apps 0.0.1-beta.26 → 0.0.1-beta.28

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 (72) hide show
  1. package/README.md +6 -6
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-AAAMPT6F.js → chunk-65SZ23BK.js} +2 -2
  4. package/js/{chunk-XBG3M64K.js → chunk-6JBTHTI5.js} +1 -1
  5. package/js/{chunk-OBXHLFGQ.js → chunk-B5YJQU45.js} +1 -1
  6. package/js/{chunk-T7WRQJUF.js → chunk-BRGF7VFN.js} +2 -2
  7. package/js/{chunk-HQKIPKM5.js → chunk-BTJMXW4I.js} +1 -1
  8. package/js/{chunk-BTRBOOTD.js → chunk-GLIAMV2R.js} +29 -23
  9. package/js/{chunk-WPKXOTKM.js → chunk-GQ7GCZ4J.js} +3 -3
  10. package/js/{chunk-EXDR4HVM.js → chunk-JN3PEGMW.js} +109 -12
  11. package/js/{chunk-DAIW2WM3.js → chunk-KQCMHI3K.js} +3 -3
  12. package/js/{chunk-HIYRKEWP.js → chunk-L76NWXM5.js} +74 -22
  13. package/js/{chunk-GH6PY5BQ.js → chunk-M2KEEOIQ.js} +1 -1
  14. package/js/{chunk-OI7OI2U3.js → chunk-MWCLJQRI.js} +2 -2
  15. package/js/{chunk-TACLXEAE.js → chunk-NSBRV4FJ.js} +1 -1
  16. package/js/{chunk-DM5U7G7V.js → chunk-NXTXZ635.js} +1842 -1840
  17. package/js/{chunk-3YN4UDPB.js → chunk-PTUZSCEV.js} +2 -2
  18. package/js/{chunk-KKGRSXUK.js → chunk-PWF2DRJ3.js} +1 -1
  19. package/js/{chunk-2TP7C25K.js → chunk-SDLIDQXG.js} +3 -3
  20. package/js/{chunk-VGEPL4BV.js → chunk-TE2HPDZG.js} +110 -5
  21. package/js/{chunk-PC5RHPUP.js → chunk-TSLG2WPA.js} +2 -2
  22. package/js/{chunk-KNJAOYV4.js → chunk-V2I3MMPM.js} +2 -2
  23. package/js/{chunk-NXO2GN2T.js → chunk-VF3X26ZO.js} +8 -8
  24. package/js/{chunk-4CMJD7AB.js → chunk-VIQQ52V7.js} +24 -8
  25. package/js/{chunk-ZVMZWXVF.js → chunk-VUVBMNKC.js} +2 -2
  26. package/js/{chunk-SUY33XAY.js → chunk-WQ5MVBTP.js} +1 -1
  27. package/js/{chunk-LPN4ONWW.js → chunk-XBQTJP76.js} +2 -2
  28. package/js/{chunk-IE6W5RNN.js → chunk-YML53Z7H.js} +2 -2
  29. package/js/{chunk-DUEZ2XCO.js → chunk-YXKXKGN6.js} +3 -3
  30. package/js/{chunk-XIRAIB3P.js → chunk-ZZOCEUTB.js} +4 -4
  31. package/js/client.js +10 -10
  32. package/js/contracts.js +19 -7
  33. package/js/effect.js +19 -19
  34. package/js/graphql.js +28 -23
  35. package/js/host.js +19 -19
  36. package/js/index.js +16 -12
  37. package/js/mcp/effect.js +23 -21
  38. package/js/mcp/stdio.js +21 -21
  39. package/js/mcp.js +29 -24
  40. package/js/openapi.js +20 -16
  41. package/js/react.js +3 -3
  42. package/js/skills/effect.js +3 -3
  43. package/js/skills.js +11 -11
  44. package/js/storage/facet.js +4 -4
  45. package/js/ui/auth/contracts.js +2 -2
  46. package/js/ui/auth.js +5 -5
  47. package/js/ui/contracts.js +4 -4
  48. package/js/ui/serving.js +8 -8
  49. package/package.json +1 -1
  50. package/runtime.json +1 -1
  51. package/types/apps/src/contracts/graphql.d.ts +2 -1
  52. package/types/apps/src/contracts/host.d.ts +1 -0
  53. package/types/apps/src/contracts/mcp.d.ts +51 -4
  54. package/types/apps/src/contracts/network.d.ts +84 -0
  55. package/types/apps/src/contracts/openapi.d.ts +2 -1
  56. package/types/apps/src/contracts/provider.d.ts +6 -0
  57. package/types/apps/src/implementation/elicitation.d.ts +8 -8
  58. package/types/apps/src/implementation/failure-detail.d.ts +3 -2
  59. package/types/apps/src/implementation/graphql.d.ts +4 -3
  60. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  61. package/types/apps/src/implementation/mcp-client.d.ts +7 -5
  62. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  63. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  64. package/types/apps/src/implementation/mcp.d.ts +16 -5
  65. package/types/apps/src/implementation/network.d.ts +16 -0
  66. package/types/apps/src/implementation/openapi-compile.d.ts +1 -1
  67. package/types/apps/src/implementation/openapi-request.d.ts +2 -1
  68. package/types/apps/src/implementation/router-catalog.d.ts +6 -6
  69. package/types/apps/src/implementation/skills.d.ts +2 -2
  70. package/types/apps/src/index.d.ts +1 -0
  71. package/types/apps/src/mcp.d.ts +20 -1
  72. package/types/apps/src/skills.d.ts +4 -4
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** GraphQL discovery contracts. Catalogs are evaluated with the selected account. */
3
4
  import { Schema, type Effect } from "effect";
