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/ui-libs.umd.js
CHANGED
|
@@ -106546,6 +106546,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
106546
106546
|
);
|
|
106547
106547
|
traceDetails = traceResponses.map((trace) => this.transformToTraceDetailData(trace));
|
|
106548
106548
|
}
|
|
106549
|
+
const resolvedSessionReference = typeof sessionResponse.sessionReference === "string" && sessionResponse.sessionReference.trim() !== "" ? sessionResponse.sessionReference.trim() : void 0;
|
|
106549
106550
|
return {
|
|
106550
106551
|
id: sessionResponse.id,
|
|
106551
106552
|
projectId: sessionResponse.projectId,
|
|
@@ -106553,7 +106554,8 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
106553
106554
|
bookmarked: false,
|
|
106554
106555
|
public: false,
|
|
106555
106556
|
traces: traceDetails,
|
|
106556
|
-
scores: []
|
|
106557
|
+
scores: [],
|
|
106558
|
+
sessionReference: resolvedSessionReference
|
|
106557
106559
|
};
|
|
106558
106560
|
}
|
|
106559
106561
|
/**
|
|
@@ -106630,10 +106632,12 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
106630
106632
|
projectId: this.projectId
|
|
106631
106633
|
});
|
|
106632
106634
|
const traceIds = (sessionResponse.traces || []).map((t) => t.id);
|
|
106635
|
+
const resolvedSessionReference = typeof sessionResponse.sessionReference === "string" && sessionResponse.sessionReference.trim() !== "" ? sessionResponse.sessionReference.trim() : void 0;
|
|
106633
106636
|
onSessionMeta({
|
|
106634
106637
|
id: sessionResponse.id,
|
|
106635
106638
|
traceCount: traceIds.length,
|
|
106636
|
-
traceIds
|
|
106639
|
+
traceIds,
|
|
106640
|
+
sessionReference: resolvedSessionReference
|
|
106637
106641
|
});
|
|
106638
106642
|
if (traceIds.length === 0) {
|
|
106639
106643
|
return {
|
|
@@ -106643,7 +106647,8 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
106643
106647
|
bookmarked: false,
|
|
106644
106648
|
public: false,
|
|
106645
106649
|
traces: [],
|
|
106646
|
-
scores: []
|
|
106650
|
+
scores: [],
|
|
106651
|
+
sessionReference: resolvedSessionReference
|
|
106647
106652
|
};
|
|
106648
106653
|
}
|
|
106649
106654
|
const firstTraceId = traceIds[0];
|
|
@@ -106690,7 +106695,8 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
106690
106695
|
bookmarked: false,
|
|
106691
106696
|
public: false,
|
|
106692
106697
|
traces: allTraces,
|
|
106693
|
-
scores: []
|
|
106698
|
+
scores: [],
|
|
106699
|
+
sessionReference: resolvedSessionReference
|
|
106694
106700
|
};
|
|
106695
106701
|
}
|
|
106696
106702
|
// ============================================================================
|
|
@@ -106784,6 +106790,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
106784
106790
|
totalCost: trace.totalCost || trace.calculatedTotalCost,
|
|
106785
106791
|
totalTokens: trace.totalTokens,
|
|
106786
106792
|
environment: trace.environment,
|
|
106793
|
+
source: typeof trace.source === "string" && trace.source.length > 0 ? trace.source : void 0,
|
|
106787
106794
|
observations: (trace.observations || []).map(
|
|
106788
106795
|
(obs) => this.transformObservation(obs)
|
|
106789
106796
|
),
|
|
@@ -109511,6 +109518,526 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
109511
109518
|
)
|
|
109512
109519
|
] });
|
|
109513
109520
|
}
|
|
109521
|
+
const MicIcon = () => /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", className: "shrink-0", children: [
|
|
109522
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109523
|
+
"path",
|
|
109524
|
+
{
|
|
109525
|
+
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",
|
|
109526
|
+
fill: "#155EEF"
|
|
109527
|
+
}
|
|
109528
|
+
),
|
|
109529
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109530
|
+
"path",
|
|
109531
|
+
{
|
|
109532
|
+
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",
|
|
109533
|
+
stroke: "#155EEF",
|
|
109534
|
+
strokeWidth: "1.2",
|
|
109535
|
+
strokeLinecap: "round",
|
|
109536
|
+
strokeLinejoin: "round"
|
|
109537
|
+
}
|
|
109538
|
+
),
|
|
109539
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109540
|
+
"path",
|
|
109541
|
+
{
|
|
109542
|
+
d: "M8 9V11",
|
|
109543
|
+
stroke: "#155EEF",
|
|
109544
|
+
strokeWidth: "1.2",
|
|
109545
|
+
strokeLinecap: "round",
|
|
109546
|
+
strokeLinejoin: "round"
|
|
109547
|
+
}
|
|
109548
|
+
),
|
|
109549
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109550
|
+
"path",
|
|
109551
|
+
{
|
|
109552
|
+
d: "M6.5 11H9.5",
|
|
109553
|
+
stroke: "#155EEF",
|
|
109554
|
+
strokeWidth: "1.2",
|
|
109555
|
+
strokeLinecap: "round",
|
|
109556
|
+
strokeLinejoin: "round"
|
|
109557
|
+
}
|
|
109558
|
+
)
|
|
109559
|
+
] });
|
|
109560
|
+
function VoiceEventLogsBanner({ onViewEventLogs }) {
|
|
109561
|
+
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: [
|
|
109562
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[8px]", children: [
|
|
109563
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(MicIcon, {}),
|
|
109564
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-semibold text-[11px] leading-[14px] text-[#98A2B3] uppercase tracking-[0.04em]", children: "Voice-to-Voice Event Logs" })
|
|
109565
|
+
] }),
|
|
109566
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109567
|
+
"button",
|
|
109568
|
+
{
|
|
109569
|
+
onClick: onViewEventLogs,
|
|
109570
|
+
className: "text-[12px] font-medium text-[#155EEF] hover:text-[#344054] hover:underline transition-colors cursor-pointer bg-transparent border-none p-0",
|
|
109571
|
+
"data-test-id": "view-event-logs-btn",
|
|
109572
|
+
children: "View Event Logs"
|
|
109573
|
+
}
|
|
109574
|
+
)
|
|
109575
|
+
] });
|
|
109576
|
+
}
|
|
109577
|
+
function AlignLeftIcon({ className }) {
|
|
109578
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109579
|
+
"svg",
|
|
109580
|
+
{
|
|
109581
|
+
width: "16",
|
|
109582
|
+
height: "16",
|
|
109583
|
+
viewBox: "0 0 16 16",
|
|
109584
|
+
fill: "none",
|
|
109585
|
+
className,
|
|
109586
|
+
"aria-hidden": "true",
|
|
109587
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109588
|
+
"path",
|
|
109589
|
+
{
|
|
109590
|
+
d: "M10.6667 6.66667H2M13.3333 4H2M13.3333 9.33333H2M10.6667 12H2",
|
|
109591
|
+
stroke: "currentColor",
|
|
109592
|
+
strokeWidth: "1.3",
|
|
109593
|
+
strokeLinecap: "round",
|
|
109594
|
+
strokeLinejoin: "round"
|
|
109595
|
+
}
|
|
109596
|
+
)
|
|
109597
|
+
}
|
|
109598
|
+
);
|
|
109599
|
+
}
|
|
109600
|
+
function JsonViewIcon({ className }) {
|
|
109601
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109602
|
+
"svg",
|
|
109603
|
+
{
|
|
109604
|
+
width: "16",
|
|
109605
|
+
height: "16",
|
|
109606
|
+
viewBox: "0 0 16 16",
|
|
109607
|
+
fill: "none",
|
|
109608
|
+
className,
|
|
109609
|
+
"aria-hidden": "true",
|
|
109610
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109611
|
+
"path",
|
|
109612
|
+
{
|
|
109613
|
+
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",
|
|
109614
|
+
stroke: "currentColor",
|
|
109615
|
+
strokeWidth: "1.3",
|
|
109616
|
+
strokeLinecap: "round",
|
|
109617
|
+
strokeLinejoin: "round"
|
|
109618
|
+
}
|
|
109619
|
+
)
|
|
109620
|
+
}
|
|
109621
|
+
);
|
|
109622
|
+
}
|
|
109623
|
+
function pickString(obj, keys2) {
|
|
109624
|
+
for (const key of keys2) {
|
|
109625
|
+
const value = obj[key];
|
|
109626
|
+
if (typeof value === "string" && value.length > 0) return value;
|
|
109627
|
+
if (typeof value === "number") return String(value);
|
|
109628
|
+
}
|
|
109629
|
+
return void 0;
|
|
109630
|
+
}
|
|
109631
|
+
function coerceDirection(raw) {
|
|
109632
|
+
if (raw === "incoming" || raw === "server" || raw === "response") return "in";
|
|
109633
|
+
return "out";
|
|
109634
|
+
}
|
|
109635
|
+
function normalizeEvent(raw, fallbackId, docTimestamp) {
|
|
109636
|
+
if (!raw || typeof raw !== "object") {
|
|
109637
|
+
return {
|
|
109638
|
+
id: fallbackId,
|
|
109639
|
+
timestamp: docTimestamp,
|
|
109640
|
+
name: "event",
|
|
109641
|
+
direction: "out",
|
|
109642
|
+
payload: raw
|
|
109643
|
+
};
|
|
109644
|
+
}
|
|
109645
|
+
const obj = raw;
|
|
109646
|
+
const id = pickString(obj, ["event_id", "eventId", "_id", "id"]) ?? fallbackId;
|
|
109647
|
+
const name = pickString(obj, ["type", "eventType", "event", "name"]) ?? "event";
|
|
109648
|
+
const direction = coerceDirection(obj.direction);
|
|
109649
|
+
return {
|
|
109650
|
+
id,
|
|
109651
|
+
timestamp: docTimestamp,
|
|
109652
|
+
name,
|
|
109653
|
+
direction,
|
|
109654
|
+
payload: raw
|
|
109655
|
+
};
|
|
109656
|
+
}
|
|
109657
|
+
function flattenEvents(data) {
|
|
109658
|
+
if (data === null || data === void 0) return [];
|
|
109659
|
+
const out = [];
|
|
109660
|
+
const visitDoc = (doc2, docIdx) => {
|
|
109661
|
+
if (!doc2 || typeof doc2 !== "object") return;
|
|
109662
|
+
const docObj = doc2;
|
|
109663
|
+
const docTimestamp = pickString(docObj, ["createdOn", "sT", "createdAt"]);
|
|
109664
|
+
const events = docObj.events;
|
|
109665
|
+
if (Array.isArray(events)) {
|
|
109666
|
+
events.forEach((ev, evIdx) => {
|
|
109667
|
+
out.push(normalizeEvent(ev, `${docIdx}-${evIdx}`, docTimestamp));
|
|
109668
|
+
});
|
|
109669
|
+
} else {
|
|
109670
|
+
out.push(normalizeEvent(doc2, String(docIdx), docTimestamp));
|
|
109671
|
+
}
|
|
109672
|
+
};
|
|
109673
|
+
if (Array.isArray(data)) {
|
|
109674
|
+
data.forEach((doc2, docIdx) => visitDoc(doc2, docIdx));
|
|
109675
|
+
return out;
|
|
109676
|
+
}
|
|
109677
|
+
if (typeof data === "object") {
|
|
109678
|
+
const obj = data;
|
|
109679
|
+
if (Array.isArray(obj.events)) {
|
|
109680
|
+
visitDoc(obj, 0);
|
|
109681
|
+
return out;
|
|
109682
|
+
}
|
|
109683
|
+
if (Array.isArray(obj.data)) {
|
|
109684
|
+
return flattenEvents(obj.data);
|
|
109685
|
+
}
|
|
109686
|
+
}
|
|
109687
|
+
return [];
|
|
109688
|
+
}
|
|
109689
|
+
function formatEventTime(iso) {
|
|
109690
|
+
if (!iso) return "--:--:--:---";
|
|
109691
|
+
const d = new Date(iso);
|
|
109692
|
+
if (Number.isNaN(d.getTime())) return "--:--:--:---";
|
|
109693
|
+
const hh = String(d.getHours()).padStart(2, "0");
|
|
109694
|
+
const mm = String(d.getMinutes()).padStart(2, "0");
|
|
109695
|
+
const ss = String(d.getSeconds()).padStart(2, "0");
|
|
109696
|
+
const ms = String(d.getMilliseconds()).padStart(3, "0");
|
|
109697
|
+
return `${hh}:${mm}:${ss}:${ms}`;
|
|
109698
|
+
}
|
|
109699
|
+
function stringifyPayload(payload) {
|
|
109700
|
+
if (payload === null || payload === void 0) return "";
|
|
109701
|
+
if (typeof payload === "string") {
|
|
109702
|
+
try {
|
|
109703
|
+
return JSON.stringify(JSON.parse(payload), null, 2);
|
|
109704
|
+
} catch {
|
|
109705
|
+
return payload;
|
|
109706
|
+
}
|
|
109707
|
+
}
|
|
109708
|
+
try {
|
|
109709
|
+
return JSON.stringify(payload, null, 2);
|
|
109710
|
+
} catch {
|
|
109711
|
+
return String(payload);
|
|
109712
|
+
}
|
|
109713
|
+
}
|
|
109714
|
+
function compactPayload(payload) {
|
|
109715
|
+
if (payload === null || payload === void 0) return "";
|
|
109716
|
+
if (typeof payload === "string") {
|
|
109717
|
+
try {
|
|
109718
|
+
return JSON.stringify(JSON.parse(payload));
|
|
109719
|
+
} catch {
|
|
109720
|
+
return payload;
|
|
109721
|
+
}
|
|
109722
|
+
}
|
|
109723
|
+
try {
|
|
109724
|
+
return JSON.stringify(payload);
|
|
109725
|
+
} catch {
|
|
109726
|
+
return String(payload);
|
|
109727
|
+
}
|
|
109728
|
+
}
|
|
109729
|
+
function PayloadPanel({ payload, compactText }) {
|
|
109730
|
+
const [viewMode, setViewMode] = React.useState("json");
|
|
109731
|
+
const [fullscreen, setFullscreen] = React.useState(false);
|
|
109732
|
+
const [copied, setCopied] = React.useState(false);
|
|
109733
|
+
const displayText = viewMode === "json" ? payload : compactText;
|
|
109734
|
+
const handleCopy = React.useCallback(async () => {
|
|
109735
|
+
try {
|
|
109736
|
+
await navigator.clipboard.writeText(displayText);
|
|
109737
|
+
setCopied(true);
|
|
109738
|
+
await new Promise((resolve) => setTimeout(resolve, 1500));
|
|
109739
|
+
} catch {
|
|
109740
|
+
} finally {
|
|
109741
|
+
setCopied(false);
|
|
109742
|
+
}
|
|
109743
|
+
}, [displayText]);
|
|
109744
|
+
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: [
|
|
109745
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109746
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109747
|
+
"button",
|
|
109748
|
+
{
|
|
109749
|
+
type: "button",
|
|
109750
|
+
onClick: () => setViewMode("json"),
|
|
109751
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "json" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109752
|
+
title: "Pretty JSON",
|
|
109753
|
+
"aria-label": "Pretty JSON view",
|
|
109754
|
+
"aria-pressed": viewMode === "json",
|
|
109755
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(JsonViewIcon, { className: "w-[16px] h-[16px]" })
|
|
109756
|
+
}
|
|
109757
|
+
),
|
|
109758
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109759
|
+
"button",
|
|
109760
|
+
{
|
|
109761
|
+
type: "button",
|
|
109762
|
+
onClick: () => setViewMode("text"),
|
|
109763
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "text" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109764
|
+
title: "Compact text",
|
|
109765
|
+
"aria-label": "Compact text view",
|
|
109766
|
+
"aria-pressed": viewMode === "text",
|
|
109767
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlignLeftIcon, { className: "w-[16px] h-[16px]" })
|
|
109768
|
+
}
|
|
109769
|
+
)
|
|
109770
|
+
] }),
|
|
109771
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109772
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109773
|
+
"button",
|
|
109774
|
+
{
|
|
109775
|
+
type: "button",
|
|
109776
|
+
onClick: () => setFullscreen((v) => !v),
|
|
109777
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109778
|
+
title: fullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
109779
|
+
"aria-label": fullscreen ? "Exit fullscreen" : "Fullscreen",
|
|
109780
|
+
children: fullscreen ? /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize2, { className: "w-[16px] h-[16px]" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Maximize2, { className: "w-[16px] h-[16px]" })
|
|
109781
|
+
}
|
|
109782
|
+
),
|
|
109783
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109784
|
+
"button",
|
|
109785
|
+
{
|
|
109786
|
+
type: "button",
|
|
109787
|
+
onClick: () => void handleCopy(),
|
|
109788
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109789
|
+
title: "Copy to clipboard",
|
|
109790
|
+
"aria-label": "Copy payload",
|
|
109791
|
+
"data-test-id": "event-logs-row-copy",
|
|
109792
|
+
children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "w-[16px] h-[16px] text-[#12B76A]" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "w-[16px] h-[16px]" })
|
|
109793
|
+
}
|
|
109794
|
+
)
|
|
109795
|
+
] })
|
|
109796
|
+
] });
|
|
109797
|
+
if (fullscreen) {
|
|
109798
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-[20000] flex flex-col bg-[#F9FAFB]", children: [
|
|
109799
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-[48px] px-[16px] border-b border-[#E4E7EC] flex items-center justify-between flex-shrink-0 bg-white", children: [
|
|
109800
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109801
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109802
|
+
"button",
|
|
109803
|
+
{
|
|
109804
|
+
type: "button",
|
|
109805
|
+
onClick: () => setViewMode("json"),
|
|
109806
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "json" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109807
|
+
title: "Pretty JSON",
|
|
109808
|
+
"aria-label": "Pretty JSON view",
|
|
109809
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(JsonViewIcon, { className: "w-[16px] h-[16px]" })
|
|
109810
|
+
}
|
|
109811
|
+
),
|
|
109812
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109813
|
+
"button",
|
|
109814
|
+
{
|
|
109815
|
+
type: "button",
|
|
109816
|
+
onClick: () => setViewMode("text"),
|
|
109817
|
+
className: `p-[5px] rounded-[4px] transition-colors ${viewMode === "text" ? "text-[#155EEF] bg-[#EFF4FF]" : "text-[#98A2B3] hover:bg-[#F2F4F7]"}`,
|
|
109818
|
+
title: "Compact text",
|
|
109819
|
+
"aria-label": "Compact text view",
|
|
109820
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(AlignLeftIcon, { className: "w-[16px] h-[16px]" })
|
|
109821
|
+
}
|
|
109822
|
+
)
|
|
109823
|
+
] }),
|
|
109824
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109825
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109826
|
+
"button",
|
|
109827
|
+
{
|
|
109828
|
+
type: "button",
|
|
109829
|
+
onClick: () => void handleCopy(),
|
|
109830
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109831
|
+
title: "Copy to clipboard",
|
|
109832
|
+
"aria-label": "Copy payload",
|
|
109833
|
+
children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "w-[16px] h-[16px] text-[#12B76A]" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "w-[16px] h-[16px]" })
|
|
109834
|
+
}
|
|
109835
|
+
),
|
|
109836
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109837
|
+
"button",
|
|
109838
|
+
{
|
|
109839
|
+
type: "button",
|
|
109840
|
+
onClick: () => setFullscreen(false),
|
|
109841
|
+
className: "p-[5px] rounded-[4px] text-[#98A2B3] hover:bg-[#F2F4F7] transition-colors",
|
|
109842
|
+
title: "Exit fullscreen",
|
|
109843
|
+
"aria-label": "Exit fullscreen",
|
|
109844
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Minimize2, { className: "w-[16px] h-[16px]" })
|
|
109845
|
+
}
|
|
109846
|
+
)
|
|
109847
|
+
] })
|
|
109848
|
+
] }),
|
|
109849
|
+
/* @__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 })
|
|
109850
|
+
] }) });
|
|
109851
|
+
}
|
|
109852
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "rounded-[10px] border border-[#D0D5DD] overflow-hidden mt-[12px]", children: [
|
|
109853
|
+
toolbar,
|
|
109854
|
+
/* @__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 })
|
|
109855
|
+
] });
|
|
109856
|
+
}
|
|
109857
|
+
function EventRow({ event, isExpanded, onToggle }) {
|
|
109858
|
+
const jsonText = React.useMemo(() => stringifyPayload(event.payload), [event.payload]);
|
|
109859
|
+
const compactText = React.useMemo(() => compactPayload(event.payload), [event.payload]);
|
|
109860
|
+
const hasPayload = jsonText.length > 0;
|
|
109861
|
+
const isInput = event.direction === "in";
|
|
109862
|
+
const DirectionIcon = isInput ? ArrowUp : ArrowDown;
|
|
109863
|
+
const directionLabel = isInput ? "Input" : "Output";
|
|
109864
|
+
const circleClasses = isInput ? "border-[#079455] text-[#079455]" : "border-[#D92D20] text-[#D92D20]";
|
|
109865
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex items-start gap-[12px]", "data-test-id": "event-logs-row", children: [
|
|
109866
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative flex-shrink-0 flex flex-col items-center w-[16px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109867
|
+
"div",
|
|
109868
|
+
{
|
|
109869
|
+
className: `relative z-10 w-[16px] h-[16px] rounded-full bg-white border flex items-center justify-center ${circleClasses}`,
|
|
109870
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(DirectionIcon, { className: "w-[8px] h-[8px]", strokeWidth: 2.5 })
|
|
109871
|
+
}
|
|
109872
|
+
) }),
|
|
109873
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0 pb-[24px]", children: [
|
|
109874
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-[16px]", children: [
|
|
109875
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
109876
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[12px] leading-[16px] text-[#667085]", children: directionLabel }),
|
|
109877
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "text-[14px] leading-[20px] font-medium text-[#344054] mt-[2px] break-all", children: event.name }),
|
|
109878
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109879
|
+
"button",
|
|
109880
|
+
{
|
|
109881
|
+
type: "button",
|
|
109882
|
+
onClick: onToggle,
|
|
109883
|
+
className: "text-[13px] leading-[18px] text-[#155EEF] hover:underline mt-[4px] font-medium",
|
|
109884
|
+
"data-test-id": "event-logs-view-details",
|
|
109885
|
+
children: isExpanded ? "Hide details" : "View details"
|
|
109886
|
+
}
|
|
109887
|
+
)
|
|
109888
|
+
] }),
|
|
109889
|
+
/* @__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) })
|
|
109890
|
+
] }),
|
|
109891
|
+
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." }))
|
|
109892
|
+
] })
|
|
109893
|
+
] });
|
|
109894
|
+
}
|
|
109895
|
+
function EventLogsSlideout({
|
|
109896
|
+
isOpen,
|
|
109897
|
+
onClose,
|
|
109898
|
+
sessionId,
|
|
109899
|
+
fetchEventLogs
|
|
109900
|
+
}) {
|
|
109901
|
+
const [rawData, setRawData] = React.useState(null);
|
|
109902
|
+
const [loading, setLoading] = React.useState(false);
|
|
109903
|
+
const [error, setError] = React.useState(null);
|
|
109904
|
+
const [expandedIds, setExpandedIds] = React.useState(() => /* @__PURE__ */ new Set());
|
|
109905
|
+
React.useEffect(() => {
|
|
109906
|
+
if (!isOpen || !sessionId || !fetchEventLogs) return;
|
|
109907
|
+
let cancelled = false;
|
|
109908
|
+
setLoading(true);
|
|
109909
|
+
setError(null);
|
|
109910
|
+
setRawData(null);
|
|
109911
|
+
(async () => {
|
|
109912
|
+
try {
|
|
109913
|
+
const data = await fetchEventLogs(sessionId);
|
|
109914
|
+
if (cancelled) return;
|
|
109915
|
+
setRawData(data);
|
|
109916
|
+
} catch (err) {
|
|
109917
|
+
if (cancelled) return;
|
|
109918
|
+
setError(err instanceof Error ? err.message : "Failed to fetch event logs");
|
|
109919
|
+
} finally {
|
|
109920
|
+
if (!cancelled) setLoading(false);
|
|
109921
|
+
}
|
|
109922
|
+
})();
|
|
109923
|
+
return () => {
|
|
109924
|
+
cancelled = true;
|
|
109925
|
+
};
|
|
109926
|
+
}, [isOpen, sessionId, fetchEventLogs]);
|
|
109927
|
+
const events = React.useMemo(() => flattenEvents(rawData), [rawData]);
|
|
109928
|
+
React.useEffect(() => {
|
|
109929
|
+
if (!isOpen) return;
|
|
109930
|
+
const handleKey = (e) => {
|
|
109931
|
+
if (e.key === "Escape") onClose();
|
|
109932
|
+
};
|
|
109933
|
+
document.addEventListener("keydown", handleKey);
|
|
109934
|
+
return () => document.removeEventListener("keydown", handleKey);
|
|
109935
|
+
}, [isOpen, onClose]);
|
|
109936
|
+
React.useEffect(() => {
|
|
109937
|
+
if (!isOpen) {
|
|
109938
|
+
setExpandedIds(/* @__PURE__ */ new Set());
|
|
109939
|
+
setRawData(null);
|
|
109940
|
+
setError(null);
|
|
109941
|
+
}
|
|
109942
|
+
}, [isOpen]);
|
|
109943
|
+
const toggleRow = React.useCallback((id) => {
|
|
109944
|
+
setExpandedIds((prev) => {
|
|
109945
|
+
const next = new Set(prev);
|
|
109946
|
+
if (next.has(id)) next.delete(id);
|
|
109947
|
+
else next.add(id);
|
|
109948
|
+
return next;
|
|
109949
|
+
});
|
|
109950
|
+
}, []);
|
|
109951
|
+
const expandAll = React.useCallback(() => {
|
|
109952
|
+
setExpandedIds(new Set(events.map((e) => e.id)));
|
|
109953
|
+
}, [events]);
|
|
109954
|
+
const collapseAll = React.useCallback(() => {
|
|
109955
|
+
setExpandedIds(/* @__PURE__ */ new Set());
|
|
109956
|
+
}, []);
|
|
109957
|
+
if (!isOpen) return null;
|
|
109958
|
+
const showToolbar = !loading && !error && events.length > 0;
|
|
109959
|
+
const allExpanded = showToolbar && expandedIds.size === events.length;
|
|
109960
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Portal, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "fixed inset-0 z-[10000]", children: [
|
|
109961
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109962
|
+
"div",
|
|
109963
|
+
{
|
|
109964
|
+
className: "absolute inset-0 bg-black/40",
|
|
109965
|
+
onClick: onClose,
|
|
109966
|
+
"aria-hidden": "true"
|
|
109967
|
+
}
|
|
109968
|
+
),
|
|
109969
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
109970
|
+
"div",
|
|
109971
|
+
{
|
|
109972
|
+
className: "absolute top-0 right-0 bottom-0 bg-white shadow-2xl flex flex-col",
|
|
109973
|
+
style: { width: "720px", maxWidth: "100vw" },
|
|
109974
|
+
role: "dialog",
|
|
109975
|
+
"aria-label": "Event Logs",
|
|
109976
|
+
onClick: (e) => e.stopPropagation(),
|
|
109977
|
+
children: [
|
|
109978
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between h-[56px] px-[20px] border-b border-[#E4E7EC] flex-shrink-0", children: [
|
|
109979
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[8px]", children: [
|
|
109980
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[16px] font-semibold text-[#101828]", children: "Event Logs" }),
|
|
109981
|
+
!loading && !error && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[12px] font-medium text-[#667085] bg-[#F2F4F7] rounded-[10px] px-[8px] py-[2px]", children: events.length })
|
|
109982
|
+
] }),
|
|
109983
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-[4px]", children: [
|
|
109984
|
+
showToolbar && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109985
|
+
"button",
|
|
109986
|
+
{
|
|
109987
|
+
type: "button",
|
|
109988
|
+
onClick: allExpanded ? collapseAll : expandAll,
|
|
109989
|
+
className: "text-[13px] font-medium text-[#155EEF] hover:underline px-[8px] py-[6px] rounded-[6px] transition-colors",
|
|
109990
|
+
"data-test-id": "event-logs-toggle-all",
|
|
109991
|
+
children: allExpanded ? "Collapse all" : "Expand all"
|
|
109992
|
+
}
|
|
109993
|
+
),
|
|
109994
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
109995
|
+
"button",
|
|
109996
|
+
{
|
|
109997
|
+
type: "button",
|
|
109998
|
+
onClick: onClose,
|
|
109999
|
+
className: "p-[8px] rounded-[6px] hover:bg-[#F2F4F7] transition-colors",
|
|
110000
|
+
title: "Close Event Logs",
|
|
110001
|
+
"aria-label": "Close Event Logs",
|
|
110002
|
+
"data-test-id": "event-logs-close-btn",
|
|
110003
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(X, { className: "w-[16px] h-[16px] text-[#344054]" })
|
|
110004
|
+
}
|
|
110005
|
+
)
|
|
110006
|
+
] })
|
|
110007
|
+
] }),
|
|
110008
|
+
/* @__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: [
|
|
110009
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Loader2, { className: "w-[20px] h-[20px] animate-spin text-[#155EEF]" }),
|
|
110010
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Loading event logs…" })
|
|
110011
|
+
] }) : 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: [
|
|
110012
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-medium", children: "Couldn't load event logs" }),
|
|
110013
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-[12px] text-[#667085]", children: error })
|
|
110014
|
+
] }) : 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: [
|
|
110015
|
+
events.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110016
|
+
"div",
|
|
110017
|
+
{
|
|
110018
|
+
className: "absolute w-px bg-[#D0D5DD]",
|
|
110019
|
+
style: { left: "32px", top: "36px", bottom: "28px" },
|
|
110020
|
+
"aria-hidden": "true"
|
|
110021
|
+
}
|
|
110022
|
+
),
|
|
110023
|
+
events.map((event) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110024
|
+
EventRow,
|
|
110025
|
+
{
|
|
110026
|
+
event,
|
|
110027
|
+
isExpanded: expandedIds.has(event.id),
|
|
110028
|
+
onToggle: () => toggleRow(event.id)
|
|
110029
|
+
},
|
|
110030
|
+
event.id
|
|
110031
|
+
))
|
|
110032
|
+
] }) })
|
|
110033
|
+
]
|
|
110034
|
+
}
|
|
110035
|
+
)
|
|
110036
|
+
] }) });
|
|
110037
|
+
}
|
|
110038
|
+
function hasNonEmptySessionReference(ref) {
|
|
110039
|
+
return typeof ref === "string" && ref.trim().length > 0;
|
|
110040
|
+
}
|
|
109514
110041
|
function DetailPage({
|
|
109515
110042
|
mode: initialMode,
|
|
109516
110043
|
sessionId: initialSessionId,
|
|
@@ -109523,7 +110050,9 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
109523
110050
|
batchSize = DEFAULT_BATCH_SIZE,
|
|
109524
110051
|
initialTraceCount,
|
|
109525
110052
|
initialSessionData,
|
|
109526
|
-
runHeaderInputMode = "display"
|
|
110053
|
+
runHeaderInputMode = "display",
|
|
110054
|
+
onViewEventLogs,
|
|
110055
|
+
fetchEventLogs
|
|
109527
110056
|
}) {
|
|
109528
110057
|
const [currentMode, setCurrentMode] = React.useState(initialMode);
|
|
109529
110058
|
const [currentSessionId, setCurrentSessionId] = React.useState(initialSessionId);
|
|
@@ -109533,6 +110062,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
109533
110062
|
const traceId = currentTraceId;
|
|
109534
110063
|
const [selectedNode, setSelectedNode] = React.useState(null);
|
|
109535
110064
|
const [copiedId, setCopiedId] = React.useState(false);
|
|
110065
|
+
const [isEventLogsOpen, setIsEventLogsOpen] = React.useState(false);
|
|
109536
110066
|
const minObservationLevel = "DEFAULT";
|
|
109537
110067
|
const [hasAutoSelected, setHasAutoSelected] = React.useState(false);
|
|
109538
110068
|
const hasInitialData = mode === "session" && initialSessionData;
|
|
@@ -109578,7 +110108,8 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
109578
110108
|
bookmarked: false,
|
|
109579
110109
|
public: false,
|
|
109580
110110
|
traces: [],
|
|
109581
|
-
scores: []
|
|
110111
|
+
scores: [],
|
|
110112
|
+
sessionReference: meta.sessionReference
|
|
109582
110113
|
});
|
|
109583
110114
|
setLoadingState("success");
|
|
109584
110115
|
},
|
|
@@ -109762,6 +110293,10 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
109762
110293
|
} : null
|
|
109763
110294
|
};
|
|
109764
110295
|
}, [mode, sessionData, traceData, sessionId, traceId, initialSessionData]);
|
|
110296
|
+
const sessionReferenceForEventLogs = React.useMemo(() => {
|
|
110297
|
+
return (initialSessionData == null ? void 0 : initialSessionData.sessionReference) ?? (sessionData == null ? void 0 : sessionData.sessionReference);
|
|
110298
|
+
}, [initialSessionData == null ? void 0 : initialSessionData.sessionReference, sessionData == null ? void 0 : sessionData.sessionReference]);
|
|
110299
|
+
const showEventLogsBanner = mode === "session" && hasNonEmptySessionReference(sessionReferenceForEventLogs);
|
|
109765
110300
|
const traces = React.useMemo(() => {
|
|
109766
110301
|
if (mode === "session" && sessionData) {
|
|
109767
110302
|
const sorted = [...sessionData.traces].sort((a2, b) => {
|
|
@@ -109810,6 +110345,16 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
109810
110345
|
mode,
|
|
109811
110346
|
traceData
|
|
109812
110347
|
]);
|
|
110348
|
+
const handleViewEventLogs = React.useCallback(() => {
|
|
110349
|
+
setIsEventLogsOpen(true);
|
|
110350
|
+
if (onViewEventLogs && sessionId) {
|
|
110351
|
+
const firstTraceId = traces.length > 0 ? traces[0].id : void 0;
|
|
110352
|
+
onViewEventLogs(sessionId, firstTraceId);
|
|
110353
|
+
}
|
|
110354
|
+
}, [onViewEventLogs, sessionId, traces]);
|
|
110355
|
+
const handleCloseEventLogs = React.useCallback(() => {
|
|
110356
|
+
setIsEventLogsOpen(false);
|
|
110357
|
+
}, []);
|
|
109813
110358
|
const handleNodeSelect = React.useCallback((node) => {
|
|
109814
110359
|
setSelectedNode(node);
|
|
109815
110360
|
}, []);
|
|
@@ -110026,6 +110571,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
110026
110571
|
] }),
|
|
110027
110572
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex-1 flex overflow-hidden", children: [
|
|
110028
110573
|
/* @__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: [
|
|
110574
|
+
showEventLogsBanner && /* @__PURE__ */ jsxRuntimeExports.jsx(VoiceEventLogsBanner, { onViewEventLogs: handleViewEventLogs }),
|
|
110029
110575
|
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" }),
|
|
110030
110576
|
traces.map((trace, index) => {
|
|
110031
110577
|
var _a, _b, _c, _d;
|
|
@@ -110075,7 +110621,16 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
110075
110621
|
generationSummaryInputOverride
|
|
110076
110622
|
}
|
|
110077
110623
|
)
|
|
110078
|
-
] })
|
|
110624
|
+
] }),
|
|
110625
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
110626
|
+
EventLogsSlideout,
|
|
110627
|
+
{
|
|
110628
|
+
isOpen: isEventLogsOpen,
|
|
110629
|
+
onClose: handleCloseEventLogs,
|
|
110630
|
+
sessionId: sessionId ?? null,
|
|
110631
|
+
fetchEventLogs
|
|
110632
|
+
}
|
|
110633
|
+
)
|
|
110079
110634
|
] });
|
|
110080
110635
|
}
|
|
110081
110636
|
const trace1Observations = [
|
|
@@ -110489,7 +111044,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
110489
111044
|
return /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-xs text-gray-600", title: envId || "-", children: displayName });
|
|
110490
111045
|
}
|
|
110491
111046
|
function SessionsListContent(props) {
|
|
110492
|
-
const { apiConfig, onSessionClick, className = "", defaultFilters = [], defaultTimeRange = "24 hours", initialSessionId } = props;
|
|
111047
|
+
const { apiConfig, onSessionClick, className = "", defaultFilters = [], defaultTimeRange = "24 hours", initialSessionId, onViewEventLogs, fetchEventLogs } = props;
|
|
110493
111048
|
const { environments, resolveEnvironmentName } = useEnvironment();
|
|
110494
111049
|
const [selectedSessionId, setSelectedSessionId] = React.useState(() => initialSessionId ?? null);
|
|
110495
111050
|
const [selectedSessionData, setSelectedSessionData] = React.useState(null);
|
|
@@ -111050,7 +111605,8 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
111050
111605
|
totalCost: session.totalCost,
|
|
111051
111606
|
totalTokens: session.totalTokens,
|
|
111052
111607
|
sessionDuration: session.sessionDuration,
|
|
111053
|
-
createdAt: session.createdAt
|
|
111608
|
+
createdAt: session.createdAt,
|
|
111609
|
+
sessionReference: session.sessionReference
|
|
111054
111610
|
});
|
|
111055
111611
|
setIsModalOpen(true);
|
|
111056
111612
|
if (onSessionClick) {
|
|
@@ -111160,7 +111716,9 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
111160
111716
|
sessionId: selectedSessionId,
|
|
111161
111717
|
apiConfig,
|
|
111162
111718
|
onClose: handleModalClose,
|
|
111163
|
-
initialSessionData: selectedSessionData || void 0
|
|
111719
|
+
initialSessionData: selectedSessionData || void 0,
|
|
111720
|
+
onViewEventLogs,
|
|
111721
|
+
fetchEventLogs
|
|
111164
111722
|
}
|
|
111165
111723
|
) })
|
|
111166
111724
|
] });
|
|
@@ -113036,6 +113594,57 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
113036
113594
|
return { totalTokens, totalCost, totalDuration };
|
|
113037
113595
|
}
|
|
113038
113596
|
class TreeBuilder {
|
|
113597
|
+
static isPreProcessorNode(node) {
|
|
113598
|
+
const normalizedName = (node.name || "").replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
113599
|
+
return node.type === "tool" && normalizedName === "preprocessor";
|
|
113600
|
+
}
|
|
113601
|
+
static normalizeNodeName(name) {
|
|
113602
|
+
return (name || "").replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
113603
|
+
}
|
|
113604
|
+
static normalizeLinkedEventType(node) {
|
|
113605
|
+
var _a;
|
|
113606
|
+
const linkedEventType = (_a = node.metadata) == null ? void 0 : _a.linkedEventType;
|
|
113607
|
+
if (typeof linkedEventType !== "string" || linkedEventType.trim().length === 0) {
|
|
113608
|
+
return null;
|
|
113609
|
+
}
|
|
113610
|
+
return linkedEventType.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
113611
|
+
}
|
|
113612
|
+
static normalizeParentId(parentId) {
|
|
113613
|
+
if (typeof parentId !== "string") {
|
|
113614
|
+
return parentId ?? null;
|
|
113615
|
+
}
|
|
113616
|
+
const trimmedParentId = parentId.trim();
|
|
113617
|
+
if (trimmedParentId.length === 0 || trimmedParentId.toLowerCase() === "null" || trimmedParentId.toLowerCase() === "undefined") {
|
|
113618
|
+
return null;
|
|
113619
|
+
}
|
|
113620
|
+
return trimmedParentId;
|
|
113621
|
+
}
|
|
113622
|
+
static isTargetSystemEventNode(node) {
|
|
113623
|
+
const normalizedName = this.normalizeNodeName(node.name || "");
|
|
113624
|
+
if (this.TARGET_EVENT_NAMES.has(normalizedName)) return true;
|
|
113625
|
+
return typeof node.type === "string" && node.type.toLowerCase() === "event";
|
|
113626
|
+
}
|
|
113627
|
+
static compareNodesForDisplay(a2, b) {
|
|
113628
|
+
const aIsPreProcessor = this.isPreProcessorNode(a2);
|
|
113629
|
+
const bIsPreProcessor = this.isPreProcessorNode(b);
|
|
113630
|
+
const aIsTargetEvent = this.isTargetSystemEventNode(a2);
|
|
113631
|
+
const bIsTargetEvent = this.isTargetSystemEventNode(b);
|
|
113632
|
+
const aLinkedEventType = this.normalizeLinkedEventType(a2);
|
|
113633
|
+
const bLinkedEventType = this.normalizeLinkedEventType(b);
|
|
113634
|
+
const aTargetName = this.normalizeNodeName(a2.name || "");
|
|
113635
|
+
const bTargetName = this.normalizeNodeName(b.name || "");
|
|
113636
|
+
if (aIsPreProcessor && bIsTargetEvent && aLinkedEventType !== null && aLinkedEventType === bTargetName) {
|
|
113637
|
+
return -1;
|
|
113638
|
+
}
|
|
113639
|
+
if (aIsTargetEvent && bIsPreProcessor && bLinkedEventType !== null && bLinkedEventType === aTargetName) {
|
|
113640
|
+
return 1;
|
|
113641
|
+
}
|
|
113642
|
+
const timestampDiff = new Date(a2.startTime).getTime() - new Date(b.startTime).getTime();
|
|
113643
|
+
if (timestampDiff !== 0) {
|
|
113644
|
+
return timestampDiff;
|
|
113645
|
+
}
|
|
113646
|
+
return (a2.name || "").localeCompare(b.name || "");
|
|
113647
|
+
}
|
|
113039
113648
|
/**
|
|
113040
113649
|
* Process execution events and build a hierarchical tree structure
|
|
113041
113650
|
* Session > Run > Node Tree
|
|
@@ -113094,6 +113703,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
113094
113703
|
const node = this.createTreeNodeFromEvents(startedEvent, completedEvent, runId);
|
|
113095
113704
|
nodes.push(node);
|
|
113096
113705
|
}
|
|
113706
|
+
this.alignEventPreProcessorNodes(nodes);
|
|
113097
113707
|
const rootNodes = this.buildNodeHierarchy(nodes);
|
|
113098
113708
|
const runEvents = events.filter((e) => e.runId === runId);
|
|
113099
113709
|
const startTime = Math.min(...runEvents.map((e) => new Date(e.data.timestamp).getTime()));
|
|
@@ -113176,8 +113786,10 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
113176
113786
|
nodes.forEach((node) => nodeMap.set(node.id, node));
|
|
113177
113787
|
const rootNodes = [];
|
|
113178
113788
|
nodes.forEach((node) => {
|
|
113179
|
-
|
|
113180
|
-
|
|
113789
|
+
const normalizedParentId = this.normalizeParentId(node.parentId);
|
|
113790
|
+
node.parentId = normalizedParentId;
|
|
113791
|
+
if (normalizedParentId && nodeMap.has(normalizedParentId)) {
|
|
113792
|
+
const parent = nodeMap.get(normalizedParentId);
|
|
113181
113793
|
parent.children.push(node);
|
|
113182
113794
|
node.level = parent.level + 1;
|
|
113183
113795
|
} else {
|
|
@@ -113185,12 +113797,98 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
113185
113797
|
node.level = 0;
|
|
113186
113798
|
}
|
|
113187
113799
|
});
|
|
113188
|
-
rootNodes.sort(
|
|
113189
|
-
(a2, b) => new Date(a2.startTime).getTime() - new Date(b.startTime).getTime()
|
|
113190
|
-
);
|
|
113800
|
+
rootNodes.sort((a2, b) => this.compareNodesForDisplay(a2, b));
|
|
113191
113801
|
rootNodes.forEach((root2) => this.sortChildren(root2));
|
|
113802
|
+
this.relocateRootEventPreProcessors(rootNodes);
|
|
113192
113803
|
return rootNodes;
|
|
113193
113804
|
}
|
|
113805
|
+
static alignEventPreProcessorNodes(nodes) {
|
|
113806
|
+
const targetEvents = nodes.filter((node) => this.isTargetSystemEventNode(node)).sort((a2, b) => new Date(a2.startTime).getTime() - new Date(b.startTime).getTime());
|
|
113807
|
+
if (targetEvents.length === 0) {
|
|
113808
|
+
return;
|
|
113809
|
+
}
|
|
113810
|
+
const orphanPreProcessors = nodes.filter((node) => this.isPreProcessorNode(node) && this.normalizeParentId(node.parentId) === null).sort((a2, b) => new Date(a2.startTime).getTime() - new Date(b.startTime).getTime());
|
|
113811
|
+
for (const preProcessorNode of orphanPreProcessors) {
|
|
113812
|
+
const linkedEventType = this.normalizeLinkedEventType(preProcessorNode);
|
|
113813
|
+
if (linkedEventType === null) {
|
|
113814
|
+
continue;
|
|
113815
|
+
}
|
|
113816
|
+
const candidateEvents = targetEvents.filter(
|
|
113817
|
+
(eventNode) => this.normalizeNodeName(eventNode.name || "") === linkedEventType
|
|
113818
|
+
);
|
|
113819
|
+
if (candidateEvents.length === 0) {
|
|
113820
|
+
continue;
|
|
113821
|
+
}
|
|
113822
|
+
const preProcessorTime = new Date(preProcessorNode.startTime).getTime();
|
|
113823
|
+
let selectedTargetEvent = candidateEvents[0];
|
|
113824
|
+
let minDistance = Number.POSITIVE_INFINITY;
|
|
113825
|
+
for (const targetEvent of candidateEvents) {
|
|
113826
|
+
const distance = Math.abs(new Date(targetEvent.startTime).getTime() - preProcessorTime);
|
|
113827
|
+
if (distance < minDistance) {
|
|
113828
|
+
selectedTargetEvent = targetEvent;
|
|
113829
|
+
minDistance = distance;
|
|
113830
|
+
}
|
|
113831
|
+
}
|
|
113832
|
+
preProcessorNode.parentId = this.normalizeParentId(selectedTargetEvent.parentId);
|
|
113833
|
+
}
|
|
113834
|
+
}
|
|
113835
|
+
static relocateRootEventPreProcessors(rootNodes) {
|
|
113836
|
+
var _a;
|
|
113837
|
+
const preprocessorsAtRoot = rootNodes.filter((node) => this.isPreProcessorNode(node));
|
|
113838
|
+
if (preprocessorsAtRoot.length === 0) {
|
|
113839
|
+
return;
|
|
113840
|
+
}
|
|
113841
|
+
const collectTargetNodes = (nodesToSearch, parentNode2, collector) => {
|
|
113842
|
+
nodesToSearch.forEach((node, index) => {
|
|
113843
|
+
if (this.isTargetSystemEventNode(node)) {
|
|
113844
|
+
collector.push({ node, siblings: nodesToSearch, index, parentNode: parentNode2 });
|
|
113845
|
+
}
|
|
113846
|
+
if (node.children.length > 0) {
|
|
113847
|
+
collectTargetNodes(node.children, node, collector);
|
|
113848
|
+
}
|
|
113849
|
+
});
|
|
113850
|
+
};
|
|
113851
|
+
const targetNodes = [];
|
|
113852
|
+
collectTargetNodes(rootNodes, null, targetNodes);
|
|
113853
|
+
if (targetNodes.length === 0) {
|
|
113854
|
+
return;
|
|
113855
|
+
}
|
|
113856
|
+
const rootSet = new Set(rootNodes);
|
|
113857
|
+
for (const preProcessorNode of preprocessorsAtRoot) {
|
|
113858
|
+
if (!rootSet.has(preProcessorNode)) {
|
|
113859
|
+
continue;
|
|
113860
|
+
}
|
|
113861
|
+
const linkedEventType = this.normalizeLinkedEventType(preProcessorNode);
|
|
113862
|
+
if (linkedEventType === null) {
|
|
113863
|
+
continue;
|
|
113864
|
+
}
|
|
113865
|
+
const candidateTargets = targetNodes.filter(
|
|
113866
|
+
(target) => this.normalizeNodeName(target.node.name || "") === linkedEventType
|
|
113867
|
+
);
|
|
113868
|
+
if (candidateTargets.length === 0) {
|
|
113869
|
+
continue;
|
|
113870
|
+
}
|
|
113871
|
+
const preProcessorTime = new Date(preProcessorNode.startTime).getTime();
|
|
113872
|
+
let selectedTarget = candidateTargets[0];
|
|
113873
|
+
let selectedDistance = Number.POSITIVE_INFINITY;
|
|
113874
|
+
for (const candidate of candidateTargets) {
|
|
113875
|
+
const candidateTime = new Date(candidate.node.startTime).getTime();
|
|
113876
|
+
const distance = Math.abs(candidateTime - preProcessorTime);
|
|
113877
|
+
if (distance < selectedDistance) {
|
|
113878
|
+
selectedTarget = candidate;
|
|
113879
|
+
selectedDistance = distance;
|
|
113880
|
+
}
|
|
113881
|
+
}
|
|
113882
|
+
const rootIndex = rootNodes.indexOf(preProcessorNode);
|
|
113883
|
+
if (rootIndex >= 0) {
|
|
113884
|
+
rootNodes.splice(rootIndex, 1);
|
|
113885
|
+
rootSet.delete(preProcessorNode);
|
|
113886
|
+
}
|
|
113887
|
+
preProcessorNode.parentId = ((_a = selectedTarget.parentNode) == null ? void 0 : _a.id) ?? null;
|
|
113888
|
+
selectedTarget.siblings.splice(selectedTarget.index, 0, preProcessorNode);
|
|
113889
|
+
selectedTarget.siblings.sort((a2, b) => this.compareNodesForDisplay(a2, b));
|
|
113890
|
+
}
|
|
113891
|
+
}
|
|
113194
113892
|
/**
|
|
113195
113893
|
* Extract LLM usage metadata from output and event metadata (configurable path)
|
|
113196
113894
|
*/
|
|
@@ -113282,9 +113980,7 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
113282
113980
|
*/
|
|
113283
113981
|
static sortChildren(node) {
|
|
113284
113982
|
if (!node) return;
|
|
113285
|
-
node.children.sort(
|
|
113286
|
-
(a2, b) => new Date(a2.startTime).getTime() - new Date(b.startTime).getTime()
|
|
113287
|
-
);
|
|
113983
|
+
node.children.sort((a2, b) => this.compareNodesForDisplay(a2, b));
|
|
113288
113984
|
node.children.forEach((child) => this.sortChildren(child));
|
|
113289
113985
|
}
|
|
113290
113986
|
/**
|
|
@@ -113538,6 +114234,10 @@ For more info see: https://www.ag-grid.com/javascript-grid/modules/`;
|
|
|
113538
114234
|
);
|
|
113539
114235
|
}
|
|
113540
114236
|
}
|
|
114237
|
+
__publicField(TreeBuilder, "TARGET_EVENT_NAMES", /* @__PURE__ */ new Set([
|
|
114238
|
+
"endofconversation",
|
|
114239
|
+
"agenthandoff"
|
|
114240
|
+
]));
|
|
113541
114241
|
const CodeEditor = ({
|
|
113542
114242
|
value,
|
|
113543
114243
|
onChange,
|