@vitest-agent/ui 6.0.8 → 6.1.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.
@@ -1,4 +1,4 @@
1
- import { formatConsoleLeaksNote, formatScopedCoverageNote, formatStrayOutputNote } from "@vitest-agent/sdk";
1
+ import { formatConsoleLeaksNote, formatModuleCacheLines, formatScopedCoverageNote, formatStrayOutputNote } from "@vitest-agent/sdk";
2
2
  import { renderSingleFileFail } from "./cells/single-file-fail.js";
3
3
  import { renderSingleFilePass } from "./cells/single-file-pass.js";
4
4
  import { renderSingleFileThreshold } from "./cells/single-file-threshold.js";
@@ -57,6 +57,7 @@ const dispatch = (inputs, opts) => {
57
57
  const note = scopedCoverageNoteFor(inputs);
58
58
  const withNote = note !== null ? `${body}\n${note}` : body;
59
59
  const trailers = [
60
+ moduleCacheNoteFor(inputs),
60
61
  suggestedActionsNoteFor(inputs),
61
62
  strayOutputNoteFor(inputs),
62
63
  consoleLeaksNoteFor(inputs)
@@ -77,6 +78,19 @@ const suggestedActionsNoteFor = (inputs) => {
77
78
  return lines.length === 0 ? null : lines.join("\n");
78
79
  };
79
80
  /**
81
+ * The module-cache lines for the run (issue #741), or `null` when no project
82
+ * produced timing data. `dispatch` and `dispatchInk` append them after the
83
+ * cell's output; cells never emit them themselves.
84
+ *
85
+ * @param inputs - the classified dispatch inputs
86
+ * @returns the lines joined, or `null`
87
+ * @internal
88
+ */
89
+ const moduleCacheNoteFor = (inputs) => {
90
+ const lines = formatModuleCacheLines(inputs.state.moduleCache);
91
+ return lines.length === 0 ? null : lines.join("\n");
92
+ };
93
+ /**
80
94
  * The console-leaks note for a run whose passing tests wrote `console.*`
81
95
  * output, or `null` when none did. Appended after the cell's output like the
82
96
  * stray-output note; cells never emit it themselves.
@@ -121,4 +135,4 @@ const scopedCoverageNoteFor = (inputs) => {
121
135
  return formatScopedCoverageNote(cov.scopedFiles ?? 0, cov.totalFiles);
122
136
  };
123
137
 
124
- export { consoleLeaksNoteFor, dispatch, dispatcherTable, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor };
138
+ export { consoleLeaksNoteFor, dispatch, dispatcherTable, moduleCacheNoteFor, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor };
@@ -2,6 +2,7 @@ import { Doc, Fmt, Render } from "@effected/cli-kit";
2
2
  import { formatTotalsLine } from "../counts.js";
3
3
  import { formatDisplayDuration } from "../format-duration.js";
4
4
  import { statusGlyph } from "../theme.js";
5
+ import { formatTraceStepLines } from "../trace-steps.js";
5
6
 
6
7
  // src/dispatcher/helpers.ts
7
8
  /**
@@ -74,6 +75,7 @@ const formatFailure = (f, width, link = (_target, label) => label) => {
74
75
  const parts = [Doc.line([Doc.link({ file: f.modulePath }, f.modulePath, { suffix: false }), Doc.text(` > ${suite}${f.testName}${classification}`)], { wrap: false })];
75
76
  if (f.error?.message !== void 0) parts.push(Doc.line(f.error.message.split("\n", 1)[0] ?? "", { truncate: true }));
76
77
  if (f.error?.diff !== void 0) parts.push(Doc.diffText(f.error.diff, { truncate: true }));
78
+ for (const line of formatTraceStepLines(f.error?.traceSteps)) parts.push(Doc.line(line, { truncate: true }));
77
79
  return Render.ansi([Doc.list([Doc.section(void 0, parts)], { compact: true })], {
78
80
  ...Render.contextOf({
79
81
  audience: "human",
package/index.d.ts CHANGED
@@ -91,6 +91,19 @@ export declare const TestRecord: Schema.Struct<{
91
91
  readonly diff: Schema.optional<Schema.String>;
92
92
  readonly expected: Schema.optional<Schema.String>;
93
93
  readonly received: Schema.optional<Schema.String>;
94
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
95
+ readonly name: Schema.String;
96
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
97
+ readonly startTime: Schema.Finite;
98
+ readonly duration: Schema.optional<Schema.Finite>;
99
+ readonly depth: Schema.Finite;
100
+ readonly locator: Schema.optional<Schema.String>;
101
+ readonly location: Schema.optional<Schema.Struct<{
102
+ readonly file: Schema.String;
103
+ readonly line: Schema.Finite;
104
+ readonly column: Schema.Finite;
105
+ }>>;
106
+ }>>>;
94
107
  }>>;
95
108
  }>;
96
109
  /** @public */
@@ -119,6 +132,19 @@ export declare const ModuleRecord: Schema.Struct<{
119
132
  readonly diff: Schema.optional<Schema.String>;
120
133
  readonly expected: Schema.optional<Schema.String>;
121
134
  readonly received: Schema.optional<Schema.String>;
135
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
136
+ readonly name: Schema.String;
137
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
138
+ readonly startTime: Schema.Finite;
139
+ readonly duration: Schema.optional<Schema.Finite>;
140
+ readonly depth: Schema.Finite;
141
+ readonly locator: Schema.optional<Schema.String>;
142
+ readonly location: Schema.optional<Schema.Struct<{
143
+ readonly file: Schema.String;
144
+ readonly line: Schema.Finite;
145
+ readonly column: Schema.Finite;
146
+ }>>;
147
+ }>>>;
122
148
  }>>;
123
149
  }>>;
