apps 0.0.1-beta.24 → 0.0.1-beta.26
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/framework-reference.json +1 -1
- package/js/{chunk-IJX4CYZO.js → chunk-2TP7C25K.js} +3 -3
- package/js/{chunk-KUMBKVJD.js → chunk-3YN4UDPB.js} +2 -2
- package/js/{chunk-B3T7CZOH.js → chunk-4CMJD7AB.js} +29 -7
- package/js/{chunk-M3B3DE4K.js → chunk-AAAMPT6F.js} +2 -2
- package/js/{chunk-3HH4OZR3.js → chunk-BTRBOOTD.js} +23 -25
- package/js/chunk-DAIW2WM3.js +118 -0
- package/js/{chunk-CDL5PM2Q.js → chunk-DM5U7G7V.js} +124 -124
- package/js/{chunk-ODEIDRGW.js → chunk-DUEZ2XCO.js} +3 -3
- package/js/{chunk-WFEUCUFF.js → chunk-EXDR4HVM.js} +184 -30
- package/js/{chunk-N7YDVXYJ.js → chunk-GH6PY5BQ.js} +1 -1
- package/js/{chunk-K2QATKIF.js → chunk-HIYRKEWP.js} +77 -22
- package/js/{chunk-PZB6T6KU.js → chunk-HQKIPKM5.js} +1 -1
- package/js/{chunk-66JAEDTE.js → chunk-IE6W5RNN.js} +2 -2
- package/js/{chunk-27F7W2LG.js → chunk-KKGRSXUK.js} +1 -1
- package/js/{chunk-57RKNWL2.js → chunk-KNJAOYV4.js} +2 -2
- package/js/{chunk-ZQINWV4W.js → chunk-LPN4ONWW.js} +2 -2
- package/js/{chunk-A5BSZKFF.js → chunk-NXO2GN2T.js} +8 -8
- package/js/{chunk-UK573G7W.js → chunk-OBXHLFGQ.js} +1 -1
- package/js/{chunk-JWNSH5CA.js → chunk-OI7OI2U3.js} +2 -2
- package/js/{chunk-IPI4MFSN.js → chunk-PC5RHPUP.js} +2 -2
- package/js/{chunk-VFZKSM3T.js → chunk-SUY33XAY.js} +1 -1
- package/js/{chunk-R3EV5FTO.js → chunk-T7WRQJUF.js} +55 -3
- package/js/{chunk-JU7VHODU.js → chunk-TACLXEAE.js} +1 -1
- package/js/{chunk-2KZ7GG43.js → chunk-VGEPL4BV.js} +146 -53
- package/js/{chunk-S47NFEWF.js → chunk-WPKXOTKM.js} +3 -3
- package/js/{chunk-PJJ24GU7.js → chunk-XBG3M64K.js} +1 -1
- package/js/{chunk-AK54RD3A.js → chunk-XIRAIB3P.js} +4 -4
- package/js/{chunk-NKLWZJLE.js → chunk-ZVMZWXVF.js} +2 -2
- package/js/client.js +10 -10
- package/js/contracts.js +36 -14
- 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 +21 -21
- package/js/mcp/stdio.js +30 -25
- package/js/mcp.js +23 -23
- 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/api-response-error.d.ts +4 -0
- package/types/apps/src/contracts/failure.d.ts +30 -1
- package/types/apps/src/contracts/host.d.ts +5 -4
- package/types/apps/src/contracts/mcp.d.ts +8 -1
- 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/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +16 -2
- package/types/apps/src/contracts/protocols/2.d.ts +1 -1
- package/types/apps/src/contracts/protocols/3.d.ts +1 -3
- package/types/apps/src/contracts/protocols/4.d.ts +1 -2
- package/types/apps/src/contracts/protocols/5.d.ts +3 -3
- package/types/apps/src/contracts/protocols/6.d.ts +3 -3
- package/types/apps/src/contracts/protocols/7.d.ts +3 -3
- package/types/apps/src/contracts/protocols/8.d.ts +1119 -0
- package/types/apps/src/contracts/provider-error.d.ts +9 -0
- package/types/apps/src/implementation/failure-detail.d.ts +22 -3
- package/types/apps/src/implementation/mcp-client.d.ts +6 -0
- 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/implementation/provider-error.d.ts +28 -1
- package/types/apps/src/implementation/router-catalog.d.ts +2 -3
- package/types/apps/src/implementation/upstream-error.d.ts +7 -0
- package/types/telemetry/src/config.d.ts +2 -2
- package/js/chunk-MKWZPDR6.js +0 -63
|
@@ -3,12 +3,21 @@ declare const ProviderError_base: Schema.Class<ProviderError, Schema.TaggedStruc
|
|
|
3
3
|
readonly reason: Schema.Literals<readonly ["unauthorized", "forbidden", "rate_limited", "unavailable", "rejected"]>;
|
|
4
4
|
readonly status: Schema.optional<Schema.Int>;
|
|
5
5
|
readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
|
|
6
|
+
readonly phase: Schema.optional<Schema.Literals<readonly ["connect", "discover", "call"]>>;
|
|
7
|
+
readonly upstream: Schema.optional<Schema.Struct<{
|
|
8
|
+
readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
|
|
9
|
+
readonly message: Schema.optionalKey<Schema.String>;
|
|
10
|
+
}>>;
|
|
6
11
|
}>, import("effect/Cause").YieldableError>;
|
|
7
12
|
/**
|
|
8
13
|
* A recognized service failure. App authors can throw this ordinary Error from
|
|
9
14
|
* async code. Supply only a known reason and the account used for that request.
|
|
10
15
|
* Never include response bodies, messages, URLs or credentials. A bare 403 is
|
|
11
16
|
* `rejected`; `forbidden` requires explicit evidence of insufficient permission.
|
|
17
|
+
*
|
|
18
|
+
* The framework adds the phase the failure happened in, and `upstream`: the error code and
|
|
19
|
+
* description the service stated in its documented error format, such as a Bearer challenge's
|
|
20
|
+
* `error` and `error_description`. Account secrets in that text are replaced.
|
|
12
21
|
*/
|
|
13
22
|
export declare class ProviderError extends ProviderError_base {
|
|
14
23
|
}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { Redacted } from "effect";
|
|
1
|
+
import { Option, Redacted } from "effect";
|
|
2
2
|
import type { ResolvedAccounts } from "../contracts/host.js";
|
|
3
|
+
import { McpError } from "../contracts/mcp.js";
|
|
4
|
+
import type { ProviderError } from "../contracts/provider-error.js";
|
|
5
|
+
import { type FailureFields, type FailurePhase, type UpstreamError } from "../contracts/failure.js";
|
|
3
6
|
/** Fields of `FailureDetail` as constructor input. */
|
|
4
7
|
export interface FailureDetail {
|
|
5
8
|
readonly source?: "app" | "storage" | "service";
|
|
6
9
|
readonly errorName?: string;
|
|
7
10
|
readonly code?: string;
|
|
8
11
|
readonly message?: string;
|
|
12
|
+
readonly fields?: FailureFields;
|
|
9
13
|
}
|
|
10
14
|
/**
|
|
11
15
|
* Every credential field value of a slot-to-account record, longest first. Accepts both resolved
|
|
@@ -16,11 +20,26 @@ export declare const accountFieldSecrets: (accounts: unknown) => string[];
|
|
|
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<McpError>;
|
|
19
38
|
/** `Name: message` for any thrown value, before redaction. */
|
|
20
39
|
export declare const describeFailure: (error: unknown) => string;
|
|
21
40
|
/**
|
|
22
41
|
* Describe what an operation raised for the app's own caller. App data failures keep their
|
|
23
|
-
* reason as a code, as do app cache failures; any other thrown value is the app's own error
|
|
24
|
-
* Account secrets are replaced.
|
|
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.
|
|
25
44
|
*/
|
|
26
45
|
export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
|
|
@@ -4,7 +4,13 @@ import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
|
4
4
|
import type { jsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/types.js";
|
|
5
5
|
import { Effect, Schema } from "effect";
|
|
6
6
|
import { McpError, type McpToolContext } from "../contracts/mcp.js";
|
|
7
|
+
import type { UpstreamError } from "../contracts/failure.js";
|
|
7
8
|
import type { JsonObject } from "../effect.js";
|
|
9
|
+
/**
|
|
10
|
+
* The JSON-RPC error a server answered a request with, if `error` is one. The SDK formats its
|
|
11
|
+
* message as `MCP error <code>: <message>`; the server's own message follows that prefix.
|
|
12
|
+
*/
|
|
13
|
+
export declare const answeredError: (error: unknown) => UpstreamError | undefined;
|
|
8
14
|
/** Use the framework-owned interpreter at the MCP SDK's synchronous validation boundary. */
|
|
9
15
|
export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
|
|
10
16
|
/** An operation owns its connection; it must close even when interrupted. */
|
|
@@ -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
|
/**
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import { Option } from "effect";
|
|
2
|
+
import type { FailurePhase, UpstreamError } from "../contracts/failure.js";
|
|
2
3
|
import { ProviderError } from "../contracts/provider-error.js";
|
|
4
|
+
import { AccountId } from "../contracts/schema.js";
|
|
5
|
+
/** A provider failure's fields, each optional one possibly absent. */
|
|
6
|
+
interface ProviderErrorFields {
|
|
7
|
+
readonly reason: ProviderError["reason"];
|
|
8
|
+
readonly status?: number | undefined;
|
|
9
|
+
readonly accountId?: AccountId | undefined;
|
|
10
|
+
readonly phase?: FailurePhase | undefined;
|
|
11
|
+
readonly upstream?: UpstreamError | undefined;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Construct a provider failure without keys for absent fields. Failures inside a catalog cross the
|
|
15
|
+
* boundary as JSON values, which have no `undefined`.
|
|
16
|
+
*/
|
|
17
|
+
export declare const providerError: ({ reason, status, accountId, phase, upstream, }: ProviderErrorFields) => ProviderError;
|
|
3
18
|
/** Parse and rebuild the allowlisted fields, including when the input is already an Error instance. */
|
|
4
19
|
export declare function parseProviderError(error: unknown): Option.Option<ProviderError>;
|
|
5
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* The same failure with detail its raiser could not know: the phase it happened in, and the
|
|
22
|
+
* error the service stated. Detail the failure already carries is kept.
|
|
23
|
+
*/
|
|
24
|
+
export declare function providerErrorDetail(error: ProviderError, detail: {
|
|
25
|
+
readonly phase?: FailurePhase;
|
|
26
|
+
readonly upstream?: UpstreamError | undefined;
|
|
27
|
+
}): ProviderError;
|
|
28
|
+
/**
|
|
29
|
+
* Classify only explicit HTTP evidence. Raw provider content never enters the error; a Bearer
|
|
30
|
+
* challenge's documented error code and description do.
|
|
31
|
+
*/
|
|
6
32
|
export declare function httpProviderError(status: number, headers?: Readonly<Record<string, string>>): ProviderError | undefined;
|
|
7
33
|
/** Attach the account used by the enclosing operation, without preserving arbitrary thrown fields. */
|
|
8
34
|
export declare function accountProviderError<E>(error: E, accountId: string): E | ProviderError;
|
|
9
35
|
/** GraphQL has no standard auth code; recognize these documented codes without guessing from prose. */
|
|
10
36
|
export declare function graphqlProviderError(errors: readonly unknown[], status: number): ProviderError | undefined;
|
|
37
|
+
export {};
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { Effect, Schema } from "effect";
|
|
6
6
|
import { HostDeclarationInvalid, HostEvaluationFailed, type HostRouterError } from "../contracts/host.js";
|
|
7
|
-
import { McpError } from "../contracts/mcp.js";
|
|
8
7
|
import type { AppOperation } from "../contracts/operations.js";
|
|
9
8
|
import type { AppRouter, DynamicRouter, RouterMeta } from "../contracts/router.js";
|
|
10
9
|
import { SkillLoadFailed } from "../contracts/skills.js";
|
|
@@ -189,7 +188,7 @@ export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined,
|
|
|
189
188
|
})[];
|
|
190
189
|
routers: {
|
|
191
190
|
readonly path: string;
|
|
192
|
-
readonly error?: import("../index.js").ProviderError | SkillLoadFailed |
|
|
191
|
+
readonly error?: import("../index.js").ProviderError | SkillLoadFailed | HostDeclarationInvalid | HostEvaluationFailed | import("../mcp.js").McpError;
|
|
193
192
|
readonly description?: string;
|
|
194
193
|
readonly title?: string;
|
|
195
194
|
readonly tags?: {
|
|
@@ -203,7 +202,7 @@ export declare const readCatalog: (root: AppRouter | DynamicRouter | undefined,
|
|
|
203
202
|
}[];
|
|
204
203
|
readonly skill?: string;
|
|
205
204
|
}[];
|
|
206
|
-
}, import("../index.js").ProviderError | SkillLoadFailed |
|
|
205
|
+
}, import("../index.js").ProviderError | SkillLoadFailed | HostDeclarationInvalid | HostEvaluationFailed | import("../mcp.js").McpError, never>;
|
|
207
206
|
/**
|
|
208
207
|
* One skill for each router with instructions. Skills and tools fail independently: a dynamic
|
|
209
208
|
* router whose metadata cannot be read, including the root, contributes no skill and does not
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UpstreamError } from "../contracts/failure.js";
|
|
2
|
+
/** Whether `bounded` shortened this message, so it may end partway through a secret. */
|
|
3
|
+
export declare const isShortenedUpstream: (message: string) => boolean;
|
|
4
|
+
/** The error a JSON error body states, if it uses JSON-RPC's or OAuth's error format. */
|
|
5
|
+
export declare const bodyUpstreamError: (json: unknown) => UpstreamError | undefined;
|
|
6
|
+
/** The `error` and `error_description` of a Bearer challenge (RFC 6750, section 3). */
|
|
7
|
+
export declare const challengeUpstreamError: (header: string | undefined) => UpstreamError | undefined;
|
|
@@ -33,8 +33,8 @@ export declare const TelemetryConfig: Schema.Struct<{
|
|
|
33
33
|
export type TelemetryConfig = typeof TelemetryConfig.Type;
|
|
34
34
|
/** Host-only destinations; never copied into an app's invocation telemetry capability. */
|
|
35
35
|
export declare const CurrentTelemetryConfig: Context.Reference<{
|
|
36
|
-
readonly version: string;
|
|
37
36
|
readonly service: string;
|
|
37
|
+
readonly version: string;
|
|
38
38
|
readonly environment: string;
|
|
39
39
|
readonly clock?: "system" | "cloudflare-io" | undefined;
|
|
40
40
|
readonly traces?: {
|
|
@@ -59,8 +59,8 @@ export declare const CurrentTelemetryConfig: Context.Reference<{
|
|
|
59
59
|
} | undefined>;
|
|
60
60
|
/** Read OTLP endpoints uniformly for all signals; development chooses which signals to configure. */
|
|
61
61
|
export declare const telemetryConfig: (service: string) => Effect.Effect<{
|
|
62
|
-
readonly version: string;
|
|
63
62
|
readonly service: string;
|
|
63
|
+
readonly version: string;
|
|
64
64
|
readonly environment: string;
|
|
65
65
|
readonly clock?: "system" | "cloudflare-io" | undefined;
|
|
66
66
|
readonly traces?: {
|
package/js/chunk-MKWZPDR6.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ProviderError
|
|
3
|
-
} from "./chunk-R3EV5FTO.js";
|
|
4
|
-
import {
|
|
5
|
-
AccountId
|
|
6
|
-
} from "./chunk-27F7W2LG.js";
|
|
7
|
-
import {
|
|
8
|
-
Option_exports,
|
|
9
|
-
Schema_exports
|
|
10
|
-
} from "./chunk-CDL5PM2Q.js";
|
|
11
|
-
|
|
12
|
-
// src/implementation/provider-error.ts
|
|
13
|
-
function parseProviderError(error) {
|
|
14
|
-
return Schema_exports.decodeUnknownOption(ProviderError)(error).pipe(
|
|
15
|
-
Option_exports.map(({ reason, status, accountId }) => new ProviderError({ reason, status, accountId }))
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
function httpProviderError(status, headers = {}) {
|
|
19
|
-
if (status >= 500 && status <= 599) return new ProviderError({ reason: "unavailable", status });
|
|
20
|
-
if (status === 401) return new ProviderError({ reason: "unauthorized", status });
|
|
21
|
-
if (status === 429) return new ProviderError({ reason: "rate_limited", status });
|
|
22
|
-
if (status !== 403) return void 0;
|
|
23
|
-
const retry = headers["retry-after"];
|
|
24
|
-
if (headers["x-ratelimit-remaining"] === "0" || retry !== void 0 && (/^\d+$/.test(retry) || Number.isFinite(Date.parse(retry))))
|
|
25
|
-
return new ProviderError({ reason: "rate_limited", status });
|
|
26
|
-
if (/\bBearer\b.*\berror="insufficient_scope"/i.test(headers["www-authenticate"] ?? ""))
|
|
27
|
-
return new ProviderError({ reason: "forbidden", status });
|
|
28
|
-
return new ProviderError({ reason: "rejected", status });
|
|
29
|
-
}
|
|
30
|
-
function accountProviderError(error, accountId) {
|
|
31
|
-
const parsed = parseProviderError(error);
|
|
32
|
-
const account = Schema_exports.decodeUnknownOption(AccountId)(accountId);
|
|
33
|
-
if (Option_exports.isNone(parsed) || Option_exports.isNone(account)) return error;
|
|
34
|
-
return new ProviderError({
|
|
35
|
-
reason: parsed.value.reason,
|
|
36
|
-
status: parsed.value.status,
|
|
37
|
-
accountId: account.value
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function graphqlProviderError(errors, status) {
|
|
41
|
-
const codes = errors.flatMap((error) => {
|
|
42
|
-
const parsed = Schema_exports.decodeUnknownOption(
|
|
43
|
-
Schema_exports.Struct({
|
|
44
|
-
type: Schema_exports.optional(Schema_exports.String),
|
|
45
|
-
extensions: Schema_exports.optional(Schema_exports.Struct({ code: Schema_exports.optional(Schema_exports.String) }))
|
|
46
|
-
})
|
|
47
|
-
)(error);
|
|
48
|
-
return Option_exports.isSome(parsed) ? [parsed.value.type, parsed.value.extensions?.code] : [];
|
|
49
|
-
});
|
|
50
|
-
if (codes.includes("RATE_LIMITED") || codes.includes("TOO_MANY_REQUESTS"))
|
|
51
|
-
return new ProviderError({ reason: "rate_limited", status });
|
|
52
|
-
if (codes.includes("UNAUTHENTICATED"))
|
|
53
|
-
return new ProviderError({ reason: "unauthorized", status });
|
|
54
|
-
if (codes.includes("FORBIDDEN")) return new ProviderError({ reason: "forbidden", status });
|
|
55
|
-
return void 0;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export {
|
|
59
|
-
parseProviderError,
|
|
60
|
-
httpProviderError,
|
|
61
|
-
accountProviderError,
|
|
62
|
-
graphqlProviderError
|
|
63
|
-
};
|