@gjermundgaraba/effect-actions 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/README.md +7 -6
  2. package/dist/Action.d.mts +16 -8
  3. package/dist/Action.mjs +0 -1
  4. package/dist/ActionCatalog.d.mts +2 -3
  5. package/dist/ActionCatalog.mjs +4 -5
  6. package/dist/ActionCli.mjs +5 -1
  7. package/dist/ActionCliClient.d.mts +8 -9
  8. package/dist/ActionCliClient.mjs +4 -11
  9. package/dist/ActionGroup.d.mts +15 -11
  10. package/dist/ActionGroup.mjs +8 -2
  11. package/dist/ActionHttp.d.mts +9 -5
  12. package/dist/ActionHttp.mjs +14 -9
  13. package/dist/ActionHttpClient.d.mts +33 -0
  14. package/dist/ActionHttpClient.mjs +16 -0
  15. package/dist/ActionMcp.d.mts +16 -26
  16. package/dist/ActionMcp.mjs +12 -8
  17. package/dist/ActionToolkit.d.mts +10 -11
  18. package/dist/Testing.d.mts +35 -4
  19. package/dist/Testing.mjs +53 -6
  20. package/dist/TestingClient.d.mts +6 -5
  21. package/dist/TestingClient.mjs +6 -3
  22. package/dist/internal/actions.d.mts +18 -7
  23. package/dist/internal/actions.mjs +11 -1
  24. package/dist/internal/fetchClient.d.mts +6 -0
  25. package/dist/internal/fetchClient.mjs +8 -0
  26. package/dist/internal/implementation.d.mts +14 -15
  27. package/dist/internal/implementation.mjs +6 -5
  28. package/dist/internal/tools.mjs +1 -1
  29. package/docs/Action.md +11 -10
  30. package/docs/ActionCatalog.md +9 -9
  31. package/docs/ActionCli.md +7 -7
  32. package/docs/ActionCliClient.md +4 -4
  33. package/docs/ActionGroup.md +24 -16
  34. package/docs/ActionHttp.md +14 -12
  35. package/docs/ActionHttpClient.md +80 -0
  36. package/docs/ActionMcp.md +19 -22
  37. package/docs/ActionToolkit.md +1 -1
  38. package/docs/CONTEXT.md +4 -4
  39. package/docs/README.md +18 -18
  40. package/docs/Testing.md +27 -16
  41. package/docs/guarantees.md +5 -5
  42. package/docs/setup.md +7 -6
  43. package/package.json +5 -4
@@ -32,7 +32,7 @@ Defaults without a schema-error policy. HTTP is a native `HttpApi`; MCP is a nat
32
32
  | Unknown path or method | 404 | n/a |
33
33
  | Invalid JSON / content type | 400 / 415 | n/a |
34
34
 
35
- - A group `schemaError` policy replaces the empty 400s on HTTP with a declared error and status. It never affects MCP. Details in [ActionGroup.md](ActionGroup.md).
35
+ - A group `schemaError` policy replaces the empty 400s on HTTP with a declared error and status: its `invalid` error for input that does not decode, its `internal` error for output that does not encode. It never affects MCP. Details in [ActionGroup.md](ActionGroup.md).
36
36
  - `ActionHttp` sets no headers of its own. The host owns cache and challenge headers; `Authentication.middleware` marks its responses `cache-control: no-store`. Hook refusals and handler failures are ordinary declared error responses.
37
37
  - Routes are `POST <apiPath>/<group>/<action>`. Operation IDs are `<group>.<action>`. Effect generates OpenAPI component names and references.
38
38
  - `ActionHttp.make`'s `errors` are declared on every endpoint so clients decode the surface's own failures (401, 403, 429, 503). They are produced by middleware or by the binding's hook, never by a handler. `ActionMcp` and `ActionToolkit` declare their own `errors` the same way, joined into every tool's failure schema. Two errors may share an HTTP status; their `_tag`s must differ, because the client decodes a status by trying the schemas declared for it.
@@ -42,7 +42,7 @@ Defaults without a schema-error policy. HTTP is a native `HttpApi`; MCP is a nat
42
42
 
43
43
  - Group names are unique within one `ActionHttp.make`. Action names are unique within a group. MCP tool names are unique within a group and within each Toolkit or MCP projection that serves it.
