@gjermundgaraba/effect-actions 0.28.0 → 0.30.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/dist/Action.d.mts +6 -6
- package/dist/Action.mjs +11 -11
- package/dist/ActionCli.d.mts +23 -23
- package/dist/ActionCli.mjs +4 -4
- package/dist/ActionHttp.d.mts +16 -16
- package/dist/ActionHttp.mjs +7 -7
- package/dist/ActionMcp.d.mts +8 -8
- package/dist/ActionMcp.mjs +8 -8
- package/dist/ActionRpc.d.mts +22 -22
- package/dist/ActionRpc.mjs +8 -8
- package/dist/ActionToolkit.d.mts +1 -1
- package/dist/ActionToolkit.mjs +3 -3
- package/dist/Authentication.d.mts +2 -2
- package/dist/Authentication.mjs +1 -1
- package/dist/Event.d.mts +4 -4
- package/dist/Event.mjs +3 -3
- package/dist/Webhook.d.mts +2 -0
- package/dist/Webhook.mjs +1 -0
- package/dist/authentication/provider.d.mts +15 -15
- package/dist/authentication/refusal.mjs +1 -1
- package/dist/cli/commands.d.mts +2 -2
- package/dist/cli/commands.mjs +5 -5
- package/dist/contract/authorizer.d.mts +1 -1
- package/dist/contract/call.d.mts +2 -2
- package/dist/contract/caller.d.mts +1 -1
- package/dist/contract/declared.d.mts +1 -1
- package/dist/contract/declared.mjs +1 -1
- package/dist/contract/feed.d.mts +1 -1
- package/dist/contract/feed.mjs +6 -6
- package/dist/contract/hub.d.mts +1 -1
- package/dist/contract/idempotency.d.mts +1 -1
- package/dist/contract/idempotency.mjs +4 -4
- package/dist/contract/implementation.d.mts +27 -27
- package/dist/contract/implementation.mjs +1 -1
- package/dist/contract/input-check.d.mts +3 -3
- package/dist/contract/listed.d.mts +1 -1
- package/dist/contract/listed.mjs +1 -1
- package/dist/contract/pages.d.mts +1 -1
- package/dist/contract/push.d.mts +2 -2
- package/dist/contract/push.mjs +2 -2
- package/dist/contract/receiving.d.mts +2 -2
- package/dist/contract/receiving.mjs +1 -1
- package/dist/contract/serving.mjs +2 -2
- package/dist/contract/subscribe.mjs +1 -1
- package/dist/contract/transient.mjs +1 -1
- package/dist/contract/watch.d.mts +1 -1
- package/dist/contract/watch.mjs +2 -2
- package/dist/contract/webhooks.d.mts +1 -1
- package/dist/http/client.d.mts +9 -9
- package/dist/http/client.mjs +1 -1
- package/dist/http/events.d.mts +6 -6
- package/dist/http/events.mjs +4 -4
- package/dist/http/placed.d.mts +3 -3
- package/dist/http/placed.mjs +5 -5
- package/dist/http/streamed.d.mts +2 -2
- package/dist/http/streamed.mjs +1 -1
- package/dist/http/watch.mjs +1 -1
- package/dist/mcp/bridge.mjs +8 -8
- package/dist/mcp/client.d.mts +10 -10
- package/dist/mcp/client.mjs +4 -4
- package/dist/mcp/protocol.mjs +16 -4
- package/dist/mcp/reply.d.mts +1 -1
- package/dist/mcp/watch.mjs +4 -4
- package/dist/webhook/stored.mjs +1 -1
- package/dist/webhook/subscriptions.mjs +8 -5
- package/docs/setup.md +1 -1
- package/package.json +11 -12
package/dist/http/client.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
import { Any, VerifierError } from "../authentication/provider.mjs";
|
|
2
|
+
import { Any as Any$1, Errors } from "../Action.mjs";
|
|
3
|
+
import { Call } from "../contract/call.mjs";
|
|
1
4
|
import { Codec } from "../contract/codec.mjs";
|
|
2
5
|
import { BuiltIns } from "../contract/errors.mjs";
|
|
3
|
-
import { Any, Received, SubscriptionError, WatchOptions } from "../Event.mjs";
|
|
6
|
+
import { Any as Any$2, Received, SubscriptionError, WatchOptions } from "../Event.mjs";
|
|
4
7
|
import "../contract/implementation.mjs";
|
|
5
|
-
import { Call } from "../contract/call.mjs";
|
|
6
|
-
import { Answer, StreamOf } from "../contract/stream.mjs";
|
|
7
8
|
import "../contract/receiving.mjs";
|
|
9
|
+
import { Answer, StreamOf } from "../contract/stream.mjs";
|
|
8
10
|
import { WatchArgs, WatchRequirement } from "../contract/watch.mjs";
|
|
9
|
-
import { Any as Any$1, Errors } from "../Action.mjs";
|
|
10
|
-
import { Any as Any$2, VerifierError } from "../authentication/provider.mjs";
|
|
11
11
|
import { sentOf } from "./events.mjs";
|
|
12
12
|
import { Effect, Schema, Stream } from "effect";
|
|
13
13
|
import { HttpClient, HttpClientError } from "effect/http";
|
|
@@ -38,7 +38,7 @@ export interface Options<E = HttpClientError.HttpClientError, R = never> {
|
|
|
38
38
|
readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient.With<E, R>) | undefined;
|
|
39
39
|
}
|
|
40
40
|
type BindingError = Errors[number];
|
|
41
|
-
type SseFailure = Extract<Stream.Error<HttpApiClient.SuccessType<ReturnType<typeof sentOf<Any>>>>, {
|
|
41
|
+
type SseFailure = Extract<Stream.Error<HttpApiClient.SuccessType<ReturnType<typeof sentOf<Any$2>>>>, {
|
|
42
42
|
readonly _tag: "SseError" | "Retry";
|
|
43
43
|
}>;
|
|
44
44
|
type SseError = Extract<SseFailure, {
|
|
@@ -59,9 +59,9 @@ type Method<A extends Any$1, E extends BindingError, CE, CR> = Call<A, Answer<A[
|
|
|
59
59
|
* types.
|
|
60
60
|
*/
|
|
61
61
|
export interface AnyHttp {
|
|
62
|
-
readonly authentication?: Any
|
|
62
|
+
readonly authentication?: Any | undefined;
|
|
63
63
|
readonly actions: readonly Any$1[];
|
|
64
|
-
readonly events: readonly Any[];
|
|
64
|
+
readonly events: readonly Any$2[];
|
|
65
65
|
readonly error: readonly BindingError[];
|
|
66
66
|
readonly prefix: `/${string}`;
|
|
67
67
|
readonly api: HttpApi.Constraint;
|
|
@@ -71,7 +71,7 @@ export interface AnyHttp {
|
|
|
71
71
|
* a refusal ending it later, an `Event.SubscriptionError` where it is not served, a native
|
|
72
72
|
* `HttpClientError` that no reconnect outlasts, or a stream or an occurrence that does not decode.
|
|
73
73
|
*/
|
|
74
|
-
export type WatchError<W extends Any, H extends AnyHttp> = SubscriptionError | BuiltIns["Type"] | H["error"][number]["Type"] | VerifierError<W, H["authentication"]>["Type"] | HttpClientError.HttpClientError | Schema.SchemaError | SseError;
|
|
74
|
+
export type WatchError<W extends Any$2, H extends AnyHttp> = SubscriptionError | BuiltIns["Type"] | H["error"][number]["Type"] | VerifierError<W, H["authentication"]>["Type"] | HttpClientError.HttpClientError | Schema.SchemaError | SseError;
|
|
75
75
|
type Watching<H extends AnyHttp, E, R> = [H["events"][number]] extends [never] ? unknown : {
|
|
76
76
|
readonly watch: <W extends H["events"][number], SE = never, const O extends WatchOptions<unknown> = {}>(event: W, ...args: WatchArgs<W, SE, O>) => Stream.Stream<Received<W>, WatchError<W, H> | E | SE, R | WatchRequirement<O>>;
|
|
77
77
|
};
|
package/dist/http/client.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { elementOf } from "../contract/stream.mjs";
|
|
2
1
|
import { checked, checkedStream, sendingValue, watchInput } from "../contract/call.mjs";
|
|
2
|
+
import { elementOf } from "../contract/stream.mjs";
|
|
3
3
|
import { watching } from "../contract/watch.mjs";
|
|
4
4
|
import { readElements, readWithProgress } from "./streamed.mjs";
|
|
5
5
|
import { transportOf } from "./watch.mjs";
|
package/dist/http/events.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "../contract/codec.mjs";
|
|
2
|
-
import { Forbidden, Unauthenticated } from "../contract/errors.mjs";
|
|
3
1
|
import { OccurrenceSchema } from "../contract/occurrence.mjs";
|
|
2
|
+
import { Forbidden, Unauthenticated } from "../contract/errors.mjs";
|
|
3
|
+
import "../contract/codec.mjs";
|
|
4
4
|
import "../contract/pages.mjs";
|
|
5
|
-
import "../contract/feed.mjs";
|
|
6
|
-
import { Any } from "../Event.mjs";
|
|
7
|
-
import "../contract/subscribe.mjs";
|
|
8
|
-
import "../Action.mjs";
|
|
9
5
|
import "../authentication/provider.mjs";
|
|
6
|
+
import "../Action.mjs";
|
|
7
|
+
import { Any } from "../Event.mjs";
|
|
8
|
+
import "../contract/feed.mjs";
|
|
10
9
|
import "../contract/push.mjs";
|
|
10
|
+
import "../contract/subscribe.mjs";
|
|
11
11
|
import "../contract/webhooks.mjs";
|
|
12
12
|
import { Effect, Option, Schema, Stream } from "effect";
|
|
13
13
|
import { HttpApiEndpoint, HttpApiSchema } from "effect/http-api";
|
package/dist/http/events.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { principalOf } from "../contract/caller.mjs";
|
|
2
|
-
import { Refusal } from "../contract/errors.mjs";
|
|
3
|
-
import { declared } from "../contract/status.mjs";
|
|
4
2
|
import { assertDistinctTags } from "../contract/declared.mjs";
|
|
5
|
-
import {
|
|
3
|
+
import { Refusal } from "../contract/errors.mjs";
|
|
6
4
|
import { SubscriptionError } from "../Event.mjs";
|
|
7
|
-
import {
|
|
5
|
+
import { OccurrenceOf } from "../contract/occurrence.mjs";
|
|
8
6
|
import { PushedOf, SubscriptionOf, queuedPush } from "../contract/push.mjs";
|
|
7
|
+
import { declared } from "../contract/status.mjs";
|
|
9
8
|
import { Subscribed, WebhookCancellationOf, WebhookSubscriptionOf } from "../contract/subscribe.mjs";
|
|
9
|
+
import { webhookSubscriber } from "../contract/webhooks.mjs";
|
|
10
10
|
import { Effect, Function, Schema, Stream } from "effect";
|
|
11
11
|
import { HttpServerRequest } from "effect/http";
|
|
12
12
|
import { HttpApiEndpoint, HttpApiSchema, OpenApi } from "effect/http-api";
|
package/dist/http/placed.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { Any } from "../Action.mjs";
|
|
2
|
+
import { Any as Any$1 } from "../Event.mjs";
|
|
1
3
|
import { EventImplementation } from "../contract/feed.mjs";
|
|
2
|
-
import { Any } from "../Event.mjs";
|
|
3
4
|
import { Implementation } from "../contract/implementation.mjs";
|
|
4
|
-
import { Any as Any$1 } from "../Action.mjs";
|
|
5
5
|
import { AnyHttp } from "./client.mjs";
|
|
6
6
|
import { HttpClient } from "effect/http";
|
|
7
7
|
type Contract<H extends AnyHttp> = H["actions"][number] | H["events"][number];
|
|
8
|
-
type Nothing<C extends Any
|
|
8
|
+
type Nothing<C extends Any | Any$1> = { readonly [K in C["name"]]: never; };
|
|
9
9
|
/**
|
|
10
10
|
* What `placed` returns: an implementation of the binding's actions where it has some, and one of
|
|
11
11
|
* its event types where it has some, which require nothing.
|
package/dist/http/placed.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { allowAll } from "../Action.mjs";
|
|
2
|
+
import { SubscriptionError, allowAll as allowAll$1 } from "../Event.mjs";
|
|
2
3
|
import { EventImplementation } from "../contract/feed.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { isNotFound } from "./watch.mjs";
|
|
4
|
+
import { Implementation, memoized } from "../contract/implementation.mjs";
|
|
5
5
|
import { sendersWith } from "./client.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { isNotFound } from "./watch.mjs";
|
|
7
7
|
import { Context, Effect, Option, Predicate, Schema, Stream } from "effect";
|
|
8
8
|
import { Headers, HttpClient, HttpClientRequest, HttpServerRequest } from "effect/http";
|
|
9
9
|
// src/http/placed.ts
|
|
@@ -66,6 +66,6 @@ const placed = (binding, client) => {
|
|
|
66
66
|
poll: (input, cursor) => transport(event, input).poll(cursor).pipe(Effect.provideService(Sending, sendingTo(input, event)), Effect.catchIf(isNotServed, () => Effect.die(notServedThere(event.name)))),
|
|
67
67
|
stream: (input, cursor) => transport(event, input).stream(cursor).pipe(Stream.provideService(Sending, sendingTo(input, event)), Stream.catchIf(isNotServed, () => Stream.die(notServedThere(event.name))))
|
|
68
68
|
});
|
|
69
|
-
return [...binding.actions.length === 0 ? [] : [new Implementation(binding.actions, memoized(Effect.map(senders, (built) => binding.actions.map((action) => [action, handlerOf(built, action)]))), memoized(Effect.succeed(allowAll
|
|
69
|
+
return [...binding.actions.length === 0 ? [] : [new Implementation(binding.actions, memoized(Effect.map(senders, (built) => binding.actions.map((action) => [action, handlerOf(built, action)]))), memoized(Effect.succeed(allowAll)))], ...binding.events.length === 0 ? [] : [new EventImplementation(binding.events, binding.events.map((event) => [event, memoized(Effect.map(senders, (built) => runOf(built, event)))]), memoized(Effect.succeed(allowAll$1)))]];
|
|
70
70
|
};
|
|
71
71
|
export { placed };
|
package/dist/http/streamed.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Any } from "../Action.mjs";
|
|
1
2
|
import { Codec } from "../contract/codec.mjs";
|
|
2
|
-
import "../contract/progress.mjs";
|
|
3
3
|
import { ErasedValue } from "../contract/implementation.mjs";
|
|
4
|
+
import "../contract/progress.mjs";
|
|
4
5
|
import { StreamOf } from "../contract/stream.mjs";
|
|
5
|
-
import { Any } from "../Action.mjs";
|
|
6
6
|
import { Effect, Schema, Stream } from "effect";
|
|
7
7
|
import { HttpApiSchema } from "effect/http-api";
|
|
8
8
|
interface Sent {
|
package/dist/http/streamed.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Progressed, answerFrom, elementsFrom } from "../contract/progress.mjs";
|
|
2
1
|
import { elementsOf } from "../contract/implementation.mjs";
|
|
2
|
+
import { Progressed, answerFrom, elementsFrom } from "../contract/progress.mjs";
|
|
3
3
|
import { concealed } from "../contract/reported.mjs";
|
|
4
4
|
import { Cause, Effect, ErrorReporter, Queue, Schema, Stream } from "effect";
|
|
5
5
|
import { HttpServerRequest } from "effect/http";
|
package/dist/http/watch.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { fedOf } from "../contract/pages.mjs";
|
|
2
1
|
import { NotServed, SubscriptionError } from "../Event.mjs";
|
|
2
|
+
import { fedOf } from "../contract/pages.mjs";
|
|
3
3
|
import { Receiving, webhookFed } from "../contract/receiving.mjs";
|
|
4
4
|
import { answeredStatus, failingWhenUnanswered, isTransient, receivedFrom } from "../contract/transient.mjs";
|
|
5
5
|
import { Effect, Predicate, Stream } from "effect";
|
package/dist/mcp/bridge.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { promote } from "../authentication/provider.mjs";
|
|
2
|
+
import { recordStepUp } from "../authentication/refusal.mjs";
|
|
2
3
|
import { inputParseOptions } from "../contract/call.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { encodeUntaggedOf } from "../contract/occurrence.mjs";
|
|
5
|
-
import { acquireFeeds, unkeyedHook } from "../contract/feed.mjs";
|
|
6
|
-
import { NotServed, SubscriptionError, Unsupported } from "../Event.mjs";
|
|
4
|
+
import { Anyone, principalOf } from "../contract/caller.mjs";
|
|
7
5
|
import { sentError } from "../contract/codes.mjs";
|
|
8
|
-
import {
|
|
6
|
+
import { NotServed, SubscriptionError, Unsupported } from "../Event.mjs";
|
|
7
|
+
import { acquireFeeds, unkeyedHook } from "../contract/feed.mjs";
|
|
8
|
+
import { encodeUntaggedOf } from "../contract/occurrence.mjs";
|
|
9
9
|
import { pushed, refusalIn } from "../contract/push.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
10
|
+
import { reported } from "../contract/reported.mjs";
|
|
11
|
+
import { Webhooks, offersWebhook, servedWebhooks, webhookSubscriber } from "../contract/webhooks.mjs";
|
|
12
12
|
import { Active, EventsError, Failed, Heartbeat, Notifications, Occurred, Requests, Terminated, codes, extension, subscriptionIdKey } from "./events.mjs";
|
|
13
13
|
import { isObjectSchema, toolJsonSchema } from "./protocol.mjs";
|
|
14
14
|
import { Cause, Context, Duration, Effect, Exit, Match, Option, Predicate, Result, Schema } from "effect";
|
package/dist/mcp/client.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Any
|
|
1
|
+
import { Any, VerifierError } from "../authentication/provider.mjs";
|
|
2
|
+
import { Any as Any$1 } from "../Action.mjs";
|
|
3
3
|
import { Call } from "../contract/call.mjs";
|
|
4
|
+
import { BuiltIn } from "../contract/errors.mjs";
|
|
5
|
+
import { Any as Any$2, Received, SubscriptionError, WatchOptions } from "../Event.mjs";
|
|
4
6
|
import { Answer } from "../contract/stream.mjs";
|
|
5
7
|
import { WatchArgs, WatchRequirement } from "../contract/watch.mjs";
|
|
6
|
-
import { Any as Any$1 } from "../Action.mjs";
|
|
7
|
-
import { Any as Any$2, VerifierError } from "../authentication/provider.mjs";
|
|
8
8
|
import { McpCallError } from "./reply.mjs";
|
|
9
9
|
import { Effect, Schema, Stream } from "effect";
|
|
10
10
|
import { HttpClient, HttpClientError } from "effect/http";
|
|
@@ -12,7 +12,7 @@ import { HttpClient, HttpClientError } from "effect/http";
|
|
|
12
12
|
* Where `client` sends, through what client, and what the endpoint's authentication declares: the
|
|
13
13
|
* client `transformClient` returns may fail with `E` and require `R`.
|
|
14
14
|
*/
|
|
15
|
-
export interface ClientOptions<D extends Any
|
|
15
|
+
export interface ClientOptions<D extends Any | undefined = Any | undefined, E = HttpClientError.HttpClientError, R = never> {
|
|
16
16
|
/**
|
|
17
17
|
* The endpoint, resolved by the `HttpClient`: relative under `Testing.layer`. Defaults to `/mcp`,
|
|
18
18
|
* the default `layerHttp` path, so a call to an endpoint on another `path` fails with an
|
|
@@ -33,15 +33,15 @@ export interface ClientOptions<D extends Any$2 | undefined = Any$2 | undefined,
|
|
|
33
33
|
readonly authentication?: D;
|
|
34
34
|
}
|
|
35
35
|
type CallError<A extends Any$1, D> = A["error"][number]["Type"] | VerifierError<A, D>["Type"] | BuiltIn | Schema.SchemaError | HttpClientError.HttpClientError | McpCallError;
|
|
36
|
-
type WatchError<W extends Any, D> = SubscriptionError | BuiltIn | VerifierError<W, D>["Type"] | Schema.SchemaError | HttpClientError.HttpClientError | McpCallError;
|
|
36
|
+
type WatchError<W extends Any$2, D> = SubscriptionError | BuiltIn | VerifierError<W, D>["Type"] | Schema.SchemaError | HttpClientError.HttpClientError | McpCallError;
|
|
37
37
|
/**
|
|
38
38
|
* Every action of `Contracts` as `client.<action>(input)`, calling its tool; one answering a
|
|
39
39
|
* stream returns a `Stream` of the elements its tool collected. Where it lists event types,
|
|
40
40
|
* `watch(event, input, options)` subscribes to one. Each call and watch also fails with `E` and
|
|
41
41
|
* requires `R`, what its `transformClient` adds.
|
|
42
42
|
*/
|
|
43
|
-
export type Client<Contracts extends ReadonlyArray<Any$1 | Any>, D = undefined, E = never, R = never> = { readonly [A in Extract<Contracts[number], Any$1> as A["name"]]: Call<A, Answer<A["success"], CallError<A, D> | E, R>>; } & Watching<Extract<Contracts[number], Any>, D, E, R>;
|
|
44
|
-
type Watching<Listed extends Any, D, E, R> = [Listed] extends [never] ? unknown : {
|
|
43
|
+
export type Client<Contracts extends ReadonlyArray<Any$1 | Any$2>, D = undefined, E = never, R = never> = { readonly [A in Extract<Contracts[number], Any$1> as A["name"]]: Call<A, Answer<A["success"], CallError<A, D> | E, R>>; } & Watching<Extract<Contracts[number], Any$2>, D, E, R>;
|
|
44
|
+
type Watching<Listed extends Any$2, D, E, R> = [Listed] extends [never] ? unknown : {
|
|
45
45
|
readonly watch: <W extends Listed, SE = never, const O extends WatchOptions<unknown> = {}>(event: W, ...args: WatchArgs<W, SE, O>) => Stream.Stream<Received<W>, WatchError<W, D> | E | SE, R | WatchRequirement<O>>;
|
|
46
46
|
};
|
|
47
47
|
/**
|
|
@@ -65,6 +65,6 @@ type Watching<Listed extends Any, D, E, R> = [Listed] extends [never] ? unknown
|
|
|
65
65
|
* - A watch reconnects after the transport fails, a status such as 503, or 60 seconds without an answer or a frame, a second later and doubling to 30 seconds, each reconnect logged as a warning; any other failure ends it.
|
|
66
66
|
* - A call given `onProgress` sends a `progressToken` and reads each `notifications/progress` as its frame arrives; a call without one sends none, so the endpoint sends no progress.
|
|
67
67
|
*/
|
|
68
|
-
export declare function client<const Contracts extends ReadonlyArray<Any$1 | Any>, D extends Any
|
|
69
|
-
export declare function client<const Contracts extends ReadonlyArray<Any$1 | Any>, E, R, D extends Any
|
|
68
|
+
export declare function client<const Contracts extends ReadonlyArray<Any$1 | Any$2>, D extends Any | undefined = undefined>(contracts: Contracts, options?: ClientOptions<D>): Effect.Effect<Client<Contracts, D>, never, HttpClient.HttpClient>;
|
|
69
|
+
export declare function client<const Contracts extends ReadonlyArray<Any$1 | Any$2>, E, R, D extends Any | undefined = undefined>(contracts: Contracts, options: ClientOptions<D, E, R>): Effect.Effect<Client<Contracts, D, E, R>, never, HttpClient.HttpClient>;
|
|
70
70
|
export {};
|
package/dist/mcp/client.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { checked, checkedStream, sendingJson, watchInput } from "../contract/call.mjs";
|
|
1
2
|
import { Anyone } from "../contract/caller.mjs";
|
|
2
|
-
import { Refusal } from "../contract/errors.mjs";
|
|
3
3
|
import { projectedErrors } from "../contract/declared.mjs";
|
|
4
|
+
import { Refusal } from "../contract/errors.mjs";
|
|
5
|
+
import { liftOf } from "../contract/lift.mjs";
|
|
6
|
+
import { split } from "../contract/listed.mjs";
|
|
4
7
|
import { assertOnce } from "../contract/names.mjs";
|
|
5
8
|
import { progressSink } from "../contract/progress.mjs";
|
|
6
9
|
import { elementOf } from "../contract/stream.mjs";
|
|
7
|
-
import { checked, checkedStream, sendingJson, watchInput } from "../contract/call.mjs";
|
|
8
|
-
import { liftOf } from "../contract/lift.mjs";
|
|
9
|
-
import { split } from "../contract/listed.mjs";
|
|
10
10
|
import { watching } from "../contract/watch.mjs";
|
|
11
11
|
import { defaultPath, unliftedFrom } from "./protocol.mjs";
|
|
12
12
|
import { NoReply, NoStructuredContent, ProtocolError, StatusError, UndeclaredError, bodyOf, callError, failWith } from "./reply.mjs";
|
package/dist/mcp/protocol.mjs
CHANGED
|
@@ -21,13 +21,25 @@ const definitionsReferenced = (value) => {
|
|
|
21
21
|
return scope === "$defs" && key !== void 0 ? [key] : [];
|
|
22
22
|
});
|
|
23
23
|
};
|
|
24
|
+
const definitionReferenced = (schema) => {
|
|
25
|
+
const [scope, key] = Predicate.isString(schema["$ref"]) ? JsonPointer.parseUriFragment(schema["$ref"]) ?? [] : [];
|
|
26
|
+
return scope === "$defs" && key !== void 0 ? key : void 0;
|
|
27
|
+
};
|
|
28
|
+
const inlineRoot = (schema, definitions, inlined) => {
|
|
29
|
+
const key = schema === void 0 ? void 0 : definitionReferenced(schema);
|
|
30
|
+
if (key === void 0) return [schema, inlined];
|
|
31
|
+
return inlined.includes(key) ? [void 0, inlined] : inlineRoot(definitions[key], definitions, [...inlined, key]);
|
|
32
|
+
};
|
|
33
|
+
const withoutUnreferenced = (root, definitions, inlined) => {
|
|
34
|
+
const referenced = new Set([root, ...Object.values(definitions)].flatMap((definition) => isJson(definition) ? definitionsReferenced(definition) : []));
|
|
35
|
+
const unreferenced = inlined.filter((name) => Object.hasOwn(definitions, name) && !referenced.has(name));
|
|
36
|
+
return unreferenced.length === 0 ? definitions : withoutUnreferenced(root, Object.fromEntries(Object.entries(definitions).filter(([name]) => !unreferenced.includes(name))), inlined);
|
|
37
|
+
};
|
|
24
38
|
const toolJsonSchema = (schema, strict) => {
|
|
25
39
|
const document = Schema.toJsonSchemaDocument(schema, { onExcessProperty: strict ? "error" : "ignore" });
|
|
26
|
-
const [
|
|
27
|
-
const inlined = scope === "$defs" && key !== void 0 ? key : void 0;
|
|
28
|
-
const root = inlined === void 0 ? document.schema : document.definitions[inlined];
|
|
40
|
+
const [root, inlined] = inlineRoot(document.schema, document.definitions, []);
|
|
29
41
|
if (root === void 0) return;
|
|
30
|
-
const definitions =
|
|
42
|
+
const definitions = withoutUnreferenced(root, document.definitions, inlined);
|
|
31
43
|
return Object.keys(definitions).length === 0 ? root : {
|
|
32
44
|
...root,
|
|
33
45
|
$defs: definitions
|
package/dist/mcp/reply.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "../contract/progress.mjs";
|
|
2
1
|
import "../Action.mjs";
|
|
2
|
+
import "../contract/progress.mjs";
|
|
3
3
|
import { Effect, Schema, Stream } from "effect";
|
|
4
4
|
import { HttpClientError } from "effect/http";
|
|
5
5
|
declare const StatusError_base: Schema.Class<StatusError, Schema.TaggedStruct<"StatusError", {
|
package/dist/mcp/watch.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { reasonOf } from "../contract/codes.mjs";
|
|
1
2
|
import { InvalidInput } from "../contract/errors.mjs";
|
|
2
|
-
import { isTransientStatus } from "../contract/status.mjs";
|
|
3
|
-
import { Checked, Gap, untaggedOccurrenceOf } from "../contract/occurrence.mjs";
|
|
4
3
|
import { defaultNextPoll } from "../contract/feed.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { Receiving, webhookFed } from "../contract/receiving.mjs";
|
|
4
|
+
import { Checked, Gap, untaggedOccurrenceOf } from "../contract/occurrence.mjs";
|
|
7
5
|
import { Failed, readOn } from "../contract/push.mjs";
|
|
6
|
+
import { Receiving, webhookFed } from "../contract/receiving.mjs";
|
|
7
|
+
import { isTransientStatus } from "../contract/status.mjs";
|
|
8
8
|
import { WebhookCallback, WebhookTarget } from "../contract/subscribe.mjs";
|
|
9
9
|
import { failingWhenSilent, failingWhenUnanswered, isTransient } from "../contract/transient.mjs";
|
|
10
10
|
import { Active, Failed as Failed$1, Heartbeat, Occurred, PollEvents, SubscribeEvents, Terminated, UnsubscribeEvents, WireError, codes } from "./events.mjs";
|
package/dist/webhook/stored.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { reported } from "../contract/reported.mjs";
|
|
2
1
|
import { CallbackUrl, WebhookSecret } from "../contract/callback.mjs";
|
|
2
|
+
import { reported } from "../contract/reported.mjs";
|
|
3
3
|
import { DeliveryStatus } from "../contract/subscribe.mjs";
|
|
4
4
|
import { Cause, Duration, Effect, Option, Queue, Schema, Semaphore } from "effect";
|
|
5
5
|
import { KeyValueStore } from "effect/persistence";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { canonicalInput } from "../contract/canonical.mjs";
|
|
2
|
-
import { reported } from "../contract/reported.mjs";
|
|
3
|
-
import { encodeUntaggedOf } from "../contract/occurrence.mjs";
|
|
4
|
-
import { CallbackFailed, NotSubscribed, SubscriptionError } from "../Event.mjs";
|
|
5
2
|
import { sentError } from "../contract/codes.mjs";
|
|
6
|
-
import {
|
|
3
|
+
import { CallbackFailed, NotSubscribed, SubscriptionError } from "../Event.mjs";
|
|
4
|
+
import { encodeUntaggedOf } from "../contract/occurrence.mjs";
|
|
7
5
|
import { pushed, refusalIn } from "../contract/push.mjs";
|
|
6
|
+
import { reported } from "../contract/reported.mjs";
|
|
8
7
|
import { checkedHost } from "./address.mjs";
|
|
9
8
|
import { attempt, challenged } from "./attempt.mjs";
|
|
10
9
|
import { deliveryHealth, failingForMs, healthOf, statusOf } from "./health.mjs";
|
|
10
|
+
import { randomToken, subscriptionId } from "./signing.mjs";
|
|
11
11
|
import { Cause, Clock, Context, DateTime, Deferred, Duration, Effect, Exit, Fiber, FiberMap, Match, Option, RcMap, Schedule, Schema, Scope, Semaphore, Stream } from "effect";
|
|
12
12
|
import { HttpRouter, HttpServerRequest } from "effect/http";
|
|
13
13
|
// src/webhook/subscriptions.ts
|
|
@@ -127,7 +127,10 @@ const makeWebhooks = (policy) => Effect.gen(function* () {
|
|
|
127
127
|
})).pipe(Effect.retry({
|
|
128
128
|
schedule: terminatedEnvelopeRetries,
|
|
129
129
|
while: (failure) => !failure.final
|
|
130
|
-
}), Effect.
|
|
130
|
+
}), Effect.catchIf((failure) => failure.final, () => Effect.void), Effect.ignore({
|
|
131
|
+
log: "Warn",
|
|
132
|
+
message: `Webhook subscription ${subscription.id} ended without its terminated notice delivered`
|
|
133
|
+
})));
|
|
131
134
|
};
|
|
132
135
|
const ended = (subscription) => Effect.sync(() => {
|
|
133
136
|
if (holds(subscription)) held.delete(subscription.id);
|
package/docs/setup.md
CHANGED
|
@@ -22,7 +22,7 @@ The `effect` peer admits the 4.1.x patches from the oldest whose APIs and behavi
|
|
|
22
22
|
|
|
23
23
|
Keep the tilde in `package.json`: `^4.1.1`, which npm writes for `effect@4.1.1`, admits a minor release outside the peer range. `npm install effect@~4.1.1` keeps it.
|
|
24
24
|
|
|
25
|
-
Node `>=26.
|
|
25
|
+
Node `>=26.13.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
|
|
|
27
27
|
```json
|
|
28
28
|
{
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjermundgaraba/effect-actions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.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,20 +52,19 @@
|
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@clanker-stuff/oxlint-config": "0.
|
|
56
|
-
"@effect/platform-node": "4.1.
|
|
57
|
-
"@effect/tsgo": "0.
|
|
58
|
-
"@effect/vitest": "4.1.
|
|
55
|
+
"@clanker-stuff/oxlint-config": "0.5.0",
|
|
56
|
+
"@effect/platform-node": "4.1.2",
|
|
57
|
+
"@effect/tsgo": "0.67.3",
|
|
58
|
+
"@effect/vitest": "4.1.2",
|
|
59
59
|
"@modelcontextprotocol/client": "2.4.0",
|
|
60
60
|
"@types/node": "26.6.6",
|
|
61
|
-
"effect": "4.1.
|
|
62
|
-
"oxfmt": "0.74.0",
|
|
61
|
+
"effect": "4.1.2",
|
|
63
62
|
"tsx": "4.23.15",
|
|
64
63
|
"typescript": "7.0.2",
|
|
65
|
-
"ultracite": "8.1.
|
|
66
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
67
|
-
"vite-plus": "1.
|
|
68
|
-
"vitest": "5.0
|
|
64
|
+
"ultracite": "8.1.1",
|
|
65
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.0",
|
|
66
|
+
"vite-plus": "1.5.0",
|
|
67
|
+
"vitest": "5.1.0"
|
|
69
68
|
},
|
|
70
69
|
"peerDependencies": {
|
|
71
70
|
"effect": "~4.1.1"
|
|
@@ -78,7 +77,7 @@
|
|
|
78
77
|
}
|
|
79
78
|
},
|
|
80
79
|
"engines": {
|
|
81
|
-
"node": ">=26.
|
|
80
|
+
"node": ">=26.13.0"
|
|
82
81
|
},
|
|
83
82
|
"scripts": {
|
|
84
83
|
"build": "vp pack",
|