@copilotkit/shared 0.37.0 → 0.38.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/.turbo/turbo-build.log +73 -106
  2. package/CHANGELOG.md +6 -0
  3. package/dist/{chunk-QVD5GLKQ.mjs → chunk-2VLE6D3W.mjs} +1 -1
  4. package/dist/chunk-2VLE6D3W.mjs.map +1 -0
  5. package/dist/chunk-CIPF7PMC.mjs +80 -0
  6. package/dist/chunk-CIPF7PMC.mjs.map +1 -0
  7. package/dist/chunk-CYDWEPFL.mjs +1 -0
  8. package/dist/constants/index.d.ts +0 -2
  9. package/dist/constants/index.js +2 -9
  10. package/dist/constants/index.js.map +1 -1
  11. package/dist/constants/index.mjs +2 -6
  12. package/dist/index.d.ts +2 -6
  13. package/dist/index.js +79 -371
  14. package/dist/index.js.map +1 -1
  15. package/dist/index.mjs +11 -43
  16. package/dist/types/index.d.ts +1 -1
  17. package/dist/types/openai-assistant.d.ts +7 -46
  18. package/dist/types/openai-assistant.js.map +1 -1
  19. package/dist/utils/index.d.ts +1 -4
  20. package/dist/utils/index.js +80 -367
  21. package/dist/utils/index.js.map +1 -1
  22. package/dist/utils/index.mjs +6 -34
  23. package/dist/utils/json-schema.d.ts +30 -0
  24. package/dist/utils/json-schema.js +104 -0
  25. package/dist/utils/json-schema.js.map +1 -0
  26. package/dist/utils/json-schema.mjs +7 -0
  27. package/package.json +4 -4
  28. package/src/constants/index.ts +0 -1
  29. package/src/types/openai-assistant.ts +7 -54
  30. package/src/utils/index.ts +1 -4
  31. package/src/utils/json-schema.ts +120 -0
  32. package/dist/chunk-3ZU7SB62.mjs +0 -7
  33. package/dist/chunk-3ZU7SB62.mjs.map +0 -1
  34. package/dist/chunk-4MTSDAP6.mjs +0 -32
  35. package/dist/chunk-4MTSDAP6.mjs.map +0 -1
  36. package/dist/chunk-CBF2BIA7.mjs +0 -116
  37. package/dist/chunk-CBF2BIA7.mjs.map +0 -1
  38. package/dist/chunk-DBW3BY7E.mjs +0 -157
  39. package/dist/chunk-DBW3BY7E.mjs.map +0 -1
  40. package/dist/chunk-HW4V75UQ.mjs +0 -60
  41. package/dist/chunk-HW4V75UQ.mjs.map +0 -1
  42. package/dist/chunk-QVD5GLKQ.mjs.map +0 -1
  43. package/dist/chunk-UAPRMZEY.mjs +0 -1
  44. package/dist/constants/copilot-protocol.d.ts +0 -3
  45. package/dist/constants/copilot-protocol.js +0 -31
  46. package/dist/constants/copilot-protocol.js.map +0 -1
  47. package/dist/constants/copilot-protocol.mjs +0 -7
  48. package/dist/utils/decode-chat-completion-as-text.d.ts +0 -7
  49. package/dist/utils/decode-chat-completion-as-text.js +0 -56
  50. package/dist/utils/decode-chat-completion-as-text.js.map +0 -1
  51. package/dist/utils/decode-chat-completion-as-text.mjs +0 -7
  52. package/dist/utils/decode-chat-completion-as-text.mjs.map +0 -1
  53. package/dist/utils/decode-chat-completion.d.ts +0 -27
  54. package/dist/utils/decode-chat-completion.js +0 -140
  55. package/dist/utils/decode-chat-completion.js.map +0 -1
  56. package/dist/utils/decode-chat-completion.mjs +0 -7
  57. package/dist/utils/decode-chat-completion.mjs.map +0 -1
  58. package/dist/utils/parse-chat-completion.d.ts +0 -30
  59. package/dist/utils/parse-chat-completion.js +0 -84
  60. package/dist/utils/parse-chat-completion.js.map +0 -1
  61. package/dist/utils/parse-chat-completion.mjs +0 -7
  62. package/dist/utils/parse-chat-completion.mjs.map +0 -1
  63. package/dist/utils/utils.d.ts +0 -103
  64. package/dist/utils/utils.js +0 -189
  65. package/dist/utils/utils.js.map +0 -1
  66. package/dist/utils/utils.mjs +0 -23
  67. package/dist/utils/utils.mjs.map +0 -1
  68. package/dist/utils/utils.test.d.ts +0 -2
  69. package/dist/utils/utils.test.js +0 -9
  70. package/dist/utils/utils.test.js.map +0 -1
  71. package/dist/utils/utils.test.mjs +0 -7
  72. package/dist/utils/utils.test.mjs.map +0 -1
  73. package/src/constants/copilot-protocol.ts +0 -1
  74. package/src/utils/decode-chat-completion-as-text.ts +0 -33
  75. package/src/utils/decode-chat-completion.ts +0 -169
  76. package/src/utils/parse-chat-completion.ts +0 -112
  77. package/src/utils/utils.test.ts +0 -7
  78. package/src/utils/utils.ts +0 -298
  79. /package/dist/{chunk-UAPRMZEY.mjs.map → chunk-CYDWEPFL.mjs.map} +0 -0
  80. /package/dist/{constants/copilot-protocol.mjs.map → utils/json-schema.mjs.map} +0 -0
