@vitest-agent/mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -0
  3. package/bin/vitest-agent-mcp.js +93 -0
  4. package/context.js +72 -0
  5. package/index.d.ts +1577 -0
  6. package/index.js +19 -0
  7. package/layers/McpLive.js +30 -0
  8. package/middleware/idempotency.js +128 -0
  9. package/package.json +58 -0
  10. package/prompts/explain-failure.js +27 -0
  11. package/prompts/index.js +89 -0
  12. package/prompts/regression-since-pass.js +28 -0
  13. package/prompts/tdd-resume.js +28 -0
  14. package/prompts/triage.js +24 -0
  15. package/prompts/why-flaky.js +30 -0
  16. package/prompts/wrapup.js +19 -0
  17. package/resources/index.js +155 -0
  18. package/resources/indexes.js +77 -0
  19. package/resources/manifest-schema.js +46 -0
  20. package/resources/paths.js +20 -0
  21. package/resources/patterns.js +22 -0
  22. package/resources/upstream-docs.js +22 -0
  23. package/router.js +74 -0
  24. package/server.js +838 -0
  25. package/tools/_tdd-error-envelope.js +98 -0
  26. package/tools/acceptance-metrics.js +75 -0
  27. package/tools/cache-health.js +83 -0
  28. package/tools/commit-changes.js +64 -0
  29. package/tools/configure.js +107 -0
  30. package/tools/coverage.js +76 -0
  31. package/tools/errors.js +151 -0
  32. package/tools/failure-signature-get.js +73 -0
  33. package/tools/file-coverage.js +106 -0
  34. package/tools/help.js +146 -0
  35. package/tools/history.js +121 -0
  36. package/tools/hypothesis.js +127 -0
  37. package/tools/inventory.js +377 -0
  38. package/tools/note.js +208 -0
  39. package/tools/overview.js +92 -0
  40. package/tools/ping.js +22 -0
  41. package/tools/register-agent.js +135 -0
  42. package/tools/run-tests.js +359 -0
  43. package/tools/settings-list.js +48 -0
  44. package/tools/status.js +74 -0
  45. package/tools/tdd-artifact.js +101 -0
  46. package/tools/tdd-behavior.js +177 -0
  47. package/tools/tdd-goal.js +147 -0
  48. package/tools/tdd-phase-transition-request.js +212 -0
  49. package/tools/tdd-task.js +278 -0
  50. package/tools/test.js +281 -0
  51. package/tools/trends.js +112 -0
  52. package/tools/triage-brief.js +42 -0
  53. package/tools/turn-search.js +60 -0
  54. package/tools/wrapup-prompt.js +49 -0
  55. package/tsdoc-metadata.json +11 -0
  56. package/utils/effect-to-zod.js +81 -0
