@tonyclaw/agent-inspector 2.0.14 → 2.0.16

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 (41) hide show
  1. package/.output/cli.js +107 -11
  2. package/.output/nitro.json +1 -1
  3. package/.output/public/assets/{CompareDrawer-BR_kCD7Q.js → CompareDrawer-DPs4UHwd.js} +1 -1
  4. package/.output/public/assets/{ProxyViewerContainer-vc50msJj.js → ProxyViewerContainer-B1KylMPs.js} +32 -32
  5. package/.output/public/assets/{ReplayDialog-DsAYQBHZ.js → ReplayDialog-8ISC28XF.js} +1 -1
  6. package/.output/public/assets/{RequestAnatomy-B4uqyUt8.js → RequestAnatomy-BhbsgfBO.js} +1 -1
  7. package/.output/public/assets/{ResponseView-C1vQL-fM.js → ResponseView-CyM7JXeA.js} +1 -1
  8. package/.output/public/assets/{StreamingChunkSequence-BECMV-xf.js → StreamingChunkSequence-BaX0x38n.js} +1 -1
  9. package/.output/public/assets/_sessionId-CShO0OrR.js +1 -0
  10. package/.output/public/assets/index-BkdYiTpV.js +1 -0
  11. package/.output/public/assets/{main-D6wegveF.js → main-B2t-3SYj.js} +2 -2
  12. package/.output/server/{_sessionId-CeHY-3xa.mjs → _sessionId-CEbZTs68.mjs} +2 -2
  13. package/.output/server/_ssr/{CompareDrawer-blWGaGiT.mjs → CompareDrawer-CEo48Wsu.mjs} +2 -2
  14. package/.output/server/_ssr/{ProxyViewerContainer-Dt_9BuM9.mjs → ProxyViewerContainer-5ekIK_jx.mjs} +64 -22
  15. package/.output/server/_ssr/{ReplayDialog-mzsq7AjW.mjs → ReplayDialog-C0nEvbYo.mjs} +3 -3
  16. package/.output/server/_ssr/{RequestAnatomy-CDAcXMBK.mjs → RequestAnatomy-CT55prmM.mjs} +2 -2
  17. package/.output/server/_ssr/{ResponseView-B__xXCsZ.mjs → ResponseView-DBZSBCOD.mjs} +2 -2
  18. package/.output/server/_ssr/{StreamingChunkSequence-BnJkTdXF.mjs → StreamingChunkSequence-BuVT7Oke.mjs} +2 -2
  19. package/.output/server/_ssr/{index-B2-uF9XT.mjs → index-Cw_zJVQv.mjs} +2 -2
  20. package/.output/server/_ssr/index.mjs +2 -2
  21. package/.output/server/_ssr/{router-BpEBhA7S.mjs → router-DxjqHipT.mjs} +89 -46
  22. package/.output/server/{_tanstack-start-manifest_v-CHekFSzj.mjs → _tanstack-start-manifest_v-xeOo5gW5.mjs} +1 -1
  23. package/.output/server/index.mjs +59 -59
  24. package/README.md +31 -1
  25. package/package.json +1 -1
  26. package/src/cli/templates/codex-skill-onboard.ts +8 -4
  27. package/src/cli/templates/skill-onboard.ts +15 -7
  28. package/src/cli.ts +91 -0
  29. package/src/components/OnboardingBanner.tsx +32 -9
  30. package/src/components/ProxyViewer.tsx +32 -24
  31. package/src/components/ProxyViewerContainer.tsx +2 -1
  32. package/src/components/providers/SettingsDialog.tsx +10 -0
  33. package/src/lib/runtimeConfig.ts +4 -0
  34. package/src/lib/useOnboarding.ts +9 -1
  35. package/src/lib/useStripConfig.ts +10 -2
  36. package/src/proxy/config.ts +33 -3
  37. package/src/proxy/handler.ts +30 -13
  38. package/src/proxy/logFinalizer.ts +4 -2
  39. package/src/routes/api/providers.$providerId.test.log.ts +17 -7
  40. package/.output/public/assets/_sessionId-3bjQPmHl.js +0 -1
  41. package/.output/public/assets/index-_7blCOK0.js +0 -1
@@ -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, a as DEFAULT_TIME_DISPLAY_FORMAT, b as RuntimeConfigSchema, P as ProviderConfigSchema, r as requestFormatForPath, h as createPendingProviderTestResults, i as ProviderTestResultsSchema, j as createFailedProviderTestResults, M as MAX_SLOW_RESPONSE_THRESHOLD_SECONDS, T as TimeDisplayFormatSchema, g as getSessionPath, e as providerHasContextMetadata, f as findProviderModelMetadata, s as safeGetOwnProperty, K as KnowledgeCandidateSchema, d as stripClaudeCodeBillingHeader, p as parseOpenAIResponse, O as OpenAIRequestSchema, A as AnthropicResponseSchema$1, c as AnthropicRequestSchema, k as resolveProviderContextWindow, l as isPlainRecord } from "./router-BpEBhA7S.mjs";
2
+ import { C as CapturedLogSchema, D as DEFAULT_CAPTURE_MODE, a as DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS, b as DEFAULT_TIME_DISPLAY_FORMAT, c as RuntimeConfigSchema, P as ProviderConfigSchema, r as requestFormatForPath, i as createPendingProviderTestResults, j as ProviderTestResultsSchema, k as createFailedProviderTestResults, M as MAX_SLOW_RESPONSE_THRESHOLD_SECONDS, T as TimeDisplayFormatSchema, g as getSessionPath, f as providerHasContextMetadata, h as findProviderModelMetadata, s as safeGetOwnProperty, K as KnowledgeCandidateSchema, e as stripClaudeCodeBillingHeader, p as parseOpenAIResponse, O as OpenAIRequestSchema, A as AnthropicResponseSchema$1, d as AnthropicRequestSchema, l as resolveProviderContextWindow, m as isPlainRecord } from "./router-DxjqHipT.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";
@@ -73,6 +73,7 @@ function useStripConfig() {
73
73
  );
