@tonyclaw/llm-inspector 1.17.0 → 1.18.0

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.
Files changed (34) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/public/assets/{CompareDrawer-C4fie5g5.js → CompareDrawer-BpwZCB6M.js} +1 -1
  3. package/.output/public/assets/{ReplayDialog-Dme5uOR9.js → ReplayDialog-Clratkzl.js} +1 -1
  4. package/.output/public/assets/{RequestAnatomy-ChBLDNFH.js → RequestAnatomy-EtiX0r_G.js} +1 -1
  5. package/.output/public/assets/{ResponseView-wGeqBzVU.js → ResponseView-CJqxo-EN.js} +1 -1
  6. package/.output/public/assets/{StreamingChunkSequence-zeJZQLqT.js → StreamingChunkSequence-BIbRqQiV.js} +1 -1
  7. package/.output/public/assets/{index-DpbutOvo.js → index-B-0F9n1w.js} +17 -17
  8. package/.output/public/assets/{json-viewer-BV-WUszW.js → json-viewer-D-z1r1Pp.js} +1 -1
  9. package/.output/public/assets/{main-DRu10KNQ.js → main-CZJ63sQh.js} +1 -1
  10. package/.output/server/_ssr/{CompareDrawer-C4-CQL5w.mjs → CompareDrawer-BJr-913n.mjs} +4 -3
  11. package/.output/server/_ssr/{ReplayDialog-BTb1Bam8.mjs → ReplayDialog-BwmToGuR.mjs} +5 -4
  12. package/.output/server/_ssr/{RequestAnatomy-CZFV1IvL.mjs → RequestAnatomy-BmMiPRPB.mjs} +3 -2
  13. package/.output/server/_ssr/{ResponseView-CTZekh65.mjs → ResponseView-ZB9-8Raw.mjs} +4 -3
  14. package/.output/server/_ssr/{StreamingChunkSequence-C38Ynabd.mjs → StreamingChunkSequence-DWm4CQWC.mjs} +4 -3
  15. package/.output/server/_ssr/{index-Cnu-QzAy.mjs → index-C7I_Qgt0.mjs} +24 -36
  16. package/.output/server/_ssr/index.mjs +2 -2
  17. package/.output/server/_ssr/{json-viewer-DROqpjS9.mjs → json-viewer-D9XETzwp.mjs} +3 -2
  18. package/.output/server/_ssr/{router-pP4GCTQx.mjs → router-711KpGkz.mjs} +647 -98
  19. package/.output/server/{_tanstack-start-manifest_v-CphS4rZd.mjs → _tanstack-start-manifest_v-noQw0Vmw.mjs} +1 -1
  20. package/.output/server/index.mjs +50 -50
  21. package/package.json +1 -1
  22. package/src/components/proxy-viewer/LogEntryHeader.tsx +5 -18
  23. package/src/components/proxy-viewer/TurnGroup.tsx +10 -13
  24. package/src/proxy/handler.ts +52 -84
  25. package/src/proxy/logFinalizer.ts +301 -0
  26. package/src/proxy/logFinalizer.worker.ts +24 -0
  27. package/src/proxy/schemas.ts +8 -3
  28. package/src/proxy/sessionProcess.ts +133 -0
  29. package/src/proxy/sessionRuntime.ts +85 -0
  30. package/src/proxy/sessionSupervisor.ts +282 -0
  31. package/src/proxy/sessionWorkerEntry.ts +26 -0
  32. package/src/proxy/store.ts +64 -20
  33. package/src/routes/api/logs.stream.ts +2 -2
  34. package/src/routes/api/sessions.ts +9 -2
@@ -1,5 +1,5 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports, a as React } from "../_libs/react.mjs";
2
- import { C as CapturedLogSchema, D as DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS, R as RuntimeConfigSchema, r as requestFormatForPath, c as createPendingProviderTestResults, P as ProviderTestResultsSchema, b as createFailedProviderTestResults, M as MAX_SLOW_RESPONSE_THRESHOLD_SECONDS, d as ProviderConfigSchema, s as stripClaudeCodeBillingHeader, p as parseOpenAIResponse, O as OpenAIRequestSchema, A as AnthropicResponseSchema$1, a as AnthropicRequestSchema } from "./router-pP4GCTQx.mjs";
2
+ import { C as CapturedLogSchema, D as DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS, R as RuntimeConfigSchema, r as requestFormatForPath, c as createPendingProviderTestResults, P as ProviderTestResultsSchema, b as createFailedProviderTestResults, M as MAX_SLOW_RESPONSE_THRESHOLD_SECONDS, d as ProviderConfigSchema, s as stripClaudeCodeBillingHeader, p as parseOpenAIResponse, O as OpenAIRequestSchema, A as AnthropicResponseSchema$1, a as AnthropicRequestSchema } from "./router-711KpGkz.mjs";
3
3
  import { u as useSWR, a as useSWRConfig } from "../_libs/swr.mjs";
