@copilotkit/runtime 1.72.1-canary.sp-longthread-perf → 1.73.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 (142) hide show
  1. package/dist/agent/index.cjs +48 -8
  2. package/dist/agent/index.cjs.map +1 -1
  3. package/dist/agent/index.d.cts +20 -7
  4. package/dist/agent/index.d.cts.map +1 -1
  5. package/dist/agent/index.d.mts +18 -5
  6. package/dist/agent/index.d.mts.map +1 -1
  7. package/dist/agent/index.mjs +48 -8
  8. package/dist/agent/index.mjs.map +1 -1
  9. package/dist/agent/learned-skills.cjs +77 -0
  10. package/dist/agent/learned-skills.cjs.map +1 -0
  11. package/dist/agent/learned-skills.d.cts +16 -0
  12. package/dist/agent/learned-skills.d.cts.map +1 -0
  13. package/dist/agent/learned-skills.d.mts +16 -0
  14. package/dist/agent/learned-skills.d.mts.map +1 -0
  15. package/dist/agent/learned-skills.mjs +75 -0
  16. package/dist/agent/learned-skills.mjs.map +1 -0
  17. package/dist/index.d.cts +4 -4
  18. package/dist/index.d.mts +4 -4
  19. package/dist/internal/learned-skills.cjs +22 -0
  20. package/dist/internal/learned-skills.d.cts +10 -0
  21. package/dist/internal/learned-skills.d.mts +10 -0
  22. package/dist/internal/learned-skills.mjs +10 -0
  23. package/dist/lib/index.d.cts +2 -2
  24. package/dist/lib/index.d.mts +2 -2
  25. package/dist/lib/integrations/node-http/index.cjs.map +1 -1
  26. package/dist/lib/integrations/node-http/index.d.cts.map +1 -1
  27. package/dist/lib/integrations/node-http/index.d.mts.map +1 -1
  28. package/dist/lib/integrations/node-http/index.mjs.map +1 -1
  29. package/dist/lib/integrations/shared.cjs.map +1 -1
  30. package/dist/lib/integrations/shared.d.cts +1 -1
  31. package/dist/lib/integrations/shared.d.cts.map +1 -1
  32. package/dist/lib/integrations/shared.d.mts +1 -1
  33. package/dist/lib/integrations/shared.d.mts.map +1 -1
  34. package/dist/lib/integrations/shared.mjs.map +1 -1
  35. package/dist/lib/runtime/agent-integrations/langgraph/agent.d.cts +1 -1
  36. package/dist/lib/runtime/copilot-runtime.d.cts +2 -2
  37. package/dist/lib/runtime/copilot-runtime.d.mts +2 -2
  38. package/dist/package.cjs +9 -3
  39. package/dist/package.mjs +9 -3
  40. package/dist/service-adapters/anthropic/anthropic-adapter.cjs.map +1 -1
  41. package/dist/service-adapters/anthropic/anthropic-adapter.d.cts.map +1 -1
  42. package/dist/service-adapters/anthropic/anthropic-adapter.d.mts.map +1 -1
  43. package/dist/service-adapters/anthropic/anthropic-adapter.mjs.map +1 -1
  44. package/dist/service-adapters/shared/sdk-client-utils.cjs.map +1 -1
  45. package/dist/service-adapters/shared/sdk-client-utils.d.cts.map +1 -1
  46. package/dist/service-adapters/shared/sdk-client-utils.d.mts.map +1 -1
  47. package/dist/service-adapters/shared/sdk-client-utils.mjs.map +1 -1
  48. package/dist/v2/index.cjs +6 -0
  49. package/dist/v2/index.d.cts +6 -5
  50. package/dist/v2/index.d.mts +6 -5
  51. package/dist/v2/index.mjs +2 -2
  52. package/dist/v2/runtime/core/channel-manager.d.cts +1 -1
  53. package/dist/v2/runtime/core/channel-manager.d.mts +1 -1
  54. package/dist/v2/runtime/core/runtime.cjs +5 -0
  55. package/dist/v2/runtime/core/runtime.cjs.map +1 -1
  56. package/dist/v2/runtime/core/runtime.d.cts +18 -3
  57. package/dist/v2/runtime/core/runtime.d.cts.map +1 -1
  58. package/dist/v2/runtime/core/runtime.d.mts +17 -2
  59. package/dist/v2/runtime/core/runtime.d.mts.map +1 -1
  60. package/dist/v2/runtime/core/runtime.mjs +5 -0
  61. package/dist/v2/runtime/core/runtime.mjs.map +1 -1
  62. package/dist/v2/runtime/handlers/handle-suggest.cjs +4 -3
  63. package/dist/v2/runtime/handlers/handle-suggest.cjs.map +1 -1
  64. package/dist/v2/runtime/handlers/handle-suggest.mjs +5 -4
  65. package/dist/v2/runtime/handlers/handle-suggest.mjs.map +1 -1
  66. package/dist/v2/runtime/handlers/shared/sse-keep-alive.cjs +69 -0
  67. package/dist/v2/runtime/handlers/shared/sse-keep-alive.cjs.map +1 -0
  68. package/dist/v2/runtime/handlers/shared/sse-keep-alive.mjs +67 -0
  69. package/dist/v2/runtime/handlers/shared/sse-keep-alive.mjs.map +1 -0
  70. package/dist/v2/runtime/handlers/shared/sse-response.cjs +5 -2
  71. package/dist/v2/runtime/handlers/shared/sse-response.cjs.map +1 -1
  72. package/dist/v2/runtime/handlers/shared/sse-response.mjs +5 -2
  73. package/dist/v2/runtime/handlers/shared/sse-response.mjs.map +1 -1
  74. package/dist/v2/runtime/handlers/sse/connect.cjs +1 -0
  75. package/dist/v2/runtime/handlers/sse/connect.cjs.map +1 -1
  76. package/dist/v2/runtime/handlers/sse/connect.mjs +1 -0
  77. package/dist/v2/runtime/handlers/sse/connect.mjs.map +1 -1
  78. package/dist/v2/runtime/handlers/sse/run.cjs +1 -0
  79. package/dist/v2/runtime/handlers/sse/run.cjs.map +1 -1
  80. package/dist/v2/runtime/handlers/sse/run.mjs +1 -0
  81. package/dist/v2/runtime/handlers/sse/run.mjs.map +1 -1
  82. package/dist/v2/runtime/index.d.cts +3 -3
  83. package/dist/v2/runtime/index.d.mts +3 -3
  84. package/dist/v2/runtime/intelligence-platform/client.d.cts +1 -1
  85. package/dist/v2/runtime/intelligence-platform/client.d.mts +1 -1
  86. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.cjs +132 -0
  87. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.cjs.map +1 -0
  88. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.cts +11 -0
  89. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.cts.map +1 -0
  90. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.mts +11 -0
  91. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.d.mts.map +1 -0
  92. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.mjs +128 -0
  93. package/dist/v2/runtime/intelligence-platform/skill-registry/archive.mjs.map +1 -0
  94. package/dist/v2/runtime/intelligence-platform/skill-registry/config.cjs +48 -0
  95. package/dist/v2/runtime/intelligence-platform/skill-registry/config.cjs.map +1 -0
  96. package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.cts +27 -0
  97. package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.cts.map +1 -0
  98. package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.mts +27 -0
  99. package/dist/v2/runtime/intelligence-platform/skill-registry/config.d.mts.map +1 -0
  100. package/dist/v2/runtime/intelligence-platform/skill-registry/config.mjs +48 -0
  101. package/dist/v2/runtime/intelligence-platform/skill-registry/config.mjs.map +1 -0
  102. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.cjs +11 -0
  103. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.cjs.map +1 -0
  104. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.cts +8 -0
  105. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.cts.map +1 -0
  106. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.mts +8 -0
  107. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.d.mts.map +1 -0
  108. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.mjs +11 -0
  109. package/dist/v2/runtime/intelligence-platform/skill-registry/errors.mjs.map +1 -0
  110. package/dist/v2/runtime/intelligence-platform/skill-registry/index.d.cts +8 -0
  111. package/dist/v2/runtime/intelligence-platform/skill-registry/index.d.mts +8 -0
  112. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.cjs +132 -0
  113. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.cjs.map +1 -0
  114. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.cts +31 -0
  115. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.cts.map +1 -0
  116. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.mts +31 -0
  117. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.d.mts.map +1 -0
  118. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.mjs +132 -0
  119. package/dist/v2/runtime/intelligence-platform/skill-registry/registry.mjs.map +1 -0
  120. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.cjs +42 -0
  121. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.cjs.map +1 -0
  122. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.cts +13 -0
  123. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.cts.map +1 -0
  124. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.mts +13 -0
  125. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.d.mts.map +1 -0
  126. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.mjs +39 -0
  127. package/dist/v2/runtime/intelligence-platform/skill-registry/skill-content.mjs.map +1 -0
  128. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.cjs +93 -0
  129. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.cjs.map +1 -0
  130. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.cts +28 -0
  131. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.cts.map +1 -0
  132. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.mts +28 -0
  133. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.d.mts.map +1 -0
  134. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.mjs +92 -0
  135. package/dist/v2/runtime/intelligence-platform/skill-registry/snapshot.mjs.map +1 -0
  136. package/dist/v2/runtime/runner/agent-runner.d.cts +1 -1
  137. package/dist/v2/runtime/runner/in-memory.d.cts +1 -1
  138. package/dist/v2/runtime/runner/index.d.cts +2 -2
  139. package/dist/v2/runtime/runner/index.d.mts +2 -2
  140. package/dist/v2/runtime/runner/index.mjs +2 -2
  141. package/dist/v2/runtime/runner/intelligence.d.cts +1 -1
  142. package/package.json +9 -3
