@vitest-agent/sdk 7.0.4 → 7.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.
Files changed (73) hide show
  1. package/dispatch.d.ts +0 -6
  2. package/errors/AgentErrors.js +1 -2
  3. package/errors/DataStoreError.js +1 -2
  4. package/errors/DiscoveryError.js +1 -2
  5. package/errors/PathResolutionError.js +1 -2
  6. package/errors/ProjectIdentityError.js +1 -2
  7. package/errors/RunContextError.js +1 -2
  8. package/errors/TddErrors.js +1 -2
  9. package/exit-code-for-tag.js +1 -2
  10. package/index.d.ts +108 -141
  11. package/index.js +2 -2
  12. package/internal-inject-env.js +1 -2
  13. package/package.json +2 -2
  14. package/schemas/5.0/run.json +75 -135
  15. package/schemas/Agent.js +1 -2
  16. package/schemas/AgentReport.js +1 -2
  17. package/schemas/Baselines.js +1 -2
  18. package/schemas/CacheManifest.js +1 -2
  19. package/schemas/ChannelEvent.js +1 -2
  20. package/schemas/Common.js +1 -2
  21. package/schemas/Config.js +73 -7
  22. package/schemas/ConsoleLeaks.js +1 -2
  23. package/schemas/Coverage.js +1 -2
  24. package/schemas/CoverageLevel.js +1 -2
  25. package/schemas/CoverageTargets.js +1 -2
  26. package/schemas/History.js +1 -2
  27. package/schemas/Identity.js +1 -2
  28. package/schemas/Options.js +32 -5
  29. package/schemas/RenderState.js +1 -2
  30. package/schemas/RunEvent.js +1 -2
  31. package/schemas/RunReportFile.js +1 -2
  32. package/schemas/StrayOutput.js +1 -2
  33. package/schemas/Tdd.js +1 -2
  34. package/schemas/TestArtifacts.js +1 -2
  35. package/schemas/Thresholds.js +1 -2
  36. package/schemas/Transport.js +1 -2
  37. package/schemas/Trends.js +1 -2
  38. package/schemas/turns/FileEditPayload.js +1 -2
  39. package/schemas/turns/HookFirePayload.js +1 -2
  40. package/schemas/turns/HypothesisPayload.js +1 -2
  41. package/schemas/turns/NotePayload.js +1 -2
  42. package/schemas/turns/ToolCallPayload.js +1 -2
  43. package/schemas/turns/ToolResultPayload.js +1 -2
  44. package/schemas/turns/UserPromptPayload.js +1 -2
  45. package/schemas/turns/index.js +1 -2
  46. package/sidecar-dispatch.js +1 -2
  47. package/utils/ansi.js +1 -2
  48. package/utils/build-report.js +1 -2
  49. package/utils/canonicalize-git-url.js +1 -2
  50. package/utils/classify-test.js +1 -2
  51. package/utils/coerce-error-text.js +1 -2
  52. package/utils/compress-lines.js +1 -2
  53. package/utils/compute-trend.js +1 -2
  54. package/utils/console-leaks.js +1 -2
  55. package/utils/detect-non-default-discover-strategy.js +1 -2
  56. package/utils/detect-pm.js +1 -2
  57. package/utils/detect-timeout.js +1 -2
  58. package/utils/format-console.js +1 -2
  59. package/utils/format-fatal-error.js +1 -2
  60. package/utils/format-gfm.js +1 -2
  61. package/utils/format-scoped-coverage-note.js +1 -2
  62. package/utils/function-boundary.js +1 -2
  63. package/utils/hyperlink.js +1 -2
  64. package/utils/match-vitest-command.js +1 -2
  65. package/utils/normalize-workspace-key.js +1 -2
  66. package/utils/posix-path.js +1 -2
  67. package/utils/probe-host-metadata.js +1 -2
  68. package/utils/safe-filename.js +1 -2
  69. package/utils/stray-output.js +1 -2
  70. package/utils/test-location.js +1 -2
  71. package/utils/validate-coverage-targets-shape.js +1 -2
  72. package/utils/validate-phase-transition.js +1 -2
  73. package/version.js +2 -3
package/index.js CHANGED
@@ -16,7 +16,7 @@ import { AgentReport, ModuleReport, ReportSummary, TagCountEntry, TestReport } f
16
16
  import { CoverageBaselines } from "./schemas/Baselines.js";
17
17
  import { CacheManifest, CacheManifestEntry } from "./schemas/CacheManifest.js";
18
18
  import { BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorsReadyEvent, BlockedEvent, ChannelEvent, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalStartedEvent, GoalsReadyEvent, PhaseTransitionEvent, SessionCompleteEvent, SessionOutcome } from "./schemas/ChannelEvent.js";