4
5
  import { type JsonValue } from "./schema.js";
@@ -97,7 +98,7 @@ export interface GraphqlTool {
97
98
  readonly description: string;
98
99
  readonly readOnly: boolean;
99
100
  readonly input: Schema.Decoder<JsonValue>;
100
- readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError>;
101
+ readonly run: (context: unknown, input: JsonValue) => Effect.Effect<JsonValue, GraphqlError | ProviderError | NetworkRefused>;
101
102
  }
102
103
  /** One tool per root field; subscriptions require a separate long-lived host. */
103
104
  export type GraphqlTools = Readonly<Record<string, GraphqlTool>>;
@@ -6,6 +6,7 @@ import { OpenapiResponseError } from "./api-response-error.js";
6
6
  export { ApiErrorResponse, maxApiErrorInstructionsLength, maxApiErrorMessageLength, OpenapiResponseError, } from "./api-response-error.js";
7
7
  export { ProviderError } from "./provider-error.js";
8
8
  export { McpError } from "./mcp.js";
9
+ export { FetchOptionUnsupported, NetworkRefusal, NetworkRefused, networkRefusalHeader, networkRefusalResponse, networkRefusalStatus, } from "./network.js";
9
10
  import { WorkflowFailure, type WorkflowExecution, type WorkflowReplay, type WorkflowHostControls } from "./workflows.js";
10
11
  export * from "./workflows.js";
11
12
  export * from "./failure.js";