@@ -0,0 +1,93 @@
1
+ require("reflect-metadata");
2
+ const require_runtime = require('../../../../_virtual/_rolldown/runtime.cjs');
3
+ const require_learned_skills = require('../learned-skills.cjs');
4
+ const require_errors = require('./errors.cjs');
5
+ const require_archive = require('./archive.cjs');
6
+ let node_crypto = require("node:crypto");
7
+
8
+ //#region src/v2/runtime/intelligence-platform/skill-registry/snapshot.ts
9
+ function object(value) {
10
+ return value !== null && typeof value === "object" && !Array.isArray(value);
11
+ }
12
+ function sha256(bytes) {
13
+ return (0, node_crypto.createHash)("sha256").update(bytes).digest("hex");
14
+ }
15
+ function utf8(bytes) {
16
+ try {
17
+ return new TextDecoder("utf-8", {
18
+ fatal: true,
19
+ ignoreBOM: true
20
+ }).decode(bytes);
21
+ } catch {
22
+ return;
23
+ }
24
+ }
25
+ /** Validate a replacement fully before it can become an invocation snapshot. */
26
+ async function validateSnapshot(response, signal) {
27
+ try {
28
+ if (!object(response) || !(response.bytes instanceof Uint8Array) || typeof response.revision !== "string" || typeof response.etag !== "string" || typeof response.contentType !== "string") throw require_errors.invalidSnapshot();
29
+ const { revision, etag, contentType } = response;
30
+ if (response.status !== "snapshot" || response.bytes.byteLength > require_archive.MAX_SNAPSHOT_BYTES || contentType.split(";", 1)[0]?.trim().toLowerCase() !== "application/zip" || !revision || !/^"[a-f0-9]{64}"$/.test(etag)) throw require_errors.invalidSnapshot();
31
+ const bytes = Buffer.from(response.bytes);
32
+ if (`"${sha256(bytes)}"` !== etag) throw require_errors.invalidSnapshot();
33
+ const archive = await require_archive.readArchive(bytes, signal);
34
+ const manifestBytes = archive.get("manifest.json");
35
+ if (!manifestBytes) throw require_errors.invalidSnapshot();
36
+ const decoded = utf8(manifestBytes);
37
+ if (decoded === void 0) throw require_errors.invalidSnapshot();
38
+ const manifest = JSON.parse(decoded);
39
+ if (!object(manifest)) throw require_errors.invalidSnapshot();
40
+ if (typeof manifest.schemaVersion === "number" && manifest.schemaVersion !== 1) throw new require_learned_skills.LearnedSkillsError("UNSUPPORTED_SERVER", false);
41
+ if (manifest.schemaVersion !== 1 || manifest.revision !== revision || !Array.isArray(manifest.skills)) throw require_errors.invalidSnapshot();
42
+ const expected = new Set(["manifest.json"]);
43
+ let previousName;
44
+ const skills = [];
45
+ for (const skill of manifest.skills) {
46
+ if (!object(skill) || typeof skill.name !== "string" || !require_archive.safeRelativePath(skill.name) || skill.name.includes("/") || previousName !== void 0 && Buffer.compare(Buffer.from(previousName), Buffer.from(skill.name)) >= 0 || typeof skill.description !== "string" || !Array.isArray(skill.files)) throw require_errors.invalidSnapshot();
47
+ previousName = skill.name;
48
+ let previousPath;
49
+ let hasSkill = false;
50
+ const files = [];
51
+ for (const file of skill.files) {
52
+ if (!object(file) || typeof file.path !== "string" || !require_archive.safeRelativePath(file.path) || previousPath !== void 0 && Buffer.compare(Buffer.from(previousPath), Buffer.from(file.path)) >= 0 || typeof file.size !== "number" || !Number.isSafeInteger(file.size) || file.size < 0 || typeof file.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(file.sha256)) throw require_errors.invalidSnapshot();
53
+ previousPath = file.path;
54
+ const path = `${skill.name}/${file.path}`;
55
+ if (expected.has(path)) throw require_errors.invalidSnapshot();
56
+ expected.add(path);
57
+ const content = archive.get(path);
58
+ if (!content || content.length !== file.size || sha256(content) !== file.sha256) throw require_errors.invalidSnapshot();
59
+ const text = utf8(content);
60
+ if (file.path === "SKILL.md") {
61
+ if (text === void 0) throw require_errors.invalidSnapshot();
62
+ hasSkill = true;
63
+ }
64
+ files.push(Object.freeze({
65
+ path: file.path,
66
+ size: file.size,
67
+ sha256: file.sha256,
68
+ ...text !== void 0 ? { text } : {}
69
+ }));
70
+ }
71
+ if (!hasSkill) throw require_errors.invalidSnapshot();
72
+ skills.push(Object.freeze({
73
+ name: skill.name,
74
+ description: skill.description,
75
+ files: Object.freeze(files)
76
+ }));
77
+ }
78
+ if (expected.size !== archive.size || [...archive.keys()].some((path) => !expected.has(path))) throw require_errors.invalidSnapshot();
79
+ return Object.freeze({
80
+ revision,
81
+ etag,
82
+ skills: Object.freeze(skills)
83
+ });
84
+ } catch (error) {
85
+ if (signal?.aborted) throw signal.reason;
86
+ if (error instanceof require_learned_skills.LearnedSkillsError) throw error;
87
+ throw require_errors.invalidSnapshot(error);
88
+ }
89
+ }
90
+
91
+ //#endregion
92
+ exports.validateSnapshot = validateSnapshot;
93
+ //# sourceMappingURL=snapshot.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.cjs","names":["invalidSnapshot","MAX_SNAPSHOT_BYTES","readArchive","SkillDeliveryError","safeRelativePath"],"sources":["../../../../../src/v2/runtime/intelligence-platform/skill-registry/snapshot.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport type { LearnedSkillsSnapshotResult } from \"../learned-skills\";\nimport { SkillDeliveryError, invalidSnapshot } from \"./errors\";\nimport { MAX_SNAPSHOT_BYTES, readArchive, safeRelativePath } from \"./archive\";\n\nexport interface SnapshotFile {\n readonly path: string;\n readonly size: number;\n readonly sha256: string;\n /** Absent for supporting resources that cannot be decoded as UTF-8 text. */\n readonly text?: string;\n}\nexport interface SnapshotSkill {\n readonly name: string;\n readonly description: string;\n readonly files: readonly SnapshotFile[];\n}\nexport interface VerifiedSnapshot {\n readonly revision: string;\n readonly etag: string;\n readonly skills: readonly SnapshotSkill[];\n}\n\nfunction object(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction sha256(bytes: Uint8Array): string {\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\nfunction utf8(bytes: Uint8Array): string | undefined {\n try {\n return new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: true }).decode(\n bytes,\n );\n } catch {\n return undefined;\n }\n}\n\n/** Validate a replacement fully before it can become an invocation snapshot. */\nexport async function validateSnapshot(\n response: Extract<LearnedSkillsSnapshotResult, { status: \"snapshot\" }>,\n signal?: AbortSignal,\n): Promise<VerifiedSnapshot> {\n try {\n if (\n !object(response) ||\n !(response.bytes instanceof Uint8Array) ||\n typeof response.revision !== \"string\" ||\n typeof response.etag !== \"string\" ||\n typeof response.contentType !== \"string\"\n )\n throw invalidSnapshot();\n const { revision, etag, contentType } = response;\n if (\n response.status !== \"snapshot\" ||\n response.bytes.byteLength > MAX_SNAPSHOT_BYTES ||\n contentType.split(\";\", 1)[0]?.trim().toLowerCase() !==\n \"application/zip\" ||\n !revision ||\n !/^\"[a-f0-9]{64}\"$/.test(etag)\n )\n throw invalidSnapshot();\n // Own the bytes before asynchronous decompression so an injected client\n // cannot mutate an in-flight replacement after its digest is checked.\n const bytes = Buffer.from(response.bytes);\n if (`\"${sha256(bytes)}\"` !== etag) throw invalidSnapshot();\n const archive = await readArchive(bytes, signal);\n const manifestBytes = archive.get(\"manifest.json\");\n if (!manifestBytes) throw invalidSnapshot();\n const decoded = utf8(manifestBytes);\n if (decoded === undefined) throw invalidSnapshot();\n const manifest: unknown = JSON.parse(decoded);\n if (!object(manifest)) throw invalidSnapshot();\n if (\n typeof manifest.schemaVersion === \"number\" &&\n manifest.schemaVersion !== 1\n )\n throw new SkillDeliveryError(\"UNSUPPORTED_SERVER\", false);\n if (\n manifest.schemaVersion !== 1 ||\n manifest.revision !== revision ||\n !Array.isArray(manifest.skills)\n )\n throw invalidSnapshot();\n const expected = new Set([\"manifest.json\"]);\n let previousName: string | undefined;\n const skills: SnapshotSkill[] = [];\n for (const skill of manifest.skills) {\n if (\n !object(skill) ||\n typeof skill.name !== \"string\" ||\n !safeRelativePath(skill.name) ||\n skill.name.includes(\"/\") ||\n (previousName !== undefined &&\n Buffer.compare(Buffer.from(previousName), Buffer.from(skill.name)) >=\n 0) ||\n typeof skill.description !== \"string\" ||\n !Array.isArray(skill.files)\n )\n throw invalidSnapshot();\n previousName = skill.name;\n let previousPath: string | undefined;\n let hasSkill = false;\n const files: SnapshotFile[] = [];\n for (const file of skill.files) {\n if (\n !object(file) ||\n typeof file.path !== \"string\" ||\n !safeRelativePath(file.path) ||\n (previousPath !== undefined &&\n Buffer.compare(Buffer.from(previousPath), Buffer.from(file.path)) >=\n 0) ||\n typeof file.size !== \"number\" ||\n !Number.isSafeInteger(file.size) ||\n file.size < 0 ||\n typeof file.sha256 !== \"string\" ||\n !/^[a-f0-9]{64}$/.test(file.sha256)\n )\n throw invalidSnapshot();\n previousPath = file.path;\n const path = `${skill.name}/${file.path}`;\n if (expected.has(path)) throw invalidSnapshot();\n expected.add(path);\n const content = archive.get(path);\n if (\n !content ||\n content.length !== file.size ||\n sha256(content) !== file.sha256\n )\n throw invalidSnapshot();\n const text = utf8(content);\n if (file.path === \"SKILL.md\") {\n if (text === undefined) throw invalidSnapshot();\n hasSkill = true;\n }\n files.push(\n Object.freeze({\n path: file.path,\n size: file.size,\n sha256: file.sha256,\n ...(text !== undefined ? { text } : {}),\n }),\n );\n }\n if (!hasSkill) throw invalidSnapshot();\n skills.push(\n Object.freeze({\n name: skill.name,\n description: skill.description,\n files: Object.freeze(files),\n }),\n );\n }\n if (\n expected.size !== archive.size ||\n [...archive.keys()].some((path) => !expected.has(path))\n )\n throw invalidSnapshot();\n return Object.freeze({\n revision: revision,\n etag: etag,\n skills: Object.freeze(skills),\n });\n } catch (error) {\n if (signal?.aborted) throw signal.reason;\n if (error instanceof SkillDeliveryError) throw error;\n throw invalidSnapshot(error);\n }\n}\n"],"mappings":";;;;;;;;AAuBA,SAAS,OAAO,OAAkD;AAChE,QAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;AAE7E,SAAS,OAAO,OAA2B;AACzC,oCAAkB,SAAS,CAAC,OAAO,MAAM,CAAC,OAAO,MAAM;;AAEzD,SAAS,KAAK,OAAuC;AACnD,KAAI;AACF,SAAO,IAAI,YAAY,SAAS;GAAE,OAAO;GAAM,WAAW;GAAM,CAAC,CAAC,OAChE,MACD;SACK;AACN;;;;AAKJ,eAAsB,iBACpB,UACA,QAC2B;AAC3B,KAAI;AACF,MACE,CAAC,OAAO,SAAS,IACjB,EAAE,SAAS,iBAAiB,eAC5B,OAAO,SAAS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AC5B,CAAC,CACH;;AAEH,MACE,SAAS,SAAS,QAAQ,QAC1B,CAAC,GAAG,QAAQ,MAAM,CAAC,CAAC,MAAM,SAAS,CAAC,SAAS,IAAI,KAAK,CAAC,CAEvD,OAAMA,gCAAiB;AACzB,SAAO,OAAO,OAAO;GACT;GACJ;GACN,QAAQ,OAAO,OAAO,OAAO;GAC9B,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,QAAS,OAAM,OAAO;AAClC,MAAI,iBAAiBG,0CAAoB,OAAM;AAC/C,QAAMH,+BAAgB,MAAM"}
@@ -0,0 +1,28 @@
1
+
2
+ import { LearnedSkillsSnapshotResult } from "../learned-skills.cjs";
3
+
4
+ //#region src/v2/runtime/intelligence-platform/skill-registry/snapshot.d.ts
5
+ interface SnapshotFile {
6
+ readonly path: string;
7
+ readonly size: number;
8
+ readonly sha256: string;
9
+ /** Absent for supporting resources that cannot be decoded as UTF-8 text. */
10
+ readonly text?: string;
11
+ }
12
+ interface SnapshotSkill {
13
+ readonly name: string;
14
+ readonly description: string;
15
+ readonly files: readonly SnapshotFile[];
16
+ }
17
+ interface VerifiedSnapshot {
18
+ readonly revision: string;
19
+ readonly etag: string;
20
+ readonly skills: readonly SnapshotSkill[];
21
+ }
22
+ /** Validate a replacement fully before it can become an invocation snapshot. */
23
+ declare function validateSnapshot(response: Extract<LearnedSkillsSnapshotResult, {
24
+ status: "snapshot";
25
+ }>, signal?: AbortSignal): Promise<VerifiedSnapshot>;
26
+ //#endregion
27
+ export { SnapshotFile, SnapshotSkill, VerifiedSnapshot, validateSnapshot };
28
+ //# sourceMappingURL=snapshot.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.cts","names":[],"sources":["../../../../../src/v2/runtime/intelligence-platform/skill-registry/snapshot.ts"],"mappings":";;;;UAKiB,YAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;;WAEA,IAAA;AAAA;AAAA,UAEM,aAAA;EAAA,SACN,IAAA;EAAA,SACA,WAAA;EAAA,SACA,KAAA,WAAgB,YAAA;AAAA;AAAA,UAEV,gBAAA;EAAA,SACN,QAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA,WAAiB,aAAA;AAAA;;iBAoBN,gBAAA,CACpB,QAAA,EAAU,OAAA,CAAQ,2BAAA;EAA+B,MAAA;AAAA,IACjD,MAAA,GAAS,WAAA,GACR,OAAA,CAAQ,gBAAA"}
@@ -0,0 +1,28 @@
1
+
2
+ import { LearnedSkillsSnapshotResult } from "../learned-skills.mjs";
3
+
4
+ //#region src/v2/runtime/intelligence-platform/skill-registry/snapshot.d.ts
5
+ interface SnapshotFile {
6
+ readonly path: string;
7
+ readonly size: number;
8
+ readonly sha256: string;
9
+ /** Absent for supporting resources that cannot be decoded as UTF-8 text. */
10
+ readonly text?: string;
11
+ }
12
+ interface SnapshotSkill {
13
+ readonly name: string;
14
+ readonly description: string;
15
+ readonly files: readonly SnapshotFile[];
16
+ }
17
+ interface VerifiedSnapshot {
18
+ readonly revision: string;
19
+ readonly etag: string;
20
+ readonly skills: readonly SnapshotSkill[];
21
+ }
22
+ /** Validate a replacement fully before it can become an invocation snapshot. */
23
+ declare function validateSnapshot(response: Extract<LearnedSkillsSnapshotResult, {
24
+ status: "snapshot";
25
+ }>, signal?: AbortSignal): Promise<VerifiedSnapshot>;
26
+ //#endregion
27
+ export { SnapshotFile, SnapshotSkill, VerifiedSnapshot, validateSnapshot };
28
+ //# sourceMappingURL=snapshot.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.d.mts","names":[],"sources":["../../../../../src/v2/runtime/intelligence-platform/skill-registry/snapshot.ts"],"mappings":";;;;UAKiB,YAAA;EAAA,SACN,IAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA;;WAEA,IAAA;AAAA;AAAA,UAEM,aAAA;EAAA,SACN,IAAA;EAAA,SACA,WAAA;EAAA,SACA,KAAA,WAAgB,YAAA;AAAA;AAAA,UAEV,gBAAA;EAAA,SACN,QAAA;EAAA,SACA,IAAA;EAAA,SACA,MAAA,WAAiB,aAAA;AAAA;;iBAoBN,gBAAA,CACpB,QAAA,EAAU,OAAA,CAAQ,2BAAA;EAA+B,MAAA;AAAA,IACjD,MAAA,GAAS,WAAA,GACR,OAAA,CAAQ,gBAAA"}
@@ -0,0 +1,92 @@
1
+ import "reflect-metadata";
2
+ import { LearnedSkillsError } from "../learned-skills.mjs";
3
+ import { invalidSnapshot } from "./errors.mjs";
4
+ import { MAX_SNAPSHOT_BYTES, readArchive, safeRelativePath } from "./archive.mjs";
5
+ import { createHash } from "node:crypto";
6
+
7
+ //#region src/v2/runtime/intelligence-platform/skill-registry/snapshot.ts
8
+ function object(value) {
9
+ return value !== null && typeof value === "object" && !Array.isArray(value);
10
+ }
11
+ function sha256(bytes) {
12
+ return createHash("sha256").update(bytes).digest("hex");
13
+ }
14
+ function utf8(bytes) {
15
+ try {
16
+ return new TextDecoder("utf-8", {
17
+ fatal: true,
18
+ ignoreBOM: true
19
+ }).decode(bytes);
20
+ } catch {
21
+ return;
22
+ }
23
+ }
24
+ /** Validate a replacement fully before it can become an invocation snapshot. */
25
+ async function validateSnapshot(response, signal) {
26
+ try {
27
+ if (!object(response) || !(response.bytes instanceof Uint8Array) || typeof response.revision !== "string" || typeof response.etag !== "string" || typeof response.contentType !== "string") throw invalidSnapshot();
28
+ const { revision, etag, contentType } = response;
29
+ if (response.status !== "snapshot" || response.bytes.byteLength > MAX_SNAPSHOT_BYTES || contentType.split(";", 1)[0]?.trim().toLowerCase() !== "application/zip" || !revision || !/^"[a-f0-9]{64}"$/.test(etag)) throw invalidSnapshot();
30
+ const bytes = Buffer.from(response.bytes);
31
+ if (`"${sha256(bytes)}"` !== etag) throw invalidSnapshot();
32
+ const archive = await readArchive(bytes, signal);
33
+ const manifestBytes = archive.get("manifest.json");
34
+ if (!manifestBytes) throw invalidSnapshot();
35
+ const decoded = utf8(manifestBytes);
36
+ if (decoded === void 0) throw invalidSnapshot();
37
+ const manifest = JSON.parse(decoded);
38
+ if (!object(manifest)) throw invalidSnapshot();
39
+ if (typeof manifest.schemaVersion === "number" && manifest.schemaVersion !== 1) throw new LearnedSkillsError("UNSUPPORTED_SERVER", false);
40
+ if (manifest.schemaVersion !== 1 || manifest.revision !== revision || !Array.isArray(manifest.skills)) throw invalidSnapshot();
41
+ const expected = new Set(["manifest.json"]);
42
+ let previousName;
43
+ const skills = [];
44
+ for (const skill of manifest.skills) {
45
+ if (!object(skill) || typeof skill.name !== "string" || !safeRelativePath(skill.name) || skill.name.includes("/") || previousName !== void 0 && Buffer.compare(Buffer.from(previousName), Buffer.from(skill.name)) >= 0 || typeof skill.description !== "string" || !Array.isArray(skill.files)) throw invalidSnapshot();
46
+ previousName = skill.name;
47
+ let previousPath;
48
+ let hasSkill = false;
49
+ const files = [];
50
+ for (const file of skill.files) {
51
+ if (!object(file) || typeof file.path !== "string" || !safeRelativePath(file.path) || previousPath !== void 0 && Buffer.compare(Buffer.from(previousPath), Buffer.from(file.path)) >= 0 || typeof file.size !== "number" || !Number.isSafeInteger(file.size) || file.size < 0 || typeof file.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(file.sha256)) throw invalidSnapshot();
52
+ previousPath = file.path;
53
+ const path = `${skill.name}/${file.path}`;
54
+ if (expected.has(path)) throw invalidSnapshot();
55
+ expected.add(path);
56
+ const content = archive.get(path);
57
+ if (!content || content.length !== file.size || sha256(content) !== file.sha256) throw invalidSnapshot();
58
+ const text = utf8(content);
59
+ if (file.path === "SKILL.md") {
60
+ if (text === void 0) throw invalidSnapshot();
61
+ hasSkill = true;
62
+ }
63
+ files.push(Object.freeze({
64
+ path: file.path,
65
+ size: file.size,
66
+ sha256: file.sha256,
67
+ ...text !== void 0 ? { text } : {}
68
+ }));
69
+ }
70
+ if (!hasSkill) throw invalidSnapshot();
71
+ skills.push(Object.freeze({
72
+ name: skill.name,
73
+ description: skill.description,
74
+ files: Object.freeze(files)
75
+ }));
76
+ }
77
+ if (expected.size !== archive.size || [...archive.keys()].some((path) => !expected.has(path))) throw invalidSnapshot();
78
+ return Object.freeze({
79
+ revision,
80
+ etag,
81
+ skills: Object.freeze(skills)
82
+ });
83
+ } catch (error) {
84
+ if (signal?.aborted) throw signal.reason;
85
+ if (error instanceof LearnedSkillsError) throw error;
86
+ throw invalidSnapshot(error);
87
+ }
88
+ }
89
+
90
+ //#endregion
91
+ export { validateSnapshot };
92
+ //# sourceMappingURL=snapshot.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"snapshot.mjs","names":["SkillDeliveryError"],"sources":["../../../../../src/v2/runtime/intelligence-platform/skill-registry/snapshot.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\nimport type { LearnedSkillsSnapshotResult } from \"../learned-skills\";\nimport { SkillDeliveryError, invalidSnapshot } from \"./errors\";\nimport { MAX_SNAPSHOT_BYTES, readArchive, safeRelativePath } from \"./archive\";\n\nexport interface SnapshotFile {\n readonly path: string;\n readonly size: number;\n readonly sha256: string;\n /** Absent for supporting resources that cannot be decoded as UTF-8 text. */\n readonly text?: string;\n}\nexport interface SnapshotSkill {\n readonly name: string;\n readonly description: string;\n readonly files: readonly SnapshotFile[];\n}\nexport interface VerifiedSnapshot {\n readonly revision: string;\n readonly etag: string;\n readonly skills: readonly SnapshotSkill[];\n}\n\nfunction object(value: unknown): value is Record<string, unknown> {\n return value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction sha256(bytes: Uint8Array): string {\n return createHash(\"sha256\").update(bytes).digest(\"hex\");\n}\nfunction utf8(bytes: Uint8Array): string | undefined {\n try {\n return new TextDecoder(\"utf-8\", { fatal: true, ignoreBOM: true }).decode(\n bytes,\n );\n } catch {\n return undefined;\n }\n}\n\n/** Validate a replacement fully before it can become an invocation snapshot. */\nexport async function validateSnapshot(\n response: Extract<LearnedSkillsSnapshotResult, { status: \"snapshot\" }>,\n signal?: AbortSignal,\n): Promise<VerifiedSnapshot> {\n try {\n if (\n !object(response) ||\n !(response.bytes instanceof Uint8Array) ||\n typeof response.revision !== \"string\" ||\n typeof response.etag !== \"string\" ||\n typeof response.contentType !== \"string\"\n )\n throw invalidSnapshot();\n const { revision, etag, contentType } = response;\n if (\n response.status !== \"snapshot\" ||\n response.bytes.byteLength > MAX_SNAPSHOT_BYTES ||\n contentType.split(\";\", 1)[0]?.trim().toLowerCase() !==\n \"application/zip\" ||\n !revision ||\n !/^\"[a-f0-9]{64}\"$/.test(etag)\n )\n throw invalidSnapshot();\n // Own the bytes before asynchronous decompression so an injected client\n // cannot mutate an in-flight replacement after its digest is checked.\n const bytes = Buffer.from(response.bytes);\n if (`\"${sha256(bytes)}\"` !== etag) throw invalidSnapshot();\n const archive = await readArchive(bytes, signal);\n const manifestBytes = archive.get(\"manifest.json\");\n if (!manifestBytes) throw invalidSnapshot();\n const decoded = utf8(manifestBytes);\n if (decoded === undefined) throw invalidSnapshot();\n const manifest: unknown = JSON.parse(decoded);\n if (!object(manifest)) throw invalidSnapshot();\n if (\n typeof manifest.schemaVersion === \"number\" &&\n manifest.schemaVersion !== 1\n )\n throw new SkillDeliveryError(\"UNSUPPORTED_SERVER\", false);\n if (\n manifest.schemaVersion !== 1 ||\n manifest.revision !== revision ||\n !Array.isArray(manifest.skills)\n )\n throw invalidSnapshot();\n const expected = new Set([\"manifest.json\"]);\n let previousName: string | undefined;\n const skills: SnapshotSkill[] = [];\n for (const skill of manifest.skills) {\n if (\n !object(skill) ||\n typeof skill.name !== \"string\" ||\n !safeRelativePath(skill.name) ||\n skill.name.includes(\"/\") ||\n (previousName !== undefined &&\n Buffer.compare(Buffer.from(previousName), Buffer.from(skill.name)) >=\n 0) ||\n typeof skill.description !== \"string\" ||\n !Array.isArray(skill.files)\n )\n throw invalidSnapshot();\n previousName = skill.name;\n let previousPath: string | undefined;\n let hasSkill = false;\n const files: SnapshotFile[] = [];\n for (const file of skill.files) {\n if (\n !object(file) ||\n typeof file.path !== \"string\" ||\n !safeRelativePath(file.path) ||\n (previousPath !== undefined &&\n Buffer.compare(Buffer.from(previousPath), Buffer.from(file.path)) >=\n 0) ||\n typeof file.size !== \"number\" ||\n !Number.isSafeInteger(file.size) ||\n file.size < 0 ||\n typeof file.sha256 !== \"string\" ||\n !/^[a-f0-9]{64}$/.test(file.sha256)\n )\n throw invalidSnapshot();\n previousPath = file.path;\n const path = `${skill.name}/${file.path}`;\n if (expected.has(path)) throw invalidSnapshot();\n expected.add(path);\n const content = archive.get(path);\n if (\n !content ||\n content.length !== file.size ||\n sha256(content) !== file.sha256\n )\n throw invalidSnapshot();\n const text = utf8(content);\n if (file.path === \"SKILL.md\") {\n if (text === undefined) throw invalidSnapshot();\n hasSkill = true;\n }\n files.push(\n Object.freeze({\n path: file.path,\n size: file.size,\n sha256: file.sha256,\n ...(text !== undefined ? { text } : {}),\n }),\n );\n }\n if (!hasSkill) throw invalidSnapshot();\n skills.push(\n Object.freeze({\n name: skill.name,\n description: skill.description,\n files: Object.freeze(files),\n }),\n );\n }\n if (\n expected.size !== archive.size ||\n [...archive.keys()].some((path) => !expected.has(path))\n )\n throw invalidSnapshot();\n return Object.freeze({\n revision: revision,\n etag: etag,\n skills: Object.freeze(skills),\n });\n } catch (error) {\n if (signal?.aborted) throw signal.reason;\n if (error instanceof SkillDeliveryError) throw error;\n throw invalidSnapshot(error);\n }\n}\n"],"mappings":";;;;;;;AAuBA,SAAS,OAAO,OAAkD;AAChE,QAAO,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM;;AAE7E,SAAS,OAAO,OAA2B;AACzC,QAAO,WAAW,SAAS,CAAC,OAAO,MAAM,CAAC,OAAO,MAAM;;AAEzD,SAAS,KAAK,OAAuC;AACnD,KAAI;AACF,SAAO,IAAI,YAAY,SAAS;GAAE,OAAO;GAAM,WAAW;GAAM,CAAC,CAAC,OAChE,MACD;SACK;AACN;;;;AAKJ,eAAsB,iBACpB,UACA,QAC2B;AAC3B,KAAI;AACF,MACE,CAAC,OAAO,SAAS,IACjB,EAAE,SAA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,MAAM;IAC5B,CAAC,CACH;;AAEH,MACE,SAAS,SAAS,QAAQ,QAC1B,CAAC,GAAG,QAAQ,MAAM,CAAC,CAAC,MAAM,SAAS,CAAC,SAAS,IAAI,KAAK,CAAC,CAEvD,OAAM,iBAAiB;AACzB,SAAO,OAAO,OAAO;GACT;GACJ;GACN,QAAQ,OAAO,OAAO,OAAO;GAC9B,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,QAAS,OAAM,OAAO;AAClC,MAAI,iBAAiBA,mBAAoB,OAAM;AAC/C,QAAM,gBAAgB,MAAM"}
@@ -1,6 +1,6 @@
1
1
 
