@copilotkit/shared 1.5.8 → 1.5.10-next.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.
- 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/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// src/telemetry/utils.ts
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
function flattenObject(obj, parentKey = "", res = {}) {
|
|
4
|
+
for (let key in obj) {
|
|
5
|
+
const propName = parentKey ? `${parentKey}.${key}` : key;
|
|
6
|
+
if (typeof obj[key] === "object" && obj[key] !== null) {
|
|
7
|
+
flattenObject(obj[key], propName, res);
|
|
8
|
+
} else {
|
|
9
|
+
res[propName] = obj[key];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
return res;
|
|
13
|
+
}
|
|
14
|
+
function printSecurityNotice(advisory) {
|
|
15
|
+
const severityColor = {
|
|
16
|
+
low: chalk.blue,
|
|
17
|
+
medium: chalk.yellow,
|
|
18
|
+
high: chalk.red
|
|
19
|
+
}[advisory.severity.toLowerCase()] || chalk.white;
|
|
20
|
+
console.log();
|
|
21
|
+
console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 ${chalk.bold(`CopilotKit`)} \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`);
|
|
22
|
+
console.log();
|
|
23
|
+
console.log(`${chalk.bold(`Severity: ${severityColor(advisory.severity.toUpperCase())}`)}`);
|
|
24
|
+
console.log();
|
|
25
|
+
console.log(`${chalk.bold(advisory.message)}`);
|
|
26
|
+
console.log();
|
|
27
|
+
console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export {
|
|
31
|
+
flattenObject,
|
|
32
|
+
printSecurityNotice
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=chunk-6QGXWNS5.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/telemetry/utils.ts"],"sourcesContent":["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,OAAO,WAAW;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;AAEO,SAAS,oBAAoB,UAIjC;AACD,QAAM,gBACJ;AAAA,IACE,KAAK,MAAM;AAAA,IACX,QAAQ,MAAM;AAAA,IACd,MAAM,MAAM;AAAA,EACd,EAAE,SAAS,SAAS,YAAY,CAAC,KAAK,MAAM;AAE9C,UAAQ,IAAI;AACZ,UAAQ,IAAI,gHAAsB,MAAM,KAAK,YAAY,gHAAsB;AAC/E,UAAQ,IAAI;AACZ,UAAQ,IAAI,GAAG,MAAM,KAAK,aAAa,cAAc,SAAS,SAAS,YAAY,CAAC,GAAG,GAAG;AAC1F,UAAQ,IAAI;AACZ,UAAQ,IAAI,GAAG,MAAM,KAAK,SAAS,OAAO,GAAG;AAC7C,UAAQ,IAAI;AACZ,UAAQ,IAAI,kSAAkD;AAChE;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-BANDZXMP.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-CYDWEPFL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-FCCOSO5L.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// src/constants/index.ts
|
|
2
|
+
var COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
3
|
+
var COPILOT_CLOUD_VERSION = "v1";
|
|
4
|
+
var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
|
|
5
|
+
var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
COPILOT_CLOUD_API_URL,
|
|
9
|
+
COPILOT_CLOUD_VERSION,
|
|
10
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
11
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=chunk-GYZIHHE6.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/constants/index.ts"],"sourcesContent":["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"],"mappings":";AAAO,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB,GAAG,oCAAoC;AACtE,IAAM,sCAAsC;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-IAFBVORQ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// src/utils/json-schema.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
function actionParametersToJsonSchema(actionParameters) {
|
|
4
|
+
let parameters = {};
|
|
5
|
+
for (let parameter of actionParameters || []) {
|
|
6
|
+
parameters[parameter.name] = convertAttribute(parameter);
|
|
7
|
+
}
|
|
8
|
+
let requiredParameterNames = [];
|
|
9
|
+
for (let arg of actionParameters || []) {
|
|
10
|
+
if (arg.required !== false) {
|
|
11
|
+
requiredParameterNames.push(arg.name);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
type: "object",
|
|
16
|
+
properties: parameters,
|
|
17
|
+
required: requiredParameterNames
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function convertAttribute(attribute) {
|
|
21
|
+
var _a, _b, _c;
|
|
22
|
+
switch (attribute.type) {
|
|
23
|
+
case "string":
|
|
24
|
+
return {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: attribute.description,
|
|
27
|
+
...attribute.enum && { enum: attribute.enum }
|
|
28
|
+
};
|
|
29
|
+
case "number":
|
|
30
|
+
case "boolean":
|
|
31
|
+
return {
|
|
32
|
+
type: attribute.type,
|
|
33
|
+
description: attribute.description
|
|
34
|
+
};
|
|
35
|
+
case "object":
|
|
36
|
+
case "object[]":
|
|
37
|
+
const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
|
|
38
|
+
(acc, attr) => {
|
|
39
|
+
acc[attr.name] = convertAttribute(attr);
|
|
40
|
+
return acc;
|
|
41
|
+
},
|
|
42
|
+
{}
|
|
43
|
+
);
|
|
44
|
+
const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
|
|
45
|
+
if (attribute.type === "object[]") {
|
|
46
|
+
return {
|
|
47
|
+
type: "array",
|
|
48
|
+
items: {
|
|
49
|
+
type: "object",
|
|
50
|
+
...properties && { properties },
|
|
51
|
+
...required && required.length > 0 && { required }
|
|
52
|
+
},
|
|
53
|
+
description: attribute.description
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
type: "object",
|
|
58
|
+
description: attribute.description,
|
|
59
|
+
...properties && { properties },
|
|
60
|
+
...required && required.length > 0 && { required }
|
|
61
|
+
};
|
|
62
|
+
default:
|
|
63
|
+
if ((_c = attribute.type) == null ? void 0 : _c.endsWith("[]")) {
|
|
64
|
+
const itemType = attribute.type.slice(0, -2);
|
|
65
|
+
return {
|
|
66
|
+
type: "array",
|
|
67
|
+
items: { type: itemType },
|
|
68
|
+
description: attribute.description
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
type: "string",
|
|
73
|
+
description: attribute.description
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function convertJsonSchemaToZodSchema(jsonSchema, required) {
|
|
78
|
+
if (jsonSchema.type === "object") {
|
|
79
|
+
const spec = {};
|
|
80
|
+
if (!jsonSchema.properties || !Object.keys(jsonSchema.properties).length) {
|
|
81
|
+
return !required ? z.object(spec).optional() : z.object(spec);
|
|
82
|
+
}
|
|
83
|
+
for (const [key, value] of Object.entries(jsonSchema.properties)) {
|
|
84
|
+
spec[key] = convertJsonSchemaToZodSchema(
|
|
85
|
+
value,
|
|
86
|
+
jsonSchema.required ? jsonSchema.required.includes(key) : false
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
let schema = z.object(spec).describe(jsonSchema.description);
|
|
90
|
+
return required ? schema : schema.optional();
|
|
91
|
+
} else if (jsonSchema.type === "string") {
|
|
92
|
+
let schema = z.string().describe(jsonSchema.description);
|
|
93
|
+
return required ? schema : schema.optional();
|
|
94
|
+
} else if (jsonSchema.type === "number") {
|
|
95
|
+
let schema = z.number().describe(jsonSchema.description);
|
|
96
|
+
return required ? schema : schema.optional();
|
|
97
|
+
} else if (jsonSchema.type === "boolean") {
|
|
98
|
+
let schema = z.boolean().describe(jsonSchema.description);
|
|
99
|
+
return required ? schema : schema.optional();
|
|
100
|
+
} else if (jsonSchema.type === "array") {
|
|
101
|
+
let itemSchema = convertJsonSchemaToZodSchema(jsonSchema.items, true);
|
|
102
|
+
let schema = z.array(itemSchema).describe(jsonSchema.description);
|
|
103
|
+
return required ? schema : schema.optional();
|
|
104
|
+
}
|
|
105
|
+
throw new Error("Invalid JSON schema");
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
actionParametersToJsonSchema,
|
|
110
|
+
convertJsonSchemaToZodSchema
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-JP2M4U4G.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/json-schema.ts"],"sourcesContent":["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"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-MSUB6DGR.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-NAFEBKSO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=chunk-P7STFMPO.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {
|
|
2
|
+
flattenObject
|
|
3
|
+
} from "./chunk-6QGXWNS5.mjs";
|
|
4
|
+
|
|
5
|
+
// src/telemetry/telemetry-client.ts
|
|
6
|
+
import { Analytics } from "@segment/analytics-node";
|
|
7
|
+
import { v4 as uuidv4 } from "uuid";
|
|
8
|
+
var TelemetryClient = class {
|
|
9
|
+
constructor({
|
|
10
|
+
packageName,
|
|
11
|
+
packageVersion,
|
|
12
|
+
telemetryDisabled,
|
|
13
|
+
telemetryBaseUrl,
|
|
14
|
+
sampleRate
|
|
15
|
+
}) {
|
|
16
|
+
this.globalProperties = {};
|
|
17
|
+
this.cloudConfiguration = null;
|
|
18
|
+
this.telemetryDisabled = false;
|
|
19
|
+
this.sampleRate = 0.05;
|
|
20
|
+
this.anonymousId = `anon_${uuidv4()}`;
|
|
21
|
+
this.packageName = packageName;
|
|
22
|
+
this.packageVersion = packageVersion;
|
|
23
|
+
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";
|
|
24
|
+
if (this.telemetryDisabled) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
this.setSampleRate(sampleRate);
|
|
28
|
+
const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || "n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja";
|
|
29
|
+
this.segment = new Analytics({
|
|
30
|
+
writeKey
|
|
31
|
+
});
|
|
32
|
+
this.setGlobalProperties({
|
|
33
|
+
"copilotkit.package.name": packageName,
|
|
34
|
+
"copilotkit.package.version": packageVersion
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
shouldSendEvent() {
|
|
38
|
+
const randomNumber = Math.random();
|
|
39
|
+
return randomNumber < this.sampleRate;
|
|
40
|
+
}
|
|
41
|
+
async capture(event, properties) {
|
|
42
|
+
if (!this.shouldSendEvent() || !this.segment) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const flattenedProperties = flattenObject(properties);
|
|
46
|
+
const propertiesWithGlobal = {
|
|
47
|
+
...this.globalProperties,
|
|
48
|
+
...flattenedProperties
|
|
49
|
+
};
|
|
50
|
+
const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal).sort().reduce(
|
|
51
|
+
(obj, key) => {
|
|
52
|
+
obj[key] = propertiesWithGlobal[key];
|
|
53
|
+
return obj;
|
|
54
|
+
},
|
|
55
|
+
{}
|
|
56
|
+
);
|
|
57
|
+
this.segment.track({
|
|
58
|
+
anonymousId: this.anonymousId,
|
|
59
|
+
event,
|
|
60
|
+
properties: { ...orderedPropertiesWithGlobal }
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
setGlobalProperties(properties) {
|
|
64
|
+
const flattenedProperties = flattenObject(properties);
|
|
65
|
+
this.globalProperties = { ...this.globalProperties, ...flattenedProperties };
|
|
66
|
+
}
|
|
67
|
+
setCloudConfiguration(properties) {
|
|
68
|
+
this.cloudConfiguration = properties;
|
|
69
|
+
this.setGlobalProperties({
|
|
70
|
+
cloud: {
|
|
71
|
+
publicApiKey: properties.publicApiKey,
|
|
72
|
+
baseUrl: properties.baseUrl
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
setSampleRate(sampleRate) {
|
|
77
|
+
let _sampleRate;
|
|
78
|
+
_sampleRate = sampleRate ?? 0.05;
|
|
79
|
+
if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {
|
|
80
|
+
_sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);
|
|
81
|
+
}
|
|
82
|
+
if (_sampleRate < 0 || _sampleRate > 1) {
|
|
83
|
+
throw new Error("Sample rate must be between 0 and 1");
|
|
84
|
+
}
|
|
85
|
+
this.sampleRate = _sampleRate;
|
|
86
|
+
this.setGlobalProperties({
|
|
87
|
+
sampleRate: this.sampleRate,
|
|
88
|
+
sampleRateAdjustmentFactor: 1 - this.sampleRate
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
export {
|
|
94
|
+
TelemetryClient
|
|
95
|
+
};
|
|
96
|
+
//# sourceMappingURL=chunk-QFITLWYZ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/telemetry/telemetry-client.ts"],"sourcesContent":["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"],"mappings":";;;;;AAAA,SAAS,iBAAiB;AAG1B,SAAS,MAAM,cAAc;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,QAAQ,OAAO;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,UAAM,WAAW,QAAQ,IAAI,gCAAgC;AAE7D,SAAK,UAAU,IAAI,UAAU;AAAA,MAC3B;AAAA,IACF,CAAC;AAED,SAAK,oBAAoB;AAAA,MACvB,2BAA2B;AAAA,MAC3B,8BAA8B;AAAA,IAChC,CAAC;AAAA,EACH;AAAA,EAEQ,kBAAkB;AACxB,UAAM,eAAe,KAAK,OAAO;AACjC,WAAO,eAAe,KAAK;AAAA,EAC7B;AAAA,EAEA,MAAM,QAAyC,OAAU,YAAgC;AACvF,QAAI,CAAC,KAAK,gBAAgB,KAAK,CAAC,KAAK,SAAS;AAC5C;AAAA,IACF;AAEA,UAAM,sBAAsB,cAAc,UAAU;AACpD,UAAM,uBAAuB;AAAA,MAC3B,GAAG,KAAK;AAAA,MACR,GAAG;AAAA,IACL;AACA,UAAM,8BAA8B,OAAO,KAAK,oBAAoB,EACjE,KAAK,EACL;AAAA,MACC,CAAC,KAAK,QAAQ;AACZ,YAAI,GAAG,IAAI,qBAAqB,GAAG;AACnC,eAAO;AAAA,MACT;AAAA,MACA,CAAC;AAAA,IACH;AAEF,SAAK,QAAQ,MAAM;AAAA,MACjB,aAAa,KAAK;AAAA,MAClB;AAAA,MACA,YAAY,EAAE,GAAG,4BAA4B;AAAA,IAC/C,CAAC;AAAA,EACH;AAAA,EAEA,oBAAoB,YAAiC;AACnD,UAAM,sBAAsB,cAAc,UAAU;AACpD,SAAK,mBAAmB,EAAE,GAAG,KAAK,kBAAkB,GAAG,oBAAoB;AAAA,EAC7E;AAAA,EAEA,sBAAsB,YAAuD;AAC3E,SAAK,qBAAqB;AAE1B,SAAK,oBAAoB;AAAA,MACvB,OAAO;AAAA,QACL,cAAc,WAAW;AAAA,QACzB,SAAS,WAAW;AAAA,MACtB;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEQ,cAAc,YAAgC;AACpD,QAAI;AAEJ,kBAAc,cAAc;AAG5B,QAAI,QAAQ,IAAI,kCAAkC;AAEhD,oBAAc,WAAW,QAAQ,IAAI,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":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/utils/random-id.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\n\nexport function randomId() {\n return \"ck-\" + uuidv4();\n}\n"],"mappings":";AAAA,SAAS,MAAM,cAAc;AAEtB,SAAS,WAAW;AACzB,SAAO,QAAQ,OAAO;AACxB;","names":[]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
declare const COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
2
|
+
declare const COPILOT_CLOUD_VERSION = "v1";
|
|
3
|
+
declare const COPILOT_CLOUD_CHAT_URL = "https://api.cloud.copilotkit.ai/copilotkit/v1";
|
|
4
|
+
declare const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
5
|
+
|
|
6
|
+
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION };
|
|
@@ -0,0 +1,40 @@
|
|
|
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 __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/constants/index.ts
|
|
21
|
+
var constants_exports = {};
|
|
22
|
+
__export(constants_exports, {
|
|
23
|
+
COPILOT_CLOUD_API_URL: () => COPILOT_CLOUD_API_URL,
|
|
24
|
+
COPILOT_CLOUD_CHAT_URL: () => COPILOT_CLOUD_CHAT_URL,
|
|
25
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER: () => COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
26
|
+
COPILOT_CLOUD_VERSION: () => COPILOT_CLOUD_VERSION
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(constants_exports);
|
|
29
|
+
var COPILOT_CLOUD_API_URL = "https://api.cloud.copilotkit.ai";
|
|
30
|
+
var COPILOT_CLOUD_VERSION = "v1";
|
|
31
|
+
var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/copilotkit/${COPILOT_CLOUD_VERSION}`;
|
|
32
|
+
var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
COPILOT_CLOUD_API_URL,
|
|
36
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
37
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
38
|
+
COPILOT_CLOUD_VERSION
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/constants/index.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB,GAAG,oCAAoC;AACtE,IAAM,sCAAsC;","names":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
COPILOT_CLOUD_API_URL,
|
|
3
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
4
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
5
|
+
COPILOT_CLOUD_VERSION
|
|
6
|
+
} from "../chunk-GYZIHHE6.mjs";
|
|
7
|
+
export {
|
|
8
|
+
COPILOT_CLOUD_API_URL,
|
|
9
|
+
COPILOT_CLOUD_CHAT_URL,
|
|
10
|
+
COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
|
|
11
|
+
COPILOT_CLOUD_VERSION
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from './types/openai-assistant.js';
|
|
2
|
+
export { Action, MappedParameterTypes, Parameter } from './types/action.js';
|
|
3
|
+
export { CopilotCloudConfig } from './types/copilot-cloud-config.js';
|
|
4
|
+
export { PartialBy } from './types/utility.js';
|
|
5
|
+
export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema } from './utils/json-schema.js';
|
|
6
|
+
export { randomId } from './utils/random-id.js';
|
|
7
|
+
export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION } from './constants/index.js';
|
|
8
|
+
export { TelemetryClient } from './telemetry/telemetry-client.js';
|
|
9
|
+
import 'zod';
|
|
10
|
+
import '@segment/analytics-node';
|
|
11
|
+
import './telemetry/events.js';
|
|
12
|
+
|
|
13
|
+
declare const COPILOTKIT_VERSION: string;
|
|
14
|
+
|
|
15
|
+
export { COPILOTKIT_VERSION };
|