@copilotkit/web-inspector 1.80.0 → 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.
- package/dist/components/generative-ui-view.cjs +939 -0
- package/dist/components/generative-ui-view.cjs.map +1 -0
- package/dist/components/generative-ui-view.d.mts +3 -0
- package/dist/components/generative-ui-view.mjs +940 -0
- package/dist/components/generative-ui-view.mjs.map +1 -0
- package/dist/index.cjs +79 -155
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -23
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +7 -23
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +63 -139
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1257 -257
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/inspector-nav.cjs +2 -1
- package/dist/lib/inspector-nav.cjs.map +1 -1
- package/dist/lib/inspector-nav.mjs +2 -1
- package/dist/lib/inspector-nav.mjs.map +1 -1
- package/dist/lib/json-block.cjs +139 -0
- package/dist/lib/json-block.cjs.map +1 -0
- package/dist/lib/json-block.d.cts +26 -0
- package/dist/lib/json-block.d.cts.map +1 -0
- package/dist/lib/json-block.d.mts +28 -0
- package/dist/lib/json-block.d.mts.map +1 -0
- package/dist/lib/json-block.mjs +134 -0
- package/dist/lib/json-block.mjs.map +1 -0
- package/dist/lib/telemetry.cjs.map +1 -1
- package/dist/lib/telemetry.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +3 -3
package/dist/index.umd.js
CHANGED
|
@@ -2518,6 +2518,1127 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
2518
2518
|
`;
|
|
2519
2519
|
if (!customElements.get("cpk-learning-view")) customElements.define("cpk-learning-view", CpkLearningView);
|
|
2520
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, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
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);
|
|
3638
|
+
}
|
|
3639
|
+
`;
|
|
3640
|
+
if (!customElements.get("cpk-generative-ui-view")) customElements.define("cpk-generative-ui-view", CpkGenerativeUIView);
|
|
3641
|
+
|
|
2521
3642
|
//#endregion
|
|
2522
3643
|
//#region src/lib/context-helpers.ts
|
|
2523
3644
|
function updateSizeFromElement(state, element, fallback) {
|
|
@@ -3129,7 +4250,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3129
4250
|
"ag-ui-events",
|
|
3130
4251
|
"frontend-tools",
|
|
3131
4252
|
"capabilities",
|
|
3132
|
-
"agent-context"
|
|
4253
|
+
"agent-context",
|
|
4254
|
+
"generative-ui"
|
|
3133
4255
|
]
|
|
3134
4256
|
};
|
|
3135
4257
|
const INSPECTOR_MENU_KEYS = [
|
|
@@ -3202,7 +4324,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3202
4324
|
|
|
3203
4325
|
//#endregion
|
|
3204
4326
|
//#region package.json
|
|
3205
|
-
var version = "1.
|
|
4327
|
+
var version = "1.81.0";
|
|
3206
4328
|
|
|
3207
4329
|
//#endregion
|
|
3208
4330
|
//#region src/lib/telemetry.ts
|
|
@@ -3770,47 +4892,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3770
4892
|
return FEATURE_ONBOARDING_PROMPT_TEMPLATE.replace(RUN_ID_PLACEHOLDER, runId).replace(INTENT_PLACEHOLDER, FEATURE_ONBOARDING_INTENT[serviceId]);
|
|
3771
4893
|
}
|
|
3772
4894
|
|
|
3773
|
-
//#endregion
|
|
3774
|
-
//#region \0@oxc-project+runtime@0.112.0/helpers/checkPrivateRedeclaration.js
|
|
3775
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
3776
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
3777
|
-
}
|
|
3778
|
-
|
|
3779
|
-
//#endregion
|
|
3780
|
-
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateMethodInitSpec.js
|
|
3781
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
3782
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
3783
|
-
}
|
|
3784
|
-
|
|
3785
|
-
//#endregion
|
|
3786
|
-
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldInitSpec.js
|
|
3787
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
3788
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
3789
|
-
}
|
|
3790
|
-
|
|
3791
|
-
//#endregion
|
|
3792
|
-
//#region \0@oxc-project+runtime@0.112.0/helpers/assertClassBrand.js
|
|
3793
|
-
function _assertClassBrand(e, t, n) {
|
|
3794
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
3795
|
-
throw new TypeError("Private element is not present on this object");
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
//#endregion
|
|
3799
|
-
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldGet2.js
|
|
3800
|
-
function _classPrivateFieldGet2(s, a) {
|
|
3801
|
-
return s.get(_assertClassBrand(s, a));
|
|
3802
|
-
}
|
|
3803
|
-
|
|
3804
|
-
//#endregion
|
|
3805
|
-
//#region \0@oxc-project+runtime@0.112.0/helpers/classPrivateFieldSet2.js
|
|
3806
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
3807
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
3808
|
-
}
|
|
3809
|
-
|
|
3810
4895
|
//#endregion
|
|
3811
4896
|
//#region src/index.ts
|
|
3812
|
-
|
|
3813
|
-
/**
|
|
4897
|
+
/**
|
|
3814
4898
|
* Resolve the attached core's request headers at send time. A core released
|
|
3815
4899
|
* before `resolveHeaders()` existed has only the static `headers` map, so an
|
|
3816
4900
|
* inspector attached to it falls back to a copy of that map.
|
|
@@ -4587,142 +5671,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4587
5671
|
function getMetadataActionPlacement(placement) {
|
|
4588
5672
|
return placement === "threads-footer" ? "threads_footer" : "threads_locked";
|
|
4589
5673
|
}
|
|
4590
|
-
function escapeHtml(s) {
|
|
4591
|
-
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
4592
|
-
}
|
|
4593
|
-
const highlightedJsonCache = /* @__PURE__ */ new WeakMap();
|
|
4594
|
-
function highlightedJson(obj) {
|
|
4595
|
-
if (typeof obj === "object" && obj !== null) {
|
|
4596
|
-
const cached = highlightedJsonCache.get(obj);
|
|
4597
|
-
if (cached !== void 0) return cached;
|
|
4598
|
-
}
|
|
4599
|
-
const json = JSON.stringify(obj, null, 2);
|
|
4600
|
-
if (!json) return "";
|
|
4601
|
-
const parts = [];
|
|
4602
|
-
let lastIndex = 0;
|
|
4603
|
-
const re = /("(?:\\u[a-fA-F0-9]{4}|\\[^u]|[^\\"])*"(?:\s*:)?|\b(?:true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+-]?\d+)?)/g;
|
|
4604
|
-
let match;
|
|
4605
|
-
while ((match = re.exec(json)) !== null) {
|
|
4606
|
-
parts.push(escapeHtml(json.slice(lastIndex, match.index)));
|
|
4607
|
-
const m = match[0];
|
|
4608
|
-
let token = "num";
|
|
4609
|
-
if (m.startsWith("\"")) token = m.trimEnd().endsWith(":") ? "key" : "str";
|
|
4610
|
-
else if (m === "true" || m === "false") token = "bool";
|
|
4611
|
-
else if (m === "null") token = "nil";
|
|
4612
|
-
parts.push(`<span class="cpk-json-token cpk-json-token--${token}">${escapeHtml(m)}</span>`);
|
|
4613
|
-
lastIndex = match.index + m.length;
|
|
4614
|
-
}
|
|
4615
|
-
parts.push(escapeHtml(json.slice(lastIndex)));
|
|
4616
|
-
const result = parts.join("");
|
|
4617
|
-
if (typeof obj === "object" && obj !== null) highlightedJsonCache.set(obj, result);
|
|
4618
|
-
return result;
|
|
4619
|
-
}
|
|
4620
|
-
function coerceJsonValue(value) {
|
|
4621
|
-
if (typeof value !== "string") return value;
|
|
4622
|
-
const trimmed = value.trim();
|
|
4623
|
-
if (trimmed.length === 0) return value;
|
|
4624
|
-
if (!(trimmed.startsWith("{") && trimmed.endsWith("}") || trimmed.startsWith("[") && trimmed.endsWith("]"))) return value;
|
|
4625
|
-
try {
|
|
4626
|
-
return JSON.parse(trimmed);
|
|
4627
|
-
} catch (_unused) {
|
|
4628
|
-
return value;
|
|
4629
|
-
}
|
|
4630
|
-
}
|
|
4631
|
-
let inspectorJsonRenderer = null;
|
|
4632
|
-
let inspectorJsonSlotCount = 0;
|
|
4633
|
-
const JSON_BLOCK_TAG = "cpk-json-block";
|
|
4634
|
-
/**
|
|
4635
|
-
* Replaces the inspector's built-in JSON blocks (tool arguments and results,
|
|
4636
|
-
* state, events, and context) with a host renderer. Pass `null` to restore the
|
|
4637
|
-
* built-in blocks. Set it before the inspector renders: a block that is
|
|
4638
|
-
* already on screen changes at the inspector's next render.
|
|
4639
|
-
*
|
|
4640
|
-
* @example
|
|
4641
|
-
* ```ts
|
|
4642
|
-
* setInspectorJsonRenderer((container, value) => {
|
|
4643
|
-
* const root = createRoot(container);
|
|
4644
|
-
* root.render(<JsonView value={value} />);
|
|
4645
|
-
* return () => root.unmount();
|
|
4646
|
-
* });
|
|
4647
|
-
* ```
|
|
4648
|
-
*/
|
|
4649
|
-
function setInspectorJsonRenderer(renderer) {
|
|
4650
|
-
inspectorJsonRenderer = renderer;
|
|
4651
|
-
}
|
|
4652
|
-
var _value = /* @__PURE__ */ new WeakMap();
|
|
4653
|
-
var _hasValue = /* @__PURE__ */ new WeakMap();
|
|
4654
|
-
var _cleanup = /* @__PURE__ */ new WeakMap();
|
|
4655
|
-
var _container = /* @__PURE__ */ new WeakMap();
|
|
4656
|
-
var _CpkJsonBlock_brand = /* @__PURE__ */ new WeakSet();
|
|
4657
|
-
/**
|
|
4658
|
-
* Hosts one value drawn by the host renderer. Inside a shadow root, the
|
|
4659
|
-
* container lives in the shadow host's light DOM and shows here through a
|
|
4660
|
-
* named slot, so the host page's own styles apply to what the renderer draws.
|
|
4661
|
-
*/
|
|
4662
|
-
var CpkJsonBlock = class extends ((_globalThis$HTMLEleme = globalThis.HTMLElement) !== null && _globalThis$HTMLEleme !== void 0 ? _globalThis$HTMLEleme : class {}) {
|
|
4663
|
-
constructor(..._args) {
|
|
4664
|
-
super(..._args);
|
|
4665
|
-
_classPrivateMethodInitSpec(this, _CpkJsonBlock_brand);
|
|
4666
|
-
_classPrivateFieldInitSpec(this, _value, void 0);
|
|
4667
|
-
_classPrivateFieldInitSpec(this, _hasValue, false);
|
|
4668
|
-
_classPrivateFieldInitSpec(this, _cleanup, void 0);
|
|
4669
|
-
_classPrivateFieldInitSpec(this, _container, void 0);
|
|
4670
|
-
}
|
|
4671
|
-
get value() {
|
|
4672
|
-
return _classPrivateFieldGet2(_value, this);
|
|
4673
|
-
}
|
|
4674
|
-
set value(next) {
|
|
4675
|
-
if (_classPrivateFieldGet2(_hasValue, this) && Object.is(next, _classPrivateFieldGet2(_value, this))) return;
|
|
4676
|
-
_classPrivateFieldSet2(_value, this, next);
|
|
4677
|
-
_classPrivateFieldSet2(_hasValue, this, true);
|
|
4678
|
-
if (this.isConnected) _assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
|
|
4679
|
-
}
|
|
4680
|
-
connectedCallback() {
|
|
4681
|
-
this.style.display = "block";
|
|
4682
|
-
_assertClassBrand(_CpkJsonBlock_brand, this, _render).call(this);
|
|
4683
|
-
}
|
|
4684
|
-
disconnectedCallback() {
|
|
4685
|
-
_assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
|
|
4686
|
-
}
|
|
4687
|
-
};
|
|
4688
|
-
function _render() {
|
|
4689
|
-
_assertClassBrand(_CpkJsonBlock_brand, this, _teardown).call(this);
|
|
4690
|
-
const renderer = inspectorJsonRenderer;
|
|
4691
|
-
if (!renderer) return;
|
|
4692
|
-
const root = this.getRootNode();
|
|
4693
|
-
const container = this.ownerDocument.createElement("div");
|
|
4694
|
-
if (root.nodeType === Node.DOCUMENT_FRAGMENT_NODE && "host" in root) {
|
|
4695
|
-
inspectorJsonSlotCount += 1;
|
|
4696
|
-
const name = `cpk-json-${inspectorJsonSlotCount}`;
|
|
4697
|
-
const slot = this.ownerDocument.createElement("slot");
|
|
4698
|
-
slot.name = name;
|
|
4699
|
-
this.replaceChildren(slot);
|
|
4700
|
-
container.slot = name;
|
|
4701
|
-
root.host.append(container);
|
|
4702
|
-
} else this.replaceChildren(container);
|
|
4703
|
-
_classPrivateFieldSet2(_container, this, container);
|
|
4704
|
-
const cleanup = renderer(container, _classPrivateFieldGet2(_value, this));
|
|
4705
|
-
_classPrivateFieldSet2(_cleanup, this, typeof cleanup === "function" ? cleanup : void 0);
|
|
4706
|
-
}
|
|
4707
|
-
function _teardown() {
|
|
4708
|
-
var _classPrivateFieldGet2$1;
|
|
4709
|
-
const cleanup = _classPrivateFieldGet2(_cleanup, this);
|
|
4710
|
-
_classPrivateFieldSet2(_cleanup, this, void 0);
|
|
4711
|
-
cleanup === null || cleanup === void 0 || cleanup();
|
|
4712
|
-
(_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_container, this)) === null || _classPrivateFieldGet2$1 === void 0 || _classPrivateFieldGet2$1.remove();
|
|
4713
|
-
_classPrivateFieldSet2(_container, this, void 0);
|
|
4714
|
-
this.replaceChildren();
|
|
4715
|
-
}
|
|
4716
|
-
function renderHighlightedJsonBlock(value, options = {}) {
|
|
4717
|
-
if (inspectorJsonRenderer) return lit.html`<cpk-json-block
|
|
4718
|
-
.value=${value}
|
|
4719
|
-
style=${options.maxHeight ? `overflow:auto;max-height:${options.maxHeight}` : lit.nothing}
|
|
4720
|
-
></cpk-json-block>`;
|
|
4721
|
-
const parsed = coerceJsonValue(value);
|
|
4722
|
-
return lit.html`<pre class="cpk-json-block" style=${(options.maxHeight ? `max-height:${options.maxHeight}` : void 0) || lit.nothing}>
|
|
4723
|
-
${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
4724
|
-
>`;
|
|
4725
|
-
}
|
|
4726
5674
|
function humanizeEventType(type) {
|
|
4727
5675
|
const words = type.trim().split(/[_\s]+/).filter(Boolean).map((word) => word.toLowerCase());
|
|
4728
5676
|
if (words.length === 0) return "Event";
|
|
@@ -4779,8 +5727,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
4779
5727
|
}
|
|
4780
5728
|
};
|
|
4781
5729
|
var CpkThreadList = class extends PortableLitElement {
|
|
4782
|
-
constructor(...
|
|
4783
|
-
super(...
|
|
5730
|
+
constructor(..._args) {
|
|
5731
|
+
super(..._args);
|
|
4784
5732
|
this.threads = [];
|
|
4785
5733
|
this.selectedThreadId = null;
|
|
4786
5734
|
this.inAppThreadId = null;
|
|
@@ -5134,8 +6082,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
5134
6082
|
}
|
|
5135
6083
|
`;
|
|
5136
6084
|
var CpkThreadInspector = class CpkThreadInspector extends PortableLitElement {
|
|
5137
|
-
constructor(...
|
|
5138
|
-
super(...
|
|
6085
|
+
constructor(..._args2) {
|
|
6086
|
+
super(..._args2);
|
|
5139
6087
|
this.showThreadTitle = true;
|
|
5140
6088
|
this.threadId = null;
|
|
5141
6089
|
this.provider = null;
|
|
@@ -5985,7 +6933,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
5985
6933
|
const item = ensureTool(event);
|
|
5986
6934
|
if (item.rawArgs) try {
|
|
5987
6935
|
JSON.parse(item.rawArgs);
|
|
5988
|
-
} catch (
|
|
6936
|
+
} catch (_unused) {
|
|
5989
6937
|
appendWarning(event, "Could not decode tool call arguments", item.rawArgs);
|
|
5990
6938
|
}
|
|
5991
6939
|
continue;
|
|
@@ -6001,7 +6949,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
6001
6949
|
item.body = item.body ? `${item.body}\nResult: ${result}` : `Result: ${result}`;
|
|
6002
6950
|
try {
|
|
6003
6951
|
JSON.parse(result);
|
|
6004
|
-
} catch (
|
|
6952
|
+
} catch (_unused2) {
|
|
6005
6953
|
appendWarning(event, "Could not decode tool result", result);
|
|
6006
6954
|
}
|
|
6007
6955
|
}
|
|
@@ -8406,8 +9354,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
8406
9354
|
return Math.max(6, Math.min(100, Math.round(relevance * 100)));
|
|
8407
9355
|
}
|
|
8408
9356
|
var CpkMemoryList = class extends PortableLitElement {
|
|
8409
|
-
constructor(...
|
|
8410
|
-
super(...
|
|
9357
|
+
constructor(..._args3) {
|
|
9358
|
+
super(..._args3);
|
|
8411
9359
|
this.memories = [];
|
|
8412
9360
|
this.recallResults = null;
|
|
8413
9361
|
this.recallLoading = false;
|
|
@@ -9019,8 +9967,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9019
9967
|
if (!registry.get(tag)) registry.define(tag, ctor);
|
|
9020
9968
|
}
|
|
9021
9969
|
var WebInspectorElement = class WebInspectorElement extends lit.LitElement {
|
|
9022
|
-
constructor(...
|
|
9023
|
-
super(...
|
|
9970
|
+
constructor(..._args4) {
|
|
9971
|
+
super(..._args4);
|
|
9024
9972
|
this._core = null;
|
|
9025
9973
|
this.resolveCoreHeaders = () => this._core ? resolveAttachedCoreHeaders(this._core) : {};
|
|
9026
9974
|
this.coreSubscriber = null;
|
|
@@ -9031,6 +9979,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9031
9979
|
this._memoriesAvailable = true;
|
|
9032
9980
|
this._memoriesRealtimeStatus = "connecting";
|
|
9033
9981
|
this._memoryUnsub = null;
|
|
9982
|
+
this._generativeUIUnsub = null;
|
|
9034
9983
|
this._memorySubscribed = false;
|
|
9035
9984
|
this._memoryStoreUnsupported = false;
|
|
9036
9985
|
this.learningSnapshot = null;
|
|
@@ -9367,14 +10316,9 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9367
10316
|
}
|
|
9368
10317
|
} catch (error) {
|
|
9369
10318
|
if (generation !== this.learningRequestGeneration || controller.signal.aborted) return;
|
|
9370
|
-
if (error instanceof InspectorLearningUnsupportedError)
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
this.learningSnapshot = null;
|
|
9374
|
-
} else {
|
|
9375
|
-
this.learningError = error instanceof Error ? error.message : "Learning data is unavailable.";
|
|
9376
|
-
this.learningPollFailureCount += 1;
|
|
9377
|
-
}
|
|
10319
|
+
if (error instanceof InspectorLearningUnsupportedError) loadOutcome = "unsupported";
|
|
10320
|
+
this.learningError = "Learning status unavailable";
|
|
10321
|
+
this.learningPollFailureCount += 1;
|
|
9378
10322
|
} finally {
|
|
9379
10323
|
if (generation === this.learningRequestGeneration) {
|
|
9380
10324
|
this.learningLoading = false;
|
|
@@ -9404,7 +10348,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9404
10348
|
try {
|
|
9405
10349
|
await clipboard.writeText(createFeatureOnboardingPrompt(service.id, onboardingRunId));
|
|
9406
10350
|
return true;
|
|
9407
|
-
} catch (
|
|
10351
|
+
} catch (_unused3) {
|
|
9408
10352
|
return false;
|
|
9409
10353
|
}
|
|
9410
10354
|
};
|
|
@@ -9583,6 +10527,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9583
10527
|
this.queueHudTelemetry(() => trackHudHideClicked({ trigger }));
|
|
9584
10528
|
this.dismissInspectorFor("day");
|
|
9585
10529
|
};
|
|
10530
|
+
this.retryLearningStatus = (event) => {
|
|
10531
|
+
event.stopPropagation();
|
|
10532
|
+
this.refreshLearningSnapshot().catch(() => {
|
|
10533
|
+
this.learningError = "Learning status unavailable";
|
|
10534
|
+
this.requestUpdate();
|
|
10535
|
+
});
|
|
10536
|
+
};
|
|
9586
10537
|
this.handleSidebarToggle = () => {
|
|
9587
10538
|
this.sidebarRailTooltip = null;
|
|
9588
10539
|
this.sidebarCollapsed = !this.sidebarCollapsed;
|
|
@@ -9652,7 +10603,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
9652
10603
|
if (clipboard === null || clipboard === void 0 ? void 0 : clipboard.writeText) try {
|
|
9653
10604
|
await clipboard.writeText(createOnboardingPrompt(runId));
|
|
9654
10605
|
outcome = "copied";
|
|
9655
|
-
} catch (
|
|
10606
|
+
} catch (_unused4) {
|
|
9656
10607
|
outcome = "failed";
|
|
9657
10608
|
}
|
|
9658
10609
|
if (!this.isConnected) return;
|
|
@@ -10042,7 +10993,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10042
10993
|
...this.getMetadataTelemetryContext(),
|
|
10043
10994
|
action_placement: getMetadataActionPlacement(placement)
|
|
10044
10995
|
});
|
|
10045
|
-
} catch (
|
|
10996
|
+
} catch (_unused5) {}
|
|
10046
10997
|
};
|
|
10047
10998
|
this.handleTalkToEngineerClick = () => {
|
|
10048
10999
|
var _this$core8;
|
|
@@ -10120,7 +11071,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10120
11071
|
this.invalidateThreadsExampleOverviewVideoPlay();
|
|
10121
11072
|
try {
|
|
10122
11073
|
video.pause();
|
|
10123
|
-
} catch (
|
|
11074
|
+
} catch (_unused6) {}
|
|
10124
11075
|
this.threadsExampleOverviewVideoState = "ready";
|
|
10125
11076
|
this.requestUpdate();
|
|
10126
11077
|
return;
|
|
@@ -10267,7 +11218,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10267
11218
|
if (this._core) this.attachToCore(this._core);
|
|
10268
11219
|
}
|
|
10269
11220
|
get menuItems() {
|
|
10270
|
-
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;
|
|
10271
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;
|
|
10272
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;
|
|
10273
11224
|
return [
|
|
@@ -10316,6 +11267,11 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10316
11267
|
label: "Context",
|
|
10317
11268
|
icon: "FileText"
|
|
10318
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
|
+
}] : [],
|
|
10319
11275
|
{
|
|
10320
11276
|
key: "threads",
|
|
10321
11277
|
label: "Rich Threads",
|
|
@@ -10370,8 +11326,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10370
11326
|
return ((_this$_core$threadEnd = this._core.threadEndpoints) === null || _this$_core$threadEnd === void 0 ? void 0 : _this$_core$threadEnd.list) === false ? "unavailable" : "available";
|
|
10371
11327
|
}
|
|
10372
11328
|
areThreadEndpointsAvailable() {
|
|
10373
|
-
var _this$
|
|
10374
|
-
const endpoints = (_this$
|
|
11329
|
+
var _this$_core4;
|
|
11330
|
+
const endpoints = (_this$_core4 = this._core) === null || _this$_core4 === void 0 ? void 0 : _this$_core4.threadEndpoints;
|
|
10375
11331
|
return endpoints !== null && typeof endpoints === "object" && endpoints.list !== false;
|
|
10376
11332
|
}
|
|
10377
11333
|
synchronizeThreadCapability() {
|
|
@@ -10683,7 +11639,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10683
11639
|
coreSupportsInspectorMetadata(core) {
|
|
10684
11640
|
try {
|
|
10685
11641
|
return "inspectorMetadata" in core;
|
|
10686
|
-
} catch (
|
|
11642
|
+
} catch (_unused7) {
|
|
10687
11643
|
return false;
|
|
10688
11644
|
}
|
|
10689
11645
|
}
|
|
@@ -10691,7 +11647,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10691
11647
|
if (!this.coreSupportsInspectorMetadata(core)) return;
|
|
10692
11648
|
try {
|
|
10693
11649
|
return core.inspectorMetadata;
|
|
10694
|
-
} catch (
|
|
11650
|
+
} catch (_unused8) {
|
|
10695
11651
|
return;
|
|
10696
11652
|
}
|
|
10697
11653
|
}
|
|
@@ -10699,16 +11655,16 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10699
11655
|
this.inspectorMetadataValue = value;
|
|
10700
11656
|
let runtimeLicense;
|
|
10701
11657
|
try {
|
|
10702
|
-
var _this$
|
|
10703
|
-
runtimeLicense = (_this$
|
|
10704
|
-
} catch (
|
|
11658
|
+
var _this$_core5;
|
|
11659
|
+
runtimeLicense = (_this$_core5 = this._core) === null || _this$_core5 === void 0 ? void 0 : _this$_core5.licenseStatus;
|
|
11660
|
+
} catch (_unused9) {
|
|
10705
11661
|
runtimeLicense = void 0;
|
|
10706
11662
|
}
|
|
10707
11663
|
this.inspectorMetadataProjection = projectInspectorMetadata(value, runtimeLicense);
|
|
10708
11664
|
this.refreshNotifications();
|
|
10709
11665
|
}
|
|
10710
11666
|
attachToCore(core) {
|
|
10711
|
-
var _this$inspectorMetada2;
|
|
11667
|
+
var _this$inspectorMetada2, _core$ɵsubscribeToGe, _core$ɵsubscribeToGe2;
|
|
10712
11668
|
this.runtimeStatus = core.runtimeConnectionStatus;
|
|
10713
11669
|
this.coreProperties = core.properties;
|
|
10714
11670
|
this.lastCoreError = null;
|
|
@@ -10809,6 +11765,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10809
11765
|
}
|
|
10810
11766
|
};
|
|
10811
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;
|
|
10812
11772
|
this.processAgentsChanged(core.agents);
|
|
10813
11773
|
if (core.runtimeConnectionStatus === "connected") {
|
|
10814
11774
|
if (!core.telemetryDisabled) {
|
|
@@ -10883,10 +11843,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10883
11843
|
* reachable from the Intelligence-gated memory view, so it inherits the gate.
|
|
10884
11844
|
*/
|
|
10885
11845
|
runRecall(query) {
|
|
10886
|
-
var _this$
|
|
11846
|
+
var _this$_core6, _this$_core6$getMemor;
|
|
10887
11847
|
const trimmed = query.trim();
|
|
10888
11848
|
if (trimmed.length === 0) return;
|
|
10889
|
-
const store = (_this$
|
|
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);
|
|
10890
11850
|
if (!store || typeof store.recall !== "function") {
|
|
10891
11851
|
this._recallResults = [];
|
|
10892
11852
|
this._recallError = "Recall is not supported by this SDK version.";
|
|
@@ -10994,7 +11954,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
10994
11954
|
}
|
|
10995
11955
|
}
|
|
10996
11956
|
detachFromCore() {
|
|
10997
|
-
var _this$_memoryUnsub;
|
|
11957
|
+
var _this$_memoryUnsub, _this$_generativeUIUn;
|
|
10998
11958
|
this.threadCapabilityGeneration += 1;
|
|
10999
11959
|
this.threadCapabilityEnabled = null;
|
|
11000
11960
|
if (this.selectedThreadId !== this.selectedLocalExampleThreadId) {
|
|
@@ -11008,6 +11968,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11008
11968
|
}
|
|
11009
11969
|
(_this$_memoryUnsub = this._memoryUnsub) === null || _this$_memoryUnsub === void 0 || _this$_memoryUnsub.call(this);
|
|
11010
11970
|
this._memoryUnsub = null;
|
|
11971
|
+
(_this$_generativeUIUn = this._generativeUIUnsub) === null || _this$_generativeUIUn === void 0 || _this$_generativeUIUn.call(this);
|
|
11972
|
+
this._generativeUIUnsub = null;
|
|
11011
11973
|
this._memories = [];
|
|
11012
11974
|
this._memoriesLoading = false;
|
|
11013
11975
|
this._memoriesError = null;
|
|
@@ -11475,12 +12437,12 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11475
12437
|
if (typeof args === "string") try {
|
|
11476
12438
|
const parsed = JSON.parse(args);
|
|
11477
12439
|
return JSON.stringify(parsed, null, 2);
|
|
11478
|
-
} catch (
|
|
12440
|
+
} catch (_unused10) {
|
|
11479
12441
|
return args;
|
|
11480
12442
|
}
|
|
11481
12443
|
if (typeof args === "object") try {
|
|
11482
12444
|
return JSON.stringify(args, null, 2);
|
|
11483
|
-
} catch (
|
|
12445
|
+
} catch (_unused11) {
|
|
11484
12446
|
return String(args);
|
|
11485
12447
|
}
|
|
11486
12448
|
return String(args);
|
|
@@ -11503,13 +12465,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
11503
12465
|
try {
|
|
11504
12466
|
const parsed = JSON.parse(trimmed);
|
|
11505
12467
|
return JSON.stringify(parsed, null, 2);
|
|
11506
|
-
} catch (
|
|
12468
|
+
} catch (_unused12) {
|
|
11507
12469
|
return state;
|
|
11508
12470
|
}
|
|
11509
12471
|
}
|
|
11510
12472
|
if (typeof state === "object") try {
|
|
11511
12473
|
return JSON.stringify(state, null, 2);
|
|
11512
|
-
} catch (
|
|
12474
|
+
} catch (_unused13) {
|
|
11513
12475
|
return String(state);
|
|
11514
12476
|
}
|
|
11515
12477
|
return String(state);
|
|
@@ -12071,8 +13033,23 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
12071
13033
|
const titleCharacters = Array.from(title);
|
|
12072
13034
|
return titleCharacters.length > HUD_ANNOUNCEMENT_TITLE_LIMIT ? `${titleCharacters.slice(0, HUD_ANNOUNCEMENT_TITLE_LIMIT).join("").trimEnd()}...` : title;
|
|
12073
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
|
+
}
|
|
12074
13043
|
renderHudRow(args) {
|
|
12075
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>`;
|
|
12076
13053
|
const detailId = `cpk-hud-detail-${args.id}`;
|
|
12077
13054
|
const { label, description } = this.hudContent[args.id];
|
|
12078
13055
|
return lit.html`
|
|
@@ -12442,14 +13419,14 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
12442
13419
|
`;
|
|
12443
13420
|
}
|
|
12444
13421
|
getHomeModel() {
|
|
12445
|
-
var _this$notificationFee2, _this$
|
|
13422
|
+
var _this$notificationFee2, _this$_core7, _this$_core8, _this$learningSnapsho8, _this$_core9, _this$_core10, _this$_core11, _this$_core12, _this$_core13;
|
|
12446
13423
|
const lastRuntimeEvent = this.flattenedEvents[0];
|
|
12447
13424
|
const activeNotice = (_this$notificationFee2 = this.notificationFeed) === null || _this$notificationFee2 === void 0 ? void 0 : _this$notificationFee2.notifications.find((notice) => notice.id === this.notificationState.activeId);
|
|
12448
13425
|
return buildHomeModel({
|
|
12449
|
-
intelligenceConnected: Boolean((_this$
|
|
13426
|
+
intelligenceConnected: Boolean((_this$_core7 = this._core) === null || _this$_core7 === void 0 ? void 0 : _this$_core7.intelligence),
|
|
12450
13427
|
threadsAvailable: this.areThreadEndpointsAvailable(),
|
|
12451
13428
|
metadata: this.inspectorMetadataProjection,
|
|
12452
|
-
runtimeUrl: (_this$
|
|
13429
|
+
runtimeUrl: (_this$_core8 = this._core) === null || _this$_core8 === void 0 ? void 0 : _this$_core8.runtimeUrl,
|
|
12453
13430
|
runtimeConnectionState: this.getCoreStatusSummary().state,
|
|
12454
13431
|
lastRuntimeEvent: lastRuntimeEvent ? {
|
|
12455
13432
|
id: lastRuntimeEvent.id,
|
|
@@ -12457,12 +13434,12 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
12457
13434
|
type: lastRuntimeEvent.type,
|
|
12458
13435
|
timestamp: lastRuntimeEvent.timestamp
|
|
12459
13436
|
} : void 0,
|
|
12460
|
-
learningOn: this.learningSupported && this.learningError === null && ((_this$
|
|
12461
|
-
a2uiOn: ((_this$
|
|
12462
|
-
openGenUiOn: ((_this$
|
|
12463
|
-
suggestionsOn: ((_this$
|
|
12464
|
-
audioOn: ((_this$
|
|
12465
|
-
websocketUrl: (_this$
|
|
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,
|
|
12466
13443
|
announcementPreviewText: activeNotice === null || activeNotice === void 0 ? void 0 : activeNotice.title,
|
|
12467
13444
|
announcementMarkdown: activeNotice === null || activeNotice === void 0 ? void 0 : activeNotice.body,
|
|
12468
13445
|
announcementHtml: activeNotice ? this.notificationDocuments.get(activeNotice.id) : void 0,
|
|
@@ -12914,18 +13891,27 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
12914
13891
|
}
|
|
12915
13892
|
renderHomeFeatures(model) {
|
|
12916
13893
|
const enabledServices = model.services.filter((service) => service.enabled);
|
|
12917
|
-
const
|
|
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));
|
|
12918
13897
|
const renderService = (service) => {
|
|
12919
13898
|
var _this$homeFeatureProm;
|
|
12920
13899
|
const copyState = ((_this$homeFeatureProm = this.homeFeaturePromptCopyState) === null || _this$homeFeatureProm === void 0 ? void 0 : _this$homeFeatureProm.serviceId) === service.id ? this.homeFeaturePromptCopyState.state : "idle";
|
|
12921
|
-
const
|
|
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"}`;
|
|
12922
13908
|
const copyLabel = copyState === "copied" ? "Copied" : copyState === "error" ? "Copy failed" : "Copy prompt";
|
|
12923
13909
|
const copyTitle = copyLabel;
|
|
12924
13910
|
return lit.html`
|
|
12925
13911
|
<div
|
|
12926
13912
|
class="inspector-home-feature"
|
|
12927
13913
|
data-inspector-service=${service.id}
|
|
12928
|
-
data-state=${service.enabled ? "on" : "off"}
|
|
13914
|
+
data-state=${learningUnavailable ? "unavailable" : service.enabled ? "on" : "off"}
|
|
12929
13915
|
role="listitem"
|
|
12930
13916
|
>
|
|
12931
13917
|
<span
|
|
@@ -12944,13 +13930,16 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
12944
13930
|
rel="noopener noreferrer"
|
|
12945
13931
|
aria-label="Open ${service.label} documentation in a new tab"
|
|
12946
13932
|
>
|
|
12947
|
-
<span>${service.label}</span>
|
|
13933
|
+
<span>${learningStatus ? stateDescription : service.label}</span>
|
|
12948
13934
|
<span class="inspector-home-feature-label-icon" aria-hidden="true"
|
|
12949
13935
|
>${this.renderIcon("ArrowUpRight")}</span
|
|
12950
13936
|
>
|
|
12951
13937
|
</a>
|
|
12952
13938
|
<span class="inspector-home-feature-actions">
|
|
12953
|
-
${
|
|
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`
|
|
12954
13943
|
<button
|
|
12955
13944
|
type="button"
|
|
12956
13945
|
class="inspector-home-feature-action inspector-system-health-url"
|
|
@@ -12994,6 +13983,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
12994
13983
|
</p>
|
|
12995
13984
|
` : lit.html`
|
|
12996
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}
|
|
12997
13990
|
<section
|
|
12998
13991
|
class="inspector-home-feature-group"
|
|
12999
13992
|
data-feature-state-group="active"
|
|
@@ -13407,8 +14400,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
13407
14400
|
* would be holding a repeating timer behind a closed panel.
|
|
13408
14401
|
*/
|
|
13409
14402
|
syncIntelligenceStory() {
|
|
13410
|
-
var _this$
|
|
13411
|
-
if (!(this.isOpen && !this.settingsOpen && this.selectedMenu === "home" && !((_this$
|
|
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")) {
|
|
13412
14405
|
this.intelStoryUserPinned = false;
|
|
13413
14406
|
this.stopIntelligenceStory();
|
|
13414
14407
|
return;
|
|
@@ -13841,7 +14834,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
13841
14834
|
unbindPopOutPointerDown(win) {
|
|
13842
14835
|
try {
|
|
13843
14836
|
win.removeEventListener("pointerdown", this.handleGlobalPointerDown);
|
|
13844
|
-
} catch (
|
|
14837
|
+
} catch (_unused14) {}
|
|
13845
14838
|
}
|
|
13846
14839
|
closePopOut() {
|
|
13847
14840
|
const handle = this.popOut;
|
|
@@ -14289,7 +15282,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
14289
15282
|
if (content === null || content === void 0) return "";
|
|
14290
15283
|
if (typeof content === "object") try {
|
|
14291
15284
|
return JSON.stringify(this.sanitizeForLogging(content));
|
|
14292
|
-
} catch (
|
|
15285
|
+
} catch (_unused15) {
|
|
14293
15286
|
return "";
|
|
14294
15287
|
}
|
|
14295
15288
|
return String(content);
|
|
@@ -14399,8 +15392,8 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
14399
15392
|
};
|
|
14400
15393
|
}
|
|
14401
15394
|
resolvePlaygroundAgentId(preferredAgentId) {
|
|
14402
|
-
var _this$_core$agents, _this$
|
|
14403
|
-
const agents = (_this$_core$agents = (_this$
|
|
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 : {};
|
|
14404
15397
|
if (preferredAgentId && preferredAgentId !== "all-agents" && agents[preferredAgentId]) return preferredAgentId;
|
|
14405
15398
|
return (_Object$keys$ = Object.keys(agents)[0]) !== null && _Object$keys$ !== void 0 ? _Object$keys$ : null;
|
|
14406
15399
|
}
|
|
@@ -14429,13 +15422,13 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
14429
15422
|
});
|
|
14430
15423
|
}
|
|
14431
15424
|
startPlaygroundSession(showEphemeralNotice, seedMessages = [], seedState = {}, preferredAgentId) {
|
|
14432
|
-
var _this$
|
|
15425
|
+
var _this$_core16, _this$_core17, _this$_core18;
|
|
14433
15426
|
const agentId = this.resolvePlaygroundAgentId(preferredAgentId !== null && preferredAgentId !== void 0 ? preferredAgentId : this.selectedContext);
|
|
14434
|
-
const sourceAgent = agentId ? typeof ((_this$
|
|
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;
|
|
14435
15428
|
this.teardownPlaygroundAgent();
|
|
14436
15429
|
this.playgroundError = null;
|
|
14437
15430
|
this.playgroundSourceThreadId = null;
|
|
14438
|
-
this.playgroundShowEphemeralNotice = showEphemeralNotice && ((_this$
|
|
15431
|
+
this.playgroundShowEphemeralNotice = showEphemeralNotice && ((_this$_core18 = this._core) === null || _this$_core18 === void 0 ? void 0 : _this$_core18.runtimeMode) !== "intelligence";
|
|
14439
15432
|
if (!agentId || !sourceAgent) {
|
|
14440
15433
|
this.requestUpdate();
|
|
14441
15434
|
return;
|
|
@@ -14613,18 +15606,25 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
14613
15606
|
if (this.selectedMenu === "frontend-tools") return this.renderToolsView();
|
|
14614
15607
|
if (this.selectedMenu === "capabilities") return this.renderCapabilitiesView();
|
|
14615
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
|
+
}
|
|
14616
15616
|
if (this.selectedMenu === "threads") return this.renderThreadsView();
|
|
14617
15617
|
if (this.selectedMenu === "memories") return this.renderMemoriesView();
|
|
14618
15618
|
return lit.nothing;
|
|
14619
15619
|
}
|
|
14620
15620
|
renderPlaygroundView() {
|
|
14621
|
-
var _this$playgroundAgent4, _this$playgroundAgent5, _this$_core$runtimeMo, _this$
|
|
15621
|
+
var _this$playgroundAgent4, _this$playgroundAgent5, _this$_core$runtimeMo, _this$_core20, _this$_core$runtimeUr, _this$_core21, _this$playgroundSourc;
|
|
14622
15622
|
const agentId = this.resolvePlaygroundAgentId(this.selectedContext);
|
|
14623
15623
|
const sourceThreads = this._threads.filter((thread) => !agentId || thread.agentId === agentId);
|
|
14624
15624
|
const visibleMessages = this.playgroundMessages.filter((message) => message.role === "user" || message.role === "assistant" || message.role === "reasoning" || message.role === "activity");
|
|
14625
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;
|
|
14626
|
-
const runtimeMode = (_this$_core$runtimeMo = (_this$
|
|
14627
|
-
const runtimeLabel = (_this$_core$runtimeUr = (_this$
|
|
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";
|
|
14628
15628
|
const busy = this.playgroundIsRunning || this.playgroundIsLoadingThread;
|
|
14629
15629
|
const suggestions = agentId && this._core ? this._core.getSuggestions(agentId).suggestions : [];
|
|
14630
15630
|
const lastAssistantIndex = visibleMessages.reduce((last, message, index) => message.role === "assistant" ? index : last, -1);
|
|
@@ -15112,7 +16112,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
15112
16112
|
this.metadataTelemetryFingerprints.set(props.module, fingerprint);
|
|
15113
16113
|
try {
|
|
15114
16114
|
trackMetadataModuleViewed(props);
|
|
15115
|
-
} catch (
|
|
16115
|
+
} catch (_unused16) {}
|
|
15116
16116
|
}
|
|
15117
16117
|
maybeTrackInspectorMetadataViews() {
|
|
15118
16118
|
var _this$core32, _telemetryContext$gro, _telemetryContext$lea;
|
|
@@ -15408,7 +16408,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
15408
16408
|
const raw = window.localStorage.getItem(THREADS_EXAMPLE_TOUR_STORAGE_KEY);
|
|
15409
16409
|
if (!raw) return false;
|
|
15410
16410
|
return JSON.parse(raw).dismissed === true;
|
|
15411
|
-
} catch (
|
|
16411
|
+
} catch (_unused17) {
|
|
15412
16412
|
return false;
|
|
15413
16413
|
}
|
|
15414
16414
|
}
|
|
@@ -15416,7 +16416,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
15416
16416
|
if (typeof window === "undefined") return;
|
|
15417
16417
|
try {
|
|
15418
16418
|
window.localStorage.setItem(THREADS_EXAMPLE_TOUR_STORAGE_KEY, JSON.stringify({ dismissed: true }));
|
|
15419
|
-
} catch (
|
|
16419
|
+
} catch (_unused18) {}
|
|
15420
16420
|
}
|
|
15421
16421
|
/** Cancels the one deferred gate without disturbing a newer lifecycle. */
|
|
15422
16422
|
cancelThreadsExampleOverviewVideoGate() {
|
|
@@ -15454,7 +16454,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
15454
16454
|
this.threadsExampleOverviewVideoState = "playing";
|
|
15455
16455
|
this.requestUpdate();
|
|
15456
16456
|
}
|
|
15457
|
-
} catch (
|
|
16457
|
+
} catch (_unused19) {
|
|
15458
16458
|
if (this.isCurrentThreadsExampleOverviewVideo(video, lifecycleGeneration) && this.threadsExampleOverviewVideoPlayAttemptGeneration === playAttemptGeneration) this.failThreadsExampleOverviewVideo(video, lifecycleGeneration);
|
|
15459
16459
|
} finally {
|
|
15460
16460
|
if (this.threadsExampleOverviewVideoPlayAttemptGeneration === playAttemptGeneration) this.threadsExampleOverviewVideoPlayPromise = null;
|
|
@@ -15468,7 +16468,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
15468
16468
|
try {
|
|
15469
16469
|
const playback = Promise.resolve(video.play());
|
|
15470
16470
|
this.threadsExampleOverviewVideoPlayPromise = this.settleThreadsExampleOverviewVideoPlay(video, lifecycleGeneration, playAttemptGeneration, playback);
|
|
15471
|
-
} catch (
|
|
16471
|
+
} catch (_unused20) {
|
|
15472
16472
|
this.failThreadsExampleOverviewVideo(video, lifecycleGeneration);
|
|
15473
16473
|
}
|
|
15474
16474
|
}
|
|
@@ -15561,11 +16561,11 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
15561
16561
|
if (video) {
|
|
15562
16562
|
try {
|
|
15563
16563
|
video.pause();
|
|
15564
|
-
} catch (
|
|
16564
|
+
} catch (_unused21) {}
|
|
15565
16565
|
video.removeAttribute("src");
|
|
15566
16566
|
try {
|
|
15567
16567
|
video.load();
|
|
15568
|
-
} catch (
|
|
16568
|
+
} catch (_unused22) {}
|
|
15569
16569
|
}
|
|
15570
16570
|
this.threadsExampleOverviewVideoLoaded = false;
|
|
15571
16571
|
this.threadsExampleOverviewVideoState = "deferred";
|
|
@@ -16099,9 +17099,9 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
16099
17099
|
`;
|
|
16100
17100
|
}
|
|
16101
17101
|
renderThreadsView() {
|
|
16102
|
-
var _this$
|
|
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;
|
|
16103
17103
|
const { displayThreads, threadsErrorMessage, threadsLoading } = this.getActiveThreadsState();
|
|
16104
|
-
const ephemeral = !((_this$
|
|
17104
|
+
const ephemeral = !((_this$_core22 = this._core) === null || _this$_core22 === void 0 ? void 0 : _this$_core22.intelligence);
|
|
16105
17105
|
const available = this.areThreadEndpointsAvailable();
|
|
16106
17106
|
const hasEphemeralThreads = ephemeral && available && displayThreads.length > 0;
|
|
16107
17107
|
if (!ephemeral) this.ephemeralThreadsSetupOpen = false;
|
|
@@ -16239,10 +17239,10 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
16239
17239
|
.threadId=${selectedThread.id}
|
|
16240
17240
|
.thread=${selectedThread}
|
|
16241
17241
|
.provider=${selectedThreadIsLocalExample ? this.getExampleThreadProvider(selectedThread.id) : null}
|
|
16242
|
-
.runtimeUrl=${selectedThreadIsLocalExample ? "" : (_this$_core$runtimeUr2 = (_this$
|
|
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 : ""}
|
|
16243
17243
|
.resolveHeaders=${this.resolveCoreHeaders}
|
|
16244
|
-
.headersGeneration=${(_this$_core$ɵheaders = (_this$
|
|
16245
|
-
.threadInspectionAvailable=${selectedThreadIsLocalExample || this.areThreadEndpointsAvailable() && ((_this$
|
|
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}
|
|
16246
17246
|
.liveMessageVersion=${(_this$liveMessageVers2 = this.liveMessageVersion.get(selectedThread.id)) !== null && _this$liveMessageVers2 !== void 0 ? _this$liveMessageVers2 : 0}
|
|
16247
17247
|
.viewInAppMode=${this.getViewInAppMode(selectedThread, selectedThreadIsLocalExample)}
|
|
16248
17248
|
.viewInAppError=${this.viewInAppError}
|
|
@@ -16253,7 +17253,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
16253
17253
|
.agentStateInput=${this.getLatestStateForAgent(selectedThread.agentId)}
|
|
16254
17254
|
.agentEventsInput=${(_this$agentEvents$get6 = this.agentEvents.get(selectedThread.agentId)) !== null && _this$agentEvents$get6 !== void 0 ? _this$agentEvents$get6 : []}
|
|
16255
17255
|
.agentMessagesInput=${selectedThreadIsLocalExample ? EMPTY_INSPECTOR_MESSAGES : this.getLiveAgentMessagesForThread(selectedThread)}
|
|
16256
|
-
.tryFromHereAvailable=${!selectedThreadIsLocalExample && this.areThreadEndpointsAvailable() && ((_this$
|
|
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}
|
|
16257
17257
|
.tryFromHereBusy=${this.tryFromHereBusy}
|
|
16258
17258
|
.tryFromHereError=${this.tryFromHereError}
|
|
16259
17259
|
@tryFromHere=${(event) => {
|
|
@@ -18197,7 +19197,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
18197
19197
|
this.notificationDocuments = new Map(documents);
|
|
18198
19198
|
this.notificationFeed = feed;
|
|
18199
19199
|
}
|
|
18200
|
-
} catch (
|
|
19200
|
+
} catch (_unused23) {}
|
|
18201
19201
|
this.announcementLoaded = true;
|
|
18202
19202
|
this.refreshNotifications();
|
|
18203
19203
|
this.requestUpdate();
|
|
@@ -18263,7 +19263,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
18263
19263
|
try {
|
|
18264
19264
|
const url = new URL(href, typeof window !== "undefined" ? window.location.href : "https://copilotkit.ai");
|
|
18265
19265
|
return url.protocol === "http:" || url.protocol === "https:" || url.protocol === "mailto:";
|
|
18266
|
-
} catch (
|
|
19266
|
+
} catch (_unused24) {
|
|
18267
19267
|
return false;
|
|
18268
19268
|
}
|
|
18269
19269
|
}
|
|
@@ -18293,7 +19293,7 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(parsed))}</pre
|
|
|
18293
19293
|
}
|
|
18294
19294
|
if (isRootRelative) return `${url.pathname}${url.search}${url.hash}`;
|
|
18295
19295
|
return url.toString();
|
|
18296
|
-
} catch (
|
|
19296
|
+
} catch (_unused25) {
|
|
18297
19297
|
return href;
|
|
18298
19298
|
}
|
|
18299
19299
|
}
|