@copilotkit/shared 1.5.9 → 1.5.10
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/CHANGELOG.md +4 -0
- package/dist/chunk-6QGXWNS5.mjs +34 -0
- package/dist/chunk-6QGXWNS5.mjs.map +1 -0
- package/dist/chunk-BANDZXMP.mjs +1 -0
- package/dist/chunk-BANDZXMP.mjs.map +1 -0
- package/dist/chunk-CYDWEPFL.mjs +1 -0
- package/dist/chunk-CYDWEPFL.mjs.map +1 -0
- package/dist/chunk-FCCOSO5L.mjs +1 -0
- package/dist/chunk-FCCOSO5L.mjs.map +1 -0
- package/dist/chunk-GYZIHHE6.mjs +13 -0
- package/dist/chunk-GYZIHHE6.mjs.map +1 -0
- package/dist/chunk-IAFBVORQ.mjs +1 -0
- package/dist/chunk-IAFBVORQ.mjs.map +1 -0
- package/dist/chunk-JP2M4U4G.mjs +112 -0
- package/dist/chunk-JP2M4U4G.mjs.map +1 -0
- package/dist/chunk-MSUB6DGR.mjs +1 -0
- package/dist/chunk-MSUB6DGR.mjs.map +1 -0
- package/dist/chunk-NAFEBKSO.mjs +1 -0
- package/dist/chunk-NAFEBKSO.mjs.map +1 -0
- package/dist/chunk-P7STFMPO.mjs +1 -0
- package/dist/chunk-P7STFMPO.mjs.map +1 -0
- package/dist/chunk-QFITLWYZ.mjs +96 -0
- package/dist/chunk-QFITLWYZ.mjs.map +1 -0
- package/dist/chunk-RIPX6APP.mjs +10 -0
- package/dist/chunk-RIPX6APP.mjs.map +1 -0
- package/dist/constants/index.d.ts +6 -0
- package/dist/constants/index.js +40 -0
- package/dist/constants/index.js.map +1 -0
- package/dist/constants/index.mjs +13 -0
- package/dist/constants/index.mjs.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +285 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +42 -0
- package/dist/index.mjs.map +1 -0
- package/dist/telemetry/events.d.ts +39 -0
- package/dist/telemetry/events.js +19 -0
- package/dist/telemetry/events.js.map +1 -0
- package/dist/telemetry/events.mjs +1 -0
- package/dist/telemetry/events.mjs.map +1 -0
- package/dist/telemetry/index.d.ts +3 -0
- package/dist/telemetry/index.js +144 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/index.mjs +9 -0
- package/dist/telemetry/index.mjs.map +1 -0
- package/dist/telemetry/security-check.d.ts +2 -0
- package/dist/telemetry/security-check.js +2 -0
- package/dist/telemetry/security-check.js.map +1 -0
- package/dist/telemetry/security-check.mjs +1 -0
- package/dist/telemetry/security-check.mjs.map +1 -0
- package/dist/telemetry/telemetry-client.d.ts +33 -0
- package/dist/telemetry/telemetry-client.js +142 -0
- package/dist/telemetry/telemetry-client.js.map +1 -0
- package/dist/telemetry/telemetry-client.mjs +8 -0
- package/dist/telemetry/telemetry-client.mjs.map +1 -0
- package/dist/telemetry/utils.d.ts +8 -0
- package/dist/telemetry/utils.js +69 -0
- package/dist/telemetry/utils.js.map +1 -0
- package/dist/telemetry/utils.mjs +9 -0
- package/dist/telemetry/utils.mjs.map +1 -0
- package/dist/types/action.d.ts +58 -0
- package/dist/types/action.js +19 -0
- package/dist/types/action.js.map +1 -0
- package/dist/types/action.mjs +2 -0
- package/dist/types/action.mjs.map +1 -0
- package/dist/types/copilot-cloud-config.d.ts +13 -0
- package/dist/types/copilot-cloud-config.js +19 -0
- package/dist/types/copilot-cloud-config.js.map +1 -0
- package/dist/types/copilot-cloud-config.mjs +2 -0
- package/dist/types/copilot-cloud-config.mjs.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.js +19 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/index.mjs +6 -0
- package/dist/types/index.mjs.map +1 -0
- package/dist/types/openai-assistant.d.ts +53 -0
- package/dist/types/openai-assistant.js +19 -0
- package/dist/types/openai-assistant.js.map +1 -0
- package/dist/types/openai-assistant.mjs +2 -0
- package/dist/types/openai-assistant.mjs.map +1 -0
- package/dist/types/utility.d.ts +3 -0
- package/dist/types/utility.js +19 -0
- package/dist/types/utility.js.map +1 -0
- package/dist/types/utility.mjs +2 -0
- package/dist/types/utility.mjs.map +1 -0
- package/dist/utils/index.d.ts +4 -0
- package/dist/utils/index.js +147 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/index.mjs +14 -0
- package/dist/utils/index.mjs.map +1 -0
- package/dist/utils/json-schema.d.ts +32 -0
- package/dist/utils/json-schema.js +137 -0
- package/dist/utils/json-schema.js.map +1 -0
- package/dist/utils/json-schema.mjs +9 -0
- package/dist/utils/json-schema.mjs.map +1 -0
- package/dist/utils/json-schema.test.d.ts +2 -0
- package/dist/utils/json-schema.test.js +173 -0
- package/dist/utils/json-schema.test.js.map +1 -0
- package/dist/utils/json-schema.test.mjs +140 -0
- package/dist/utils/json-schema.test.mjs.map +1 -0
- package/dist/utils/random-id.d.ts +3 -0
- package/dist/utils/random-id.js +34 -0
- package/dist/utils/random-id.js.map +1 -0
- package/dist/utils/random-id.mjs +7 -0
- package/dist/utils/random-id.mjs.map +1 -0
- package/package.json +1 -1
package/dist/index.js
ADDED
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
COPILOTKIT_VERSION: () => COPILOTKIT_VERSION,
|
|
34
|
+
COPILOT_CLOUD_API_URL: () => COPILOT_CLOUD_API_URL,
|
|
35
|
+
COPILOT_CLOUD_CHAT_URL: () => COPILOT_CLOUD_CHAT_URL,
|
|
36
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER: () => COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
37
|
+
COPILOT_CLOUD_VERSION: () => COPILOT_CLOUD_VERSION,
|
|
38
|
+
TelemetryClient: () => TelemetryClient,
|
|
39
|
+
actionParametersToJsonSchema: () => actionParametersToJsonSchema,
|
|
40
|
+
convertJsonSchemaToZodSchema: () => convertJsonSchemaToZodSchema,
|
|
41
|
+
randomId: () => randomId
|
|
42
|
+
});
|
|
43
|
+
module.exports = __toCommonJS(src_exports);
|
|
44
|
+
|
|
45
|
+
// src/utils/json-schema.ts
|
|
46
|
+
var import_zod = require("zod");
|
|
47
|
+
function actionParametersToJsonSchema(actionParameters) {
|
|
48
|
+
let parameters = {};
|
|
49
|
+
for (let parameter of actionParameters || []) {
|
|
50
|
+
parameters[parameter.name] = convertAttribute(parameter);
|
|
51
|
+
}
|
|
52
|
+
let requiredParameterNames = [];
|
|
53
|
+
for (let arg of actionParameters || []) {
|
|
54
|
+
if (arg.required !== false) {
|
|
55
|
+
requiredParameterNames.push(arg.name);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
return {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: parameters,
|
|
61
|
+
required: requiredParameterNames
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function convertAttribute(attribute) {
|
|
65
|
+
var _a, _b, _c;
|
|
66
|
+
switch (attribute.type) {
|
|
67
|
+
case "string":
|
|
68
|
+
return {
|
|
69
|
+
type: "string",
|
|
70
|
+
description: attribute.description,
|
|
71
|
+
...attribute.enum && { enum: attribute.enum }
|
|
72
|
+
};
|
|
73
|
+
case "number":
|
|
74
|
+
case "boolean":
|
|
75
|
+
return {
|
|
76
|
+
type: attribute.type,
|
|
77
|
+
description: attribute.description
|
|
78
|
+
};
|
|
79
|
+
case "object":
|
|
80
|
+
case "object[]":
|
|
81
|
+
const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
|
|
82
|
+
(acc, attr) => {
|
|
83
|
+
acc[attr.name] = convertAttribute(attr);
|
|
84
|
+
return acc;
|
|
85
|
+
},
|
|
86
|
+
{}
|
|
87
|
+
);
|
|
88
|
+
const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
|
|
89
|
+
if (attribute.type === "object[]") {
|
|
90
|
+
return {
|
|
91
|
+
type: "array",
|
|
92
|
+
items: {
|
|
93
|
+
type: "object",
|
|
94
|
+
...properties && { properties },
|
|
95
|
+
...required && required.length > 0 && { required }
|
|
96
|
+
},
|
|
97
|
+
description: attribute.description
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return {
|
|
101
|
+
type: "object",
|
|
102
|
+
description: attribute.description,
|
|
103
|
+
...properties && { properties },
|
|
104
|
+
...required && required.length > 0 && { required }
|
|
105
|
+
};
|
|
106
|
+
default:
|
|
107
|
+
if ((_c = attribute.type) == null ? void 0 : _c.endsWith("[]")) {
|
|
108
|
+
const itemType = attribute.type.slice(0, -2);
|
|
109
|
+
return {
|
|
110
|
+
type: "array",
|
|
111
|
+
items: { type: itemType },
|
|
112
|
+
description: attribute.description
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
type: "string",
|
|
117
|
+
description: attribute.description
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
122
|
+
if (jsonSchema.type === "object") {
|
|
123
|
+
const spec = {};
|
|
124
|
+
if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {
|
|
125
|
+
return !required ? import_zod.z.object(spec).optional() : import_zod.z.object(spec);
|
|
126
|
+
}
|
|
127
|
+
for (const [key, value] of Object.entries(jsonSchema.properties)) {
|
|
128
|
+
spec[key] = convertJsonSchemaToZodSchema(
|
|
129
|
+
value,
|
|
130
|
+
jsonSchema.required ? jsonSchema.required.includes(key) : false
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
let schema = import_zod.z.object(spec).describe(jsonSchema.description);
|
|
134
|
+
return required ? schema : schema.optional();
|
|
135
|
+
} else if (jsonSchema.type === "string") {
|
|
136
|
+
let schema = import_zod.z.string().describe(jsonSchema.description);
|
|
137
|
+
return required ? schema : schema.optional();
|
|
138
|
+
} else if (jsonSchema.type === "number") {
|
|
139
|
+
let schema = import_zod.z.number().describe(jsonSchema.description);
|
|
140
|
+
return required ? schema : schema.optional();
|
|
141
|
+
} else if (jsonSchema.type === "boolean") {
|
|
142
|
+
let schema = import_zod.z.boolean().describe(jsonSchema.description);
|
|
143
|
+
return required ? schema : schema.optional();
|
|
144
|
+
} else if (jsonSchema.type === "array") {
|
|
145
|
+
let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
|
|
146
|
+
let schema = import_zod.z.array(itemSchema).describe(jsonSchema.description);
|
|
147
|
+
return required ? schema : schema.optional();
|
|
148
|
+
}
|
|
149
|
+
throw new Error("Invalid JSON schema");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/utils/random-id.ts
|
|
153
|
+
var import_uuid = require("uuid");
|
|
154
|
+
function randomId() {
|
|
155
|
+
return "ck-" + (0, import_uuid.v4)();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// src/constants/index.ts
|
|
159
|
+
var COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
160
|
+
var COPILOT_CLOUD_VERSION = "v1";
|
|
161
|
+
var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
|
|
162
|
+
var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
163
|
+
|
|
164
|
+
// src/telemetry/telemetry-client.ts
|
|
165
|
+
var import_analytics_node = require("@segment/analytics-node");
|
|
166
|
+
|
|
167
|
+
// src/telemetry/utils.ts
|
|
168
|
+
var import_chalk = __toESM(require("chalk"));
|
|
169
|
+
function flattenObject(obj, parentKey = "", res = {}) {
|
|
170
|
+
for (let key in obj) {
|
|
171
|
+
const propName = parentKey ? `${parentKey}.${key}` : key;
|
|
172
|
+
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
173
|
+
flattenObject(obj[key], propName, res);
|
|
174
|
+
} else {
|
|
175
|
+
res[propName] = obj[key];
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return res;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// src/telemetry/telemetry-client.ts
|
|
182
|
+
var import_uuid2 = require("uuid");
|
|
183
|
+
var TelemetryClient = class {
|
|
184
|
+
constructor({
|
|
185
|
+
packageName,
|
|
186
|
+
packageVersion,
|
|
187
|
+
telemetryDisabled,
|
|
188
|
+
telemetryBaseUrl,
|
|
189
|
+
sampleRate
|
|
190
|
+
}) {
|
|
191
|
+
this.globalProperties = {};
|
|
192
|
+
this.cloudConfiguration = null;
|
|
193
|
+
this.telemetryDisabled = false;
|
|
194
|
+
this.sampleRate = 0.05;
|
|
195
|
+
this.anonymousId = `anon_${(0, import_uuid2.v4)()}`;
|
|
196
|
+
this.packageName = packageName;
|
|
197
|
+
this.packageVersion = packageVersion;
|
|
198
|
+
this.telemetryDisabled = telemetryDisabled || process.env.COPILOTKIT_TELEMETRY_DISABLED === "true" || process.env.COPILOTKIT_TELEMETRY_DISABLED === "1" || process.env.DO_NOT_TRACK === "true" || process.env.DO_NOT_TRACK === "1";
|
|
199
|
+
if (this.telemetryDisabled) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
this.setSampleRate(sampleRate);
|
|
203
|
+
const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || "n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja";
|
|
204
|
+
this.segment = new import_analytics_node.Analytics({
|
|
205
|
+
writeKey
|
|
206
|
+
});
|
|
207
|
+
this.setGlobalProperties({
|
|
208
|
+
"copilotkit.package.name": packageName,
|
|
209
|
+
"copilotkit.package.version": packageVersion
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
shouldSendEvent() {
|
|
213
|
+
const randomNumber = Math.random();
|
|
214
|
+
return randomNumber < this.sampleRate;
|
|
215
|
+
}
|
|
216
|
+
async capture(event, properties) {
|
|
217
|
+
if (!this.shouldSendEvent() || !this.segment) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const flattenedProperties = flattenObject(properties);
|
|
221
|
+
const propertiesWithGlobal = {
|
|
222
|
+
...this.globalProperties,
|
|
223
|
+
...flattenedProperties
|
|
224
|
+
};
|
|
225
|
+
const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal).sort().reduce(
|
|
226
|
+
(obj, key) => {
|
|
227
|
+
obj[key] = propertiesWithGlobal[key];
|
|
228
|
+
return obj;
|
|
229
|
+
},
|
|
230
|
+
{}
|
|
231
|
+
);
|
|
232
|
+
this.segment.track({
|
|
233
|
+
anonymousId: this.anonymousId,
|
|
234
|
+
event,
|
|
235
|
+
properties: { ...orderedPropertiesWithGlobal }
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
setGlobalProperties(properties) {
|
|
239
|
+
const flattenedProperties = flattenObject(properties);
|
|
240
|
+
this.globalProperties = { ...this.globalProperties, ...flattenedProperties };
|
|
241
|
+
}
|
|
242
|
+
setCloudConfiguration(properties) {
|
|
243
|
+
this.cloudConfiguration = properties;
|
|
244
|
+
this.setGlobalProperties({
|
|
245
|
+
cloud: {
|
|
246
|
+
publicApiKey: properties.publicApiKey,
|
|
247
|
+
baseUrl: properties.baseUrl
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
setSampleRate(sampleRate) {
|
|
252
|
+
let _sampleRate;
|
|
253
|
+
_sampleRate = sampleRate ?? 0.05;
|
|
254
|
+
if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {
|
|
255
|
+
_sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);
|
|
256
|
+
}
|
|
257
|
+
if (_sampleRate < 0 || _sampleRate > 1) {
|
|
258
|
+
throw new Error("Sample rate must be between 0 and 1");
|
|
259
|
+
}
|
|
260
|
+
this.sampleRate = _sampleRate;
|
|
261
|
+
this.setGlobalProperties({
|
|
262
|
+
sampleRate: this.sampleRate,
|
|
263
|
+
sampleRateAdjustmentFactor: 1 - this.sampleRate
|
|
264
|
+
});
|
|
265
|
+
}
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
// package.json
|
|
269
|
+
var version = "1.5.10";
|
|
270
|
+
|
|
271
|
+
// src/index.ts
|
|
272
|
+
var COPILOTKIT_VERSION = version;
|
|
273
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
274
|
+
0 && (module.exports = {
|
|
275
|
+
COPILOTKIT_VERSION,
|
|
276
|
+
COPILOT_CLOUD_API_URL,
|
|
277
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
278
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
279
|
+
COPILOT_CLOUD_VERSION,
|
|
280
|
+
TelemetryClient,
|
|
281
|
+
actionParametersToJsonSchema,
|
|
282
|
+
convertJsonSchemaToZodSchema,
|
|
283
|
+
randomId
|
|
284
|
+
});
|
|
285
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils/json-schema.ts","../src/utils/random-id.ts","../src/constants/index.ts","../src/telemetry/telemetry-client.ts","../src/telemetry/utils.ts","../package.json"],"sourcesContent":["export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n","import { z } from \"zod\";\nimport { Parameter } from \"../types\";\n\nexport type JSONSchemaString = {\n type: \"string\";\n description?: string;\n enum?: string[];\n};\n\nexport type JSONSchemaNumber = {\n type: \"number\";\n description?: string;\n};\n\nexport type JSONSchemaBoolean = {\n type: \"boolean\";\n description?: string;\n};\n\nexport type JSONSchemaObject = {\n type: \"object\";\n properties?: Record<string, JSONSchema>;\n required?: string[];\n description?: string;\n};\n\nexport type JSONSchemaArray = {\n type: \"array\";\n items: JSONSchema;\n description?: string;\n};\n\nexport type JSONSchema =\n | JSONSchemaString\n | JSONSchemaNumber\n | JSONSchemaBoolean\n | JSONSchemaObject\n | JSONSchemaArray;\n\nexport function actionParametersToJsonSchema(actionParameters: Parameter[]): JSONSchema {\n // Create the parameters object based on the argumentAnnotations\n let parameters: { [key: string]: any } = {};\n for (let parameter of actionParameters || []) {\n parameters[parameter.name] = convertAttribute(parameter);\n }\n\n let requiredParameterNames: string[] = [];\n for (let arg of actionParameters || []) {\n if (arg.required !== false) {\n requiredParameterNames.push(arg.name);\n }\n }\n\n // Create the ChatCompletionFunctions object\n return {\n type: \"object\",\n properties: parameters,\n required: requiredParameterNames,\n };\n}\n\nfunction convertAttribute(attribute: Parameter): JSONSchema {\n switch (attribute.type) {\n case \"string\":\n return {\n type: \"string\",\n description: attribute.description,\n ...(attribute.enum && { enum: attribute.enum }),\n };\n case \"number\":\n case \"boolean\":\n return {\n type: attribute.type,\n description: attribute.description,\n };\n case \"object\":\n case \"object[]\":\n const properties = attribute.attributes?.reduce(\n (acc, attr) => {\n acc[attr.name] = convertAttribute(attr);\n return acc;\n },\n {} as Record<string, any>,\n );\n const required = attribute.attributes\n ?.filter((attr) => attr.required !== false)\n .map((attr) => attr.name);\n if (attribute.type === \"object[]\") {\n return {\n type: \"array\",\n items: {\n type: \"object\",\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n },\n description: attribute.description,\n };\n }\n return {\n type: \"object\",\n description: attribute.description,\n ...(properties && { properties }),\n ...(required && required.length > 0 && { required }),\n };\n default:\n // Handle arrays of primitive types and undefined attribute.type\n if (attribute.type?.endsWith(\"[]\")) {\n const itemType = attribute.type.slice(0, -2);\n return {\n type: \"array\",\n items: { type: itemType as any },\n description: attribute.description,\n };\n }\n // Fallback for undefined type or any other unexpected type\n return {\n type: \"string\",\n description: attribute.description,\n };\n }\n}\n\nexport function convertJsonSchemaToZodSchema(jsonSchema: any, required: boolean): z.ZodSchema {\n if (jsonSchema.type === \"object\") {\n const spec: { [key: string]: z.ZodSchema } = {};\n\n if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {\n return !required ? z.object(spec).optional() : z.object(spec);\n }\n\n for (const [key, value] of Object.entries(jsonSchema.properties)) {\n spec[key] = convertJsonSchemaToZodSchema(\n value,\n jsonSchema.required ? jsonSchema.required.includes(key) : false,\n );\n }\n let schema = z.object(spec).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"string\") {\n let schema = z.string().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"number\") {\n let schema = z.number().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"boolean\") {\n let schema = z.boolean().describe(jsonSchema.description);\n return required ? schema : schema.optional();\n } else if (jsonSchema.type === \"array\") {\n let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);\n let schema = z.array(itemSchema).describe(jsonSchema.description);\n return required ? schema : schema.optional();\n }\n throw new Error(\"Invalid JSON schema\");\n}\n","import { v4 as uuidv4 } from \"uuid\";\n\nexport function randomId() {\n return \"ck-\" + uuidv4();\n}\n","export const COPILOT_CLOUD_API_URL = \"https://api.cloud.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = \"X-CopilotCloud-Public-Api-Key\";\n","import { Analytics } from \"@segment/analytics-node\";\nimport { AnalyticsEvents } from \"./events\";\nimport { flattenObject, printSecurityNotice } from \"./utils\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport class TelemetryClient {\n segment: Analytics | undefined;\n globalProperties: Record<string, any> = {};\n cloudConfiguration: { publicApiKey: string; baseUrl: string } | null = null;\n packageName: string;\n packageVersion: string;\n private telemetryDisabled: boolean = false;\n private sampleRate: number = 0.05;\n private anonymousId = `anon_${uuidv4()}`;\n\n constructor({\n packageName,\n packageVersion,\n telemetryDisabled,\n telemetryBaseUrl,\n sampleRate,\n }: {\n packageName: string;\n packageVersion: string;\n telemetryDisabled?: boolean;\n telemetryBaseUrl?: string;\n sampleRate?: number;\n }) {\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.telemetryDisabled =\n telemetryDisabled ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n (process.env as any).DO_NOT_TRACK === \"true\" ||\n (process.env as any).DO_NOT_TRACK === \"1\";\n\n if (this.telemetryDisabled) {\n return;\n }\n\n this.setSampleRate(sampleRate);\n\n // eslint-disable-next-line\n const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || \"n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja\";\n\n this.segment = new Analytics({\n writeKey,\n });\n\n this.setGlobalProperties({\n \"copilotkit.package.name\": packageName,\n \"copilotkit.package.version\": packageVersion,\n });\n }\n\n private shouldSendEvent() {\n const randomNumber = Math.random();\n return randomNumber < this.sampleRate;\n }\n\n async capture<K extends keyof AnalyticsEvents>(event: K, properties: AnalyticsEvents[K]) {\n if (!this.shouldSendEvent() || !this.segment) {\n return;\n }\n\n const flattenedProperties = flattenObject(properties);\n const propertiesWithGlobal = {\n ...this.globalProperties,\n ...flattenedProperties,\n };\n const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal)\n .sort()\n .reduce(\n (obj, key) => {\n obj[key] = propertiesWithGlobal[key];\n return obj;\n },\n {} as Record<string, any>,\n );\n\n this.segment.track({\n anonymousId: this.anonymousId,\n event,\n properties: { ...orderedPropertiesWithGlobal },\n });\n }\n\n setGlobalProperties(properties: Record<string, any>) {\n const flattenedProperties = flattenObject(properties);\n this.globalProperties = { ...this.globalProperties, ...flattenedProperties };\n }\n\n setCloudConfiguration(properties: { publicApiKey: string; baseUrl: string }) {\n this.cloudConfiguration = properties;\n\n this.setGlobalProperties({\n cloud: {\n publicApiKey: properties.publicApiKey,\n baseUrl: properties.baseUrl,\n },\n });\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 0.05;\n\n // eslint-disable-next-line\n if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n // eslint-disable-next-line\n _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n if (_sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.sampleRate = _sampleRate;\n this.setGlobalProperties({\n sampleRate: this.sampleRate,\n sampleRateAdjustmentFactor: 1 - this.sampleRate,\n });\n }\n}\n","import chalk from \"chalk\";\n\nexport function flattenObject(\n obj: Record<string, any>,\n parentKey = \"\",\n res: Record<string, any> = {},\n): Record<string, any> {\n for (let key in obj) {\n const propName = parentKey ? `${parentKey}.${key}` : key;\n if (typeof obj[key] === \"object\" && obj[key] !== null) {\n flattenObject(obj[key], propName, res);\n } else {\n res[propName] = obj[key];\n }\n }\n return res;\n}\n\nexport function printSecurityNotice(advisory: {\n advisory: string | null;\n message: string;\n severity: \"low\" | \"medium\" | \"high\" | \"none\";\n}) {\n const severityColor =\n {\n low: chalk.blue,\n medium: chalk.yellow,\n high: chalk.red,\n }[advisory.severity.toLowerCase()] || chalk.white;\n\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━ ${chalk.bold(`CopilotKit`)} ━━━━━━━━━━━━━━━━━━`);\n console.log();\n console.log(`${chalk.bold(`Severity: ${severityColor(advisory.severity.toUpperCase())}`)}`);\n console.log();\n console.log(`${chalk.bold(advisory.message)}`);\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);\n}\n","{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.5.10\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\"\n },\n \"dependencies\": {\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,iBAAkB;AAuCX,SAAS,6BAA6B,kBAA2C;AAEtF,MAAI,aAAqC,CAAC;AAC1C,WAAS,aAAa,oBAAoB,CAAC,GAAG;AAC5C,eAAW,UAAU,IAAI,IAAI,iBAAiB,SAAS;AAAA,EACzD;AAEA,MAAI,yBAAmC,CAAC;AACxC,WAAS,OAAO,oBAAoB,CAAC,GAAG;AACtC,QAAI,IAAI,aAAa,OAAO;AAC1B,6BAAuB,KAAK,IAAI,IAAI;AAAA,IACtC;AAAA,EACF;AAGA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,YA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AI,KAAK;AAAA,IACvC,CAAC;AAAA,EACH;AACF;;;AElHE,cAAW;;;ANLN,IAAM,qBAAiC;","names":["uuidv4","import_uuid","uuidv4"]}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import "./chunk-BANDZXMP.mjs";
|
|
2
|
+
import "./chunk-MSUB6DGR.mjs";
|
|
3
|
+
import "./chunk-IAFBVORQ.mjs";
|
|
4
|
+
import "./chunk-FCCOSO5L.mjs";
|
|
5
|
+
import "./chunk-CYDWEPFL.mjs";
|
|
6
|
+
import {
|
|
7
|
+
actionParametersToJsonSchema,
|
|
8
|
+
convertJsonSchemaToZodSchema
|
|
9
|
+
} from "./chunk-JP2M4U4G.mjs";
|
|
10
|
+
import {
|
|
11
|
+
randomId
|
|
12
|
+
} from "./chunk-RIPX6APP.mjs";
|
|
13
|
+
import {
|
|
14
|
+
COPILOT_CLOUD_API_URL,
|
|
15
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
16
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
17
|
+
COPILOT_CLOUD_VERSION
|
|
18
|
+
} from "./chunk-GYZIHHE6.mjs";
|
|
19
|
+
import "./chunk-P7STFMPO.mjs";
|
|
20
|
+
import {
|
|
21
|
+
TelemetryClient
|
|
22
|
+
} from "./chunk-QFITLWYZ.mjs";
|
|
23
|
+
import "./chunk-6QGXWNS5.mjs";
|
|
24
|
+
import "./chunk-NAFEBKSO.mjs";
|
|
25
|
+
|
|
26
|
+
// package.json
|
|
27
|
+
var version = "1.5.10";
|
|
28
|
+
|
|
29
|
+
// src/index.ts
|
|
30
|
+
var COPILOTKIT_VERSION = version;
|
|
31
|
+
export {
|
|
32
|
+
COPILOTKIT_VERSION,
|
|
33
|
+
COPILOT_CLOUD_API_URL,
|
|
34
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
35
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
36
|
+
COPILOT_CLOUD_VERSION,
|
|
37
|
+
TelemetryClient,
|
|
38
|
+
actionParametersToJsonSchema,
|
|
39
|
+
convertJsonSchemaToZodSchema,
|
|
40
|
+
randomId
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/index.ts"],"sourcesContent":["{\n \"name\": \"@copilotkit/shared\",\n \"private\": false,\n \"homepage\": \"https://github.com/CopilotKit/CopilotKit\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/CopilotKit/CopilotKit.git\"\n },\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"version\": \"1.5.10\",\n \"sideEffects\": false,\n \"main\": \"./dist/index.js\",\n \"module\": \"./dist/index.mjs\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.mjs\",\n \"require\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\"\n }\n },\n \"types\": \"./dist/index.d.ts\",\n \"license\": \"MIT\",\n \"scripts\": {\n \"build\": \"tsup --clean\",\n \"dev\": \"tsup --watch --no-splitting\",\n \"test\": \"jest --passWithNoTests\",\n \"check-types\": \"tsc --noEmit\",\n \"clean\": \"rm -rf .turbo && rm -rf node_modules && rm -rf dist && rm -rf .next\",\n \"link:global\": \"pnpm link --global\",\n \"unlink:global\": \"pnpm unlink --global\"\n },\n \"devDependencies\": {\n \"@types/jest\": \"^29.5.4\",\n \"@types/uuid\": \"^10.0.0\",\n \"eslint\": \"^8.56.0\",\n \"eslint-config-custom\": \"workspace:*\",\n \"jest\": \"^29.6.4\",\n \"ts-jest\": \"^29.1.1\",\n \"tsconfig\": \"workspace:*\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.2.3\"\n },\n \"dependencies\": {\n \"@segment/analytics-node\": \"^2.1.2\",\n \"chalk\": \"4.1.2\",\n \"uuid\": \"^10.0.0\",\n \"zod\": \"^3.23.3\",\n \"zod-to-json-schema\": \"^3.23.5\"\n },\n \"keywords\": [\n \"copilotkit\",\n \"copilot\",\n \"react\",\n \"nextjs\",\n \"nodejs\",\n \"ai\",\n \"assistant\",\n \"javascript\",\n \"automation\",\n \"textarea\"\n ]\n}\n","export * from \"./types\";\nexport * from \"./utils\";\nexport * from \"./constants\";\nexport * from \"./telemetry\";\n\nimport * as packageJson from \"../package.json\";\nexport const COPILOTKIT_VERSION = packageJson.version;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAWE,cAAW;;;ACLN,IAAM,qBAAiC;","names":[]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
type AnalyticsEvents = {
|
|
2
|
+
"oss.runtime.instance_created": RuntimeInstanceCreatedInfo;
|
|
3
|
+
"oss.runtime.copilot_request_created": {
|
|
4
|
+
"cloud.guardrails.enabled": boolean;
|
|
5
|
+
requestType: string;
|
|
6
|
+
};
|
|
7
|
+
"oss.runtime.server_action_executed": {};
|
|
8
|
+
"oss.runtime.remote_action_executed": RemoteActionExecutionInfo;
|
|
9
|
+
"oss.runtime.agent_execution_stream_started": {
|
|
10
|
+
hashedLgcKey?: string;
|
|
11
|
+
};
|
|
12
|
+
"oss.runtime.agent_execution_stream_ended": AgentExecutionResponseInfo;
|
|
13
|
+
"oss.runtime.agent_execution_stream_errored": {
|
|
14
|
+
hashedLgcKey?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
interface RuntimeInstanceCreatedInfo {
|
|
19
|
+
actionsAmount: number;
|
|
20
|
+
endpointTypes: string[];
|
|
21
|
+
hashedLgcKey?: string;
|
|
22
|
+
endpointsAmount: number;
|
|
23
|
+
agentsAmount?: number | null;
|
|
24
|
+
}
|
|
25
|
+
interface RemoteActionExecutionInfo {
|
|
26
|
+
agentExecution: boolean;
|
|
27
|
+
type: "self-hosted" | "langgraph-platform";
|
|
28
|
+
agentsAmount?: number | null;
|
|
29
|
+
hashedLgcKey?: string;
|
|
30
|
+
}
|
|
31
|
+
interface AgentExecutionResponseInfo {
|
|
32
|
+
provider?: string;
|
|
33
|
+
model?: string;
|
|
34
|
+
langGraphHost?: string;
|
|
35
|
+
langGraphVersion?: string;
|
|
36
|
+
hashedLgcKey?: string;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { AgentExecutionResponseInfo, AnalyticsEvents, RemoteActionExecutionInfo, RuntimeInstanceCreatedInfo };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/telemetry/events.ts
|
|
17
|
+
var events_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(events_exports);
|
|
19
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/events.ts"],"sourcesContent":["export type AnalyticsEvents = {\n \"oss.runtime.instance_created\": RuntimeInstanceCreatedInfo;\n \"oss.runtime.copilot_request_created\": {\n \"cloud.guardrails.enabled\": boolean;\n requestType: string;\n };\n \"oss.runtime.server_action_executed\": {};\n \"oss.runtime.remote_action_executed\": RemoteActionExecutionInfo;\n \"oss.runtime.agent_execution_stream_started\": { hashedLgcKey?: string };\n \"oss.runtime.agent_execution_stream_ended\": AgentExecutionResponseInfo;\n \"oss.runtime.agent_execution_stream_errored\": { hashedLgcKey?: string; error?: string };\n};\n\nexport interface RuntimeInstanceCreatedInfo {\n actionsAmount: number;\n endpointTypes: string[];\n hashedLgcKey?: string;\n endpointsAmount: number;\n agentsAmount?: number | null;\n}\n\nexport interface RemoteActionExecutionInfo {\n agentExecution: boolean;\n type: \"self-hosted\" | \"langgraph-platform\";\n agentsAmount?: number | null;\n hashedLgcKey?: string;\n}\n\nexport interface AgentExecutionResponseInfo {\n provider?: string;\n model?: string;\n langGraphHost?: string;\n langGraphVersion?: string;\n hashedLgcKey?: string;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=events.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/telemetry/index.ts
|
|
31
|
+
var telemetry_exports = {};
|
|
32
|
+
__export(telemetry_exports, {
|
|
33
|
+
TelemetryClient: () => TelemetryClient
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(telemetry_exports);
|
|
36
|
+
|
|
37
|
+
// src/telemetry/telemetry-client.ts
|
|
38
|
+
var import_analytics_node = require("@segment/analytics-node");
|
|
39
|
+
|
|
40
|
+
// src/telemetry/utils.ts
|
|
41
|
+
var import_chalk = __toESM(require("chalk"));
|
|
42
|
+
function flattenObject(obj, parentKey = "", res = {}) {
|
|
43
|
+
for (let key in obj) {
|
|
44
|
+
const propName = parentKey ? `${parentKey}.${key}` : key;
|
|
45
|
+
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
46
|
+
flattenObject(obj[key], propName, res);
|
|
47
|
+
} else {
|
|
48
|
+
res[propName] = obj[key];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return res;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/telemetry/telemetry-client.ts
|
|
55
|
+
var import_uuid = require("uuid");
|
|
56
|
+
var TelemetryClient = class {
|
|
57
|
+
constructor({
|
|
58
|
+
packageName,
|
|
59
|
+
packageVersion,
|
|
60
|
+
telemetryDisabled,
|
|
61
|
+
telemetryBaseUrl,
|
|
62
|
+
sampleRate
|
|
63
|
+
}) {
|
|
64
|
+
this.globalProperties = {};
|
|
65
|
+
this.cloudConfiguration = null;
|
|
66
|
+
this.telemetryDisabled = false;
|
|
67
|
+
this.sampleRate = 0.05;
|
|
68
|
+
this.anonymousId = `anon_${(0, import_uuid.v4)()}`;
|
|
69
|
+
this.packageName = packageName;
|
|
70
|
+
this.packageVersion = packageVersion;
|
|
71
|
+
this.telemetryDisabled = telemetryDisabled || process.env.COPILOTKIT_TELEMETRY_DISABLED === "true" || process.env.COPILOTKIT_TELEMETRY_DISABLED === "1" || process.env.DO_NOT_TRACK === "true" || process.env.DO_NOT_TRACK === "1";
|
|
72
|
+
if (this.telemetryDisabled) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
this.setSampleRate(sampleRate);
|
|
76
|
+
const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || "n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja";
|
|
77
|
+
this.segment = new import_analytics_node.Analytics({
|
|
78
|
+
writeKey
|
|
79
|
+
});
|
|
80
|
+
this.setGlobalProperties({
|
|
81
|
+
"copilotkit.package.name": packageName,
|
|
82
|
+
"copilotkit.package.version": packageVersion
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
shouldSendEvent() {
|
|
86
|
+
const randomNumber = Math.random();
|
|
87
|
+
return randomNumber < this.sampleRate;
|
|
88
|
+
}
|
|
89
|
+
async capture(event, properties) {
|
|
90
|
+
if (!this.shouldSendEvent() || !this.segment) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
const flattenedProperties = flattenObject(properties);
|
|
94
|
+
const propertiesWithGlobal = {
|
|
95
|
+
...this.globalProperties,
|
|
96
|
+
...flattenedProperties
|
|
97
|
+
};
|
|
98
|
+
const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal).sort().reduce(
|
|
99
|
+
(obj, key) => {
|
|
100
|
+
obj[key] = propertiesWithGlobal[key];
|
|
101
|
+
return obj;
|
|
102
|
+
},
|
|
103
|
+
{}
|
|
104
|
+
);
|
|
105
|
+
this.segment.track({
|
|
106
|
+
anonymousId: this.anonymousId,
|
|
107
|
+
event,
|
|
108
|
+
properties: { ...orderedPropertiesWithGlobal }
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
setGlobalProperties(properties) {
|
|
112
|
+
const flattenedProperties = flattenObject(properties);
|
|
113
|
+
this.globalProperties = { ...this.globalProperties, ...flattenedProperties };
|
|
114
|
+
}
|
|
115
|
+
setCloudConfiguration(properties) {
|
|
116
|
+
this.cloudConfiguration = properties;
|
|
117
|
+
this.setGlobalProperties({
|
|
118
|
+
cloud: {
|
|
119
|
+
publicApiKey: properties.publicApiKey,
|
|
120
|
+
baseUrl: properties.baseUrl
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
setSampleRate(sampleRate) {
|
|
125
|
+
let _sampleRate;
|
|
126
|
+
_sampleRate = sampleRate ?? 0.05;
|
|
127
|
+
if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {
|
|
128
|
+
_sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);
|
|
129
|
+
}
|
|
130
|
+
if (_sampleRate < 0 || _sampleRate > 1) {
|
|
131
|
+
throw new Error("Sample rate must be between 0 and 1");
|
|
132
|
+
}
|
|
133
|
+
this.sampleRate = _sampleRate;
|
|
134
|
+
this.setGlobalProperties({
|
|
135
|
+
sampleRate: this.sampleRate,
|
|
136
|
+
sampleRateAdjustmentFactor: 1 - this.sampleRate
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
141
|
+
0 && (module.exports = {
|
|
142
|
+
TelemetryClient
|
|
143
|
+
});
|
|
144
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/index.ts","../../src/telemetry/telemetry-client.ts","../../src/telemetry/utils.ts"],"sourcesContent":["export * from \"./telemetry-client\";\n","import { Analytics } from \"@segment/analytics-node\";\nimport { AnalyticsEvents } from \"./events\";\nimport { flattenObject, printSecurityNotice } from \"./utils\";\nimport { v4 as uuidv4 } from \"uuid\";\n\nexport class TelemetryClient {\n segment: Analytics | undefined;\n globalProperties: Record<string, any> = {};\n cloudConfiguration: { publicApiKey: string; baseUrl: string } | null = null;\n packageName: string;\n packageVersion: string;\n private telemetryDisabled: boolean = false;\n private sampleRate: number = 0.05;\n private anonymousId = `anon_${uuidv4()}`;\n\n constructor({\n packageName,\n packageVersion,\n telemetryDisabled,\n telemetryBaseUrl,\n sampleRate,\n }: {\n packageName: string;\n packageVersion: string;\n telemetryDisabled?: boolean;\n telemetryBaseUrl?: string;\n sampleRate?: number;\n }) {\n this.packageName = packageName;\n this.packageVersion = packageVersion;\n this.telemetryDisabled =\n telemetryDisabled ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"true\" ||\n (process.env as any).COPILOTKIT_TELEMETRY_DISABLED === \"1\" ||\n (process.env as any).DO_NOT_TRACK === \"true\" ||\n (process.env as any).DO_NOT_TRACK === \"1\";\n\n if (this.telemetryDisabled) {\n return;\n }\n\n this.setSampleRate(sampleRate);\n\n // eslint-disable-next-line\n const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || \"n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja\";\n\n this.segment = new Analytics({\n writeKey,\n });\n\n this.setGlobalProperties({\n \"copilotkit.package.name\": packageName,\n \"copilotkit.package.version\": packageVersion,\n });\n }\n\n private shouldSendEvent() {\n const randomNumber = Math.random();\n return randomNumber < this.sampleRate;\n }\n\n async capture<K extends keyof AnalyticsEvents>(event: K, properties: AnalyticsEvents[K]) {\n if (!this.shouldSendEvent() || !this.segment) {\n return;\n }\n\n const flattenedProperties = flattenObject(properties);\n const propertiesWithGlobal = {\n ...this.globalProperties,\n ...flattenedProperties,\n };\n const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal)\n .sort()\n .reduce(\n (obj, key) => {\n obj[key] = propertiesWithGlobal[key];\n return obj;\n },\n {} as Record<string, any>,\n );\n\n this.segment.track({\n anonymousId: this.anonymousId,\n event,\n properties: { ...orderedPropertiesWithGlobal },\n });\n }\n\n setGlobalProperties(properties: Record<string, any>) {\n const flattenedProperties = flattenObject(properties);\n this.globalProperties = { ...this.globalProperties, ...flattenedProperties };\n }\n\n setCloudConfiguration(properties: { publicApiKey: string; baseUrl: string }) {\n this.cloudConfiguration = properties;\n\n this.setGlobalProperties({\n cloud: {\n publicApiKey: properties.publicApiKey,\n baseUrl: properties.baseUrl,\n },\n });\n }\n\n private setSampleRate(sampleRate: number | undefined) {\n let _sampleRate: number;\n\n _sampleRate = sampleRate ?? 0.05;\n\n // eslint-disable-next-line\n if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {\n // eslint-disable-next-line\n _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);\n }\n\n if (_sampleRate < 0 || _sampleRate > 1) {\n throw new Error(\"Sample rate must be between 0 and 1\");\n }\n\n this.sampleRate = _sampleRate;\n this.setGlobalProperties({\n sampleRate: this.sampleRate,\n sampleRateAdjustmentFactor: 1 - this.sampleRate,\n });\n }\n}\n","import chalk from \"chalk\";\n\nexport function flattenObject(\n obj: Record<string, any>,\n parentKey = \"\",\n res: Record<string, any> = {},\n): Record<string, any> {\n for (let key in obj) {\n const propName = parentKey ? `${parentKey}.${key}` : key;\n if (typeof obj[key] === \"object\" && obj[key] !== null) {\n flattenObject(obj[key], propName, res);\n } else {\n res[propName] = obj[key];\n }\n }\n return res;\n}\n\nexport function printSecurityNotice(advisory: {\n advisory: string | null;\n message: string;\n severity: \"low\" | \"medium\" | \"high\" | \"none\";\n}) {\n const severityColor =\n {\n low: chalk.blue,\n medium: chalk.yellow,\n high: chalk.red,\n }[advisory.severity.toLowerCase()] || chalk.white;\n\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━ ${chalk.bold(`CopilotKit`)} ━━━━━━━━━━━━━━━━━━`);\n console.log();\n console.log(`${chalk.bold(`Severity: ${severityColor(advisory.severity.toUpperCase())}`)}`);\n console.log();\n console.log(`${chalk.bold(advisory.message)}`);\n console.log();\n console.log(`━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,4BAA0B;;;ACA1B,mBAAkB;AAEX,SAAS,cACd,KACA,YAAY,IACZ,MAA2B,CAAC,GACP;AACrB,WAAS,OAAO,KAAK;AACnB,UAAM,WAAW,YAAY,GAAG,aAAa,QAAQ;AACrD,QAAI,OAAO,IAAI,GAAG,MAAM,YAAY,IAAI,GAAG,MAAM,MAAM;AACrD,oBAAc,IAAI,GAAG,GAAG,UAAU,GAAG;AAAA,IACvC,OAAO;AACL,UAAI,QAAQ,IAAI,IAAI,GAAG;AAAA,IACzB;AAAA,EACF;AACA,SAAO;AACT;;;ADbA,kBAA6B;AAEtB,IAAM,kBAAN,MAAsB;AAAA,EAU3B,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAMG;AApBH,4BAAwC,CAAC;AACzC,8BAAuE;AAGvE,SAAQ,oBAA6B;AACrC,SAAQ,aAAqB;AAC7B,SAAQ,cAAc,YAAQ,YAAAA,IAAO;AAenC,SAAK,cAAc;AACnB,SAAK,iBAAiB;AACtB,SAAK,oBACH,qBACC,QAAQ,IAAY,kCAAkC,UACtD,QAAQ,IAAY,kCAAkC,OACtD,QAAQ,IAAY,iBAAiB,UACrC,QAAQ,IAAY,iBAAiB;AAExC,QAAI,KAAK,mBAAmB;AAC1B;AAAA,IACF;AAEA,SAAK,cAAc,UAAU;AAG7B,UA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I,gCAAgC;AAAA,IACvE;AAEA,QAAI,cAAc,KAAK,cAAc,GAAG;AACtC,YAAM,IAAI,MAAM,qCAAqC;AAAA,IACvD;AAEA,SAAK,aAAa;AAClB,SAAK,oBAAoB;AAAA,MACvB,YAAY,KAAK;AAAA,MACjB,4BAA4B,IAAI,KAAK;AAAA,IACvC,CAAC;AAAA,EACH;AACF;","names":["uuidv4"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=security-check.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|