@@ -1,8 +1,8 @@
1
1
 
2
- > @copilotkit/shared@0.37.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/shared
2
+ > @copilotkit/shared@0.38.0-beta.0 build /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/shared
3
3
  > tsup --clean
4
4
 
5
- CLI Building entry: src/index.ts, src/constants/copilot-protocol.ts, src/constants/index.ts, src/types/action.ts, src/types/annotated-function.ts, src/types/copilot-cloud-config.ts, src/types/index.ts, src/types/openai-assistant.ts, src/utils/annotated-function.ts, src/utils/decode-chat-completion-as-text.ts, src/utils/decode-chat-completion.ts, src/utils/index.ts, src/utils/parse-chat-completion.ts, src/utils/utils.test.ts, src/utils/utils.ts
5
+ CLI Building entry: src/index.ts, src/constants/index.ts, src/types/action.ts, src/types/annotated-function.ts, src/types/copilot-cloud-config.ts, src/types/index.ts, src/types/openai-assistant.ts, src/utils/annotated-function.ts, src/utils/index.ts, src/utils/json-schema.ts
6
6
  CLI Using tsconfig: tsconfig.json
7
7
  CLI tsup v6.7.0
8
8
  CLI Using tsup config: /home/runner/work/CopilotKit/CopilotKit/CopilotKit/packages/shared/tsup.config.ts
@@ -10,108 +10,75 @@
10
10
  CLI Cleaning output folder
11
11
  ESM Build start
12
12
  CJS Build start