@@ -1,7 +1,9 @@
1
- import type { ProviderError } from "./provider-error.js";
1
+ import { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
3
4
  import { type Effect, type Redacted, Schema } from "effect";
4
5
  import type { Elicit, ElicitationFailed } from "./elicitation.js";
6
+ import type { AccountCheckContext, AuthMethods } from "./provider.js";
5
7
  import { type JsonValue } from "./schema.js";
6
8
  /** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
7
9
  export declare const McpClientLimits: Schema.Struct<{
@@ -31,6 +33,37 @@ export declare const McpToolsOptions: Schema.Struct<{
31
33
  readonly timeoutMs: Schema.optional<Schema.Number>;
32
34
  }>;
33
35
  export type McpToolsOptions = typeof McpToolsOptions.Type;
36
+ /**
37
+ * What `mcpHealth` checks, as decoded: its options, with the account's ID, signal and deadline
38
+ * taken from the check context.
39
+ */
40
+ export declare const McpHealthInput: Schema.Struct<{
41
+ readonly headers: Schema.$Record<Schema.String, Schema.String>;
42
+ readonly deadline: Schema.optional<Schema.Finite>;
43
+ readonly url: Schema.String;
44
+ readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
45
+ readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
46
+ readonly timeoutMs: Schema.optional<Schema.Number>;
47
+ }>;
48
+ /**
49
+ * The server a provider check verifies, and the headers that send the checked account's
50
+ * credentials. The account, signal and deadline come from the check context instead. Both attempts
51
+ * share one budget that ends `mcpHealthReserveMs` before the deadline. `timeoutMs` bounds the whole
52
+ * check too; it can shorten the budget, never extend it.
53
+ */
54
+ export type McpHealthOptions = Pick<typeof McpHealthInput.Type, "url" | "headers" | "timeoutMs">;
55
+ /** What `mcpHealth` reads from the check context the host passes to a provider's `health`. */
56
+ export type McpHealthCheck = Pick<AccountCheckContext<AuthMethods>, "signal" | "deadline"> & {
57
+ readonly account: {
58
+ readonly id: string;
59
+ };
60
+ };
61
+ /**
62
+ * How long before an account check's deadline `mcpHealth` stops waiting for the server, so it can
63
+ * still close its session, ending it and then its transport, each within `cleanupTimeoutMs`, and
64
+ * report why before the host stops waiting.
65
+ */
66
+ export declare const mcpHealthReserveMs: number;
34
67
  /** One parsed server and credential snapshot; never shared across account evaluations. */
35
68
  export interface McpConnection {
36
69
  readonly url: URL;
@@ -99,7 +132,7 @@ export interface McpTool extends Omit<McpToolMetadata, "outputSchema"> {
99
132
  readonly input: Schema.Decoder<JsonValue>;
100
133
  readonly output: Schema.Decoder<JsonValue>;
101
134
  readonly readOnly?: boolean;
102
- readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | ElicitationFailed>;
135
+ readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | NetworkRefused | ElicitationFailed>;
103
136
  }
104
137
  /** The discovered catalog keyed by remote tool name. */
105
138
  export type McpTools = Readonly<Record<string, McpTool>>;
@@ -113,11 +146,25 @@ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpErro
113
146
  }>>;
114
147
  }>, import("effect/Cause").YieldableError>;
115
148
  /**
116
- * Safe protocol/transport failure; no raw upstream payloads or credentials. `upstream` is the
117
- * JSON-RPC error the server answered with, bounded and with account secrets replaced.
149
+ * Safe protocol/transport failure; no raw upstream payloads or credentials. `status` is the HTTP
150
+ * status a `request` failure was redirected or refused with. Without one, a `request` failure in
151
+ * the `transport` phase never reached the server; in another phase it may be a JSON-RPC error the
152
+ * server answered with. `upstream` is that JSON-RPC error, bounded and with account secrets
153
+ * replaced. A response that is not MCP is `invalid_response`.
118
154
  */
119
155
  export declare class McpError extends McpError_base {
120
156
  }
157
+ declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverified, Schema.TaggedStruct<"McpCredentialsUnverified", {
158
+ readonly anonymous: Schema.Union<readonly [Schema.Literal<"answered">, typeof McpError, typeof ProviderError]>;
159
+ }>, import("effect/Cause").YieldableError>;
160
+ /**
161
+ * `mcpHealth` could not show that the server needs the account's credentials, although it accepted
162
+ * them. `anonymous` is what the same check without credentials met: `answered` when it succeeded,
163
+ * so a refused key would pass too, or the failure, other than a refusal, that left it undecided.
164
+ * Only app code raises it; the host reports its fixed message, so no host protocol carries it.
165
+ */
166
+ export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
167
+ }
121
168
  /** Public process configuration. Credentials arrive through the selected account. */