4
4
  import { J as JSZip } from "../_libs/jszip.mjs";
5
5
  import { c as clsx } from "../_libs/clsx.mjs";
@@ -56,6 +56,7 @@ import "../_libs/mimic-function.mjs";
56
56
  import "../_libs/semver.mjs";
57
57
  import "../_libs/uint8array-extras.mjs";
58
58
  import "node:child_process";
59
+ import "node:worker_threads";
59
60
  import "../_libs/modelcontextprotocol__server.mjs";
60
61
  import "../_libs/use-sync-external-store.mjs";
61
62
  import "../_libs/dequal.mjs";
@@ -370,7 +371,7 @@ function getStatusCategory(status) {
370
371
  if (status >= 500) return "server_error";
371
372
  return "pending";
372
373
  }
373
- const version = "1.17.0";
374
+ const version = "1.18.0";
374
375
  const packageJson = {
375
376
  version
376
377
  };
@@ -564,7 +565,7 @@ const API_FORMAT_LABELS = {
564
565
  openai: "OpenAI",
565
566
  unknown: "Unknown"
566
567
  };
567
- function formatTimestamp$1(iso) {
568
+ function formatTimestamp(iso) {
568
569
  const date = new Date(iso);
569
570
  return date.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", second: "2-digit" });
570
571
  }
@@ -648,9 +649,9 @@ function ConversationHeader({
648
649
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs shrink-0", children: [
649
650
  /* @__PURE__ */ jsxRuntimeExports.jsx(Clock, { className: "size-3" }),
650
651
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "font-mono tabular-nums", children: [
651
- formatTimestamp$1(startTime),
652
+ formatTimestamp(startTime),
652
653
  " - ",
653
- formatTimestamp$1(endTime)
654
+ formatTimestamp(endTime)
654
655
  ] })
655
656
  ] }),
656
657
  /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs shrink-0", children: [
@@ -1423,27 +1424,27 @@ function TabsContent({
1423
1424
  );
1424
1425
  }
1425
1426
  const LazyCompareDrawer = reactExports.lazy(
1426
- () => import("./CompareDrawer-C4-CQL5w.mjs").then((m) => ({ default: m.CompareDrawer }))
1427
+ () => import("./CompareDrawer-BJr-913n.mjs").then((m) => ({ default: m.CompareDrawer }))
1427
1428
  );
1428
1429
  const LazyReplayDialog = reactExports.lazy(
1429
- () => import("./ReplayDialog-BTb1Bam8.mjs").then((m) => ({ default: m.ReplayDialog }))
1430
+ () => import("./ReplayDialog-BwmToGuR.mjs").then((m) => ({ default: m.ReplayDialog }))
1430
1431
  );
1431
1432
  const LazyRequestAnatomy = reactExports.lazy(
1432
- () => import("./RequestAnatomy-CZFV1IvL.mjs").then((m) => ({ default: m.RequestAnatomy }))
1433
+ () => import("./RequestAnatomy-BmMiPRPB.mjs").then((m) => ({ default: m.RequestAnatomy }))
1433
1434
  );
1434
1435
  const LazyResponseView = reactExports.lazy(
1435
- () => import("./ResponseView-CTZekh65.mjs").then((m) => ({ default: m.ResponseView }))
1436
+ () => import("./ResponseView-ZB9-8Raw.mjs").then((m) => ({ default: m.ResponseView }))
1436
1437
  );