13
- CJS dist/index.js 17.87 KB
14
- CJS dist/constants/copilot-protocol.js 1.25 KB
15
- CJS dist/types/action.js 801.00 B
16
- CJS dist/utils/annotated-function.js 5.84 KB
17
- CJS dist/constants/index.js 1.89 KB
18
- CJS dist/types/annotated-function.js 849.00 B
19
- CJS dist/types/index.js 797.00 B
20
- CJS dist/types/copilot-cloud-config.js 857.00 B
21
- CJS dist/types/openai-assistant.js 841.00 B
22
- CJS dist/utils/decode-chat-completion-as-text.js 1.82 KB
23
- CJS dist/utils/decode-chat-completion.js 4.68 KB
24
- CJS dist/utils/index.js 17.02 KB
25
- CJS dist/utils/utils.test.js 184.00 B
26
- CJS dist/utils/parse-chat-completion.js 2.68 KB
27
- CJS dist/utils/utils.js 6.25 KB
28
- CJS dist/index.js.map 33.62 KB
29
- CJS dist/constants/copilot-protocol.js.map 261.00 B
30
- CJS dist/types/action.js.map 4.84 KB
31
- CJS dist/utils/annotated-function.js.map 8.45 KB
32
- CJS dist/constants/index.js.map 760.00 B
33
- CJS dist/types/annotated-function.js.map 871.00 B
34
- CJS dist/types/index.js.map 277.00 B
35
- CJS dist/types/copilot-cloud-config.js.map 356.00 B
36
- CJS dist/types/openai-assistant.js.map 2.86 KB
37
- CJS dist/utils/decode-chat-completion-as-text.js.map 1.34 KB
38
- CJS dist/utils/decode-chat-completion.js.map 7.26 KB
39
- CJS dist/utils/index.js.map 33.13 KB
40
- CJS dist/utils/utils.test.js.map 354.00 B
41
- CJS dist/utils/parse-chat-completion.js.map 4.17 KB
42
- CJS dist/utils/utils.js.map 12.09 KB
43
- CJS ⚡️ Build success in 67ms
44
- ESM dist/utils/annotated-function.mjs 314.00 B
45
- ESM dist/utils/decode-chat-completion-as-text.mjs 170.00 B
46
- ESM dist/utils/decode-chat-completion.mjs 150.00 B
47
- ESM dist/utils/index.mjs 1001.00 B
48
- ESM dist/utils/parse-chat-completion.mjs 147.00 B
49
- ESM dist/utils/utils.test.mjs 170.00 B
50
- ESM dist/utils/utils.mjs 439.00 B
51
- ESM dist/index.mjs 1.49 KB
52
- ESM dist/chunk-UAPRMZEY.mjs 43.00 B
53
- ESM dist/chunk-S4HGLK2E.mjs 4.62 KB
54
- ESM dist/chunk-4MTSDAP6.mjs 729.00 B
55
- ESM dist/chunk-CBF2BIA7.mjs 3.62 KB
56
- ESM dist/chunk-HW4V75UQ.mjs 1.63 KB
57
- ESM dist/chunk-DBW3BY7E.mjs 4.92 KB
58
- ESM dist/constants/copilot-protocol.mjs 166.00 B
59
- ESM dist/constants/index.mjs 425.00 B
60
- ESM dist/chunk-QVD5GLKQ.mjs 468.00 B
61
- ESM dist/chunk-3ZU7SB62.mjs 200.00 B
62
- ESM dist/types/action.mjs 67.00 B
63
- ESM dist/types/annotated-function.mjs 79.00 B
64
- ESM dist/types/copilot-cloud-config.mjs 81.00 B
65
- ESM dist/types/index.mjs 194.00 B
66
- ESM dist/chunk-BANDZXMP.mjs 43.00 B
67
- ESM dist/chunk-NAFEBKSO.mjs 43.00 B
68
- ESM dist/chunk-YBHX4Y25.mjs 43.00 B
69
- ESM dist/chunk-MSUB6DGR.mjs 43.00 B
70
- ESM dist/types/openai-assistant.mjs 77.00 B
71
- ESM dist/chunk-IAFBVORQ.mjs 43.00 B
72
- ESM dist/utils/annotated-function.mjs.map 71.00 B
73
- ESM dist/utils/decode-chat-completion-as-text.mjs.map 71.00 B
74
- ESM dist/utils/decode-chat-completion.mjs.map 71.00 B
75
- ESM dist/utils/index.mjs.map 71.00 B
76
- ESM dist/utils/parse-chat-completion.mjs.map 71.00 B
77
- ESM dist/utils/utils.test.mjs.map 352.00 B
78
- ESM dist/utils/utils.mjs.map 71.00 B
79
- ESM dist/index.mjs.map 71.00 B
80
- ESM dist/chunk-UAPRMZEY.mjs.map 71.00 B
81
- ESM dist/chunk-S4HGLK2E.mjs.map 8.40 KB
82
- ESM dist/chunk-4MTSDAP6.mjs.map 1.30 KB
83
- ESM dist/chunk-CBF2BIA7.mjs.map 7.21 KB
84
- ESM dist/chunk-HW4V75UQ.mjs.map 4.12 KB
85
- ESM dist/chunk-DBW3BY7E.mjs.map 12.00 KB
86
- ESM dist/constants/copilot-protocol.mjs.map 71.00 B
87
- ESM dist/constants/index.mjs.map 71.00 B
88
- ESM dist/chunk-QVD5GLKQ.mjs.map 541.00 B
89
- ESM dist/chunk-3ZU7SB62.mjs.map 214.00 B
90
- ESM dist/types/action.mjs.map 71.00 B
91
- ESM dist/types/annotated-function.mjs.map 71.00 B
92
- ESM dist/types/copilot-cloud-config.mjs.map 71.00 B
93
- ESM dist/types/index.mjs.map 71.00 B
94
- ESM dist/chunk-BANDZXMP.mjs.map 71.00 B
95
- ESM dist/chunk-NAFEBKSO.mjs.map 71.00 B
96
- ESM dist/chunk-YBHX4Y25.mjs.map 71.00 B
97
- ESM dist/chunk-MSUB6DGR.mjs.map 71.00 B
98
- ESM dist/types/openai-assistant.mjs.map 71.00 B
99
- ESM dist/chunk-IAFBVORQ.mjs.map 71.00 B
100
- ESM ⚡️ Build success in 70ms
13
+ CJS dist/index.js 8.66 KB
14
+ CJS dist/constants/index.js 1.65 KB
15
+ CJS dist/types/action.js 801.00 B
16
+ CJS dist/types/annotated-function.js 849.00 B
17
+ CJS dist/types/copilot-cloud-config.js 857.00 B
18
+ CJS dist/types/index.js 797.00 B
19
+ CJS dist/types/openai-assistant.js 841.00 B
20
+ CJS dist/utils/annotated-function.js 5.84 KB
21
+ CJS dist/utils/index.js 8.03 KB
22
+ CJS dist/utils/json-schema.js 3.23 KB
23
+ CJS dist/index.js.map 13.67 KB
24
+ CJS dist/constants/index.js.map 564.00 B
25
+ CJS dist/types/action.js.map 4.84 KB
26
+ CJS dist/types/annotated-function.js.map 871.00 B
27
+ CJS dist/types/copilot-cloud-config.js.map 356.00 B
28
+ CJS dist/types/index.js.map 277.00 B
29
+ CJS dist/types/openai-assistant.js.map 1.53 KB
30
+ CJS dist/utils/annotated-function.js.map 8.45 KB
31
+ CJS dist/utils/index.js.map 13.23 KB
32
+ CJS dist/utils/json-schema.js.map 4.75 KB
33
+ CJS ⚡️ Build success in 77ms
34
+ ESM dist/index.mjs 858.00 B
35
+ ESM dist/constants/index.mjs 315.00 B
36
+ ESM dist/types/action.mjs 67.00 B
37
+ ESM dist/utils/annotated-function.mjs 314.00 B
38
+ ESM dist/chunk-CYDWEPFL.mjs 43.00 B
39
+ ESM dist/chunk-CIPF7PMC.mjs 2.20 KB
40
+ ESM dist/chunk-2VLE6D3W.mjs 468.00 B
41
+ ESM dist/types/annotated-function.mjs 79.00 B
42
+ ESM dist/types/copilot-cloud-config.mjs 81.00 B
43
+ ESM dist/types/index.mjs 194.00 B
44
+ ESM dist/chunk-BANDZXMP.mjs 43.00 B
45
+ ESM dist/chunk-NAFEBKSO.mjs 43.00 B
46
+ ESM dist/chunk-YBHX4Y25.mjs 43.00 B
47
+ ESM dist/chunk-MSUB6DGR.mjs 43.00 B
48
+ ESM dist/types/openai-assistant.mjs 77.00 B
49
+ ESM dist/chunk-IAFBVORQ.mjs 43.00 B
50
+ ESM dist/chunk-S4HGLK2E.mjs 4.62 KB
51
+ ESM dist/utils/index.mjs 437.00 B
52
+ ESM dist/utils/json-schema.mjs 155.00 B
53
+ ESM dist/index.mjs.map 71.00 B
54
+ ESM dist/constants/index.mjs.map 71.00 B
55
+ ESM dist/types/action.mjs.map 71.00 B
56
+ ESM dist/utils/annotated-function.mjs.map 71.00 B
57
+ ESM dist/chunk-CYDWEPFL.mjs.map 71.00 B
58
+ ESM dist/chunk-CIPF7PMC.mjs.map 4.71 KB
59
+ ESM dist/chunk-2VLE6D3W.mjs.map 502.00 B
60
+ ESM dist/types/annotated-function.mjs.map 71.00 B
61
+ ESM dist/types/copilot-cloud-config.mjs.map 71.00 B
62
+ ESM dist/types/index.mjs.map 71.00 B
63
+ ESM dist/chunk-BANDZXMP.mjs.map 71.00 B
64
+ ESM dist/chunk-NAFEBKSO.mjs.map 71.00 B
65
+ ESM dist/chunk-YBHX4Y25.mjs.map 71.00 B
66
+ ESM dist/chunk-MSUB6DGR.mjs.map 71.00 B
67
+ ESM dist/types/openai-assistant.mjs.map 71.00 B
68
+ ESM dist/chunk-IAFBVORQ.mjs.map 71.00 B
69
+ ESM dist/chunk-S4HGLK2E.mjs.map 8.40 KB
70
+ ESM dist/utils/index.mjs.map 71.00 B
71
+ ESM dist/utils/json-schema.mjs.map 71.00 B
72
+ ESM ⚡️ Build success in 79ms
101
73
  DTS Build start