2
- import { Observable } from "rxjs";
3
2
  import { AbstractAgent, BaseEvent, Message, RunAgentInput } from "@ag-ui/client";
3
+ import { Observable } from "rxjs";
4
4
 
5
5
  //#region src/v2/runtime/runner/agent-runner.d.ts
6
6
  interface AgentRunnerRunRequest {
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./agent-runner.cjs";
3
- import { Observable, ReplaySubject } from "rxjs";
4
3
  import { AbstractAgent, BaseEvent, Message } from "@ag-ui/client";
4
+ import { Observable, ReplaySubject } from "rxjs";
5
5
 
6
6
  //#region src/v2/runtime/runner/in-memory.d.ts
7
7
  interface InMemoryLimits {
@@ -2,5 +2,5 @@
2
2
  import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, LocalThreadEndpointRecord, LocalThreadEndpointRunner, supportsLocalThreadEndpoints } from "./agent-runner.cjs";
3
3
  import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵestimateBytes, ɵnormalizeLimits } from "./in-memory.cjs";
4
4
  import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary } from "./intelligence.cjs";
5
- import { finalizeRunEvents } from "@copilotkit/shared";
6
- export { finalizeRunEvents };
5
+ import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents } from "@copilotkit/shared";
6
+ export { type FinalizeRunOptions, type RunEventFinalizer, createRunEventFinalizer, finalizeRunEvents };
@@ -2,5 +2,5 @@
2
2
  import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest, LocalThreadEndpointRecord, LocalThreadEndpointRunner, supportsLocalThreadEndpoints } from "./agent-runner.mjs";