44
44
  - Adapters validate only the namespace they serve. HTTP does not check tool names; MCP does not check route names.
45
- - Each adapter builds only what it serves. A group with no HTTP actions is not built by `Http.layer`; a group with no tools is not built by MCP or Toolkit.
45
+ - Each adapter builds only what it serves. HTTP serves every action of a group it binds, so `Http.layer` builds every implementation it is given (except a group without actions); a group with no tools is not built by MCP or Toolkit.
46
46
 
47
47
  ## Observability
48
48
 
@@ -51,9 +51,9 @@ Defaults without a schema-error policy. HTTP is a native `HttpApi`; MCP is a nat
51
51
 
52
52
  ## MCP transport
53
53
 
54
- - `protocols` is required. Effect owns negotiation, revision rejection, and session lifecycle; the adapter forwards the selection unchanged. `[McpProtocol.v2026_07_28]` is a stateless endpoint.
55
- - `layerHttp` is single-endpoint Streamable HTTP, never two-endpoint HTTP+SSE, whatever revision is selected.
56
- - Cancellation is Effect's native RPC interruption.
54
+ - MCP 2026-07-28 is the only revision served, on both transports; there is no option to select another. Effect owns version checks and rejects other revisions. Over HTTP the endpoint is stateless: no initialize handshake and no session.
55
+ - `layerHttp` is single-endpoint Streamable HTTP, never two-endpoint HTTP+SSE.
56
+ - Cancellation is Effect's native RPC interruption. Without an HTTP session, `notifications/cancelled` interrupts nothing over HTTP; a call ends with its request.
57
57
  - Each endpoint or subprocess owns a fresh native tool registry. That isolates names, not application context.
58
58
 
59
59
  ## Scope
package/docs/setup.md CHANGED
@@ -5,12 +5,12 @@ Install, version pins, entry points, and the boundaries of the package.
5
5
  ## Install
6
6
 
7
7
  ```sh
8
- pnpm add @gjermundgaraba/effect-actions effect@4.0.0-rc.116
8
+ pnpm add @gjermundgaraba/effect-actions effect@4.0.0-rc.117
9
9
  ```
10
10
 
11
11
  | Need | Add |
12
12
  | ------------------------------ | ----------------------------------------------------- |
13
- | Node HTTP server or stdio host | `@effect/platform-node@4.0.0-rc.116` |
13
+ | Node HTTP server or stdio host | `@effect/platform-node@4.0.0-rc.117` |
14
14
  | `TestingClient.withMcpClient` | `@modelcontextprotocol/client@^2.0.0` (optional peer) |
15
15
 
16
16
  Node `^22.12.0 || ^24.0.0 || >=26.0.0`. ESM only.
@@ -23,6 +23,7 @@ There is no package root. Import one module per subpath, as a namespace:
23
23
  import * as Action from "@gjermundgaraba/effect-actions/Action";
24
24
  import * as ActionGroup from "@gjermundgaraba/effect-actions/ActionGroup";
25
25
  import * as ActionHttp from "@gjermundgaraba/effect-actions/ActionHttp";
26
+ import * as ActionHttpClient from "@gjermundgaraba/effect-actions/ActionHttpClient";
26
27
  import * as ActionMcp from "@gjermundgaraba/effect-actions/ActionMcp";
27
28
  import * as ActionToolkit from "@gjermundgaraba/effect-actions/ActionToolkit";
28
29
  import * as ActionCatalog from "@gjermundgaraba/effect-actions/ActionCatalog";
