@vitest-agent/sdk 1.0.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.
- package/DataReader-2kJ9I9Hh.d.ts +1809 -0
- package/LICENSE +21 -0
- package/README.md +52 -0
- package/dispatch.d.ts +48 -0
- package/dispatch.js +5 -0
- package/errors/AgentErrors.js +65 -0
- package/errors/DataStoreError.js +44 -0
- package/errors/DiscoveryError.js +21 -0
- package/errors/PathResolutionError.js +27 -0
- package/errors/ProjectIdentityError.js +29 -0
- package/errors/RunContextError.js +35 -0
- package/errors/TddErrors.js +66 -0
- package/exit-code-for-tag.js +18 -0
- package/formatters/ci-annotations.js +61 -0
- package/formatters/gfm.js +20 -0
- package/formatters/json.js +18 -0
- package/formatters/markdown.js +39 -0
- package/formatters/silent.js +9 -0
- package/formatters/terminal.js +56 -0
- package/index.d.ts +3334 -0
- package/index.js +120 -0
- package/internal-inject-env.js +42 -0
- package/layers/ConfigLive.js +47 -0
- package/layers/DataReaderLive.js +1666 -0
- package/layers/DataStoreLive.js +1185 -0
- package/layers/DetailResolverLive.js +9 -0
- package/layers/DiscoveryRegistryLive.js +70 -0
- package/layers/EnvironmentDetectorLive.js +21 -0
- package/layers/EnvironmentDetectorTest.js +13 -0
- package/layers/ExecutorResolverLive.js +9 -0
- package/layers/FormatSelectorLive.js +20 -0
- package/layers/HistoryTrackerLive.js +47 -0
- package/layers/HistoryTrackerTest.js +25 -0
- package/layers/LoggerLive.js +64 -0
- package/layers/OutputPipelineLive.js +13 -0
- package/layers/OutputRendererLive.js +28 -0
- package/layers/PathResolutionLive.js +36 -0
- package/layers/PerClientSessionMapLive.js +145 -0
- package/layers/ProjectDiscoveryLive.js +70 -0
- package/layers/ProjectDiscoveryTest.js +12 -0
- package/layers/ProjectIdentityLive.js +92 -0
- package/layers/RunContextLive.js +81 -0
- package/lib/format-triage.js +103 -0
- package/lib/format-wrapup.js +67 -0
- package/migrations/0001_initial.js +849 -0
- package/migrations/registry_0001_initial.js +39 -0
- package/migrations/session_map_0001_initial.js +61 -0
- package/package.json +64 -0
- package/schemas/Agent.js +42 -0
- package/schemas/AgentReport.js +71 -0
- package/schemas/Baselines.js +16 -0
- package/schemas/CacheManifest.js +27 -0
- package/schemas/ChannelEvent.js +138 -0
- package/schemas/Common.js +105 -0
- package/schemas/Config.js +28 -0
- package/schemas/Coverage.js +51 -0
- package/schemas/CoverageLevel.js +117 -0
- package/schemas/CoverageTargets.js +39 -0
- package/schemas/History.js +31 -0
- package/schemas/Identity.js +64 -0
- package/schemas/Options.js +57 -0
- package/schemas/RenderState.js +161 -0
- package/schemas/RunEvent.js +163 -0
- package/schemas/Tdd.js +44 -0
- package/schemas/Thresholds.js +30 -0
- package/schemas/Transport.js +16 -0
- package/schemas/Trends.js +23 -0
- package/schemas/turns/FileEditPayload.js +15 -0
- package/schemas/turns/HookFirePayload.js +13 -0
- package/schemas/turns/HypothesisPayload.js +13 -0
- package/schemas/turns/NotePayload.js +13 -0
- package/schemas/turns/ToolCallPayload.js +13 -0
- package/schemas/turns/ToolResultPayload.js +15 -0
- package/schemas/turns/UserPromptPayload.js +12 -0
- package/schemas/turns/index.js +15 -0
- package/services/Config.js +15 -0
- package/services/DataReader.js +8 -0
- package/services/DataStore.js +8 -0
- package/services/DetailResolver.js +8 -0
- package/services/DiscoveryRegistry.js +8 -0
- package/services/EnvironmentDetector.js +8 -0
- package/services/ExecutorResolver.js +8 -0
- package/services/FormatSelector.js +8 -0
- package/services/HistoryTracker.js +8 -0
- package/services/OutputRenderer.js +8 -0
- package/services/PerClientSessionMap.js +22 -0
- package/services/ProjectDiscovery.js +8 -0
- package/services/ProjectIdentity.js +63 -0
- package/services/RunContext.js +53 -0
- package/services/idempotency.js +57 -0
- package/sidecar-dispatch.js +84 -0
- package/sql/assemblers.js +59 -0
- package/testing/layers.js +21 -0
- package/testing.d.ts +25 -0
- package/testing.js +243 -0
- package/tsdoc-metadata.json +11 -0
- package/utils/ansi.js +49 -0
- package/utils/build-report.js +130 -0
- package/utils/canonicalize-git-url.js +66 -0
- package/utils/classify-test.js +22 -0
- package/utils/compress-lines.js +45 -0
- package/utils/compute-trend.js +88 -0
- package/utils/detect-pm.js +58 -0
- package/utils/detect-timeout.js +17 -0
- package/utils/ensure-migrated.js +52 -0
- package/utils/failure-signature.js +33 -0
- package/utils/format-console.js +219 -0
- package/utils/format-fatal-error.js +35 -0
- package/utils/format-gfm.js +161 -0
- package/utils/format-terminal.js +480 -0
- package/utils/function-boundary.js +75 -0
- package/utils/hyperlink.js +11 -0
- package/utils/match-vitest-command.js +88 -0
- package/utils/normalize-workspace-key.js +34 -0
- package/utils/probe-host-metadata.js +99 -0
- package/utils/resolve-data-path.js +66 -0
- package/utils/resolve-project-key-from-cwd.js +52 -0
- package/utils/resolve-workspace-key.js +33 -0
- package/utils/safe-filename.js +34 -0
- package/utils/validate-coverage-targets-shape.js +84 -0
- package/utils/validate-phase-transition.js +113 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,3334 @@
|
|
|
1
|
+
import { $ as ValidateHypothesisInput, $t as TddTaskId, A as CreateGoalInput, At as CacheManifestEntry, B as RunChangedFile, Bt as extractSqlReason, C as TestError, Ct as GoalDetail, D as AssociateRunSessionInput, Dt as TestHistory, E as TurnSummary, Et as HistoryRecord, F as HypothesisInput, Ft as IllegalStatusTransitionError, G as SuiteInput, Gt as SessionNotFoundError, H as SessionInput, Ht as ConversationNotFoundError, I as IdempotentResponseInput, It as TddTaskAlreadyEndedError, J as TestErrorInput, Jt as AgentId, K as TddTaskInput, Kt as SidecarTimeoutError, L as ModuleInput, Lt as TddTaskEndOutcome, M as EndTddTaskInput, Mt as BehaviorNotFoundError, N as FailureSignatureWriteInput, Nt as GoalNotFoundError, O as ChangeKind, Ot as TestRun, P as FileCoverageInput, Pt as IllegalStatusTransitionEntity, Q as UpdateGoalInput, Qt as ProjectKey, R as NoteInput, Rt as TddTaskNotFoundError, S as TddTaskSummary, St as BehaviorStatus, T as TurnSearchOptions, Tt as GoalStatus, U as SettingsInput, Ut as HostMetadataParseError, V as RunInvocationMethod, Vt as AgentNotFoundError, W as StackFrameInput, Wt as RegistrationConflictError, X as TurnInput, Xt as ConversationId, Y as TestRunInput, Yt as ChatId, Z as UpdateBehaviorInput, Zt as HostKind, _ as TagInventoryRow, _t as validatePhaseTransition, a as DataReader, an as CoverageReport, at as Agent, b as TddPhaseDetail, bt as BehaviorDetail, c as HypothesisDetail, ct as RegisterAgentResult, d as PersistentFailure, dt as DenialReason, en as AgentReport, et as WriteCommitInput, f as ProjectRunSummary, ft as Phase, g as SuiteListEntry, gt as requiredArtifactForTransition, h as SettingsRow, ht as Remediation, i as CurrentTddPhase, in as TestReport, it as WriteTddPhaseOutput, j as DataStore, jt as CoverageBaselines, k as CreateBehaviorInput, kt as CacheManifest, l as ModuleListEntry, lt as ArtifactKind, m as SettingsListEntry, mt as PhaseTransitionResult, n as CitedArtifactRow, nn as ReportSummary, nt as WriteTddArtifactInput, o as FailureSignatureDetail, on as CoverageTotals, ot as AgentTreeNode, p as SessionDetail, pt as PhaseTransitionContext, q as TestCaseInput, qt as ActorType, r as CommitChangesEntry, rn as TagCountEntry, rt as WriteTddPhaseInput, s as FlakyTest, sn as FileCoverageReport, st as IdempotencyHit, t as AcceptanceMetrics, tn as ModuleReport, tt as WriteRunChangedFilesInput, u as NoteRow, ut as CitedArtifact, v as TddArtifactDetail, vt as TrendEntry, w as TestListEntry, wt as GoalRow, x as TddTaskDetail, xt as BehaviorRow, y as TddArtifactRow, yt as TrendRecord, z as RegisterAgentInput, zt as DataStoreError } from "./DataReader-2kJ9I9Hh.js";
|
|
2
|
+
import { Context, Effect, Layer, LogLevel, Option, PubSub, Schema } from "effect";
|
|
3
|
+
import { CommandExecutor, FileSystem } from "@effect/platform";
|
|
4
|
+
import { ConfigFileService } from "config-file-effect";
|
|
5
|
+
import { SqlClient } from "@effect/sql/SqlClient";
|
|
6
|
+
import { WorkspaceDiscovery, WorkspaceDiscoveryError, WorkspaceRootNotFoundError } from "workspaces-effect";
|
|
7
|
+
import { AppDirs } from "xdg-effect";
|
|
8
|
+
|
|
9
|
+
//#region src/schemas/RenderState.d.ts
|
|
10
|
+
/**
|
|
11
|
+
* Per-test record accumulated as `TestStarted` / `TestFinished` events arrive.
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
declare const TestRecord: Schema.Struct<{
|
|
15
|
+
testName: typeof Schema.String;
|
|
16
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
17
|
+
status: Schema.Union<[Schema.Literal<["passed", "failed", "skipped", "pending"]>, Schema.Literal<["running", "timed-out"]>]>;
|
|
18
|
+
durationMs: Schema.NullOr<typeof Schema.Number>;
|
|
19
|
+
error: Schema.optional<Schema.Struct<{
|
|
20
|
+
message: typeof Schema.String;
|
|
21
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
22
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
23
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
24
|
+
received: Schema.optional<typeof Schema.String>;
|
|
25
|
+
}>>;
|
|
26
|
+
}>;
|
|
27
|
+
/** @public */
|
|
28
|
+
type TestRecord = typeof TestRecord.Type;
|
|
29
|
+
/**
|
|
30
|
+
* Per-module aggregation. The reducer keeps modules keyed on
|
|
31
|
+
* `modulePath` so out-of-order events can update the right slot.
|
|
32
|
+
* @public
|
|
33
|
+
*/
|
|
34
|
+
declare const ModuleRecord: Schema.Struct<{
|
|
35
|
+
modulePath: typeof Schema.String;
|
|
36
|
+
status: Schema.Literal<["queued", "running", "finished"]>;
|
|
37
|
+
passCount: typeof Schema.Number;
|
|
38
|
+
failCount: typeof Schema.Number;
|
|
39
|
+
skipCount: typeof Schema.Number;
|
|
40
|
+
timeoutCount: typeof Schema.Number;
|
|
41
|
+
durationMs: typeof Schema.Number;
|
|
42
|
+
tests: Schema.Array$<Schema.Struct<{
|
|
43
|
+
testName: typeof Schema.String;
|
|
44
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
45
|
+
status: Schema.Union<[Schema.Literal<["passed", "failed", "skipped", "pending"]>, Schema.Literal<["running", "timed-out"]>]>;
|
|
46
|
+
durationMs: Schema.NullOr<typeof Schema.Number>;
|
|
47
|
+
error: Schema.optional<Schema.Struct<{
|
|
48
|
+
message: typeof Schema.String;
|
|
49
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
50
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
51
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
52
|
+
received: Schema.optional<typeof Schema.String>;
|
|
53
|
+
}>>;
|
|
54
|
+
}>>;
|
|
55
|
+
/**
|
|
56
|
+
* Owning Vitest project name. Optional — events from project-less
|
|
57
|
+
* configs or older replays leave it `undefined`, which the renderer
|
|
58
|
+
* treats as a single anonymous project.
|
|
59
|
+
*/
|
|
60
|
+
projectName: Schema.optional<typeof Schema.String>;
|
|
61
|
+
/**
|
|
62
|
+
* ISO wall-clock stamp captured at `onTestModuleStart`. The live
|
|
63
|
+
* renderer derives a ticking elapsed column from it while the module
|
|
64
|
+
* runs; once finished it shows `durationMs` instead. Optional — a
|
|
65
|
+
* module seeded by `ModuleQueued` (or replayed) has no start stamp.
|
|
66
|
+
*/
|
|
67
|
+
startedAt: Schema.optional<typeof Schema.String>;
|
|
68
|
+
tagCounts: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Number>>;
|
|
69
|
+
}>;
|
|
70
|
+
/** @public */
|
|
71
|
+
type ModuleRecord = typeof ModuleRecord.Type;
|
|
72
|
+
/**
|
|
73
|
+
* One row in the failure list. A failure can exist before its
|
|
74
|
+
* classification arrives (`FailureClassified` is emitted from a
|
|
75
|
+
* separate pipeline), so `classification` is nullable.
|
|
76
|
+
* @public
|
|
77
|
+
*/
|
|
78
|
+
declare const FailureRecord: Schema.Struct<{
|
|
79
|
+
modulePath: typeof Schema.String;
|
|
80
|
+
testName: typeof Schema.String;
|
|
81
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
82
|
+
error: Schema.optional<Schema.Struct<{
|
|
83
|
+
message: typeof Schema.String;
|
|
84
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
85
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
86
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
87
|
+
received: Schema.optional<typeof Schema.String>;
|
|
88
|
+
}>>;
|
|
89
|
+
timedOut: Schema.optional<typeof Schema.Boolean>;
|
|
90
|
+
classification: Schema.NullOr<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
91
|
+
}>;
|
|
92
|
+
/** @public */
|
|
93
|
+
type FailureRecord = typeof FailureRecord.Type;
|
|
94
|
+
/**
|
|
95
|
+
* Coverage block, populated only after `CoverageReady`. Threshold
|
|
96
|
+
* violations are accumulated separately as they arrive.
|
|
97
|
+
* @public
|
|
98
|
+
*/
|
|
99
|
+
declare const CoverageRenderState: Schema.Struct<{
|
|
100
|
+
metrics: Schema.Struct<{
|
|
101
|
+
statements: typeof Schema.Number;
|
|
102
|
+
branches: typeof Schema.Number;
|
|
103
|
+
functions: typeof Schema.Number;
|
|
104
|
+
lines: typeof Schema.Number;
|
|
105
|
+
}>;
|
|
106
|
+
thresholds: Schema.Struct<{
|
|
107
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
108
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
109
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
110
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
111
|
+
}>;
|
|
112
|
+
gaps: Schema.Array$<Schema.Struct<{
|
|
113
|
+
file: typeof Schema.String;
|
|
114
|
+
missing: Schema.Struct<{
|
|
115
|
+
statements: typeof Schema.Number;
|
|
116
|
+
branches: typeof Schema.Number;
|
|
117
|
+
functions: typeof Schema.Number;
|
|
118
|
+
lines: typeof Schema.Number;
|
|
119
|
+
}>;
|
|
120
|
+
uncoveredLines: Schema.optional<typeof Schema.String>;
|
|
121
|
+
}>>;
|
|
122
|
+
violations: Schema.Array$<Schema.Struct<{
|
|
123
|
+
metric: Schema.Literal<["lines", "branches", "functions", "statements"]>;
|
|
124
|
+
expected: typeof Schema.Number;
|
|
125
|
+
actual: typeof Schema.Number;
|
|
126
|
+
}>>;
|
|
127
|
+
}>;
|
|
128
|
+
/** @public */
|
|
129
|
+
type CoverageRenderState = typeof CoverageRenderState.Type;
|
|
130
|
+
/**
|
|
131
|
+
* A `SuggestedAction` event, denormalized into the queue the renderer reads.
|
|
132
|
+
* @public
|
|
133
|
+
*/
|
|
134
|
+
declare const SuggestedActionRecord: Schema.Struct<{
|
|
135
|
+
severity: Schema.Literal<["info", "warn", "blocker"]>;
|
|
136
|
+
title: typeof Schema.String;
|
|
137
|
+
detail: typeof Schema.String;
|
|
138
|
+
targetTool: Schema.optional<typeof Schema.String>;
|
|
139
|
+
}>;
|
|
140
|
+
/** @public */
|
|
141
|
+
type SuggestedActionRecord = typeof SuggestedActionRecord.Type;
|
|
142
|
+
/**
|
|
143
|
+
* Per-run totals, recomputed on every `ModuleFinished` and reconciled
|
|
144
|
+
* against `RunFinished` (which carries the runner's own count).
|
|
145
|
+
* @public
|
|
146
|
+
*/
|
|
147
|
+
declare const RenderTotals: Schema.Struct<{
|
|
148
|
+
passCount: typeof Schema.Number;
|
|
149
|
+
failCount: typeof Schema.Number;
|
|
150
|
+
skipCount: typeof Schema.Number;
|
|
151
|
+
timeoutCount: typeof Schema.Number;
|
|
152
|
+
durationMs: typeof Schema.Number;
|
|
153
|
+
}>;
|
|
154
|
+
/** @public */
|
|
155
|
+
type RenderTotals = typeof RenderTotals.Type;
|
|
156
|
+
/**
|
|
157
|
+
* The renderer state. Both the human (Ink) and agent (string)
|
|
158
|
+
* renderers read this shape; the reducer is the only producer.
|
|
159
|
+
*
|
|
160
|
+
* `phase` is the layout discriminator — agent mode emits one final
|
|
161
|
+
* frame when `phase === "finished"`; human mode redraws at every
|
|
162
|
+
* state change. `"timed-out"` is a terminal phase like `"finished"`
|
|
163
|
+
* — the run is over, but it ended because `onProcessTimeout` fired
|
|
164
|
+
* rather than the suite completing.
|
|
165
|
+
* @public
|
|
166
|
+
*/
|
|
167
|
+
declare const RenderState: Schema.Struct<{
|
|
168
|
+
phase: Schema.Literal<["idle", "running", "finished", "timed-out"]>;
|
|
169
|
+
runId: Schema.NullOr<typeof Schema.String>;
|
|
170
|
+
configHash: Schema.NullOr<typeof Schema.String>;
|
|
171
|
+
startedAt: Schema.NullOr<typeof Schema.String>;
|
|
172
|
+
finishedAt: Schema.NullOr<typeof Schema.String>;
|
|
173
|
+
modules: Schema.Record$<typeof Schema.String, Schema.Struct<{
|
|
174
|
+
modulePath: typeof Schema.String;
|
|
175
|
+
status: Schema.Literal<["queued", "running", "finished"]>;
|
|
176
|
+
passCount: typeof Schema.Number;
|
|
177
|
+
failCount: typeof Schema.Number;
|
|
178
|
+
skipCount: typeof Schema.Number;
|
|
179
|
+
timeoutCount: typeof Schema.Number;
|
|
180
|
+
durationMs: typeof Schema.Number;
|
|
181
|
+
tests: Schema.Array$<Schema.Struct<{
|
|
182
|
+
testName: typeof Schema.String;
|
|
183
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
184
|
+
status: Schema.Union<[Schema.Literal<["passed", "failed", "skipped", "pending"]>, Schema.Literal<["running", "timed-out"]>]>;
|
|
185
|
+
durationMs: Schema.NullOr<typeof Schema.Number>;
|
|
186
|
+
error: Schema.optional<Schema.Struct<{
|
|
187
|
+
message: typeof Schema.String;
|
|
188
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
189
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
190
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
191
|
+
received: Schema.optional<typeof Schema.String>;
|
|
192
|
+
}>>;
|
|
193
|
+
}>>;
|
|
194
|
+
/**
|
|
195
|
+
* Owning Vitest project name. Optional — events from project-less
|
|
196
|
+
* configs or older replays leave it `undefined`, which the renderer
|
|
197
|
+
* treats as a single anonymous project.
|
|
198
|
+
*/
|
|
199
|
+
projectName: Schema.optional<typeof Schema.String>;
|
|
200
|
+
/**
|
|
201
|
+
* ISO wall-clock stamp captured at `onTestModuleStart`. The live
|
|
202
|
+
* renderer derives a ticking elapsed column from it while the module
|
|
203
|
+
* runs; once finished it shows `durationMs` instead. Optional — a
|
|
204
|
+
* module seeded by `ModuleQueued` (or replayed) has no start stamp.
|
|
205
|
+
*/
|
|
206
|
+
startedAt: Schema.optional<typeof Schema.String>;
|
|
207
|
+
tagCounts: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Number>>;
|
|
208
|
+
}>>;
|
|
209
|
+
moduleOrder: Schema.Array$<typeof Schema.String>;
|
|
210
|
+
totals: Schema.Struct<{
|
|
211
|
+
passCount: typeof Schema.Number;
|
|
212
|
+
failCount: typeof Schema.Number;
|
|
213
|
+
skipCount: typeof Schema.Number;
|
|
214
|
+
timeoutCount: typeof Schema.Number;
|
|
215
|
+
durationMs: typeof Schema.Number;
|
|
216
|
+
}>;
|
|
217
|
+
coverage: Schema.NullOr<Schema.Struct<{
|
|
218
|
+
metrics: Schema.Struct<{
|
|
219
|
+
statements: typeof Schema.Number;
|
|
220
|
+
branches: typeof Schema.Number;
|
|
221
|
+
functions: typeof Schema.Number;
|
|
222
|
+
lines: typeof Schema.Number;
|
|
223
|
+
}>;
|
|
224
|
+
thresholds: Schema.Struct<{
|
|
225
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
226
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
227
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
228
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
229
|
+
}>;
|
|
230
|
+
gaps: Schema.Array$<Schema.Struct<{
|
|
231
|
+
file: typeof Schema.String;
|
|
232
|
+
missing: Schema.Struct<{
|
|
233
|
+
statements: typeof Schema.Number;
|
|
234
|
+
branches: typeof Schema.Number;
|
|
235
|
+
functions: typeof Schema.Number;
|
|
236
|
+
lines: typeof Schema.Number;
|
|
237
|
+
}>;
|
|
238
|
+
uncoveredLines: Schema.optional<typeof Schema.String>;
|
|
239
|
+
}>>;
|
|
240
|
+
violations: Schema.Array$<Schema.Struct<{
|
|
241
|
+
metric: Schema.Literal<["lines", "branches", "functions", "statements"]>;
|
|
242
|
+
expected: typeof Schema.Number;
|
|
243
|
+
actual: typeof Schema.Number;
|
|
244
|
+
}>>;
|
|
245
|
+
}>>;
|
|
246
|
+
trend: Schema.NullOr<Schema.Struct<{
|
|
247
|
+
direction: Schema.Literal<["improving", "regressing", "stable"]>;
|
|
248
|
+
runCount: typeof Schema.Number;
|
|
249
|
+
}>>;
|
|
250
|
+
failures: Schema.Array$<Schema.Struct<{
|
|
251
|
+
modulePath: typeof Schema.String;
|
|
252
|
+
testName: typeof Schema.String;
|
|
253
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
254
|
+
error: Schema.optional<Schema.Struct<{
|
|
255
|
+
message: typeof Schema.String;
|
|
256
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
257
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
258
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
259
|
+
received: Schema.optional<typeof Schema.String>;
|
|
260
|
+
}>>;
|
|
261
|
+
timedOut: Schema.optional<typeof Schema.Boolean>;
|
|
262
|
+
classification: Schema.NullOr<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
|
|
263
|
+
}>>;
|
|
264
|
+
suggestedActions: Schema.Array$<Schema.Struct<{
|
|
265
|
+
severity: Schema.Literal<["info", "warn", "blocker"]>;
|
|
266
|
+
title: typeof Schema.String;
|
|
267
|
+
detail: typeof Schema.String;
|
|
268
|
+
targetTool: Schema.optional<typeof Schema.String>;
|
|
269
|
+
}>>;
|
|
270
|
+
}>;
|
|
271
|
+
/** @public */
|
|
272
|
+
type RenderState = typeof RenderState.Type;
|
|
273
|
+
/**
|
|
274
|
+
* Initial state — what the reducer returns when no events have been
|
|
275
|
+
* applied yet. Exported so tests and the renderers' bootstrapping
|
|
276
|
+
* code share one definition.
|
|
277
|
+
* @public
|
|
278
|
+
*/
|
|
279
|
+
declare const initialRenderState: RenderState;
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/contracts/dispatcher.d.ts
|
|
282
|
+
/**
|
|
283
|
+
* The four run shapes the dispatcher distinguishes.
|
|
284
|
+
*
|
|
285
|
+
* Computed once per run from the reduced state's module count, the
|
|
286
|
+
* distinct-project count (carried via {@link DispatchInputs.projects}),
|
|
287
|
+
* and the test count inside each module.
|
|
288
|
+
*
|
|
289
|
+
* - `single-test` — exactly one test by name across the run.
|
|
290
|
+
* - `single-file` — exactly one module, more than one test.
|
|
291
|
+
* - `single-project` — one project, more than one module.
|
|
292
|
+
* - `workspace` — more than one project.
|
|
293
|
+
* @public
|
|
294
|
+
*/
|
|
295
|
+
type RunShape = "single-test" | "single-file" | "single-project" | "workspace";
|
|
296
|
+
/**
|
|
297
|
+
* The three outcome classes the dispatcher distinguishes.
|
|
298
|
+
*
|
|
299
|
+
* - `all-pass` — `totals.failed === 0` and no coverage threshold violations.
|
|
300
|
+
* - `some-fail` — `totals.failed > 0`.
|
|
301
|
+
* - `threshold-violation` — `totals.failed === 0` and at least one coverage violation.
|
|
302
|
+
* @public
|
|
303
|
+
*/
|
|
304
|
+
type RunOutcome = "all-pass" | "some-fail" | "threshold-violation";
|
|
305
|
+
/**
|
|
306
|
+
* Compact per-project aggregate carried into workspace cells.
|
|
307
|
+
*
|
|
308
|
+
* Populated by the plugin from `ReporterRenderInput.reports`. Empty for
|
|
309
|
+
* non-workspace shapes. `tagCounts`, `belowTarget`, and `violations` are
|
|
310
|
+
* optional — workspace cells render the columns only when present.
|
|
311
|
+
* @public
|
|
312
|
+
*/
|
|
313
|
+
interface ProjectSummary {
|
|
314
|
+
readonly name: string;
|
|
315
|
+
readonly passCount: number;
|
|
316
|
+
readonly failCount: number;
|
|
317
|
+
readonly skipCount: number;
|
|
318
|
+
readonly durationMs: number;
|
|
319
|
+
readonly tagCounts?: Record<string, number>;
|
|
320
|
+
readonly belowTarget?: number;
|
|
321
|
+
readonly violations?: number;
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Per-run trend direction handed to cells that surface a `Trend: …` line.
|
|
325
|
+
*
|
|
326
|
+
* Mirrors the inline `ReporterRenderInput.trendSummary` shape — promoted
|
|
327
|
+
* to a named type here so the dispatcher and its cells can pass it around
|
|
328
|
+
* without re-declaring it. The plugin populates this from
|
|
329
|
+
* `ReporterRenderInput.trendSummary` before invoking `dispatch`.
|
|
330
|
+
* @public
|
|
331
|
+
*/
|
|
332
|
+
interface TrendSummary {
|
|
333
|
+
readonly direction: "improving" | "regressing" | "stable";
|
|
334
|
+
readonly runCount: number;
|
|
335
|
+
readonly firstMetric?: {
|
|
336
|
+
readonly name: string;
|
|
337
|
+
readonly from: number;
|
|
338
|
+
readonly to: number;
|
|
339
|
+
readonly target?: number;
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Inputs each cell renderer reads to produce its output.
|
|
344
|
+
*
|
|
345
|
+
* `state` carries the post-reduce projection of the `RunEvent`
|
|
346
|
+
* stream. `shape` and `outcome` are the classified axes the dispatcher
|
|
347
|
+
* keyed on to reach this cell. The remaining fields are non-state
|
|
348
|
+
* helpers the plugin computes once before dispatch so cells stay pure.
|
|
349
|
+
* @public
|
|
350
|
+
*/
|
|
351
|
+
interface DispatchInputs {
|
|
352
|
+
readonly state: RenderState;
|
|
353
|
+
readonly shape: RunShape;
|
|
354
|
+
readonly outcome: RunOutcome;
|
|
355
|
+
/**
|
|
356
|
+
* Per-project aggregates carried into workspace cells. Populated by
|
|
357
|
+
* the plugin from `ReporterRenderInput.reports`; empty for non-workspace
|
|
358
|
+
* shapes.
|
|
359
|
+
*/
|
|
360
|
+
readonly projects: ReadonlyArray<ProjectSummary>;
|
|
361
|
+
/**
|
|
362
|
+
* Trend direction for cells that surface a `Trend: …` line. `null`
|
|
363
|
+
* for scoped runs and any run where trend history is unavailable.
|
|
364
|
+
*/
|
|
365
|
+
readonly trend: TrendSummary | null;
|
|
366
|
+
/**
|
|
367
|
+
* Files below the aspirational `coverageTargets` tier. Workspace and
|
|
368
|
+
* project cells surface a truncated listing of these; single-file and
|
|
369
|
+
* single-test cells ignore them.
|
|
370
|
+
*/
|
|
371
|
+
readonly belowTarget: ReadonlyArray<FileCoverageReport>;
|
|
372
|
+
/**
|
|
373
|
+
* Configured run command (e.g. `pnpm test`). Cell footers reference
|
|
374
|
+
* this so copy-pasted commands stay accurate. `null` when no command
|
|
375
|
+
* was configured.
|
|
376
|
+
*/
|
|
377
|
+
readonly runCommand: string | null;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Render-time options threaded into each cell from the resolved
|
|
381
|
+
* `ReporterKit`. These are concerns the cell needs to format its
|
|
382
|
+
* output but that do not belong on the state-derived
|
|
383
|
+
* {@link DispatchInputs} struct.
|
|
384
|
+
*
|
|
385
|
+
* The plugin builds this once per run from the kit and passes it into
|
|
386
|
+
* `dispatch(inputs, opts)`. Cells destructure only what they consume.
|
|
387
|
+
* @public
|
|
388
|
+
*/
|
|
389
|
+
interface CellOptions {
|
|
390
|
+
/**
|
|
391
|
+
* Resolved value of the `NO_COLOR` env var. Cells gate ANSI escape
|
|
392
|
+
* sequences and OSC-8 hyperlinks on this.
|
|
393
|
+
*/
|
|
394
|
+
readonly noColor: boolean;
|
|
395
|
+
/**
|
|
396
|
+
* Pre-bound OSC-8 hyperlink helper. The plugin has already decided
|
|
397
|
+
* whether OSC-8 should be enabled (`target=stdout`, `!noColor`) so
|
|
398
|
+
* cells can call this directly without re-consulting the environment.
|
|
399
|
+
*/
|
|
400
|
+
readonly osc8: (url: string, label: string) => string;
|
|
401
|
+
}
|
|
402
|
+
//#endregion
|
|
403
|
+
//#region src/schemas/Common.d.ts
|
|
404
|
+
/**
|
|
405
|
+
* Possible states for an individual test case.
|
|
406
|
+
* @public
|
|
407
|
+
*/
|
|
408
|
+
declare const TestState: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
|
|
409
|
+
/** @public */
|
|
410
|
+
type TestState = typeof TestState.Type;
|
|
411
|
+
/**
|
|
412
|
+
* Overall outcome of a test run.
|
|
413
|
+
* @public
|
|
414
|
+
*/
|
|
415
|
+
declare const TestRunReason: Schema.Literal<["passed", "failed", "interrupted"]>;
|
|
416
|
+
/** @public */
|
|
417
|
+
type TestRunReason = typeof TestRunReason.Type;
|
|
418
|
+
/**
|
|
419
|
+
* Classification of a test's failure history across runs.
|
|
420
|
+
* @public
|
|
421
|
+
*/
|
|
422
|
+
declare const TestClassification: Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>;
|
|
423
|
+
/** @public */
|
|
424
|
+
type TestClassification = typeof TestClassification.Type;
|
|
425
|
+
/**
|
|
426
|
+
* Console output verbosity mode for AgentReporter.
|
|
427
|
+
* @public
|
|
428
|
+
*/
|
|
429
|
+
declare const ConsoleOutputMode: Schema.Literal<["failures", "full", "silent"]>;
|
|
430
|
+
/** @public */
|
|
431
|
+
type ConsoleOutputMode = typeof ConsoleOutputMode.Type;
|
|
432
|
+
/**
|
|
433
|
+
* Console output choices per executor type.
|
|
434
|
+
*
|
|
435
|
+
* - `passthrough` — plugin emits nothing observable; Vitest's own reporters
|
|
436
|
+
* do the visible work. Persistence still runs. Default for `human` and `ci`.
|
|
437
|
+
* - `silent` — strip Vitest's reporters AND emit nothing from the plugin.
|
|
438
|
+
* True silence. Persistence still runs.
|
|
439
|
+
* - `agent` — markdown-flavored final-frame string tuned for token economy.
|
|
440
|
+
* Default for `agent` executor. Set on `human` as the debugging mode for
|
|
441
|
+
* inspecting the exact plain-text output an agent consumes.
|
|
442
|
+
* - `stream` — progressively-drawn, colored, animated rendering of the
|
|
443
|
+
* agent's run-shape view. Strips Vitest's reporters and owns stdout for
|
|
444
|
+
* the duration of the run. Human executor only.
|
|
445
|
+
* - `ci-annotations` — GitHub Actions `::error::` annotations. Opt-in for
|
|
446
|
+
* the `ci` executor; the matching dedicated emitter is not yet shipped,
|
|
447
|
+
* so the default for `ci` is `passthrough` until it lands.
|
|
448
|
+
* @public
|
|
449
|
+
*/
|
|
450
|
+
declare const HumanConsoleMode: Schema.Literal<["passthrough", "silent", "stream", "agent"]>;
|
|
451
|
+
/** @public */
|
|
452
|
+
type HumanConsoleMode = typeof HumanConsoleMode.Type;
|
|
453
|
+
/** @public */
|
|
454
|
+
declare const AgentConsoleMode: Schema.Literal<["passthrough", "silent", "agent"]>;
|
|
455
|
+
/** @public */
|
|
456
|
+
type AgentConsoleMode = typeof AgentConsoleMode.Type;
|
|
457
|
+
/** @public */
|
|
458
|
+
declare const CiConsoleMode: Schema.Literal<["passthrough", "silent", "ci-annotations"]>;
|
|
459
|
+
/** @public */
|
|
460
|
+
type CiConsoleMode = typeof CiConsoleMode.Type;
|
|
461
|
+
/**
|
|
462
|
+
* Union of every legal console-output value across the three executor slots.
|
|
463
|
+
* Useful for type-narrowing in renderers that take the resolved value.
|
|
464
|
+
* @public
|
|
465
|
+
*/
|
|
466
|
+
declare const ConsoleMode: Schema.Union<[Schema.Literal<["passthrough", "silent", "stream", "agent"]>, Schema.Literal<["passthrough", "silent", "agent"]>, Schema.Literal<["passthrough", "silent", "ci-annotations"]>]>;
|
|
467
|
+
/** @public */
|
|
468
|
+
type ConsoleMode = typeof ConsoleMode.Type;
|
|
469
|
+
/**
|
|
470
|
+
* Supported package managers for run command generation.
|
|
471
|
+
* @public
|
|
472
|
+
*/
|
|
473
|
+
declare const PackageManager: Schema.Literal<["pnpm", "npm", "yarn", "bun"]>;
|
|
474
|
+
/** @public */
|
|
475
|
+
type PackageManager = typeof PackageManager.Type;
|
|
476
|
+
/**
|
|
477
|
+
* Runtime environment where tests are being executed.
|
|
478
|
+
* @public
|
|
479
|
+
*/
|
|
480
|
+
declare const Environment: Schema.Literal<["agent-shell", "terminal", "ci-github", "ci-generic"]>;
|
|
481
|
+
/** @public */
|
|
482
|
+
type Environment = typeof Environment.Type;
|
|
483
|
+
/**
|
|
484
|
+
* Who or what is executing the test run.
|
|
485
|
+
* @public
|
|
486
|
+
*/
|
|
487
|
+
declare const Executor: Schema.Literal<["human", "agent", "ci"]>;
|
|
488
|
+
/** @public */
|
|
489
|
+
type Executor = typeof Executor.Type;
|
|
490
|
+
/**
|
|
491
|
+
* Output format for the reporter pipeline.
|
|
492
|
+
* @public
|
|
493
|
+
*/
|
|
494
|
+
declare const OutputFormat: Schema.Literal<["terminal", "markdown", "json", "vitest-bypass", "silent", "ci-annotations"]>;
|
|
495
|
+
/** @public */
|
|
496
|
+
type OutputFormat = typeof OutputFormat.Type;
|
|
497
|
+
/**
|
|
498
|
+
* Level of detail in reporter output.
|
|
499
|
+
* @public
|
|
500
|
+
*/
|
|
501
|
+
declare const DetailLevel: Schema.Literal<["minimal", "neutral", "standard", "verbose"]>;
|
|
502
|
+
/** @public */
|
|
503
|
+
type DetailLevel = typeof DetailLevel.Type;
|
|
504
|
+
/**
|
|
505
|
+
* A single test or module error with optional stack trace, diff, and
|
|
506
|
+
* structured assertion values.
|
|
507
|
+
*
|
|
508
|
+
* `expected` / `received` are pre-stringified, one-line representations
|
|
509
|
+
* of the assertion's expected and received JS values. They are populated
|
|
510
|
+
* only when the underlying test runner error carries structured `.expected`
|
|
511
|
+
* / `.actual` properties (assertion errors). The raw JS values stay in
|
|
512
|
+
* Vitest's internal error object; only the string representation crosses
|
|
513
|
+
* the schema boundary.
|
|
514
|
+
* @public
|
|
515
|
+
*/
|
|
516
|
+
declare const ReportError: Schema.Struct<{
|
|
517
|
+
message: typeof Schema.String;
|
|
518
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
519
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
520
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
521
|
+
received: Schema.optional<typeof Schema.String>;
|
|
522
|
+
}>;
|
|
523
|
+
/** @public */
|
|
524
|
+
type ReportError = typeof ReportError.Type;
|
|
525
|
+
//#endregion
|
|
526
|
+
//#region src/formatters/types.d.ts
|
|
527
|
+
/** @public */
|
|
528
|
+
interface RenderedOutput {
|
|
529
|
+
readonly target: "stdout" | "file" | "github-summary";
|
|
530
|
+
readonly content: string;
|
|
531
|
+
readonly contentType: string;
|
|
532
|
+
}
|
|
533
|
+
/** @public */
|
|
534
|
+
interface FormatterContext {
|
|
535
|
+
readonly detail: DetailLevel;
|
|
536
|
+
readonly noColor: boolean;
|
|
537
|
+
readonly coverageConsoleLimit: number;
|
|
538
|
+
readonly trendSummary?: {
|
|
539
|
+
direction: "improving" | "regressing" | "stable";
|
|
540
|
+
runCount: number;
|
|
541
|
+
firstMetric?: {
|
|
542
|
+
name: string;
|
|
543
|
+
from: number;
|
|
544
|
+
to: number;
|
|
545
|
+
target?: number;
|
|
546
|
+
};
|
|
547
|
+
};
|
|
548
|
+
readonly runCommand?: string;
|
|
549
|
+
readonly githubSummaryFile?: string;
|
|
550
|
+
readonly mcp?: boolean;
|
|
551
|
+
}
|
|
552
|
+
/** @public */
|
|
553
|
+
interface Formatter {
|
|
554
|
+
readonly format: string;
|
|
555
|
+
readonly render: (reports: ReadonlyArray<AgentReport>, context: FormatterContext) => ReadonlyArray<RenderedOutput>;
|
|
556
|
+
}
|
|
557
|
+
//#endregion
|
|
558
|
+
//#region src/schemas/RunEvent.d.ts
|
|
559
|
+
/**
|
|
560
|
+
* Coverage metric whose threshold can be violated independently.
|
|
561
|
+
* @public
|
|
562
|
+
*/
|
|
563
|
+
declare const CoverageMetric: Schema.Literal<["lines", "branches", "functions", "statements"]>;
|
|
564
|
+
/** @public */
|
|
565
|
+
type CoverageMetric = typeof CoverageMetric.Type;
|
|
566
|
+
/**
|
|
567
|
+
* Severity tier for a suggested action emitted during a run.
|
|
568
|
+
* @public
|
|
569
|
+
*/
|
|
570
|
+
declare const ActionSeverity: Schema.Literal<["info", "warn", "blocker"]>;
|
|
571
|
+
/** @public */
|
|
572
|
+
type ActionSeverity = typeof ActionSeverity.Type;
|
|
573
|
+
/**
|
|
574
|
+
* Lifecycle scope of a Vitest setup/teardown hook.
|
|
575
|
+
* @public
|
|
576
|
+
*/
|
|
577
|
+
declare const HookType: Schema.Literal<["beforeAll", "afterAll", "beforeEach", "afterEach"]>;
|
|
578
|
+
/** @public */
|
|
579
|
+
type HookType = typeof HookType.Type;
|
|
580
|
+
/**
|
|
581
|
+
* Terminal status of a Vitest hook run.
|
|
582
|
+
* @public
|
|
583
|
+
*/
|
|
584
|
+
declare const HookStatus: Schema.Literal<["passed", "failed"]>;
|
|
585
|
+
/** @public */
|
|
586
|
+
type HookStatus = typeof HookStatus.Type;
|
|
587
|
+
/**
|
|
588
|
+
* Output stream a captured user `console.log` was written to.
|
|
589
|
+
* @public
|
|
590
|
+
*/
|
|
591
|
+
declare const ConsoleLogLevel: Schema.Literal<["stdout", "stderr"]>;
|
|
592
|
+
/** @public */
|
|
593
|
+
type ConsoleLogLevel = typeof ConsoleLogLevel.Type;
|
|
594
|
+
/**
|
|
595
|
+
* A coverage gap surfaced to the renderer — a per-file shortfall that
|
|
596
|
+
* a renderer may want to call out individually.
|
|
597
|
+
* @public
|
|
598
|
+
*/
|
|
599
|
+
declare const CoverageGap: Schema.Struct<{
|
|
600
|
+
file: typeof Schema.String;
|
|
601
|
+
missing: Schema.Struct<{
|
|
602
|
+
statements: typeof Schema.Number;
|
|
603
|
+
branches: typeof Schema.Number;
|
|
604
|
+
functions: typeof Schema.Number;
|
|
605
|
+
lines: typeof Schema.Number;
|
|
606
|
+
}>;
|
|
607
|
+
uncoveredLines: Schema.optional<typeof Schema.String>;
|
|
608
|
+
}>;
|
|
609
|
+
/** @public */
|
|
610
|
+
type CoverageGap = typeof CoverageGap.Type;
|
|
611
|
+
/**
|
|
612
|
+
* The reducer projects this union into `RenderState`. Renderers
|
|
613
|
+
* never read the raw event stream — they read the projected state.
|
|
614
|
+
*
|
|
615
|
+
* @remarks
|
|
616
|
+
* Adding a variant here is one change in one place; the reducer's
|
|
617
|
+
* exhaustive `Match.exhaustive` will surface any renderer that hasn't
|
|
618
|
+
* been updated to consume the new state shape.
|
|
619
|
+
* @public
|
|
620
|
+
*/
|
|
621
|
+
declare const RunEvent: Schema.Union<[Schema.TaggedStruct<"RunStarted", {
|
|
622
|
+
runId: typeof Schema.String;
|
|
623
|
+
startedAt: typeof Schema.String;
|
|
624
|
+
configHash: typeof Schema.String;
|
|
625
|
+
}>, Schema.TaggedStruct<"ModuleQueued", {
|
|
626
|
+
modulePath: typeof Schema.String;
|
|
627
|
+
projectName: Schema.optional<typeof Schema.String>;
|
|
628
|
+
}>, Schema.TaggedStruct<"ModuleStarted", {
|
|
629
|
+
modulePath: typeof Schema.String;
|
|
630
|
+
startedAt: typeof Schema.String;
|
|
631
|
+
projectName: Schema.optional<typeof Schema.String>;
|
|
632
|
+
}>, Schema.TaggedStruct<"TestStarted", {
|
|
633
|
+
modulePath: typeof Schema.String;
|
|
634
|
+
testName: typeof Schema.String;
|
|
635
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
636
|
+
}>, Schema.TaggedStruct<"TestFinished", {
|
|
637
|
+
modulePath: typeof Schema.String;
|
|
638
|
+
testName: typeof Schema.String;
|
|
639
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
640
|
+
status: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
|
|
641
|
+
durationMs: typeof Schema.Number;
|
|
642
|
+
error: Schema.optional<Schema.Struct<{
|
|
643
|
+
message: typeof Schema.String;
|
|
644
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
645
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
646
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
647
|
+
received: Schema.optional<typeof Schema.String>;
|
|
648
|
+
}>>;
|
|
649
|
+
timedOut: Schema.optional<typeof Schema.Boolean>;
|
|
650
|
+
}>, Schema.TaggedStruct<"ModuleFinished", {
|
|
651
|
+
modulePath: typeof Schema.String;
|
|
652
|
+
passCount: typeof Schema.Number;
|
|
653
|
+
failCount: typeof Schema.Number;
|
|
654
|
+
skipCount: typeof Schema.Number;
|
|
655
|
+
durationMs: typeof Schema.Number;
|
|
656
|
+
projectName: Schema.optional<typeof Schema.String>;
|
|
657
|
+
timeoutCount: Schema.optional<typeof Schema.Number>;
|
|
658
|
+
tagCounts: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Number>>;
|
|
659
|
+
}>, Schema.TaggedStruct<"ModuleCollected", {
|
|
660
|
+
modulePath: typeof Schema.String;
|
|
661
|
+
testCount: typeof Schema.Number;
|
|
662
|
+
suiteCount: typeof Schema.Number;
|
|
663
|
+
}>, Schema.TaggedStruct<"SuiteStarted", {
|
|
664
|
+
modulePath: typeof Schema.String;
|
|
665
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
666
|
+
suiteName: typeof Schema.String;
|
|
667
|
+
}>, Schema.TaggedStruct<"SuiteFinished", {
|
|
668
|
+
modulePath: typeof Schema.String;
|
|
669
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
670
|
+
suiteName: typeof Schema.String;
|
|
671
|
+
passCount: typeof Schema.Number;
|
|
672
|
+
failCount: typeof Schema.Number;
|
|
673
|
+
skipCount: typeof Schema.Number;
|
|
674
|
+
}>, Schema.TaggedStruct<"HookStarted", {
|
|
675
|
+
modulePath: typeof Schema.String;
|
|
676
|
+
hookType: Schema.Literal<["beforeAll", "afterAll", "beforeEach", "afterEach"]>;
|
|
677
|
+
scopeName: typeof Schema.String;
|
|
678
|
+
}>, Schema.TaggedStruct<"HookFinished", {
|
|
679
|
+
modulePath: typeof Schema.String;
|
|
680
|
+
hookType: Schema.Literal<["beforeAll", "afterAll", "beforeEach", "afterEach"]>;
|
|
681
|
+
scopeName: typeof Schema.String;
|
|
682
|
+
durationMs: typeof Schema.Number;
|
|
683
|
+
status: Schema.Literal<["passed", "failed"]>;
|
|
684
|
+
error: Schema.optional<Schema.Struct<{
|
|
685
|
+
message: typeof Schema.String;
|
|
686
|
+
stack: Schema.optional<typeof Schema.String>;
|
|
687
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
688
|
+
expected: Schema.optional<typeof Schema.String>;
|
|
689
|
+
received: Schema.optional<typeof Schema.String>;
|
|
690
|
+
}>>;
|
|
691
|
+
}>, Schema.TaggedStruct<"ConsoleLog", {
|
|
692
|
+
modulePath: Schema.optional<typeof Schema.String>;
|
|
693
|
+
testName: Schema.optional<typeof Schema.String>;
|
|
694
|
+
level: Schema.Literal<["stdout", "stderr"]>;
|
|
695
|
+
content: typeof Schema.String;
|
|
696
|
+
time: typeof Schema.Number;
|
|
697
|
+
}>, Schema.TaggedStruct<"RunTimedOut", {
|
|
698
|
+
message: typeof Schema.String;
|
|
699
|
+
}>, Schema.TaggedStruct<"TestAnnotated", {
|
|
700
|
+
modulePath: typeof Schema.String;
|
|
701
|
+
testName: typeof Schema.String;
|
|
702
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
703
|
+
annotation: typeof Schema.String;
|
|
704
|
+
}>, Schema.TaggedStruct<"TestArtifactRecorded", {
|
|
705
|
+
modulePath: typeof Schema.String;
|
|
706
|
+
testName: typeof Schema.String;
|
|
707
|
+
suitePath: Schema.Array$<typeof Schema.String>;
|
|
708
|
+
artifact: typeof Schema.String;
|
|
709
|
+
}>, Schema.TaggedStruct<"WatcherReady", {}>, Schema.TaggedStruct<"WatcherRerun", {
|
|
710
|
+
triggerFiles: Schema.Array$<typeof Schema.String>;
|
|
711
|
+
reason: Schema.optional<typeof Schema.String>;
|
|
712
|
+
}>, Schema.TaggedStruct<"TrendComputed", {
|
|
713
|
+
direction: Schema.Literal<["improving", "regressing", "stable"]>;
|
|
714
|
+
runCount: typeof Schema.Number;
|
|
715
|
+
}>, Schema.TaggedStruct<"CoverageReady", {
|
|
716
|
+
metrics: Schema.Struct<{
|
|
717
|
+
statements: typeof Schema.Number;
|
|
718
|
+
branches: typeof Schema.Number;
|
|
719
|
+
functions: typeof Schema.Number;
|
|
720
|
+
lines: typeof Schema.Number;
|
|
721
|
+
}>;
|
|
722
|
+
thresholds: Schema.Struct<{
|
|
723
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
724
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
725
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
726
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
727
|
+
}>;
|
|
728
|
+
gaps: Schema.Array$<Schema.Struct<{
|
|
729
|
+
file: typeof Schema.String;
|
|
730
|
+
missing: Schema.Struct<{
|
|
731
|
+
statements: typeof Schema.Number;
|
|
732
|
+
branches: typeof Schema.Number;
|
|
733
|
+
functions: typeof Schema.Number;
|
|
734
|
+
lines: typeof Schema.Number;
|
|
735
|
+
}>;
|
|
736
|
+
uncoveredLines: Schema.optional<typeof Schema.String>;
|
|
737
|
+
}>>;
|
|
738
|
+
}>, Schema.TaggedStruct<"ThresholdViolation", {
|
|
739
|
+
metric: Schema.Literal<["lines", "branches", "functions", "statements"]>;
|
|
740
|
+
expected: typeof Schema.Number;
|
|
741
|
+
actual: typeof Schema.Number;
|
|
742
|
+
}>, Schema.TaggedStruct<"FailureClassified", {
|
|
743
|
+
modulePath: typeof Schema.String;
|
|
744
|
+
testName: typeof Schema.String;
|
|
745
|
+
classification: Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>;
|
|
746
|
+
}>, Schema.TaggedStruct<"SuggestedAction", {
|
|
747
|
+
severity: Schema.Literal<["info", "warn", "blocker"]>;
|
|
748
|
+
title: typeof Schema.String;
|
|
749
|
+
detail: typeof Schema.String;
|
|
750
|
+
targetTool: Schema.optional<typeof Schema.String>;
|
|
751
|
+
}>, Schema.TaggedStruct<"RunFinished", {
|
|
752
|
+
runId: typeof Schema.String;
|
|
753
|
+
finishedAt: typeof Schema.String;
|
|
754
|
+
passCount: typeof Schema.Number;
|
|
755
|
+
failCount: typeof Schema.Number;
|
|
756
|
+
skipCount: typeof Schema.Number;
|
|
757
|
+
durationMs: typeof Schema.Number;
|
|
758
|
+
timeoutCount: Schema.optional<typeof Schema.Number>;
|
|
759
|
+
}>]>;
|
|
760
|
+
/** @public */
|
|
761
|
+
type RunEvent = typeof RunEvent.Type;
|
|
762
|
+
/**
|
|
763
|
+
* Convenience: discriminator-keyed map of the individual variants.
|
|
764
|
+
*
|
|
765
|
+
* Useful for callers that want to construct an event by tag without
|
|
766
|
+
* pulling the whole union shape into scope.
|
|
767
|
+
* @public
|
|
768
|
+
*/
|
|
769
|
+
type RunEventByTag = { [E in RunEvent as E["_tag"]]: E };
|
|
770
|
+
//#endregion
|
|
771
|
+
//#region src/schemas/Thresholds.d.ts
|
|
772
|
+
/**
|
|
773
|
+
* Per-metric threshold values. All optional -- only set metrics are enforced.
|
|
774
|
+
* @public
|
|
775
|
+
*/
|
|
776
|
+
declare const MetricThresholds: Schema.Struct<{
|
|
777
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
778
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
779
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
780
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
781
|
+
}>;
|
|
782
|
+
/** @public */
|
|
783
|
+
type MetricThresholds = typeof MetricThresholds.Type;
|
|
784
|
+
/**
|
|
785
|
+
* A glob pattern paired with its metric thresholds.
|
|
786
|
+
* @public
|
|
787
|
+
*/
|
|
788
|
+
declare const PatternThresholds: Schema.Tuple2<typeof Schema.String, Schema.Struct<{
|
|
789
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
790
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
791
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
792
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
793
|
+
}>>;
|
|
794
|
+
/** @public */
|
|
795
|
+
type PatternThresholds = typeof PatternThresholds.Type;
|
|
796
|
+
/**
|
|
797
|
+
* Fully resolved thresholds ready for evaluation.
|
|
798
|
+
* @public
|
|
799
|
+
*/
|
|
800
|
+
declare const ResolvedThresholds: Schema.Struct<{
|
|
801
|
+
global: Schema.Struct<{
|
|
802
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
803
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
804
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
805
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
806
|
+
}>;
|
|
807
|
+
perFile: Schema.optionalWith<typeof Schema.Boolean, {
|
|
808
|
+
default: () => false;
|
|
809
|
+
}>;
|
|
810
|
+
patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
|
|
811
|
+
lines: Schema.optional<typeof Schema.Number>;
|
|
812
|
+
functions: Schema.optional<typeof Schema.Number>;
|
|
813
|
+
branches: Schema.optional<typeof Schema.Number>;
|
|
814
|
+
statements: Schema.optional<typeof Schema.Number>;
|
|
815
|
+
}>>>, {
|
|
816
|
+
default: () => never[];
|
|
817
|
+
}>;
|
|
818
|
+
}>;
|
|
819
|
+
/** @public */
|
|
820
|
+
type ResolvedThresholds = typeof ResolvedThresholds.Type;
|
|
821
|
+
//#endregion
|
|
822
|
+
//#region src/schemas/Transport.d.ts
|
|
823
|
+
/**
|
|
824
|
+
* Transport binding for the persistence layer.
|
|
825
|
+
*
|
|
826
|
+
* 2.x ships only `{ kind: "local" }`. Modeled as a single-member
|
|
827
|
+
* discriminated union so the 3.0 cloud-backend swap (D1, Turso, etc.)
|
|
828
|
+
* lands as a pure addition of new union members — no schema-shape
|
|
829
|
+
* diff and no breaking API change at the call site.
|
|
830
|
+
* @public
|
|
831
|
+
*/
|
|
832
|
+
declare const Transport: Schema.Struct<{
|
|
833
|
+
kind: Schema.Literal<["local"]>;
|
|
834
|
+
}>;
|
|
835
|
+
/** @public */
|
|
836
|
+
type Transport = typeof Transport.Type;
|
|
837
|
+
//#endregion
|
|
838
|
+
//#region src/contracts/reporter.d.ts
|
|
839
|
+
/**
|
|
840
|
+
* Config the plugin computes from its own options + Vitest's resolved config,
|
|
841
|
+
* then hands to the reporter factory inside {@link ReporterKit}.
|
|
842
|
+
*
|
|
843
|
+
* `dbPath` is optional at the type level so renderers that don't care about
|
|
844
|
+
* the persistence layer (e.g. a stdout-only renderer) can ignore it. The
|
|
845
|
+
* plugin always populates it in practice — the option exists for clarity
|
|
846
|
+
* and to leave room for future "no-persistence" experiments.
|
|
847
|
+
*
|
|
848
|
+
* `format` and `detail` are pre-resolved by the plugin (via
|
|
849
|
+
* `FormatSelector` / `DetailResolver`) but reporters that want to override
|
|
850
|
+
* can ignore them. `noColor` is the resolved value of the `NO_COLOR` env
|
|
851
|
+
* var; reporters use it to gate ANSI escapes and OSC-8 hyperlinks.
|
|
852
|
+
* @public
|
|
853
|
+
*/
|
|
854
|
+
interface ResolvedReporterConfig {
|
|
855
|
+
readonly dbPath?: string;
|
|
856
|
+
readonly projectFilter?: string;
|
|
857
|
+
/**
|
|
858
|
+
* The executor the plugin detected at run time (`human`, `agent`, `ci`).
|
|
859
|
+
* Renderers branch on this when their per-mode behavior depends on the
|
|
860
|
+
* observer (e.g. honoring `NO_COLOR` only when a human is watching).
|
|
861
|
+
*/
|
|
862
|
+
readonly executor: Executor;
|
|
863
|
+
/**
|
|
864
|
+
* The `ConsoleMode` value the plugin selected for the active
|
|
865
|
+
* executor — the result of looking up `console.{executor}` and falling
|
|
866
|
+
* back to the per-slot default. Renderers that need to know "what am I
|
|
867
|
+
* supposed to produce right now?" read this single field.
|
|
868
|
+
*/
|
|
869
|
+
readonly consoleMode: ConsoleMode;
|
|
870
|
+
readonly mcp: boolean;
|
|
871
|
+
readonly consoleOutput: "failures" | "full" | "silent";
|
|
872
|
+
readonly omitPassingTests: boolean;
|
|
873
|
+
readonly coverageConsoleLimit: number;
|
|
874
|
+
readonly includeBareZero: boolean;
|
|
875
|
+
readonly githubActions: boolean;
|
|
876
|
+
readonly githubSummary: boolean;
|
|
877
|
+
readonly githubSummaryFile?: string;
|
|
878
|
+
readonly coverageThresholds?: ResolvedThresholds;
|
|
879
|
+
readonly coverageTargets?: ResolvedThresholds;
|
|
880
|
+
/**
|
|
881
|
+
* Operating mode resolved from Vitest's native `coverage.enabled` config.
|
|
882
|
+
* - `"full"` — coverage is enabled; all analytics and persistence run.
|
|
883
|
+
* - `"ui-only"` — coverage is disabled (`coverage.enabled: false`); reporter
|
|
884
|
+
* renders output but the persistence pipeline is skipped (Phase 5).
|
|
885
|
+
*
|
|
886
|
+
* The plugin always resolves this field in `configureVitest`.
|
|
887
|
+
* @internal
|
|
888
|
+
*/
|
|
889
|
+
readonly coverageMode: "full" | "ui-only";
|
|
890
|
+
readonly format: OutputFormat;
|
|
891
|
+
readonly detail: DetailLevel;
|
|
892
|
+
readonly noColor: boolean;
|
|
893
|
+
readonly runCommand?: string;
|
|
894
|
+
/**
|
|
895
|
+
* Transport binding for the persistence layer. Custom reporters
|
|
896
|
+
* read this when they want to branch on backend kind (e.g. behave
|
|
897
|
+
* differently against a cloud DB). 2.x ships only `{ kind: "local" }`.
|
|
898
|
+
*/
|
|
899
|
+
readonly transport?: Transport;
|
|
900
|
+
/**
|
|
901
|
+
* Snapshot of Vitest's `test.passWithNoTests` policy captured from
|
|
902
|
+
* the resolved config at `configureVitest` time.
|
|
903
|
+
*
|
|
904
|
+
* Informational for consumer reporters that want to render the
|
|
905
|
+
* resolved policy alongside other run context. The MCP `run_tests`
|
|
906
|
+
* tool does not read this field — when its per-call
|
|
907
|
+
* `passWithNoTests` override is unset the tool forwards nothing to
|
|
908
|
+
* `createVitest`, and Vitest re-resolves from the project config on
|
|
909
|
+
* disk. The `no-match` discriminator is filter-driven and is not
|
|
910
|
+
* affected by this policy.
|
|
911
|
+
*
|
|
912
|
+
* Optional because the field is only present when populated by the
|
|
913
|
+
* plugin; consumers constructing `ResolvedReporterConfig` directly
|
|
914
|
+
* may omit it.
|
|
915
|
+
*/
|
|
916
|
+
readonly passWithNoTests?: boolean;
|
|
917
|
+
}
|
|
918
|
+
/**
|
|
919
|
+
* Plugin-provided primitives passed to the reporter factory at construction
|
|
920
|
+
* time. The `std*` prefix marks these as "the plugin gives you these — do
|
|
921
|
+
* not import equivalents yourself"; they are pre-resolved with full context
|
|
922
|
+
* (environment, executor, NO_COLOR, target=stdout) so the reporter doesn't
|
|
923
|
+
* have to re-derive that state.
|
|
924
|
+
*
|
|
925
|
+
* The shape is open to additions: future fields (e.g. `stdLogger`,
|
|
926
|
+
* `stdRuntime`) won't break existing reporters because the parameter is a
|
|
927
|
+
* named-field object. Reporters destructure only what they consume.
|
|
928
|
+
* @public
|
|
929
|
+
*/
|
|
930
|
+
interface ReporterKit {
|
|
931
|
+
readonly config: ResolvedReporterConfig;
|
|
932
|
+
readonly stdEnv: Environment;
|
|
933
|
+
/**
|
|
934
|
+
* Pre-bound OSC-8 hyperlink helper. The plugin has already decided
|
|
935
|
+
* whether OSC-8 should be enabled (target=stdout, !noColor) so the
|
|
936
|
+
* reporter can call this directly without consulting environment.
|
|
937
|
+
*/
|
|
938
|
+
readonly stdOsc8: (url: string, label: string) => string;
|
|
939
|
+
/**
|
|
940
|
+
* Live run-event channel. The plugin publishes one `RunEvent`
|
|
941
|
+
* per Vitest streaming callback (`onTestRunStart`, `onTestModuleStart`,
|
|
942
|
+
* `onTestCaseResult`, `onTestRunEnd`, …) onto this `PubSub` as the run
|
|
943
|
+
* progresses. A reporter that paints live — the default reporter's Ink
|
|
944
|
+
* mount in `consoleMode: "stream"` — subscribes here at construction time
|
|
945
|
+
* (the factory is invoked at run start, before the first event) and
|
|
946
|
+
* drives its renderer off the stream.
|
|
947
|
+
*
|
|
948
|
+
* Optional at the type level so a reporter constructed directly
|
|
949
|
+
* without the plugin (tests, one-shot replay) can omit it; a reporter
|
|
950
|
+
* that wants live events must guard for `undefined`. The plugin always
|
|
951
|
+
* populates it.
|
|
952
|
+
*/
|
|
953
|
+
readonly runEvents?: PubSub.PubSub<RunEvent>;
|
|
954
|
+
}
|
|
955
|
+
/**
|
|
956
|
+
* Per-run data handed to {@link VitestAgentReporter.render} after the plugin
|
|
957
|
+
* has finished persisting and classifying the run.
|
|
958
|
+
*
|
|
959
|
+
* `reports` is one entry per project (multi-project Vitest configs produce
|
|
960
|
+
* multiple). `classifications` is keyed by `TestReport.fullName` and is the
|
|
961
|
+
* stable / new-failure / persistent / flaky / recovered label assigned by
|
|
962
|
+
* `HistoryTracker`. `trendSummary` is present only on full (non-scoped) runs
|
|
963
|
+
* where coverage trends were computed.
|
|
964
|
+
* @public
|
|
965
|
+
*/
|
|
966
|
+
interface ReporterRenderInput {
|
|
967
|
+
readonly reports: ReadonlyArray<AgentReport>;
|
|
968
|
+
readonly classifications: ReadonlyMap<string, TestClassification>;
|
|
969
|
+
readonly trendSummary?: {
|
|
970
|
+
readonly direction: "improving" | "regressing" | "stable";
|
|
971
|
+
readonly runCount: number;
|
|
972
|
+
readonly firstMetric?: {
|
|
973
|
+
readonly name: string;
|
|
974
|
+
readonly from: number;
|
|
975
|
+
readonly to: number;
|
|
976
|
+
readonly target?: number;
|
|
977
|
+
};
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* The reporter contract. Implement this to plug a custom output strategy
|
|
982
|
+
* into `vitest-agent`.
|
|
983
|
+
*
|
|
984
|
+
* `render` is called once per test run after the plugin has persisted all
|
|
985
|
+
* data. It receives the assembled run plus a second, health-aware
|
|
986
|
+
* {@link ReporterKit}: the kit handed to the factory is resolved at run
|
|
987
|
+
* start (before failures are known), while the kit handed to `render` is
|
|
988
|
+
* resolved at run end and reflects post-run `detail`. A reporter that does
|
|
989
|
+
* construction-time work reads the factory kit; a reporter that renders
|
|
990
|
+
* reads the `render` kit. The reporter returns `RenderedOutput[]` — the
|
|
991
|
+
* plugin routes each entry to its declared `target` (`stdout`, `file`,
|
|
992
|
+
* `github-summary`), so the reporter does not need to know about file
|
|
993
|
+
* paths or write streams.
|
|
994
|
+
*
|
|
995
|
+
* A "no-op" reporter is one line: `() => ({ render: () => [] })`. Useful
|
|
996
|
+
* for users who only want persistence (the MCP/CLI tools see the data) and
|
|
997
|
+
* no console output at all.
|
|
998
|
+
* @public
|
|
999
|
+
*/
|
|
1000
|
+
interface VitestAgentReporter {
|
|
1001
|
+
readonly render: (input: ReporterRenderInput, kit: ReporterKit) => ReadonlyArray<RenderedOutput>;
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* Factory that the plugin's `reporter` option accepts. The plugin calls
|
|
1005
|
+
* this once with the resolved kit; the factory returns either a single
|
|
1006
|
+
* reporter or an array of reporters bound to that kit.
|
|
1007
|
+
*
|
|
1008
|
+
* Returning an array models Vitest's own multi-reporter pattern
|
|
1009
|
+
* (`reporters: ['default', 'github-actions']`): each reporter handles
|
|
1010
|
+
* its own concern (e.g. one for stdout markdown, one for SARIF, one
|
|
1011
|
+
* for the GitHub Actions step summary) and the plugin concatenates
|
|
1012
|
+
* their `RenderedOutput[]` before routing. Persistence still runs
|
|
1013
|
+
* exactly once — the plugin owns the Vitest lifecycle and the
|
|
1014
|
+
* reporters never see Vitest events directly.
|
|
1015
|
+
*
|
|
1016
|
+
* Defaulting to a factory (rather than passing a class or pre-made
|
|
1017
|
+
* instance) gives implementations a place to do construction-time work
|
|
1018
|
+
* (e.g. opening a file handle, capturing config) while still letting
|
|
1019
|
+
* the plugin own the kit assembly.
|
|
1020
|
+
* @public
|
|
1021
|
+
*/
|
|
1022
|
+
type VitestAgentReporterFactory = (kit: ReporterKit) => VitestAgentReporter | ReadonlyArray<VitestAgentReporter>;
|
|
1023
|
+
//#endregion
|
|
1024
|
+
//#region src/errors/DiscoveryError.d.ts
|
|
1025
|
+
declare const DiscoveryError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
1026
|
+
readonly _tag: "DiscoveryError";
|
|
1027
|
+
} & Readonly<A>;
|
|
1028
|
+
/**
|
|
1029
|
+
* Error raised when project discovery (glob, file read, or stat) fails.
|
|
1030
|
+
* @public
|
|
1031
|
+
*/
|
|
1032
|
+
declare class DiscoveryError extends DiscoveryError_base<{
|
|
1033
|
+
readonly operation: "glob" | "read" | "stat";
|
|
1034
|
+
readonly path: string;
|
|
1035
|
+
readonly reason: string;
|
|
1036
|
+
}> {
|
|
1037
|
+
constructor(args: {
|
|
1038
|
+
readonly operation: "glob" | "read" | "stat";
|
|
1039
|
+
readonly path: string;
|
|
1040
|
+
readonly reason: string;
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region src/errors/PathResolutionError.d.ts
|
|
1045
|
+
declare const PathResolutionError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
1046
|
+
readonly _tag: "PathResolutionError";
|
|
1047
|
+
} & Readonly<A>;
|
|
1048
|
+
/**
|
|
1049
|
+
* Error raised when the data directory path cannot be resolved.
|
|
1050
|
+
*
|
|
1051
|
+
* The most common case is missing workspace identity: no `projectKey`
|
|
1052
|
+
* override in `vitest-agent.config.toml` and no `name` field in
|
|
1053
|
+
* the root workspace's `package.json`. The path is a function of the
|
|
1054
|
+
* workspace's identity, so without one we have no canonical location to
|
|
1055
|
+
* write to.
|
|
1056
|
+
* @public
|
|
1057
|
+
*/
|
|
1058
|
+
declare class PathResolutionError extends PathResolutionError_base<{
|
|
1059
|
+
readonly reason: string;
|
|
1060
|
+
}> {
|
|
1061
|
+
constructor(args: {
|
|
1062
|
+
readonly reason: string;
|
|
1063
|
+
});
|
|
1064
|
+
}
|
|
1065
|
+
//#endregion
|
|
1066
|
+
//#region src/errors/ProjectIdentityError.d.ts
|
|
1067
|
+
/**
|
|
1068
|
+
* One source the resolver tried while looking for project identity.
|
|
1069
|
+
*
|
|
1070
|
+
* `source` is a stable label (`"explicit"`, `"toml"`, `"git-remote"`,
|
|
1071
|
+
* `"package-repository"`, `"package-name"`) the error message and
|
|
1072
|
+
* downstream tooling can switch on. `reason` explains why the source
|
|
1073
|
+
* didn't produce a value (e.g., "not configured", "git command failed",
|
|
1074
|
+
* "URL canonicalization rejected the value").
|
|
1075
|
+
* @public
|
|
1076
|
+
*/
|
|
1077
|
+
interface ProjectIdentityCandidate {
|
|
1078
|
+
readonly source: string;
|
|
1079
|
+
readonly reason: string;
|
|
1080
|
+
}
|
|
1081
|
+
declare const ProjectIdentityNotResolvableError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
1082
|
+
readonly _tag: "ProjectIdentityNotResolvableError";
|
|
1083
|
+
} & Readonly<A>;
|
|
1084
|
+
/**
|
|
1085
|
+
* Raised at plugin / sidecar / MCP boot when the project's identity
|
|
1086
|
+
* cannot be resolved through the documented fallback chain. The error
|
|
1087
|
+
* carries the full list of attempted sources so the user knows which
|
|
1088
|
+
* lever to pull (set `projectId` explicitly, configure the TOML file,
|
|
1089
|
+
* add a git remote, or set `name` in `package.json`).
|
|
1090
|
+
*
|
|
1091
|
+
* Replaces the legacy `WorkspaceRootNotFoundError` for callers that
|
|
1092
|
+
* went through the new resolver.
|
|
1093
|
+
* @public
|
|
1094
|
+
*/
|
|
1095
|
+
declare class ProjectIdentityNotResolvableError extends ProjectIdentityNotResolvableError_base<{
|
|
1096
|
+
readonly tried: ReadonlyArray<ProjectIdentityCandidate>;
|
|
1097
|
+
}> {
|
|
1098
|
+
constructor(args: {
|
|
1099
|
+
readonly tried: ReadonlyArray<ProjectIdentityCandidate>;
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
//#endregion
|
|
1103
|
+
//#region src/errors/RunContextError.d.ts
|
|
1104
|
+
declare const GitCommandError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
1105
|
+
readonly _tag: "GitCommandError";
|
|
1106
|
+
} & Readonly<A>;
|
|
1107
|
+
/**
|
|
1108
|
+
* Surfaces unexpected git-command failures from `RunContext`. Expected
|
|
1109
|
+
* non-zero exits (e.g., "not a git repository") are absorbed via
|
|
1110
|
+
* `Effect.option` and surface as `null` columns — they are not errors.
|
|
1111
|
+
* This error is reserved for "the executable is missing" /
|
|
1112
|
+
* "permission denied" / other system-level failures the caller cannot
|
|
1113
|
+
* meaningfully recover from.
|
|
1114
|
+
* @public
|
|
1115
|
+
*/
|
|
1116
|
+
declare class GitCommandError extends GitCommandError_base<{
|
|
1117
|
+
readonly command: string;
|
|
1118
|
+
readonly reason: string;
|
|
1119
|
+
}> {
|
|
1120
|
+
constructor(args: {
|
|
1121
|
+
readonly command: string;
|
|
1122
|
+
readonly reason: string;
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
declare const ProbeMissError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
|
|
1126
|
+
readonly _tag: "ProbeMissError";
|
|
1127
|
+
} & Readonly<A>;
|
|
1128
|
+
/**
|
|
1129
|
+
* Internal probe miss — consumed by `Effect.firstSuccessOf` /
|
|
1130
|
+
* `Effect.orElse` inside the host-metadata probe chain. Never surfaces
|
|
1131
|
+
* to the caller of `RunContext.captureRunContext`; the public API
|
|
1132
|
+
* always returns a complete `RunContext` (with NULLs for missed
|
|
1133
|
+
* probes).
|
|
1134
|
+
* @internal
|
|
1135
|
+
*/
|
|
1136
|
+
declare class ProbeMissError extends ProbeMissError_base<{
|
|
1137
|
+
readonly probe: string;
|
|
1138
|
+
}> {}
|
|
1139
|
+
//#endregion
|
|
1140
|
+
//#region src/formatters/ci-annotations.d.ts
|
|
1141
|
+
/** @public */
|
|
1142
|
+
declare const ciAnnotationsFormatter: Formatter;
|
|
1143
|
+
//#endregion
|
|
1144
|
+
//#region src/formatters/gfm.d.ts
|
|
1145
|
+
/** @public */
|
|
1146
|
+
declare const GfmFormatter: Formatter;
|
|
1147
|
+
//#endregion
|
|
1148
|
+
//#region src/formatters/json.d.ts
|
|
1149
|
+
/** @public */
|
|
1150
|
+
declare const JsonFormatter: Formatter;
|
|
1151
|
+
//#endregion
|
|
1152
|
+
//#region src/formatters/markdown.d.ts
|
|
1153
|
+
/**
|
|
1154
|
+
* Markdown formatter for surfaces that *render* markdown.
|
|
1155
|
+
*
|
|
1156
|
+
* Stdout output goes through {@link TerminalFormatter} (plain text +
|
|
1157
|
+
* ANSI), not this formatter — markdown syntax (e.g. heading prefixes,
|
|
1158
|
+
* backticks, list dashes) is visual noise in a terminal that doesn't
|
|
1159
|
+
* render it. This formatter remains for callers that explicitly request
|
|
1160
|
+
* `format: "markdown"`, e.g. when piping the rendered output into a
|
|
1161
|
+
* Markdown-aware sink.
|
|
1162
|
+
* @public
|
|
1163
|
+
*/
|
|
1164
|
+
declare const MarkdownFormatter: Formatter;
|
|
1165
|
+
//#endregion
|
|
1166
|
+
//#region src/formatters/silent.d.ts
|
|
1167
|
+
/** @public */
|
|
1168
|
+
declare const SilentFormatter: Formatter;
|
|
1169
|
+
//#endregion
|
|
1170
|
+
//#region src/formatters/terminal.d.ts
|
|
1171
|
+
/** @public */
|
|
1172
|
+
declare const TerminalFormatter: Formatter;
|
|
1173
|
+
//#endregion
|
|
1174
|
+
//#region src/schemas/Config.d.ts
|
|
1175
|
+
declare const VitestAgentConfig_base: Schema.Class<VitestAgentConfig, {
|
|
1176
|
+
cacheDir: Schema.optional<typeof Schema.String>;
|
|
1177
|
+
projectKey: Schema.optional<typeof Schema.String>;
|
|
1178
|
+
}, Schema.Struct.Encoded<{
|
|
1179
|
+
cacheDir: Schema.optional<typeof Schema.String>;
|
|
1180
|
+
projectKey: Schema.optional<typeof Schema.String>;
|
|
1181
|
+
}>, never, {
|
|
1182
|
+
readonly cacheDir?: string | undefined;
|
|
1183
|
+
} & {
|
|
1184
|
+
readonly projectKey?: string | undefined;
|
|
1185
|
+
}, {}, {}>;
|
|
1186
|
+
/**
|
|
1187
|
+
* Schema for the optional `vitest-agent.config.toml` file.
|
|
1188
|
+
*
|
|
1189
|
+
* Both fields are optional. When the file is absent or these fields are
|
|
1190
|
+
* unset, `resolveDataPath` falls back to deriving the path from the
|
|
1191
|
+
* workspace's `package.json` `name` under the XDG data directory.
|
|
1192
|
+
*
|
|
1193
|
+
* Fields:
|
|
1194
|
+
* - `cacheDir` — absolute path overriding the entire data directory. Highest
|
|
1195
|
+
* precedence after the programmatic option. Use this to relocate the SQLite
|
|
1196
|
+
* database (e.g. project-local `.vitest-agent/`) instead of the
|
|
1197
|
+
* default XDG location.
|
|
1198
|
+
* - `projectKey` — overrides the workspace key segment under the XDG data
|
|
1199
|
+
* directory. Use this when two unrelated projects on the same machine
|
|
1200
|
+
* share a `package.json` `name` (the collision case for workspace-name
|
|
1201
|
+
* keying), or when you want a stable key independent of `name` changes.
|
|
1202
|
+
* @public
|
|
1203
|
+
*/
|
|
1204
|
+
declare class VitestAgentConfig extends VitestAgentConfig_base {}
|
|
1205
|
+
//#endregion
|
|
1206
|
+
//#region src/services/Config.d.ts
|
|
1207
|
+
/**
|
|
1208
|
+
* Service shape that `ConfigLive(projectDir)` provides to downstream
|
|
1209
|
+
* consumers. Re-exported so callers can spell out the concrete service
|
|
1210
|
+
* type without referencing the `ConfigFileService<A>` generic directly.
|
|
1211
|
+
* @public
|
|
1212
|
+
*/
|
|
1213
|
+
type VitestAgentConfigFileService = ConfigFileService<VitestAgentConfig>;
|
|
1214
|
+
/**
|
|
1215
|
+
* Typed `Context.Tag` for the vitest-agent config file service.
|
|
1216
|
+
*
|
|
1217
|
+
* Both runtime packages (reporter, MCP) yield this tag to access the loaded
|
|
1218
|
+
* `VitestAgentConfig`. The live layer is built per `projectDir` via
|
|
1219
|
+
* `ConfigLive(projectDir)`.
|
|
1220
|
+
* @public
|
|
1221
|
+
*/
|
|
1222
|
+
declare const VitestAgentConfigFile: import("effect/Context").Tag<ConfigFileService<VitestAgentConfig>, ConfigFileService<VitestAgentConfig>>;
|
|
1223
|
+
//#endregion
|
|
1224
|
+
//#region src/layers/ConfigLive.d.ts
|
|
1225
|
+
/**
|
|
1226
|
+
* Build the live `ConfigFile` layer for a given project directory.
|
|
1227
|
+
*
|
|
1228
|
+
* Resolves the optional `vitest-agent.config.toml` from (in order):
|
|
1229
|
+
*
|
|
1230
|
+
* 1. The workspace root (when `projectDir` is inside a pnpm/npm/yarn workspace).
|
|
1231
|
+
* 2. The git repository root (when `projectDir` is inside a git repo).
|
|
1232
|
+
* 3. Walking upward from `projectDir`.
|
|
1233
|
+
*
|
|
1234
|
+
* The first found file wins (`FirstMatch` strategy). If no file is present,
|
|
1235
|
+
* downstream callers use `loadOrDefault(new VitestAgentConfig({}))`
|
|
1236
|
+
* to get an empty config.
|
|
1237
|
+
*
|
|
1238
|
+
* @param projectDir - Absolute path inside the user's workspace. Resolvers
|
|
1239
|
+
* anchor here rather than `process.cwd()` so the plugin-spawned MCP server
|
|
1240
|
+
* sees the right config even when invoked from elsewhere.
|
|
1241
|
+
* @public
|
|
1242
|
+
*/
|
|
1243
|
+
declare const ConfigLive: (projectDir: string) => Layer.Layer<VitestAgentConfigFileService, never, FileSystem.FileSystem>;
|
|
1244
|
+
//#endregion
|
|
1245
|
+
//#region src/layers/DataReaderLive.d.ts
|
|
1246
|
+
/** @public */
|
|
1247
|
+
declare const DataReaderLive: Layer.Layer<DataReader, never, SqlClient>;
|
|
1248
|
+
//#endregion
|
|
1249
|
+
//#region src/layers/DataStoreLive.d.ts
|
|
1250
|
+
/** @public */
|
|
1251
|
+
declare const DataStoreLive: Layer.Layer<DataStore, never, SqlClient>;
|
|
1252
|
+
//#endregion
|
|
1253
|
+
//#region src/services/DetailResolver.d.ts
|
|
1254
|
+
/** @public */
|
|
1255
|
+
interface RunHealth {
|
|
1256
|
+
readonly hasFailures: boolean;
|
|
1257
|
+
readonly belowTargets: boolean;
|
|
1258
|
+
readonly hasTargets?: boolean;
|
|
1259
|
+
}
|
|
1260
|
+
declare const DetailResolver_base: Context.TagClass<DetailResolver, "vitest-agent/DetailResolver", {
|
|
1261
|
+
readonly resolve: (executor: Executor, health: RunHealth, explicit?: DetailLevel) => Effect.Effect<DetailLevel>;
|
|
1262
|
+
}>;
|
|
1263
|
+
/** @public */
|
|
1264
|
+
declare class DetailResolver extends DetailResolver_base {}
|
|
1265
|
+
//#endregion
|
|
1266
|
+
//#region src/layers/DetailResolverLive.d.ts
|
|
1267
|
+
/** @public */
|
|
1268
|
+
declare const DetailResolverLive: Layer.Layer<DetailResolver, never, never>;
|
|
1269
|
+
//#endregion
|
|
1270
|
+
//#region src/services/DiscoveryRegistry.d.ts
|
|
1271
|
+
/**
|
|
1272
|
+
* Input for upserting a known project into the global discovery registry.
|
|
1273
|
+
*
|
|
1274
|
+
* @public
|
|
1275
|
+
*/
|
|
1276
|
+
interface KnownProjectInput {
|
|
1277
|
+
readonly projectKey: string;
|
|
1278
|
+
readonly canonicalForm: string;
|
|
1279
|
+
readonly dataDbPath: string;
|
|
1280
|
+
readonly gitRemoteOrigin: string | null;
|
|
1281
|
+
readonly workspaceRoot: string;
|
|
1282
|
+
}
|
|
1283
|
+
/**
|
|
1284
|
+
* A project record as stored in the global discovery registry.
|
|
1285
|
+
*
|
|
1286
|
+
* @public
|
|
1287
|
+
*/
|
|
1288
|
+
interface KnownProject {
|
|
1289
|
+
readonly projectKey: string;
|
|
1290
|
+
readonly canonicalForm: string;
|
|
1291
|
+
readonly dataDbPath: string;
|
|
1292
|
+
readonly gitRemoteOrigin: string | null;
|
|
1293
|
+
readonly workspaceRoot: string;
|
|
1294
|
+
readonly firstSeenAt: number;
|
|
1295
|
+
readonly lastSeenAt: number;
|
|
1296
|
+
}
|
|
1297
|
+
declare const DiscoveryRegistry_base: Context.TagClass<DiscoveryRegistry, "vitest-agent/DiscoveryRegistry", {
|
|
1298
|
+
/**
|
|
1299
|
+
* Upsert this project into the registry. Sets `first_seen_at` on
|
|
1300
|
+
* insert; updates `last_seen_at` plus all mutable fields on
|
|
1301
|
+
* conflict. Returns nothing — the call is fire-and-observe.
|
|
1302
|
+
*/
|
|
1303
|
+
readonly recordProject: (input: KnownProjectInput) => Effect.Effect<void, DataStoreError>;
|
|
1304
|
+
/**
|
|
1305
|
+
* List all projects ordered by most recent activity first. Used by
|
|
1306
|
+
* cross-project discovery tooling.
|
|
1307
|
+
*/
|
|
1308
|
+
readonly listProjects: () => Effect.Effect<ReadonlyArray<KnownProject>, DataStoreError>;
|
|
1309
|
+
/**
|
|
1310
|
+
* Drop registry rows whose `last_seen_at` is older than `maxAgeDays`
|
|
1311
|
+
* days ago. The corresponding `data.db` files are NOT deleted; only
|
|
1312
|
+
* the index entry is pruned. Returns the count of removed rows.
|
|
1313
|
+
*/
|
|
1314
|
+
readonly prune: (maxAgeDays: number) => Effect.Effect<number, DataStoreError>;
|
|
1315
|
+
}>;
|
|
1316
|
+
/** @public */
|
|
1317
|
+
declare class DiscoveryRegistry extends DiscoveryRegistry_base {}
|
|
1318
|
+
//#endregion
|
|
1319
|
+
//#region src/layers/DiscoveryRegistryLive.d.ts
|
|
1320
|
+
/** @public */
|
|
1321
|
+
declare const DiscoveryRegistryLive: Layer.Layer<DiscoveryRegistry, never, SqlClient>;
|
|
1322
|
+
//#endregion
|
|
1323
|
+
//#region src/services/EnvironmentDetector.d.ts
|
|
1324
|
+
declare const EnvironmentDetector_base: Context.TagClass<EnvironmentDetector, "vitest-agent/EnvironmentDetector", {
|
|
1325
|
+
readonly detect: () => Effect.Effect<Environment>;
|
|
1326
|
+
readonly isAgent: Effect.Effect<boolean>;
|
|
1327
|
+
readonly agentName: Effect.Effect<string | undefined>;
|
|
1328
|
+
}>;
|
|
1329
|
+
/** @public */
|
|
1330
|
+
declare class EnvironmentDetector extends EnvironmentDetector_base {}
|
|
1331
|
+
//#endregion
|
|
1332
|
+
//#region src/layers/EnvironmentDetectorLive.d.ts
|
|
1333
|
+
/** @public */
|
|
1334
|
+
declare const EnvironmentDetectorLive: Layer.Layer<EnvironmentDetector>;
|
|
1335
|
+
//#endregion
|
|
1336
|
+
//#region src/layers/EnvironmentDetectorTest.d.ts
|
|
1337
|
+
/** @public */
|
|
1338
|
+
declare const EnvironmentDetectorTest: {
|
|
1339
|
+
layer: (env?: Environment) => Layer.Layer<EnvironmentDetector, never, never>;
|
|
1340
|
+
};
|
|
1341
|
+
//#endregion
|
|
1342
|
+
//#region src/services/ExecutorResolver.d.ts
|
|
1343
|
+
declare const ExecutorResolver_base: Context.TagClass<ExecutorResolver, "vitest-agent/ExecutorResolver", {
|
|
1344
|
+
readonly resolve: (env: Environment) => Effect.Effect<Executor>;
|
|
1345
|
+
}>;
|
|
1346
|
+
/** @public */
|
|
1347
|
+
declare class ExecutorResolver extends ExecutorResolver_base {}
|
|
1348
|
+
//#endregion
|
|
1349
|
+
//#region src/layers/ExecutorResolverLive.d.ts
|
|
1350
|
+
/** @public */
|
|
1351
|
+
declare const ExecutorResolverLive: Layer.Layer<ExecutorResolver, never, never>;
|
|
1352
|
+
//#endregion
|
|
1353
|
+
//#region src/services/FormatSelector.d.ts
|
|
1354
|
+
declare const FormatSelector_base: Context.TagClass<FormatSelector, "vitest-agent/FormatSelector", {
|
|
1355
|
+
readonly select: (executor: Executor, explicitFormat?: OutputFormat, environment?: Environment) => Effect.Effect<OutputFormat>;
|
|
1356
|
+
}>;
|
|
1357
|
+
/** @public */
|
|
1358
|
+
declare class FormatSelector extends FormatSelector_base {}
|
|
1359
|
+
//#endregion
|
|
1360
|
+
//#region src/layers/FormatSelectorLive.d.ts
|
|
1361
|
+
/**
|
|
1362
|
+
* Default format dispatch:
|
|
1363
|
+
*
|
|
1364
|
+
* - GitHub Actions CI executor: `ci-annotations` (renders as `::error::`).
|
|
1365
|
+
* - Human executor: `silent` (Vitest's own reporters handle the user
|
|
1366
|
+
* experience; we just write to the database).
|
|
1367
|
+
* - Anyone else (agent-shell, terminal-bound CI): `terminal` — plain
|
|
1368
|
+
* text + ANSI color, no markdown syntax in the place that doesn't
|
|
1369
|
+
* render it. Markdown stays available via explicit `format: "markdown"`
|
|
1370
|
+
* for surfaces that *do* render it (MCP tools, GitHub step summary).
|
|
1371
|
+
* @public
|
|
1372
|
+
*/
|
|
1373
|
+
declare const FormatSelectorLive: Layer.Layer<FormatSelector, never, never>;
|
|
1374
|
+
//#endregion
|
|
1375
|
+
//#region src/services/HistoryTracker.d.ts
|
|
1376
|
+
/**
|
|
1377
|
+
* Lightweight test outcome for history classification.
|
|
1378
|
+
* @public
|
|
1379
|
+
*/
|
|
1380
|
+
interface TestOutcome {
|
|
1381
|
+
readonly fullName: string;
|
|
1382
|
+
readonly state: "passed" | "failed";
|
|
1383
|
+
}
|
|
1384
|
+
declare const HistoryTracker_base: Context.TagClass<HistoryTracker, "vitest-agent/HistoryTracker", {
|
|
1385
|
+
readonly classify: (project: string, testOutcomes: ReadonlyArray<TestOutcome>, timestamp: string) => Effect.Effect<{
|
|
1386
|
+
history: HistoryRecord;
|
|
1387
|
+
classifications: Map<string, TestClassification>;
|
|
1388
|
+
}, DataStoreError>;
|
|
1389
|
+
}>;
|
|
1390
|
+
/** @public */
|
|
1391
|
+
declare class HistoryTracker extends HistoryTracker_base {}
|
|
1392
|
+
//#endregion
|
|
1393
|
+
//#region src/layers/HistoryTrackerLive.d.ts
|
|
1394
|
+
/** @public */
|
|
1395
|
+
declare const HistoryTrackerLive: Layer.Layer<HistoryTracker, never, DataReader>;
|
|
1396
|
+
//#endregion
|
|
1397
|
+
//#region src/layers/HistoryTrackerTest.d.ts
|
|
1398
|
+
/** @public */
|
|
1399
|
+
interface HistoryTrackerTestState {
|
|
1400
|
+
readonly classifyCalls: Array<{
|
|
1401
|
+
project: string;
|
|
1402
|
+
timestamp: string;
|
|
1403
|
+
}>;
|
|
1404
|
+
}
|
|
1405
|
+
/** @public */
|
|
1406
|
+
declare const HistoryTrackerTest: {
|
|
1407
|
+
readonly empty: () => HistoryTrackerTestState;
|
|
1408
|
+
readonly layer: (state: HistoryTrackerTestState, cannedResult?: {
|
|
1409
|
+
history: HistoryRecord;
|
|
1410
|
+
classifications: Map<string, TestClassification>;
|
|
1411
|
+
}) => Layer.Layer<HistoryTracker>;
|
|
1412
|
+
};
|
|
1413
|
+
//#endregion
|
|
1414
|
+
//#region src/layers/LoggerLive.d.ts
|
|
1415
|
+
/**
|
|
1416
|
+
* Create a structured JSON (NDJSON) logger layer for stderr.
|
|
1417
|
+
*
|
|
1418
|
+
* When level is undefined or LogLevel.None, replaces the default logger with Logger.none (silent).
|
|
1419
|
+
* When logFile is set, composes with a file logger via Logger.zip.
|
|
1420
|
+
* Uses Logger.structuredLogger serialized to JSON for machine-readable output.
|
|
1421
|
+
* @public
|
|
1422
|
+
*/
|
|
1423
|
+
declare const LoggerLive: (level?: LogLevel.LogLevel, logFile?: string) => Layer.Layer<never>;
|
|
1424
|
+
/** @public */
|
|
1425
|
+
declare function resolveLogLevel(option?: string): LogLevel.LogLevel | undefined;
|
|
1426
|
+
/**
|
|
1427
|
+
* Resolve log file from option or environment variable.
|
|
1428
|
+
* @public
|
|
1429
|
+
*/
|
|
1430
|
+
declare function resolveLogFile(option?: string): string | undefined;
|
|
1431
|
+
//#endregion
|
|
1432
|
+
//#region src/layers/OutputPipelineLive.d.ts
|
|
1433
|
+
/** @public */
|
|
1434
|
+
declare const OutputPipelineLive: Layer.Layer<EnvironmentDetector | DetailResolver | ExecutorResolver | FormatSelector | OutputRenderer, never, never>;
|
|
1435
|
+
//#endregion
|
|
1436
|
+
//#region src/services/OutputRenderer.d.ts
|
|
1437
|
+
declare const OutputRenderer_base: Context.TagClass<OutputRenderer, "vitest-agent/OutputRenderer", {
|
|
1438
|
+
readonly render: (reports: ReadonlyArray<AgentReport>, format: OutputFormat, context: FormatterContext) => Effect.Effect<ReadonlyArray<RenderedOutput>>;
|
|
1439
|
+
}>;
|
|
1440
|
+
/** @public */
|
|
1441
|
+
declare class OutputRenderer extends OutputRenderer_base {}
|
|
1442
|
+
//#endregion
|
|
1443
|
+
//#region src/layers/OutputRendererLive.d.ts
|
|
1444
|
+
/** @public */
|
|
1445
|
+
declare const OutputRendererLive: Layer.Layer<OutputRenderer, never, never>;
|
|
1446
|
+
//#endregion
|
|
1447
|
+
//#region src/layers/PathResolutionLive.d.ts
|
|
1448
|
+
/**
|
|
1449
|
+
* Composite layer providing every service `resolveDataPath` requires:
|
|
1450
|
+
* `AppDirs` (XDG path resolution), `VitestAgentConfigFile` (TOML
|
|
1451
|
+
* config loader), `WorkspaceDiscovery` and `WorkspaceRoot` (workspace name
|
|
1452
|
+
* lookup).
|
|
1453
|
+
*
|
|
1454
|
+
* Callers still need to provide `FileSystem` and `Path` from
|
|
1455
|
+
* `@effect/platform-node`'s `NodeContext.layer` (or the equivalent on Bun).
|
|
1456
|
+
*
|
|
1457
|
+
* @param projectDir - Absolute path inside the user's workspace, used to
|
|
1458
|
+
* anchor the config file resolvers.
|
|
1459
|
+
* @public
|
|
1460
|
+
*/
|
|
1461
|
+
declare const PathResolutionLive: (projectDir: string) => Layer.Layer<VitestAgentConfigFileService | import("workspaces-effect").WorkspaceDiscovery | import("xdg-effect").XdgResolver | import("xdg-effect").AppDirs, never, import("@effect/platform/FileSystem").FileSystem | import("@effect/platform/Path").Path>;
|
|
1462
|
+
//#endregion
|
|
1463
|
+
//#region src/services/PerClientSessionMap.d.ts
|
|
1464
|
+
/** @public */
|
|
1465
|
+
interface MapSessionInput {
|
|
1466
|
+
readonly hostSessionId: string;
|
|
1467
|
+
readonly conversationId: string;
|
|
1468
|
+
readonly projectKey: string;
|
|
1469
|
+
readonly projectDir: string;
|
|
1470
|
+
}
|
|
1471
|
+
/** @public */
|
|
1472
|
+
interface MapSessionOutput {
|
|
1473
|
+
readonly mainAgentId: string;
|
|
1474
|
+
readonly conversationId: string;
|
|
1475
|
+
}
|
|
1476
|
+
/** @public */
|
|
1477
|
+
interface SessionContextRow {
|
|
1478
|
+
readonly hostSessionId: string;
|
|
1479
|
+
readonly conversationId: string;
|
|
1480
|
+
readonly projectKey: string;
|
|
1481
|
+
readonly projectDir: string;
|
|
1482
|
+
readonly mainAgentId: string;
|
|
1483
|
+
readonly startedAt: number;
|
|
1484
|
+
readonly endedAt: number | null;
|
|
1485
|
+
}
|
|
1486
|
+
declare const PerClientSessionMapReader_base: Context.TagClass<PerClientSessionMapReader, "vitest-agent/PerClientSessionMapReader", {
|
|
1487
|
+
/**
|
|
1488
|
+
* Look up an existing conversation_id for a given transcript
|
|
1489
|
+
* path. Returns `Option.none()` when the transcript hasn't been
|
|
1490
|
+
* seen before. Read-only — does not insert.
|
|
1491
|
+
*/
|
|
1492
|
+
readonly lookupConversation: (transcriptPath: string) => Effect.Effect<Option.Option<string>, DataStoreError>;
|
|
1493
|
+
/**
|
|
1494
|
+
* Return the most recent open session for a project_dir
|
|
1495
|
+
* (`ended_at IS NULL`). The MCP server uses this to recover
|
|
1496
|
+
* `currentSessionContext` after `/reload-plugins`. The compound
|
|
1497
|
+
* index `idx_session_map_active` covers the predicate.
|
|
1498
|
+
*/
|
|
1499
|
+
readonly lookupByProjectDir: (projectDir: string) => Effect.Effect<Option.Option<SessionContextRow>, DataStoreError>;
|
|
1500
|
+
}>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Read-only side of the session map.
|
|
1503
|
+
*
|
|
1504
|
+
* Provided by `PerClientSessionMapReaderLive` (opens SQLite with
|
|
1505
|
+
* `?mode=ro`). MCP server depends on this tag — calls to write
|
|
1506
|
+
* methods would be a type error.
|
|
1507
|
+
* @public
|
|
1508
|
+
*/
|
|
1509
|
+
declare class PerClientSessionMapReader extends PerClientSessionMapReader_base {}
|
|
1510
|
+
declare const PerClientSessionMapWriter_base: Context.TagClass<PerClientSessionMapWriter, "vitest-agent/PerClientSessionMapWriter", {
|
|
1511
|
+
/**
|
|
1512
|
+
* Upsert a conversation row. Returns the canonical conversation_id
|
|
1513
|
+
* for the given transcript_path (existing if seen before, freshly
|
|
1514
|
+
* generated otherwise).
|
|
1515
|
+
*/
|
|
1516
|
+
readonly mapConversation: (transcriptPath: string) => Effect.Effect<string, DataStoreError>;
|
|
1517
|
+
/**
|
|
1518
|
+
* Upsert a session row. Returns the canonical main_agent_id and
|
|
1519
|
+
* conversation_id (existing if `host_session_id` was seen before,
|
|
1520
|
+
* freshly generated otherwise).
|
|
1521
|
+
*
|
|
1522
|
+
* The caller is responsible for having already mapped the
|
|
1523
|
+
* conversation; this method only records the
|
|
1524
|
+
* (host_session_id, conversation_id, project) tuple.
|
|
1525
|
+
*/
|
|
1526
|
+
readonly mapSession: (input: MapSessionInput) => Effect.Effect<MapSessionOutput, DataStoreError>;
|
|
1527
|
+
/**
|
|
1528
|
+
* Mark a session as ended. Sets `ended_at` to the supplied
|
|
1529
|
+
* timestamp. No-op if the session is unknown — endSession is
|
|
1530
|
+
* best-effort cleanup.
|
|
1531
|
+
*/
|
|
1532
|
+
readonly endSession: (hostSessionId: string, endedAt: number) => Effect.Effect<void, DataStoreError>;
|
|
1533
|
+
/**
|
|
1534
|
+
* Read methods so the Writer also satisfies the Reader tag's
|
|
1535
|
+
* surface.
|
|
1536
|
+
*/
|
|
1537
|
+
readonly lookupConversation: (transcriptPath: string) => Effect.Effect<Option.Option<string>, DataStoreError>;
|
|
1538
|
+
readonly lookupByProjectDir: (projectDir: string) => Effect.Effect<Option.Option<SessionContextRow>, DataStoreError>;
|
|
1539
|
+
}>;
|
|
1540
|
+
/**
|
|
1541
|
+
* Read-write side of the session map. Sidecar provides this; the
|
|
1542
|
+
* Writer layer also satisfies the Reader tag so consumers of either
|
|
1543
|
+
* one resolve.
|
|
1544
|
+
* @public
|
|
1545
|
+
*/
|
|
1546
|
+
declare class PerClientSessionMapWriter extends PerClientSessionMapWriter_base {}
|
|
1547
|
+
//#endregion
|
|
1548
|
+
//#region src/layers/PerClientSessionMapLive.d.ts
|
|
1549
|
+
/**
|
|
1550
|
+
* Read-only layer. The entry point provides an `SqlClient` configured
|
|
1551
|
+
* with the `?mode=ro` URI parameter; this layer wraps the read
|
|
1552
|
+
* methods and never declares write methods.
|
|
1553
|
+
* @public
|
|
1554
|
+
*/
|
|
1555
|
+
declare const PerClientSessionMapReaderLive: Layer.Layer<PerClientSessionMapReader, never, SqlClient>;
|
|
1556
|
+
/**
|
|
1557
|
+
* Read-write layer. Provides both write methods and the Reader's read
|
|
1558
|
+
* methods so the same layer instance satisfies callers of either
|
|
1559
|
+
* tag.
|
|
1560
|
+
* @public
|
|
1561
|
+
*/
|
|
1562
|
+
declare const PerClientSessionMapWriterLive: Layer.Layer<PerClientSessionMapWriter | PerClientSessionMapReader, never, SqlClient>;
|
|
1563
|
+
//#endregion
|
|
1564
|
+
//#region src/services/ProjectDiscovery.d.ts
|
|
1565
|
+
/** @public */
|
|
1566
|
+
interface TestFileEntry {
|
|
1567
|
+
readonly testFile: string;
|
|
1568
|
+
readonly sourceFiles: ReadonlyArray<string>;
|
|
1569
|
+
}
|
|
1570
|
+
declare const ProjectDiscovery_base: Context.TagClass<ProjectDiscovery, "vitest-agent/ProjectDiscovery", {
|
|
1571
|
+
readonly discoverTestFiles: (rootDir: string) => Effect.Effect<ReadonlyArray<TestFileEntry>, DiscoveryError>;
|
|
1572
|
+
readonly mapTestToSource: (testFile: string) => Effect.Effect<ReadonlyArray<string>, DiscoveryError>;
|
|
1573
|
+
}>;
|
|
1574
|
+
/** @public */
|
|
1575
|
+
declare class ProjectDiscovery extends ProjectDiscovery_base {}
|
|
1576
|
+
//#endregion
|
|
1577
|
+
//#region src/layers/ProjectDiscoveryLive.d.ts
|
|
1578
|
+
/** @public */
|
|
1579
|
+
declare const ProjectDiscoveryLive: Layer.Layer<ProjectDiscovery, never, FileSystem.FileSystem>;
|
|
1580
|
+
//#endregion
|
|
1581
|
+
//#region src/layers/ProjectDiscoveryTest.d.ts
|
|
1582
|
+
/** @public */
|
|
1583
|
+
declare const ProjectDiscoveryTest: {
|
|
1584
|
+
readonly layer: (entries: ReadonlyArray<TestFileEntry>) => Layer.Layer<ProjectDiscovery>;
|
|
1585
|
+
};
|
|
1586
|
+
//#endregion
|
|
1587
|
+
//#region src/services/ProjectIdentity.d.ts
|
|
1588
|
+
/**
|
|
1589
|
+
* Result of a successful identity resolution.
|
|
1590
|
+
*
|
|
1591
|
+
* - `projectKey` — filesystem-safe single segment for the per-project
|
|
1592
|
+
* data store directory under `$XDG_DATA_HOME/vitest-agent/`.
|
|
1593
|
+
* - `canonicalForm` — human-readable form for display in the discovery
|
|
1594
|
+
* registry. Equal to `projectKey` for non-git sources; for git
|
|
1595
|
+
* sources, the original `host/path` shape (with slashes preserved).
|
|
1596
|
+
* - `source` — which source matched. Useful for diagnostics and the
|
|
1597
|
+
* `vitest-agent doctor`-style commands.
|
|
1598
|
+
* @public
|
|
1599
|
+
*/
|
|
1600
|
+
interface ResolvedIdentity {
|
|
1601
|
+
readonly projectKey: string;
|
|
1602
|
+
readonly canonicalForm: string;
|
|
1603
|
+
readonly source: ProjectIdentitySource;
|
|
1604
|
+
}
|
|
1605
|
+
/** @public */
|
|
1606
|
+
type ProjectIdentitySource = "explicit" | "toml" | "git-remote" | "package-repository" | "package-name";
|
|
1607
|
+
/**
|
|
1608
|
+
* Per-source candidate values. Each is optional — an absent or empty
|
|
1609
|
+
* value causes the resolver to fall through to the next source.
|
|
1610
|
+
*
|
|
1611
|
+
* The Live layer collects these from real I/O (config file, git
|
|
1612
|
+
* subprocess, `package.json` read). Tests pass a literal object.
|
|
1613
|
+
* @public
|
|
1614
|
+
*/
|
|
1615
|
+
interface ProjectIdentityCandidates {
|
|
1616
|
+
readonly explicit?: string;
|
|
1617
|
+
readonly toml?: string;
|
|
1618
|
+
readonly gitRemote?: string;
|
|
1619
|
+
readonly packageJsonRepoUrl?: string;
|
|
1620
|
+
readonly packageJsonName?: string;
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Options accepted by the `ProjectIdentity.resolve` service method.
|
|
1624
|
+
*
|
|
1625
|
+
* `projectId` is the priority-1 escape hatch — pass when the user has
|
|
1626
|
+
* configured `AgentPlugin({ projectId: "..." })` in `vitest.config.ts`.
|
|
1627
|
+
* @public
|
|
1628
|
+
*/
|
|
1629
|
+
interface ResolveProjectIdentityOptions {
|
|
1630
|
+
readonly projectId?: string;
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Pure priority resolver. Returns `null` when no candidate produces a
|
|
1634
|
+
* usable value — the caller wraps `null` into a tagged error.
|
|
1635
|
+
*
|
|
1636
|
+
* For non-git sources the `canonicalForm` equals the original
|
|
1637
|
+
* (un-normalized) input so the discovery registry can display
|
|
1638
|
+
* `@spencerbeggs/vitest-agent` rather than the underscored form. For
|
|
1639
|
+
* git sources, `canonicalForm` is the slash-preserving `host/path`
|
|
1640
|
+
* shape from `canonicalizeGitUrl`.
|
|
1641
|
+
* @public
|
|
1642
|
+
*/
|
|
1643
|
+
declare const resolveProjectIdentityFromCandidates: (candidates: ProjectIdentityCandidates) => ResolvedIdentity | null;
|
|
1644
|
+
declare const ProjectIdentity_base: Context.TagClass<ProjectIdentity, "vitest-agent/ProjectIdentity", {
|
|
1645
|
+
readonly resolve: (workspaceRoot: string, options?: ResolveProjectIdentityOptions) => Effect.Effect<ResolvedIdentity, ProjectIdentityNotResolvableError>;
|
|
1646
|
+
}>;
|
|
1647
|
+
/**
|
|
1648
|
+
* Service tag. The Live layer (in `layers/ProjectIdentityLive.ts`)
|
|
1649
|
+
* wires up the I/O sources; tests provide a stub that returns a
|
|
1650
|
+
* pre-built `ResolvedIdentity`.
|
|
1651
|
+
* @public
|
|
1652
|
+
*/
|
|
1653
|
+
declare class ProjectIdentity extends ProjectIdentity_base {}
|
|
1654
|
+
//#endregion
|
|
1655
|
+
//#region src/layers/ProjectIdentityLive.d.ts
|
|
1656
|
+
/**
|
|
1657
|
+
* Effect environment type required by `collectCandidates` and the
|
|
1658
|
+
* `ProjectIdentityLive` layer. Exported only so the layer's
|
|
1659
|
+
* `Layer.Layer<ProjectIdentity, never, CandidateContext>` signature
|
|
1660
|
+
* has a named referent — consumers should provide the four named
|
|
1661
|
+
* services (FileSystem, WorkspaceDiscovery, VitestAgentConfigFile,
|
|
1662
|
+
* CommandExecutor) rather than reference this type directly.
|
|
1663
|
+
*
|
|
1664
|
+
* @public
|
|
1665
|
+
*/
|
|
1666
|
+
type CandidateContext = FileSystem.FileSystem | WorkspaceDiscovery | Context.Tag.Identifier<typeof VitestAgentConfigFile> | CommandExecutor.CommandExecutor;
|
|
1667
|
+
/**
|
|
1668
|
+
* Live layer that wires the resolver into real I/O. Requires
|
|
1669
|
+
* `FileSystem`, `CommandExecutor`, `WorkspaceDiscovery`, and
|
|
1670
|
+
* `VitestAgentConfigFile`. The platform context comes from
|
|
1671
|
+
* `NodeContext.layer` at the entry point.
|
|
1672
|
+
* @public
|
|
1673
|
+
*/
|
|
1674
|
+
declare const ProjectIdentityLive: Layer.Layer<ProjectIdentity, never, CandidateContext>;
|
|
1675
|
+
/**
|
|
1676
|
+
* Build a Test layer that returns a fixed `ResolvedIdentity` (or
|
|
1677
|
+
* fails with `ProjectIdentityNotResolvableError`). Use in unit tests
|
|
1678
|
+
* that depend on `ProjectIdentity` but don't want to wire upstream
|
|
1679
|
+
* services.
|
|
1680
|
+
* @public
|
|
1681
|
+
*/
|
|
1682
|
+
declare const ProjectIdentityTest: (result: ResolvedIdentity | ProjectIdentityNotResolvableError) => Layer.Layer<ProjectIdentity, never, never>;
|
|
1683
|
+
//#endregion
|
|
1684
|
+
//#region src/services/RunContext.d.ts
|
|
1685
|
+
declare const RunContext_base: Schema.Class<RunContext, {
|
|
1686
|
+
gitBranch: Schema.NullOr<typeof Schema.String>;
|
|
1687
|
+
gitCommitSha: Schema.NullOr<typeof Schema.String>;
|
|
1688
|
+
gitDirty: Schema.NullOr<typeof Schema.Boolean>;
|
|
1689
|
+
gitUpstream: Schema.NullOr<typeof Schema.String>;
|
|
1690
|
+
gitWorktreeDir: Schema.NullOr<typeof Schema.String>;
|
|
1691
|
+
hostSource: Schema.NullOr<typeof Schema.String>;
|
|
1692
|
+
hostValue: Schema.NullOr<typeof Schema.String>;
|
|
1693
|
+
hostMetadata: Schema.NullOr<typeof Schema.Unknown>;
|
|
1694
|
+
}, Schema.Struct.Encoded<{
|
|
1695
|
+
gitBranch: Schema.NullOr<typeof Schema.String>;
|
|
1696
|
+
gitCommitSha: Schema.NullOr<typeof Schema.String>;
|
|
1697
|
+
gitDirty: Schema.NullOr<typeof Schema.Boolean>;
|
|
1698
|
+
gitUpstream: Schema.NullOr<typeof Schema.String>;
|
|
1699
|
+
gitWorktreeDir: Schema.NullOr<typeof Schema.String>;
|
|
1700
|
+
hostSource: Schema.NullOr<typeof Schema.String>;
|
|
1701
|
+
hostValue: Schema.NullOr<typeof Schema.String>;
|
|
1702
|
+
hostMetadata: Schema.NullOr<typeof Schema.Unknown>;
|
|
1703
|
+
}>, never, {
|
|
1704
|
+
readonly gitBranch: string | null;
|
|
1705
|
+
} & {
|
|
1706
|
+
readonly gitCommitSha: string | null;
|
|
1707
|
+
} & {
|
|
1708
|
+
readonly gitDirty: boolean | null;
|
|
1709
|
+
} & {
|
|
1710
|
+
readonly gitUpstream: string | null;
|
|
1711
|
+
} & {
|
|
1712
|
+
readonly gitWorktreeDir: string | null;
|
|
1713
|
+
} & {
|
|
1714
|
+
readonly hostSource: string | null;
|
|
1715
|
+
} & {
|
|
1716
|
+
readonly hostValue: string | null;
|
|
1717
|
+
} & {
|
|
1718
|
+
readonly hostMetadata: unknown;
|
|
1719
|
+
}, {}, {}>;
|
|
1720
|
+
/**
|
|
1721
|
+
* Per-run snapshot of the workspace's git state and host context.
|
|
1722
|
+
* Every field is nullable: a non-git workspace has all-NULL git
|
|
1723
|
+
* fields, a CI run with no terminal probe match has all-NULL host
|
|
1724
|
+
* fields, and a worker that can't read upstream info has a NULL
|
|
1725
|
+
* `gitUpstream` while everything else is set.
|
|
1726
|
+
*
|
|
1727
|
+
* Declared as a `Schema.Class` so callers can `new RunContext({...})`
|
|
1728
|
+
* and `Schema.encode(...)` for the SQLite row mapping.
|
|
1729
|
+
* @public
|
|
1730
|
+
*/
|
|
1731
|
+
declare class RunContext extends RunContext_base {}
|
|
1732
|
+
declare const AgentContext_base: Schema.Class<AgentContext, {
|
|
1733
|
+
startGitBranch: Schema.NullOr<typeof Schema.String>;
|
|
1734
|
+
startGitCommitSha: Schema.NullOr<typeof Schema.String>;
|
|
1735
|
+
startWorktreeDir: Schema.NullOr<typeof Schema.String>;
|
|
1736
|
+
}, Schema.Struct.Encoded<{
|
|
1737
|
+
startGitBranch: Schema.NullOr<typeof Schema.String>;
|
|
1738
|
+
startGitCommitSha: Schema.NullOr<typeof Schema.String>;
|
|
1739
|
+
startWorktreeDir: Schema.NullOr<typeof Schema.String>;
|
|
1740
|
+
}>, never, {
|
|
1741
|
+
readonly startGitBranch: string | null;
|
|
1742
|
+
} & {
|
|
1743
|
+
readonly startGitCommitSha: string | null;
|
|
1744
|
+
} & {
|
|
1745
|
+
readonly startWorktreeDir: string | null;
|
|
1746
|
+
}, {}, {}>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Subset of {@link RunContext} captured at agent registration. Only
|
|
1749
|
+
* the inheritable git context — branch, sha, worktree path. Mid-run
|
|
1750
|
+
* dirty-tree state and upstream tracking are per-run concerns.
|
|
1751
|
+
* @public
|
|
1752
|
+
*/
|
|
1753
|
+
declare class AgentContext extends AgentContext_base {}
|
|
1754
|
+
declare const RunContext$_base: Context.TagClass<RunContext$, "vitest-agent/RunContextService", {
|
|
1755
|
+
readonly captureRunContext: (cwd: string) => Effect.Effect<RunContext>;
|
|
1756
|
+
readonly captureAgentContext: (cwd: string) => Effect.Effect<AgentContext>;
|
|
1757
|
+
}>;
|
|
1758
|
+
/**
|
|
1759
|
+
* Service tag. The Live layer captures real I/O; the Test layer
|
|
1760
|
+
* returns whatever the test fixture passes.
|
|
1761
|
+
* @public
|
|
1762
|
+
*/
|
|
1763
|
+
declare class RunContext$ extends RunContext$_base {}
|
|
1764
|
+
/**
|
|
1765
|
+
* Re-export the service tag under a less-collision-prone name. The
|
|
1766
|
+
* `RunContext` Schema.Class above shares its symbol-name with the
|
|
1767
|
+
* service tag concept; the `$` suffix on the Context.Tag class name
|
|
1768
|
+
* keeps both addressable from the same module.
|
|
1769
|
+
*
|
|
1770
|
+
* @public
|
|
1771
|
+
*/
|
|
1772
|
+
declare const RunContextService: typeof RunContext$;
|
|
1773
|
+
/** @public */
|
|
1774
|
+
type RunContextService = RunContext$;
|
|
1775
|
+
//#endregion
|
|
1776
|
+
//#region src/layers/RunContextLive.d.ts
|
|
1777
|
+
/**
|
|
1778
|
+
* Live layer. Requires `CommandExecutor` (provided by
|
|
1779
|
+
* `NodeContext.layer` at the entry point). Reads `process.env`
|
|
1780
|
+
* directly for host-metadata probes — the env walk is pure but the
|
|
1781
|
+
* env source is process-global, captured once when the layer
|
|
1782
|
+
* constructs.
|
|
1783
|
+
* @public
|
|
1784
|
+
*/
|
|
1785
|
+
declare const RunContextLive: Layer.Layer<RunContextService, never, CommandExecutor.CommandExecutor>;
|
|
1786
|
+
/**
|
|
1787
|
+
* Build a Test layer that returns fixed `RunContext` and
|
|
1788
|
+
* `AgentContext` values regardless of `cwd`.
|
|
1789
|
+
* @public
|
|
1790
|
+
*/
|
|
1791
|
+
declare const RunContextTest: (fixture: {
|
|
1792
|
+
readonly runContext: RunContext;
|
|
1793
|
+
readonly agentContext: AgentContext;
|
|
1794
|
+
}) => Layer.Layer<RunContextService, never, never>;
|
|
1795
|
+
//#endregion
|
|
1796
|
+
//#region src/lib/format-triage.d.ts
|
|
1797
|
+
/** @public */
|
|
1798
|
+
interface FormatTriageOptions {
|
|
1799
|
+
readonly project?: string;
|
|
1800
|
+
readonly maxLines?: number;
|
|
1801
|
+
}
|
|
1802
|
+
/**
|
|
1803
|
+
* Generates an orientation triage markdown string for LLM agents.
|
|
1804
|
+
* Summarises recent test runs, active sessions, acceptance metrics,
|
|
1805
|
+
* and (forward-compat) the most recent TDD session.
|
|
1806
|
+
*
|
|
1807
|
+
* Error channel is `never` — all DataReader errors are swallowed and
|
|
1808
|
+
* replaced with empty defaults so the caller is guaranteed a string.
|
|
1809
|
+
* @public
|
|
1810
|
+
*/
|
|
1811
|
+
declare const formatTriageEffect: (options?: FormatTriageOptions) => Effect.Effect<string, never, DataReader>;
|
|
1812
|
+
//#endregion
|
|
1813
|
+
//#region src/lib/format-wrapup.d.ts
|
|
1814
|
+
/** @public */
|
|
1815
|
+
type WrapupKind = "stop" | "session_end" | "pre_compact" | "tdd_handoff" | "user_prompt_nudge";
|
|
1816
|
+
/** @public */
|
|
1817
|
+
interface FormatWrapupOptions {
|
|
1818
|
+
readonly sessionId?: number;
|
|
1819
|
+
readonly chatId?: string;
|
|
1820
|
+
readonly kind: WrapupKind;
|
|
1821
|
+
readonly userPromptHint?: string;
|
|
1822
|
+
}
|
|
1823
|
+
/** @public */
|
|
1824
|
+
declare const formatWrapupEffect: (options: FormatWrapupOptions) => Effect.Effect<string, never, DataReader>;
|
|
1825
|
+
//#endregion
|
|
1826
|
+
//#region src/migrations/0001_initial.d.ts
|
|
1827
|
+
/** @internal */
|
|
1828
|
+
declare const migration: Effect.Effect<void, import("@effect/sql/SqlError").SqlError, SqlClient>;
|
|
1829
|
+
/** @public */
|
|
1830
|
+
//#endregion
|
|
1831
|
+
//#region src/migrations/registry_0001_initial.d.ts
|
|
1832
|
+
/**
|
|
1833
|
+
* Migration for the global discovery registry SQLite at
|
|
1834
|
+
* `$XDG_DATA_HOME/vitest-agent/registry.db`.
|
|
1835
|
+
*
|
|
1836
|
+
* Single table `known_projects` indexed by `project_key` (the
|
|
1837
|
+
* filesystem-safe form from {@link ProjectIdentity}). Tooling like
|
|
1838
|
+
* `mcp-app` queries this table to enumerate every vitest-agent
|
|
1839
|
+
* project the user has ever run on this machine.
|
|
1840
|
+
*
|
|
1841
|
+
* The registry never blocks anything — its writes are best-effort.
|
|
1842
|
+
* Concurrent writers from multiple Claude Code windows converge via
|
|
1843
|
+
* the `ON CONFLICT(project_key) DO UPDATE` upsert.
|
|
1844
|
+
* @public
|
|
1845
|
+
*/
|
|
1846
|
+
declare const migration$1: Effect.Effect<void, import("@effect/sql/SqlError").SqlError, SqlClient>;
|
|
1847
|
+
//#endregion
|
|
1848
|
+
//#region src/migrations/session_map_0001_initial.d.ts
|
|
1849
|
+
/** @internal */
|
|
1850
|
+
declare const migration$2: Effect.Effect<void, import("@effect/sql/SqlError").SqlError, SqlClient>;
|
|
1851
|
+
/** @public */
|
|
1852
|
+
//#endregion
|
|
1853
|
+
//#region src/schemas/ChannelEvent.d.ts
|
|
1854
|
+
/** @public */
|
|
1855
|
+
declare const SessionOutcome: Schema.Literal<["succeeded", "blocked", "abandoned"]>;
|
|
1856
|
+
/** @public */
|
|
1857
|
+
type SessionOutcome = typeof SessionOutcome.Type;
|
|
1858
|
+
/** @public */
|
|
1859
|
+
declare const GoalsReadyEvent: Schema.Struct<{
|
|
1860
|
+
type: Schema.Literal<["goals_ready"]>;
|
|
1861
|
+
sessionId: typeof Schema.Number;
|
|
1862
|
+
goals: Schema.Array$<Schema.Struct<{
|
|
1863
|
+
id: typeof Schema.Number;
|
|
1864
|
+
ordinal: typeof Schema.Number;
|
|
1865
|
+
goal: typeof Schema.String;
|
|
1866
|
+
}>>;
|
|
1867
|
+
}>;
|
|
1868
|
+
/** @public */
|
|
1869
|
+
type GoalsReadyEvent = typeof GoalsReadyEvent.Type;
|
|
1870
|
+
/** @public */
|
|
1871
|
+
declare const GoalAddedEvent: Schema.Struct<{
|
|
1872
|
+
type: Schema.Literal<["goal_added"]>;
|
|
1873
|
+
sessionId: typeof Schema.Number;
|
|
1874
|
+
goal: Schema.Struct<{
|
|
1875
|
+
id: typeof Schema.Number;
|
|
1876
|
+
ordinal: typeof Schema.Number;
|
|
1877
|
+
goal: typeof Schema.String;
|
|
1878
|
+
}>;
|
|
1879
|
+
}>;
|
|
1880
|
+
/** @public */
|
|
1881
|
+
type GoalAddedEvent = typeof GoalAddedEvent.Type;
|
|
1882
|
+
/** @public */
|
|
1883
|
+
declare const GoalStartedEvent: Schema.Struct<{
|
|
1884
|
+
type: Schema.Literal<["goal_started"]>;
|
|
1885
|
+
sessionId: typeof Schema.Number;
|
|
1886
|
+
goalId: typeof Schema.Number;
|
|
1887
|
+
}>;
|
|
1888
|
+
/** @public */
|
|
1889
|
+
type GoalStartedEvent = typeof GoalStartedEvent.Type;
|
|
1890
|
+
/** @public */
|
|
1891
|
+
declare const GoalCompletedEvent: Schema.Struct<{
|
|
1892
|
+
type: Schema.Literal<["goal_completed"]>;
|
|
1893
|
+
sessionId: typeof Schema.Number;
|
|
1894
|
+
goalId: typeof Schema.Number;
|
|
1895
|
+
behaviorIds: Schema.Array$<typeof Schema.Number>;
|
|
1896
|
+
}>;
|
|
1897
|
+
/** @public */
|
|
1898
|
+
type GoalCompletedEvent = typeof GoalCompletedEvent.Type;
|
|
1899
|
+
/** @public */
|
|
1900
|
+
declare const GoalAbandonedEvent: Schema.Struct<{
|
|
1901
|
+
type: Schema.Literal<["goal_abandoned"]>;
|
|
1902
|
+
sessionId: typeof Schema.Number;
|
|
1903
|
+
goalId: typeof Schema.Number;
|
|
1904
|
+
reason: typeof Schema.String;
|
|
1905
|
+
}>;
|
|
1906
|
+
/** @public */
|
|
1907
|
+
type GoalAbandonedEvent = typeof GoalAbandonedEvent.Type;
|
|
1908
|
+
/** @public */
|
|
1909
|
+
declare const BehaviorsReadyEvent: Schema.Struct<{
|
|
1910
|
+
type: Schema.Literal<["behaviors_ready"]>;
|
|
1911
|
+
sessionId: typeof Schema.Number;
|
|
1912
|
+
goalId: typeof Schema.Number;
|
|
1913
|
+
behaviors: Schema.Array$<Schema.Struct<{
|
|
1914
|
+
id: typeof Schema.Number;
|
|
1915
|
+
ordinal: typeof Schema.Number;
|
|
1916
|
+
behavior: typeof Schema.String;
|
|
1917
|
+
}>>;
|
|
1918
|
+
}>;
|
|
1919
|
+
/** @public */
|
|
1920
|
+
type BehaviorsReadyEvent = typeof BehaviorsReadyEvent.Type;
|
|
1921
|
+
/** @public */
|
|
1922
|
+
declare const BehaviorAddedEvent: Schema.Struct<{
|
|
1923
|
+
type: Schema.Literal<["behavior_added"]>;
|
|
1924
|
+
sessionId: typeof Schema.Number;
|
|
1925
|
+
goalId: typeof Schema.Number;
|
|
1926
|
+
behavior: Schema.Struct<{
|
|
1927
|
+
id: typeof Schema.Number;
|
|
1928
|
+
ordinal: typeof Schema.Number;
|
|
1929
|
+
behavior: typeof Schema.String;
|
|
1930
|
+
}>;
|
|
1931
|
+
}>;
|
|
1932
|
+
/** @public */
|
|
1933
|
+
type BehaviorAddedEvent = typeof BehaviorAddedEvent.Type;
|
|
1934
|
+
/** @public */
|
|
1935
|
+
declare const BehaviorStartedEvent: Schema.Struct<{
|
|
1936
|
+
type: Schema.Literal<["behavior_started"]>;
|
|
1937
|
+
sessionId: typeof Schema.Number;
|
|
1938
|
+
goalId: typeof Schema.Number;
|
|
1939
|
+
behaviorId: typeof Schema.Number;
|
|
1940
|
+
}>;
|
|
1941
|
+
/** @public */
|
|
1942
|
+
type BehaviorStartedEvent = typeof BehaviorStartedEvent.Type;
|
|
1943
|
+
/** @public */
|
|
1944
|
+
declare const PhaseTransitionEvent: Schema.Struct<{
|
|
1945
|
+
type: Schema.Literal<["phase_transition"]>;
|
|
1946
|
+
sessionId: typeof Schema.Number;
|
|
1947
|
+
goalId: typeof Schema.Number;
|
|
1948
|
+
behaviorId: typeof Schema.Number;
|
|
1949
|
+
from: Schema.Literal<["spike", "red", "red.triangulate", "green", "green.fake-it", "refactor", "extended-red", "green-without-red"]>;
|
|
1950
|
+
to: Schema.Literal<["spike", "red", "red.triangulate", "green", "green.fake-it", "refactor", "extended-red", "green-without-red"]>;
|
|
1951
|
+
}>;
|
|
1952
|
+
/** @public */
|
|
1953
|
+
type PhaseTransitionEvent = typeof PhaseTransitionEvent.Type;
|
|
1954
|
+
/** @public */
|
|
1955
|
+
declare const BehaviorCompletedEvent: Schema.Struct<{
|
|
1956
|
+
type: Schema.Literal<["behavior_completed"]>;
|
|
1957
|
+
sessionId: typeof Schema.Number;
|
|
1958
|
+
goalId: typeof Schema.Number;
|
|
1959
|
+
behaviorId: typeof Schema.Number;
|
|
1960
|
+
}>;
|
|
1961
|
+
/** @public */
|
|
1962
|
+
type BehaviorCompletedEvent = typeof BehaviorCompletedEvent.Type;
|
|
1963
|
+
/** @public */
|
|
1964
|
+
declare const BehaviorAbandonedEvent: Schema.Struct<{
|
|
1965
|
+
type: Schema.Literal<["behavior_abandoned"]>;
|
|
1966
|
+
sessionId: typeof Schema.Number;
|
|
1967
|
+
goalId: typeof Schema.Number;
|
|
1968
|
+
behaviorId: typeof Schema.Number;
|
|
1969
|
+
reason: typeof Schema.String;
|
|
1970
|
+
}>;
|
|
1971
|
+
/** @public */
|
|
1972
|
+
type BehaviorAbandonedEvent = typeof BehaviorAbandonedEvent.Type;
|
|
1973
|
+
/** @public */
|
|
1974
|
+
declare const BlockedEvent: Schema.Struct<{
|
|
1975
|
+
type: Schema.Literal<["blocked"]>;
|
|
1976
|
+
sessionId: typeof Schema.Number;
|
|
1977
|
+
goalId: typeof Schema.Number;
|
|
1978
|
+
behaviorId: typeof Schema.Number;
|
|
1979
|
+
reason: typeof Schema.String;
|
|
1980
|
+
failureSignatureHash: Schema.optional<typeof Schema.String>;
|
|
1981
|
+
}>;
|
|
1982
|
+
/** @public */
|
|
1983
|
+
type BlockedEvent = typeof BlockedEvent.Type;
|
|
1984
|
+
/** @public */
|
|
1985
|
+
declare const SessionCompleteEvent: Schema.Struct<{
|
|
1986
|
+
type: Schema.Literal<["session_complete"]>;
|
|
1987
|
+
sessionId: typeof Schema.Number;
|
|
1988
|
+
goalIds: Schema.Array$<typeof Schema.Number>;
|
|
1989
|
+
outcome: Schema.Literal<["succeeded", "blocked", "abandoned"]>;
|
|
1990
|
+
}>;
|
|
1991
|
+
/** @public */
|
|
1992
|
+
type SessionCompleteEvent = typeof SessionCompleteEvent.Type;
|
|
1993
|
+
/** @public */
|
|
1994
|
+
declare const ChannelEvent: Schema.Union<[Schema.Struct<{
|
|
1995
|
+
type: Schema.Literal<["goals_ready"]>;
|
|
1996
|
+
sessionId: typeof Schema.Number;
|
|
1997
|
+
goals: Schema.Array$<Schema.Struct<{
|
|
1998
|
+
id: typeof Schema.Number;
|
|
1999
|
+
ordinal: typeof Schema.Number;
|
|
2000
|
+
goal: typeof Schema.String;
|
|
2001
|
+
}>>;
|
|
2002
|
+
}>, Schema.Struct<{
|
|
2003
|
+
type: Schema.Literal<["goal_added"]>;
|
|
2004
|
+
sessionId: typeof Schema.Number;
|
|
2005
|
+
goal: Schema.Struct<{
|
|
2006
|
+
id: typeof Schema.Number;
|
|
2007
|
+
ordinal: typeof Schema.Number;
|
|
2008
|
+
goal: typeof Schema.String;
|
|
2009
|
+
}>;
|
|
2010
|
+
}>, Schema.Struct<{
|
|
2011
|
+
type: Schema.Literal<["goal_started"]>;
|
|
2012
|
+
sessionId: typeof Schema.Number;
|
|
2013
|
+
goalId: typeof Schema.Number;
|
|
2014
|
+
}>, Schema.Struct<{
|
|
2015
|
+
type: Schema.Literal<["goal_completed"]>;
|
|
2016
|
+
sessionId: typeof Schema.Number;
|
|
2017
|
+
goalId: typeof Schema.Number;
|
|
2018
|
+
behaviorIds: Schema.Array$<typeof Schema.Number>;
|
|
2019
|
+
}>, Schema.Struct<{
|
|
2020
|
+
type: Schema.Literal<["goal_abandoned"]>;
|
|
2021
|
+
sessionId: typeof Schema.Number;
|
|
2022
|
+
goalId: typeof Schema.Number;
|
|
2023
|
+
reason: typeof Schema.String;
|
|
2024
|
+
}>, Schema.Struct<{
|
|
2025
|
+
type: Schema.Literal<["behaviors_ready"]>;
|
|
2026
|
+
sessionId: typeof Schema.Number;
|
|
2027
|
+
goalId: typeof Schema.Number;
|
|
2028
|
+
behaviors: Schema.Array$<Schema.Struct<{
|
|
2029
|
+
id: typeof Schema.Number;
|
|
2030
|
+
ordinal: typeof Schema.Number;
|
|
2031
|
+
behavior: typeof Schema.String;
|
|
2032
|
+
}>>;
|
|
2033
|
+
}>, Schema.Struct<{
|
|
2034
|
+
type: Schema.Literal<["behavior_added"]>;
|
|
2035
|
+
sessionId: typeof Schema.Number;
|
|
2036
|
+
goalId: typeof Schema.Number;
|
|
2037
|
+
behavior: Schema.Struct<{
|
|
2038
|
+
id: typeof Schema.Number;
|
|
2039
|
+
ordinal: typeof Schema.Number;
|
|
2040
|
+
behavior: typeof Schema.String;
|
|
2041
|
+
}>;
|
|
2042
|
+
}>, Schema.Struct<{
|
|
2043
|
+
type: Schema.Literal<["behavior_started"]>;
|
|
2044
|
+
sessionId: typeof Schema.Number;
|
|
2045
|
+
goalId: typeof Schema.Number;
|
|
2046
|
+
behaviorId: typeof Schema.Number;
|
|
2047
|
+
}>, Schema.Struct<{
|
|
2048
|
+
type: Schema.Literal<["phase_transition"]>;
|
|
2049
|
+
sessionId: typeof Schema.Number;
|
|
2050
|
+
goalId: typeof Schema.Number;
|
|
2051
|
+
behaviorId: typeof Schema.Number;
|
|
2052
|
+
from: Schema.Literal<["spike", "red", "red.triangulate", "green", "green.fake-it", "refactor", "extended-red", "green-without-red"]>;
|
|
2053
|
+
to: Schema.Literal<["spike", "red", "red.triangulate", "green", "green.fake-it", "refactor", "extended-red", "green-without-red"]>;
|
|
2054
|
+
}>, Schema.Struct<{
|
|
2055
|
+
type: Schema.Literal<["behavior_completed"]>;
|
|
2056
|
+
sessionId: typeof Schema.Number;
|
|
2057
|
+
goalId: typeof Schema.Number;
|
|
2058
|
+
behaviorId: typeof Schema.Number;
|
|
2059
|
+
}>, Schema.Struct<{
|
|
2060
|
+
type: Schema.Literal<["behavior_abandoned"]>;
|
|
2061
|
+
sessionId: typeof Schema.Number;
|
|
2062
|
+
goalId: typeof Schema.Number;
|
|
2063
|
+
behaviorId: typeof Schema.Number;
|
|
2064
|
+
reason: typeof Schema.String;
|
|
2065
|
+
}>, Schema.Struct<{
|
|
2066
|
+
type: Schema.Literal<["blocked"]>;
|
|
2067
|
+
sessionId: typeof Schema.Number;
|
|
2068
|
+
goalId: typeof Schema.Number;
|
|
2069
|
+
behaviorId: typeof Schema.Number;
|
|
2070
|
+
reason: typeof Schema.String;
|
|
2071
|
+
failureSignatureHash: Schema.optional<typeof Schema.String>;
|
|
2072
|
+
}>, Schema.Struct<{
|
|
2073
|
+
type: Schema.Literal<["session_complete"]>;
|
|
2074
|
+
sessionId: typeof Schema.Number;
|
|
2075
|
+
goalIds: Schema.Array$<typeof Schema.Number>;
|
|
2076
|
+
outcome: Schema.Literal<["succeeded", "blocked", "abandoned"]>;
|
|
2077
|
+
}>]>;
|
|
2078
|
+
/** @public */
|
|
2079
|
+
type ChannelEvent = typeof ChannelEvent.Type;
|
|
2080
|
+
/**
|
|
2081
|
+
* Event types whose `goalId` and `sessionId` should be resolved
|
|
2082
|
+
* server-side from `behaviorId` (per spec: "not trusting the
|
|
2083
|
+
* orchestrator's request"). Listed explicitly so the resolver knows
|
|
2084
|
+
* which subset to enrich vs pass through.
|
|
2085
|
+
* @public
|
|
2086
|
+
*/
|
|
2087
|
+
declare const BehaviorScopedEventTypes: readonly ["behavior_started", "phase_transition", "behavior_completed", "behavior_abandoned", "blocked"];
|
|
2088
|
+
/** @public */
|
|
2089
|
+
type BehaviorScopedEventType = (typeof BehaviorScopedEventTypes)[number];
|
|
2090
|
+
//#endregion
|
|
2091
|
+
//#region src/schemas/CoverageLevel.d.ts
|
|
2092
|
+
declare const CoverageLevel_base: Schema.Class<CoverageLevel, {
|
|
2093
|
+
lines: typeof Schema.Number;
|
|
2094
|
+
functions: typeof Schema.Number;
|
|
2095
|
+
branches: typeof Schema.Number;
|
|
2096
|
+
statements: typeof Schema.Number;
|
|
2097
|
+
perFile: Schema.optional<typeof Schema.Boolean>;
|
|
2098
|
+
}, Schema.Struct.Encoded<{
|
|
2099
|
+
lines: typeof Schema.Number;
|
|
2100
|
+
functions: typeof Schema.Number;
|
|
2101
|
+
branches: typeof Schema.Number;
|
|
2102
|
+
statements: typeof Schema.Number;
|
|
2103
|
+
perFile: Schema.optional<typeof Schema.Boolean>;
|
|
2104
|
+
}>, never, {
|
|
2105
|
+
readonly lines: number;
|
|
2106
|
+
} & {
|
|
2107
|
+
readonly functions: number;
|
|
2108
|
+
} & {
|
|
2109
|
+
readonly branches: number;
|
|
2110
|
+
} & {
|
|
2111
|
+
readonly statements: number;
|
|
2112
|
+
} & {
|
|
2113
|
+
readonly perFile?: boolean | undefined;
|
|
2114
|
+
}, {}, {}>;
|
|
2115
|
+
/**
|
|
2116
|
+
* A coverage level configuration with per-metric thresholds and an optional
|
|
2117
|
+
* perFile flag. Extend this class to define custom named presets.
|
|
2118
|
+
* @public
|
|
2119
|
+
*/
|
|
2120
|
+
declare class CoverageLevel extends CoverageLevel_base {
|
|
2121
|
+
/** No enforcement — all metrics at 0%. */
|
|
2122
|
+
static readonly none: CoverageLevel;
|
|
2123
|
+
/** Minimal coverage bar — all metrics at 50%. */
|
|
2124
|
+
static readonly basic: CoverageLevel;
|
|
2125
|
+
/** Recommended default — lines/functions/statements at 70%, branches at 65%. */
|
|
2126
|
+
static readonly standard: CoverageLevel;
|
|
2127
|
+
/** High-quality bar — lines/functions/statements at 80%, branches at 75%. */
|
|
2128
|
+
static readonly strict: CoverageLevel;
|
|
2129
|
+
/** Near-complete coverage — lines/functions/statements at 90%, branches at 85%. */
|
|
2130
|
+
static readonly full: CoverageLevel;
|
|
2131
|
+
/**
|
|
2132
|
+
* Returns a new CoverageLevel instance with perFile set to true.
|
|
2133
|
+
* Does not mutate the original.
|
|
2134
|
+
*/
|
|
2135
|
+
withPerFile(): CoverageLevel;
|
|
2136
|
+
/**
|
|
2137
|
+
* Returns a new CoverageLevel instance with the given fields overridden.
|
|
2138
|
+
* Does not mutate the original. Existing perFile is preserved unless
|
|
2139
|
+
* explicitly overridden.
|
|
2140
|
+
*/
|
|
2141
|
+
extend(overrides: Partial<{
|
|
2142
|
+
lines: number;
|
|
2143
|
+
functions: number;
|
|
2144
|
+
branches: number;
|
|
2145
|
+
statements: number;
|
|
2146
|
+
perFile: boolean;
|
|
2147
|
+
}>): CoverageLevel;
|
|
2148
|
+
}
|
|
2149
|
+
/** The named preset identifiers. * @public
|
|
2150
|
+
*/
|
|
2151
|
+
type CoverageLevelName = "none" | "basic" | "standard" | "strict" | "full";
|
|
2152
|
+
/** Accepted input forms: a preset name string or a CoverageLevel instance. * @public
|
|
2153
|
+
*/
|
|
2154
|
+
type CoverageInput = CoverageLevelName | CoverageLevel;
|
|
2155
|
+
/**
|
|
2156
|
+
* Resolves a CoverageInput (preset name or CoverageLevel instance) to a
|
|
2157
|
+
* CoverageLevel. When input is undefined, returns the named fallback preset.
|
|
2158
|
+
* Throws if a string is provided that does not match a known preset name.
|
|
2159
|
+
* @public
|
|
2160
|
+
*/
|
|
2161
|
+
declare function resolveCoverageInput(input: CoverageInput | undefined, fallback: CoverageLevelName): CoverageLevel;
|
|
2162
|
+
/**
|
|
2163
|
+
* Validates that coverageTargets are not below coverageThresholds for any
|
|
2164
|
+
* metric, and that both agree on perFile. Throws a descriptive Error on
|
|
2165
|
+
* any violation.
|
|
2166
|
+
* @public
|
|
2167
|
+
*/
|
|
2168
|
+
declare function validateCoverageConfig(thresholds: CoverageLevel, targets: CoverageLevel): void;
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region src/schemas/CoverageTargets.d.ts
|
|
2171
|
+
/**
|
|
2172
|
+
* Per-metric leaf shape for coverageTargets entries. Allows optional
|
|
2173
|
+
* numeric targets per metric and the `100: true` shortcut.
|
|
2174
|
+
* @public
|
|
2175
|
+
*/
|
|
2176
|
+
declare const CoverageTargetsMetrics: Schema.Struct<{
|
|
2177
|
+
lines: Schema.optional<typeof Schema.Positive>;
|
|
2178
|
+
functions: Schema.optional<typeof Schema.Positive>;
|
|
2179
|
+
branches: Schema.optional<typeof Schema.Positive>;
|
|
2180
|
+
statements: Schema.optional<typeof Schema.Positive>;
|
|
2181
|
+
100: Schema.optional<Schema.Literal<[true]>>;
|
|
2182
|
+
}>;
|
|
2183
|
+
/** @public */
|
|
2184
|
+
type CoverageTargetsMetrics = typeof CoverageTargetsMetrics.Type;
|
|
2185
|
+
/**
|
|
2186
|
+
* Typed schema for the coverageTargets option.
|
|
2187
|
+
*
|
|
2188
|
+
* Mirrors Vitest's coverage.thresholds shape — per-metric positive numbers,
|
|
2189
|
+
* the `100: true` shortcut (only valid at key `"100"`), and glob-pattern
|
|
2190
|
+
* entries with metric objects. Positive numbers only; negatives and zeros
|
|
2191
|
+
* are rejected. `perFile` is not allowed here — inherit it from
|
|
2192
|
+
* `coverage.thresholds.perFile`.
|
|
2193
|
+
*
|
|
2194
|
+
* A decode-time refinement rejects `true` at any key other than `"100"`
|
|
2195
|
+
* so `{ statements: true }` fails parse rather than silently flowing
|
|
2196
|
+
* through to a runtime parser that only honors the canonical shorthand
|
|
2197
|
+
* at key `"100"`.
|
|
2198
|
+
* @public
|
|
2199
|
+
*/
|
|
2200
|
+
declare const CoverageTargets: Schema.refine<{
|
|
2201
|
+
readonly [x: string]: number | true | {
|
|
2202
|
+
readonly lines?: number | undefined;
|
|
2203
|
+
readonly functions?: number | undefined;
|
|
2204
|
+
readonly branches?: number | undefined;
|
|
2205
|
+
readonly statements?: number | undefined;
|
|
2206
|
+
readonly 100?: true | undefined;
|
|
2207
|
+
};
|
|
2208
|
+
}, Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.Positive, Schema.Literal<[true]>, Schema.Struct<{
|
|
2209
|
+
lines: Schema.optional<typeof Schema.Positive>;
|
|
2210
|
+
functions: Schema.optional<typeof Schema.Positive>;
|
|
2211
|
+
branches: Schema.optional<typeof Schema.Positive>;
|
|
2212
|
+
statements: Schema.optional<typeof Schema.Positive>;
|
|
2213
|
+
100: Schema.optional<Schema.Literal<[true]>>;
|
|
2214
|
+
}>]>>>;
|
|
2215
|
+
/** @public */
|
|
2216
|
+
type CoverageTargets = typeof CoverageTargets.Type;
|
|
2217
|
+
//#endregion
|
|
2218
|
+
//#region src/schemas/Options.d.ts
|
|
2219
|
+
/**
|
|
2220
|
+
* Per-executor console-output matrix. Most users never set this — the
|
|
2221
|
+
* built-in defaults cover the common cases. Override per slot when you
|
|
2222
|
+
* want to force a specific layout for debugging or to suppress one
|
|
2223
|
+
* channel without affecting the others.
|
|
2224
|
+
*
|
|
2225
|
+
* Defaults:
|
|
2226
|
+
* - `human` → `"passthrough"` today; users opt into `"stream"` explicitly
|
|
2227
|
+
* for the progressively-drawn, animated agent-shaped live renderer.
|
|
2228
|
+
* - `agent` → `"agent"` (markdown-flavored final frame).
|
|
2229
|
+
* - `ci` → `"passthrough"` (Vitest's reporters produce log-friendly
|
|
2230
|
+
* output). `"ci-annotations"` is opt-in until the dedicated GHA
|
|
2231
|
+
* annotations writer ships.
|
|
2232
|
+
* @public
|
|
2233
|
+
*/
|
|
2234
|
+
declare const ConsoleOutputs: Schema.Struct<{
|
|
2235
|
+
human: Schema.optional<Schema.Literal<["passthrough", "silent", "stream", "agent"]>>;
|
|
2236
|
+
agent: Schema.optional<Schema.Literal<["passthrough", "silent", "agent"]>>;
|
|
2237
|
+
ci: Schema.optional<Schema.Literal<["passthrough", "silent", "ci-annotations"]>>;
|
|
2238
|
+
}>;
|
|
2239
|
+
/** @public */
|
|
2240
|
+
type ConsoleOutputs = typeof ConsoleOutputs.Type;
|
|
2241
|
+
/**
|
|
2242
|
+
* The 2.0 user-facing options for `AgentPlugin`.
|
|
2243
|
+
*
|
|
2244
|
+
* Five fields total. Two are function-typed (`reporter`, `onRunEvent`)
|
|
2245
|
+
* and live on the `AgentPluginConstructorOptions` companion interface in
|
|
2246
|
+
* `@vitest-agent/plugin` — Effect Schema cannot encode functions cleanly,
|
|
2247
|
+
* so the schema-decodable struct carries the three data-shaped fields.
|
|
2248
|
+
* @public
|
|
2249
|
+
*/
|
|
2250
|
+
declare const AgentPluginOptions: Schema.Struct<{
|
|
2251
|
+
console: Schema.optional<Schema.Struct<{
|
|
2252
|
+
human: Schema.optional<Schema.Literal<["passthrough", "silent", "stream", "agent"]>>;
|
|
2253
|
+
agent: Schema.optional<Schema.Literal<["passthrough", "silent", "agent"]>>;
|
|
2254
|
+
ci: Schema.optional<Schema.Literal<["passthrough", "silent", "ci-annotations"]>>;
|
|
2255
|
+
}>>;
|
|
2256
|
+
coverageTargets: Schema.optional<Schema.refine<{
|
|
2257
|
+
readonly [x: string]: number | true | {
|
|
2258
|
+
readonly lines?: number | undefined;
|
|
2259
|
+
readonly functions?: number | undefined;
|
|
2260
|
+
readonly branches?: number | undefined;
|
|
2261
|
+
readonly statements?: number | undefined;
|
|
2262
|
+
readonly 100?: true | undefined;
|
|
2263
|
+
};
|
|
2264
|
+
}, Schema.Record$<typeof Schema.String, Schema.Union<[typeof Schema.Positive, Schema.Literal<[true]>, Schema.Struct<{
|
|
2265
|
+
lines: Schema.optional<typeof Schema.Positive>;
|
|
2266
|
+
functions: Schema.optional<typeof Schema.Positive>;
|
|
2267
|
+
branches: Schema.optional<typeof Schema.Positive>;
|
|
2268
|
+
statements: Schema.optional<typeof Schema.Positive>;
|
|
2269
|
+
100: Schema.optional<Schema.Literal<[true]>>;
|
|
2270
|
+
}>]>>>>;
|
|
2271
|
+
transport: Schema.optional<Schema.Struct<{
|
|
2272
|
+
kind: Schema.Literal<["local"]>;
|
|
2273
|
+
}>>;
|
|
2274
|
+
}>;
|
|
2275
|
+
/** @public */
|
|
2276
|
+
type AgentPluginOptions = typeof AgentPluginOptions.Type;
|
|
2277
|
+
/**
|
|
2278
|
+
* Reporter-implementation options.
|
|
2279
|
+
*
|
|
2280
|
+
* Public for users building custom reporters via `@vitest-agent/reporter`;
|
|
2281
|
+
* most users never see this type — they wire `AgentPlugin({ reporter })`
|
|
2282
|
+
* and the factory receives a fully-resolved `ReporterKit` instead.
|
|
2283
|
+
*
|
|
2284
|
+
* Carries internal flags the plugin sets when constructing the reporter
|
|
2285
|
+
* (currently only `projectFilter` for per-project scoping).
|
|
2286
|
+
* @public
|
|
2287
|
+
*/
|
|
2288
|
+
declare const AgentReporterOptions: Schema.Struct<{
|
|
2289
|
+
/** Set by the plugin per-project. Filters reports to one project. */projectFilter: Schema.optional<typeof Schema.String>;
|
|
2290
|
+
}>;
|
|
2291
|
+
/** @public */
|
|
2292
|
+
type AgentReporterOptions = typeof AgentReporterOptions.Type;
|
|
2293
|
+
//#endregion
|
|
2294
|
+
//#region src/schemas/turns/FileEditPayload.d.ts
|
|
2295
|
+
/** @public */
|
|
2296
|
+
declare const FileEditPayload: Schema.Struct<{
|
|
2297
|
+
type: Schema.Literal<["file_edit"]>;
|
|
2298
|
+
file_path: typeof Schema.String;
|
|
2299
|
+
edit_kind: Schema.Literal<["write", "edit", "multi_edit"]>;
|
|
2300
|
+
lines_added: Schema.optional<typeof Schema.Number>;
|
|
2301
|
+
lines_removed: Schema.optional<typeof Schema.Number>;
|
|
2302
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
2303
|
+
}>;
|
|
2304
|
+
/** @public */
|
|
2305
|
+
type FileEditPayload = typeof FileEditPayload.Type;
|
|
2306
|
+
//#endregion
|
|
2307
|
+
//#region src/schemas/turns/HookFirePayload.d.ts
|
|
2308
|
+
/** @public */
|
|
2309
|
+
declare const HookFirePayload: Schema.Struct<{
|
|
2310
|
+
type: Schema.Literal<["hook_fire"]>;
|
|
2311
|
+
hook_kind: Schema.Literal<["SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PreToolUse", "PostToolUse", "PostToolUseFailure", "UserPromptSubmit", "FileChanged"]>;
|
|
2312
|
+
chat_id: Schema.optional<typeof Schema.String>;
|
|
2313
|
+
previous_record_failures: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
2314
|
+
}>;
|
|
2315
|
+
/** @public */
|
|
2316
|
+
type HookFirePayload = typeof HookFirePayload.Type;
|
|
2317
|
+
//#endregion
|
|
2318
|
+
//#region src/schemas/turns/HypothesisPayload.d.ts
|
|
2319
|
+
/** @public */
|
|
2320
|
+
declare const HypothesisPayload: Schema.Struct<{
|
|
2321
|
+
type: Schema.Literal<["hypothesis"]>;
|
|
2322
|
+
content: typeof Schema.String;
|
|
2323
|
+
cited_test_error_id: Schema.optional<typeof Schema.Number>;
|
|
2324
|
+
cited_stack_frame_id: Schema.optional<typeof Schema.Number>;
|
|
2325
|
+
}>;
|
|
2326
|
+
/** @public */
|
|
2327
|
+
type HypothesisPayload = typeof HypothesisPayload.Type;
|
|
2328
|
+
//#endregion
|
|
2329
|
+
//#region src/schemas/turns/NotePayload.d.ts
|
|
2330
|
+
/** @public */
|
|
2331
|
+
declare const NotePayload: Schema.Struct<{
|
|
2332
|
+
type: Schema.Literal<["note"]>;
|
|
2333
|
+
scope: typeof Schema.String;
|
|
2334
|
+
title: Schema.optional<typeof Schema.String>;
|
|
2335
|
+
content: typeof Schema.String;
|
|
2336
|
+
}>;
|
|
2337
|
+
/** @public */
|
|
2338
|
+
type NotePayload = typeof NotePayload.Type;
|
|
2339
|
+
//#endregion
|
|
2340
|
+
//#region src/schemas/turns/ToolCallPayload.d.ts
|
|
2341
|
+
/** @public */
|
|
2342
|
+
declare const ToolCallPayload: Schema.Struct<{
|
|
2343
|
+
type: Schema.Literal<["tool_call"]>;
|
|
2344
|
+
tool_name: typeof Schema.String;
|
|
2345
|
+
tool_input: typeof Schema.Unknown;
|
|
2346
|
+
tool_use_id: Schema.optional<typeof Schema.String>;
|
|
2347
|
+
}>;
|
|
2348
|
+
/** @public */
|
|
2349
|
+
type ToolCallPayload = typeof ToolCallPayload.Type;
|
|
2350
|
+
//#endregion
|
|
2351
|
+
//#region src/schemas/turns/ToolResultPayload.d.ts
|
|
2352
|
+
/** @public */
|
|
2353
|
+
declare const ToolResultPayload: Schema.Struct<{
|
|
2354
|
+
type: Schema.Literal<["tool_result"]>;
|
|
2355
|
+
tool_name: typeof Schema.String;
|
|
2356
|
+
tool_use_id: Schema.optional<typeof Schema.String>;
|
|
2357
|
+
result_summary: Schema.optional<typeof Schema.String>;
|
|
2358
|
+
success: typeof Schema.Boolean;
|
|
2359
|
+
duration_ms: Schema.optional<typeof Schema.Number>;
|
|
2360
|
+
}>;
|
|
2361
|
+
/** @public */
|
|
2362
|
+
type ToolResultPayload = typeof ToolResultPayload.Type;
|
|
2363
|
+
//#endregion
|
|
2364
|
+
//#region src/schemas/turns/UserPromptPayload.d.ts
|
|
2365
|
+
/** @public */
|
|
2366
|
+
declare const UserPromptPayload: Schema.Struct<{
|
|
2367
|
+
type: Schema.Literal<["user_prompt"]>;
|
|
2368
|
+
prompt: typeof Schema.String;
|
|
2369
|
+
cc_message_id: Schema.optional<typeof Schema.String>;
|
|
2370
|
+
}>;
|
|
2371
|
+
/** @public */
|
|
2372
|
+
type UserPromptPayload = typeof UserPromptPayload.Type;
|
|
2373
|
+
//#endregion
|
|
2374
|
+
//#region src/schemas/turns/index.d.ts
|
|
2375
|
+
/** @public */
|
|
2376
|
+
declare const TurnPayload: Schema.Union<[Schema.Struct<{
|
|
2377
|
+
type: Schema.Literal<["user_prompt"]>;
|
|
2378
|
+
prompt: typeof Schema.String;
|
|
2379
|
+
cc_message_id: Schema.optional<typeof Schema.String>;
|
|
2380
|
+
}>, Schema.Struct<{
|
|
2381
|
+
type: Schema.Literal<["tool_call"]>;
|
|
2382
|
+
tool_name: typeof Schema.String;
|
|
2383
|
+
tool_input: typeof Schema.Unknown;
|
|
2384
|
+
tool_use_id: Schema.optional<typeof Schema.String>;
|
|
2385
|
+
}>, Schema.Struct<{
|
|
2386
|
+
type: Schema.Literal<["tool_result"]>;
|
|
2387
|
+
tool_name: typeof Schema.String;
|
|
2388
|
+
tool_use_id: Schema.optional<typeof Schema.String>;
|
|
2389
|
+
result_summary: Schema.optional<typeof Schema.String>;
|
|
2390
|
+
success: typeof Schema.Boolean;
|
|
2391
|
+
duration_ms: Schema.optional<typeof Schema.Number>;
|
|
2392
|
+
}>, Schema.Struct<{
|
|
2393
|
+
type: Schema.Literal<["file_edit"]>;
|
|
2394
|
+
file_path: typeof Schema.String;
|
|
2395
|
+
edit_kind: Schema.Literal<["write", "edit", "multi_edit"]>;
|
|
2396
|
+
lines_added: Schema.optional<typeof Schema.Number>;
|
|
2397
|
+
lines_removed: Schema.optional<typeof Schema.Number>;
|
|
2398
|
+
diff: Schema.optional<typeof Schema.String>;
|
|
2399
|
+
}>, Schema.Struct<{
|
|
2400
|
+
type: Schema.Literal<["hook_fire"]>;
|
|
2401
|
+
hook_kind: Schema.Literal<["SessionStart", "SessionEnd", "Stop", "StopFailure", "SubagentStart", "SubagentStop", "PreCompact", "PostCompact", "PreToolUse", "PostToolUse", "PostToolUseFailure", "UserPromptSubmit", "FileChanged"]>;
|
|
2402
|
+
chat_id: Schema.optional<typeof Schema.String>;
|
|
2403
|
+
previous_record_failures: Schema.optional<Schema.Array$<typeof Schema.String>>;
|
|
2404
|
+
}>, Schema.Struct<{
|
|
2405
|
+
type: Schema.Literal<["note"]>;
|
|
2406
|
+
scope: typeof Schema.String;
|
|
2407
|
+
title: Schema.optional<typeof Schema.String>;
|
|
2408
|
+
content: typeof Schema.String;
|
|
2409
|
+
}>, Schema.Struct<{
|
|
2410
|
+
type: Schema.Literal<["hypothesis"]>;
|
|
2411
|
+
content: typeof Schema.String;
|
|
2412
|
+
cited_test_error_id: Schema.optional<typeof Schema.Number>;
|
|
2413
|
+
cited_stack_frame_id: Schema.optional<typeof Schema.Number>;
|
|
2414
|
+
}>]>;
|
|
2415
|
+
/** @public */
|
|
2416
|
+
type TurnPayload = typeof TurnPayload.Type;
|
|
2417
|
+
//#endregion
|
|
2418
|
+
//#region src/services/idempotency.d.ts
|
|
2419
|
+
/**
|
|
2420
|
+
* Sentinel substituted for `parentAgentId` when the value is `null`.
|
|
2421
|
+
* Avoids ambiguity around hashing the literal string "null" or empty
|
|
2422
|
+
* string, both of which could collide with caller-supplied values.
|
|
2423
|
+
* @public
|
|
2424
|
+
*/
|
|
2425
|
+
declare const IDEMPOTENCY_ROOT_SENTINEL = "__ROOT__";
|
|
2426
|
+
/** @public */
|
|
2427
|
+
interface IdempotencyInput {
|
|
2428
|
+
readonly agentType: string;
|
|
2429
|
+
readonly parentAgentId: string | null;
|
|
2430
|
+
readonly clientNonce: string;
|
|
2431
|
+
}
|
|
2432
|
+
/**
|
|
2433
|
+
* Derive the canonical idempotency key for an `agents` row.
|
|
2434
|
+
*
|
|
2435
|
+
* Algorithm:
|
|
2436
|
+
* sha256(agentType + "|" + (parentAgentId ?? "__ROOT__") + "|" + clientNonce)
|
|
2437
|
+
* then base32 (RFC 4648 alphabet, lowercased) truncated to 26 chars.
|
|
2438
|
+
*
|
|
2439
|
+
* 26 base32 chars = 130 bits, far beyond the birthday-bound for the
|
|
2440
|
+
* scoping (UNIQUE per session). The base32 alphabet is a-z2-7 — all
|
|
2441
|
+
* lowercase to keep the column lexicographically friendly and
|
|
2442
|
+
* case-insensitive on filesystems that we never hit but might in
|
|
2443
|
+
* future debugging.
|
|
2444
|
+
* @public
|
|
2445
|
+
*/
|
|
2446
|
+
declare const deriveIdempotencyKey: (input: IdempotencyInput) => string;
|
|
2447
|
+
//#endregion
|
|
2448
|
+
//#region src/sql/assemblers.d.ts
|
|
2449
|
+
/**
|
|
2450
|
+
* Minimal shape of a test_runs aggregation row used to build the manifest.
|
|
2451
|
+
* @public
|
|
2452
|
+
*/
|
|
2453
|
+
interface ManifestRow {
|
|
2454
|
+
project: string;
|
|
2455
|
+
sub_project: string | null;
|
|
2456
|
+
timestamp: string;
|
|
2457
|
+
reason: string;
|
|
2458
|
+
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Minimal shape of a test_history row used to build a history record.
|
|
2461
|
+
* @public
|
|
2462
|
+
*/
|
|
2463
|
+
interface HistoryRow {
|
|
2464
|
+
full_name: string;
|
|
2465
|
+
timestamp: string;
|
|
2466
|
+
state: string;
|
|
2467
|
+
}
|
|
2468
|
+
/**
|
|
2469
|
+
* A `Record<fullName, { runs: TestRun[] }>` keyed by test full name.
|
|
2470
|
+
*
|
|
2471
|
+
* This is the internal representation returned by `assembleHistoryRecord`.
|
|
2472
|
+
* Callers that need the Effect Schema `HistoryRecord` type should adapt this
|
|
2473
|
+
* into the `tests` array format.
|
|
2474
|
+
* @public
|
|
2475
|
+
*/
|
|
2476
|
+
interface AssembledHistoryRecord {
|
|
2477
|
+
[fullName: string]: {
|
|
2478
|
+
runs: TestRun[];
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
/**
|
|
2482
|
+
* Builds a `CacheManifest` from an array of test_runs aggregation rows.
|
|
2483
|
+
*
|
|
2484
|
+
* Each row represents the latest run for a project/sub_project pair.
|
|
2485
|
+
* The `dbPath` is stored as `cacheDir` so CLI tools can locate the source.
|
|
2486
|
+
* @public
|
|
2487
|
+
*/
|
|
2488
|
+
declare function assembleManifest(rows: ManifestRow[], dbPath: string): CacheManifest;
|
|
2489
|
+
/**
|
|
2490
|
+
* Groups test_history rows by `full_name` into a keyed record.
|
|
2491
|
+
*
|
|
2492
|
+
* Returns `Record<fullName, { runs: TestRun[] }>` where `runs` are the
|
|
2493
|
+
* accumulated test runs for that test, in the order they appear in `rows`.
|
|
2494
|
+
*
|
|
2495
|
+
* Only rows with state `"passed"` or `"failed"` are included in runs
|
|
2496
|
+
* (matching the `TestRun` schema constraint).
|
|
2497
|
+
* @public
|
|
2498
|
+
*/
|
|
2499
|
+
declare function assembleHistoryRecord(rows: HistoryRow[]): AssembledHistoryRecord;
|
|
2500
|
+
//#endregion
|
|
2501
|
+
//#region src/utils/ansi.d.ts
|
|
2502
|
+
/**
|
|
2503
|
+
* Options for ANSI color output control.
|
|
2504
|
+
*
|
|
2505
|
+
* @internal
|
|
2506
|
+
*/
|
|
2507
|
+
interface AnsiOptions {
|
|
2508
|
+
noColor?: boolean;
|
|
2509
|
+
}
|
|
2510
|
+
/**
|
|
2511
|
+
* Wrap text with an ANSI color/style escape code.
|
|
2512
|
+
*
|
|
2513
|
+
* No-ops when `options.noColor` is true, keeping output as valid plain
|
|
2514
|
+
* markdown when captured by agents or piped to files.
|
|
2515
|
+
*
|
|
2516
|
+
* @privateRemarks
|
|
2517
|
+
* Uses raw ANSI escape sequences (`\x1b[...m`) rather than a dependency
|
|
2518
|
+
* like `chalk` or `picocolors` to keep the package zero-dependency. The
|
|
2519
|
+
* `noColor` flag respects the `NO_COLOR` environment variable convention.
|
|
2520
|
+
*
|
|
2521
|
+
* @param text - Text to wrap
|
|
2522
|
+
* @param color - ANSI code name: `reset`, `bold`, `dim`, `red`, `green`, `yellow`, `cyan`
|
|
2523
|
+
* @param options - Control color output
|
|
2524
|
+
* @returns Text with ANSI escape codes, or plain text if noColor
|
|
2525
|
+
*
|
|
2526
|
+
* @see {@link https://no-color.org/ | NO_COLOR convention}
|
|
2527
|
+
* @internal
|
|
2528
|
+
*/
|
|
2529
|
+
declare function ansi(text: string, color: string, options?: AnsiOptions): string;
|
|
2530
|
+
/**
|
|
2531
|
+
* Strip all ANSI escape codes from a string.
|
|
2532
|
+
*
|
|
2533
|
+
* @param text - String potentially containing ANSI escape sequences
|
|
2534
|
+
* @returns Plain text with all escape sequences removed
|
|
2535
|
+
*
|
|
2536
|
+
* @internal
|
|
2537
|
+
*/
|
|
2538
|
+
declare function stripAnsi(text: string): string;
|
|
2539
|
+
//#endregion
|
|
2540
|
+
//#region src/utils/build-report.d.ts
|
|
2541
|
+
/**
|
|
2542
|
+
* Duck-typed Vitest parsed stack frame.
|
|
2543
|
+
*
|
|
2544
|
+
* Vitest's TestError.stacks is `ParsedStack[]` from `@vitest/utils`, not a
|
|
2545
|
+
* plain string array. Frames must be formatted before joining; otherwise
|
|
2546
|
+
* `[obj].join("\n")` produces "[object Object]".
|
|
2547
|
+
*
|
|
2548
|
+
* @public
|
|
2549
|
+
*/
|
|
2550
|
+
interface VitestParsedStack {
|
|
2551
|
+
method: string;
|
|
2552
|
+
file: string;
|
|
2553
|
+
line: number;
|
|
2554
|
+
column: number;
|
|
2555
|
+
}
|
|
2556
|
+
/**
|
|
2557
|
+
* Duck-typed Vitest test error with message, optional diff, and stack traces.
|
|
2558
|
+
*
|
|
2559
|
+
* `stacks` accepts both already-formatted strings (legacy / coercion path)
|
|
2560
|
+
* and `ParsedStack[]` (real Vitest output).
|
|
2561
|
+
*
|
|
2562
|
+
* @public
|
|
2563
|
+
*/
|
|
2564
|
+
interface VitestTestError {
|
|
2565
|
+
message: string;
|
|
2566
|
+
diff?: string;
|
|
2567
|
+
stacks?: Array<string | VitestParsedStack>;
|
|
2568
|
+
}
|
|
2569
|
+
/**
|
|
2570
|
+
* Duck-typed Vitest test result returned by `TestCase.result()`.
|
|
2571
|
+
*
|
|
2572
|
+
* Vitest returns `undefined` for tests that have not finished running
|
|
2573
|
+
* (pending/collected state).
|
|
2574
|
+
*
|
|
2575
|
+
* @public
|
|
2576
|
+
*/
|
|
2577
|
+
interface VitestTestResult {
|
|
2578
|
+
state: string;
|
|
2579
|
+
errors?: ReadonlyArray<VitestTestError>;
|
|
2580
|
+
}
|
|
2581
|
+
/**
|
|
2582
|
+
* Duck-typed Vitest test diagnostic returned by `TestCase.diagnostic()`.
|
|
2583
|
+
*
|
|
2584
|
+
* @public
|
|
2585
|
+
*/
|
|
2586
|
+
interface VitestTestDiagnostic {
|
|
2587
|
+
duration: number;
|
|
2588
|
+
flaky: boolean;
|
|
2589
|
+
slow: boolean;
|
|
2590
|
+
}
|
|
2591
|
+
/**
|
|
2592
|
+
* Duck-typed Vitest TestCase from the Reporter v2 API.
|
|
2593
|
+
*
|
|
2594
|
+
* @remarks
|
|
2595
|
+
* These interfaces mirror the Vitest TestCase shape without importing
|
|
2596
|
+
* Vitest types directly, keeping the formatter a pure data transformer
|
|
2597
|
+
* with no dependency on the Vitest runtime.
|
|
2598
|
+
*
|
|
2599
|
+
* @public
|
|
2600
|
+
*/
|
|
2601
|
+
interface VitestTestCase {
|
|
2602
|
+
type: "test";
|
|
2603
|
+
name: string;
|
|
2604
|
+
fullName: string;
|
|
2605
|
+
tags: readonly string[];
|
|
2606
|
+
/** Parent suite or module. Optional in the duck-type so unit-test fixtures don't have to fabricate a stub; always present in real Vitest TestCase instances. */
|
|
2607
|
+
parent?: VitestTestSuite | VitestTestModule;
|
|
2608
|
+
result(): VitestTestResult | undefined;
|
|
2609
|
+
diagnostic(): VitestTestDiagnostic | undefined;
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* Duck-typed Vitest module diagnostic.
|
|
2613
|
+
*
|
|
2614
|
+
* @public
|
|
2615
|
+
*/
|
|
2616
|
+
interface VitestModuleDiagnostic {
|
|
2617
|
+
duration: number;
|
|
2618
|
+
}
|
|
2619
|
+
/**
|
|
2620
|
+
* Duck-typed Vitest module error.
|
|
2621
|
+
*
|
|
2622
|
+
* @public
|
|
2623
|
+
*/
|
|
2624
|
+
interface VitestModuleError {
|
|
2625
|
+
message: string;
|
|
2626
|
+
stacks?: Array<string | VitestParsedStack>;
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* Duck-typed Vitest TestSuite from the Reporter v2 API.
|
|
2630
|
+
*
|
|
2631
|
+
* @public
|
|
2632
|
+
*/
|
|
2633
|
+
interface VitestTestSuite {
|
|
2634
|
+
type: "suite";
|
|
2635
|
+
name: string;
|
|
2636
|
+
fullName: string;
|
|
2637
|
+
state(): string;
|
|
2638
|
+
parent: VitestTestSuite | VitestTestModule;
|
|
2639
|
+
options: {
|
|
2640
|
+
concurrent?: boolean;
|
|
2641
|
+
shuffle?: boolean;
|
|
2642
|
+
retry?: number;
|
|
2643
|
+
repeats?: number;
|
|
2644
|
+
mode?: string;
|
|
2645
|
+
tags?: string[];
|
|
2646
|
+
};
|
|
2647
|
+
location?: {
|
|
2648
|
+
line: number;
|
|
2649
|
+
column: number;
|
|
2650
|
+
};
|
|
2651
|
+
}
|
|
2652
|
+
/**
|
|
2653
|
+
* Duck-typed Vitest TestModule from the Reporter v2 API.
|
|
2654
|
+
*
|
|
2655
|
+
* @remarks
|
|
2656
|
+
* Each `TestModule` carries a `.project` reference with a `.name` property,
|
|
2657
|
+
* which `AgentReporter` uses to group results by Vitest project in
|
|
2658
|
+
* monorepo configurations.
|
|
2659
|
+
*
|
|
2660
|
+
* @public
|
|
2661
|
+
*/
|
|
2662
|
+
interface VitestTestModule {
|
|
2663
|
+
type: "module";
|
|
2664
|
+
moduleId: string;
|
|
2665
|
+
relativeModuleId: string;
|
|
2666
|
+
project: {
|
|
2667
|
+
name: string;
|
|
2668
|
+
};
|
|
2669
|
+
state(): string;
|
|
2670
|
+
children: {
|
|
2671
|
+
allTests(filter?: string): Generator<VitestTestCase>;
|
|
2672
|
+
allSuites(): Generator<VitestTestSuite>;
|
|
2673
|
+
};
|
|
2674
|
+
diagnostic(): VitestModuleDiagnostic | undefined;
|
|
2675
|
+
errors(): Array<VitestModuleError>;
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* Convert Vitest TestModule/TestCase objects into an `AgentReport`.
|
|
2679
|
+
*
|
|
2680
|
+
* @remarks
|
|
2681
|
+
* This is a pure data transformation function with no I/O. It tallies
|
|
2682
|
+
* pass/fail/skip counts, extracts error details with diffs, and builds
|
|
2683
|
+
* the complete report structure. Only modules with at least one failing
|
|
2684
|
+
* test are included in the `failed` array to keep reports compact.
|
|
2685
|
+
*
|
|
2686
|
+
* @param testModules - All test modules from the Vitest run
|
|
2687
|
+
* @param unhandledErrors - Unhandled errors from the run
|
|
2688
|
+
* @param reason - Overall run outcome (`"passed"`, `"failed"`, or `"interrupted"`)
|
|
2689
|
+
* @param options - Reporter options; only `omitPassingTests` is used
|
|
2690
|
+
* @param projectName - Optional project name for monorepo grouping
|
|
2691
|
+
* @returns Structured report ready for JSON serialization
|
|
2692
|
+
*
|
|
2693
|
+
* @public
|
|
2694
|
+
*/
|
|
2695
|
+
declare function buildAgentReport(testModules: ReadonlyArray<VitestTestModule>, unhandledErrors: ReadonlyArray<VitestModuleError>, reason: "passed" | "failed" | "interrupted", options: {
|
|
2696
|
+
readonly omitPassingTests?: boolean;
|
|
2697
|
+
}, projectName?: string): AgentReport;
|
|
2698
|
+
//#endregion
|
|
2699
|
+
//#region src/utils/canonicalize-git-url.d.ts
|
|
2700
|
+
/**
|
|
2701
|
+
* Canonicalize a git remote URL.
|
|
2702
|
+
*
|
|
2703
|
+
* Returns `null` when the input is empty, whitespace-only, or has
|
|
2704
|
+
* neither a host nor a path after stripping known prefixes.
|
|
2705
|
+
*
|
|
2706
|
+
* Steps applied in order:
|
|
2707
|
+
*
|
|
2708
|
+
* 1. Trim whitespace.
|
|
2709
|
+
* 2. If the value starts with `[git+]ssh|https|http://`, strip the
|
|
2710
|
+
* scheme. After stripping, drop any embedded `user@` segment.
|
|
2711
|
+
* 3. Otherwise, try the SSH shorthand `user@host:path` pattern; on a
|
|
2712
|
+
* match, rebuild as `host/path` (drop the user).
|
|
2713
|
+
* 4. Strip trailing `.git`.
|
|
2714
|
+
* 5. Strip trailing `/`.
|
|
2715
|
+
* 6. Lowercase the entire string.
|
|
2716
|
+
* 7. Reject if the result is empty or has no `/` (no path) — a bare
|
|
2717
|
+
* host like `github.com` is not a project identity.
|
|
2718
|
+
* @public
|
|
2719
|
+
*/
|
|
2720
|
+
declare const canonicalizeGitUrl: (raw: string) => string | null;
|
|
2721
|
+
/**
|
|
2722
|
+
* Convert a (possibly raw) git URL to the filesystem-safe `project_key`
|
|
2723
|
+
* form. The canonical `host/path` is mapped 1:1 to `host__path` so it
|
|
2724
|
+
* can serve as a single path segment under
|
|
2725
|
+
* `$XDG_DATA_HOME/vitest-agent/`.
|
|
2726
|
+
* @public
|
|
2727
|
+
*/
|
|
2728
|
+
declare const gitUrlToProjectKey: (raw: string) => string | null;
|
|
2729
|
+
//#endregion
|
|
2730
|
+
//#region src/utils/classify-test.d.ts
|
|
2731
|
+
/**
|
|
2732
|
+
* Classify a test based on its current state and prior run history.
|
|
2733
|
+
*
|
|
2734
|
+
* @param current - The test's state in the current run
|
|
2735
|
+
* @param priorRuns - Previous runs (most recent first), before the current run was prepended
|
|
2736
|
+
* @returns The test's classification
|
|
2737
|
+
* @public
|
|
2738
|
+
*/
|
|
2739
|
+
declare function classifyTest(current: "passed" | "failed", priorRuns: ReadonlyArray<{
|
|
2740
|
+
state: string;
|
|
2741
|
+
}>): TestClassification;
|
|
2742
|
+
//#endregion
|
|
2743
|
+
//#region src/utils/compress-lines.d.ts
|
|
2744
|
+
/**
|
|
2745
|
+
* Compress an array of line numbers into a compact range string.
|
|
2746
|
+
*
|
|
2747
|
+
* Consecutive line numbers are collapsed into `start-end` ranges,
|
|
2748
|
+
* separated by commas. Duplicate values are removed and the input
|
|
2749
|
+
* is sorted ascending before processing.
|
|
2750
|
+
*
|
|
2751
|
+
* @param lines - Array of line numbers to compress
|
|
2752
|
+
* @returns Compressed range string, or empty string for empty input
|
|
2753
|
+
*
|
|
2754
|
+
* @example
|
|
2755
|
+
* ```typescript
|
|
2756
|
+
* import { compressLines } from "@vitest-agent/sdk/utils";
|
|
2757
|
+
*
|
|
2758
|
+
* compressLines([1, 2, 3, 5, 10, 11, 12]);
|
|
2759
|
+
* // Returns: "1-3,5,10-12"
|
|
2760
|
+
*
|
|
2761
|
+
* compressLines([42]);
|
|
2762
|
+
* // Returns: "42"
|
|
2763
|
+
*
|
|
2764
|
+
* compressLines([]);
|
|
2765
|
+
* // Returns: ""
|
|
2766
|
+
* ```
|
|
2767
|
+
*
|
|
2768
|
+
* @public
|
|
2769
|
+
*/
|
|
2770
|
+
declare function compressLines(lines: number[]): string;
|
|
2771
|
+
//#endregion
|
|
2772
|
+
//#region src/utils/compute-trend.d.ts
|
|
2773
|
+
/**
|
|
2774
|
+
* Hash resolved targets to detect configuration changes.
|
|
2775
|
+
*
|
|
2776
|
+
* Note: JSON.stringify is order-sensitive, but resolveThresholds()
|
|
2777
|
+
* always produces keys in METRIC_KEYS iteration order, so the hash
|
|
2778
|
+
* is stable for the same logical configuration.
|
|
2779
|
+
* @public
|
|
2780
|
+
*/
|
|
2781
|
+
declare function hashTargets(targets: ResolvedThresholds | undefined): string | undefined;
|
|
2782
|
+
/**
|
|
2783
|
+
* Compute a new trend entry and return the updated trend record.
|
|
2784
|
+
*
|
|
2785
|
+
* If targets have changed (different hash), the trend history is
|
|
2786
|
+
* cleared and the new entry becomes the first data point.
|
|
2787
|
+
* @public
|
|
2788
|
+
*/
|
|
2789
|
+
declare function computeTrend(current: CoverageTotals, existing: TrendRecord | undefined, targets: ResolvedThresholds | undefined): TrendRecord;
|
|
2790
|
+
/**
|
|
2791
|
+
* Get the overall direction from recent entries.
|
|
2792
|
+
* @public
|
|
2793
|
+
*/
|
|
2794
|
+
declare function getRecentDirection(record: TrendRecord, count?: number): {
|
|
2795
|
+
direction: "improving" | "regressing" | "stable";
|
|
2796
|
+
runCount: number;
|
|
2797
|
+
};
|
|
2798
|
+
//#endregion
|
|
2799
|
+
//#region src/utils/detect-pm.d.ts
|
|
2800
|
+
/**
|
|
2801
|
+
* Filesystem abstraction for package manager detection.
|
|
2802
|
+
*
|
|
2803
|
+
* @remarks
|
|
2804
|
+
* This interface allows dependency injection for testability. In production,
|
|
2805
|
+
* pass an adapter backed by `node:fs/promises`. In tests, provide a mock
|
|
2806
|
+
* implementation.
|
|
2807
|
+
*
|
|
2808
|
+
* @example
|
|
2809
|
+
* ```typescript
|
|
2810
|
+
* import type { FileSystemAdapter } from "@vitest-agent/sdk/detect-pm";
|
|
2811
|
+
* import { readFile, access } from "node:fs/promises";
|
|
2812
|
+
*
|
|
2813
|
+
* const fsAdapter: FileSystemAdapter = {
|
|
2814
|
+
* readFile: (path: string) => readFile(path, "utf-8"),
|
|
2815
|
+
* exists: async (path: string) => {
|
|
2816
|
+
* try {
|
|
2817
|
+
* await access(path);
|
|
2818
|
+
* return true;
|
|
2819
|
+
* } catch {
|
|
2820
|
+
* return false;
|
|
2821
|
+
* }
|
|
2822
|
+
* },
|
|
2823
|
+
* };
|
|
2824
|
+
* ```
|
|
2825
|
+
*
|
|
2826
|
+
* @internal
|
|
2827
|
+
*/
|
|
2828
|
+
interface FileSystemAdapter {
|
|
2829
|
+
readFile(path: string): Promise<string>;
|
|
2830
|
+
exists(path: string): Promise<boolean>;
|
|
2831
|
+
}
|
|
2832
|
+
/**
|
|
2833
|
+
* Detect the package manager used in a project by inspecting the root directory.
|
|
2834
|
+
*
|
|
2835
|
+
* @remarks
|
|
2836
|
+
* Detection order:
|
|
2837
|
+
* 1. The `packageManager` field in `package.json` (e.g., `"pnpm\@10.32.1"`)
|
|
2838
|
+
* 2. Lockfile presence: `pnpm-lock.yaml`, `package-lock.json`, `yarn.lock`, `bun.lock`
|
|
2839
|
+
*
|
|
2840
|
+
* Returns `null` when no package manager can be determined.
|
|
2841
|
+
*
|
|
2842
|
+
* @param root - Absolute path to the project root directory
|
|
2843
|
+
* @param fs - Filesystem adapter for reading files and checking existence
|
|
2844
|
+
* @returns The detected package manager, or `null`
|
|
2845
|
+
*
|
|
2846
|
+
* @internal
|
|
2847
|
+
*/
|
|
2848
|
+
declare function detectPackageManager(root: string, fs: FileSystemAdapter): Promise<PackageManager | null>;
|
|
2849
|
+
/**
|
|
2850
|
+
* Return the vitest run command for the given package manager.
|
|
2851
|
+
*
|
|
2852
|
+
* Falls back to `"npx vitest run"` when `pm` is `null`.
|
|
2853
|
+
*
|
|
2854
|
+
* @param pm - Detected package manager, or `null` for unknown
|
|
2855
|
+
* @returns Shell command string for running vitest
|
|
2856
|
+
*
|
|
2857
|
+
* @internal
|
|
2858
|
+
*/
|
|
2859
|
+
declare function getRunCommand(pm: PackageManager | null): string;
|
|
2860
|
+
//#endregion
|
|
2861
|
+
//#region src/utils/detect-timeout.d.ts
|
|
2862
|
+
/**
|
|
2863
|
+
* True when the error looks like a Vitest test or hook timeout. Either
|
|
2864
|
+
* the message matches "timed out in Nms" or the error name contains
|
|
2865
|
+
* "timeout".
|
|
2866
|
+
* @public
|
|
2867
|
+
*/
|
|
2868
|
+
declare const isTimeoutError: (error: {
|
|
2869
|
+
message?: string;
|
|
2870
|
+
name?: string;
|
|
2871
|
+
}) => boolean;
|
|
2872
|
+
//#endregion
|
|
2873
|
+
//#region src/utils/ensure-migrated.d.ts
|
|
2874
|
+
/**
|
|
2875
|
+
* Ensure the SQLite database at `dbPath` is migrated. Runs migrations at
|
|
2876
|
+
* most once per dbPath in the current process; concurrent calls share the
|
|
2877
|
+
* same in-flight promise. Subsequent calls (after the first resolves) are
|
|
2878
|
+
* no-ops.
|
|
2879
|
+
* @public
|
|
2880
|
+
*/
|
|
2881
|
+
declare function ensureMigrated(dbPath: string, logLevel?: LogLevel.LogLevel, logFile?: string): Promise<void>;
|
|
2882
|
+
/**
|
|
2883
|
+
* Reset the migration cache. Test-only.
|
|
2884
|
+
*
|
|
2885
|
+
* @internal
|
|
2886
|
+
*/
|
|
2887
|
+
declare function _resetMigrationCacheForTesting(): void;
|
|
2888
|
+
//#endregion
|
|
2889
|
+
//#region src/utils/failure-signature.d.ts
|
|
2890
|
+
/** @public */
|
|
2891
|
+
interface FailureSignatureInput {
|
|
2892
|
+
readonly error_name: string;
|
|
2893
|
+
readonly assertion_message: string;
|
|
2894
|
+
readonly top_frame_function_name: string;
|
|
2895
|
+
readonly top_frame_function_boundary_line: number | null;
|
|
2896
|
+
readonly top_frame_raw_line?: number;
|
|
2897
|
+
}
|
|
2898
|
+
/** @public */
|
|
2899
|
+
declare const normalizeAssertionShape: (message: string) => string | null;
|
|
2900
|
+
/** @public */
|
|
2901
|
+
declare const computeFailureSignature: (input: FailureSignatureInput) => string;
|
|
2902
|
+
//#endregion
|
|
2903
|
+
//#region src/utils/format-console.d.ts
|
|
2904
|
+
/**
|
|
2905
|
+
* Options controlling console markdown output formatting.
|
|
2906
|
+
*
|
|
2907
|
+
* @internal
|
|
2908
|
+
*/
|
|
2909
|
+
interface ConsoleFormatOptions {
|
|
2910
|
+
/** Output verbosity: `"failures"` (default), `"full"`, or `"silent"`. */
|
|
2911
|
+
consoleOutput: "failures" | "full" | "silent";
|
|
2912
|
+
/** Maximum number of low-coverage files to show in console output. */
|
|
2913
|
+
coverageConsoleLimit: number;
|
|
2914
|
+
/** When `true`, suppress ANSI color codes for valid plain markdown. */
|
|
2915
|
+
noColor: boolean;
|
|
2916
|
+
/** Optional trend summary for tiered coverage output. */
|
|
2917
|
+
trendSummary?: {
|
|
2918
|
+
direction: "improving" | "regressing" | "stable";
|
|
2919
|
+
runCount: number;
|
|
2920
|
+
firstMetric?: {
|
|
2921
|
+
name: string;
|
|
2922
|
+
from: number;
|
|
2923
|
+
to: number;
|
|
2924
|
+
target?: number;
|
|
2925
|
+
};
|
|
2926
|
+
};
|
|
2927
|
+
/** CLI run command prefix for coverage/trends hints (e.g., `"pnpm vitest-agent"`). */
|
|
2928
|
+
runCommand?: string;
|
|
2929
|
+
/** When true, suggest MCP tools instead of CLI commands in Next Steps. */
|
|
2930
|
+
mcp?: boolean;
|
|
2931
|
+
}
|
|
2932
|
+
/**
|
|
2933
|
+
* Return the metric with the lowest percentage from a `FileCoverageReport`.
|
|
2934
|
+
*
|
|
2935
|
+
* @remarks
|
|
2936
|
+
* Used to surface the single worst coverage metric per file in console output,
|
|
2937
|
+
* keeping the display compact. Labels are abbreviated: `"Stmts"`, `"Branch"`,
|
|
2938
|
+
* `"Funcs"`, `"Lines"`.
|
|
2939
|
+
*
|
|
2940
|
+
* @param f - File coverage report to analyze
|
|
2941
|
+
* @returns Object with `label` and `pct` of the worst metric
|
|
2942
|
+
*
|
|
2943
|
+
* @internal
|
|
2944
|
+
*/
|
|
2945
|
+
declare function getWorstMetric(f: FileCoverageReport): {
|
|
2946
|
+
label: string;
|
|
2947
|
+
pct: number;
|
|
2948
|
+
};
|
|
2949
|
+
/**
|
|
2950
|
+
* Strip the working directory prefix from a file path to produce a
|
|
2951
|
+
* project-relative path for display.
|
|
2952
|
+
*
|
|
2953
|
+
* @param filePath - Absolute or relative file path
|
|
2954
|
+
* @param cwd - Working directory to strip; defaults to `process.cwd()`
|
|
2955
|
+
* @returns Project-relative path string
|
|
2956
|
+
*
|
|
2957
|
+
* @internal
|
|
2958
|
+
*/
|
|
2959
|
+
declare function relativePath(filePath: string, cwd?: string): string;
|
|
2960
|
+
/**
|
|
2961
|
+
* Determine the output tier based on test results and coverage state.
|
|
2962
|
+
*
|
|
2963
|
+
* - `"red"` -- failures, unhandled errors, or files below threshold
|
|
2964
|
+
* - `"yellow"` -- all tests pass but coverage targets exist (room to improve)
|
|
2965
|
+
* - `"green"` -- all tests pass, all coverage targets met
|
|
2966
|
+
*
|
|
2967
|
+
* @internal
|
|
2968
|
+
*/
|
|
2969
|
+
declare function determineTier(report: AgentReport): "green" | "yellow" | "red";
|
|
2970
|
+
/**
|
|
2971
|
+
* Format an {@link (AgentReport:variable)} as compact, actionable console markdown.
|
|
2972
|
+
*
|
|
2973
|
+
* @remarks
|
|
2974
|
+
* The output is structured for LLM agent consumption with four sections:
|
|
2975
|
+
*
|
|
2976
|
+
* 1. **Compact header** with pass/fail counts and duration
|
|
2977
|
+
* 2. **Failed test details** with error messages and diffs (the core value)
|
|
2978
|
+
* 3. **Coverage gaps** showing only files below threshold, worst metric first
|
|
2979
|
+
* 4. **Next steps** with re-run commands and cache file pointer
|
|
2980
|
+
*
|
|
2981
|
+
* When all tests pass, the output collapses to a single success line
|
|
2982
|
+
* with an optional cache file reference.
|
|
2983
|
+
*
|
|
2984
|
+
* Returns an empty string when `consoleOutput` is `"silent"`.
|
|
2985
|
+
*
|
|
2986
|
+
* @param report - The report to format
|
|
2987
|
+
* @param options - Formatting options controlling verbosity and color
|
|
2988
|
+
* @returns Formatted markdown string, or empty string for silent mode
|
|
2989
|
+
*
|
|
2990
|
+
* @internal
|
|
2991
|
+
*/
|
|
2992
|
+
declare function formatConsoleMarkdown(report: AgentReport, options: ConsoleFormatOptions): string;
|
|
2993
|
+
//#endregion
|
|
2994
|
+
//#region src/utils/format-fatal-error.d.ts
|
|
2995
|
+
/**
|
|
2996
|
+
* Format an unknown error into a human-readable string with issue URL.
|
|
2997
|
+
*
|
|
2998
|
+
* Extraction order:
|
|
2999
|
+
* 1. Effect Cause — use `Cause.pretty()` for full formatting
|
|
3000
|
+
* 2. Effect FiberFailure — extract Cause and use `Cause.pretty()`
|
|
3001
|
+
* 3. Plain Error — extract `.message` and `.stack`
|
|
3002
|
+
* 4. Unknown — `String(err)`
|
|
3003
|
+
*
|
|
3004
|
+
* @public
|
|
3005
|
+
*/
|
|
3006
|
+
declare function formatFatalError(err: unknown): string;
|
|
3007
|
+
//#endregion
|
|
3008
|
+
//#region src/utils/format-gfm.d.ts
|
|
3009
|
+
/**
|
|
3010
|
+
* Format one or more {@link (AgentReport:variable) | AgentReports} as a GitHub-Flavored
|
|
3011
|
+
* Markdown string for writing to `GITHUB_STEP_SUMMARY`.
|
|
3012
|
+
*
|
|
3013
|
+
* @remarks
|
|
3014
|
+
* GFM-specific features used in the output:
|
|
3015
|
+
*
|
|
3016
|
+
* - **Summary table** with pass/fail counts across all projects
|
|
3017
|
+
* - **Collapsible `<details>` blocks** for per-project results in monorepo setups
|
|
3018
|
+
* - **Tables** for coverage metrics
|
|
3019
|
+
* - **Diff-fenced code blocks** for expected/received comparison output
|
|
3020
|
+
* - **GitHub Alert callouts** (`[!WARNING]`) for coverage threshold violations
|
|
3021
|
+
*
|
|
3022
|
+
* For a single report, the project body is rendered directly without
|
|
3023
|
+
* a `<details>` wrapper. For multiple reports (monorepo), each project
|
|
3024
|
+
* gets its own collapsible section with a status icon in the summary line.
|
|
3025
|
+
*
|
|
3026
|
+
* @param reports - One or more agent reports to format
|
|
3027
|
+
* @returns GFM-formatted string ready for appending to `GITHUB_STEP_SUMMARY`
|
|
3028
|
+
*
|
|
3029
|
+
* @public
|
|
3030
|
+
*/
|
|
3031
|
+
declare function formatGfm(reports: AgentReport[]): string;
|
|
3032
|
+
//#endregion
|
|
3033
|
+
//#region src/utils/function-boundary.d.ts
|
|
3034
|
+
/** @public */
|
|
3035
|
+
interface FunctionBoundary {
|
|
3036
|
+
readonly line: number;
|
|
3037
|
+
readonly name: string;
|
|
3038
|
+
}
|
|
3039
|
+
/**
|
|
3040
|
+
* Parse `source` (JavaScript or TypeScript, via `acorn` + `acorn-typescript`)
|
|
3041
|
+
* and return the smallest enclosing function's start line and name for `line`.
|
|
3042
|
+
*
|
|
3043
|
+
* Returns `null` only when the parser rejects the source outright (rare —
|
|
3044
|
+
* usually a syntax error). Type annotations, generics, decorators, and `as`
|
|
3045
|
+
* casts are all accepted.
|
|
3046
|
+
* @public
|
|
3047
|
+
*/
|
|
3048
|
+
declare const findFunctionBoundary: (source: string, line: number) => FunctionBoundary | null;
|
|
3049
|
+
//#endregion
|
|
3050
|
+
//#region src/utils/hyperlink.d.ts
|
|
3051
|
+
/** @public */
|
|
3052
|
+
interface Osc8Options {
|
|
3053
|
+
readonly enabled: boolean;
|
|
3054
|
+
}
|
|
3055
|
+
/** @public */
|
|
3056
|
+
declare const osc8: (url: string, label: string, options: Osc8Options) => string;
|
|
3057
|
+
//#endregion
|
|
3058
|
+
//#region src/utils/match-vitest-command.d.ts
|
|
3059
|
+
/**
|
|
3060
|
+
* Return `true` if the command invokes Vitest in any of the five
|
|
3061
|
+
* supported shapes. The `vitestScripts` set carries the names of
|
|
3062
|
+
* package.json scripts that were detected as containing `vitest`
|
|
3063
|
+
* (computed once per project and cached by the sidecar).
|
|
3064
|
+
* @public
|
|
3065
|
+
*/
|
|
3066
|
+
declare const isVitestInvocation: (command: string, vitestScripts: ReadonlySet<string>) => boolean;
|
|
3067
|
+
/**
|
|
3068
|
+
* Build the env-var prefix string to prepend to a matched command.
|
|
3069
|
+
*
|
|
3070
|
+
* Returns the assignments in the documented order:
|
|
3071
|
+
* `VITEST_AGENT_CONVERSATION_ID=<uuid> VITEST_AGENT_AGENT_ID=<uuid> [VITEST_AGENT_PARENT_AGENT_ID=<uuid>]`
|
|
3072
|
+
*
|
|
3073
|
+
* POSIX env-prefix syntax scopes the assignments to the
|
|
3074
|
+
* immediately-following process — no sticky-env across subsequent
|
|
3075
|
+
* Bash calls, no risk of cross-contamination.
|
|
3076
|
+
* @public
|
|
3077
|
+
*/
|
|
3078
|
+
declare const buildEnvPrefix: (input: {
|
|
3079
|
+
readonly conversationId: string;
|
|
3080
|
+
readonly agentId: string;
|
|
3081
|
+
readonly parentAgentId?: string;
|
|
3082
|
+
}) => string;
|
|
3083
|
+
/**
|
|
3084
|
+
* Compute the rewritten command for a Bash tool invocation. When the
|
|
3085
|
+
* command does not match a Vitest shape, returns the original
|
|
3086
|
+
* unchanged. When it matches, prepends the env prefix.
|
|
3087
|
+
* @public
|
|
3088
|
+
*/
|
|
3089
|
+
declare const rewriteBashCommand: (input: {
|
|
3090
|
+
readonly command: string;
|
|
3091
|
+
readonly vitestScripts: ReadonlySet<string>;
|
|
3092
|
+
readonly conversationId: string;
|
|
3093
|
+
readonly agentId: string;
|
|
3094
|
+
readonly parentAgentId?: string;
|
|
3095
|
+
}) => string;
|
|
3096
|
+
/**
|
|
3097
|
+
* Detect which package.json scripts invoke Vitest by inspecting the
|
|
3098
|
+
* `scripts` field. Resolves one hop of script reference (e.g.,
|
|
3099
|
+
* `"test": "pnpm test:unit && pnpm test:int"` finds vitest if either
|
|
3100
|
+
* `test:unit` or `test:int` mentions vitest). Multi-hop indirection
|
|
3101
|
+
* is a documented limitation.
|
|
3102
|
+
* @public
|
|
3103
|
+
*/
|
|
3104
|
+
declare const detectVitestScripts: (scripts: Record<string, string>) => Set<string>;
|
|
3105
|
+
//#endregion
|
|
3106
|
+
//#region src/utils/normalize-workspace-key.d.ts
|
|
3107
|
+
/**
|
|
3108
|
+
* Normalize a workspace name into a filesystem-safe directory segment.
|
|
3109
|
+
*
|
|
3110
|
+
* The workspace key drives the per-project subdirectory under the XDG data
|
|
3111
|
+
* directory (e.g. `$XDG_DATA_HOME/vitest-agent/<key>/data.db`). The
|
|
3112
|
+
* key must be deterministic for a given input and safe to use as a single
|
|
3113
|
+
* path segment on macOS, Linux, and Windows.
|
|
3114
|
+
*
|
|
3115
|
+
* Rules (applied in order):
|
|
3116
|
+
*
|
|
3117
|
+
* 1. Replace `/` with `__` so scoped names like `@org/pkg` collapse to
|
|
3118
|
+
* `@org__pkg` rather than introducing a subdirectory boundary. Scoped
|
|
3119
|
+
* npm names contain at most one `/` (between scope and name), and
|
|
3120
|
+
* leading-`@` requires the scope/name form, so `@org__pkg` is not a
|
|
3121
|
+
* valid unscoped npm name -- the `__` token is unambiguous in
|
|
3122
|
+
* practice.
|
|
3123
|
+
* 2. Replace any character outside `[A-Za-z0-9._@-]` with `_`. This catches
|
|
3124
|
+
* Windows-reserved characters (`\`, `:`, `*`, `?`, `"`, `<`, `>`, `|`),
|
|
3125
|
+
* control characters, whitespace, and anything else that varies in
|
|
3126
|
+
* interpretation across filesystems.
|
|
3127
|
+
* 3. Collapse runs of underscores produced by the substitution above into a
|
|
3128
|
+
* single `_` so the output stays compact.
|
|
3129
|
+
*
|
|
3130
|
+
* @param name - The raw `name` field from a workspace's `package.json`.
|
|
3131
|
+
* @returns A filesystem-safe single path segment.
|
|
3132
|
+
* @public
|
|
3133
|
+
*/
|
|
3134
|
+
declare function normalizeWorkspaceKey(name: string): string;
|
|
3135
|
+
//#endregion
|
|
3136
|
+
//#region src/utils/probe-host-metadata.d.ts
|
|
3137
|
+
/** @public */
|
|
3138
|
+
interface HostMetadataResult {
|
|
3139
|
+
readonly source: string | null;
|
|
3140
|
+
readonly value: string | null;
|
|
3141
|
+
readonly metadata: Record<string, unknown> | null;
|
|
3142
|
+
}
|
|
3143
|
+
/**
|
|
3144
|
+
* Walk the priority chain of env-var probes. Returns the first match
|
|
3145
|
+
* along with any decorating metadata (`term_program`, `ci_provider`,
|
|
3146
|
+
* etc.) for that source. When no probe matches, `source`/`value`/
|
|
3147
|
+
* `metadata` are all `null`.
|
|
3148
|
+
*
|
|
3149
|
+
* The probe order matches the plan's table exactly:
|
|
3150
|
+
*
|
|
3151
|
+
* 1. `TMUX_PANE` (tmux reattach-stable)
|
|
3152
|
+
* 2. `WT_SESSION` (Windows Terminal pane)
|
|
3153
|
+
* 3. `WEZTERM_PANE` (WezTerm pane)
|
|
3154
|
+
* 4. `KITTY_WINDOW_ID` (kitty window)
|
|
3155
|
+
* 5. `TERM_SESSION_ID` (iTerm2, Terminal.app)
|
|
3156
|
+
* 6. `VSCODE_INJECTION` + `process.ppid` (handled by the Live layer
|
|
3157
|
+
* since it needs `process.ppid`, not env)
|
|
3158
|
+
* 7. `GITHUB_RUN_ID` + `GITHUB_RUN_ATTEMPT`
|
|
3159
|
+
* 8. `BUILDKITE_JOB_ID` / `CIRCLE_BUILD_NUM` / `GITLAB_CI_JOB_ID`
|
|
3160
|
+
* 9. `process.ppid` walk (handled by the Live layer)
|
|
3161
|
+
* @public
|
|
3162
|
+
*/
|
|
3163
|
+
declare const probeHostMetadataFromEnv: (env: Record<string, string | undefined>) => HostMetadataResult;
|
|
3164
|
+
//#endregion
|
|
3165
|
+
//#region src/utils/resolve-data-path.d.ts
|
|
3166
|
+
/**
|
|
3167
|
+
* Filename of the SQLite database that stores all reporter data.
|
|
3168
|
+
* @public
|
|
3169
|
+
*/
|
|
3170
|
+
declare const DATABASE_FILENAME = "data.db";
|
|
3171
|
+
/**
|
|
3172
|
+
* Caller-supplied overrides for `resolveDataPath`.
|
|
3173
|
+
* @public
|
|
3174
|
+
*/
|
|
3175
|
+
interface ResolveDataPathOptions {
|
|
3176
|
+
/**
|
|
3177
|
+
* Programmatic override for the entire data directory. Highest precedence.
|
|
3178
|
+
*
|
|
3179
|
+
* Use this when the reporter or plugin user has explicitly set
|
|
3180
|
+
* `reporter.cacheDir`. The returned path is `<cacheDir>/data.db`.
|
|
3181
|
+
*/
|
|
3182
|
+
readonly cacheDir?: string;
|
|
3183
|
+
}
|
|
3184
|
+
/**
|
|
3185
|
+
* Resolve the absolute path to the SQLite database for `projectDir`.
|
|
3186
|
+
*
|
|
3187
|
+
* The directory containing the database is ensured to exist before the
|
|
3188
|
+
* function returns, so callers can open the database immediately without
|
|
3189
|
+
* needing to create parent directories. better-sqlite3 creates the file but
|
|
3190
|
+
* not its parent.
|
|
3191
|
+
*
|
|
3192
|
+
* Precedence (highest first):
|
|
3193
|
+
*
|
|
3194
|
+
* 1. `options.cacheDir` — programmatic override.
|
|
3195
|
+
* 2. `cacheDir` from `vitest-agent.config.toml`.
|
|
3196
|
+
* 3. `<XDG data>/<normalized projectKey from config>/data.db`.
|
|
3197
|
+
* 4. `<XDG data>/<projectKey resolved from cwd's package.json>/data.db`.
|
|
3198
|
+
* Source 4 prefers `repository.url` (canonicalized to `host__path`),
|
|
3199
|
+
* falling back to the normalized `name`. This matches the sidecar
|
|
3200
|
+
* CLI's `_internal register-agent` resolver so the reporter and
|
|
3201
|
+
* sidecar always write to the same `data.db`.
|
|
3202
|
+
*
|
|
3203
|
+
* The XDG data directory is namespaced via `AppDirs` (typically
|
|
3204
|
+
* `$XDG_DATA_HOME/vitest-agent`, defaulting to
|
|
3205
|
+
* `~/.local/share/vitest-agent`).
|
|
3206
|
+
*
|
|
3207
|
+
* The path is a function of identity, not filesystem layout. When no
|
|
3208
|
+
* `package.json` is reachable from `projectDir`, the cwd basename is used
|
|
3209
|
+
* as the final fallback so the function never throws on identity lookup.
|
|
3210
|
+
*
|
|
3211
|
+
* @param projectDir - Absolute path inside the user's workspace.
|
|
3212
|
+
* @param options - Optional programmatic overrides.
|
|
3213
|
+
* @public
|
|
3214
|
+
*/
|
|
3215
|
+
declare const resolveDataPath: (projectDir: string, options?: ResolveDataPathOptions) => Effect.Effect<any, import("config-file-effect").ConfigError | import("xdg-effect").AppDirsError, import("config-file-effect").ConfigFileService<VitestAgentConfig> | AppDirs>;
|
|
3216
|
+
//#endregion
|
|
3217
|
+
//#region src/utils/resolve-project-key-from-cwd.d.ts
|
|
3218
|
+
/**
|
|
3219
|
+
* Compute the project key for a workspace by reading `package.json`
|
|
3220
|
+
* fields directly. Returns the canonical `host__path` form when a git
|
|
3221
|
+
* remote URL is present, otherwise the normalized package name.
|
|
3222
|
+
*
|
|
3223
|
+
* Always returns a non-empty string — falls back to the cwd basename
|
|
3224
|
+
* (or `"anonymous-project"`) so callers don't have to handle the
|
|
3225
|
+
* empty case.
|
|
3226
|
+
* @public
|
|
3227
|
+
*/
|
|
3228
|
+
declare const resolveProjectKeyFromCwd: (cwd: string) => string;
|
|
3229
|
+
//#endregion
|
|
3230
|
+
//#region src/utils/resolve-workspace-key.d.ts
|
|
3231
|
+
/**
|
|
3232
|
+
* Resolve the normalized workspace key for the workspace containing
|
|
3233
|
+
* `projectDir`.
|
|
3234
|
+
*
|
|
3235
|
+
* The key is the root `package.json`'s `name`, normalized via
|
|
3236
|
+
* `normalizeWorkspaceKey`. This becomes the directory segment under
|
|
3237
|
+
* `$XDG_DATA_HOME/vitest-agent/` where the SQLite database lives.
|
|
3238
|
+
*
|
|
3239
|
+
* Fails with `WorkspaceRootNotFoundError` when no root workspace is
|
|
3240
|
+
* discoverable from `projectDir`. `WorkspacePackage.name` is enforced
|
|
3241
|
+
* non-empty by `workspaces-effect`'s schema, so a successful root lookup
|
|
3242
|
+
* always yields a usable name.
|
|
3243
|
+
*
|
|
3244
|
+
* @param projectDir - Absolute path inside the workspace. Typically the
|
|
3245
|
+
* reporter's resolved `projectDir` (CLAUDE_PROJECT_DIR or process.cwd()).
|
|
3246
|
+
* @public
|
|
3247
|
+
*/
|
|
3248
|
+
declare const resolveWorkspaceKey: (projectDir: string) => Effect.Effect<string, WorkspaceRootNotFoundError | WorkspaceDiscoveryError, WorkspaceDiscovery>;
|
|
3249
|
+
//#endregion
|
|
3250
|
+
//#region src/utils/safe-filename.d.ts
|
|
3251
|
+
/**
|
|
3252
|
+
* Convert a project name to a filesystem-safe filename.
|
|
3253
|
+
*
|
|
3254
|
+
* Replaces `/` and `:` characters with `__` (double underscore).
|
|
3255
|
+
* Returns `"default"` for empty strings, which is used as the
|
|
3256
|
+
* fallback project name for single-repo configurations.
|
|
3257
|
+
*
|
|
3258
|
+
* @param name - Project name to sanitize
|
|
3259
|
+
* @returns Filesystem-safe filename string
|
|
3260
|
+
*
|
|
3261
|
+
* @example
|
|
3262
|
+
* ```typescript
|
|
3263
|
+
* import { safeFilename } from "@vitest-agent/sdk/utils";
|
|
3264
|
+
*
|
|
3265
|
+
* safeFilename("\@savvy-web/my-lib:unit");
|
|
3266
|
+
* // Returns: "\@savvy-web__my-lib__unit"
|
|
3267
|
+
*
|
|
3268
|
+
* safeFilename("core");
|
|
3269
|
+
* // Returns: "core"
|
|
3270
|
+
*
|
|
3271
|
+
* safeFilename("");
|
|
3272
|
+
* // Returns: "default"
|
|
3273
|
+
* ```
|
|
3274
|
+
*
|
|
3275
|
+
* @public
|
|
3276
|
+
*/
|
|
3277
|
+
declare function safeFilename(name: string): string;
|
|
3278
|
+
//#endregion
|
|
3279
|
+
//#region src/utils/validate-coverage-targets-shape.d.ts
|
|
3280
|
+
/** @public */
|
|
3281
|
+
interface CoverageTargetsShapeError {
|
|
3282
|
+
readonly code: string;
|
|
3283
|
+
readonly path: string;
|
|
3284
|
+
readonly message: string;
|
|
3285
|
+
}
|
|
3286
|
+
/** @public */
|
|
3287
|
+
interface CoverageTargetsShapeWarning {
|
|
3288
|
+
readonly code: string;
|
|
3289
|
+
readonly path: string;
|
|
3290
|
+
readonly message: string;
|
|
3291
|
+
}
|
|
3292
|
+
/** @public */
|
|
3293
|
+
interface CoverageTargetsShapeInfo {
|
|
3294
|
+
readonly code: string;
|
|
3295
|
+
readonly message: string;
|
|
3296
|
+
}
|
|
3297
|
+
/** @public */
|
|
3298
|
+
interface CoverageTargetsShapeResult {
|
|
3299
|
+
readonly errors: ReadonlyArray<CoverageTargetsShapeError>;
|
|
3300
|
+
readonly warnings: ReadonlyArray<CoverageTargetsShapeWarning>;
|
|
3301
|
+
readonly info: ReadonlyArray<CoverageTargetsShapeInfo>;
|
|
3302
|
+
}
|
|
3303
|
+
/**
|
|
3304
|
+
* Validates the shape of a raw coverageTargets value, producing structured
|
|
3305
|
+
* diagnostic entries. This is a pure function with no Effect or I/O.
|
|
3306
|
+
*
|
|
3307
|
+
* Codes emitted:
|
|
3308
|
+
* - `INVALID_TARGET_VALUE` — a numeric metric value is zero or negative,
|
|
3309
|
+
* OR a literal `true` appears at any key other than `"100"`. The
|
|
3310
|
+
* offending `path` is included (e.g. `"lines"`, `"src/**.ts.lines"`,
|
|
3311
|
+
* or `"statements"` when misused as a boolean shortcut).
|
|
3312
|
+
* - `PERFILE_ON_TARGETS` — the `perFile` key appears inside coverageTargets;
|
|
3313
|
+
* it should be set on `coverage.thresholds.perFile` instead.
|
|
3314
|
+
*
|
|
3315
|
+
* @param input - The raw value passed as coverageTargets.
|
|
3316
|
+
* @returns A result object with errors, warnings, and info arrays.
|
|
3317
|
+
* @public
|
|
3318
|
+
*/
|
|
3319
|
+
declare function validateCoverageTargetsShape(input: unknown): CoverageTargetsShapeResult;
|
|
3320
|
+
//#endregion
|
|
3321
|
+
//#region src/index.d.ts
|
|
3322
|
+
/**
|
|
3323
|
+
* The version of this package. Inlined at build time from
|
|
3324
|
+
* package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
|
|
3325
|
+
* Source-level reads (workspace `exports: "./src/index.ts"` during dev)
|
|
3326
|
+
* see the `"0.0.0"` fallback — a clear signal the build pipeline has not
|
|
3327
|
+
* substituted yet. Read by the plugin / MCP / CLI init-time drift check.
|
|
3328
|
+
* See the root CLAUDE.md "Cross-package version drift" section.
|
|
3329
|
+
* @public
|
|
3330
|
+
*/
|
|
3331
|
+
declare const CURRENT_SDK_VERSION: string;
|
|
3332
|
+
//#endregion
|
|
3333
|
+
export { AcceptanceMetrics, ActionSeverity, ActorType, Agent, AgentConsoleMode, AgentContext, AgentId, AgentNotFoundError, AgentPluginOptions, AgentReport, AgentReporterOptions, AgentTreeNode, AnsiOptions, ArtifactKind, AssembledHistoryRecord, AssociateRunSessionInput, BehaviorAbandonedEvent, BehaviorAddedEvent, BehaviorCompletedEvent, BehaviorDetail, BehaviorNotFoundError, BehaviorRow, BehaviorScopedEventType, BehaviorScopedEventTypes, BehaviorStartedEvent, BehaviorStatus, BehaviorsReadyEvent, BlockedEvent, CURRENT_SDK_VERSION, CacheManifest, CacheManifestEntry, CandidateContext, CellOptions, ChangeKind, ChannelEvent, ChatId, CiConsoleMode, CitedArtifact, CitedArtifactRow, CommitChangesEntry, ConfigLive, ConsoleFormatOptions, ConsoleLogLevel, ConsoleMode, ConsoleOutputMode, ConsoleOutputs, ConversationId, ConversationNotFoundError, CoverageBaselines, FileCoverageReport as CoverageFile, FileCoverageReport, CoverageGap, CoverageInput, CoverageLevel, CoverageLevelName, CoverageMetric, CoverageRenderState, CoverageReport, CoverageTargets, CoverageTargetsMetrics, CoverageTargetsShapeError, CoverageTargetsShapeInfo, CoverageTargetsShapeResult, CoverageTargetsShapeWarning, CoverageTotals, CreateBehaviorInput, CreateGoalInput, CurrentTddPhase, DATABASE_FILENAME, DataReader, DataReaderLive, DataStore, DataStoreError, DataStoreLive, DenialReason, DetailLevel, DetailResolver, DetailResolverLive, DiscoveryError, DiscoveryRegistry, DiscoveryRegistryLive, DispatchInputs, EndTddTaskInput, Environment, EnvironmentDetector, EnvironmentDetectorLive, EnvironmentDetectorTest, Executor, ExecutorResolver, ExecutorResolverLive, FailureRecord, FailureSignatureDetail, FailureSignatureInput, FailureSignatureWriteInput, FileCoverageInput, FileEditPayload, FileSystemAdapter, FlakyTest, FormatSelector, FormatSelectorLive, type FormatTriageOptions, type FormatWrapupOptions, Formatter, FormatterContext, FunctionBoundary, GfmFormatter, GitCommandError, GoalAbandonedEvent, GoalAddedEvent, GoalCompletedEvent, GoalDetail, GoalNotFoundError, GoalRow, GoalStartedEvent, GoalStatus, GoalsReadyEvent, HistoryRecord, HistoryRow, HistoryTracker, HistoryTrackerLive, HistoryTrackerTest, HistoryTrackerTestState, HookFirePayload, HookStatus, HookType, HostKind, HostMetadataParseError, HostMetadataResult, HumanConsoleMode, HypothesisDetail, HypothesisInput, HypothesisPayload, IDEMPOTENCY_ROOT_SENTINEL, IdempotencyHit, IdempotencyInput, IdempotentResponseInput, IllegalStatusTransitionEntity, IllegalStatusTransitionError, JsonFormatter, KnownProject, KnownProjectInput, LoggerLive, ManifestRow, MapSessionInput, MapSessionOutput, MarkdownFormatter, MetricThresholds, ModuleInput, ModuleListEntry, ModuleRecord, ModuleReport, NoteInput, NotePayload, NoteRow, Osc8Options, OutputFormat, OutputPipelineLive, OutputRenderer, OutputRendererLive, PackageManager, PathResolutionError, PathResolutionLive, PatternThresholds, PerClientSessionMapReader, PerClientSessionMapReaderLive, PerClientSessionMapWriter, PerClientSessionMapWriterLive, PersistentFailure, Phase, PhaseTransitionContext, PhaseTransitionEvent, PhaseTransitionResult, ProbeMissError, ProjectDiscovery, ProjectDiscoveryLive, ProjectDiscoveryTest, ProjectIdentity, ProjectIdentityCandidate, ProjectIdentityCandidates, ProjectIdentityLive, ProjectIdentityNotResolvableError, ProjectIdentitySource, ProjectIdentityTest, ProjectKey, ProjectRunSummary, ProjectSummary, RegisterAgentInput, RegisterAgentResult, RegistrationConflictError, Remediation, RenderState, RenderTotals, RenderedOutput, ReportError, ReportSummary, ReporterKit, ReporterRenderInput, ResolveDataPathOptions, ResolveProjectIdentityOptions, ResolvedIdentity, ResolvedReporterConfig, ResolvedThresholds, RunChangedFile, RunContext, RunContext$, RunContextLive, RunContextService, RunContextTest, RunEvent, RunEventByTag, RunHealth, RunInvocationMethod, RunOutcome, RunShape, SessionCompleteEvent, SessionContextRow, SessionDetail, SessionInput, SessionNotFoundError, SessionOutcome, SettingsInput, SettingsListEntry, SettingsRow, SidecarTimeoutError, SilentFormatter, StackFrameInput, SuggestedActionRecord, SuiteInput, SuiteListEntry, TagCountEntry, TagInventoryRow, TddArtifactDetail, TddArtifactRow, TddPhaseDetail, TddTaskAlreadyEndedError, TddTaskDetail, TddTaskEndOutcome, TddTaskId, TddTaskInput, TddTaskNotFoundError, TddTaskSummary, TerminalFormatter, TestCaseInput, TestClassification, TestError, TestErrorInput, TestFileEntry, TestHistory, TestListEntry, TestOutcome, TestRecord, TestReport, TestRun, TestRunInput, TestRunReason, TestState, ToolCallPayload, ToolResultPayload, Transport, TrendEntry, TrendRecord, TrendSummary, TurnInput, TurnPayload, TurnSearchOptions, TurnSummary, UpdateBehaviorInput, UpdateGoalInput, UserPromptPayload, ValidateHypothesisInput, VitestAgentConfig, VitestAgentConfigFile, VitestAgentConfigFileService, VitestAgentReporter, VitestAgentReporterFactory, VitestModuleDiagnostic, VitestModuleError, VitestParsedStack, VitestTestCase, VitestTestDiagnostic, VitestTestError, VitestTestModule, VitestTestResult, VitestTestSuite, type WrapupKind, WriteCommitInput, WriteRunChangedFilesInput, WriteTddArtifactInput, WriteTddPhaseInput, WriteTddPhaseOutput, _resetMigrationCacheForTesting, ansi, assembleHistoryRecord, assembleManifest, buildAgentReport, buildEnvPrefix, canonicalizeGitUrl, ciAnnotationsFormatter, classifyTest, compressLines, computeFailureSignature, computeTrend, deriveIdempotencyKey, detectPackageManager, detectVitestScripts, determineTier, ensureMigrated, extractSqlReason, findFunctionBoundary, formatConsoleMarkdown, formatFatalError, formatGfm, formatTriageEffect, formatWrapupEffect, getRecentDirection, getRunCommand, getWorstMetric, gitUrlToProjectKey, hashTargets, initialRenderState, isTimeoutError, isVitestInvocation, migration as migration0001, normalizeAssertionShape, normalizeWorkspaceKey, osc8, probeHostMetadataFromEnv, migration$1 as registryMigration0001, relativePath, requiredArtifactForTransition, resolveCoverageInput, resolveDataPath, resolveLogFile, resolveLogLevel, resolveProjectIdentityFromCandidates, resolveProjectKeyFromCwd, resolveWorkspaceKey, rewriteBashCommand, safeFilename, migration$2 as sessionMapMigration0001, stripAnsi, validateCoverageConfig, validateCoverageTargetsShape, validatePhaseTransition };
|
|
3334
|
+
//# sourceMappingURL=index.d.ts.map
|