102
- DTS ⚡️ Build success in 3085ms
103
- DTS dist/index.d.ts 1.47 KB
104
- DTS dist/types/openai-assistant.d.ts 2.79 KB
105
- DTS dist/types/annotated-function.d.ts 766.00 B
106
- DTS dist/types/action.d.ts 2.24 KB
107
- DTS dist/types/copilot-cloud-config.d.ts 278.00 B
108
- DTS dist/utils/utils.d.ts 4.32 KB
109
- DTS dist/utils/parse-chat-completion.d.ts 826.00 B
110
- DTS dist/utils/decode-chat-completion.d.ts 955.00 B
111
- DTS dist/utils/decode-chat-completion-as-text.d.ts 298.00 B
112
- DTS dist/utils/annotated-function.d.ts 600.00 B
113
- DTS dist/constants/index.d.ts 484.00 B
114
- DTS dist/constants/copilot-protocol.d.ts 128.00 B
115
- DTS dist/types/index.d.ts 443.00 B
116
- DTS dist/utils/index.d.ts 892.00 B
117
- DTS dist/utils/utils.test.d.ts 12.00 B
74
+ DTS ⚡️ Build success in 4698ms
75
+ DTS dist/index.d.ts 937.00 B
76
+ DTS dist/types/openai-assistant.d.ts 1.47 KB
77
+ DTS dist/types/annotated-function.d.ts 766.00 B
78
+ DTS dist/types/action.d.ts 2.24 KB
79
+ DTS dist/types/copilot-cloud-config.d.ts 278.00 B
80
+ DTS dist/utils/annotated-function.d.ts 600.00 B
81
+ DTS dist/utils/json-schema.d.ts 884.00 B
82
+ DTS dist/constants/index.d.ts 410.00 B
83
+ DTS dist/types/index.d.ts 444.00 B
84
+ DTS dist/utils/index.d.ts 420.00 B
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @copilotkit/shared
2
2
 
