@gjermundgaraba/effect-actions 0.23.0 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -76,10 +76,10 @@ Effect.gen(function* () {
76
76
  ## Install
77
77
 
78
78
  ```sh
79
- pnpm add @gjermundgaraba/effect-actions effect@~4.0.5
79
+ pnpm add @gjermundgaraba/effect-actions effect@~4.1.0
80
80
  ```
81
81
 
82
- It needs TypeScript 7 or newer and is ESM only ([docs/setup.md](docs/setup.md#install)). Add `@effect/platform-node@~4.0.5` to serve or run a CLI from Node, and `@types/node` for its `node:` imports. Every module is a subpath import (`.../Action`, `.../ActionHttp`, ...); there is no package root, so a contracts-only bundle never loads a server.
82
+ It needs TypeScript 7 or newer and is ESM only ([docs/setup.md](docs/setup.md#install)). Add `@effect/platform-node@~4.1.0` to serve or run a CLI from Node, and `@types/node` for its `node:` imports. Every module is a subpath import (`.../Action`, `.../ActionHttp`, ...); there is no package root, so a contracts-only bundle never loads a server.
83
83
 
84
84
  ## Examples
85
85
 
@@ -104,7 +104,7 @@ type WatchServices<C, E extends Any> = [E] extends [never] ? never : C extends E
104
104
  * - Each value an action declaring `progress` reports is one line of compact JSON on stderr, as it arrives, so stdout holds the answer alone; `remoteCommand` asks the server for them too.
105
105
  * - An action answering a stream prints each element on stdout as it arrives, one line of compact JSON, or `render`'s text of it; a declared failure ends the command after the elements before it.
106
106
  * - A declared error is its JSON on stderr, under Effect CLI's `ERROR` heading, the command failing with a `UserError` whose `cause` is the error, exit 1 or its `Runtime.errorExitCode`; a refusal as `Action.Unauthenticated` and `Action.Forbidden` say; input that does not decode, in `--input` or a flag's JSON value, is `InvalidInput`'s JSON there, while a missing flag or a rejected choice is Effect CLI's own parse error.
107
- * - Effect CLI styles what it prints, a failure's JSON included, on a terminal and, from Effect 4.0.6, wherever `FORCE_COLOR` forces colour: for plain text there, set `NO_COLOR` or provide `TerminalCapabilities.TerminalCapabilities` with `canColor: false`.
107
+ * - Effect CLI styles what it prints, a failure's JSON included, on a terminal and wherever `FORCE_COLOR` forces colour: for plain text there, set `NO_COLOR` or provide `TerminalCapabilities.TerminalCapabilities` with `canColor: false`.
108
108
  * - A failure no schema encodes, a builder's or an accepted error that does not encode, is a `UserError` printed as its tag or name and its message, then its causes, never its other fields; a defect, an undeclared failure, or a success that does not encode is the command's defect, which `runMain` reports as `logToStderr` says.
109
109
  * - Provide services with `Command.provide` on the command, built when an action runs: provided around `Command.run`, they are built before parsing, so `--help` and a mistyped flag open the database.
110
110
  * - Each run builds the action's implementation, its builder and an authorizer an Effect builds, and releases them after the call, even where the host already built them; implementations passed beside it are not built.
@@ -94,7 +94,7 @@ const checkedCommandsOf = (commands, actions) => {
94
94
  * - Each value an action declaring `progress` reports is one line of compact JSON on stderr, as it arrives, so stdout holds the answer alone; `remoteCommand` asks the server for them too.
95
95
  * - An action answering a stream prints each element on stdout as it arrives, one line of compact JSON, or `render`'s text of it; a declared failure ends the command after the elements before it.
96
96
  * - A declared error is its JSON on stderr, under Effect CLI's `ERROR` heading, the command failing with a `UserError` whose `cause` is the error, exit 1 or its `Runtime.errorExitCode`; a refusal as `Action.Unauthenticated` and `Action.Forbidden` say; input that does not decode, in `--input` or a flag's JSON value, is `InvalidInput`'s JSON there, while a missing flag or a rejected choice is Effect CLI's own parse error.
97
- * - Effect CLI styles what it prints, a failure's JSON included, on a terminal and, from Effect 4.0.6, wherever `FORCE_COLOR` forces colour: for plain text there, set `NO_COLOR` or provide `TerminalCapabilities.TerminalCapabilities` with `canColor: false`.
97
+ * - Effect CLI styles what it prints, a failure's JSON included, on a terminal and wherever `FORCE_COLOR` forces colour: for plain text there, set `NO_COLOR` or provide `TerminalCapabilities.TerminalCapabilities` with `canColor: false`.
98
98
  * - A failure no schema encodes, a builder's or an accepted error that does not encode, is a `UserError` printed as its tag or name and its message, then its causes, never its other fields; a defect, an undeclared failure, or a success that does not encode is the command's defect, which `runMain` reports as `logToStderr` says.
99
99
  * - Provide services with `Command.provide` on the command, built when an action runs: provided around `Command.run`, they are built before parsing, so `--help` and a mistyped flag open the database.
100
100
  * - Each run builds the action's implementation, its builder and an authorizer an Effect builds, and releases them after the call, even where the host already built them; implementations passed beside it are not built.
@@ -168,7 +168,7 @@ export declare function make<const Contracts extends ReadonlyArray<Any$1 | Any>>
168
168
  * - The 415 keeps from every handler what another site's page can send without a CORS preflight, such as a form post carrying the user's cookie; the server's CORS policy decides the rest.
169
169
  * - Router middleware providing a request service `X` is declared `HttpRouter.middleware<{ provides: X }>()`: without the type argument it runs and the layer still owes `X`.
170
170
  * - `HttpRouter.provideRequest(layer)` builds its layer once, at startup, so it never provides an identity or a tenant.
171
- * - A request body is read whole, however large, unless the host provides `HttpServerRequest.MaxBodySize` to `HttpRouter.serve`, limiting every route that reads its body whole, MCP endpoints included; a body a route reads as a stream is not limited. On Node a request over it is an empty 413 from Effect 4.0.6, and before it gets no response, its connection closed; `HttpRouter.toWebHandler` ignores it, so limit bodies in the platform serving the handler.
171
+ * - A request body is read whole, however large, unless the host provides `HttpServerRequest.MaxBodySize` to `HttpRouter.serve`, limiting every route that reads its body whole, MCP endpoints included; a body a route reads as a stream is not limited. A request over it is an empty 413. Under `HttpRouter.toWebHandler` provide it with `HttpRouter.provideRequest`: `Layer.provide` around the routes limits `ActionHttp`'s and no MCP endpoint.
172
172
  * - An `ErrorReporter` the server runs with is given, as `Info`, a handler's declared failure and an input that does not decode, never a refusal or a refused credential: give an error class `override readonly [ErrorReporter.ignore] = true` to keep it out, and drop `Info` for a built-in error, which takes no mark.
173
173
  * - An event's route takes `{ input, cursor }`, a `cursor` omitted or `null` reading from now, and answers a page, `{ events, cursor, truncated, hasMore, nextPollMs }`, or, to a request accepting `text/event-stream`, an SSE stream of `Checked`, `Occurrence`, `Gap` and `Failed` data, a `Checked` every 30 seconds; the stream carries no `id:`, so `Last-Event-ID` resumes nothing: resume from a cursor in the body.
174
174
  * - A subscription is refused as an action's call is, before its stream starts, with the route's 401 or 403; a refusal later ends the stream with Effect's `effect/http-api/stream/failure` event.
@@ -6,15 +6,16 @@ import { Any as Any$2, Matching, ProviderOf, RemoteRequest, Required, ServerBuil
6
6
  import { McpCallError } from "./mcp/reply.mjs";
7
7
  import { Client, ClientOptions, client } from "./mcp/client.mjs";
8
8
  import { Params, RequestOptions, request } from "./mcp/request.mjs";
9
- import { Cause, Effect, Layer, Stdio } from "effect";
9
+ import { Cause, Effect, Layer, Scope, Stdio } from "effect";
10
10
  import { HttpRouter } from "effect/http";
11
11
  import { McpSchema, McpServer } from "effect/ai";
12
12
  /**
13
- * An MCP server, over HTTP or stdio: every native `McpServer.layerStdio` option but `protocols`,
14
- * the server information, `instructions` and `extensions` among them, the actions `A` that are
15
- * its tools and the event types `A` it serves, and the native features it serves beside them.
13
+ * An MCP server, over HTTP or stdio: every native `McpServer.layerStdio` option but `protocols`
14
+ * and `registrations`, the server information, `instructions`, `extensions` and `cacheHints`
15
+ * among them, the actions `A` that are its tools and the event types `A` it serves, and the
16
+ * native features it serves beside them.
16
17
  */
17
- export interface Options<E = never, R = never, A extends Any$1 | Any = Any$1 | Any> extends Omit<Parameters<typeof McpServer.layerStdio>[0], "protocols"> {
18
+ export interface Options<E = never, R = never, A extends Any$1 | Any = Any$1 | Any> extends Omit<Parameters<typeof McpServer.layerStdio>[0], "protocols" | "registrations"> {
18
19
  /**
19
20
  * The actions that are tools and the event types it serves, among the implementations':
20
21
  * `[GetUser, RenameUser, UserRenamed]`, exactly those. Each keeps its implementation's
@@ -27,24 +28,25 @@ export interface Options<E = never, R = never, A extends Any$1 | Any = Any$1 | A
27
28
  readonly actions?: readonly A[] | undefined;
28
29
  /**
29
30
  * Native MCP features served beside the actions' tools, such as `McpServer.resource`,
30
- * `McpServer.prompt` and `McpServer.toolkit` layers merged into one. They register on this
31
- * server's registry and run with the services they were built with, and no `authorize` runs for
32
- * them.
31
+ * `McpServer.prompt` and `McpServer.toolkit` layers merged into one: Effect's `registrations`,
32
+ * registered on this server's registry before it reads a request. No `authorize` runs for them.
33
33
  *
34
34
  * **Gotchas**
35
35
  *
36
- * - Merged beside the endpoint instead of passed here, they register on another registry and are never served, without an error.
37
- * - A service provided to this layer itself is built again for the features alone, so a resource reads another store than the tools write: provide it around the endpoint.
38
- * - They never receive a request's services, so they cannot read the caller: content that depends on the caller is an action.
36
+ * - Merged beside the endpoint instead of passed here, they need an `McpServer` nothing provides: a type error, and `Service not found: effect/ai/McpServer` as the layer builds.
37
+ * - A service a handler reads is a request's, in the endpoint's `Request<"Requires", X>`, as a tool's is: provide it with router middleware, or around `runStdio`. `Layer.provide` does not satisfy it.
38
+ * - A service known at startup is read in a `Layer.unwrap` around the feature, which closes over it: the endpoint then needs it at startup, and shares it with the tools.
39
+ * - A layer provided to this layer itself is built again for the features alone, so a resource reads another store than the tools write: provide it around the endpoint.
40
+ * - They cannot read the caller, which `authentication` gives protected tools alone: content that depends on the caller is an action.
39
41
  */
40
42
  readonly features?: Layer.Layer<never, E, R> | undefined;
41
43
  }
42
44
  /**
43
45
  * One Streamable HTTP MCP endpoint: `Options`, `authentication`, `requestScoped`, and every native
44
- * `McpServer.layerHttp` option, `allowedOrigins` among them, except `protocols` and
45
- * `allowSessionTermination`, which are fixed.
46
+ * `McpServer.layerHttp` option, `allowedOrigins` among them, except `protocols`, `registrations`
47
+ * and `allowSessionTermination`, which are fixed.
46
48
  */
47
- export interface LayerHttpOptions<E = never, R = never, A extends Any$1 | Any = Any$1 | Any> extends Options<E, R, A>, Omit<Parameters<typeof McpServer.layerHttp>[0], "protocols" | "path" | "allowSessionTermination"> {
49
+ export interface LayerHttpOptions<E = never, R = never, A extends Any$1 | Any = Any$1 | Any> extends Options<E, R, A>, Omit<Parameters<typeof McpServer.layerHttp>[0], "protocols" | "path" | "allowSessionTermination" | "registrations"> {
48
50
  /** The endpoint's route; defaults to `/mcp`. */
49
51
  readonly path?: HttpRouter.PathInput;
50
52
  /**
@@ -86,7 +88,8 @@ export interface LayerHttpOptions<E = never, R = never, A extends Any$1 | Any =
86
88
  }
87
89
  type ToolRequestContext<R> = Exclude<R, McpSchema.McpRequestContext | McpServer.McpServer>;
88
90
  type HttpToolRequestContext<R> = Exclude<ToolRequestContext<R>, HttpRouter.Provided>;
89
- type Features<R> = Exclude<R, McpServer.McpServer>;
91
+ type Features<R> = Exclude<McpServer.McpRequest.Without<R>, McpServer.McpServer>;
92
+ type FeatureRequest<R> = McpServer.McpRequest.Only<"Requires", R>;
90
93
  type Contracts<Apps extends Served, O> = SelectedOf<O, Apps> | SelectedEventsOf<O, Apps>;
91
94
  type ServerError<Apps extends Served, O> = BuildError<Holding<Member<Apps>, SelectedOf<O, Apps>>, SelectedOf<O, Apps>> | EventBuildError<HoldingEvents<Member<Apps>, SelectedEventsOf<O, Apps>>, SelectedEventsOf<O, Apps>> | Cause.IllegalArgumentError;
92
95
  type EventServices<Apps extends Served, O> = EventBuildServices<HoldingEvents<Member<Apps>, SelectedEventsOf<O, Apps>>, SelectedEventsOf<O, Apps>>;
@@ -130,7 +133,7 @@ type Inferring<D, A extends Pick<Any$1, "caller">> = [D] extends [undefined] ? [
130
133
  * - A poll's `maxEvents` caps a log source's page, at most 100, and is not honored for a check source, whose page is answered whole since only its last cursor resumes; `maxAgeMs` is accepted and not honored, a log source keeping what its `log.maxAge` and `log.maxEvents` say.
131
134
  * - A push stream's failure that no refusal explains, such as an upstream's outage, is `notifications/events/error`, its cause logged and reported, and the stream resumes from where it reached after 5 seconds; a refusal ends it with `notifications/events/terminated`. One before `active`, or a poll's, is a JSON-RPC `-32603`, which `client`'s `watch` reconnects after, as after a 5xx.
132
135
  */
133
- export declare function layerHttp<const Apps extends Served, const O extends Selection<ActionOf<Member<Apps>> | EventOf<Member<Apps>>> = {}, E = never, R = never, const D extends Any$2 | undefined = undefined>(implementations: Apps, options: LayerHttpOptions<E, R, ActionOf<Member<Apps>> | EventOf<Member<Apps>>> & O & NoInfer<Known<O, LayerHttpOptions<E, R>>> & NoInfer<Required<Contracts<Apps, O>>> & Matching<NoInfer<Contracts<Apps, O>>, NoInfer<D>> & Inferring<D, NoInfer<Contracts<Apps, O>>>): Layer.Layer<never, ServerError<Apps, O> | E, ServerBuildServices<Holding<Member<Apps>, SelectedOf<O, Apps>>, SelectedOf<O, Apps>> | EventServices<Apps, O> | HttpRouter.HttpRouter | HttpRouter.Request.From<"Requires", HttpToolRequestContext<RemoteRequest<Member<Apps>, SelectedOf<O, Apps>> | EventServedRequest<Member<Apps>, SelectedEventsOf<O, Apps>>>> | ProviderOf<D> | Features<R>>;
136
+ export declare function layerHttp<const Apps extends Served, const O extends Selection<ActionOf<Member<Apps>> | EventOf<Member<Apps>>> = {}, E = never, R = never, const D extends Any$2 | undefined = undefined>(implementations: Apps, options: LayerHttpOptions<E, R, ActionOf<Member<Apps>> | EventOf<Member<Apps>>> & O & NoInfer<Known<O, LayerHttpOptions<E, R>>> & NoInfer<Required<Contracts<Apps, O>>> & Matching<NoInfer<Contracts<Apps, O>>, NoInfer<D>> & Inferring<D, NoInfer<Contracts<Apps, O>>>): Layer.Layer<never, ServerError<Apps, O> | E, ServerBuildServices<Holding<Member<Apps>, SelectedOf<O, Apps>>, SelectedOf<O, Apps>> | EventServices<Apps, O> | HttpRouter.HttpRouter | HttpRouter.Request.From<"Requires", HttpToolRequestContext<RemoteRequest<Member<Apps>, SelectedOf<O, Apps>> | EventServedRequest<Member<Apps>, SelectedEventsOf<O, Apps>> | FeatureRequest<R>>> | ProviderOf<D> | Features<R>>;
134
137
  /**
135
138
  * Serve MCP tools through newline-delimited JSON-RPC on standard I/O, speaking MCP
136
139
  * 2026-07-28, 2025-11-25 or 2025-06-18, as the host negotiates: the whole
@@ -147,5 +150,5 @@ export declare function layerHttp<const Apps extends Served, const O extends Sel
147
150
  * - A line that is not JSON goes unanswered, with no `-32700` as over HTTP, and the lines after it are still answered.
148
151
  * - The layers provided around it log to stdout, among the protocol's lines: apply `ActionCli.logToStderr` to the program, last, as its JSDoc says.
149
152
  */
150
- export declare function runStdio<const Apps extends Served, const O extends Selection<ActionOf<Member<Apps>> | EventOf<Member<Apps>>> = {}, E = never, R = never>(implementations: Apps, options: Options<E, R, ActionOf<Member<Apps>> | EventOf<Member<Apps>>> & O & NoInfer<Known<O, Options<E, R>>>): Effect.Effect<void, ServerError<Apps, O> | E, BuildServices<Holding<Member<Apps>, SelectedOf<O, Apps>>, SelectedOf<O, Apps>> | EventServices<Apps, O> | Stdio.Stdio | ToolRequestContext<ServedRequest<Member<Apps>, SelectedOf<O, Apps>> | EventRequestOf<Member<Apps>, SelectedEventsOf<O, Apps>>> | Features<R>>;
153
+ export declare function runStdio<const Apps extends Served, const O extends Selection<ActionOf<Member<Apps>> | EventOf<Member<Apps>>> = {}, E = never, R = never>(implementations: Apps, options: Options<E, R, ActionOf<Member<Apps>> | EventOf<Member<Apps>>> & O & NoInfer<Known<O, Options<E, R>>>): Effect.Effect<void, ServerError<Apps, O> | E, BuildServices<Holding<Member<Apps>, SelectedOf<O, Apps>>, SelectedOf<O, Apps>> | EventServices<Apps, O> | Stdio.Stdio | ToolRequestContext<ServedRequest<Member<Apps>, SelectedOf<O, Apps>> | EventRequestOf<Member<Apps>, SelectedEventsOf<O, Apps>> | Exclude<FeatureRequest<R>, Scope.Scope>> | Features<R>>;
151
154
  export { type Client, type ClientOptions, McpCallError, type Params, type RequestOptions, client, request };
@@ -133,7 +133,7 @@ const server = (apps, serving, transport, features = Layer.empty) => {
133
133
  yield* serveWebhooks(serving);
134
134
  yield* registerTools(apps, authentication);
135
135
  });
136
- return Layer.effectDiscard(register).pipe(Layer.provide(features), Layer.provide(transport), Layer.fresh, provideServed({
136
+ return Layer.empty.pipe(Layer.provide(transport(Layer.effectDiscard(register).pipe(Layer.provide(features)))), Layer.fresh, provideServed({
137
137
  apps,
138
138
  events
139
139
  }));
@@ -183,16 +183,18 @@ function layerHttp(apps, { actions, features, path = defaultPath, authentication
183
183
  events,
184
184
  authentication
185
185
  };
186
- const transport = server(selected, serving, requestScoped === true ? McpServer.layerHttpRequestScoped({
186
+ const transport = server(selected, serving, (registrations) => requestScoped === true ? McpServer.layerHttpRequestScoped({
187
187
  ...options,
188
188
  path,
189
- protocols: servingEvents([httpProtocol], serving)
189
+ protocols: servingEvents([httpProtocol], serving),
190
+ registrations
190
191
  }) : McpServer.layerHttp({
191
192
  ...options,
192
193
  path,
193
194
  protocols: servingEvents(protocols, serving),
194
195
  allowSessionTermination: true,
195
- allowSubscriptions: allowSubscriptions ?? (features !== void 0 || events.length > 0)
196
+ allowSubscriptions: allowSubscriptions ?? (features !== void 0 || events.length > 0),
197
+ registrations
196
198
  }), features);
197
199
  if (authentication === void 0) return transport.pipe(Layer.provide(HttpRouter.middleware(readsItsBody).layer));
198
200
  const required = requiresAuthentication(served, listed);
@@ -211,9 +213,10 @@ function runStdio(apps, { actions, features, ...options }) {
211
213
  events,
212
214
  authentication: void 0
213
215
  };
214
- const transport = server(selected, serving, McpServer.layerStdio({
216
+ const transport = server(selected, serving, (registrations) => McpServer.layerStdio({
215
217
  ...options,
216
- protocols: servingEvents(protocols, serving)
218
+ protocols: servingEvents(protocols, serving),
219
+ registrations
217
220
  }).pipe(Layer.provide(jsonLinesOnly)), features);
218
221
  return Layer.launch(transport).pipe(withStderrConsole, Effect.forkChild, Effect.flatMap(Fiber.await), Effect.flatMap((exit) => Exit.isFailure(exit) && !Cause.hasInterruptsOnly(exit.cause) ? Effect.failCause(exit.cause) : Effect.void));
219
222
  }
@@ -18,7 +18,7 @@ import { McpSchema } from "effect/ai";
18
18
  const isGroup = (u) => Predicate.isObjectKeyword(u) && "merge" in u && Predicate.isFunction(u.merge) && "requests" in u && u.requests instanceof Map;
19
19
  const groupOf = (adapter, key) => {
20
20
  const group = Predicate.hasProperty(adapter, key) ? adapter[key] : void 0;
21
- if (!isGroup(group)) throw new Error(`Effect's MCP ${adapter.protocolVersion} adapter holds no ${key} group: effect-actions supports MCP events on effect 4.0.x (install the effect version its peer range names)`);
21
+ if (!isGroup(group)) throw new Error(`Effect's MCP ${adapter.protocolVersion} adapter holds no ${key} group: effect-actions supports MCP events on effect 4.1.x (install the effect version its peer range names)`);
22
22
  return group;
23
23
  };
24
24
  const eventSchemasOf = (event) => {
@@ -20,7 +20,7 @@ What you see when something is wrong, and the fix. Search for a fragment of the
20
20
 
21
21
  ## Client methods
22
22
 
23
- - `HttpClientError` whose `reason._tag` is `DecodeError`, printed `Decode error (<status> …)`, for a status such as 429: no schema declares that status; declare the error on the binding when middleware answers with it, on the action when its handler does. For a 500, the cause is in the server's logs.
23
+ - `HttpClientError` whose `reason._tag` is `DecodeError`, printed `Decode: undeclared status code (<status> …)`, for a status such as 429: no schema declares that status; declare the error on the binding when middleware answers with it, on the action when its handler does. For a 500, the cause is in the server's logs.
24
24
  - `HttpClientError` whose `reason._tag` is `InvalidUrlError` outside a browser: relative routes have no page to resolve against; set `baseUrl`.
25
25
  - Type error listing `HttpClient` as an unsatisfied requirement: provide one, such as `FetchHttpClient.layer`, or use `ActionHttp.fetchClient`.
26
26
  - `Expected 1 arguments` at a client method: `{}` is not a valid input for the action, so pass its input; where the argument may be omitted, leave it out, as `undefined` is a type error.
@@ -3,7 +3,8 @@
3
3
  What you see when something is wrong, and the fix. Search for a fragment of the message. The tasks are in [ActionMcp.md](ActionMcp.md).
4
4
 
5
5
  - `Type 'X' is not assignable to type 'never'` where the server is launched, or `Request<"Requires", X>` in an MCP endpoint's type: a handler or an authorizer yields a request service no middleware around the endpoint provides. Provide it with router middleware. `X` the identity, on an endpoint serving public tools: a public handler reads it, which no public tool gets, signed in or not. Make that action protected.
6
- - `Type 'CurrentUser' is not assignable to type 'never'` where the server is launched, with `CurrentUser` among an MCP endpoint's startup requirements, not its `Request<"Requires", ...>`: a native feature reads a request service, which features never receive. Serve that content as an action.
6
+ - `Type 'CurrentUser' is not assignable to type 'never'` where the server is launched, with `CurrentUser` among an MCP endpoint's startup requirements, not its `Request<"Requires", ...>`: a native feature's `Layer.unwrap` reads a request service at startup, when there is no caller. Content that depends on the caller is an action.
7
+ - `Service not found: effect/ai/McpServer` as a layer builds, or `McpServer` among a layer's requirements: a native feature is merged beside the endpoint. Pass it as `features`.
7
8
  - `Type 'CurrentUser' is not assignable to type 'never'` at a stdio program's `runMain`: it serves a protected tool, whose caller the host supplies. Provide the identity around `runStdio`.
8
9
  - A client that opens with `initialize`, such as Codex, gets 400 with JSON-RPC error `-32020`, `MCP-Protocol-Version header is required`, or 401 signed out where the endpoint serves a protected tool, and a `DELETE` gets 405: the endpoint is `requestScoped`, which speaks MCP 2026-07-28 alone and keeps no session. Connect that client to an endpoint without it, on a host that keeps a process running.
9
10
  - `subscriptions/listen` answered with JSON-RPC error `-32601`, Method not found: an endpoint without `features` has no 2026-07-28 subscriptions unless `allowSubscriptions` is `true`, and a `requestScoped` one has none. Pass `true` where a handler changes the server through `McpServer.McpServer`.
@@ -2,7 +2,7 @@
2
2
 
3
3
  What you see when something is wrong, and the fix. Search for a fragment of the message. A missing service's error can start `… with 'exactOptionalPropertyTypes: true'. Consider adding 'undefined'`: search a line beneath it, `is missing the following properties from type 'Scope'`, instead. The tasks are in [Testing.md](Testing.md).
4
4
 
5
- - A route answers an empty 500, which a client method reports as `HttpClientError: Decode error (500 …)`: a defect, or a result that does not encode. `Testing.layer(routes)` logs its cause on the process console, under `it.effect` too: read the test's output, or collect it with a `Logger` provided around the layer.
5
+ - A route answers an empty 500, which a client method reports as `HttpClientError: Decode: undeclared status code (500 …)`: a defect, or a result that does not encode. `Testing.layer(routes)` logs its cause on the process console, under `it.effect` too: read the test's output, or collect it with a `Logger` provided around the layer.
6
6
  - `Type 'Provider<CurrentUser, "notes-service.Login">' is missing the following properties from type 'Scope'` at `it.effect`, or `… is not assignable to type 'never'` at `Effect.runPromise`: the routes serve a protected action without a provider of its descriptor. Provide the real one or a test verifier to the routes; a caller provided around `Testing.layer` does not satisfy them.
7
7
  - `Type 'CurrentUser' is missing the following properties from type 'Scope'` at `it.effect`, or `… is not assignable to type 'never'` at `Effect.runPromise`: the test still owes the identity. An `Action.client` call of a protected action takes its caller per call: provide it around the call. Or a public action's handler reads the identity, which no route provides to it: make the action protected. Or, where the caller is provided already, a builder yields it: move that `yield*` into the handler ([Action-failures.md](Action-failures.md#where-an-implementation-is-served)).
8
8
  - `Type '<Service>' is missing the following properties from type 'Scope'` at every `it.effect`, for a service that is no identity, such as a store, a limiter or a `LanguageModel`: a builder now yields it, and the routes require it. Provide its layer to `Testing.layer(routes)`, as the entrypoint provides it to the server.
@@ -8,5 +8,5 @@ What you see when something is wrong, and the fix. Search for a fragment of the
8
8
  - A page that loads Effect from an import map still bundles a second copy of Effect or of some of its modules, or fails to resolve `effect/Schema` in the browser when its bundler externalizes subpaths, as esbuild's `--external:effect` does: a module of the page imports an Effect specifier the map does not serve. Serve the specifiers [Bundle for a browser](setup.md#bundle-for-a-browser) lists, and import Effect through them in the page's own modules too.
9
9
  - A page loading Effect from an import map fails with `Failed to resolve module specifier "effect/Cause"` in Chromium: the map points at Effect's published files and lacks a specifier Effect imports itself. Map `effect/Cause`, `effect/Effect`, `effect/Exit` and `effect/Function` to the same files, or serve Effect from a build that resolves its own imports.
10
10
  - A page fails at load with `does not provide an export named …`: it serves only the names it uses of an Effect specifier, from a vendored module or a trimmed bundle, and the package imports another. Serve each specifier whole.
11
- - Type errors inside `effect/*` modules after install, an unmet peer warning for `effect`, such as `found 4.1.0`, or a start failing with `Cannot find module '…/effect/dist/…'` under an `@effect/*` package: more than one Effect release is installed, or one outside the peer range. Install the `effect` range [Install](setup.md#install) names, with every `@effect/*` package at the version `effect` resolved to, such as `@effect/platform-node@4.0.5` beside `effect@4.0.5`.
11
+ - Type errors inside `effect/*` modules after install, an unmet peer warning for `effect`, such as `found 4.2.0`, or a start failing with `Cannot find module '…/effect/dist/…'` under an `@effect/*` package: more than one Effect release is installed, or one outside the peer range. Install the `effect` range [Install](setup.md#install) names, with every `@effect/*` package at the version `effect` resolved to, such as `@effect/platform-node@4.1.1` beside `effect@4.1.1`.
12
12
  - `Cannot find module 'effect/unstable/http'` (or `…/httpapi`, `…/cli`, `…/ai`): these modules are now `effect/http`, `effect/http-api`, `effect/cli` and `effect/ai`.
package/docs/setup.md CHANGED
@@ -7,20 +7,20 @@ A message the library throws says its fix; for a compiler diagnostic or Effect's
7
7
  ## Install
8
8
 
9
9
  ```sh
10
- pnpm add @gjermundgaraba/effect-actions effect@~4.0.5
10
+ pnpm add @gjermundgaraba/effect-actions effect@~4.1.0
11
11
  ```
12
12
 
13
13
  | Need | Add |
14
14
  | --- | --- |
15
- | Node HTTP server, stdio host or CLI | `@effect/platform-node@~4.0.5` |
16
- | Tests | `vitest@^5` and `@effect/vitest@~4.0.5`, as dev dependencies |
15
+ | Node HTTP server, stdio host or CLI | `@effect/platform-node@~4.1.0` |
16
+ | Tests | `vitest@^5` and `@effect/vitest@~4.1.0`, as dev dependencies |
17
17
  | Type checking | `typescript@^7.0.2`, as a dev dependency |
18
18
  | Node's types, for `node:` imports | `@types/node`, as a dev dependency |
19
19
  | Running a TypeScript entrypoint | `tsx`, as a dev dependency: `node --import tsx <entrypoint>.ts` |
20
20
 
21
- The `effect` peer admits the 4.0.x patches from the oldest whose APIs the package uses, and no minor release: a minor release may change the unstable Effect modules the surfaces build on.
21
+ The `effect` peer admits the 4.1.x patches from the oldest whose APIs the package uses, and no minor release: a minor release may change the unstable Effect modules the surfaces build on.
22
22
 
23
- Keep the tilde in `package.json`: `^4.0.5`, which npm writes for `effect@4.0.5`, admits a minor release outside the peer range. `npm install effect@~4.0.5` keeps it.
23
+ Keep the tilde in `package.json`: `^4.1.0`, which npm writes for `effect@4.1.0`, admits a minor release outside the peer range. `npm install effect@~4.1.0` keeps it.
24
24
 
25
25
  Node `>=26.12.0`: the package's `engines`, the Node the library is developed and tested on. TypeScript 7 or newer. ESM only. The repository checks the examples with a stricter `tsconfig.json`; this is the minimum a project needs. The package's modules resolve only through its `exports`, which `"module": "nodenext"` reads, as a bundler project's `"moduleResolution": "bundler"` does. `"strict": true` is required, by Effect:
26
26
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba/effect-actions",
3
- "version": "0.23.0",
3
+ "version": "0.24.0",
4
4
  "description": "Define Effect action contracts once and project them onto HTTP, MCP, Effect RPC, native Toolkits, and CLIs.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -52,14 +52,13 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@clanker-stuff/oxlint-config": "0.1.0",
55
- "@effect/platform-node": "4.0.6",
55
+ "@effect/platform-node": "4.1.1",
56
56
  "@effect/tsgo": "0.57.0",
57
- "@effect/vitest": "4.0.6",
57
+ "@effect/vitest": "4.1.1",
58
58
  "@modelcontextprotocol/client": "2.3.1",
59
59
  "@types/node": "26.6.5",
60
- "effect": "4.0.6",
60
+ "effect": "4.1.1",
61
61
  "oxfmt": "0.74.0",
62
- "oxlint": "1.89.0",
63
62
  "tsx": "4.23.15",
64
63
  "typescript": "7.0.2",
65
64
  "ultracite": "8.0.2",
@@ -68,7 +67,7 @@
68
67
  "vitest": "5.0.5"
69
68
  },
70
69
  "peerDependencies": {
71
- "effect": "~4.0.5"
70
+ "effect": "~4.1.0"
72
71
  },
73
72
  "devEngines": {
74
73
  "packageManager": {