apps 0.0.1-beta.25 → 0.0.1-beta.27
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 +6 -6
- package/framework-reference.json +1 -1
- package/js/{chunk-VWU6I23D.js → chunk-3TEX4ZND.js} +23 -17
- package/js/{chunk-K3MQX2KO.js → chunk-4OD7PHQL.js} +2 -2
- package/js/{chunk-AAAMPT6F.js → chunk-65SZ23BK.js} +2 -2
- package/js/{chunk-XBG3M64K.js → chunk-6JBTHTI5.js} +1 -1
- package/js/{chunk-J3RUZMLO.js → chunk-7AZNPMQH.js} +149 -15
- package/js/{chunk-VGEPL4BV.js → chunk-7R5JY5H7.js} +19 -5
- package/js/{chunk-VSLWGXPW.js → chunk-AHI26TO6.js} +24 -8
- package/js/{chunk-OBXHLFGQ.js → chunk-B5YJQU45.js} +1 -1
- package/js/{chunk-T7WRQJUF.js → chunk-BRGF7VFN.js} +2 -2
- package/js/{chunk-HQKIPKM5.js → chunk-BTJMXW4I.js} +1 -1
- package/js/{chunk-GG4IFBN3.js → chunk-HIJW4LWC.js} +64 -21
- package/js/{chunk-DAIW2WM3.js → chunk-KQCMHI3K.js} +3 -3
- package/js/{chunk-GH6PY5BQ.js → chunk-M2KEEOIQ.js} +1 -1
- package/js/{chunk-TACLXEAE.js → chunk-NSBRV4FJ.js} +1 -1
- package/js/{chunk-DM5U7G7V.js → chunk-NXTXZ635.js} +1842 -1840
- package/js/{chunk-3YN4UDPB.js → chunk-PTUZSCEV.js} +2 -2
- package/js/{chunk-KKGRSXUK.js → chunk-PWF2DRJ3.js} +1 -1
- package/js/{chunk-2TP7C25K.js → chunk-SDLIDQXG.js} +3 -3
- package/js/{chunk-NXO2GN2T.js → chunk-T2UFJKZR.js} +8 -8
- package/js/{chunk-PC5RHPUP.js → chunk-TSLG2WPA.js} +2 -2
- package/js/{chunk-WPKXOTKM.js → chunk-TX2XCAL6.js} +3 -3
- package/js/{chunk-KNJAOYV4.js → chunk-V2I3MMPM.js} +2 -2
- package/js/{chunk-ZVMZWXVF.js → chunk-VUVBMNKC.js} +2 -2
- package/js/{chunk-SUY33XAY.js → chunk-WQ5MVBTP.js} +1 -1
- package/js/{chunk-LPN4ONWW.js → chunk-XBQTJP76.js} +2 -2
- package/js/{chunk-IE6W5RNN.js → chunk-YML53Z7H.js} +2 -2
- package/js/{chunk-DUEZ2XCO.js → chunk-YXKXKGN6.js} +3 -3
- package/js/{chunk-XIRAIB3P.js → chunk-ZZOCEUTB.js} +4 -4
- package/js/client.js +10 -10
- package/js/contracts.js +7 -7
- package/js/effect.js +19 -19
- package/js/graphql.js +21 -21
- package/js/host.js +19 -19
- package/js/index.js +12 -12
- package/js/mcp/effect.js +23 -21
- package/js/mcp/stdio.js +21 -21
- package/js/mcp.js +29 -24
- package/js/openapi.js +595 -200
- package/js/react.js +3 -3
- package/js/skills/effect.js +3 -3
- package/js/skills.js +11 -11
- package/js/storage/facet.js +4 -4
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +4 -4
- package/js/ui/serving.js +8 -8
- package/package.json +1 -1
- package/runtime.json +1 -1
- package/types/apps/src/contracts/mcp.d.ts +49 -3
- package/types/apps/src/contracts/openapi-compile.d.ts +31 -3
- package/types/apps/src/contracts/openapi.d.ts +16 -6
- package/types/apps/src/contracts/provider.d.ts +6 -0
- package/types/apps/src/implementation/failure-detail.d.ts +3 -2
- package/types/apps/src/implementation/mcp-client.d.ts +1 -0
- package/types/apps/src/implementation/mcp.d.ts +11 -1
- package/types/apps/src/implementation/openapi-compile.d.ts +12 -2
- package/types/apps/src/implementation/openapi-document.d.ts +20 -6
- package/types/apps/src/implementation/openapi-names.d.ts +9 -4
- package/types/apps/src/implementation/openapi-source.d.ts +6 -0
- package/types/apps/src/mcp.d.ts +20 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ProviderError } from "./provider-error.js";
|
|
2
2
|
/** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
|
|
3
3
|
import { type Effect, type Redacted, Schema } from "effect";
|
|
4
4
|
import type { Elicit, ElicitationFailed } from "./elicitation.js";
|
|
5
|
+
import type { AccountCheckContext, AuthMethods } from "./provider.js";
|
|
5
6
|
import { type JsonValue } from "./schema.js";
|
|
6
7
|
/** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
|
|
7
8
|
export declare const McpClientLimits: Schema.Struct<{
|
|
@@ -31,6 +32,37 @@ export declare const McpToolsOptions: Schema.Struct<{
|
|
|
31
32
|
readonly timeoutMs: Schema.optional<Schema.Number>;
|
|
32
33
|
}>;
|
|
33
34
|
export type McpToolsOptions = typeof McpToolsOptions.Type;
|
|
35
|
+
/**
|
|
36
|
+
* What `mcpHealth` checks, as decoded: its options, with the account's ID, signal and deadline
|
|
37
|
+
* taken from the check context.
|
|
38
|
+
*/
|
|
39
|
+
export declare const McpHealthInput: Schema.Struct<{
|
|
40
|
+
readonly headers: Schema.$Record<Schema.String, Schema.String>;
|
|
41
|
+
readonly deadline: Schema.optional<Schema.Finite>;
|
|
42
|
+
readonly url: Schema.String;
|
|
43
|
+
readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
|
|
44
|
+
readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
|
|
45
|
+
readonly timeoutMs: Schema.optional<Schema.Number>;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* The server a provider check verifies, and the headers that send the checked account's
|
|
49
|
+
* credentials. The account, signal and deadline come from the check context instead. Both attempts
|
|
50
|
+
* share one budget that ends `mcpHealthReserveMs` before the deadline. `timeoutMs` bounds the whole
|
|
51
|
+
* check too; it can shorten the budget, never extend it.
|
|
52
|
+
*/
|
|
53
|
+
export type McpHealthOptions = Pick<typeof McpHealthInput.Type, "url" | "headers" | "timeoutMs">;
|
|
54
|
+
/** What `mcpHealth` reads from the check context the host passes to a provider's `health`. */
|
|
55
|
+
export type McpHealthCheck = Pick<AccountCheckContext<AuthMethods>, "signal" | "deadline"> & {
|
|
56
|
+
readonly account: {
|
|
57
|
+
readonly id: string;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* How long before an account check's deadline `mcpHealth` stops waiting for the server, so it can
|
|
62
|
+
* still close its session, ending it and then its transport, each within `cleanupTimeoutMs`, and
|
|
63
|
+
* report why before the host stops waiting.
|
|
64
|
+
*/
|
|
65
|
+
export declare const mcpHealthReserveMs: number;
|
|
34
66
|
/** One parsed server and credential snapshot; never shared across account evaluations. */
|
|
35
67
|
export interface McpConnection {
|
|
36
68
|
readonly url: URL;
|
|
@@ -113,11 +145,25 @@ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpErro
|
|
|
113
145
|
}>>;
|
|
114
146
|
}>, import("effect/Cause").YieldableError>;
|
|
115
147
|
/**
|
|
116
|
-
* Safe protocol/transport failure; no raw upstream payloads or credentials. `
|
|
117
|
-
*
|
|
148
|
+
* Safe protocol/transport failure; no raw upstream payloads or credentials. `status` is the HTTP
|
|
149
|
+
* status a `request` failure was redirected or refused with. Without one, a `request` failure in
|
|
150
|
+
* the `transport` phase never reached the server; in another phase it may be a JSON-RPC error the
|
|
151
|
+
* server answered with. `upstream` is that JSON-RPC error, bounded and with account secrets
|
|
152
|
+
* replaced. A response that is not MCP is `invalid_response`.
|
|
118
153
|
*/
|
|
119
154
|
export declare class McpError extends McpError_base {
|
|
120
155
|
}
|
|
156
|
+
declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverified, Schema.TaggedStruct<"McpCredentialsUnverified", {
|
|
157
|
+
readonly anonymous: Schema.Union<readonly [Schema.Literal<"answered">, typeof McpError, typeof ProviderError]>;
|
|
158
|
+
}>, import("effect/Cause").YieldableError>;
|
|
159
|
+
/**
|
|
160
|
+
* `mcpHealth` could not show that the server needs the account's credentials, although it accepted
|
|
161
|
+
* them. `anonymous` is what the same check without credentials met: `answered` when it succeeded,
|
|
162
|
+
* so a refused key would pass too, or the failure, other than a refusal, that left it undecided.
|
|
163
|
+
* Only app code raises it; the host reports its fixed message, so no host protocol carries it.
|
|
164
|
+
*/
|
|
165
|
+
export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
|
|
166
|
+
}
|
|
121
167
|
/** Public process configuration. Credentials arrive through the selected account. */
|
|
122
168
|
export declare const ProcessConfig: Schema.Struct<{
|
|
123
169
|
readonly command: Schema.NonEmptyString;
|
|
@@ -1,11 +1,39 @@
|
|
|
1
1
|
/** Shared OpenAPI compilation diagnostics. */
|
|
2
2
|
import { Schema } from "effect";
|
|
3
|
-
export declare const OpenapiCompileErrorCode: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
|
|
3
|
+
export declare const OpenapiCompileErrorCode: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
|
|
4
|
+
/** A declared operation the importer left out, and why. */
|
|
5
|
+
export declare const OpenapiSkippedOperation: Schema.Struct<{
|
|
6
|
+
/** The tool name the operation would have; reading that tool reports why it is missing. */
|
|
7
|
+
readonly name: Schema.String;
|
|
8
|
+
/** The HTTP method, such as `GET`. */
|
|
9
|
+
readonly method: Schema.String;
|
|
10
|
+
/** The path as the definition declares it. */
|
|
11
|
+
readonly path: Schema.String;
|
|
12
|
+
readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
|
|
13
|
+
readonly reason: Schema.String;
|
|
14
|
+
}>;
|
|
15
|
+
export type OpenapiSkippedOperation = typeof OpenapiSkippedOperation.Type;
|
|
4
16
|
declare const OpenapiCompileError_base: Schema.Class<OpenapiCompileError, Schema.TaggedStruct<"OpenapiCompileError", {
|
|
5
|
-
readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
|
|
17
|
+
readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
|
|
6
18
|
readonly reason: Schema.String;
|
|
19
|
+
readonly skipped: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
20
|
+
/** The tool name the operation would have; reading that tool reports why it is missing. */
|
|
21
|
+
readonly name: Schema.String;
|
|
22
|
+
/** The HTTP method, such as `GET`. */
|
|
23
|
+
readonly method: Schema.String;
|
|
24
|
+
/** The path as the definition declares it. */
|
|
25
|
+
readonly path: Schema.String;
|
|
26
|
+
readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
|
|
27
|
+
readonly reason: Schema.String;
|
|
28
|
+
}>>>;
|
|
29
|
+
readonly origins: Schema.optionalKey<Schema.$Array<Schema.String>>;
|
|
7
30
|
}>, import("effect/Cause").YieldableError>;
|
|
8
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* A safe generation failure. `reason` explains the cause; `skipped` lists the declared operations
|
|
33
|
+
* it left out and why, and `origins` the origins operations resolve to when none of them matches
|
|
34
|
+
* the allowed origin. Reading one left-out tool fails with this error for that operation alone.
|
|
35
|
+
*/
|
|
9
36
|
export declare class OpenapiCompileError extends OpenapiCompileError_base {
|
|
37
|
+
get message(): string;
|
|
10
38
|
}
|
|
11
39
|
export {};
|
|
@@ -20,7 +20,8 @@ export type OpenapiErrorResponse = typeof OpenapiErrorResponse.Type;
|
|
|
20
20
|
/** Resolved OpenAPI parameter shared by import validation and request construction. */
|
|
21
21
|
export declare const OpenapiParameter: Schema.Struct<{
|
|
22
22
|
readonly name: Schema.String;
|
|
23
|
-
|
|
23
|
+
/** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
|
|
24
|
+
readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
|
|
24
25
|
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
25
26
|
readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
26
27
|
readonly style: Schema.optionalKey<Schema.String>;
|
|
@@ -45,7 +46,7 @@ export declare const OpenapiOperation: Schema.Struct<{
|
|
|
45
46
|
/** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
|
|
46
47
|
readonly operationId: Schema.optionalKey<Schema.String>;
|
|
47
48
|
readonly description: Schema.String;
|
|
48
|
-
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
|
|
49
|
+
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
|
|
49
50
|
readonly path: Schema.String;
|
|
50
51
|
readonly baseUrl: Schema.String;
|
|
51
52
|
readonly openapi: Schema.String;
|
|
@@ -54,7 +55,8 @@ export declare const OpenapiOperation: Schema.Struct<{
|
|
|
54
55
|
readonly request: Schema.Struct<{
|
|
55
56
|
readonly parameters: Schema.$Array<Schema.Struct<{
|
|
56
57
|
readonly name: Schema.String;
|
|
57
|
-
|
|
58
|
+
/** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
|
|
59
|
+
readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
|
|
58
60
|
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
59
61
|
readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
60
62
|
readonly style: Schema.optionalKey<Schema.String>;
|
|
@@ -92,6 +94,8 @@ export declare const OpenapiOperation: Schema.Struct<{
|
|
|
92
94
|
}>>>;
|
|
93
95
|
}>;
|
|
94
96
|
export type OpenapiOperation = typeof OpenapiOperation.Type;
|
|
97
|
+
/** Safe methods, whose operations are queries unless `kinds` says otherwise. QUERY is OpenAPI 3.2's. */
|
|
98
|
+
export declare const isOpenapiReadMethod: (method: OpenapiOperation["method"]) => method is "GET" | "HEAD" | "OPTIONS" | "QUERY";
|
|
95
99
|
/** Map a selected account field to one Swagger credential value. */
|
|
96
100
|
export declare const CredentialBinding: Schema.Struct<{
|
|
97
101
|
readonly scheme: Schema.String;
|
|
@@ -125,7 +129,7 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
|
|
|
125
129
|
/** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
|
|
126
130
|
readonly operationId: Schema.optionalKey<Schema.String>;
|
|
127
131
|
readonly description: Schema.String;
|
|
128
|
-
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
|
|
132
|
+
readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
|
|
129
133
|
readonly path: Schema.String;
|
|
130
134
|
readonly baseUrl: Schema.String;
|
|
131
135
|
readonly openapi: Schema.String;
|
|
@@ -134,7 +138,8 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
|
|
|
134
138
|
readonly request: Schema.Struct<{
|
|
135
139
|
readonly parameters: Schema.$Array<Schema.Struct<{
|
|
136
140
|
readonly name: Schema.String;
|
|
137
|
-
|
|
141
|
+
/** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
|
|
142
|
+
readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
|
|
138
143
|
readonly required: Schema.optionalKey<Schema.Boolean>;
|
|
139
144
|
readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
|
|
140
145
|
readonly style: Schema.optionalKey<Schema.String>;
|
|
@@ -223,7 +228,12 @@ export declare const defaultOpenapiResponseLimits: {
|
|
|
223
228
|
readonly maxBodyBytes: 16777216;
|
|
224
229
|
readonly readTimeoutMs: 30000;
|
|
225
230
|
};
|
|
226
|
-
/**
|
|
231
|
+
/**
|
|
232
|
+
* A sequence of JSON values, one per line or record: NDJSON, JSON Lines and `json-seq`, whose
|
|
233
|
+
* items OpenAPI 3.2 describes with `itemSchema`. The body is not one JSON value.
|
|
234
|
+
*/
|
|
235
|
+
export declare const isOpenapiJsonSequence: (type: string) => boolean;
|
|
236
|
+
/** Media returned as text rather than a base64 file. JSON sequences remain unparsed text. */
|
|
227
237
|
export declare const isOpenapiTextMedia: (type: string) => boolean;
|
|
228
238
|
/** A form field that carries raw file bytes: OpenAPI 3.1 `contentMediaType` without an
|
|
229
239
|
* encoding, or the `format: binary` string that 3.1 documents still commonly use. */
|
|
@@ -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
|
|
@@ -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
|
|
43
|
-
* its
|
|
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;
|
|
@@ -56,6 +56,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
56
56
|
readonly websiteUrl?: string;
|
|
57
57
|
} | {};
|
|
58
58
|
}, ProviderError | McpError, never>;
|
|
59
|
+
check: Effect.Effect<void, ProviderError | McpError, never>;
|
|
59
60
|
call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
|
|
60
61
|
readonly content: readonly {
|
|
61
62
|
readonly [x: string]: Schema.Json;
|
|
@@ -1,6 +1,6 @@
|
|
|
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
4
|
/** Discover and call with a fresh selected-account transport for each operation. */
|
|
5
5
|
export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
|
|
6
6
|
list: Effect.Effect<{
|
|
@@ -40,6 +40,7 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
|
|
|
40
40
|
readonly websiteUrl?: string;
|
|
41
41
|
} | {};
|
|
42
42
|
}, ProviderError | McpError, never>;
|
|
43
|
+
check: Effect.Effect<void, ProviderError | McpError, never>;
|
|
43
44
|
call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
|
|
44
45
|
readonly content: readonly {
|
|
45
46
|
readonly [x: string]: Schema.Json;
|
|
@@ -53,5 +54,14 @@ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.
|
|
|
53
54
|
readonly isError?: boolean;
|
|
54
55
|
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
55
56
|
}, McpError, never>;
|
|
57
|
+
/**
|
|
58
|
+
* Check one account: initialize and read the first page of tools with the account's headers, then
|
|
59
|
+
* repeat that with no headers on a fresh transport. A refused account fails with its
|
|
60
|
+
* `ProviderError`, and anything else that stops the first check is an `McpError`; the second never
|
|
61
|
+
* runs. The check passes only when the server refuses the second, which shows it checked the
|
|
62
|
+
* credentials. Otherwise it fails with `McpCredentialsUnverified`. Both share one budget, which
|
|
63
|
+
* ends early enough before the check context's deadline to close the session and report why.
|
|
64
|
+
*/
|
|
65
|
+
export declare const mcpHealthEffect: (check: McpHealthCheck, options: McpHealthOptions) => Effect.Effect<void, ProviderError | McpError | McpCredentialsUnverified, never>;
|
|
56
66
|
/** Discover and compile all tools for connection probes and low-level consumers. */
|
|
57
67
|
export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | McpError, never>;
|
|
@@ -11,6 +11,8 @@ import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/ope
|
|
|
11
11
|
export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: JsonObject, options?: {
|
|
12
12
|
readonly baseUrl?: string;
|
|
13
13
|
readonly allowedOrigin?: string;
|
|
14
|
+
/** Inserted between every operation's server and path; see `prefixParameters`. */
|
|
15
|
+
readonly pathPrefix?: string;
|
|
14
16
|
readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
|
|
15
17
|
readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
|
|
16
18
|
}) => Effect.Effect<{
|
|
@@ -19,7 +21,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
19
21
|
readonly request: {
|
|
20
22
|
readonly parameters: readonly {
|
|
21
23
|
readonly name: string;
|
|
22
|
-
readonly in: "query" | "path" | "header" | "cookie";
|
|
24
|
+
readonly in: "query" | "path" | "querystring" | "header" | "cookie";
|
|
23
25
|
readonly required?: boolean;
|
|
24
26
|
readonly schema?: {
|
|
25
27
|
readonly [x: string]: Schema.Json;
|
|
@@ -59,7 +61,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
59
61
|
readonly input: {
|
|
60
62
|
readonly [x: string]: Schema.Json;
|
|
61
63
|
};
|
|
62
|
-
readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
|
|
64
|
+
readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "QUERY";
|
|
63
65
|
readonly securitySchemes: {
|
|
64
66
|
readonly [x: string]: {
|
|
65
67
|
readonly [x: string]: Schema.Json;
|
|
@@ -87,6 +89,14 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
|
|
|
87
89
|
};
|
|
88
90
|
}[];
|
|
89
91
|
}[];
|
|
92
|
+
/** Declared operations left out of `operations`, in definition order. */
|
|
93
|
+
skipped: {
|
|
94
|
+
readonly name: string;
|
|
95
|
+
readonly method: string;
|
|
96
|
+
readonly path: string;
|
|
97
|
+
readonly code: "server_protocol" | "server_url" | "external_reference" | "circular_reference" | "schema_keyword" | "schema_reference" | "missing_component" | "openapi_version" | "auth_helper" | "auth_missing" | "operation_path" | "operation_method" | "duplicate_operation" | "server_missing" | "multiple_hosts" | "parameter_encoding" | "parameter_style" | "request_body" | "combined_oauth" | "auth_method" | "event_stream" | "input_schema" | "no_operations" | "no_supported_operations" | "invalid_document" | "source_generation" | "authoring_reference";
|
|
98
|
+
readonly reason: string;
|
|
99
|
+
}[];
|
|
90
100
|
definitions: {
|
|
91
101
|
[k: string]: {
|
|
92
102
|
readonly [x: string]: Schema.Json;
|
|
@@ -13,10 +13,18 @@ export declare const DocumentObject: Schema.declare<{
|
|
|
13
13
|
export declare const documentObject: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => {
|
|
14
14
|
readonly [x: string]: Schema.Json;
|
|
15
15
|
};
|
|
16
|
+
/** One JSON Pointer reference token. */
|
|
17
|
+
export declare const pointerToken: (key: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Decode one part of the definition, located by the JSON Pointer `at`. A mismatch names the
|
|
20
|
+
* pointer of the first failing value and what was expected there.
|
|
21
|
+
*/
|
|
22
|
+
export declare const decodeDefinition: <S extends Schema.Decoder<unknown>>(schema: S, value: unknown, at: string, what: string) => S["Type"];
|
|
16
23
|
/** Resolve OpenAPI objects once; schemas retain their original recursive references.
|
|
17
|
-
* Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer
|
|
18
|
-
* 3.1 keywords that appear in 3.0 documents keep
|
|
19
|
-
* Unsupported versions, references and conversions throw TemplateError at the
|
|
24
|
+
* Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer reads 3.1 and 3.2,
|
|
25
|
+
* whose Schema Objects share one dialect, and 3.1 keywords that appear in 3.0 documents keep
|
|
26
|
+
* their meaning. Unsupported versions, references and conversions throw TemplateError at the
|
|
27
|
+
* import boundary.
|
|
20
28
|
*/
|
|
21
29
|
export declare function openApiDocument(input: JsonObject): Promise<{
|
|
22
30
|
spec: {
|
|
@@ -51,14 +59,20 @@ export declare function openApiDocument(input: JsonObject): Promise<{
|
|
|
51
59
|
definitions: Map<string, {
|
|
52
60
|
readonly [x: string]: Schema.Json;
|
|
53
61
|
}>;
|
|
62
|
+
/**
|
|
63
|
+
* The JSON Pointer of the object a local reference resolved to, so a diagnostic can locate
|
|
64
|
+
* a resolved Response, Parameter, Request Body or Path Item where the definition declares it.
|
|
65
|
+
*/
|
|
66
|
+
origin(value: unknown): string | undefined;
|
|
54
67
|
/** Inspect a component schema without expanding its children. OpenAPI object refs must already be resolved by Swagger. */
|
|
55
68
|
resolve(value: JsonObject): JsonObject;
|
|
56
69
|
/** Compose a Draft 2020-12 schema around API Schema Objects. Only values passed to
|
|
57
70
|
* `api` use the document's OpenAPI dialect; Executor-authored wrappers are already
|
|
58
|
-
* Draft 2020-12 and must not be reinterpreted.
|
|
59
|
-
*
|
|
71
|
+
* Draft 2020-12 and must not be reinterpreted. `api` takes the schema's JSON Pointer in the
|
|
72
|
+
* definition, which failures name. Reached components are converted once into the shared
|
|
73
|
+
* `definitions` and stay references here; nothing is inlined or copied per operation.
|
|
60
74
|
*/
|
|
61
|
-
schema(build: (api: (input: Schema.Json) => JsonObject) => JsonObject): JsonObject;
|
|
75
|
+
schema(build: (api: (input: Schema.Json, at: string) => JsonObject) => JsonObject): JsonObject;
|
|
62
76
|
}>;
|
|
63
77
|
/** A parsed document with one reference scope and one schema dialect. */
|
|
64
78
|
export type OpenApiDocument = Awaited<ReturnType<typeof openApiDocument>>;
|
|
@@ -11,8 +11,13 @@ export interface OperationNameInput {
|
|
|
11
11
|
readonly path: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
15
|
-
* the path's version segment, then by the
|
|
16
|
-
*
|
|
14
|
+
* Name every input, in input order. Names that collide, whether or not they come from an
|
|
15
|
+
* operationId, are refined together: first by the path's version segment, then by the path
|
|
16
|
+
* segments that tell them apart (`GET /items` and `GET /items/{id}` are `items.getItems` and
|
|
17
|
+
* `items.getItemsById`), then by the whole path, then by the HTTP method, then by a stable hash.
|
|
18
|
+
* Refinement only touches the colliding names, so adding an operation never renames an unrelated
|
|
19
|
+
* one.
|
|
17
20
|
*/
|
|
18
|
-
export declare const planOperationNames: (inputs: readonly
|
|
21
|
+
export declare const planOperationNames: <I extends OperationNameInput>(inputs: readonly I[]) => (I & {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
})[];
|
|
@@ -16,6 +16,12 @@ export interface OpenapiSourceOptions extends Omit<OpenapiToolsOptions, "operati
|
|
|
16
16
|
readonly allowedOrigin: string;
|
|
17
17
|
readonly securitySchemes: Readonly<Record<string, JsonObject>>;
|
|
18
18
|
readonly baseUrl?: string;
|
|
19
|
+
/**
|
|
20
|
+
* A path inserted between the server and every operation's path, for a definition that omits a
|
|
21
|
+
* leading segment, such as `/projects/{project}`. Each `{name}` becomes a required string path
|
|
22
|
+
* parameter of every tool, unless the operation already declares it without placing it.
|
|
23
|
+
*/
|
|
24
|
+
readonly pathPrefix?: string;
|
|
19
25
|
readonly freshFor?: Duration.Input;
|
|
20
26
|
readonly staleFor?: Duration.Input;
|
|
21
27
|
/**
|
package/types/apps/src/mcp.d.ts
CHANGED
|
@@ -1,11 +1,30 @@
|
|
|
1
1
|
/** HTTP MCP helpers. Requires the optional @modelcontextprotocol/sdk peer. */
|
|
2
2
|
import type { OperationKinds } from "./implementation/protocol-operations.js";
|
|
3
|
+
import type { McpHealthOptions } from "./contracts/mcp.js";
|
|
4
|
+
import type { AccountCheckContext, AuthMethods } from "./contracts/provider.js";
|
|
3
5
|
import { type McpCatalogOptions } from "./implementation/mcp-catalog.js";
|
|
4
6
|
export type { McpCatalogOptions } from "./implementation/mcp-catalog.js";
|
|
5
|
-
export { McpError, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
|
|
7
|
+
export { McpCredentialsUnverified, McpError, type McpHealthOptions, type McpToolContext, type McpToolsOptions, type McpToolResult, } from "./contracts/mcp.js";
|
|
6
8
|
/**
|
|
7
9
|
* A router over a server's tools for the selected account. Its title, description and
|
|
8
10
|
* instructions come from the server. Kinds override uncertain upstream read-only hints.
|
|
9
11
|
*/
|
|
10
12
|
export declare const mcpRouter: (options: McpCatalogOptions, kinds?: OperationKinds) => Promise<import("./index.js").RouterDeclaration<unknown, unknown>>;
|
|
13
|
+
/**
|
|
14
|
+
* A provider `health` check for an MCP server. Pass the check context `health` receives, then the
|
|
15
|
+
* server's `url` and the `headers` that send the account's credentials:
|
|
16
|
+
* `health: (check) => mcpHealth(check, { url, headers: headers(check.account) })`.
|
|
17
|
+
*
|
|
18
|
+
* It connects with those headers, initializes, and reads the first page of tools, then does the
|
|
19
|
+
* same without any headers. No tool runs. The check passes only when the server accepts the account
|
|
20
|
+
* and refuses the attempt without credentials. A refused account throws `ProviderError`, as HTTP
|
|
21
|
+
* helpers do. An unreachable or unusable server throws `McpError`. A server that also answers
|
|
22
|
+
* without credentials, or whose answer to that attempt is not a refusal, throws
|
|
23
|
+
* `McpCredentialsUnverified`. Either error means the check could not verify the account, and the
|
|
24
|
+
* account form explains why. Send credentials only in `headers`; the attempt without them uses the
|
|
25
|
+
* same `url`. The check context's `signal` cancels both attempts, and they share one budget that
|
|
26
|
+
* ends early enough before its `deadline` to report a server that did not answer in time.
|
|
27
|
+
* `timeoutMs` can only shorten that budget.
|
|
28
|
+
*/
|
|
29
|
+
export declare const mcpHealth: <Auth extends AuthMethods>(check: AccountCheckContext<Auth>, options: McpHealthOptions) => Promise<void>;
|
|
11
30
|
export type { OperationKinds } from "./implementation/protocol-operations.js";
|