3
+ ## 0.38.0-beta.0
4
+
5
+ ### Minor Changes
6
+
7
+ - Beta
8
+
3
9
  ## 0.37.0
4
10
 
5
11
  ### Minor Changes
@@ -10,4 +10,4 @@ export {
10
10
  COPILOT_CLOUD_CHAT_URL,
11
11
  COPILOT_CLOUD_PUBLIC_API_KEY_HEADER
12
12
  };
13
- //# sourceMappingURL=chunk-QVD5GLKQ.mjs.map
13
+ //# sourceMappingURL=chunk-2VLE6D3W.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;\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,yBAAyB;AAC3D,IAAM,sCAAsC;","names":[]}
@@ -0,0 +1,80 @@
1
+ // src/utils/json-schema.ts
2
+ function actionParametersToJsonSchema(actionParameters) {
3
+ let parameters = {};
4
+ for (let parameter of actionParameters || []) {
5
+ parameters[parameter.name] = convertAttribute(parameter);
6
+ }
7
+ let requiredParameterNames = [];
8
+ for (let arg of actionParameters || []) {
9
+ if (arg.required !== false) {
10
+ requiredParameterNames.push(arg.name);
11
+ }
12
+ }
13
+ return {
14
+ type: "object",
15
+ properties: parameters,
16
+ required: requiredParameterNames
17
+ };
18
+ }
19
+ function convertAttribute(attribute) {
20
+ var _a, _b, _c;
21
+ switch (attribute.type) {
22
+ case "string":
23
+ return {
24
+ type: "string",
25
+ description: attribute.description,
26
+ ...attribute.enum && { enum: attribute.enum }
27
+ };
28
+ case "number":
29
+ case "boolean":
30
+ return {
31
+ type: attribute.type,
32
+ description: attribute.description
33
+ };
34
+ case "object":
35
+ case "object[]":
36
+ const properties = (_a = attribute.attributes) == null ? void 0 : _a.reduce(
37
+ (acc, attr) => {
38
+ acc[attr.name] = convertAttribute(attr);
39
+ return acc;
40
+ },
41
+ {}
42
+ );
43
+ const required = (_b = attribute.attributes) == null ? void 0 : _b.filter((attr) => attr.required !== false).map((attr) => attr.name);
44
+ if (attribute.type === "object[]") {
45
+ return {
46
+ type: "array",
47
+ items: {
48
+ type: "object",
49
+ ...properties && { properties },
50
+ ...required && required.length > 0 && { required }
51
+ },
52
+ description: attribute.description
53
+ };
54
+ }
55
+ return {
56
+ type: "object",
57
+ description: attribute.description,
58
+ ...properties && { properties },
59
+ ...required && required.length > 0 && { required }
60
+ };
61
+ default:
62
+ if ((_c = attribute.type) == null ? void 0 : _c.endsWith("[]")) {
63
+ const itemType = attribute.type.slice(0, -2);
64
+ return {
65
+ type: "array",
66
+ items: { type: itemType },
67
+ description: attribute.description
68
+ };
69
+ }
70
+ return {
71
+ type: "string",
72
+ description: attribute.description
73
+ };
74
+ }
75
+ }
76
+
77
+ export {
78
+ actionParametersToJsonSchema
79
+ };
80
+ //# sourceMappingURL=chunk-CIPF7PMC.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/json-schema.ts"],"sourcesContent":["import { 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"],"mappings":";AAsCO,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,YAAY;AAAA,IACZ,UAAU;AAAA,EACZ;AACF;AAEA,SAAS,iBAAiB,WAAkC;AA5D5D;AA6DE,UAAQ,UAAU,MAAM;AAAA,IACtB,KAAK;AACH,aAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa,UAAU;AAAA,QACvB,GAAI,UAAU,QAAQ,EAAE,MAAM,UAAU,KAAK;AAAA,MAC/C;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,QACL,MAAM,UAAU;AAAA,QAChB,aAAa,UAAU;AAAA,MACzB;AAAA,IACF,KAAK;AAAA,IACL,KAAK;AACH,YAAM,cAAa,eAAU,eAAV,mBAAsB;AAAA,QACvC,CAAC,KAAK,SAAS;AACb,cAAI,KAAK,IAAI,IAAI,iBAAiB,IAAI;AACtC,iBAAO;AAAA,QACT;AAAA,QACA,CAAC;AAAA;AAEH,YAAM,YAAW,eAAU,eAAV,mBACb,OAAO,CAAC,SAAS,KAAK,aAAa,OACpC,IAAI,CAAC,SAAS,KAAK;AACtB,UAAI,UAAU,SAAS,YAAY;AACjC,eAAO;AAAA,UACL,MAAM;AAAA,UACN,OAAO;AAAA,YACL,MAAM;AAAA,YACN,GAAI,cAAc,EAAE,WAAW;AAAA,YAC/B,GAAI,YAAY,SAAS,SAAS,KAAK,EAAE,SAAS;AAAA,UACpD;AAAA,UACA,aAAa,UAAU;AAAA,QACzB;AAAA,MACF;AACA,aAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa,UAAU;AAAA,QACvB,GAAI,cAAc,EAAE,WAAW;AAAA,QAC/B,GAAI,YAAY,SAAS,SAAS,KAAK,EAAE,SAAS;AAAA,MACpD;AAAA,IACF;AAEE,WAAI,eAAU,SAAV,mBAAgB,SAAS,OAAO;AAClC,cAAM,WAAW,UAAU,KAAK,MAAM,GAAG,EAAE;AAC3C,eAAO;AAAA,UACL,MAAM;AAAA,UACN,OAAO,EAAE,MAAM,SAAgB;AAAA,UAC/B,aAAa,UAAU;AAAA,QACzB;AAAA,MACF;AAEA,aAAO;AAAA,QACL,MAAM;AAAA,QACN,aAAa,UAAU;AAAA,MACzB;AAAA,EACJ;AACF;","names":[]}
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=chunk-CYDWEPFL.mjs.map
@@ -1,5 +1,3 @@
1
- export { EXCLUDE_FROM_FORWARD_PROPS_KEYS } from './copilot-protocol.js';
2
-
3
1
  declare const COPILOT_CLOUD_API_URL = "https://api.copilotkit.ai";
