@tonyclaw/agent-inspector 3.1.8 → 3.1.10

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/backend/nitro.json +1 -1
  2. package/.output/cli.js +14 -4
  3. package/.output/server/_ssr/index.mjs +1 -1
  4. package/.output/server/_ssr/{router-CHcOqlej.mjs → router-sfMEKM3b.mjs} +270 -3
  5. package/.output/server/index.mjs +1 -1
  6. package/.output/ui/assets/{CompareDrawer-D6p2D3aR.js → CompareDrawer-dLJBRd6W.js} +1 -1
  7. package/.output/ui/assets/{InspectorPet-DteVBsK4.js → InspectorPet-DOP6QLyU.js} +1 -1
  8. package/.output/ui/assets/ProxyViewerContainer-BR0cxniH.js +59 -0
  9. package/.output/ui/assets/{ReplayDialog-BxfD3Ni8.js → ReplayDialog-Bfdzueeg.js} +1 -1
  10. package/.output/ui/assets/{RequestAnatomy-Bc-HEy3u.js → RequestAnatomy-CvVFHUCZ.js} +1 -1
  11. package/.output/ui/assets/ResponseView-BOeVZfR4.js +2 -0
  12. package/.output/ui/assets/StreamingChunkSequence-BX4KDLqt.js +1 -0
  13. package/.output/ui/assets/{_sessionId-Dm2fmwl6.js → _sessionId-BD6Scv6x.js} +1 -1
  14. package/.output/ui/assets/{_sessionId-MXVCdKA6.js → _sessionId-BlQOMPaG.js} +1 -1
  15. package/.output/ui/assets/{index-r-7cZ1UL.js → index-BwV0b3yu.js} +2 -2
  16. package/.output/ui/assets/{index-aah_H3hN.js → index-CVlN4MFT.js} +1 -1
  17. package/.output/ui/assets/index-IBEDJoV_.css +1 -0
  18. package/.output/ui/assets/{index-BuF4rMwu.js → index-UvtnFHf_.js} +1 -1
  19. package/.output/ui/assets/{index-Dr_GO75d.js → index-gUFWZr2M.js} +1 -1
  20. package/.output/ui/assets/{json-viewer-Dikr00zS.js → json-viewer-BLx7UxTA.js} +1 -1
  21. package/.output/ui/assets/{jszip.min-zWpW-aD7.js → jszip.min-BvxDqjej.js} +1 -1
  22. package/.output/ui/index.html +2 -2
  23. package/.output/workers/logFinalizer.worker.js +10 -0
  24. package/.output/workers/sessionWorkerEntry.js +10 -0
  25. package/package.json +4 -4
  26. package/src/components/proxy-viewer/AnswerMarkdown.tsx +37 -7
  27. package/src/components/proxy-viewer/LogEntry.tsx +61 -11
  28. package/src/components/proxy-viewer/ResponseView.tsx +33 -3
  29. package/src/components/proxy-viewer/StreamingChunkSequence.tsx +60 -3
  30. package/src/components/proxy-viewer/viewerState.ts +11 -169
  31. package/src/contracts/index.ts +2 -0
  32. package/src/contracts/log.ts +13 -0
  33. package/src/lib/toolTrace.ts +290 -0
  34. package/src/proxy/logIndex.ts +4 -0
  35. package/src/proxy/schemas.ts +2 -0
  36. package/src/proxy/sqliteLogIndex.ts +24 -2
  37. package/src/proxy/store.ts +3 -0
  38. package/.output/ui/assets/ProxyViewerContainer-Dw723CdA.js +0 -59
  39. package/.output/ui/assets/ResponseView-Be5xdsIm.js +0 -2
  40. package/.output/ui/assets/StreamingChunkSequence-Cd5G2xRQ.js +0 -1
  41. package/.output/ui/assets/index-BvXp42al.css +0 -1
@@ -5,6 +5,7 @@ export {
5
5
  CapturedLogSchema,
6
6
  JsonValueSchema,
7
7
  StreamingChunkSchema,
8
+ ToolTraceEventSchema,
8
9
  } from "../contracts";
