@copilotkit/web-inspector 1.79.2-canary.1792172552 → 1.81.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 (36) hide show
  1. package/dist/components/generative-ui-view.cjs +939 -0
  2. package/dist/components/generative-ui-view.cjs.map +1 -0
  3. package/dist/components/generative-ui-view.d.mts +3 -0
  4. package/dist/components/generative-ui-view.mjs +940 -0
  5. package/dist/components/generative-ui-view.mjs.map +1 -0
  6. package/dist/components/learning-view.cjs +145 -10
  7. package/dist/components/learning-view.cjs.map +1 -1
  8. package/dist/components/learning-view.mjs +145 -10
  9. package/dist/components/learning-view.mjs.map +1 -1
  10. package/dist/index.cjs +79 -155
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +6 -23
  13. package/dist/index.d.cts.map +1 -1
  14. package/dist/index.d.mts +7 -23
  15. package/dist/index.d.mts.map +1 -1
  16. package/dist/index.mjs +63 -139
  17. package/dist/index.mjs.map +1 -1
  18. package/dist/index.umd.js +1427 -289
  19. package/dist/index.umd.js.map +1 -1
  20. package/dist/lib/inspector-nav.cjs +2 -1
  21. package/dist/lib/inspector-nav.cjs.map +1 -1
  22. package/dist/lib/inspector-nav.mjs +2 -1
  23. package/dist/lib/inspector-nav.mjs.map +1 -1
  24. package/dist/lib/json-block.cjs +139 -0
  25. package/dist/lib/json-block.cjs.map +1 -0
  26. package/dist/lib/json-block.d.cts +26 -0
  27. package/dist/lib/json-block.d.cts.map +1 -0
  28. package/dist/lib/json-block.d.mts +28 -0
  29. package/dist/lib/json-block.d.mts.map +1 -0
  30. package/dist/lib/json-block.mjs +134 -0
  31. package/dist/lib/json-block.mjs.map +1 -0
  32. package/dist/lib/telemetry.cjs.map +1 -1
  33. package/dist/lib/telemetry.mjs.map +1 -1
  34. package/dist/package.cjs +1 -1
  35. package/dist/package.mjs +1 -1
  36. package/package.json +5 -5
package/dist/index.umd.js CHANGED
@@ -927,6 +927,54 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
927
927
 
928
928
  //#endregion
929
929
  //#region src/components/learning-view.ts
930
+ const plural = (count, singular, pluralForm) => `${count} ${count === 1 ? singular : pluralForm}`;
931
+ /** Rows shown per evidence kind before the panel asks to show more. */
932
+ const EVIDENCE_PREVIEW_LIMIT = 10;
933
+ const EVIDENCE_NOUNS = {
934
+ threads: ["Thread", "Threads"],
935
+ trajectories: ["Trajectory", "Trajectories"]
936
+ };
937
+ const trajectoryTimeFormat = new Intl.DateTimeFormat(void 0, {
938
+ month: "short",
939
+ day: "numeric",
940
+ hour: "numeric",
941
+ minute: "2-digit"
942
+ });
943
+ /**
944
+ * Reads the creation time from a UUIDv7 Trajectory id, whose first 48 bits
945
+ * are Unix milliseconds. Returns null for ids of any other version.
946
+ */
947
+ const trajectoryCreatedAt = (trajectoryId) => {
948
+ const hex = trajectoryId.replace(/-/g, "");
949
+ if (!/^[0-9a-f]{12}7[0-9a-f]{19}$/i.test(hex)) return null;
950
+ return new Date(Number.parseInt(hex.slice(0, 12), 16));
951
+ };
952
+ /**
953
+ * "Showing 100 of 412 Trajectories" for each kind the response shortened,
954
+ * or null when every cited source is listed.
955
+ */
956
+ function evidenceCoverageLabel(insight) {
957
+ var _insight$trajectoryEv, _insight$trajectoryEv2;
958
+ if (!insight.evidenceTruncated) return null;
959
+ const parts = [];
960
+ if (insight.evidence.length < insight.totalThreadCount) parts.push(`${insight.evidence.length} of ${plural(insight.totalThreadCount, ...EVIDENCE_NOUNS.threads)}`);
961
+ const trajectoriesShown = (_insight$trajectoryEv = (_insight$trajectoryEv2 = insight.trajectoryEvidence) === null || _insight$trajectoryEv2 === void 0 ? void 0 : _insight$trajectoryEv2.length) !== null && _insight$trajectoryEv !== void 0 ? _insight$trajectoryEv : 0;
962
+ if (insight.totalTrajectoryCount !== void 0 && trajectoriesShown < insight.totalTrajectoryCount) parts.push(`${trajectoriesShown} of ${plural(insight.totalTrajectoryCount, ...EVIDENCE_NOUNS.trajectories)}`);
963
+ return parts.length === 0 ? null : `Showing ${parts.join(" · ")}`;
964
+ }
965
+ /**
966
+ * Labels the sources an Insight cites. Trajectories are named only when
967
+ * cited, so Thread-only Insights and older Intelligence versions read as
968
+ * before.
969
+ */
970
+ function evidenceCountLabel(insight) {
971
+ var _ref, _insight$totalTraject, _insight$trajectoryEv3;
972
+ const threads = plural(insight.totalThreadCount, "Thread", "Threads");
973
+ const trajectoryCount = (_ref = (_insight$totalTraject = insight.totalTrajectoryCount) !== null && _insight$totalTraject !== void 0 ? _insight$totalTraject : (_insight$trajectoryEv3 = insight.trajectoryEvidence) === null || _insight$trajectoryEv3 === void 0 ? void 0 : _insight$trajectoryEv3.length) !== null && _ref !== void 0 ? _ref : 0;
974
+ if (trajectoryCount === 0) return threads;
975
+ const trajectories = plural(trajectoryCount, "Trajectory", "Trajectories");
976
+ return insight.totalThreadCount === 0 ? trajectories : `${threads} · ${trajectories}`;
977
+ }
930
978
  function deriveLearningViewState(input) {
931
979
  if (!input.supported) return input.setupActive ? "setup" : "landing";
932
980
  if (!input.snapshot && input.loading) return "loading";
@@ -958,6 +1006,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
958
1006
  this.promptTrigger = null;
959
1007
  this.expandedSkillId = null;
960
1008
  this.selectedInsightId = null;
1009
+ this.expandedEvidence = /* @__PURE__ */ new Set();
961
1010
  this.skillPageKey = "";
962
1011
  this.handlePromptKeydown = (event) => {
963
1012
  if (event.key === "Escape") {
@@ -1156,6 +1205,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1156
1205
  </nav>`;
1157
1206
  }
1158
1207
  renderEvidence(insight) {
1208
+ var _insight$trajectoryEv4;
1209
+ const threads = insight.evidence;
1210
+ const trajectories = (_insight$trajectoryEv4 = insight.trajectoryEvidence) !== null && _insight$trajectoryEv4 !== void 0 ? _insight$trajectoryEv4 : [];
1211
+ const mixed = threads.length > 0 && trajectories.length > 0;
1212
+ const coverage = evidenceCoverageLabel(insight);
1159
1213
  return lit.html`<section class="detail-panel" aria-label="Insight evidence">
1160
1214
  <div class="detail-head">
1161
1215
  <div>
@@ -1174,14 +1228,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1174
1228
  ×
1175
1229
  </button>
1176
1230
  </div>
1231
+ ${coverage ? lit.html`<p class="evidence-coverage">${coverage}</p>` : lit.nothing}
1177
1232
  <div class="evidence-list">
1178
- ${insight.evidence.length === 0 ? lit.html`
1233
+ ${threads.length === 0 && trajectories.length === 0 ? lit.html`
1179
1234
  <div class="evidence-unavailable">Evidence is no longer available</div>
1180
- ` : insight.evidence.map((evidence) => {
1235
+ ` : lit.html`${this.renderEvidenceGroup(insight.id, "threads", threads, mixed, (evidence) => {
1181
1236
  var _evidence$threadName;
1182
- return evidence.status === "unavailable" ? lit.html`
1183
- <div class="evidence-unavailable">Evidence is no longer available</div>
1184
- ` : lit.html`<button
1237
+ return lit.html`<button
1185
1238
  class="evidence-link"
1186
1239
  type="button"
1187
1240
  @click=${() => this.emit("learning-open-evidence", {
@@ -1193,12 +1246,63 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1193
1246
  ${(_evidence$threadName = evidence.threadName) !== null && _evidence$threadName !== void 0 ? _evidence$threadName : `Thread ${evidence.threadId.slice(0, 8)}`}
1194
1247
  <span>Open Thread →</span>
1195
1248
  </button>`;
1196
- })}
1249
+ })}${this.renderEvidenceGroup(insight.id, "trajectories", trajectories, mixed, (evidence) => this.renderTrajectoryEvidence(evidence))}`}
1197
1250
  </div>
1198
- ${insight.evidenceTruncated ? lit.html`
1251
+ ${insight.evidenceTruncated && !coverage ? lit.html`
1199
1252
  <p class="supporting-unavailable">Evidence response shortened</p>
1200
1253
  ` : lit.nothing}
1201
1254
  </section>`;
1255
+ }
1256
+ /**
1257
+ * Lists one kind of evidence: the first rows with a toggle for the rest,
1258
+ * then one line counting the sources that are no longer available.
1259
+ */
1260
+ renderEvidenceGroup(insightId, kind, entries, showHeading, renderRow) {
1261
+ if (entries.length === 0) return lit.nothing;
1262
+ const available = entries.filter((entry) => entry.status === "available");
1263
+ const unavailable = entries.length - available.length;
1264
+ const key = `${insightId}:${kind}`;
1265
+ const expanded = this.expandedEvidence.has(key);
1266
+ const hidden = Math.max(0, available.length - EVIDENCE_PREVIEW_LIMIT);
1267
+ const [singular, pluralForm] = EVIDENCE_NOUNS[kind];
1268
+ return lit.html`
1269
+ ${showHeading ? lit.html`<h4 class="evidence-group-heading">${pluralForm}</h4>` : lit.nothing}
1270
+ ${(expanded ? available : available.slice(0, EVIDENCE_PREVIEW_LIMIT)).map(renderRow)}
1271
+ ${hidden > 0 ? lit.html`<button
1272
+ class="evidence-more"
1273
+ type="button"
1274
+ aria-expanded=${expanded}
1275
+ @click=${() => {
1276
+ if (expanded) this.expandedEvidence.delete(key);
1277
+ else this.expandedEvidence.add(key);
1278
+ this.requestUpdate();
1279
+ }}
1280
+ >
1281
+ ${expanded ? `Show fewer ${pluralForm}` : `Show ${plural(hidden, `more ${singular}`, `more ${pluralForm}`)}`}
1282
+ </button>` : lit.nothing}
1283
+ ${unavailable > 0 ? lit.html`<div class="evidence-unavailable">
1284
+ ${plural(unavailable, singular, pluralForm)}
1285
+ ${unavailable === 1 ? "is" : "are"} no longer available
1286
+ </div>` : lit.nothing}
1287
+ `;
1288
+ }
1289
+ renderTrajectoryEvidence(evidence) {
1290
+ const createdAt = trajectoryCreatedAt(evidence.trajectoryId);
1291
+ const idTail = evidence.trajectoryId.slice(-8);
1292
+ return lit.html`<a
1293
+ class="evidence-link"
1294
+ href=${evidence.url}
1295
+ target="_blank"
1296
+ rel="noopener noreferrer"
1297
+ title=${evidence.trajectoryId}
1298
+ @click=${() => this.emit("learning-web-link", { category: "trajectory" })}
1299
+ >
1300
+ ⌁
1301
+ ${createdAt ? `Trajectory · ${trajectoryTimeFormat.format(createdAt)}` : `Trajectory ${idTail}`}
1302
+ · ${plural(evidence.eventCount, "cited event", "cited events")}
1303
+ ${createdAt ? lit.html`<small class="evidence-id">${idTail}</small>` : lit.nothing}
1304
+ <span>Open Trajectory ↗</span>
1305
+ </a>`;
1202
1306
  }
1203
1307
  selectInsight(insight) {
1204
1308
  this.selectedInsightId = insight.id;
@@ -1242,8 +1346,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1242
1346
  @click=${() => this.selectInsight(skill.sourceInsight)}
1243
1347
  >
1244
1348
  ${this.supportingInsightLabel(skill.sourceInsight.statement)}<small
1245
- >${skill.sourceInsight.totalThreadCount}
1246
- ${skill.sourceInsight.totalThreadCount === 1 ? "Thread" : "Threads"}</small
1349
+ >${evidenceCountLabel(skill.sourceInsight)}</small
1247
1350
  >
1248
1351
  </button>` : lit.html`
1249
1352
  <div class="supporting-unavailable">Supporting Insight unavailable</div>
@@ -1298,8 +1401,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1298
1401
  <p>${insight.impact}</p>
1299
1402
  </div>
1300
1403
  <span class="evidence-count"
1301
- >${insight.totalThreadCount}
1302
- ${insight.totalThreadCount === 1 ? "Thread" : "Threads"}</span
1404
+ >${evidenceCountLabel(insight)}</span
1303
1405
  >
1304
1406
  </button>`)}