4
2
  declare const COPILOT_CLOUD_VERSION = "v1";
5
3
  declare const COPILOT_CLOUD_CHAT_URL = "https://api.copilotkit.ai/v1/copilotkit/runtime/chat";
@@ -23,15 +23,9 @@ __export(constants_exports, {
23
23
  COPILOT_CLOUD_API_URL: () => COPILOT_CLOUD_API_URL,
24
24
  COPILOT_CLOUD_CHAT_URL: () => COPILOT_CLOUD_CHAT_URL,
25
25
  COPILOT_CLOUD_PUBLIC_API_KEY_HEADER: () => COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
26
- COPILOT_CLOUD_VERSION: () => COPILOT_CLOUD_VERSION,
27
- EXCLUDE_FROM_FORWARD_PROPS_KEYS: () => EXCLUDE_FROM_FORWARD_PROPS_KEYS
26
+ COPILOT_CLOUD_VERSION: () => COPILOT_CLOUD_VERSION
28
27
  });
29
28
  module.exports = __toCommonJS(constants_exports);
30
-
31
- // src/constants/copilot-protocol.ts
32
- var EXCLUDE_FROM_FORWARD_PROPS_KEYS = "exclude_from_forward_props_keys";
33
-
34
- // src/constants/index.ts
35
29
  var COPILOT_CLOUD_API_URL = "https://api.copilotkit.ai";
