@copilotkit/web-inspector 1.62.2 → 1.62.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +736 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +28 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +738 -4
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +762 -23
- package/dist/index.umd.js.map +1 -1
- package/dist/lib/telemetry.cjs +7 -2
- package/dist/lib/telemetry.cjs.map +1 -1
- package/dist/lib/telemetry.mjs +7 -3
- package/dist/lib/telemetry.mjs.map +1 -1
- package/dist/package.cjs +1 -1
- package/dist/package.mjs +1 -1
- package/package.json +2 -2
- package/src/__tests__/web-inspector.spec.ts +1054 -0
- package/src/index.ts +871 -1
- package/src/lib/telemetry.ts +18 -1
- package/src/styles/generated.css +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2628,16 +2628,365 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
2628
2628
|
`;
|
|
2629
2629
|
}
|
|
2630
2630
|
};
|
|
2631
|
+
var CpkMemoryList = class extends lit.LitElement {
|
|
2632
|
+
constructor(..._args3) {
|
|
2633
|
+
super(..._args3);
|
|
2634
|
+
this.memories = [];
|
|
2635
|
+
this.search = "";
|
|
2636
|
+
this.kind = "all";
|
|
2637
|
+
this.onSearchInput = (event) => {
|
|
2638
|
+
this.search = event.target.value;
|
|
2639
|
+
};
|
|
2640
|
+
this.onKindClick = (event) => {
|
|
2641
|
+
const seg = event.target.closest("[data-kind]");
|
|
2642
|
+
if (!seg) return;
|
|
2643
|
+
this.kind = seg.dataset["kind"];
|
|
2644
|
+
};
|
|
2645
|
+
}
|
|
2646
|
+
static {
|
|
2647
|
+
this.properties = {
|
|
2648
|
+
memories: { attribute: false },
|
|
2649
|
+
search: { state: true },
|
|
2650
|
+
kind: { state: true }
|
|
2651
|
+
};
|
|
2652
|
+
}
|
|
2653
|
+
static {
|
|
2654
|
+
this.styles = lit.css`
|
|
2655
|
+
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600&family=Spline+Sans+Mono:wght@400;500&display=swap");
|
|
2656
|
+
|
|
2657
|
+
:host {
|
|
2658
|
+
display: flex;
|
|
2659
|
+
flex-direction: column;
|
|
2660
|
+
height: 100%;
|
|
2661
|
+
overflow: hidden;
|
|
2662
|
+
}
|
|
2663
|
+
|
|
2664
|
+
.cpk-ml {
|
|
2665
|
+
font-family: "Plus Jakarta Sans", sans-serif;
|
|
2666
|
+
display: flex;
|
|
2667
|
+
flex-direction: column;
|
|
2668
|
+
height: 100%;
|
|
2669
|
+
overflow: hidden;
|
|
2670
|
+
background: #f7f7f9;
|
|
2671
|
+
}
|
|
2672
|
+
|
|
2673
|
+
/* ── Search ── */
|
|
2674
|
+
.cpk-ml__search {
|
|
2675
|
+
padding: 10px 12px;
|
|
2676
|
+
border-bottom: 1px solid #dbdbe5;
|
|
2677
|
+
flex-shrink: 0;
|
|
2678
|
+
}
|
|
2679
|
+
|
|
2680
|
+
.cpk-ml__search-input {
|
|
2681
|
+
width: 100%;
|
|
2682
|
+
box-sizing: border-box;
|
|
2683
|
+
font-family: "Plus Jakarta Sans", sans-serif;
|
|
2684
|
+
font-size: 12px;
|
|
2685
|
+
padding: 7px 10px;
|
|
2686
|
+
border-radius: 6px;
|
|
2687
|
+
border: 1px solid #dbdbe5;
|
|
2688
|
+
background: #ffffff;
|
|
2689
|
+
color: #010507;
|
|
2690
|
+
outline: none;
|
|
2691
|
+
transition: border-color 0.15s;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
.cpk-ml__search-input:focus {
|
|
2695
|
+
border-color: #bec2ff;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
/* ── Kind filter ── */
|
|
2699
|
+
.cpk-ml__filter {
|
|
2700
|
+
display: flex;
|
|
2701
|
+
gap: 4px;
|
|
2702
|
+
padding: 8px 12px;
|
|
2703
|
+
border-bottom: 1px solid #dbdbe5;
|
|
2704
|
+
flex-shrink: 0;
|
|
2705
|
+
flex-wrap: wrap;
|
|
2706
|
+
}
|
|
2707
|
+
|
|
2708
|
+
.cpk-ml__filter-seg {
|
|
2709
|
+
font-family: "Plus Jakarta Sans", sans-serif;
|
|
2710
|
+
font-size: 11px;
|
|
2711
|
+
font-weight: 500;
|
|
2712
|
+
padding: 3px 9px;
|
|
2713
|
+
border-radius: 5px;
|
|
2714
|
+
border: 1px solid #dbdbe5;
|
|
2715
|
+
background: #ffffff;
|
|
2716
|
+
color: #57575b;
|
|
2717
|
+
cursor: pointer;
|
|
2718
|
+
transition:
|
|
2719
|
+
background 0.1s,
|
|
2720
|
+
border-color 0.1s,
|
|
2721
|
+
color 0.1s;
|
|
2722
|
+
user-select: none;
|
|
2723
|
+
}
|
|
2724
|
+
|
|
2725
|
+
.cpk-ml__filter-seg:hover {
|
|
2726
|
+
background: #f0f0f5;
|
|
2727
|
+
}
|
|
2728
|
+
|
|
2729
|
+
.cpk-ml__filter-seg--active {
|
|
2730
|
+
background: #bec2ff1a;
|
|
2731
|
+
border-color: #bec2ff;
|
|
2732
|
+
color: #010507;
|
|
2733
|
+
}
|
|
2734
|
+
|
|
2735
|
+
.cpk-ml__filter-count {
|
|
2736
|
+
font-family: "Spline Sans Mono", monospace;
|
|
2737
|
+
font-size: 9px;
|
|
2738
|
+
margin-left: 4px;
|
|
2739
|
+
color: #838389;
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
/* ── List ── */
|
|
2743
|
+
.cpk-ml__list {
|
|
2744
|
+
flex: 1;
|
|
2745
|
+
overflow-y: auto;
|
|
2746
|
+
padding: 8px 12px;
|
|
2747
|
+
display: flex;
|
|
2748
|
+
flex-direction: column;
|
|
2749
|
+
gap: 8px;
|
|
2750
|
+
}
|
|
2751
|
+
|
|
2752
|
+
/* ── Card ── */
|
|
2753
|
+
.cpk-ml__card {
|
|
2754
|
+
background: #ffffff;
|
|
2755
|
+
border: 1px solid #e9e9ef;
|
|
2756
|
+
border-radius: 8px;
|
|
2757
|
+
padding: 10px 12px;
|
|
2758
|
+
display: flex;
|
|
2759
|
+
flex-direction: column;
|
|
2760
|
+
gap: 6px;
|
|
2761
|
+
}
|
|
2762
|
+
|
|
2763
|
+
.cpk-ml__card-badges {
|
|
2764
|
+
display: flex;
|
|
2765
|
+
gap: 6px;
|
|
2766
|
+
align-items: center;
|
|
2767
|
+
flex-wrap: wrap;
|
|
2768
|
+
}
|
|
2769
|
+
|
|
2770
|
+
/* Kind badge — color per kind */
|
|
2771
|
+
.cpk-ml__kind-badge {
|
|
2772
|
+
font-family: "Spline Sans Mono", monospace;
|
|
2773
|
+
font-size: 9px;
|
|
2774
|
+
padding: 1px 7px;
|
|
2775
|
+
border-radius: 4px;
|
|
2776
|
+
text-transform: uppercase;
|
|
2777
|
+
font-weight: 500;
|
|
2778
|
+
white-space: nowrap;
|
|
2779
|
+
}
|
|
2780
|
+
|
|
2781
|
+
.cpk-ml__kind-badge--topical {
|
|
2782
|
+
background: #eee6fe;
|
|
2783
|
+
color: #57575b;
|
|
2784
|
+
}
|
|
2785
|
+
|
|
2786
|
+
.cpk-ml__kind-badge--episodic {
|
|
2787
|
+
background: #e6f4fe;
|
|
2788
|
+
color: #2d5f80;
|
|
2789
|
+
}
|
|
2790
|
+
|
|
2791
|
+
.cpk-ml__kind-badge--operational {
|
|
2792
|
+
background: #e6feee;
|
|
2793
|
+
color: #2d6645;
|
|
2794
|
+
}
|
|
2795
|
+
|
|
2796
|
+
/* Scope badge */
|
|
2797
|
+
.cpk-ml__scope-badge {
|
|
2798
|
+
font-family: "Spline Sans Mono", monospace;
|
|
2799
|
+
font-size: 9px;
|
|
2800
|
+
padding: 1px 7px;
|
|
2801
|
+
border-radius: 4px;
|
|
2802
|
+
text-transform: uppercase;
|
|
2803
|
+
font-weight: 500;
|
|
2804
|
+
white-space: nowrap;
|
|
2805
|
+
background: #f0f0f5;
|
|
2806
|
+
color: #838389;
|
|
2807
|
+
}
|
|
2808
|
+
|
|
2809
|
+
/* Content */
|
|
2810
|
+
.cpk-ml__content {
|
|
2811
|
+
font-size: 12px;
|
|
2812
|
+
color: #010507;
|
|
2813
|
+
line-height: 1.5;
|
|
2814
|
+
word-break: break-word;
|
|
2815
|
+
}
|
|
2816
|
+
|
|
2817
|
+
/* Footer */
|
|
2818
|
+
.cpk-ml__footer {
|
|
2819
|
+
display: flex;
|
|
2820
|
+
align-items: center;
|
|
2821
|
+
justify-content: space-between;
|
|
2822
|
+
gap: 8px;
|
|
2823
|
+
margin-top: 2px;
|
|
2824
|
+
}
|
|
2825
|
+
|
|
2826
|
+
.cpk-ml__footer-threads {
|
|
2827
|
+
font-size: 10px;
|
|
2828
|
+
color: #838389;
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
.cpk-ml__footer-id {
|
|
2832
|
+
font-family: "Spline Sans Mono", monospace;
|
|
2833
|
+
font-size: 9px;
|
|
2834
|
+
color: #c0c0c8;
|
|
2835
|
+
}
|
|
2836
|
+
|
|
2837
|
+
/* ── Empty state ── */
|
|
2838
|
+
.cpk-ml__empty {
|
|
2839
|
+
padding: 32px 16px;
|
|
2840
|
+
text-align: center;
|
|
2841
|
+
color: #838389;
|
|
2842
|
+
font-size: 12px;
|
|
2843
|
+
display: flex;
|
|
2844
|
+
flex-direction: column;
|
|
2845
|
+
align-items: center;
|
|
2846
|
+
gap: 8px;
|
|
2847
|
+
}
|
|
2848
|
+
|
|
2849
|
+
.cpk-ml__empty-icon {
|
|
2850
|
+
color: #c0c0c8;
|
|
2851
|
+
}
|
|
2852
|
+
`;
|
|
2853
|
+
}
|
|
2854
|
+
/** Memories that pass the current text search (before kind filter). */
|
|
2855
|
+
get searchFiltered() {
|
|
2856
|
+
const q = this.search.trim().toLowerCase();
|
|
2857
|
+
if (!q) return this.memories;
|
|
2858
|
+
return this.memories.filter((m) => m.content.toLowerCase().includes(q));
|
|
2859
|
+
}
|
|
2860
|
+
/** Memories that pass both search and kind filter. */
|
|
2861
|
+
get filtered() {
|
|
2862
|
+
const searched = this.searchFiltered;
|
|
2863
|
+
if (this.kind === "all") return searched;
|
|
2864
|
+
return searched.filter((m) => m.kind === this.kind);
|
|
2865
|
+
}
|
|
2866
|
+
/** Count of search-filtered memories for a given kind (for segment labels). */
|
|
2867
|
+
countForKind(kind) {
|
|
2868
|
+
return this.searchFiltered.filter((m) => m.kind === kind).length;
|
|
2869
|
+
}
|
|
2870
|
+
/** Truncate an id to first-4…last-4 characters. */
|
|
2871
|
+
shortId(id) {
|
|
2872
|
+
if (id.length <= 12) return id;
|
|
2873
|
+
return `${id.slice(0, 4)}…${id.slice(-4)}`;
|
|
2874
|
+
}
|
|
2875
|
+
renderKindBadge(kind) {
|
|
2876
|
+
return lit.html`<span class="cpk-ml__kind-badge cpk-ml__kind-badge--${kind}"
|
|
2877
|
+
>${kind}</span
|
|
2878
|
+
>`;
|
|
2879
|
+
}
|
|
2880
|
+
renderEmpty() {
|
|
2881
|
+
const q = this.search.trim();
|
|
2882
|
+
if (this.memories.length === 0) return lit.html`
|
|
2883
|
+
<div class="cpk-ml__empty">
|
|
2884
|
+
<svg
|
|
2885
|
+
width="24"
|
|
2886
|
+
height="24"
|
|
2887
|
+
viewBox="0 0 24 24"
|
|
2888
|
+
fill="none"
|
|
2889
|
+
stroke="currentColor"
|
|
2890
|
+
stroke-width="1.5"
|
|
2891
|
+
stroke-linecap="round"
|
|
2892
|
+
stroke-linejoin="round"
|
|
2893
|
+
class="cpk-ml__empty-icon"
|
|
2894
|
+
>
|
|
2895
|
+
<ellipse cx="12" cy="5" rx="9" ry="3" />
|
|
2896
|
+
<path d="M21 12c0 1.66-4 3-9 3s-9-1.34-9-3" />
|
|
2897
|
+
<path d="M3 5v14c0 1.66 4 3 9 3s9-1.34 9-3V5" />
|
|
2898
|
+
</svg>
|
|
2899
|
+
No memories yet — tell the agent a durable fact and watch it appear.
|
|
2900
|
+
</div>
|
|
2901
|
+
`;
|
|
2902
|
+
if (q) return lit.html`
|
|
2903
|
+
<div class="cpk-ml__empty">
|
|
2904
|
+
No memories match “${q}”.
|
|
2905
|
+
</div>
|
|
2906
|
+
`;
|
|
2907
|
+
return lit.html`
|
|
2908
|
+
<div class="cpk-ml__empty">No ${this.kind} memories yet.</div>
|
|
2909
|
+
`;
|
|
2910
|
+
}
|
|
2911
|
+
render() {
|
|
2912
|
+
const filtered = this.filtered;
|
|
2913
|
+
return lit.html`
|
|
2914
|
+
<div class="cpk-ml">
|
|
2915
|
+
<!-- Search -->
|
|
2916
|
+
<div class="cpk-ml__search">
|
|
2917
|
+
<input
|
|
2918
|
+
type="text"
|
|
2919
|
+
placeholder="Search memories…"
|
|
2920
|
+
.value=${this.search}
|
|
2921
|
+
@input=${this.onSearchInput}
|
|
2922
|
+
class="cpk-ml__search-input"
|
|
2923
|
+
/>
|
|
2924
|
+
</div>
|
|
2925
|
+
|
|
2926
|
+
<!-- Kind filter -->
|
|
2927
|
+
<div class="cpk-ml__filter" @click=${this.onKindClick}>
|
|
2928
|
+
<button
|
|
2929
|
+
class="cpk-ml__filter-seg ${this.kind === "all" ? "cpk-ml__filter-seg--active" : ""}"
|
|
2930
|
+
data-kind="all"
|
|
2931
|
+
>
|
|
2932
|
+
All<span class="cpk-ml__filter-count">${this.searchFiltered.length}</span>
|
|
2933
|
+
</button>
|
|
2934
|
+
${[
|
|
2935
|
+
"topical",
|
|
2936
|
+
"episodic",
|
|
2937
|
+
"operational"
|
|
2938
|
+
].map((k) => lit.html`
|
|
2939
|
+
<button
|
|
2940
|
+
class="cpk-ml__filter-seg ${this.kind === k ? "cpk-ml__filter-seg--active" : ""}"
|
|
2941
|
+
data-kind="${k}"
|
|
2942
|
+
>
|
|
2943
|
+
${k}<span class="cpk-ml__filter-count">${this.countForKind(k)}</span>
|
|
2944
|
+
</button>
|
|
2945
|
+
`)}
|
|
2946
|
+
</div>
|
|
2947
|
+
|
|
2948
|
+
<!-- Memory list -->
|
|
2949
|
+
<div class="cpk-ml__list">
|
|
2950
|
+
${filtered.map((m) => lit.html`
|
|
2951
|
+
<div class="cpk-ml__card">
|
|
2952
|
+
<div class="cpk-ml__card-badges">
|
|
2953
|
+
${this.renderKindBadge(m.kind)}
|
|
2954
|
+
<span class="cpk-ml__scope-badge">${m.scope}</span>
|
|
2955
|
+
</div>
|
|
2956
|
+
<div class="cpk-ml__content">${m.content}</div>
|
|
2957
|
+
<div class="cpk-ml__footer">
|
|
2958
|
+
<span class="cpk-ml__footer-threads"
|
|
2959
|
+
>${m.sourceThreadIds.length} source thread${m.sourceThreadIds.length === 1 ? "" : "s"}</span
|
|
2960
|
+
>
|
|
2961
|
+
<span class="cpk-ml__footer-id">${this.shortId(m.id)}</span>
|
|
2962
|
+
</div>
|
|
2963
|
+
</div>
|
|
2964
|
+
`)}
|
|
2965
|
+
${filtered.length === 0 ? this.renderEmpty() : lit.nothing}
|
|
2966
|
+
</div>
|
|
2967
|
+
</div>
|
|
2968
|
+
`;
|
|
2969
|
+
}
|
|
2970
|
+
};
|
|
2631
2971
|
var ɵCpkThreadDetails = class extends CpkThreadInspector {};
|
|
2632
2972
|
if (!customElements.get("cpk-thread-list")) customElements.define("cpk-thread-list", CpkThreadList);
|
|
2633
2973
|
if (!customElements.get(THREAD_INSPECTOR_TAG)) customElements.define(THREAD_INSPECTOR_TAG, CpkThreadInspector);
|
|
2634
2974
|
if (!customElements.get("cpk-thread-details")) customElements.define("cpk-thread-details", ɵCpkThreadDetails);
|
|
2975
|
+
if (!customElements.get("cpk-memory-list")) customElements.define("cpk-memory-list", CpkMemoryList);
|
|
2635
2976
|
var WebInspectorElement = class extends lit.LitElement {
|
|
2636
|
-
constructor(...
|
|
2637
|
-
super(...
|
|
2977
|
+
constructor(..._args4) {
|
|
2978
|
+
super(..._args4);
|
|
2638
2979
|
this._core = null;
|
|
2639
2980
|
this.coreSubscriber = null;
|
|
2640
2981
|
this.coreUnsubscribe = null;
|
|
2982
|
+
this._memories = [];
|
|
2983
|
+
this._memoriesLoading = false;
|
|
2984
|
+
this._memoriesError = null;
|
|
2985
|
+
this._memoriesAvailable = true;
|
|
2986
|
+
this._memoriesRealtimeStatus = "connecting";
|
|
2987
|
+
this._memoryUnsub = null;
|
|
2988
|
+
this._memorySubscribed = false;
|
|
2989
|
+
this._memoryStoreUnsupported = false;
|
|
2641
2990
|
this.runtimeStatus = null;
|
|
2642
2991
|
this.coreProperties = {};
|
|
2643
2992
|
this.lastCoreError = null;
|
|
@@ -3053,6 +3402,11 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
3053
3402
|
key: "threads",
|
|
3054
3403
|
label: "Threads",
|
|
3055
3404
|
icon: "MessageSquare"
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
key: "memories",
|
|
3408
|
+
label: "Learning",
|
|
3409
|
+
icon: "Brain"
|
|
3056
3410
|
}
|
|
3057
3411
|
];
|
|
3058
3412
|
}
|
|
@@ -3078,6 +3432,13 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
3078
3432
|
...extra
|
|
3079
3433
|
};
|
|
3080
3434
|
}
|
|
3435
|
+
getMemoriesTelemetryProps() {
|
|
3436
|
+
return {
|
|
3437
|
+
posthog_distinct_id: (!this.core?.telemetryDisabled ? require_telemetry.getTelemetryDistinctIdForUrl() : null) ?? void 0,
|
|
3438
|
+
memory_count: this._memories.length,
|
|
3439
|
+
available: this._memoriesAvailable
|
|
3440
|
+
};
|
|
3441
|
+
}
|
|
3081
3442
|
getIntelligenceSignupUrl() {
|
|
3082
3443
|
return this.appendRefParam(INTELLIGENCE_SIGNUP_URL, "cpk-inspector");
|
|
3083
3444
|
}
|
|
@@ -3242,12 +3603,75 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
3242
3603
|
const threadStores = typeof core.getThreadStores === "function" ? core.getThreadStores() : {};
|
|
3243
3604
|
for (const [agentId, store] of Object.entries(threadStores)) this.subscribeToThreadStore(agentId, store);
|
|
3244
3605
|
if (core.context) this.contextStore = this.normalizeContextStore(core.context);
|
|
3606
|
+
if (this.selectedMenu === "memories") this.ensureMemorySubscription();
|
|
3607
|
+
}
|
|
3608
|
+
/**
|
|
3609
|
+
* Lazily subscribes to the singleton memory store the first time the user
|
|
3610
|
+
* activates the Memories tab. This is deferred out of `attachToCore` because
|
|
3611
|
+
* `core.getMemoryStore()` is what creates + starts the store and opens
|
|
3612
|
+
* realtime — doing it on attach would start memory for apps that never use
|
|
3613
|
+
* it. Idempotent: repeated tab activations are guarded by
|
|
3614
|
+
* `_memorySubscribed`. On an older @copilotkit/core without `getMemoryStore`,
|
|
3615
|
+
* records the unsupported state so the teaser can guide an SDK upgrade.
|
|
3616
|
+
*/
|
|
3617
|
+
ensureMemorySubscription() {
|
|
3618
|
+
if (this._memorySubscribed) return;
|
|
3619
|
+
const core = this._core;
|
|
3620
|
+
if (!core) return;
|
|
3621
|
+
if (typeof core.getMemoryStore !== "function") {
|
|
3622
|
+
this._memoryStoreUnsupported = true;
|
|
3623
|
+
this._memoriesAvailable = false;
|
|
3624
|
+
this.requestUpdate();
|
|
3625
|
+
return;
|
|
3626
|
+
}
|
|
3627
|
+
this._memorySubscribed = true;
|
|
3628
|
+
this._memoryStoreUnsupported = false;
|
|
3629
|
+
const memoryStore = core.getMemoryStore();
|
|
3630
|
+
const ms = memoryStore.getState();
|
|
3631
|
+
this._memories = (0, _copilotkit_core.ɵselectMemories)(ms);
|
|
3632
|
+
this._memoriesLoading = (0, _copilotkit_core.ɵselectMemoriesIsLoading)(ms);
|
|
3633
|
+
this._memoriesError = (0, _copilotkit_core.ɵselectMemoriesError)(ms);
|
|
3634
|
+
this._memoriesAvailable = (0, _copilotkit_core.ɵselectMemoriesAvailable)(ms);
|
|
3635
|
+
this._memoriesRealtimeStatus = (0, _copilotkit_core.ɵselectMemoriesRealtimeStatus)(ms);
|
|
3636
|
+
const memSubs = [
|
|
3637
|
+
memoryStore.select(_copilotkit_core.ɵselectMemories).subscribe((v) => {
|
|
3638
|
+
this._memories = v;
|
|
3639
|
+
this.requestUpdate();
|
|
3640
|
+
}),
|
|
3641
|
+
memoryStore.select(_copilotkit_core.ɵselectMemoriesIsLoading).subscribe((v) => {
|
|
3642
|
+
this._memoriesLoading = v;
|
|
3643
|
+
this.requestUpdate();
|
|
3644
|
+
}),
|
|
3645
|
+
memoryStore.select(_copilotkit_core.ɵselectMemoriesError).subscribe((v) => {
|
|
3646
|
+
this._memoriesError = v;
|
|
3647
|
+
this.requestUpdate();
|
|
3648
|
+
}),
|
|
3649
|
+
memoryStore.select(_copilotkit_core.ɵselectMemoriesAvailable).subscribe((v) => {
|
|
3650
|
+
this._memoriesAvailable = v;
|
|
3651
|
+
this.requestUpdate();
|
|
3652
|
+
}),
|
|
3653
|
+
memoryStore.select(_copilotkit_core.ɵselectMemoriesRealtimeStatus).subscribe((v) => {
|
|
3654
|
+
this._memoriesRealtimeStatus = v;
|
|
3655
|
+
this.requestUpdate();
|
|
3656
|
+
})
|
|
3657
|
+
];
|
|
3658
|
+
this._memoryUnsub = () => memSubs.forEach((s) => s.unsubscribe());
|
|
3659
|
+
this.requestUpdate();
|
|
3245
3660
|
}
|
|
3246
3661
|
detachFromCore() {
|
|
3247
3662
|
if (this.coreUnsubscribe) {
|
|
3248
3663
|
this.coreUnsubscribe();
|
|
3249
3664
|
this.coreUnsubscribe = null;
|
|
3250
3665
|
}
|
|
3666
|
+
this._memoryUnsub?.();
|
|
3667
|
+
this._memoryUnsub = null;
|
|
3668
|
+
this._memories = [];
|
|
3669
|
+
this._memoriesLoading = false;
|
|
3670
|
+
this._memoriesError = null;
|
|
3671
|
+
this._memoriesAvailable = true;
|
|
3672
|
+
this._memoriesRealtimeStatus = "connecting";
|
|
3673
|
+
this._memorySubscribed = false;
|
|
3674
|
+
this._memoryStoreUnsupported = false;
|
|
3251
3675
|
this.coreSubscriber = null;
|
|
3252
3676
|
this.runtimeStatus = null;
|
|
3253
3677
|
this.lastCoreError = null;
|
|
@@ -4470,6 +4894,7 @@ ${argsString}</pre
|
|
|
4470
4894
|
y: EDGE_MARGIN
|
|
4471
4895
|
};
|
|
4472
4896
|
this.hydrateStateFromStorage();
|
|
4897
|
+
if (this.selectedMenu === "memories") this.ensureMemorySubscription();
|
|
4473
4898
|
if (this.isOpen && this.dockMode !== "floating") this.applyDockStyles(true);
|
|
4474
4899
|
this.applyAnchorPosition("button");
|
|
4475
4900
|
if (this.dockMode === "floating") if (this.hasCustomPosition.window) this.applyAnchorPosition("window");
|
|
@@ -5165,6 +5590,7 @@ ${argsString}</pre
|
|
|
5165
5590
|
if (this.selectedMenu === "frontend-tools") return this.renderToolsView();
|
|
5166
5591
|
if (this.selectedMenu === "agent-context") return this.renderContextView();
|
|
5167
5592
|
if (this.selectedMenu === "threads") return this.renderThreadsView();
|
|
5593
|
+
if (this.selectedMenu === "memories") return this.renderMemoriesView();
|
|
5168
5594
|
if (this.selectedMenu === "settings") return this.renderSettingsPanel();
|
|
5169
5595
|
return lit.nothing;
|
|
5170
5596
|
}
|
|
@@ -5516,6 +5942,310 @@ ${argsString}</pre
|
|
|
5516
5942
|
</div>
|
|
5517
5943
|
</div>
|
|
5518
5944
|
</div>
|
|
5945
|
+
`;
|
|
5946
|
+
}
|
|
5947
|
+
/**
|
|
5948
|
+
* Renders the realtime-connection indicator in the memory-store header.
|
|
5949
|
+
* Only `"connected"` shows the live (green-dot) state; `"connecting"` shows a
|
|
5950
|
+
* muted amber "reconnecting" and `"unavailable"` a muted grey "offline", so
|
|
5951
|
+
* the indicator never claims "live" over a frozen snapshot once the realtime
|
|
5952
|
+
* socket has permanently given up.
|
|
5953
|
+
*/
|
|
5954
|
+
renderMemoryRealtimeIndicator() {
|
|
5955
|
+
const status = this._memoriesRealtimeStatus;
|
|
5956
|
+
const connected = status === "connected";
|
|
5957
|
+
return lit.html`
|
|
5958
|
+
<span
|
|
5959
|
+
style="
|
|
5960
|
+
display: inline-flex;
|
|
5961
|
+
align-items: center;
|
|
5962
|
+
gap: 4px;
|
|
5963
|
+
font-size: 10px;
|
|
5964
|
+
font-weight: 500;
|
|
5965
|
+
color: ${connected ? "#57575b" : "#838389"};
|
|
5966
|
+
"
|
|
5967
|
+
>
|
|
5968
|
+
<span
|
|
5969
|
+
style="
|
|
5970
|
+
display: inline-block;
|
|
5971
|
+
width: 6px;
|
|
5972
|
+
height: 6px;
|
|
5973
|
+
border-radius: 50%;
|
|
5974
|
+
background: ${connected ? "#22c55e" : status === "connecting" ? "#f59e0b" : "#9ca3af"};
|
|
5975
|
+
"
|
|
5976
|
+
></span>
|
|
5977
|
+
${status === "connected" ? "live" : status === "connecting" ? "reconnecting" : "offline"}
|
|
5978
|
+
</span>
|
|
5979
|
+
`;
|
|
5980
|
+
}
|
|
5981
|
+
renderMemoriesView() {
|
|
5982
|
+
if (!this.core?.intelligence || !this._memoriesAvailable) return lit.html`
|
|
5983
|
+
<div
|
|
5984
|
+
style="
|
|
5985
|
+
position: relative;
|
|
5986
|
+
height: 100%;
|
|
5987
|
+
display: flex;
|
|
5988
|
+
align-items: center;
|
|
5989
|
+
justify-content: center;
|
|
5990
|
+
padding: 32px;
|
|
5991
|
+
overflow: hidden;
|
|
5992
|
+
background: #ffffff;
|
|
5993
|
+
"
|
|
5994
|
+
>
|
|
5995
|
+
${this.renderThreadsLockedBackgroundMockup()}
|
|
5996
|
+
<div
|
|
5997
|
+
aria-hidden="true"
|
|
5998
|
+
style="
|
|
5999
|
+
position: absolute;
|
|
6000
|
+
inset: 0;
|
|
6001
|
+
pointer-events: none;
|
|
6002
|
+
background:
|
|
6003
|
+
radial-gradient(circle at center, rgba(255,255,255,0.9) 0, rgba(255,255,255,0.78) 24%, rgba(255,255,255,0.34) 48%, rgba(255,255,255,0.56) 100%);
|
|
6004
|
+
"
|
|
6005
|
+
></div>
|
|
6006
|
+
<div
|
|
6007
|
+
style="
|
|
6008
|
+
position: relative;
|
|
6009
|
+
z-index: 1;
|
|
6010
|
+
max-width: 440px;
|
|
6011
|
+
text-align: center;
|
|
6012
|
+
color: #57575b;
|
|
6013
|
+
"
|
|
6014
|
+
>
|
|
6015
|
+
<div
|
|
6016
|
+
aria-hidden="true"
|
|
6017
|
+
style="
|
|
6018
|
+
margin: 0 auto 18px;
|
|
6019
|
+
display: flex;
|
|
6020
|
+
justify-content: center;
|
|
6021
|
+
"
|
|
6022
|
+
>
|
|
6023
|
+
<div
|
|
6024
|
+
style="
|
|
6025
|
+
display: flex;
|
|
6026
|
+
height: 44px;
|
|
6027
|
+
width: 44px;
|
|
6028
|
+
align-items: center;
|
|
6029
|
+
justify-content: center;
|
|
6030
|
+
border: 1px solid #dfd6fb;
|
|
6031
|
+
border-radius: 8px;
|
|
6032
|
+
background: #eee6fe;
|
|
6033
|
+
color: #57575b;
|
|
6034
|
+
box-shadow: 0 8px 18px rgba(87, 87, 91, 0.14);
|
|
6035
|
+
"
|
|
6036
|
+
>
|
|
6037
|
+
${this.renderIcon("Lock")}
|
|
6038
|
+
</div>
|
|
6039
|
+
</div>
|
|
6040
|
+
<h2
|
|
6041
|
+
style="
|
|
6042
|
+
margin: 0 0 8px;
|
|
6043
|
+
font-size: 16px;
|
|
6044
|
+
line-height: 1.35;
|
|
6045
|
+
font-weight: 600;
|
|
6046
|
+
color: #010507;
|
|
6047
|
+
"
|
|
6048
|
+
>
|
|
6049
|
+
Long-term memory
|
|
6050
|
+
</h2>
|
|
6051
|
+
<p
|
|
6052
|
+
style="
|
|
6053
|
+
margin: 0 auto 18px;
|
|
6054
|
+
max-width: 380px;
|
|
6055
|
+
font-size: 13px;
|
|
6056
|
+
line-height: 1.55;
|
|
6057
|
+
color: #57575b;
|
|
6058
|
+
"
|
|
6059
|
+
>
|
|
6060
|
+
${this._memoryStoreUnsupported ? "Long-term memory isn't available in this version of the @copilotkit SDK. Upgrade @copilotkit/core (and @copilotkit/react) to a version that supports memory." : "Long-term memory isn't enabled on this deployment."}
|
|
6061
|
+
</p>
|
|
6062
|
+
<div
|
|
6063
|
+
style="
|
|
6064
|
+
display: flex;
|
|
6065
|
+
flex-wrap: wrap;
|
|
6066
|
+
justify-content: center;
|
|
6067
|
+
gap: 8px;
|
|
6068
|
+
"
|
|
6069
|
+
>
|
|
6070
|
+
<a
|
|
6071
|
+
href=${this.getTalkToEngineerUrl()}
|
|
6072
|
+
target="_blank"
|
|
6073
|
+
rel="noopener"
|
|
6074
|
+
style="
|
|
6075
|
+
display: inline-flex;
|
|
6076
|
+
min-height: 34px;
|
|
6077
|
+
align-items: center;
|
|
6078
|
+
justify-content: center;
|
|
6079
|
+
gap: 6px;
|
|
6080
|
+
border-radius: 6px;
|
|
6081
|
+
background: #010507;
|
|
6082
|
+
padding: 8px 12px;
|
|
6083
|
+
font-size: 12px;
|
|
6084
|
+
font-weight: 600;
|
|
6085
|
+
color: #ffffff;
|
|
6086
|
+
text-decoration: none;
|
|
6087
|
+
"
|
|
6088
|
+
@click=${this.handleThreadsTalkToEngineerClick}
|
|
6089
|
+
>
|
|
6090
|
+
Talk to an Engineer
|
|
6091
|
+
</a>
|
|
6092
|
+
<a
|
|
6093
|
+
href=${this.getIntelligenceSignupUrl()}
|
|
6094
|
+
target="_blank"
|
|
6095
|
+
rel="noopener"
|
|
6096
|
+
style="
|
|
6097
|
+
display: inline-flex;
|
|
6098
|
+
min-height: 34px;
|
|
6099
|
+
align-items: center;
|
|
6100
|
+
justify-content: center;
|
|
6101
|
+
gap: 6px;
|
|
6102
|
+
border-radius: 6px;
|
|
6103
|
+
border: 1px solid #dbdbe5;
|
|
6104
|
+
background: #ffffff;
|
|
6105
|
+
padding: 8px 12px;
|
|
6106
|
+
font-size: 12px;
|
|
6107
|
+
font-weight: 600;
|
|
6108
|
+
color: #57575b;
|
|
6109
|
+
text-decoration: none;
|
|
6110
|
+
"
|
|
6111
|
+
@click=${this.handleThreadsIntelligenceSignupClick}
|
|
6112
|
+
>
|
|
6113
|
+
Sign up for Intelligence
|
|
6114
|
+
</a>
|
|
6115
|
+
</div>
|
|
6116
|
+
</div>
|
|
6117
|
+
</div>
|
|
6118
|
+
`;
|
|
6119
|
+
if (this._memoriesError && this._memories.length === 0) return lit.html`
|
|
6120
|
+
<div
|
|
6121
|
+
style="
|
|
6122
|
+
display: flex;
|
|
6123
|
+
height: 100%;
|
|
6124
|
+
flex-direction: column;
|
|
6125
|
+
align-items: center;
|
|
6126
|
+
justify-content: center;
|
|
6127
|
+
gap: 8px;
|
|
6128
|
+
color: #838389;
|
|
6129
|
+
"
|
|
6130
|
+
>
|
|
6131
|
+
<svg
|
|
6132
|
+
width="24"
|
|
6133
|
+
height="24"
|
|
6134
|
+
viewBox="0 0 24 24"
|
|
6135
|
+
fill="none"
|
|
6136
|
+
stroke="#c0333a"
|
|
6137
|
+
stroke-width="1.5"
|
|
6138
|
+
stroke-linecap="round"
|
|
6139
|
+
stroke-linejoin="round"
|
|
6140
|
+
>
|
|
6141
|
+
<circle cx="12" cy="12" r="10" />
|
|
6142
|
+
<line x1="12" y1="8" x2="12" y2="12" />
|
|
6143
|
+
<line x1="12" y1="16" x2="12.01" y2="16" />
|
|
6144
|
+
</svg>
|
|
6145
|
+
<span style="font-size: 13px; color: #c0333a;">
|
|
6146
|
+
Failed to load memories
|
|
6147
|
+
</span>
|
|
6148
|
+
<span
|
|
6149
|
+
style="
|
|
6150
|
+
max-width: 320px;
|
|
6151
|
+
text-align: center;
|
|
6152
|
+
font-size: 11px;
|
|
6153
|
+
line-height: 1.5;
|
|
6154
|
+
color: #c0333a;
|
|
6155
|
+
"
|
|
6156
|
+
>
|
|
6157
|
+
${this._memoriesError.message}
|
|
6158
|
+
</span>
|
|
6159
|
+
</div>
|
|
6160
|
+
`;
|
|
6161
|
+
if (this._memoriesLoading && this._memories.length === 0) return lit.html`
|
|
6162
|
+
<div
|
|
6163
|
+
style="
|
|
6164
|
+
display: flex;
|
|
6165
|
+
height: 100%;
|
|
6166
|
+
flex-direction: column;
|
|
6167
|
+
align-items: center;
|
|
6168
|
+
justify-content: center;
|
|
6169
|
+
gap: 8px;
|
|
6170
|
+
color: #838389;
|
|
6171
|
+
"
|
|
6172
|
+
>
|
|
6173
|
+
<svg
|
|
6174
|
+
width="24"
|
|
6175
|
+
height="24"
|
|
6176
|
+
viewBox="0 0 24 24"
|
|
6177
|
+
fill="none"
|
|
6178
|
+
stroke="#c0c0c8"
|
|
6179
|
+
stroke-width="1.5"
|
|
6180
|
+
stroke-linecap="round"
|
|
6181
|
+
stroke-linejoin="round"
|
|
6182
|
+
>
|
|
6183
|
+
<path d="M21 12a9 9 0 1 1-6.219-8.56" />
|
|
6184
|
+
</svg>
|
|
6185
|
+
<span style="font-size: 13px">Loading memories…</span>
|
|
6186
|
+
</div>
|
|
6187
|
+
`;
|
|
6188
|
+
return lit.html`
|
|
6189
|
+
<div style="display:flex;height:100%;overflow:hidden;flex-direction:column;">
|
|
6190
|
+
<div class="cpk-section-header" style="display:flex;align-items:center;justify-content:space-between;">
|
|
6191
|
+
<h4>Learning</h4>
|
|
6192
|
+
<div style="display:flex;align-items:center;gap:6px;">
|
|
6193
|
+
${this.renderMemoryRealtimeIndicator()}
|
|
6194
|
+
<span
|
|
6195
|
+
style="
|
|
6196
|
+
font-size: 11px;
|
|
6197
|
+
font-weight: 500;
|
|
6198
|
+
color: #57575b;
|
|
6199
|
+
background: rgba(0,0,0,0.07);
|
|
6200
|
+
border-radius: 9999px;
|
|
6201
|
+
padding: 1px 7px;
|
|
6202
|
+
"
|
|
6203
|
+
>
|
|
6204
|
+
${this._memories.length}
|
|
6205
|
+
</span>
|
|
6206
|
+
</div>
|
|
6207
|
+
</div>
|
|
6208
|
+
${this._memoriesError ? lit.html`
|
|
6209
|
+
<div
|
|
6210
|
+
role="alert"
|
|
6211
|
+
style="
|
|
6212
|
+
display: flex;
|
|
6213
|
+
align-items: flex-start;
|
|
6214
|
+
gap: 8px;
|
|
6215
|
+
flex-shrink: 0;
|
|
6216
|
+
border-bottom: 1px solid #f1c7c9;
|
|
6217
|
+
background: #fdf3f3;
|
|
6218
|
+
padding: 8px 12px;
|
|
6219
|
+
color: #c0333a;
|
|
6220
|
+
font-size: 12px;
|
|
6221
|
+
line-height: 1.45;
|
|
6222
|
+
"
|
|
6223
|
+
>
|
|
6224
|
+
<svg
|
|
6225
|
+
width="16"
|
|
6226
|
+
height="16"
|
|
6227
|
+
viewBox="0 0 24 24"
|
|
6228
|
+
fill="none"
|
|
6229
|
+
stroke="#c0333a"
|
|
6230
|
+
stroke-width="1.5"
|
|
6231
|
+
stroke-linecap="round"
|
|
6232
|
+
stroke-linejoin="round"
|
|
6233
|
+
style="flex-shrink:0;margin-top:1px;"
|
|
6234
|
+
>
|
|
6235
|
+
<circle cx="12" cy="12" r="10" />
|
|
6236
|
+
<line x1="12" y1="8" x2="12" y2="12" />
|
|
6237
|
+
<line x1="12" y1="16" x2="12.01" y2="16" />
|
|
6238
|
+
</svg>
|
|
6239
|
+
<span>Action failed: ${this._memoriesError.message}</span>
|
|
6240
|
+
</div>
|
|
6241
|
+
` : lit.nothing}
|
|
6242
|
+
<div style="flex:1;min-height:0;overflow:hidden;">
|
|
6243
|
+
<cpk-memory-list
|
|
6244
|
+
style="height:100%;"
|
|
6245
|
+
.memories=${this._memories}
|
|
6246
|
+
></cpk-memory-list>
|
|
6247
|
+
</div>
|
|
6248
|
+
</div>
|
|
5519
6249
|
`;
|
|
5520
6250
|
}
|
|
5521
6251
|
renderThreadsView() {
|
|
@@ -6135,6 +6865,10 @@ ${prettyEvent}</pre
|
|
|
6135
6865
|
if (previousMenu !== "threads" && !this.core?.telemetryDisabled) require_telemetry.trackThreadsTabClicked(this.getThreadsTelemetryProps());
|
|
6136
6866
|
this.autoSelectLatestThread();
|
|
6137
6867
|
}
|
|
6868
|
+
if (key === "memories") {
|
|
6869
|
+
this.ensureMemorySubscription();
|
|
6870
|
+
if (previousMenu !== "memories" && !this.core?.telemetryDisabled) require_telemetry.trackMemoriesTabClicked(this.getMemoriesTelemetryProps());
|
|
6871
|
+
}
|
|
6138
6872
|
if (key === "ag-ui-events" || key === "agents") requestAnimationFrame(() => {
|
|
6139
6873
|
const scroller = this.shadowRoot?.getElementById("cpk-main-scroll");
|
|
6140
6874
|
if (scroller) scroller.scrollTop = 0;
|