1305
1407
  </div>`}
@@ -2221,7 +2323,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2221
2323
  text-align: left;
2222
2324
  }
2223
2325
  .evidence-link {
2326
+ box-sizing: border-box;
2224
2327
  width: 100%;
2328
+ text-decoration: none;
2225
2329
  cursor: pointer;
2226
2330
  }
2227
2331
  .evidence-link span {
@@ -2232,6 +2336,40 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2232
2336
  color: var(--learning-muted-strong);
2233
2337
  font-style: italic;
2234
2338
  }
2339
+ .evidence-coverage {
2340
+ margin: 12px 0 0;
2341
+ color: var(--learning-muted-strong);
2342
+ font-size: 11px;
2343
+ }
2344
+ .evidence-group-heading {
2345
+ margin: 6px 0 0;
2346
+ color: var(--learning-muted-strong);
2347
+ font-size: 10px;
2348
+ font-weight: 800;
2349
+ letter-spacing: 0.06em;
2350
+ text-transform: uppercase;
2351
+ }
2352
+ .evidence-group-heading:first-child {
2353
+ margin-top: 0;
2354
+ }
2355
+ .evidence-id {
2356
+ color: var(--learning-muted-strong);
2357
+ font:
2358
+ 10px ui-monospace,
2359
+ SFMono-Regular,
2360
+ Menlo,
2361
+ monospace;
2362
+ }
2363
+ .evidence-more {
2364
+ justify-self: start;
2365
+ padding: 2px 0;
2366
+ color: var(--learning-purple-dark);
2367
+ background: none;
2368
+ border: 0;
2369
+ font-size: 11px;
2370
+ font-weight: 700;
2371
+ cursor: pointer;
2372
+ }
2235
2373
  .pagination {
2236
2374
  display: flex;
2237
2375
  align-items: center;
@@ -2356,29 +2494,1150 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2356
2494
  min-height: auto;
2357
2495
  }
2358
2496
  }
2359
- @media (max-width: 640px) {
2360
- .pane-inner {
2361
- padding: 24px 18px 60px;
2362
- }
2363
- .analysis-row,
2364
- .collection-summary {
2365
- align-items: flex-start;
2366
- flex-wrap: wrap;
2367
- }
2368
- .insight-row {
2369
- grid-template-columns: 1fr;
2370
- gap: 8px;
2371
- }
2372
- .evidence-count {
2373
- text-align: left;
2374
- }
2375
- .review-link {
2376
- width: 100%;
2377
- margin: 4px 0 0;
2378
- }
2497
+ @media (max-width: 640px) {
2498
+ .pane-inner {
2499
+ padding: 24px 18px 60px;
2500
+ }
2501
+ .analysis-row,
2502
+ .collection-summary {
2503
+ align-items: flex-start;
2504
+ flex-wrap: wrap;
2505
+ }
2506
+ .insight-row {
2507
+ grid-template-columns: 1fr;
2508
+ gap: 8px;
2509
+ }
2510
+ .evidence-count {
2511
+ text-align: left;
2512
+ }
2513
+ .review-link {
2514
+ width: 100%;
2515
+ margin: 4px 0 0;
2516
+ }
2517
+ }
2518
+ `;
2519
+ if (!customElements.get("cpk-learning-view")) customElements.define("cpk-learning-view", CpkLearningView);
2520
+
2521
+ //#endregion
2522
+ //#region \0@oxc-project+runtime@0.112.0/helpers/checkPrivateRedeclaration.js
2523
+ function _checkPrivateRedeclaration(e, t) {
2524
+ if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
2525
+ }
2526
+
2527
+ //#endregion
2528
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateMethodInitSpec.js
2529
+ function _classPrivateMethodInitSpec(e, a) {
2530
+ _checkPrivateRedeclaration(e, a), a.add(e);
2531
+ }
2532
+
2533
+ //#endregion
2534
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldInitSpec.js
2535
+ function _classPrivateFieldInitSpec(e, t, a) {
2536
+ _checkPrivateRedeclaration(e, t), t.set(e, a);
2537
+ }
2538
+
2539
+ //#endregion
2540
+ //#region \0@oxc-project+runtime@0.112.0/helpers/assertClassBrand.js
2541
+ function _assertClassBrand(e, t, n) {
2542
+ if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
2543
+ throw new TypeError("Private element is not present on this object");
2544
+ }
2545
+
2546
+ //#endregion
2547
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldGet2.js
2548
+ function _classPrivateFieldGet2(s, a) {
2549
+ return s.get(_assertClassBrand(s, a));
2550
+ }
2551
+
2552
+ //#endregion
2553
+ //#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldSet2.js
2554
+ function _classPrivateFieldSet2(s, a, r) {
2555
+ return s.set(_assertClassBrand(s, a), r), r;
2556
+ }
2557
+
2558
+ //#endregion
2559
+ //#region src/lib/json-block.ts
2560
+ var _globalThis$HTMLEleme;
2561
+ function escapeHtml(s) {
2562
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
2563
+ }
2564
+ const highlightedJsonCache = /* @__PURE__ */ new WeakMap();
2565
+ function highlightedJson(obj) {
2566
+ if (typeof obj === "object" && obj !== null) {
2567
+ const cached = highlightedJsonCache.get(obj);
2568
+ if (cached !== void 0) return cached;
2569
+ }
2570
+ const json = JSON.stringify(obj, null, 2);
2571
+ if (!json) return "";
2572
+ const parts = [];
2573
+ let lastIndex = 0;
2574
+ const re = /("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*"(?:\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g;
2575
+ let match;
2576
+ while ((match = re.exec(json)) !== null) {
2577
+ parts.push(escapeHtml(json.slice(lastIndex, match.index)));
2578
+ const m = match[0];
2579
+ let token = "num";
2580
+ if (m.startsWith("\"")) token = m.trimEnd().endsWith(":") ? "key" : "str";
2581
+ else if (m === "true" || m === "false") token = "bool";
2582
+ else if (m === "null") token = "nil";
2583
+ parts.push(`<span class="cpk-json-token cpk-json-token--${token}">${escapeHtml(m)}</span>`);
2584
+ lastIndex = match.index + m.length;
2585
+ }
2586
+ parts.push(escapeHtml(json.slice(lastIndex)));
2587
+ const result = parts.join("");
2588
+ if (typeof obj === "object" && obj !== null) highlightedJsonCache.set(obj, result);
2589
+ return result;
2590
+ }
2591
+ function coerceJsonValue(value) {
2592
+ if (typeof value !== "string") return value;
2593
+ const trimmed = value.trim();
2594
+ if (trimmed.length === 0) return value;
2595
+ if (!(trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]"))) return value;
2596
+ try {
2597
+ return JSON.parse(trimmed);
2598
+ } catch (_unused) {
2599
+ return value;
2600
+ }
2601
+ }
2602
+ let inspectorJsonRenderer = null;
2603
+ let inspectorJsonSlotCount = 0;
2604
+ const JSON_BLOCK_TAG = "cpk-json-block";
2605
+ /**
2606
+ * Replaces the inspector's built-in JSON blocks (tool arguments and results,
2607
+ * state, events, and context) with a host renderer. Pass `null` to restore the
2608
+ * built-in blocks. Set it before the inspector renders: a block that is
2609
+ * already on screen changes at the inspector's next render.
2610
+ *
2611
+ * @example
2612
+ * ```ts
2613
+ * setInspectorJsonRenderer((container, value) => {
2614
+ * const root = createRoot(container);
2615
+ * root.render(<JsonView value={value} />);
2616
+ * return () => root.unmount();
2617
+ * });
2618
+ * ```
2619
+ */
2620
+ function setInspectorJsonRenderer(renderer) {
2621
+ inspectorJsonRenderer = renderer;
2622
+ }
2623
+ var _value = /* @__PURE__ */ new WeakMap();
2624
+ var _hasValue = /* @__PURE__ */ new WeakMap();
2625
+ var _cleanup = /* @__PURE__ */ new WeakMap();
2626
+ var _container = /* @__PURE__ */ new WeakMap();
2627
+ var _CpkJsonBlock_brand = /* @__PURE__ */ new WeakSet();
2628
+ /**
2629
+ * Hosts one value drawn by the host renderer. Inside a shadow root, the
2630
+ * container lives in the shadow host's light DOM and shows here through a
2631
+ * named slot, so the host page's own styles apply to what the renderer draws.
2632
+ */
2633
+ var CpkJsonBlock = class extends ((_globalThis$HTMLEleme = globalThis.HTMLElement) !== null && _globalThis$HTMLEleme !== void 0 ? _globalThis$HTMLEleme : class {}) {
2634
+ constructor(..._args) {
2635
+ super(..._args);
2636
+ _classPrivateMethodInitSpec(this, _CpkJsonBlock_brand);
2637
+ _classPrivateFieldInitSpec(this, _value, void 0);
2638
+ _classPrivateFieldInitSpec(this, _hasValue, false);
2639
+ _classPrivateFieldInitSpec(this, _cleanup, void 0);
2640
+ _classPrivateFieldInitSpec(this, _container, void 0);
2641
+ }
2642
+ get value() {
2643
+ return _classPrivateFieldGet2(_value, this);
2644
+ }
2645
+ set value(next) {
2646
+ if (_classPrivateFieldGet2(_hasValue, this) && Object.is(next, _classPrivateFieldGet2(_value, this))) return;
2647
+ _classPrivateFieldSet2(_value, this, next);
2648
+ _classPrivateFieldSet2(_hasValue, this, true);
2649
+ if (this.isConnected) _assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
2650
+ }
2651
+ connectedCallback() {
2652
+ this.style.display = "block";
2653
+ _assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
2654
+ }
2655
+ disconnectedCallback() {
2656
+ _assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
2657
+ }
2658
+ };
2659
+ function _render() {
2660
+ _assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
2661
+ const renderer = inspectorJsonRenderer;
2662
+ if (!renderer) return;
2663
+ const root = this.getRootNode();
2664
+ const container = this.ownerDocument.createElement("div");
2665
+ if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in root) {
2666
+ inspectorJsonSlotCount += 1;
2667
+ const name = `cpk-json-${inspectorJsonSlotCount}`;
2668
+ const slot = this.ownerDocument.createElement("slot");
2669
+ slot.name = name;
2670
+ this.replaceChildren(slot);
2671
+ container.slot = name;
2672
+ root.host.append(container);
2673
+ } else this.replaceChildren(container);
2674
+ _classPrivateFieldSet2(_container, this, container);
2675
+ const cleanup = renderer(container, _classPrivateFieldGet2(_value, this));
2676
+ _classPrivateFieldSet2(_cleanup, this, typeof cleanup === "function" ? cleanup : void 0);
2677
+ }
2678
+ function _teardown() {
2679
+ var _classPrivateFieldGet2$1;
2680
+ const cleanup = _classPrivateFieldGet2(_cleanup, this);
2681
+ _classPrivateFieldSet2(_cleanup, this, void 0);
2682
+ cleanup === null || cleanup === void 0 || cleanup();
2683
+ (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_container, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.remove();
2684
+ _classPrivateFieldSet2(_container, this, void 0);
2685
+ this.replaceChildren();
2686
+ }
2687
+ function renderHighlightedJsonBlock(value, options = {}) {
2688
+ if (inspectorJsonRenderer) return lit.html`<cpk-json-block
2689
+ .value=${value}
2690
+ style=${options.maxHeight ? `overflow:auto;max-height:${options.maxHeight}` : lit.nothing}
2691
+ ></cpk-json-block>`;
2692
+ const parsed = coerceJsonValue(value);
2693
+ return lit.html`<pre class="cpk-json-block" style=${(options.maxHeight ? `max-height:${options.maxHeight}` : void 0) || lit.nothing}>
2694
+ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
2695
+ >`;
2696
+ }
2697
+
2698
+ //#endregion
2699
+ //#region src/components/generative-ui-view.ts
2700
+ const TABS = [
2701
+ {
2702
+ key: "surfaces",
2703
+ label: "Surfaces"
2704
+ },
2705
+ {
2706
+ key: "catalog",
2707
+ label: "Catalog"
2708
+ },
2709
+ {
2710
+ key: "prompt",
2711
+ label: "Prompt"
2712
+ }
2713
+ ];
2714
+ const PROMPT_SOURCE_NOTES = {
2715
+ runtime: "The runtime adds this text as a context entry, with the render_ui tool.",
2716
+ context: "The provider sends this text as a context entry.",
2717
+ backend: "sendContext is false. Your backend builds the prompt, usually from this text."
2718
+ };
2719
+ /** A rough token count: about 4 characters for each token. */
2720
+ function estimateTokens(text) {
2721
+ return Math.ceil(text.length / 4);
2722
+ }
2723
+ function formatTokens(text) {
2724
+ return `~${estimateTokens(text).toLocaleString()} tokens`;
2725
+ }
2726
+ function json(value) {
2727
+ var _JSON$stringify;
2728
+ return (_JSON$stringify = JSON.stringify(value, null, 2)) !== null && _JSON$stringify !== void 0 ? _JSON$stringify : "undefined";
2729
+ }
2730
+ /** The kind of an A2UI operation, for example `updateComponents`. */
2731
+ function operationKind(operation) {
2732
+ var _Object$keys$find;
2733
+ if (typeof operation !== "object" || operation === null) return "unknown";
2734
+ return (_Object$keys$find = Object.keys(operation).find((key) => key !== "version")) !== null && _Object$keys$find !== void 0 ? _Object$keys$find : "unknown";
2735
+ }
2736
+ /**
2737
+ * The component tree of a surface, from its root. Later operations replace
2738
+ * components with the same id. Skipped operations (rejected by the browser)
2739
+ * are left out. A slot id with no component yet is left out too.
2740
+ */
2741
+ function componentTree(operations, skip, catalog) {
2742
+ const byId = /* @__PURE__ */ new Map();
2743
+ operations.forEach((operation, index) => {
2744
+ if (skip.has(index)) return;
2745
+ const components = "createSurface" in operation ? operation.createSurface.components : "updateComponents" in operation ? operation.updateComponents.components : void 0;
2746
+ for (const node of components !== null && components !== void 0 ? components : []) byId.set(node.id, node);
2747
+ });
2748
+ const seen = /* @__PURE__ */ new Set();
2749
+ const build = (id, repeat) => {
2750
+ var _manifest$slots;
2751
+ const node = typeof id === "string" ? byId.get(id) : void 0;
2752
+ if (!node || seen.has(node.id)) return [];
2753
+ seen.add(node.id);
2754
+ const { id: _id, component, ...rest } = node;
2755
+ const manifest = catalog[component];
2756
+ const refs = manifest ? (0, _copilotkit_shared.collectChildRefs)(manifest.props) : [];
2757
+ const childKeys = new Set([...Object.keys((_manifest$slots = manifest === null || manifest === void 0 ? void 0 : manifest.slots) !== null && _manifest$slots !== void 0 ? _manifest$slots : {}), ...refs.filter((ref) => ref.path.length === 1).map((ref) => ref.path[0])]);
2758
+ const nested = refs.filter((ref) => ref.path.length > 1);
2759
+ const props = {};
2760
+ const children = [];
2761
+ for (const [name, value] of Object.entries(rest)) if (!childKeys.has(name)) props[name] = value;
2762
+ else if (Array.isArray(value)) for (const child of value) children.push(...build(child));
2763
+ else if (typeof value === "object" && value !== null) {
2764
+ const template = value;
2765
+ children.push(...build(template.componentId, template.path));
2766
+ } else children.push(...build(value));
2767
+ for (const child of (0, _copilotkit_shared.childIdsAtRefs)(rest, nested)) children.push(...build(child));
2768
+ return [{
2769
+ id: node.id,
2770
+ component,
2771
+ props,
2772
+ ...repeat ? { repeat } : {},
2773
+ children
2774
+ }];
2775
+ };
2776
+ return build(_copilotkit_shared.GENERATIVE_UI_ROOT_ID)[0];
2777
+ }
2778
+ /** The first element of the page whose `attribute` is `value`. */
2779
+ function findOnPage(attribute, value) {
2780
+ return [...document.querySelectorAll(`[${attribute}]`)].find((element) => element.getAttribute(attribute) === value);
2781
+ }
2782
+ /**
2783
+ * The function problem that the inspector shows. A function goes to the
2784
+ * model only with exactly one mounted handler.
2785
+ */
2786
+ /**
2787
+ * Splits components by the catalog that declared them: the catalog of the
2788
+ * provider first, then each base in the order of `extends`.
2789
+ */
2790
+ function groupByCatalog(components, snapshot) {
2791
+ const groups = new Map([[snapshot.catalogId, []]]);
2792
+ for (const entry of components) {
2793
+ var _snapshot$componentCa, _groups$get;
2794
+ const id = (_snapshot$componentCa = snapshot.componentCatalogs[entry[0]]) !== null && _snapshot$componentCa !== void 0 ? _snapshot$componentCa : snapshot.catalogId;
2795
+ groups.set(id, [...(_groups$get = groups.get(id)) !== null && _groups$get !== void 0 ? _groups$get : [], entry]);
2796
+ }
2797
+ return [...groups].filter(([, group]) => group.length > 0);
2798
+ }
2799
+ function functionHandlerProblem(handlers) {
2800
+ if (handlers === 1) return void 0;
2801
+ if (handlers === 0) return "No useGenerativeUIFunction handler is mounted, so the model does not get this function.";
2802
+ return `${handlers} handlers are mounted. Mount exactly one, or the model does not get this function.`;
2803
+ }
2804
+ /**
2805
+ * The Generative UI pane: the catalog, the targets and surfaces on the page,
2806
+ * and what a run adds to the prompt of the model.
2807
+ */
2808
+ var CpkGenerativeUIView = class extends lit.LitElement {
2809
+ constructor(..._args) {
2810
+ super(..._args);
2811
+ this.tab = "surfaces";
2812
+ this.run = "last";
2813
+ this.filter = "";
2814
+ this.expanded = /* @__PURE__ */ new Set();
2815
+ this.copied = null;
2816
+ this.unsubscribe = null;
2817
+ this.outlined = null;
2818
+ }
2819
+ disconnectedCallback() {
2820
+ var _this$unsubscribe;
2821
+ super.disconnectedCallback();
2822
+ this.unhighlight();
2823
+ (_this$unsubscribe = this.unsubscribe) === null || _this$unsubscribe === void 0 || _this$unsubscribe.call(this);
2824
+ this.unsubscribe = null;
2825
+ this.subscribedSource = void 0;
2826
+ }
2827
+ willUpdate() {
2828
+ var _this$unsubscribe2, _this$source$subscrib, _this$source;
2829
+ if (this.source === this.subscribedSource && this.unsubscribe) return;
2830
+ (_this$unsubscribe2 = this.unsubscribe) === null || _this$unsubscribe2 === void 0 || _this$unsubscribe2.call(this);
2831
+ this.subscribedSource = this.source;
2832
+ this.unsubscribe = (_this$source$subscrib = (_this$source = this.source) === null || _this$source === void 0 ? void 0 : _this$source.subscribe(() => this.requestUpdate())) !== null && _this$source$subscrib !== void 0 ? _this$source$subscrib : null;
2833
+ }
2834
+ toggle(key) {
2835
+ if (this.expanded.has(key)) this.expanded.delete(key);
2836
+ else this.expanded.add(key);
2837
+ this.requestUpdate();
2838
+ }
2839
+ async copy(key, text) {
2840
+ try {
2841
+ await navigator.clipboard.writeText(text);
2842
+ this.copied = key;
2843
+ } catch (_unused) {
2844
+ this.copied = null;
2845
+ }
2846
+ this.requestUpdate();
2847
+ setTimeout(() => {
2848
+ if (this.copied !== key) return;
2849
+ this.copied = null;
2850
+ this.requestUpdate();
2851
+ }, 1500);
2852
+ }
2853
+ /**
2854
+ * Outlines an element of the page and scrolls it into view, until
2855
+ * `unhighlight`. Hover and keyboard focus call these two.
2856
+ */
2857
+ highlight(element) {
2858
+ this.unhighlight();
2859
+ if (!element) return;
2860
+ const { outline, outlineOffset } = element.style;
2861
+ this.outlined = {
2862
+ element,
2863
+ outline,
2864
+ outlineOffset
2865
+ };
2866
+ element.style.outline = "2px solid #7567ff";
2867
+ element.style.outlineOffset = "4px";
2868
+ element.scrollIntoView({
2869
+ behavior: "smooth",
2870
+ block: "nearest"
2871
+ });
2872
+ }
2873
+ unhighlight() {
2874
+ if (!this.outlined) return;
2875
+ const { element, outline, outlineOffset } = this.outlined;
2876
+ element.style.outline = outline;
2877
+ element.style.outlineOffset = outlineOffset;
2878
+ this.outlined = null;
2879
+ }
2880
+ render() {
2881
+ if (!this.source) return lit.html`
2882
+ <div class="empty">
2883
+ <p class="strong">No generative UI</p>
2884
+ <p>
2885
+ Pass <code>generativeUI</code> to <code>CopilotKitProvider</code>, and this
2886
+ pane shows its catalog, surfaces, and prompt.
2887
+ </p>
2888
+ </div>
2889
+ `;
2890
+ const snapshot = this.source.getSnapshot();
2891
+ return lit.html`
2892
+ <header class="header">
2893
+ <div class="title-row">
2894
+ <h2>Generative UI</h2>
2895
+ <span class="chip">${snapshot.transport} transport</span>
2896
+ <code class="muted">${snapshot.catalogId}</code>
2897
+ </div>
2898
+ <p class="muted small">
2899
+ ${snapshot.agentIds ? `For agents: ${snapshot.agentIds.join(", ")}` : "For every agent"}
2900
+ · ${Object.keys(snapshot.components).length} components ·
2901
+ ${Object.keys(snapshot.functions).length} functions ·
2902
+ ${snapshot.surfaces.length} surfaces
2903
+ </p>
2904
+ <nav class="tabs" role="tablist">
2905
+ ${TABS.map((tab) => lit.html`<button
2906
+ type="button"
2907
+ role="tab"
2908
+ aria-selected=${this.tab === tab.key}
2909
+ class="tab ${this.tab === tab.key ? "active" : ""}"
2910
+ @click=${() => {
2911
+ this.tab = tab.key;
2912
+ this.requestUpdate();
2913
+ }}
2914
+ >
2915
+ ${tab.label}
2916
+ </button>`)}
2917
+ </nav>
2918
+ </header>
2919
+ <div class="body">
2920
+ ${this.tab === "surfaces" ? this.renderSurfaces(snapshot) : this.tab === "catalog" ? this.renderCatalog(snapshot) : this.renderPrompt(snapshot)}
2921
+ </div>
2922
+ `;
2923
+ }
2924
+ renderSurfaces(snapshot) {
2925
+ const stateKeys = Object.keys(snapshot.state);
2926
+ const active = snapshot.surfaces.filter((surface) => surface.threadId === snapshot.activeThreadId);
2927
+ const other = snapshot.surfaces.filter((surface) => surface.threadId !== snapshot.activeThreadId);
2928
+ return lit.html`
2929
+ <section>
2930
+ <h3>Targets</h3>
2931
+ <p class="muted small">
2932
+ Where the model can render. The model sees each description.
2933
+ </p>
2934
+ ${snapshot.targets.map((target) => {
2935
+ const show = () => this.highlight(findOnPage("data-generative-ui-surface", target.id));
2936
+ return lit.html`<div
2937
+ class="row"
2938
+ @mouseenter=${show}
2939
+ @mouseleave=${this.unhighlight}
2940
+ >
2941
+ <div class="row-main">
2942
+ <div class="row-title">
2943
+ <code>${target.id}</code>
2944
+ <span class="chip">${target.kind}</span>
2945
+ ${target.components ? lit.html`<span class="chip"
2946
+ >${target.components.length} components only</span
2947
+ >` : lit.nothing}
2948
+ </div>
2949
+ ${target.description ? lit.html`<p class="small">${target.description}</p>` : target.kind === "inline" ? lit.html`
2950
+ <p class="small warn">
2951
+ No description. Give the surface a description, so the model knows what to put
2952
+ in it.
2953
+ </p>
2954
+ ` : lit.nothing}
2955
+ ${target.components ? lit.html`<p class="muted small">
2956
+ ${target.components.join(", ") || "No components"}
2957
+ </p>` : lit.nothing}
2958
+ </div>
2959
+ </div>`;
2960
+ })}
2961
+ </section>
2962
+ <section>
2963
+ <h3>Surfaces in this thread</h3>
2964
+ ${active.length === 0 ? lit.html`
2965
+ <p class="muted small">No surfaces yet. Ask the chat for something visual.</p>
2966
+ ` : active.map((surface) => this.renderSurface(surface, snapshot.components))}
2967
+ ${other.length > 0 ? lit.html`<h4>Other threads</h4>
2968
+ ${other.map((surface) => this.renderSurface(surface, snapshot.components))}` : lit.nothing}
2969
+ </section>
2970
+ <section>
2971
+ <h3>App state</h3>
2972
+ <p class="muted small">
2973
+ Bound props read these values. The model does not see them.
2974
+ </p>
2975
+ ${stateKeys.length === 0 ? lit.html`
2976
+ <p class="muted small">No state is set.</p>
2977
+ ` : renderHighlightedJsonBlock(snapshot.state)}
2978
+ </section>
2979
+ `;
2980
+ }
2981
+ renderComponent(node, key) {
2982
+ const nodeKey = `${key}:component:${node.id}`;
2983
+ const propCount = Object.keys(node.props).length;
2984
+ return lit.html`<li>
2985
+ <button
2986
+ type="button"
2987
+ class="op-toggle"
2988
+ aria-expanded=${this.expanded.has(nodeKey)}
2989
+ @click=${() => this.toggle(nodeKey)}
2990
+ >
2991
+ <code>${node.component}</code>
2992
+ <span class="muted small">${node.id}</span>
2993
+ ${node.repeat ? lit.html`<span class="chip">each item of ${node.repeat}</span>` : lit.nothing}
2994
+ <span class="muted small">${propCount} props</span>
2995
+ </button>
2996
+ ${this.expanded.has(nodeKey) ? renderHighlightedJsonBlock(node.props) : lit.nothing}
2997
+ ${node.children.length > 0 ? lit.html`<ul class="tree">
2998
+ ${node.children.map((child) => this.renderComponent(child, key))}
2999
+ </ul>` : lit.nothing}
3000
+ </li>`;
3001
+ }
3002
+ renderSurface(surface, catalog) {
3003
+ const key = `surface:${surface.threadId}:${surface.surfaceId}`;
3004
+ const isOpen = this.expanded.has(key);
3005
+ const userPaths = Object.keys(surface.userValues);
3006
+ const browserRejected = new Set(surface.rejected.filter((rejection) => rejection.source === "browser").map((rejection) => rejection.index));
3007
+ const tree = isOpen ? componentTree(surface.operations, browserRejected, catalog) : void 0;
3008
+ const show = () => {
3009
+ var _findOnPage;
3010
+ return this.highlight((_findOnPage = findOnPage("data-generative-ui-root", surface.surfaceId)) === null || _findOnPage === void 0 ? void 0 : _findOnPage.closest("[data-generative-ui-surface]"));
3011
+ };
3012
+ return lit.html`<div
3013
+ class="card"
3014
+ @mouseenter=${show}
3015
+ @mouseleave=${this.unhighlight}
3016
+ @focusin=${show}
3017
+ @focusout=${this.unhighlight}
3018
+ >
3019
+ <div class="card-head">
3020
+ <button
3021
+ type="button"
3022
+ class="card-toggle"
3023
+ aria-expanded=${isOpen}
3024
+ @click=${() => this.toggle(key)}
3025
+ >
3026
+ <span class="row-title">
3027
+ <code>${surface.surfaceId}</code>
3028
+ <span class="chip status-${surface.status}">${surface.status}</span>
3029
+ <span class="muted small">in ${surface.target}</span>
3030
+ </span>
3031
+ <span class="muted small">
3032
+ ${surface.operations.length} operations
3033
+ ${surface.rejected.length > 0 ? lit.html`·
3034
+ <span class="danger"
3035
+ >${surface.rejected.length} rejected</span
3036
+ >` : lit.nothing}
3037
+ ${userPaths.length > 0 ? lit.html`· ${userPaths.length} user values` : lit.nothing}
3038
+ </span>
3039
+ </button>
3040
+ </div>
3041
+ ${isOpen ? lit.html`<div class="card-body">
3042
+ ${surface.rejected.length > 0 ? lit.html`<h4>Rejected operations</h4>
3043
+ <p class="muted small">
3044
+ These were dropped. The model gets them on its next run, so
3045
+ it can fix them.
3046
+ </p>
3047
+ <ul class="list">
3048
+ ${surface.rejected.map((rejection) => lit.html`<li class="danger">
3049
+ <span class="chip">${rejection.source}</span>
3050
+ operation ${rejection.index}: ${rejection.reason}
3051
+ </li>`)}
3052
+ </ul>` : lit.nothing}
3053
+ ${userPaths.length > 0 ? lit.html`<h4>User values</h4>
3054
+ <p class="muted small">
3055
+ The user wrote these paths. Agent writes to them are
3056
+ ignored.
3057
+ </p>
3058
+ ${renderHighlightedJsonBlock(surface.userValues)}` : lit.nothing}
3059
+ <h4>Components</h4>
3060
+ ${tree ? lit.html`<ul class="tree root">
3061
+ ${this.renderComponent(tree, key)}
3062
+ </ul>` : lit.html`
3063
+ <p class="muted small">No root component yet.</p>
3064
+ `}
3065
+ <h4>Data model</h4>
3066
+ ${renderHighlightedJsonBlock(surface.dataModel)}
3067
+ <h4>Operations</h4>
3068
+ <ol class="ops">
3069
+ ${surface.operations.map((operation, index) => {
3070
+ const opKey = `${key}:op:${index}`;
3071
+ const rejected = browserRejected.has(index);
3072
+ return lit.html`<li class=${rejected ? "danger" : ""}>
3073
+ <button
3074
+ type="button"
3075
+ class="op-toggle"
3076
+ aria-expanded=${this.expanded.has(opKey)}
3077
+ @click=${() => this.toggle(opKey)}
3078
+ >
3079
+ <span class="muted">${index}</span>
3080
+ <code>${operationKind(operation)}</code>
3081
+ ${rejected ? lit.html`
3082
+ <span class="chip">rejected</span>
3083
+ ` : lit.nothing}
3084
+ </button>
3085
+ ${this.expanded.has(opKey) ? renderHighlightedJsonBlock(operation) : lit.nothing}
3086
+ </li>`;
3087
+ })}
3088
+ </ol>
3089
+ <p class="muted small">Thread <code>${surface.threadId}</code></p>
3090
+ </div>` : lit.nothing}
3091
+ </div>`;
3092
+ }
3093
+ renderCatalogComponent(name, component) {
3094
+ var _component$events, _component$slots;
3095
+ const key = `component:${name}`;
3096
+ const isOpen = this.expanded.has(key);
3097
+ const events = Object.keys((_component$events = component.events) !== null && _component$events !== void 0 ? _component$events : {});
3098
+ return lit.html`<div class="card">
3099
+ <button
3100
+ type="button"
3101
+ class="card-toggle"
3102
+ aria-expanded=${isOpen}
3103
+ @click=${() => this.toggle(key)}
3104
+ >
3105
+ <span class="row-title">
3106
+ <code>${name}</code>
3107
+ ${[...Object.entries((_component$slots = component.slots) !== null && _component$slots !== void 0 ? _component$slots : {}), ...(0, _copilotkit_shared.collectChildRefs)(component.props).map((ref) => [ref.path.join("."), ref.kind])].map(([slot, kind]) => lit.html`<span class="chip">${slot}: ${kind}</span>`)}
3108
+ ${events.map((event) => lit.html`<span class="chip event">${event}</span>`)}
3109
+ </span>
3110
+ ${component.description ? lit.html`<span class="small">${component.description}</span>` : lit.html`
3111
+ <span class="small warn">No description</span>
3112
+ `}
3113
+ </button>
3114
+ ${isOpen ? lit.html`<div class="card-body">
3115
+ <h4>Props (JSON Schema)</h4>
3116
+ ${renderHighlightedJsonBlock(component.props)}
3117
+ ${component.events ? lit.html`<h4>Events</h4>
3118
+ ${renderHighlightedJsonBlock(component.events)}` : lit.nothing}
3119
+ </div>` : lit.nothing}
3120
+ </div>`;
3121
+ }
3122
+ renderCatalog(snapshot) {
3123
+ const query = this.filter.trim().toLowerCase();
3124
+ const matches = ([name, entry]) => {
3125
+ var _entry$description;
3126
+ return !query || name.toLowerCase().includes(query) || ((_entry$description = entry.description) === null || _entry$description === void 0 ? void 0 : _entry$description.toLowerCase().includes(query));
3127
+ };
3128
+ const components = Object.entries(snapshot.components).filter(matches);
3129
+ const functions = Object.entries(snapshot.functions).filter(matches);
3130
+ return lit.html`
3131
+ <section>
3132
+ <div class="section-head">
3133
+ <h3>Components</h3>
3134
+ <input
3135
+ class="filter"
3136
+ type="search"
3137
+ placeholder="Search"
3138
+ aria-label="Search components and functions"
3139
+ .value=${this.filter}
3140
+ @input=${(event) => {
3141
+ this.filter = event.target.value;
3142
+ this.requestUpdate();
3143
+ }}
3144
+ />
3145
+ </div>
3146
+ <p class="muted small">
3147
+ ${Object.keys(snapshot.components).length} components ·
3148
+ ${formatTokens(JSON.stringify(snapshot.components))} in the envelope
3149
+ </p>
3150
+ ${groupByCatalog(components, snapshot).map(([catalogId, group]) => {
3151
+ const key = `catalog:${catalogId}`;
3152
+ const isOwn = catalogId === snapshot.catalogId;
3153
+ const toggled = this.expanded.has(key);
3154
+ const isOpen = query !== "" || (isOwn ? !toggled : toggled);
3155
+ return lit.html`<h4>
3156
+ <button
3157
+ type="button"
3158
+ class="op-toggle catalog-toggle"
3159
+ aria-expanded=${isOpen}
3160
+ @click=${() => this.toggle(key)}
3161
+ >
3162
+ <code>${catalogId}</code>
3163
+ ${isOwn ? lit.nothing : lit.html`
3164
+ <span class="chip">extended</span>
3165
+ `}
3166
+ <span class="muted small">${group.length} components</span>
3167
+ </button>
3168
+ </h4>
3169
+ ${isOpen ? group.map(([name, component]) => this.renderCatalogComponent(name, component)) : lit.nothing}`;
3170
+ })}
3171
+ ${query && components.length === 0 ? lit.html`
3172
+ <p class="muted small">No component matches.</p>
3173
+ ` : lit.nothing}
3174
+ </section>
3175
+ <section>
3176
+ <h3>Functions</h3>
3177
+ ${functions.length === 0 ? lit.html`<p class="muted small">
3178
+ ${query ? "No function matches." : "No functions are declared."}
3179
+ </p>` : functions.map(([name, fn]) => {
3180
+ const problem = functionHandlerProblem(fn.handlers);
3181
+ return lit.html`<div class="card">
3182
+ <div class="card-body">
3183
+ <div class="row-title">
3184
+ <code>${name}</code>
3185
+ <span
3186
+ class="chip ${problem ? "status-error" : "status-ready"}"
3187
+ >${fn.handlers}
3188
+ handler${fn.handlers === 1 ? "" : "s"}</span
3189
+ >
3190
+ </div>
3191
+ ${fn.description ? lit.html`<p class="small">${fn.description}</p>` : lit.nothing}
3192
+ ${problem ? lit.html`<p class="small warn">${problem}</p>` : lit.nothing}
3193
+ ${renderHighlightedJsonBlock(fn.parameters)}
3194
+ </div>
3195
+ </div>`;
3196
+ })}
3197
+ </section>
3198
+ `;
3199
+ }
3200
+ /**
3201
+ * The prompt text and the envelope are large (about 90,000 characters
3202
+ * each in the shop), and the next run changes with each surface change.
3203
+ * So they are drawn only when open.
3204
+ */
3205
+ renderShowButton(key) {
3206
+ const open = this.expanded.has(key);
3207
+ return lit.html`<button
3208
+ type="button"
3209
+ class="button"
3210
+ aria-expanded=${open}
3211
+ @click=${() => this.toggle(key)}
3212
+ >
3213
+ ${open ? "Hide" : "Show"}
3214
+ </button>`;
3215
+ }
3216
+ renderPrompt(snapshot) {
3217
+ var _run$agentId;
3218
+ const showing = this.run === "last" && snapshot.lastRun ? "last" : "next";
3219
+ const run = showing === "last" && snapshot.lastRun ? snapshot.lastRun : snapshot.nextRun;
3220
+ const isLast = showing === "last";
3221
+ const envelope = json(run.envelope);
3222
+ return lit.html`
3223
+ <div class="segmented" role="radiogroup">
3224
+ ${["last", "next"].map((option) => lit.html`<button
3225
+ type="button"
3226
+ role="radio"
3227
+ aria-checked=${showing === option}
3228
+ class="tab ${showing === option ? "active" : ""}"
3229
+ ?disabled=${option === "last" && !snapshot.lastRun}
3230
+ @click=${() => {
3231
+ this.run = option;
3232
+ this.requestUpdate();
3233
+ }}
3234
+ >
3235
+ ${option === "last" ? "Last run" : "Next run"}
3236
+ </button>`)}
3237
+ </div>
3238
+ <p class="muted small">
3239
+ ${isLast ? lit.html`What the last run of
3240
+ <code>${(_run$agentId = run.agentId) !== null && _run$agentId !== void 0 ? _run$agentId : "the agent"}</code> sent${run.startedAt ? `, at ${new Date(run.startedAt).toLocaleTimeString()}` : ""}.` : lit.html`
3241
+ What the next run will send, from the page as it is now.
3242
+ `}
3243
+ Your own system prompt and tools are not shown.
3244
+ </p>
3245
+ ${run.prompt.map((section, index) => {
3246
+ const key = `prompt:${index}`;
3247
+ return lit.html`<section>
3248
+ <div class="section-head">
3249
+ <h3>${section.title}</h3>
3250
+ <span class="muted small">${formatTokens(section.text)}</span>
3251
+ ${this.renderShowButton(key)}
3252
+ <button
3253
+ type="button"
3254
+ class="button"
3255
+ @click=${() => void this.copy(key, section.text)}
3256
+ >
3257
+ ${this.copied === key ? "Copied" : "Copy"}
3258
+ </button>
3259
+ </div>
3260
+ <p class="muted small">${PROMPT_SOURCE_NOTES[section.source]}</p>
3261
+ ${this.expanded.has(key) ? lit.html`<pre class="prompt">${section.text || "(empty)"}</pre>` : lit.nothing}
3262
+ </section>`;
3263
+ })}
3264
+ <section>
3265
+ <div class="section-head">
3266
+ <h3>Envelope</h3>
3267
+ <span class="muted small">${formatTokens(envelope)}</span>
3268
+ ${this.renderShowButton("envelope")}
3269
+ <button
3270
+ type="button"
3271
+ class="button"
3272
+ @click=${() => void this.copy("envelope", envelope)}
3273
+ >
3274
+ ${this.copied === "envelope" ? "Copied" : "Copy"}
3275
+ </button>
3276
+ </div>
3277
+ <p class="muted small">
3278
+ The run sends this as <code>forwardedProps.copilotkit.ui</code>.
3279
+ </p>
3280
+ ${this.expanded.has("envelope") ? renderHighlightedJsonBlock(run.envelope) : lit.nothing}
3281
+ </section>
3282
+ `;
3283
+ }
3284
+ };
3285
+ CpkGenerativeUIView.properties = { source: { attribute: false } };
3286
+ CpkGenerativeUIView.styles = lit.css`
3287
+ :host {
3288
+ --gui-ink: #202127;
3289
+ --gui-muted: #64656f;
3290
+ --gui-line: #dcdce4;
3291
+ --gui-soft: #f7f7fa;
3292
+ --gui-canvas: #fff;
3293
+ --gui-accent: #7567ff;
3294
+ --gui-accent-soft: #f0edff;
3295
+ --gui-green: #168b69;
3296
+ --gui-green-soft: #eaf6f1;
3297
+ --gui-amber: #8a5a00;
3298
+ --gui-amber-soft: #fff6e0;
3299
+ --gui-danger: #a12f2f;
3300
+ --gui-danger-soft: #fff4f4;
3301
+ --cpk-json-key: #3d408f;
3302
+ --cpk-json-str: #0b6b4c;
3303
+ --cpk-json-num: #8a5900;
3304
+ --cpk-json-bool: #c0333a;
3305
+ --cpk-json-nil: #57575b;
3306
+ display: block;
3307
+ height: 100%;
3308
+ overflow: auto;
3309
+ color: var(--gui-ink);
3310
+ background: var(--gui-canvas);
3311
+ font-family: Inter, ui-sans-serif, system-ui, sans-serif;
3312
+ font-size: 12px;
3313
+ }
3314
+ :host([data-color-scheme="dark"]) {
3315
+ color-scheme: dark;
3316
+ --gui-ink: #f3f4f8;
3317
+ --gui-muted: #b0b3be;
3318
+ --gui-line: #3a3e4b;
3319
+ --gui-soft: #20232d;
3320
+ --gui-canvas: #15171e;
3321
+ --gui-accent: #a296ff;
3322
+ --gui-accent-soft: #2a2940;
3323
+ --gui-green: #4dc69d;
3324
+ --gui-green-soft: #172923;
3325
+ --gui-amber: #f2c46d;
3326
+ --gui-amber-soft: #2f2716;
3327
+ --gui-danger: #ffabab;
3328
+ --gui-danger-soft: #321f25;
3329
+ --cpk-json-key: #bec2ff;
3330
+ --cpk-json-str: #85ecce;
3331
+ --cpk-json-num: #ffac4d;
3332
+ --cpk-json-bool: #fa5f67;
3333
+ --cpk-json-nil: #afafb7;
3334
+ }
3335
+ .header {
3336
+ position: sticky;
3337
+ top: 0;
3338
+ z-index: 1;
3339
+ padding: 12px 16px 0;
3340
+ background: var(--gui-canvas);
3341
+ border-bottom: 1px solid var(--gui-line);
3342
+ }
3343
+ .title-row,
3344
+ .row-title,
3345
+ .section-head {
3346
+ display: flex;
3347
+ flex-wrap: wrap;
3348
+ align-items: center;
3349
+ gap: 6px;
3350
+ }
3351
+ .title-row,
3352
+ .row-title {
3353
+ align-items: baseline;
3354
+ }
3355
+ .section-head h3 {
3356
+ margin-right: auto;
3357
+ }
3358
+ h2 {
3359
+ margin: 0;
3360
+ font-size: 13px;
3361
+ font-weight: 600;
3362
+ }
3363
+ h3 {
3364
+ margin: 0 0 4px;
3365
+ font-size: 12px;
3366
+ font-weight: 600;
3367
+ }
3368
+ h4 {
3369
+ margin: 12px 0 4px;
3370
+ font-size: 11px;
3371
+ font-weight: 600;
3372
+ color: var(--gui-muted);
3373
+ }
3374
+ p {
3375
+ margin: 2px 0 6px;
3376
+ }
3377
+ code {
3378
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
3379
+ font-size: 11px;
3380
+ }
3381
+ .body {
3382
+ padding: 12px 16px 24px;
3383
+ }
3384
+ section {
3385
+ margin-bottom: 20px;
3386
+ }
3387
+ .muted {
3388
+ color: var(--gui-muted);
3389
+ }
3390
+ .small {
3391
+ font-size: 11px;
3392
+ }
3393
+ .strong {
3394
+ font-weight: 600;
3395
+ color: var(--gui-ink);
3396
+ }
3397
+ .warn {
3398
+ color: var(--gui-amber);
3399
+ }
3400
+ .danger {
3401
+ color: var(--gui-danger);
3402
+ }
3403
+ .tabs,
3404
+ .segmented {
3405
+ display: flex;
3406
+ gap: 4px;
3407
+ margin-top: 8px;
3408
+ }
3409
+ .segmented {
3410
+ margin: 0 0 8px;
3411
+ }
3412
+ .tab {
3413
+ border: 0;
3414
+ border-bottom: 2px solid transparent;
3415
+ background: none;
3416
+ color: var(--gui-muted);
3417
+ font: inherit;
3418
+ font-weight: 500;
3419
+ padding: 6px 8px;
3420
+ cursor: pointer;
3421
+ }
3422
+ .segmented .tab {
3423
+ border: 1px solid var(--gui-line);
3424
+ border-radius: 6px;
3425
+ }
3426
+ .tab.active {
3427
+ color: var(--gui-ink);
3428
+ border-bottom-color: var(--gui-accent);
3429
+ }
3430
+ .segmented .tab.active {
3431
+ border-color: var(--gui-accent);
3432
+ background: var(--gui-accent-soft);
3433
+ }
3434
+ .tab:disabled {
3435
+ opacity: 0.5;
3436
+ cursor: default;
3437
+ }
3438
+ .chip {
3439
+ display: inline-block;
3440
+ border: 1px solid var(--gui-line);
3441
+ border-radius: 999px;
3442
+ padding: 0 6px;
3443
+ font-size: 10px;
3444
+ line-height: 16px;
3445
+ color: var(--gui-muted);
3446
+ background: var(--gui-soft);
3447
+ }
3448
+ .chip.event {
3449
+ color: var(--gui-accent);
3450
+ background: var(--gui-accent-soft);
3451
+ }
3452
+ .status-ready {
3453
+ color: var(--gui-green);
3454
+ background: var(--gui-green-soft);
3455
+ }
3456
+ .status-streaming {
3457
+ color: var(--gui-accent);
3458
+ background: var(--gui-accent-soft);
3459
+ }
3460
+ .status-error {
3461
+ color: var(--gui-danger);
3462
+ background: var(--gui-danger-soft);
3463
+ }
3464
+ .row {
3465
+ display: flex;
3466
+ align-items: flex-start;
3467
+ gap: 8px;
3468
+ padding: 8px 0;
3469
+ border-bottom: 1px solid var(--gui-line);
3470
+ }
3471
+ .row-main {
3472
+ flex: 1;
3473
+ min-width: 0;
3474
+ }
3475
+ .card {
3476
+ border: 1px solid var(--gui-line);
3477
+ border-radius: 8px;
3478
+ margin-bottom: 6px;
3479
+ overflow: hidden;
3480
+ }
3481
+ .card-head {
3482
+ display: flex;
3483
+ align-items: center;
3484
+ gap: 8px;
3485
+ padding-right: 8px;
3486
+ }
3487
+ .cpk-json-block {
3488
+ margin: 4px 0 0;
3489
+ max-height: 320px;
3490
+ overflow: auto;
3491
+ border: 1px solid var(--gui-line);
3492
+ border-radius: 6px;
3493
+ padding: 8px 10px;
3494
+ background: var(--gui-soft);
3495
+ color: var(--gui-ink);
3496
+ font-family: "Spline Sans Mono", ui-monospace, monospace;
3497
+ font-size: 11px;
3498
+ line-height: 1.6;
3499
+ white-space: pre-wrap;
3500
+ overflow-wrap: anywhere;
3501
+ }
3502
+ .cpk-json-token--key {
3503
+ color: var(--cpk-json-key);
3504
+ }
3505
+ .cpk-json-token--str {
3506
+ color: var(--cpk-json-str);
3507
+ }
3508
+ .cpk-json-token--num {
3509
+ color: var(--cpk-json-num);
3510
+ }
3511
+ .cpk-json-token--bool {
3512
+ color: var(--cpk-json-bool);
3513
+ }
3514
+ .cpk-json-token--nil {
3515
+ color: var(--cpk-json-nil);
3516
+ }
3517
+ .card-toggle {
3518
+ display: flex;
3519
+ flex: 1;
3520
+ box-sizing: border-box;
3521
+ width: 100%;
3522
+ flex-direction: column;
3523
+ align-items: flex-start;
3524
+ gap: 2px;
3525
+ min-width: 0;
3526
+ border: 0;
3527
+ background: none;
3528
+ color: inherit;
3529
+ font: inherit;
3530
+ text-align: left;
3531
+ padding: 8px 10px;
3532
+ cursor: pointer;
3533
+ }
3534
+ .card-toggle:hover {
3535
+ background: var(--gui-soft);
3536
+ }
3537
+ .card-body {
3538
+ padding: 8px 10px;
3539
+ border-top: 1px solid var(--gui-line);
3540
+ }
3541
+ .card > .card-body:first-child {
3542
+ border-top: 0;
3543
+ }
3544
+ .button {
3545
+ flex-shrink: 0;
3546
+ border: 1px solid var(--gui-line);
3547
+ border-radius: 6px;
3548
+ background: var(--gui-canvas);
3549
+ color: var(--gui-ink);
3550
+ font: inherit;
3551
+ font-size: 11px;
3552
+ padding: 2px 8px;
3553
+ cursor: pointer;
3554
+ }
3555
+ .button:hover {
3556
+ border-color: var(--gui-accent);
3557
+ }
3558
+ .section-head {
3559
+ display: flex;
3560
+ align-items: center;
3561
+ justify-content: space-between;
3562
+ gap: 8px;
3563
+ }
3564
+ .filter {
3565
+ width: 160px;
3566
+ box-sizing: border-box;
3567
+ border: 1px solid var(--gui-line);
3568
+ border-radius: 6px;
3569
+ background: var(--gui-canvas);
3570
+ color: var(--gui-ink);
3571
+ font: inherit;
3572
+ font-size: 11px;
3573
+ padding: 3px 6px;
3574
+ }
3575
+ .catalog-toggle::before {
3576
+ content: "▸";
3577
+ display: inline-block;
3578
+ width: 10px;
3579
+ color: var(--gui-muted);
3580
+ transition: transform 0.1s;
3581
+ }
3582
+ .catalog-toggle[aria-expanded="true"]::before {
3583
+ transform: rotate(90deg);
3584
+ }
3585
+ pre {
3586
+ margin: 4px 0 0;
3587
+ max-height: 320px;
3588
+ overflow: auto;
3589
+ border-radius: 6px;
3590
+ background: var(--gui-soft);
3591
+ padding: 8px;
3592
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
3593
+ font-size: 11px;
3594
+ line-height: 1.45;
3595
+ white-space: pre-wrap;
3596
+ word-break: break-word;
3597
+ }
3598
+ pre.prompt {
3599
+ max-height: 480px;
3600
+ }
3601
+ .list,
3602
+ .ops {
3603
+ margin: 0;
3604
+ padding-left: 18px;
3605
+ }
3606
+ .list li {
3607
+ margin-bottom: 4px;
3608
+ }
3609
+ .ops {
3610
+ list-style: none;
3611
+ padding: 0;
3612
+ }
3613
+ .tree {
3614
+ list-style: none;
3615
+ margin: 0;
3616
+ padding-left: 14px;
3617
+ border-left: 1px solid var(--gui-line);
3618
+ }
3619
+ .tree.root {
3620
+ padding-left: 0;
3621
+ border-left: 0;
3622
+ }
3623
+ .op-toggle {
3624
+ display: flex;
3625
+ align-items: baseline;
3626
+ gap: 6px;
3627
+ border: 0;
3628
+ background: none;
3629
+ color: inherit;
3630
+ font: inherit;
3631
+ padding: 2px 0;
3632
+ cursor: pointer;
3633
+ }
3634
+ .empty {
3635
+ padding: 48px 24px;
3636
+ text-align: center;
3637
+ color: var(--gui-muted);
2379
3638
  }
2380
3639
  `;
2381
- if (!customElements.get("cpk-learning-view")) customElements.define("cpk-learning-view", CpkLearningView);
3640
+ if (!customElements.get("cpk-generative-ui-view")) customElements.define("cpk-generative-ui-view", CpkGenerativeUIView);
2382
3641
 
2383
3642
  //#endregion
2384
3643
  //#region src/lib/context-helpers.ts
@@ -2991,7 +4250,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2991
4250
  "ag-ui-events",
2992
4251
  "frontend-tools",
2993
4252
  "capabilities",
2994
- "agent-context"
4253
+ "agent-context",
4254
+ "generative-ui"
2995
4255
  ]
2996
4256
  };
2997
4257
  const INSPECTOR_MENU_KEYS = [
@@ -3064,7 +4324,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3064
4324
 
3065
4325
  //#endregion
3066
4326
  //#region package.json
3067
- var version = "1.79.2-canary.1792172552";
4327
+ var version = "1.81.0";
3068
4328
 
3069
4329
  //#endregion
3070
4330
  //#region src/lib/telemetry.ts
@@ -3632,47 +4892,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3632
4892
  return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);
3633
4893
  }