3
3
  import { InMemoryAgentRunner, InMemoryAgentRunnerOptions, InMemoryLimits, InMemoryThread, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵestimateBytes, ɵnormalizeLimits } from "./in-memory.mjs";
4
4
  import { IntelligenceAgentRunner, IntelligenceAgentRunnerOptions, RunnerStartupBoundary } from "./intelligence.mjs";
5
- import { finalizeRunEvents as finalizeRunEvents$1 } from "@copilotkit/shared";
6
- export { finalizeRunEvents$1 as finalizeRunEvents };
5
+ import { FinalizeRunOptions, RunEventFinalizer, createRunEventFinalizer as createRunEventFinalizer$1, finalizeRunEvents as finalizeRunEvents$1 } from "@copilotkit/shared";
6
+ export { type FinalizeRunOptions, type RunEventFinalizer, createRunEventFinalizer$1 as createRunEventFinalizer, finalizeRunEvents$1 as finalizeRunEvents };
@@ -2,6 +2,6 @@ import "reflect-metadata";
2
2
  import { AgentRunner, supportsLocalThreadEndpoints } from "./agent-runner.mjs";
3
3
  import { InMemoryAgentRunner, ɵBoundedThreadStore, ɵGLOBAL_STORE, ɵINMEMORY_DEFAULTS, ɵestimateBytes, ɵnormalizeLimits } from "./in-memory.mjs";