1437
1438
  const LazyStreamingChunkSequence = reactExports.lazy(
1438
- () => import("./StreamingChunkSequence-C38Ynabd.mjs").then((m) => ({
1439
+ () => import("./StreamingChunkSequence-DWm4CQWC.mjs").then((m) => ({
1439
1440
  default: m.StreamingChunkSequence
1440
1441
  }))
1441
1442
  );
1442
1443
  const LazyJsonViewer = reactExports.lazy(
1443
- () => import("./json-viewer-DROqpjS9.mjs").then((m) => ({ default: m.JsonViewer }))
1444
+ () => import("./json-viewer-D9XETzwp.mjs").then((m) => ({ default: m.JsonViewer }))
1444
1445
  );
1445
1446
  const LazyJsonViewerFromString = reactExports.lazy(
1446
- () => import("./json-viewer-DROqpjS9.mjs").then((m) => ({ default: m.JsonViewerFromString }))
1447
+ () => import("./json-viewer-D9XETzwp.mjs").then((m) => ({ default: m.JsonViewerFromString }))
1447
1448
  );
1448
1449
  const HIGHLIGHT_DURATION_MS = 1200;
1449
1450
  const MAX_HIGHLIGHT_ATTEMPTS = 12;
@@ -1841,13 +1842,6 @@ function formatElapsed$1(ms) {
1841
1842
  if (ms < 1e3) return `${ms}ms`;
1842
1843
  return `${(ms / 1e3).toFixed(1)}s`;
1843
1844
  }
1844
- function formatTimestamp(iso) {
1845
- const d = new Date(iso);
1846
- const hh = String(d.getHours()).padStart(2, "0");
1847
- const mm = String(d.getMinutes()).padStart(2, "0");
1848
- const ss = String(d.getSeconds()).padStart(2, "0");
1849
- return `${hh}:${mm}:${ss}`;
1850
- }
1851
1845
  function CacheTrendIndicator({ trend }) {
1852
1846
  if (trend === null) return null;
1853
1847
  const isUp = trend.direction === "up";
@@ -1905,12 +1899,9 @@ const LogEntryHeader = reactExports.memo(function({
1905
1899
  "#",
1906
1900
  log.id
1907
1901
  ] }),
1908
- /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
1909
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs shrink-0", children: [
1910
- /* @__PURE__ */ jsxRuntimeExports.jsx(Clock, { className: "size-3" }),
1911
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatTimestamp(log.timestamp) })
1912
- ] }) }),
1913
- /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: log.timestamp })
1902
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 text-muted-foreground text-xs shrink-0", children: [
1903
+ /* @__PURE__ */ jsxRuntimeExports.jsx(Clock, { className: "size-3" }),
1904
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: log.timestamp })
1914
1905
  ] }),
1915
1906
  log.model !== null && /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