122
169
  export declare const ProcessConfig: Schema.Struct<{
123
170
  readonly command: Schema.NonEmptyString;
@@ -0,0 +1,84 @@
1
+ /**
2
+ * What app code sees when Executor's app network refuses a request, and the fetch options the
3
+ * app runtime accepts. A refusal is Executor's decision, not the service's: the request never
4
+ * left Executor. App code runs on workerd, Cloudflare's runtime, on every host.
5
+ */
6
+ import { Schema } from "effect";
7
+ /**
8
+ * Why Executor's app network refused a request.
9
+ * - `private_address`: the destination is a private, loopback or internal address, and this
10
+ * instance lets apps reach only public addresses.
11
+ * - `credential_host`: the request carries a credential handle, and its provider does not allow
12
+ * the destination host.
13
+ * - `credential_app`: the request carries a credential handle that is not valid for this app.
14
+ * - `credential_expired`: the request carries an expired credential handle.
15
+ */
16
+ export declare const NetworkRefusal: Schema.Union<readonly [Schema.Struct<{
17
+ readonly reason: Schema.Literal<"private_address">;
18
+ }>, Schema.Struct<{
19
+ readonly reason: Schema.Literal<"credential_host">;
20
+ /** The provider of the credential handle the request carried. */
21
+ readonly provider: Schema.String;
22
+ /** The hosts that provider's credentials may reach; empty when it declares none. */
23
+ readonly allowedHosts: Schema.$Array<Schema.String>;
24
+ }>, Schema.Struct<{
25
+ readonly reason: Schema.Literal<"credential_app">;
26
+ }>, Schema.Struct<{
27
+ readonly reason: Schema.Literal<"credential_expired">;
28
+ /** The provider of the expired credential handle. */
29
+ readonly provider: Schema.String;
30
+ }>]>;
31
+ export type NetworkRefusal = typeof NetworkRefusal.Type;
32
+ declare const NetworkRefused_base: Schema.Class<NetworkRefused, Schema.TaggedStruct<"NetworkRefused", {
33
+ /** The refused destination, with its port when the URL names one. */
34
+ readonly host: Schema.String;
35
+ readonly refusal: Schema.Union<readonly [Schema.Struct<{
36
+ readonly reason: Schema.Literal<"private_address">;
37
+ }>, Schema.Struct<{
38
+ readonly reason: Schema.Literal<"credential_host">;
39
+ /** The provider of the credential handle the request carried. */
40
+ readonly provider: Schema.String;
41
+ /** The hosts that provider's credentials may reach; empty when it declares none. */
42
+ readonly allowedHosts: Schema.$Array<Schema.String>;
43
+ }>, Schema.Struct<{
44
+ readonly reason: Schema.Literal<"credential_app">;
45
+ }>, Schema.Struct<{
46
+ readonly reason: Schema.Literal<"credential_expired">;
47
+ /** The provider of the expired credential handle. */
48
+ readonly provider: Schema.String;
49
+ }>]>;
50
+ }>, import("effect/Cause").YieldableError>;
51
+ /** Executor's app network refused a request before it reached the service. */
52
+ export declare class NetworkRefused extends NetworkRefused_base {
53
+ get message(): string;
54
+ }
55
+ /**
56
+ * A refusal reaches app code as a response with this status and header. The header holds the
57
+ * encoded `NetworkRefused`, so it survives responses without a body, such as to `HEAD`; the
58
+ * body repeats it as JSON with its message. `ctx.fetch` and the framework's protocol helpers
59
+ * raise it as `NetworkRefused`; the platform's global `fetch` returns the response. Only
60
+ * Executor's app network sets the mark: it removes the header from a service's 421 response.
61
+ */
62
+ export declare const networkRefusalStatus = 421;
63
+ export declare const networkRefusalHeader = "x-executor-refused";
64
+ /** The header's value: the refusal as JSON, URI-encoded so any provider name fits in a header. */
65
+ export declare const NetworkRefusedHeader: Schema.compose<Schema.fromJsonString<typeof NetworkRefused>, Schema.StringFromUriComponent>;
66
+ /** The response Executor's app network returns in place of a request it refused. */
67
+ export declare const networkRefusalResponse: (refused: NetworkRefused) => Response;
68
+ /** RequestInit options the app runtime restricts. */
69
+ export declare const RestrictedFetchOption: Schema.Literals<readonly ["redirect", "cache", "integrity"]>;
70
+ export type RestrictedFetchOption = typeof RestrictedFetchOption.Type;
71
+ /** The values the app runtime accepts for each restricted option. */
72
+ export declare const supportedFetchOptions: Readonly<Record<RestrictedFetchOption, ReadonlyArray<string>>>;
73
+ declare const FetchOptionUnsupported_base: Schema.Class<FetchOptionUnsupported, Schema.TaggedStruct<"FetchOptionUnsupported", {
74
+ readonly option: Schema.Literals<readonly ["redirect", "cache", "integrity"]>;
75
+ readonly value: Schema.String;
76
+ readonly supported: Schema.$Array<Schema.String>;
77
+ }>, import("effect/Cause").YieldableError>;
78
+ /** `ctx.fetch` was given a standard RequestInit value the app runtime does not implement. */
79
+ export declare class FetchOptionUnsupported extends FetchOptionUnsupported_base {
80
+ get message(): string;
81
+ /** What to do instead, when the standard value has an equivalent the runtime supports. */
82
+ private get advice();
83
+ }
84
+ export {};
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** Credential-free OpenAPI request declarations and validation schemas retained with app source. */
3
4
  import { Schema, type Effect } from "effect";
4
5
  import { JsonObject } from "./schema.js";
@@ -219,7 +220,7 @@ export interface OpenapiTool {
219
220
  readonly readOnly: boolean;
220
221
  readonly outputSchema?: JsonObject;
221
222
  readonly input: Schema.Decoder<Schema.Json>;
222
- readonly run: (context: unknown, input: Schema.Json) => Effect.Effect<unknown, OpenapiError | OpenapiResponseError | ProviderError>;
223
+ readonly run: (context: unknown, input: Schema.Json) => Effect.Effect<unknown, OpenapiError | OpenapiResponseError | ProviderError | NetworkRefused>;
223
224
  }
224
225
  /** Executable operations keyed by their generated names. */
225
226
  export type OpenapiTools = Readonly<Record<string, OpenapiTool>>;
@@ -160,6 +160,12 @@ export interface AccountCheckContext<Auth extends AuthMethods> {
160
160
  readonly account: AccountOfMethods<Auth>;
161
161
  readonly fetch: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
162
162
  readonly signal: AbortSignal;
163
+ /**
164
+ * When the host stops waiting for the check, in milliseconds since the epoch. A check still
165
+ * running then fails without its own message, so a check that gives up must do so before it.
166
+ * Executor always sets it; a host that does not limit the check leaves it out.
167
+ */
168
+ readonly deadline?: number;
163
169
  }
164
170
  /**
165
171
  * A safe authenticated read proving the account works for this app. Returning passes; a thrown
@@ -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,8 +37,8 @@ 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;
41
+ readonly default?: readonly string[];
42
42
  readonly title?: string;
43
43
  readonly minItems?: number;
44
44
  readonly maxItems?: number;
@@ -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;
54
+ readonly default?: readonly string[];
55
55
  readonly title?: string;
56
56
  readonly minItems?: number;
57
57
  readonly maxItems?: number;
58
58
  } | {
59
59
  readonly type: "string";
60
- readonly default?: string;
61
60
  readonly description?: string;
61
+ readonly default?: string;
62
62
  readonly format?: "email" | "uri" | "date" | "date-time";
63
63
  readonly title?: string;
64
64
  readonly minLength?: number;
65
65
  readonly maxLength?: number;
66
66
  } | {
67
67
  readonly type: "number" | "integer";
68
+ readonly description?: string;
68
69
  readonly default?: number;
69
70
  readonly maximum?: number;
70
- readonly description?: string;
71
71
  readonly title?: string;
72
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
  };
@@ -39,7 +39,8 @@ export declare const parseMcpError: (error: unknown, secrets: readonly string[])
39
39
  export declare const describeFailure: (error: unknown) => string;
40
40
  /**
41
41
  * Describe what an operation raised for the app's own caller. App data failures keep their
42
- * reason as a code, as do app cache failures; any other thrown value is the app's own error, with
43
- * its own code and scalar fields. Account secrets are replaced.
42
+ * reason as a code, as do app cache failures and OpenAPI and MCP service failures, such as an
43
+ * `mcpHealth` check that cannot reach its server or cannot verify the credentials; any other thrown
44
+ * value is the app's own error, with its own code and scalar fields. Account secrets are replaced.
44
45
  */
45
46
  export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
@@ -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,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,7 +7,7 @@ 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
  }[];