36
30
  var COPILOT_CLOUD_VERSION = "v1";
37
31
  var COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;
@@ -41,7 +35,6 @@ var COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = "X-CopilotCloud-Public-Api-Key";
41
35
  COPILOT_CLOUD_API_URL,
42
36
  COPILOT_CLOUD_CHAT_URL,
43
37
  COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
44
- COPILOT_CLOUD_VERSION,
45
- EXCLUDE_FROM_FORWARD_PROPS_KEYS
38
+ COPILOT_CLOUD_VERSION
46
39
  });
47
40
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/constants/index.ts","../../src/constants/copilot-protocol.ts"],"sourcesContent":["export * from \"./copilot-protocol\";\nexport const COPILOT_CLOUD_API_URL = \"https://api.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;\nexport const COPILOT_CLOUD_PUBLIC_API_KEY_HEADER = \"X-CopilotCloud-Public-Api-Key\";\n","export const EXCLUDE_FROM_FORWARD_PROPS_KEYS = \"exclude_from_forward_props_keys\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,kCAAkC;;;ADCxC,IAAM,wBAAwB;AAC9B,IAAM,wBAAwB;AAC9B,IAAM,yBAAyB,GAAG,yBAAyB;AAC3D,IAAM,sCAAsC;","names":[]}
1
+ {"version":3,"sources":["../../src/constants/index.ts"],"sourcesContent":["export const COPILOT_CLOUD_API_URL = \"https://api.copilotkit.ai\";\nexport const COPILOT_CLOUD_VERSION = \"v1\";\nexport const COPILOT_CLOUD_CHAT_URL = `${COPILOT_CLOUD_API_URL}/${COPILOT_CLOUD_VERSION}/copilotkit/runtime/chat`;\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,yBAAyB;AAC3D,IAAM,sCAAsC;","names":[]}
@@ -3,15 +3,11 @@ import {
3
3
  COPILOT_CLOUD_CHAT_URL,
4
4
  COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
5
5
  COPILOT_CLOUD_VERSION
6
- } from "../chunk-QVD5GLKQ.mjs";
7
- import {
8
- EXCLUDE_FROM_FORWARD_PROPS_KEYS
9
- } from "../chunk-3ZU7SB62.mjs";
6
+ } from "../chunk-2VLE6D3W.mjs";
10
7
  export {
11
8
  COPILOT_CLOUD_API_URL,
12
9
  COPILOT_CLOUD_CHAT_URL,
13
10
  COPILOT_CLOUD_PUBLIC_API_KEY_HEADER,
14
- COPILOT_CLOUD_VERSION,
15
- EXCLUDE_FROM_FORWARD_PROPS_KEYS
11
+ COPILOT_CLOUD_VERSION
16
12
  };
