@copilotkit/web-inspector 2.0.0-rc.10 → 2.0.0-rc.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.umd.js +234 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/hud-config.cjs +4 -4
- package/dist/lib/hud-config.cjs.map +1 -1
- package/dist/lib/hud-config.mjs +3 -3
- package/dist/lib/hud-config.mjs.map +1 -1
- package/dist/lib/markdown.cjs +2 -2
- package/dist/lib/markdown.cjs.map +1 -1
- package/dist/lib/markdown.mjs +1 -1
- package/dist/lib/markdown.mjs.map +1 -1
- package/dist/lib/notifications.cjs +4 -4
- package/dist/lib/notifications.cjs.map +1 -1
- package/dist/lib/notifications.mjs +4 -4
- package/dist/lib/notifications.mjs.map +1 -1
- package/dist/lib/semver.cjs +224 -0
- package/dist/lib/semver.cjs.map +1 -0
- package/dist/lib/semver.mjs +221 -0
- package/dist/lib/semver.mjs.map +1 -0
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +6 -6
package/dist/index.umd.js
CHANGED
|
@@ -1,10 +1,232 @@
|
|
|
1
1
|
(function(global, factory) {
|
|
2
|
-
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('
|
|
3
|
-
typeof define === 'function' && define.amd ? define(['exports', '
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitWebInspector = {}), global.
|
|
5
|
-
})(this, function(exports,
|
|
2
|
+
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('lit'), require('lit/directives/style-map.js'), require('lit/directives/unsafe-html.js'), require('@copilotkit/markdown'), require('@copilotkit/core'), require('@copilotkit/shared')) :
|
|
3
|
+
typeof define === 'function' && define.amd ? define(['exports', 'lit', 'lit/directives/style-map.js', 'lit/directives/unsafe-html.js', '@copilotkit/markdown', '@copilotkit/core', '@copilotkit/shared'], factory) :
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.CopilotKitWebInspector = {}), global.Lit,global.LitDirectivesStyleMap,global.LitDirectivesUnsafeHtml,global._copilotkit_markdown,global.CopilotKitCore,global.CopilotKitShared));
|
|
5
|
+
})(this, function(exports, lit, lit_directives_style_map_js, lit_directives_unsafe_html_js, _copilotkit_markdown, _copilotkit_core, _copilotkit_shared) {
|
|
6
6
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
7
7
|
|
|
8
|
+
//#region src/lib/semver.ts
|
|
9
|
+
const MAX_LENGTH = 256;
|
|
10
|
+
const IDENTIFIER = "(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)";
|
|
11
|
+
const PRERELEASE = `(?:-(${IDENTIFIER}(?:\\.${IDENTIFIER})*))?`;
|
|
12
|
+
const BUILD = "(?:\\+[0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*)?";
|
|
13
|
+
const NUMBER = "(0|[1-9]\\d*)";
|
|
14
|
+
const FULL_VERSION = new RegExp(`^v?${NUMBER}\\.${NUMBER}\\.${NUMBER}${PRERELEASE}${BUILD}$`);
|
|
15
|
+
const PART = "(0|[1-9]\\d*|x|X|\\*)";
|
|
16
|
+
const PARTIAL_VERSION = new RegExp(`^v?${PART}(?:\\.${PART}(?:\\.${PART}${PRERELEASE}${BUILD})?)?$`);
|
|
17
|
+
const COMPARATOR = /^(<=|>=|<|>|=|~>|~|\^)?(.*)$/;
|
|
18
|
+
function parseIdentifiers(value) {
|
|
19
|
+
if (!value) return [];
|
|
20
|
+
return value.split(".").map((id) => /^\d+$/.test(id) ? Number(id) : id);
|
|
21
|
+
}
|
|
22
|
+
function parseVersion(value) {
|
|
23
|
+
const trimmed = value.trim();
|
|
24
|
+
if (trimmed.length > MAX_LENGTH) return null;
|
|
25
|
+
const match = FULL_VERSION.exec(trimmed);
|
|
26
|
+
if (!match) return null;
|
|
27
|
+
const major = Number(match[1]);
|
|
28
|
+
const minor = Number(match[2]);
|
|
29
|
+
const patch = Number(match[3]);
|
|
30
|
+
if (![
|
|
31
|
+
major,
|
|
32
|
+
minor,
|
|
33
|
+
patch
|
|
34
|
+
].every(Number.isSafeInteger)) return null;
|
|
35
|
+
return {
|
|
36
|
+
major,
|
|
37
|
+
minor,
|
|
38
|
+
patch,
|
|
39
|
+
prerelease: parseIdentifiers(match[4])
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function compareIdentifiers(a, b) {
|
|
43
|
+
if (typeof a === "number" && typeof b === "number") return a - b;
|
|
44
|
+
if (typeof a === "number") return -1;
|
|
45
|
+
if (typeof b === "number") return 1;
|
|
46
|
+
return a < b ? -1 : a > b ? 1 : 0;
|
|
47
|
+
}
|
|
48
|
+
function compare(a, b) {
|
|
49
|
+
const core = a.major - b.major || a.minor - b.minor || a.patch - b.patch;
|
|
50
|
+
if (core) return core;
|
|
51
|
+
if (!a.prerelease.length || !b.prerelease.length) return b.prerelease.length - a.prerelease.length;
|
|
52
|
+
for (let i = 0; i < Math.max(a.prerelease.length, b.prerelease.length); i++) {
|
|
53
|
+
const left = a.prerelease[i];
|
|
54
|
+
const right = b.prerelease[i];
|
|
55
|
+
if (left === void 0) return -1;
|
|
56
|
+
if (right === void 0) return 1;
|
|
57
|
+
const result = compareIdentifiers(left, right);
|
|
58
|
+
if (result) return result;
|
|
59
|
+
}
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
/** The lowest version of a release line: `1.2.3-0` sorts before every `1.2.3-*`. */
|
|
63
|
+
function floor(major, minor, patch) {
|
|
64
|
+
return {
|
|
65
|
+
major,
|
|
66
|
+
minor,
|
|
67
|
+
patch,
|
|
68
|
+
prerelease: [0]
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function at(major, minor, patch) {
|
|
72
|
+
return {
|
|
73
|
+
major,
|
|
74
|
+
minor,
|
|
75
|
+
patch,
|
|
76
|
+
prerelease: []
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const NOTHING = [{
|
|
80
|
+
operator: "<",
|
|
81
|
+
version: floor(0, 0, 0)
|
|
82
|
+
}];
|
|
83
|
+
/** Desugar one comparator, such as `^1.2` or `>=1.70.1`, into plain bounds. */
|
|
84
|
+
function parseComparator(value) {
|
|
85
|
+
var _COMPARATOR$exec;
|
|
86
|
+
const [, rawOperator = "", rest = ""] = (_COMPARATOR$exec = COMPARATOR.exec(value)) !== null && _COMPARATOR$exec !== void 0 ? _COMPARATOR$exec : [];
|
|
87
|
+
const match = PARTIAL_VERSION.exec(rest);
|
|
88
|
+
if (!match) return null;
|
|
89
|
+
const isWild = (part) => part === void 0 || part === "x" || part === "X" || part === "*";
|
|
90
|
+
const [majorPart, minorPart, patchPart] = match.slice(1, 4);
|
|
91
|
+
const major = isWild(majorPart) ? null : Number(majorPart);
|
|
92
|
+
const minor = major === null || isWild(minorPart) ? null : Number(minorPart);
|
|
93
|
+
const patch = minor === null || isWild(patchPart) ? null : Number(patchPart);
|
|
94
|
+
const prerelease = patch === null ? [] : parseIdentifiers(match[4]);
|
|
95
|
+
const operator = rawOperator === "~>" ? "~" : rawOperator;
|
|
96
|
+
if (operator === "~" || operator === "^") {
|
|
97
|
+
if (major === null) return [];
|
|
98
|
+
const lower = {
|
|
99
|
+
operator: ">=",
|
|
100
|
+
version: {
|
|
101
|
+
major,
|
|
102
|
+
minor: minor !== null && minor !== void 0 ? minor : 0,
|
|
103
|
+
patch: patch !== null && patch !== void 0 ? patch : 0,
|
|
104
|
+
prerelease
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
let upper;
|
|
108
|
+
if (operator === "~" || minor === null) upper = minor === null || operator === "^" ? floor(major + 1, 0, 0) : floor(major, minor + 1, 0);
|
|
109
|
+
else if (major > 0) upper = floor(major + 1, 0, 0);
|
|
110
|
+
else if (minor > 0 || patch === null) upper = floor(0, minor + 1, 0);
|
|
111
|
+
else upper = floor(0, 0, patch + 1);
|
|
112
|
+
return [lower, {
|
|
113
|
+
operator: "<",
|
|
114
|
+
version: upper
|
|
115
|
+
}];
|
|
116
|
+
}
|
|
117
|
+
if (major === null) return operator === "<" || operator === ">" ? NOTHING : [];
|
|
118
|
+
if (patch !== null) return [{
|
|
119
|
+
operator: operator || "=",
|
|
120
|
+
version: {
|
|
121
|
+
major,
|
|
122
|
+
minor,
|
|
123
|
+
patch,
|
|
124
|
+
prerelease
|
|
125
|
+
}
|
|
126
|
+
}];
|
|
127
|
+
const lower = at(major, minor !== null && minor !== void 0 ? minor : 0, 0);
|
|
128
|
+
const next = minor === null ? floor(major + 1, 0, 0) : floor(major, minor + 1, 0);
|
|
129
|
+
switch (operator) {
|
|
130
|
+
case ">": return [{
|
|
131
|
+
operator: ">=",
|
|
132
|
+
version: {
|
|
133
|
+
...next,
|
|
134
|
+
prerelease: []
|
|
135
|
+
}
|
|
136
|
+
}];
|
|
137
|
+
case ">=": return [{
|
|
138
|
+
operator: ">=",
|
|
139
|
+
version: lower
|
|
140
|
+
}];
|
|
141
|
+
case "<": return [{
|
|
142
|
+
operator: "<",
|
|
143
|
+
version: floor(major, minor !== null && minor !== void 0 ? minor : 0, 0)
|
|
144
|
+
}];
|
|
145
|
+
case "<=": return [{
|
|
146
|
+
operator: "<",
|
|
147
|
+
version: next
|
|
148
|
+
}];
|
|
149
|
+
default: return [{
|
|
150
|
+
operator: ">=",
|
|
151
|
+
version: lower
|
|
152
|
+
}, {
|
|
153
|
+
operator: "<",
|
|
154
|
+
version: next
|
|
155
|
+
}];
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
/** Desugar `1.2 - 2.3.4` into `>=1.2.0 <=2.3.4`. */
|
|
159
|
+
function parseHyphen(from, to) {
|
|
160
|
+
var _parseComparator;
|
|
161
|
+
const lower = parseComparator(">=" + from);
|
|
162
|
+
const upper = PARTIAL_VERSION.exec(to);
|
|
163
|
+
if (!lower || !upper) return null;
|
|
164
|
+
const full = parseComparator("=" + to);
|
|
165
|
+
if ((full === null || full === void 0 ? void 0 : full.length) === 1 && full[0]) return [...lower, {
|
|
166
|
+
operator: "<=",
|
|
167
|
+
version: full[0].version
|
|
168
|
+
}];
|
|
169
|
+
return [...lower, ...(_parseComparator = parseComparator("<=" + to)) !== null && _parseComparator !== void 0 ? _parseComparator : []];
|
|
170
|
+
}
|
|
171
|
+
function parseRange(range) {
|
|
172
|
+
if (range.length > MAX_LENGTH) return null;
|
|
173
|
+
const sets = [];
|
|
174
|
+
for (const raw of range.split("||")) {
|
|
175
|
+
const set = raw.trim().replace(/(<=|>=|<|>|=|~>|~|\^)\s+/g, "$1");
|
|
176
|
+
const hyphen = /^(\S+)\s+-\s+(\S+)$/.exec(set);
|
|
177
|
+
if (hyphen) {
|
|
178
|
+
var _hyphen$, _hyphen$2;
|
|
179
|
+
const comparators = parseHyphen((_hyphen$ = hyphen[1]) !== null && _hyphen$ !== void 0 ? _hyphen$ : "", (_hyphen$2 = hyphen[2]) !== null && _hyphen$2 !== void 0 ? _hyphen$2 : "");
|
|
180
|
+
if (!comparators) return null;
|
|
181
|
+
sets.push(comparators);
|
|
182
|
+
continue;
|
|
183
|
+
}
|
|
184
|
+
const comparators = [];
|
|
185
|
+
for (const part of set.split(/\s+/).filter(Boolean)) {
|
|
186
|
+
const parsed = parseComparator(part);
|
|
187
|
+
if (!parsed) return null;
|
|
188
|
+
comparators.push(...parsed);
|
|
189
|
+
}
|
|
190
|
+
sets.push(comparators);
|
|
191
|
+
}
|
|
192
|
+
return sets;
|
|
193
|
+
}
|
|
194
|
+
function test(version, { operator, version: bound }) {
|
|
195
|
+
const result = compare(version, bound);
|
|
196
|
+
switch (operator) {
|
|
197
|
+
case "<": return result < 0;
|
|
198
|
+
case "<=": return result <= 0;
|
|
199
|
+
case ">": return result > 0;
|
|
200
|
+
case ">=": return result >= 0;
|
|
201
|
+
default: return result === 0;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
function sameLine(a, b) {
|
|
205
|
+
return a.major === b.major && a.minor === b.minor && a.patch === b.patch;
|
|
206
|
+
}
|
|
207
|
+
function satisfiesSet(version, set) {
|
|
208
|
+
if (!set.every((comparator) => test(version, comparator))) return false;
|
|
209
|
+
if (!version.prerelease.length) return true;
|
|
210
|
+
return set.some(({ version: bound }) => bound.prerelease.length > 0 && sameLine(bound, version));
|
|
211
|
+
}
|
|
212
|
+
/** Whether `value` is a stable version, such as `1.70.2`, and not `1.70.2-beta.1`. */
|
|
213
|
+
function isStableVersion(value) {
|
|
214
|
+
const version = parseVersion(value);
|
|
215
|
+
return version !== null && version.prerelease.length === 0;
|
|
216
|
+
}
|
|
217
|
+
/** Whether `range` is a valid npm range, such as `>=1.70.1 <1.71.0` or `^1.73.0`. */
|
|
218
|
+
function isValidRange(range) {
|
|
219
|
+
return parseRange(range) !== null;
|
|
220
|
+
}
|
|
221
|
+
/** Whether `version` is in `range`, with the same result as `semver.satisfies`. */
|
|
222
|
+
function satisfies(version, range) {
|
|
223
|
+
const parsed = parseVersion(version);
|
|
224
|
+
const sets = parseRange(range);
|
|
225
|
+
if (!parsed || !sets) return false;
|
|
226
|
+
return sets.some((set) => satisfiesSet(parsed, set));
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
//#endregion
|
|
8
230
|
//#region src/lib/notifications.ts
|
|
9
231
|
function emptyNotificationState() {
|
|
10
232
|
return {
|
|
@@ -52,7 +274,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
52
274
|
return Object.entries(value).every(([key, expected]) => {
|
|
53
275
|
var _conditionValues$key$, _conditionValues$key;
|
|
54
276
|
if (!text$1(expected)) return false;
|
|
55
|
-
if (key === "sdkVersion") return (
|
|
277
|
+
if (key === "sdkVersion") return isValidRange(expected);
|
|
56
278
|
if (key === "plan") return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(expected);
|
|
57
279
|
return Object.prototype.hasOwnProperty.call(conditionValues, key) && ((_conditionValues$key$ = (_conditionValues$key = conditionValues[key]) === null || _conditionValues$key === void 0 ? void 0 : _conditionValues$key.includes(expected)) !== null && _conditionValues$key$ !== void 0 ? _conditionValues$key$ : false);
|
|
58
280
|
});
|
|
@@ -152,7 +374,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
152
374
|
matches: false,
|
|
153
375
|
reasons: ["Development only"]
|
|
154
376
|
};
|
|
155
|
-
if (!context.sdkVersion || !(
|
|
377
|
+
if (!context.sdkVersion || !isStableVersion(context.sdkVersion)) return {
|
|
156
378
|
matches: false,
|
|
157
379
|
reasons: ["Known stable SDK required"]
|
|
158
380
|
};
|
|
@@ -160,7 +382,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
160
382
|
const matches = notice.audiences.some((conditions) => {
|
|
161
383
|
return Object.entries(conditions).every(([field, expected]) => {
|
|
162
384
|
const actual = context[field];
|
|
163
|
-
const matches = field === "sdkVersion" ? actual !== void 0 && (
|
|
385
|
+
const matches = field === "sdkVersion" ? actual !== void 0 && isStableVersion(actual) && satisfies(actual, expected) : actual === expected;
|
|
164
386
|
if (!matches) reasons.push(`${field} ${actual === void 0 ? "is unknown" : `requires ${expected} (got ${actual})`}`);
|
|
165
387
|
return matches;
|
|
166
388
|
});
|
|
@@ -243,7 +465,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
243
465
|
"framework",
|
|
244
466
|
"sdkVersion",
|
|
245
467
|
"features"
|
|
246
|
-
]) || typeof value.framework !== "string" || !frameworkPattern.test(value.framework) || !text(value.sdkVersion, 256) || (
|
|
468
|
+
]) || typeof value.framework !== "string" || !frameworkPattern.test(value.framework) || !text(value.sdkVersion, 256) || !isValidRange(value.sdkVersion) || !record(value.features) || !Object.keys(value.features).length) return null;
|
|
247
469
|
const features = {};
|
|
248
470
|
for (const [id, entry] of Object.entries(value.features)) {
|
|
249
471
|
if (!featureIdPattern.test(id)) return null;
|
|
@@ -275,8 +497,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
275
497
|
function matchHudRule(feed, context) {
|
|
276
498
|
var _feed$rules$find;
|
|
277
499
|
const { development, framework, sdkVersion } = context;
|
|
278
|
-
if (!development || !framework || !sdkVersion || (
|
|
279
|
-
return (_feed$rules$find = feed.rules.find((rule) => rule.framework === framework &&
|
|
500
|
+
if (!development || !framework || !sdkVersion || !isStableVersion(sdkVersion)) return null;
|
|
501
|
+
return (_feed$rules$find = feed.rules.find((rule) => rule.framework === framework && satisfies(sdkVersion, rule.sdkVersion))) !== null && _feed$rules$find !== void 0 ? _feed$rules$find : null;
|
|
280
502
|
}
|
|
281
503
|
/** Overlay the matching rule on the built-in content, field by field. */
|
|
282
504
|
function resolveHudContent(feed, context, options) {
|
|
@@ -1358,7 +1580,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
1358
1580
|
* reach attributes through the caller's `linkHref` / `imageSrc` policy.
|
|
1359
1581
|
*/
|
|
1360
1582
|
function renderMarkdownToHtml(markdown, options) {
|
|
1361
|
-
const state = (0,
|
|
1583
|
+
const state = (0, _copilotkit_markdown.finalizeStreamingMarkdown)((0, _copilotkit_markdown.parseStreamingMarkdownChunk)((0, _copilotkit_markdown.createStreamingMarkdownParserState)({ segmenter: false }), markdown));
|
|
1362
1584
|
const nodes = new Map(state.nodes.map((node) => [node.id, node]));
|
|
1363
1585
|
const root = state.rootId === null ? void 0 : nodes.get(state.rootId);
|
|
1364
1586
|
if (!root || root.type !== "document") return "";
|
|
@@ -4896,7 +5118,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
4896
5118
|
|
|
4897
5119
|
//#endregion
|
|
4898
5120
|
//#region package.json
|
|
4899
|
-
var version = "2.0.0-rc.
|
|
5121
|
+
var version = "2.0.0-rc.12";
|
|
4900
5122
|
|
|
4901
5123
|
//#endregion
|
|
4902
5124
|
//#region src/lib/telemetry.ts
|