124
150
  /**
@@ -154,6 +180,19 @@ export declare const FailureRecord: Schema.Struct<{
154
180
  readonly diff: Schema.optional<Schema.String>;
155
181
  readonly expected: Schema.optional<Schema.String>;
156
182
  readonly received: Schema.optional<Schema.String>;
183
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
184
+ readonly name: Schema.String;
185
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
186
+ readonly startTime: Schema.Finite;
187
+ readonly duration: Schema.optional<Schema.Finite>;
188
+ readonly depth: Schema.Finite;
189
+ readonly locator: Schema.optional<Schema.String>;
190
+ readonly location: Schema.optional<Schema.Struct<{
191
+ readonly file: Schema.String;
192
+ readonly line: Schema.Finite;
193
+ readonly column: Schema.Finite;
194
+ }>>;
195
+ }>>>;
157
196
  }>>;
158
197
  readonly timedOut: Schema.optional<Schema.Boolean>;
159
198
  readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
@@ -276,6 +315,19 @@ export declare const RenderState: Schema.Struct<{
276
315
  readonly diff: Schema.optional<Schema.String>;
277
316
  readonly expected: Schema.optional<Schema.String>;
278
317
  readonly received: Schema.optional<Schema.String>;
318
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
319
+ readonly name: Schema.String;
320
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
321
+ readonly startTime: Schema.Finite;
322
+ readonly duration: Schema.optional<Schema.Finite>;
323
+ readonly depth: Schema.Finite;
324
+ readonly locator: Schema.optional<Schema.String>;
325
+ readonly location: Schema.optional<Schema.Struct<{
326
+ readonly file: Schema.String;
327
+ readonly line: Schema.Finite;
328
+ readonly column: Schema.Finite;
329
+ }>>;
330
+ }>>>;
279
331
  }>>;
280
332
  }>>;
281
333
  /**
@@ -362,6 +414,19 @@ export declare const RenderState: Schema.Struct<{
362
414
  readonly diff: Schema.optional<Schema.String>;
363
415
  readonly expected: Schema.optional<Schema.String>;
364
416
  readonly received: Schema.optional<Schema.String>;
417
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
418
+ readonly name: Schema.String;
419
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
420
+ readonly startTime: Schema.Finite;
421
+ readonly duration: Schema.optional<Schema.Finite>;
422
+ readonly depth: Schema.Finite;
423
+ readonly locator: Schema.optional<Schema.String>;
424
+ readonly location: Schema.optional<Schema.Struct<{
425
+ readonly file: Schema.String;
426
+ readonly line: Schema.Finite;
427
+ readonly column: Schema.Finite;
428
+ }>>;
429
+ }>>>;
365
430
  }>>;
366
431
  readonly timedOut: Schema.optional<Schema.Boolean>;
367
432
  readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
@@ -394,6 +459,19 @@ export declare const RenderState: Schema.Struct<{
394
459
  readonly diff: Schema.optional<Schema.String>;
395
460
  readonly expected: Schema.optional<Schema.String>;
396
461
  readonly received: Schema.optional<Schema.String>;
462
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
463
+ readonly name: Schema.String;
464
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
465
+ readonly startTime: Schema.Finite;
466
+ readonly duration: Schema.optional<Schema.Finite>;
467
+ readonly depth: Schema.Finite;
468
+ readonly locator: Schema.optional<Schema.String>;
469
+ readonly location: Schema.optional<Schema.Struct<{
470
+ readonly file: Schema.String;
471
+ readonly line: Schema.Finite;
472
+ readonly column: Schema.Finite;
473
+ }>>;
474
+ }>>>;
397
475
  }>>;
398
476
  /**
399
477
  * What the run wrote straight to the terminal, past Vitest's console
@@ -430,6 +508,21 @@ export declare const RenderState: Schema.Struct<{
430
508
  readonly files: Schema.Finite;
431
509
  }>>;
432
510
  }>>;
511
+ /**
512
+ * Module cache effectiveness per project, folded from
513
+ * `RunFinished.moduleCache`. Absent when the run produced no timing data
514
+ * (issue #741).
515
+ */
516
+ readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
517
+ readonly project: Schema.optional<Schema.String>;
518
+ readonly moduleCache: Schema.Struct<{
519
+ readonly enabled: Schema.Boolean;
520
+ readonly transformMs: Schema.Finite;
521
+ readonly trackedMs: Schema.Finite;
522
+ readonly share: Schema.Finite;
523
+ readonly modulesWritten: Schema.optional<Schema.Finite>;
524
+ }>;
525
+ }>>>;
433
526
  }>;
