@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.
Files changed (106) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/chunk-6QGXWNS5.mjs +34 -0
  3. package/dist/chunk-6QGXWNS5.mjs.map +1 -0
  4. package/dist/chunk-BANDZXMP.mjs +1 -0
  5. package/dist/chunk-BANDZXMP.mjs.map +1 -0
  6. package/dist/chunk-CYDWEPFL.mjs +1 -0
  7. package/dist/chunk-CYDWEPFL.mjs.map +1 -0
  8. package/dist/chunk-FCCOSO5L.mjs +1 -0
  9. package/dist/chunk-FCCOSO5L.mjs.map +1 -0
  10. package/dist/chunk-GYZIHHE6.mjs +13 -0
  11. package/dist/chunk-GYZIHHE6.mjs.map +1 -0
  12. package/dist/chunk-IAFBVORQ.mjs +1 -0
  13. package/dist/chunk-IAFBVORQ.mjs.map +1 -0
  14. package/dist/chunk-JP2M4U4G.mjs +112 -0
  15. package/dist/chunk-JP2M4U4G.mjs.map +1 -0
  16. package/dist/chunk-MSUB6DGR.mjs +1 -0
  17. package/dist/chunk-MSUB6DGR.mjs.map +1 -0
  18. package/dist/chunk-NAFEBKSO.mjs +1 -0
  19. package/dist/chunk-NAFEBKSO.mjs.map +1 -0
  20. package/dist/chunk-P7STFMPO.mjs +1 -0
  21. package/dist/chunk-P7STFMPO.mjs.map +1 -0
  22. package/dist/chunk-QFITLWYZ.mjs +96 -0
  23. package/dist/chunk-QFITLWYZ.mjs.map +1 -0
  24. package/dist/chunk-RIPX6APP.mjs +10 -0
  25. package/dist/chunk-RIPX6APP.mjs.map +1 -0
  26. package/dist/constants/index.d.ts +6 -0
  27. package/dist/constants/index.js +40 -0
  28. package/dist/constants/index.js.map +1 -0
  29. package/dist/constants/index.mjs +13 -0
  30. package/dist/constants/index.mjs.map +1 -0
  31. package/dist/index.d.ts +15 -0
  32. package/dist/index.js +285 -0
  33. package/dist/index.js.map +1 -0
  34. package/dist/index.mjs +42 -0
  35. package/dist/index.mjs.map +1 -0
  36. package/dist/telemetry/events.d.ts +39 -0
  37. package/dist/telemetry/events.js +19 -0
  38. package/dist/telemetry/events.js.map +1 -0
  39. package/dist/telemetry/events.mjs +1 -0
  40. package/dist/telemetry/events.mjs.map +1 -0
  41. package/dist/telemetry/index.d.ts +3 -0
  42. package/dist/telemetry/index.js +144 -0
  43. package/dist/telemetry/index.js.map +1 -0
  44. package/dist/telemetry/index.mjs +9 -0
  45. package/dist/telemetry/index.mjs.map +1 -0
  46. package/dist/telemetry/security-check.d.ts +2 -0
  47. package/dist/telemetry/security-check.js +2 -0
  48. package/dist/telemetry/security-check.js.map +1 -0
  49. package/dist/telemetry/security-check.mjs +1 -0
  50. package/dist/telemetry/security-check.mjs.map +1 -0
  51. package/dist/telemetry/telemetry-client.d.ts +33 -0
  52. package/dist/telemetry/telemetry-client.js +142 -0
  53. package/dist/telemetry/telemetry-client.js.map +1 -0
  54. package/dist/telemetry/telemetry-client.mjs +8 -0
  55. package/dist/telemetry/telemetry-client.mjs.map +1 -0
  56. package/dist/telemetry/utils.d.ts +8 -0
  57. package/dist/telemetry/utils.js +69 -0
  58. package/dist/telemetry/utils.js.map +1 -0
  59. package/dist/telemetry/utils.mjs +9 -0
  60. package/dist/telemetry/utils.mjs.map +1 -0
  61. package/dist/types/action.d.ts +58 -0
  62. package/dist/types/action.js +19 -0
  63. package/dist/types/action.js.map +1 -0
  64. package/dist/types/action.mjs +2 -0
  65. package/dist/types/action.mjs.map +1 -0
  66. package/dist/types/copilot-cloud-config.d.ts +13 -0
  67. package/dist/types/copilot-cloud-config.js +19 -0
  68. package/dist/types/copilot-cloud-config.js.map +1 -0
  69. package/dist/types/copilot-cloud-config.mjs +2 -0
  70. package/dist/types/copilot-cloud-config.mjs.map +1 -0
  71. package/dist/types/index.d.ts +4 -0
  72. package/dist/types/index.js +19 -0
  73. package/dist/types/index.js.map +1 -0
  74. package/dist/types/index.mjs +6 -0
  75. package/dist/types/index.mjs.map +1 -0
  76. package/dist/types/openai-assistant.d.ts +53 -0
  77. package/dist/types/openai-assistant.js +19 -0
  78. package/dist/types/openai-assistant.js.map +1 -0
  79. package/dist/types/openai-assistant.mjs +2 -0
  80. package/dist/types/openai-assistant.mjs.map +1 -0
  81. package/dist/types/utility.d.ts +3 -0
  82. package/dist/types/utility.js +19 -0
  83. package/dist/types/utility.js.map +1 -0
  84. package/dist/types/utility.mjs +2 -0
  85. package/dist/types/utility.mjs.map +1 -0
  86. package/dist/utils/index.d.ts +4 -0
  87. package/dist/utils/index.js +147 -0
  88. package/dist/utils/index.js.map +1 -0
  89. package/dist/utils/index.mjs +14 -0
  90. package/dist/utils/index.mjs.map +1 -0
  91. package/dist/utils/json-schema.d.ts +32 -0
  92. package/dist/utils/json-schema.js +137 -0
  93. package/dist/utils/json-schema.js.map +1 -0
  94. package/dist/utils/json-schema.mjs +9 -0
  95. package/dist/utils/json-schema.mjs.map +1 -0
  96. package/dist/utils/json-schema.test.d.ts +2 -0
  97. package/dist/utils/json-schema.test.js +173 -0
  98. package/dist/utils/json-schema.test.js.map +1 -0
  99. package/dist/utils/json-schema.test.mjs +140 -0
  100. package/dist/utils/json-schema.test.mjs.map +1 -0
  101. package/dist/utils/random-id.d.ts +3 -0
  102. package/dist/utils/random-id.js +34 -0
  103. package/dist/utils/random-id.js.map +1 -0
  104. package/dist/utils/random-id.mjs +7 -0
  105. package/dist/utils/random-id.mjs.map +1 -0
  106. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ import { Analytics } from '@segment/analytics-node';