@@ -17,4 +18,4 @@ export declare const mcpCall: (client: Client, name: string, input: JsonObject,
17
18
  readonly [x: string]: Schema.Json;
18
19
  };
19
20
  readonly isError?: boolean;
20
- }, ProviderError | ElicitationFailed | McpError, never>;
21
+ }, ProviderError | NetworkRefused | ElicitationFailed | McpError, never>;
@@ -1,4 +1,5 @@
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";
@@ -15,10 +16,10 @@ export declare const answeredError: (error: unknown) => UpstreamError | undefine
15
16
  export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
16
17
  /** An operation owns its connection; it must close even when interrupted. */
17
18
  export interface WithMcpClient {
18
- <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>;
19
20
  }
20
21
  /** Shared client operations never cache catalogs or account credentials. */
21
- 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): {
22
23
  list: Effect.Effect<{
23
24
  tools: {
24
25
  readonly name: string;
@@ -42,9 +43,9 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
42
43
  } | undefined;
43
44
  }[];
44
45
  server: {
46
+ readonly description?: string;
45
47
  readonly version?: string;
46
48
  readonly name?: string;
47
- readonly description?: string;
48
49
  readonly title?: string;
49
50
  readonly instructions?: string;
50
51
  readonly icons?: readonly {
@@ -55,7 +56,8 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
55
56
  }[];
56
57
  readonly websiteUrl?: string;
57
58
  } | {};
58
- }, ProviderError | McpError, never>;
59
+ }, ProviderError | NetworkRefused | McpError, never>;
60
+ check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
59
61
  call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
