apps 0.0.1-beta.9 → 0.0.1-beta.91
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 +56 -38
- package/framework-reference.json +1 -1
- package/js/chunk-3LEVTFD4.js +712 -0
- package/js/chunk-5FHWNLCI.js +88 -0
- package/js/{chunk-FL2QR3XW.js → chunk-5MDA7MKL.js} +338 -73
- package/js/chunk-6XQLA5NC.js +5047 -0
- package/js/{chunk-M3B3DE4K.js → chunk-74YVXBKY.js} +463 -218
- package/js/chunk-7PHHWYV4.js +335 -0
- package/js/chunk-DADXWWRZ.js +449 -0
- package/js/{chunk-27F7W2LG.js → chunk-DDHBUKXX.js} +18 -2
- package/js/{chunk-UK573G7W.js → chunk-EOPQ727L.js} +87 -51
- package/js/{chunk-5T57N25Q.js → chunk-GQ33QSNB.js} +583 -69
- package/js/{chunk-JU7VHODU.js → chunk-H72MEDMN.js} +65 -10
- package/js/chunk-I5C7FD5Z.js +171 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-IFJU5SYQ.js} +19082 -18402
- package/js/{chunk-VFZKSM3T.js → chunk-JPEUKEV4.js} +3 -3
- package/js/{chunk-KUMBKVJD.js → chunk-KLYSEHUD.js} +2 -2
- package/js/{chunk-RFVIONFX.js → chunk-KUCCHNVY.js} +123 -44
- package/js/chunk-OD3KFKZD.js +1617 -0
- package/js/{chunk-57RKNWL2.js → chunk-PD6I2SDG.js} +4 -4
- package/js/{chunk-72JNVHPK.js → chunk-PYQLOLOC.js} +4 -3
- package/js/{chunk-ODEIDRGW.js → chunk-QWQM3CLH.js} +795 -176
- package/js/{chunk-IJX4CYZO.js → chunk-TUMGL2OC.js} +228 -264
- package/js/{chunk-IPI4MFSN.js → chunk-XBG7HHXC.js} +2 -2
- package/js/chunk-XPRZTLHD.js +1915 -0
- package/js/chunk-YNJ5CZMJ.js +93 -0
- package/js/chunk-YRGL4QEF.js +49 -0
- package/js/{chunk-Z5M2LQOZ.js → chunk-YWFUWTUJ.js} +113 -58
- package/js/client.js +142 -78
- package/js/contracts.js +142 -21
- package/js/effect.js +18 -19
- package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
- package/js/graphql.js +49 -40
- package/js/host.js +85 -62
- package/js/index.js +165 -70
- package/js/mcp/effect.js +21 -21
- package/js/mcp.js +76 -56
- package/js/openapi.js +4189 -1411
- package/js/react.js +2 -3
- package/js/skills/effect.js +6 -3
- package/js/skills.js +208 -81
- package/js/storage/facet.js +1 -540
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +5 -4
- package/js/ui/serving.js +8605 -225
- package/package.json +3 -8
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +18 -0
- package/types/app-cache/src/index.d.ts +34 -2
- package/types/apps/src/contracts/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/app.d.ts +60 -11
- package/types/apps/src/contracts/cache.d.ts +20 -0
- package/types/apps/src/contracts/context.d.ts +60 -17
- package/types/apps/src/contracts/elicitation.d.ts +23 -7
- package/types/apps/src/contracts/events.d.ts +94 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/graphql.d.ts +2 -1
- package/types/apps/src/contracts/host.d.ts +1446 -17
- package/types/apps/src/contracts/icons.d.ts +28 -0
- package/types/apps/src/contracts/live.d.ts +2 -0
- package/types/apps/src/contracts/mcp.d.ts +81 -20
- package/types/apps/src/contracts/network.d.ts +120 -0
- package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
- package/types/apps/src/contracts/openapi.d.ts +41 -9
- package/types/apps/src/contracts/operations.d.ts +14 -7
- package/types/apps/src/contracts/placement.d.ts +102 -0
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +733 -81
- package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
- package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
- package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
- package/types/apps/src/contracts/protocols/2.d.ts +69 -26
- package/types/apps/src/contracts/protocols/3.d.ts +133 -33
- package/types/apps/src/contracts/protocols/4.d.ts +122 -45
- package/types/apps/src/contracts/protocols/5.d.ts +157 -47
- package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
- package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
- package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
- package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
- package/types/apps/src/contracts/protocols/current.d.ts +6669 -0
- package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
- package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/contracts/provider.d.ts +90 -6
- package/types/apps/src/contracts/schedules.d.ts +7 -1
- package/types/apps/src/contracts/schema.d.ts +21 -0
- package/types/apps/src/contracts/skills.d.ts +50 -13
- package/types/apps/src/contracts/sql.d.ts +63 -0
- package/types/apps/src/contracts/ui.d.ts +44 -14
- package/types/apps/src/contracts/webhooks.d.ts +24 -7
- package/types/apps/src/contracts/workflows.d.ts +19 -17
- package/types/apps/src/facet.d.ts +4 -5
- package/types/apps/src/host.d.ts +5 -0
- package/types/apps/src/implementation/account-router.d.ts +4 -3
- package/types/apps/src/implementation/app.d.ts +41 -14
- package/types/apps/src/implementation/authoring.d.ts +25 -5
- package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
- package/types/apps/src/implementation/cache.d.ts +29 -2
- package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
- package/types/apps/src/implementation/elicitation.d.ts +18 -15
- package/types/apps/src/implementation/events.d.ts +64 -0
- package/types/apps/src/implementation/failure-detail.d.ts +28 -5
- package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
- package/types/apps/src/implementation/graphql.d.ts +4 -3
- package/types/apps/src/implementation/input-problems.d.ts +6 -2
- package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-call.d.ts +6 -5
- package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
- package/types/apps/src/implementation/mcp-client.d.ts +17 -9
- package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
- package/types/apps/src/implementation/mcp.d.ts +20 -9
- package/types/apps/src/implementation/network.d.ts +16 -0
- package/types/apps/src/implementation/openapi-compile.d.ts +28 -7
- package/types/apps/src/implementation/openapi-document.d.ts +46 -19
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-request.d.ts +10 -2
- package/types/apps/src/implementation/openapi-source.d.ts +23 -1
- package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
- package/types/apps/src/implementation/operations.d.ts +57 -7
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/placement.d.ts +60 -0
- package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
- package/types/apps/src/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/provider.d.ts +19 -4
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +20 -18
- package/types/apps/src/implementation/router.d.ts +24 -5
- package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
- package/types/apps/src/implementation/schedules.d.ts +39 -8
- package/types/apps/src/implementation/schema.d.ts +98 -11
- package/types/apps/src/implementation/skills.d.ts +18 -24
- package/types/apps/src/implementation/sql.d.ts +71 -0
- package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +2 -2
- package/types/apps/src/implementation/ui-document.d.ts +5 -0
- package/types/apps/src/implementation/ui-errors.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +26 -9
- package/types/apps/src/implementation/ui-watch.d.ts +1 -1
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/apps/src/implementation/webhooks.d.ts +15 -6
- package/types/apps/src/implementation/workflow-context.d.ts +6 -2
- package/types/apps/src/implementation/workflows.d.ts +11 -4
- package/types/apps/src/index.d.ts +68 -19
- package/types/apps/src/mcp.d.ts +20 -1
- package/types/apps/src/openapi.d.ts +6 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +10 -8
- package/types/apps/src/ui-serving.d.ts +1 -1
- package/types/telemetry/src/app-records.d.ts +42 -0
- package/types/telemetry/src/browser-operations.d.ts +2 -2
- package/types/telemetry/src/browser.d.ts +8 -3
- package/types/telemetry/src/config.d.ts +2 -2
- package/types/telemetry/src/index.d.ts +2 -1
- package/types/telemetry/src/layer.d.ts +10 -4
- package/types/telemetry/src/measurements.d.ts +1 -1
- package/types/telemetry/src/ownership.d.ts +60 -0
- package/types/telemetry/src/recorded-failure.d.ts +29 -0
- package/types/telemetry/src/relay.d.ts +16 -6
- package/types/telemetry/src/span-attributes.d.ts +17 -1
- package/types/telemetry/src/transport.d.ts +8 -1
- package/types/utils/src/api-error.d.ts +55 -0
- package/types/utils/src/connection-failure.d.ts +33 -0
- package/types/utils/src/recorded-message.d.ts +18 -0
- package/types/utils/src/user-facing-error.d.ts +83 -0
- package/js/chunk-7EK2JDX4.js +0 -299
- package/js/chunk-IKS2C5MQ.js +0 -224
- package/js/chunk-MKWZPDR6.js +0 -63
- package/js/chunk-N7YDVXYJ.js +0 -186
- package/js/chunk-NKLWZJLE.js +0 -172
- package/js/chunk-PJJ24GU7.js +0 -877
- package/js/chunk-PZB6T6KU.js +0 -19
- package/js/chunk-R3EV5FTO.js +0 -97
- package/js/chunk-SJFZCGXG.js +0 -1243
- package/js/chunk-WLE7WX2U.js +0 -2645
- package/js/chunk-YXQHV65J.js +0 -242
- package/js/chunk-ZQINWV4W.js +0 -630
- package/js/mcp/stdio.js +0 -128
- package/types/app-data/src/implementation/cursor.d.ts +0 -10
- package/types/app-data/src/implementation/index-key.d.ts +0 -7
- package/types/app-data/src/implementation/promise.d.ts +0 -68
- package/types/app-data/src/implementation/range.d.ts +0 -8
- package/types/app-data/src/implementation/schema.d.ts +0 -18
- package/types/app-data/src/implementation/sqlite.d.ts +0 -11
- package/types/app-data/src/index.d.ts +0 -4
- package/types/apps/src/contracts/storage.d.ts +0 -68
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/implementation/storage.d.ts +0 -15
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Duration, Effect, Schema } from "effect";
|
|
2
|
-
import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
2
|
+
import type { AccountCredential, AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
3
|
import { JsonObject, type JsonValue } from "../contracts/schema.js";
|
|
4
4
|
export interface CatalogCacheOptions {
|
|
5
|
-
/**
|
|
5
|
+
/** The app's cache. An account's catalog is kept in that account's scope. */
|
|
6
6
|
readonly cache?: AppCache;
|
|
7
7
|
/** Reuse metadata for this duration. Defaults to five minutes. */
|
|
8
8
|
readonly freshFor?: Duration.Input;
|
|
@@ -11,14 +11,39 @@ export interface CatalogCacheOptions {
|
|
|
11
11
|
/** Await a fresh revision at an explicit logical connection or refresh boundary. */
|
|
12
12
|
readonly revalidate?: boolean;
|
|
13
13
|
}
|
|
14
|
+
/** Whose catalog a remote router reads, and the headers, such as credentials, it sends. */
|
|
15
|
+
export type CatalogAccount = AccountCredential<{
|
|
16
|
+
/** Headers for this account's requests, such as its credentials. */
|
|
17
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
18
|
+
}>;
|
|
19
|
+
/** Why a read cannot use its account's scope. */
|
|
20
|
+
export type CatalogScopeProblem = "missing-account" | "unselected-account";
|
|
21
|
+
/**
|
|
22
|
+
* The cache an account's catalog lives in: the account's own scope, which token renewals keep.
|
|
23
|
+
* `credential` is what the read sends, such as headers or a token; it never enters a key. A
|
|
24
|
+
* credential without an account, or an account the app was not given, fails with `invalid`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const catalogScope: <E>(options: {
|
|
27
|
+
readonly cache?: AppCache | undefined;
|
|
28
|
+
readonly account?: {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
} | undefined;
|
|
31
|
+
}, credential: unknown, invalid: (problem: CatalogScopeProblem) => E) => Effect.Effect<AppCache | undefined, E>;
|
|
14
32
|
/** One load: the tools, and optionally a record describing the whole catalog. */
|
|
15
33
|
export interface CatalogLoad<A> {
|
|
16
34
|
readonly tools: readonly A[];
|
|
17
35
|
readonly header?: JsonObject;
|
|
18
36
|
}
|
|
37
|
+
/** The catalog a refresh replaces, read only when its loader asks for it. */
|
|
38
|
+
export interface KeptCatalog<A> {
|
|
39
|
+
readonly header: JsonObject | undefined;
|
|
40
|
+
readonly tools: Effect.Effect<readonly A[], unknown>;
|
|
41
|
+
}
|
|
19
42
|
export declare const catalogCache: <A extends {
|
|
20
43
|
readonly name: string;
|
|
21
|
-
}, S>(options: CatalogCacheOptions & {
|
|
44
|
+
}, S>(options: Omit<CatalogCacheOptions, "cache"> & {
|
|
45
|
+
/** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
|
|
46
|
+
readonly cache: AppCache | undefined;
|
|
22
47
|
readonly prefix: readonly JsonValue[];
|
|
23
48
|
readonly schema: Schema.Decoder<A>;
|
|
24
49
|
/** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
|
|
@@ -26,7 +51,13 @@ export declare const catalogCache: <A extends {
|
|
|
26
51
|
readonly schema: Schema.Decoder<S>;
|
|
27
52
|
readonly of: (tool: A) => S;
|
|
28
53
|
};
|
|
29
|
-
|
|
54
|
+
/** Past `freshFor`, serve the kept catalog while refreshing, or refresh first. */
|
|
55
|
+
readonly stale?: "serve" | "revalidate";
|
|
56
|
+
/**
|
|
57
|
+
* Load the catalog. A refresh also gets the catalog it replaces, if one is kept, so a source
|
|
58
|
+
* that can confirm it is unchanged need not load it again.
|
|
59
|
+
*/
|
|
60
|
+
readonly load: (context?: CacheLoadContext, kept?: Effect.Effect<KeptCatalog<A> | undefined, unknown>) => Effect.Effect<CatalogLoad<A>, unknown>;
|
|
30
61
|
}) => Effect.Effect<{
|
|
31
62
|
list: () => Effect.Effect<readonly A[], unknown, never>;
|
|
32
63
|
/** The record stored with the current revision, if the source supplied one. */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** Validate both sides of a tool's form and bind delivery to its invocation lifetime. */
|
|
2
|
-
import { Effect, Schema } from "effect";
|
|
2
|
+
import { Effect, Schema, type Context } from "effect";
|
|
3
3
|
import { ElicitationFailed, type ElicitationHandler, type Elicit } from "../contracts/elicitation.js";
|
|
4
4
|
/** Parse a form and retain its response parser, so invalid answers can be rejected before consuming a host continuation. */
|
|
5
5
|
export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
@@ -12,15 +12,15 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
12
12
|
readonly [x: string]: {
|
|
13
13
|
readonly type: "string";
|
|
14
14
|
readonly enum: readonly string[];
|
|
15
|
-
readonly default?: string;
|
|
16
15
|
readonly description?: string;
|
|
16
|
+
readonly default?: string;
|
|
17
17
|
readonly title?: string;
|
|
18
18
|
readonly enumNames?: readonly string[];
|
|
19
19
|
} | {
|
|
20
20
|
readonly type: "string";
|
|
21
21
|
readonly enum: readonly string[];
|
|
22
|
-
readonly default?: string;
|
|
23
22
|
readonly description?: string;
|
|
23
|
+
readonly default?: string;
|
|
24
24
|
readonly title?: string;
|
|
25
25
|
} | {
|
|
26
26
|
readonly type: "string";
|
|
@@ -28,8 +28,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
28
28
|
readonly const: string;
|
|
29
29
|
readonly title: string;
|
|
30
30
|
}[];
|
|
31
|
-
readonly default?: string;
|
|
32
31
|
readonly description?: string;
|
|
32
|
+
readonly default?: string;
|
|
33
33
|
readonly title?: string;
|
|
34
34
|
} | {
|
|
35
35
|
readonly type: "array";
|
|
@@ -37,11 +37,11 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
37
37
|
readonly type: "string";
|
|
38
38
|
readonly enum: readonly string[];
|
|
39
39
|
};
|
|
40
|
-
readonly default?: readonly string[];
|
|
41
40
|
readonly description?: string;
|
|
42
|
-
readonly
|
|
41
|
+
readonly default?: readonly string[];
|
|
43
42
|
readonly minItems?: number;
|
|
44
43
|
readonly maxItems?: number;
|
|
44
|
+
readonly title?: string;
|
|
45
45
|
} | {
|
|
46
46
|
readonly type: "array";
|
|
47
47
|
readonly items: {
|
|
@@ -50,30 +50,30 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
50
50
|
readonly title: string;
|
|
51
51
|
}[];
|
|
52
52
|
};
|
|
53
|
-
readonly default?: readonly string[];
|
|
54
53
|
readonly description?: string;
|
|
55
|
-
readonly
|
|
54
|
+
readonly default?: readonly string[];
|
|
56
55
|
readonly minItems?: number;
|
|
57
56
|
readonly maxItems?: number;
|
|
57
|
+
readonly title?: string;
|
|
58
58
|
} | {
|
|
59
59
|
readonly type: "string";
|
|
60
|
+
readonly description?: string;
|
|
60
61
|
readonly default?: string;
|
|
61
62
|
readonly format?: "email" | "uri" | "date" | "date-time";
|
|
62
|
-
readonly description?: string;
|
|
63
|
-
readonly title?: string;
|
|
64
63
|
readonly minLength?: number;
|
|
65
64
|
readonly maxLength?: number;
|
|
65
|
+
readonly title?: string;
|
|
66
66
|
} | {
|
|
67
67
|
readonly type: "number" | "integer";
|
|
68
|
+
readonly description?: string;
|
|
68
69
|
readonly default?: number;
|
|
70
|
+
readonly minimum?: number;
|
|
69
71
|
readonly maximum?: number;
|
|
70
|
-
readonly description?: string;
|
|
71
72
|
readonly title?: string;
|
|
72
|
-
readonly minimum?: number;
|
|
73
73
|
} | {
|
|
74
74
|
readonly type: "boolean";
|
|
75
|
-
readonly default?: boolean;
|
|
76
75
|
readonly description?: string;
|
|
76
|
+
readonly default?: boolean;
|
|
77
77
|
readonly title?: string;
|
|
78
78
|
};
|
|
79
79
|
};
|
|
@@ -99,5 +99,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
99
99
|
} | undefined;
|
|
100
100
|
}, ElicitationFailed, never>;
|
|
101
101
|
}, ElicitationFailed, never>;
|
|
102
|
-
/**
|
|
103
|
-
|
|
102
|
+
/**
|
|
103
|
+
* Bind a validated interaction to the live invocation; transport adapters share its form parser.
|
|
104
|
+
* Authored code's Promise calls run in the invocation's telemetry, like framework callers.
|
|
105
|
+
*/
|
|
106
|
+
export declare const makeElicit: (handler: ElicitationHandler | undefined, signal: AbortSignal, telemetry: Context.Context<never>) => Elicit;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/** Event declarations and the per-invocation emitter. Emitted events leave in the reply. */
|
|
2
|
+
import { Effect, Schema as EffectSchema } from "effect";
|
|
3
|
+
import { EmittedEvent, type AppEvent, type EmitOptions } from "../contracts/events.js";
|
|
4
|
+
import { type Fields, type Infer, type ObjectValue, type Schema } from "./schema.js";
|
|
5
|
+
declare const Native: unique symbol;
|
|
6
|
+
/** An event an app emits. Declare it in `defineApp`'s requirements under `events`. */
|
|
7
|
+
export interface EventDeclaration<F extends Fields, P extends Schema<unknown, boolean>> {
|
|
8
|
+
readonly [Native]: AppEvent;
|
|
9
|
+
readonly description: string;
|
|
10
|
+
readonly filters: F;
|
|
11
|
+
readonly payload: P;
|
|
12
|
+
}
|
|
13
|
+
/** Any declared event, for requirement constraints. */
|
|
14
|
+
export type AnyEventDeclaration = EventDeclaration<Fields, Schema<unknown, boolean>>;
|
|
15
|
+
/**
|
|
16
|
+
* Declare an event. `filters` are scalar fields subscribers can narrow on, such as a repository;
|
|
17
|
+
* every emitted occurrence supplies their values. `payload` describes each occurrence's data.
|
|
18
|
+
*/
|
|
19
|
+
export declare const event: <const F extends Fields = {}, P extends Schema<unknown, boolean> = Schema<unknown>>(options: {
|
|
20
|
+
readonly description: string;
|
|
21
|
+
readonly filters?: F;
|
|
22
|
+
readonly payload: P;
|
|
23
|
+
}) => EventDeclaration<F, P>;
|
|
24
|
+
/** The native declaration retained by an author event. */
|
|
25
|
+
export declare const nativeEvent: (declaration: unknown) => AppEvent | undefined;
|
|
26
|
+
/** JSON Schema for each declared event, as the host reads it from requirements. */
|
|
27
|
+
export declare const declaredEvents: (events: Readonly<Record<string, AppEvent>>) => Effect.Effect<{
|
|
28
|
+
readonly [x: string]: {
|
|
29
|
+
readonly description: string;
|
|
30
|
+
readonly filters: {
|
|
31
|
+
readonly [x: string]: EffectSchema.Json;
|
|
32
|
+
};
|
|
33
|
+
readonly payload: {
|
|
34
|
+
readonly [x: string]: EffectSchema.Json;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
}, EffectSchema.SchemaError, never>;
|
|
38
|
+
/** Emit options typed by the event's filters: required exactly when it declares some. */
|
|
39
|
+
type OptionsFor<F extends Fields> = keyof F extends never ? [options?: Omit<EmitOptions<never>, "filters">] : [options: EmitOptions<ObjectValue<F>> & {
|
|
40
|
+
readonly filters: ObjectValue<F>;
|
|
41
|
+
}];
|
|
42
|
+
/** `ctx.events` in mutations and webhook handlers. */
|
|
43
|
+
export interface EventEmitter<Events extends Readonly<Record<string, AnyEventDeclaration>>> {
|
|
44
|
+
/**
|
|
45
|
+
* Record an occurrence. It is delivered only if this invocation succeeds. Invalid data, filters
|
|
46
|
+
* or options throw here, before anything is recorded.
|
|
47
|
+
*/
|
|
48
|
+
readonly emit: <Name extends keyof Events & string>(name: Name, data: Infer<Events[Name]["payload"]>, ...options: OptionsFor<Events[Name]["filters"]>) => void;
|
|
49
|
+
}
|
|
50
|
+
/** One invocation's buffer. The handler reads `emitted` only after the invocation succeeds. */
|
|
51
|
+
export declare const makeEmitter: (input: {
|
|
52
|
+
readonly events: Readonly<Record<string, AppEvent>>;
|
|
53
|
+
/** Every account ID bound to this invocation, which an emit may name. */
|
|
54
|
+
readonly accounts: readonly string[];
|
|
55
|
+
/**
|
|
56
|
+
* The caller's account IDs. An emit that names no account is attributed to the only one, if
|
|
57
|
+
* there is exactly one. App accounts never count: they are bound to every call.
|
|
58
|
+
*/
|
|
59
|
+
readonly attributable: readonly string[];
|
|
60
|
+
/** The webhook's source account, which an emit names by default. */
|
|
61
|
+
readonly sourceAccount?: string;
|
|
62
|
+
readonly emitted: EmittedEvent[];
|
|
63
|
+
}) => EventEmitter<Readonly<Record<string, AnyEventDeclaration>>>;
|
|
64
|
+
export {};
|
|
@@ -1,25 +1,48 @@
|
|
|
1
|
-
import { Redacted } from "effect";
|
|
2
|
-
import type
|
|
1
|
+
import { Option, Redacted } from "effect";
|
|
2
|
+
import { McpError as HostMcpError, SkillLoadFailed as HostSkillLoadFailed, type ResolvedAccounts } from "../contracts/host.js";
|
|
3
|
+
import type { ProviderError } from "../contracts/provider-error.js";
|
|
4
|
+
import { type FailureFields, type FailurePhase, type UpstreamError } from "../contracts/failure.js";
|
|
3
5
|
/** Fields of `FailureDetail` as constructor input. */
|
|
4
6
|
export interface FailureDetail {
|
|
5
7
|
readonly source?: "app" | "storage" | "service";
|
|
6
8
|
readonly errorName?: string;
|
|
7
9
|
readonly code?: string;
|
|
8
10
|
readonly message?: string;
|
|
11
|
+
readonly fields?: FailureFields;
|
|
9
12
|
}
|
|
10
13
|
/**
|
|
11
|
-
* Every credential field value of
|
|
12
|
-
*
|
|
14
|
+
* Every credential field value of an invocation's accounts by scope, longest first. The accounts
|
|
15
|
+
* may not have been checked yet, so each scope is read only when it is a slot-to-account record;
|
|
16
|
+
* each account keeps its credential values in `fields`.
|
|
13
17
|
*/
|
|
14
18
|
export declare const accountFieldSecrets: (accounts: unknown) => string[];
|
|
15
19
|
/** Every credential field value of an invocation's selected accounts. */
|
|
16
20
|
export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
|
|
17
21
|
/** Replace account secrets and bound the message for the runtime boundary. */
|
|
18
22
|
export declare const boundFailureMessage: (message: string, secrets: readonly string[]) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Replace account secrets in the error a service stated, as it leaves the bundle. A message
|
|
25
|
+
* shortened where it was read can end partway through a secret; that part is replaced too.
|
|
26
|
+
*/
|
|
27
|
+
export declare const redactUpstream: (upstream: UpstreamError | undefined, secrets: readonly string[]) => UpstreamError | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* A provider failure as it leaves the bundle: in the phase it happened, unless its raiser named a
|
|
30
|
+
* more precise one, with account secrets replaced in the error the service stated.
|
|
31
|
+
*/
|
|
32
|
+
export declare const leavingProviderError: (error: ProviderError, secrets: readonly string[], phase?: FailurePhase) => ProviderError;
|
|
33
|
+
/**
|
|
34
|
+
* Rebuild an MCP failure's allowlisted fields, with account secrets replaced in the server's
|
|
35
|
+
* error. Absent fields have no key, as catalogs cross the boundary as JSON values.
|
|
36
|
+
*/
|
|
37
|
+
export declare const parseMcpError: (error: unknown, secrets: readonly string[]) => Option.Option<HostMcpError>;
|
|
38
|
+
/** Rebuild only the allowlisted skill loader fields from an author-visible rejection. */
|
|
39
|
+
export declare const parseSkillLoadFailed: (error: unknown) => Option.Option<HostSkillLoadFailed>;
|
|
19
40
|
/** `Name: message` for any thrown value, before redaction. */
|
|
20
41
|
export declare const describeFailure: (error: unknown) => string;
|
|
21
42
|
/**
|
|
22
43
|
* Describe what an operation raised for the app's own caller. App data failures keep their
|
|
23
|
-
* reason as a code
|
|
44
|
+
* reason as a code, as do app cache failures and OpenAPI and MCP service failures, such as an
|
|
45
|
+
* `mcpHealth` check that cannot reach its server or cannot verify the credentials; any other thrown
|
|
46
|
+
* value is the app's own error, with its own code and scalar fields. Account secrets are replaced.
|
|
24
47
|
*/
|
|
25
48
|
export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { GraphqlToolsOptions } from "../contracts/graphql.js";
|
|
3
|
-
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
3
|
+
import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
|
|
4
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
/** An endpoint, the account whose schema it is, and the metadata policy. */
|
|
6
|
+
export type GraphqlCatalogOptions = Omit<GraphqlToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
|
|
7
7
|
export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** Discover GraphQL tools live; transport, decoding and cancellation stay in Effect. */
|
|
3
4
|
import { Effect, Schema } from "effect";
|
|
4
5
|
import { OperationTypeNode } from "graphql";
|
|
@@ -8,7 +9,7 @@ import { JsonObject } from "../effect.js";
|
|
|
8
9
|
export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect.Effect<{
|
|
9
10
|
request: (phase: "discover" | "call", query: string, variables?: JsonObject) => Effect.Effect<{
|
|
10
11
|
readonly [x: string]: Schema.Json;
|
|
11
|
-
}, ProviderError | GraphqlError, never>;
|
|
12
|
+
}, ProviderError | NetworkRefused | GraphqlError, never>;
|
|
12
13
|
discover: Effect.Effect<{
|
|
13
14
|
readonly __schema: {
|
|
14
15
|
readonly queryType: {
|
|
@@ -42,7 +43,7 @@ export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect
|
|
|
42
43
|
}[] | null;
|
|
43
44
|
}[];
|
|
44
45
|
};
|
|
45
|
-
}, ProviderError | GraphqlError, never>;
|
|
46
|
+
}, ProviderError | NetworkRefused | GraphqlError, never>;
|
|
46
47
|
}, GraphqlError, never>;
|
|
47
48
|
/** Build serializable definitions once per introspection revision, without compiling validators. */
|
|
48
49
|
export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effect.Effect<{
|
|
@@ -80,4 +81,4 @@ export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effe
|
|
|
80
81
|
/** Bind only the selected definition to current credentials and compile its input decoder. */
|
|
81
82
|
export declare const adaptGraphqlTool: (client: Effect.Success<ReturnType<typeof graphqlClientEffect>>, definition: GraphqlToolDefinition) => Effect.Effect<import("../contracts/graphql.js").GraphqlTool, GraphqlError, never>;
|
|
82
83
|
/** Low-level callers can still request a complete invocation-owned tool map. */
|
|
83
|
-
export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError>;
|
|
84
|
+
export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError | NetworkRefused>;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { HostInputInvalid } from "../contracts/host.js";
|
|
2
|
-
/**
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Failing input paths and what each expects, from a schema decode failure, without supplied
|
|
4
|
+
* values. An expected object names its keys, so a caller can correct nesting from the problem.
|
|
5
|
+
* A missing key also asks about a place where `input`, the rejected input, may have that key.
|
|
6
|
+
*/
|
|
7
|
+
export declare const inputInvalid: (error: unknown, input: unknown) => HostInputInvalid;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Divide a tool invocation's time, on its own isolate's clock, by who the work belonged to:
|
|
3
|
+
* Executor, the app's authored code, upstream providers, a person answering an elicitation, or
|
|
4
|
+
* another call loading a cache entry this one waits for. Background work no caller waits on runs
|
|
5
|
+
* beside the division and is reported apart.
|
|
6
|
+
* Each boundary declares its owner where the work starts (see `owned`); the invocation's own span is
|
|
7
|
+
* Executor's. The host adds the other isolates' parts.
|
|
8
|
+
*/
|
|
9
|
+
import { Effect } from "effect";
|
|
10
|
+
/** The span `makeElicit` opens while a person answers. */
|
|
11
|
+
export declare const elicitationWaitSpan = "app.elicitation.wait";
|
|
12
|
+
/** The span around each workflow control an app calls, which Executor answers. */
|
|
13
|
+
export declare const workflowControlSpan = "app.workflow.control";
|
|
14
|
+
/**
|
|
15
|
+
* Run a tool operation in its `app.<operation>` span and time it from the span's own start to its
|
|
16
|
+
* own end. The span records each part, and the isolated handler returns them to the host.
|
|
17
|
+
*/
|
|
18
|
+
export declare const timedInvocation: (operation: "call" | "query" | "mutate") => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, import("effect/Tracer").ParentSpan>>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Atom } from "effect/
|
|
1
|
+
import { Atom } from "effect/reactivity";
|
|
2
2
|
import { AppQueryFailed, type OperationReference, type QueryTransport } from "../contracts/live.js";
|
|
3
3
|
import type { Operation } from "./operations.js";
|
|
4
4
|
import { type Schema } from "./schema.js";
|
|
@@ -14,5 +14,5 @@ export declare const mutationReference: <Mutation>(name: Mutation extends Operat
|
|
|
14
14
|
export declare const liveQueryAtom: <Input, Output>(reference: OperationReference<Input, Output, "query">, input: NoInfer<Input>, options: {
|
|
15
15
|
readonly output: Schema<NoInfer<Output>, boolean>;
|
|
16
16
|
readonly transport: QueryTransport;
|
|
17
|
-
}) => Atom.Atom<import("effect/
|
|
17
|
+
}) => Atom.Atom<import("effect/reactivity/AsyncResult").AsyncResult<NoInfer<Output>, import("effect/Cause").NoSuchElementError | AppQueryFailed>>;
|
|
18
18
|
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** One upstream call, with form requests forwarded to the invocation's existing elicitation capability. */
|
|
3
4
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
5
|
import { Effect, Schema } from "effect";
|
|
@@ -6,15 +7,15 @@ import { ElicitationFailed } from "../contracts/elicitation.js";
|
|
|
6
7
|
import { McpError, type McpToolContext } from "../contracts/mcp.js";
|
|
7
8
|
import type { JsonObject } from "../contracts/schema.js";
|
|
8
9
|
/** Register prompts only around tools/call, preserve metadata, and close every callback with the call. Never retries. */
|
|
9
|
-
export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError) => Effect.Effect<{
|
|
10
|
+
export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused) => Effect.Effect<{
|
|
10
11
|
readonly content: readonly {
|
|
11
12
|
readonly [x: string]: Schema.Json;
|
|
12
13
|
}[];
|
|
13
14
|
readonly _meta?: {
|
|
14
15
|
readonly [x: string]: Schema.Json;
|
|
15
|
-
}
|
|
16
|
+
};
|
|
16
17
|
readonly structuredContent?: {
|
|
17
18
|
readonly [x: string]: Schema.Json;
|
|
18
|
-
}
|
|
19
|
-
readonly isError?: boolean
|
|
20
|
-
}, ProviderError | ElicitationFailed | McpError, never>;
|
|
19
|
+
};
|
|
20
|
+
readonly isError?: boolean;
|
|
21
|
+
}, ProviderError | NetworkRefused | ElicitationFailed | McpError, never>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { McpToolsOptions } from "../contracts/mcp.js";
|
|
3
|
-
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
3
|
+
import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
|
|
4
4
|
import { type OperationKinds } from "./protocol-operations.js";
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A server, the account whose catalog it is, and the metadata policy for HTTP/SSE sources. A
|
|
7
|
+
* missing cache keeps discovery invocation-local.
|
|
8
|
+
*/
|
|
9
|
+
export type McpCatalogOptions = Omit<McpToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
|
|
8
10
|
/** Construction opens no transport unless explicit revalidation is requested. */
|
|
9
11
|
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import type { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** Shared MCP pagination, wire parsing and calls. Transport owns connection lifetime. */
|
|
3
4
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
4
5
|
import type { jsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/types.js";
|
|
5
6
|
import { Effect, Schema } from "effect";
|
|
6
7
|
import { McpError, type McpToolContext } from "../contracts/mcp.js";
|
|
8
|
+
import type { UpstreamError } from "../contracts/failure.js";
|
|
7
9
|
import type { JsonObject } from "../effect.js";
|
|
10
|
+
/**
|
|
11
|
+
* The JSON-RPC error a server answered a request with, if `error` is one. The SDK formats its
|
|
12
|
+
* message as `MCP error <code>: <message>`; the server's own message follows that prefix.
|
|
13
|
+
*/
|
|
14
|
+
export declare const answeredError: (error: unknown) => UpstreamError | undefined;
|
|
8
15
|
/** Use the framework-owned interpreter at the MCP SDK's synchronous validation boundary. */
|
|
9
16
|
export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
|
|
10
17
|
/** An operation owns its connection; it must close even when interrupted. */
|
|
11
18
|
export interface WithMcpClient {
|
|
12
|
-
<A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError>;
|
|
19
|
+
<A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError | NetworkRefused>;
|
|
13
20
|
}
|
|
14
21
|
/** Shared client operations never cache catalogs or account credentials. */
|
|
15
|
-
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError): {
|
|
22
|
+
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused): {
|
|
16
23
|
list: Effect.Effect<{
|
|
17
24
|
tools: {
|
|
18
25
|
readonly name: string;
|
|
@@ -36,11 +43,11 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
36
43
|
} | undefined;
|
|
37
44
|
}[];
|
|
38
45
|
server: {
|
|
46
|
+
readonly description?: string;
|
|
39
47
|
readonly version?: string;
|
|
40
48
|
readonly name?: string;
|
|
41
|
-
readonly description?: string;
|
|
42
|
-
readonly title?: string;
|
|
43
49
|
readonly instructions?: string;
|
|
50
|
+
readonly title?: string;
|
|
44
51
|
readonly icons?: readonly {
|
|
45
52
|
readonly src: string;
|
|
46
53
|
readonly mimeType?: string;
|
|
@@ -49,19 +56,20 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
49
56
|
}[];
|
|
50
57
|
readonly websiteUrl?: string;
|
|
51
58
|
} | {};
|
|
52
|
-
}, ProviderError | McpError, never>;
|
|
59
|
+
}, ProviderError | NetworkRefused | McpError, never>;
|
|
60
|
+
check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
|
|
53
61
|
call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
|
|
54
62
|
readonly content: readonly {
|
|
55
63
|
readonly [x: string]: Schema.Json;
|
|
56
64
|
}[];
|
|
57
65
|
readonly _meta?: {
|
|
58
66
|
readonly [x: string]: Schema.Json;
|
|
59
|
-
}
|
|
67
|
+
};
|
|
60
68
|
readonly structuredContent?: {
|
|
61
69
|
readonly [x: string]: Schema.Json;
|
|
62
|
-
}
|
|
63
|
-
readonly isError?: boolean
|
|
64
|
-
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
70
|
+
};
|
|
71
|
+
readonly isError?: boolean;
|
|
72
|
+
}, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
|
|
65
73
|
};
|
|
66
74
|
/** Transport-independent operations consumed by the app tool adapter. */
|
|
67
75
|
export type McpClient = ReturnType<typeof mcpClient>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import type { NetworkRefused } from "../contracts/network.js";
|
|
2
3
|
/** Adapt any MCP transport into ordinary tools with shared validation behavior. */
|
|
3
4
|
import { Effect } from "effect";
|
|
4
5
|
import { McpError, type McpTools, type McpToolMetadata } from "../contracts/mcp.js";
|
|
@@ -6,4 +7,4 @@ import type { McpClient } from "./mcp-client.js";
|
|
|
6
7
|
/** Compile only the selected tool and bind its executable to the current invocation. */
|
|
7
8
|
export declare const adaptMcpTool: (client: McpClient, tool: McpToolMetadata) => Effect.Effect<import("../contracts/mcp.js").McpTool, McpError, never>;
|
|
8
9
|
/** Discover a complete catalog for probes and uncached low-level callers. */
|
|
9
|
-
export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError>;
|
|
10
|
+
export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError | NetworkRefused>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ProviderError } from "../contracts/provider-error.js";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
|
-
import { McpError, McpToolsOptions } from "../contracts/mcp.js";
|
|
3
|
+
import { McpCredentialsUnverified, McpError, McpToolsOptions, type McpHealthCheck, type McpHealthOptions } from "../contracts/mcp.js";
|
|
4
|
+
import { NetworkRefused } from "../contracts/network.js";
|
|
4
5
|
/** Discover and call with a fresh selected-account transport for each operation. */
|
|
5
6
|
export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
|
|
6
7
|
list: Effect.Effect<{
|
|
@@ -26,11 +27,11 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
|
|
|
26
27
|
} | undefined;
|
|
27
28
|
}[];
|
|
28
29
|
server: {
|
|
30
|
+
readonly description?: string;
|
|
29
31
|
readonly version?: string;
|
|
30
32
|
readonly name?: string;
|
|
31
|
-
readonly description?: string;
|
|
32
|
-
readonly title?: string;
|
|
33
33
|
readonly instructions?: string;
|
|
34
|
+
readonly title?: string;
|
|
34
35
|
readonly icons?: readonly {
|
|
35
36
|
readonly src: string;
|
|
36
37
|
readonly mimeType?: string;
|
|
@@ -39,19 +40,29 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
|
|
|
39
40
|
}[];
|
|
40
41
|
readonly websiteUrl?: string;
|
|
41
42
|
} | {};
|
|
42
|
-
}, ProviderError | McpError, never>;
|
|
43
|
+
}, ProviderError | NetworkRefused | McpError, never>;
|
|
44
|
+
check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
|
|
43
45
|
call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
|
|
44
46
|
readonly content: readonly {
|
|
45
47
|
readonly [x: string]: Schema.Json;
|
|
46
48
|
}[];
|
|
47
49
|
readonly _meta?: {
|
|
48
50
|
readonly [x: string]: Schema.Json;
|
|
49
|
-
}
|
|
51
|
+
};
|
|
50
52
|
readonly structuredContent?: {
|
|
51
53
|
readonly [x: string]: Schema.Json;
|
|
52
|
-
}
|
|
53
|
-
readonly isError?: boolean
|
|
54
|
-
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
54
|
+
};
|
|
55
|
+
readonly isError?: boolean;
|
|
56
|
+
}, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
|
|
55
57
|
}, McpError, never>;
|
|
58
|
+
/**
|
|
59
|
+
* Check one account: initialize and read the first page of tools with the account's headers, then
|
|
60
|
+
* repeat that with no headers on a fresh transport. A refused account fails with its
|
|
61
|
+
* `ProviderError`, and anything else that stops the first check is an `McpError`; the second never
|
|
62
|
+
* runs. The check passes only when the server refuses the second, which shows it checked the
|
|
63
|
+
* credentials. Otherwise it fails with `McpCredentialsUnverified`. Both share one budget, which
|
|
64
|
+
* ends early enough before the check context's deadline to close the session and report why.
|
|
65
|
+
*/
|
|
66
|
+
export declare const mcpHealthEffect: (check: McpHealthCheck, options: McpHealthOptions) => Effect.Effect<void, ProviderError | NetworkRefused | McpError | McpCredentialsUnverified, never>;
|
|
56
67
|
/** Discover and compile all tools for connection probes and low-level consumers. */
|
|
57
|
-
export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | McpError, never>;
|
|
68
|
+
export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | NetworkRefused | McpError, never>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** Typed refusals and option checks for the fetch app code receives from the framework. */
|
|
2
|
+
import { Effect } from "effect";
|
|
3
|
+
import type { HttpClientResponse } from "effect/http";
|
|
4
|
+
import { type NetworkRefused } from "../contracts/network.js";
|
|
5
|
+
type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
6
|
+
/** Fail with the refusal a protocol helper's response carries, or continue to its own handling. */
|
|
7
|
+
export declare const failOnNetworkRefusal: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<void, NetworkRefused>;
|
|
8
|
+
/**
|
|
9
|
+
* The fetch app code receives as `ctx.fetch`. It rejects a RequestInit value the app runtime
|
|
10
|
+
* would reject, naming the option, on every host. A request Executor's app network refused
|
|
11
|
+
* rejects with `NetworkRefused`: the service never answered, so there is no response to return.
|
|
12
|
+
*/
|
|
13
|
+
export declare const appFetch: (fetch: Fetch) => Fetch;
|
|
14
|
+
/** The invocation's correlated, cancellable fetch, as app code receives it. */
|
|
15
|
+
export declare const appInvocationFetch: (signal: AbortSignal) => Effect.Effect<Fetch, never, never>;
|
|
16
|
+
export {};
|