@vitest-agent/sdk 1.0.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,1809 +0,0 @@
1
- import { Context, Effect, Option, Schema } from "effect";
2
-
3
- //#region src/schemas/Coverage.d.ts
4
- /**
5
- * Aggregate coverage percentages across four istanbul metrics.
6
- * @public
7
- */
8
- declare const CoverageTotals: Schema.Struct<{
9
- statements: typeof Schema.Number;
10
- branches: typeof Schema.Number;
11
- functions: typeof Schema.Number;
12
- lines: typeof Schema.Number;
13
- }>;
14
- /** @public */
15
- type CoverageTotals = typeof CoverageTotals.Type;
16
- /**
17
- * Per-file coverage data including uncovered line ranges.
18
- * @public
19
- */
20
- declare const FileCoverageReport: Schema.Struct<{
21
- file: typeof Schema.String;
22
- summary: Schema.Struct<{
23
- statements: typeof Schema.Number;
24
- branches: typeof Schema.Number;
25
- functions: typeof Schema.Number;
26
- lines: typeof Schema.Number;
27
- }>;
28
- uncoveredLines: typeof Schema.String;
29
- }>;
30
- /** @public */
31
- type FileCoverageReport = typeof FileCoverageReport.Type;
32
- /**
33
- * Complete coverage report attached to an AgentReport.
34
- * @public
35
- */
36
- declare const CoverageReport: Schema.Struct<{
37
- totals: Schema.Struct<{
38
- statements: typeof Schema.Number;
39
- branches: typeof Schema.Number;
40
- functions: typeof Schema.Number;
41
- lines: typeof Schema.Number;
42
- }>;
43
- thresholds: Schema.Struct<{
44
- global: Schema.Struct<{
45
- lines: Schema.optional<typeof Schema.Number>;
46
- functions: Schema.optional<typeof Schema.Number>;
47
- branches: Schema.optional<typeof Schema.Number>;
48
- statements: Schema.optional<typeof Schema.Number>;
49
- }>;
50
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
51
- lines: Schema.optional<typeof Schema.Number>;
52
- functions: Schema.optional<typeof Schema.Number>;
53
- branches: Schema.optional<typeof Schema.Number>;
54
- statements: Schema.optional<typeof Schema.Number>;
55
- }>>>, {
56
- default: () => never[];
57
- }>;
58
- }>;
59
- targets: Schema.optional<Schema.Struct<{
60
- global: Schema.Struct<{
61
- lines: Schema.optional<typeof Schema.Number>;
62
- functions: Schema.optional<typeof Schema.Number>;
63
- branches: Schema.optional<typeof Schema.Number>;
64
- statements: Schema.optional<typeof Schema.Number>;
65
- }>;
66
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
67
- lines: Schema.optional<typeof Schema.Number>;
68
- functions: Schema.optional<typeof Schema.Number>;
69
- branches: Schema.optional<typeof Schema.Number>;
70
- statements: Schema.optional<typeof Schema.Number>;
71
- }>>>, {
72
- default: () => never[];
73
- }>;
74
- }>>;
75
- baselines: Schema.optional<Schema.Struct<{
76
- global: Schema.Struct<{
77
- lines: Schema.optional<typeof Schema.Number>;
78
- functions: Schema.optional<typeof Schema.Number>;
79
- branches: Schema.optional<typeof Schema.Number>;
80
- statements: Schema.optional<typeof Schema.Number>;
81
- }>;
82
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
83
- lines: Schema.optional<typeof Schema.Number>;
84
- functions: Schema.optional<typeof Schema.Number>;
85
- branches: Schema.optional<typeof Schema.Number>;
86
- statements: Schema.optional<typeof Schema.Number>;
87
- }>>>, {
88
- default: () => never[];
89
- }>;
90
- }>>;
91
- scoped: Schema.optionalWith<typeof Schema.Boolean, {
92
- default: () => false;
93
- }>;
94
- scopedFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
95
- lowCoverage: Schema.Array$<Schema.Struct<{
96
- file: typeof Schema.String;
97
- summary: Schema.Struct<{
98
- statements: typeof Schema.Number;
99
- branches: typeof Schema.Number;
100
- functions: typeof Schema.Number;
101
- lines: typeof Schema.Number;
102
- }>;
103
- uncoveredLines: typeof Schema.String;
104
- }>>;
105
- lowCoverageFiles: Schema.Array$<typeof Schema.String>;
106
- belowTarget: Schema.optional<Schema.Array$<Schema.Struct<{
107
- file: typeof Schema.String;
108
- summary: Schema.Struct<{
109
- statements: typeof Schema.Number;
110
- branches: typeof Schema.Number;
111
- functions: typeof Schema.Number;
112
- lines: typeof Schema.Number;
113
- }>;
114
- uncoveredLines: typeof Schema.String;
115
- }>>>;
116
- belowTargetFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
117
- }>;
118
- /** @public */
119
- type CoverageReport = typeof CoverageReport.Type;
120
- //#endregion
121
- //#region src/schemas/AgentReport.d.ts
122
- /**
123
- * Aggregate test run statistics.
124
- * @public
125
- */
126
- declare const ReportSummary: Schema.Struct<{
127
- total: typeof Schema.Number;
128
- passed: typeof Schema.Number;
129
- failed: typeof Schema.Number;
130
- skipped: typeof Schema.Number;
131
- duration: typeof Schema.Number;
132
- }>;
133
- /** @public */
134
- type ReportSummary = typeof ReportSummary.Type;
135
- /**
136
- * An individual test case result.
137
- * @public
138
- */
139
- declare const TestReport: Schema.Struct<{
140
- name: typeof Schema.String;
141
- fullName: typeof Schema.String;
142
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
143
- duration: Schema.optional<typeof Schema.Number>;
144
- flaky: Schema.optional<typeof Schema.Boolean>;
145
- slow: Schema.optional<typeof Schema.Boolean>;
146
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
147
- message: typeof Schema.String;
148
- stack: Schema.optional<typeof Schema.String>;
149
- diff: Schema.optional<typeof Schema.String>;
150
- expected: Schema.optional<typeof Schema.String>;
151
- received: Schema.optional<typeof Schema.String>;
152
- }>>>;
153
- classification: Schema.optional<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
154
- }>;
155
- /** @public */
156
- type TestReport = typeof TestReport.Type;
157
- /**
158
- * A test module (file) and its contained test cases.
159
- * @public
160
- */
161
- declare const ModuleReport: Schema.Struct<{
162
- file: typeof Schema.String;
163
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
164
- duration: Schema.optional<typeof Schema.Number>;
165
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
166
- message: typeof Schema.String;
167
- stack: Schema.optional<typeof Schema.String>;
168
- diff: Schema.optional<typeof Schema.String>;
169
- expected: Schema.optional<typeof Schema.String>;
170
- received: Schema.optional<typeof Schema.String>;
171
- }>>>;
172
- tests: Schema.Array$<Schema.Struct<{
173
- name: typeof Schema.String;
174
- fullName: typeof Schema.String;
175
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
176
- duration: Schema.optional<typeof Schema.Number>;
177
- flaky: Schema.optional<typeof Schema.Boolean>;
178
- slow: Schema.optional<typeof Schema.Boolean>;
179
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
180
- message: typeof Schema.String;
181
- stack: Schema.optional<typeof Schema.String>;
182
- diff: Schema.optional<typeof Schema.String>;
183
- expected: Schema.optional<typeof Schema.String>;
184
- received: Schema.optional<typeof Schema.String>;
185
- }>>>;
186
- classification: Schema.optional<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
187
- }>>;
188
- }>;
189
- /** @public */
190
- type ModuleReport = typeof ModuleReport.Type;
191
- /**
192
- * Per-tag pass/fail/skip aggregates for a single project run.
193
- * @public
194
- */
195
- declare const TagCountEntry: Schema.Struct<{
196
- passed: Schema.optional<typeof Schema.Number>;
197
- failed: Schema.optional<typeof Schema.Number>;
198
- skipped: Schema.optional<typeof Schema.Number>;
199
- }>;
200
- /** @public */
201
- type TagCountEntry = typeof TagCountEntry.Type;
202
- /**
203
- * Complete per-project test report written to disk as JSON.
204
- * @public
205
- */
206
- declare const AgentReport: Schema.Struct<{
207
- timestamp: typeof Schema.String;
208
- project: Schema.optional<typeof Schema.String>;
209
- reason: Schema.Literal<["passed", "failed", "interrupted"]>;
210
- summary: Schema.Struct<{
211
- total: typeof Schema.Number;
212
- passed: typeof Schema.Number;
213
- failed: typeof Schema.Number;
214
- skipped: typeof Schema.Number;
215
- duration: typeof Schema.Number;
216
- }>;
217
- failed: Schema.Array$<Schema.Struct<{
218
- file: typeof Schema.String;
219
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
220
- duration: Schema.optional<typeof Schema.Number>;
221
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
222
- message: typeof Schema.String;
223
- stack: Schema.optional<typeof Schema.String>;
224
- diff: Schema.optional<typeof Schema.String>;
225
- expected: Schema.optional<typeof Schema.String>;
226
- received: Schema.optional<typeof Schema.String>;
227
- }>>>;
228
- tests: Schema.Array$<Schema.Struct<{
229
- name: typeof Schema.String;
230
- fullName: typeof Schema.String;
231
- state: Schema.Literal<["passed", "failed", "skipped", "pending"]>;
232
- duration: Schema.optional<typeof Schema.Number>;
233
- flaky: Schema.optional<typeof Schema.Boolean>;
234
- slow: Schema.optional<typeof Schema.Boolean>;
235
- errors: Schema.optional<Schema.Array$<Schema.Struct<{
236
- message: typeof Schema.String;
237
- stack: Schema.optional<typeof Schema.String>;
238
- diff: Schema.optional<typeof Schema.String>;
239
- expected: Schema.optional<typeof Schema.String>;
240
- received: Schema.optional<typeof Schema.String>;
241
- }>>>;
242
- classification: Schema.optional<Schema.Literal<["stable", "new-failure", "persistent", "flaky", "recovered"]>>;
243
- }>>;
244
- }>>;
245
- unhandledErrors: Schema.Array$<Schema.Struct<{
246
- message: typeof Schema.String;
247
- stack: Schema.optional<typeof Schema.String>;
248
- diff: Schema.optional<typeof Schema.String>;
249
- expected: Schema.optional<typeof Schema.String>;
250
- received: Schema.optional<typeof Schema.String>;
251
- }>>;
252
- failedFiles: Schema.Array$<typeof Schema.String>;
253
- coverage: Schema.optional<Schema.Struct<{
254
- totals: Schema.Struct<{
255
- statements: typeof Schema.Number;
256
- branches: typeof Schema.Number;
257
- functions: typeof Schema.Number;
258
- lines: typeof Schema.Number;
259
- }>;
260
- thresholds: Schema.Struct<{
261
- global: Schema.Struct<{
262
- lines: Schema.optional<typeof Schema.Number>;
263
- functions: Schema.optional<typeof Schema.Number>;
264
- branches: Schema.optional<typeof Schema.Number>;
265
- statements: Schema.optional<typeof Schema.Number>;
266
- }>;
267
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
268
- lines: Schema.optional<typeof Schema.Number>;
269
- functions: Schema.optional<typeof Schema.Number>;
270
- branches: Schema.optional<typeof Schema.Number>;
271
- statements: Schema.optional<typeof Schema.Number>;
272
- }>>>, {
273
- default: () => never[];
274
- }>;
275
- }>;
276
- targets: Schema.optional<Schema.Struct<{
277
- global: Schema.Struct<{
278
- lines: Schema.optional<typeof Schema.Number>;
279
- functions: Schema.optional<typeof Schema.Number>;
280
- branches: Schema.optional<typeof Schema.Number>;
281
- statements: Schema.optional<typeof Schema.Number>;
282
- }>;
283
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
284
- lines: Schema.optional<typeof Schema.Number>;
285
- functions: Schema.optional<typeof Schema.Number>;
286
- branches: Schema.optional<typeof Schema.Number>;
287
- statements: Schema.optional<typeof Schema.Number>;
288
- }>>>, {
289
- default: () => never[];
290
- }>;
291
- }>>;
292
- baselines: Schema.optional<Schema.Struct<{
293
- global: Schema.Struct<{
294
- lines: Schema.optional<typeof Schema.Number>;
295
- functions: Schema.optional<typeof Schema.Number>;
296
- branches: Schema.optional<typeof Schema.Number>;
297
- statements: Schema.optional<typeof Schema.Number>;
298
- }>;
299
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
300
- lines: Schema.optional<typeof Schema.Number>;
301
- functions: Schema.optional<typeof Schema.Number>;
302
- branches: Schema.optional<typeof Schema.Number>;
303
- statements: Schema.optional<typeof Schema.Number>;
304
- }>>>, {
305
- default: () => never[];
306
- }>;
307
- }>>;
308
- scoped: Schema.optionalWith<typeof Schema.Boolean, {
309
- default: () => false;
310
- }>;
311
- scopedFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
312
- lowCoverage: Schema.Array$<Schema.Struct<{
313
- file: typeof Schema.String;
314
- summary: Schema.Struct<{
315
- statements: typeof Schema.Number;
316
- branches: typeof Schema.Number;
317
- functions: typeof Schema.Number;
318
- lines: typeof Schema.Number;
319
- }>;
320
- uncoveredLines: typeof Schema.String;
321
- }>>;
322
- lowCoverageFiles: Schema.Array$<typeof Schema.String>;
323
- belowTarget: Schema.optional<Schema.Array$<Schema.Struct<{
324
- file: typeof Schema.String;
325
- summary: Schema.Struct<{
326
- statements: typeof Schema.Number;
327
- branches: typeof Schema.Number;
328
- functions: typeof Schema.Number;
329
- lines: typeof Schema.Number;
330
- }>;
331
- uncoveredLines: typeof Schema.String;
332
- }>>>;
333
- belowTargetFiles: Schema.optional<Schema.Array$<typeof Schema.String>>;
334
- }>>;
335
- tagCounts: Schema.optional<Schema.Record$<typeof Schema.String, Schema.Struct<{
336
- passed: Schema.optional<typeof Schema.Number>;
337
- failed: Schema.optional<typeof Schema.Number>;
338
- skipped: Schema.optional<typeof Schema.Number>;
339
- }>>>;
340
- }>;
341
- /** @public */
342
- type AgentReport = typeof AgentReport.Type;
343
- //#endregion
344
- //#region src/schemas/Identity.d.ts
345
- /**
346
- * Canonical UUID for an LLM agent invocation. Generated server-side at
347
- * `register_agent` time. Stable across transport reconnects within an
348
- * agent's lifetime.
349
- * @public
350
- */
351
- declare const AgentId: Schema.brand<typeof Schema.UUID, "AgentId">;
352
- /** @public */
353
- type AgentId = Schema.Schema.Type<typeof AgentId>;
354
- /**
355
- * The unit "all work on this feature" rolls up to. Survives
356
- * `claude --resume` and parallel windows; lives in the host's
357
- * transcript filename for Claude Code.
358
- * @public
359
- */
360
- declare const ConversationId: Schema.brand<typeof Schema.UUID, "ConversationId">;
361
- /** @public */
362
- type ConversationId = Schema.Schema.Type<typeof ConversationId>;
363
- /**
364
- * The agent host process's chat id (Claude Code's per-process chat
365
- * UUID, etc.). Shorter-lived than a conversation; one conversation can
366
- * have multiple chats across `--resume` invocations. Distinct from
367
- * `sessions.id` (the SQLite agent-run PK).
368
- * @public
369
- */
370
- declare const ChatId: Schema.brand<typeof Schema.UUID, "ChatId">;
371
- /** @public */
372
- type ChatId = Schema.Schema.Type<typeof ChatId>;
373
- /**
374
- * One TDD orchestration task. Replaces the legacy `tdd_session_id`
375
- * vocabulary so "session" is unambiguous in the codebase.
376
- * @public
377
- */
378
- declare const TddTaskId: Schema.brand<typeof Schema.UUID, "TddTaskId">;
379
- /** @public */
380
- type TddTaskId = Schema.Schema.Type<typeof TddTaskId>;
381
- /**
382
- * Filesystem-safe key for the per-project data store directory under
383
- * `$XDG_DATA_HOME/vitest-agent/<projectKey>/`. Resolved by the
384
- * `ProjectIdentity` service from the explicit option / TOML config /
385
- * git remote / package.json fallback chain. Always non-empty (a missing
386
- * value is `ProjectIdentityNotResolvableError`, not an empty string).
387
- * @public
388
- */
389
- declare const ProjectKey: Schema.brand<Schema.filter<typeof Schema.String>, "ProjectKey">;
390
- /** @public */
391
- type ProjectKey = Schema.Schema.Type<typeof ProjectKey>;
392
- /**
393
- * Who initiated the action (test run, hypothesis, note, TDD phase, …).
394
- * Recorded on every action row alongside `agent_id`.
395
- *
396
- * - `agent` — an LLM agent (`agent_id` is set, `conversation_id` is set)
397
- * - `user` — a human at a terminal (`agent_id` and `conversation_id` are NULL)
398
- * - `system` — a CI run, scheduler, or other non-human/non-agent actor
399
- * @public
400
- */
401
- declare const ActorType: Schema.Literal<["agent", "user", "system"]>;
402
- /** @public */
403
- type ActorType = typeof ActorType.Type;
404
- /**
405
- * Recommended canonical host identifiers. Open enum at the SDK level so
406
- * a new client doesn't require an SDK release; the MCP server defaults
407
- * `agentType` validation against the `${hostKind}-` prefix using this
408
- * value.
409
- *
410
- * `unknown` is the explicit fallback when `clientInfo.name` doesn't
411
- * match a known pattern — preferred over guessing.
412
- * @public
413
- */
414
- declare const HostKind: Schema.Literal<["claude-code", "claude-desktop", "cursor", "goose", "chatgpt", "mcp-inspector", "unknown"]>;
415
- /** @public */
416
- type HostKind = typeof HostKind.Type;
417
- //#endregion
418
- //#region src/errors/AgentErrors.d.ts
419
- declare const AgentNotFoundError_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 & {
420
- readonly _tag: "AgentNotFoundError";
421
- } & Readonly<A>;
422
- /**
423
- * `agent_id` does not exist for the given chat. Surface to the
424
- * caller; the typical resolution is to call `register_agent` for
425
- * this agent first.
426
- * @public
427
- */
428
- declare class AgentNotFoundError extends AgentNotFoundError_base<{
429
- readonly agentId: AgentId;
430
- readonly chatId?: ChatId;
431
- }> {}
432
- declare const SessionNotFoundError_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 & {
433
- readonly _tag: "SessionNotFoundError";
434
- } & Readonly<A>;
435
- /**
436
- * Session row for the given `chat_id` does not exist. The host
437
- * probably hasn't fired the SessionStart equivalent for this chat yet.
438
- * @public
439
- */
440
- declare class SessionNotFoundError extends SessionNotFoundError_base<{
441
- readonly chatId: ChatId;
442
- }> {}
443
- declare const ConversationNotFoundError_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 & {
444
- readonly _tag: "ConversationNotFoundError";
445
- } & Readonly<A>;
446
- /**
447
- * `conversation_id` does not exist. Used by rollup queries that
448
- * require a conversation row.
449
- * @public
450
- */
451
- declare class ConversationNotFoundError extends ConversationNotFoundError_base<{
452
- readonly conversationId: ConversationId;
453
- }> {}
454
- declare const RegistrationConflictError_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 & {
455
- readonly _tag: "RegistrationConflictError";
456
- } & Readonly<A>;
457
- /**
458
- * True conflict — e.g., the `parentAgentId` supplied to
459
- * `register_agent` refers to a different session than the one the
460
- * caller named. Distinct from `IdempotencyHit`, which is a success.
461
- * @public
462
- */
463
- declare class RegistrationConflictError extends RegistrationConflictError_base<{
464
- readonly reason: string;
465
- }> {
466
- constructor(args: {
467
- readonly reason: string;
468
- });
469
- }
470
- declare const HostMetadataParseError_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 & {
471
- readonly _tag: "HostMetadataParseError";
472
- } & Readonly<A>;
473
- /**
474
- * `host_metadata` JSON column failed to parse on read. Usually mapped
475
- * to `DataStoreError` at the row-read boundary; surfaces alone in
476
- * paths that explicitly carry through `Schema.parseJson` errors.
477
- * @public
478
- */
479
- declare class HostMetadataParseError extends HostMetadataParseError_base<{
480
- readonly raw: string;
481
- readonly reason: string;
482
- }> {}
483
- declare const SidecarTimeoutError_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 & {
484
- readonly _tag: "SidecarTimeoutError";
485
- } & Readonly<A>;
486
- /**
487
- * Sidecar exceeded its timeout. Surfaces from the sidecar CLI's
488
- * `Effect.timeout`; the top-level wrapper maps it to exit code 2.
489
- * @public
490
- */
491
- declare class SidecarTimeoutError extends SidecarTimeoutError_base<{
492
- readonly operation: string;
493
- readonly timeoutMs: number;
494
- }> {
495
- constructor(args: {
496
- readonly operation: string;
497
- readonly timeoutMs: number;
498
- });
499
- }
500
- //#endregion
501
- //#region src/errors/DataStoreError.d.ts
502
- declare const DataStoreError_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 & {
503
- readonly _tag: "DataStoreError";
504
- } & Readonly<A>;
505
- /**
506
- * Error raised when a SQLite operation fails at read, write, or migration time.
507
- * @public
508
- */
509
- declare class DataStoreError extends DataStoreError_base<{
510
- readonly operation: "read" | "write" | "migrate";
511
- readonly table: string;
512
- readonly reason: string;
513
- }> {
514
- constructor(args: {
515
- readonly operation: "read" | "write" | "migrate";
516
- readonly table: string;
517
- readonly reason: string;
518
- });
519
- }
520
- /**
521
- * Extract a human-readable reason string from an Effect SqlError or unknown error.
522
- *
523
- * SqlError wraps the underlying better-sqlite3 error in `cause`. The actual SQLite
524
- * message (e.g. "SQLITE_BUSY: database is locked", "UNIQUE constraint failed: ...")
525
- * lives on `cause.message`, while the SqlError's own `message` is generic
526
- * ("Failed to execute statement"). Prefer the cause's message when available.
527
- * @public
528
- */
529
- declare const extractSqlReason: (e: unknown) => string;
530
- //#endregion
531
- //#region src/errors/TddErrors.d.ts
532
- declare const GoalNotFoundError_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 & {
533
- readonly _tag: "GoalNotFoundError";
534
- } & Readonly<A>;
535
- /** @public */
536
- declare class GoalNotFoundError extends GoalNotFoundError_base<{
537
- readonly id: number;
538
- readonly reason: string;
539
- }> {
540
- constructor(args: {
541
- readonly id: number;
542
- readonly reason: string;
543
- });
544
- }
545
- declare const BehaviorNotFoundError_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 & {
546
- readonly _tag: "BehaviorNotFoundError";
547
- } & Readonly<A>;
548
- /** @public */
549
- declare class BehaviorNotFoundError extends BehaviorNotFoundError_base<{
550
- readonly id: number;
551
- readonly reason: string;
552
- }> {
553
- constructor(args: {
554
- readonly id: number;
555
- readonly reason: string;
556
- });
557
- }
558
- declare const TddTaskNotFoundError_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 & {
559
- readonly _tag: "TddTaskNotFoundError";
560
- } & Readonly<A>;
561
- /** @public */
562
- declare class TddTaskNotFoundError extends TddTaskNotFoundError_base<{
563
- readonly id: number;
564
- readonly reason: string;
565
- }> {
566
- constructor(args: {
567
- readonly id: number;
568
- readonly reason: string;
569
- });
570
- }
571
- /** @public */
572
- type TddTaskEndOutcome = "succeeded" | "blocked" | "abandoned";
573
- declare const TddTaskAlreadyEndedError_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 & {
574
- readonly _tag: "TddTaskAlreadyEndedError";
575
- } & Readonly<A>;
576
- /** @public */
577
- declare class TddTaskAlreadyEndedError extends TddTaskAlreadyEndedError_base<{
578
- readonly id: number;
579
- readonly endedAt: string;
580
- readonly outcome: TddTaskEndOutcome;
581
- }> {
582
- constructor(args: {
583
- readonly id: number;
584
- readonly endedAt: string;
585
- readonly outcome: TddTaskEndOutcome;
586
- });
587
- }
588
- /** @public */
589
- type IllegalStatusTransitionEntity = "goal" | "behavior" | "task";
590
- declare const IllegalStatusTransitionError_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 & {
591
- readonly _tag: "IllegalStatusTransitionError";
592
- } & Readonly<A>;
593
- /** @public */
594
- declare class IllegalStatusTransitionError extends IllegalStatusTransitionError_base<{
595
- readonly entity: IllegalStatusTransitionEntity;
596
- readonly id: number;
597
- readonly from: string;
598
- readonly to: string;
599
- readonly reason: string;
600
- }> {
601
- constructor(args: {
602
- readonly entity: IllegalStatusTransitionEntity;
603
- readonly id: number;
604
- readonly from: string;
605
- readonly to: string;
606
- readonly reason: string;
607
- });
608
- }
609
- //#endregion
610
- //#region src/schemas/Baselines.d.ts
611
- /**
612
- * Coverage baselines -- the auto-ratcheting high-water mark.
613
- * @public
614
- */
615
- declare const CoverageBaselines: Schema.Struct<{
616
- updatedAt: typeof Schema.String;
617
- global: Schema.Struct<{
618
- lines: Schema.optional<typeof Schema.Number>;
619
- functions: Schema.optional<typeof Schema.Number>;
620
- branches: Schema.optional<typeof Schema.Number>;
621
- statements: Schema.optional<typeof Schema.Number>;
622
- }>;
623
- patterns: Schema.optionalWith<Schema.Array$<Schema.Tuple2<typeof Schema.String, Schema.Struct<{
624
- lines: Schema.optional<typeof Schema.Number>;
625
- functions: Schema.optional<typeof Schema.Number>;
626
- branches: Schema.optional<typeof Schema.Number>;
627
- statements: Schema.optional<typeof Schema.Number>;
628
- }>>>, {
629
- default: () => never[];
630
- }>;
631
- }>;
632
- /** @public */
633
- type CoverageBaselines = typeof CoverageBaselines.Type;
634
- //#endregion
635
- //#region src/schemas/CacheManifest.d.ts
636
- /**
637
- * A single project entry in the cache manifest.
638
- * @public
639
- */
640
- declare const CacheManifestEntry: Schema.Struct<{
641
- project: typeof Schema.String;
642
- reportFile: typeof Schema.String;
643
- historyFile: Schema.optional<typeof Schema.String>;
644
- lastRun: Schema.NullOr<typeof Schema.String>;
645
- lastResult: Schema.NullOr<Schema.Literal<["passed", "failed", "interrupted"]>>;
646
- }>;
647
- /** @public */
648
- type CacheManifestEntry = typeof CacheManifestEntry.Type;
649
- /**
650
- * Root manifest file that indexes all project reports.
651
- * @public
652
- */
653
- declare const CacheManifest: Schema.Struct<{
654
- updatedAt: typeof Schema.String;
655
- cacheDir: typeof Schema.String;
656
- projects: Schema.Array$<Schema.Struct<{
657
- project: typeof Schema.String;
658
- reportFile: typeof Schema.String;
659
- historyFile: Schema.optional<typeof Schema.String>;
660
- lastRun: Schema.NullOr<typeof Schema.String>;
661
- lastResult: Schema.NullOr<Schema.Literal<["passed", "failed", "interrupted"]>>;
662
- }>>;
663
- }>;
664
- /** @public */
665
- type CacheManifest = typeof CacheManifest.Type;
666
- //#endregion
667
- //#region src/schemas/History.d.ts
668
- /**
669
- * A single test run outcome (pass or fail only).
670
- * @public
671
- */
672
- declare const TestRun: Schema.Struct<{
673
- timestamp: typeof Schema.String;
674
- state: Schema.Literal<["passed", "failed"]>;
675
- }>;
676
- /** @public */
677
- type TestRun = typeof TestRun.Type;
678
- /**
679
- * History for a single test across multiple runs.
680
- * @public
681
- */
682
- declare const TestHistory: Schema.Struct<{
683
- fullName: typeof Schema.String;
684
- runs: Schema.Array$<Schema.Struct<{
685
- timestamp: typeof Schema.String;
686
- state: Schema.Literal<["passed", "failed"]>;
687
- }>>;
688
- }>;
689
- /** @public */
690
- type TestHistory = typeof TestHistory.Type;
691
- /**
692
- * Per-project history record containing all tracked tests.
693
- * @public
694
- */
695
- declare const HistoryRecord: Schema.Struct<{
696
- project: typeof Schema.String;
697
- updatedAt: typeof Schema.String;
698
- tests: Schema.Array$<Schema.Struct<{
699
- fullName: typeof Schema.String;
700
- runs: Schema.Array$<Schema.Struct<{
701
- timestamp: typeof Schema.String;
702
- state: Schema.Literal<["passed", "failed"]>;
703
- }>>;
704
- }>>;
705
- }>;
706
- /** @public */
707
- type HistoryRecord = typeof HistoryRecord.Type;
708
- //#endregion
709
- //#region src/schemas/Tdd.d.ts
710
- /** @public */
711
- declare const GoalStatus: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
712
- /** @public */
713
- type GoalStatus = typeof GoalStatus.Type;
714
- /** @public */
715
- declare const BehaviorStatus: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
716
- /** @public */
717
- type BehaviorStatus = typeof BehaviorStatus.Type;
718
- /** @public */
719
- declare const GoalRow: Schema.Struct<{
720
- id: typeof Schema.Number;
721
- sessionId: typeof Schema.Number;
722
- ordinal: typeof Schema.Number;
723
- goal: typeof Schema.String;
724
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
725
- createdAt: typeof Schema.String;
726
- }>;
727
- /** @public */
728
- type GoalRow = typeof GoalRow.Type;
729
- /** @public */
730
- declare const BehaviorRow: Schema.Struct<{
731
- id: typeof Schema.Number;
732
- goalId: typeof Schema.Number;
733
- ordinal: typeof Schema.Number;
734
- behavior: typeof Schema.String;
735
- suggestedTestName: Schema.NullOr<typeof Schema.String>;
736
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
737
- createdAt: typeof Schema.String;
738
- }>;
739
- /** @public */
740
- type BehaviorRow = typeof BehaviorRow.Type;
741
- /** @public */
742
- declare const GoalDetail: Schema.Struct<{
743
- behaviors: Schema.Array$<Schema.Struct<{
744
- id: typeof Schema.Number;
745
- goalId: typeof Schema.Number;
746
- ordinal: typeof Schema.Number;
747
- behavior: typeof Schema.String;
748
- suggestedTestName: Schema.NullOr<typeof Schema.String>;
749
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
750
- createdAt: typeof Schema.String;
751
- }>>;
752
- id: typeof Schema.Number;
753
- sessionId: typeof Schema.Number;
754
- ordinal: typeof Schema.Number;
755
- goal: typeof Schema.String;
756
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
757
- createdAt: typeof Schema.String;
758
- }>;
759
- /** @public */
760
- type GoalDetail = typeof GoalDetail.Type;
761
- /** @public */
762
- declare const BehaviorDetail: Schema.Struct<{
763
- parentGoal: Schema.Struct<{
764
- id: typeof Schema.Number;
765
- goal: typeof Schema.String;
766
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
767
- }>;
768
- dependencies: Schema.Array$<Schema.Struct<{
769
- id: typeof Schema.Number;
770
- goalId: typeof Schema.Number;
771
- ordinal: typeof Schema.Number;
772
- behavior: typeof Schema.String;
773
- suggestedTestName: Schema.NullOr<typeof Schema.String>;
774
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
775
- createdAt: typeof Schema.String;
776
- }>>;
777
- id: typeof Schema.Number;
778
- goalId: typeof Schema.Number;
779
- ordinal: typeof Schema.Number;
780
- behavior: typeof Schema.String;
781
- suggestedTestName: Schema.NullOr<typeof Schema.String>;
782
- status: Schema.Literal<["pending", "in_progress", "done", "abandoned"]>;
783
- createdAt: typeof Schema.String;
784
- }>;
785
- /** @public */
786
- type BehaviorDetail = typeof BehaviorDetail.Type;
787
- //#endregion
788
- //#region src/schemas/Trends.d.ts
789
- /**
790
- * A single coverage trend data point recorded on a full test run.
791
- * @public
792
- */
793
- declare const TrendEntry: Schema.Struct<{
794
- timestamp: typeof Schema.String;
795
- coverage: Schema.Struct<{
796
- statements: typeof Schema.Number;
797
- branches: typeof Schema.Number;
798
- functions: typeof Schema.Number;
799
- lines: typeof Schema.Number;
800
- }>;
801
- delta: Schema.Struct<{
802
- statements: typeof Schema.Number;
803
- branches: typeof Schema.Number;
804
- functions: typeof Schema.Number;
805
- lines: typeof Schema.Number;
806
- }>;
807
- direction: Schema.Literal<["improving", "regressing", "stable"]>;
808
- targetsHash: Schema.optional<typeof Schema.String>;
809
- }>;
810
- /** @public */
811
- type TrendEntry = typeof TrendEntry.Type;
812
- /**
813
- * Per-project trend record with sliding window of entries.
814
- * @public
815
- */
816
- declare const TrendRecord: Schema.Struct<{
817
- entries: Schema.Array$<Schema.Struct<{
818
- timestamp: typeof Schema.String;
819
- coverage: Schema.Struct<{
820
- statements: typeof Schema.Number;
821
- branches: typeof Schema.Number;
822
- functions: typeof Schema.Number;
823
- lines: typeof Schema.Number;
824
- }>;
825
- delta: Schema.Struct<{
826
- statements: typeof Schema.Number;
827
- branches: typeof Schema.Number;
828
- functions: typeof Schema.Number;
829
- lines: typeof Schema.Number;
830
- }>;
831
- direction: Schema.Literal<["improving", "regressing", "stable"]>;
832
- targetsHash: Schema.optional<typeof Schema.String>;
833
- }>>;
834
- }>;
835
- /** @public */
836
- type TrendRecord = typeof TrendRecord.Type;
837
- //#endregion
838
- //#region src/utils/validate-phase-transition.d.ts
839
- /** @public */
840
- type Phase = "spike" | "red" | "red.triangulate" | "green" | "green.fake-it" | "refactor" | "extended-red" | "green-without-red";
841
- /** @public */
842
- type ArtifactKind = "test_written" | "test_failed_run" | "code_written" | "test_passed_run" | "refactor" | "test_weakened";
843
- /** @public */
844
- interface CitedArtifact {
845
- readonly id: number;
846
- readonly artifact_kind: ArtifactKind;
847
- readonly test_case_id: number | null;
848
- readonly test_case_created_turn_at: string | null;
849
- readonly test_case_authored_in_session: boolean;
850
- readonly test_run_id: number | null;
851
- readonly test_first_failure_run_id: number | null;
852
- readonly behavior_id: number | null;
853
- }
854
- /** @public */
855
- interface PhaseTransitionContext {
856
- readonly tdd_task_id: number;
857
- readonly current_phase: Phase;
858
- readonly phase_started_at: string;
859
- readonly now: string;
860
- readonly requested_phase: Phase;
861
- readonly cited_artifact: CitedArtifact;
862
- readonly requested_behavior_id: number | null;
863
- }
864
- /** @public */
865
- type DenialReason = "missing_artifact_evidence" | "wrong_artifact_kind" | "wrong_source_phase" | "unknown_tdd_task" | "tdd_task_already_ended" | "goal_not_started" | "goal_not_found" | "goal_not_in_progress" | "goal_not_in_tdd_task" | "behavior_not_found" | "behavior_not_in_goal" | "refactor_without_passing_run" | "evidence_not_in_phase_window" | "evidence_not_for_behavior" | "evidence_test_was_already_failing";
866
- /** @public */
867
- interface Remediation {
868
- readonly suggestedTool: string;
869
- readonly suggestedArgs: Record<string, unknown>;
870
- readonly humanHint: string;
871
- }
872
- /** @public */
873
- type PhaseTransitionResult = {
874
- readonly accepted: true;
875
- readonly phase: Phase;
876
- } | {
877
- readonly accepted: false;
878
- readonly phase: Phase;
879
- readonly denialReason: DenialReason;
880
- readonly remediation: Remediation;
881
- };
882
- /**
883
- * Return the artifact kind a phase transition requires, plus a
884
- * human-readable hint for surfacing in remediations.
885
- *
886
- * Exported so the MCP `tdd_phase_transition_request` tool can pre-compute
887
- * the expected kind when the agent omits `citedArtifactId` (auto-resolve
888
- * to the most recent matching artifact). The transitions without a
889
- * required artifact (`spike→red`, `*→red`, etc.) return `null`.
890
- * @public
891
- */
892
- declare const requiredArtifactForTransition: (from: Phase, to: Phase) => {
893
- kind: ArtifactKind;
894
- humanHint: string;
895
- } | null;
896
- /** @public */
897
- declare const validatePhaseTransition: (ctx: PhaseTransitionContext) => PhaseTransitionResult;
898
- //#endregion
899
- //#region src/schemas/Agent.d.ts
900
- declare const Agent_base: Schema.TaggedClass<Agent, "Agent", {
901
- readonly _tag: Schema.tag<"Agent">;
902
- } & {
903
- agentId: Schema.brand<typeof Schema.UUID, "AgentId">;
904
- sessionId: typeof Schema.Number;
905
- parentAgentId: Schema.NullOr<Schema.brand<typeof Schema.UUID, "AgentId">>;
906
- conversationId: Schema.NullOr<Schema.brand<typeof Schema.UUID, "ConversationId">>;
907
- agentType: typeof Schema.String;
908
- startedAt: typeof Schema.Number;
909
- endedAt: Schema.NullOr<typeof Schema.Number>;
910
- startGitBranch: Schema.NullOr<typeof Schema.String>;
911
- startGitCommitSha: Schema.NullOr<typeof Schema.String>;
912
- startWorktreeDir: Schema.NullOr<typeof Schema.String>;
913
- idempotencyKey: typeof Schema.String;
914
- }>;
915
- /**
916
- * Successful registration row. The fields mirror the `agents` SQLite
917
- * table 1:1 in camelCase.
918
- *
919
- * `startGitBranch`, `startGitCommitSha`, `startWorktreeDir` capture
920
- * *what the agent inherited at registration time* — distinct from the
921
- * per-run git context recorded on `runs`. A divergence between the
922
- * two reveals a mid-session branch switch, which is itself signal.
923
- * @public
924
- */
925
- declare class Agent extends Agent_base {}
926
- declare const IdempotencyHit_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] }>) => Readonly<A> & {
927
- readonly _tag: "IdempotencyHit";
928
- };
929
- /**
930
- * Returned by `DataStore.registerAgent` when the
931
- * `(session_id, idempotency_key)` UNIQUE constraint already has a
932
- * row. Not an error — the caller treats it as a successful recovery
933
- * of the existing `agentId`.
934
- *
935
- * Modeled as a `Data.TaggedClass` so the success channel of
936
- * `registerAgent` is `Effect<Agent | IdempotencyHit, ...>` and
937
- * downstream code uses `Match.tag` to branch.
938
- * @public
939
- */
940
- declare class IdempotencyHit extends IdempotencyHit_base<{
941
- readonly existingAgentId: typeof AgentId.Type;
942
- }> {}
943
- /**
944
- * Sum type of the two possible outcomes of `registerAgent`.
945
- * @public
946
- */
947
- type RegisterAgentResult = Agent | IdempotencyHit;
948
- /**
949
- * Agent tree — root agent with all descendants nested under
950
- * `children`. Returned by `DataStore.getAgentTree` for forensics and
951
- * the `vitest-agent agent list` CLI subcommand.
952
- * @public
953
- */
954
- interface AgentTreeNode {
955
- readonly agent: Agent;
956
- readonly children: ReadonlyArray<AgentTreeNode>;
957
- }
958
- //#endregion
959
- //#region src/services/DataStore.d.ts
960
- /** @public */
961
- interface CreateGoalInput {
962
- readonly tddTaskId: number;
963
- readonly goal: string;
964
- }
965
- /** @public */
966
- interface UpdateGoalInput {
967
- readonly id: number;
968
- readonly goal?: string;
969
- readonly status?: GoalStatus;
970
- }
971
- /** @public */
972
- interface CreateBehaviorInput {
973
- readonly goalId: number;
974
- readonly behavior: string;
975
- readonly suggestedTestName?: string;
976
- readonly dependsOnBehaviorIds?: ReadonlyArray<number>;
977
- }
978
- /** @public */
979
- interface UpdateBehaviorInput {
980
- readonly id: number;
981
- readonly behavior?: string;
982
- readonly suggestedTestName?: string | null;
983
- readonly status?: BehaviorStatus;
984
- readonly dependsOnBehaviorIds?: ReadonlyArray<number>;
985
- }
986
- /** @public */
987
- interface SettingsInput {
988
- readonly vitestVersion: string;
989
- readonly pool?: string;
990
- readonly environment?: string;
991
- readonly testTimeout?: number;
992
- readonly hookTimeout?: number;
993
- readonly slowTestThreshold?: number;
994
- readonly maxConcurrency?: number;
995
- readonly maxWorkers?: number;
996
- readonly isolate?: boolean;
997
- readonly bail?: number;
998
- readonly globals?: boolean;
999
- readonly fileParallelism?: boolean;
1000
- readonly sequenceSeed?: number;
1001
- readonly coverageProvider?: string;
1002
- }
1003
- /** @public */
1004
- interface TestRunInput {
1005
- readonly invocationId: string;
1006
- readonly project: string;
1007
- readonly settingsHash: string;
1008
- readonly timestamp: string;
1009
- readonly commitSha: string | null;
1010
- readonly branch: string | null;
1011
- readonly reason: "passed" | "failed" | "interrupted";
1012
- readonly duration: number;
1013
- readonly total: number;
1014
- readonly passed: number;
1015
- readonly failed: number;
1016
- readonly skipped: number;
1017
- readonly scoped: boolean;
1018
- readonly snapshotAdded?: number;
1019
- readonly snapshotMatched?: number;
1020
- readonly snapshotUnmatched?: number;
1021
- readonly snapshotUpdated?: number;
1022
- readonly snapshotUnchecked?: number;
1023
- readonly snapshotTotal?: number;
1024
- readonly snapshotFailure?: boolean;
1025
- readonly snapshotDidUpdate?: boolean;
1026
- readonly snapshotFilesAdded?: number;
1027
- readonly snapshotFilesRemoved?: number;
1028
- readonly snapshotFilesUnmatched?: number;
1029
- readonly snapshotFilesUpdated?: number;
1030
- /**
1031
- * Attribution columns added by the agent-agnostic taxonomy work. The
1032
- * reporter walks env vars / session map to populate these; un-attributed
1033
- * runs default to actor_type='system' and NULL agent/conversation ids.
1034
- */
1035
- readonly actorType?: "agent" | "user" | "system";
1036
- readonly agentId?: string | null;
1037
- readonly conversationId?: string | null;
1038
- /**
1039
- * Git context the run executed against. NULL for non-git workspaces.
1040
- */
1041
- readonly gitBranch?: string | null;
1042
- readonly gitCommitSha?: string | null;
1043
- readonly gitDirty?: boolean | null;
1044
- readonly gitUpstream?: string | null;
1045
- readonly gitWorktreeDir?: string | null;
1046
- /**
1047
- * Host metadata probe result (terminal pane, CI runner). NULL when no
1048
- * probe in the priority chain matched.
1049
- * @public
1050
- */
1051
- readonly hostSource?: string | null;
1052
- readonly hostValue?: string | null;
1053
- readonly hostMetadata?: Record<string, unknown> | null;
1054
- }
1055
- /** @public */
1056
- interface ModuleInput {
1057
- readonly fileId: number;
1058
- readonly relativeModuleId: string;
1059
- readonly state: string;
1060
- readonly duration?: number;
1061
- readonly environmentSetupDuration?: number;
1062
- readonly prepareDuration?: number;
1063
- readonly collectDuration?: number;
1064
- readonly setupDuration?: number;
1065
- readonly heap?: number;
1066
- }
1067
- /** @public */
1068
- interface TestCaseInput {
1069
- readonly suiteId?: number;
1070
- readonly vitestId?: string;
1071
- readonly name: string;
1072
- readonly fullName: string;
1073
- readonly state: string;
1074
- readonly classification?: string;
1075
- readonly duration?: number;
1076
- readonly startTime?: number;
1077
- readonly flaky?: boolean;
1078
- readonly slow?: boolean;
1079
- readonly retryCount?: number;
1080
- readonly repeatCount?: number;
1081
- readonly heap?: number;
1082
- readonly mode?: string;
1083
- readonly each?: boolean;
1084
- readonly fails?: boolean;
1085
- readonly concurrent?: boolean;
1086
- readonly shuffle?: boolean;
1087
- readonly timeout?: number;
1088
- readonly skipNote?: string;
1089
- readonly locationLine?: number;
1090
- readonly locationColumn?: number;
1091
- readonly tags?: readonly string[];
1092
- /**
1093
- * FK to `turns(id)`. Set by the reporter when the test case row was
1094
- * authored within a recorded turn (D2 binding rule 1).
1095
- * @public
1096
- */
1097
- readonly createdTurnId?: number;
1098
- }
1099
- /** @public */
1100
- interface StackFrameInput {
1101
- readonly ordinal: number;
1102
- readonly method: string | null;
1103
- readonly filePath: string;
1104
- readonly line: number;
1105
- readonly col: number;
1106
- readonly sourceMappedLine?: number;
1107
- readonly functionBoundaryLine?: number;
1108
- }
1109
- /** @public */
1110
- interface TestErrorInput {
1111
- readonly testCaseId?: number;
1112
- readonly testSuiteId?: number;
1113
- readonly moduleId?: number;
1114
- readonly scope: "test" | "suite" | "module" | "unhandled";
1115
- readonly name?: string;
1116
- readonly message: string;
1117
- readonly diff?: string;
1118
- readonly actual?: string;
1119
- readonly expected?: string;
1120
- readonly stack?: string;
1121
- readonly causeErrorId?: number;
1122
- readonly signatureHash?: string;
1123
- readonly frames?: ReadonlyArray<StackFrameInput>;
1124
- readonly ordinal?: number;
1125
- }
1126
- /** @public */
1127
- interface FileCoverageInput {
1128
- readonly fileId: number;
1129
- readonly statements: number;
1130
- readonly branches: number;
1131
- readonly functions: number;
1132
- readonly lines: number;
1133
- readonly uncoveredLines?: string;
1134
- /**
1135
- * Coverage tier this row represents. `'below_threshold'` is the
1136
- * build-failing tier (file falls below the configured minimum
1137
- * coverage thresholds). `'below_target'` is the warning tier (file
1138
- * is above thresholds but below the aspirational target).
1139
- *
1140
- * Defaults to `'below_threshold'` when omitted, matching the only
1141
- * tier that existed before migration 0005.
1142
- * @public
1143
- */
1144
- readonly tier?: "below_threshold" | "below_target";
1145
- }
1146
- /** @public */
1147
- interface SuiteInput {
1148
- readonly parentSuiteId?: number;
1149
- readonly name: string;
1150
- readonly fullName: string;
1151
- readonly state: "pending" | "passed" | "failed" | "skipped";
1152
- readonly mode?: "run" | "only" | "skip" | "todo";
1153
- readonly concurrent?: boolean;
1154
- readonly shuffle?: boolean;
1155
- readonly retry?: number;
1156
- readonly repeats?: number;
1157
- readonly locationLine?: number;
1158
- readonly locationColumn?: number;
1159
- }
1160
- /** @public */
1161
- interface NoteInput {
1162
- readonly title: string;
1163
- readonly content: string;
1164
- readonly scope: "global" | "project" | "module" | "suite" | "test" | "note";
1165
- readonly project?: string;
1166
- readonly testFullName?: string;
1167
- readonly modulePath?: string;
1168
- readonly parentNoteId?: number;
1169
- readonly createdBy?: string;
1170
- readonly expiresAt?: string;
1171
- readonly pinned?: boolean;
1172
- }
1173
- /** @public */
1174
- interface SessionInput {
1175
- readonly chatId: string;
1176
- readonly project: string;
1177
- readonly cwd: string;
1178
- readonly agentKind: "main" | "subagent";
1179
- readonly agentType?: string;
1180
- readonly parentSessionId?: number;
1181
- readonly triageWasNonEmpty?: boolean;
1182
- readonly startedAt: string;
1183
- }
1184
- /** @public */
1185
- interface TurnInput {
1186
- readonly sessionId: number;
1187
- /** When omitted, writeTurn computes MAX(turnNo) + 1 for the session. */
1188
- readonly turnNo?: number;
1189
- readonly type: "user_prompt" | "tool_call" | "tool_result" | "file_edit" | "hook_fire" | "note" | "hypothesis";
1190
- readonly payload: string;
1191
- readonly occurredAt: string;
1192
- }
1193
- /** @public */
1194
- interface FailureSignatureWriteInput {
1195
- readonly signatureHash: string;
1196
- readonly runId: number;
1197
- readonly seenAt: string;
1198
- }
1199
- /** @public */
1200
- interface HypothesisInput {
1201
- readonly sessionId: number;
1202
- readonly content: string;
1203
- readonly createdTurnId?: number;
1204
- readonly citedTestErrorId?: number;
1205
- readonly citedStackFrameId?: number;
1206
- }
1207
- /** @public */
1208
- interface ValidateHypothesisInput {
1209
- readonly id: number;
1210
- readonly outcome: "confirmed" | "refuted" | "abandoned";
1211
- readonly validatedTurnId?: number;
1212
- readonly validatedAt: string;
1213
- }
1214
- /** @public */
1215
- interface IdempotentResponseInput {
1216
- readonly procedurePath: string;
1217
- readonly key: string;
1218
- readonly resultJson: string;
1219
- readonly createdAt: string;
1220
- }
1221
- /** @public */
1222
- interface TddTaskInput {
1223
- readonly sessionId: number;
1224
- readonly goal: string;
1225
- readonly startedAt: string;
1226
- readonly parentTddTaskId?: number;
1227
- readonly runId?: string;
1228
- }
1229
- /** @public */
1230
- interface EndTddTaskInput {
1231
- readonly id: number;
1232
- readonly endedAt: string;
1233
- readonly outcome: "succeeded" | "blocked" | "abandoned";
1234
- readonly summaryNoteId?: number;
1235
- }
1236
- /** @public */
1237
- interface WriteTddPhaseInput {
1238
- readonly tddTaskId: number;
1239
- readonly behaviorId?: number;
1240
- readonly phase: Phase;
1241
- readonly startedAt: string;
1242
- readonly transitionReason?: string;
1243
- readonly parentPhaseId?: number;
1244
- }
1245
- /** @public */
1246
- interface WriteTddPhaseOutput {
1247
- readonly id: number;
1248
- readonly previousPhaseId: number | null;
1249
- }
1250
- /** @public */
1251
- interface WriteTddArtifactInput {
1252
- readonly phaseId: number;
1253
- readonly artifactKind: ArtifactKind;
1254
- readonly fileId?: number;
1255
- readonly testCaseId?: number;
1256
- readonly testRunId?: number;
1257
- readonly testFirstFailureRunId?: number;
1258
- readonly diffExcerpt?: string;
1259
- readonly recordedAt: string;
1260
- }
1261
- /** @public */
1262
- interface WriteCommitInput {
1263
- readonly sha: string;
1264
- readonly parentSha?: string;
1265
- readonly message?: string;
1266
- readonly author?: string;
1267
- readonly committedAt?: string;
1268
- readonly branch?: string;
1269
- }
1270
- /** @public */
1271
- type ChangeKind = "added" | "modified" | "deleted" | "renamed" | "untracked-modified";
1272
- /** @public */
1273
- interface RunChangedFile {
1274
- readonly filePath: string;
1275
- readonly changeKind: ChangeKind;
1276
- readonly commitSha?: string;
1277
- }
1278
- /** @public */
1279
- interface WriteRunChangedFilesInput {
1280
- readonly runId: number;
1281
- readonly files: ReadonlyArray<RunChangedFile>;
1282
- }
1283
- /** @public */
1284
- type RunInvocationMethod = "bash" | "mcp" | "cli";
1285
- /**
1286
- * Input to `DataStore.registerAgent`.
1287
- *
1288
- * `sessionId` is the FK to `sessions.id` (integer PK), NOT the host's
1289
- * chat UUID string. Callers that hold only the chat UUID must resolve
1290
- * it through `getSessionByChatId` first.
1291
- *
1292
- * `idempotencyKey` is pre-derived by the caller via
1293
- * `deriveIdempotencyKey(...)` — both the sidecar CLI and the MCP
1294
- * server compute it the same way so a hook retry collapses to the
1295
- * same row.
1296
- * @public
1297
- */
1298
- interface RegisterAgentInput {
1299
- readonly sessionId: number;
1300
- readonly agentType: string;
1301
- readonly parentAgentId: string | null;
1302
- readonly conversationId: string | null;
1303
- readonly startedAt: number;
1304
- readonly startGitBranch?: string;
1305
- readonly startGitCommitSha?: string;
1306
- readonly startWorktreeDir?: string;
1307
- readonly idempotencyKey: string;
1308
- /**
1309
- * Pre-allocated `agents.agent_id` UUID. The sidecar passes
1310
- * `PerClientSessionMapWriter.mapSession()`'s `main_agent_id` here so
1311
- * the per-project `agents` row and the per-client session_map row
1312
- * agree on a single canonical id — the same value the SessionStart
1313
- * hook exports as `VITEST_AGENT_MAIN_AGENT_ID` / `_AGENT_ID`. When
1314
- * omitted, the implementation generates a fresh UUID (used by tests
1315
- * and any caller without a session map).
1316
- */
1317
- readonly agentId?: string;
1318
- }
1319
- /** @public */
1320
- interface AssociateRunSessionInput {
1321
- readonly chatId: string;
1322
- readonly invocationMethod: RunInvocationMethod;
1323
- }
1324
- declare const DataStore_base: Context.TagClass<DataStore, "vitest-agent/DataStore", {
1325
- readonly writeSettings: (hash: string, settings: SettingsInput, envVars: Record<string, string>) => Effect.Effect<void, DataStoreError>;
1326
- readonly writeRun: (input: TestRunInput) => Effect.Effect<number, DataStoreError>;
1327
- readonly writeModules: (runId: number, modules: ReadonlyArray<ModuleInput>) => Effect.Effect<ReadonlyArray<number>, DataStoreError>;
1328
- readonly writeSuites: (moduleId: number, suites: ReadonlyArray<SuiteInput>) => Effect.Effect<ReadonlyArray<number>, DataStoreError>;
1329
- readonly writeTestCases: (moduleId: number, tests: ReadonlyArray<TestCaseInput>) => Effect.Effect<ReadonlyArray<number>, DataStoreError>;
1330
- readonly writeErrors: (runId: number, errors: ReadonlyArray<TestErrorInput>) => Effect.Effect<void, DataStoreError>;
1331
- readonly writeCoverage: (runId: number, coverage: ReadonlyArray<FileCoverageInput>) => Effect.Effect<void, DataStoreError>;
1332
- readonly writeHistory: (project: string, fullName: string, runId: number, timestamp: string, state: string, duration: number | null, flaky: boolean, retryCount: number, errorMessage: string | null) => Effect.Effect<void, DataStoreError>;
1333
- readonly writeBaselines: (baselines: CoverageBaselines) => Effect.Effect<void, DataStoreError>;
1334
- readonly writeTrends: (project: string, runId: number, entry: TrendEntry) => Effect.Effect<void, DataStoreError>;
1335
- readonly writeSourceMap: (sourceFilePath: string, testModuleId: number, mappingType: string) => Effect.Effect<void, DataStoreError>;
1336
- readonly ensureFile: (filePath: string) => Effect.Effect<number, DataStoreError>;
1337
- readonly writeNote: (note: NoteInput) => Effect.Effect<number, DataStoreError>;
1338
- readonly updateNote: (id: number, fields: Partial<NoteInput>) => Effect.Effect<void, DataStoreError>;
1339
- readonly deleteNote: (id: number) => Effect.Effect<void, DataStoreError>;
1340
- readonly writeSession: (input: SessionInput) => Effect.Effect<number, DataStoreError>;
1341
- /**
1342
- * Idempotent variant of `writeSession`: if a row with this
1343
- * `chat_id` already exists, return its id and leave the stored
1344
- * fields untouched; otherwise insert a new row. Used by
1345
- * hook-triggered recording paths (artifacts, turns) that fire
1346
- * for sessions whose original `SessionStart` may have missed —
1347
- * e.g. when Claude Code rotates `chat_id` mid-window after a
1348
- * continuation or compaction. Race-safe via
1349
- * `INSERT ... ON CONFLICT DO NOTHING`.
1350
- */
1351
- readonly upsertSession: (input: SessionInput) => Effect.Effect<number, DataStoreError>;
1352
- readonly writeTurn: (input: TurnInput) => Effect.Effect<number, DataStoreError>;
1353
- readonly writeFailureSignature: (input: FailureSignatureWriteInput) => Effect.Effect<void, DataStoreError>;
1354
- readonly endSession: (chatId: string, endedAt: string, endReason: string | null) => Effect.Effect<void, DataStoreError>;
1355
- readonly writeHypothesis: (input: HypothesisInput) => Effect.Effect<number, DataStoreError>;
1356
- readonly validateHypothesis: (input: ValidateHypothesisInput) => Effect.Effect<void, DataStoreError>;
1357
- readonly writeTddTask: (input: TddTaskInput) => Effect.Effect<number, DataStoreError>;
1358
- readonly endTddTask: (input: EndTddTaskInput) => Effect.Effect<void, DataStoreError>;
1359
- readonly createGoal: (input: CreateGoalInput) => Effect.Effect<GoalRow, DataStoreError | TddTaskNotFoundError | TddTaskAlreadyEndedError>;
1360
- readonly getGoal: (id: number) => Effect.Effect<Option.Option<GoalRow>, DataStoreError>;
1361
- readonly updateGoal: (input: UpdateGoalInput) => Effect.Effect<GoalRow, DataStoreError | GoalNotFoundError | TddTaskAlreadyEndedError | IllegalStatusTransitionError>;
1362
- readonly deleteGoal: (id: number) => Effect.Effect<void, DataStoreError | GoalNotFoundError>;
1363
- readonly listGoalsByTddTask: (tddTaskId: number) => Effect.Effect<ReadonlyArray<GoalRow>, DataStoreError | TddTaskNotFoundError>;
1364
- readonly createBehavior: (input: CreateBehaviorInput) => Effect.Effect<BehaviorRow, DataStoreError | GoalNotFoundError | BehaviorNotFoundError | TddTaskAlreadyEndedError | IllegalStatusTransitionError>;
1365
- readonly getBehavior: (id: number) => Effect.Effect<Option.Option<BehaviorRow>, DataStoreError>;
1366
- readonly updateBehavior: (input: UpdateBehaviorInput) => Effect.Effect<BehaviorRow, DataStoreError | BehaviorNotFoundError | TddTaskAlreadyEndedError | IllegalStatusTransitionError>;
1367
- readonly deleteBehavior: (id: number) => Effect.Effect<void, DataStoreError | BehaviorNotFoundError>;
1368
- readonly listBehaviorsByGoal: (goalId: number) => Effect.Effect<ReadonlyArray<BehaviorRow>, DataStoreError | GoalNotFoundError>;
1369
- readonly listBehaviorsByTddTask: (tddTaskId: number) => Effect.Effect<ReadonlyArray<BehaviorRow>, DataStoreError | TddTaskNotFoundError>;
1370
- readonly writeTddPhase: (input: WriteTddPhaseInput) => Effect.Effect<WriteTddPhaseOutput, DataStoreError>;
1371
- readonly writeTddArtifact: (input: WriteTddArtifactInput) => Effect.Effect<number, DataStoreError>;
1372
- readonly writeCommit: (input: WriteCommitInput) => Effect.Effect<void, DataStoreError>;
1373
- readonly writeRunChangedFiles: (input: WriteRunChangedFilesInput) => Effect.Effect<void, DataStoreError>;
1374
- readonly recordIdempotentResponse: (input: IdempotentResponseInput) => Effect.Effect<void, DataStoreError>;
1375
- readonly pruneSessions: (keepRecent: number) => Effect.Effect<{
1376
- readonly affectedSessions: number;
1377
- readonly prunedTurns: number;
1378
- }, DataStoreError>;
1379
- readonly associateLatestRunWithSession: (input: AssociateRunSessionInput) => Effect.Effect<void, DataStoreError>;
1380
- readonly backfillTestCaseTurns: (chatId: string) => Effect.Effect<number, DataStoreError>;
1381
- /**
1382
- * Idempotently insert an `agents` row.
1383
- *
1384
- * Returns `Agent` on a fresh insert, or `IdempotencyHit` carrying
1385
- * the existing `agentId` when the `(session_id, idempotency_key)`
1386
- * UNIQUE constraint already has a row. The caller treats the latter
1387
- * as a successful recovery (same logical agent), not an error.
1388
- *
1389
- * Fails with `RegistrationConflictError` when the supplied
1390
- * `parentAgentId` references an agent in a different session, or
1391
- * when no such agent exists. Surface to the caller for true
1392
- * mis-configuration cases; idempotency hits never produce this.
1393
- */
1394
- readonly registerAgent: (input: RegisterAgentInput) => Effect.Effect<Agent | IdempotencyHit, RegistrationConflictError | DataStoreError>;
1395
- /**
1396
- * Mark an agent as ended. Sets `agents.ended_at` to the supplied
1397
- * timestamp. Fails with `AgentNotFoundError` when no row exists.
1398
- */
1399
- readonly endAgent: (agentId: string, endedAt: number) => Effect.Effect<void, AgentNotFoundError | DataStoreError>;
1400
- }>;
1401
- /** @public */
1402
- declare class DataStore extends DataStore_base {}
1403
- //#endregion
1404
- //#region src/services/DataReader.d.ts
1405
- /** @public */
1406
- interface ProjectRunSummary {
1407
- readonly project: string;
1408
- readonly lastRun: string | null;
1409
- readonly lastResult: "passed" | "failed" | "interrupted" | null;
1410
- readonly total: number;
1411
- readonly passed: number;
1412
- readonly failed: number;
1413
- readonly skipped: number;
1414
- }
1415
- /** @public */
1416
- interface FlakyTest {
1417
- readonly fullName: string;
1418
- readonly project: string;
1419
- readonly passCount: number;
1420
- readonly failCount: number;
1421
- readonly lastState: "passed" | "failed";
1422
- readonly lastTimestamp: string;
1423
- }
1424
- /** @public */
1425
- interface PersistentFailure {
1426
- readonly fullName: string;
1427
- readonly project: string;
1428
- readonly consecutiveFailures: number;
1429
- readonly firstFailedAt: string;
1430
- readonly lastFailedAt: string;
1431
- readonly lastErrorMessage: string | null;
1432
- }
1433
- /** @public */
1434
- interface TestError {
1435
- /** `test_errors.id` — required by `hypothesis (action: record).citedTestErrorId`. */
1436
- readonly id: number;
1437
- /**
1438
- * `stack_frames.id` for the top frame of this error (ordinal 0), or
1439
- * `null` if no frames were captured. Required by
1440
- * `hypothesis (action: record).citedStackFrameId`.
1441
- */
1442
- readonly topStackFrameId: number | null;
1443
- readonly name: string | null;
1444
- readonly message: string;
1445
- readonly diff: string | null;
1446
- readonly actual: string | null;
1447
- readonly expected: string | null;
1448
- readonly stack: string | null;
1449
- readonly scope: "test" | "suite" | "module" | "unhandled";
1450
- readonly testFullName: string | null;
1451
- readonly moduleFile: string | null;
1452
- }
1453
- /** @public */
1454
- interface NoteRow {
1455
- readonly id: number;
1456
- readonly title: string;
1457
- readonly content: string;
1458
- readonly scope: "global" | "project" | "module" | "suite" | "test" | "note";
1459
- readonly project: string | null;
1460
- readonly testFullName: string | null;
1461
- readonly modulePath: string | null;
1462
- readonly parentNoteId: number | null;
1463
- readonly createdBy: string | null;
1464
- readonly expiresAt: string | null;
1465
- readonly pinned: boolean;
1466
- readonly createdAt: string;
1467
- readonly updatedAt: string;
1468
- }
1469
- /** @public */
1470
- interface SettingsRow {
1471
- readonly hash: string;
1472
- readonly reporters: string | null;
1473
- readonly coverageEnabled: boolean;
1474
- readonly coverageProvider: string | null;
1475
- readonly coverageThresholds: string | null;
1476
- readonly coverageTargets: string | null;
1477
- readonly pool: string | null;
1478
- readonly shard: string | null;
1479
- readonly project: string | null;
1480
- readonly environment: string | null;
1481
- readonly envVars: Record<string, string>;
1482
- readonly capturedAt: string;
1483
- }
1484
- /** @public */
1485
- interface TestListEntry {
1486
- readonly id: number;
1487
- readonly fullName: string;
1488
- readonly state: string;
1489
- readonly duration: number | null;
1490
- readonly module: string;
1491
- readonly classification: string | null;
1492
- }
1493
- /** @public */
1494
- interface ModuleListEntry {
1495
- readonly id: number;
1496
- readonly file: string;
1497
- readonly state: string;
1498
- readonly testCount: number;
1499
- readonly duration: number | null;
1500
- }
1501
- /** @public */
1502
- interface SuiteListEntry {
1503
- readonly id: number;
1504
- readonly name: string;
1505
- readonly module: string;
1506
- readonly state: string;
1507
- readonly testCount: number;
1508
- }
1509
- /** @public */
1510
- interface SettingsListEntry {
1511
- readonly hash: string;
1512
- readonly capturedAt: string;
1513
- }
1514
- /** @public */
1515
- interface SessionDetail {
1516
- readonly id: number;
1517
- readonly chatId: string;
1518
- readonly project: string;
1519
- readonly cwd: string;
1520
- readonly agentKind: "main" | "subagent";
1521
- readonly agentType: string | null;
1522
- readonly parentSessionId: number | null;
1523
- readonly triageWasNonEmpty: boolean;
1524
- readonly startedAt: string;
1525
- readonly endedAt: string | null;
1526
- readonly endReason: string | null;
1527
- }
1528
- /** @public */
1529
- interface TurnSummary {
1530
- readonly id: number;
1531
- readonly sessionId: number;
1532
- readonly turnNo: number;
1533
- readonly type: string;
1534
- readonly payload: string;
1535
- readonly occurredAt: string;
1536
- }
1537
- /** @public */
1538
- interface TurnSearchOptions {
1539
- readonly sessionId?: number;
1540
- readonly type?: string;
1541
- readonly since?: string;
1542
- readonly limit?: number;
1543
- }
1544
- /** @public */
1545
- interface AcceptanceMetrics {
1546
- readonly phaseEvidenceIntegrity: {
1547
- total: number;
1548
- compliant: number;
1549
- ratio: number;
1550
- };
1551
- readonly complianceHookResponsiveness: {
1552
- total: number;
1553
- withFollowup: number;
1554
- ratio: number;
1555
- };
1556
- readonly orientationUsefulness: {
1557
- total: number;
1558
- referencedCount: number;
1559
- ratio: number;
1560
- };
1561
- readonly antiPatternDetectionRate: {
1562
- total: number;
1563
- cleanSessions: number;
1564
- ratio: number;
1565
- };
1566
- }
1567
- /** @public */
1568
- interface FailureSignatureDetail {
1569
- readonly signatureHash: string;
1570
- readonly firstSeenRunId: number | null;
1571
- readonly firstSeenAt: string;
1572
- readonly lastSeenAt: string | null;
1573
- readonly occurrenceCount: number;
1574
- readonly recentErrors: ReadonlyArray<{
1575
- readonly runId: number;
1576
- readonly message: string;
1577
- readonly errorName: string | null;
1578
- }>;
1579
- }
1580
- /** @public */
1581
- interface TddPhaseDetail {
1582
- readonly id: number;
1583
- readonly behaviorId: number | null;
1584
- readonly phase: string;
1585
- readonly startedAt: string;
1586
- readonly endedAt: string | null;
1587
- readonly transitionReason: string | null;
1588
- }
1589
- /** @public */
1590
- interface TddArtifactDetail {
1591
- readonly id: number;
1592
- readonly phaseId: number;
1593
- readonly artifactKind: string;
1594
- readonly testCaseId: number | null;
1595
- readonly testRunId: number | null;
1596
- readonly recordedAt: string;
1597
- }
1598
- /** @public */
1599
- interface TddTaskDetail {
1600
- readonly id: number;
1601
- readonly sessionId: number;
1602
- readonly goal: string;
1603
- readonly startedAt: string;
1604
- readonly endedAt: string | null;
1605
- readonly outcome: string | null;
1606
- readonly runId: string | null;
1607
- readonly goals: ReadonlyArray<GoalDetail>;
1608
- readonly phases: ReadonlyArray<TddPhaseDetail>;
1609
- readonly artifacts: ReadonlyArray<TddArtifactDetail>;
1610
- }
1611
- /** @public */
1612
- interface CurrentTddPhase {
1613
- readonly id: number;
1614
- readonly phase: Phase;
1615
- readonly startedAt: string;
1616
- readonly behaviorId: number | null;
1617
- }
1618
- /** @public */
1619
- interface CitedArtifactRow extends CitedArtifact {
1620
- readonly phase_id: number;
1621
- }
1622
- /** @public */
1623
- interface CommitChangesEntry {
1624
- readonly sha: string;
1625
- readonly parentSha: string | null;
1626
- readonly message: string | null;
1627
- readonly author: string | null;
1628
- readonly committedAt: string | null;
1629
- readonly branch: string | null;
1630
- readonly files: ReadonlyArray<{
1631
- readonly filePath: string;
1632
- readonly changeKind: ChangeKind;
1633
- }>;
1634
- }
1635
- /** @public */
1636
- interface HypothesisDetail {
1637
- readonly id: number;
1638
- readonly sessionId: number;
1639
- readonly content: string;
1640
- readonly citedTestErrorId: number | null;
1641
- readonly citedStackFrameId: number | null;
1642
- readonly validationOutcome: "confirmed" | "refuted" | "abandoned" | null;
1643
- readonly validatedAt: string | null;
1644
- }
1645
- /** @public */
1646
- interface TddTaskSummary {
1647
- readonly id: number;
1648
- readonly sessionId: number;
1649
- readonly goal: string;
1650
- readonly startedAt: string;
1651
- readonly endedAt: string | null;
1652
- readonly outcome: "succeeded" | "blocked" | "abandoned" | null;
1653
- }
1654
- /**
1655
- * Row shape returned by `listTddArtifactsForTask`. Carries every
1656
- * field an agent typically needs to cite an artifact in a subsequent
1657
- * `tdd_phase_transition_request` call without further lookups.
1658
- *
1659
- * @public
1660
- */
1661
- interface TddArtifactRow {
1662
- readonly id: number;
1663
- readonly tddTaskId: number;
1664
- readonly phaseId: number;
1665
- readonly phaseName: Phase;
1666
- readonly artifactKind: ArtifactKind;
1667
- readonly behaviorId: number | null;
1668
- readonly testCaseId: number | null;
1669
- readonly testRunId: number | null;
1670
- readonly testFirstFailureRunId: number | null;
1671
- readonly recordedAt: string;
1672
- }
1673
- /** @public */
1674
- interface TagInventoryRow {
1675
- /** The tag name (e.g. `"int"`, `"e2e"`, `"unit"`). */
1676
- readonly tag: string;
1677
- /** The Vitest project this tag was observed in. */
1678
- readonly project: string;
1679
- /**
1680
- * Number of distinct test modules in the project's latest run that contain
1681
- * at least one test case carrying this tag.
1682
- */
1683
- readonly moduleCount: number;
1684
- /**
1685
- * Number of test cases in the project's latest run that carry this tag.
1686
- */
1687
- readonly testCount: number;
1688
- }
1689
- declare const DataReader_base: Context.TagClass<DataReader, "vitest-agent/DataReader", {
1690
- readonly getLatestRun: (project: string) => Effect.Effect<Option.Option<AgentReport>, DataStoreError>;
1691
- readonly getRunsByProject: () => Effect.Effect<ReadonlyArray<ProjectRunSummary>, DataStoreError>;
1692
- readonly getHistory: (project: string) => Effect.Effect<HistoryRecord, DataStoreError>;
1693
- readonly getBaselines: (project: string) => Effect.Effect<Option.Option<CoverageBaselines>, DataStoreError>;
1694
- readonly getTrends: (project: string, limit?: number) => Effect.Effect<Option.Option<TrendRecord>, DataStoreError>;
1695
- readonly getFlaky: (project: string) => Effect.Effect<ReadonlyArray<FlakyTest>, DataStoreError>;
1696
- readonly getPersistentFailures: (project: string) => Effect.Effect<ReadonlyArray<PersistentFailure>, DataStoreError>;
1697
- readonly getFileCoverage: (runId: number) => Effect.Effect<ReadonlyArray<FileCoverageReport>, DataStoreError>;
1698
- readonly getCoverage: (project: string) => Effect.Effect<Option.Option<CoverageReport>, DataStoreError>;
1699
- readonly getTestsForFile: (filePath: string) => Effect.Effect<ReadonlyArray<string>, DataStoreError>;
1700
- readonly getErrors: (project: string, errorName?: string) => Effect.Effect<ReadonlyArray<TestError>, DataStoreError>;
1701
- readonly getNotes: (scope?: string, project?: string, testFullName?: string) => Effect.Effect<ReadonlyArray<NoteRow>, DataStoreError>;
1702
- readonly getNoteById: (id: number) => Effect.Effect<Option.Option<NoteRow>, DataStoreError>;
1703
- readonly searchNotes: (query: string) => Effect.Effect<ReadonlyArray<NoteRow>, DataStoreError>;
1704
- readonly getManifest: () => Effect.Effect<Option.Option<CacheManifest>, DataStoreError>;
1705
- readonly getSettings: (hash: string) => Effect.Effect<Option.Option<SettingsRow>, DataStoreError>;
1706
- readonly getLatestSettings: () => Effect.Effect<Option.Option<SettingsRow>, DataStoreError>;
1707
- readonly getTestByFullName: (project: string, fullName: string) => Effect.Effect<Option.Option<TestListEntry>, DataStoreError>;
1708
- readonly listTests: (project: string, options?: {
1709
- state?: string;
1710
- module?: string;
1711
- limit?: number;
1712
- }) => Effect.Effect<ReadonlyArray<TestListEntry>, DataStoreError>;
1713
- readonly listModules: (project: string) => Effect.Effect<ReadonlyArray<ModuleListEntry>, DataStoreError>;
1714
- readonly listSuites: (project: string, options?: {
1715
- module?: string;
1716
- }) => Effect.Effect<ReadonlyArray<SuiteListEntry>, DataStoreError>;
1717
- readonly listSettings: () => Effect.Effect<ReadonlyArray<SettingsListEntry>, DataStoreError>;
1718
- readonly getSessionById: (id: number) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
1719
- readonly getSessionByChatId: (chatId: string) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
1720
- /**
1721
- * Find every session row whose `chat_id` begins with `prefix`.
1722
- * Used to recover the synthetic subagent row created by the
1723
- * SubagentStart hook (`<parentChatId>-subagent-<ts>-<pid>`)
1724
- * when subsequent PostToolUse hooks fire under the bare
1725
- * parent chat_id. Returns most recent first.
1726
- */
1727
- readonly findSessionsByChatPrefix: (prefix: string) => Effect.Effect<ReadonlyArray<SessionDetail>, DataStoreError>;
1728
- /**
1729
- * Find the most-recently-started subagent session whose
1730
- * `parent_session_id` is `parentSessionId` and that has not ended
1731
- * (`ended_at IS NULL`). Used to attribute orchestrator (subagent)
1732
- * MCP writes — e.g. `hypothesis record` — to the running subagent's
1733
- * own session row instead of the parent main session, since the MCP
1734
- * server's recovered context only ever names the main agent.
1735
- */
1736
- readonly findActiveSubagentSession: (parentSessionId: number) => Effect.Effect<Option.Option<SessionDetail>, DataStoreError>;
1737
- readonly listSessions: (options: {
1738
- readonly project?: string;
1739
- readonly agentKind?: "main" | "subagent";
1740
- readonly limit?: number;
1741
- }) => Effect.Effect<ReadonlyArray<SessionDetail>, DataStoreError>;
1742
- readonly searchTurns: (options: TurnSearchOptions) => Effect.Effect<ReadonlyArray<TurnSummary>, DataStoreError>;
1743
- readonly computeAcceptanceMetrics: () => Effect.Effect<AcceptanceMetrics, DataStoreError>;
1744
- readonly getFailureSignatureByHash: (hash: string) => Effect.Effect<Option.Option<FailureSignatureDetail>, DataStoreError>;
1745
- readonly getTddTaskById: (id: number) => Effect.Effect<Option.Option<TddTaskDetail>, DataStoreError>;
1746
- readonly getGoalById: (id: number) => Effect.Effect<Option.Option<GoalDetail>, DataStoreError>;
1747
- readonly getGoalsByTddTask: (tddTaskId: number) => Effect.Effect<ReadonlyArray<GoalDetail>, DataStoreError>;
1748
- readonly getBehaviorById: (id: number) => Effect.Effect<Option.Option<BehaviorDetail>, DataStoreError>;
1749
- readonly getBehaviorsByGoal: (goalId: number) => Effect.Effect<ReadonlyArray<BehaviorRow>, DataStoreError>;
1750
- readonly getBehaviorsByTddTask: (tddTaskId: number) => Effect.Effect<ReadonlyArray<BehaviorRow>, DataStoreError>;
1751
- readonly getBehaviorDependencies: (behaviorId: number) => Effect.Effect<ReadonlyArray<BehaviorRow>, DataStoreError>;
1752
- readonly resolveGoalIdForBehavior: (behaviorId: number) => Effect.Effect<Option.Option<number>, DataStoreError>;
1753
- readonly getCurrentTddPhase: (tddTaskId: number) => Effect.Effect<Option.Option<CurrentTddPhase>, DataStoreError>;
1754
- readonly getTddArtifactWithContext: (artifactId: number) => Effect.Effect<Option.Option<CitedArtifactRow>, DataStoreError>;
1755
- readonly getCommitChanges: (sha?: string) => Effect.Effect<ReadonlyArray<CommitChangesEntry>, DataStoreError>;
1756
- readonly listTddTasksForSession: (sessionId: number, options?: {
1757
- /**
1758
- * When true, also return tdd_tasks belonging to any
1759
- * ancestor of `sessionId` via `parent_session_id`. Used
1760
- * by hook-driven artifact recording where the
1761
- * orchestrator opened the tdd task under the parent
1762
- * main row but the subagent's own session row is the
1763
- * one carrying the calling chat_id. Default `false`
1764
- * preserves the prior single-session contract.
1765
- */
1766
- readonly walkParents?: boolean;
1767
- }) => Effect.Effect<ReadonlyArray<TddTaskSummary>, DataStoreError>;
1768
- /**
1769
- * List artifacts recorded for a TDD task, optionally filtered
1770
- * by `artifactKind`, `phaseId`, or `behaviorId`. Returns rows in
1771
- * recorded_at DESC order so the most recently captured artifact
1772
- * (the typical citation target for a phase transition) appears
1773
- * first. `limit` defaults to 50.
1774
- */
1775
- readonly listTddArtifactsForTask: (input: {
1776
- readonly tddTaskId: number;
1777
- readonly artifactKind?: ArtifactKind;
1778
- readonly phaseId?: number;
1779
- readonly behaviorId?: number;
1780
- readonly limit?: number;
1781
- }) => Effect.Effect<ReadonlyArray<TddArtifactRow>, DataStoreError>;
1782
- readonly listHypotheses: (options: {
1783
- readonly sessionId?: number;
1784
- readonly outcome?: "confirmed" | "refuted" | "abandoned" | "open";
1785
- readonly limit?: number;
1786
- }) => Effect.Effect<ReadonlyArray<HypothesisDetail>, DataStoreError>;
1787
- readonly findIdempotentResponse: (procedurePath: string, key: string) => Effect.Effect<Option.Option<string>, DataStoreError>;
1788
- readonly getLatestTestCaseForSession: (chatId: string) => Effect.Effect<Option.Option<number>, DataStoreError>;
1789
- /**
1790
- * Returns one `TagInventoryRow` per `(tag, project)` pair observed in
1791
- * each project's latest test run. When `project` is supplied, results
1792
- * are restricted to that project's latest run.
1793
- */
1794
- readonly listTagInventory: (options?: {
1795
- readonly project?: string;
1796
- }) => Effect.Effect<ReadonlyArray<TagInventoryRow>, DataStoreError>;
1797
- /**
1798
- * Returns every `TestListEntry` from the latest run of each project
1799
- * (or the specified project) whose test case carries `tag`.
1800
- */
1801
- readonly listTestsForTag: (tag: string, options?: {
1802
- readonly project?: string;
1803
- }) => Effect.Effect<ReadonlyArray<TestListEntry>, DataStoreError>;
1804
- }>;
1805
- /** @public */
1806
- declare class DataReader extends DataReader_base {}
1807
- //#endregion
1808
- export { ValidateHypothesisInput as $, TddTaskId as $t, CreateGoalInput as A, CacheManifestEntry as At, RunChangedFile as B, extractSqlReason as Bt, TestError as C, GoalDetail as Ct, AssociateRunSessionInput as D, TestHistory as Dt, TurnSummary as E, HistoryRecord as Et, HypothesisInput as F, IllegalStatusTransitionError as Ft, SuiteInput as G, SessionNotFoundError as Gt, SessionInput as H, ConversationNotFoundError as Ht, IdempotentResponseInput as I, TddTaskAlreadyEndedError as It, TestErrorInput as J, AgentId as Jt, TddTaskInput as K, SidecarTimeoutError as Kt, ModuleInput as L, TddTaskEndOutcome as Lt, EndTddTaskInput as M, BehaviorNotFoundError as Mt, FailureSignatureWriteInput as N, GoalNotFoundError as Nt, ChangeKind as O, TestRun as Ot, FileCoverageInput as P, IllegalStatusTransitionEntity as Pt, UpdateGoalInput as Q, ProjectKey as Qt, NoteInput as R, TddTaskNotFoundError as Rt, TddTaskSummary as S, BehaviorStatus as St, TurnSearchOptions as T, GoalStatus as Tt, SettingsInput as U, HostMetadataParseError as Ut, RunInvocationMethod as V, AgentNotFoundError as Vt, StackFrameInput as W, RegistrationConflictError as Wt, TurnInput as X, ConversationId as Xt, TestRunInput as Y, ChatId as Yt, UpdateBehaviorInput as Z, HostKind as Zt, TagInventoryRow as _, validatePhaseTransition as _t, DataReader as a, CoverageReport as an, Agent as at, TddPhaseDetail as b, BehaviorDetail as bt, HypothesisDetail as c, RegisterAgentResult as ct, PersistentFailure as d, DenialReason as dt, AgentReport as en, WriteCommitInput as et, ProjectRunSummary as f, Phase as ft, SuiteListEntry as g, requiredArtifactForTransition as gt, SettingsRow as h, Remediation as ht, CurrentTddPhase as i, TestReport as in, WriteTddPhaseOutput as it, DataStore as j, CoverageBaselines as jt, CreateBehaviorInput as k, CacheManifest as kt, ModuleListEntry as l, ArtifactKind as lt, SettingsListEntry as m, PhaseTransitionResult as mt, CitedArtifactRow as n, ReportSummary as nn, WriteTddArtifactInput as nt, FailureSignatureDetail as o, CoverageTotals as on, AgentTreeNode as ot, SessionDetail as p, PhaseTransitionContext as pt, TestCaseInput as q, ActorType as qt, CommitChangesEntry as r, TagCountEntry as rn, WriteTddPhaseInput as rt, FlakyTest as s, FileCoverageReport as sn, IdempotencyHit as st, AcceptanceMetrics as t, ModuleReport as tn, WriteRunChangedFilesInput as tt, NoteRow as u, CitedArtifact as ut, TddArtifactDetail as v, TrendEntry as vt, TestListEntry as w, GoalRow as wt, TddTaskDetail as x, BehaviorRow as xt, TddArtifactRow as y, TrendRecord as yt, RegisterAgentInput as z, DataStoreError as zt };
1809
- //# sourceMappingURL=DataReader-2kJ9I9Hh.d.ts.map