3634
4894
 
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
-
3672
4895
  //#endregion
3673
4896
  //#region src/index.ts
3674
- var _globalThis$HTMLEleme;
3675
- /**
4897
+ /**
3676
4898
  * Resolve the attached core's request headers at send time. A core released
3677
4899
  * before `resolveHeaders()` existed has only the static `headers` map, so an
3678
4900
  * inspector attached to it falls back to a copy of that map.
@@ -4449,142 +5671,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4449
5671
  function getMetadataActionPlacement(placement) {
4450
5672
  return placement === "threads-footer" ? "threads_footer" : "threads_locked";
4451
5673
  }
4452
- function escapeHtml(s) {
4453
- return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
4454
- }
4455
- const highlightedJsonCache = /* @__PURE__ */ new WeakMap();
4456
- function highlightedJson(obj) {
4457
- if (typeof obj === "object" && obj !== null) {
4458
- const cached = highlightedJsonCache.get(obj);
4459
- if (cached !== void 0) return cached;
4460
- }
4461
- const json = JSON.stringify(obj, null, 2);
4462
- if (!json) return "";
4463
- const parts = [];
4464
- let lastIndex = 0;
4465
- const re = /("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*"(?:\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g;
4466
- let match;
4467
- while ((match = re.exec(json)) !== null) {
4468
- parts.push(escapeHtml(json.slice(lastIndex, match.index)));
4469
- const m = match[0];
4470
- let token = "num";
4471
- if (m.startsWith("\"")) token = m.trimEnd().endsWith(":") ? "key" : "str";
4472
- else if (m === "true" || m === "false") token = "bool";
4473
- else if (m === "null") token = "nil";
4474
- parts.push(`<span class="cpk-json-token cpk-json-token--${token}">${escapeHtml(m)}</span>`);
4475
- lastIndex = match.index + m.length;
4476
- }
4477
- parts.push(escapeHtml(json.slice(lastIndex)));
4478
- const result = parts.join("");
4479
- if (typeof obj === "object" && obj !== null) highlightedJsonCache.set(obj, result);
4480
- return result;
4481
- }
4482
- function coerceJsonValue(value) {
4483
- if (typeof value !== "string") return value;
4484
- const trimmed = value.trim();
4485
- if (trimmed.length === 0) return value;
4486
- if (!(trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]"))) return value;
4487
- try {
4488
- return JSON.parse(trimmed);
4489
- } catch (_unused) {
4490
- return value;
4491
- }
4492
- }
4493
- let inspectorJsonRenderer = null;
4494
- let inspectorJsonSlotCount = 0;
4495
- const JSON_BLOCK_TAG = "cpk-json-block";
4496
- /**
4497
- * Replaces the inspector's built-in JSON blocks (tool arguments and results,
4498
- * state, events, and context) with a host renderer. Pass `null` to restore the
4499
- * built-in blocks. Set it before the inspector renders: a block that is
4500
- * already on screen changes at the inspector's next render.
4501
- *
4502
- * @example
4503
- * ```ts
4504
- * setInspectorJsonRenderer((container, value) => {
4505
- * const root = createRoot(container);
4506
- * root.render(<JsonView value={value} />);
4507
- * return () => root.unmount();
4508
- * });
4509
- * ```
4510
- */
4511
- function setInspectorJsonRenderer(renderer) {
4512
- inspectorJsonRenderer = renderer;
4513
- }
4514
- var _value = /* @__PURE__ */ new WeakMap();
4515
- var _hasValue = /* @__PURE__ */ new WeakMap();
4516
- var _cleanup = /* @__PURE__ */ new WeakMap();
4517
- var _container = /* @__PURE__ */ new WeakMap();
4518
- var _CpkJsonBlock_brand = /* @__PURE__ */ new WeakSet();
4519
- /**
4520
- * Hosts one value drawn by the host renderer. Inside a shadow root, the
4521
- * container lives in the shadow host's light DOM and shows here through a
4522
- * named slot, so the host page's own styles apply to what the renderer draws.
4523
- */
4524
- var CpkJsonBlock = class extends ((_globalThis$HTMLEleme = globalThis.HTMLElement) !== null && _globalThis$HTMLEleme !== void 0 ? _globalThis$HTMLEleme : class {}) {
4525
- constructor(..._args) {
4526
- super(..._args);
4527
- _classPrivateMethodInitSpec(this, _CpkJsonBlock_brand);
4528
- _classPrivateFieldInitSpec(this, _value, void 0);
4529
- _classPrivateFieldInitSpec(this, _hasValue, false);
4530
- _classPrivateFieldInitSpec(this, _cleanup, void 0);
4531
- _classPrivateFieldInitSpec(this, _container, void 0);
4532
- }
4533
- get value() {
4534
- return _classPrivateFieldGet2(_value, this);
4535
- }
4536
- set value(next) {
4537
- if (_classPrivateFieldGet2(_hasValue, this) && Object.is(next, _classPrivateFieldGet2(_value, this))) return;
4538
- _classPrivateFieldSet2(_value, this, next);
4539
- _classPrivateFieldSet2(_hasValue, this, true);
4540
- if (this.isConnected) _assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
4541
- }
4542
- connectedCallback() {
4543
- this.style.display = "block";
4544
- _assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
4545
- }
4546
- disconnectedCallback() {
4547
- _assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
4548
- }
4549
- };
4550
- function _render() {
4551
- _assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
4552
- const renderer = inspectorJsonRenderer;
4553
- if (!renderer) return;
4554
- const root = this.getRootNode();
4555
- const container = this.ownerDocument.createElement("div");
4556
- if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in root) {
4557
- inspectorJsonSlotCount += 1;
4558
- const name = `cpk-json-${inspectorJsonSlotCount}`;
4559
- const slot = this.ownerDocument.createElement("slot");
4560
- slot.name = name;
4561
- this.replaceChildren(slot);
4562
- container.slot = name;
4563
- root.host.append(container);
4564
- } else this.replaceChildren(container);
4565
- _classPrivateFieldSet2(_container, this, container);
4566
- const cleanup = renderer(container, _classPrivateFieldGet2(_value, this));
4567
- _classPrivateFieldSet2(_cleanup, this, typeof cleanup === "function" ? cleanup : void 0);
4568
- }
4569
- function _teardown() {
4570
- var _classPrivateFieldGet2$1;
4571
- const cleanup = _classPrivateFieldGet2(_cleanup, this);
4572
- _classPrivateFieldSet2(_cleanup, this, void 0);
4573
- cleanup === null || cleanup === void 0 || cleanup();
4574
- (_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_container, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.remove();
4575
- _classPrivateFieldSet2(_container, this, void 0);
4576
- this.replaceChildren();
4577
- }
4578
- function renderHighlightedJsonBlock(value, options = {}) {
4579
- if (inspectorJsonRenderer) return lit.html`<cpk-json-block
4580
- .value=${value}
4581
- style=${options.maxHeight ? `overflow:auto;max-height:${options.maxHeight}` : lit.nothing}
4582
- ></cpk-json-block>`;
4583
- const parsed = coerceJsonValue(value);
4584
- return lit.html`<pre class="cpk-json-block" style=${(options.maxHeight ? `max-height:${options.maxHeight}` : void 0) || lit.nothing}>
4585
- ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
4586
- >`;
4587
- }
4588
5674
  function humanizeEventType(type) {
4589
5675
  const words = type.trim().split(/[_\s]+/).filter(Boolean).map((word) => word.toLowerCase());
4590
5676
  if (words.length === 0) return "Event";
@@ -4641,8 +5727,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
4641
5727
  }
4642
5728
  };
4643
5729
  var CpkThreadList = class extends PortableLitElement {
4644
- constructor(..._args2) {
4645
- super(..._args2);
5730
+ constructor(..._args) {
5731
+ super(..._args);
4646
5732
  this.threads = [];
4647
5733
  this.selectedThreadId = null;
4648
5734
  this.inAppThreadId = null;
@@ -4996,8 +6082,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
4996
6082
  }
4997
6083
  `;
4998
6084
  var CpkThreadInspector = class CpkThreadInspector extends PortableLitElement {
4999
- constructor(..._args3) {
5000
- super(..._args3);
6085
+ constructor(..._args2) {
6086
+ super(..._args2);
5001
6087
  this.showThreadTitle = true;
5002
6088
  this.threadId = null;
5003
6089
  this.provider = null;
@@ -5847,7 +6933,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
5847
6933
  const item = ensureTool(event);
5848
6934
  if (item.rawArgs) try {
5849
6935
  JSON.parse(item.rawArgs);
5850
- } catch (_unused2) {
6936
+ } catch (_unused) {
5851
6937
  appendWarning(event, "Could not decode tool call arguments", item.rawArgs);
5852
6938
  }
5853
6939
  continue;
@@ -5863,7 +6949,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
5863
6949
  item.body = item.body ? `${item.body}\nResult: ${result}` : `Result: ${result}`;
5864
6950
  try {
5865
6951
  JSON.parse(result);
5866
- } catch (_unused3) {
6952
+ } catch (_unused2) {
5867
6953
  appendWarning(event, "Could not decode tool result", result);
5868
6954
  }
5869
6955
  }
@@ -8268,8 +9354,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
8268
9354
  return Math.max(6, Math.min(100, Math.round(relevance * 100)));
8269
9355
  }
8270
9356
  var CpkMemoryList = class extends PortableLitElement {
8271
- constructor(..._args4) {
8272
- super(..._args4);
9357
+ constructor(..._args3) {
9358
+ super(..._args3);
8273
9359
  this.memories = [];
8274
9360
  this.recallResults = null;
8275
9361
  this.recallLoading = false;
@@ -8881,8 +9967,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
8881
9967
  if (!registry.get(tag)) registry.define(tag, ctor);
8882
9968
  }
8883
9969
  var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
8884
- constructor(..._args5) {
8885
- super(..._args5);
9970
+ constructor(..._args4) {
9971
+ super(..._args4);
8886
9972
  this._core = null;
8887
9973
  this.resolveCoreHeaders = () => this._core ? resolveAttachedCoreHeaders(this._core) : {};
8888
9974
  this.coreSubscriber = null;
@@ -8893,6 +9979,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
8893
9979
  this._memoriesAvailable = true;
8894
9980
  this._memoriesRealtimeStatus = "connecting";
8895
9981
  this._memoryUnsub = null;
9982
+ this._generativeUIUnsub = null;
8896
9983
  this._memorySubscribed = false;
8897
9984
  this._memoryStoreUnsupported = false;
8898
9985
  this.learningSnapshot = null;
@@ -9229,14 +10316,9 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9229
10316
  }
9230
10317
  } catch (error) {
9231
10318
  if (generation !== this.learningRequestGeneration || controller.signal.aborted) return;
9232
- if (error instanceof InspectorLearningUnsupportedError) {
9233
- loadOutcome = "unsupported";
9234
- this.learningSupported = false;
9235
- this.learningSnapshot = null;
9236
- } else {
9237
- this.learningError = error instanceof Error ? error.message : "Learning data is unavailable.";
9238
- this.learningPollFailureCount += 1;
9239
- }
10319
+ if (error instanceof InspectorLearningUnsupportedError) loadOutcome = "unsupported";
10320
+ this.learningError = "Learning status unavailable";
10321
+ this.learningPollFailureCount += 1;
9240
10322
  } finally {
9241
10323
  if (generation === this.learningRequestGeneration) {
9242
10324
  this.learningLoading = false;
@@ -9266,7 +10348,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9266
10348
  try {
9267
10349
  await clipboard.writeText(createFeatureOnboardingPrompt(service.id, onboardingRunId));
9268
10350
  return true;
9269
- } catch (_unused4) {
10351
+ } catch (_unused3) {
9270
10352
  return false;
9271
10353
  }
9272
10354
  };
@@ -9445,6 +10527,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9445
10527
  this.queueHudTelemetry(() => trackHudHideClicked({ trigger }));
9446
10528
  this.dismissInspectorFor("day");
9447
10529
  };
10530
+ this.retryLearningStatus = (event) => {
10531
+ event.stopPropagation();
10532
+ this.refreshLearningSnapshot().catch(() => {
10533
+ this.learningError = "Learning status unavailable";
10534
+ this.requestUpdate();
10535
+ });
10536
+ };
9448
10537
  this.handleSidebarToggle = () => {
9449
10538
  this.sidebarRailTooltip = null;
9450
10539
  this.sidebarCollapsed = !this.sidebarCollapsed;
@@ -9514,7 +10603,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9514
10603
  if (clipboard === null || clipboard === void 0 ? void 0 : clipboard.writeText) try {
9515
10604
  await clipboard.writeText(createOnboardingPrompt(runId));
9516
10605
  outcome = "copied";
9517
- } catch (_unused5) {
10606
+ } catch (_unused4) {
9518
10607
  outcome = "failed";
9519
10608
  }
9520
10609
  if (!this.isConnected) return;
@@ -9904,7 +10993,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9904
10993
  ...this.getMetadataTelemetryContext(),
9905
10994
  action_placement: getMetadataActionPlacement(placement)
9906
10995
  });
9907
- } catch (_unused6) {}
10996
+ } catch (_unused5) {}
9908
10997
  };
9909
10998
  this.handleTalkToEngineerClick = () => {
9910
10999
  var _this$core8;
@@ -9982,7 +11071,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
9982
11071
  this.invalidateThreadsExampleOverviewVideoPlay();
9983
11072
  try {
9984
11073
  video.pause();
9985
- } catch (_unused7) {}
11074
+ } catch (_unused6) {}
9986
11075
  this.threadsExampleOverviewVideoState = "ready";
9987
11076
  this.requestUpdate();
9988
11077
  return;
@@ -10129,7 +11218,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10129
11218
  if (this._core) this.attachToCore(this._core);
10130
11219
  }
10131
11220
  get menuItems() {
10132
- var _this$_core$tools$len, _this$_core, _this$_core$catalogCo, _this$_core2;
11221
+ var _this$_core$tools$len, _this$_core, _this$_core$catalogCo, _this$_core2, _this$_core3;
10133
11222
  const hasFrontendTools = ((_this$_core$tools$len = (_this$_core = this._core) === null || _this$_core === void 0 || (_this$_core = _this$_core.tools) === null || _this$_core === void 0 ? void 0 : _this$_core.length) !== null && _this$_core$tools$len !== void 0 ? _this$_core$tools$len : 0) > 0;
10134
11223
  const hasCapabilities = ((_this$_core$catalogCo = (_this$_core2 = this._core) === null || _this$_core2 === void 0 || (_this$_core2 = _this$_core2.catalogComponents) === null || _this$_core2 === void 0 ? void 0 : _this$_core2.length) !== null && _this$_core$catalogCo !== void 0 ? _this$_core$catalogCo : 0) > 0;
10135
11224
  return [
@@ -10178,6 +11267,11 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10178
11267
  label: "Context",
10179
11268
  icon: "FileText"
10180
11269
  },
11270
+ ...((_this$_core3 = this._core) === null || _this$_core3 === void 0 ? void 0 : _this$_core3.ɵgenerativeUIDebugSource) ? [{
11271
+ key: "generative-ui",
11272
+ label: "Generative UI",
11273
+ icon: "LayoutTemplate"
11274
+ }] : [],
10181
11275
  {
10182
11276
  key: "threads",
10183
11277
  label: "Rich Threads",
@@ -10232,8 +11326,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10232
11326
  return ((_this$_core$threadEnd = this._core.threadEndpoints) === null || _this$_core$threadEnd === void 0 ? void 0 : _this$_core$threadEnd.list) === false ? "unavailable" : "available";
10233
11327
  }
10234
11328
  areThreadEndpointsAvailable() {
10235
- var _this$_core3;
10236
- const endpoints = (_this$_core3 = this._core) === null || _this$_core3 === void 0 ? void 0 : _this$_core3.threadEndpoints;
11329
+ var _this$_core4;
11330
+ const endpoints = (_this$_core4 = this._core) === null || _this$_core4 === void 0 ? void 0 : _this$_core4.threadEndpoints;
10237
11331
  return endpoints !== null && typeof endpoints === "object" && endpoints.list !== false;
10238
11332
  }
10239
11333
  synchronizeThreadCapability() {
@@ -10545,7 +11639,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10545
11639
  coreSupportsInspectorMetadata(core) {
10546
11640
  try {
10547
11641
  return "inspectorMetadata" in core;
10548
- } catch (_unused8) {
11642
+ } catch (_unused7) {
10549
11643
  return false;
10550
11644
  }
10551
11645
  }
@@ -10553,7 +11647,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10553
11647
  if (!this.coreSupportsInspectorMetadata(core)) return;
10554
11648
  try {
10555
11649
  return core.inspectorMetadata;
10556
- } catch (_unused9) {
11650
+ } catch (_unused8) {
10557
11651
  return;
10558
11652
  }
10559
11653
  }
@@ -10561,16 +11655,16 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10561
11655
  this.inspectorMetadataValue = value;
10562
11656
  let runtimeLicense;
10563
11657
  try {
10564
- var _this$_core4;
10565
- runtimeLicense = (_this$_core4 = this._core) === null || _this$_core4 === void 0 ? void 0 : _this$_core4.licenseStatus;
10566
- } catch (_unused10) {
11658
+ var _this$_core5;
11659
+ runtimeLicense = (_this$_core5 = this._core) === null || _this$_core5 === void 0 ? void 0 : _this$_core5.licenseStatus;
11660
+ } catch (_unused9) {
10567
11661
  runtimeLicense = void 0;
10568
11662
  }
10569
11663
  this.inspectorMetadataProjection = projectInspectorMetadata(value, runtimeLicense);
10570
11664
  this.refreshNotifications();
10571
11665
  }
10572
11666
  attachToCore(core) {
10573
- var _this$inspectorMetada2;
11667
+ var _this$inspectorMetada2, _core$ɵsubscribeToGe, _core$ɵsubscribeToGe2;
10574
11668
  this.runtimeStatus = core.runtimeConnectionStatus;
10575
11669
  this.coreProperties = core.properties;
10576
11670
  this.lastCoreError = null;
@@ -10671,6 +11765,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10671
11765
  }
10672
11766
  };
10673
11767
  this.coreUnsubscribe = core.subscribe(this.coreSubscriber).unsubscribe;
11768
+ this._generativeUIUnsub = (_core$ɵsubscribeToGe = (_core$ɵsubscribeToGe2 = core.ɵsubscribeToGenerativeUIDebugSource) === null || _core$ɵsubscribeToGe2 === void 0 ? void 0 : _core$ɵsubscribeToGe2.call(core, () => {
11769
+ this.reconcileSelectedMenuVisibility();
11770
+ this.requestUpdate();
11771
+ })) !== null && _core$ɵsubscribeToGe !== void 0 ? _core$ɵsubscribeToGe : null;
10674
11772
  this.processAgentsChanged(core.agents);
10675
11773
  if (core.runtimeConnectionStatus === "connected") {
10676
11774
  if (!core.telemetryDisabled) {
@@ -10745,10 +11843,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10745
11843
  * reachable from the Intelligence-gated memory view, so it inherits the gate.
10746
11844
  */
10747
11845
  runRecall(query) {
10748
- var _this$_core5, _this$_core5$getMemor;
11846
+ var _this$_core6, _this$_core6$getMemor;
10749
11847
  const trimmed = query.trim();
10750
11848
  if (trimmed.length === 0) return;
10751
- const store = (_this$_core5 = this._core) === null || _this$_core5 === void 0 || (_this$_core5$getMemor = _this$_core5.getMemoryStore) === null || _this$_core5$getMemor === void 0 ? void 0 : _this$_core5$getMemor.call(_this$_core5);
11849
+ const store = (_this$_core6 = this._core) === null || _this$_core6 === void 0 || (_this$_core6$getMemor = _this$_core6.getMemoryStore) === null || _this$_core6$getMemor === void 0 ? void 0 : _this$_core6$getMemor.call(_this$_core6);
10752
11850
  if (!store || typeof store.recall !== "function") {
10753
11851
  this._recallResults = [];
10754
11852
  this._recallError = "Recall is not supported by this SDK version.";
@@ -10856,7 +11954,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10856
11954
  }
10857
11955
  }
10858
11956
  detachFromCore() {
10859
- var _this$_memoryUnsub;
11957
+ var _this$_memoryUnsub, _this$_generativeUIUn;
10860
11958
  this.threadCapabilityGeneration += 1;
10861
11959
  this.threadCapabilityEnabled = null;
10862
11960
  if (this.selectedThreadId !== this.selectedLocalExampleThreadId) {
@@ -10870,6 +11968,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
10870
11968
  }
10871
11969
  (_this$_memoryUnsub = this._memoryUnsub) === null || _this$_memoryUnsub === void 0 || _this$_memoryUnsub.call(this);
10872
11970
  this._memoryUnsub = null;
11971
+ (_this$_generativeUIUn = this._generativeUIUnsub) === null || _this$_generativeUIUn === void 0 || _this$_generativeUIUn.call(this);
11972
+ this._generativeUIUnsub = null;
10873
11973
  this._memories = [];
10874
11974
  this._memoriesLoading = false;
10875
11975
  this._memoriesError = null;
@@ -11337,12 +12437,12 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
11337
12437
  if (typeof args === "string") try {
11338
12438
  const parsed = JSON.parse(args);
11339
12439
  return JSON.stringify(parsed, null, 2);
11340
- } catch (_unused11) {
12440
+ } catch (_unused10) {
11341
12441
  return args;
11342
12442
  }
11343
12443
  if (typeof args === "object") try {
11344
12444
  return JSON.stringify(args, null, 2);
11345
- } catch (_unused12) {
12445
+ } catch (_unused11) {
11346
12446
  return String(args);
11347
12447
  }
11348
12448
  return String(args);
@@ -11365,13 +12465,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
11365
12465
  try {
11366
12466
  const parsed = JSON.parse(trimmed);
11367
12467
  return JSON.stringify(parsed, null, 2);
11368
- } catch (_unused13) {
12468
+ } catch (_unused12) {
11369
12469
  return state;
11370
12470
  }
11371
12471
  }
11372
12472
  if (typeof state === "object") try {
11373
12473
  return JSON.stringify(state, null, 2);
11374
- } catch (_unused14) {
12474
+ } catch (_unused13) {
11375
12475
  return String(state);
11376
12476
  }
11377
12477
  return String(state);
@@ -11933,8 +13033,23 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
11933
13033
  const titleCharacters = Array.from(title);
11934
13034
  return titleCharacters.length > HUD_ANNOUNCEMENT_TITLE_LIMIT ? `${titleCharacters.slice(0, HUD_ANNOUNCEMENT_TITLE_LIMIT).join("").trimEnd()}...` : title;
11935
13035
  }
13036
+ /** A failed or pending read must never imply that Learning is disabled. */
13037
+ getLearningStatus() {
13038
+ var _this$learningSnapsho7;
13039
+ if (this.learningError) return "unavailable";
13040
+ if (this.learningSupported && !this.learningSnapshot) return "checking";
13041
+ return ((_this$learningSnapsho7 = this.learningSnapshot) === null || _this$learningSnapsho7 === void 0 ? void 0 : _this$learningSnapsho7.configuration.state) === "configured" ? "configured" : "not_configured";
13042
+ }
11936
13043
  renderHudRow(args) {
11937
13044
  if (args.connected) return lit.nothing;
13045
+ const learningStatus = args.id === "learning" ? this.getLearningStatus() : null;
13046
+ if (learningStatus === "unavailable" || learningStatus === "checking") return lit.html`
13047
+ <li class="cpk-launcher-hud__row" data-cpk-hud-row="learning">
13048
+ <span class="cpk-launcher-hud__label" role="status">${learningStatus === "unavailable" ? "Learning status unavailable" : "Checking Learning status"}</span>
13049
+ <button type="button" class="cpk-launcher-hud__action" aria-label="Retry Learning status"
13050
+ ?disabled=${this.learningLoading || this.learningRefreshing}
13051
+ @click=${this.retryLearningStatus}>Retry</button>
13052
+ </li>`;
11938
13053
  const detailId = `cpk-hud-detail-${args.id}`;
11939
13054
  const { label, description } = this.hudContent[args.id];
11940
13055
  return lit.html`
@@ -12304,14 +13419,14 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12304
13419
  `;
12305
13420
  }
12306
13421
  getHomeModel() {
12307
- var _this$notificationFee2, _this$_core6, _this$_core7, _this$learningSnapsho7, _this$_core8, _this$_core9, _this$_core10, _this$_core11, _this$_core12;
13422
+ var _this$notificationFee2, _this$_core7, _this$_core8, _this$learningSnapsho8, _this$_core9, _this$_core10, _this$_core11, _this$_core12, _this$_core13;
12308
13423
  const lastRuntimeEvent = this.flattenedEvents[0];
12309
13424
  const activeNotice = (_this$notificationFee2 = this.notificationFeed) === null || _this$notificationFee2 === void 0 ? void 0 : _this$notificationFee2.notifications.find((notice) => notice.id === this.notificationState.activeId);
12310
13425
  return buildHomeModel({
12311
- intelligenceConnected: Boolean((_this$_core6 = this._core) === null || _this$_core6 === void 0 ? void 0 : _this$_core6.intelligence),
13426
+ intelligenceConnected: Boolean((_this$_core7 = this._core) === null || _this$_core7 === void 0 ? void 0 : _this$_core7.intelligence),
12312
13427
  threadsAvailable: this.areThreadEndpointsAvailable(),
12313
13428
  metadata: this.inspectorMetadataProjection,
12314
- runtimeUrl: (_this$_core7 = this._core) === null || _this$_core7 === void 0 ? void 0 : _this$_core7.runtimeUrl,
13429
+ runtimeUrl: (_this$_core8 = this._core) === null || _this$_core8 === void 0 ? void 0 : _this$_core8.runtimeUrl,
12315
13430
  runtimeConnectionState: this.getCoreStatusSummary().state,
12316
13431
  lastRuntimeEvent: lastRuntimeEvent ? {
12317
13432
  id: lastRuntimeEvent.id,
@@ -12319,12 +13434,12 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12319
13434
  type: lastRuntimeEvent.type,
12320
13435
  timestamp: lastRuntimeEvent.timestamp
12321
13436
  } : void 0,
12322
- learningOn: this.learningSupported && this.learningError === null && ((_this$learningSnapsho7 = this.learningSnapshot) === null || _this$learningSnapsho7 === void 0 ? void 0 : _this$learningSnapsho7.configuration.state) === "configured",
12323
- a2uiOn: ((_this$_core8 = this._core) === null || _this$_core8 === void 0 ? void 0 : _this$_core8.a2uiEnabled) === true,
12324
- openGenUiOn: ((_this$_core9 = this._core) === null || _this$_core9 === void 0 ? void 0 : _this$_core9.openGenerativeUIEnabled) === true,
12325
- suggestionsOn: ((_this$_core10 = this._core) === null || _this$_core10 === void 0 ? void 0 : _this$_core10.suggestions) === true,
12326
- audioOn: ((_this$_core11 = this._core) === null || _this$_core11 === void 0 ? void 0 : _this$_core11.audioFileTranscriptionEnabled) === true,
12327
- websocketUrl: (_this$_core12 = this._core) === null || _this$_core12 === void 0 || (_this$_core12 = _this$_core12.intelligence) === null || _this$_core12 === void 0 ? void 0 : _this$_core12.wsUrl,
13437
+ learningOn: this.learningSupported && this.learningError === null && ((_this$learningSnapsho8 = this.learningSnapshot) === null || _this$learningSnapsho8 === void 0 ? void 0 : _this$learningSnapsho8.configuration.state) === "configured",
13438
+ a2uiOn: ((_this$_core9 = this._core) === null || _this$_core9 === void 0 ? void 0 : _this$_core9.a2uiEnabled) === true,
13439
+ openGenUiOn: ((_this$_core10 = this._core) === null || _this$_core10 === void 0 ? void 0 : _this$_core10.openGenerativeUIEnabled) === true,
13440
+ suggestionsOn: ((_this$_core11 = this._core) === null || _this$_core11 === void 0 ? void 0 : _this$_core11.suggestions) === true,
13441
+ audioOn: ((_this$_core12 = this._core) === null || _this$_core12 === void 0 ? void 0 : _this$_core12.audioFileTranscriptionEnabled) === true,
13442
+ websocketUrl: (_this$_core13 = this._core) === null || _this$_core13 === void 0 || (_this$_core13 = _this$_core13.intelligence) === null || _this$_core13 === void 0 ? void 0 : _this$_core13.wsUrl,
12328
13443
  announcementPreviewText: activeNotice === null || activeNotice === void 0 ? void 0 : activeNotice.title,
12329
13444
  announcementMarkdown: activeNotice === null || activeNotice === void 0 ? void 0 : activeNotice.body,
12330
13445
  announcementHtml: activeNotice ? this.notificationDocuments.get(activeNotice.id) : void 0,
@@ -12776,18 +13891,27 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12776
13891
  }
12777
13892
  renderHomeFeatures(model) {
12778
13893
  const enabledServices = model.services.filter((service) => service.enabled);
12779
- const disabledServices = model.services.filter((service) => !service.enabled);
13894
+ const learningStatus = this.getLearningStatus();
13895
+ const unavailableServices = model.services.filter((service) => service.id === "memory" && (learningStatus === "unavailable" || learningStatus === "checking"));
13896
+ const disabledServices = model.services.filter((service) => !service.enabled && !unavailableServices.includes(service));
12780
13897
  const renderService = (service) => {
12781
13898
  var _this$homeFeatureProm;
12782
13899
  const copyState = ((_this$homeFeatureProm = this.homeFeaturePromptCopyState) === null || _this$homeFeatureProm === void 0 ? void 0 : _this$homeFeatureProm.serviceId) === service.id ? this.homeFeaturePromptCopyState.state : "idle";
12783
- const stateDescription = `${service.label} is ${service.enabled ? "enabled in your runtime" : "not enabled in your runtime"}`;
13900
+ const learningStatus = service.id === "memory" ? this.getLearningStatus() : null;
13901
+ const learningUnavailable = learningStatus === "unavailable" || learningStatus === "checking";
13902
+ const stateDescription = learningStatus ? {
13903
+ configured: "Learning configured",
13904
+ not_configured: "Learning not configured",
13905
+ unavailable: "Learning status unavailable",
13906
+ checking: "Checking Learning status"
13907
+ }[learningStatus] : `${service.label} is ${service.enabled ? "enabled in your runtime" : "not enabled in your runtime"}`;
12784
13908
  const copyLabel = copyState === "copied" ? "Copied" : copyState === "error" ? "Copy failed" : "Copy prompt";
12785
13909
  const copyTitle = copyLabel;
12786
13910
  return lit.html`
12787
13911
  <div
12788
13912
  class="inspector-home-feature"
12789
13913
  data-inspector-service=${service.id}
12790
- data-state=${service.enabled ? "on" : "off"}
13914
+ data-state=${learningUnavailable ? "unavailable" : service.enabled ? "on" : "off"}
12791
13915
  role="listitem"
12792
13916
  >
12793
13917
  <span
@@ -12806,13 +13930,16 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12806
13930
  rel="noopener noreferrer"
12807
13931
  aria-label="Open ${service.label} documentation in a new tab"
12808
13932
  >
12809
- <span>${service.label}</span>
13933
+ <span>${learningStatus ? stateDescription : service.label}</span>
12810
13934
  <span class="inspector-home-feature-label-icon" aria-hidden="true"
12811
13935
  >${this.renderIcon("ArrowUpRight")}</span
12812
13936
  >
12813
13937
  </a>
12814
13938
  <span class="inspector-home-feature-actions">
12815
- ${service.enabled ? lit.nothing : lit.html`
13939
+ ${learningUnavailable ? lit.html`<button type="button" class="inspector-home-feature-action" aria-label="Retry Learning status"
13940
+ ?disabled=${this.learningLoading || this.learningRefreshing}
13941
+ @click=${this.retryLearningStatus}>Retry</button>` : lit.nothing}
13942
+ ${service.enabled || learningUnavailable ? lit.nothing : lit.html`
12816
13943
  <button
12817
13944
  type="button"
12818
13945
  class="inspector-home-feature-action inspector-system-health-url"
@@ -12856,6 +13983,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
12856
13983
  </p>
12857
13984
  ` : lit.html`
12858
13985
  <div class="inspector-home-feature-groups">
13986
+ ${unavailableServices.length ? lit.html`
13987
+ <section class="inspector-home-feature-group" data-feature-state-group="unavailable" aria-label="Feature status unavailable">
13988
+ <div class="inspector-home-feature-list" role="list">${unavailableServices.map(renderService)}</div>
13989
+ </section>` : lit.nothing}
12859
13990
  <section
12860
13991
  class="inspector-home-feature-group"
12861
13992
  data-feature-state-group="active"
@@ -13269,8 +14400,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
13269
14400
  * would be holding a repeating timer behind a closed panel.
13270
14401
  */
13271
14402
  syncIntelligenceStory() {
13272
- var _this$_core13;
13273
- if (!(this.isOpen && !this.settingsOpen && this.selectedMenu === "home" && !((_this$_core13 = this._core) === null || _this$_core13 === void 0 ? void 0 : _this$_core13.intelligence) && typeof document !== "undefined" && document.visibilityState !== "hidden")) {
14403
+ var _this$_core14;
14404
+ if (!(this.isOpen && !this.settingsOpen && this.selectedMenu === "home" && !((_this$_core14 = this._core) === null || _this$_core14 === void 0 ? void 0 : _this$_core14.intelligence) && typeof document !== "undefined" && document.visibilityState !== "hidden")) {
13274
14405
  this.intelStoryUserPinned = false;
13275
14406
  this.stopIntelligenceStory();
13276
14407
  return;
@@ -13703,7 +14834,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
13703
14834
  unbindPopOutPointerDown(win) {
13704
14835
  try {
13705
14836
  win.removeEventListener("pointerdown", this.handleGlobalPointerDown);
13706
- } catch (_unused15) {}
14837
+ } catch (_unused14) {}
13707
14838
  }
13708
14839
  closePopOut() {
13709
14840
  const handle = this.popOut;
@@ -14151,7 +15282,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
14151
15282
  if (content === null || content === void 0) return "";
14152
15283
  if (typeof content === "object") try {
14153
15284
  return JSON.stringify(this.sanitizeForLogging(content));
14154
- } catch (_unused16) {
15285
+ } catch (_unused15) {
14155
15286
  return "";
14156
15287
  }
14157
15288
  return String(content);
@@ -14261,8 +15392,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
14261
15392
  };
14262
15393
  }
14263
15394
  resolvePlaygroundAgentId(preferredAgentId) {
14264
- var _this$_core$agents, _this$_core14, _Object$keys$;
14265
- const agents = (_this$_core$agents = (_this$_core14 = this._core) === null || _this$_core14 === void 0 ? void 0 : _this$_core14.agents) !== null && _this$_core$agents !== void 0 ? _this$_core$agents : {};
15395
+ var _this$_core$agents, _this$_core15, _Object$keys$;
15396
+ const agents = (_this$_core$agents = (_this$_core15 = this._core) === null || _this$_core15 === void 0 ? void 0 : _this$_core15.agents) !== null && _this$_core$agents !== void 0 ? _this$_core$agents : {};
14266
15397
  if (preferredAgentId && preferredAgentId !== "all-agents" && agents[preferredAgentId]) return preferredAgentId;
14267
15398
  return (_Object$keys$ = Object.keys(agents)[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : null;
14268
15399
  }
@@ -14291,13 +15422,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
14291
15422
  });
14292
15423
  }
14293
15424
  startPlaygroundSession(showEphemeralNotice, seedMessages = [], seedState = {}, preferredAgentId) {
14294
- var _this$_core15, _this$_core16, _this$_core17;
15425
+ var _this$_core16, _this$_core17, _this$_core18;
14295
15426
  const agentId = this.resolvePlaygroundAgentId(preferredAgentId !== null && preferredAgentId !== void 0 ? preferredAgentId : this.selectedContext);
14296
- const sourceAgent = agentId ? typeof ((_this$_core15 = this._core) === null || _this$_core15 === void 0 ? void 0 : _this$_core15.getAgent) === "function" ? this._core.getAgent(agentId) : (_this$_core16 = this._core) === null || _this$_core16 === void 0 ? void 0 : _this$_core16.agents[agentId] : void 0;
15427
+ const sourceAgent = agentId ? typeof ((_this$_core16 = this._core) === null || _this$_core16 === void 0 ? void 0 : _this$_core16.getAgent) === "function" ? this._core.getAgent(agentId) : (_this$_core17 = this._core) === null || _this$_core17 === void 0 ? void 0 : _this$_core17.agents[agentId] : void 0;
14297
15428
  this.teardownPlaygroundAgent();
14298
15429
  this.playgroundError = null;
14299
15430
  this.playgroundSourceThreadId = null;
14300
- this.playgroundShowEphemeralNotice = showEphemeralNotice && ((_this$_core17 = this._core) === null || _this$_core17 === void 0 ? void 0 : _this$_core17.runtimeMode) !== "intelligence";
15431
+ this.playgroundShowEphemeralNotice = showEphemeralNotice && ((_this$_core18 = this._core) === null || _this$_core18 === void 0 ? void 0 : _this$_core18.runtimeMode) !== "intelligence";
14301
15432
  if (!agentId || !sourceAgent) {
14302
15433
  this.requestUpdate();
14303
15434
  return;
@@ -14475,18 +15606,25 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
14475
15606
  if (this.selectedMenu === "frontend-tools") return this.renderToolsView();
14476
15607
  if (this.selectedMenu === "capabilities") return this.renderCapabilitiesView();
14477
15608
  if (this.selectedMenu === "agent-context") return this.renderContextView();
15609
+ if (this.selectedMenu === "generative-ui") {
15610
+ var _this$_core19;
15611
+ return lit.html`<cpk-generative-ui-view
15612
+ data-color-scheme=${this.colorScheme}
15613
+ .source=${(_this$_core19 = this._core) === null || _this$_core19 === void 0 ? void 0 : _this$_core19.ɵgenerativeUIDebugSource}
15614
+ ></cpk-generative-ui-view>`;
15615
+ }
14478
15616
  if (this.selectedMenu === "threads") return this.renderThreadsView();
14479
15617
  if (this.selectedMenu === "memories") return this.renderMemoriesView();
14480
15618
  return lit.nothing;
14481
15619
  }
14482
15620
  renderPlaygroundView() {
14483
- var _this$playgroundAgent4, _this$playgroundAgent5, _this$_core$runtimeMo, _this$_core18, _this$_core$runtimeUr, _this$_core19, _this$playgroundSourc;
15621
+ var _this$playgroundAgent4, _this$playgroundAgent5, _this$_core$runtimeMo, _this$_core20, _this$_core$runtimeUr, _this$_core21, _this$playgroundSourc;
14484
15622
  const agentId = this.resolvePlaygroundAgentId(this.selectedContext);
14485
15623
  const sourceThreads = this._threads.filter((thread) => !agentId || thread.agentId === agentId);
14486
15624
  const visibleMessages = this.playgroundMessages.filter((message) => message.role === "user" || message.role === "assistant" || message.role === "reasoning" || message.role === "activity");
14487
15625
  const hasRetry = (_this$playgroundAgent4 = (_this$playgroundAgent5 = this.playgroundAgent) === null || _this$playgroundAgent5 === void 0 ? void 0 : _this$playgroundAgent5.messages.some((message) => message.role === "user")) !== null && _this$playgroundAgent4 !== void 0 ? _this$playgroundAgent4 : false;
14488
- const runtimeMode = (_this$_core$runtimeMo = (_this$_core18 = this._core) === null || _this$_core18 === void 0 ? void 0 : _this$_core18.runtimeMode) !== null && _this$_core$runtimeMo !== void 0 ? _this$_core$runtimeMo : "sse";
14489
- const runtimeLabel = (_this$_core$runtimeUr = (_this$_core19 = this._core) === null || _this$_core19 === void 0 ? void 0 : _this$_core19.runtimeUrl) !== null && _this$_core$runtimeUr !== void 0 ? _this$_core$runtimeUr : "Self-managed agent";
15626
+ const runtimeMode = (_this$_core$runtimeMo = (_this$_core20 = this._core) === null || _this$_core20 === void 0 ? void 0 : _this$_core20.runtimeMode) !== null && _this$_core$runtimeMo !== void 0 ? _this$_core$runtimeMo : "sse";
15627
+ const runtimeLabel = (_this$_core$runtimeUr = (_this$_core21 = this._core) === null || _this$_core21 === void 0 ? void 0 : _this$_core21.runtimeUrl) !== null && _this$_core$runtimeUr !== void 0 ? _this$_core$runtimeUr : "Self-managed agent";
14490
15628
  const busy = this.playgroundIsRunning || this.playgroundIsLoadingThread;
14491
15629
  const suggestions = agentId && this._core ? this._core.getSuggestions(agentId).suggestions : [];
14492
15630
  const lastAssistantIndex = visibleMessages.reduce((last, message, index) => message.role === "assistant" ? index : last, -1);
@@ -14974,7 +16112,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
14974
16112
  this.metadataTelemetryFingerprints.set(props.module, fingerprint);
14975
16113
  try {
14976
16114
  trackMetadataModuleViewed(props);
14977
- } catch (_unused17) {}
16115
+ } catch (_unused16) {}
14978
16116
  }
14979
16117
  maybeTrackInspectorMetadataViews() {
14980
16118
  var _this$core32, _telemetryContext$gro, _telemetryContext$lea;
@@ -15270,7 +16408,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15270
16408
  const raw = window.localStorage.getItem(THREADS_EXAMPLE_TOUR_STORAGE_KEY);
15271
16409
  if (!raw) return false;
15272
16410
  return JSON.parse(raw).dismissed === true;
15273
- } catch (_unused18) {
16411
+ } catch (_unused17) {
15274
16412
  return false;
15275
16413
  }
15276
16414
  }
@@ -15278,7 +16416,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15278
16416
  if (typeof window === "undefined") return;
15279
16417
  try {
15280
16418
  window.localStorage.setItem(THREADS_EXAMPLE_TOUR_STORAGE_KEY, JSON.stringify({ dismissed: true }));
15281
- } catch (_unused19) {}
16419
+ } catch (_unused18) {}
15282
16420
  }
15283
16421
  /** Cancels the one deferred gate without disturbing a newer lifecycle. */
15284
16422
  cancelThreadsExampleOverviewVideoGate() {
@@ -15316,7 +16454,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15316
16454
  this.threadsExampleOverviewVideoState = "playing";
15317
16455
  this.requestUpdate();
15318
16456
  }
15319
- } catch (_unused20) {
16457
+ } catch (_unused19) {
15320
16458
  if (this.isCurrentThreadsExampleOverviewVideo(video, lifecycleGeneration) && this.threadsExampleOverviewVideoPlayAttemptGeneration === playAttemptGeneration) this.failThreadsExampleOverviewVideo(video, lifecycleGeneration);
15321
16459
  } finally {
15322
16460
  if (this.threadsExampleOverviewVideoPlayAttemptGeneration === playAttemptGeneration) this.threadsExampleOverviewVideoPlayPromise = null;
@@ -15330,7 +16468,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15330
16468
  try {
15331
16469
  const playback = Promise.resolve(video.play());
15332
16470
  this.threadsExampleOverviewVideoPlayPromise = this.settleThreadsExampleOverviewVideoPlay(video, lifecycleGeneration, playAttemptGeneration, playback);
15333
- } catch (_unused21) {
16471
+ } catch (_unused20) {
15334
16472
  this.failThreadsExampleOverviewVideo(video, lifecycleGeneration);
15335
16473
  }
15336
16474
  }
@@ -15423,11 +16561,11 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15423
16561
  if (video) {
15424
16562
  try {
15425
16563
  video.pause();
15426
- } catch (_unused22) {}
16564
+ } catch (_unused21) {}
15427
16565
  video.removeAttribute("src");
15428
16566
  try {
15429
16567
  video.load();
15430
- } catch (_unused23) {}
16568
+ } catch (_unused22) {}
15431
16569
  }
