@copilotkit/intelligence-langgraph 1.71.2 → 1.73.0-rc.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 (65) hide show
  1. package/README.md +35 -3
  2. package/dist/index.cjs +3 -4
  3. package/dist/index.d.cts +2 -4
  4. package/dist/index.d.mts +2 -5
  5. package/dist/index.mjs +1 -3
  6. package/dist/intelligence-delivery-core/dist/index.cjs +1 -7
  7. package/dist/intelligence-delivery-core/dist/index.d.cts +2 -0
  8. package/dist/intelligence-delivery-core/dist/index.d.mts +2 -5
  9. package/dist/intelligence-delivery-core/dist/index.mjs +2 -7
  10. package/dist/invocation.cjs +5 -5
  11. package/dist/invocation.cjs.map +1 -1
  12. package/dist/invocation.mjs +1 -2
  13. package/dist/invocation.mjs.map +1 -1
  14. package/dist/middleware.cjs +3 -4
  15. package/dist/middleware.cjs.map +1 -1
  16. package/dist/middleware.d.cts +7 -7
  17. package/dist/middleware.d.cts.map +1 -1
  18. package/dist/middleware.d.mts +7 -8
  19. package/dist/middleware.d.mts.map +1 -1
  20. package/dist/middleware.mjs +1 -3
  21. package/dist/middleware.mjs.map +1 -1
  22. package/dist/skill-tools.cjs +3 -3
  23. package/dist/skill-tools.cjs.map +1 -1
  24. package/dist/skill-tools.mjs +1 -2
  25. package/dist/skill-tools.mjs.map +1 -1
  26. package/package.json +4 -5
  27. package/dist/intelligence-delivery-core/dist/archive.cjs +0 -130
  28. package/dist/intelligence-delivery-core/dist/archive.cjs.map +0 -1
  29. package/dist/intelligence-delivery-core/dist/archive.mjs +0 -127
  30. package/dist/intelligence-delivery-core/dist/archive.mjs.map +0 -1
  31. package/dist/intelligence-delivery-core/dist/config.cjs +0 -47
  32. package/dist/intelligence-delivery-core/dist/config.cjs.map +0 -1
  33. package/dist/intelligence-delivery-core/dist/config.d.cts +0 -17
  34. package/dist/intelligence-delivery-core/dist/config.d.cts.map +0 -1
  35. package/dist/intelligence-delivery-core/dist/config.d.mts +0 -17
  36. package/dist/intelligence-delivery-core/dist/config.d.mts.map +0 -1
  37. package/dist/intelligence-delivery-core/dist/config.mjs +0 -47
  38. package/dist/intelligence-delivery-core/dist/config.mjs.map +0 -1
  39. package/dist/intelligence-delivery-core/dist/errors.cjs +0 -10
  40. package/dist/intelligence-delivery-core/dist/errors.cjs.map +0 -1
  41. package/dist/intelligence-delivery-core/dist/errors.d.cts +0 -2
  42. package/dist/intelligence-delivery-core/dist/errors.d.mts +0 -2
  43. package/dist/intelligence-delivery-core/dist/errors.mjs +0 -10
  44. package/dist/intelligence-delivery-core/dist/errors.mjs.map +0 -1
  45. package/dist/intelligence-delivery-core/dist/registry.cjs +0 -131
  46. package/dist/intelligence-delivery-core/dist/registry.cjs.map +0 -1
  47. package/dist/intelligence-delivery-core/dist/registry.d.cts +0 -31
  48. package/dist/intelligence-delivery-core/dist/registry.d.cts.map +0 -1
  49. package/dist/intelligence-delivery-core/dist/registry.d.mts +0 -31
  50. package/dist/intelligence-delivery-core/dist/registry.d.mts.map +0 -1
  51. package/dist/intelligence-delivery-core/dist/registry.mjs +0 -130
  52. package/dist/intelligence-delivery-core/dist/registry.mjs.map +0 -1
  53. package/dist/intelligence-delivery-core/dist/skill-content.cjs +0 -41
  54. package/dist/intelligence-delivery-core/dist/skill-content.cjs.map +0 -1
  55. package/dist/intelligence-delivery-core/dist/skill-content.d.mts +0 -1
  56. package/dist/intelligence-delivery-core/dist/skill-content.mjs +0 -38
  57. package/dist/intelligence-delivery-core/dist/skill-content.mjs.map +0 -1
  58. package/dist/intelligence-delivery-core/dist/snapshot.cjs +0 -91
  59. package/dist/intelligence-delivery-core/dist/snapshot.cjs.map +0 -1
  60. package/dist/intelligence-delivery-core/dist/snapshot.d.cts +0 -23
  61. package/dist/intelligence-delivery-core/dist/snapshot.d.cts.map +0 -1
  62. package/dist/intelligence-delivery-core/dist/snapshot.d.mts +0 -25
  63. package/dist/intelligence-delivery-core/dist/snapshot.d.mts.map +0 -1
  64. package/dist/intelligence-delivery-core/dist/snapshot.mjs +0 -90
  65. package/dist/intelligence-delivery-core/dist/snapshot.mjs.map +0 -1
