@vitest-agent/mcp 6.0.1 → 6.1.1

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/README.md CHANGED
@@ -12,11 +12,11 @@ The `vitest-agent-mcp` MCP server bin, built on Effect's native `McpServer` (`ef
12
12
 
13
13
  - **30 action-keyed tools** — one tool per file, assembled into a single `Toolkit`; per-CRUD families collapse into single tools dispatching on an `action` discriminator; covers `test_status`, `test_overview`, `test_coverage`, `test_errors`, `run_tests`, `note`, `hypothesis`, `tdd_task`, `tdd_goal`, `tdd_behavior`, `tdd_progress_push` and more
14
14
  - **Six framing prompts** — `triage`, `why-flaky`, `regression-since-pass`, `explain-failure`, `tdd-resume`, `wrapup`
15
- - **Idempotent writes** — `tdd_task` `start` / `end`, `tdd_goal` and `tdd_behavior` `create`, and `hypothesis` `validate` replay their stored result on a retry with the same derived key, through `@effected/mcp`'s `ToolReplay`; a replay carries `_idempotentReplay: true`
15
+ - **Idempotent writes** — `tdd_task` `start` / `end`, `tdd_goal` and `tdd_behavior` `create`, and `hypothesis` `validate` replay their stored result on a retry with the same derived key, through `@effected/mcp-kit`'s `ToolReplay`; a replay carries `_idempotentReplay: true`
16
16
  - **Strict tool inputs** — every served `inputSchema` is strict at every object level; an unknown key is rejected with an error naming every unrecognized key and the accepted params, instead of being stripped and running a wider query than the caller asked for
17
17
  - **Typed results** — every tool serves an object-rooted `outputSchema`, and every successful result carries the typed object in `structuredContent`
18
18
  - **Session-surviving error handling** — a handler that dies returns a generic `isError` result (the detail is logged on stderr, never on stdout, the JSON-RPC wire), and a stray unhandled rejection after the transport connects is logged rather than killing the server mid-session