60
62
  readonly content: readonly {
61
63
  readonly [x: string]: Schema.Json;
@@ -67,7 +69,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
67
69
  readonly [x: string]: Schema.Json;
68
70
  };
69
71
  readonly isError?: boolean;
70
- }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
72
+ }, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
71
73
  };
72
74
  /** Transport-independent operations consumed by the app tool adapter. */
73
75
  export type McpClient = ReturnType<typeof mcpClient>;
@@ -1,4 +1,4 @@
1
1
  import { Effect } from "effect";
2
2
  import { McpError, ProcessConfig } from "../contracts/mcp.js";
3
3
  /** Each discovery/call owns and closes its subprocess. Deployment never starts it. */
4
- export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | McpError, never>;
4
+ export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | import("../index.js").NetworkRefused | McpError, never>;
@@ -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,9 +27,9 @@ 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
33
  readonly title?: string;
33
34
  readonly instructions?: string;
34
35
  readonly icons?: readonly {
@@ -39,7 +40,8 @@ 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;
@@ -51,7 +53,16 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
51
53
  readonly [x: string]: Schema.Json;
52
54
  };
53
55
  readonly isError?: boolean;
54
- }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
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/unstable/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 {};
@@ -17,6 +17,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
17
17
  readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
18
18
  }) => Effect.Effect<{
19
19
  operations: {
20
+ readonly description: string;
20
21
  readonly name: string;
21
22
  readonly request: {
22
23
  readonly parameters: readonly {
@@ -57,7 +58,6 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
57
58
  };
58
59
  };
59
60
  readonly path: string;
60
- readonly description: string;
61
61
  readonly input: {
62
62
  readonly [x: string]: Schema.Json;
63
63
  };
@@ -1,3 +1,4 @@
1
+ import { NetworkRefused } from "../contracts/network.js";
1
2
  import { ProviderError } from "../contracts/provider-error.js";
2
3
  /** Swagger constructs requests; Effect owns HTTP policy and bounded results. */
3
4
  import { Effect, Schema } from "effect";
@@ -19,6 +20,6 @@ export declare function createRequest(config: {
19
20
  readonly oauth: readonly string[];
20
21
  }): {
21
22
  available: (op: OpenapiOperationAccess, account: OpenapiAccount | undefined) => boolean;
22
- call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined, errors: readonly DeclaredError[]) => Effect.Effect<Schema.Json, ProviderError | OpenapiResponseError | OpenapiError, never>;
23
+ call: (op: OpenapiOperation, input: unknown, account: OpenapiAccount | undefined, errors: readonly DeclaredError[]) => Effect.Effect<Schema.Json, ProviderError | NetworkRefused | OpenapiResponseError | OpenapiError, never>;
23
24
  };
24
25
  export {};
@@ -28,8 +28,8 @@ export declare const routerSkillPrefix = "tools";
28
28
  export declare const routerSkillName: (path: string) => string;
29
29
  /** A declared operation's catalog entry without schemas. `router` is its owning router's path. */
30
30
  export declare const operationSummary: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
31
- readonly name: string;
32
31
  readonly description: string;
32
+ readonly name: string;
33
33
  readonly title?: string;
34
34
  readonly annotations?: {
35
35
  readonly title?: string;
@@ -58,8 +58,8 @@ export declare const operationSummary: (name: string, router: string, operation:
58
58
  }, HostDeclarationInvalid, never>;
59
59
  /** A declared operation's full description, including rendered schemas. */
60
60
  export declare const operationDescription: (name: string, router: string, operation: AppOperation, schedules?: readonly OperationSchedule[]) => Effect.Effect<{
61
- readonly name: string;
62
61
  readonly description: string;
62
+ readonly name: string;
63
63
  readonly inputSchema: {
64
64
  readonly [x: string]: Schema.Json;
65
65
  };
@@ -121,8 +121,8 @@ export interface CatalogOptions {
121
121
  */
122
122
  export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined, options: CatalogOptions) => Effect.Effect<{
123
123
  tools: ({
124
- readonly name: string;
125
124
  readonly description: string;
125
+ readonly name: string;
126
126
  readonly inputSchema: {
127
127
  readonly [x: string]: Schema.Json;
128
128
  };
@@ -158,8 +158,8 @@ export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined,
158
158
  readonly router?: string;
159
159
  readonly tags?: readonly string[];
160
160
  } | {
161
- readonly name: string;
162
161
  readonly description: string;
162
+ readonly name: string;
163
163
  readonly title?: string;
164
164
  readonly annotations?: {
165
165
  readonly title?: string;
@@ -188,8 +188,8 @@ export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined,
188
188
  })[];
189
189
  routers: {
190
190
  readonly path: string;
191
- readonly error?: import("../index.js").ProviderError | SkillLoadFailed | HostDeclarationInvalid | HostEvaluationFailed | import("../mcp.js").McpError;
192
191
  readonly description?: string;
192
+ readonly error?: import("../index.js").ProviderError | SkillLoadFailed | HostDeclarationInvalid | HostEvaluationFailed | import("../mcp.js").McpError;
193
193
  readonly title?: string;
194
194
  readonly tags?: {
195
195
  readonly [x: string]: string;
@@ -209,8 +209,8 @@ export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined,
209
209
  * fail the others. Metadata comes through each source's catalog cache, like a tool listing.
210
210
  */
211
211
  export declare const routerSkills: (root: AppRouter | DynamicRouter | undefined) => Effect.Effect<{
212
- readonly name: string;
213
212
  readonly description: string;
213
+ readonly name: string;
214
214
  readonly files: readonly {
215
215
  readonly path: string;
216
216
  readonly content: string;
@@ -13,8 +13,8 @@ export declare const reader: (transport: SkillTransport) => Effect.Effect<{
13
13
  json: (url: string) => Effect.Effect<unknown, SkillLoadFailed, never>;
14
14
  }, never, never>;
15
15
  export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effect.Effect<readonly {
16
- readonly name: string;
17
16
  readonly description: string;
17
+ readonly name: string;
18
18
  readonly files: readonly {
19
19
  readonly path: string;
20
20
  readonly content: string;
@@ -28,8 +28,8 @@ export declare const githubSkillsEffect: (options: GitHubSkillsOptions) => Effec
28
28
  }[], SkillLoadFailed, never>;
29
29
  /** Fetch all indexed files and reject a publication whose index changes during the read. */
30
30
  export declare const wellKnownSkillsEffect: (options: WellKnownSkillsOptions) => Effect.Effect<readonly {
31
- readonly name: string;
32
31
  readonly description: string;
32
+ readonly name: string;
33
33
  readonly files: readonly {
34
34
  readonly path: string;
35
35
  readonly content: string;
@@ -1,4 +1,5 @@
1
1
  export { ProviderError } from "./contracts/provider-error.js";
2
+ export { FetchOptionUnsupported, NetworkRefused } from "./contracts/network.js";
2
3
  export type { AppCache, CacheLoadContext, CacheGetOptions } from "./contracts/cache.js";
3
4
  export { CacheError } from "../../app-cache/src/contracts/cache.js";
4
5
  /**