17
13
  //# sourceMappingURL=index.mjs.map
package/dist/index.d.ts CHANGED
@@ -1,11 +1,7 @@
1
- export { AssistantMessage, FunctionCall, FunctionCallHandler, FunctionDefinition, JSONValue, Message, Role, ToolDefinition } from './types/openai-assistant.js';
1
+ export { AssistantMessage, FunctionCallHandler, FunctionCallHandlerArguments, FunctionDefinition, JSONValue, ToolDefinition } from './types/openai-assistant.js';
2
2
  export { AnnotatedFunction, AnnotatedFunctionArgument, AnnotatedFunctionArrayArgument, AnnotatedFunctionSimpleArgument } from './types/annotated-function.js';
3
3
  export { Action, MappedParameterTypes, Parameter } from './types/action.js';
4
4
  export { CopilotCloudConfig } from './types/copilot-cloud-config.js';
5
- export { COMPLEX_HEADER, StreamPart, StreamPartType, StreamString, StreamStringPrefixes, decodeResult, encodeResult, formatStreamPart, isStreamStringEqualToType, parseStreamPart, streamPartsByCode, validCodes } from './utils/utils.js';
6
- export { ChatCompletionChunk, ToolCallFunctionCall, ToolCallPayload, parseChatCompletion } from './utils/parse-chat-completion.js';
7
- export { ChatCompletionContentEvent, ChatCompletionEvent, ChatCompletionFunctionEvent, ChatCompletionPartialEvent, ChatCompletionResultEvent, decodeChatCompletion } from './utils/decode-chat-completion.js';
8
- export { decodeChatCompletionAsText } from './utils/decode-chat-completion-as-text.js';
9
5
  export { actionToChatCompletionFunction, annotatedFunctionToAction, annotatedFunctionToChatCompletionFunction } from './utils/annotated-function.js';
6
+ export { JSONSchema, JSONSchemaArray, JSONSchemaBoolean, JSONSchemaNumber, JSONSchemaObject, JSONSchemaString, actionParametersToJsonSchema } from './utils/json-schema.js';
10
7
  export { COPILOT_CLOUD_API_URL, COPILOT_CLOUD_CHAT_URL, COPILOT_CLOUD_PUBLIC_API_KEY_HEADER, COPILOT_CLOUD_VERSION } from './constants/index.js';
11
- export { EXCLUDE_FROM_FORWARD_PROPS_KEYS } from './constants/copilot-protocol.js';