434
527
  /** @public */
435
528
  export type RenderState = typeof RenderState.Type;
@@ -608,6 +701,19 @@ declare const AgentReport: Schema.Struct<{
608
701
  readonly diff: Schema.optional<Schema.String>;
609
702
  readonly expected: Schema.optional<Schema.String>;
610
703
  readonly received: Schema.optional<Schema.String>;
704
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
705
+ readonly name: Schema.String;
706
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
707
+ readonly startTime: Schema.Finite;
708
+ readonly duration: Schema.optional<Schema.Finite>;
709
+ readonly depth: Schema.Finite;
710
+ readonly locator: Schema.optional<Schema.String>;
711
+ readonly location: Schema.optional<Schema.Struct<{
712
+ readonly file: Schema.String;
713
+ readonly line: Schema.Finite;
714
+ readonly column: Schema.Finite;
715
+ }>>;
716
+ }>>>;
611
717
  }>>>;
612
718
  readonly tests: Schema.$Array<Schema.Struct<{
613
719
  readonly name: Schema.String;
@@ -622,6 +728,19 @@ declare const AgentReport: Schema.Struct<{
622
728
  readonly diff: Schema.optional<Schema.String>;
623
729
  readonly expected: Schema.optional<Schema.String>;
624
730
  readonly received: Schema.optional<Schema.String>;
731
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
732
+ readonly name: Schema.String;
733
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
734
+ readonly startTime: Schema.Finite;
735
+ readonly duration: Schema.optional<Schema.Finite>;
736
+ readonly depth: Schema.Finite;
737
+ readonly locator: Schema.optional<Schema.String>;
738
+ readonly location: Schema.optional<Schema.Struct<{
739
+ readonly file: Schema.String;
740
+ readonly line: Schema.Finite;
741
+ readonly column: Schema.Finite;
742
+ }>>;
743
+ }>>>;
625
744
  }>>>;
626
745
  readonly classification: Schema.optional<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
627
746
  }>>;
@@ -632,6 +751,19 @@ declare const AgentReport: Schema.Struct<{
632
751
  readonly diff: Schema.optional<Schema.String>;
633
752
  readonly expected: Schema.optional<Schema.String>;
634
753
  readonly received: Schema.optional<Schema.String>;
754
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
755
+ readonly name: Schema.String;
756
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
757
+ readonly startTime: Schema.Finite;
758
+ readonly duration: Schema.optional<Schema.Finite>;
759
+ readonly depth: Schema.Finite;
760
+ readonly locator: Schema.optional<Schema.String>;
761
+ readonly location: Schema.optional<Schema.Struct<{
762
+ readonly file: Schema.String;
763
+ readonly line: Schema.Finite;
764
+ readonly column: Schema.Finite;
765
+ }>>;
766
+ }>>>;
635
767
  }>>;
636
768
  readonly failedFiles: Schema.$Array<Schema.String>;
637
769
  readonly coverage: Schema.optional<Schema.Struct<{
@@ -772,6 +904,17 @@ declare const AgentReport: Schema.Struct<{
772
904
  readonly text: Schema.String;
773
905
  }>>;
774
906
  }>>;