2
+ import { AnalyticsEvents } from './events.js';
3
+
4
+ declare class TelemetryClient {
5
+ segment: Analytics | undefined;
6
+ globalProperties: Record<string, any>;
7
+ cloudConfiguration: {
8
+ publicApiKey: string;
9
+ baseUrl: string;
10
+ } | null;
11
+ packageName: string;
12
+ packageVersion: string;
13
+ private telemetryDisabled;
14
+ private sampleRate;
15
+ private anonymousId;
16
+ constructor({ packageName, packageVersion, telemetryDisabled, telemetryBaseUrl, sampleRate, }: {
17
+ packageName: string;
18
+ packageVersion: string;
19
+ telemetryDisabled?: boolean;
20
+ telemetryBaseUrl?: string;
21
+ sampleRate?: number;
22
+ });
23
+ private shouldSendEvent;
24
+ capture<K extends keyof AnalyticsEvents>(event: K, properties: AnalyticsEvents[K]): Promise<void>;
25
+ setGlobalProperties(properties: Record<string, any>): void;
26
+ setCloudConfiguration(properties: {
27
+ publicApiKey: string;
28
+ baseUrl: string;
29
+ }): void;
30
+ private setSampleRate;
31
+ }
32
+
33
+ export { TelemetryClient };
@@ -0,0 +1,142 @@
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/telemetry-client.ts
31
+ var telemetry_client_exports = {};
32
+ __export(telemetry_client_exports, {
33
+ TelemetryClient: () => TelemetryClient
34
+ });
35
+ module.exports = __toCommonJS(telemetry_client_exports);
36
+ var import_analytics_node = require("@segment/analytics-node");
37
+
38
+ // src/telemetry/utils.ts
39
+ var import_chalk = __toESM(require("chalk"));
40
+ function flattenObject(obj, parentKey = "", res = {}) {
41
+ for (let key in obj) {
42
+ const propName = parentKey ? `${parentKey}.${key}` : key;
43
+ if (typeof obj[key] === "object" && obj[key] !== null) {
44
+ flattenObject(obj[key], propName, res);
45
+ } else {
46
+ res[propName] = obj[key];
47
+ }
48
+ }
49
+ return res;
50
+ }
51
+
52
+ // src/telemetry/telemetry-client.ts
53
+ var import_uuid = require("uuid");
54
+ var TelemetryClient = class {
55
+ constructor({
56
+ packageName,
57
+ packageVersion,
58
+ telemetryDisabled,
59
+ telemetryBaseUrl,
60
+ sampleRate
61
+ }) {
62
+ this.globalProperties = {};
63
+ this.cloudConfiguration = null;
64
+ this.telemetryDisabled = false;
65
+ this.sampleRate = 0.05;
66
+ this.anonymousId = `anon_${(0, import_uuid.v4)()}`;
67
+ this.packageName = packageName;
68
+ this.packageVersion = packageVersion;
69
+ 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";
70
+ if (this.telemetryDisabled) {
71
+ return;
72
+ }
73
+ this.setSampleRate(sampleRate);
74
+ const writeKey = process.env.COPILOTKIT_SEGMENT_WRITE_KEY || "n7XAZtQCGS2v1vvBy3LgBCv2h3Y8whja";
75
+ this.segment = new import_analytics_node.Analytics({
76
+ writeKey
77
+ });
78
+ this.setGlobalProperties({
79
+ "copilotkit.package.name": packageName,
80
+ "copilotkit.package.version": packageVersion
81
+ });
82
+ }
83
+ shouldSendEvent() {
84
+ const randomNumber = Math.random();
85
+ return randomNumber < this.sampleRate;
86
+ }
87
+ async capture(event, properties) {
88
+ if (!this.shouldSendEvent() || !this.segment) {
89
+ return;
90
+ }
91
+ const flattenedProperties = flattenObject(properties);
92
+ const propertiesWithGlobal = {
93
+ ...this.globalProperties,
94
+ ...flattenedProperties
95
+ };
96
+ const orderedPropertiesWithGlobal = Object.keys(propertiesWithGlobal).sort().reduce(
97
+ (obj, key) => {
98
+ obj[key] = propertiesWithGlobal[key];
99
+ return obj;
100
+ },
101
+ {}
102
+ );
103
+ this.segment.track({
104
+ anonymousId: this.anonymousId,
105
+ event,
106
+ properties: { ...orderedPropertiesWithGlobal }
107
+ });
108
+ }
109
+ setGlobalProperties(properties) {
110
+ const flattenedProperties = flattenObject(properties);
111
+ this.globalProperties = { ...this.globalProperties, ...flattenedProperties };
112
+ }
113
+ setCloudConfiguration(properties) {
114
+ this.cloudConfiguration = properties;
115
+ this.setGlobalProperties({
116
+ cloud: {
117
+ publicApiKey: properties.publicApiKey,
118
+ baseUrl: properties.baseUrl
119
+ }
120
+ });
121
+ }
122
+ setSampleRate(sampleRate) {
123
+ let _sampleRate;
124
+ _sampleRate = sampleRate ?? 0.05;
125
+ if (process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE) {
126
+ _sampleRate = parseFloat(process.env.COPILOTKIT_TELEMETRY_SAMPLE_RATE);
127
+ }
128
+ if (_sampleRate < 0 || _sampleRate > 1) {
129
+ throw new Error("Sample rate must be between 0 and 1");
130
+ }
131
+ this.sampleRate = _sampleRate;
132
+ this.setGlobalProperties({
133
+ sampleRate: this.sampleRate,
134
+ sampleRateAdjustmentFactor: 1 - this.sampleRate
135
+ });
136
+ }
137
+ };
138
+ // Annotate the CommonJS export names for ESM import in node:
139
+ 0 && (module.exports = {
140
+ TelemetryClient
141
+ });
142
+ //# sourceMappingURL=telemetry-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/telemetry/telemetry-client.ts","../../src/telemetry/utils.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","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":"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","names":["uuidv4"]}
@@ -0,0 +1,8 @@
1
+ import {
2
+ TelemetryClient
3
+ } from "../chunk-QFITLWYZ.mjs";
4
+ import "../chunk-6QGXWNS5.mjs";
5
+ export {
6
+ TelemetryClient
7
+ };
8
+ //# sourceMappingURL=telemetry-client.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,8 @@
1
+ declare function flattenObject(obj: Record<string, any>, parentKey?: string, res?: Record<string, any>): Record<string, any>;
2
+ declare function printSecurityNotice(advisory: {
3
+ advisory: string | null;
4
+ message: string;
5
+ severity: "low" | "medium" | "high" | "none";
6
+ }): void;
7
+
8
+ export { flattenObject, printSecurityNotice };
@@ -0,0 +1,69 @@
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/utils.ts
31
+ var utils_exports = {};
32
+ __export(utils_exports, {
33
+ flattenObject: () => flattenObject,
34
+ printSecurityNotice: () => printSecurityNotice
35
+ });
36
+ module.exports = __toCommonJS(utils_exports);
37
+ var import_chalk = __toESM(require("chalk"));
38
+ function flattenObject(obj, parentKey = "", res = {}) {
39
+ for (let key in obj) {
40
+ const propName = parentKey ? `${parentKey}.${key}` : key;
41
+ if (typeof obj[key] === "object" && obj[key] !== null) {
42
+ flattenObject(obj[key], propName, res);
43
+ } else {
44
+ res[propName] = obj[key];
45
+ }
46
+ }
47
+ return res;
48
+ }
49
+ function printSecurityNotice(advisory) {
50
+ const severityColor = {
51
+ low: import_chalk.default.blue,
52
+ medium: import_chalk.default.yellow,
53
+ high: import_chalk.default.red
54
+ }[advisory.severity.toLowerCase()] || import_chalk.default.white;
55
+ console.log();
56
+ console.log(`\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501 ${import_chalk.default.bold(`CopilotKit`)} \u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501`);
57
+ console.log();
58
+ console.log(`${import_chalk.default.bold(`Severity: ${severityColor(advisory.severity.toUpperCase())}`)}`);
59
+ console.log();
60
+ console.log(`${import_chalk.default.bold(advisory.message)}`);
61
+ console.log();
62
+ 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`);
63
+ }
64
+ // Annotate the CommonJS export names for ESM import in node:
65
+ 0 && (module.exports = {
66
+ flattenObject,
67
+ printSecurityNotice
68
+ });
69
+ //# sourceMappingURL=utils.js.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;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,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;AAEO,SAAS,oBAAoB,UAIjC;AACD,QAAM,gBACJ;AAAA,IACE,KAAK,aAAAA,QAAM;AAAA,IACX,QAAQ,aAAAA,QAAM;AAAA,IACd,MAAM,aAAAA,QAAM;AAAA,EACd,EAAE,SAAS,SAAS,YAAY,CAAC,KAAK,aAAAA,QAAM;AAE9C,UAAQ,IAAI;AACZ,UAAQ,IAAI,gHAAsB,aAAAA,QAAM,KAAK,YAAY,gHAAsB;AAC/E,UAAQ,IAAI;AACZ,UAAQ,IAAI,GAAG,aAAAA,QAAM,KAAK,aAAa,cAAc,SAAS,SAAS,YAAY,CAAC,GAAG,GAAG;AAC1F,UAAQ,IAAI;AACZ,UAAQ,IAAI,GAAG,aAAAA,QAAM,KAAK,SAAS,OAAO,GAAG;AAC7C,UAAQ,IAAI;AACZ,UAAQ,IAAI,kSAAkD;AAChE;","names":["chalk"]}
@@ -0,0 +1,9 @@
1
+ import {
2
+ flattenObject,
3
+ printSecurityNotice
4
+ } from "../chunk-6QGXWNS5.mjs";
5
+ export {
6
+ flattenObject,
7
+ printSecurityNotice
8
+ };
9
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,58 @@
1
+ type TypeMap = {
2
+ string: string;
3
+ number: number;
4
+ boolean: boolean;
5
+ object: object;
6
+ "string[]": string[];
7
+ "number[]": number[];
8
+ "boolean[]": boolean[];
9
+ "object[]": object[];
10
+ };
11
+ type AbstractParameter = {
12
+ name: string;
13
+ type?: keyof TypeMap;
14
+ description?: string;
15
+ required?: boolean;
16
+ };
17
+ interface StringParameter extends AbstractParameter {
18
+ type: "string";
19
+ enum?: string[];
20
+ }
21
+ interface ObjectParameter extends AbstractParameter {
22
+ type: "object";
23
+ attributes?: Parameter[];
24
+ }
25
+ interface ObjectArrayParameter extends AbstractParameter {
26
+ type: "object[]";
27
+ attributes?: Parameter[];
28
+ }
29
+ type SpecialParameters = StringParameter | ObjectParameter | ObjectArrayParameter;
30
+ interface BaseParameter extends AbstractParameter {
31
+ type?: Exclude<AbstractParameter["type"], SpecialParameters["type"]>;
32
+ }
33
+ type Parameter = BaseParameter | SpecialParameters;
34
+ type OptionalParameterType<P extends AbstractParameter> = P["required"] extends false ? undefined : never;
35
+ type StringParameterType<P> = P extends StringParameter ? P extends {
36
+ enum?: Array<infer E>;
37
+ } ? E : string : never;
38
+ type ObjectParameterType<P> = P extends ObjectParameter ? P extends {
39
+ attributes?: infer Attributes extends Parameter[];
40
+ } ? MappedParameterTypes<Attributes> : object : never;
41
+ type ObjectArrayParameterType<P> = P extends ObjectArrayParameter ? P extends {
42
+ attributes?: infer Attributes extends Parameter[];
43
+ } ? MappedParameterTypes<Attributes>[] : any[] : never;
44
+ type MappedTypeOrString<T> = T extends keyof TypeMap ? TypeMap[T] : string;
45
+ type BaseParameterType<P extends AbstractParameter> = P extends {
46
+ type: infer T;
47
+ } ? T extends BaseParameter["type"] ? MappedTypeOrString<T> : never : string;
48
+ type MappedParameterTypes<T extends Parameter[] | [] = []> = T extends [] ? Record<string, any> : {
49
+ [P in T[number] as P["name"]]: OptionalParameterType<P> | StringParameterType<P> | ObjectParameterType<P> | ObjectArrayParameterType<P> | BaseParameterType<P>;
50
+ };
51
+ type Action<T extends Parameter[] | [] = []> = {
52
+ name: string;
53
+ description?: string;
54
+ parameters?: T;
55
+ handler?: T extends [] ? () => any | Promise<any> : (args: MappedParameterTypes<T>) => any | Promise<any>;
56
+ };
57
+
58
+ export { Action, MappedParameterTypes, Parameter };
@@ -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/types/action.ts
17
+ var action_exports = {};
18
+ module.exports = __toCommonJS(action_exports);
19
+ //# sourceMappingURL=action.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/action.ts"],"sourcesContent":["type TypeMap = {\n string: string;\n number: number;\n boolean: boolean;\n object: object;\n \"string[]\": string[];\n \"number[]\": number[];\n \"boolean[]\": boolean[];\n \"object[]\": object[];\n};\n\ntype AbstractParameter = {\n name: string;\n type?: keyof TypeMap;\n description?: string;\n required?: boolean;\n};\n\ninterface StringParameter extends AbstractParameter {\n type: \"string\";\n enum?: string[];\n}\n\ninterface ObjectParameter extends AbstractParameter {\n type: \"object\";\n attributes?: Parameter[];\n}\n\ninterface ObjectArrayParameter extends AbstractParameter {\n type: \"object[]\";\n attributes?: Parameter[];\n}\n\ntype SpecialParameters = StringParameter | ObjectParameter | ObjectArrayParameter;\ninterface BaseParameter extends AbstractParameter {\n type?: Exclude<AbstractParameter[\"type\"], SpecialParameters[\"type\"]>;\n}\n\nexport type Parameter = BaseParameter | SpecialParameters;\n\ntype OptionalParameterType<P extends AbstractParameter> = P[\"required\"] extends false\n ? undefined\n : never;\n\ntype StringParameterType<P> = P extends StringParameter\n ? P extends { enum?: Array<infer E> }\n ? E\n : string\n : never;\n\ntype ObjectParameterType<P> = P extends ObjectParameter\n ? P extends { attributes?: infer Attributes extends Parameter[] }\n ? MappedParameterTypes<Attributes>\n : object\n : never;\n\ntype ObjectArrayParameterType<P> = P extends ObjectArrayParameter\n ? P extends { attributes?: infer Attributes extends Parameter[] }\n ? MappedParameterTypes<Attributes>[]\n : any[]\n : never;\n\ntype MappedTypeOrString<T> = T extends keyof TypeMap ? TypeMap[T] : string;\ntype BaseParameterType<P extends AbstractParameter> = P extends { type: infer T }\n ? T extends BaseParameter[\"type\"]\n ? MappedTypeOrString<T>\n : never\n : string;\n\nexport type MappedParameterTypes<T extends Parameter[] | [] = []> = T extends []\n ? Record<string, any>\n : {\n [P in T[number] as P[\"name\"]]:\n | OptionalParameterType<P>\n | StringParameterType<P>\n | ObjectParameterType<P>\n | ObjectArrayParameterType<P>\n | BaseParameterType<P>;\n };\n\nexport type Action<T extends Parameter[] | [] = []> = {\n name: string;\n description?: string;\n parameters?: T;\n handler?: T extends []\n ? () => any | Promise<any>\n : (args: MappedParameterTypes<T>) => any | Promise<any>;\n};\n\n// This is the original \"ceiling is being raised\" version of MappedParameterTypes.\n//\n// ceiling is being raised. cursor's copilot helped us write \"superhuman code\"\n// for a critical feature. We can read this code, but VERY few engineers out\n// there could write it from scratch.\n// Took lots of convincing too. \"come on, this must be possible, try harder\".\n// and obviously- done in parts.\n//\n// - https://twitter.com/ataiiam/status/1765089261374914957\n// (Mar 5, 2024)\n//\n// export type MappedParameterTypes<T extends Parameter[]> = {\n// // Check if the parameter has an 'enum' defined\n// [P in T[number] as P[\"name\"]]: P extends { enum: Array<infer E> }\n// ? E extends string // Ensure the enum values are strings\n// ? P[\"required\"] extends false // Check if the parameter is optional\n// ? E | undefined // If so, include 'undefined' in the type\n// : E // Otherwise, use the enum type directly\n// : never // This case should not occur since 'enum' implies string values\n// : // Handle parameters defined as 'object' with specified attributes\n// P extends { type: \"object\"; attributes: infer Attributes }\n// ? Attributes extends Parameter[]\n// ? MappedParameterTypes<Attributes> // Recursively map the attributes of the object\n// : never // If 'attributes' is not an array of Parameters, this is invalid\n// : // Handle parameters defined as 'object[]' without specified attributes\n// P extends { type: \"object[]\"; attributes?: never }\n// ? any[] // Default to 'any[]' for arrays of objects without specific attributes\n// : // Handle parameters defined as 'object[]' with specified attributes\n// P extends { type: \"object[]\"; attributes: infer Attributes }\n// ? Attributes extends Parameter[]\n// ? MappedParameterTypes<Attributes>[] // Recursively map each object in the array\n// : any[] // Default to 'any[]' if attributes are not properly defined\n// : // Handle all other parameter types\n// P[\"required\"] extends false\n// ? // Include 'undefined' for optional parameters\n// TypeMap[P[\"type\"] extends keyof TypeMap ? P[\"type\"] : \"string\"] | undefined\n// : // Use the direct mapping from 'TypeMap' for the parameter's type\n// TypeMap[P[\"type\"] extends keyof TypeMap ? P[\"type\"] : \"string\"];\n// };\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,2 @@
1
+ import "../chunk-NAFEBKSO.mjs";
2
+ //# sourceMappingURL=action.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,13 @@
1
+ interface CopilotCloudConfig {
2
+ guardrails: {
3
+ input: {
4
+ restrictToTopic: {
5
+ enabled: boolean;
6
+ validTopics: string[];
7
+ invalidTopics: string[];
8
+ };
9
+ };
10
+ };
11
+ }
12
+
13
+ export { CopilotCloudConfig };
@@ -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/types/copilot-cloud-config.ts
17
+ var copilot_cloud_config_exports = {};
18
+ module.exports = __toCommonJS(copilot_cloud_config_exports);
19
+ //# sourceMappingURL=copilot-cloud-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/copilot-cloud-config.ts"],"sourcesContent":["export interface CopilotCloudConfig {\n guardrails: {\n input: {\n restrictToTopic: {\n enabled: boolean;\n validTopics: string[];\n invalidTopics: string[];\n };\n };\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,2 @@
1
+ import "../chunk-MSUB6DGR.mjs";
2
+ //# sourceMappingURL=copilot-cloud-config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,4 @@
1
+ export { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from './openai-assistant.js';
2
+ export { Action, MappedParameterTypes, Parameter } from './action.js';
3
+ export { CopilotCloudConfig } from './copilot-cloud-config.js';
4
+ export { PartialBy } from './utility.js';
@@ -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/types/index.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["export * from \"./openai-assistant\";\nexport * from \"./action\";\nexport * from \"./copilot-cloud-config\";\nexport * from \"./utility\";\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,6 @@
1
+ import "../chunk-BANDZXMP.mjs";
2
+ import "../chunk-MSUB6DGR.mjs";
3
+ import "../chunk-IAFBVORQ.mjs";
4
+ import "../chunk-FCCOSO5L.mjs";
5
+ import "../chunk-NAFEBKSO.mjs";
6
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,53 @@
1
+ interface FunctionDefinition {
2
+ /**
3
+ * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain
4
+ * underscores and dashes, with a maximum length of 64.
5
+ */
6
+ name: string;
7
+ /**
8
+ * The parameters the functions accepts, described as a JSON Schema object. See the
9
+ * [guide](/docs/guides/gpt/function-calling) for examples, and the
10
+ * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for
11
+ * documentation about the format.
12
+ *
13
+ * To describe a function that accepts no parameters, provide the value
14
+ * `{"type": "object", "properties": {}}`.
15
+ */
16
+ parameters: Record<string, unknown>;
17
+ /**
18
+ * A description of what the function does, used by the model to choose when and
19
+ * how to call the function.
20
+ */
21
+ description?: string;
22
+ }
23
+ interface ToolDefinition {
24
+ type: "function";
25
+ function: FunctionDefinition;
26
+ }
27
+ interface FunctionCallHandlerArguments {
28
+ messages: any[];
29
+ name: string;
30
+ args: any;
31
+ }
32
+ type FunctionCallHandler = (args: FunctionCallHandlerArguments) => Promise<any>;
33
+ type CoAgentStateRenderHandlerArguments = {
34
+ name: string;
35
+ nodeName: string;
36
+ state: any;
37
+ };
38
+ type CoAgentStateRenderHandler = (args: CoAgentStateRenderHandlerArguments) => Promise<any>;
39
+ type AssistantMessage = {
40
+ id: string;
41
+ role: "assistant";
42
+ content: Array<{
43
+ type: "text";
44
+ text: {
45
+ value: string;
46
+ };
47
+ }>;
48
+ };
49
+ type JSONValue = null | string | number | boolean | {
50
+ [x: string]: JSONValue;
51
+ } | Array<JSONValue>;
52
+
53
+ export { AssistantMessage, CoAgentStateRenderHandler, CoAgentStateRenderHandlerArguments, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition };
@@ -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/types/openai-assistant.ts
17
+ var openai_assistant_exports = {};
18
+ module.exports = __toCommonJS(openai_assistant_exports);
19
+ //# sourceMappingURL=openai-assistant.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/openai-assistant.ts"],"sourcesContent":["export interface FunctionDefinition {\n /**\n * The name of the function to be called. Must be a-z, A-Z, 0-9, or contain\n * underscores and dashes, with a maximum length of 64.\n */\n name: string;\n /**\n * The parameters the functions accepts, described as a JSON Schema object. See the\n * [guide](/docs/guides/gpt/function-calling) for examples, and the\n * [JSON Schema reference](https://json-schema.org/understanding-json-schema/) for\n * documentation about the format.\n *\n * To describe a function that accepts no parameters, provide the value\n * `{\"type\": \"object\", \"properties\": {}}`.\n */\n parameters: Record<string, unknown>;\n /**\n * A description of what the function does, used by the model to choose when and\n * how to call the function.\n */\n description?: string;\n}\n\nexport interface ToolDefinition {\n type: \"function\";\n function: FunctionDefinition;\n}\n\nexport interface FunctionCallHandlerArguments {\n messages: any[];\n name: string;\n args: any;\n}\n\nexport type FunctionCallHandler = (args: FunctionCallHandlerArguments) => Promise<any>;\n\nexport type CoAgentStateRenderHandlerArguments = {\n name: string;\n nodeName: string;\n state: any;\n};\n\nexport type CoAgentStateRenderHandler = (args: CoAgentStateRenderHandlerArguments) => Promise<any>;\n\nexport type AssistantMessage = {\n id: string;\n role: \"assistant\";\n content: Array<{\n type: \"text\";\n text: {\n value: string;\n };\n }>;\n};\n\nexport type JSONValue =\n | null\n | string\n | number\n | boolean\n | { [x: string]: JSONValue }\n | Array<JSONValue>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,2 @@
1
+ import "../chunk-IAFBVORQ.mjs";
2
+ //# sourceMappingURL=openai-assistant.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
2
+
3
+ export { PartialBy };
@@ -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/types/utility.ts
17
+ var utility_exports = {};
18
+ module.exports = __toCommonJS(utility_exports);
19
+ //# sourceMappingURL=utility.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/utility.ts"],"sourcesContent":["export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,2 @@
1
+ import "../chunk-FCCOSO5L.mjs";
2
+ //# sourceMappingURL=utility.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,4 @@
1
+ export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema, convertJsonSchemaToZodSchema } from './json-schema.js';
2
+ export { randomId } from './random-id.js';
3
+ import 'zod';
4
+ import '../types/action.js';