74
74
  const { mutate: globalMutate } = useSWRConfig();
75
75
  const strip = response.data?.stripClaudeCodeBillingHeader ?? false;
76
+ const captureMode = response.data?.captureMode ?? DEFAULT_CAPTURE_MODE;
76
77
  const slowResponseThresholdSeconds = response.data?.slowResponseThresholdSeconds ?? DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS;
77
78
  const timeDisplayFormat = response.data?.timeDisplayFormat ?? DEFAULT_TIME_DISPLAY_FORMAT;
78
79
  const optimisticConfig = (patch) => ({
@@ -80,6 +81,7 @@ function useStripConfig() {
80
81
  hasSeenOnboarding: response.data?.hasSeenOnboarding ?? false,
81
82
  slowResponseThresholdSeconds: response.data?.slowResponseThresholdSeconds ?? DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS,
82
83
  timeDisplayFormat: response.data?.timeDisplayFormat ?? DEFAULT_TIME_DISPLAY_FORMAT,
84
+ captureMode,
83
85
  ...patch
84
86
  });
85
87
  const setStrip = async (next) => {
@@ -113,6 +115,7 @@ function useStripConfig() {
113
115
  };
114
116
  return {
115
117
  strip,
118
+ captureMode,
116
119
  slowResponseThresholdSeconds,
117
120
  timeDisplayFormat,
118
121
  isLoading: response.isLoading,
@@ -154,13 +157,15 @@ function useOnboarding() {
154
157
  );
155
158
  const { mutate: globalMutate } = useSWRConfig();
156
159
  const hasSeenOnboarding = response.data?.hasSeenOnboarding ?? false;
160
+ const captureMode = response.data?.captureMode ?? DEFAULT_CAPTURE_MODE;
157
161
  const markSeen = async () => {
158
162
  await globalMutate(ONBOARDING_SWR_KEY, patchRuntimeConfig({ hasSeenOnboarding: true }), {
159
163
  optimisticData: {
160
164
  stripClaudeCodeBillingHeader: response.data?.stripClaudeCodeBillingHeader ?? false,
161
165
  hasSeenOnboarding: true,
162
166
  slowResponseThresholdSeconds: response.data?.slowResponseThresholdSeconds ?? DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS,
163
- timeDisplayFormat: response.data?.timeDisplayFormat ?? DEFAULT_TIME_DISPLAY_FORMAT
167
+ timeDisplayFormat: response.data?.timeDisplayFormat ?? DEFAULT_TIME_DISPLAY_FORMAT,
168
+ captureMode
164
169
  },
165
170
  rollbackOnError: true,
166
171
  revalidate: false
@@ -168,13 +173,15 @@ function useOnboarding() {
168
173
  };
169
174
  return {
170
175
  hasSeenOnboarding,
176
+ captureMode,
171
177
  isLoading: response.isLoading,
172
178
  markSeen
173
179
  };
174
180
  }
175
181
  function OnboardingBanner() {
176
- const { hasSeenOnboarding, isLoading, markSeen } = useOnboarding();
182
+ const { hasSeenOnboarding, captureMode, isLoading, markSeen } = useOnboarding();
177
183
  if (isLoading || hasSeenOnboarding) return null;
184
+ const isFullMode = captureMode === "full";
178
185
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(
179
186
  "div",
180
187
  {
@@ -183,19 +190,36 @@ function OnboardingBanner() {
183
190
  className: "mx-4 mt-2 mb-1 flex items-start gap-3 rounded-md border border-amber-500/30 bg-amber-500/5 px-4 py-3 text-sm",
184
191
  children: [
185
192
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "min-w-0 flex-1", children: [
186
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-1 font-medium text-amber-600 dark:text-amber-400", children: "Agent Inspector is ready" }),
193
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-1 font-medium text-amber-600 dark:text-amber-400", children: isFullMode ? "Agent Inspector is ready in Full mode" : "Agent Inspector is ready in Simple mode" }),
187
194
  /* @__PURE__ */ jsxRuntimeExports.jsxs("ul", { className: "space-y-0.5 text-xs leading-relaxed text-muted-foreground", children: [
188
- /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
189
- /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Trace" }),
190
- ": requests, responses, streaming chunks, tools, and timing."
191
- ] }),
192
- /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
193
- /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Replay" }),
194
- ": resend captured requests and compare provider behavior."
195
+ isFullMode ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
196
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
197
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Full mode" }),
198
+ ": raw headers, raw response, and SSE chunks are captured for diagnostics."
199
+ ] }),
200
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
201
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Daily work" }),
202
+ ": restart with ",
203
+ /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: "agent-inspector --mode simple" }),
204
+ " ",
205
+ "to reduce capture overhead."
206
+ ] })
207
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
208
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
209
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Simple mode" }),
210
+ ": lightweight capture for requests, responses, tools, timing, and token usage."
211
+ ] }),
212
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
213
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Need diagnostics?" }),
214
+ " Restart with",
215
+ " ",
216
+ /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: "agent-inspector --mode full" }),
217
+ " for raw headers, raw response, and SSE chunks."
218
+ ] })
195
219
  ] }),
