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