1916
1907
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "shrink-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ProviderLogo, { provider: detectProvider(log.model), className: "size-4" }) }) }),
@@ -2916,9 +2907,8 @@ const TurnGroup = reactExports.memo(function TurnGroup2({
2916
2907
  const aggregate = reactExports.useMemo(() => {
2917
2908
  let totalInput = 0;
2918
2909
  let totalOutput = 0;
2919
- let totalElapsed = 0;
2910
+ let maxElapsed = null;
2920
2911
  let hasTokens = false;
2921
- let hasElapsed = false;
2922
2912
  for (const e of entries) {
2923
2913
  if (e.log.inputTokens !== null) {
2924
2914
  totalInput += e.log.inputTokens;
@@ -2929,16 +2919,14 @@ const TurnGroup = reactExports.memo(function TurnGroup2({
2929
2919
  hasTokens = true;
2930
2920
  }
2931
2921
  if (e.log.elapsedMs !== null) {
2932
- totalElapsed += e.log.elapsedMs;
2933
- hasElapsed = true;
2922
+ maxElapsed = maxElapsed === null ? e.log.elapsedMs : Math.max(maxElapsed, e.log.elapsedMs);
2934
2923
  }
2935
2924
  }
2936
2925
  return {
2937
2926
  totalInput,
2938
2927
  totalOutput,
2939
2928
  hasTokens,
2940
- totalElapsed,
2941
- hasElapsed
2929
+ maxElapsed
2942
2930
  };
2943
2931
  }, [entries, lastIdx]);
2944
2932
  const uniqueProviders = reactExports.useMemo(() => {
@@ -2952,7 +2940,7 @@ const TurnGroup = reactExports.memo(function TurnGroup2({
2952
2940
  const StartCrab = reactExports.useMemo(() => getCrabVariant(entries[0]?.log.id ?? 0), [entries]);
2953
2941
  const EndCrab = reactExports.useMemo(() => getCrabVariant(entries[lastIdx]?.log.id ?? 0), [entries, lastIdx]);
2954
2942
  const bgClass = turnIndex % 2 === 0 ? "bg-muted/10" : "bg-muted/25";
2955
- const aggregateIsSlow = aggregate.hasElapsed && slowResponseThresholdSeconds > 0 && aggregate.totalElapsed > slowResponseThresholdSeconds * 1e3;
2943
+ const aggregateIsSlow = aggregate.maxElapsed !== null && slowResponseThresholdSeconds > 0 && aggregate.maxElapsed > slowResponseThresholdSeconds * 1e3;
2956
2944
  const [layoutVersion, setLayoutVersion] = reactExports.useState(0);
2957
2945
  const containerRef = reactExports.useRef(null);
2958
2946
  reactExports.useEffect(() => {
@@ -3073,7 +3061,7 @@ const TurnGroup = reactExports.memo(function TurnGroup2({
3073
3061
  entries.length > 1 ? "s" : ""
3074
3062
  ] }),
3075
3063
  uniqueProviders.length > 0 && /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex items-center gap-0.5 shrink-0", children: uniqueProviders.map((p) => /* @__PURE__ */ jsxRuntimeExports.jsx(ProviderLogo, { provider: p, className: "size-4" }, p)) }),
3076
- aggregate.hasElapsed && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
3064
+ aggregate.maxElapsed !== null && /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
3077
3065
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3078
3066
  "span",
3079
3067
  {
@@ -3083,14 +3071,14 @@ const TurnGroup = reactExports.memo(function TurnGroup2({
3083
3071
  ),
3084
3072
  children: [
3085
3073
  /* @__PURE__ */ jsxRuntimeExports.jsx(Clock, { className: "size-3" }),
3086
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatElapsed(aggregate.totalElapsed) }),
3074
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "font-mono tabular-nums", children: formatElapsed(aggregate.maxElapsed) }),
3087
3075
  aggregateIsSlow && /* @__PURE__ */ jsxRuntimeExports.jsx(TriangleAlert, { className: "size-3", "aria-label": "Slow response" })
3088
3076
  ]
3089
3077
  }
3090
3078
  ) }),
3091
3079
  /* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: aggregateIsSlow ? `Slow response: ${formatElapsed(
3092
- aggregate.totalElapsed
3093
- )} exceeds ${formatElapsed(slowResponseThresholdSeconds * 1e3)}` : "Total elapsed response time" })
3080
+ aggregate.maxElapsed
3081
+ )} exceeds ${formatElapsed(slowResponseThresholdSeconds * 1e3)}` : "Slowest request in this turn" })
3094
3082
  ] }) }),
3095
3083
  aggregate.hasTokens && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1 shrink-0", children: [
3096
3084
  /* @__PURE__ */ jsxRuntimeExports.jsx(Zap, { className: "size-3 text-muted-foreground" }),
@@ -198,7 +198,7 @@ function getResponse() {
198
198
  return event.res;
199
199
  }
200
200
  async function getStartManifest(matchedRoutes) {
201
- const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-CphS4rZd.mjs");
201
+ const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-noQw0Vmw.mjs");
202
202
  const startManifest = tsrStartManifest();
203
203
  const rootRoute = startManifest.routes[rootRouteId] = startManifest.routes[rootRouteId] || {};
204
204
  rootRoute.assets = rootRoute.assets || [];
@@ -767,7 +767,7 @@ let entriesPromise;
767
767
  let baseManifestPromise;
768
768
  let cachedFinalManifestPromise;
769
769
  async function loadEntries() {
770
- const routerEntry = await import("./router-pP4GCTQx.mjs").then((n) => n.e);
770
+ const routerEntry = await import("./router-711KpGkz.mjs").then((n) => n.e);
771
771
  const startEntry = await import("./start-HYkvq4Ni.mjs");
772
772
  return { startEntry, routerEntry };
773
773
  }
@@ -1,6 +1,6 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { q as parseJsonText, c as cn, k as TooltipProvider, l as Tooltip, m as TooltipTrigger, n as TooltipContent } from "./index-Cnu-QzAy.mjs";
3
- import "./router-pP4GCTQx.mjs";
2
+ import { q as parseJsonText, c as cn, k as TooltipProvider, l as Tooltip, m as TooltipTrigger, n as TooltipContent } from "./index-C7I_Qgt0.mjs";
3
+ import "./router-711KpGkz.mjs";
4
4
  import "../_libs/modelcontextprotocol__server.mjs";
5
5
  import "../_libs/jszip.mjs";
6
6
  import { C as Check, c as Copy, a as ChevronDown, f as ChevronRight, r as ChevronsDown } from "../_libs/lucide-react.mjs";
@@ -97,6 +97,7 @@ import "../_libs/mimic-function.mjs";
97
97
  import "../_libs/semver.mjs";
98
98
  import "../_libs/uint8array-extras.mjs";
99
99
  import "node:child_process";
100
+ import "node:worker_threads";
100
101
  import "../_libs/readable-stream.mjs";
101
102
  import "events";
102
103
  import "node:string_decoder";