196
220
  /* @__PURE__ */ jsxRuntimeExports.jsxs("li", { children: [
197
- /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Memory" }),
198
- ": create reviewable candidates before promotion to OpenClaw."
221
+ /* @__PURE__ */ jsxRuntimeExports.jsx("strong", { children: "Replay and Memory" }),
222
+ ": available in both modes for provider checks and reviewable knowledge candidates."
199
223
  ] })
200
224
  ] })
201
225
  ] }),
@@ -328,7 +352,7 @@ function useProviders() {
328
352
  mutate: response.mutate
329
353
  };
330
354
  }
331
- const version = "2.0.14";
355
+ const version = "2.0.16";
332
356
  const packageJson = {
333
357
  version
334
358
  };
@@ -1389,19 +1413,19 @@ function useCopyFeedback(text) {
1389
1413
  return { copied, copy };
1390
1414
  }
1391
1415
  const LazyCompareDrawer = reactExports.lazy(
1392
- () => import("./CompareDrawer-blWGaGiT.mjs").then((m) => ({ default: m.CompareDrawer }))
1416
+ () => import("./CompareDrawer-CEo48Wsu.mjs").then((m) => ({ default: m.CompareDrawer }))
1393
1417
  );
1394
1418
  const LazyReplayDialog = reactExports.lazy(
1395
- () => import("./ReplayDialog-mzsq7AjW.mjs").then((m) => ({ default: m.ReplayDialog }))
1419
+ () => import("./ReplayDialog-C0nEvbYo.mjs").then((m) => ({ default: m.ReplayDialog }))
1396
1420
  );
1397
1421
  const LazyRequestAnatomy = reactExports.lazy(
1398
- () => import("./RequestAnatomy-CDAcXMBK.mjs").then((m) => ({ default: m.RequestAnatomy }))
1422
+ () => import("./RequestAnatomy-CT55prmM.mjs").then((m) => ({ default: m.RequestAnatomy }))
1399
1423
  );
1400
1424
  const LazyResponseView = reactExports.lazy(
1401
- () => import("./ResponseView-B__xXCsZ.mjs").then((m) => ({ default: m.ResponseView }))
1425
+ () => import("./ResponseView-DBZSBCOD.mjs").then((m) => ({ default: m.ResponseView }))
1402
1426
  );
1403
1427
  const LazyStreamingChunkSequence = reactExports.lazy(
1404
- () => import("./StreamingChunkSequence-BnJkTdXF.mjs").then((m) => ({
1428
+ () => import("./StreamingChunkSequence-BuVT7Oke.mjs").then((m) => ({
1405
1429
  default: m.StreamingChunkSequence
1406
1430
  }))
1407
1431
  );
@@ -7182,6 +7206,7 @@ function OnboardingSettingsTab() {
7182
7206
  function ProxySettingsTab() {
7183
7207
  const {
7184
7208
  strip,
7209
+ captureMode,
7185
7210
  slowResponseThresholdSeconds,
7186
7211
  timeDisplayFormat,
7187
7212
  isLoading,
@@ -7191,6 +7216,7 @@ function ProxySettingsTab() {
7191
7216
  } = useStripConfig();
7192
7217
  const [error, setError] = reactExports.useState(null);
7193
7218
  const [pending, setPending] = reactExports.useState(false);
7219
+ const alternateCaptureMode = captureMode === "full" ? "simple" : "full";
7194
7220
  const handleToggle = reactExports.useCallback(
7195
7221
  async (next) => {
7196
7222
  setError(null);
@@ -7234,6 +7260,20 @@ function ProxySettingsTab() {
7234
7260
  [setTimeDisplayFormat]
7235
7261
  );
7236
7262
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-4", children: [
7263
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
7264
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold", children: "Capture mode" }),
7265
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-muted-foreground", children: [
7266
+ "This process is running in ",
7267
+ /* @__PURE__ */ jsxRuntimeExports.jsx("code", { children: captureMode }),
7268
+ " mode. Restart with",
7269
+ " ",
7270
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("code", { children: [
7271
+ "agent-inspector --mode ",
7272
+ alternateCaptureMode
7273
+ ] }),
7274
+ " to change it."
7275
+ ] })
7276
+ ] }),
7237
7277
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "space-y-1", children: [
7238
7278
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-sm font-semibold", children: "Claude Code billing header" }),
7239
7279
  /* @__PURE__ */ jsxRuntimeExports.jsxs("p", { className: "text-xs text-muted-foreground", children: [
@@ -8861,6 +8901,7 @@ function ProxyViewer({
8861
8901
  onClearGroup,
8862
8902
  viewMode,
8863
8903
  onViewModeChange,
8904
+ captureMode,
8864
8905
  strip,
8865
8906
  slowResponseThresholdSeconds,
8866
8907
  timeDisplayFormat,
@@ -9019,7 +9060,7 @@ function ProxyViewer({
9019
9060
  models.map((m) => /* @__PURE__ */ jsxRuntimeExports.jsx(SelectItem, { value: m, children: m }, m))
9020
9061
  ] })
9021
9062
  ] }),
9022
- /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center border border-border rounded-md overflow-hidden", children: [
9063
+ captureMode === "full" ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center border border-border rounded-md overflow-hidden", children: [
9023
9064
  /* @__PURE__ */ jsxRuntimeExports.jsx(
9024
9065
  "button",
9025
9066
  {
@@ -9038,7 +9079,7 @@ function ProxyViewer({
9038
9079
  children: "Full"
9039
9080
  }
9040
9081
  )
9041
- ] }),
9082
+ ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center rounded-md border border-border bg-muted px-3 text-xs text-foreground", children: "Simple" }),
9042
9083
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1" }),
9043
9084
  !hasSessionContext && /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "text-muted-foreground text-xs font-mono", children: [
9044
9085
  logs.length,
@@ -9371,7 +9412,7 @@ function ProxyViewerContainer({
9371
9412
  }
9372
9413
  })();
9373
9414
  }, []);
9374
- const { strip, slowResponseThresholdSeconds, timeDisplayFormat } = useStripConfig();
9415
+ const { strip, captureMode, slowResponseThresholdSeconds, timeDisplayFormat } = useStripConfig();
9375
9416
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9376
9417
  error !== null && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "fixed top-4 right-4 bg-destructive text-destructive-foreground px-4 py-2 rounded-md text-sm z-50", children: error }),