9
10
  export type {
10
11
  CapturedLog,
@@ -12,6 +13,7 @@ export type {
12
13
  CaptureIncompleteReason,
13
14
  JsonValue,
14
15
  StreamingChunk,
16
+ ToolTraceEvent,
15
17
  TokenUsage,
16
18
  } from "../contracts";
17
19
 
@@ -1,7 +1,7 @@
1
1
  import { existsSync } from "node:fs";
2
2
  import { dirname, join } from "node:path";
3
3
  import { logger, resolveLogDir } from "./logger";
4
- import type { ApiFormat, CaptureIncompleteReason } from "./schemas";
4
+ import { ToolTraceEventSchema, type ApiFormat, type CaptureIncompleteReason } from "./schemas";
5
5
  import type { LogIndexEntry, LogIndexSummary } from "./logIndex";
6
6
  import { ensurePrivateDirectorySync, securePrivateFileSync } from "./privateDataPath";
7
7
 
@@ -52,6 +52,7 @@ CREATE TABLE IF NOT EXISTS log_index (
52
52
  dropped_bytes INTEGER NOT NULL DEFAULT 0,
53
53
  capture_incomplete_reason TEXT,
54
54
  warnings_json TEXT,
55
+ tool_trace_events_json TEXT,
55
56
  error TEXT
56
57
  );
57
58
  CREATE INDEX IF NOT EXISTS idx_log_index_session_id_id ON log_index(session_id, id);
@@ -98,9 +99,10 @@ INSERT INTO log_index (
98
99
  dropped_bytes,
99
100
  capture_incomplete_reason,
100
101
  warnings_json,
102
+ tool_trace_events_json,
101
103
  error
102
104
  ) VALUES (
103
- ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
105
+ ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
104
106
  )
105
107
  ON CONFLICT(id) DO UPDATE SET
106
108
  file = excluded.file,
@@ -139,6 +141,7 @@ ON CONFLICT(id) DO UPDATE SET
139
141
  dropped_bytes = excluded.dropped_bytes,
140
142
  capture_incomplete_reason = excluded.capture_incomplete_reason,
141
143
  warnings_json = excluded.warnings_json,
144
+ tool_trace_events_json = excluded.tool_trace_events_json,
142
145
  error = excluded.error
143
146
  `;
144
147
 
@@ -232,6 +235,7 @@ const REQUIRED_SCHEMA_COLUMNS = [
232
235
  { name: "dropped_chunks", definition: "INTEGER NOT NULL DEFAULT 0" },
233
236
  { name: "dropped_bytes", definition: "INTEGER NOT NULL DEFAULT 0" },
234
237
  { name: "capture_incomplete_reason", definition: "TEXT" },
238
+ { name: "tool_trace_events_json", definition: "TEXT" },
235
239
  ];
236
240
 
237
241
  function ensureSchemaColumns(db: unknown): boolean {
@@ -394,6 +398,10 @@ function warningJson(warnings: string[] | undefined): string | null {
394
398
  return warnings === undefined ? null : JSON.stringify(warnings);
395
399
  }
396
400
 
401
+ function toolTraceEventsJson(summary: LogIndexSummary | undefined): string | null {
402
+ return summary?.toolTraceEvents === undefined ? null : JSON.stringify(summary.toolTraceEvents);
403
+ }
404
+
397
405
  function boolToInt(value: boolean): number {
398
406
  return value ? 1 : 0;
399
407
  }
@@ -438,6 +446,7 @@ function entryParams(entry: LogIndexEntry): readonly unknown[] {
438
446
  summary?.droppedBytes ?? 0,
439
447
  summary?.captureIncompleteReason ?? null,
440
448
  warningJson(summary?.warnings),
449
+ toolTraceEventsJson(summary),
441
450
  summary?.error ?? null,
442
451
  ];
443
452
  }
@@ -504,6 +513,18 @@ function readWarnings(row: unknown): string[] | undefined {
504
513
  }
505
514
  }
506
515
 
516
+ function readToolTraceEvents(row: unknown): LogIndexSummary["toolTraceEvents"] {
517
+ const value = readString(row, "tool_trace_events_json");
518
+ if (value === null) return undefined;
519
+ try {
520
+ const parsed: unknown = JSON.parse(value);
521
+ const result = ToolTraceEventSchema.array().safeParse(parsed);
522
+ return result.success ? result.data : undefined;
523
+ } catch {
524
+ return undefined;
525
+ }
526
+ }
527
+
507
528
  function readRequiredNumber(row: unknown, name: string): number | null {
508
529
  const value = readNumber(row, name);
509
530
  return value === null || !Number.isInteger(value) ? null : value;
@@ -545,6 +566,7 @@ function summaryFromRow(row: unknown, id: number): LogIndexSummary {
545
566
  droppedBytes: readNumber(row, "dropped_bytes") ?? 0,
546
567
  captureIncompleteReason: readCaptureIncompleteReason(row),
547
568
  warnings: readWarnings(row),
569
+ toolTraceEvents: readToolTraceEvents(row),
548
570
  error: readString(row, "error"),
549
571
  };
550
572
  }
@@ -36,6 +36,7 @@ import {
36
36
  import { writeChunks } from "./chunkStorage";
37
37
  import { closeSqliteLogIndex } from "./sqliteLogIndex";
38
38
  import type { SessionInfo, SessionLogSummary } from "../lib/sessionInfoContract";
39
+ import { extractToolTraceEvents } from "../lib/toolTrace";
39
40
  import { textByteLength } from "../lib/unknown";
40
41
  import { buildSessionInfo, buildSessionLogSummary } from "./sessionInfo";
41
42
  import type { CapturedLog } from "./schemas";
@@ -338,6 +339,7 @@ export function compactLogForList(log: CapturedLog): CapturedLog {
338
339
  rawHeaders: undefined,
339
340
  headers: undefined,
340
341
  streamingChunks: undefined,
342
+ toolTraceEvents: log.toolTraceEvents ?? extractToolTraceEvents(log),
341
343
  rawRequestBodyBytes: log.rawRequestBodyBytes ?? textByteLength(log.rawRequestBody),
342
344
  responseTextBytes: log.responseTextBytes ?? textByteLength(log.responseText),
343
345
  bodyContentMode: "compact",
@@ -383,6 +385,7 @@ function compactLogFromIndexSummary(summary: LogIndexSummary): CapturedLog {
383
385
  droppedBytes: summary.droppedBytes,
384
386
  captureIncompleteReason: summary.captureIncompleteReason,
385
387
  warnings: summary.warnings,
388
+ toolTraceEvents: summary.toolTraceEvents,
386
389
  error: summary.error,
387
390
  });
388
391
  }