15432
16570
  this.threadsExampleOverviewVideoLoaded = false;
15433
16571
  this.threadsExampleOverviewVideoState = "deferred";
@@ -15961,9 +17099,9 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
15961
17099
  `;
15962
17100
  }
15963
17101
  renderThreadsView() {
15964
- var _this$_core20, _visibleThreads$find, _this$_core$runtimeUr2, _this$_core21, _this$_core$ɵheaders, _this$_core22, _this$_core23, _this$liveMessageVers2, _this$agentEvents$get6, _this$_core24;
17102
+ var _this$_core22, _visibleThreads$find, _this$_core$runtimeUr2, _this$_core23, _this$_core$ɵheaders, _this$_core24, _this$_core25, _this$liveMessageVers2, _this$agentEvents$get6, _this$_core26;
15965
17103
  const { displayThreads, threadsErrorMessage, threadsLoading } = this.getActiveThreadsState();
15966
- const ephemeral = !((_this$_core20 = this._core) === null || _this$_core20 === void 0 ? void 0 : _this$_core20.intelligence);
17104
+ const ephemeral = !((_this$_core22 = this._core) === null || _this$_core22 === void 0 ? void 0 : _this$_core22.intelligence);
15967
17105
  const available = this.areThreadEndpointsAvailable();
15968
17106
  const hasEphemeralThreads = ephemeral && available && displayThreads.length > 0;
15969
17107
  if (!ephemeral) this.ephemeralThreadsSetupOpen = false;
@@ -16101,10 +17239,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
16101
17239
  .threadId=${selectedThread.id}
16102
17240
  .thread=${selectedThread}
16103
17241
  .provider=${selectedThreadIsLocalExample ? this.getExampleThreadProvider(selectedThread.id) : null}
16104
- .runtimeUrl=${selectedThreadIsLocalExample ? "" : (_this$_core$runtimeUr2 = (_this$_core21 = this._core) === null || _this$_core21 === void 0 ? void 0 : _this$_core21.runtimeUrl) !== null && _this$_core$runtimeUr2 !== void 0 ? _this$_core$runtimeUr2 : ""}
17242
+ .runtimeUrl=${selectedThreadIsLocalExample ? "" : (_this$_core$runtimeUr2 = (_this$_core23 = this._core) === null || _this$_core23 === void 0 ? void 0 : _this$_core23.runtimeUrl) !== null && _this$_core$runtimeUr2 !== void 0 ? _this$_core$runtimeUr2 : ""}
16105
17243
  .resolveHeaders=${this.resolveCoreHeaders}
16106
- .headersGeneration=${(_this$_core$ɵheaders = (_this$_core22 = this._core) === null || _this$_core22 === void 0 ? void 0 : _this$_core22.ɵheadersGeneration) !== null && _this$_core$ɵheaders !== void 0 ? _this$_core$ɵheaders : 0}
16107
- .threadInspectionAvailable=${selectedThreadIsLocalExample || this.areThreadEndpointsAvailable() && ((_this$_core23 = this._core) === null || _this$_core23 === void 0 || (_this$_core23 = _this$_core23.threadEndpoints) === null || _this$_core23 === void 0 ? void 0 : _this$_core23.inspect) !== false}
17244
+ .headersGeneration=${(_this$_core$ɵheaders = (_this$_core24 = this._core) === null || _this$_core24 === void 0 ? void 0 : _this$_core24.ɵheadersGeneration) !== null && _this$_core$ɵheaders !== void 0 ? _this$_core$ɵheaders : 0}
17245
+ .threadInspectionAvailable=${selectedThreadIsLocalExample || this.areThreadEndpointsAvailable() && ((_this$_core25 = this._core) === null || _this$_core25 === void 0 || (_this$_core25 = _this$_core25.threadEndpoints) === null || _this$_core25 === void 0 ? void 0 : _this$_core25.inspect) !== false}
16108
17246
  .liveMessageVersion=${(_this$liveMessageVers2 = this.liveMessageVersion.get(selectedThread.id)) !== null && _this$liveMessageVers2 !== void 0 ? _this$liveMessageVers2 : 0}
16109
17247
  .viewInAppMode=${this.getViewInAppMode(selectedThread, selectedThreadIsLocalExample)}
16110
17248
  .viewInAppError=${this.viewInAppError}
@@ -16115,7 +17253,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
16115
17253
  .agentStateInput=${this.getLatestStateForAgent(selectedThread.agentId)}
16116
17254
  .agentEventsInput=${(_this$agentEvents$get6 = this.agentEvents.get(selectedThread.agentId)) !== null && _this$agentEvents$get6 !== void 0 ? _this$agentEvents$get6 : []}
16117
17255
  .agentMessagesInput=${selectedThreadIsLocalExample ? EMPTY_INSPECTOR_MESSAGES : this.getLiveAgentMessagesForThread(selectedThread)}
16118
- .tryFromHereAvailable=${!selectedThreadIsLocalExample && this.areThreadEndpointsAvailable() && ((_this$_core24 = this._core) === null || _this$_core24 === void 0 || (_this$_core24 = _this$_core24.threadEndpoints) === null || _this$_core24 === void 0 ? void 0 : _this$_core24.inspect) !== false}
17256
+ .tryFromHereAvailable=${!selectedThreadIsLocalExample && this.areThreadEndpointsAvailable() && ((_this$_core26 = this._core) === null || _this$_core26 === void 0 || (_this$_core26 = _this$_core26.threadEndpoints) === null || _this$_core26 === void 0 ? void 0 : _this$_core26.inspect) !== false}
16119
17257
  .tryFromHereBusy=${this.tryFromHereBusy}
16120
17258
  .tryFromHereError=${this.tryFromHereError}
16121
17259
  @tryFromHere=${(event) => {
@@ -18059,7 +19197,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
18059
19197
  this.notificationDocuments = new Map(documents);
18060
19198
  this.notificationFeed = feed;
18061
19199
  }
18062
- } catch (_unused24) {}
19200
+ } catch (_unused23) {}
18063
19201
  this.announcementLoaded = true;
18064
19202
  this.refreshNotifications();
18065
19203
  this.requestUpdate();
@@ -18125,7 +19263,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
18125
19263
  try {
18126
19264
  const url = new URL(href, typeof window !== "undefined" ? window.location.href : "https://copilotkit.ai");
18127
19265
  return url.protocol === "http:" || url.protocol === "https:" || url.protocol === "mailto:";
18128
- } catch (_unused25) {
19266
+ } catch (_unused24) {
18129
19267
  return false;
18130
19268
  }
18131
19269
  }
@@ -18155,7 +19293,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
18155
19293
  }
18156
19294
  if (isRootRelative) return `${url.pathname}${url.search}${url.hash}`;
18157
19295
  return url.toString();
18158
- } catch (_unused26) {
19296
+ } catch (_unused25) {
18159
19297
  return href;
18160
19298
  }
18161
19299
  }