9377
9418
  /* @__PURE__ */ jsxRuntimeExports.jsx(OnboardingBanner, {}),
@@ -9389,6 +9430,7 @@ function ProxyViewerContainer({
9389
9430
  onClearGroup: handleClearGroup,
9390
9431
  viewMode,
9391
9432
  onViewModeChange: setViewMode,
9433
+ captureMode,
9392
9434
  strip,
9393
9435
  slowResponseThresholdSeconds,
9394
9436
  timeDisplayFormat,
@@ -1,7 +1,7 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { u as useProviders, D as Dialog, b as DialogContent, d as DialogHeader, e as DialogTitle, T as Tabs, h as TabsList, i as TabsTrigger, j as TabsContent, k as TooltipProvider, l as Tooltip, m as TooltipTrigger, n as TooltipContent, o as Button } from "./ProxyViewerContainer-Dt_9BuM9.mjs";
3
- import { ResponseView } from "./ResponseView-B__xXCsZ.mjs";
4
- import "./router-BpEBhA7S.mjs";
2
+ import { u as useProviders, D as Dialog, b as DialogContent, d as DialogHeader, e as DialogTitle, T as Tabs, h as TabsList, i as TabsTrigger, j as TabsContent, k as TooltipProvider, l as Tooltip, m as TooltipTrigger, n as TooltipContent, o as Button } from "./ProxyViewerContainer-5ekIK_jx.mjs";
3
+ import { ResponseView } from "./ResponseView-DBZSBCOD.mjs";
4
+ import "./router-DxjqHipT.mjs";
5
5
  import "../_libs/modelcontextprotocol__server.mjs";
6
6
  import "../_libs/jszip.mjs";
7
7
  import { K as RotateCcw } from "../_libs/lucide-react.mjs";
@@ -1,6 +1,6 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { u as useProviders, p as analyzeContextIntelligence, f as formatTokens, k as TooltipProvider, c as cn, l as Tooltip, m as TooltipTrigger, n as TooltipContent, S as SegmentBar, R as ROLE_COLOR_CLASSES, A as ANATOMY_ROLE_LABELS, q as formatContextWindowTokens, C as CONTEXT_USAGE_THRESHOLDS } from "./ProxyViewerContainer-Dt_9BuM9.mjs";
3
- import "./router-BpEBhA7S.mjs";
2
+ import { u as useProviders, p as analyzeContextIntelligence, f as formatTokens, k as TooltipProvider, c as cn, l as Tooltip, m as TooltipTrigger, n as TooltipContent, S as SegmentBar, R as ROLE_COLOR_CLASSES, A as ANATOMY_ROLE_LABELS, q as formatContextWindowTokens, C as CONTEXT_USAGE_THRESHOLDS } from "./ProxyViewerContainer-5ekIK_jx.mjs";
3
+ import "./router-DxjqHipT.mjs";
4
4
  import "../_libs/modelcontextprotocol__server.mjs";
5
5
  import "../_libs/jszip.mjs";
6
6
  import { ac as Info, b as ChevronDown, f as ChevronRight } from "../_libs/lucide-react.mjs";
@@ -1,6 +1,6 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { g as getLogFormatAdapter, f as formatTokens, c as cn, s as getStatusCategory, B as Badge, t as Collapsible, v as CollapsibleTrigger, w as CollapsibleContent, x as ScrollArea, y as JsonViewer, z as safeJsonValue } from "./ProxyViewerContainer-Dt_9BuM9.mjs";
3
- import "./router-BpEBhA7S.mjs";
2
+ import { g as getLogFormatAdapter, f as formatTokens, c as cn, s as getStatusCategory, B as Badge, t as Collapsible, v as CollapsibleTrigger, w as CollapsibleContent, x as ScrollArea, y as JsonViewer, z as safeJsonValue } from "./ProxyViewerContainer-5ekIK_jx.mjs";
3
+ import "./router-DxjqHipT.mjs";
4
4
  import "../_libs/modelcontextprotocol__server.mjs";
5
5
  import "../_libs/jszip.mjs";
6
6
  import { Z as Zap, j as TriangleAlert, ad as CircleStop, B as Brain, b as ChevronDown, f as ChevronRight, T as Terminal } from "../_libs/lucide-react.mjs";
@@ -1,6 +1,6 @@
1
1
  import { r as reactExports, j as jsxRuntimeExports } from "../_libs/react.mjs";
2
- import { k as TooltipProvider, l as Tooltip, m as TooltipTrigger, B as Badge, n as TooltipContent, y as JsonViewer } from "./ProxyViewerContainer-Dt_9BuM9.mjs";
3
- import "./router-BpEBhA7S.mjs";
2
+ import { k as TooltipProvider, l as Tooltip, m as TooltipTrigger, B as Badge, n as TooltipContent, y as JsonViewer } from "./ProxyViewerContainer-5ekIK_jx.mjs";
3
+ import "./router-DxjqHipT.mjs";
4
4
  import "../_libs/modelcontextprotocol__server.mjs";
5
5
  import "../_libs/jszip.mjs";
6
6
  import { b as ChevronDown, f as ChevronRight, L as LoaderCircle } from "../_libs/lucide-react.mjs";
@@ -1,6 +1,6 @@
1
- import { P as ProxyViewerContainer } from "./ProxyViewerContainer-Dt_9BuM9.mjs";
1
+ import { P as ProxyViewerContainer } from "./ProxyViewerContainer-5ekIK_jx.mjs";
2
2
  import "../_libs/react.mjs";
3
- import "./router-BpEBhA7S.mjs";
3
+ import "./router-DxjqHipT.mjs";
4
4
  import "../_libs/modelcontextprotocol__server.mjs";
5
5
  import "../_libs/jszip.mjs";
6
6
  import "../_libs/swr.mjs";
@@ -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-CHekFSzj.mjs");
201
+ const { tsrStartManifest } = await import("../_tanstack-start-manifest_v-xeOo5gW5.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-BpEBhA7S.mjs").then((n) => n.m);
770
+ const routerEntry = await import("./router-DxjqHipT.mjs").then((n) => n.n);
771
771
  const startEntry = await import("./start-HYkvq4Ni.mjs");
772
772
  return { startEntry, routerEntry };
773
773
  }
@@ -92,7 +92,7 @@ function RootDocument({ children }) {
92
92
  ] })