4
4
  import { IntelligenceAgentRunner } from "./intelligence.mjs";
5
- import { finalizeRunEvents as finalizeRunEvents$1 } from "@copilotkit/shared";
5
+ import { createRunEventFinalizer as createRunEventFinalizer$1, finalizeRunEvents as finalizeRunEvents$1 } from "@copilotkit/shared";
6
6
 
7
- export { finalizeRunEvents$1 as finalizeRunEvents };
7
+ export { createRunEventFinalizer$1 as createRunEventFinalizer, finalizeRunEvents$1 as finalizeRunEvents };
@@ -1,7 +1,7 @@
1
1
 
2
2
  import { AgentRunner, AgentRunnerConnectRequest, AgentRunnerIsRunningRequest, AgentRunnerRunRequest, AgentRunnerStopRequest } from "./agent-runner.cjs";
3
- import { Observable } from "rxjs";
4
3
  import { BaseEvent } from "@ag-ui/client";
4
+ import { Observable } from "rxjs";
5
5
 
6
6
  //#region src/v2/runtime/runner/intelligence.d.ts
7
7
  interface IntelligenceAgentRunnerOptions {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@copilotkit/runtime",
3
- "version": "1.72.1-canary.sp-longthread-perf",
3
+ "version": "1.73.0",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "ai",
@@ -38,6 +38,10 @@
38
38
  "import": "./dist/index.mjs",
39
39
  "require": "./dist/index.cjs"
40
40
  },