907
+ /**
908
+ * How well Vitest's fs module cache served this project's run (issue
909
+ * #741). Omitted when the run produced no timing data.
910
+ */
911
+ readonly moduleCache: Schema.optional<Schema.Struct<{
912
+ readonly enabled: Schema.Boolean;
913
+ readonly transformMs: Schema.Finite;
914
+ readonly trackedMs: Schema.Finite;
915
+ readonly share: Schema.Finite;
916
+ readonly modulesWritten: Schema.optional<Schema.Finite>;
917
+ }>>;
775
918
  }>;
776
919
  /** @public */
777
920
  type AgentReport = typeof AgentReport.Type;
@@ -850,6 +993,19 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
850
993
  readonly diff: Schema.optional<Schema.String>;
851
994
  readonly expected: Schema.optional<Schema.String>;
852
995
  readonly received: Schema.optional<Schema.String>;
996
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
997
+ readonly name: Schema.String;
998
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
999
+ readonly startTime: Schema.Finite;
1000
+ readonly duration: Schema.optional<Schema.Finite>;
1001
+ readonly depth: Schema.Finite;
1002
+ readonly locator: Schema.optional<Schema.String>;
1003
+ readonly location: Schema.optional<Schema.Struct<{
1004
+ readonly file: Schema.String;
1005
+ readonly line: Schema.Finite;
1006
+ readonly column: Schema.Finite;
1007
+ }>>;
1008
+ }>>>;
853
1009
  }>>;
854
1010
  readonly timedOut: Schema.optional<Schema.Boolean>;
855
1011
  }>, Schema.TaggedStruct<"ModuleFinished", {
@@ -892,6 +1048,19 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
892
1048
  readonly diff: Schema.optional<Schema.String>;
893
1049
  readonly expected: Schema.optional<Schema.String>;
894
1050
  readonly received: Schema.optional<Schema.String>;
1051
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
1052
+ readonly name: Schema.String;
1053
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
1054
+ readonly startTime: Schema.Finite;
1055
+ readonly duration: Schema.optional<Schema.Finite>;
1056
+ readonly depth: Schema.Finite;
1057
+ readonly locator: Schema.optional<Schema.String>;
1058
+ readonly location: Schema.optional<Schema.Struct<{
1059
+ readonly file: Schema.String;
1060
+ readonly line: Schema.Finite;
1061
+ readonly column: Schema.Finite;
1062
+ }>>;
1063
+ }>>>;
895
1064
  }>>;
896
1065
  }>, Schema.TaggedStruct<"ConsoleLog", {
897
1066
  readonly modulePath: Schema.optional<Schema.String>;
@@ -1024,6 +1193,19 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
1024
1193
  readonly diff: Schema.optional<Schema.String>;
1025
1194
  readonly expected: Schema.optional<Schema.String>;
1026
1195
  readonly received: Schema.optional<Schema.String>;
1196
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
1197
+ readonly name: Schema.String;
1198
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
1199
+ readonly startTime: Schema.Finite;
1200
+ readonly duration: Schema.optional<Schema.Finite>;
1201
+ readonly depth: Schema.Finite;
1202
+ readonly locator: Schema.optional<Schema.String>;
1203
+ readonly location: Schema.optional<Schema.Struct<{
1204
+ readonly file: Schema.String;
1205
+ readonly line: Schema.Finite;
1206
+ readonly column: Schema.Finite;
1207
+ }>>;
1208
+ }>>>;
1027
1209
  }>>>;
1028
1210
  /**
1029
1211
  * What the run wrote straight to the terminal, past Vitest's console
@@ -1060,6 +1242,22 @@ export declare const RunEvent: Schema.Union<readonly [Schema.TaggedStruct<"RunSt
1060
1242
  readonly files: Schema.Finite;
1061
1243
  }>>;
1062
1244
  }>>;
1245
+ /**
1246
+ * How well Vitest's fs module cache served each project's run
1247
+ * (`AgentReport.moduleCache`), one entry per project that has data.
1248
+ * Optional: absent when no project produced timing data, and in older
1249
+ * replay data (issue #741).
1250
+ */
1251
+ readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
1252
+ readonly project: Schema.optional<Schema.String>;
1253
+ readonly moduleCache: Schema.Struct<{
1254
+ readonly enabled: Schema.Boolean;
1255
+ readonly transformMs: Schema.Finite;
1256
+ readonly trackedMs: Schema.Finite;
1257
+ readonly share: Schema.Finite;
1258
+ readonly modulesWritten: Schema.optional<Schema.Finite>;
1259
+ }>;
1260
+ }>>>;
1063
1261
  }>]>;
1064
1262
  /** @public */
1065
1263
  export type RunEvent = typeof RunEvent.Type;