93
93
  ] });
94
94
  }
95
- const $$splitComponentImporter$1 = () => import("./index-B2-uF9XT.mjs");
95
+ const $$splitComponentImporter$1 = () => import("./index-Cw_zJVQv.mjs");
96
96
  const Route$r = createFileRoute("/")({
97
97
  component: lazyRouteComponent($$splitComponentImporter$1, "component")
98
98
  });
@@ -135,7 +135,7 @@ function decodeSessionIdFromPath(encoded) {
135
135
  function getSessionPath(sessionId) {
136
136
  return `/session/${encodeSessionIdForPath(sessionId)}`;
137
137
  }
138
- const $$splitComponentImporter = () => import("../_sessionId-CeHY-3xa.mjs");
138
+ const $$splitComponentImporter = () => import("../_sessionId-CEbZTs68.mjs");
139
139
  const Route$q = createFileRoute("/session/$sessionId")({
140
140
  component: lazyRouteComponent($$splitComponentImporter, "component"),
141
141
  parseParams: (params) => ({
@@ -3008,12 +3008,15 @@ async function getClientInfo(request) {
3008
3008
  const DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS = 10;
3009
3009
  const MAX_SLOW_RESPONSE_THRESHOLD_SECONDS = 600;
3010
3010
  const DEFAULT_TIME_DISPLAY_FORMAT = "time";
3011
+ const DEFAULT_CAPTURE_MODE = "simple";
3011
3012
  const TimeDisplayFormatSchema = _enum(["time", "full"]);
3013
+ const CaptureModeSchema = _enum(["simple", "full"]);
3012
3014
  const RuntimeConfigSchema = object({
3013
3015
  stripClaudeCodeBillingHeader: boolean(),
3014
3016
  hasSeenOnboarding: boolean().default(false),
3015
3017
  slowResponseThresholdSeconds: number().int().min(0).max(MAX_SLOW_RESPONSE_THRESHOLD_SECONDS).default(DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS),
3016
- timeDisplayFormat: TimeDisplayFormatSchema.default(DEFAULT_TIME_DISPLAY_FORMAT)
3018
+ timeDisplayFormat: TimeDisplayFormatSchema.default(DEFAULT_TIME_DISPLAY_FORMAT),
3019
+ captureMode: CaptureModeSchema.default(DEFAULT_CAPTURE_MODE)
3017
3020
  });
3018
3021
  function getConfigFilePath() {
3019
3022
  return join(getDataDir(), "config.json");
@@ -3022,7 +3025,16 @@ function getConfigTempPath() {
3022
3025
  return join(getDataDir(), "config.json.tmp");
3023
3026
  }
3024
3027
  let currentConfig = resolveInitialConfig();
3028
+ function resolveInitialCaptureMode() {
3029
+ const value = process.env["AGENT_INSPECTOR_CAPTURE_MODE"] ?? process.env["AGENT_INSPECTOR_MODE"];
3030
+ if (value === void 0 || value === "") return DEFAULT_CAPTURE_MODE;
3031
+ const result = CaptureModeSchema.safeParse(value);
3032
+ if (result.success) return result.data;
3033
+ logger.warn(`[config] Invalid capture mode ${value}; falling back to ${DEFAULT_CAPTURE_MODE}`);
3034
+ return DEFAULT_CAPTURE_MODE;
3035
+ }
3025
3036
  function resolveInitialConfig() {
3037
+ const captureMode = resolveInitialCaptureMode();
3026
3038
  const filePath = getConfigFilePath();
3027
3039
  if (existsSync(filePath)) {
3028
3040
  try {
@@ -3031,7 +3043,7 @@ function resolveInitialConfig() {
3031
3043
  const result = RuntimeConfigSchema.safeParse(parsed);
3032
3044
  if (result.success) {
3033
3045
  logger.info(`[config] Loaded persisted config from ${filePath}`);
3034
- return result.data;
3046
+ return { ...result.data, captureMode };
3035
3047
  }
3036
3048
  logger.warn(
3037
3049
  `[config] Persisted config at ${filePath} is invalid; falling back to env/default`
@@ -3047,14 +3059,16 @@ function resolveInitialConfig() {
3047
3059
  stripClaudeCodeBillingHeader: true,
3048
3060
  hasSeenOnboarding: false,
3049
3061
  slowResponseThresholdSeconds: DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS,
3050
- timeDisplayFormat: DEFAULT_TIME_DISPLAY_FORMAT
3062
+ timeDisplayFormat: DEFAULT_TIME_DISPLAY_FORMAT,
3063
+ captureMode
3051
3064
  };
3052
3065
  }
3053
3066
  return {
3054
3067
  stripClaudeCodeBillingHeader: false,
3055
3068
  hasSeenOnboarding: false,
3056
3069
  slowResponseThresholdSeconds: DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS,
3057
- timeDisplayFormat: DEFAULT_TIME_DISPLAY_FORMAT
3070
+ timeDisplayFormat: DEFAULT_TIME_DISPLAY_FORMAT,
3071
+ captureMode
3058
3072
  };
3059
3073
  }
3060
3074
  function getConfig() {
@@ -3063,7 +3077,8 @@ function getConfig() {
3063
3077
  function setConfig(patch) {
3064
3078
  const next = {
3065
3079
  ...currentConfig,
3066
- ...patch
3080
+ ...patch,
3081
+ captureMode: currentConfig.captureMode
3067
3082
  };
3068
3083
  currentConfig = next;
3069
3084
  persistConfig(next);
@@ -3080,7 +3095,7 @@ function persistConfig(value) {
3080
3095
  return false;
3081
3096
  }
3082
3097
  try {
3083
- writeFileSync(tempPath, JSON.stringify(value), "utf-8");
3098
+ writeFileSync(tempPath, JSON.stringify(toPersistedConfig(value)), "utf-8");
3084
3099
  } catch (err) {
3085
3100
  logger.error(`[config] Failed to write config temp file: ${String(err)}`);
3086
3101
  return false;
@@ -3100,6 +3115,14 @@ function persistConfig(value) {
3100
3115
  }
3101
3116
  }
3102
3117
  }
3118
+ function toPersistedConfig(value) {
3119
+ return {
3120
+ stripClaudeCodeBillingHeader: value.stripClaudeCodeBillingHeader,
3121
+ hasSeenOnboarding: value.hasSeenOnboarding,
3122
+ slowResponseThresholdSeconds: value.slowResponseThresholdSeconds,
3123
+ timeDisplayFormat: value.timeDisplayFormat
3124
+ };
3125
+ }
3103
3126
  const BILLING_HEADER_PREFIX = "x-anthropic-billing-header:";
3104
3127
  function isClaudeCodeBillingHeaderBlock(text) {
3105
3128
  const trimmed = text.trimStart();
@@ -3305,7 +3328,7 @@ function finalizeStreaming(job, log) {
3305
3328
  job.rawStream,
3306
3329
  log,
3307
3330
  log.model ?? void 0,
3308
- true
3331
+ job.collectStreamingChunks
3309
3332
  );
3310
3333
  persistStreamingChunks(log);
3311
3334
  return { log, upstreamUrl: job.upstreamUrl, error: null };
@@ -3325,7 +3348,7 @@ function finalizeStreamAbort(job, log) {
3325
3348
  job.rawStream,
3326
3349
  log,
3327
3350
  log.model ?? void 0,
3328
- true
3351
+ job.collectStreamingChunks
3329
3352
  );
3330
3353
  persistStreamingChunks(log);
3331
3354
  } else {
@@ -3518,12 +3541,14 @@ function injectProviderAuth(headers, provider) {
3518
3541
  }
3519
3542
  headers.set(HEADER_AUTHORIZATION, `Bearer ${apiKey}`);
3520
3543
  }
3521
- function buildProxyHeaders(originalHeaders) {
3522
- const rawHeaders = {};
3544
+ function buildProxyHeaders(originalHeaders, captureRawHeaders) {
3545
+ const rawHeaders = captureRawHeaders ? {} : void 0;
3523
3546
  const headers = new Headers();
3524
- originalHeaders.forEach((value, key) => {
3525
- rawHeaders[key.toLowerCase()] = value;
3526
- });
3547
+ if (rawHeaders !== void 0) {
3548
+ originalHeaders.forEach((value, key) => {
3549
+ rawHeaders[key.toLowerCase()] = value;
3550
+ });
3551
+ }
3527
3552
  headers.set(HEADER_USER_AGENT, PROXY_IDENTITY);
3528
3553
  headers.set(HEADER_X_PROXY_IDENTITY, PROXY_IDENTITY);
3529
3554
  for (const name of PRESERVE_HEADERS) {
@@ -3575,7 +3600,7 @@ function handleNonStreamingResponse(upstreamRes, responseBody, startTime, upstre
3575
3600
  headers: responseHeaders
3576
3601
  });
3577
3602
  }
3578
- function handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log) {
3603
+ function handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log, collectStreamingChunks) {
3579
3604
  log.streaming = true;
3580
3605
  log.responseStatus = upstreamRes.status;
3581
3606
  const chunks = [];
@@ -3594,7 +3619,8 @@ function handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log)
3594
3619
  upstreamUrl,
3595
3620
  elapsedMs,
3596
3621
  responseStatus: upstreamRes.status,
3597
- rawStream: full
3622
+ rawStream: full,
3623
+ collectStreamingChunks
3598
3624
  });
3599
3625
  }
3600
3626
  });
@@ -3614,7 +3640,8 @@ function handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log)
3614
3640
  upstreamUrl,
3615
3641
  elapsedMs,
3616
3642
  rawStream: full,
3617
- hasChunks
3643
+ hasChunks,
3644
+ collectStreamingChunks
3618
3645
  });
3619
3646
  }
3620
3647
  });
@@ -3633,8 +3660,9 @@ async function handleProxy(req) {
3633
3660
  if (req.body && req.method !== "GET" && req.method !== "HEAD") {
3634
3661
  requestBody = await req.text();
3635
3662
  }
3663
+ const config = getConfig();
3636
3664
  let bodyToForward = requestBody;
3637
- if (getConfig().stripClaudeCodeBillingHeader && requestBody !== null && parsed.isMessages) {
3665
+ if (config.stripClaudeCodeBillingHeader && requestBody !== null && parsed.isMessages) {
3638
3666
  const stripped = stripClaudeCodeBillingHeader(requestBody);
3639
3667
  if (stripped.removed > 0) {
3640
3668
  logger.info(
@@ -3658,7 +3686,11 @@ async function handleProxy(req) {
3658
3686
  const upstreamBase = selectUpstreamBase(route, matchedProviderConfig);
3659
3687
  const upstreamUrl = buildUpstreamUrl(upstreamBase, parsed.normalizedPath);
3660
3688
  const startTime = Date.now();
3661
- const { headers: upstreamHeaders, rawHeaders } = buildProxyHeaders(req.headers);
3689
+ const captureFullDetails = config.captureMode === "full";
3690
+ const { headers: upstreamHeaders, rawHeaders } = buildProxyHeaders(
3691
+ req.headers,
3692
+ captureFullDetails
3693
+ );
3662
3694
  setUpstreamHost(upstreamHeaders, upstreamBase);
3663
3695
  injectProviderAuth(upstreamHeaders, matchedProviderConfig);
3664
3696
  const provider = model !== null ? registry.findProvider(model) : null;
@@ -3671,10 +3703,12 @@ async function handleProxy(req) {
3671
3703
  return new Response("Forbidden: unsupported format", { status: STATUS_FORBIDDEN });
3672
3704
  }
3673
3705
  const [clientInfo, preAcquiredId] = await Promise.all([getClientInfo(req), getNextLogId()]);
3674
- const upstreamHeadersObj = {};
3675
- upstreamHeaders.forEach((value, key) => {
3676
- upstreamHeadersObj[key.toLowerCase()] = value;
3677
- });
3706
+ const upstreamHeadersObj = captureFullDetails ? {} : void 0;
3707
+ if (upstreamHeadersObj !== void 0) {
3708
+ upstreamHeaders.forEach((value, key) => {
3709
+ upstreamHeadersObj[key.toLowerCase()] = value;
3710
+ });
3711
+ }
3678
3712
  const log = await createLog(
3679
3713
  req.method,
3680
3714
  parsed.apiPath,
@@ -3718,7 +3752,7 @@ async function handleProxy(req) {
3718
3752
  const responseBody = await upstreamRes.text();
3719
3753
  return handleNonStreamingResponse(upstreamRes, responseBody, startTime, upstreamUrl, log);
3720
3754
  }
3721
- return handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log);
3755
+ return handleStreamingResponse(upstreamRes, req, startTime, upstreamUrl, log, captureFullDetails);
3722
3756
  }
3723
3757
  const Route$p = createFileRoute("/proxy/$")({
3724
3758
  server: {
@@ -6642,7 +6676,7 @@ function createFailedProviderTestResults(message, type) {
6642
6676
  function hasSuccessField(result) {
6643
6677
  return Object.prototype.hasOwnProperty.call(result, "success");
6644
6678
  }
6645
- async function logModelResults(displayName, providerName, anthropicUrl, openaiUrl, modelResults) {
6679
+ async function logModelResults(displayName, providerName, anthropicUrl, openaiUrl, modelResults, captureFullDetails) {
6646
6680
  const usageModel = getModelUsageName(displayName, providerName);
6647
6681
  if (anthropicUrl !== void 0) {
6648
6682
  const nsResult = modelResults.anthropic.nonStreaming;
@@ -6671,7 +6705,7 @@ async function logModelResults(displayName, providerName, anthropicUrl, openaiUr
6671
6705
  apiFormat: "anthropic",
6672
6706
  isTest: true,
6673
6707
  providerName,
6674
- headers: nonStreamingResult.requestHeaders ?? {}
6708
+ headers: captureFullDetails ? nonStreamingResult.requestHeaders ?? {} : void 0
6675
6709
  });
6676
6710
  const streamingRequestBody = JSON.stringify(
6677
6711
  buildProviderTestRequestBody(usageModel, "streaming")
@@ -6691,13 +6725,13 @@ async function logModelResults(displayName, providerName, anthropicUrl, openaiUr
6691
6725
  cacheReadInputTokens: streamingResult.cacheReadInputTokens ?? null,
6692
6726
  elapsedMs: streamingResult.latencyMs ?? 0,
6693
6727
  streaming: true,
6694
- streamingChunks: streamingResult.streamingChunks,
6728
+ streamingChunks: captureFullDetails ? streamingResult.streamingChunks : void 0,
6695
6729
  userAgent: "provider-test",
6696
6730
  origin: null,
6697
6731
  apiFormat: "anthropic",
6698
6732
  isTest: true,
6699
6733
  providerName,
6700
- headers: streamingResult.requestHeaders ?? {}
6734
+ headers: captureFullDetails ? streamingResult.requestHeaders ?? {} : void 0
6701
6735
  });
6702
6736
  }
6703
6737
  }
@@ -6728,7 +6762,7 @@ async function logModelResults(displayName, providerName, anthropicUrl, openaiUr
6728
6762
  apiFormat: "openai",
6729
6763
  isTest: true,
6730
6764
  providerName,
6731
- headers: nonStreamingResult.requestHeaders ?? {}
6765
+ headers: captureFullDetails ? nonStreamingResult.requestHeaders ?? {} : void 0
6732
6766
  });
6733
6767
  const streamingRequestBody = JSON.stringify(
6734
6768
  buildProviderTestRequestBody(usageModel, "streaming")
@@ -6748,13 +6782,13 @@ async function logModelResults(displayName, providerName, anthropicUrl, openaiUr
6748
6782
  cacheReadInputTokens: null,
6749
6783
  elapsedMs: streamingResult.latencyMs ?? 0,
6750
6784
  streaming: true,
6751
- streamingChunks: streamingResult.streamingChunks,
6785
+ streamingChunks: captureFullDetails ? streamingResult.streamingChunks : void 0,
6752
6786
  userAgent: "provider-test",
6753
6787
  origin: null,
6754
6788
  apiFormat: "openai",
6755
6789
  isTest: true,
6756
6790
  providerName,
6757
- headers: streamingResult.requestHeaders ?? {}
6791
+ headers: captureFullDetails ? streamingResult.requestHeaders ?? {} : void 0
6758
6792
  });
6759
6793
  }
6760
6794
  }
@@ -6781,13 +6815,21 @@ const Route$2 = createFileRoute("/api/providers/$providerId/test/log")({
6781
6815
  );
6782
6816
  }
6783
6817
  const results = parsed.data;
6818
+ const captureFullDetails = getConfig().captureMode === "full";
6784
6819
  const anthropicUrl = provider.anthropicBaseUrl !== void 0 && provider.anthropicBaseUrl.length > 0 ? provider.anthropicBaseUrl : void 0;
6785
6820
  const openaiUrl = provider.openaiBaseUrl !== void 0 && provider.openaiBaseUrl.length > 0 ? provider.openaiBaseUrl : void 0;
6786
6821
  const entries = [];
6787
6822
  if (results.models !== void 0) {
6788
6823
  for (const [modelName, modelResult] of Object.entries(results.models)) {
6789
6824
  entries.push(
6790
- logModelResults(modelName, provider.name, anthropicUrl, openaiUrl, modelResult)
6825
+ logModelResults(
6826
+ modelName,
6827
+ provider.name,
6828
+ anthropicUrl,
6829
+ openaiUrl,
6830
+ modelResult,
6831
+ captureFullDetails
6832
+ )
6791
6833
  );
6792
6834
  }
6793
6835
  }
@@ -7143,26 +7185,27 @@ const router = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
7143
7185
  export {
7144
7186
  AnthropicResponseSchema$1 as A,
7145
7187
  CapturedLogSchema as C,
7146
- DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS as D,
7188
+ DEFAULT_CAPTURE_MODE as D,
7147
7189
  KnowledgeCandidateSchema as K,
7148
7190
  MAX_SLOW_RESPONSE_THRESHOLD_SECONDS as M,
7149
7191
  OpenAIRequestSchema as O,
7150
7192
  ProviderConfigSchema as P,
7151
7193
  Route$q as R,
7152
7194
  TimeDisplayFormatSchema as T,
7153
- DEFAULT_TIME_DISPLAY_FORMAT as a,
7154
- RuntimeConfigSchema as b,
7155
- AnthropicRequestSchema as c,
7156
- stripClaudeCodeBillingHeader as d,
7157
- providerHasContextMetadata as e,
7158
- findProviderModelMetadata as f,
7195
+ DEFAULT_SLOW_RESPONSE_THRESHOLD_SECONDS as a,
7196
+ DEFAULT_TIME_DISPLAY_FORMAT as b,
7197
+ RuntimeConfigSchema as c,
7198
+ AnthropicRequestSchema as d,
7199
+ stripClaudeCodeBillingHeader as e,
7200
+ providerHasContextMetadata as f,
7159
7201
  getSessionPath as g,
7160
- createPendingProviderTestResults as h,
7161
- ProviderTestResultsSchema as i,
7162
- createFailedProviderTestResults as j,
7163
- resolveProviderContextWindow as k,
7164
- isPlainRecord as l,
7165
- router as m,
7202
+ findProviderModelMetadata as h,
7203
+ createPendingProviderTestResults as i,
7204
+ ProviderTestResultsSchema as j,
7205
+ createFailedProviderTestResults as k,
7206
+ resolveProviderContextWindow as l,
7207
+ isPlainRecord as m,
7208
+ router as n,
7166
7209
  parseOpenAIResponse as p,
7167
7210
  requestFormatForPath as r,
7168
7211
  safeGetOwnProperty as s