@@ -39,11 +40,11 @@ and `TestingClient` is the only module that imports the optional `@modelcontextp
39
40
  peer. Because there is no package root, importing a contract module never pulls in an MCP
40
41
  server or the peer.
41
42
 
42
- Companion Effect modules you will import alongside: `effect/unstable/httpapi` (`HttpApiClient`, `OpenApi`, `HttpApiSwagger`, `HttpApiScalar`), `effect/unstable/http` (`HttpRouter`, `HttpServerResponse`, `FetchHttpClient`), `effect/unstable/ai` (`McpProtocol`), `effect/unstable/cli` (`Command`, `Flag`, `Argument`).
43
+ Companion Effect modules you will import alongside: `effect/unstable/httpapi` (`HttpApiClient`, `OpenApi`, `HttpApiSwagger`, `HttpApiScalar`), `effect/unstable/http` (`HttpRouter`, `HttpServerResponse`, `FetchHttpClient`, `HttpClientError`), `effect/unstable/cli` (`Command`, `Flag`, `Argument`).
43
44
 
44
45
  ## Rules
45
46
 
46
- - Pin `effect` to the exact release candidate the package declares as peer. Mixed rc versions fail at the type level in ways that look like library bugs.
47
+ - Install a single `effect` version within the peer range, and keep every `@effect/*` package on that same release candidate. Mixed rc versions fail at the type level in ways that look like library bugs.
47
48
  - Never import from `dist/` paths or from a package root. Only the subpaths above are public.
48
49
  - Schemas passed to `Action.make` must be service-free (`Schema.Codec<_, _, never, never>`). Handlers may require services.
49
50
 
@@ -52,12 +53,12 @@ Companion Effect modules you will import alongside: `effect/unstable/httpapi` (`
52
53
  What the package does, and nothing else:
53
54
 
54
55
  - HTTP means JSON `POST` endpoints built on Effect's `HttpApi`. It is not Effect RPC.
55
- - MCP means one native `McpServer` `Tool` per action. There is no MCP SDK runtime dependency.
56
+ - MCP means one native `McpServer` `Tool` per action, over MCP 2026-07-28 only. There is no MCP SDK runtime dependency.
56
57
  - Actions are unary: one decoded input, one decoded success or one declared error. No streaming, uploads, prompts, resources, retries, or code-execution sandbox.
57
58
  - Authentication and authorization are the application's. The library provides the seams — `Authentication.middleware` for identity, one `before` hook per surface for the authorization rule, `access` for what that rule reads, each surface's `errors` for what a caller can decode — and no token verifier, error types or scopes of its own. Tool discovery is never filtered by actor.
58
59
 
59
60
  ## Failure modes
60
61
 
61
62
  - `Cannot find module '@gjermundgaraba/effect-actions'`: there is no root export. Import a subpath.
62
- - Type errors inside `effect/unstable/*` after install: `effect` version drift. Align to the peer pin.
63
+ - Type errors inside `effect/unstable/*` after install: `effect` version drift. Install one `effect` release candidate within the peer range for every package.
63
64
  - `@modelcontextprotocol/client` resolution errors in a server build: something imported `TestingClient`. Only tests should.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gjermundgaraba/effect-actions",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Define Effect action contracts once and project them onto HTTP, MCP, native Toolkits, catalogs, and CLIs.",
5
5
  "homepage": "https://github.com/gjermundgaraba/effect-actions#readme",
6
6
  "bugs": {
@@ -23,6 +23,7 @@
23
23
  "./ActionCliClient": "./dist/ActionCliClient.mjs",
24
24
  "./ActionGroup": "./dist/ActionGroup.mjs",
25
25
  "./ActionHttp": "./dist/ActionHttp.mjs",
26
+ "./ActionHttpClient": "./dist/ActionHttpClient.mjs",
26
27
  "./ActionMcp": "./dist/ActionMcp.mjs",
27
28
  "./ActionToolkit": "./dist/ActionToolkit.mjs",
28
29
  "./Authentication": "./dist/Authentication.mjs",
@@ -34,10 +35,10 @@
34
35
  "access": "public"
35
36
  },
36
37
  "devDependencies": {
37
- "@effect/platform-node": "4.0.0-rc.116",
38
+ "@effect/platform-node": "4.0.0-rc.117",
38
39
  "@modelcontextprotocol/client": "2.0.0",
39
40
  "@types/node": "26.6.2",
40
- "effect": "4.0.0-rc.116",
41
+ "effect": "4.0.0-rc.117",
41
42
  "tsx": "4.23.15",
42
43
  "typescript": "7.0.2",
43
44
  "vite": "npm:@voidzero-dev/vite-plus-core@0.3.3",
@@ -45,7 +46,7 @@
45
46
  },
46
47
  "peerDependencies": {
47
48
  "@modelcontextprotocol/client": "^2.0.0",
48
- "effect": "4.0.0-rc.116"
49
+ "effect": ">=4.0.0-rc.116 <4.0.0"
49
50
  },
50
51
  "peerDependenciesMeta": {
51
52
  "@modelcontextprotocol/client": {