@@ -1162,7 +1360,11 @@ interface VitestTestCase {
1162
1360
  /** Per-attempt results, one per retry and repeat (Vitest 5.1+). */
1163
1361
  attempts?(): ReadonlyArray<{
1164
1362
  errors?: ReadonlyArray<VitestTestError> | undefined;
1363
+ retryIndex?: number;
1364
+ repeatIndex?: number;
1165
1365
  }>;
1366
+ /** Recorded artifacts; Vitest 5.1 `traceTimeline` adds an `internal:browserTrace` one (read, never persisted as a user artifact). */
1367
+ artifacts?(): ReadonlyArray<unknown>;
1166
1368
  diagnostic(): VitestTestDiagnostic | undefined;
1167
1369
  }
1168
1370
  /**
package/index.js CHANGED
@@ -18,6 +18,6 @@ import { VitestAgentStatus, VitestAgentTokens, inkStyle, statusGlyph, statusInkS
18
18
  *
19
19
  * @public
20
20
  */
21
- const CURRENT_UI_VERSION = "6.0.8";
21
+ const CURRENT_UI_VERSION = "6.1.0";
22
22
 
23
23
  export { ActionSeverity, CURRENT_UI_VERSION, CoverageFile, CoverageGap, CoverageMetric, CoverageRenderState, FailureRecord, ModuleRecord, RenderState, RenderTotals, RunEvent, SPINNER_FRAMES, SPINNER_FRAME_MS, SUITE_FAILURE_LABEL, SUITE_LOAD_FAILURE_LABEL, SuggestedActionRecord, TestRecord, VitestAgentStatus, VitestAgentTokens, buildFooter, classifyOutcome, classifyRunShape, dispatch, dispatcherTable, dominantClassification, formatDisplayDuration, formatSuggestedActionLines, initialRenderState, inkStyle, reduceRenderState, reduceRenderStateAll, renderAgent, spinnerFrame, statusGlyph, statusInkStyle, synthesizeFromAgentReport, synthesizeRunEvents };
@@ -1,6 +1,7 @@
1
1
  import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
2
2
  import { Box, Text } from "ink";
3
3
  import { statusGlyph, statusToken } from "../theme.js";
4
+ import { formatTraceStepLines } from "../trace-steps.js";
4
5
  import { useFileLink } from "./FileLink.js";
5
6
  import { jsx, jsxs } from "react/jsx-runtime";
6
7
 
@@ -47,6 +48,13 @@ const FailureRow = ({ failure, includeStack }) => {
47
48
  }, key);
48
49
  return /* @__PURE__ */ jsx(Text, { children: ` ${line}` }, key);
49
50
  }) : null,