19
- import { VitestAgentConfig } from "./schemas/Config.js";
19
+ import { RetentionConfig, RunRetentionPolicy, VitestAgentConfig } from "./schemas/Config.js";
20
20
  import { CoverageLevel, resolveCoverageInput, validateCoverageConfig } from "./schemas/CoverageLevel.js";
21
21
  import { CoverageTargets, CoverageTargetsMetrics } from "./schemas/CoverageTargets.js";
22
22
  import { HistoryRecord, TestHistory, TestRun } from "./schemas/History.js";
@@ -64,4 +64,4 @@ import { validateCoverageTargetsShape } from "./utils/validate-coverage-targets-
64
64
  import { requiredArtifactForTransition, transitionEnforcesBehaviorMatch, validatePhaseTransition } from "./utils/validate-phase-transition.js";
65
65
  import { CURRENT_SDK_VERSION } from "./version.js";
66
66
 
67
- export { ActionSeverity, ActorType, Agent, AgentConsoleMode, AgentId, AgentNotFoundError, AgentPluginOptions, AgentReport, AgentReporterOptions, BATS_FILE_GLOB_SUFFIX, BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorStatus, BehaviorsReadyEvent, BlockedEvent, CURRENT_SDK_VERSION, CacheManifest, CacheManifestEntry, ChannelEvent, ChatId, CiConsoleMode, ConsoleLeakFile, ConsoleLeaks, ConsoleLeaksFromFailingTests, ConsoleLogLevel, ConsoleMode, ConsoleOutputMode, ConsoleOutputs, ConversationId, ConversationNotFoundError, CoverageBaselines, FileCoverageReport as CoverageFile, CoverageGap, CoverageLevel, CoverageMetric, CoverageRenderState, CoverageReport, CoverageTargets, CoverageTargetsMetrics, CoverageTotals, DataStoreError, DetailLevel, DiscoveryError, Environment, Executor, FailureRecord, FileCoverageReport, FileEditPayload, GitCommandError, GlobShortfall, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalDetail, GoalNotFoundError, GoalRow, GoalStartedEvent, GoalStatus, GoalsReadyEvent, HistoryRecord, HookFirePayload, HookStatus, HookType, HostKind, HostMetadataParseError, HumanConsoleMode, HypothesisPayload, IdempotencyHit, IllegalStatusTransitionError, MetricThresholds, ModuleRecord, ModuleReport, NON_DISCOVERABLE_DIRS, NotePayload, PackageManager, PathResolutionError, PatternMetricThresholds, PatternThresholds, PerFileThresholds, PhaseTransitionEvent, ProbeMissError, ProjectIdentityNotResolvableError, ProjectKey, RUN_REPORT_FILE_SCHEMA_URL, RegistrationConflictError, RenderState, RenderTotals, ReportError, ReportOption, ReportSettings, ReportSummary, ResolvedThresholds, RunEvent, RunReportFile, SRC_DIR, STRAY_OUTPUT_SOURCE, SessionCompleteEvent, SessionNotFoundError, SessionOutcome, SidecarTimeoutError, StrayOutput, StrayOutputSample, SuggestedActionRecord, TEST_DIR, TEST_FILE_GLOB_SUFFIX, TEST_HELPER_DIRS, TagCountEntry, TddTaskAlreadyEndedError, TddTaskId, TddTaskNotFoundError, TestAnnotation, TestArtifact, TestArtifactLocation, TestAttachment, TestClassification, TestHistory, TestRecord, TestReport, TestRun, TestRunReason, TestState, ToolCallPayload, ToolResultPayload, Transport, TrendEntry, TrendRecord, TurnPayload, UserPromptPayload, VitestAgentConfig, ansi, basenamePosix, buildAgentReport, buildConsoleLeaks, buildEnvPrefix, canonicalizeGitUrl, classifyTest, classifyTestPath, coerceErrorField, coerceErrorText, collectConsoleLeakEntries, compressLines, computeTrend, countSuiteFailures, detectNonDefaultDiscoverStrategy, detectPackageManager, detectVitestScripts, determineTier, extractSqlReason, findFunctionBoundary, findOwningWorkspace, formatConsoleMarkdown, formatFatalError, formatGfm, formatScopedCoverageNote, formatStrayOutputNote, getRecentDirection, getRunCommand, getWorstMetric, gitUrlToProjectKey, hashTargets, initialRenderState, isEscapeOnly, isTestFileName, isTimeoutError, isVitestInvocation, joinPosix, makeStrayOutputRecorder, normalizeWorkspaceKey, osc8, probeHostMetadataFromEnv, readStrayOutput, relativePath, relativePosix, requiredArtifactForTransition, resolveCoverageInput, rewriteBashCommand, safeFilename, stripAnsi, toPosix, transitionEnforcesBehaviorMatch, validateCoverageConfig, validateCoverageTargetsShape, validatePhaseTransition };
67
+ export { ActionSeverity, ActorType, Agent, AgentConsoleMode, AgentId, AgentNotFoundError, AgentPluginOptions, AgentReport, AgentReporterOptions, BATS_FILE_GLOB_SUFFIX, BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorStatus, BehaviorsReadyEvent, BlockedEvent, CURRENT_SDK_VERSION, CacheManifest, CacheManifestEntry, ChannelEvent, ChatId, CiConsoleMode, ConsoleLeakFile, ConsoleLeaks, ConsoleLeaksFromFailingTests, ConsoleLogLevel, ConsoleMode, ConsoleOutputMode, ConsoleOutputs, ConversationId, ConversationNotFoundError, CoverageBaselines, FileCoverageReport as CoverageFile, CoverageGap, CoverageLevel, CoverageMetric, CoverageRenderState, CoverageReport, CoverageTargets, CoverageTargetsMetrics, CoverageTotals, DataStoreError, DetailLevel, DiscoveryError, Environment, Executor, FailureRecord, FileCoverageReport, FileEditPayload, GitCommandError, GlobShortfall, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalDetail, GoalNotFoundError, GoalRow, GoalStartedEvent, GoalStatus, GoalsReadyEvent, HistoryRecord, HookFirePayload, HookStatus, HookType, HostKind, HostMetadataParseError, HumanConsoleMode, HypothesisPayload, IdempotencyHit, IllegalStatusTransitionError, MetricThresholds, ModuleRecord, ModuleReport, NON_DISCOVERABLE_DIRS, NotePayload, PackageManager, PathResolutionError, PatternMetricThresholds, PatternThresholds, PerFileThresholds, PhaseTransitionEvent, ProbeMissError, ProjectIdentityNotResolvableError, ProjectKey, RUN_REPORT_FILE_SCHEMA_URL, RegistrationConflictError, RenderState, RenderTotals, ReportError, ReportOption, ReportSettings, ReportSummary, ResolvedThresholds, RetentionConfig, RunEvent, RunReportFile, RunRetentionPolicy, SRC_DIR, STRAY_OUTPUT_SOURCE, SessionCompleteEvent, SessionNotFoundError, SessionOutcome, SidecarTimeoutError, StrayOutput, StrayOutputSample, SuggestedActionRecord, TEST_DIR, TEST_FILE_GLOB_SUFFIX, TEST_HELPER_DIRS, TagCountEntry, TddTaskAlreadyEndedError, TddTaskId, TddTaskNotFoundError, TestAnnotation, TestArtifact, TestArtifactLocation, TestAttachment, TestClassification, TestHistory, TestRecord, TestReport, TestRun, TestRunReason, TestState, ToolCallPayload, ToolResultPayload, Transport, TrendEntry, TrendRecord, TurnPayload, UserPromptPayload, VitestAgentConfig, ansi, basenamePosix, buildAgentReport, buildConsoleLeaks, buildEnvPrefix, canonicalizeGitUrl, classifyTest, classifyTestPath, coerceErrorField, coerceErrorText, collectConsoleLeakEntries, compressLines, computeTrend, countSuiteFailures, detectNonDefaultDiscoverStrategy, detectPackageManager, detectVitestScripts, determineTier, extractSqlReason, findFunctionBoundary, findOwningWorkspace, formatConsoleMarkdown, formatFatalError, formatGfm, formatScopedCoverageNote, formatStrayOutputNote, getRecentDirection, getRunCommand, getWorstMetric, gitUrlToProjectKey, hashTargets, initialRenderState, isEscapeOnly, isTestFileName, isTimeoutError, isVitestInvocation, joinPosix, makeStrayOutputRecorder, normalizeWorkspaceKey, osc8, probeHostMetadataFromEnv, readStrayOutput, relativePath, relativePosix, requiredArtifactForTransition, resolveCoverageInput, rewriteBashCommand, safeFilename, stripAnsi, toPosix, transitionEnforcesBehaviorMatch, validateCoverageConfig, validateCoverageTargetsShape, validatePhaseTransition };
@@ -1,6 +1,6 @@
1
1
  import { detectVitestScripts, rewriteBashCommand } from "./utils/match-vitest-command.js";