19
- - **Programmatic API** — `ServerLayer({ version })` is the whole server as an Effect `Layer` over any `Stdio` implementation (the test harness runs it over in-memory queues); `Kit`, `toolHandlers`, `PromptsLayer` and `McpSession` are exported for embedding or extension. Built on [`@effected/mcp`](https://github.com/spencerbeggs/effected)'s `McpStdio` and `McpToolkit`
19
+ - **Programmatic API** — `ServerLayer({ version })` is the whole server as an Effect `Layer` over any `Stdio` implementation (the test harness runs it over in-memory queues); `Kit`, `toolHandlers`, `PromptsLayer` and `McpSession` are exported for embedding or extension. Built on [`@effected/mcp-kit`](https://github.com/spencerbeggs/effected)'s `McpStdio` and `McpToolkit`
20
20
  - **No MCP SDK, tRPC or zod** — the wire protocol, JSON Schema generation and input validation all come from `effect`; tool inputs and outputs are Effect `Schema` values end to end
21
21
 
22
22
  ## Install
package/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { ToolRefusal, ToolRefusal as ToolRefusal$1 } from "@effected/mcp";
2
- import { Context, Effect, Layer, Schema, Stdio } from "effect";
3
- import { DataReader, DataStore, ProjectDiscovery, SessionContext } from "@vitest-agent/engine";
1
+ import { ToolRefusal, ToolRefusal as ToolRefusal$1 } from "@effected/mcp-kit";
2
+ import { Context, Effect, Layer, Schema, Scope, Stdio } from "effect";
4
3
  import { McpServer, Tool, Toolkit } from "effect/ai";
4
+ import { DataReader, DataStore, ProjectDiscovery, SessionContext } from "@vitest-agent/engine";
5
5
  import "@effected/git";
6
- import "@effected/mcp/node";
6
+ import "@effected/mcp-kit/node";
7
7
  import "@vitest-agent/sdk";
8
- import { Remediation } from "@effected/engine";
8
+ import { Remediation } from "@effected/kit";
9
9
  /**
10
10
  * Formerly rendered a tool's encoded result as a markdown `content[0].text`
11
11
  * channel. The server no longer reads it: every successful result carries
@@ -115,12 +115,14 @@ export declare class McpSession extends McpSession_base {
115
115
  static readonly layerTest: (overrides: Pick<McpSessionOptions, "cwd"> & Partial<McpSessionOptions>) => Layer.Layer<McpSession>;
116
116
  }
117
117
  /**
118
- * Every framing prompt as one layer; merged into `ServerLayer` beside the
119
- * toolkit registration. Requires `McpSession` for `tdd-resume`'s default.
118
+ * Every framing prompt as one layer; merged into `ServerLayer`'s
119
+ * registrations beside the toolkit, so the transport supplies `McpServer`.
120
+ * Requires `McpSession` per request for
121
+ * `tdd-resume`'s default, met by the server's request-services middleware.
120
122
  *
121
123
  * @public
122
124
  */
123
- export declare const PromptsLayer: Layer.Layer<never, never, McpSession>;
125
+ export declare const PromptsLayer: Layer.Layer<never, never, McpServer.McpServer | McpServer.McpRequest<"Requires", McpSession>>;
124
126
  /**
125
127
  * The platform services the stdio transport needs.
126
128
  *
@@ -149,19 +151,20 @@ export declare const SERVER_INSTRUCTIONS: string;
149
151
  /**
150
152
  * The server layer: every tool registered through `McpToolkit.layer` (strict
151
153
  * by default, every unknown key named in one `InvalidParams`) plus the six
152
- * framing prompts, over `McpStdio.layer`.
154
+ * framing prompts, passed to `McpStdio.layer` as its `registrations` so they
155
+ * are built before the first request, with build-time logs on stderr.
153
156
  *
154
157
  * `McpStdio.layer` serves `McpStdio.protocols` — the stateless `2026-07-28`
155
158
  * adapter first, then `2025-11-25` and `2025-06-18` — provides
156
159
  * `LogToStderr` (stdout is the JSON-RPC wire) to everything it provides, and
157
160
  * answers a malformed stdin line itself instead of wedging core's decoder.
158
- * It is provided, not merged, so the output stays `never`; a test registers
159
- * extra tools beside it through the shared module-level `McpServer` registry.
161
+ * Its output is what `McpStdio.layer` returns: the `McpServer` it serves
162
+ * and the `Scope` request marker the transport discharges.
160
163
  *
161
164
  * @param options - the advertised server version
162
165
  * @public
163
166
  */
164
- export declare const ServerLayer: (options: ServerLayerOptions) => Layer.Layer<never, never, PlatformServices | McpSession | DataReader | DataStore | ProjectDiscovery>;
167
+ export declare const ServerLayer: (options: ServerLayerOptions) => Layer.Layer<McpServer.McpServer | McpServer.McpRequest<"Requires", Scope.Scope>, never, PlatformServices | McpSession | DataReader | DataStore | ProjectDiscovery>;
165
168
  /**
166
169
  * The `acceptance_metrics` tool's success payload.
167
170
  *
@@ -2855,7 +2858,7 @@ export declare const Kit: Toolkit.Toolkit<{
2855
2858
  readonly failure: import("effect/Schema").Never;
2856
2859
  readonly failureMode: "error";
2857
2860
  }, never>;
2858
- readonly hypothesis: import("@effected/mcp").UnionTool<"hypothesis", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
2861
+ readonly hypothesis: import("@effected/mcp-kit").UnionTool<"hypothesis", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
2859
2862
  readonly action: import("effect/Schema").Literal<"record">;
2860
2863
  readonly tddTaskId: import("effect/Schema").optionalKey<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>;
2861
2864
  readonly sessionId: import("effect/Schema").optionalKey<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>;
@@ -2892,8 +2895,8 @@ export declare const Kit: Toolkit.Toolkit<{
2892
2895
  readonly validationOutcome: import("effect/Schema").NullOr<import("effect/Schema").Literals<readonly ["confirmed", "refuted", "abandoned"]>>;
2893
2896
  readonly validatedAt: import("effect/Schema").NullOr<import("effect/Schema").String>;
2894
2897
  }>>;
2895
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore | McpSession>;
2896
- readonly inventory: import("@effected/mcp").UnionTool<"inventory", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
2898
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore | McpSession>;
2899
+ readonly inventory: import("@effected/mcp-kit").UnionTool<"inventory", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
2897
2900
  readonly kind: import("effect/Schema").Literal<"project">;
2898
2901
  }>, import("effect/Schema").Struct<{
2899
2902
  readonly kind: import("effect/Schema").Literal<"module">;
@@ -3007,8 +3010,8 @@ export declare const Kit: Toolkit.Toolkit<{
3007
3010
  readonly testCount: import("effect/Schema").Number;
3008
3011
  }>>;
3009
3012
  }>>;
3010
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader>;
3011
- readonly note: import("@effected/mcp").UnionTool<"note", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3013
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader>;
3014
+ readonly note: import("@effected/mcp-kit").UnionTool<"note", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3012
3015
  readonly action: import("effect/Schema").Literal<"create">;
3013
3016
  readonly title: import("effect/Schema").String;
3014
3017
  readonly content: import("effect/Schema").String;
@@ -3109,7 +3112,7 @@ export declare const Kit: Toolkit.Toolkit<{
3109
3112
  readonly createdAt: import("effect/Schema").String;
3110
3113
  readonly updatedAt: import("effect/Schema").String;
3111
3114
  }>>;
3112
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3115
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3113
3116
  readonly ping: import("effect/ai/Tool").Tool<"ping", {
3114
3117
  readonly parameters: import("effect/ai/Tool").EmptyParams;
3115
3118
  readonly success: import("effect/Schema").Struct<{
@@ -3472,7 +3475,7 @@ export declare const Kit: Toolkit.Toolkit<{
3472
3475
  readonly failure: import("effect/Schema").Never;
3473
3476
  readonly failureMode: "error";
3474
3477
  }, import("@vitest-agent/engine").DataReader>;
3475
- readonly tdd_behavior: import("@effected/mcp").UnionTool<"tdd_behavior", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3478
+ readonly tdd_behavior: import("@effected/mcp-kit").UnionTool<"tdd_behavior", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3476
3479
  readonly action: import("effect/Schema").Literal<"create">;
3477
3480
  readonly goalId: import("effect/Schema").Finite;
3478
3481
  readonly behavior: import("effect/Schema").String;
@@ -3649,8 +3652,8 @@ export declare const Kit: Toolkit.Toolkit<{
3649
3652
  readonly to: import("effect/Schema").String;
3650
3653
  readonly reason: import("effect/Schema").String;
3651
3654
  }>]>;
3652
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3653
- readonly tdd_goal: import("@effected/mcp").UnionTool<"tdd_goal", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3655
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3656
+ readonly tdd_goal: import("@effected/mcp-kit").UnionTool<"tdd_goal", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3654
3657
  readonly action: import("effect/Schema").Literal<"create">;
3655
3658
  readonly tddTaskId: import("effect/Schema").Finite;
3656
3659
  readonly goal: import("effect/Schema").String;
@@ -3807,7 +3810,7 @@ export declare const Kit: Toolkit.Toolkit<{
3807
3810
  readonly to: import("effect/Schema").String;
3808
3811
  readonly reason: import("effect/Schema").String;
3809
3812
  }>]>;
3810
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3813
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3811
3814
  readonly tdd_phase_transition_request: import("effect/ai/Tool").Tool<"tdd_phase_transition_request", {
3812
3815
  readonly parameters: import("effect/Schema").Struct<{
3813
3816
  readonly tddTaskId: import("effect/Schema").Finite;
@@ -3848,7 +3851,7 @@ export declare const Kit: Toolkit.Toolkit<{
3848
3851
  readonly failure: import("effect/Schema").Never;
3849
3852
  readonly failureMode: "error";
3850
3853
  }, import("@vitest-agent/engine").DataReader | import("effect/ai/McpServer").McpServer>;
3851
- readonly tdd_task: import("@effected/mcp").UnionTool<"tdd_task", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3854
+ readonly tdd_task: import("@effected/mcp-kit").UnionTool<"tdd_task", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3852
3855
  readonly action: import("effect/Schema").Literal<"start">;
3853
3856
  readonly goal: import("effect/Schema").String;
3854
3857
  readonly sessionId: import("effect/Schema").optionalKey<import("effect/Schema").Finite>;
@@ -3951,8 +3954,8 @@ export declare const Kit: Toolkit.Toolkit<{
3951
3954
  readonly action: import("effect/Schema").Literal<"resume">;
3952
3955
  readonly found: import("effect/Schema").Literal<false>;
3953
3956
  readonly tddTaskId: import("effect/Schema").Number;
3954
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3955
- readonly test: import("@effected/mcp").UnionTool<"test", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3957
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
3958
+ readonly test: import("@effected/mcp-kit").UnionTool<"test", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
3956
3959
  readonly action: import("effect/Schema").Literal<"list">;
3957
3960
  readonly project: import("effect/Schema").optionalKey<import("effect/Schema").String>;
3958
3961
  readonly state: import("effect/Schema").optionalKey<import("effect/Schema").String>;
@@ -4090,7 +4093,7 @@ export declare const Kit: Toolkit.Toolkit<{
4090
4093
  readonly bodyEncoding: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["base64", "utf-8"]>>;
4091
4094
  }>>;
4092
4095
  }>>;
4093
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader>;
4096
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader>;
4094
4097
  readonly test_coverage: import("effect/ai/Tool").Tool<"test_coverage", {
4095
4098
  readonly parameters: import("effect/Schema").Struct<{
4096
4099
  readonly project: import("effect/Schema").optionalKey<import("effect/Schema").String>;
@@ -4452,14 +4455,16 @@ export declare const Kit: Toolkit.Toolkit<{
4452
4455
  }, import("@vitest-agent/engine").DataReader>;
4453
4456
  }>;
4454
4457
  /**
4455
- * The handler for each tool in {@link Kit}, keyed by tool name. The seven
4456
- * action-keyed tools are `Tool.dynamic` (a union root cannot be a `Tool.make`
4457
- * parameters schema), so their handlers take the raw payload and decode it
4458
- * through `McpToolkit.unionHandler`.
4458
+ * Builds the handler for each tool in {@link Kit}: reads `DataReader` /
4459
+ * `DataStore` once into the idempotent-replay store and wraps the write
4460
+ * tools once over it (`@effected/mcp-kit`'s `ToolReplay` guidance for a server:
4461
+ * read the store when the handlers are built, never per call). Both services
4462
+ * are fixed for the life of the server, the same instances the server's
4463
+ * request middleware provides to each call.
4459
4464
  *
4460
4465
  * @public
4461
4466
  */
4462
- export declare const toolHandlers: {
4467
+ export declare const toolHandlers: Effect.Effect<{
4463
4468
  ping: typeof handlePing;
4464
4469
  help: typeof handleHelp;
4465
4470
  test_status: typeof handleTestStatus;
@@ -4478,7 +4483,7 @@ export declare const toolHandlers: {
4478
4483
  acceptance_metrics: typeof handleAcceptanceMetrics;
4479
4484
  triage_brief: typeof handleTriageBrief;
4480
4485
  wrapup_prompt: typeof handleWrapupPrompt;
4481
- inventory: (payload: unknown) => import("effect/Effect").Effect<{
4486
+ inventory: (payload: unknown) => Effect.Effect<{
4482
4487
  readonly inventoryKind: "project";
4483
4488
  readonly count: number;
4484
4489
  readonly projects: readonly {
@@ -4575,7 +4580,7 @@ export declare const toolHandlers: {
4575
4580
  }[];
4576
4581
  }[];
4577
4582
  }, import("effect/ai/McpSchema").InvalidParams, import("@vitest-agent/engine").DataReader>;
4578
- test: (payload: unknown) => import("effect/Effect").Effect<{
4583
+ test: (payload: unknown) => Effect.Effect<{
4579
4584
  readonly action: "list";
4580
4585
  readonly count: number;
4581
4586
  readonly groups: readonly {
@@ -4685,7 +4690,7 @@ export declare const toolHandlers: {
4685
4690
  readonly candidateModules?: readonly string[] | undefined;
4686
4691
  }, import("effect/ai/McpSchema").InvalidParams, import("@vitest-agent/engine").DataReader>;
4687
4692
  register_agent: typeof handleRegisterAgent;
4688
- note: (payload: unknown) => import("effect/Effect").Effect<{
4693
+ note: (payload: unknown) => Effect.Effect<{
4689
4694
  readonly action: "create";
4690
4695
  readonly id: number;
4691
4696
  } | {
@@ -4754,7 +4759,7 @@ export declare const toolHandlers: {
4754
4759
  readonly updatedAt: string;
4755
4760
  }[];
4756
4761
  }, import("effect/ai/McpSchema").InvalidParams, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
4757
- hypothesis: (payload: unknown) => import("effect/Effect").Effect<{
4762
+ hypothesis: (payload: unknown) => Effect.Effect<{
4758
4763
  readonly action: "record";
4759
4764
  readonly id: number;
4760
4765
  } | {
@@ -4772,8 +4777,8 @@ export declare const toolHandlers: {
4772
4777
  } | {
4773
4778
  readonly _idempotentReplay?: true;
4774
4779
  readonly action: "validate";
4775
- }, import("effect/ai/McpSchema").InvalidParams | import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore | McpSession>;
4776
- tdd_task: (payload: unknown) => import("effect/Effect").Effect<{
4780
+ }, import("effect/ai/McpSchema").InvalidParams | import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore | McpSession>;
4781
+ tdd_task: (payload: unknown) => Effect.Effect<{
4777
4782
  readonly action: "get";
4778
4783
  readonly found: true;
4779
4784
  readonly task: {
@@ -4857,9 +4862,9 @@ export declare const toolHandlers: {
4857
4862
  readonly action: "end";
4858
4863
  readonly tddTaskId: number;
4859
4864
  readonly outcome: "abandoned" | "blocked" | "succeeded";
4860
- }, import("effect/ai/McpSchema").InvalidParams | import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
4865
+ }, import("effect/ai/McpSchema").InvalidParams | import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
4861
4866
  tdd_phase_transition_request: typeof handlePhaseTransitionRequest;
4862
- tdd_goal: (payload: unknown) => import("effect/Effect").Effect<{
4867
+ tdd_goal: (payload: unknown) => Effect.Effect<{
4863
4868
  readonly ok: false;
4864
4869
  readonly error: {
4865
4870
  readonly message: string;
@@ -4999,7 +5004,7 @@ export declare const toolHandlers: {
4999
5004
  readonly createdAt: string;
5000
5005
  };
5001
5006
  }, import("effect/ai/McpSchema").InvalidParams, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
5002
- tdd_behavior: (payload: unknown) => import("effect/Effect").Effect<{
5007
+ tdd_behavior: (payload: unknown) => Effect.Effect<{
5003
5008
  readonly ok: false;
5004
5009
  readonly error: {
5005
5010
  readonly message: string;
@@ -5155,9 +5160,10 @@ export declare const toolHandlers: {
5155
5160
  tdd_artifact_list: typeof handleTddArtifactList;
5156
5161
  tdd_progress_push: typeof handleTddProgressPush;
5157
5162
  run_tests: typeof handleRunTests;
5158
- };
5163
+ }, never, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
5159
5164
  /**
5160
- * The handlers layer: provides `Tool.HandlersFor<typeof Kit.tools>`.
5165
+ * The handlers layer: provides `Tool.HandlersFor<typeof Kit.tools>`, built
5166
+ * from {@link toolHandlers}, so it requires `DataReader` / `DataStore`.
5161
5167
  *
5162
5168
  * @public
5163
5169
  */
@@ -5339,7 +5345,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
5339
5345
  readonly failure: import("effect/Schema").Never;
5340
5346
  readonly failureMode: "error";
5341
5347
  }, never>;
5342
- readonly hypothesis: import("@effected/mcp").UnionTool<"hypothesis", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5348
+ readonly hypothesis: import("@effected/mcp-kit").UnionTool<"hypothesis", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5343
5349
  readonly action: import("effect/Schema").Literal<"record">;
5344
5350
  readonly tddTaskId: import("effect/Schema").optionalKey<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>;
5345
5351
  readonly sessionId: import("effect/Schema").optionalKey<import("effect/Schema").Union<readonly [import("effect/Schema").Finite, import("effect/Schema").FiniteFromString]>>;
@@ -5376,8 +5382,8 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
5376
5382
  readonly validationOutcome: import("effect/Schema").NullOr<import("effect/Schema").Literals<readonly ["confirmed", "refuted", "abandoned"]>>;
5377
5383
  readonly validatedAt: import("effect/Schema").NullOr<import("effect/Schema").String>;
5378
5384
  }>>;
5379
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore | McpSession>;
5380
- readonly inventory: import("@effected/mcp").UnionTool<"inventory", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5385
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore | McpSession>;
5386
+ readonly inventory: import("@effected/mcp-kit").UnionTool<"inventory", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5381
5387
  readonly kind: import("effect/Schema").Literal<"project">;
5382
5388
  }>, import("effect/Schema").Struct<{
5383
5389
  readonly kind: import("effect/Schema").Literal<"module">;
@@ -5491,8 +5497,8 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
5491
5497
  readonly testCount: import("effect/Schema").Number;
5492
5498
  }>>;
5493
5499
  }>>;
5494
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader>;
5495
- readonly note: import("@effected/mcp").UnionTool<"note", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5500
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader>;
5501
+ readonly note: import("@effected/mcp-kit").UnionTool<"note", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5496
5502
  readonly action: import("effect/Schema").Literal<"create">;
5497
5503
  readonly title: import("effect/Schema").String;
5498
5504
  readonly content: import("effect/Schema").String;
@@ -5593,7 +5599,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
5593
5599
  readonly createdAt: import("effect/Schema").String;
5594
5600
  readonly updatedAt: import("effect/Schema").String;
5595
5601
  }>>;
5596
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
5602
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
5597
5603
  readonly ping: import("effect/ai/Tool").Tool<"ping", {
5598
5604
  readonly parameters: import("effect/ai/Tool").EmptyParams;
5599
5605
  readonly success: import("effect/Schema").Struct<{
@@ -5956,7 +5962,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
5956
5962
  readonly failure: import("effect/Schema").Never;
5957
5963
  readonly failureMode: "error";
5958
5964
  }, import("@vitest-agent/engine").DataReader>;
5959
- readonly tdd_behavior: import("@effected/mcp").UnionTool<"tdd_behavior", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5965
+ readonly tdd_behavior: import("@effected/mcp-kit").UnionTool<"tdd_behavior", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
5960
5966
  readonly action: import("effect/Schema").Literal<"create">;
5961
5967
  readonly goalId: import("effect/Schema").Finite;
5962
5968
  readonly behavior: import("effect/Schema").String;
@@ -6133,8 +6139,8 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
6133
6139
  readonly to: import("effect/Schema").String;
6134
6140
  readonly reason: import("effect/Schema").String;
6135
6141
  }>]>;
6136
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6137
- readonly tdd_goal: import("@effected/mcp").UnionTool<"tdd_goal", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
6142
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6143
+ readonly tdd_goal: import("@effected/mcp-kit").UnionTool<"tdd_goal", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
6138
6144
  readonly action: import("effect/Schema").Literal<"create">;
6139
6145
  readonly tddTaskId: import("effect/Schema").Finite;
6140
6146
  readonly goal: import("effect/Schema").String;
@@ -6291,7 +6297,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
6291
6297
  readonly to: import("effect/Schema").String;
6292
6298
  readonly reason: import("effect/Schema").String;
6293
6299
  }>]>;
6294
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6300
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6295
6301
  readonly tdd_phase_transition_request: import("effect/ai/Tool").Tool<"tdd_phase_transition_request", {
6296
6302
  readonly parameters: import("effect/Schema").Struct<{
6297
6303
  readonly tddTaskId: import("effect/Schema").Finite;
@@ -6332,7 +6338,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
6332
6338
  readonly failure: import("effect/Schema").Never;
6333
6339
  readonly failureMode: "error";
6334
6340
  }, import("@vitest-agent/engine").DataReader | import("effect/ai/McpServer").McpServer>;
6335
- readonly tdd_task: import("@effected/mcp").UnionTool<"tdd_task", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
6341
+ readonly tdd_task: import("@effected/mcp-kit").UnionTool<"tdd_task", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
6336
6342
  readonly action: import("effect/Schema").Literal<"start">;
6337
6343
  readonly goal: import("effect/Schema").String;
6338
6344
  readonly sessionId: import("effect/Schema").optionalKey<import("effect/Schema").Finite>;
@@ -6435,8 +6441,8 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
6435
6441
  readonly action: import("effect/Schema").Literal<"resume">;
6436
6442
  readonly found: import("effect/Schema").Literal<false>;
6437
6443
  readonly tddTaskId: import("effect/Schema").Number;
6438
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6439
- readonly test: import("@effected/mcp").UnionTool<"test", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
6444
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6445
+ readonly test: import("@effected/mcp-kit").UnionTool<"test", import("effect/Schema").Union<readonly [import("effect/Schema").Struct<{
6440
6446
  readonly action: import("effect/Schema").Literal<"list">;
6441
6447
  readonly project: import("effect/Schema").optionalKey<import("effect/Schema").String>;
6442
6448
  readonly state: import("effect/Schema").optionalKey<import("effect/Schema").String>;
@@ -6574,7 +6580,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
6574
6580
  readonly bodyEncoding: import("effect/Schema").optional<import("effect/Schema").Literals<readonly ["base64", "utf-8"]>>;
6575
6581
  }>>;
6576
6582
  }>>;
6577
- }>]>, typeof import("@effected/mcp").ToolRefusal, import("@vitest-agent/engine").DataReader>;
6583
+ }>]>, typeof import("@effected/mcp-kit").ToolRefusal, import("@vitest-agent/engine").DataReader>;
6578
6584
  readonly test_coverage: import("effect/ai/Tool").Tool<"test_coverage", {
6579
6585
  readonly parameters: import("effect/Schema").Struct<{
6580
6586
  readonly project: import("effect/Schema").optionalKey<import("effect/Schema").String>;
@@ -6934,7 +6940,7 @@ export declare const ToolsLayer: import("effect/Layer").Layer<import("effect/ai/
6934
6940
  readonly failure: import("effect/Schema").Never;
6935
6941
  readonly failureMode: "error";
6936
6942
  }, import("@vitest-agent/engine").DataReader>;
6937
- }>, never, never>;
6943
+ }>, never, import("@vitest-agent/engine").DataReader | import("@vitest-agent/engine").DataStore>;
6938
6944
  /**
6939
6945
  * Success-shaped envelope returned by TDD CRUD tools when a known TDD error occurs.
6940
6946
  *
@@ -7030,7 +7036,7 @@ export declare const handleHypothesis: (input: HypothesisInputType) => Effect.Ef
7030
7036
  *
7031
7037
  * @public
7032
7038
  */
7033
- export declare const hypothesisTool: import("@effected/mcp").UnionTool<"hypothesis", Schema.Union<readonly [Schema.Struct<{
7039
+ export declare const hypothesisTool: import("@effected/mcp-kit").UnionTool<"hypothesis", Schema.Union<readonly [Schema.Struct<{
7034
7040
  readonly action: Schema.Literal<"record">;
7035
7041
  readonly tddTaskId: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>;
7036
7042
  readonly sessionId: Schema.optionalKey<Schema.Union<readonly [Schema.Finite, Schema.FiniteFromString]>>;
@@ -7219,7 +7225,7 @@ export declare const handleInventory: (input: InventoryInputType) => Effect.Effe
7219
7225
  *
7220
7226
  * @public
7221
7227
  */
7222
- export declare const inventoryTool: import("@effected/mcp").UnionTool<"inventory", Schema.Union<readonly [Schema.Struct<{
7228
+ export declare const inventoryTool: import("@effected/mcp-kit").UnionTool<"inventory", Schema.Union<readonly [Schema.Struct<{
7223
7229
  readonly kind: Schema.Literal<"project">;
7224
7230
  }>, Schema.Struct<{
7225
7231
  readonly kind: Schema.Literal<"module">;
@@ -7470,7 +7476,7 @@ export declare const handleNote: (input: NoteParamsType) => Effect.Effect<NoteRe
7470
7476
  *
7471
7477
  * @public
7472
7478
  */
7473
- export declare const noteTool: import("@effected/mcp").UnionTool<"note", Schema.Union<readonly [Schema.Struct<{
7479
+ export declare const noteTool: import("@effected/mcp-kit").UnionTool<"note", Schema.Union<readonly [Schema.Struct<{
7474
7480
  readonly action: Schema.Literal<"create">;
7475
7481
  readonly title: Schema.String;
7476
7482
  readonly content: Schema.String;
@@ -7785,7 +7791,7 @@ export declare const handleTddBehavior: (input: TddBehaviorInputType) => Effect.
7785
7791
  *
7786
7792
  * @public
7787
7793
  */
7788
- export declare const tddBehaviorTool: import("@effected/mcp").UnionTool<"tdd_behavior", Schema.Union<readonly [Schema.Struct<{
7794
+ export declare const tddBehaviorTool: import("@effected/mcp-kit").UnionTool<"tdd_behavior", Schema.Union<readonly [Schema.Struct<{
7789
7795
  readonly action: Schema.Literal<"create">;
7790
7796
  readonly goalId: Schema.Finite;
7791
7797
  readonly behavior: Schema.String;
@@ -8156,7 +8162,7 @@ export declare const handleTddGoal: (input: TddGoalInputType) => Effect.Effect<T
8156
8162
  *
8157
8163
  * @public
8158
8164
  */
8159
- export declare const tddGoalTool: import("@effected/mcp").UnionTool<"tdd_goal", Schema.Union<readonly [Schema.Struct<{
8165
+ export declare const tddGoalTool: import("@effected/mcp-kit").UnionTool<"tdd_goal", Schema.Union<readonly [Schema.Struct<{
8160
8166
  readonly action: Schema.Literal<"create">;
8161
8167
  readonly tddTaskId: Schema.Finite;
8162
8168
  readonly goal: Schema.String;
@@ -8455,7 +8461,7 @@ export declare const handleTddTask: (input: TddTaskInputType) => Effect.Effect<T
8455
8461
  *
8456
8462
  * @public
8457
8463
  */
8458
- export declare const tddTaskTool: import("@effected/mcp").UnionTool<"tdd_task", Schema.Union<readonly [Schema.Struct<{
8464
+ export declare const tddTaskTool: import("@effected/mcp-kit").UnionTool<"tdd_task", Schema.Union<readonly [Schema.Struct<{
8459
8465
  readonly action: Schema.Literal<"start">;
8460
8466
  readonly goal: Schema.String;
8461
8467
  readonly sessionId: Schema.optionalKey<Schema.Finite>;
@@ -8745,7 +8751,7 @@ export declare const handleTest: (input: TestInputType) => Effect.Effect<TestRes
8745
8751
  *
8746
8752
  * @public
8747
8753
  */
8748
- export declare const testTool: import("@effected/mcp").UnionTool<"test", Schema.Union<readonly [Schema.Struct<{
8754
+ export declare const testTool: import("@effected/mcp-kit").UnionTool<"test", Schema.Union<readonly [Schema.Struct<{
8749
8755
  readonly action: Schema.Literal<"list">;
8750
8756
  readonly project: Schema.optionalKey<Schema.String>;
8751
8757
  readonly state: Schema.optionalKey<Schema.String>;
package/index.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { RenderText } from "./annotations.js";
2
- import { McpSession, createCurrentSessionIdRef, createSessionContextRef, sessionContextFromEnv } from "./session.js";
3
2
  import { PromptsLayer } from "./prompts/layer.js";
3
+ import { SERVER_INSTRUCTIONS, ServerLayer } from "./server.js";
4
+ import { McpSession, createCurrentSessionIdRef, createSessionContextRef, sessionContextFromEnv } from "./session.js";
5
+ import { Kit, ToolsLayer, toolHandlers } from "./toolkit.js";
4
6
  import { AcceptanceMetricsResult, acceptanceMetricsTool, handleAcceptanceMetrics } from "./tools/acceptance-metrics.js";
5
7
  import { CacheHealthResult, cacheHealthTool, handleCacheHealth } from "./tools/cache-health.js";
6
8
  import { CommitChangesInput, CommitChangesResult, commitChangesTool, handleCommitChanges } from "./tools/commit-changes.js";
@@ -31,9 +33,7 @@ import { TestTrendsInput, TestTrendsResult, handleTestTrends, testTrendsTool } f
31
33
  import { TriageBriefInput, TriageBriefResult, handleTriageBrief, triageBriefTool } from "./tools/triage-brief.js";
32
34
  import { TurnSearchInput, TurnSearchResult, handleTurnSearch, turnSearchTool } from "./tools/turn-search.js";
33
35
  import { WrapupPromptInput, WrapupPromptResult, handleWrapupPrompt, wrapupPromptTool } from "./tools/wrapup-prompt.js";
34
- import { Kit, ToolsLayer, toolHandlers } from "./toolkit.js";
35
- import { SERVER_INSTRUCTIONS, ServerLayer } from "./server.js";
36
36
  import { CURRENT_MCP_VERSION } from "./version.js";
37
- import { ToolRefusal } from "@effected/mcp";
37
+ import { ToolRefusal } from "@effected/mcp-kit";
38
38
 
39
39
  export { AcceptanceMetricsResult, CURRENT_MCP_VERSION, CacheHealthResult, CommitChangesInput, CommitChangesResult, ConfigureInput, ConfigureResult, FailureSignatureGetInput, FailureSignatureGetResult, FileCoverageInput, FileCoverageResult, HelpResult, HypothesisInput, HypothesisResult, InventoryInput, InventoryResult, Kit, McpSession, NoteParams, NoteResult, PhaseTransitionInput, PhaseTransitionResult, PingResult, PromptsLayer, RegisterAgentInput, RegisterAgentResult, RenderText, RunTestsInput, RunTestsResult, SERVER_INSTRUCTIONS, ServerLayer, SettingsListResult, TddArtifactListInput, TddArtifactListResult, TddBehaviorInput, TddBehaviorResult, TddGoalInput, TddGoalResult, TddProgressPushInput, TddProgressPushResult, TddTaskInput, TddTaskResult, TestCoverageInput, TestCoverageResult, TestErrorsInput, TestErrorsResult, TestHistoryInput, TestHistoryResult, TestInput, TestOverviewInput, TestOverviewResult, TestResult, TestStatusInput, TestStatusResult, TestTrendsInput, TestTrendsResult, ToolRefusal, ToolsLayer, TriageBriefInput, TriageBriefResult, TurnSearchInput, TurnSearchResult, WrapupPromptInput, WrapupPromptResult, acceptanceMetricsTool, cacheHealthTool, commitChangesTool, configureTool, createCurrentSessionIdRef, createSessionContextRef, failureSignatureGetTool, fileCoverageTool, handleAcceptanceMetrics, handleCacheHealth, handleCommitChanges, handleConfigure, handleFailureSignatureGet, handleFileCoverage, handleHelp, handleHypothesis, handleInventory, handleNote, handlePhaseTransitionRequest, handlePing, handleRegisterAgent, handleRunTests, handleSettingsList, handleTddArtifactList, handleTddBehavior, handleTddGoal, handleTddProgressPush, handleTddTask, handleTest, handleTestCoverage, handleTestErrors, handleTestHistory, handleTestOverview, handleTestStatus, handleTestTrends, handleTriageBrief, handleTurnSearch, handleWrapupPrompt, helpTool, hypothesisTool, inventoryTool, noteTool, pingTool, registerAgentTool, runTestsTool, sessionContextFromEnv, settingsListTool, tddArtifactListTool, tddBehaviorTool, tddGoalTool, tddPhaseTransitionRequestTool, tddProgressPushTool, tddTaskTool, testCoverageTool, testErrorsTool, testHistoryTool, testOverviewTool, testStatusTool, testTool, testTrendsTool, toolHandlers, triageBriefTool, turnSearchTool, wrapupPromptTool };
package/main.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Distribution } from "@effected/engine";
1
+ import { Distribution } from "@effected/kit";
2
2
  /**
3
3
  * Options for {@link main}.
4
4
  *
package/main.js CHANGED
@@ -1,4 +1,4 @@
1
- import { McpGuard } from "@effected/mcp/guard";
1
+ import { McpGuard } from "@effected/mcp-kit/guard";
2
2
 
3
3
  // src/main.ts
4
4
  /**
@@ -27,8 +27,8 @@ const main = (options = {}) => McpGuard.run({
27
27
  const NodeServices = await import("@effect/platform-node/NodeServices");
28
28
  const NodeStdio = await import("@effect/platform-node/NodeStdio");
29
29
  const { Effect, Layer, Option } = await import("effect");
30
- const { CurrentDistribution, LaunchContext } = await import("@effected/engine");
31
- const { StdioCapture } = await import("@effected/mcp/node");
30
+ const { CurrentDistribution, LaunchContext } = await import("@effected/kit");
31
+ const { StdioCapture } = await import("@effected/mcp-kit/node");
32
32
  const { PathResolutionLive, PlatformLive, recoverSessionContextFromSessionEnv, resolveDataPath, resolveLogFile, resolveLogLevel, resolveProjectDir } = await import("@vitest-agent/engine");
33
33
  const { McpSession, sessionContextFromEnv } = await import("./session.js");
34
34
  const { ServerLayer } = await import("./server.js");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitest-agent/mcp",
3
- "version": "6.0.1",
3
+ "version": "6.1.1",
4
4
  "private": false,
5
5
  "description": "Model Context Protocol server for vitest-agent. Exposes 30 tools for agent access to test data, TDD lifecycle, and session management.",
6
6
  "keywords": [
@@ -43,16 +43,16 @@
43
43
  "vitest-agent-mcp": "bin/vitest-agent-mcp.js"
44
44
  },
45
45
  "dependencies": {
46
- "@effect/platform-node": "^4.0.7",
47
- "@effected/commands": "^0.18.0",
48
- "@effected/engine": "^0.10.0",
49
- "@effected/git": "^0.27.0",
50
- "@effected/glob": "^0.16.0",
51
- "@effected/mcp": "^0.11.0",
52
- "@effected/walker": "^0.22.0",
53
- "@vitest-agent/engine": "3.0.1",
54
- "@vitest-agent/sdk": "9.0.1",
55
- "effect": "^4.0.7"
46
+ "@effect/platform-node": "~4.1.2",
47
+ "@effected/commands": "^0.20.0",
48
+ "@effected/git": "^0.30.0",
49
+ "@effected/glob": "^0.18.0",
50
+ "@effected/kit": "^0.12.0",
51
+ "@effected/mcp-kit": "^0.13.0",
52
+ "@effected/walker": "^0.25.0",
53
+ "@vitest-agent/engine": "3.1.1",
54
+ "@vitest-agent/sdk": "9.0.3",
55
+ "effect": "~4.1.2"
56
56
  },
57
57
  "peerDependencies": {
58
58
  "vitest": "^5.0.0"
package/prompts/layer.js CHANGED
@@ -103,8 +103,10 @@ const Wrapup = McpServer.prompt({
103
103
  }
104
104
  });
105
105
  /**
106
- * Every framing prompt as one layer; merged into `ServerLayer` beside the
107
- * toolkit registration. Requires `McpSession` for `tdd-resume`'s default.
106
+ * Every framing prompt as one layer; merged into `ServerLayer`'s
107
+ * registrations beside the toolkit, so the transport supplies `McpServer`.
108
+ * Requires `McpSession` per request for
109
+ * `tdd-resume`'s default, met by the server's request-services middleware.
108
110
  *
109
111
  * @public
110
112
  */
package/replay.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ToolReplay } from "@effected/mcp";
1
+ import { ToolReplay } from "@effected/mcp-kit";
2
2
  import { Effect, Option } from "effect";
3
3
  import { DataReader, DataStore } from "@vitest-agent/engine";
4
4
 
@@ -79,15 +79,19 @@ const makeReplayStore = Effect.gen(function* () {
79
79
  };
80
80
  });
81
81
  /**
82
- * `ToolReplay.wrap` for one write tool, with the replay store built from the
83
- * handler's own `DataReader` / `DataStore`, so the wrapped handler requires
84
- * exactly what the bare one did.
82
+ * `ToolReplay.wrap` for one write tool over an already-built `store`: the
83
+ * production form. `toolHandlers` reads `DataReader` / `DataStore` once when
84
+ * the handlers layer is built ({@link makeReplayStore}) and wraps each write
85
+ * tool once here, so the replay codec is derived once and `wrap`'s wiring
86
+ * check (a `:` in the tool name) fails the server build instead of the first
87
+ * call. With the store supplied, the wrapped handler requires exactly what
88
+ * the bare one did.
85
89
  *
86
90
  * @internal
87
91
  */
88
- const replayed = (options) => (handler) => (params) => Effect.flatMap(makeReplayStore, (store) => ToolReplay.wrap({
92
+ const replayWith = (store) => (options) => (handler) => ToolReplay.wrap({
89
93
  ...options,
90
94
  store
91
- })(handler)(params));
95
+ })(handler);
92
96
 
93
- export { hypothesisReplayKey, makeReplayStore, replayed, tddBehaviorReplayKey, tddGoalReplayKey, tddTaskReplayKey };
97
+ export { hypothesisReplayKey, makeReplayStore, replayWith, tddBehaviorReplayKey, tddGoalReplayKey, tddTaskReplayKey };
package/server.js CHANGED
@@ -1,7 +1,8 @@
1
1
  import { PromptsLayer } from "./prompts/layer.js";
2
2
  import { Kit, ToolsLayer } from "./toolkit.js";
3
- import { McpStdio, McpToolkit } from "@effected/mcp";
4
- import { Layer } from "effect";
3
+ import { McpStdio, McpToolkit } from "@effected/mcp-kit";
4
+ import { Effect, Layer } from "effect";
5
+ import { McpServer } from "effect/ai";
5
6
 
6
7
  // src/server.ts
7
8
  /** One-line human summary agents see on `serverInfo.description`. */
@@ -24,25 +25,40 @@ const SERVER_INSTRUCTIONS = [
24
25
  "An isError result means the call itself failed and carries no structuredContent. Its text either names what to fix (invalid params, or a refused call such as an unknown id, often ending 'Try <tool>.' with the tool to call next) or is a generic internal-error message (the server logged the detail). Fix the call, or report the internal failure rather than retrying it unchanged."
25
26
  ].join("\n");
26
27
  /**
28
+ * Meets every registration's request-level dependencies. A tool's declared
29
+ * `dependencies` (and a prompt's services) are per-request
30
+ * `McpServer.McpRequest<"Requires", S>` requirements that only MCP middleware
31
+ * discharges; every one of ours is fixed for the life of the server, so the
32
+ * middleware reads them once when it is built and provides the same context
33
+ * to every request. `McpServer` itself is read from the transport, for
34
+ * `tdd_progress_push`'s `notifications/message` frame.
35
+ */
36
+ const RequestServices = McpServer.middleware()(Effect.gen(function* () {
37
+ const context = yield* Effect.context();
38
+ return (effect) => Effect.provideContext(effect, context);
39
+ }));
40
+ /**
27
41
  * The server layer: every tool registered through `McpToolkit.layer` (strict
28
42
  * by default, every unknown key named in one `InvalidParams`) plus the six
29
- * framing prompts, over `McpStdio.layer`.
43
+ * framing prompts, passed to `McpStdio.layer` as its `registrations` so they
44
+ * are built before the first request, with build-time logs on stderr.
30
45
  *
31
46
  * `McpStdio.layer` serves `McpStdio.protocols` — the stateless `2026-07-28`
32
47
  * adapter first, then `2025-11-25` and `2025-06-18` — provides
33
48
  * `LogToStderr` (stdout is the JSON-RPC wire) to everything it provides, and
34
49
  * answers a malformed stdin line itself instead of wedging core's decoder.
35
- * It is provided, not merged, so the output stays `never`; a test registers
36
- * extra tools beside it through the shared module-level `McpServer` registry.
50
+ * Its output is what `McpStdio.layer` returns: the `McpServer` it serves
51
+ * and the `Scope` request marker the transport discharges.
37
52
  *
38
53
  * @param options - the advertised server version
39
54
  * @public
40
55
  */
41
- const ServerLayer = (options) => Layer.mergeAll(McpToolkit.layer(Kit).pipe(Layer.provide(ToolsLayer)), PromptsLayer).pipe(Layer.provide(McpStdio.layer({
56
+ const ServerLayer = (options) => McpStdio.layer({
42
57
  name: "vitest-agent",
43
58
  version: options.version,
44
59
  description: DESCRIPTION,
45
- instructions: SERVER_INSTRUCTIONS
46
- })));
60
+ instructions: SERVER_INSTRUCTIONS,
61
+ registrations: Layer.mergeAll(McpToolkit.layer(Kit).pipe(Layer.provide(ToolsLayer)), PromptsLayer).pipe(Layer.provide(RequestServices.layer))
62
+ });
47
63
 
48
64
  export { SERVER_INSTRUCTIONS, ServerLayer };
package/toolkit.js CHANGED
@@ -1,4 +1,4 @@
1
- import { hypothesisReplayKey, replayed, tddBehaviorReplayKey, tddGoalReplayKey, tddTaskReplayKey } from "./replay.js";
1
+ import { hypothesisReplayKey, makeReplayStore, replayWith, tddBehaviorReplayKey, tddGoalReplayKey, tddTaskReplayKey } from "./replay.js";
2
2
  import { acceptanceMetricsTool, handleAcceptanceMetrics } from "./tools/acceptance-metrics.js";
3
3
  import { cacheHealthTool, handleCacheHealth } from "./tools/cache-health.js";
4
4
  import { commitChangesTool, handleCommitChanges } from "./tools/commit-changes.js";
@@ -29,7 +29,8 @@ import { handleTestTrends, testTrendsTool } from "./tools/trends.js";
29
29
  import { handleTriageBrief, triageBriefTool } from "./tools/triage-brief.js";
30
30
  import { handleTurnSearch, turnSearchTool } from "./tools/turn-search.js";
31
31
  import { handleWrapupPrompt, wrapupPromptTool } from "./tools/wrapup-prompt.js";
32
- import { McpToolkit } from "@effected/mcp";
32
+ import { McpToolkit } from "@effected/mcp-kit";
33
+ import { Effect } from "effect";
33
34
  import { Toolkit } from "effect/ai";
34
35
 
35
36
  // src/toolkit.ts
@@ -40,66 +41,82 @@ import { Toolkit } from "effect/ai";
40
41
  */
41
42
  const Kit = Toolkit.make(pingTool, helpTool, testStatusTool, testOverviewTool, testCoverageTool, testHistoryTool, testTrendsTool, testErrorsTool, fileCoverageTool, settingsListTool, cacheHealthTool, configureTool, commitChangesTool, turnSearchTool, failureSignatureGetTool, acceptanceMetricsTool, triageBriefTool, wrapupPromptTool, inventoryTool, testTool, registerAgentTool, noteTool, hypothesisTool, tddTaskTool, tddPhaseTransitionRequestTool, tddGoalTool, tddBehaviorTool, tddArtifactListTool, tddProgressPushTool, runTestsTool);
42
43
  /**
43
- * The handler for each tool in {@link Kit}, keyed by tool name. The seven
44
- * action-keyed tools are `Tool.dynamic` (a union root cannot be a `Tool.make`
45
- * parameters schema), so their handlers take the raw payload and decode it
46
- * through `McpToolkit.unionHandler`.
44
+ * The handler for each tool in {@link Kit}, keyed by tool name, with the four
45
+ * replayable write tools wrapped once over `store`. The seven action-keyed
46
+ * tools are `Tool.dynamic` (a union root cannot be a `Tool.make` parameters
47
+ * schema), so their handlers take the raw payload and decode it through
48
+ * `McpToolkit.unionHandler`.
47
49
  *
48
- * @public
50
+ * @internal
49
51
  */
50
- const toolHandlers = {
51
- ping: handlePing,
52
- help: handleHelp,
53
- test_status: handleTestStatus,
54
- test_overview: handleTestOverview,
55
- test_coverage: handleTestCoverage,
56
- test_history: handleTestHistory,
57
- test_trends: handleTestTrends,
58
- test_errors: handleTestErrors,
59
- file_coverage: handleFileCoverage,
60
- settings_list: handleSettingsList,
61
- cache_health: handleCacheHealth,
62
- configure: handleConfigure,
63
- commit_changes: handleCommitChanges,
64
- turn_search: handleTurnSearch,
65
- failure_signature_get: handleFailureSignatureGet,
66
- acceptance_metrics: handleAcceptanceMetrics,
67
- triage_brief: handleTriageBrief,
68
- wrapup_prompt: handleWrapupPrompt,
69
- inventory: McpToolkit.unionHandler(inventoryTool, handleInventory),
70
- test: McpToolkit.unionHandler(testTool, handleTest),
71
- register_agent: handleRegisterAgent,
72
- note: McpToolkit.unionHandler(noteTool, handleNote),
73
- hypothesis: McpToolkit.unionHandler(hypothesisTool, replayed({
74
- tool: "hypothesis",
75
- success: HypothesisResult,
76
- key: hypothesisReplayKey
77
- })(handleHypothesis)),
78
- tdd_task: McpToolkit.unionHandler(tddTaskTool, replayed({
79
- tool: "tdd_task",
80
- success: TddTaskResult,
81
- key: tddTaskReplayKey
82
- })(handleTddTask)),
83
- tdd_phase_transition_request: handlePhaseTransitionRequest,
84
- tdd_goal: McpToolkit.unionHandler(tddGoalTool, replayed({
85
- tool: "tdd_goal",
86
- success: TddGoalResult,
87
- key: tddGoalReplayKey
88
- })(handleTddGoal)),
89
- tdd_behavior: McpToolkit.unionHandler(tddBehaviorTool, replayed({
90
- tool: "tdd_behavior",
91
- success: TddBehaviorResult,
92
- key: tddBehaviorReplayKey
93
- })(handleTddBehavior)),
94
- tdd_artifact_list: handleTddArtifactList,
95
- tdd_progress_push: handleTddProgressPush,
96
- run_tests: handleRunTests
52
+ const makeToolHandlers = (store) => {
53
+ const replayed = replayWith(store);
54
+ return {
55
+ ping: handlePing,
56
+ help: handleHelp,
57
+ test_status: handleTestStatus,
58
+ test_overview: handleTestOverview,
59
+ test_coverage: handleTestCoverage,
60
+ test_history: handleTestHistory,
61
+ test_trends: handleTestTrends,
62
+ test_errors: handleTestErrors,
63
+ file_coverage: handleFileCoverage,
64
+ settings_list: handleSettingsList,
65
+ cache_health: handleCacheHealth,
66
+ configure: handleConfigure,
67
+ commit_changes: handleCommitChanges,
68
+ turn_search: handleTurnSearch,
69
+ failure_signature_get: handleFailureSignatureGet,
70
+ acceptance_metrics: handleAcceptanceMetrics,
71
+ triage_brief: handleTriageBrief,
72
+ wrapup_prompt: handleWrapupPrompt,
73
+ inventory: McpToolkit.unionHandler(inventoryTool, handleInventory),
74
+ test: McpToolkit.unionHandler(testTool, handleTest),
75
+ register_agent: handleRegisterAgent,
76
+ note: McpToolkit.unionHandler(noteTool, handleNote),
77
+ hypothesis: McpToolkit.unionHandler(hypothesisTool, replayed({
78
+ tool: "hypothesis",
79
+ success: HypothesisResult,
80
+ key: hypothesisReplayKey
81
+ })(handleHypothesis)),
82
+ tdd_task: McpToolkit.unionHandler(tddTaskTool, replayed({
83
+ tool: "tdd_task",
84
+ success: TddTaskResult,
85
+ key: tddTaskReplayKey
86
+ })(handleTddTask)),
87
+ tdd_phase_transition_request: handlePhaseTransitionRequest,
88
+ tdd_goal: McpToolkit.unionHandler(tddGoalTool, replayed({
89
+ tool: "tdd_goal",
90
+ success: TddGoalResult,
91
+ key: tddGoalReplayKey
92
+ })(handleTddGoal)),
93
+ tdd_behavior: McpToolkit.unionHandler(tddBehaviorTool, replayed({
94
+ tool: "tdd_behavior",
95
+ success: TddBehaviorResult,
96
+ key: tddBehaviorReplayKey
97
+ })(handleTddBehavior)),
98
+ tdd_artifact_list: handleTddArtifactList,
99
+ tdd_progress_push: handleTddProgressPush,
100
+ run_tests: handleRunTests
101
+ };
97
102
  };
98
103
  /**
99
- * The handlers layer: provides `Tool.HandlersFor<typeof Kit.tools>`.
104
+ * Builds the handler for each tool in {@link Kit}: reads `DataReader` /
105
+ * `DataStore` once into the idempotent-replay store and wraps the write
106
+ * tools once over it (`@effected/mcp-kit`'s `ToolReplay` guidance for a server:
107
+ * read the store when the handlers are built, never per call). Both services
108
+ * are fixed for the life of the server, the same instances the server's
109
+ * request middleware provides to each call.
110
+ *
111
+ * @public
112
+ */
113
+ const toolHandlers = Effect.map(makeReplayStore, makeToolHandlers);
114
+ /**
115
+ * The handlers layer: provides `Tool.HandlersFor<typeof Kit.tools>`, built
116
+ * from {@link toolHandlers}, so it requires `DataReader` / `DataStore`.
100
117
  *
101
118
  * @public
102
119
  */
103
120
  const ToolsLayer = Kit.toLayer(toolHandlers);
104
121
 
105
- export { Kit, ToolsLayer, toolHandlers };
122
+ export { Kit, ToolsLayer, makeToolHandlers, toolHandlers };
@@ -1,4 +1,4 @@
1
- import { ToolOutcome } from "@effected/mcp";
1
+ import { ToolOutcome } from "@effected/mcp-kit";
2
2
  import { Schema } from "effect";
3
3
 
4
4
  // src/tools/_tdd-error-envelope.ts
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
package/tools/coverage.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
@@ -1,6 +1,6 @@
1
1
  import { McpSession } from "../session.js";
2
2
  import { IdempotentReplayMarker } from "../utils/replay-marker.js";
3
- import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp";
3
+ import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp-kit";
4
4
  import { Effect, Match, Option, Schema } from "effect";
5
5
  import { Tool } from "effect/ai";
6
6
  import { DataReader, DataStore } from "@vitest-agent/engine";
@@ -1,5 +1,5 @@
1
1
  import { collectProjectRows, resolveProjectTargets } from "./_project-groups.js";
2
- import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp";
2
+ import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp-kit";
3
3
  import { Effect, Match, Option, Schema } from "effect";
4
4
  import { Tool } from "effect/ai";
5
5
  import { DataReader } from "@vitest-agent/engine";
package/tools/note.js CHANGED
@@ -1,4 +1,4 @@
1
- import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp";
1
+ import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp-kit";
2
2
  import { Effect, Match, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader, DataStore } from "@vitest-agent/engine";
package/tools/overview.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
package/tools/ping.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Effect, Option, Schema } from "effect";
2
2
  import { Tool } from "effect/ai";
3
- import { CurrentDistribution, DistributionField } from "@effected/engine";
3
+ import { CurrentDistribution, DistributionField } from "@effected/kit";
4
4
 
5
5
  // src/tools/ping.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader, DataStore, deriveIdempotencyKey } from "@vitest-agent/engine";
@@ -1,19 +1,17 @@
1
1
  import { McpSession } from "../session.js";
2
- import { ToolOutputSchema } from "@effected/mcp";
2
+ import { ToolOutputSchema } from "@effected/mcp-kit";
3
3
  import { Context, Data, Effect, FileSystem, Layer, Option, Path, Result, Schema } from "effect";
4
4
  import { Tool } from "effect/ai";
5
5
  import { DataReader, DataStore } from "@vitest-agent/engine";
6
- import { AgentReport, RunDiagnostics, SuggestedActionRecord, VITEST_CONFIG_FILES, buildAgentReport, buildConsoleLeaks, coerceErrorField, collectConsoleLeakEntries, formatScopedCoverageNote, readStrayOutput, suggestedActionsFromRunDiagnostics } from "@vitest-agent/sdk";
7
- import { Exclusive, ProcessScope } from "@effected/engine";
8
- import { stat } from "node:fs/promises";
9
- import { isAbsolute, resolve } from "node:path";
6
+ import { AgentReport, RunDiagnostics, SuggestedActionRecord, VITEST_CONFIG_FILES, buildAgentReport, buildConsoleLeaks, collectConsoleLeakEntries, formatScopedCoverageNote, readStrayOutput, suggestedActionsFromRunDiagnostics } from "@vitest-agent/sdk";
7
+ import { ErrorText, Exclusive, ProcessScope } from "@effected/kit";
10
8
  import { fileURLToPath } from "node:url";
11
9
  import * as NodeChildProcessSpawner from "@effect/platform-node/NodeChildProcessSpawner";
12
10
  import * as NodeFileSystem from "@effect/platform-node/NodeFileSystem";
13
11
  import * as NodePath from "@effect/platform-node/NodePath";
14
12
  import { ModuleResolution } from "@effected/commands/node-sync";
15
13
  import { Git, TreeIdentity } from "@effected/git";
16
- import { StdioCapture } from "@effected/mcp/node";
14
+ import { StdioCapture } from "@effected/mcp-kit/node";
17
15
  import { Walker } from "@effected/walker";
18
16
 
19
17
  // src/tools/run-tests.ts
@@ -265,8 +263,6 @@ const resolveConfigAnchoredRoot = (startDir) => Effect.gen(function* () {
265
263
  const NodeFsPath = Layer.mergeAll(NodeFileSystem.layer, NodePath.layer);
266
264
  /** The Node platform the promise-shaped run body walks the real disk with; bound once so it memoizes. */
267
265
  const NodeWalkPlatform = Git.layer.pipe(Layer.provide(NodeChildProcessSpawner.layer), Layer.provideMerge(NodeFsPath));
268
- /** Run a never-failing platform walk against the real disk. */
269
- const runOnNodePlatform = (effect) => Effect.runPromise(Effect.provide(effect, NodeWalkPlatform));
270
266
  /**
271
267
  * Validate an optional caller-supplied `projectRoot` against `ctxCwd`
272
268
  * (the MCP server's boot-time root). `undefined` anchors at the directory
@@ -286,26 +282,24 @@ const runOnNodePlatform = (effect) => Effect.runPromise(Effect.provide(effect, N
286
282
  *
287
283
  * @internal exported for tests
288
284
  */
289
- async function validateProjectRoot(projectRoot, ctxCwd) {
285
+ const validateProjectRoot = Effect.fn("run_tests.validateProjectRoot")(function* (projectRoot, ctxCwd) {
290
286
  if (projectRoot === void 0) return {
291
287
  ok: true,
292
- root: await runOnNodePlatform(resolveConfigAnchoredRoot(ctxCwd))
288
+ root: yield* resolveConfigAnchoredRoot(ctxCwd)
293
289
  };
294
- const resolvedRoot = resolve(ctxCwd, projectRoot);
295
- let isDirectory;
296
- try {
297
- isDirectory = (await stat(resolvedRoot)).isDirectory();
298
- } catch {
299
- return {
300
- ok: false,
301
- message: `projectRoot "${resolvedRoot}" does not exist (ctx.cwd is "${ctxCwd}").`
302
- };
303
- }
304
- if (!isDirectory) return {
290
+ const path = yield* Path.Path;
291
+ const fs = yield* FileSystem.FileSystem;
292
+ const resolvedRoot = path.resolve(ctxCwd, projectRoot);
293
+ const info = yield* fs.stat(resolvedRoot).pipe(Effect.option, Effect.catchDefect(() => Effect.succeedNone));
294
+ if (Option.isNone(info)) return {
295
+ ok: false,
296
+ message: `projectRoot "${resolvedRoot}" does not exist (ctx.cwd is "${ctxCwd}").`
297
+ };
298
+ if (info.value.type !== "Directory") return {
305
299
  ok: false,
306
300
  message: `projectRoot "${resolvedRoot}" is not a directory (ctx.cwd is "${ctxCwd}").`
307
301
  };
308
- const [rootCommonDir, cwdCommonDir] = await runOnNodePlatform(Effect.all([gitCommonDir(resolvedRoot), gitCommonDir(ctxCwd)], { concurrency: 2 }));
302
+ const [rootCommonDir, cwdCommonDir] = yield* Effect.all([gitCommonDir(resolvedRoot), gitCommonDir(ctxCwd)], { concurrency: 2 });
309
303
  if (rootCommonDir === null || cwdCommonDir === null || rootCommonDir !== cwdCommonDir) return {
310
304
  ok: false,
311
305
  message: `projectRoot "${resolvedRoot}" does not belong to the same git repository as ctx.cwd "${ctxCwd}".`
@@ -314,7 +308,7 @@ async function validateProjectRoot(projectRoot, ctxCwd) {
314
308
  ok: true,
315
309
  root: resolvedRoot
316
310
  };
317
- }
311
+ });
318
312
  /**
319
313
  * The tree identity for `dir` (`Git.treeIdentity`: its physical toplevel and
320
314
  * the shared common dir, from one `git rev-parse`), or `None` when git cannot
@@ -332,16 +326,17 @@ const treeIdentityOf = (dir) => Effect.flatMap(Git, (git) => git.treeIdentity(di
332
326
  *
333
327
  * @internal exported for tests
334
328
  */
335
- async function checkCallerWorktree(callerCwd, resolvedRoot) {
336
- if (callerCwd === void 0 || callerCwd === "" || !isAbsolute(callerCwd)) return {
329
+ const checkCallerWorktree = Effect.fn("run_tests.checkCallerWorktree")(function* (callerCwd, resolvedRoot) {
330
+ const path = yield* Path.Path;
331
+ if (callerCwd === void 0 || callerCwd === "" || !path.isAbsolute(callerCwd)) return {
337
332
  ok: true,
338
333
  root: resolvedRoot
339
334
  };
340
- if (!await stat(callerCwd).then((s) => s.isDirectory(), () => false)) return {
335
+ if (!(yield* (yield* FileSystem.FileSystem).stat(callerCwd).pipe(Effect.map((info) => info.type === "Directory"), Effect.orElseSucceed(() => false), Effect.catchDefect(() => Effect.succeed(false))))) return {
341
336
  ok: true,
342
337
  root: resolvedRoot
343
338
  };
344
- const [caller, root] = await runOnNodePlatform(Effect.all([treeIdentityOf(callerCwd), treeIdentityOf(resolvedRoot)], { concurrency: 2 }));
339
+ const [caller, root] = yield* Effect.all([treeIdentityOf(callerCwd), treeIdentityOf(resolvedRoot)], { concurrency: 2 });
345
340
  if (Option.isNone(caller) || Option.isNone(root)) return {
346
341
  ok: true,
347
342
  root: resolvedRoot
@@ -354,7 +349,7 @@ async function checkCallerWorktree(callerCwd, resolvedRoot) {
354
349
  ok: false,
355
350
  message: `This call came from the working tree "${caller.value.toplevel}" but the Vitest root resolved to "${root.value.toplevel}", a different working tree of the same repository, so the run would report results for the wrong tree. Pass projectRoot (the absolute path of your own working tree, "${caller.value.toplevel}") to run there.`
356
351
  };
357
- }
352
+ });
358
353
  /**
359
354
  * Issue #303: resolve `vitest/node` anchored at the run's project root
360
355
  * instead of the bare `"vitest/node"` specifier, which resolves relative to
@@ -519,7 +514,7 @@ function deriveRunScope(input) {
519
514
  hasFilter
520
515
  });
521
516
  } catch (err) {
522
- return Result.fail(err instanceof Error ? err.message : String(err));
517
+ return Result.fail(ErrorText.describe(err));
523
518
  }
524
519
  }
525
520
  /**
@@ -590,17 +585,14 @@ function toOkPayload(args) {
590
585
  */
591
586
  const makeBestEffortFork = (services) => (effect) => Effect.runFork(Effect.provideContext(effect.pipe(Effect.ignore), services));
592
587
  /**
593
- * A rejected step's message. Exception-safe: a hostile thrown value (a
594
- * throwing `message` getter or `toString`) still yields a string, so the
595
- * `{ kind: "error" }` envelope always comes back.
588
+ * A rejected step's message: `ErrorText.describe`, which is total, so a
589
+ * hostile thrown value (a throwing `message` getter or `toString`) still
590
+ * yields a string and the `{ kind: "error" }` envelope always comes back. A
591
+ * plain `{ message }` object reads as its message and any other object as its
592
+ * JSON, never `[object Object]`. Deliberately not `ErrorText.of`: the
593
+ * envelope carries the rejected value's own message, not its cause chain.
596
594
  */
597
- const errorMessage = (err) => {
598
- try {
599
- return err instanceof Error ? err.message : String(err);
600
- } catch {
601
- return coerceErrorField(err, "message") ?? "<unserializable error>";
602
- }
603
- };
595
+ const errorMessage = (err) => ErrorText.describe(err);
604
596
  /**
605
597
  * A promise-returning Vitest step, run through the lane's promise. By default
606
598
  * an interrupt aborts, then waits for the promise to settle; `abandon` resumes
@@ -708,13 +700,13 @@ const runTestsBody = (input, ctx) => Effect.gen(function* () {
708
700
  message: derived.failure
709
701
  };
710
702
  const scope = derived.success;
711
- const projectRootValidation = yield* Effect.promise(() => validateProjectRoot(input.projectRoot, ctx.cwd));
703
+ const projectRootValidation = yield* onNodePlatform(validateProjectRoot(input.projectRoot, ctx.cwd));
712
704
  if (!projectRootValidation.ok) return {
713
705
  kind: "error",
714
706
  message: projectRootValidation.message
715
707
  };
716
708
  const resolvedRoot = projectRootValidation.root;
717
- const callerCheck = yield* Effect.promise(() => checkCallerWorktree(input._callerCwd, resolvedRoot));
709
+ const callerCheck = yield* onNodePlatform(checkCallerWorktree(input._callerCwd, resolvedRoot));
718
710
  if (!callerCheck.ok) return {
719
711
  kind: "error",
720
712
  message: callerCheck.message
package/tools/status.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
@@ -1,6 +1,6 @@
1
1
  import { IdempotentReplayMarker } from "../utils/replay-marker.js";
2
2
  import { behaviorNotFound, goalNotFound, illegalStatusTransition, tddEnvelope, tddTaskAlreadyEnded, tddTaskNotFound } from "./_tdd-error-envelope.js";
3
- import { McpToolkit, ToolOutcome, ToolRefusal } from "@effected/mcp";
3
+ import { McpToolkit, ToolOutcome, ToolRefusal } from "@effected/mcp-kit";
4
4
  import { Effect, Match, Option, Schema } from "effect";
5
5
  import { Tool } from "effect/ai";
6
6
  import { DataReader, DataStore } from "@vitest-agent/engine";
package/tools/tdd-goal.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { IdempotentReplayMarker } from "../utils/replay-marker.js";
2
2
  import { goalNotFound, illegalStatusTransition, tddEnvelope, tddTaskAlreadyEnded, tddTaskNotFound } from "./_tdd-error-envelope.js";
3
- import { McpToolkit, ToolOutcome, ToolRefusal } from "@effected/mcp";
3
+ import { McpToolkit, ToolOutcome, ToolRefusal } from "@effected/mcp-kit";
4
4
  import { Effect, Match, Option, Schema } from "effect";
5
5
  import { Tool } from "effect/ai";
6
6
  import { DataReader, DataStore } from "@vitest-agent/engine";
@@ -1,9 +1,9 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader, DataStore } from "@vitest-agent/engine";
5
5
  import { requiredArtifactForTransition, transitionEnforcesBehaviorMatch, validatePhaseTransition } from "@vitest-agent/sdk";
6
- import { Remediation } from "@effected/engine";
6
+ import { Remediation } from "@effected/kit";
7
7
 
8
8
  // src/tools/tdd-phase-transition-request.ts
9
9
  /**
package/tools/tdd-task.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { IdempotentReplayMarker } from "../utils/replay-marker.js";
2
- import { McpToolkit, ToolFailure, ToolOutputSchema, ToolRefusal } from "@effected/mcp";
2
+ import { McpToolkit, ToolFailure, ToolOutputSchema, ToolRefusal } from "@effected/mcp-kit";
3
3
  import { Effect, Match, Option, Schema } from "effect";
4
4
  import { Tool } from "effect/ai";
5
5
  import { DataReader, DataStore } from "@vitest-agent/engine";
package/tools/test.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { collectProjectRows, resolveProjectTargets } from "./_project-groups.js";
2
- import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp";
2
+ import { McpToolkit, ToolOutputSchema, ToolRefusal } from "@effected/mcp-kit";
3
3
  import { Effect, Match, Option, Schema } from "effect";
4
4
  import { Tool } from "effect/ai";
5
5
  import { DataReader } from "@vitest-agent/engine";
package/tools/trends.js CHANGED
@@ -1,4 +1,4 @@
1
- import { ToolOutputSchema } from "@effected/mcp";
1
+ import { ToolOutputSchema } from "@effected/mcp-kit";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { Tool } from "effect/ai";
4
4
  import { DataReader } from "@vitest-agent/engine";
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.60.0"
8
+ "packageVersion": "7.60.1"
9
9
  }
10
10
  ]
11
11
  }
package/version.js CHANGED
@@ -7,6 +7,6 @@
7
7
  *
8
8
  * @public
9
9
  */
10
- const CURRENT_MCP_VERSION = "6.0.1";
10
+ const CURRENT_MCP_VERSION = "6.1.1";
11
11
 
12
12
  export { CURRENT_MCP_VERSION };