package/index.d.ts ADDED
@@ -0,0 +1,1577 @@
1
+ import { DataReader, DataStore, OutputRenderer, ProjectDiscovery } from "@vitest-agent/sdk";
2
+ import { Layer, LogLevel, ManagedRuntime } from "effect";
3
+ import * as NodeContext from "@effect/platform-node/NodeContext";
4
+ import * as SqliteMigrator from "@effect/sql-sqlite-node/SqliteMigrator";
5
+
6
+ //#region src/context.d.ts
7
+ /**
8
+ * Mutable holder for the MCP server's currently-associated host chat
9
+ * id (the per-process CC chat UUID).
10
+ *
11
+ * The MCP server is one process per host window, so a single in-memory
12
+ * ref is enough — no cross-window contention. The bin entry seeds the
13
+ * value from `process.env.VITEST_AGENT_CHAT_ID` (written by the
14
+ * SessionStart hook to `CLAUDE_ENV_FILE` and auto-sourced into the MCP
15
+ * child) or from an explicit positional argv. The legacy
16
+ * `set_current_session_id` MCP tool was removed in Phase 3.
17
+ *
18
+ * @public
19
+ */
20
+ interface CurrentSessionIdRef {
21
+ get(): string | null;
22
+ set(id: string | null): void;
23
+ }
24
+ /**
25
+ * Creates a new {@link CurrentSessionIdRef} with an optional initial value.
26
+ *
27
+ * @param initial - the starting chat id, or `null` when unknown at construction time
28
+ * @returns a mutable ref holding the current session id
29
+ * @public
30
+ */
31
+ declare const createCurrentSessionIdRef: (initial?: string | null) => CurrentSessionIdRef;
32
+ /**
33
+ * Recovered session attribution context — the canonical UUIDs the
34
+ * SessionStart hook wrote to `${CLAUDE_ENV_FILE}` so they auto-source
35
+ * into the MCP server child's `process.env`, with the per-client
36
+ * session map as a fallback when the env vars are missing (dev /
37
+ * tests).
38
+ *
39
+ * Read by `run_tests` to populate `VITEST_AGENT_AGENT_ID` and friends
40
+ * on the Vitest child process so the reporter attributes runs back to
41
+ * the active agent.
42
+ *
43
+ * @public
44
+ */
45
+ interface SessionContext {
46
+ readonly chatId: string;
47
+ readonly conversationId: string;
48
+ readonly mainAgentId: string;
49
+ }
50
+ /**
51
+ * Mutable ref holding the MCP server's recovered {@link SessionContext}.
52
+ *
53
+ * @public
54
+ */
55
+ interface SessionContextRef {
56
+ get(): SessionContext | null;
57
+ set(ctx: SessionContext | null): void;
58
+ }
59
+ /**
60
+ * Creates a new {@link SessionContextRef} with an optional initial value.
61
+ *
62
+ * @param initial - the starting session context, or `null` when not yet recovered
63
+ * @returns a mutable ref holding the current session context
64
+ * @public
65
+ */
66
+ declare const createSessionContextRef: (initial?: SessionContext | null) => SessionContextRef;
67
+ /**
68
+ * tRPC context carrying a ManagedRuntime for Effect service access.
69
+ *
70
+ * The MCP server creates a ManagedRuntime at startup (long-lived
71
+ * process) and passes it through tRPC context so procedures can
72
+ * call Effect services via `ctx.runtime.runPromise(effect)`.
73
+ *
74
+ * @public
75
+ */
76
+ interface McpContext {
77
+ readonly runtime: ManagedRuntime.ManagedRuntime<DataReader | DataStore | ProjectDiscovery | OutputRenderer, never>;
78
+ readonly cwd: string;
79
+ readonly currentSessionId: CurrentSessionIdRef;
80
+ readonly sessionContext: SessionContextRef;
81
+ }
82
+ /**
83
+ * Factory for creating server-side tRPC callers for the MCP router.
84
+ *
85
+ * Use with {@link appRouter} in tests or programmatic contexts to invoke
86
+ * tool procedures without starting the MCP server.
87
+ *
88
+ * @public
89
+ */
90
+ declare const createCallerFactory: import("@trpc/server").TRPCRouterCallerFactory<{
91
+ ctx: McpContext;
92
+ meta: object;
93
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
94
+ transformer: false;
95
+ }>;
96
+ //#endregion
97
+ //#region src/layers/McpLive.d.ts
98
+ /**
99
+ * Builds the Effect Layer that provides all services required by the MCP server.
100
+ *
101
+ * Composes DataReader, DataStore, ProjectDiscovery, OutputPipeline, SQLite
102
+ * client, migrator, NodeContext, NodeFileSystem, and the logger into a single
103
+ * layer suitable for `ManagedRuntime.make`.
104
+ *
105
+ * @param dbPath - absolute path to the SQLite database file
106
+ * @param logLevel - optional log level; defaults to the logger's own default
107
+ * @param logFile - optional path to write structured log output
108
+ * @returns an Effect Layer providing all MCP runtime services
109
+ * @public
110
+ */
111
+ declare const McpLive: (dbPath: string, logLevel?: LogLevel.LogLevel, logFile?: string) => Layer.Layer<import("@vitest-agent/sdk").DataReader | import("@effect/sql/SqlClient").SqlClient | import("@vitest-agent/sdk").DataStore | import("@vitest-agent/sdk").ProjectDiscovery | import("@vitest-agent/sdk").DetailResolver | import("@vitest-agent/sdk").EnvironmentDetector | import("@vitest-agent/sdk").ExecutorResolver | import("@vitest-agent/sdk").FormatSelector | import("@vitest-agent/sdk").OutputRenderer | import("@effect/sql-sqlite-node/SqliteClient").SqliteClient | NodeContext.NodeContext, import("@effect/sql/SqlError").SqlError | SqliteMigrator.MigrationError | import("effect/ConfigError").ConfigError, never>;
112
+ //#endregion
113
+ //#region src/router.d.ts
114
+ /**
115
+ * The tRPC router aggregating all MCP tool procedures.
116
+ *
117
+ * Pass to `createCallerFactory` in tests, or to `createCallerFactory(appRouter)`
118
+ * followed by `startMcpServer` in the bin entry to start the MCP server.
119
+ *
120
+ * @public
121
+ */
122
+ declare const appRouter: import("@trpc/server").TRPCBuiltRouter<{
123
+ ctx: McpContext;
124
+ meta: object;
125
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
126
+ transformer: false;
127
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
128
+ help: import("@trpc/server").TRPCQueryProcedure<{
129
+ input: void;
130
+ output: {
131
+ readonly helpText: string;
132
+ };
133
+ meta: object;
134
+ }>;
135
+ test_status: import("@trpc/server").TRPCQueryProcedure<{
136
+ input: {
137
+ readonly project?: string | undefined;
138
+ };
139
+ output: {
140
+ readonly entries: readonly {
141
+ readonly project: string;
142
+ readonly reportFile: string;
143
+ readonly historyFile?: string | undefined;
144
+ readonly lastRun: string | null;
145
+ readonly lastResult: "passed" | "failed" | "interrupted" | null;
146
+ }[];
147
+ readonly dataAvailable: true;
148
+ readonly manifestUpdatedAt: string;
149
+ readonly projectFilter?: string | undefined;
150
+ } | {
151
+ readonly reason: "no_manifest" | "project_filter_empty";
152
+ readonly dataAvailable: false;
153
+ readonly projectFilter?: string | undefined;
154
+ };
155
+ meta: object;
156
+ }>;
157
+ test_overview: import("@trpc/server").TRPCQueryProcedure<{
158
+ input: {
159
+ readonly project?: string | undefined;
160
+ };
161
+ output: {
162
+ readonly dataAvailable: true;
163
+ readonly projectFilter?: string | undefined;
164
+ readonly runs: readonly {
165
+ readonly project: string;
166
+ readonly lastRun: string | null;
167
+ readonly lastResult: "passed" | "failed" | "interrupted" | null;
168
+ readonly passed: number;
169
+ readonly failed: number;
170
+ readonly total: number;
171
+ readonly skipped: number;
172
+ }[];
173
+ } | {
174
+ readonly reason: "project_filter_empty" | "no_runs";
175
+ readonly dataAvailable: false;
176
+ readonly projectFilter?: string | undefined;
177
+ };
178
+ meta: object;
179
+ }>;
180
+ test_coverage: import("@trpc/server").TRPCQueryProcedure<{
181
+ input: {
182
+ readonly project?: string | undefined;
183
+ };
184
+ output: {
185
+ readonly project: string;
186
+ readonly dataAvailable: true;
187
+ readonly coverage: {
188
+ readonly totals: {
189
+ readonly statements: number;
190
+ readonly branches: number;
191
+ readonly functions: number;
192
+ readonly lines: number;
193
+ };
194
+ readonly thresholds: {
195
+ readonly global: {
196
+ readonly statements?: number | undefined;
197
+ readonly branches?: number | undefined;
198
+ readonly functions?: number | undefined;
199
+ readonly lines?: number | undefined;
200
+ };
201
+ readonly patterns: readonly (readonly [string, {
202
+ readonly statements?: number | undefined;
203
+ readonly branches?: number | undefined;
204
+ readonly functions?: number | undefined;
205
+ readonly lines?: number | undefined;
206
+ }])[];
207
+ };
208
+ readonly targets?: {
209
+ readonly global: {
210
+ readonly statements?: number | undefined;
211
+ readonly branches?: number | undefined;
212
+ readonly functions?: number | undefined;
213
+ readonly lines?: number | undefined;
214
+ };
215
+ readonly patterns: readonly (readonly [string, {
216
+ readonly statements?: number | undefined;
217
+ readonly branches?: number | undefined;
218
+ readonly functions?: number | undefined;
219
+ readonly lines?: number | undefined;
220
+ }])[];
221
+ } | undefined;
222
+ readonly baselines?: {
223
+ readonly global: {
224
+ readonly statements?: number | undefined;
225
+ readonly branches?: number | undefined;
226
+ readonly functions?: number | undefined;
227
+ readonly lines?: number | undefined;
228
+ };
229
+ readonly patterns: readonly (readonly [string, {
230
+ readonly statements?: number | undefined;
231
+ readonly branches?: number | undefined;
232
+ readonly functions?: number | undefined;
233
+ readonly lines?: number | undefined;
234
+ }])[];
235
+ } | undefined;
236
+ readonly scoped: boolean;
237
+ readonly scopedFiles?: readonly string[] | undefined;
238
+ readonly lowCoverage: readonly {
239
+ readonly file: string;
240
+ readonly summary: {
241
+ readonly statements: number;
242
+ readonly branches: number;
243
+ readonly functions: number;
244
+ readonly lines: number;
245
+ };
246
+ readonly uncoveredLines: string;
247
+ }[];
248
+ readonly lowCoverageFiles: readonly string[];
249
+ readonly belowTarget?: readonly {
250
+ readonly file: string;
251
+ readonly summary: {
252
+ readonly statements: number;
253
+ readonly branches: number;
254
+ readonly functions: number;
255
+ readonly lines: number;
256
+ };
257
+ readonly uncoveredLines: string;
258
+ }[] | undefined;
259
+ readonly belowTargetFiles?: readonly string[] | undefined;
260
+ };
261
+ } | {
262
+ readonly project: string;
263
+ readonly dataAvailable: false;
264
+ };
265
+ meta: object;
266
+ }>;
267
+ test_history: import("@trpc/server").TRPCQueryProcedure<{
268
+ input: {
269
+ readonly project: string;
270
+ };
271
+ output: {
272
+ readonly project: string;
273
+ readonly hasData: boolean;
274
+ readonly history: {
275
+ readonly project: string;
276
+ readonly updatedAt: string;
277
+ readonly tests: readonly {
278
+ readonly runs: readonly {
279
+ readonly timestamp: string;
280
+ readonly state: "passed" | "failed";
281
+ }[];
282
+ readonly fullName: string;
283
+ }[];
284
+ };
285
+ readonly flaky: readonly {
286
+ readonly project: string;
287
+ readonly fullName: string;
288
+ readonly passCount: number;
289
+ readonly failCount: number;
290
+ readonly lastState: "passed" | "failed";
291
+ readonly lastTimestamp: string;
292
+ }[];
293
+ readonly persistent: readonly {
294
+ readonly project: string;
295
+ readonly fullName: string;
296
+ readonly consecutiveFailures: number;
297
+ readonly firstFailedAt: string;
298
+ readonly lastFailedAt: string;
299
+ readonly lastErrorMessage: string | null;
300
+ }[];
301
+ readonly recovered: readonly {
302
+ readonly fullName: string;
303
+ readonly recentRuns: readonly ("passed" | "failed")[];
304
+ }[];
305
+ };
306
+ meta: object;
307
+ }>;
308
+ test_trends: import("@trpc/server").TRPCQueryProcedure<{
309
+ input: {
310
+ readonly project: string;
311
+ readonly limit?: number | undefined;
312
+ };
313
+ output: {
314
+ readonly project: string;
315
+ readonly dataAvailable: true;
316
+ readonly trends: {
317
+ readonly entries: readonly {
318
+ readonly coverage: {
319
+ readonly statements: number;
320
+ readonly branches: number;
321
+ readonly functions: number;
322
+ readonly lines: number;
323
+ };
324
+ readonly timestamp: string;
325
+ readonly delta: {
326
+ readonly statements: number;
327
+ readonly branches: number;
328
+ readonly functions: number;
329
+ readonly lines: number;
330
+ };
331
+ readonly direction: "improving" | "regressing" | "stable";
332
+ readonly targetsHash?: string | undefined;
333
+ }[];
334
+ };
335
+ } | {
336
+ readonly project: string;
337
+ readonly dataAvailable: false;
338
+ };
339
+ meta: object;
340
+ }>;
341
+ test_errors: import("@trpc/server").TRPCQueryProcedure<{
342
+ input: {
343
+ readonly project: string;
344
+ readonly errorName?: string | undefined;
345
+ };
346
+ output: {
347
+ readonly project: string;
348
+ readonly errorName?: string | undefined;
349
+ readonly count: number;
350
+ readonly errors: readonly {
351
+ readonly message: string;
352
+ readonly id: number;
353
+ readonly topStackFrameId: number | null;
354
+ readonly name: string | null;
355
+ readonly diff: string | null;
356
+ readonly actual: string | null;
357
+ readonly expected: string | null;
358
+ readonly stack: string | null;
359
+ readonly scope: "test" | "suite" | "module" | "unhandled";
360
+ readonly testFullName: string | null;
361
+ readonly moduleFile: string | null;
362
+ }[];
363
+ };
364
+ meta: object;
365
+ }>;
366
+ test: import("@trpc/server").TRPCQueryProcedure<{
367
+ input: {
368
+ readonly action: "list";
369
+ readonly project?: string | undefined;
370
+ readonly state?: string | undefined;
371
+ readonly limit?: number | undefined;
372
+ readonly module?: string | undefined;
373
+ } | {
374
+ readonly fullName: string;
375
+ readonly action: "get";
376
+ readonly project?: string | undefined;
377
+ } | {
378
+ readonly action: "for_file";
379
+ readonly filePath: string;
380
+ } | {
381
+ readonly action: "for_tag";
382
+ readonly tag: string;
383
+ readonly project?: string | undefined;
384
+ };
385
+ output: {
386
+ readonly count: number;
387
+ readonly action: "list";
388
+ readonly groups: readonly {
389
+ readonly project: string;
390
+ readonly tests: readonly {
391
+ readonly fullName: string;
392
+ readonly state: string;
393
+ readonly id: number;
394
+ readonly module: string;
395
+ readonly duration: number | null;
396
+ readonly classification: string | null;
397
+ }[];
398
+ }[];
399
+ } | {
400
+ readonly project: string;
401
+ readonly runs: readonly {
402
+ readonly timestamp: string;
403
+ readonly state: "passed" | "failed";
404
+ }[];
405
+ readonly test: {
406
+ readonly fullName: string;
407
+ readonly state: string;
408
+ readonly id: number;
409
+ readonly module: string;
410
+ readonly duration: number | null;
411
+ readonly classification: string | null;
412
+ };
413
+ readonly errors: readonly {
414
+ readonly message: string;
415
+ readonly name: string | null;
416
+ readonly diff: string | null;
417
+ readonly stack: string | null;
418
+ }[];
419
+ readonly action: "get";
420
+ readonly found: true;
421
+ } | {
422
+ readonly project: string;
423
+ readonly fullName: string;
424
+ readonly action: "get";
425
+ readonly found: false;
426
+ } | {
427
+ readonly count: number;
428
+ readonly action: "for_file";
429
+ readonly filePath: string;
430
+ readonly testFiles: readonly string[];
431
+ } | {
432
+ readonly count: number;
433
+ readonly action: "for_tag";
434
+ readonly tag: string;
435
+ readonly groups: readonly {
436
+ readonly project: string;
437
+ readonly tests: readonly {
438
+ readonly fullName: string;
439
+ readonly state: string;
440
+ readonly id: number;
441
+ readonly module: string;
442
+ readonly duration: number | null;
443
+ readonly classification: string | null;
444
+ }[];
445
+ }[];
446
+ };
447
+ meta: object;
448
+ }>;
449
+ file_coverage: import("@trpc/server").TRPCQueryProcedure<{
450
+ input: {
451
+ readonly filePath: string;
452
+ readonly project?: string | undefined;
453
+ };
454
+ output: {
455
+ readonly dataAvailable: true;
456
+ readonly filePath: string;
457
+ readonly matched: true;
458
+ readonly report: {
459
+ readonly file: string;
460
+ readonly summary: {
461
+ readonly statements: number;
462
+ readonly branches: number;
463
+ readonly functions: number;
464
+ readonly lines: number;
465
+ };
466
+ readonly uncoveredLines: string;
467
+ };
468
+ readonly globalThresholds: {
469
+ readonly statements?: number | undefined;
470
+ readonly branches?: number | undefined;
471
+ readonly functions?: number | undefined;
472
+ readonly lines?: number | undefined;
473
+ };
474
+ readonly relatedTestFiles: readonly string[];
475
+ } | {
476
+ readonly dataAvailable: true;
477
+ readonly totals: {
478
+ readonly statements: number;
479
+ readonly branches: number;
480
+ readonly functions: number;
481
+ readonly lines: number;
482
+ };
483
+ readonly filePath: string;
484
+ readonly matched: false;
485
+ readonly relatedTestFiles: readonly string[];
486
+ } | {
487
+ readonly dataAvailable: false;
488
+ readonly filePath: string;
489
+ };
490
+ meta: object;
491
+ }>;
492
+ run_tests: import("@trpc/server").TRPCMutationProcedure<{
493
+ input: {
494
+ readonly project?: string | undefined;
495
+ readonly files?: readonly string[] | undefined;
496
+ readonly tags?: {
497
+ readonly all?: readonly string[] | undefined;
498
+ readonly any?: readonly string[] | undefined;
499
+ readonly none?: readonly string[] | undefined;
500
+ } | undefined;
501
+ readonly passWithNoTests?: boolean | undefined;
502
+ readonly timeout?: number | undefined;
503
+ readonly _sessionContext?: {
504
+ readonly chatId: string;
505
+ readonly conversationId: string;
506
+ readonly mainAgentId: string;
507
+ } | undefined;
508
+ };
509
+ output: {
510
+ readonly project?: string | undefined;
511
+ readonly report: {
512
+ readonly reason: "passed" | "failed" | "interrupted";
513
+ readonly project?: string | undefined;
514
+ readonly failed: readonly {
515
+ readonly file: string;
516
+ readonly tests: readonly {
517
+ readonly fullName: string;
518
+ readonly state: "passed" | "failed" | "skipped" | "pending";
519
+ readonly flaky?: boolean | undefined;
520
+ readonly name: string;
521
+ readonly errors?: readonly {
522
+ readonly message: string;
523
+ readonly diff?: string | undefined;
524
+ readonly expected?: string | undefined;
525
+ readonly stack?: string | undefined;
526
+ readonly received?: string | undefined;
527
+ }[] | undefined;
528
+ readonly duration?: number | undefined;
529
+ readonly classification?: "flaky" | "persistent" | "recovered" | "stable" | "new-failure" | undefined;
530
+ readonly slow?: boolean | undefined;
531
+ }[];
532
+ readonly state: "passed" | "failed" | "skipped" | "pending";
533
+ readonly errors?: readonly {
534
+ readonly message: string;
535
+ readonly diff?: string | undefined;
536
+ readonly expected?: string | undefined;
537
+ readonly stack?: string | undefined;
538
+ readonly received?: string | undefined;
539
+ }[] | undefined;
540
+ readonly duration?: number | undefined;
541
+ }[];
542
+ readonly summary: {
543
+ readonly passed: number;
544
+ readonly failed: number;
545
+ readonly total: number;
546
+ readonly skipped: number;
547
+ readonly duration: number;
548
+ };
549
+ readonly coverage?: {
550
+ readonly totals: {
551
+ readonly statements: number;
552
+ readonly branches: number;
553
+ readonly functions: number;
554
+ readonly lines: number;
555
+ };
556
+ readonly thresholds: {
557
+ readonly global: {
558
+ readonly statements?: number | undefined;
559
+ readonly branches?: number | undefined;
560
+ readonly functions?: number | undefined;
561
+ readonly lines?: number | undefined;
562
+ };
563
+ readonly patterns: readonly (readonly [string, {
564
+ readonly statements?: number | undefined;
565
+ readonly branches?: number | undefined;
566
+ readonly functions?: number | undefined;
567
+ readonly lines?: number | undefined;
568
+ }])[];
569
+ };
570
+ readonly targets?: {
571
+ readonly global: {
572
+ readonly statements?: number | undefined;
573
+ readonly branches?: number | undefined;
574
+ readonly functions?: number | undefined;
575
+ readonly lines?: number | undefined;
576
+ };
577
+ readonly patterns: readonly (readonly [string, {
578
+ readonly statements?: number | undefined;
579
+ readonly branches?: number | undefined;
580
+ readonly functions?: number | undefined;
581
+ readonly lines?: number | undefined;
582
+ }])[];
583
+ } | undefined;
584
+ readonly baselines?: {
585
+ readonly global: {
586
+ readonly statements?: number | undefined;
587
+ readonly branches?: number | undefined;
588
+ readonly functions?: number | undefined;
589
+ readonly lines?: number | undefined;
590
+ };
591
+ readonly patterns: readonly (readonly [string, {
592
+ readonly statements?: number | undefined;
593
+ readonly branches?: number | undefined;
594
+ readonly functions?: number | undefined;
595
+ readonly lines?: number | undefined;
596
+ }])[];
597
+ } | undefined;
598
+ readonly scoped: boolean;
599
+ readonly scopedFiles?: readonly string[] | undefined;
600
+ readonly lowCoverage: readonly {
601
+ readonly file: string;
602
+ readonly summary: {
603
+ readonly statements: number;
604
+ readonly branches: number;
605
+ readonly functions: number;
606
+ readonly lines: number;
607
+ };
608
+ readonly uncoveredLines: string;
609
+ }[];
610
+ readonly lowCoverageFiles: readonly string[];
611
+ readonly belowTarget?: readonly {
612
+ readonly file: string;
613
+ readonly summary: {
614
+ readonly statements: number;
615
+ readonly branches: number;
616
+ readonly functions: number;
617
+ readonly lines: number;
618
+ };
619
+ readonly uncoveredLines: string;
620
+ }[] | undefined;
621
+ readonly belowTargetFiles?: readonly string[] | undefined;
622
+ } | undefined;
623
+ readonly timestamp: string;
624
+ readonly unhandledErrors: readonly {
625
+ readonly message: string;
626
+ readonly diff?: string | undefined;
627
+ readonly expected?: string | undefined;
628
+ readonly stack?: string | undefined;
629
+ readonly received?: string | undefined;
630
+ }[];
631
+ readonly failedFiles: readonly string[];
632
+ readonly tagCounts?: {
633
+ readonly [x: string]: {
634
+ readonly passed?: number | undefined;
635
+ readonly failed?: number | undefined;
636
+ readonly skipped?: number | undefined;
637
+ };
638
+ } | undefined;
639
+ };
640
+ readonly kind: "ok";
641
+ readonly classifications: {
642
+ readonly [x: string]: string;
643
+ };
644
+ } | {
645
+ readonly kind: "timeout";
646
+ readonly timeoutSeconds: number;
647
+ } | {
648
+ readonly message: string;
649
+ readonly kind: "error";
650
+ } | {
651
+ readonly filter: {
652
+ readonly project: string | null;
653
+ readonly files: readonly string[];
654
+ readonly tags: {
655
+ readonly all?: readonly string[] | undefined;
656
+ readonly any?: readonly string[] | undefined;
657
+ readonly none?: readonly string[] | undefined;
658
+ } | null;
659
+ readonly resolvedExpression: string | null;
660
+ };
661
+ readonly kind: "no-match";
662
+ };
663
+ meta: object;
664
+ }>;
665
+ register_agent: import("@trpc/server").TRPCMutationProcedure<{
666
+ input: {
667
+ readonly chatId: string;
668
+ readonly agentType: string;
669
+ readonly conversationId?: string | undefined;
670
+ readonly hostKind?: string | undefined;
671
+ readonly parentAgentId?: string | undefined;
672
+ readonly clientNonce?: string | undefined;
673
+ readonly startGitBranch?: string | undefined;
674
+ readonly startGitCommitSha?: string | undefined;
675
+ readonly startWorktreeDir?: string | undefined;
676
+ };
677
+ output: {
678
+ readonly conversationId: string | null;
679
+ readonly ok: true;
680
+ readonly agentId: string;
681
+ readonly idempotencyKey: string;
682
+ } | {
683
+ readonly ok: false;
684
+ readonly error: {
685
+ readonly message: string;
686
+ readonly code: "AGENT_ALREADY_REGISTERED" | "PARENT_AGENT_NOT_FOUND" | "SESSION_NOT_FOUND" | "INVALID_AGENT_TYPE_PREFIX";
687
+ readonly existingAgentId?: string | undefined;
688
+ readonly expectedPrefix?: string | undefined;
689
+ };
690
+ };
691
+ meta: object;
692
+ }>;
693
+ cache_health: import("@trpc/server").TRPCQueryProcedure<{
694
+ input: void;
695
+ output: {
696
+ readonly manifestPresent: true;
697
+ readonly manifest: {
698
+ readonly updatedAt: string;
699
+ readonly cacheDir: string;
700
+ readonly projects: readonly {
701
+ readonly project: string;
702
+ readonly reportFile: string;
703
+ readonly historyFile?: string | undefined;
704
+ readonly lastRun: string | null;
705
+ readonly lastResult: "passed" | "failed" | "interrupted" | null;
706
+ }[];
707
+ };
708
+ readonly ageMs: number;
709
+ readonly stale: boolean;
710
+ } | {
711
+ readonly manifestPresent: false;
712
+ };
713
+ meta: object;
714
+ }>;
715
+ configure: import("@trpc/server").TRPCQueryProcedure<{
716
+ input: {
717
+ readonly settingsHash?: string | undefined;
718
+ };
719
+ output: {
720
+ readonly found: true;
721
+ readonly source: "requested" | "latest";
722
+ readonly settings: {
723
+ readonly project: string | null;
724
+ readonly hash: string;
725
+ readonly reporters: string | null;
726
+ readonly coverageEnabled: boolean;
727
+ readonly coverageProvider: string | null;
728
+ readonly coverageThresholds: string | null;
729
+ readonly coverageTargets: string | null;
730
+ readonly pool: string | null;
731
+ readonly shard: string | null;
732
+ readonly environment: string | null;
733
+ readonly envVars: {
734
+ readonly [x: string]: string;
735
+ };
736
+ readonly capturedAt: string;
737
+ };
738
+ } | {
739
+ readonly found: false;
740
+ readonly source: "requested" | "latest";
741
+ readonly requestedHash?: string | undefined;
742
+ };
743
+ meta: object;
744
+ }>;
745
+ inventory: import("@trpc/server").TRPCQueryProcedure<{
746
+ input: {
747
+ readonly kind: "project";
748
+ } | {
749
+ readonly kind: "module";
750
+ readonly project?: string | undefined;
751
+ } | {
752
+ readonly kind: "suite";
753
+ readonly project?: string | undefined;
754
+ readonly module?: string | undefined;
755
+ } | {
756
+ readonly kind: "session";
757
+ readonly project?: string | undefined;
758
+ readonly limit?: number | undefined;
759
+ readonly id?: number | undefined;
760
+ readonly agentKind?: "main" | "subagent" | undefined;
761
+ } | {
762
+ readonly kind: "tag";
763
+ readonly project?: string | undefined;
764
+ };
765
+ output: {
766
+ readonly count: number;
767
+ readonly projects: readonly {
768
+ readonly project: string;
769
+ readonly lastRun: string | null;
770
+ readonly lastResult: "passed" | "failed" | "interrupted" | null;
771
+ readonly passed: number;
772
+ readonly failed: number;
773
+ readonly total: number;
774
+ readonly skipped: number;
775
+ }[];
776
+ readonly inventoryKind: "project";
777
+ } | {
778
+ readonly count: number;
779
+ readonly groups: readonly {
780
+ readonly project: string;
781
+ readonly modules: readonly {
782
+ readonly file: string;
783
+ readonly state: string;
784
+ readonly id: number;
785
+ readonly duration: number | null;
786
+ readonly testCount: number;
787
+ }[];
788
+ }[];
789
+ readonly inventoryKind: "module";
790
+ } | {
791
+ readonly count: number;
792
+ readonly groups: readonly {
793
+ readonly project: string;
794
+ readonly suites: readonly {
795
+ readonly state: string;
796
+ readonly id: number;
797
+ readonly name: string;
798
+ readonly module: string;
799
+ readonly testCount: number;
800
+ }[];
801
+ }[];
802
+ readonly inventoryKind: "suite";
803
+ } | {
804
+ readonly found: true;
805
+ readonly session: {
806
+ readonly project: string;
807
+ readonly cwd: string;
808
+ readonly id: number;
809
+ readonly chatId: string;
810
+ readonly agentType: string | null;
811
+ readonly agentKind: "main" | "subagent";
812
+ readonly parentSessionId: number | null;
813
+ readonly triageWasNonEmpty: boolean;
814
+ readonly startedAt: string;
815
+ readonly endedAt: string | null;
816
+ readonly endReason: string | null;
817
+ };
818
+ readonly inventoryKind: "session_detail";
819
+ } | {
820
+ readonly id: number;
821
+ readonly found: false;
822
+ readonly inventoryKind: "session_detail";
823
+ } | {
824
+ readonly count: number;
825
+ readonly inventoryKind: "session_list";
826
+ readonly sessions: readonly {
827
+ readonly project: string;
828
+ readonly cwd: string;
829
+ readonly id: number;
830
+ readonly chatId: string;
831
+ readonly agentType: string | null;
832
+ readonly agentKind: "main" | "subagent";
833
+ readonly parentSessionId: number | null;
834
+ readonly triageWasNonEmpty: boolean;
835
+ readonly startedAt: string;
836
+ readonly endedAt: string | null;
837
+ readonly endReason: string | null;
838
+ }[];
839
+ } | {
840
+ readonly project: string;
841
+ readonly count: number;
842
+ readonly tags: readonly {
843
+ readonly tag: string;
844
+ readonly testCount: number;
845
+ readonly moduleCount: number;
846
+ }[];
847
+ readonly inventoryKind: "tag_scoped";
848
+ } | {
849
+ readonly count: number;
850
+ readonly tags: readonly {
851
+ readonly tag: string;
852
+ readonly testCount: number;
853
+ readonly moduleCount: number;
854
+ readonly byProject: readonly {
855
+ readonly project: string;
856
+ readonly testCount: number;
857
+ readonly moduleCount: number;
858
+ }[];
859
+ }[];
860
+ readonly inventoryKind: "tag_unscoped";
861
+ };
862
+ meta: object;
863
+ }>;
864
+ settings_list: import("@trpc/server").TRPCQueryProcedure<{
865
+ input: {};
866
+ output: {
867
+ readonly count: number;
868
+ readonly settings: readonly {
869
+ readonly hash: string;
870
+ readonly capturedAt: string;
871
+ }[];
872
+ };
873
+ meta: object;
874
+ }>;
875
+ note: import("@trpc/server").TRPCMutationProcedure<{
876
+ input: {
877
+ readonly title: string;
878
+ readonly scope: "project" | "global" | "test" | "suite" | "module" | "note";
879
+ readonly action: "create";
880
+ readonly content: string;
881
+ readonly project?: string | undefined;
882
+ readonly testFullName?: string | undefined;
883
+ readonly modulePath?: string | undefined;
884
+ readonly parentNoteId?: number | undefined;
885
+ readonly createdBy?: string | undefined;
886
+ readonly expiresAt?: string | undefined;
887
+ readonly pinned?: boolean | undefined;
888
+ } | {
889
+ readonly action: "list";
890
+ readonly project?: string | undefined;
891
+ readonly scope?: string | undefined;
892
+ readonly testFullName?: string | undefined;
893
+ } | {
894
+ readonly id: number;
895
+ readonly action: "get";
896
+ } | {
897
+ readonly id: number;
898
+ readonly action: "update";
899
+ readonly title?: string | undefined;
900
+ readonly content?: string | undefined;
901
+ readonly expiresAt?: string | undefined;
902
+ readonly pinned?: boolean | undefined;
903
+ } | {
904
+ readonly id: number;
905
+ readonly action: "delete";
906
+ } | {
907
+ readonly query: string;
908
+ readonly action: "search";
909
+ };
910
+ output: {
911
+ readonly id: number;
912
+ readonly action: "create";
913
+ } | {
914
+ readonly count: number;
915
+ readonly action: "list";
916
+ readonly notes: readonly {
917
+ readonly project: string | null;
918
+ readonly updatedAt: string;
919
+ readonly title: string;
920
+ readonly id: number;
921
+ readonly scope: "project" | "global" | "test" | "suite" | "module" | "note";
922
+ readonly testFullName: string | null;
923
+ readonly content: string;
924
+ readonly modulePath: string | null;
925
+ readonly parentNoteId: number | null;
926
+ readonly createdBy: string | null;
927
+ readonly expiresAt: string | null;
928
+ readonly pinned: boolean;
929
+ readonly createdAt: string;
930
+ }[];
931
+ } | {
932
+ readonly action: "get";
933
+ readonly found: true;
934
+ readonly note: {
935
+ readonly project: string | null;
936
+ readonly updatedAt: string;
937
+ readonly title: string;
938
+ readonly id: number;
939
+ readonly scope: "project" | "global" | "test" | "suite" | "module" | "note";
940
+ readonly testFullName: string | null;
941
+ readonly content: string;
942
+ readonly modulePath: string | null;
943
+ readonly parentNoteId: number | null;
944
+ readonly createdBy: string | null;
945
+ readonly expiresAt: string | null;
946
+ readonly pinned: boolean;
947
+ readonly createdAt: string;
948
+ };
949
+ } | {
950
+ readonly id: number;
951
+ readonly action: "get";
952
+ readonly found: false;
953
+ } | {
954
+ readonly action: "update";
955
+ readonly success: true;
956
+ } | {
957
+ readonly action: "delete";
958
+ readonly success: true;
959
+ } | {
960
+ readonly query: string;
961
+ readonly count: number;
962
+ readonly action: "search";
963
+ readonly notes: readonly {
964
+ readonly project: string | null;
965
+ readonly updatedAt: string;
966
+ readonly title: string;
967
+ readonly id: number;
968
+ readonly scope: "project" | "global" | "test" | "suite" | "module" | "note";
969
+ readonly testFullName: string | null;
970
+ readonly content: string;
971
+ readonly modulePath: string | null;
972
+ readonly parentNoteId: number | null;
973
+ readonly createdBy: string | null;
974
+ readonly expiresAt: string | null;
975
+ readonly pinned: boolean;
976
+ readonly createdAt: string;
977
+ }[];
978
+ };
979
+ meta: object;
980
+ }>;
981
+ turn_search: import("@trpc/server").TRPCQueryProcedure<{
982
+ input: {
983
+ readonly limit?: number | undefined;
984
+ readonly sessionId?: number | undefined;
985
+ readonly since?: string | undefined;
986
+ readonly type?: "note" | "user_prompt" | "tool_call" | "tool_result" | "file_edit" | "hook_fire" | "hypothesis" | undefined;
987
+ };
988
+ output: {
989
+ readonly count: number;
990
+ readonly turns: readonly {
991
+ readonly id: number;
992
+ readonly sessionId: number;
993
+ readonly type: string;
994
+ readonly turnNo: number;
995
+ readonly payload: string;
996
+ readonly occurredAt: string;
997
+ }[];
998
+ };
999
+ meta: object;
1000
+ }>;
1001
+ failure_signature_get: import("@trpc/server").TRPCQueryProcedure<{
1002
+ input: {
1003
+ readonly hash: string;
1004
+ };
1005
+ output: {
1006
+ readonly found: true;
1007
+ readonly signatureHash: string;
1008
+ readonly firstSeenRunId: number | null;
1009
+ readonly firstSeenAt: string;
1010
+ readonly lastSeenAt: string | null;
1011
+ readonly occurrenceCount: number;
1012
+ readonly recentErrors: readonly {
1013
+ readonly message: string;
1014
+ readonly errorName: string | null;
1015
+ readonly runId: number;
1016
+ }[];
1017
+ } | {
1018
+ readonly found: false;
1019
+ readonly requestedHash: string;
1020
+ };
1021
+ meta: object;
1022
+ }>;
1023
+ tdd_task: import("@trpc/server").TRPCMutationProcedure<{
1024
+ input: {
1025
+ readonly action: "start";
1026
+ readonly goal: string;
1027
+ readonly chatId?: string | undefined;
1028
+ readonly startedAt?: string | undefined;
1029
+ readonly sessionId?: number | undefined;
1030
+ readonly runId?: string | undefined;
1031
+ readonly parentTddTaskId?: number | undefined;
1032
+ } | {
1033
+ readonly action: "end";
1034
+ readonly tddTaskId: number;
1035
+ readonly outcome: "succeeded" | "blocked" | "abandoned";
1036
+ readonly summaryNoteId?: number | undefined;
1037
+ } | {
1038
+ readonly action: "get";
1039
+ readonly tddTaskId: number;
1040
+ } | {
1041
+ readonly action: "resume";
1042
+ readonly tddTaskId: number;
1043
+ };
1044
+ output: {
1045
+ readonly action: "start";
1046
+ readonly runId?: string | undefined;
1047
+ readonly goal: string;
1048
+ readonly tddTaskId: number;
1049
+ } | {
1050
+ readonly action: "end";
1051
+ readonly tddTaskId: number;
1052
+ readonly outcome: "succeeded" | "blocked" | "abandoned";
1053
+ } | {
1054
+ readonly action: "get";
1055
+ readonly found: true;
1056
+ readonly task: {
1057
+ readonly startedAt: string;
1058
+ readonly endedAt: string | null;
1059
+ readonly sessionId: number;
1060
+ readonly runId: string | null;
1061
+ readonly goal: string;
1062
+ readonly tddTaskId: number;
1063
+ readonly outcome: string | null;
1064
+ readonly goals: readonly {
1065
+ readonly id: number;
1066
+ readonly createdAt: string;
1067
+ readonly sessionId: number;
1068
+ readonly goal: string;
1069
+ readonly behaviors: readonly {
1070
+ readonly id: number;
1071
+ readonly createdAt: string;
1072
+ readonly ordinal: number;
1073
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1074
+ readonly goalId: number;
1075
+ readonly behavior: string;
1076
+ readonly suggestedTestName: string | null;
1077
+ }[];
1078
+ readonly ordinal: number;
1079
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1080
+ }[];
1081
+ readonly phases: readonly {
1082
+ readonly id: number;
1083
+ readonly startedAt: string;
1084
+ readonly endedAt: string | null;
1085
+ readonly behaviorId: number | null;
1086
+ readonly phase: string;
1087
+ readonly transitionReason: string | null;
1088
+ }[];
1089
+ readonly artifacts: readonly {
1090
+ readonly id: number;
1091
+ readonly phaseId: number;
1092
+ readonly artifactKind: string;
1093
+ readonly testCaseId: number | null;
1094
+ readonly testRunId: number | null;
1095
+ readonly recordedAt: string;
1096
+ }[];
1097
+ };
1098
+ readonly currentPhase: {
1099
+ readonly id: number;
1100
+ readonly startedAt: string;
1101
+ readonly behaviorId: number | null;
1102
+ readonly phase: string;
1103
+ } | null;
1104
+ } | {
1105
+ readonly action: "get";
1106
+ readonly found: false;
1107
+ readonly tddTaskId: number;
1108
+ } | {
1109
+ readonly action: "resume";
1110
+ readonly found: true;
1111
+ readonly goal: string;
1112
+ readonly tddTaskId: number;
1113
+ readonly status: string;
1114
+ readonly currentPhase: {
1115
+ readonly id: number;
1116
+ readonly startedAt: string;
1117
+ readonly behaviorId: number | null;
1118
+ readonly phase: string;
1119
+ } | null;
1120
+ readonly phasesRecorded: number;
1121
+ readonly artifactsRecorded: number;
1122
+ } | {
1123
+ readonly action: "resume";
1124
+ readonly found: false;
1125
+ readonly tddTaskId: number;
1126
+ };
1127
+ meta: object;
1128
+ }>;
1129
+ tdd_phase_transition_request: import("@trpc/server").TRPCMutationProcedure<{
1130
+ input: {
1131
+ readonly tddTaskId: number;
1132
+ readonly goalId: number;
1133
+ readonly requestedPhase: "spike" | "red" | "red.triangulate" | "green" | "green.fake-it" | "refactor" | "extended-red" | "green-without-red";
1134
+ readonly reason?: string | undefined;
1135
+ readonly behaviorId?: number | undefined;
1136
+ readonly citedArtifactId?: number | undefined;
1137
+ readonly citedArtifactKind?: "refactor" | "test_written" | "test_failed_run" | "code_written" | "test_passed_run" | "test_weakened" | undefined;
1138
+ };
1139
+ output: {
1140
+ readonly accepted: false;
1141
+ readonly phase: import("@vitest-agent/sdk").Phase;
1142
+ readonly denialReason: import("@vitest-agent/sdk").DenialReason;
1143
+ readonly remediation: import("@vitest-agent/sdk").Remediation;
1144
+ } | {
1145
+ citedArtifactId?: number | undefined;
1146
+ citedArtifactSource?: "none" | "explicit-id" | "explicit-kind" | "transition-derived" | undefined;
1147
+ accepted: true;
1148
+ phase: import("@vitest-agent/sdk").Phase;
1149
+ newPhaseId: number;
1150
+ previousPhaseId: number | null;
1151
+ };
1152
+ meta: object;
1153
+ }>;
1154
+ tdd_goal: import("@trpc/server").TRPCMutationProcedure<{
1155
+ input: {
1156
+ readonly action: "create";
1157
+ readonly goal: string;
1158
+ readonly tddTaskId: number;
1159
+ } | {
1160
+ readonly id: number;
1161
+ readonly action: "update";
1162
+ readonly goal?: string | undefined;
1163
+ readonly status?: "pending" | "abandoned" | "in_progress" | "done" | undefined;
1164
+ } | {
1165
+ readonly id: number;
1166
+ readonly action: "delete";
1167
+ } | {
1168
+ readonly id: number;
1169
+ readonly action: "get";
1170
+ } | {
1171
+ readonly action: "list";
1172
+ readonly tddTaskId: number;
1173
+ };
1174
+ output: TddErrorEnvelope | {
1175
+ ok: true;
1176
+ action: "create";
1177
+ goal: {
1178
+ readonly id: number;
1179
+ readonly createdAt: string;
1180
+ readonly sessionId: number;
1181
+ readonly goal: string;
1182
+ readonly ordinal: number;
1183
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1184
+ };
1185
+ } | {
1186
+ ok: true;
1187
+ action: "update";
1188
+ goal: {
1189
+ readonly id: number;
1190
+ readonly createdAt: string;
1191
+ readonly sessionId: number;
1192
+ readonly goal: string;
1193
+ readonly ordinal: number;
1194
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1195
+ };
1196
+ } | {
1197
+ ok: true;
1198
+ action: "delete";
1199
+ id: number;
1200
+ } | {
1201
+ action: "get";
1202
+ found: false;
1203
+ id: number;
1204
+ goal?: undefined;
1205
+ } | {
1206
+ action: "get";
1207
+ found: true;
1208
+ goal: {
1209
+ readonly id: number;
1210
+ readonly createdAt: string;
1211
+ readonly sessionId: number;
1212
+ readonly goal: string;
1213
+ readonly behaviors: readonly {
1214
+ readonly id: number;
1215
+ readonly createdAt: string;
1216
+ readonly ordinal: number;
1217
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1218
+ readonly goalId: number;
1219
+ readonly behavior: string;
1220
+ readonly suggestedTestName: string | null;
1221
+ }[];
1222
+ readonly ordinal: number;
1223
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1224
+ };
1225
+ id?: undefined;
1226
+ } | {
1227
+ ok: true;
1228
+ action: "list";
1229
+ tddTaskId: number;
1230
+ goals: readonly {
1231
+ readonly id: number;
1232
+ readonly createdAt: string;
1233
+ readonly sessionId: number;
1234
+ readonly goal: string;
1235
+ readonly behaviors: readonly {
1236
+ readonly id: number;
1237
+ readonly createdAt: string;
1238
+ readonly ordinal: number;
1239
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1240
+ readonly goalId: number;
1241
+ readonly behavior: string;
1242
+ readonly suggestedTestName: string | null;
1243
+ }[];
1244
+ readonly ordinal: number;
1245
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1246
+ }[];
1247
+ };
1248
+ meta: object;
1249
+ }>;
1250
+ tdd_behavior: import("@trpc/server").TRPCMutationProcedure<{
1251
+ input: {
1252
+ readonly action: "create";
1253
+ readonly goalId: number;
1254
+ readonly behavior: string;
1255
+ readonly suggestedTestName?: string | undefined;
1256
+ readonly dependsOnBehaviorIds?: readonly number[] | undefined;
1257
+ } | {
1258
+ readonly id: number;
1259
+ readonly action: "update";
1260
+ readonly status?: "pending" | "abandoned" | "in_progress" | "done" | undefined;
1261
+ readonly behavior?: string | undefined;
1262
+ readonly suggestedTestName?: string | null | undefined;
1263
+ readonly dependsOnBehaviorIds?: readonly number[] | undefined;
1264
+ } | {
1265
+ readonly id: number;
1266
+ readonly action: "delete";
1267
+ } | {
1268
+ readonly id: number;
1269
+ readonly action: "get";
1270
+ } | {
1271
+ readonly action: "list_by_goal";
1272
+ readonly goalId: number;
1273
+ } | {
1274
+ readonly action: "list_by_tdd_task";
1275
+ readonly tddTaskId: number;
1276
+ };
1277
+ output: TddErrorEnvelope | {
1278
+ ok: true;
1279
+ action: "create";
1280
+ behavior: {
1281
+ readonly id: number;
1282
+ readonly createdAt: string;
1283
+ readonly ordinal: number;
1284
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1285
+ readonly goalId: number;
1286
+ readonly behavior: string;
1287
+ readonly suggestedTestName: string | null;
1288
+ };
1289
+ } | {
1290
+ ok: true;
1291
+ action: "update";
1292
+ behavior: {
1293
+ readonly id: number;
1294
+ readonly createdAt: string;
1295
+ readonly ordinal: number;
1296
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1297
+ readonly goalId: number;
1298
+ readonly behavior: string;
1299
+ readonly suggestedTestName: string | null;
1300
+ };
1301
+ } | {
1302
+ ok: true;
1303
+ action: "delete";
1304
+ id: number;
1305
+ } | {
1306
+ action: "get";
1307
+ found: false;
1308
+ id: number;
1309
+ behavior?: undefined;
1310
+ } | {
1311
+ action: "get";
1312
+ found: true;
1313
+ behavior: {
1314
+ readonly id: number;
1315
+ readonly createdAt: string;
1316
+ readonly ordinal: number;
1317
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1318
+ readonly goalId: number;
1319
+ readonly behavior: string;
1320
+ readonly suggestedTestName: string | null;
1321
+ readonly parentGoal: {
1322
+ readonly id: number;
1323
+ readonly goal: string;
1324
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1325
+ };
1326
+ readonly dependencies: readonly {
1327
+ readonly id: number;
1328
+ readonly createdAt: string;
1329
+ readonly ordinal: number;
1330
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1331
+ readonly goalId: number;
1332
+ readonly behavior: string;
1333
+ readonly suggestedTestName: string | null;
1334
+ }[];
1335
+ };
1336
+ id?: undefined;
1337
+ } | {
1338
+ ok: true;
1339
+ action: "list_by_goal";
1340
+ goalId: number;
1341
+ behaviors: readonly {
1342
+ readonly id: number;
1343
+ readonly createdAt: string;
1344
+ readonly ordinal: number;
1345
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1346
+ readonly goalId: number;
1347
+ readonly behavior: string;
1348
+ readonly suggestedTestName: string | null;
1349
+ }[];
1350
+ } | {
1351
+ ok: true;
1352
+ action: "list_by_tdd_task";
1353
+ tddTaskId: number;
1354
+ behaviors: readonly {
1355
+ readonly id: number;
1356
+ readonly createdAt: string;
1357
+ readonly ordinal: number;
1358
+ readonly status: "pending" | "abandoned" | "in_progress" | "done";
1359
+ readonly goalId: number;
1360
+ readonly behavior: string;
1361
+ readonly suggestedTestName: string | null;
1362
+ }[];
1363
+ };
1364
+ meta: object;
1365
+ }>;
1366
+ tdd_artifact_list: import("@trpc/server").TRPCQueryProcedure<{
1367
+ input: {
1368
+ readonly tddTaskId: number;
1369
+ readonly limit?: number | undefined;
1370
+ readonly behaviorId?: number | undefined;
1371
+ readonly phaseId?: number | undefined;
1372
+ readonly artifactKind?: "refactor" | "test_written" | "test_failed_run" | "code_written" | "test_passed_run" | "test_weakened" | undefined;
1373
+ };
1374
+ output: {
1375
+ readonly count: number;
1376
+ readonly tddTaskId: number;
1377
+ readonly artifacts: readonly {
1378
+ readonly id: number;
1379
+ readonly tddTaskId: number;
1380
+ readonly behaviorId: number | null;
1381
+ readonly phaseId: number;
1382
+ readonly artifactKind: "refactor" | "test_written" | "test_failed_run" | "code_written" | "test_passed_run" | "test_weakened";
1383
+ readonly testCaseId: number | null;
1384
+ readonly testRunId: number | null;
1385
+ readonly recordedAt: string;
1386
+ readonly phaseName: "spike" | "red" | "red.triangulate" | "green" | "green.fake-it" | "refactor" | "extended-red" | "green-without-red";
1387
+ readonly testFirstFailureRunId: number | null;
1388
+ }[];
1389
+ readonly filters: {
1390
+ readonly behaviorId?: number | undefined;
1391
+ readonly phaseId?: number | undefined;
1392
+ readonly artifactKind?: "refactor" | "test_written" | "test_failed_run" | "code_written" | "test_passed_run" | "test_weakened" | undefined;
1393
+ };
1394
+ };
1395
+ meta: object;
1396
+ }>;
1397
+ hypothesis: import("@trpc/server").TRPCMutationProcedure<{
1398
+ input: {
1399
+ readonly action: "record";
1400
+ readonly content: string;
1401
+ readonly sessionId?: number | undefined;
1402
+ readonly createdTurnId?: number | undefined;
1403
+ readonly citedTestErrorId?: number | undefined;
1404
+ readonly citedStackFrameId?: number | undefined;
1405
+ } | {
1406
+ readonly id: number;
1407
+ readonly action: "validate";
1408
+ readonly outcome: "abandoned" | "confirmed" | "refuted";
1409
+ readonly validatedAt: string;
1410
+ readonly validatedTurnId?: number | undefined;
1411
+ } | {
1412
+ readonly action: "list";
1413
+ readonly limit?: number | undefined;
1414
+ readonly sessionId?: number | undefined;
1415
+ readonly outcome?: "open" | "abandoned" | "confirmed" | "refuted" | undefined;
1416
+ };
1417
+ output: {
1418
+ readonly id: number;
1419
+ readonly action: "record";
1420
+ } | {
1421
+ readonly action: "validate";
1422
+ } | {
1423
+ readonly count: number;
1424
+ readonly action: "list";
1425
+ readonly hypotheses: readonly {
1426
+ readonly id: number;
1427
+ readonly content: string;
1428
+ readonly sessionId: number;
1429
+ readonly citedTestErrorId: number | null;
1430
+ readonly citedStackFrameId: number | null;
1431
+ readonly validatedAt: string | null;
1432
+ readonly validationOutcome: "abandoned" | "confirmed" | "refuted" | null;
1433
+ }[];
1434
+ };
1435
+ meta: object;
1436
+ }>;
1437
+ acceptance_metrics: import("@trpc/server").TRPCQueryProcedure<{
1438
+ input: {};
1439
+ output: {
1440
+ readonly phaseEvidenceIntegrity: {
1441
+ readonly total: number;
1442
+ readonly compliant: number;
1443
+ readonly ratio: number;
1444
+ };
1445
+ readonly complianceHookResponsiveness: {
1446
+ readonly total: number;
1447
+ readonly ratio: number;
1448
+ readonly withFollowup: number;
1449
+ };
1450
+ readonly orientationUsefulness: {
1451
+ readonly total: number;
1452
+ readonly ratio: number;
1453
+ readonly referencedCount: number;
1454
+ };
1455
+ readonly antiPatternDetectionRate: {
1456
+ readonly total: number;
1457
+ readonly ratio: number;
1458
+ readonly cleanSessions: number;
1459
+ };
1460
+ };
1461
+ meta: object;
1462
+ }>;
1463
+ triage_brief: import("@trpc/server").TRPCQueryProcedure<{
1464
+ input: {
1465
+ readonly project?: string | undefined;
1466
+ readonly maxLines?: number | undefined;
1467
+ };
1468
+ output: {
1469
+ readonly hasContent: boolean;
1470
+ readonly markdown: string;
1471
+ };
1472
+ meta: object;
1473
+ }>;
1474
+ wrapup_prompt: import("@trpc/server").TRPCQueryProcedure<{
1475
+ input: {
1476
+ readonly chatId?: string | undefined;
1477
+ readonly kind?: "stop" | "session_end" | "pre_compact" | "tdd_handoff" | "user_prompt_nudge" | undefined;
1478
+ readonly sessionId?: number | undefined;
1479
+ readonly userPromptHint?: string | undefined;
1480
+ };
1481
+ output: {
1482
+ readonly kind: "stop" | "session_end" | "pre_compact" | "tdd_handoff" | "user_prompt_nudge";
1483
+ readonly hasContent: boolean;
1484
+ readonly markdown: string;
1485
+ };
1486
+ meta: object;
1487
+ }>;
1488
+ commit_changes: import("@trpc/server").TRPCQueryProcedure<{
1489
+ input: {
1490
+ readonly sha?: string | undefined;
1491
+ };
1492
+ output: {
1493
+ readonly count: number;
1494
+ readonly filterSha?: string | undefined;
1495
+ readonly commits: readonly {
1496
+ readonly message: string | null;
1497
+ readonly files: readonly {
1498
+ readonly filePath: string;
1499
+ readonly changeKind: "added" | "modified" | "deleted" | "renamed" | "untracked-modified";
1500
+ }[];
1501
+ readonly sha: string;
1502
+ readonly parentSha: string | null;
1503
+ readonly author: string | null;
1504
+ readonly committedAt: string | null;
1505
+ readonly branch: string | null;
1506
+ }[];
1507
+ };
1508
+ meta: object;
1509
+ }>;
1510
+ ping: import("@trpc/server").TRPCQueryProcedure<{
1511
+ input: void;
1512
+ output: {
1513
+ readonly message: "pong";
1514
+ };
1515
+ meta: object;
1516
+ }>;
1517
+ }>>;
1518
+ //#endregion
1519
+ //#region src/server.d.ts
1520
+ /**
1521
+ * Starts the MCP server over stdio, registering all tools, resources, and prompts.
1522
+ *
1523
+ * Constructs the MCP server instance, registers all tRPC-backed tools (wired through
1524
+ * `ctx.runtime`), calls `registerAllResources` and `registerAllPrompts`, then connects
1525
+ * a `StdioServerTransport`. Returns when the transport disconnects.
1526
+ *
1527
+ * @param ctx - the MCP context carrying the shared ManagedRuntime and session refs
1528
+ * @public
1529
+ */
1530
+ declare function startMcpServer(ctx: McpContext): Promise<void>;
1531
+ //#endregion
1532
+ //#region src/tools/_tdd-error-envelope.d.ts
1533
+ /**
1534
+ * Suggested recovery action attached to a TDD error envelope.
1535
+ *
1536
+ * Tells the agent which tool to call next and provides a human-readable hint
1537
+ * explaining the error context and recommended fix.
1538
+ *
1539
+ * @public
1540
+ */
1541
+ interface Remediation {
1542
+ readonly suggestedTool: string;
1543
+ readonly suggestedArgs: Record<string, unknown>;
1544
+ readonly humanHint: string;
1545
+ }
1546
+ /**
1547
+ * Success-shaped envelope returned by TDD CRUD tools when a known TDD error occurs.
1548
+ *
1549
+ * Instead of letting the five tagged TDD errors propagate as transport errors,
1550
+ * `catchTddErrorsAsEnvelope` maps them to this shape so the agent receives a normal
1551
+ * tool response with `ok: false` and a {@link Remediation} describing the next step.
1552
+ *
1553
+ * @public
1554
+ */
1555
+ interface TddErrorEnvelope {
1556
+ readonly ok: false;
1557
+ readonly error: {
1558
+ readonly _tag: string;
1559
+ readonly remediation: Remediation;
1560
+ readonly [key: string]: unknown;
1561
+ };
1562
+ }
1563
+ //#endregion
1564
+ //#region src/index.d.ts
1565
+ /**
1566
+ * The version of this package, inlined at build time from
1567
+ * package.json#version via rslib-builder's __PACKAGE_VERSION__ substitution.
1568
+ * Compared against CURRENT_SDK_VERSION at MCP bin init to surface
1569
+ * partially-upgraded installs as a single stderr warning. See the root
1570
+ * CLAUDE.md "Cross-package version drift" section.
1571
+ *
1572
+ * @public
1573
+ */
1574
+ declare const CURRENT_MCP_VERSION: string;
1575
+ //#endregion
1576
+ export { CURRENT_MCP_VERSION, type CurrentSessionIdRef, type McpContext, McpLive, type Remediation, type SessionContext, type SessionContextRef, type TddErrorEnvelope, appRouter, createCallerFactory, createCurrentSessionIdRef, createSessionContextRef, startMcpServer };
1577
+ //# sourceMappingURL=index.d.ts.map