51
+ formatTraceStepLines(failure.error?.traceSteps).map((line, idx) => {
52
+ const key = `trace-${idx}`;
53
+ return /* @__PURE__ */ jsx(Text, {
54
+ dimColor: true,
55
+ children: ` ${line}`
56
+ }, key);
57
+ }),
50
58
  includeStack && failure.error?.stack !== void 0 ? failure.error.stack.split("\n").map((line, idx) => {
51
59
  const key = `stack-${idx}`;
52
60
  return /* @__PURE__ */ jsx(Text, {
package/ink/StreamApp.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fmt } from "@effected/cli-kit";
2
2
  import { Styled, useGlyphs, useStyle } from "@effected/cli-kit/ui";
3
- import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
3
+ import { formatConsoleLeaksNote, formatModuleCacheLines, formatStrayOutputNote } from "@vitest-agent/sdk";
4
4
  import { Box, Text } from "ink";
5
5
  import { classifyRunShape } from "../dispatcher/classify.js";
6
6
  import { formatDisplayDuration } from "../format-duration.js";
@@ -523,10 +523,16 @@ const StreamApp = ({ state, frameIndex, nowMs }) => {
523
523
  const stray = state.strayOutput !== void 0 ? formatStrayOutputNote(state.strayOutput) : null;
524
524
  const leakLines = state.consoleLeaks !== void 0 ? formatConsoleLeaksNote(state.consoleLeaks) : [];
525
525
  const leaks = leakLines.length > 0 ? leakLines : null;
526
+ const cacheLines = formatModuleCacheLines(state.moduleCache);
526
527
  return /* @__PURE__ */ jsxs(Box, {
527
528
  flexDirection: "column",
528
529
  children: [
529
530
  liveContent,
531
+ cacheLines.length > 0 ? /* @__PURE__ */ jsx(Box, {
532
+ flexDirection: "column",
533
+ marginTop: 1,
534
+ children: cacheLines.map((line, i) => /* @__PURE__ */ jsx(Text, { children: line }, `cache:${i}`))
535
+ }) : null,
530
536
  stray !== null ? /* @__PURE__ */ jsx(Box, {
531
537
  flexDirection: "column",
532
538
  marginTop: 1,
@@ -1,6 +1,6 @@
1
1
  import { Box, Text } from "ink";
2
2
  import { createElement } from "react";
3
- import { consoleLeaksNoteFor, dispatcherTable, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor } from "../dispatcher/dispatch.js";
3
+ import { consoleLeaksNoteFor, dispatcherTable, moduleCacheNoteFor, scopedCoverageNoteFor, strayOutputNoteFor, suggestedActionsNoteFor } from "../dispatcher/dispatch.js";
4
4
  import { renderAgentStringAsInk } from "./ink-helpers.js";
5
5
 
6
6
  // src/ink/dispatch-ink.ts
@@ -58,6 +58,7 @@ const dispatchInk = (inputs, opts) => {
58
58
  const element = cell(inputs, opts);
59
59
  const note = scopedCoverageNoteFor(inputs);
60
60
  const trailers = [
61
+ moduleCacheNoteFor(inputs),
61
62
  suggestedActionsNoteFor(inputs),
62
63
  strayOutputNoteFor(inputs),
63
64
  consoleLeaksNoteFor(inputs)
package/ink.d.ts CHANGED
@@ -44,6 +44,19 @@ declare const TestRecord: Schema.Struct<{
44
44
  readonly diff: Schema.optional<Schema.String>;
45
45
  readonly expected: Schema.optional<Schema.String>;
46
46
  readonly received: Schema.optional<Schema.String>;
47
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
48
+ readonly name: Schema.String;
49
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
50
+ readonly startTime: Schema.Finite;
51
+ readonly duration: Schema.optional<Schema.Finite>;
52
+ readonly depth: Schema.Finite;
53
+ readonly locator: Schema.optional<Schema.String>;
54
+ readonly location: Schema.optional<Schema.Struct<{
55
+ readonly file: Schema.String;
56
+ readonly line: Schema.Finite;
57
+ readonly column: Schema.Finite;
58
+ }>>;
59
+ }>>>;
47
60
  }>>;
48
61
  }>;
49
62
  /** @public */
@@ -72,6 +85,19 @@ declare const ModuleRecord: Schema.Struct<{
72
85
  readonly diff: Schema.optional<Schema.String>;
73
86
  readonly expected: Schema.optional<Schema.String>;
74
87
  readonly received: Schema.optional<Schema.String>;
88
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
89
+ readonly name: Schema.String;
90
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
91
+ readonly startTime: Schema.Finite;
92
+ readonly duration: Schema.optional<Schema.Finite>;
93
+ readonly depth: Schema.Finite;
94
+ readonly locator: Schema.optional<Schema.String>;
95
+ readonly location: Schema.optional<Schema.Struct<{
96
+ readonly file: Schema.String;
97
+ readonly line: Schema.Finite;
98
+ readonly column: Schema.Finite;
99
+ }>>;
100
+ }>>>;
75
101
  }>>;
76
102
  }>>;
77
103
  /**
@@ -107,6 +133,19 @@ declare const FailureRecord: Schema.Struct<{
107
133
  readonly diff: Schema.optional<Schema.String>;
108
134
  readonly expected: Schema.optional<Schema.String>;
109
135
  readonly received: Schema.optional<Schema.String>;
136
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
137
+ readonly name: Schema.String;
138
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
139
+ readonly startTime: Schema.Finite;
140
+ readonly duration: Schema.optional<Schema.Finite>;
141
+ readonly depth: Schema.Finite;
142
+ readonly locator: Schema.optional<Schema.String>;
143
+ readonly location: Schema.optional<Schema.Struct<{
144
+ readonly file: Schema.String;
145
+ readonly line: Schema.Finite;
146
+ readonly column: Schema.Finite;
147
+ }>>;
148
+ }>>>;
110
149
  }>>;
111
150
  readonly timedOut: Schema.optional<Schema.Boolean>;
112
151
  readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
@@ -215,6 +254,19 @@ declare const RenderState: Schema.Struct<{
215
254
  readonly diff: Schema.optional<Schema.String>;
216
255
  readonly expected: Schema.optional<Schema.String>;
217
256
  readonly received: Schema.optional<Schema.String>;
257
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
258
+ readonly name: Schema.String;
259
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
260
+ readonly startTime: Schema.Finite;
261
+ readonly duration: Schema.optional<Schema.Finite>;
262
+ readonly depth: Schema.Finite;
263
+ readonly locator: Schema.optional<Schema.String>;
264
+ readonly location: Schema.optional<Schema.Struct<{
265
+ readonly file: Schema.String;
266
+ readonly line: Schema.Finite;
267
+ readonly column: Schema.Finite;
268
+ }>>;
269
+ }>>>;
218
270
  }>>;
219
271
  }>>;
220
272
  /**
@@ -301,6 +353,19 @@ declare const RenderState: Schema.Struct<{
301
353
  readonly diff: Schema.optional<Schema.String>;
302
354
  readonly expected: Schema.optional<Schema.String>;
303
355
  readonly received: Schema.optional<Schema.String>;
356
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
357
+ readonly name: Schema.String;
358
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
359
+ readonly startTime: Schema.Finite;
360
+ readonly duration: Schema.optional<Schema.Finite>;
361
+ readonly depth: Schema.Finite;
362
+ readonly locator: Schema.optional<Schema.String>;
363
+ readonly location: Schema.optional<Schema.Struct<{
364
+ readonly file: Schema.String;
365
+ readonly line: Schema.Finite;
366
+ readonly column: Schema.Finite;
367
+ }>>;
368
+ }>>>;
304
369
  }>>;
305
370
  readonly timedOut: Schema.optional<Schema.Boolean>;
306
371
  readonly classification: Schema.NullOr<Schema.Literals<readonly ["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
@@ -333,6 +398,19 @@ declare const RenderState: Schema.Struct<{
333
398
  readonly diff: Schema.optional<Schema.String>;
334
399
  readonly expected: Schema.optional<Schema.String>;
335
400
  readonly received: Schema.optional<Schema.String>;
401
+ readonly traceSteps: Schema.optional<Schema.$Array<Schema.Struct<{
402
+ readonly name: Schema.String;
403
+ readonly status: Schema.optional<Schema.Literals<readonly ["pass", "fail"]>>;
404
+ readonly startTime: Schema.Finite;
405
+ readonly duration: Schema.optional<Schema.Finite>;
406
+ readonly depth: Schema.Finite;
407
+ readonly locator: Schema.optional<Schema.String>;
408
+ readonly location: Schema.optional<Schema.Struct<{
409
+ readonly file: Schema.String;
410
+ readonly line: Schema.Finite;
411
+ readonly column: Schema.Finite;
412
+ }>>;
413
+ }>>>;
336
414
  }>>;
337
415
  /**
338
416
  * What the run wrote straight to the terminal, past Vitest's console
@@ -369,6 +447,21 @@ declare const RenderState: Schema.Struct<{
369
447
  readonly files: Schema.Finite;
370
448
  }>>;
371
449
  }>>;
450
+ /**
451
+ * Module cache effectiveness per project, folded from
452
+ * `RunFinished.moduleCache`. Absent when the run produced no timing data
453
+ * (issue #741).
454
+ */
455
+ readonly moduleCache: Schema.optional<Schema.$Array<Schema.Struct<{
456
+ readonly project: Schema.optional<Schema.String>;
457
+ readonly moduleCache: Schema.Struct<{
458
+ readonly enabled: Schema.Boolean;
459
+ readonly transformMs: Schema.Finite;
460
+ readonly trackedMs: Schema.Finite;
461
+ readonly share: Schema.Finite;
462
+ readonly modulesWritten: Schema.optional<Schema.Finite>;
463
+ }>;
464
+ }>>>;
372
465
  }>;
373
466
  /** @public */
374
467
  type RenderState = typeof RenderState.Type;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/ui",
3
- "version": "6.0.8",
3
+ "version": "6.1.0",
4
4
  "private": false,
5
5
  "description": "Shared event-sourced renderer for vitest-agent. React Ink view for humans, plain-string view for agents, both fed by the same reducer over a RunEvent stream.",
6
6
  "keywords": [
@@ -44,7 +44,7 @@
44
44
  "./package.json": "./package.json"
45
45
  },
46
46
  "dependencies": {
47
- "@vitest-agent/sdk": "9.1.0",
47
+ "@vitest-agent/sdk": "9.2.0",
48
48
  "effect": "4.1.5"
49
49
  },
50
50
  "peerDependencies": {
package/reducer.js CHANGED
@@ -226,7 +226,8 @@ const reduceRenderState = (state, event) => {
226
226
  ...e.collectedModules !== void 0 && { collectedModules: e.collectedModules },
227
227
  ...e.unhandledErrors !== void 0 && { unhandledErrors: e.unhandledErrors },
228
228
  ...e.strayOutput !== void 0 && { strayOutput: e.strayOutput },
229
- ...e.consoleLeaks !== void 0 && { consoleLeaks: e.consoleLeaks }
229
+ ...e.consoleLeaks !== void 0 && { consoleLeaks: e.consoleLeaks },
230
+ ...e.moduleCache !== void 0 && { moduleCache: e.moduleCache }
230
231
  }),
231
232
  RunTimedOut: () => ({
232
233
  ...state,
package/render-agent.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Fmt } from "@effected/cli-kit";
2
- import { formatConsoleLeaksNote, formatStrayOutputNote } from "@vitest-agent/sdk";
2
+ import { formatConsoleLeaksNote, formatModuleCacheLines, formatStrayOutputNote } from "@vitest-agent/sdk";
3
3
  import { formatTotalsLine } from "./counts.js";
4
4
  import { formatFailure as formatFailure$1, formatGlobShortfallLines, formatSuggestedActionLines } from "./dispatcher/helpers.js";
5
5
 
@@ -104,6 +104,10 @@ const formatActionsSection = (state) => {
104
104
  const lines = formatSuggestedActionLines(state.suggestedActions);
105
105
  return lines.length === 0 ? null : lines.join("\n");
106
106
  };
107
+ const formatModuleCacheSection = (state) => {
108
+ const lines = formatModuleCacheLines(state.moduleCache);
109
+ return lines.length === 0 ? null : lines.join("\n");
110
+ };
107
111
  const formatConsoleLeaksSection = (state) => {
108
112
  if (state.consoleLeaks === void 0) return null;
109
113
  const lines = formatConsoleLeaksNote(state.consoleLeaks);
@@ -134,6 +138,8 @@ const renderAgent = (state, options = {}) => {
134
138
  if (modules !== null) sections.push(modules);
135
139
  const coverage = formatCoverageSection(state, maxGaps);
136
140
  if (coverage !== null) sections.push(coverage);
141
+ const moduleCache = formatModuleCacheSection(state);
142
+ if (moduleCache !== null) sections.push(moduleCache);
137
143
  const actions = formatActionsSection(state);
138
144
  if (actions !== null) sections.push(actions);
139
145
  if (state.strayOutput !== void 0) sections.push(formatStrayOutputNote(state.strayOutput).join("\n"));
package/synthesize.js CHANGED
@@ -389,7 +389,11 @@ const synthesizeFromAgentReport = (report, options = {}) => {
389
389
  ...report.summary.modules !== void 0 && { collectedModules: report.summary.modules },
390
390
  ...report.unhandledErrors.length > 0 && { unhandledErrors: report.unhandledErrors },
391
391
  ...report.strayOutput !== void 0 && { strayOutput: report.strayOutput },
392
- ...report.consoleLeaks !== void 0 && { consoleLeaks: report.consoleLeaks }
392
+ ...report.consoleLeaks !== void 0 && { consoleLeaks: report.consoleLeaks },
393
+ ...report.moduleCache !== void 0 && { moduleCache: [{
394
+ ...report.project !== void 0 && { project: report.project },
395
+ moduleCache: report.moduleCache
396
+ }] }
393
397
  });
394
398
  return events;
395
399
  };
package/trace-steps.js ADDED
@@ -0,0 +1,22 @@
1
+ // src/trace-steps.ts
2
+ const ms = (value) => `${Math.round(value)}ms`;
3
+ /**
4
+ * One line per step, indented two spaces per nesting level, e.g.
5
+ * `click [button] +12ms 3ms src/a.test.ts:4:7 FAIL`.
6
+ *
7
+ * @param steps - the failed attempt's steps, oldest first
8
+ * @returns the lines with a leading `Trace:` header, or `[]` when there are no steps
9
+ * @internal
10
+ */
11
+ const formatTraceStepLines = (steps) => {
12
+ if (steps === void 0 || steps.length === 0) return [];
13
+ return ["Trace:", ...steps.map((step) => {
14
+ const parts = [`${" ".repeat(Math.max(0, step.depth))}${step.name}${step.locator !== void 0 ? ` [${step.locator}]` : ""}`, `+${ms(step.startTime)}`];
15
+ if (step.duration !== void 0) parts.push(ms(step.duration));
16
+ if (step.location !== void 0) parts.push(`${step.location.file}:${step.location.line}:${step.location.column}`);
17
+ if (step.status === "fail") parts.push("FAIL");
18
+ return ` ${parts.join(" ")}`;
19
+ })];
20
+ };
21
+
22
+ export { formatTraceStepLines };