agentic-ui-libs 1.2.0-beta.21 → 1.2.0-beta.22
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/assets/agentic-ui-libs.css +64 -0
- package/dist/features/debug-logs/services/TreeBuilder.d.ts +9 -0
- package/dist/features/debug-logs/services/TreeBuilder.d.ts.map +1 -1
- package/dist/features/tracing/components/SessionsList.d.ts.map +1 -1
- package/dist/features/tracing/components/detail/DetailPage.d.ts +1 -1
- package/dist/features/tracing/components/detail/DetailPage.d.ts.map +1 -1
- package/dist/features/tracing/components/detail/EventLogsSlideout.d.ts +58 -0
- package/dist/features/tracing/components/detail/EventLogsSlideout.d.ts.map +1 -0
- package/dist/features/tracing/components/detail/VoiceEventLogsBanner.d.ts +11 -0
- package/dist/features/tracing/components/detail/VoiceEventLogsBanner.d.ts.map +1 -0
- package/dist/features/tracing/components/detail/index.d.ts +2 -0
- package/dist/features/tracing/components/detail/index.d.ts.map +1 -1
- package/dist/features/tracing/components/detail/services/DetailPageService.d.ts +1 -0
- package/dist/features/tracing/components/detail/services/DetailPageService.d.ts.map +1 -1
- package/dist/features/tracing/components/detail/types.d.ts +19 -0
- package/dist/features/tracing/components/detail/types.d.ts.map +1 -1
- package/dist/features/tracing/types.d.ts +11 -0
- package/dist/features/tracing/types.d.ts.map +1 -1
- package/dist/index.js +718 -18
- package/dist/ui-libs.umd.js +718 -18
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -106506,6 +106506,7 @@ class DetailPageService {
|
|
|
106506
106506
|
);
|
|
106507
106507
|
traceDetails = traceResponses.map((trace) => this.transformToTraceDetailData(trace));
|
|
106508
106508
|
}
|
|
106509
|
+
const resolvedSessionReference = typeof sessionResponse.sessionReference === "string" && sessionResponse.sessionReference.trim() !== "" ? sessionResponse.sessionReference.trim() : void 0;
|
|
106509
106510
|
return {
|
|
106510
106511
|
id: sessionResponse.id,
|
|
106511
106512
|
projectId: sessionResponse.projectId,
|
|
@@ -106513,7 +106514,8 @@ class DetailPageService {
|
|
|
106513
106514
|
bookmarked: false,
|
|
106514
106515
|
public: false,
|
|
106515
106516
|
traces: traceDetails,
|
|
106516
|
-
scores: []
|
|
106517
|
+
scores: [],
|
|
106518
|
+
sessionReference: resolvedSessionReference
|
|
106517
106519
|
};
|
|
106518
106520
|
}
|
|
106519
106521
|
/**
|
|
@@ -106590,10 +106592,12 @@ class DetailPageService {
|
|
|
106590
106592
|
projectId: this.projectId
|
|
106591
106593
|
});
|
|
106592
106594
|
const traceIds = (sessionResponse.traces || []).map((t2) => t2.id);
|
|
106595
|
+
const resolvedSessionReference = typeof sessionResponse.sessionReference === "string" && sessionResponse.sessionReference.trim() !== "" ? sessionResponse.sessionReference.trim() : void 0;
|
|
106593
106596
|
onSessionMeta({
|
|
106594
106597
|
id: sessionResponse.id,
|
|
106595
106598
|
traceCount: traceIds.length,
|
|
106596
|
-
traceIds
|
|
106599
|
+
traceIds,
|
|
106600
|
+
sessionReference: resolvedSessionReference
|
|
106597
106601
|
});
|
|
106598
106602
|
if (traceIds.length === 0) {
|
|
106599
106603
|
return {
|
|
@@ -106603,7 +106607,8 @@ class DetailPageService {
|
|
|
106603
106607
|
bookmarked: false,
|
|
106604
106608
|
public: false,
|
|
106605
106609
|
traces: [],
|
|
106606
|
-
scores: []
|
|
106610
|
+
scores: [],
|
|
106611
|
+
sessionReference: resolvedSessionReference
|
|
106607
106612
|
};
|
|
106608
106613
|
}
|
|
106609
106614
|
const firstTraceId = traceIds[0];
|
|
@@ -106650,7 +106655,8 @@ class DetailPageService {
|
|
|
106650
106655
|
bookmarked: false,
|
|
106651
106656
|
public: false,
|
|
106652
106657
|
traces: allTraces,
|
|
106653
|
-
scores: []
|
|
106658
|
+
scores: [],
|
|
106659
|
+
sessionReference: resolvedSessionReference
|
|
106654
106660
|
};
|
|
106655
106661
|
}
|
|
106656
106662
|
// ============================================================================
|
|
@@ -106744,6 +106750,7 @@ class DetailPageService {
|
|
|
106744
106750
|
totalCost: trace.totalCost || trace.calculatedTotalCost,
|
|
106745
106751
|
totalTokens: trace.totalTokens,
|
|
106746
106752
|
environment: trace.environment,
|
|
106753
|
+
source: typeof trace.source === "string" && trace.source.length > 0 ? trace.source : void 0,
|
|
106747
106754
|
observations: (trace.observations || []).map(
|
|
106748
106755
|
(obs) => this.transformObservation(obs)
|
|
106749
106756
|
),
|
|
@@ -109471,6 +109478,526 @@ function NodeDetailPanel({
|
|
|
109471
109478
|
)
|
|
109472
109479
|
] });
|
|
109473
109480
|
}
|
|
109481
|
+
const MicIcon = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: [
|
|
109482
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109483
|
+
"path",
|
|
109484
|
+
{
|
|
109485
|
+
d: "M8 2C7.60218 2 7.22064 2.15804 6.93934 2.43934C6.65804 2.72064 6.5 3.10218 6.5 3.5V6.5C6.5 6.89782 6.65804 7.27936 6.93934 7.56066C7.22064 7.84196 7.60218 8 8 8C8.39782 8 8.77936 7.84196 9.06066 7.56066C9.34196 7.27936 9.5 6.89782 9.5 6.5V3.5C9.5 3.10218 9.34196 2.72064 9.06066 2.43934C8.77936 2.15804 8.39782 2 8 2Z",
|
|
109486
|
+
fill: "#155EEF"
|
|
109487
|
+
}
|
|
109488
|
+
),
|
|
109489
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109490
|
+
"path",
|
|
109491
|
+
{
|
|
109492
|
+
d: "M5.5 6V6.5C5.5 7.16304 5.76339 7.79893 6.23223 8.26777C6.70107 8.73661 7.33696 9 8 9C8.66304 9 9.29893 8.73661 9.76777 8.26777C10.2366 7.79893 10.5 7.16304 10.5 6.5V6",
|
|
109493
|
+
stroke: "#155EEF",
|
|
109494
|
+
strokeWidth: "1.2",
|
|
109495
|
+
strokeLinecap: "round",
|
|
109496
|
+
strokeLinejoin: "round"
|
|
109497
|
+
}
|
|
109498
|
+
),
|
|
109499
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109500
|
+
"path",
|
|
109501
|
+
{
|
|
109502
|
+
d: "M8 9V11",
|
|
109503
|
+
stroke: "#155EEF",
|
|
109504
|
+
strokeWidth: "1.2",
|
|
109505
|
+
strokeLinecap: "round",
|
|
109506
|
+
strokeLinejoin: "round"
|
|
109507
|
+
}
|
|
109508
|
+
),
|
|
109509
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109510
|
+
"path",
|
|
109511
|
+
{
|
|
109512
|
+
d: "M6.5 11H9.5",
|
|
109513
|
+
stroke: "#155EEF",
|
|
109514
|
+
strokeWidth: "1.2",
|
|
109515
|
+
strokeLinecap: "round",
|
|
109516
|
+
strokeLinejoin: "round"
|
|
109517
|
+
}
|
|
109518
|
+
)
|
|
109519
|
+
] });
|
|
109520
|
+
function VoiceEventLogsBanner({ onViewEventLogs }) {
|
|
109521
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between rounded-[8px] bg-[#FFFFFF] border border-[#D0D5DD] px-[12px] py-[8px] mb-[8px]", children: [
|
|
109522
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[8px]", children: [
|
|
109523
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MicIcon, {}),
|
|
109524
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-[11px] leading-[14px] text-[#98A2B3] uppercase tracking-[0.04em]", children: "Voice-to-Voice Event Logs" })
|
|
109525
|
+
] }),
|
|
109526
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109527
|
+
"button",
|
|
109528
|
+
{
|
|
109529
|
+
onClick: onViewEventLogs,
|
|
109530
|
+
className: "text-[12px] font-medium text-[#155EEF] hover:text-[#344054] hover:underline transition-colors cursor-pointer bg-transparent border-none p-0",
|
|
109531
|
+
"data-test-id": "view-event-logs-btn",
|
|
109532
|
+
children: "View Event Logs"
|
|
109533
|
+
}
|
|
109534
|
+
)
|
|
109535
|
+
] });
|
|
109536
|
+
}
|
|
109537
|
+
function AlignLeftIcon({ className }) {
|
|
109538
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109539
|
+
"svg",
|
|
109540
|
+
{
|
|
109541
|
+
width: "16",
|
|
109542
|
+
height: "16",
|
|
109543
|
+
viewBox: "0 0 16 16",
|
|
109544
|
+
fill: "none",
|
|
109545
|
+
className,
|
|
109546
|
+
"aria-hidden": "true",
|
|
109547
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109548
|
+
"path",
|
|
109549
|
+
{
|
|
109550
|
+
d: "M10.6667 6.66667H2M13.3333 4H2M13.3333 9.33333H2M10.6667 12H2",
|
|
109551
|
+
stroke: "currentColor",
|
|
109552
|
+
strokeWidth: "1.3",
|
|
109553
|
+
strokeLinecap: "round",
|
|
109554
|
+
strokeLinejoin: "round"
|
|
109555
|
+
}
|
|
109556
|
+
)
|
|
109557
|
+
}
|
|
109558
|
+
);
|
|
109559
|
+
}
|
|
109560
|
+
function JsonViewIcon({ className }) {
|
|
109561
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109562
|
+
"svg",
|
|
109563
|
+
{
|
|
109564
|
+
width: "16",
|
|
109565
|
+
height: "16",
|
|
109566
|
+
viewBox: "0 0 16 16",
|
|
109567
|
+
fill: "none",
|
|
109568
|
+
className,
|
|
109569
|
+
"aria-hidden": "true",
|
|
109570
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109571
|
+
"path",
|
|
109572
|
+
{
|
|
109573
|
+
d: "M14 6.16602H8M14 2.66602H2M14 9.83268H8M14 13.3327H2M2.85333 5.70602L5.43111 7.63935C5.62411 7.78409 5.7206 7.85647 5.75511 7.94519C5.78533 8.02291 5.78533 8.10913 5.75511 8.18684C5.7206 8.27556 5.62411 8.34794 5.43111 8.49268L2.85333 10.426C2.57868 10.632 2.44135 10.735 2.3264 10.7326C2.22637 10.7305 2.13256 10.6836 2.07088 10.6048C2 10.5143 2 10.3427 2 9.99935V6.13268C2 5.78937 2 5.61771 2.07088 5.52718C2.13256 5.4484 2.22637 5.4015 2.3264 5.39942C2.44135 5.39703 2.57868 5.50003 2.85333 5.70602Z",
|
|
109574
|
+
stroke: "currentColor",
|
|
109575
|
+
strokeWidth: "1.3",
|
|
109576
|
+
strokeLinecap: "round",
|
|
109577
|
+
strokeLinejoin: "round"
|
|
109578
|
+
}
|
|
109579
|
+
)
|
|
109580
|
+
}
|
|
109581
|
+
);
|
|
109582
|
+
}
|
|
109583
|
+
function pickString(obj, keys2) {
|
|
109584
|
+
for (const key of keys2) {
|
|
109585
|
+
const value = obj[key];
|
|
109586
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
109587
|
+
if (typeof value === "number") return String(value);
|
|
109588
|
+
}
|
|
109589
|
+
return void 0;
|
|
109590
|
+
}
|
|
109591
|
+
function coerceDirection(raw) {
|
|
109592
|
+
if (raw === "incoming" || raw === "server" || raw === "response") return "in";
|
|
109593
|
+
return "out";
|
|
109594
|
+
}
|
|
109595
|
+
function normalizeEvent(raw, fallbackId, docTimestamp) {
|
|
109596
|
+
if (!raw || typeof raw !== "object") {
|
|
109597
|
+
return {
|
|
109598
|
+
id: fallbackId,
|
|
109599
|
+
timestamp: docTimestamp,
|
|
109600
|
+
name: "event",
|
|
109601
|
+
direction: "out",
|
|
109602
|
+
payload: raw
|
|
109603
|
+
};
|
|
109604
|
+
}
|
|
109605
|
+
const obj = raw;
|
|
109606
|
+
const id = pickString(obj, ["event_id", "eventId", "_id", "id"]) ?? fallbackId;
|
|
109607
|
+
const name = pickString(obj, ["type", "eventType", "event", "name"]) ?? "event";
|
|
109608
|
+
const direction = coerceDirection(obj.direction);
|
|
109609
|
+
return {
|
|
109610
|
+
id,
|
|
109611
|
+
timestamp: docTimestamp,
|
|
109612
|
+
name,
|
|
109613
|
+
direction,
|
|
109614
|
+
payload: raw
|
|
109615
|
+
};
|
|
109616
|
+
}
|
|
109617
|
+
function flattenEvents(data) {
|
|
109618
|
+
if (data === null || data === void 0) return [];
|
|
109619
|
+
const out = [];
|
|
109620
|
+
const visitDoc = (doc2, docIdx) => {
|
|
109621
|
+
if (!doc2 || typeof doc2 !== "object") return;
|
|
109622
|
+
const docObj = doc2;
|
|
109623
|
+
const docTimestamp = pickString(docObj, ["createdOn", "sT", "createdAt"]);
|
|
109624
|
+
const events = docObj.events;
|
|
109625
|
+
if (Array.isArray(events)) {
|
|
109626
|
+
events.forEach((ev, evIdx) => {
|
|
109627
|
+
out.push(normalizeEvent(ev, `${docIdx}-${evIdx}`, docTimestamp));
|
|
109628
|
+
});
|
|
109629
|
+
} else {
|
|
109630
|
+
out.push(normalizeEvent(doc2, String(docIdx), docTimestamp));
|
|
109631
|
+
}
|
|
109632
|
+
};
|
|
109633
|
+
if (Array.isArray(data)) {
|
|
109634
|
+
data.forEach((doc2, docIdx) => visitDoc(doc2, docIdx));
|
|
109635
|
+
return out;
|
|
109636
|
+
}
|
|
109637
|
+
if (typeof data === "object") {
|
|
109638
|
+
const obj = data;
|
|
109639
|
+
if (Array.isArray(obj.events)) {
|
|
109640
|
+
visitDoc(obj, 0);
|
|
109641
|
+
return out;
|
|
109642
|
+
}
|
|
109643
|
+
if (Array.isArray(obj.data)) {
|
|
109644
|
+
return flattenEvents(obj.data);
|
|
109645
|
+
}
|
|
109646
|
+
}
|
|
109647
|
+
return [];
|
|
109648
|
+
}
|
|
109649
|
+
function formatEventTime(iso) {
|
|
109650
|
+
if (!iso) return "--:--:--:---";
|
|
109651
|
+
const d3 = new Date(iso);
|
|
109652
|
+
if (Number.isNaN(d3.getTime())) return "--:--:--:---";
|
|
109653
|
+
const hh = String(d3.getHours()).padStart(2, "0");
|
|
109654
|
+
const mm = String(d3.getMinutes()).padStart(2, "0");
|
|
109655
|
+
const ss = String(d3.getSeconds()).padStart(2, "0");
|
|
109656
|
+
const ms = String(d3.getMilliseconds()).padStart(3, "0");
|
|
109657
|
+
return `${hh}:${mm}:${ss}:${ms}`;
|
|
109658
|
+
}
|
|
109659
|
+
function stringifyPayload(payload) {
|
|
109660
|
+
if (payload === null || payload === void 0) return "";
|
|
109661
|
+
if (typeof payload === "string") {
|
|
109662
|
+
try {
|
|
109663
|
+
return JSON.stringify(JSON.parse(payload), null, 2);
|
|
109664
|
+
} catch {
|
|
109665
|
+
return payload;
|
|
109666
|
+
}
|
|
109667
|
+
}
|
|
109668
|
+
try {
|
|
109669
|
+
return JSON.stringify(payload, null, 2);
|
|
109670
|
+
} catch {
|
|
109671
|
+
return String(payload);
|
|
109672
|
+
}
|
|
109673
|
+
}
|
|
109674
|
+
function compactPayload(payload) {
|
|
109675
|
+
if (payload === null || payload === void 0) return "";
|
|
109676
|
+
if (typeof payload === "string") {
|
|
109677
|
+
try {
|
|
109678
|
+
return JSON.stringify(JSON.parse(payload));
|
|
109679
|
+
} catch {
|
|
109680
|
+
return payload;
|
|
109681
|
+
}
|
|
109682
|
+
}
|
|
109683
|
+
try {
|
|
109684
|
+
return JSON.stringify(payload);
|
|
109685
|
+
} catch {
|
|
109686
|
+
return String(payload);
|
|
109687
|
+
}
|
|
109688
|
+
}
|
|
109689
|
+
function PayloadPanel({ payload, compactText }) {
|
|
109690
|
+
const [viewMode, setViewMode] = useState("json");
|
|
109691
|
+
const [fullscreen, setFullscreen] = useState(false);
|
|
109692
|
+
const [copied, setCopied] = useState(false);
|
|
109693
|
+
const displayText = viewMode === "json" ? payload : compactText;
|
|
109694
|
+
const handleCopy = useCallback(async () => {
|
|
109695
|
+
try {
|
|
109696
|
+
await navigator.clipboard.writeText(displayText);
|
|
109697
|
+
setCopied(true);
|
|
109698
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
109699
|
+
} catch {
|
|
109700
|
+
} finally {
|
|
109701
|
+
setCopied(false);
|
|
109702
|
+
}
|
|
109703
|
+
}, [displayText]);
|
|
109704
|
+
const toolbar = /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-[42px] px-[10px] border-b border-[#D0D5DD] flex items-center justify-between flex-shrink-0 bg-white", children: [
|
|
109705
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109706
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109707
|
+
"button",
|
|
109708
|
+
{
|
|
109709
|
+
type: "button",
|
|
109710
|
+
onClick: () => setViewMode("json"),
|
|
109711
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "json" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109712
|
+
title: "Pretty JSON",
|
|
109713
|
+
"aria-label": "Pretty JSON view",
|
|
109714
|
+
"aria-pressed": viewMode === "json",
|
|
109715
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(JsonViewIcon, { className: "w-[16px] h-[16px]" })
|
|
109716
|
+
}
|
|
109717
|
+
),
|
|
109718
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109719
|
+
"button",
|
|
109720
|
+
{
|
|
109721
|
+
type: "button",
|
|
109722
|
+
onClick: () => setViewMode("text"),
|
|
109723
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "text" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109724
|
+
title: "Compact text",
|
|
109725
|
+
"aria-label": "Compact text view",
|
|
109726
|
+
"aria-pressed": viewMode === "text",
|
|
109727
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlignLeftIcon, { className: "w-[16px] h-[16px]" })
|
|
109728
|
+
}
|
|
109729
|
+
)
|
|
109730
|
+
] }),
|
|
109731
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109732
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109733
|
+
"button",
|
|
109734
|
+
{
|
|
109735
|
+
type: "button",
|
|
109736
|
+
onClick: () => setFullscreen((v) => !v),
|
|
109737
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109738
|
+
title: fullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
109739
|
+
"aria-label": fullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
109740
|
+
children: fullscreen ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize2, { className: "w-[16px] h-[16px]" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Maximize2, { className: "w-[16px] h-[16px]" })
|
|
109741
|
+
}
|
|
109742
|
+
),
|
|
109743
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109744
|
+
"button",
|
|
109745
|
+
{
|
|
109746
|
+
type: "button",
|
|
109747
|
+
onClick: () => void handleCopy(),
|
|
109748
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109749
|
+
title: "Copy to clipboard",
|
|
109750
|
+
"aria-label": "Copy payload",
|
|
109751
|
+
"data-test-id": "event-logs-row-copy",
|
|
109752
|
+
children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "w-[16px] h-[16px] text-[#12B76A]" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "w-[16px] h-[16px]" })
|
|
109753
|
+
}
|
|
109754
|
+
)
|
|
109755
|
+
] })
|
|
109756
|
+
] });
|
|
109757
|
+
if (fullscreen) {
|
|
109758
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-[20000] flex flex-col bg-[#F9FAFB]", children: [
|
|
109759
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-[48px] px-[16px] border-b border-[#E4E7EC] flex items-center justify-between flex-shrink-0 bg-white", children: [
|
|
109760
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109761
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109762
|
+
"button",
|
|
109763
|
+
{
|
|
109764
|
+
type: "button",
|
|
109765
|
+
onClick: () => setViewMode("json"),
|
|
109766
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "json" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109767
|
+
title: "Pretty JSON",
|
|
109768
|
+
"aria-label": "Pretty JSON view",
|
|
109769
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(JsonViewIcon, { className: "w-[16px] h-[16px]" })
|
|
109770
|
+
}
|
|
109771
|
+
),
|
|
109772
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109773
|
+
"button",
|
|
109774
|
+
{
|
|
109775
|
+
type: "button",
|
|
109776
|
+
onClick: () => setViewMode("text"),
|
|
109777
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "text" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109778
|
+
title: "Compact text",
|
|
109779
|
+
"aria-label": "Compact text view",
|
|
109780
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlignLeftIcon, { className: "w-[16px] h-[16px]" })
|
|
109781
|
+
}
|
|
109782
|
+
)
|
|
109783
|
+
] }),
|
|
109784
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109785
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109786
|
+
"button",
|
|
109787
|
+
{
|
|
109788
|
+
type: "button",
|
|
109789
|
+
onClick: () => void handleCopy(),
|
|
109790
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109791
|
+
title: "Copy to clipboard",
|
|
109792
|
+
"aria-label": "Copy payload",
|
|
109793
|
+
children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "w-[16px] h-[16px] text-[#12B76A]" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "w-[16px] h-[16px]" })
|
|
109794
|
+
}
|
|
109795
|
+
),
|
|
109796
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109797
|
+
"button",
|
|
109798
|
+
{
|
|
109799
|
+
type: "button",
|
|
109800
|
+
onClick: () => setFullscreen(false),
|
|
109801
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109802
|
+
title: "Exit fullscreen",
|
|
109803
|
+
"aria-label": "Exit fullscreen",
|
|
109804
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize2, { className: "w-[16px] h-[16px]" })
|
|
109805
|
+
}
|
|
109806
|
+
)
|
|
109807
|
+
] })
|
|
109808
|
+
] }),
|
|
109809
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "flex-1 overflow-auto m-0 p-[20px] text-[13px] leading-[20px] font-mono text-[#344054] whitespace-pre-wrap break-all", children: displayText })
|
|
109810
|
+
] }) });
|
|
109811
|
+
}
|
|
109812
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-[10px] border border-[#D0D5DD] overflow-hidden mt-[12px]", children: [
|
|
109813
|
+
toolbar,
|
|
109814
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("pre", { className: "m-0 bg-[#F9FAFB] text-[#344054] p-[12px] text-[12px] leading-[18px] font-mono whitespace-pre-wrap break-all overflow-auto max-h-[360px]", children: displayText })
|
|
109815
|
+
] });
|
|
109816
|
+
}
|
|
109817
|
+
function EventRow({ event, isExpanded, onToggle }) {
|
|
109818
|
+
const jsonText = useMemo(() => stringifyPayload(event.payload), [event.payload]);
|
|
109819
|
+
const compactText = useMemo(() => compactPayload(event.payload), [event.payload]);
|
|
109820
|
+
const hasPayload = jsonText.length > 0;
|
|
109821
|
+
const isInput = event.direction === "in";
|
|
109822
|
+
const DirectionIcon = isInput ? ArrowUp : ArrowDown;
|
|
109823
|
+
const directionLabel = isInput ? "Input" : "Output";
|
|
109824
|
+
const circleClasses = isInput ? "border-[#079455] text-[#079455]" : "border-[#D92D20] text-[#D92D20]";
|
|
109825
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex items-start gap-[12px]", "data-test-id": "event-logs-row", children: [
|
|
109826
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex-shrink-0 flex flex-col items-center w-[16px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109827
|
+
"div",
|
|
109828
|
+
{
|
|
109829
|
+
className: `relative z-10 w-[16px] h-[16px] rounded-full bg-white border flex items-center justify-center ${circleClasses}`,
|
|
109830
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(DirectionIcon, { className: "w-[8px] h-[8px]", strokeWidth: 2.5 })
|
|
109831
|
+
}
|
|
109832
|
+
) }),
|
|
109833
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 pb-[24px]", children: [
|
|
109834
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-[16px]", children: [
|
|
109835
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
109836
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[12px] leading-[16px] text-[#667085]", children: directionLabel }),
|
|
109837
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[14px] leading-[20px] font-medium text-[#344054] mt-[2px] break-all", children: event.name }),
|
|
109838
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109839
|
+
"button",
|
|
109840
|
+
{
|
|
109841
|
+
type: "button",
|
|
109842
|
+
onClick: onToggle,
|
|
109843
|
+
className: "text-[13px] leading-[18px] text-[#155EEF] hover:underline mt-[4px] font-medium",
|
|
109844
|
+
"data-test-id": "event-logs-view-details",
|
|
109845
|
+
children: isExpanded ? "Hide details" : "View details"
|
|
109846
|
+
}
|
|
109847
|
+
)
|
|
109848
|
+
] }),
|
|
109849
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex-shrink-0 text-[12px] leading-[18px] text-[#344054] font-mono tabular-nums whitespace-nowrap pt-[2px]", children: formatEventTime(event.timestamp) })
|
|
109850
|
+
] }),
|
|
109851
|
+
isExpanded && (hasPayload ? /* @__PURE__ */ jsxRuntimeExports.jsx(PayloadPanel, { payload: jsonText, compactText }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-[12px] text-[12px] text-[#667085] italic", children: "No payload recorded for this event." }))
|
|
109852
|
+
] })
|
|
109853
|
+
] });
|
|
109854
|
+
}
|
|
109855
|
+
function EventLogsSlideout({
|
|
109856
|
+
isOpen,
|
|
109857
|
+
onClose,
|
|
109858
|
+
sessionId,
|
|
109859
|
+
fetchEventLogs
|
|
109860
|
+
}) {
|
|
109861
|
+
const [rawData, setRawData] = useState(null);
|
|
109862
|
+
const [loading, setLoading] = useState(false);
|
|
109863
|
+
const [error, setError] = useState(null);
|
|
109864
|
+
const [expandedIds, setExpandedIds] = useState(() => /* @__PURE__ */ new Set());
|
|
109865
|
+
useEffect(() => {
|
|
109866
|
+
if (!isOpen || !sessionId || !fetchEventLogs) return;
|
|
109867
|
+
let cancelled = false;
|
|
109868
|
+
setLoading(true);
|
|
109869
|
+
setError(null);
|
|
109870
|
+
setRawData(null);
|
|
109871
|
+
(async () => {
|
|
109872
|
+
try {
|
|
109873
|
+
const data = await fetchEventLogs(sessionId);
|
|
109874
|
+
if (cancelled) return;
|
|
109875
|
+
setRawData(data);
|
|
109876
|
+
} catch (err) {
|
|
109877
|
+
if (cancelled) return;
|
|
109878
|
+
setError(err instanceof Error ? err.message : "Failed to fetch event logs");
|
|
109879
|
+
} finally {
|
|
109880
|
+
if (!cancelled) setLoading(false);
|
|
109881
|
+
}
|
|
109882
|
+
})();
|
|
109883
|
+
return () => {
|
|
109884
|
+
cancelled = true;
|
|
109885
|
+
};
|
|
109886
|
+
}, [isOpen, sessionId, fetchEventLogs]);
|
|
109887
|
+
const events = useMemo(() => flattenEvents(rawData), [rawData]);
|
|
109888
|
+
useEffect(() => {
|
|
109889
|
+
if (!isOpen) return;
|
|
109890
|
+
const handleKey = (e3) => {
|
|
109891
|
+
if (e3.key === "Escape") onClose();
|
|
109892
|
+
};
|
|
109893
|
+
document.addEventListener("keydown", handleKey);
|
|
109894
|
+
return () => document.removeEventListener("keydown", handleKey);
|
|
109895
|
+
}, [isOpen, onClose]);
|
|
109896
|
+
useEffect(() => {
|
|
109897
|
+
if (!isOpen) {
|
|
109898
|
+
setExpandedIds(/* @__PURE__ */ new Set());
|
|
109899
|
+
setRawData(null);
|
|
109900
|
+
setError(null);
|
|
109901
|
+
}
|
|
109902
|
+
}, [isOpen]);
|
|
109903
|
+
const toggleRow = useCallback((id) => {
|
|
109904
|
+
setExpandedIds((prev) => {
|
|
109905
|
+
const next = new Set(prev);
|
|
109906
|
+
if (next.has(id)) next.delete(id);
|
|
109907
|
+
else next.add(id);
|
|
109908
|
+
return next;
|
|
109909
|
+
});
|
|
109910
|
+
}, []);
|
|
109911
|
+
const expandAll = useCallback(() => {
|
|
109912
|
+
setExpandedIds(new Set(events.map((e3) => e3.id)));
|
|
109913
|
+
}, [events]);
|
|
109914
|
+
const collapseAll = useCallback(() => {
|
|
109915
|
+
setExpandedIds(/* @__PURE__ */ new Set());
|
|
109916
|
+
}, []);
|
|
109917
|
+
if (!isOpen) return null;
|
|
109918
|
+
const showToolbar = !loading && !error && events.length > 0;
|
|
109919
|
+
const allExpanded = showToolbar && expandedIds.size === events.length;
|
|
109920
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-[10000]", children: [
|
|
109921
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109922
|
+
"div",
|
|
109923
|
+
{
|
|
109924
|
+
className: "absolute inset-0 bg-black/40",
|
|
109925
|
+
onClick: onClose,
|
|
109926
|
+
"aria-hidden": "true"
|
|
109927
|
+
}
|
|
109928
|
+
),
|
|
109929
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
109930
|
+
"div",
|
|
109931
|
+
{
|
|
109932
|
+
className: "absolute top-0 right-0 bottom-0 bg-white shadow-2xl flex flex-col",
|
|
109933
|
+
style: { width: "720px", maxWidth: "100vw" },
|
|
109934
|
+
role: "dialog",
|
|
109935
|
+
"aria-label": "Event Logs",
|
|
109936
|
+
onClick: (e3) => e3.stopPropagation(),
|
|
109937
|
+
children: [
|
|
109938
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between h-[56px] px-[20px] border-b border-[#E4E7EC] flex-shrink-0", children: [
|
|
109939
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[8px]", children: [
|
|
109940
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[16px] font-semibold text-[#101828]", children: "Event Logs" }),
|
|
109941
|
+
!loading && !error && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[12px] font-medium text-[#667085] bg-[#F2F4F7] rounded-[10px] px-[8px] py-[2px]", children: events.length })
|
|
109942
|
+
] }),
|
|
109943
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109944
|
+
showToolbar && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109945
|
+
"button",
|
|
109946
|
+
{
|
|
109947
|
+
type: "button",
|
|
109948
|
+
onClick: allExpanded ? collapseAll : expandAll,
|
|
109949
|
+
className: "text-[13px] font-medium text-[#155EEF] hover:underline px-[8px] py-[6px] rounded-[6px] transition-colors",
|
|
109950
|
+
"data-test-id": "event-logs-toggle-all",
|
|
109951
|
+
children: allExpanded ? "Collapse all" : "Expand all"
|
|
109952
|
+
}
|
|
109953
|
+
),
|
|
109954
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109955
|
+
"button",
|
|
109956
|
+
{
|
|
109957
|
+
type: "button",
|
|
109958
|
+
onClick: onClose,
|
|
109959
|
+
className: "p-[8px] rounded-[6px] hover:bg-[#F2F4F7] transition-colors",
|
|
109960
|
+
title: "Close Event Logs",
|
|
109961
|
+
"aria-label": "Close Event Logs",
|
|
109962
|
+
"data-test-id": "event-logs-close-btn",
|
|
109963
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "w-[16px] h-[16px] text-[#344054]" })
|
|
109964
|
+
}
|
|
109965
|
+
)
|
|
109966
|
+
] })
|
|
109967
|
+
] }),
|
|
109968
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-auto", children: loading ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col items-center justify-center gap-[8px] text-[13px] text-[#667085]", children: [
|
|
109969
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "w-[20px] h-[20px] animate-spin text-[#155EEF]" }),
|
|
109970
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Loading event logs…" })
|
|
109971
|
+
] }) : error ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex flex-col items-center justify-center gap-[8px] text-[13px] text-[#B42318] px-[24px] text-center", children: [
|
|
109972
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "Couldn't load event logs" }),
|
|
109973
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[12px] text-[#667085]", children: error })
|
|
109974
|
+
] }) : events.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full flex items-center justify-center text-[13px] text-[#667085]", children: "No events recorded for this session yet." }) : /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative px-[24px] pt-[28px] pb-[8px]", children: [
|
|
109975
|
+
events.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109976
|
+
"div",
|
|
109977
|
+
{
|
|
109978
|
+
className: "absolute w-px bg-[#D0D5DD]",
|
|
109979
|
+
style: { left: "32px", top: "36px", bottom: "28px" },
|
|
109980
|
+
"aria-hidden": "true"
|
|
109981
|
+
}
|
|
109982
|
+
),
|
|
109983
|
+
events.map((event) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109984
|
+
EventRow,
|
|
109985
|
+
{
|
|
109986
|
+
event,
|
|
109987
|
+
isExpanded: expandedIds.has(event.id),
|
|
109988
|
+
onToggle: () => toggleRow(event.id)
|
|
109989
|
+
},
|
|
109990
|
+
event.id
|
|
109991
|
+
))
|
|
109992
|
+
] }) })
|
|
109993
|
+
]
|
|
109994
|
+
}
|
|
109995
|
+
)
|
|
109996
|
+
] }) });
|
|
109997
|
+
}
|
|
109998
|
+
function hasNonEmptySessionReference(ref) {
|
|
109999
|
+
return typeof ref === "string" && ref.trim().length > 0;
|
|
110000
|
+
}
|
|
109474
110001
|
function DetailPage({
|
|
109475
110002
|
mode: initialMode,
|
|
109476
110003
|
sessionId: initialSessionId,
|
|
@@ -109483,7 +110010,9 @@ function DetailPage({
|
|
|
109483
110010
|
batchSize = DEFAULT_BATCH_SIZE,
|
|
109484
110011
|
initialTraceCount,
|
|
109485
110012
|
initialSessionData,
|
|
109486
|
-
runHeaderInputMode = "display"
|
|
110013
|
+
runHeaderInputMode = "display",
|
|
110014
|
+
onViewEventLogs,
|
|
110015
|
+
fetchEventLogs
|
|
109487
110016
|
}) {
|
|
109488
110017
|
const [currentMode, setCurrentMode] = useState(initialMode);
|
|
109489
110018
|
const [currentSessionId, setCurrentSessionId] = useState(initialSessionId);
|
|
@@ -109493,6 +110022,7 @@ function DetailPage({
|
|
|
109493
110022
|
const traceId = currentTraceId;
|
|
109494
110023
|
const [selectedNode, setSelectedNode] = useState(null);
|
|
109495
110024
|
const [copiedId, setCopiedId] = useState(false);
|
|
110025
|
+
const [isEventLogsOpen, setIsEventLogsOpen] = useState(false);
|
|
109496
110026
|
const minObservationLevel = "DEFAULT";
|
|
109497
110027
|
const [hasAutoSelected, setHasAutoSelected] = useState(false);
|
|
109498
110028
|
const hasInitialData = mode === "session" && initialSessionData;
|
|
@@ -109538,7 +110068,8 @@ function DetailPage({
|
|
|
109538
110068
|
bookmarked: false,
|
|
109539
110069
|
public: false,
|
|
109540
110070
|
traces: [],
|
|
109541
|
-
scores: []
|
|
110071
|
+
scores: [],
|
|
110072
|
+
sessionReference: meta.sessionReference
|
|
109542
110073
|
});
|
|
109543
110074
|
setLoadingState("success");
|
|
109544
110075
|
},
|
|
@@ -109722,6 +110253,10 @@ function DetailPage({
|
|
|
109722
110253
|
} : null
|
|
109723
110254
|
};
|
|
109724
110255
|
}, [mode, sessionData, traceData, sessionId, traceId, initialSessionData]);
|
|
110256
|
+
const sessionReferenceForEventLogs = useMemo(() => {
|
|
110257
|
+
return (initialSessionData == null ? void 0 : initialSessionData.sessionReference) ?? (sessionData == null ? void 0 : sessionData.sessionReference);
|
|
110258
|
+
}, [initialSessionData == null ? void 0 : initialSessionData.sessionReference, sessionData == null ? void 0 : sessionData.sessionReference]);
|
|
110259
|
+
const showEventLogsBanner = mode === "session" && hasNonEmptySessionReference(sessionReferenceForEventLogs);
|
|
109725
110260
|
const traces = useMemo(() => {
|
|
109726
110261
|
if (mode === "session" && sessionData) {
|
|
109727
110262
|
const sorted = [...sessionData.traces].sort((a4, b2) => {
|
|
@@ -109770,6 +110305,16 @@ function DetailPage({
|
|
|
109770
110305
|
mode,
|
|
109771
110306
|
traceData
|
|
109772
110307
|
]);
|
|
110308
|
+
const handleViewEventLogs = useCallback(() => {
|
|
110309
|
+
setIsEventLogsOpen(true);
|
|
110310
|
+
if (onViewEventLogs && sessionId) {
|
|
110311
|
+
const firstTraceId = traces.length > 0 ? traces[0].id : void 0;
|
|
110312
|
+
onViewEventLogs(sessionId, firstTraceId);
|
|
110313
|
+
}
|
|
110314
|
+
}, [onViewEventLogs, sessionId, traces]);
|
|
110315
|
+
const handleCloseEventLogs = useCallback(() => {
|
|
110316
|
+
setIsEventLogsOpen(false);
|
|
110317
|
+
}, []);
|
|
109773
110318
|
const handleNodeSelect = useCallback((node) => {
|
|
109774
110319
|
setSelectedNode(node);
|
|
109775
110320
|
}, []);
|
|
@@ -109986,6 +110531,7 @@ function DetailPage({
|
|
|
109986
110531
|
] }),
|
|
109987
110532
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
109988
110533
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-[480px] min-w-[400px] max-w-[600px] border-r border-[#E4E7EC] flex flex-col bg-[#F9FAFB] overflow-auto", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 p-[16px]", children: [
|
|
110534
|
+
showEventLogsBanner && /* @__PURE__ */ jsxRuntimeExports.jsx(VoiceEventLogsBanner, { onViewEventLogs: handleViewEventLogs }),
|
|
109989
110535
|
traces.length === 0 && loadingState === "success" && progressiveState.traceCount === 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "py-[32px] text-center text-[13px] text-[#667085]", children: "No traces available" }),
|
|
109990
110536
|
traces.map((trace, index) => {
|
|
109991
110537
|
var _a, _b, _c, _d;
|
|
@@ -110035,7 +110581,16 @@ function DetailPage({
|
|
|
110035
110581
|
generationSummaryInputOverride
|
|
110036
110582
|
}
|
|
110037
110583
|
)
|
|
110038
|
-
] })
|
|
110584
|
+
] }),
|
|
110585
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110586
|
+
EventLogsSlideout,
|
|
110587
|
+
{
|
|
110588
|
+
isOpen: isEventLogsOpen,
|
|
110589
|
+
onClose: handleCloseEventLogs,
|
|
110590
|
+
sessionId: sessionId ?? null,
|
|
110591
|
+
fetchEventLogs
|
|
110592
|
+
}
|
|
110593
|
+
)
|
|
110039
110594
|
] });
|
|
110040
110595
|
}
|
|
110041
110596
|
const trace1Observations = [
|
|
@@ -110449,7 +111004,7 @@ function EnvironmentNameCell$1({ envId }) {
|
|
|
110449
111004
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-gray-600", title: envId || "-", children: displayName });
|
|
110450
111005
|
}
|
|
110451
111006
|
function SessionsListContent(props) {
|
|
110452
|
-
const { apiConfig, onSessionClick, className = "", defaultFilters = [], defaultTimeRange = "24 hours", initialSessionId } = props;
|
|
111007
|
+
const { apiConfig, onSessionClick, className = "", defaultFilters = [], defaultTimeRange = "24 hours", initialSessionId, onViewEventLogs, fetchEventLogs } = props;
|
|
110453
111008
|
const { environments, resolveEnvironmentName } = useEnvironment();
|
|
110454
111009
|
const [selectedSessionId, setSelectedSessionId] = useState(() => initialSessionId ?? null);
|
|
110455
111010
|
const [selectedSessionData, setSelectedSessionData] = useState(null);
|
|
@@ -111010,7 +111565,8 @@ function SessionsListContent(props) {
|
|
|
111010
111565
|
totalCost: session.totalCost,
|
|
111011
111566
|
totalTokens: session.totalTokens,
|
|
111012
111567
|
sessionDuration: session.sessionDuration,
|
|
111013
|
-
createdAt: session.createdAt
|
|
111568
|
+
createdAt: session.createdAt,
|
|
111569
|
+
sessionReference: session.sessionReference
|
|
111014
111570
|
});
|
|
111015
111571
|
setIsModalOpen(true);
|
|
111016
111572
|
if (onSessionClick) {
|
|
@@ -111120,7 +111676,9 @@ function SessionsListContent(props) {
|
|
|
111120
111676
|
sessionId: selectedSessionId,
|
|
111121
111677
|
apiConfig,
|
|
111122
111678
|
onClose: handleModalClose,
|
|
111123
|
-
initialSessionData: selectedSessionData || void 0
|
|
111679
|
+
initialSessionData: selectedSessionData || void 0,
|
|
111680
|
+
onViewEventLogs,
|
|
111681
|
+
fetchEventLogs
|
|
111124
111682
|
}
|
|
111125
111683
|
) })
|
|
111126
111684
|
] });
|
|
@@ -112996,6 +113554,57 @@ function calculateNodeMetrics(node) {
|
|
|
112996
113554
|
return { totalTokens, totalCost, totalDuration };
|
|
112997
113555
|
}
|
|
112998
113556
|
class TreeBuilder {
|
|
113557
|
+
static isPreProcessorNode(node) {
|
|
113558
|
+
const normalizedName = (node.name || "").replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
113559
|
+
return node.type === "tool" && normalizedName === "preprocessor";
|
|
113560
|
+
}
|
|
113561
|
+
static normalizeNodeName(name) {
|
|
113562
|
+
return (name || "").replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
113563
|
+
}
|
|
113564
|
+
static normalizeLinkedEventType(node) {
|
|
113565
|
+
var _a;
|
|
113566
|
+
const linkedEventType = (_a = node.metadata) == null ? void 0 : _a.linkedEventType;
|
|
113567
|
+
if (typeof linkedEventType !== "string" || linkedEventType.trim().length === 0) {
|
|
113568
|
+
return null;
|
|
113569
|
+
}
|
|
113570
|
+
return linkedEventType.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
113571
|
+
}
|
|
113572
|
+
static normalizeParentId(parentId) {
|
|
113573
|
+
if (typeof parentId !== "string") {
|
|
113574
|
+
return parentId ?? null;
|
|
113575
|
+
}
|
|
113576
|
+
const trimmedParentId = parentId.trim();
|
|
113577
|
+
if (trimmedParentId.length === 0 || trimmedParentId.toLowerCase() === "null" || trimmedParentId.toLowerCase() === "undefined") {
|
|
113578
|
+
return null;
|
|
113579
|
+
}
|
|
113580
|
+
return trimmedParentId;
|
|
113581
|
+
}
|
|
113582
|
+
static isTargetSystemEventNode(node) {
|
|
113583
|
+
const normalizedName = this.normalizeNodeName(node.name || "");
|
|
113584
|
+
if (this.TARGET_EVENT_NAMES.has(normalizedName)) return true;
|
|
113585
|
+
return typeof node.type === "string" && node.type.toLowerCase() === "event";
|
|
113586
|
+
}
|
|
113587
|
+
static compareNodesForDisplay(a4, b2) {
|
|
113588
|
+
const aIsPreProcessor = this.isPreProcessorNode(a4);
|
|
113589
|
+
const bIsPreProcessor = this.isPreProcessorNode(b2);
|
|
113590
|
+
const aIsTargetEvent = this.isTargetSystemEventNode(a4);
|
|
113591
|
+
const bIsTargetEvent = this.isTargetSystemEventNode(b2);
|
|
113592
|
+
const aLinkedEventType = this.normalizeLinkedEventType(a4);
|
|
113593
|
+
const bLinkedEventType = this.normalizeLinkedEventType(b2);
|
|
113594
|
+
const aTargetName = this.normalizeNodeName(a4.name || "");
|
|
113595
|
+
const bTargetName = this.normalizeNodeName(b2.name || "");
|
|
113596
|
+
if (aIsPreProcessor && bIsTargetEvent && aLinkedEventType !== null && aLinkedEventType === bTargetName) {
|
|
113597
|
+
return -1;
|
|
113598
|
+
}
|
|
113599
|
+
if (aIsTargetEvent && bIsPreProcessor && bLinkedEventType !== null && bLinkedEventType === aTargetName) {
|
|
113600
|
+
return 1;
|
|
113601
|
+
}
|
|
113602
|
+
const timestampDiff = new Date(a4.startTime).getTime() - new Date(b2.startTime).getTime();
|
|
113603
|
+
if (timestampDiff !== 0) {
|
|
113604
|
+
return timestampDiff;
|
|
113605
|
+
}
|
|
113606
|
+
return (a4.name || "").localeCompare(b2.name || "");
|
|
113607
|
+
}
|
|
112999
113608
|
/**
|
|
113000
113609
|
* Process execution events and build a hierarchical tree structure
|
|
113001
113610
|
* Session > Run > Node Tree
|
|
@@ -113054,6 +113663,7 @@ class TreeBuilder {
|
|
|
113054
113663
|
const node = this.createTreeNodeFromEvents(startedEvent, completedEvent, runId);
|
|
113055
113664
|
nodes.push(node);
|
|
113056
113665
|
}
|
|
113666
|
+
this.alignEventPreProcessorNodes(nodes);
|
|
113057
113667
|
const rootNodes = this.buildNodeHierarchy(nodes);
|
|
113058
113668
|
const runEvents = events.filter((e3) => e3.runId === runId);
|
|
113059
113669
|
const startTime = Math.min(...runEvents.map((e3) => new Date(e3.data.timestamp).getTime()));
|
|
@@ -113136,8 +113746,10 @@ class TreeBuilder {
|
|
|
113136
113746
|
nodes.forEach((node) => nodeMap.set(node.id, node));
|
|
113137
113747
|
const rootNodes = [];
|
|
113138
113748
|
nodes.forEach((node) => {
|
|
113139
|
-
|
|
113140
|
-
|
|
113749
|
+
const normalizedParentId = this.normalizeParentId(node.parentId);
|
|
113750
|
+
node.parentId = normalizedParentId;
|
|
113751
|
+
if (normalizedParentId && nodeMap.has(normalizedParentId)) {
|
|
113752
|
+
const parent = nodeMap.get(normalizedParentId);
|
|
113141
113753
|
parent.children.push(node);
|
|
113142
113754
|
node.level = parent.level + 1;
|
|
113143
113755
|
} else {
|
|
@@ -113145,12 +113757,98 @@ class TreeBuilder {
|
|
|
113145
113757
|
node.level = 0;
|
|
113146
113758
|
}
|
|
113147
113759
|
});
|
|
113148
|
-
rootNodes.sort(
|
|
113149
|
-
(a4, b2) => new Date(a4.startTime).getTime() - new Date(b2.startTime).getTime()
|
|
113150
|
-
);
|
|
113760
|
+
rootNodes.sort((a4, b2) => this.compareNodesForDisplay(a4, b2));
|
|
113151
113761
|
rootNodes.forEach((root2) => this.sortChildren(root2));
|
|
113762
|
+
this.relocateRootEventPreProcessors(rootNodes);
|
|
113152
113763
|
return rootNodes;
|
|
113153
113764
|
}
|
|
113765
|
+
static alignEventPreProcessorNodes(nodes) {
|
|
113766
|
+
const targetEvents = nodes.filter((node) => this.isTargetSystemEventNode(node)).sort((a4, b2) => new Date(a4.startTime).getTime() - new Date(b2.startTime).getTime());
|
|
113767
|
+
if (targetEvents.length === 0) {
|
|
113768
|
+
return;
|
|
113769
|
+
}
|
|
113770
|
+
const orphanPreProcessors = nodes.filter((node) => this.isPreProcessorNode(node) && this.normalizeParentId(node.parentId) === null).sort((a4, b2) => new Date(a4.startTime).getTime() - new Date(b2.startTime).getTime());
|
|
113771
|
+
for (const preProcessorNode of orphanPreProcessors) {
|
|
113772
|
+
const linkedEventType = this.normalizeLinkedEventType(preProcessorNode);
|
|
113773
|
+
if (linkedEventType === null) {
|
|
113774
|
+
continue;
|
|
113775
|
+
}
|
|
113776
|
+
const candidateEvents = targetEvents.filter(
|
|
113777
|
+
(eventNode) => this.normalizeNodeName(eventNode.name || "") === linkedEventType
|
|
113778
|
+
);
|
|
113779
|
+
if (candidateEvents.length === 0) {
|
|
113780
|
+
continue;
|
|
113781
|
+
}
|
|
113782
|
+
const preProcessorTime = new Date(preProcessorNode.startTime).getTime();
|
|
113783
|
+
let selectedTargetEvent = candidateEvents[0];
|
|
113784
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
113785
|
+
for (const targetEvent of candidateEvents) {
|
|
113786
|
+
const distance = Math.abs(new Date(targetEvent.startTime).getTime() - preProcessorTime);
|
|
113787
|
+
if (distance < minDistance) {
|
|
113788
|
+
selectedTargetEvent = targetEvent;
|
|
113789
|
+
minDistance = distance;
|
|
113790
|
+
}
|
|
113791
|
+
}
|
|
113792
|
+
preProcessorNode.parentId = this.normalizeParentId(selectedTargetEvent.parentId);
|
|
113793
|
+
}
|
|
113794
|
+
}
|
|
113795
|
+
static relocateRootEventPreProcessors(rootNodes) {
|
|
113796
|
+
var _a;
|
|
113797
|
+
const preprocessorsAtRoot = rootNodes.filter((node) => this.isPreProcessorNode(node));
|
|
113798
|
+
if (preprocessorsAtRoot.length === 0) {
|
|
113799
|
+
return;
|
|
113800
|
+
}
|
|
113801
|
+
const collectTargetNodes = (nodesToSearch, parentNode2, collector) => {
|
|
113802
|
+
nodesToSearch.forEach((node, index) => {
|
|
113803
|
+
if (this.isTargetSystemEventNode(node)) {
|
|
113804
|
+
collector.push({ node, siblings: nodesToSearch, index, parentNode: parentNode2 });
|
|
113805
|
+
}
|
|
113806
|
+
if (node.children.length > 0) {
|
|
113807
|
+
collectTargetNodes(node.children, node, collector);
|
|
113808
|
+
}
|
|
113809
|
+
});
|
|
113810
|
+
};
|
|
113811
|
+
const targetNodes = [];
|
|
113812
|
+
collectTargetNodes(rootNodes, null, targetNodes);
|
|
113813
|
+
if (targetNodes.length === 0) {
|
|
113814
|
+
return;
|
|
113815
|
+
}
|
|
113816
|
+
const rootSet = new Set(rootNodes);
|
|
113817
|
+
for (const preProcessorNode of preprocessorsAtRoot) {
|
|
113818
|
+
if (!rootSet.has(preProcessorNode)) {
|
|
113819
|
+
continue;
|
|
113820
|
+
}
|
|
113821
|
+
const linkedEventType = this.normalizeLinkedEventType(preProcessorNode);
|
|
113822
|
+
if (linkedEventType === null) {
|
|
113823
|
+
continue;
|
|
113824
|
+
}
|
|
113825
|
+
const candidateTargets = targetNodes.filter(
|
|
113826
|
+
(target) => this.normalizeNodeName(target.node.name || "") === linkedEventType
|
|
113827
|
+
);
|
|
113828
|
+
if (candidateTargets.length === 0) {
|
|
113829
|
+
continue;
|
|
113830
|
+
}
|
|
113831
|
+
const preProcessorTime = new Date(preProcessorNode.startTime).getTime();
|
|
113832
|
+
let selectedTarget = candidateTargets[0];
|
|
113833
|
+
let selectedDistance = Number.POSITIVE_INFINITY;
|
|
113834
|
+
for (const candidate of candidateTargets) {
|
|
113835
|
+
const candidateTime = new Date(candidate.node.startTime).getTime();
|
|
113836
|
+
const distance = Math.abs(candidateTime - preProcessorTime);
|
|
113837
|
+
if (distance < selectedDistance) {
|
|
113838
|
+
selectedTarget = candidate;
|
|
113839
|
+
selectedDistance = distance;
|
|
113840
|
+
}
|
|
113841
|
+
}
|
|
113842
|
+
const rootIndex = rootNodes.indexOf(preProcessorNode);
|
|
113843
|
+
if (rootIndex >= 0) {
|
|
113844
|
+
rootNodes.splice(rootIndex, 1);
|
|
113845
|
+
rootSet.delete(preProcessorNode);
|
|
113846
|
+
}
|
|
113847
|
+
preProcessorNode.parentId = ((_a = selectedTarget.parentNode) == null ? void 0 : _a.id) ?? null;
|
|
113848
|
+
selectedTarget.siblings.splice(selectedTarget.index, 0, preProcessorNode);
|
|
113849
|
+
selectedTarget.siblings.sort((a4, b2) => this.compareNodesForDisplay(a4, b2));
|
|
113850
|
+
}
|
|
113851
|
+
}
|
|
113154
113852
|
/**
|
|
113155
113853
|
* Extract LLM usage metadata from output and event metadata (configurable path)
|
|
113156
113854
|
*/
|
|
@@ -113242,9 +113940,7 @@ class TreeBuilder {
|
|
|
113242
113940
|
*/
|
|
113243
113941
|
static sortChildren(node) {
|
|
113244
113942
|
if (!node) return;
|
|
113245
|
-
node.children.sort(
|
|
113246
|
-
(a4, b2) => new Date(a4.startTime).getTime() - new Date(b2.startTime).getTime()
|
|
113247
|
-
);
|
|
113943
|
+
node.children.sort((a4, b2) => this.compareNodesForDisplay(a4, b2));
|
|
113248
113944
|
node.children.forEach((child) => this.sortChildren(child));
|
|
113249
113945
|
}
|
|
113250
113946
|
/**
|
|
@@ -113498,6 +114194,10 @@ class TreeBuilder {
|
|
|
113498
114194
|
);
|
|
113499
114195
|
}
|
|
113500
114196
|
}
|
|
114197
|
+
__publicField(TreeBuilder, "TARGET_EVENT_NAMES", /* @__PURE__ */ new Set([
|
|
114198
|
+
"endofconversation",
|
|
114199
|
+
"agenthandoff"
|
|
114200
|
+
]));
|
|
113501
114201
|
const CodeEditor = ({
|
|
113502
114202
|
value,
|
|
113503
114203
|
onChange,
|