@copilotkit/web-inspector 1.62.1 → 1.62.2-canary.1783457132
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 +975 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +45 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +45 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +977 -26
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1012 -55
- 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 +1150 -1
- package/src/index.ts +1208 -60
- package/src/lib/telemetry.ts +18 -1
- package/src/styles/generated.css +1 -1
package/dist/index.cjs
CHANGED
|
@@ -428,6 +428,8 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
428
428
|
this._stateError = null;
|
|
429
429
|
this._expandedTools = /* @__PURE__ */ new Set();
|
|
430
430
|
this._expandedMessages = /* @__PURE__ */ new Set();
|
|
431
|
+
this._expandedTimelineDetails = /* @__PURE__ */ new Set();
|
|
432
|
+
this._expandedRawEvents = /* @__PURE__ */ new Set();
|
|
431
433
|
this._showDetailPanel = false;
|
|
432
434
|
this._detailPanelWidth = 250;
|
|
433
435
|
this._eventsNotAvailable = false;
|
|
@@ -493,6 +495,8 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
493
495
|
_stateError: { state: true },
|
|
494
496
|
_expandedTools: { state: true },
|
|
495
497
|
_expandedMessages: { state: true },
|
|
498
|
+
_expandedTimelineDetails: { state: true },
|
|
499
|
+
_expandedRawEvents: { state: true },
|
|
496
500
|
_showDetailPanel: { state: true },
|
|
497
501
|
_detailPanelWidth: { state: true },
|
|
498
502
|
_eventsNotAvailable: { state: true },
|
|
@@ -707,6 +711,7 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
707
711
|
|
|
708
712
|
.cpk-td__metadata-strip {
|
|
709
713
|
display: flex;
|
|
714
|
+
align-items: center;
|
|
710
715
|
gap: 6px;
|
|
711
716
|
flex-wrap: wrap;
|
|
712
717
|
padding: 10px 16px;
|
|
@@ -715,6 +720,14 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
715
720
|
flex-shrink: 0;
|
|
716
721
|
}
|
|
717
722
|
|
|
723
|
+
.cpk-td__metadata-pills {
|
|
724
|
+
display: flex;
|
|
725
|
+
gap: 6px;
|
|
726
|
+
flex: 1;
|
|
727
|
+
flex-wrap: wrap;
|
|
728
|
+
min-width: 0;
|
|
729
|
+
}
|
|
730
|
+
|
|
718
731
|
.cpk-td__metadata-pill {
|
|
719
732
|
display: inline-flex;
|
|
720
733
|
align-items: center;
|
|
@@ -1009,13 +1022,44 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
1009
1022
|
}
|
|
1010
1023
|
|
|
1011
1024
|
.cpk-td__timeline-body {
|
|
1012
|
-
|
|
1025
|
+
margin: 0;
|
|
1026
|
+
padding: 0 10px 9px;
|
|
1013
1027
|
font-size: 12px;
|
|
1014
1028
|
line-height: 1.55;
|
|
1015
1029
|
color: #57575b;
|
|
1016
1030
|
white-space: pre-wrap;
|
|
1017
1031
|
word-break: break-word;
|
|
1018
|
-
|
|
1032
|
+
}
|
|
1033
|
+
|
|
1034
|
+
.cpk-td__timeline-toolbar {
|
|
1035
|
+
display: flex;
|
|
1036
|
+
gap: 6px;
|
|
1037
|
+
margin-left: auto;
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
.cpk-td__timeline-bulk-toggle {
|
|
1041
|
+
margin: 0;
|
|
1042
|
+
padding: 4px 8px;
|
|
1043
|
+
border: 1px solid #dcdce8;
|
|
1044
|
+
border-radius: 6px;
|
|
1045
|
+
background: #ffffff;
|
|
1046
|
+
color: #36363a;
|
|
1047
|
+
cursor: pointer;
|
|
1048
|
+
font-family: "Inter", sans-serif;
|
|
1049
|
+
font-size: 11px;
|
|
1050
|
+
font-weight: 600;
|
|
1051
|
+
line-height: 1.2;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
.cpk-td__timeline-bulk-toggle:hover {
|
|
1055
|
+
border-color: rgba(85, 88, 178, 0.38);
|
|
1056
|
+
background: #f7f7ff;
|
|
1057
|
+
color: #010507;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
.cpk-td__timeline-bulk-toggle:disabled {
|
|
1061
|
+
cursor: not-allowed;
|
|
1062
|
+
opacity: 0.45;
|
|
1019
1063
|
}
|
|
1020
1064
|
|
|
1021
1065
|
.cpk-td__source-link {
|
|
@@ -1036,6 +1080,34 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
1036
1080
|
color: #010507;
|
|
1037
1081
|
}
|
|
1038
1082
|
|
|
1083
|
+
.cpk-td__timeline-details-toggle {
|
|
1084
|
+
margin: 0;
|
|
1085
|
+
padding: 5px 10px;
|
|
1086
|
+
border: none;
|
|
1087
|
+
background: #ffffff;
|
|
1088
|
+
color: #5558b2;
|
|
1089
|
+
cursor: pointer;
|
|
1090
|
+
display: inline-flex;
|
|
1091
|
+
align-items: center;
|
|
1092
|
+
gap: 5px;
|
|
1093
|
+
font-family: "Inter", sans-serif;
|
|
1094
|
+
font-size: 12px;
|
|
1095
|
+
font-weight: 600;
|
|
1096
|
+
line-height: 1.2;
|
|
1097
|
+
width: 100%;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
.cpk-td__timeline-details-toggle:hover {
|
|
1101
|
+
background: #f7f7ff;
|
|
1102
|
+
color: #010507;
|
|
1103
|
+
}
|
|
1104
|
+
|
|
1105
|
+
.cpk-td__timeline-details-toggle svg {
|
|
1106
|
+
width: 12px;
|
|
1107
|
+
height: 12px;
|
|
1108
|
+
stroke-width: 2;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1039
1111
|
/* ── Generative UI ──────────────────────────────────────────────── */
|
|
1040
1112
|
@keyframes cpk-genui-enter {
|
|
1041
1113
|
from {
|
|
@@ -1293,6 +1365,8 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
1293
1365
|
this._liveEventsWithSourceIndexCache = null;
|
|
1294
1366
|
this._expandedTools = /* @__PURE__ */ new Set();
|
|
1295
1367
|
this._expandedMessages = /* @__PURE__ */ new Set();
|
|
1368
|
+
this._expandedTimelineDetails = /* @__PURE__ */ new Set();
|
|
1369
|
+
this._expandedRawEvents = /* @__PURE__ */ new Set();
|
|
1296
1370
|
this._metadataAbort?.abort();
|
|
1297
1371
|
this._metadataAbort = null;
|
|
1298
1372
|
this._messagesAbort?.abort();
|
|
@@ -1821,6 +1895,37 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
1821
1895
|
else next.add(id);
|
|
1822
1896
|
this._expandedMessages = next;
|
|
1823
1897
|
}
|
|
1898
|
+
toggleTimelineDetails(id) {
|
|
1899
|
+
const next = new Set(this._expandedTimelineDetails);
|
|
1900
|
+
if (next.has(id)) next.delete(id);
|
|
1901
|
+
else next.add(id);
|
|
1902
|
+
this._expandedTimelineDetails = next;
|
|
1903
|
+
}
|
|
1904
|
+
expandTimelineDetails(ids) {
|
|
1905
|
+
this._expandedTimelineDetails = new Set([...this._expandedTimelineDetails, ...ids]);
|
|
1906
|
+
}
|
|
1907
|
+
collapseTimelineDetails(ids) {
|
|
1908
|
+
const next = new Set(this._expandedTimelineDetails);
|
|
1909
|
+
for (const id of ids) next.delete(id);
|
|
1910
|
+
this._expandedTimelineDetails = next;
|
|
1911
|
+
}
|
|
1912
|
+
toggleRawEventDetails(id) {
|
|
1913
|
+
const next = new Set(this._expandedRawEvents);
|
|
1914
|
+
if (next.has(id)) next.delete(id);
|
|
1915
|
+
else next.add(id);
|
|
1916
|
+
this._expandedRawEvents = next;
|
|
1917
|
+
}
|
|
1918
|
+
expandRawEventDetails(ids) {
|
|
1919
|
+
this._expandedRawEvents = new Set([...this._expandedRawEvents, ...ids]);
|
|
1920
|
+
}
|
|
1921
|
+
collapseRawEventDetails(ids) {
|
|
1922
|
+
const next = new Set(this._expandedRawEvents);
|
|
1923
|
+
for (const id of ids) next.delete(id);
|
|
1924
|
+
this._expandedRawEvents = next;
|
|
1925
|
+
}
|
|
1926
|
+
rawEventId(event) {
|
|
1927
|
+
return `raw-event-${event.sourceIndex ?? event.timestamp ?? event.type}`;
|
|
1928
|
+
}
|
|
1824
1929
|
get activeEvents() {
|
|
1825
1930
|
if (this._eventsNotAvailable) return [];
|
|
1826
1931
|
const events = this._fetchedEvents ?? this.agentEventsInput ?? [];
|
|
@@ -1944,19 +2049,70 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
1944
2049
|
value: metadata?.status
|
|
1945
2050
|
}
|
|
1946
2051
|
].filter((pill) => pill.value != null && pill.value !== "");
|
|
1947
|
-
|
|
2052
|
+
const bulkControls = this.renderActiveBulkControls();
|
|
2053
|
+
if (pills.length === 0 && bulkControls === lit.nothing) return lit.nothing;
|
|
1948
2054
|
return lit.html`
|
|
1949
2055
|
<div class="cpk-td__metadata-strip" aria-label="Thread metadata">
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
<span class="cpk-td__metadata-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
2056
|
+
<div class="cpk-td__metadata-pills">
|
|
2057
|
+
${pills.map((pill) => lit.html`
|
|
2058
|
+
<span class="cpk-td__metadata-pill" title=${pill.value ?? ""}>
|
|
2059
|
+
<span class="cpk-td__metadata-label">${pill.label}</span>
|
|
2060
|
+
<span class="cpk-td__metadata-value"
|
|
2061
|
+
>${this.shortId(pill.value)}</span
|
|
2062
|
+
>
|
|
2063
|
+
</span>
|
|
2064
|
+
`)}
|
|
2065
|
+
</div>
|
|
2066
|
+
${bulkControls}
|
|
1958
2067
|
</div>
|
|
1959
2068
|
`;
|
|
2069
|
+
}
|
|
2070
|
+
renderActiveBulkControls() {
|
|
2071
|
+
if (this._eventsNotAvailable) return lit.nothing;
|
|
2072
|
+
if (this._tab === "raw-events") return this.renderRawEventBulkControls();
|
|
2073
|
+
if (this._tab !== "timeline") return lit.nothing;
|
|
2074
|
+
const detailIds = this.timelineItemsForEvents(this.activeEvents).filter((item) => item.details).map((item) => item.id);
|
|
2075
|
+
if (detailIds.length <= 1) return lit.nothing;
|
|
2076
|
+
return lit.html`<div class="cpk-td__timeline-toolbar">
|
|
2077
|
+
<button
|
|
2078
|
+
type="button"
|
|
2079
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2080
|
+
?disabled=${detailIds.every((id) => this._expandedTimelineDetails.has(id))}
|
|
2081
|
+
@click=${() => this.expandTimelineDetails(detailIds)}
|
|
2082
|
+
>
|
|
2083
|
+
Expand all
|
|
2084
|
+
</button>
|
|
2085
|
+
<button
|
|
2086
|
+
type="button"
|
|
2087
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2088
|
+
?disabled=${detailIds.every((id) => !this._expandedTimelineDetails.has(id))}
|
|
2089
|
+
@click=${() => this.collapseTimelineDetails(detailIds)}
|
|
2090
|
+
>
|
|
2091
|
+
Collapse all
|
|
2092
|
+
</button>
|
|
2093
|
+
</div>`;
|
|
2094
|
+
}
|
|
2095
|
+
renderRawEventBulkControls() {
|
|
2096
|
+
const eventIds = this.activeEvents.map((event) => this.rawEventId(event));
|
|
2097
|
+
if (eventIds.length <= 1) return lit.nothing;
|
|
2098
|
+
return lit.html`<div class="cpk-td__timeline-toolbar">
|
|
2099
|
+
<button
|
|
2100
|
+
type="button"
|
|
2101
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2102
|
+
?disabled=${eventIds.every((id) => this._expandedRawEvents.has(id))}
|
|
2103
|
+
@click=${() => this.expandRawEventDetails(eventIds)}
|
|
2104
|
+
>
|
|
2105
|
+
Expand all
|
|
2106
|
+
</button>
|
|
2107
|
+
<button
|
|
2108
|
+
type="button"
|
|
2109
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2110
|
+
?disabled=${eventIds.every((id) => !this._expandedRawEvents.has(id))}
|
|
2111
|
+
@click=${() => this.collapseRawEventDetails(eventIds)}
|
|
2112
|
+
>
|
|
2113
|
+
Collapse all
|
|
2114
|
+
</button>
|
|
2115
|
+
</div>`;
|
|
1960
2116
|
}
|
|
1961
2117
|
revealSourceEvent(sourceIndex) {
|
|
1962
2118
|
this._activatedTabs = new Set([...this._activatedTabs, "raw-events"]);
|
|
@@ -1987,7 +2143,7 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
1987
2143
|
`;
|
|
1988
2144
|
}
|
|
1989
2145
|
const events = this.activeEvents;
|
|
1990
|
-
const cachedTimeline = this.getCachedPanelTpl("timeline", [events]);
|
|
2146
|
+
const cachedTimeline = this.getCachedPanelTpl("timeline", [events, this._expandedTimelineDetails]);
|
|
1991
2147
|
if (cachedTimeline) return cachedTimeline;
|
|
1992
2148
|
const timelineItems = this.timelineItemsForEvents(events);
|
|
1993
2149
|
if (timelineItems.length === 0) {
|
|
@@ -2003,14 +2159,14 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
2003
2159
|
</div>
|
|
2004
2160
|
`;
|
|
2005
2161
|
}
|
|
2006
|
-
return this.cachedPanelTpl("timeline", [events], () => {
|
|
2007
|
-
return lit.html`${timelineItems.map((item) => this.renderTimelineItem(item))}`;
|
|
2008
|
-
});
|
|
2162
|
+
return this.cachedPanelTpl("timeline", [events, this._expandedTimelineDetails], () => lit.html`${timelineItems.map((item) => this.renderTimelineItem(item))}`);
|
|
2009
2163
|
}
|
|
2010
2164
|
renderTimelineItem(item) {
|
|
2165
|
+
const isWarning = item.kind === "warning";
|
|
2166
|
+
const detailsExpanded = this._expandedTimelineDetails.has(item.id);
|
|
2011
2167
|
return lit.html`
|
|
2012
2168
|
<div
|
|
2013
|
-
class="cpk-td__timeline-item ${
|
|
2169
|
+
class="cpk-td__timeline-item ${isWarning ? "cpk-td__timeline-item--warning" : ""}"
|
|
2014
2170
|
>
|
|
2015
2171
|
<div class="cpk-td__timeline-header">
|
|
2016
2172
|
<span class="cpk-td__timeline-kind"
|
|
@@ -2028,9 +2184,39 @@ var CpkThreadInspector = class CpkThreadInspector extends lit.LitElement {
|
|
|
2028
2184
|
>${formatTimestamp(item.timestamp)}</span
|
|
2029
2185
|
>
|
|
2030
2186
|
</div>
|
|
2031
|
-
${item.
|
|
2032
|
-
|
|
2033
|
-
|
|
2187
|
+
${item.details ? lit.html`<button
|
|
2188
|
+
type="button"
|
|
2189
|
+
class="cpk-td__timeline-details-toggle"
|
|
2190
|
+
aria-expanded=${detailsExpanded ? "true" : "false"}
|
|
2191
|
+
@click=${() => this.toggleTimelineDetails(item.id)}
|
|
2192
|
+
>
|
|
2193
|
+
${detailsExpanded ? lit.html`
|
|
2194
|
+
<svg
|
|
2195
|
+
aria-hidden="true"
|
|
2196
|
+
viewBox="0 0 24 24"
|
|
2197
|
+
fill="none"
|
|
2198
|
+
stroke="currentColor"
|
|
2199
|
+
stroke-linecap="round"
|
|
2200
|
+
stroke-linejoin="round"
|
|
2201
|
+
>
|
|
2202
|
+
<path d="m6 9 6 6 6-6" />
|
|
2203
|
+
</svg>
|
|
2204
|
+
` : lit.html`
|
|
2205
|
+
<svg
|
|
2206
|
+
aria-hidden="true"
|
|
2207
|
+
viewBox="0 0 24 24"
|
|
2208
|
+
fill="none"
|
|
2209
|
+
stroke="currentColor"
|
|
2210
|
+
stroke-linecap="round"
|
|
2211
|
+
stroke-linejoin="round"
|
|
2212
|
+
>
|
|
2213
|
+
<path d="m9 18 6-6-6-6" />
|
|
2214
|
+
</svg>
|
|
2215
|
+
`}
|
|
2216
|
+
<span>${detailsExpanded ? "Hide details" : "Show details"}</span>
|
|
2217
|
+
</button>` : lit.nothing}
|
|
2218
|
+
${item.body ? lit.html`<div class="cpk-td__timeline-body">${item.body}</div>` : lit.nothing}
|
|
2219
|
+
${item.details && detailsExpanded ? lit.html`<pre class="cpk-td__timeline-body">${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(item.details))}</pre>` : lit.nothing}
|
|
2034
2220
|
</div>
|
|
2035
2221
|
`;
|
|
2036
2222
|
}
|
|
@@ -2287,9 +2473,11 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
2287
2473
|
>
|
|
2288
2474
|
</div>
|
|
2289
2475
|
`;
|
|
2290
|
-
return this.cachedPanelTpl("raw-events", [events], () => {
|
|
2476
|
+
return this.cachedPanelTpl("raw-events", [events, this._expandedRawEvents], () => {
|
|
2291
2477
|
return lit.html`${events.map((event) => {
|
|
2292
2478
|
const { bg, fg } = eventColors(event.type);
|
|
2479
|
+
const eventId = this.rawEventId(event);
|
|
2480
|
+
const detailsExpanded = this._expandedRawEvents.has(eventId);
|
|
2293
2481
|
return lit.html`
|
|
2294
2482
|
<div class="cpk-td__event" data-source-index=${event.sourceIndex}>
|
|
2295
2483
|
<div class="cpk-td__event-header" style="background:${bg}">
|
|
@@ -2300,9 +2488,38 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(stateValue))}</p
|
|
|
2300
2488
|
>${formatTimestamp(event.timestamp)}</span
|
|
2301
2489
|
>
|
|
2302
2490
|
</div>
|
|
2303
|
-
<
|
|
2304
|
-
|
|
2491
|
+
<button
|
|
2492
|
+
type="button"
|
|
2493
|
+
class="cpk-td__timeline-details-toggle"
|
|
2494
|
+
aria-expanded=${detailsExpanded ? "true" : "false"}
|
|
2495
|
+
@click=${() => this.toggleRawEventDetails(eventId)}
|
|
2305
2496
|
>
|
|
2497
|
+
${detailsExpanded ? lit.html`
|
|
2498
|
+
<svg
|
|
2499
|
+
aria-hidden="true"
|
|
2500
|
+
viewBox="0 0 24 24"
|
|
2501
|
+
fill="none"
|
|
2502
|
+
stroke="currentColor"
|
|
2503
|
+
stroke-linecap="round"
|
|
2504
|
+
stroke-linejoin="round"
|
|
2505
|
+
>
|
|
2506
|
+
<path d="m6 9 6 6 6-6" />
|
|
2507
|
+
</svg>
|
|
2508
|
+
` : lit.html`
|
|
2509
|
+
<svg
|
|
2510
|
+
aria-hidden="true"
|
|
2511
|
+
viewBox="0 0 24 24"
|
|
2512
|
+
fill="none"
|
|
2513
|
+
stroke="currentColor"
|
|
2514
|
+
stroke-linecap="round"
|
|
2515
|
+
stroke-linejoin="round"
|
|
2516
|
+
>
|
|
2517
|
+
<path d="m9 18 6-6-6-6" />
|
|
2518
|
+
</svg>
|
|
2519
|
+
`}
|
|
2520
|
+
<span>${detailsExpanded ? "Hide details" : "Show details"}</span>
|
|
2521
|
+
</button>
|
|
2522
|
+
${detailsExpanded ? lit.html`<pre class="cpk-td__event-payload">${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(event.rawEvent ?? event))}</pre>` : lit.nothing}
|
|
2306
2523
|
</div>
|
|
2307
2524
|
`;
|
|
2308
2525
|
})}`;
|
|
@@ -2411,16 +2628,365 @@ ${(0, lit_directives_unsafe_html_js.unsafeHTML)(highlightedJson(event.rawEvent ?
|
|
|
2411
2628
|
`;
|
|
2412
2629
|
}
|
|
2413
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
|
+
};
|
|
2414
2971
|
var ɵCpkThreadDetails = class extends CpkThreadInspector {};
|
|
2415
2972
|
if (!customElements.get("cpk-thread-list")) customElements.define("cpk-thread-list", CpkThreadList);
|
|
2416
2973
|
if (!customElements.get(THREAD_INSPECTOR_TAG)) customElements.define(THREAD_INSPECTOR_TAG, CpkThreadInspector);
|
|
2417
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);
|
|
2418
2976
|
var WebInspectorElement = class extends lit.LitElement {
|
|
2419
|
-
constructor(...
|
|
2420
|
-
super(...
|
|
2977
|
+
constructor(..._args4) {
|
|
2978
|
+
super(..._args4);
|
|
2421
2979
|
this._core = null;
|
|
2422
2980
|
this.coreSubscriber = null;
|
|
2423
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;
|
|
2424
2990
|
this.runtimeStatus = null;
|
|
2425
2991
|
this.coreProperties = {};
|
|
2426
2992
|
this.lastCoreError = null;
|
|
@@ -2836,6 +3402,11 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
2836
3402
|
key: "threads",
|
|
2837
3403
|
label: "Threads",
|
|
2838
3404
|
icon: "MessageSquare"
|
|
3405
|
+
},
|
|
3406
|
+
{
|
|
3407
|
+
key: "memories",
|
|
3408
|
+
label: "Learning",
|
|
3409
|
+
icon: "Brain"
|
|
2839
3410
|
}
|
|
2840
3411
|
];
|
|
2841
3412
|
}
|
|
@@ -2861,6 +3432,13 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
2861
3432
|
...extra
|
|
2862
3433
|
};
|
|
2863
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
|
+
}
|
|
2864
3442
|
getIntelligenceSignupUrl() {
|
|
2865
3443
|
return this.appendRefParam(INTELLIGENCE_SIGNUP_URL, "cpk-inspector");
|
|
2866
3444
|
}
|
|
@@ -3025,12 +3603,75 @@ var WebInspectorElement = class extends lit.LitElement {
|
|
|
3025
3603
|
const threadStores = typeof core.getThreadStores === "function" ? core.getThreadStores() : {};
|
|
3026
3604
|
for (const [agentId, store] of Object.entries(threadStores)) this.subscribeToThreadStore(agentId, store);
|
|
3027
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();
|
|
3028
3660
|
}
|
|
3029
3661
|
detachFromCore() {
|
|
3030
3662
|
if (this.coreUnsubscribe) {
|
|
3031
3663
|
this.coreUnsubscribe();
|
|
3032
3664
|
this.coreUnsubscribe = null;
|
|
3033
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;
|
|
3034
3675
|
this.coreSubscriber = null;
|
|
3035
3676
|
this.runtimeStatus = null;
|
|
3036
3677
|
this.lastCoreError = null;
|
|
@@ -4253,6 +4894,7 @@ ${argsString}</pre
|
|
|
4253
4894
|
y: EDGE_MARGIN
|
|
4254
4895
|
};
|
|
4255
4896
|
this.hydrateStateFromStorage();
|
|
4897
|
+
if (this.selectedMenu === "memories") this.ensureMemorySubscription();
|
|
4256
4898
|
if (this.isOpen && this.dockMode !== "floating") this.applyDockStyles(true);
|
|
4257
4899
|
this.applyAnchorPosition("button");
|
|
4258
4900
|
if (this.dockMode === "floating") if (this.hasCustomPosition.window) this.applyAnchorPosition("window");
|
|
@@ -4948,6 +5590,7 @@ ${argsString}</pre
|
|
|
4948
5590
|
if (this.selectedMenu === "frontend-tools") return this.renderToolsView();
|
|
4949
5591
|
if (this.selectedMenu === "agent-context") return this.renderContextView();
|
|
4950
5592
|
if (this.selectedMenu === "threads") return this.renderThreadsView();
|
|
5593
|
+
if (this.selectedMenu === "memories") return this.renderMemoriesView();
|
|
4951
5594
|
if (this.selectedMenu === "settings") return this.renderSettingsPanel();
|
|
4952
5595
|
return lit.nothing;
|
|
4953
5596
|
}
|
|
@@ -5299,6 +5942,310 @@ ${argsString}</pre
|
|
|
5299
5942
|
</div>
|
|
5300
5943
|
</div>
|
|
5301
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>
|
|
5302
6249
|
`;
|
|
5303
6250
|
}
|
|
5304
6251
|
renderThreadsView() {
|
|
@@ -5918,6 +6865,10 @@ ${prettyEvent}</pre
|
|
|
5918
6865
|
if (previousMenu !== "threads" && !this.core?.telemetryDisabled) require_telemetry.trackThreadsTabClicked(this.getThreadsTelemetryProps());
|
|
5919
6866
|
this.autoSelectLatestThread();
|
|
5920
6867
|
}
|
|
6868
|
+
if (key === "memories") {
|
|
6869
|
+
this.ensureMemorySubscription();
|
|
6870
|
+
if (previousMenu !== "memories" && !this.core?.telemetryDisabled) require_telemetry.trackMemoriesTabClicked(this.getMemoriesTelemetryProps());
|
|
6871
|
+
}
|
|
5921
6872
|
if (key === "ag-ui-events" || key === "agents") requestAnimationFrame(() => {
|
|
5922
6873
|
const scroller = this.shadowRoot?.getElementById("cpk-main-scroll");
|
|
5923
6874
|
if (scroller) scroller.scrollTop = 0;
|