@copilotkit/web-inspector 1.62.1 → 1.62.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +239 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +17 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +239 -22
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +251 -33
- package/dist/index.umd.js.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 +96 -1
- package/src/index.ts +308 -30
package/dist/package.cjs
CHANGED
package/dist/package.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@copilotkit/web-inspector",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.2",
|
|
4
4
|
"description": "Lit-based web component for the CopilotKit web inspector",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"lit": "^3.2.0",
|
|
28
28
|
"lucide": "^0.525.0",
|
|
29
29
|
"marked": "^12.0.2",
|
|
30
|
-
"@copilotkit/core": "1.62.
|
|
30
|
+
"@copilotkit/core": "1.62.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@tailwindcss/cli": "^4.1.11",
|
|
@@ -339,6 +339,7 @@ type ThreadDetailsInternals = {
|
|
|
339
339
|
} | null;
|
|
340
340
|
_expandedTools: Set<string>;
|
|
341
341
|
_expandedMessages: Set<string>;
|
|
342
|
+
_expandedTimelineDetails: Set<string>;
|
|
342
343
|
_stateNotAvailable: boolean;
|
|
343
344
|
_eventsNotAvailable: boolean;
|
|
344
345
|
_loadingMessages: boolean;
|
|
@@ -934,7 +935,22 @@ describe("CpkThreadInspector provider contract", () => {
|
|
|
934
935
|
?.click();
|
|
935
936
|
await flushProviderWork(el);
|
|
936
937
|
|
|
938
|
+
const rawEvent = el.shadowRoot?.querySelector<HTMLElement>(
|
|
939
|
+
'.cpk-td__event[data-source-index="1"]',
|
|
940
|
+
);
|
|
941
|
+
expect(rawEvent?.textContent ?? "").toContain("Show details");
|
|
942
|
+
expect(rawEvent?.textContent ?? "").not.toContain("top-level-run");
|
|
943
|
+
expect(rawEvent?.textContent ?? "").not.toContain("sequence");
|
|
944
|
+
expect(rawEvent?.textContent ?? "").not.toContain("messageId");
|
|
945
|
+
expect(rawEvent?.textContent ?? "").not.toContain("hello");
|
|
946
|
+
|
|
947
|
+
rawEvent
|
|
948
|
+
?.querySelector<HTMLButtonElement>(".cpk-td__timeline-details-toggle")
|
|
949
|
+
?.click();
|
|
950
|
+
await el.updateComplete;
|
|
951
|
+
|
|
937
952
|
const text = el.shadowRoot?.textContent ?? "";
|
|
953
|
+
expect(text).toContain("Hide details");
|
|
938
954
|
expect(text).toContain("top-level-run");
|
|
939
955
|
expect(text).toContain("sequence");
|
|
940
956
|
expect(text).toContain("messageId");
|
|
@@ -1118,11 +1134,90 @@ describe("CpkThreadInspector provider contract", () => {
|
|
|
1118
1134
|
|
|
1119
1135
|
expect(internals.activeTimelineItems).toHaveLength(1);
|
|
1120
1136
|
expect(el.shadowRoot?.textContent ?? "").toContain("THREAD_STATE_WRITTEN");
|
|
1121
|
-
expect(el.shadowRoot?.textContent ?? "").toContain("
|
|
1137
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Show details");
|
|
1138
|
+
expect(el.shadowRoot?.textContent ?? "").not.toContain("checkpointId");
|
|
1122
1139
|
expect(el.shadowRoot?.textContent ?? "").toContain("Source event #1");
|
|
1123
1140
|
expect(el.shadowRoot?.textContent ?? "").not.toContain(
|
|
1124
1141
|
"No timeline events captured",
|
|
1125
1142
|
);
|
|
1143
|
+
el.shadowRoot
|
|
1144
|
+
?.querySelector<HTMLButtonElement>(".cpk-td__timeline-details-toggle")
|
|
1145
|
+
?.click();
|
|
1146
|
+
await el.updateComplete;
|
|
1147
|
+
|
|
1148
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("checkpointId");
|
|
1149
|
+
});
|
|
1150
|
+
|
|
1151
|
+
it("collapses structured timeline event details by default", async () => {
|
|
1152
|
+
const provider: ThreadDebuggerProvider = {
|
|
1153
|
+
getEvents: vi.fn().mockResolvedValue([
|
|
1154
|
+
{
|
|
1155
|
+
type: "RUN_STARTED",
|
|
1156
|
+
timestamp: "2026-06-25T10:00:00.000Z",
|
|
1157
|
+
payload: {
|
|
1158
|
+
input: {
|
|
1159
|
+
tools: [
|
|
1160
|
+
{
|
|
1161
|
+
name: "generateSandboxedUi",
|
|
1162
|
+
description: "very chonky run-started payload",
|
|
1163
|
+
},
|
|
1164
|
+
],
|
|
1165
|
+
},
|
|
1166
|
+
},
|
|
1167
|
+
},
|
|
1168
|
+
]),
|
|
1169
|
+
};
|
|
1170
|
+
const { el, internals } = createThreadInspector();
|
|
1171
|
+
|
|
1172
|
+
internals.provider = provider;
|
|
1173
|
+
internals.threadId = "thread-chonky-run-started";
|
|
1174
|
+
await flushProviderWork(el);
|
|
1175
|
+
|
|
1176
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Run started");
|
|
1177
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Show details");
|
|
1178
|
+
expect(el.shadowRoot?.textContent ?? "").not.toContain(
|
|
1179
|
+
"very chonky run-started payload",
|
|
1180
|
+
);
|
|
1181
|
+
el.shadowRoot
|
|
1182
|
+
?.querySelector<HTMLButtonElement>(".cpk-td__timeline-details-toggle")
|
|
1183
|
+
?.click();
|
|
1184
|
+
await el.updateComplete;
|
|
1185
|
+
|
|
1186
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Hide details");
|
|
1187
|
+
expect(el.shadowRoot?.textContent ?? "").toContain(
|
|
1188
|
+
"very chonky run-started payload",
|
|
1189
|
+
);
|
|
1190
|
+
});
|
|
1191
|
+
|
|
1192
|
+
it("shows expanded timeline details when an event also has a summary body", async () => {
|
|
1193
|
+
const provider: ThreadDebuggerProvider = {
|
|
1194
|
+
getEvents: vi.fn().mockResolvedValue([
|
|
1195
|
+
{
|
|
1196
|
+
type: "RUN_ERROR",
|
|
1197
|
+
timestamp: "2026-06-25T10:00:00.000Z",
|
|
1198
|
+
payload: {
|
|
1199
|
+
message: "Tool failed",
|
|
1200
|
+
errorCode: "ERR_TOOL_TIMEOUT",
|
|
1201
|
+
},
|
|
1202
|
+
},
|
|
1203
|
+
]),
|
|
1204
|
+
};
|
|
1205
|
+
const { el, internals } = createThreadInspector();
|
|
1206
|
+
|
|
1207
|
+
internals.provider = provider;
|
|
1208
|
+
internals.threadId = "thread-error-details";
|
|
1209
|
+
await flushProviderWork(el);
|
|
1210
|
+
|
|
1211
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Tool failed");
|
|
1212
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Show details");
|
|
1213
|
+
expect(el.shadowRoot?.textContent ?? "").not.toContain("ERR_TOOL_TIMEOUT");
|
|
1214
|
+
el.shadowRoot
|
|
1215
|
+
?.querySelector<HTMLButtonElement>(".cpk-td__timeline-details-toggle")
|
|
1216
|
+
?.click();
|
|
1217
|
+
await el.updateComplete;
|
|
1218
|
+
|
|
1219
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("Hide details");
|
|
1220
|
+
expect(el.shadowRoot?.textContent ?? "").toContain("ERR_TOOL_TIMEOUT");
|
|
1126
1221
|
});
|
|
1127
1222
|
|
|
1128
1223
|
it("keeps the first-visible timeline intentional while provider message fallback is loading", async () => {
|
package/src/index.ts
CHANGED
|
@@ -779,6 +779,8 @@ export class CpkThreadInspector extends LitElement {
|
|
|
779
779
|
_stateError: { state: true },
|
|
780
780
|
_expandedTools: { state: true },
|
|
781
781
|
_expandedMessages: { state: true },
|
|
782
|
+
_expandedTimelineDetails: { state: true },
|
|
783
|
+
_expandedRawEvents: { state: true },
|
|
782
784
|
_showDetailPanel: { state: true },
|
|
783
785
|
_detailPanelWidth: { state: true },
|
|
784
786
|
_eventsNotAvailable: { state: true },
|
|
@@ -816,6 +818,8 @@ export class CpkThreadInspector extends LitElement {
|
|
|
816
818
|
private _stateError: string | null = null;
|
|
817
819
|
private _expandedTools = new Set<string>();
|
|
818
820
|
private _expandedMessages = new Set<string>();
|
|
821
|
+
private _expandedTimelineDetails = new Set<string>();
|
|
822
|
+
private _expandedRawEvents = new Set<string>();
|
|
819
823
|
private _showDetailPanel = false;
|
|
820
824
|
private _detailPanelWidth = 250;
|
|
821
825
|
/** True when the /events endpoint returned 501 — don't fall back to live data. */
|
|
@@ -1102,6 +1106,7 @@ export class CpkThreadInspector extends LitElement {
|
|
|
1102
1106
|
|
|
1103
1107
|
.cpk-td__metadata-strip {
|
|
1104
1108
|
display: flex;
|
|
1109
|
+
align-items: center;
|
|
1105
1110
|
gap: 6px;
|
|
1106
1111
|
flex-wrap: wrap;
|
|
1107
1112
|
padding: 10px 16px;
|
|
@@ -1110,6 +1115,14 @@ export class CpkThreadInspector extends LitElement {
|
|
|
1110
1115
|
flex-shrink: 0;
|
|
1111
1116
|
}
|
|
1112
1117
|
|
|
1118
|
+
.cpk-td__metadata-pills {
|
|
1119
|
+
display: flex;
|
|
1120
|
+
gap: 6px;
|
|
1121
|
+
flex: 1;
|
|
1122
|
+
flex-wrap: wrap;
|
|
1123
|
+
min-width: 0;
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1113
1126
|
.cpk-td__metadata-pill {
|
|
1114
1127
|
display: inline-flex;
|
|
1115
1128
|
align-items: center;
|
|
@@ -1404,13 +1417,44 @@ export class CpkThreadInspector extends LitElement {
|
|
|
1404
1417
|
}
|
|
1405
1418
|
|
|
1406
1419
|
.cpk-td__timeline-body {
|
|
1407
|
-
|
|
1420
|
+
margin: 0;
|
|
1421
|
+
padding: 0 10px 9px;
|
|
1408
1422
|
font-size: 12px;
|
|
1409
1423
|
line-height: 1.55;
|
|
1410
1424
|
color: #57575b;
|
|
1411
1425
|
white-space: pre-wrap;
|
|
1412
1426
|
word-break: break-word;
|
|
1413
|
-
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
.cpk-td__timeline-toolbar {
|
|
1430
|
+
display: flex;
|
|
1431
|
+
gap: 6px;
|
|
1432
|
+
margin-left: auto;
|
|
1433
|
+
}
|
|
1434
|
+
|
|
1435
|
+
.cpk-td__timeline-bulk-toggle {
|
|
1436
|
+
margin: 0;
|
|
1437
|
+
padding: 4px 8px;
|
|
1438
|
+
border: 1px solid #dcdce8;
|
|
1439
|
+
border-radius: 6px;
|
|
1440
|
+
background: #ffffff;
|
|
1441
|
+
color: #36363a;
|
|
1442
|
+
cursor: pointer;
|
|
1443
|
+
font-family: "Inter", sans-serif;
|
|
1444
|
+
font-size: 11px;
|
|
1445
|
+
font-weight: 600;
|
|
1446
|
+
line-height: 1.2;
|
|
1447
|
+
}
|
|
1448
|
+
|
|
1449
|
+
.cpk-td__timeline-bulk-toggle:hover {
|
|
1450
|
+
border-color: rgba(85, 88, 178, 0.38);
|
|
1451
|
+
background: #f7f7ff;
|
|
1452
|
+
color: #010507;
|
|
1453
|
+
}
|
|
1454
|
+
|
|
1455
|
+
.cpk-td__timeline-bulk-toggle:disabled {
|
|
1456
|
+
cursor: not-allowed;
|
|
1457
|
+
opacity: 0.45;
|
|
1414
1458
|
}
|
|
1415
1459
|
|
|
1416
1460
|
.cpk-td__source-link {
|
|
@@ -1431,6 +1475,34 @@ export class CpkThreadInspector extends LitElement {
|
|
|
1431
1475
|
color: #010507;
|
|
1432
1476
|
}
|
|
1433
1477
|
|
|
1478
|
+
.cpk-td__timeline-details-toggle {
|
|
1479
|
+
margin: 0;
|
|
1480
|
+
padding: 5px 10px;
|
|
1481
|
+
border: none;
|
|
1482
|
+
background: #ffffff;
|
|
1483
|
+
color: #5558b2;
|
|
1484
|
+
cursor: pointer;
|
|
1485
|
+
display: inline-flex;
|
|
1486
|
+
align-items: center;
|
|
1487
|
+
gap: 5px;
|
|
1488
|
+
font-family: "Inter", sans-serif;
|
|
1489
|
+
font-size: 12px;
|
|
1490
|
+
font-weight: 600;
|
|
1491
|
+
line-height: 1.2;
|
|
1492
|
+
width: 100%;
|
|
1493
|
+
}
|
|
1494
|
+
|
|
1495
|
+
.cpk-td__timeline-details-toggle:hover {
|
|
1496
|
+
background: #f7f7ff;
|
|
1497
|
+
color: #010507;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
.cpk-td__timeline-details-toggle svg {
|
|
1501
|
+
width: 12px;
|
|
1502
|
+
height: 12px;
|
|
1503
|
+
stroke-width: 2;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1434
1506
|
/* ── Generative UI ──────────────────────────────────────────────── */
|
|
1435
1507
|
@keyframes cpk-genui-enter {
|
|
1436
1508
|
from {
|
|
@@ -1720,6 +1792,8 @@ export class CpkThreadInspector extends LitElement {
|
|
|
1720
1792
|
this._liveEventsWithSourceIndexCache = null;
|
|
1721
1793
|
this._expandedTools = new Set();
|
|
1722
1794
|
this._expandedMessages = new Set();
|
|
1795
|
+
this._expandedTimelineDetails = new Set();
|
|
1796
|
+
this._expandedRawEvents = new Set();
|
|
1723
1797
|
this._metadataAbort?.abort();
|
|
1724
1798
|
this._metadataAbort = null;
|
|
1725
1799
|
this._messagesAbort?.abort();
|
|
@@ -2391,6 +2465,47 @@ export class CpkThreadInspector extends LitElement {
|
|
|
2391
2465
|
this._expandedMessages = next;
|
|
2392
2466
|
}
|
|
2393
2467
|
|
|
2468
|
+
private toggleTimelineDetails(id: string): void {
|
|
2469
|
+
const next = new Set(this._expandedTimelineDetails);
|
|
2470
|
+
if (next.has(id)) next.delete(id);
|
|
2471
|
+
else next.add(id);
|
|
2472
|
+
this._expandedTimelineDetails = next;
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
private expandTimelineDetails(ids: string[]): void {
|
|
2476
|
+
this._expandedTimelineDetails = new Set([
|
|
2477
|
+
...this._expandedTimelineDetails,
|
|
2478
|
+
...ids,
|
|
2479
|
+
]);
|
|
2480
|
+
}
|
|
2481
|
+
|
|
2482
|
+
private collapseTimelineDetails(ids: string[]): void {
|
|
2483
|
+
const next = new Set(this._expandedTimelineDetails);
|
|
2484
|
+
for (const id of ids) next.delete(id);
|
|
2485
|
+
this._expandedTimelineDetails = next;
|
|
2486
|
+
}
|
|
2487
|
+
|
|
2488
|
+
private toggleRawEventDetails(id: string): void {
|
|
2489
|
+
const next = new Set(this._expandedRawEvents);
|
|
2490
|
+
if (next.has(id)) next.delete(id);
|
|
2491
|
+
else next.add(id);
|
|
2492
|
+
this._expandedRawEvents = next;
|
|
2493
|
+
}
|
|
2494
|
+
|
|
2495
|
+
private expandRawEventDetails(ids: string[]): void {
|
|
2496
|
+
this._expandedRawEvents = new Set([...this._expandedRawEvents, ...ids]);
|
|
2497
|
+
}
|
|
2498
|
+
|
|
2499
|
+
private collapseRawEventDetails(ids: string[]): void {
|
|
2500
|
+
const next = new Set(this._expandedRawEvents);
|
|
2501
|
+
for (const id of ids) next.delete(id);
|
|
2502
|
+
this._expandedRawEvents = next;
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
private rawEventId(event: ApiAgentEvent): string {
|
|
2506
|
+
return `raw-event-${event.sourceIndex ?? event.timestamp ?? event.type}`;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2394
2509
|
private get activeEvents(): ApiAgentEvent[] {
|
|
2395
2510
|
// When the endpoint explicitly returned 501 we report no events rather
|
|
2396
2511
|
// than leaking the parent's agent-keyed live events across historical
|
|
@@ -2562,25 +2677,95 @@ export class CpkThreadInspector extends LitElement {
|
|
|
2562
2677
|
},
|
|
2563
2678
|
{ label: "Status", value: metadata?.status },
|
|
2564
2679
|
].filter((pill) => pill.value != null && pill.value !== "");
|
|
2680
|
+
const bulkControls = this.renderActiveBulkControls();
|
|
2565
2681
|
|
|
2566
|
-
if (pills.length === 0) return nothing;
|
|
2682
|
+
if (pills.length === 0 && bulkControls === nothing) return nothing;
|
|
2567
2683
|
|
|
2568
2684
|
return html`
|
|
2569
2685
|
<div class="cpk-td__metadata-strip" aria-label="Thread metadata">
|
|
2570
|
-
|
|
2571
|
-
(
|
|
2572
|
-
|
|
2573
|
-
<span class="cpk-td__metadata-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2686
|
+
<div class="cpk-td__metadata-pills">
|
|
2687
|
+
${pills.map(
|
|
2688
|
+
(pill) => html`
|
|
2689
|
+
<span class="cpk-td__metadata-pill" title=${pill.value ?? ""}>
|
|
2690
|
+
<span class="cpk-td__metadata-label">${pill.label}</span>
|
|
2691
|
+
<span class="cpk-td__metadata-value"
|
|
2692
|
+
>${this.shortId(pill.value)}</span
|
|
2693
|
+
>
|
|
2694
|
+
</span>
|
|
2695
|
+
`,
|
|
2696
|
+
)}
|
|
2697
|
+
</div>
|
|
2698
|
+
${bulkControls}
|
|
2580
2699
|
</div>
|
|
2581
2700
|
`;
|
|
2582
2701
|
}
|
|
2583
2702
|
|
|
2703
|
+
private renderActiveBulkControls() {
|
|
2704
|
+
if (this._eventsNotAvailable) return nothing;
|
|
2705
|
+
if (this._tab === "raw-events") return this.renderRawEventBulkControls();
|
|
2706
|
+
if (this._tab !== "timeline") return nothing;
|
|
2707
|
+
|
|
2708
|
+
const detailIds = this.timelineItemsForEvents(this.activeEvents)
|
|
2709
|
+
.filter((item) => item.details)
|
|
2710
|
+
.map((item) => item.id);
|
|
2711
|
+
if (detailIds.length <= 1) return nothing;
|
|
2712
|
+
|
|
2713
|
+
const allExpanded = detailIds.every((id) =>
|
|
2714
|
+
this._expandedTimelineDetails.has(id),
|
|
2715
|
+
);
|
|
2716
|
+
const allCollapsed = detailIds.every(
|
|
2717
|
+
(id) => !this._expandedTimelineDetails.has(id),
|
|
2718
|
+
);
|
|
2719
|
+
|
|
2720
|
+
return html`<div class="cpk-td__timeline-toolbar">
|
|
2721
|
+
<button
|
|
2722
|
+
type="button"
|
|
2723
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2724
|
+
?disabled=${allExpanded}
|
|
2725
|
+
@click=${() => this.expandTimelineDetails(detailIds)}
|
|
2726
|
+
>
|
|
2727
|
+
Expand all
|
|
2728
|
+
</button>
|
|
2729
|
+
<button
|
|
2730
|
+
type="button"
|
|
2731
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2732
|
+
?disabled=${allCollapsed}
|
|
2733
|
+
@click=${() => this.collapseTimelineDetails(detailIds)}
|
|
2734
|
+
>
|
|
2735
|
+
Collapse all
|
|
2736
|
+
</button>
|
|
2737
|
+
</div>`;
|
|
2738
|
+
}
|
|
2739
|
+
|
|
2740
|
+
private renderRawEventBulkControls() {
|
|
2741
|
+
const eventIds = this.activeEvents.map((event) => this.rawEventId(event));
|
|
2742
|
+
if (eventIds.length <= 1) return nothing;
|
|
2743
|
+
|
|
2744
|
+
const allExpanded = eventIds.every((id) => this._expandedRawEvents.has(id));
|
|
2745
|
+
const allCollapsed = eventIds.every(
|
|
2746
|
+
(id) => !this._expandedRawEvents.has(id),
|
|
2747
|
+
);
|
|
2748
|
+
|
|
2749
|
+
return html`<div class="cpk-td__timeline-toolbar">
|
|
2750
|
+
<button
|
|
2751
|
+
type="button"
|
|
2752
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2753
|
+
?disabled=${allExpanded}
|
|
2754
|
+
@click=${() => this.expandRawEventDetails(eventIds)}
|
|
2755
|
+
>
|
|
2756
|
+
Expand all
|
|
2757
|
+
</button>
|
|
2758
|
+
<button
|
|
2759
|
+
type="button"
|
|
2760
|
+
class="cpk-td__timeline-bulk-toggle"
|
|
2761
|
+
?disabled=${allCollapsed}
|
|
2762
|
+
@click=${() => this.collapseRawEventDetails(eventIds)}
|
|
2763
|
+
>
|
|
2764
|
+
Collapse all
|
|
2765
|
+
</button>
|
|
2766
|
+
</div>`;
|
|
2767
|
+
}
|
|
2768
|
+
|
|
2584
2769
|
private revealSourceEvent(sourceIndex: number): void {
|
|
2585
2770
|
this._activatedTabs = new Set([...this._activatedTabs, "raw-events"]);
|
|
2586
2771
|
this._tab = "raw-events";
|
|
@@ -2619,7 +2804,10 @@ export class CpkThreadInspector extends LitElement {
|
|
|
2619
2804
|
}
|
|
2620
2805
|
|
|
2621
2806
|
const events = this.activeEvents;
|
|
2622
|
-
const cachedTimeline = this.getCachedPanelTpl("timeline", [
|
|
2807
|
+
const cachedTimeline = this.getCachedPanelTpl("timeline", [
|
|
2808
|
+
events,
|
|
2809
|
+
this._expandedTimelineDetails,
|
|
2810
|
+
]);
|
|
2623
2811
|
if (cachedTimeline) return cachedTimeline;
|
|
2624
2812
|
|
|
2625
2813
|
const timelineItems = this.timelineItemsForEvents(events);
|
|
@@ -2637,13 +2825,16 @@ export class CpkThreadInspector extends LitElement {
|
|
|
2637
2825
|
`;
|
|
2638
2826
|
}
|
|
2639
2827
|
|
|
2640
|
-
return this.cachedPanelTpl(
|
|
2641
|
-
|
|
2642
|
-
|
|
2828
|
+
return this.cachedPanelTpl(
|
|
2829
|
+
"timeline",
|
|
2830
|
+
[events, this._expandedTimelineDetails],
|
|
2831
|
+
() => html`${timelineItems.map((item) => this.renderTimelineItem(item))}`,
|
|
2832
|
+
);
|
|
2643
2833
|
}
|
|
2644
2834
|
|
|
2645
2835
|
private renderTimelineItem(item: TimelineItem) {
|
|
2646
2836
|
const isWarning = item.kind === "warning";
|
|
2837
|
+
const detailsExpanded = this._expandedTimelineDetails.has(item.id);
|
|
2647
2838
|
return html`
|
|
2648
2839
|
<div
|
|
2649
2840
|
class="cpk-td__timeline-item ${
|
|
@@ -2666,14 +2857,56 @@ export class CpkThreadInspector extends LitElement {
|
|
|
2666
2857
|
>${formatTimestamp(item.timestamp)}</span
|
|
2667
2858
|
>
|
|
2668
2859
|
</div>
|
|
2860
|
+
${
|
|
2861
|
+
item.details
|
|
2862
|
+
? html`<button
|
|
2863
|
+
type="button"
|
|
2864
|
+
class="cpk-td__timeline-details-toggle"
|
|
2865
|
+
aria-expanded=${detailsExpanded ? "true" : "false"}
|
|
2866
|
+
@click=${() => this.toggleTimelineDetails(item.id)}
|
|
2867
|
+
>
|
|
2868
|
+
${
|
|
2869
|
+
detailsExpanded
|
|
2870
|
+
? html`
|
|
2871
|
+
<svg
|
|
2872
|
+
aria-hidden="true"
|
|
2873
|
+
viewBox="0 0 24 24"
|
|
2874
|
+
fill="none"
|
|
2875
|
+
stroke="currentColor"
|
|
2876
|
+
stroke-linecap="round"
|
|
2877
|
+
stroke-linejoin="round"
|
|
2878
|
+
>
|
|
2879
|
+
<path d="m6 9 6 6 6-6" />
|
|
2880
|
+
</svg>
|
|
2881
|
+
`
|
|
2882
|
+
: html`
|
|
2883
|
+
<svg
|
|
2884
|
+
aria-hidden="true"
|
|
2885
|
+
viewBox="0 0 24 24"
|
|
2886
|
+
fill="none"
|
|
2887
|
+
stroke="currentColor"
|
|
2888
|
+
stroke-linecap="round"
|
|
2889
|
+
stroke-linejoin="round"
|
|
2890
|
+
>
|
|
2891
|
+
<path d="m9 18 6-6-6-6" />
|
|
2892
|
+
</svg>
|
|
2893
|
+
`
|
|
2894
|
+
}
|
|
2895
|
+
<span>${detailsExpanded ? "Hide details" : "Show details"}</span>
|
|
2896
|
+
</button>`
|
|
2897
|
+
: nothing
|
|
2898
|
+
}
|
|
2669
2899
|
${
|
|
2670
2900
|
item.body
|
|
2671
2901
|
? html`<div class="cpk-td__timeline-body">${item.body}</div>`
|
|
2672
|
-
:
|
|
2673
|
-
|
|
2674
|
-
${
|
|
2675
|
-
|
|
2676
|
-
|
|
2902
|
+
: nothing
|
|
2903
|
+
}
|
|
2904
|
+
${
|
|
2905
|
+
item.details && detailsExpanded
|
|
2906
|
+
? html`<pre class="cpk-td__timeline-body">${unsafeHTML(
|
|
2907
|
+
highlightedJson(item.details),
|
|
2908
|
+
)}</pre>`
|
|
2909
|
+
: nothing
|
|
2677
2910
|
}
|
|
2678
2911
|
</div>
|
|
2679
2912
|
`;
|
|
@@ -3011,10 +3244,15 @@ ${unsafeHTML(highlightedJson(stateValue))}</pre
|
|
|
3011
3244
|
</div>
|
|
3012
3245
|
`;
|
|
3013
3246
|
}
|
|
3014
|
-
return this.cachedPanelTpl(
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3247
|
+
return this.cachedPanelTpl(
|
|
3248
|
+
"raw-events",
|
|
3249
|
+
[events, this._expandedRawEvents],
|
|
3250
|
+
() => {
|
|
3251
|
+
return html`${events.map((event) => {
|
|
3252
|
+
const { bg, fg } = eventColors(event.type);
|
|
3253
|
+
const eventId = this.rawEventId(event);
|
|
3254
|
+
const detailsExpanded = this._expandedRawEvents.has(eventId);
|
|
3255
|
+
return html`
|
|
3018
3256
|
<div class="cpk-td__event" data-source-index=${event.sourceIndex}>
|
|
3019
3257
|
<div class="cpk-td__event-header" style="background:${bg}">
|
|
3020
3258
|
<span class="cpk-td__event-type" style="color:${fg}"
|
|
@@ -3024,13 +3262,53 @@ ${unsafeHTML(highlightedJson(stateValue))}</pre
|
|
|
3024
3262
|
>${formatTimestamp(event.timestamp)}</span
|
|
3025
3263
|
>
|
|
3026
3264
|
</div>
|
|
3027
|
-
<
|
|
3028
|
-
|
|
3265
|
+
<button
|
|
3266
|
+
type="button"
|
|
3267
|
+
class="cpk-td__timeline-details-toggle"
|
|
3268
|
+
aria-expanded=${detailsExpanded ? "true" : "false"}
|
|
3269
|
+
@click=${() => this.toggleRawEventDetails(eventId)}
|
|
3029
3270
|
>
|
|
3271
|
+
${
|
|
3272
|
+
detailsExpanded
|
|
3273
|
+
? html`
|
|
3274
|
+
<svg
|
|
3275
|
+
aria-hidden="true"
|
|
3276
|
+
viewBox="0 0 24 24"
|
|
3277
|
+
fill="none"
|
|
3278
|
+
stroke="currentColor"
|
|
3279
|
+
stroke-linecap="round"
|
|
3280
|
+
stroke-linejoin="round"
|
|
3281
|
+
>
|
|
3282
|
+
<path d="m6 9 6 6 6-6" />
|
|
3283
|
+
</svg>
|
|
3284
|
+
`
|
|
3285
|
+
: html`
|
|
3286
|
+
<svg
|
|
3287
|
+
aria-hidden="true"
|
|
3288
|
+
viewBox="0 0 24 24"
|
|
3289
|
+
fill="none"
|
|
3290
|
+
stroke="currentColor"
|
|
3291
|
+
stroke-linecap="round"
|
|
3292
|
+
stroke-linejoin="round"
|
|
3293
|
+
>
|
|
3294
|
+
<path d="m9 18 6-6-6-6" />
|
|
3295
|
+
</svg>
|
|
3296
|
+
`
|
|
3297
|
+
}
|
|
3298
|
+
<span>${detailsExpanded ? "Hide details" : "Show details"}</span>
|
|
3299
|
+
</button>
|
|
3300
|
+
${
|
|
3301
|
+
detailsExpanded
|
|
3302
|
+
? html`<pre class="cpk-td__event-payload">${unsafeHTML(
|
|
3303
|
+
highlightedJson(event.rawEvent ?? event),
|
|
3304
|
+
)}</pre>`
|
|
3305
|
+
: nothing
|
|
3306
|
+
}
|
|
3030
3307
|
</div>
|
|
3031
3308
|
`;
|
|
3032
|
-
|
|
3033
|
-
|
|
3309
|
+
})}`;
|
|
3310
|
+
},
|
|
3311
|
+
);
|
|
3034
3312
|
}
|
|
3035
3313
|
|
|
3036
3314
|
private renderPanelToggle() {
|