@copilotkit/web-inspector 1.77.0 → 1.77.2
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.cjs +115 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +32 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +116 -16
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +309 -33
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/hud-config.cjs +93 -0
- package/dist/lib/hud-config.cjs.map +1 -0
- package/dist/lib/hud-config.mjs +92 -0
- package/dist/lib/hud-config.mjs.map +1 -0
- package/dist/lib/hud-defaults.cjs +19 -0
- package/dist/lib/hud-defaults.cjs.map +1 -0
- package/dist/lib/hud-defaults.mjs +18 -0
- package/dist/lib/hud-defaults.mjs.map +1 -0
- package/dist/lib/hud-loader.cjs +26 -0
- package/dist/lib/hud-loader.cjs.map +1 -0
- package/dist/lib/hud-loader.mjs +26 -0
- package/dist/lib/hud-loader.mjs.map +1 -0
- package/dist/lib/inspector-nav.cjs +1 -0
- package/dist/lib/inspector-nav.mjs +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +4 -4
package/dist/index.umd.js
CHANGED
|
@@ -30,13 +30,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
30
30
|
intelligence: ["enabled", "disabled"],
|
|
31
31
|
deployment: ["managed", "self-hosted"]
|
|
32
32
|
};
|
|
33
|
-
function record(value) {
|
|
33
|
+
function record$1(value) {
|
|
34
34
|
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
35
35
|
}
|
|
36
|
-
function onlyKeys(value, keys) {
|
|
36
|
+
function onlyKeys$1(value, keys) {
|
|
37
37
|
return Object.keys(value).every((key) => keys.includes(key));
|
|
38
38
|
}
|
|
39
|
-
function text(value, max = 256) {
|
|
39
|
+
function text$1(value, max = 256) {
|
|
40
40
|
return typeof value === "string" && value.trim().length > 0 && value.length <= max;
|
|
41
41
|
}
|
|
42
42
|
function isNotificationId(value) {
|
|
@@ -47,11 +47,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
47
47
|
}
|
|
48
48
|
/** Validate authored conditions; unsupported predicates cannot broaden the audience. */
|
|
49
49
|
function validNotificationConditions(value) {
|
|
50
|
-
if (!record(value)) return false;
|
|
50
|
+
if (!record$1(value)) return false;
|
|
51
51
|
if (value.sdkVersion !== void 0 && value.framework === void 0) return false;
|
|
52
52
|
return Object.entries(value).every(([key, expected]) => {
|
|
53
53
|
var _conditionValues$key$, _conditionValues$key;
|
|
54
|
-
if (!text(expected)) return false;
|
|
54
|
+
if (!text$1(expected)) return false;
|
|
55
55
|
if (key === "sdkVersion") return (0, semver.validRange)(expected) !== null;
|
|
56
56
|
if (key === "plan") return /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(expected);
|
|
57
57
|
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);
|
|
@@ -59,11 +59,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
59
59
|
}
|
|
60
60
|
/** Parse the public envelope. Any invalid entry rejects the whole feed. */
|
|
61
61
|
function parseNotificationFeed(value) {
|
|
62
|
-
if (!record(value) || !onlyKeys(value, ["schemaVersion", "notifications"]) || value.schemaVersion !== 1) return null;
|
|
62
|
+
if (!record$1(value) || !onlyKeys$1(value, ["schemaVersion", "notifications"]) || value.schemaVersion !== 1) return null;
|
|
63
63
|
if (!Array.isArray(value.notifications) || value.notifications.length > 100) return null;
|
|
64
64
|
const notifications = [];
|
|
65
65
|
for (const notice of value.notifications) {
|
|
66
|
-
if (!record(notice) || !onlyKeys(notice, [
|
|
66
|
+
if (!record$1(notice) || !onlyKeys$1(notice, [
|
|
67
67
|
"id",
|
|
68
68
|
"title",
|
|
69
69
|
"body",
|
|
@@ -72,10 +72,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
72
72
|
"priority",
|
|
73
73
|
"priorityOverride"
|
|
74
74
|
])) return null;
|
|
75
|
-
if (!isNotificationId(notice.id) || !text(notice.title) || !text(notice.body, 1e5) || !text(notice.publishedAt)) return null;
|
|
75
|
+
if (!isNotificationId(notice.id) || !text$1(notice.title) || !text$1(notice.body, 1e5) || !text$1(notice.publishedAt)) return null;
|
|
76
76
|
if (!/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d{3}Z$/.test(notice.publishedAt) || !Number.isFinite(Date.parse(notice.publishedAt)) || new Date(notice.publishedAt).toISOString() !== notice.publishedAt) return null;
|
|
77
77
|
if (!Array.isArray(notice.audiences) || !notice.audiences.length || notice.audiences.length > 100 || !notice.audiences.every(validNotificationConditions)) return null;
|
|
78
|
-
if (!text(notice.priority) || !Object.prototype.hasOwnProperty.call(priorities, notice.priority)) return null;
|
|
78
|
+
if (!text$1(notice.priority) || !Object.prototype.hasOwnProperty.call(priorities, notice.priority)) return null;
|
|
79
79
|
if (notice.priorityOverride !== void 0 && (typeof notice.priorityOverride !== "number" || !Number.isSafeInteger(notice.priorityOverride) || notice.priorityOverride < 0)) return null;
|
|
80
80
|
if (notifications.some((n) => n.id === notice.id)) return null;
|
|
81
81
|
notifications.push({
|
|
@@ -95,7 +95,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
95
95
|
}
|
|
96
96
|
/** Ignore malformed or incompatible browser state. */
|
|
97
97
|
function parseNotificationState(value) {
|
|
98
|
-
if (!record(value) || value.schemaVersion !== 1 || !ids(value.eligibleIds) || !ids(value.readIds) || !ids(value.suppressedIds) || value.activeId !== null && !isNotificationId(value.activeId)) return null;
|
|
98
|
+
if (!record$1(value) || value.schemaVersion !== 1 || !ids(value.eligibleIds) || !ids(value.readIds) || !ids(value.suppressedIds) || value.activeId !== null && !isNotificationId(value.activeId)) return null;
|
|
99
99
|
return {
|
|
100
100
|
schemaVersion: 1,
|
|
101
101
|
eligibleIds: value.eligibleIds,
|
|
@@ -205,6 +205,135 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
205
205
|
return request;
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region src/lib/hud-config.ts
|
|
210
|
+
const HUD_FEATURE_IDS = ["threads", "learning"];
|
|
211
|
+
const HUD_LABEL_MAX_LENGTH = 32;
|
|
212
|
+
const HUD_DESCRIPTION_MAX_LENGTH = 140;
|
|
213
|
+
const frameworkPattern = /^[a-z][a-z0-9-]{0,31}$/;
|
|
214
|
+
const featureIdPattern = /^[a-z][a-z0-9-]{0,31}$/;
|
|
215
|
+
const destinationPattern = /^[a-z][a-z0-9-]{0,63}$/;
|
|
216
|
+
const controlCharacters = /[\u0000-\u001f\u007f-\u009f\u2028\u2029]/;
|
|
217
|
+
function record(value) {
|
|
218
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
219
|
+
}
|
|
220
|
+
function onlyKeys(value, keys) {
|
|
221
|
+
return Object.keys(value).every((key) => keys.includes(key));
|
|
222
|
+
}
|
|
223
|
+
function text(value, max) {
|
|
224
|
+
return typeof value === "string" && value.trim().length > 0 && value.length <= max && !controlCharacters.test(value);
|
|
225
|
+
}
|
|
226
|
+
function parseFeature(value) {
|
|
227
|
+
if (!record(value) || !Object.keys(value).length || !onlyKeys(value, [
|
|
228
|
+
"label",
|
|
229
|
+
"description",
|
|
230
|
+
"destination"
|
|
231
|
+
])) return null;
|
|
232
|
+
if (value.label !== void 0 && !text(value.label, HUD_LABEL_MAX_LENGTH)) return null;
|
|
233
|
+
if (value.description !== void 0 && !text(value.description, HUD_DESCRIPTION_MAX_LENGTH)) return null;
|
|
234
|
+
if (value.destination !== void 0 && (typeof value.destination !== "string" || !destinationPattern.test(value.destination))) return null;
|
|
235
|
+
return {
|
|
236
|
+
...value.label === void 0 ? {} : { label: value.label },
|
|
237
|
+
...value.description === void 0 ? {} : { description: value.description },
|
|
238
|
+
...value.destination === void 0 ? {} : { destination: value.destination }
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function parseRule(value) {
|
|
242
|
+
if (!record(value) || !onlyKeys(value, [
|
|
243
|
+
"framework",
|
|
244
|
+
"sdkVersion",
|
|
245
|
+
"features"
|
|
246
|
+
]) || typeof value.framework !== "string" || !frameworkPattern.test(value.framework) || !text(value.sdkVersion, 256) || (0, semver.validRange)(value.sdkVersion) === null || !record(value.features) || !Object.keys(value.features).length) return null;
|
|
247
|
+
const features = {};
|
|
248
|
+
for (const [id, entry] of Object.entries(value.features)) {
|
|
249
|
+
if (!featureIdPattern.test(id)) return null;
|
|
250
|
+
const feature = parseFeature(entry);
|
|
251
|
+
if (!feature) return null;
|
|
252
|
+
features[id] = feature;
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
framework: value.framework,
|
|
256
|
+
sdkVersion: value.sdkVersion,
|
|
257
|
+
features
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
/** Parse the public envelope. Any invalid entry rejects the whole feed. */
|
|
261
|
+
function parseHudFeed(value) {
|
|
262
|
+
if (!record(value) || !onlyKeys(value, ["schemaVersion", "rules"]) || value.schemaVersion !== 1 || !Array.isArray(value.rules) || value.rules.length > 100) return null;
|
|
263
|
+
const rules = [];
|
|
264
|
+
for (const entry of value.rules) {
|
|
265
|
+
const rule = parseRule(entry);
|
|
266
|
+
if (!rule) return null;
|
|
267
|
+
rules.push(rule);
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
schemaVersion: 1,
|
|
271
|
+
rules
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
/** Return the first rule for a development client with a known stable SDK. */
|
|
275
|
+
function matchHudRule(feed, context) {
|
|
276
|
+
var _feed$rules$find;
|
|
277
|
+
const { development, framework, sdkVersion } = context;
|
|
278
|
+
if (!development || !framework || !sdkVersion || (0, semver.valid)(sdkVersion) === null || (0, semver.prerelease)(sdkVersion) !== null) return null;
|
|
279
|
+
return (_feed$rules$find = feed.rules.find((rule) => rule.framework === framework && (0, semver.satisfies)(sdkVersion, rule.sdkVersion))) !== null && _feed$rules$find !== void 0 ? _feed$rules$find : null;
|
|
280
|
+
}
|
|
281
|
+
/** Overlay the matching rule on the built-in content, field by field. */
|
|
282
|
+
function resolveHudContent(feed, context, options) {
|
|
283
|
+
const rule = feed ? matchHudRule(feed, context) : null;
|
|
284
|
+
const content = {};
|
|
285
|
+
for (const id of HUD_FEATURE_IDS) {
|
|
286
|
+
var _override$label, _override$description;
|
|
287
|
+
const fallback = options.defaults[id];
|
|
288
|
+
const override = rule === null || rule === void 0 ? void 0 : rule.features[id];
|
|
289
|
+
content[id] = {
|
|
290
|
+
label: (_override$label = override === null || override === void 0 ? void 0 : override.label) !== null && _override$label !== void 0 ? _override$label : fallback.label,
|
|
291
|
+
description: (_override$description = override === null || override === void 0 ? void 0 : override.description) !== null && _override$description !== void 0 ? _override$description : fallback.description,
|
|
292
|
+
destination: (override === null || override === void 0 ? void 0 : override.destination) !== void 0 && options.supportedDestinations.includes(override.destination) ? override.destination : fallback.destination
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
return content;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region src/lib/hud-loader.ts
|
|
300
|
+
const HUD_FEED_URL = "https://cdn.copilotkit.ai/inspector-hud/v1.json";
|
|
301
|
+
let request = null;
|
|
302
|
+
/** Load the HUD feed once per page. The request carries no client data. */
|
|
303
|
+
function loadHudFeed() {
|
|
304
|
+
var _request;
|
|
305
|
+
if (typeof window === "undefined" || typeof fetch === "undefined") return Promise.resolve(null);
|
|
306
|
+
(_request = request) !== null && _request !== void 0 || (request = Promise.resolve().then(() => fetch(HUD_FEED_URL, {
|
|
307
|
+
cache: "no-cache",
|
|
308
|
+
credentials: "omit"
|
|
309
|
+
})).then(async (response) => {
|
|
310
|
+
if (!response.ok) throw new Error(`Feed request failed (${response.status})`);
|
|
311
|
+
const feed = parseHudFeed(await response.json());
|
|
312
|
+
if (!feed) throw new Error("Feed failed validation");
|
|
313
|
+
return feed;
|
|
314
|
+
}).catch((error) => {
|
|
315
|
+
console.warn("[CopilotKit Inspector] Failed to load HUD content", error);
|
|
316
|
+
return null;
|
|
317
|
+
}));
|
|
318
|
+
return request;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
//#endregion
|
|
322
|
+
//#region src/lib/hud-defaults.ts
|
|
323
|
+
/** Built-in HUD copy and destinations; a matching feed rule overrides fields. */
|
|
324
|
+
const HUD_DEFAULT_CONTENT = {
|
|
325
|
+
threads: {
|
|
326
|
+
label: "Rich Threads",
|
|
327
|
+
description: "Click to learn more",
|
|
328
|
+
destination: "threads"
|
|
329
|
+
},
|
|
330
|
+
learning: {
|
|
331
|
+
label: "Automatic Learning",
|
|
332
|
+
description: "Click to learn more",
|
|
333
|
+
destination: "memories"
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
208
337
|
//#endregion
|
|
209
338
|
//#region src/lib/persistence.ts
|
|
210
339
|
function loadInspectorState(storageKey) {
|
|
@@ -2935,7 +3064,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2935
3064
|
|
|
2936
3065
|
//#endregion
|
|
2937
3066
|
//#region package.json
|
|
2938
|
-
var version = "1.77.
|
|
3067
|
+
var version = "1.77.2";
|
|
2939
3068
|
|
|
2940
3069
|
//#endregion
|
|
2941
3070
|
//#region src/lib/telemetry.ts
|
|
@@ -3503,8 +3632,46 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3503
3632
|
return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);
|
|
3504
3633
|
}
|
|
3505
3634
|
|
|
3635
|
+
//#endregion
|
|
3636
|
+
//#region \0@oxc-project+runtime@0.112.0/helpers/checkPrivateRedeclaration.js
|
|
3637
|
+
function _checkPrivateRedeclaration(e, t) {
|
|
3638
|
+
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
//#endregion
|
|
3642
|
+
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateMethodInitSpec.js
|
|
3643
|
+
function _classPrivateMethodInitSpec(e, a) {
|
|
3644
|
+
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
3645
|
+
}
|
|
3646
|
+
|
|
3647
|
+
//#endregion
|
|
3648
|
+
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldInitSpec.js
|
|
3649
|
+
function _classPrivateFieldInitSpec(e, t, a) {
|
|
3650
|
+
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
3651
|
+
}
|
|
3652
|
+
|
|
3653
|
+
//#endregion
|
|
3654
|
+
//#region \0@oxc-project+runtime@0.112.0/helpers/assertClassBrand.js
|
|
3655
|
+
function _assertClassBrand(e, t, n) {
|
|
3656
|
+
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
3657
|
+
throw new TypeError("Private element is not present on this object");
|
|
3658
|
+
}
|
|
3659
|
+
|
|
3660
|
+
//#endregion
|
|
3661
|
+
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldGet2.js
|
|
3662
|
+
function _classPrivateFieldGet2(s, a) {
|
|
3663
|
+
return s.get(_assertClassBrand(s, a));
|
|
3664
|
+
}
|
|
3665
|
+
|
|
3666
|
+
//#endregion
|
|
3667
|
+
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldSet2.js
|
|
3668
|
+
function _classPrivateFieldSet2(s, a, r) {
|
|
3669
|
+
return s.set(_assertClassBrand(s, a), r), r;
|
|
3670
|
+
}
|
|
3671
|
+
|
|
3506
3672
|
//#endregion
|
|
3507
3673
|
//#region src/index.ts
|
|
3674
|
+
var _globalThis$HTMLEleme;
|
|
3508
3675
|
const WEB_INSPECTOR_TAG = "cpk-web-inspector";
|
|
3509
3676
|
const THREAD_INSPECTOR_TAG = "cpk-thread-inspector";
|
|
3510
3677
|
/**
|
|
@@ -3601,9 +3768,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3601
3768
|
const PILL_SUBLINE_LABEL = "Open Inspector for details";
|
|
3602
3769
|
const HUD_INSPECTOR_LABEL = "CopilotKit Inspector";
|
|
3603
3770
|
const HUD_ANNOUNCEMENT_TITLE_LIMIT = 80;
|
|
3604
|
-
const HUD_THREADS_LABEL = "Rich Threads";
|
|
3605
|
-
const HUD_LEARNING_LABEL = "Automatic Learning";
|
|
3606
|
-
const HUD_LEARN_MORE_LABEL = "Click to learn more";
|
|
3607
3771
|
const INSPECTOR_DISMISSAL_MS = {
|
|
3608
3772
|
day: 1440 * 60 * 1e3,
|
|
3609
3773
|
week: 10080 * 60 * 1e3,
|
|
@@ -4318,7 +4482,96 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4318
4482
|
return value;
|
|
4319
4483
|
}
|
|
4320
4484
|
}
|
|
4485
|
+
let inspectorJsonRenderer = null;
|
|
4486
|
+
let inspectorJsonSlotCount = 0;
|
|
4487
|
+
const JSON_BLOCK_TAG = "cpk-json-block";
|
|
4488
|
+
/**
|
|
4489
|
+
* Replaces the inspector's built-in JSON blocks (tool arguments and results,
|
|
4490
|
+
* state, events, and context) with a host renderer. Pass `null` to restore the
|
|
4491
|
+
* built-in blocks. Set it before the inspector renders: a block that is
|
|
4492
|
+
* already on screen changes at the inspector's next render.
|
|
4493
|
+
*
|
|
4494
|
+
* @example
|
|
4495
|
+
* ```ts
|
|
4496
|
+
* setInspectorJsonRenderer((container, value) => {
|
|
4497
|
+
* const root = createRoot(container);
|
|
4498
|
+
* root.render(<JsonView value={value} />);
|
|
4499
|
+
* return () => root.unmount();
|
|
4500
|
+
* });
|
|
4501
|
+
* ```
|
|
4502
|
+
*/
|
|
4503
|
+
function setInspectorJsonRenderer(renderer) {
|
|
4504
|
+
inspectorJsonRenderer = renderer;
|
|
4505
|
+
}
|
|
4506
|
+
var _value = /* @__PURE__ */ new WeakMap();
|
|
4507
|
+
var _hasValue = /* @__PURE__ */ new WeakMap();
|
|
4508
|
+
var _cleanup = /* @__PURE__ */ new WeakMap();
|
|
4509
|
+
var _container = /* @__PURE__ */ new WeakMap();
|
|
4510
|
+
var _CpkJsonBlock_brand = /* @__PURE__ */ new WeakSet();
|
|
4511
|
+
/**
|
|
4512
|
+
* Hosts one value drawn by the host renderer. Inside a shadow root, the
|
|
4513
|
+
* container lives in the shadow host's light DOM and shows here through a
|
|
4514
|
+
* named slot, so the host page's own styles apply to what the renderer draws.
|
|
4515
|
+
*/
|
|
4516
|
+
var CpkJsonBlock = class extends ((_globalThis$HTMLEleme = globalThis.HTMLElement) !== null && _globalThis$HTMLEleme !== void 0 ? _globalThis$HTMLEleme : class {}) {
|
|
4517
|
+
constructor(..._args) {
|
|
4518
|
+
super(..._args);
|
|
4519
|
+
_classPrivateMethodInitSpec(this, _CpkJsonBlock_brand);
|
|
4520
|
+
_classPrivateFieldInitSpec(this, _value, void 0);
|
|
4521
|
+
_classPrivateFieldInitSpec(this, _hasValue, false);
|
|
4522
|
+
_classPrivateFieldInitSpec(this, _cleanup, void 0);
|
|
4523
|
+
_classPrivateFieldInitSpec(this, _container, void 0);
|
|
4524
|
+
}
|
|
4525
|
+
get value() {
|
|
4526
|
+
return _classPrivateFieldGet2(_value, this);
|
|
4527
|
+
}
|
|
4528
|
+
set value(next) {
|
|
4529
|
+
if (_classPrivateFieldGet2(_hasValue, this) && Object.is(next, _classPrivateFieldGet2(_value, this))) return;
|
|
4530
|
+
_classPrivateFieldSet2(_value, this, next);
|
|
4531
|
+
_classPrivateFieldSet2(_hasValue, this, true);
|
|
4532
|
+
if (this.isConnected) _assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
|
|
4533
|
+
}
|
|
4534
|
+
connectedCallback() {
|
|
4535
|
+
this.style.display = "block";
|
|
4536
|
+
_assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
|
|
4537
|
+
}
|
|
4538
|
+
disconnectedCallback() {
|
|
4539
|
+
_assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
|
|
4540
|
+
}
|
|
4541
|
+
};
|
|
4542
|
+
function _render() {
|
|
4543
|
+
_assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
|
|
4544
|
+
const renderer = inspectorJsonRenderer;
|
|
4545
|
+
if (!renderer) return;
|
|
4546
|
+
const root = this.getRootNode();
|
|
4547
|
+
const container = this.ownerDocument.createElement("div");
|
|
4548
|
+
if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in root) {
|
|
4549
|
+
inspectorJsonSlotCount += 1;
|
|
4550
|
+
const name = `cpk-json-${inspectorJsonSlotCount}`;
|
|
4551
|
+
const slot = this.ownerDocument.createElement("slot");
|
|
4552
|
+
slot.name = name;
|
|
4553
|
+
this.replaceChildren(slot);
|
|
4554
|
+
container.slot = name;
|
|
4555
|
+
root.host.append(container);
|
|
4556
|
+
} else this.replaceChildren(container);
|
|
4557
|
+
_classPrivateFieldSet2(_container, this, container);
|
|
4558
|
+
const cleanup = renderer(container, _classPrivateFieldGet2(_value, this));
|
|
4559
|
+
_classPrivateFieldSet2(_cleanup, this, typeof cleanup === "function" ? cleanup : void 0);
|
|
4560
|
+
}
|
|
4561
|
+
function _teardown() {
|
|
4562
|
+
var _classPrivateFieldGet2$1;
|
|
4563
|
+
const cleanup = _classPrivateFieldGet2(_cleanup, this);
|
|
4564
|
+
_classPrivateFieldSet2(_cleanup, this, void 0);
|
|
4565
|
+
cleanup === null || cleanup === void 0 || cleanup();
|
|
4566
|
+
(_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_container, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.remove();
|
|
4567
|
+
_classPrivateFieldSet2(_container, this, void 0);
|
|
4568
|
+
this.replaceChildren();
|
|
4569
|
+
}
|
|
4321
4570
|
function renderHighlightedJsonBlock(value, options = {}) {
|
|
4571
|
+
if (inspectorJsonRenderer) return lit.html`<cpk-json-block
|
|
4572
|
+
.value=${value}
|
|
4573
|
+
style=${options.maxHeight ? `overflow:auto;max-height:${options.maxHeight}` : lit.nothing}
|
|
4574
|
+
></cpk-json-block>`;
|
|
4322
4575
|
const parsed = coerceJsonValue(value);
|
|
4323
4576
|
return lit.html`<pre class="cpk-json-block" style=${(options.maxHeight ? `max-height:${options.maxHeight}` : void 0) || lit.nothing}>
|
|
4324
4577
|
${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
@@ -4380,8 +4633,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
4380
4633
|
}
|
|
4381
4634
|
};
|
|
4382
4635
|
var CpkThreadList = class extends PortableLitElement {
|
|
4383
|
-
constructor(...
|
|
4384
|
-
super(...
|
|
4636
|
+
constructor(..._args2) {
|
|
4637
|
+
super(..._args2);
|
|
4385
4638
|
this.threads = [];
|
|
4386
4639
|
this.selectedThreadId = null;
|
|
4387
4640
|
this.inAppThreadId = null;
|
|
@@ -4735,8 +4988,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
4735
4988
|
}
|
|
4736
4989
|
`;
|
|
4737
4990
|
var CpkThreadInspector = class CpkThreadInspector extends PortableLitElement {
|
|
4738
|
-
constructor(...
|
|
4739
|
-
super(...
|
|
4991
|
+
constructor(..._args3) {
|
|
4992
|
+
super(..._args3);
|
|
4740
4993
|
this.showThreadTitle = true;
|
|
4741
4994
|
this.threadId = null;
|
|
4742
4995
|
this.provider = null;
|
|
@@ -7969,8 +8222,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
7969
8222
|
return Math.max(6, Math.min(100, Math.round(relevance * 100)));
|
|
7970
8223
|
}
|
|
7971
8224
|
var CpkMemoryList = class extends PortableLitElement {
|
|
7972
|
-
constructor(...
|
|
7973
|
-
super(...
|
|
8225
|
+
constructor(..._args4) {
|
|
8226
|
+
super(..._args4);
|
|
7974
8227
|
this.memories = [];
|
|
7975
8228
|
this.recallResults = null;
|
|
7976
8229
|
this.recallLoading = false;
|
|
@@ -8582,8 +8835,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
8582
8835
|
if (!registry.get(tag)) registry.define(tag, ctor);
|
|
8583
8836
|
}
|
|
8584
8837
|
var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
|
|
8585
|
-
constructor(...
|
|
8586
|
-
super(...
|
|
8838
|
+
constructor(..._args5) {
|
|
8839
|
+
super(..._args5);
|
|
8587
8840
|
this._core = null;
|
|
8588
8841
|
this.coreSubscriber = null;
|
|
8589
8842
|
this.coreUnsubscribe = null;
|
|
@@ -8744,6 +8997,9 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
8744
8997
|
this.announcementId = null;
|
|
8745
8998
|
this.announcementLoaded = false;
|
|
8746
8999
|
this.announcementPromise = null;
|
|
9000
|
+
this.hudFeed = null;
|
|
9001
|
+
this.hudFeedPromise = null;
|
|
9002
|
+
this.hudContent = HUD_DEFAULT_CONTENT;
|
|
8747
9003
|
this.newsSignalArmed = false;
|
|
8748
9004
|
this.pulsingSignal = null;
|
|
8749
9005
|
this.pendingPulseSignal = null;
|
|
@@ -9091,7 +9347,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9091
9347
|
control,
|
|
9092
9348
|
trigger
|
|
9093
9349
|
}));
|
|
9094
|
-
|
|
9350
|
+
const destination = this.hudContent[row].destination;
|
|
9351
|
+
this.hudLandingMenu = isInspectorMenuKey(destination) && this.menuItems.some((item) => item.key === destination) ? destination : row === "threads" ? "threads" : "memories";
|
|
9095
9352
|
this.closeLauncherHud();
|
|
9096
9353
|
this.openInspector("floating_button");
|
|
9097
9354
|
};
|
|
@@ -11239,7 +11496,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11239
11496
|
<div data-inspector-portal-anchor></div>
|
|
11240
11497
|
` : this.renderButton();
|
|
11241
11498
|
}
|
|
11242
|
-
willUpdate() {
|
|
11499
|
+
willUpdate(changed) {
|
|
11500
|
+
if (changed.has("notificationContext")) this.refreshHudContent();
|
|
11243
11501
|
this.evaluateErrorSignals();
|
|
11244
11502
|
this.reconcileSelectedMenuVisibility();
|
|
11245
11503
|
if (this.isOpen && this.dockMode === "docked-left") this.setAttribute("data-docked", "true");
|
|
@@ -11630,6 +11888,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11630
11888
|
renderHudRow(args) {
|
|
11631
11889
|
if (args.connected) return lit.nothing;
|
|
11632
11890
|
const detailId = `cpk-hud-detail-${args.id}`;
|
|
11891
|
+
const { label, description } = this.hudContent[args.id];
|
|
11633
11892
|
return lit.html`
|
|
11634
11893
|
<li
|
|
11635
11894
|
class="cpk-launcher-hud__row"
|
|
@@ -11643,7 +11902,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11643
11902
|
type="button"
|
|
11644
11903
|
class="cpk-launcher-hud__action"
|
|
11645
11904
|
data-cpk-hud-action
|
|
11646
|
-
aria-label=${`Open ${
|
|
11905
|
+
aria-label=${`Open ${label} in Inspector`}
|
|
11647
11906
|
@click=${(event) => this.handleHudActionClick(event, args.id, "action")}
|
|
11648
11907
|
@pointerdown=${(event) => event.stopPropagation()}
|
|
11649
11908
|
>
|
|
@@ -11653,13 +11912,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11653
11912
|
aria-hidden="true"
|
|
11654
11913
|
>${this.renderIcon(args.icon)}</span
|
|
11655
11914
|
>
|
|
11656
|
-
<span class="cpk-launcher-hud__label">${
|
|
11915
|
+
<span class="cpk-launcher-hud__label">${label}</span>
|
|
11657
11916
|
</button>
|
|
11658
11917
|
<span
|
|
11659
11918
|
class="cpk-launcher-hud__tooltip"
|
|
11660
11919
|
id=${detailId}
|
|
11661
11920
|
role="tooltip"
|
|
11662
|
-
>${
|
|
11921
|
+
>${description}</span
|
|
11663
11922
|
>
|
|
11664
11923
|
</span>
|
|
11665
11924
|
<span class="cpk-launcher-hud__controls">
|
|
@@ -11667,7 +11926,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11667
11926
|
type="button"
|
|
11668
11927
|
class="cpk-launcher-hud__learn-more"
|
|
11669
11928
|
data-cpk-hud-learn-more=${args.id}
|
|
11670
|
-
aria-label=${`Learn more about ${
|
|
11929
|
+
aria-label=${`Learn more about ${label}`}
|
|
11671
11930
|
aria-describedby=${detailId}
|
|
11672
11931
|
@click=${(event) => this.handleHudActionClick(event, args.id, "learn_more")}
|
|
11673
11932
|
@pointerdown=${(event) => event.stopPropagation()}
|
|
@@ -11679,7 +11938,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11679
11938
|
class="cpk-launcher-hud__toggle"
|
|
11680
11939
|
data-cpk-hud-toggle=${args.id}
|
|
11681
11940
|
data-enabled=${args.connected ? "true" : "false"}
|
|
11682
|
-
aria-label=${args.connected ? `${
|
|
11941
|
+
aria-label=${args.connected ? `${label} is enabled` : `Open ${label} in Inspector`}
|
|
11683
11942
|
?disabled=${args.connected}
|
|
11684
11943
|
@click=${(event) => this.handleHudActionClick(event, args.id, "toggle")}
|
|
11685
11944
|
@pointerdown=${(event) => event.stopPropagation()}
|
|
@@ -11765,14 +12024,12 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11765
12024
|
>
|
|
11766
12025
|
${this.renderHudRow({
|
|
11767
12026
|
id: "threads",
|
|
11768
|
-
label: HUD_THREADS_LABEL,
|
|
11769
12027
|
icon: "MessageSquare",
|
|
11770
12028
|
connected: threadsOn,
|
|
11771
12029
|
introIndex: featureBlockIntroIndex + 1
|
|
11772
12030
|
})}
|
|
11773
12031
|
${this.renderHudRow({
|
|
11774
12032
|
id: "learning",
|
|
11775
|
-
label: HUD_LEARNING_LABEL,
|
|
11776
12033
|
icon: "Brain",
|
|
11777
12034
|
connected: learningOn,
|
|
11778
12035
|
introIndex: featureBlockIntroIndex + (threadsOn ? 1 : 2)
|
|
@@ -17722,9 +17979,24 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
17722
17979
|
trackWhatsNewSignalViewed(props);
|
|
17723
17980
|
}
|
|
17724
17981
|
}
|
|
17982
|
+
/** Start the development-only remote feeds; neither blocks rendering. */
|
|
17725
17983
|
ensureAnnouncementLoading() {
|
|
17726
|
-
|
|
17727
|
-
this.
|
|
17984
|
+
var _this$announcementPro, _this$hudFeedPromise;
|
|
17985
|
+
if (this.isInspectorDismissed || !this.notificationContext.development || !this.isConnected || typeof window === "undefined" || typeof fetch === "undefined") return;
|
|
17986
|
+
(_this$announcementPro = this.announcementPromise) !== null && _this$announcementPro !== void 0 || (this.announcementPromise = this.fetchAnnouncement());
|
|
17987
|
+
(_this$hudFeedPromise = this.hudFeedPromise) !== null && _this$hudFeedPromise !== void 0 || (this.hudFeedPromise = this.fetchHudFeed());
|
|
17988
|
+
}
|
|
17989
|
+
async fetchHudFeed() {
|
|
17990
|
+
this.hudFeed = await loadHudFeed();
|
|
17991
|
+
this.refreshHudContent();
|
|
17992
|
+
this.requestUpdate();
|
|
17993
|
+
}
|
|
17994
|
+
/** Overlay the matching feed rule on the built-in HUD content. */
|
|
17995
|
+
refreshHudContent() {
|
|
17996
|
+
this.hudContent = resolveHudContent(this.hudFeed, this.notificationContext, {
|
|
17997
|
+
defaults: HUD_DEFAULT_CONTENT,
|
|
17998
|
+
supportedDestinations: INSPECTOR_MENU_KEYS
|
|
17999
|
+
});
|
|
17728
18000
|
}
|
|
17729
18001
|
async fetchAnnouncement() {
|
|
17730
18002
|
try {
|
|
@@ -19212,6 +19484,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
19212
19484
|
|
|
19213
19485
|
.cpk-launcher-hud__label {
|
|
19214
19486
|
min-width: 0;
|
|
19487
|
+
/* Remote copy can be one long word; wrap it inside the row. */
|
|
19488
|
+
overflow-wrap: anywhere;
|
|
19215
19489
|
}
|
|
19216
19490
|
|
|
19217
19491
|
.cpk-launcher-hud__feature-icon {
|
|
@@ -19908,6 +20182,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
19908
20182
|
defineElementOnce(registry, THREAD_INSPECTOR_TAG, CpkThreadInspector);
|
|
19909
20183
|
defineElementOnce(registry, "cpk-thread-details", ɵCpkThreadDetails);
|
|
19910
20184
|
defineElementOnce(registry, "cpk-memory-list", CpkMemoryList);
|
|
20185
|
+
defineElementOnce(registry, JSON_BLOCK_TAG, CpkJsonBlock);
|
|
19911
20186
|
defineElementOnce(registry, WEB_INSPECTOR_TAG, WebInspectorElement);
|
|
19912
20187
|
}
|
|
19913
20188
|
/**
|
|
@@ -19930,6 +20205,7 @@ exports.WEB_INSPECTOR_TAG = WEB_INSPECTOR_TAG;
|
|
|
19930
20205
|
exports.WebInspectorElement = WebInspectorElement;
|
|
19931
20206
|
exports.configureWebInspectorElement = configureWebInspectorElement;
|
|
19932
20207
|
exports.defineWebInspector = defineWebInspector;
|
|
20208
|
+
exports.setInspectorJsonRenderer = setInspectorJsonRenderer;
|
|
19933
20209
|
exports.ɵCpkThreadDetails = ɵCpkThreadDetails;
|
|
19934
20210
|
exports.ɵbuildCapabilityRows = buildCapabilityRows;
|
|
19935
20211
|
exports.ɵmaxRecallScore = maxRecallScore;
|