2
2
 
3
- //#region src/internal-inject-env.ts
3
+ // src/internal-inject-env.ts
4
4
  const readPackageScripts = (cwd, readFile) => {
5
5
  try {
6
6
  const raw = readFile(`${cwd}/package.json`);
@@ -37,5 +37,4 @@ const injectEnv = (input) => {
37
37
  });
38
38
  };
39
39
 
40
- //#endregion
41
40
  export { injectEnv };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/sdk",
3
- "version": "7.0.4",
3
+ "version": "7.1.0",
4
4
  "private": false,
5
5
  "description": "Platform-free core for the vitest-agent package family: Effect Schema definitions, reporter and dispatcher contracts, errors, and pure utilities.",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  "dependencies": {
44
44
  "acorn": "^8.19.0",
45
45
  "acorn-typescript": "^1.4.13",
46
- "effect": "^4.0.5"
46
+ "effect": "^4.0.6"
47
47
  },
48
48
  "engines": {
49
49
  "node": ">=24.11.0"
@@ -73,15 +73,11 @@
73
73
  "modules": {
74
74
  "anyOf": [
75
75
  {
76
- "anyOf": [
77
- {
78
- "type": "number"
79
- },
80
- {
81
- "type": "string",
82
- "enum": ["Infinity", "-Infinity", "NaN"]
83
- }
84
- ]
76
+ "type": "number"
77
+ },
78
+ {
79
+ "type": "string",
80
+ "enum": ["Infinity", "-Infinity", "NaN"]
85
81
  },
86
82
  {
87
83
  "type": "null"
@@ -165,15 +161,11 @@
165
161
  "duration": {
166
162
  "anyOf": [
167
163
  {
168
- "anyOf": [
169
- {
170
- "type": "number"
171
- },
172
- {
173
- "type": "string",
174
- "enum": ["Infinity", "-Infinity", "NaN"]
175
- }
176
- ]
164
+ "type": "number"
165
+ },
166
+ {
167
+ "type": "string",
168
+ "enum": ["Infinity", "-Infinity", "NaN"]
177
169
  },
178
170
  {
179
171
  "type": "null"
@@ -239,15 +231,11 @@
239
231
  "duration": {
240
232
  "anyOf": [
241
233
  {
242
- "anyOf": [
243
- {
244
- "type": "number"
245
- },
246
- {
247
- "type": "string",
248
- "enum": ["Infinity", "-Infinity", "NaN"]
249
- }
250
- ]
234
+ "type": "number"
235
+ },
236
+ {
237
+ "type": "string",
238
+ "enum": ["Infinity", "-Infinity", "NaN"]
251
239
  },
252
240
  {
253
241
  "type": "null"
@@ -334,15 +322,11 @@
334
322
  "lines": {
335
323
  "anyOf": [
336
324
  {
337
- "anyOf": [
338
- {
339
- "type": "number"
340
- },
341
- {
342
- "type": "string",
343
- "enum": ["Infinity", "-Infinity", "NaN"]
344
- }
345
- ]
325
+ "type": "number"
326
+ },
327
+ {
328
+ "type": "string",
329
+ "enum": ["Infinity", "-Infinity", "NaN"]
346
330
  },
347
331
  {
348
332
  "type": "null"
@@ -352,15 +336,11 @@
352
336
  "functions": {
353
337
  "anyOf": [
354
338
  {
355
- "anyOf": [
356
- {
357
- "type": "number"
358
- },
359
- {
360
- "type": "string",
361
- "enum": ["Infinity", "-Infinity", "NaN"]
362
- }
363
- ]
339
+ "type": "number"
340
+ },
341
+ {
342
+ "type": "string",
343
+ "enum": ["Infinity", "-Infinity", "NaN"]
364
344
  },
365
345
  {
366
346
  "type": "null"
@@ -370,15 +350,11 @@
370
350
  "branches": {
371
351
  "anyOf": [
372
352
  {
373
- "anyOf": [
374
- {
375
- "type": "number"
376
- },
377
- {
378
- "type": "string",
379
- "enum": ["Infinity", "-Infinity", "NaN"]
380
- }
381
- ]
353
+ "type": "number"
354
+ },
355
+ {
356
+ "type": "string",
357
+ "enum": ["Infinity", "-Infinity", "NaN"]
382
358
  },
383
359
  {
384
360
  "type": "null"
@@ -388,15 +364,11 @@
388
364
  "statements": {
389
365
  "anyOf": [
390
366
  {
391
- "anyOf": [
392
- {
393
- "type": "number"
394
- },
395
- {
396
- "type": "string",
397
- "enum": ["Infinity", "-Infinity", "NaN"]
398
- }
399
- ]
367
+ "type": "number"
368
+ },
369
+ {
370
+ "type": "string",
371
+ "enum": ["Infinity", "-Infinity", "NaN"]
400
372
  },
401
373
  {
402
374
  "type": "null"
@@ -422,15 +394,11 @@
422
394
  "lines": {
423
395
  "anyOf": [
424
396
  {
425
- "anyOf": [
426
- {
427
- "type": "number"
428
- },
429
- {
430
- "type": "string",
431
- "enum": ["Infinity", "-Infinity", "NaN"]
432
- }
433
- ]
397
+ "type": "number"
398
+ },
399
+ {
400
+ "type": "string",
401
+ "enum": ["Infinity", "-Infinity", "NaN"]
434
402
  },
435
403
  {
436
404
  "type": "null"
@@ -440,15 +408,11 @@
440
408
  "functions": {
441
409
  "anyOf": [
442
410
  {
443
- "anyOf": [
444
- {
445
- "type": "number"
446
- },
447
- {
448
- "type": "string",
449
- "enum": ["Infinity", "-Infinity", "NaN"]
450
- }
451
- ]
411
+ "type": "number"
412
+ },
413
+ {
414
+ "type": "string",
415
+ "enum": ["Infinity", "-Infinity", "NaN"]
452
416
  },
453
417
  {
454
418
  "type": "null"
@@ -458,15 +422,11 @@
458
422
  "branches": {
459
423
  "anyOf": [
460
424
  {
461
- "anyOf": [
462
- {
463
- "type": "number"
464
- },
465
- {
466
- "type": "string",
467
- "enum": ["Infinity", "-Infinity", "NaN"]
468
- }
469
- ]
425
+ "type": "number"
426
+ },
427
+ {
428
+ "type": "string",
429
+ "enum": ["Infinity", "-Infinity", "NaN"]
470
430
  },
471
431
  {
472
432
  "type": "null"
@@ -476,15 +436,11 @@
476
436
  "statements": {
477
437
  "anyOf": [
478
438
  {
479
- "anyOf": [
480
- {
481
- "type": "number"
482
- },
483
- {
484
- "type": "string",
485
- "enum": ["Infinity", "-Infinity", "NaN"]
486
- }
487
- ]
439
+ "type": "number"
440
+ },
441
+ {
442
+ "type": "string",
443
+ "enum": ["Infinity", "-Infinity", "NaN"]
488
444
  },
489
445
  {
490
446
  "type": "null"
@@ -629,15 +585,11 @@
629
585
  "totalFiles": {
630
586
  "anyOf": [
631
587
  {
632
- "anyOf": [
633
- {
634
- "type": "number"
635
- },
636
- {
637
- "type": "string",
638
- "enum": ["Infinity", "-Infinity", "NaN"]
639
- }
640
- ]
588
+ "type": "number"
589
+ },
590
+ {
591
+ "type": "string",
592
+ "enum": ["Infinity", "-Infinity", "NaN"]
641
593
  },
642
594
  {
643
595
  "type": "null"
@@ -705,15 +657,11 @@
705
657
  "passed": {
706
658
  "anyOf": [
707
659
  {
708
- "anyOf": [
709
- {
710
- "type": "number"
711
- },
712
- {
713
- "type": "string",
714
- "enum": ["Infinity", "-Infinity", "NaN"]
715
- }
716
- ]
660
+ "type": "number"
661
+ },
662
+ {
663
+ "type": "string",
664
+ "enum": ["Infinity", "-Infinity", "NaN"]
717
665
  },
718
666
  {
719
667
  "type": "null"
@@ -723,15 +671,11 @@
723
671
  "failed": {
724
672
  "anyOf": [
725
673
  {
726
- "anyOf": [
727
- {
728
- "type": "number"
729
- },
730
- {
731
- "type": "string",
732
- "enum": ["Infinity", "-Infinity", "NaN"]
733
- }
734
- ]
674
+ "type": "number"
675
+ },
676
+ {
677
+ "type": "string",
678
+ "enum": ["Infinity", "-Infinity", "NaN"]
735
679
  },
736
680
  {
737
681
  "type": "null"
@@ -741,15 +685,11 @@
741
685
  "skipped": {
742
686
  "anyOf": [
743
687
  {
744
- "anyOf": [
745
- {
746
- "type": "number"
747
- },
748
- {
749
- "type": "string",
750
- "enum": ["Infinity", "-Infinity", "NaN"]
751
- }
752
- ]
688
+ "type": "number"
689
+ },
690
+ {
691
+ "type": "string",
692
+ "enum": ["Infinity", "-Infinity", "NaN"]
753
693
  },
754
694
  {
755
695
  "type": "null"
package/schemas/Agent.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { AgentId, ConversationId } from "./Identity.js";
2
2
  import { Data, Schema } from "effect";
3
3
 
4
- //#region src/schemas/Agent.ts
4
+ // src/schemas/Agent.ts
5
5
  /**
6
6
  * Successful registration row. The fields mirror the `agents` SQLite
7
7
  * table 1:1 in camelCase.
@@ -38,5 +38,4 @@ var Agent = class extends Schema.TaggedClass()("Agent", {
38
38
  */
39
39
  var IdempotencyHit = class extends Data.TaggedClass("IdempotencyHit") {};
40
40
 
41
- //#endregion
42
41
  export { Agent, IdempotencyHit };
@@ -4,7 +4,7 @@ import { CoverageReport } from "./Coverage.js";
4
4
  import { StrayOutput } from "./StrayOutput.js";
5
5
  import { Schema } from "effect";
6
6
 
7
- //#region src/schemas/AgentReport.ts
7
+ // src/schemas/AgentReport.ts
8
8
  /**
9
9
  * Aggregate test run statistics.
10
10
  * @public
@@ -76,5 +76,4 @@ const AgentReport = Schema.Struct({
76
76
  strayOutput: Schema.optional(StrayOutput)
77
77
  }).annotate({ identifier: "AgentReport" });
78
78
 
79
- //#endregion
80
79
  export { AgentReport, ModuleReport, ReportSummary, TagCountEntry, TestReport };
@@ -1,7 +1,7 @@
1
1
  import { MetricThresholds, PatternThresholds } from "./Thresholds.js";
2
2
  import { Effect, Schema } from "effect";
3
3
 
4
- //#region src/schemas/Baselines.ts
4
+ // src/schemas/Baselines.ts
5
5
  /**
6
6
  * Coverage baselines -- the auto-ratcheting high-water mark.
7
7
  * @public
@@ -12,5 +12,4 @@ const CoverageBaselines = Schema.Struct({
12
12
  patterns: Schema.Array(PatternThresholds).pipe(Schema.withDecodingDefaultKey(Effect.succeed([])))
13
13
  }).annotate({ identifier: "CoverageBaselines" });
14
14
 
15
- //#endregion
16
15
  export { CoverageBaselines };
@@ -1,7 +1,7 @@
1
1
  import { TestRunReason } from "./Common.js";
2
2
  import { Schema } from "effect";
3
3
 
4
- //#region src/schemas/CacheManifest.ts
4
+ // src/schemas/CacheManifest.ts
5
5
  /**
6
6
  * A single project entry in the cache manifest.
7
7
  * @public
@@ -23,5 +23,4 @@ const CacheManifest = Schema.Struct({
23
23
  projects: Schema.Array(CacheManifestEntry)
24
24
  }).annotate({ identifier: "CacheManifest" });
25
25
 
26
- //#endregion
27
26
  export { CacheManifest, CacheManifestEntry };
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/schemas/ChannelEvent.ts
3
+ // src/schemas/ChannelEvent.ts
4
4
  /** @public */
5
5
  const SessionOutcome = Schema.Literals([
6
6
  "succeeded",
@@ -151,5 +151,4 @@ const BehaviorScopedEventTypes = [
151
151
  "blocked"
152
152
  ];
153
153
 
154
- //#endregion
155
154
  export { BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorsReadyEvent, BlockedEvent, ChannelEvent, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalStartedEvent, GoalsReadyEvent, PhaseTransitionEvent, SessionCompleteEvent, SessionOutcome };
package/schemas/Common.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/schemas/Common.ts
3
+ // src/schemas/Common.ts
4
4
  /**
5
5
  * Possible states for an individual test case.
6
6
  * @public
@@ -145,5 +145,4 @@ const ReportError = Schema.Struct({
145
145
  received: Schema.optional(Schema.String)
146
146
  }).annotate({ identifier: "ReportError" });
147
147
 
148
- //#endregion
149
148
  export { AgentConsoleMode, CiConsoleMode, ConsoleMode, ConsoleOutputMode, DetailLevel, Environment, Executor, HumanConsoleMode, PackageManager, ReportError, TestClassification, TestRunReason, TestState };
package/schemas/Config.js CHANGED
@@ -1,12 +1,42 @@
1
- import { Schema } from "effect";
1
+ import { Option, Schema } from "effect";
2
2
 
3
- //#region src/schemas/Config.ts
3
+ // src/schemas/Config.ts
4
+ /** A whole number of runs or days, at least one. */
5
+ const PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
6
+ /**
7
+ * The optional `[retention]` table of `vitest-agent.config.toml`: how many
8
+ * `test_runs` rows (and their cascaded modules, cases, errors, coverage
9
+ * rows) the per-project `data.db` keeps.
10
+ *
11
+ * Every field is optional. An absent table means the default policy
12
+ * (`RunRetentionPolicy.DEFAULT_KEEP_RUNS` newest runs per project, no age
13
+ * limit); `enabled = false` turns run pruning off entirely.
14
+ *
15
+ * Fields:
16
+ * - `enabled` — `false` disables run retention. Defaults to `true`.
17
+ * - `keepRuns` — the newest N runs per project to keep. A positive integer;
18
+ * defaults to `RunRetentionPolicy.DEFAULT_KEEP_RUNS`.
19
+ * - `maxAgeDays` — additionally drop any run older than this many days,
20
+ * even inside the newest N. A positive integer; no age limit by default.
21
+ *
22
+ * @remarks
23
+ * `keepRuns = 0` is rejected rather than read as "keep nothing": the run
24
+ * being written is always kept, and `enabled = false` is the explicit
25
+ * off switch, so a zero would have two readings.
26
+ * @public
27
+ */
28
+ var RetentionConfig = class extends Schema.Class("RetentionConfig")({
29
+ enabled: Schema.optionalKey(Schema.Boolean),
30
+ keepRuns: Schema.optionalKey(PositiveInt),
31
+ maxAgeDays: Schema.optionalKey(PositiveInt)
32
+ }) {};
4
33
  /**
5
34
  * Schema for the optional `vitest-agent.config.toml` file.
6
35
  *
7
- * Both fields are optional. When the file is absent or these fields are
36
+ * Every field is optional. When the file is absent or these fields are
8
37
  * unset, `resolveDataPath` falls back to deriving the path from the
9
- * workspace's `package.json` `name` under the XDG data directory.
38
+ * workspace's `package.json` `name` under the XDG data directory, and run
39
+ * retention uses the default policy.
10
40
  *
11
41
  * Fields:
12
42
  * - `cacheDir` — absolute path overriding the entire data directory. Highest
@@ -17,12 +47,48 @@ import { Schema } from "effect";
17
47
  * directory. Use this when two unrelated projects on the same machine
18
48
  * share a `package.json` `name` (the collision case for workspace-name
19
49
  * keying), or when you want a stable key independent of `name` changes.
50
+ * - `retention` — the `[retention]` table; see `RetentionConfig`.
20
51
  * @public
21
52
  */
22
53
  var VitestAgentConfig = class extends Schema.Class("VitestAgentConfig")({
23
54
  cacheDir: Schema.optional(Schema.String),
24
- projectKey: Schema.optional(Schema.String)
55
+ projectKey: Schema.optional(Schema.String),
56
+ retention: Schema.optionalKey(RetentionConfig)
25
57
  }) {};
58
+ /**
59
+ * The resolved run-retention policy a `data.db` prune applies: keep the
60
+ * newest `keepRuns` runs of every project, and drop any run older than
61
+ * `maxAgeDays` days when set. The run being persisted is never pruned.
62
+ *
63
+ * @remarks
64
+ * The default of 200 runs per project is sized against what reads the
65
+ * data: failure classification reads the newest 10 `test_history` rows per
66
+ * test and coverage trends keep 50 entries, so 200 leaves both a wide
67
+ * margin while bounding a 7k-test suite (about 3 MB per run) to a few
68
+ * hundred megabytes instead of growing without bound (issue 623, where an
69
+ * unpruned database reached 880 MB over 4,484 runs). `maxAgeDays` is the
70
+ * lever for a project that runs rarely but wants a calendar bound.
71
+ * @public
72
+ */
73
+ var RunRetentionPolicy = class RunRetentionPolicy extends Schema.Class("RunRetentionPolicy")({
74
+ keepRuns: PositiveInt,
75
+ maxAgeDays: Schema.optionalKey(PositiveInt)
76
+ }) {
77
+ /** Newest runs per project kept when the config names no `keepRuns`. */
78
+ static DEFAULT_KEEP_RUNS = 200;
79
+ /**
80
+ * Resolve the policy a loaded config asks for: `Option.none()` when
81
+ * `retention.enabled` is `false`, otherwise the configured values over
82
+ * the defaults.
83
+ */
84
+ static fromConfig(config) {
85
+ const retention = config.retention;
86
+ if (retention?.enabled === false) return Option.none();
87
+ return Option.some(RunRetentionPolicy.make({
88
+ keepRuns: retention?.keepRuns ?? RunRetentionPolicy.DEFAULT_KEEP_RUNS,
89
+ ...retention?.maxAgeDays !== void 0 && { maxAgeDays: retention.maxAgeDays }
90
+ }));
91
+ }
92
+ };
26
93
 
27
- //#endregion
28
- export { VitestAgentConfig };
94
+ export { RetentionConfig, RunRetentionPolicy, VitestAgentConfig };
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/schemas/ConsoleLeaks.ts
3
+ // src/schemas/ConsoleLeaks.ts
4
4
  /**
5
5
  * Per-file stray-console-output detail. Counts are of console writes
6
6
  * (one `console.*` call), not lines.
@@ -41,5 +41,4 @@ const ConsoleLeaks = Schema.Struct({
41
41
  fromFailingTests: Schema.optional(ConsoleLeaksFromFailingTests)
42
42
  }).annotate({ identifier: "ConsoleLeaks" });
43
43
 
44
- //#endregion
45
44
  export { ConsoleLeakFile, ConsoleLeaks, ConsoleLeaksFromFailingTests };
@@ -1,7 +1,7 @@
1
1
  import { MetricThresholds, PatternThresholds } from "./Thresholds.js";
2
2
  import { Effect, Schema } from "effect";
3
3
 
4
- //#region src/schemas/Coverage.ts
4
+ // src/schemas/Coverage.ts
5
5
  /**
6
6
  * Aggregate coverage percentages across four istanbul metrics.
7
7
  * @public
@@ -66,5 +66,4 @@ const CoverageReport = Schema.Struct({
66
66
  globShortfalls: Schema.optional(Schema.Array(GlobShortfall))
67
67
  }).annotate({ identifier: "CoverageReport" });
68
68
 
69
- //#endregion
70
69
  export { CoverageReport, CoverageTotals, FileCoverageReport, GlobShortfall };
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/schemas/CoverageLevel.ts
3
+ // src/schemas/CoverageLevel.ts
4
4
  /**
5
5
  * A coverage level configuration with per-metric thresholds and an optional
6
6
  * perFile flag. Extend this class to define custom named presets.
@@ -113,5 +113,4 @@ function validateCoverageConfig(thresholds, targets) {
113
113
  if (targets.perFile === true && thresholds.perFile !== true) throw new Error("[vitest-agent] coverageTargets sets perFile: true but coverageThresholds does not. Both must agree on perFile.");
114
114
  }
115
115
 
116
- //#endregion
117
116
  export { CoverageLevel, resolveCoverageInput, validateCoverageConfig };
@@ -1,7 +1,7 @@
1
1
  import { PerFileThresholds } from "./Thresholds.js";
2
2
  import { Schema } from "effect";
3
3
 
4
- //#region src/schemas/CoverageTargets.ts
4
+ // src/schemas/CoverageTargets.ts
5
5
  /**
6
6
  * A strictly-positive coverage percentage. Negatives and zeros are rejected
7
7
  * at decode time.
@@ -46,5 +46,4 @@ const CoverageTargets = Schema.Record(Schema.String, Schema.Union([
46
46
  for (const [key, value] of Object.entries(targets)) if (value === true && key !== "100") return `coverageTargets.${key} cannot be true. The "true" shorthand is only valid at key "100" (meaning 100% across all metrics).`;
47
47
  })).annotate({ identifier: "CoverageTargets" });
48
48
 
49
- //#endregion
50
49
  export { CoverageTargets, CoverageTargetsMetrics };
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/schemas/History.ts
3
+ // src/schemas/History.ts
4
4
  /**
5
5
  * A single test run outcome (pass or fail only).
6
6
  * @public
@@ -28,5 +28,4 @@ const HistoryRecord = Schema.Struct({
28
28
  tests: Schema.Array(TestHistory)
29
29
  }).annotate({ identifier: "HistoryRecord" });
30
30
 
31
- //#endregion
32
31
  export { HistoryRecord, TestHistory, TestRun };
@@ -1,6 +1,6 @@
1
1
  import { Schema } from "effect";
2
2
 
3
- //#region src/schemas/Identity.ts
3
+ // src/schemas/Identity.ts
4
4
  /**
5
5
  * Canonical UUID for an LLM agent invocation. Generated server-side at
6
6
  * `register_agent` time. Stable across transport reconnects within an
@@ -72,5 +72,4 @@ const HostKind = Schema.Literals([
72
72
  "unknown"
73
73
  ]).annotate({ identifier: "HostKind" });
74
74
 
75
- //#endregion
76
75
  export { ActorType, AgentId, ChatId, ConversationId, HostKind, ProjectKey, TddTaskId };