@@ -1,130 +0,0 @@
1
- const require_errors = require('./errors.cjs');
2
- let yauzl = require("yauzl");
3
-
4
- //#region ../intelligence-delivery-core/dist/archive.mjs
5
- /** Internal corruption bounds, including manifest and directory entries. */
6
- const MAX_ARCHIVE_ENTRIES = 1e3;
7
- const MAX_SNAPSHOT_BYTES = 32 * 1024 * 1024;
8
- function safeRelativePath(path) {
9
- return path.length > 0 && !/[\\\x00-\x1f\x7f]/.test(path) && !/^[a-z]:/i.test(path) && path.split("/").every((part) => part !== "" && part !== "." && part !== "..");
10
- }
11
- /** Decode only the listed ZIP namespace. No filesystem is involved. */
12
- function readArchive(bytes, signal) {
13
- return new Promise((resolve, reject) => {
14
- let archive;
15
- let stream;
16
- let settled = false;
17
- const finish = (error) => {
18
- if (settled) return;
19
- settled = true;
20
- signal?.removeEventListener("abort", abort);
21
- stream?.destroy();
22
- archive?.close();
23
- if (error !== void 0) reject(error);
24
- else resolve(files);
25
- };
26
- const abort = () => finish(signal?.reason ?? require_errors.invalidSnapshot());
27
- const files = /* @__PURE__ */ new Map();
28
- const names = /* @__PURE__ */ new Set();
29
- let decodedBytes = 0;
30
- signal?.addEventListener("abort", abort, { once: true });
31
- if (signal?.aborted) {
32
- abort();
33
- return;
34
- }
35
- (0, yauzl.fromBuffer)(bytes, {
36
- lazyEntries: true,
37
- decodeStrings: false,
38
- validateEntrySizes: true,
39
- autoClose: false
40
- }, (error, zip) => {
41
- if (error) {
42
- finish(require_errors.invalidSnapshot(error));
43
- return;
44
- }
45
- archive = zip;
46
- if (settled) {
47
- zip.close();
48
- return;
49
- }
50
- zip.on("error", (cause) => finish(require_errors.invalidSnapshot(cause)));
51
- zip.on("end", () => finish());
52
- if (zip.entryCount > MAX_ARCHIVE_ENTRIES) {
53
- finish(require_errors.invalidSnapshot());
54
- return;
55
- }
56
- zip.on("entry", (entry) => {
57
- try {
58
- const rawName = entry.fileName;
59
- if (!Buffer.isBuffer(rawName)) throw require_errors.invalidSnapshot();
60
- const name = new TextDecoder("utf-8", {
61
- fatal: true,
62
- ignoreBOM: true
63
- }).decode(rawName);
64
- const directory = name.endsWith("/");
65
- if (!safeRelativePath(directory ? name.slice(0, -1) : name) || names.has(name)) throw require_errors.invalidSnapshot();
66
- names.add(name);
67
- const fileType = entry.externalFileAttributes >>> 16 & 61440;
68
- if (fileType !== 0 && fileType !== (directory ? 16384 : 32768)) throw require_errors.invalidSnapshot();
69
- if (entry.isEncrypted() || ![0, 8].includes(entry.compressionMethod)) throw require_errors.invalidSnapshot();
70
- if (!Number.isSafeInteger(entry.uncompressedSize) || entry.uncompressedSize < 0) throw require_errors.invalidSnapshot();
71
- decodedBytes += entry.uncompressedSize;
72
- if (decodedBytes > MAX_SNAPSHOT_BYTES || directory && entry.uncompressedSize !== 0) throw require_errors.invalidSnapshot();
73
- const local = entry.relativeOffsetOfLocalHeader;
74
- if (local < 0 || local + 30 > bytes.length || bytes.readUInt32LE(local) !== 67324752) throw require_errors.invalidSnapshot();
75
- if (bytes.readUInt16LE(local + 6) !== entry.generalPurposeBitFlag || bytes.readUInt16LE(local + 8) !== entry.compressionMethod) throw require_errors.invalidSnapshot();
76
- const localNameLength = bytes.readUInt16LE(local + 26);
77
- const localExtraLength = bytes.readUInt16LE(local + 28);
78
- if (local + 30 + localNameLength + localExtraLength + entry.compressedSize > bytes.length || !bytes.subarray(local + 30, local + 30 + localNameLength).equals(rawName)) throw require_errors.invalidSnapshot();
79
- if (!(entry.generalPurposeBitFlag & 8) && (bytes.readUInt32LE(local + 18) !== entry.compressedSize || bytes.readUInt32LE(local + 22) !== entry.uncompressedSize)) throw require_errors.invalidSnapshot();
80
- if (directory) {
81
- zip.readEntry();
82
- return;
83
- }
84
- zip.openReadStream(entry, (readError, readStream) => {
85
- if (readError) {
86
- finish(require_errors.invalidSnapshot(readError));
87
- return;
88
- }
89
- stream = readStream;
90
- if (settled) {
91
- readStream.destroy();
92
- return;
93
- }
94
- const chunks = [];
95
- let size = 0;
96
- readStream.on("error", (cause) => finish(require_errors.invalidSnapshot(cause)));
97
- readStream.on("data", (chunk) => {
98
- size += chunk.length;
99
- if (size > entry.uncompressedSize || size > MAX_SNAPSHOT_BYTES) {
100
- finish(require_errors.invalidSnapshot());
101
- return;
102
- }
103
- chunks.push(chunk);
104
- });
105
- readStream.on("end", () => {
106
- if (settled) return;
107
- if (size !== entry.uncompressedSize) {
108
- finish(require_errors.invalidSnapshot());
109
- return;
110
- }
111
- files.set(name, Buffer.concat(chunks, size));
112
- stream = void 0;
113
- zip.readEntry();
114
- });
115
- });
116
- } catch (cause) {
117
- finish(require_errors.invalidSnapshot(cause));
118
- }
119
- });
120
- zip.readEntry();
121
- });
122
- });
123
- }
124
-
125
- //#endregion
126
- exports.MAX_ARCHIVE_ENTRIES = MAX_ARCHIVE_ENTRIES;
127
- exports.MAX_SNAPSHOT_BYTES = MAX_SNAPSHOT_BYTES;
128
- exports.readArchive = readArchive;
129
- exports.safeRelativePath = safeRelativePath;
130
- //# sourceMappingURL=archive.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"archive.cjs","names":["invalidSnapshot"],"sources":["../../../../intelligence-delivery-core/dist/archive.mjs"],"sourcesContent":["import { invalidSnapshot } from \"./errors.mjs\";\nimport { fromBuffer } from \"yauzl\";\n\n//#region src/archive.ts\n/** Internal corruption bounds, including manifest and directory entries. */\nconst MAX_ARCHIVE_ENTRIES = 1e3;\nconst MAX_SNAPSHOT_BYTES = 32 * 1024 * 1024;\nfunction safeRelativePath(path) {\n\treturn path.length > 0 && !/[\\\\\\x00-\\x1f\\x7f]/.test(path) && !/^[a-z]:/i.test(path) && path.split(\"/\").every((part) => part !== \"\" && part !== \".\" && part !== \"..\");\n}\n/** Decode only the listed ZIP namespace. No filesystem is involved. */\nfunction readArchive(bytes, signal) {\n\treturn new Promise((resolve, reject) => {\n\t\tlet archive;\n\t\tlet stream;\n\t\tlet settled = false;\n\t\tconst finish = (error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\t\tstream?.destroy();\n\t\t\tarchive?.close();\n\t\t\tif (error !== void 0) reject(error);\n\t\t\telse resolve(files);\n\t\t};\n\t\tconst abort = () => finish(signal?.reason ?? invalidSnapshot());\n\t\tconst files = /* @__PURE__ */ new Map();\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tlet decodedBytes = 0;\n\t\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\t\tif (signal?.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\t\tfromBuffer(bytes, {\n\t\t\tlazyEntries: true,\n\t\t\tdecodeStrings: false,\n\t\t\tvalidateEntrySizes: true,\n\t\t\tautoClose: false\n\t\t}, (error, zip) => {\n\t\t\tif (error) {\n\t\t\t\tfinish(invalidSnapshot(error));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tarchive = zip;\n\t\t\tif (settled) {\n\t\t\t\tzip.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tzip.on(\"error\", (cause) => finish(invalidSnapshot(cause)));\n\t\t\tzip.on(\"end\", () => finish());\n\t\t\tif (zip.entryCount > MAX_ARCHIVE_ENTRIES) {\n\t\t\t\tfinish(invalidSnapshot());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tzip.on(\"entry\", (entry) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst rawName = entry.fileName;\n\t\t\t\t\tif (!Buffer.isBuffer(rawName)) throw invalidSnapshot();\n\t\t\t\t\tconst name = new TextDecoder(\"utf-8\", {\n\t\t\t\t\t\tfatal: true,\n\t\t\t\t\t\tignoreBOM: true\n\t\t\t\t\t}).decode(rawName);\n\t\t\t\t\tconst directory = name.endsWith(\"/\");\n\t\t\t\t\tif (!safeRelativePath(directory ? name.slice(0, -1) : name) || names.has(name)) throw invalidSnapshot();\n\t\t\t\t\tnames.add(name);\n\t\t\t\t\tconst fileType = entry.externalFileAttributes >>> 16 & 61440;\n\t\t\t\t\tif (fileType !== 0 && fileType !== (directory ? 16384 : 32768)) throw invalidSnapshot();\n\t\t\t\t\tif (entry.isEncrypted() || ![0, 8].includes(entry.compressionMethod)) throw invalidSnapshot();\n\t\t\t\t\tif (!Number.isSafeInteger(entry.uncompressedSize) || entry.uncompressedSize < 0) throw invalidSnapshot();\n\t\t\t\t\tdecodedBytes += entry.uncompressedSize;\n\t\t\t\t\tif (decodedBytes > MAX_SNAPSHOT_BYTES || directory && entry.uncompressedSize !== 0) throw invalidSnapshot();\n\t\t\t\t\tconst local = entry.relativeOffsetOfLocalHeader;\n\t\t\t\t\tif (local < 0 || local + 30 > bytes.length || bytes.readUInt32LE(local) !== 67324752) throw invalidSnapshot();\n\t\t\t\t\tif (bytes.readUInt16LE(local + 6) !== entry.generalPurposeBitFlag || bytes.readUInt16LE(local + 8) !== entry.compressionMethod) throw invalidSnapshot();\n\t\t\t\t\tconst localNameLength = bytes.readUInt16LE(local + 26);\n\t\t\t\t\tconst localExtraLength = bytes.readUInt16LE(local + 28);\n\t\t\t\t\tif (local + 30 + localNameLength + localExtraLength + entry.compressedSize > bytes.length || !bytes.subarray(local + 30, local + 30 + localNameLength).equals(rawName)) throw invalidSnapshot();\n\t\t\t\t\tif (!(entry.generalPurposeBitFlag & 8) && (bytes.readUInt32LE(local + 18) !== entry.compressedSize || bytes.readUInt32LE(local + 22) !== entry.uncompressedSize)) throw invalidSnapshot();\n\t\t\t\t\tif (directory) {\n\t\t\t\t\t\tzip.readEntry();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tzip.openReadStream(entry, (readError, readStream) => {\n\t\t\t\t\t\tif (readError) {\n\t\t\t\t\t\t\tfinish(invalidSnapshot(readError));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstream = readStream;\n\t\t\t\t\t\tif (settled) {\n\t\t\t\t\t\t\treadStream.destroy();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst chunks = [];\n\t\t\t\t\t\tlet size = 0;\n\t\t\t\t\t\treadStream.on(\"error\", (cause) => finish(invalidSnapshot(cause)));\n\t\t\t\t\t\treadStream.on(\"data\", (chunk) => {\n\t\t\t\t\t\t\tsize += chunk.length;\n\t\t\t\t\t\t\tif (size > entry.uncompressedSize || size > MAX_SNAPSHOT_BYTES) {\n\t\t\t\t\t\t\t\tfinish(invalidSnapshot());\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchunks.push(chunk);\n\t\t\t\t\t\t});\n\t\t\t\t\t\treadStream.on(\"end\", () => {\n\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\tif (size !== entry.uncompressedSize) {\n\t\t\t\t\t\t\t\tfinish(invalidSnapshot());\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfiles.set(name, Buffer.concat(chunks, size));\n\t\t\t\t\t\t\tstream = void 0;\n\t\t\t\t\t\t\tzip.readEntry();\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfinish(invalidSnapshot(cause));\n\t\t\t\t}\n\t\t\t});\n\t\t\tzip.readEntry();\n\t\t});\n\t});\n}\n\n//#endregion\nexport { MAX_ARCHIVE_ENTRIES, MAX_SNAPSHOT_BYTES, readArchive, safeRelativePath };\n//# sourceMappingURL=archive.mjs.map"],"mappings":";;;;;AAKA,MAAM,sBAAsB;AAC5B,MAAM,qBAAqB,KAAK,OAAO;AACvC,SAAS,iBAAiB,MAAM;AAC/B,QAAO,KAAK,SAAS,KAAK,CAAC,oBAAoB,KAAK,KAAK,IAAI,CAAC,WAAW,KAAK,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC,OAAO,SAAS,SAAS,MAAM,SAAS,OAAO,SAAS,KAAK;;;AAGrK,SAAS,YAAY,O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AACZ,kBAAW,SAAS;AACpB;;MAED,MAAM,SAAS,EAAE;MACjB,IAAI,OAAO;AACX,iBAAW,GAAG,UAAU,UAAU,OAAOA,+BAAgB,MAAM,CAAC,CAAC;AACjE,iBAAW,GAAG,SAAS,UAAU;AAChC,eAAQ,MAAM;AACd,WAAI,OAAO,MAAM,oBAAoB,OAAO,oBAAoB;AAC/D,eAAOA,gCAAiB,CAAC;AACzB;;AAED,cAAO,KAAK,MAAM;QACjB;AACF,iBAAW,GAAG,aAAa;AAC1B,WAAI,QAAS;AACb,WAAI,SAAS,MAAM,kBAAkB;AACpC,eAAOA,gCAAiB,CAAC;AACzB;;AAED,aAAM,IAAI,MAAM,OAAO,OAAO,QAAQ,KAAK,CAAC;AAC5C,gBAAS,KAAK;AACd,WAAI,WAAW;QACd;OACD;aACM,OAAO;AACf,YAAOA,+BAAgB,MAAM,CAAC;;KAE9B;AACF,OAAI,WAAW;IACd;GACD"}
@@ -1,127 +0,0 @@
1
- import { invalidSnapshot } from "./errors.mjs";
2
- import { fromBuffer } from "yauzl";
3
-
4
- //#region ../intelligence-delivery-core/dist/archive.mjs
5
- /** Internal corruption bounds, including manifest and directory entries. */
6
- const MAX_ARCHIVE_ENTRIES = 1e3;
7
- const MAX_SNAPSHOT_BYTES = 32 * 1024 * 1024;
8
- function safeRelativePath(path) {
9
- return path.length > 0 && !/[\\\x00-\x1f\x7f]/.test(path) && !/^[a-z]:/i.test(path) && path.split("/").every((part) => part !== "" && part !== "." && part !== "..");
10
- }
11
- /** Decode only the listed ZIP namespace. No filesystem is involved. */
12
- function readArchive(bytes, signal) {
13
- return new Promise((resolve, reject) => {
14
- let archive;
15
- let stream;
16
- let settled = false;
17
- const finish = (error) => {
18
- if (settled) return;
19
- settled = true;
20
- signal?.removeEventListener("abort", abort);
21
- stream?.destroy();
22
- archive?.close();
23
- if (error !== void 0) reject(error);
24
- else resolve(files);
25
- };
26
- const abort = () => finish(signal?.reason ?? invalidSnapshot());
27
- const files = /* @__PURE__ */ new Map();
28
- const names = /* @__PURE__ */ new Set();
29
- let decodedBytes = 0;
30
- signal?.addEventListener("abort", abort, { once: true });
31
- if (signal?.aborted) {
32
- abort();
33
- return;
34
- }
35
- fromBuffer(bytes, {
36
- lazyEntries: true,
37
- decodeStrings: false,
38
- validateEntrySizes: true,
39
- autoClose: false
40
- }, (error, zip) => {
41
- if (error) {
42
- finish(invalidSnapshot(error));
43
- return;
44
- }
45
- archive = zip;
46
- if (settled) {
47
- zip.close();
48
- return;
49
- }
50
- zip.on("error", (cause) => finish(invalidSnapshot(cause)));
51
- zip.on("end", () => finish());
52
- if (zip.entryCount > MAX_ARCHIVE_ENTRIES) {
53
- finish(invalidSnapshot());
54
- return;
55
- }
56
- zip.on("entry", (entry) => {
57
- try {
58
- const rawName = entry.fileName;
59
- if (!Buffer.isBuffer(rawName)) throw invalidSnapshot();
60
- const name = new TextDecoder("utf-8", {
61
- fatal: true,
62
- ignoreBOM: true
63
- }).decode(rawName);
64
- const directory = name.endsWith("/");
65
- if (!safeRelativePath(directory ? name.slice(0, -1) : name) || names.has(name)) throw invalidSnapshot();
66
- names.add(name);
67
- const fileType = entry.externalFileAttributes >>> 16 & 61440;
68
- if (fileType !== 0 && fileType !== (directory ? 16384 : 32768)) throw invalidSnapshot();
69
- if (entry.isEncrypted() || ![0, 8].includes(entry.compressionMethod)) throw invalidSnapshot();
70
- if (!Number.isSafeInteger(entry.uncompressedSize) || entry.uncompressedSize < 0) throw invalidSnapshot();
71
- decodedBytes += entry.uncompressedSize;
72
- if (decodedBytes > MAX_SNAPSHOT_BYTES || directory && entry.uncompressedSize !== 0) throw invalidSnapshot();
73
- const local = entry.relativeOffsetOfLocalHeader;
74
- if (local < 0 || local + 30 > bytes.length || bytes.readUInt32LE(local) !== 67324752) throw invalidSnapshot();
75
- if (bytes.readUInt16LE(local + 6) !== entry.generalPurposeBitFlag || bytes.readUInt16LE(local + 8) !== entry.compressionMethod) throw invalidSnapshot();
76
- const localNameLength = bytes.readUInt16LE(local + 26);
77
- const localExtraLength = bytes.readUInt16LE(local + 28);
78
- if (local + 30 + localNameLength + localExtraLength + entry.compressedSize > bytes.length || !bytes.subarray(local + 30, local + 30 + localNameLength).equals(rawName)) throw invalidSnapshot();
79
- if (!(entry.generalPurposeBitFlag & 8) && (bytes.readUInt32LE(local + 18) !== entry.compressedSize || bytes.readUInt32LE(local + 22) !== entry.uncompressedSize)) throw invalidSnapshot();
80
- if (directory) {
81
- zip.readEntry();
82
- return;
83
- }
84
- zip.openReadStream(entry, (readError, readStream) => {
85
- if (readError) {
86
- finish(invalidSnapshot(readError));
87
- return;
88
- }
89
- stream = readStream;
90
- if (settled) {
91
- readStream.destroy();
92
- return;
93
- }
94
- const chunks = [];
95
- let size = 0;
96
- readStream.on("error", (cause) => finish(invalidSnapshot(cause)));
97
- readStream.on("data", (chunk) => {
98
- size += chunk.length;
99
- if (size > entry.uncompressedSize || size > MAX_SNAPSHOT_BYTES) {
100
- finish(invalidSnapshot());
101
- return;
102
- }
103
- chunks.push(chunk);
104
- });
105
- readStream.on("end", () => {
106
- if (settled) return;
107
- if (size !== entry.uncompressedSize) {
108
- finish(invalidSnapshot());
109
- return;
110
- }
111
- files.set(name, Buffer.concat(chunks, size));
112
- stream = void 0;
113
- zip.readEntry();
114
- });
115
- });
116
- } catch (cause) {
117
- finish(invalidSnapshot(cause));
118
- }
119
- });
120
- zip.readEntry();
121
- });
122
- });
123
- }
124
-
125
- //#endregion
126
- export { MAX_ARCHIVE_ENTRIES, MAX_SNAPSHOT_BYTES, readArchive, safeRelativePath };
127
- //# sourceMappingURL=archive.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"archive.mjs","names":[],"sources":["../../../../intelligence-delivery-core/dist/archive.mjs"],"sourcesContent":["import { invalidSnapshot } from \"./errors.mjs\";\nimport { fromBuffer } from \"yauzl\";\n\n//#region src/archive.ts\n/** Internal corruption bounds, including manifest and directory entries. */\nconst MAX_ARCHIVE_ENTRIES = 1e3;\nconst MAX_SNAPSHOT_BYTES = 32 * 1024 * 1024;\nfunction safeRelativePath(path) {\n\treturn path.length > 0 && !/[\\\\\\x00-\\x1f\\x7f]/.test(path) && !/^[a-z]:/i.test(path) && path.split(\"/\").every((part) => part !== \"\" && part !== \".\" && part !== \"..\");\n}\n/** Decode only the listed ZIP namespace. No filesystem is involved. */\nfunction readArchive(bytes, signal) {\n\treturn new Promise((resolve, reject) => {\n\t\tlet archive;\n\t\tlet stream;\n\t\tlet settled = false;\n\t\tconst finish = (error) => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tsignal?.removeEventListener(\"abort\", abort);\n\t\t\tstream?.destroy();\n\t\t\tarchive?.close();\n\t\t\tif (error !== void 0) reject(error);\n\t\t\telse resolve(files);\n\t\t};\n\t\tconst abort = () => finish(signal?.reason ?? invalidSnapshot());\n\t\tconst files = /* @__PURE__ */ new Map();\n\t\tconst names = /* @__PURE__ */ new Set();\n\t\tlet decodedBytes = 0;\n\t\tsignal?.addEventListener(\"abort\", abort, { once: true });\n\t\tif (signal?.aborted) {\n\t\t\tabort();\n\t\t\treturn;\n\t\t}\n\t\tfromBuffer(bytes, {\n\t\t\tlazyEntries: true,\n\t\t\tdecodeStrings: false,\n\t\t\tvalidateEntrySizes: true,\n\t\t\tautoClose: false\n\t\t}, (error, zip) => {\n\t\t\tif (error) {\n\t\t\t\tfinish(invalidSnapshot(error));\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tarchive = zip;\n\t\t\tif (settled) {\n\t\t\t\tzip.close();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tzip.on(\"error\", (cause) => finish(invalidSnapshot(cause)));\n\t\t\tzip.on(\"end\", () => finish());\n\t\t\tif (zip.entryCount > MAX_ARCHIVE_ENTRIES) {\n\t\t\t\tfinish(invalidSnapshot());\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tzip.on(\"entry\", (entry) => {\n\t\t\t\ttry {\n\t\t\t\t\tconst rawName = entry.fileName;\n\t\t\t\t\tif (!Buffer.isBuffer(rawName)) throw invalidSnapshot();\n\t\t\t\t\tconst name = new TextDecoder(\"utf-8\", {\n\t\t\t\t\t\tfatal: true,\n\t\t\t\t\t\tignoreBOM: true\n\t\t\t\t\t}).decode(rawName);\n\t\t\t\t\tconst directory = name.endsWith(\"/\");\n\t\t\t\t\tif (!safeRelativePath(directory ? name.slice(0, -1) : name) || names.has(name)) throw invalidSnapshot();\n\t\t\t\t\tnames.add(name);\n\t\t\t\t\tconst fileType = entry.externalFileAttributes >>> 16 & 61440;\n\t\t\t\t\tif (fileType !== 0 && fileType !== (directory ? 16384 : 32768)) throw invalidSnapshot();\n\t\t\t\t\tif (entry.isEncrypted() || ![0, 8].includes(entry.compressionMethod)) throw invalidSnapshot();\n\t\t\t\t\tif (!Number.isSafeInteger(entry.uncompressedSize) || entry.uncompressedSize < 0) throw invalidSnapshot();\n\t\t\t\t\tdecodedBytes += entry.uncompressedSize;\n\t\t\t\t\tif (decodedBytes > MAX_SNAPSHOT_BYTES || directory && entry.uncompressedSize !== 0) throw invalidSnapshot();\n\t\t\t\t\tconst local = entry.relativeOffsetOfLocalHeader;\n\t\t\t\t\tif (local < 0 || local + 30 > bytes.length || bytes.readUInt32LE(local) !== 67324752) throw invalidSnapshot();\n\t\t\t\t\tif (bytes.readUInt16LE(local + 6) !== entry.generalPurposeBitFlag || bytes.readUInt16LE(local + 8) !== entry.compressionMethod) throw invalidSnapshot();\n\t\t\t\t\tconst localNameLength = bytes.readUInt16LE(local + 26);\n\t\t\t\t\tconst localExtraLength = bytes.readUInt16LE(local + 28);\n\t\t\t\t\tif (local + 30 + localNameLength + localExtraLength + entry.compressedSize > bytes.length || !bytes.subarray(local + 30, local + 30 + localNameLength).equals(rawName)) throw invalidSnapshot();\n\t\t\t\t\tif (!(entry.generalPurposeBitFlag & 8) && (bytes.readUInt32LE(local + 18) !== entry.compressedSize || bytes.readUInt32LE(local + 22) !== entry.uncompressedSize)) throw invalidSnapshot();\n\t\t\t\t\tif (directory) {\n\t\t\t\t\t\tzip.readEntry();\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tzip.openReadStream(entry, (readError, readStream) => {\n\t\t\t\t\t\tif (readError) {\n\t\t\t\t\t\t\tfinish(invalidSnapshot(readError));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tstream = readStream;\n\t\t\t\t\t\tif (settled) {\n\t\t\t\t\t\t\treadStream.destroy();\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst chunks = [];\n\t\t\t\t\t\tlet size = 0;\n\t\t\t\t\t\treadStream.on(\"error\", (cause) => finish(invalidSnapshot(cause)));\n\t\t\t\t\t\treadStream.on(\"data\", (chunk) => {\n\t\t\t\t\t\t\tsize += chunk.length;\n\t\t\t\t\t\t\tif (size > entry.uncompressedSize || size > MAX_SNAPSHOT_BYTES) {\n\t\t\t\t\t\t\t\tfinish(invalidSnapshot());\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchunks.push(chunk);\n\t\t\t\t\t\t});\n\t\t\t\t\t\treadStream.on(\"end\", () => {\n\t\t\t\t\t\t\tif (settled) return;\n\t\t\t\t\t\t\tif (size !== entry.uncompressedSize) {\n\t\t\t\t\t\t\t\tfinish(invalidSnapshot());\n\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tfiles.set(name, Buffer.concat(chunks, size));\n\t\t\t\t\t\t\tstream = void 0;\n\t\t\t\t\t\t\tzip.readEntry();\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t} catch (cause) {\n\t\t\t\t\tfinish(invalidSnapshot(cause));\n\t\t\t\t}\n\t\t\t});\n\t\t\tzip.readEntry();\n\t\t});\n\t});\n}\n\n//#endregion\nexport { MAX_ARCHIVE_ENTRIES, MAX_SNAPSHOT_BYTES, readArchive, safeRelativePath };\n//# sourceMappingURL=archive.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AO,MAAM,aAAa,QAAQ,GAAG,KAAK,MAAM,kBAAkB,MAAM,aAAa,QAAQ,GAAG,KAAK,MAAM,kBAAmB,OAAM,iBAAiB;AACzL,SAAI,WAAW;AACd,UAAI,WAAW;AACf;;AAED,SAAI,eAAe,QAAQ,WAAW,eAAe;AACpD,UAAI,WAAW;AACd,cAAO,gBAAgB,UAAU,CAAC;AAClC;;AAED,eAAS;AACT,UAAI,SAAS;AACZ,kBAAW,SAAS;AACpB;;MAED,MAAM,SAAS,EAAE;MACjB,IAAI,OAAO;AACX,iBAAW,GAAG,UAAU,UAAU,OAAO,gBAAgB,MAAM,CAAC,CAAC;AACjE,iBAAW,GAAG,SAAS,UAAU;AAChC,eAAQ,MAAM;AACd,WAAI,OAAO,MAAM,oBAAoB,OAAO,oBAAoB;AAC/D,eAAO,iBAAiB,CAAC;AACzB;;AAED,cAAO,KAAK,MAAM;QACjB;AACF,iBAAW,GAAG,aAAa;AAC1B,WAAI,QAAS;AACb,WAAI,SAAS,MAAM,kBAAkB;AACpC,eAAO,iBAAiB,CAAC;AACzB;;AAED,aAAM,IAAI,MAAM,OAAO,OAAO,QAAQ,KAAK,CAAC;AAC5C,gBAAS,KAAK;AACd,WAAI,WAAW;QACd;OACD;aACM,OAAO;AACf,YAAO,gBAAgB,MAAM,CAAC;;KAE9B;AACF,OAAI,WAAW;IACd;GACD"}
@@ -1,47 +0,0 @@
1
- require('./errors.cjs');
2
- let _copilotkit_runtime_v2 = require("@copilotkit/runtime/v2");
3
-
4
- //#region ../intelligence-delivery-core/dist/config.mjs
5
- /** Resolve once. Never retain the options object, environment, or a second key. */
6
- function resolveRegistryConfig(options = {}, environment = process.env) {
7
- try {
8
- const containerId = options.containerId ?? environment.CPK_INTELLIGENCE_LEARNING_CONTAINER_ID;
9
- const revision = options.revision ?? environment.CPK_INTELLIGENCE_SKILLS_REVISION;
10
- const freshnessWindowMs = options.freshnessWindowMs ?? 5e3;
11
- const requestTimeoutMs = options.requestTimeoutMs ?? 5e3;
12
- const debug = options.debug ?? false;
13
- if (typeof containerId !== "string" || !containerId.trim() || revision !== void 0 && (typeof revision !== "string" || revision.length === 0) || !Number.isSafeInteger(freshnessWindowMs) || freshnessWindowMs < 0 || !Number.isSafeInteger(requestTimeoutMs) || requestTimeoutMs < 1 || requestTimeoutMs > 2147483647 || typeof debug !== "boolean") throw new _copilotkit_runtime_v2.LearnedSkillsError("INVALID_CONFIG", false);
14
- let client = options.client;
15
- if (client !== void 0) {
16
- if (!client || typeof client.getLearnedSkillsSnapshot !== "function") throw new _copilotkit_runtime_v2.LearnedSkillsError("INVALID_CONFIG", false);
17
- } else {
18
- const apiKey = options.apiKey ?? environment.CPK_INTELLIGENCE_API_KEY;
19
- const apiUrl = options.apiUrl ?? environment.INTELLIGENCE_API_URL;
20
- if (typeof apiKey !== "string" || !apiKey.trim()) throw new _copilotkit_runtime_v2.LearnedSkillsError("INVALID_CONFIG", false);
21
- if (apiUrl?.trim()) {
22
- const url = new URL(apiUrl);
23
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new _copilotkit_runtime_v2.LearnedSkillsError("INVALID_CONFIG", false);
24
- }
25
- client = new _copilotkit_runtime_v2.CopilotKitIntelligence({
26
- apiKey,
27
- ...apiUrl !== void 0 ? { apiUrl } : {},
28
- ...apiUrl?.trim() ? { wsUrl: "wss://realtime.intelligence.copilotkit.ai" } : {}
29
- });
30
- }
31
- return Object.freeze({
32
- client,
33
- containerId,
34
- ...revision !== void 0 ? { revision } : {},
35
- freshnessWindowMs,
36
- requestTimeoutMs,
37
- debug
38
- });
39
- } catch (error) {
40
- if (error instanceof _copilotkit_runtime_v2.LearnedSkillsError) throw error;
41
- throw new _copilotkit_runtime_v2.LearnedSkillsError("INVALID_CONFIG", false, error);
42
- }
43
- }
44
-
45
- //#endregion
46
- exports.resolveRegistryConfig = resolveRegistryConfig;
47
- //# sourceMappingURL=config.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.cjs","names":["SkillDeliveryError","CopilotKitIntelligence"],"sources":["../../../../intelligence-delivery-core/dist/config.mjs"],"sourcesContent":["import { SkillDeliveryError } from \"./errors.mjs\";\nimport { CopilotKitIntelligence } from \"@copilotkit/runtime/v2\";\n\n//#region src/config.ts\n/** Resolve once. Never retain the options object, environment, or a second key. */\nfunction resolveRegistryConfig(options = {}, environment = process.env) {\n\ttry {\n\t\tconst containerId = options.containerId ?? environment.CPK_INTELLIGENCE_LEARNING_CONTAINER_ID;\n\t\tconst revision = options.revision ?? environment.CPK_INTELLIGENCE_SKILLS_REVISION;\n\t\tconst freshnessWindowMs = options.freshnessWindowMs ?? 5e3;\n\t\tconst requestTimeoutMs = options.requestTimeoutMs ?? 5e3;\n\t\tconst debug = options.debug ?? false;\n\t\tif (typeof containerId !== \"string\" || !containerId.trim() || revision !== void 0 && (typeof revision !== \"string\" || revision.length === 0) || !Number.isSafeInteger(freshnessWindowMs) || freshnessWindowMs < 0 || !Number.isSafeInteger(requestTimeoutMs) || requestTimeoutMs < 1 || requestTimeoutMs > 2147483647 || typeof debug !== \"boolean\") throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\tlet client = options.client;\n\t\tif (client !== void 0) {\n\t\t\tif (!client || typeof client.getLearnedSkillsSnapshot !== \"function\") throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\t} else {\n\t\t\tconst apiKey = options.apiKey ?? environment.CPK_INTELLIGENCE_API_KEY;\n\t\t\tconst apiUrl = options.apiUrl ?? environment.INTELLIGENCE_API_URL;\n\t\t\tif (typeof apiKey !== \"string\" || !apiKey.trim()) throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\t\tif (apiUrl?.trim()) {\n\t\t\t\tconst url = new URL(apiUrl);\n\t\t\t\tif (![\"http:\", \"https:\"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\t\t}\n\t\t\tclient = new CopilotKitIntelligence({\n\t\t\t\tapiKey,\n\t\t\t\t...apiUrl !== void 0 ? { apiUrl } : {},\n\t\t\t\t...apiUrl?.trim() ? { wsUrl: \"wss://realtime.intelligence.copilotkit.ai\" } : {}\n\t\t\t});\n\t\t}\n\t\treturn Object.freeze({\n\t\t\tclient,\n\t\t\tcontainerId,\n\t\t\t...revision !== void 0 ? { revision } : {},\n\t\t\tfreshnessWindowMs,\n\t\t\trequestTimeoutMs,\n\t\t\tdebug\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof SkillDeliveryError) throw error;\n\t\tthrow new SkillDeliveryError(\"INVALID_CONFIG\", false, error);\n\t}\n}\n\n//#endregion\nexport { resolveRegistryConfig };\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;;;AAKA,SAAS,sBAAsB,UAAU,EAAE,EAAE,cAAc,QAAQ,KAAK;AACvE,KAAI;EACH,MAAM,cAAc,QAAQ,eAAe,YAAY;EACvD,MAAM,WAAW,QAAQ,YAAY,YAAY;EACjD,MAAM,oBAAoB,QAAQ,qBAAqB;EACvD,MAAM,mBAAmB,QAAQ,oBAAoB;EACrD,MAAM,QAAQ,QAAQ,SAAS;AAC/B,MAAI,OAAO,gBAAgB,YAAY,CAAC,YAAY,MAAM,IAAI,aAAa,KAAK,MAAM,OAAO,aAAa,YAAY,SAAS,WAAW,MAAM,CAAC,OAAO,cAAc,kBAAkB,IAAI,oBAAoB,KAAK,CAAC,OAAO,cAAc,iBAAiB,IAAI,mBAAmB,KAAK,mBAAmB,cAAc,OAAO,UAAU,UAAW,OAAM,IAAIA,0CAAmB,kBAAkB,MAAM;EAC1Y,IAAI,SAAS,QAAQ;AACrB,MAAI,WAAW,KAAK,GACnB;OAAI,CAAC,UAAU,OAAO,OAAO,6BAA6B,WAAY,OAAM,IAAIA,0CAAmB,kBAAkB,MAAM;SACrH;GACN,MAAM,SAAS,QAAQ,UAAU,YAAY;GAC7C,MAAM,SAAS,QAAQ,UAAU,YAAY;AAC7C,OAAI,OAAO,WAAW,YAAY,CAAC,OAAO,MAAM,CAAE,OAAM,IAAIA,0CAAmB,kBAAkB,MAAM;AACvG,OAAI,QAAQ,MAAM,EAAE;IACnB,MAAM,MAAM,IAAI,IAAI,OAAO;AAC3B,QAAI,CAAC,CAAC,SAAS,SAAS,CAAC,SAAS,IAAI,SAAS,IAAI,IAAI,YAAY,IAAI,YAAY,IAAI,UAAU,IAAI,KAAM,OAAM,IAAIA,0CAAmB,kBAAkB,MAAM;;AAEjK,YAAS,IAAIC,8CAAuB;IACnC;IACA,GAAG,WAAW,KAAK,IAAI,EAAE,QAAQ,GAAG,EAAE;IACtC,GAAG,QAAQ,MAAM,GAAG,EAAE,OAAO,6CAA6C,GAAG,EAAE;IAC/E,CAAC;;AAEH,SAAO,OAAO,OAAO;GACpB;GACA;GACA,GAAG,aAAa,KAAK,IAAI,EAAE,UAAU,GAAG,EAAE;GAC1C;GACA;GACA;GACA,CAAC;UACM,OAAO;AACf,MAAI,iBAAiBD,0CAAoB,OAAM;AAC/C,QAAM,IAAIA,0CAAmB,kBAAkB,OAAO,MAAM"}
@@ -1,17 +0,0 @@
1
- import { CopilotKitIntelligence } from "@copilotkit/runtime/v2";
2
-
3
- //#region ../intelligence-delivery-core/dist/config.d.mts
4
- //#region src/config.d.ts
5
- interface SkillRegistryOptions {
6
- client?: CopilotKitIntelligence;
7
- apiKey?: string;
8
- apiUrl?: string;
9
- containerId?: string;
10
- revision?: string;
11
- freshnessWindowMs?: number;
12
- requestTimeoutMs?: number;
13
- debug?: boolean;
14
- }
15
- //#endregion
16
- export { SkillRegistryOptions };
17
- //# sourceMappingURL=config.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.cts","names":["CopilotKitIntelligence","SkillRegistryOptions","client","apiKey","apiUrl","containerId","revision","freshnessWindowMs","requestTimeoutMs","debug","RegistryConfig","resolveRegistryConfig","NodeJS","ProcessEnv","options","environment"],"sources":["../../../../intelligence-delivery-core/dist/config.d.mts"],"mappings":";;;;UAGUC,oBAAAA;EACRC,MAAAA,GAASF,sBAAAA;EACTG,MAAAA;EACAC,MAAAA;EACAC,WAAAA;EACAC,QAAAA;EACAC,iBAAAA;EACAC,gBAAAA;EACAC,KAAAA;AAAAA"}
@@ -1,17 +0,0 @@
1
- import { CopilotKitIntelligence } from "@copilotkit/runtime/v2";
2
-
3
- //#region ../intelligence-delivery-core/dist/config.d.mts
4
- //#region src/config.d.ts
5
- interface SkillRegistryOptions {
6
- client?: CopilotKitIntelligence;
7
- apiKey?: string;
8
- apiUrl?: string;
9
- containerId?: string;
10
- revision?: string;
11
- freshnessWindowMs?: number;
12
- requestTimeoutMs?: number;
13
- debug?: boolean;
14
- }
15
- //#endregion
16
- export { SkillRegistryOptions };
17
- //# sourceMappingURL=config.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.mts","names":["CopilotKitIntelligence","SkillRegistryOptions","client","apiKey","apiUrl","containerId","revision","freshnessWindowMs","requestTimeoutMs","debug","RegistryConfig","resolveRegistryConfig","NodeJS","ProcessEnv","options","environment"],"sources":["../../../../intelligence-delivery-core/dist/config.d.mts"],"mappings":";;;;UAGUC,oBAAAA;EACRC,MAAAA,GAASF,sBAAAA;EACTG,MAAAA;EACAC,MAAAA;EACAC,WAAAA;EACAC,QAAAA;EACAC,iBAAAA;EACAC,gBAAAA;EACAC,KAAAA;AAAAA"}
@@ -1,47 +0,0 @@
1
- import { SkillDeliveryError } from "./errors.mjs";
2
- import { CopilotKitIntelligence } from "@copilotkit/runtime/v2";
3
-
4
- //#region ../intelligence-delivery-core/dist/config.mjs
5
- /** Resolve once. Never retain the options object, environment, or a second key. */
6
- function resolveRegistryConfig(options = {}, environment = process.env) {
7
- try {
8
- const containerId = options.containerId ?? environment.CPK_INTELLIGENCE_LEARNING_CONTAINER_ID;
9
- const revision = options.revision ?? environment.CPK_INTELLIGENCE_SKILLS_REVISION;
10
- const freshnessWindowMs = options.freshnessWindowMs ?? 5e3;
11
- const requestTimeoutMs = options.requestTimeoutMs ?? 5e3;
12
- const debug = options.debug ?? false;
13
- if (typeof containerId !== "string" || !containerId.trim() || revision !== void 0 && (typeof revision !== "string" || revision.length === 0) || !Number.isSafeInteger(freshnessWindowMs) || freshnessWindowMs < 0 || !Number.isSafeInteger(requestTimeoutMs) || requestTimeoutMs < 1 || requestTimeoutMs > 2147483647 || typeof debug !== "boolean") throw new SkillDeliveryError("INVALID_CONFIG", false);
14
- let client = options.client;
15
- if (client !== void 0) {
16
- if (!client || typeof client.getLearnedSkillsSnapshot !== "function") throw new SkillDeliveryError("INVALID_CONFIG", false);
17
- } else {
18
- const apiKey = options.apiKey ?? environment.CPK_INTELLIGENCE_API_KEY;
19
- const apiUrl = options.apiUrl ?? environment.INTELLIGENCE_API_URL;
20
- if (typeof apiKey !== "string" || !apiKey.trim()) throw new SkillDeliveryError("INVALID_CONFIG", false);
21
- if (apiUrl?.trim()) {
22
- const url = new URL(apiUrl);
23
- if (!["http:", "https:"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new SkillDeliveryError("INVALID_CONFIG", false);
24
- }
25
- client = new CopilotKitIntelligence({
26
- apiKey,
27
- ...apiUrl !== void 0 ? { apiUrl } : {},
28
- ...apiUrl?.trim() ? { wsUrl: "wss://realtime.intelligence.copilotkit.ai" } : {}
29
- });
30
- }
31
- return Object.freeze({
32
- client,
33
- containerId,
34
- ...revision !== void 0 ? { revision } : {},
35
- freshnessWindowMs,
36
- requestTimeoutMs,
37
- debug
38
- });
39
- } catch (error) {
40
- if (error instanceof SkillDeliveryError) throw error;
41
- throw new SkillDeliveryError("INVALID_CONFIG", false, error);
42
- }
43
- }
44
-
45
- //#endregion
46
- export { resolveRegistryConfig };
47
- //# sourceMappingURL=config.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.mjs","names":[],"sources":["../../../../intelligence-delivery-core/dist/config.mjs"],"sourcesContent":["import { SkillDeliveryError } from \"./errors.mjs\";\nimport { CopilotKitIntelligence } from \"@copilotkit/runtime/v2\";\n\n//#region src/config.ts\n/** Resolve once. Never retain the options object, environment, or a second key. */\nfunction resolveRegistryConfig(options = {}, environment = process.env) {\n\ttry {\n\t\tconst containerId = options.containerId ?? environment.CPK_INTELLIGENCE_LEARNING_CONTAINER_ID;\n\t\tconst revision = options.revision ?? environment.CPK_INTELLIGENCE_SKILLS_REVISION;\n\t\tconst freshnessWindowMs = options.freshnessWindowMs ?? 5e3;\n\t\tconst requestTimeoutMs = options.requestTimeoutMs ?? 5e3;\n\t\tconst debug = options.debug ?? false;\n\t\tif (typeof containerId !== \"string\" || !containerId.trim() || revision !== void 0 && (typeof revision !== \"string\" || revision.length === 0) || !Number.isSafeInteger(freshnessWindowMs) || freshnessWindowMs < 0 || !Number.isSafeInteger(requestTimeoutMs) || requestTimeoutMs < 1 || requestTimeoutMs > 2147483647 || typeof debug !== \"boolean\") throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\tlet client = options.client;\n\t\tif (client !== void 0) {\n\t\t\tif (!client || typeof client.getLearnedSkillsSnapshot !== \"function\") throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\t} else {\n\t\t\tconst apiKey = options.apiKey ?? environment.CPK_INTELLIGENCE_API_KEY;\n\t\t\tconst apiUrl = options.apiUrl ?? environment.INTELLIGENCE_API_URL;\n\t\t\tif (typeof apiKey !== \"string\" || !apiKey.trim()) throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\t\tif (apiUrl?.trim()) {\n\t\t\t\tconst url = new URL(apiUrl);\n\t\t\t\tif (![\"http:\", \"https:\"].includes(url.protocol) || url.username || url.password || url.search || url.hash) throw new SkillDeliveryError(\"INVALID_CONFIG\", false);\n\t\t\t}\n\t\t\tclient = new CopilotKitIntelligence({\n\t\t\t\tapiKey,\n\t\t\t\t...apiUrl !== void 0 ? { apiUrl } : {},\n\t\t\t\t...apiUrl?.trim() ? { wsUrl: \"wss://realtime.intelligence.copilotkit.ai\" } : {}\n\t\t\t});\n\t\t}\n\t\treturn Object.freeze({\n\t\t\tclient,\n\t\t\tcontainerId,\n\t\t\t...revision !== void 0 ? { revision } : {},\n\t\t\tfreshnessWindowMs,\n\t\t\trequestTimeoutMs,\n\t\t\tdebug\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof SkillDeliveryError) throw error;\n\t\tthrow new SkillDeliveryError(\"INVALID_CONFIG\", false, error);\n\t}\n}\n\n//#endregion\nexport { resolveRegistryConfig };\n//# sourceMappingURL=config.mjs.map"],"mappings":";;;;;AAKA,SAAS,sBAAsB,UAAU,EAAE,EAAE,cAAc,QAAQ,KAAK;AACvE,KAAI;EACH,MAAM,cAAc,QAAQ,eAAe,YAAY;EACvD,MAAM,WAAW,QAAQ,YAAY,YAAY;EACjD,MAAM,oBAAoB,QAAQ,qBAAqB;EACvD,MAAM,mBAAmB,QAAQ,oBAAoB;EACrD,MAAM,QAAQ,QAAQ,SAAS;AAC/B,MAAI,OAAO,gBAAgB,YAAY,CAAC,YAAY,MAAM,IAAI,aAAa,KAAK,MAAM,OAAO,aAAa,YAAY,SAAS,WAAW,MAAM,CAAC,OAAO,cAAc,kBAAkB,IAAI,oBAAoB,KAAK,CAAC,OAAO,cAAc,iBAAiB,IAAI,mBAAmB,KAAK,mBAAmB,cAAc,OAAO,UAAU,UAAW,OAAM,IAAI,mBAAmB,kBAAkB,MAAM;EAC1Y,IAAI,SAAS,QAAQ;AACrB,MAAI,WAAW,KAAK,GACnB;OAAI,CAAC,UAAU,OAAO,OAAO,6BAA6B,WAAY,OAAM,IAAI,mBAAmB,kBAAkB,MAAM;SACrH;GACN,MAAM,SAAS,QAAQ,UAAU,YAAY;GAC7C,MAAM,SAAS,QAAQ,UAAU,YAAY;AAC7C,OAAI,OAAO,WAAW,YAAY,CAAC,OAAO,MAAM,CAAE,OAAM,IAAI,mBAAmB,kBAAkB,MAAM;AACvG,OAAI,QAAQ,MAAM,EAAE;IACnB,MAAM,MAAM,IAAI,IAAI,OAAO;AAC3B,QAAI,CAAC,CAAC,SAAS,SAAS,CAAC,SAAS,IAAI,SAAS,IAAI,IAAI,YAAY,IAAI,YAAY,IAAI,UAAU,IAAI,KAAM,OAAM,IAAI,mBAAmB,kBAAkB,MAAM;;AAEjK,YAAS,IAAI,uBAAuB;IACnC;IACA,GAAG,WAAW,KAAK,IAAI,EAAE,QAAQ,GAAG,EAAE;IACtC,GAAG,QAAQ,MAAM,GAAG,EAAE,OAAO,6CAA6C,GAAG,EAAE;IAC/E,CAAC;;AAEH,SAAO,OAAO,OAAO;GACpB;GACA;GACA,GAAG,aAAa,KAAK,IAAI,EAAE,UAAU,GAAG,EAAE;GAC1C;GACA;GACA;GACA,CAAC;UACM,OAAO;AACf,MAAI,iBAAiB,mBAAoB,OAAM;AAC/C,QAAM,IAAI,mBAAmB,kBAAkB,OAAO,MAAM"}
@@ -1,10 +0,0 @@
1
- let _copilotkit_runtime_v2 = require("@copilotkit/runtime/v2");
2
-
3
- //#region ../intelligence-delivery-core/dist/errors.mjs
4
- function invalidSnapshot(cause) {
5
- return new _copilotkit_runtime_v2.LearnedSkillsError("INVALID_SNAPSHOT", false, cause);
6
- }
7
-
8
- //#endregion
9
- exports.invalidSnapshot = invalidSnapshot;
10
- //# sourceMappingURL=errors.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.cjs","names":["LearnedSkillsError"],"sources":["../../../../intelligence-delivery-core/dist/errors.mjs"],"sourcesContent":["import { LearnedSkillsError, LearnedSkillsError as SkillDeliveryError } from \"@copilotkit/runtime/v2\";\n\n//#region src/errors.ts\nfunction invalidSnapshot(cause) {\n\treturn new LearnedSkillsError(\"INVALID_SNAPSHOT\", false, cause);\n}\n\n//#endregion\nexport { SkillDeliveryError, invalidSnapshot };\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;AAGA,SAAS,gBAAgB,OAAO;AAC/B,QAAO,IAAIA,0CAAmB,oBAAoB,OAAO,MAAM"}
@@ -1,2 +0,0 @@
1
- import { LearnedSkillsError as SkillDeliveryError, LearnedSkillsErrorCode as SkillDeliveryErrorCode } from "@copilotkit/runtime/v2";
2
- export { SkillDeliveryError, type SkillDeliveryErrorCode };
@@ -1,2 +0,0 @@
1
- import { LearnedSkillsError, LearnedSkillsError as SkillDeliveryError, LearnedSkillsErrorCode as SkillDeliveryErrorCode } from "@copilotkit/runtime/v2";
2
- export { SkillDeliveryError, type SkillDeliveryErrorCode };
@@ -1,10 +0,0 @@
1
- import { LearnedSkillsError, LearnedSkillsError as SkillDeliveryError } from "@copilotkit/runtime/v2";
2
-
3
- //#region ../intelligence-delivery-core/dist/errors.mjs
4
- function invalidSnapshot(cause) {
5
- return new LearnedSkillsError("INVALID_SNAPSHOT", false, cause);
6
- }
7
-
8
- //#endregion
9
- export { SkillDeliveryError, invalidSnapshot };
10
- //# sourceMappingURL=errors.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errors.mjs","names":[],"sources":["../../../../intelligence-delivery-core/dist/errors.mjs"],"sourcesContent":["import { LearnedSkillsError, LearnedSkillsError as SkillDeliveryError } from \"@copilotkit/runtime/v2\";\n\n//#region src/errors.ts\nfunction invalidSnapshot(cause) {\n\treturn new LearnedSkillsError(\"INVALID_SNAPSHOT\", false, cause);\n}\n\n//#endregion\nexport { SkillDeliveryError, invalidSnapshot };\n//# sourceMappingURL=errors.mjs.map"],"mappings":";;;AAGA,SAAS,gBAAgB,OAAO;AAC/B,QAAO,IAAI,mBAAmB,oBAAoB,OAAO,MAAM"}
@@ -1,131 +0,0 @@
1
- const require_errors = require('./errors.cjs');
2
- const require_config = require('./config.cjs');
3
- const require_snapshot = require('./snapshot.cjs');
4
- let _copilotkit_runtime_v2 = require("@copilotkit/runtime/v2");
5
-
6
- //#region ../intelligence-delivery-core/dist/registry.mjs
7
- function transient(error) {
8
- return [
9
- "NETWORK_ERROR",
10
- "TIMEOUT",
11
- "INVALID_SNAPSHOT",
12
- "UNSUPPORTED_SERVER"
13
- ].includes(error.code);
14
- }
15
- function deliveryError(error) {
16
- if (error instanceof _copilotkit_runtime_v2.LearnedSkillsError) return error;
17
- return new _copilotkit_runtime_v2.LearnedSkillsError(error instanceof Error && error.name === "TimeoutError" ? "TIMEOUT" : "NETWORK_ERROR", true, error);
18
- }
19
- /** Internal registry shared by framework adapters; public API is framework-native. */
20
- var SkillRegistry = class {
21
- #config;
22
- #snapshot;
23
- #inFlight;
24
- #lastCheckedAt;
25
- #stale = false;
26
- #lastError;
27
- #blocked;
28
- constructor(options = {}) {
29
- this.#config = require_config.resolveRegistryConfig(options);
30
- }
31
- async initialize() {
32
- await this.acquireSnapshot();
33
- }
34
- /** Capture exactly one immutable snapshot before model work begins. */
35
- acquireSnapshot() {
36
- if (this.#inFlight) return this.#inFlight;
37
- if (this.#snapshot && !this.#blocked && this.#lastCheckedAt !== void 0 && Date.now() - this.#lastCheckedAt < this.#config.freshnessWindowMs) return Promise.resolve(this.#snapshot);
38
- this.#inFlight = Promise.resolve().then(() => this.#refresh()).finally(() => {
39
- this.#inFlight = void 0;
40
- });
41
- return this.#inFlight;
42
- }
43
- get status() {
44
- const error = this.#lastError;
45
- return Object.freeze({
46
- initialized: this.#snapshot !== void 0,
47
- ...this.#snapshot ? { revision: this.#snapshot.revision } : {},
48
- mode: this.#config.revision === void 0 ? "latest" : "pinned",
49
- ...this.#lastCheckedAt !== void 0 ? { lastCheckedAt: new Date(this.#lastCheckedAt).toISOString() } : {},
50
- stale: this.#stale,
51
- ...error ? { lastError: Object.freeze({
52
- code: error.code,
53
- message: error.message,
54
- retryable: error.retryable
55
- }) } : {}
56
- });
57
- }
58
- async #refresh() {
59
- const startedAt = Date.now();
60
- const controller = new AbortController();
61
- let timer;
62
- const deadline = new Promise((_, reject) => {
63
- timer = setTimeout(() => {
64
- const error = new _copilotkit_runtime_v2.LearnedSkillsError("TIMEOUT", true);
65
- controller.abort(error);
66
- timer = setTimeout(() => reject(error), 0);
67
- }, this.#config.requestTimeoutMs);
68
- });
69
- const replacement = async () => {
70
- const response = await this.#config.client.getLearnedSkillsSnapshot({
71
- containerId: this.#config.containerId,
72
- ...this.#config.revision !== void 0 ? { revision: this.#config.revision } : {},
73
- ...this.#snapshot ? { ifNoneMatch: this.#snapshot.etag } : {},
74
- signal: controller.signal
75
- });
76
- controller.signal.throwIfAborted();
77
- if (!response || typeof response !== "object") throw require_errors.invalidSnapshot();
78
- if (response.status === "unchanged") {
79
- if (!this.#snapshot || response.etag !== this.#snapshot.etag || response.revision !== this.#snapshot.revision) throw require_errors.invalidSnapshot();
80
- return this.#snapshot;
81
- }
82
- if (this.#config.revision !== void 0 && response.revision !== this.#config.revision) throw require_errors.invalidSnapshot();
83
- return require_snapshot.validateSnapshot(response, controller.signal);
84
- };
85
- try {
86
- const snapshot = await Promise.race([replacement(), deadline]);
87
- this.#snapshot = snapshot;
88
- this.#lastCheckedAt = Date.now();
89
- this.#stale = false;
90
- this.#lastError = void 0;
91
- this.#blocked = void 0;
92
- this.#debug("refresh-success", startedAt);
93
- return snapshot;
94
- } catch (cause) {
95
- const error = deliveryError(cause);
96
- if (!transient(error)) {
97
- this.#blocked = error;
98
- this.#stale = false;
99
- this.#lastError = error;
100
- this.#debug("refresh-denied", startedAt, error.code);
101
- throw error;
102
- }
103
- if (this.#blocked) {
104
- this.#lastError = this.#blocked;
105
- this.#debug("refresh-failed", startedAt, error.code);
106
- throw this.#blocked;
107
- }
108
- this.#lastError = error;
109
- this.#stale = this.#snapshot !== void 0;
110
- this.#debug("refresh-failed", startedAt, error.code);
111
- if (this.#snapshot) return this.#snapshot;
112
- throw error;
113
- } finally {
114
- if (timer !== void 0) clearTimeout(timer);
115
- }
116
- }
117
- #debug(event, startedAt, errorCode) {
118
- if (!this.#config.debug) return;
119
- console.debug("CopilotKit learned skills", {
120
- event,
121
- containerId: this.#config.containerId,
122
- revision: this.#snapshot?.revision,
123
- durationMs: Date.now() - startedAt,
124
- ...errorCode ? { errorCode } : {}
125
- });
126
- }
127
- };
128
-
129
- //#endregion
130
- exports.SkillRegistry = SkillRegistry;
131
- //# sourceMappingURL=registry.cjs.map