41
+ "./internal/learned-skills": {
42
+ "import": "./dist/internal/learned-skills.mjs",
43
+ "require": "./dist/internal/learned-skills.cjs"
44
+ },
41
45
  "./langgraph": {
42
46
  "import": "./dist/langgraph.mjs",
43
47
  "require": "./dist/langgraph.cjs"
@@ -78,7 +82,6 @@
78
82
  "@ai-sdk/openai": "^3.0.36",
79
83
  "@cfworker/json-schema": "^4.1.1",
80
84
  "@copilotkit/license-verifier": "~0.5.0",
81
- "@copilotkit/shared": "1.72.1-canary.sp-longthread-perf",
82
85
  "@graphql-yoga/plugin-defer-stream": "^3.3.1",
83
86
  "@hono/node-server": "^1.13.5",
84
87
  "@modelcontextprotocol/sdk": "^1.18.2",
@@ -108,8 +111,10 @@
108
111
  "uuid": "^11.1.0",
109
112
  "ws": "^8.18.0",
110
113
  "zod": "^3.23.3",
114
+ "yauzl": "2.10.0",
111
115
  "@copilotkit/channels-core": "^0.10.0",
112
- "@copilotkit/channels-intelligence": "0.10.0"
116
+ "@copilotkit/channels-intelligence": "0.10.0",
117
+ "@copilotkit/shared": "1.73.0"
113
118
  },
114
119
  "devDependencies": {
115
120
  "@copilotkit/aimock": "latest",
@@ -130,6 +135,7 @@
130
135
  "typescript": "^5.2.3",
131
136
  "valibot": "^1.2.0",
132
137
  "vitest": "^3.2.4",
138
+ "@types/yauzl": "2.10.3",
133
139
  "@copilotkit/channels": "0.10.0",
134
140
  "tsconfig": "1.4.12"
135
141
  },