apps 0.0.1-beta.0 → 0.0.1-beta.1
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 +97 -4
- package/framework-reference.json +1 -1
- package/js/{chunk-BPEFS4YF.js → chunk-2HHMABB6.js} +70 -14
- package/js/{chunk-SBKHUC5L.js → chunk-4LPG6RCH.js} +2 -2
- package/js/{chunk-LOKGDT6B.js → chunk-6IIO4NPI.js} +5 -4
- package/js/chunk-6YBRWRK3.js +160 -0
- package/js/{chunk-7JXHF5IF.js → chunk-BMOIAIVR.js} +1 -1
- package/js/chunk-CZ7CSFO4.js +39 -0
- package/js/{chunk-YDR4CPJA.js → chunk-EVJUVWN2.js} +8 -8
- package/js/{chunk-2OTCEKL2.js → chunk-FW5HBOIK.js} +2352 -1493
- package/js/{chunk-EP6AEUZO.js → chunk-FZJOYIZO.js} +1 -1
- package/js/{chunk-WIDTG42X.js → chunk-G7IE6BKC.js} +79 -26
- package/js/{chunk-VFUZI3NY.js → chunk-HDJH3RPR.js} +4 -4
- package/js/{chunk-HP7E42X6.js → chunk-IHQ4ML7K.js} +693 -219
- package/js/{chunk-Q2FD5IBM.js → chunk-KOXMLKTM.js} +430 -41
- package/js/{chunk-D6BKYP2L.js → chunk-M6ZRRIBI.js} +4 -4
- package/js/chunk-NCYXZN2G.js +6274 -0
- package/js/{chunk-3ANFZFCV.js → chunk-OHRT55C4.js} +15 -15
- package/js/{chunk-R6JMJSVT.js → chunk-PLCMJREA.js} +2 -2
- package/js/{chunk-C24KEZXR.js → chunk-PZ36XMXW.js} +36 -2
- package/js/{chunk-W7Q5EOTS.js → chunk-QKHR7BMF.js} +32 -32
- package/js/{chunk-X3YBZCJW.js → chunk-RBAC33PQ.js} +59 -38
- package/js/{chunk-36DNRFZQ.js → chunk-SATWJKN6.js} +1 -1
- package/js/chunk-SWPD52J7.js +35 -0
- package/js/{chunk-BKVL7XAJ.js → chunk-TE4KO4HI.js} +1 -1
- package/js/chunk-W7D7WVSY.js +18 -0
- package/js/{chunk-KWTCHVLT.js → chunk-X7SFGU4Q.js} +47 -51
- package/js/chunk-YEJOQEII.js +104 -0
- package/js/{chunk-OWD2YICM.js → chunk-ZCAMUXSG.js} +116 -87
- package/js/chunk-ZJWDMTE3.js +63 -0
- package/js/chunk-ZTFQHGEB.js +80 -0
- package/js/client.js +11 -11
- package/js/contracts.js +81 -25
- package/js/effect.js +20 -15
- package/js/graphql.js +223 -121
- package/js/host.js +75 -19
- package/js/index.js +191 -51
- package/js/mcp/effect.js +24 -17
- package/js/mcp/stdio.js +22 -17
- package/js/mcp.js +109 -24
- package/js/openapi.js +43897 -143
- package/js/operations/approval.js +1 -1
- package/js/react.js +4 -4
- package/js/skills/effect.js +12 -0
- package/js/skills.js +857 -0
- package/js/storage/facet.js +7 -7
- package/js/ui/auth/contracts.js +6 -6
- package/js/ui/auth.js +8 -8
- package/js/ui/contracts.js +5 -5
- package/js/ui/serving.js +12 -12
- package/package.json +9 -1
- package/runtime.json +1 -1
- package/types/app-cache/src/contracts/cache.d.ts +79 -0
- package/types/app-cache/src/index.d.ts +35 -0
- package/types/apps/src/contracts/api-response-error.d.ts +43 -0
- package/types/apps/src/contracts/app.d.ts +11 -0
- package/types/apps/src/contracts/cache.d.ts +41 -0
- package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
- package/types/apps/src/contracts/dynamic-tools.d.ts +13 -0
- package/types/apps/src/contracts/graphql.d.ts +18 -1
- package/types/apps/src/contracts/host.d.ts +200 -7
- package/types/apps/src/contracts/mcp.d.ts +3 -1
- package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
- package/types/apps/src/contracts/openapi-document.d.ts +53 -0
- package/types/apps/src/contracts/openapi.d.ts +150 -30
- package/types/apps/src/contracts/provider-error.d.ts +15 -0
- package/types/apps/src/contracts/provider.d.ts +18 -1
- package/types/apps/src/contracts/skills.d.ts +113 -0
- package/types/apps/src/contracts/swagger-client.d.ts +29 -0
- package/types/apps/src/graphql.d.ts +6 -6
- package/types/apps/src/host.d.ts +1 -0
- package/types/apps/src/implementation/account-operations.d.ts +122 -3
- package/types/apps/src/implementation/app.d.ts +1 -1
- package/types/apps/src/implementation/cache-session.d.ts +7 -0
- package/types/apps/src/implementation/cache.d.ts +6 -0
- package/types/apps/src/implementation/catalog-cache.d.ts +29 -0
- package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
- package/types/apps/src/implementation/dynamic-tools.d.ts +8 -0
- package/types/apps/src/implementation/elicitation.d.ts +12 -12
- package/types/apps/src/implementation/git.d.ts +25 -0
- package/types/apps/src/implementation/graphql-catalog.d.ts +10 -0
- package/types/apps/src/implementation/graphql.d.ts +81 -3
- package/types/apps/src/implementation/inflate.d.ts +16 -0
- package/types/apps/src/implementation/input-problems.d.ts +3 -0
- package/types/apps/src/implementation/mcp-call.d.ts +3 -2
- package/types/apps/src/implementation/mcp-catalog.d.ts +12 -0
- package/types/apps/src/implementation/mcp-client.d.ts +9 -8
- package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
- package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
- package/types/apps/src/implementation/mcp.d.ts +39 -2
- package/types/apps/src/implementation/openapi-compile.d.ts +119 -0
- package/types/apps/src/implementation/openapi-document.d.ts +53 -0
- package/types/apps/src/implementation/openapi-request.d.ts +11 -4
- package/types/apps/src/implementation/openapi-source.d.ts +36 -0
- package/types/apps/src/implementation/openapi.d.ts +39 -3
- package/types/apps/src/implementation/provider-error.d.ts +10 -0
- package/types/apps/src/implementation/schema.d.ts +11 -5
- package/types/apps/src/implementation/skill-files.d.ts +10 -0
- package/types/apps/src/implementation/skills.d.ts +43 -0
- package/types/apps/src/index.d.ts +7 -0
- package/types/apps/src/mcp.d.ts +5 -5
- package/types/apps/src/openapi.d.ts +3 -1
- package/types/apps/src/skills.d.ts +72 -0
- package/types/telemetry/src/config.d.ts +2 -0
- package/js/chunk-22WRQZT7.js +0 -389
- package/js/chunk-MLKGABMK.js +0 -9
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { HostCache } from "../contracts/cache.js";
|
|
2
|
+
/** Own all refresh promises until drained or cancelled. Only generated trusted bridges create sessions. */
|
|
3
|
+
export declare const isolatedCacheSession: (callback: (input: unknown) => Promise<unknown>) => {
|
|
4
|
+
cache: HostCache;
|
|
5
|
+
drain: () => Promise<void>;
|
|
6
|
+
cancel: () => Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AppCache, HostCache } from "../contracts/cache.js";
|
|
2
|
+
import type { ResolvedAccounts } from "../contracts/host.js";
|
|
3
|
+
/** Missing host support is explicit on use; ordinary apps do not need cache support. */
|
|
4
|
+
export declare const unavailableCache: HostCache;
|
|
5
|
+
/** Account scopes are derived from trusted current bindings. Loaders get a fresh owned HTTP signal. */
|
|
6
|
+
export declare const authorCache: (host: HostCache, accounts: ResolvedAccounts, signal: AbortSignal) => AppCache;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Duration, Effect, Schema } from "effect";
|
|
2
|
+
import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
|
|
3
|
+
import { type JsonValue } from "../contracts/schema.js";
|
|
4
|
+
export interface CatalogCacheOptions {
|
|
5
|
+
/** App/build scope, optionally narrowed to the current account. */
|
|
6
|
+
readonly cache?: AppCache;
|
|
7
|
+
/** Reuse metadata for this duration. Defaults to five minutes. */
|
|
8
|
+
readonly freshFor?: Duration.Input;
|
|
9
|
+
/** Serve retained metadata while refreshing. Defaults to one day. */
|
|
10
|
+
readonly staleFor?: Duration.Input;
|
|
11
|
+
/** Await a fresh revision at an explicit logical connection or refresh boundary. */
|
|
12
|
+
readonly revalidate?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare const catalogCache: <A extends {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
}, S>(options: CatalogCacheOptions & {
|
|
17
|
+
readonly prefix: readonly JsonValue[];
|
|
18
|
+
readonly schema: Schema.Decoder<A>;
|
|
19
|
+
/** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
|
|
20
|
+
readonly summary: {
|
|
21
|
+
readonly schema: Schema.Decoder<S>;
|
|
22
|
+
readonly of: (tool: A) => S;
|
|
23
|
+
};
|
|
24
|
+
readonly load: (context?: CacheLoadContext) => Effect.Effect<readonly A[], unknown>;
|
|
25
|
+
}) => Effect.Effect<{
|
|
26
|
+
list: () => Effect.Effect<readonly A[], unknown, never>;
|
|
27
|
+
summaries: () => Effect.Effect<S[], unknown, never>;
|
|
28
|
+
resolve: (name: string) => Effect.Effect<A | undefined, unknown, never>;
|
|
29
|
+
}, unknown, never>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Author-facing lazy skill sources adapt once to the framework's Effect execution path. */
|
|
2
|
+
import type { DynamicSkills } from "../contracts/dynamic-skills.js";
|
|
3
|
+
import type { AppSkillSource } from "../contracts/skills.js";
|
|
4
|
+
/** Declare skills that load only when skills are read, such as `list: () => githubSkills({...})`. */
|
|
5
|
+
export declare const dynamicSkills: (source: {
|
|
6
|
+
readonly list: () => readonly AppSkillSource[] | Promise<readonly AppSkillSource[]>;
|
|
7
|
+
}) => DynamicSkills;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { HostedTool } from "../contracts/host.js";
|
|
2
|
+
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
3
|
+
import { type OperationDeclaration } from "./operations.js";
|
|
4
|
+
/** Declare metadata discovery separately from executable resolution. Names are fully qualified. */
|
|
5
|
+
export declare const dynamicTools: (source: {
|
|
6
|
+
readonly list: () => Promise<readonly HostedTool[]>;
|
|
7
|
+
readonly resolve: (name: string) => Promise<OperationDeclaration<"query" | "mutation"> | undefined>;
|
|
8
|
+
}) => DynamicTools;
|
|
@@ -7,76 +7,76 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
|
|
|
7
7
|
readonly message: string;
|
|
8
8
|
readonly mode: "form";
|
|
9
9
|
readonly requestedSchema: {
|
|
10
|
+
readonly type: "object";
|
|
10
11
|
readonly properties: {
|
|
11
12
|
readonly [x: string]: {
|
|
12
13
|
readonly type: "string";
|
|
13
14
|
readonly enum: readonly string[];
|
|
14
15
|
readonly default?: string;
|
|
15
|
-
readonly title?: string;
|
|
16
16
|
readonly description?: string;
|
|
17
|
+
readonly title?: string;
|
|
17
18
|
readonly enumNames?: readonly string[];
|
|
18
19
|
} | {
|
|
19
20
|
readonly type: "string";
|
|
20
21
|
readonly enum: readonly string[];
|
|
21
22
|
readonly default?: string;
|
|
22
|
-
readonly title?: string;
|
|
23
23
|
readonly description?: string;
|
|
24
|
+
readonly title?: string;
|
|
24
25
|
} | {
|
|
26
|
+
readonly type: "string";
|
|
25
27
|
readonly oneOf: readonly {
|
|
26
28
|
readonly const: string;
|
|
27
29
|
readonly title: string;
|
|
28
30
|
}[];
|
|
29
|
-
readonly type: "string";
|
|
30
31
|
readonly default?: string;
|
|
31
|
-
readonly title?: string;
|
|
32
32
|
readonly description?: string;
|
|
33
|
+
readonly title?: string;
|
|
33
34
|
} | {
|
|
35
|
+
readonly type: "array";
|
|
34
36
|
readonly items: {
|
|
35
37
|
readonly type: "string";
|
|
36
38
|
readonly enum: readonly string[];
|
|
37
39
|
};
|
|
38
|
-
readonly type: "array";
|
|
39
40
|
readonly default?: readonly string[];
|
|
40
|
-
readonly title?: string;
|
|
41
41
|
readonly description?: string;
|
|
42
|
+
readonly title?: string;
|
|
42
43
|
readonly minItems?: number;
|
|
43
44
|
readonly maxItems?: number;
|
|
44
45
|
} | {
|
|
46
|
+
readonly type: "array";
|
|
45
47
|
readonly items: {
|
|
46
48
|
readonly anyOf: readonly {
|
|
47
49
|
readonly const: string;
|
|
48
50
|
readonly title: string;
|
|
49
51
|
}[];
|
|
50
52
|
};
|
|
51
|
-
readonly type: "array";
|
|
52
53
|
readonly default?: readonly string[];
|
|
53
|
-
readonly title?: string;
|
|
54
54
|
readonly description?: string;
|
|
55
|
+
readonly title?: string;
|
|
55
56
|
readonly minItems?: number;
|
|
56
57
|
readonly maxItems?: number;
|
|
57
58
|
} | {
|
|
58
59
|
readonly type: "string";
|
|
59
60
|
readonly default?: string;
|
|
60
61
|
readonly format?: "email" | "uri" | "date" | "date-time";
|
|
61
|
-
readonly title?: string;
|
|
62
62
|
readonly description?: string;
|
|
63
|
+
readonly title?: string;
|
|
63
64
|
readonly minLength?: number;
|
|
64
65
|
readonly maxLength?: number;
|
|
65
66
|
} | {
|
|
66
67
|
readonly type: "number" | "integer";
|
|
67
68
|
readonly default?: number;
|
|
68
|
-
readonly title?: string;
|
|
69
69
|
readonly description?: string;
|
|
70
|
+
readonly title?: string;
|
|
70
71
|
readonly minimum?: number;
|
|
71
72
|
readonly maximum?: number;
|
|
72
73
|
} | {
|
|
73
74
|
readonly type: "boolean";
|
|
74
75
|
readonly default?: boolean;
|
|
75
|
-
readonly title?: string;
|
|
76
76
|
readonly description?: string;
|
|
77
|
+
readonly title?: string;
|
|
77
78
|
};
|
|
78
79
|
};
|
|
79
|
-
readonly type: "object";
|
|
80
80
|
readonly required?: readonly string[];
|
|
81
81
|
readonly $schema?: string;
|
|
82
82
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/** A malformed git response; callers report it as an unreadable source document. */
|
|
2
|
+
export declare class GitProtocolError extends Error {
|
|
3
|
+
}
|
|
4
|
+
export declare const gitRequestHeaders: {
|
|
5
|
+
readonly "Content-Type": "application/x-git-upload-pack-request";
|
|
6
|
+
readonly "Git-Protocol": "version=2";
|
|
7
|
+
};
|
|
8
|
+
/** Candidate ref names for a branch, tag or HEAD, in lookup order. */
|
|
9
|
+
export declare const refCandidates: (ref: string | undefined) => string[];
|
|
10
|
+
/** Ask only for the named refs, peeling annotated tags to their commits. */
|
|
11
|
+
export declare const lsRefsRequest: (names: readonly string[]) => Uint8Array<ArrayBuffer>;
|
|
12
|
+
/** Map each advertised ref to its commit, using the peeled commit for annotated tags. */
|
|
13
|
+
export declare const parseLsRefs: (bytes: Uint8Array) => Map<string, string>;
|
|
14
|
+
/** Fetch one commit and its trees without file contents or history. */
|
|
15
|
+
export declare const treeFetchRequest: (commit: string) => Uint8Array<ArrayBuffer>;
|
|
16
|
+
export interface GitTreeEntry {
|
|
17
|
+
/** Repository-relative path. */
|
|
18
|
+
readonly path: string;
|
|
19
|
+
/** Git file mode, such as 100644, 100755 or 120000 for a symbolic link. */
|
|
20
|
+
readonly mode: string;
|
|
21
|
+
}
|
|
22
|
+
/** List the files at a commit, limited to one directory when `path` is set. */
|
|
23
|
+
export declare const parseTreeFetch: (bytes: Uint8Array, commit: string, path: string | undefined, limits: {
|
|
24
|
+
readonly objectBytes: number;
|
|
25
|
+
}) => Promise<GitTreeEntry[]>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { GraphqlToolsOptions } from "../contracts/graphql.js";
|
|
3
|
+
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
4
|
+
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
5
|
+
import { type OperationKinds } from "./protocol-operations.js";
|
|
6
|
+
export interface GraphqlCatalogOptions extends GraphqlToolsOptions, CatalogCacheOptions {
|
|
7
|
+
}
|
|
8
|
+
export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<{
|
|
9
|
+
dynamicTools: DynamicTools;
|
|
10
|
+
}, unknown, never>;
|
|
@@ -1,5 +1,83 @@
|
|
|
1
|
+
import { ProviderError } from "../contracts/provider-error.js";
|
|
1
2
|
/** Discover GraphQL tools live; transport, decoding and cancellation stay in Effect. */
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import {
|
|
3
|
+
import { Effect, Schema } from "effect";
|
|
4
|
+
import { OperationTypeNode } from "graphql";
|
|
5
|
+
import { GraphqlError, GraphqlIntrospection, GraphqlToolsOptions, type GraphqlToolDefinition, type GraphqlTools, type GraphqlTypeRef } from "../contracts/graphql.js";
|
|
6
|
+
import { JsonObject } from "../effect.js";
|
|
4
7
|
/** Resolve schema and calls per account evaluation; never cache credentials or tools globally. */
|
|
5
|
-
export declare const
|
|
8
|
+
export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect.Effect<{
|
|
9
|
+
request: (phase: "discover" | "call", query: string, variables?: JsonObject) => Effect.Effect<{
|
|
10
|
+
readonly [x: string]: Schema.Json;
|
|
11
|
+
}, ProviderError | GraphqlError, never>;
|
|
12
|
+
discover: Effect.Effect<{
|
|
13
|
+
readonly __schema: {
|
|
14
|
+
readonly queryType: {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
} | null;
|
|
17
|
+
readonly mutationType: {
|
|
18
|
+
readonly name: string;
|
|
19
|
+
} | null;
|
|
20
|
+
readonly types: readonly {
|
|
21
|
+
readonly kind: "SCALAR" | "OBJECT" | "INTERFACE" | "UNION" | "ENUM" | "INPUT_OBJECT" | "LIST" | "NON_NULL";
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly fields: readonly {
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly description: string | null;
|
|
26
|
+
readonly args: readonly {
|
|
27
|
+
readonly name: string;
|
|
28
|
+
readonly description: string | null;
|
|
29
|
+
readonly type: GraphqlTypeRef;
|
|
30
|
+
readonly defaultValue: string | null;
|
|
31
|
+
}[];
|
|
32
|
+
readonly type: GraphqlTypeRef;
|
|
33
|
+
}[] | null;
|
|
34
|
+
readonly inputFields: readonly {
|
|
35
|
+
readonly name: string;
|
|
36
|
+
readonly description: string | null;
|
|
37
|
+
readonly type: GraphqlTypeRef;
|
|
38
|
+
readonly defaultValue: string | null;
|
|
39
|
+
}[] | null;
|
|
40
|
+
readonly enumValues: readonly {
|
|
41
|
+
readonly name: string;
|
|
42
|
+
}[] | null;
|
|
43
|
+
}[];
|
|
44
|
+
};
|
|
45
|
+
}, ProviderError | GraphqlError, never>;
|
|
46
|
+
}, GraphqlError, never>;
|
|
47
|
+
/** Build serializable definitions once per introspection revision, without compiling validators. */
|
|
48
|
+
export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effect.Effect<{
|
|
49
|
+
name: string;
|
|
50
|
+
kind: OperationTypeNode.QUERY | OperationTypeNode.MUTATION;
|
|
51
|
+
field: string;
|
|
52
|
+
description: string;
|
|
53
|
+
arguments: {
|
|
54
|
+
name: string;
|
|
55
|
+
type: string;
|
|
56
|
+
}[];
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: string;
|
|
59
|
+
additionalProperties: boolean;
|
|
60
|
+
properties: {
|
|
61
|
+
select?: {
|
|
62
|
+
type: string;
|
|
63
|
+
minLength: number;
|
|
64
|
+
description: string;
|
|
65
|
+
};
|
|
66
|
+
arguments: {
|
|
67
|
+
readonly [x: string]: Schema.Json;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
required: string[];
|
|
71
|
+
$defs: {
|
|
72
|
+
[k: string]: {
|
|
73
|
+
readonly [x: string]: Schema.Json;
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
composite: boolean;
|
|
78
|
+
selection: string;
|
|
79
|
+
}[], GraphqlError, never>;
|
|
80
|
+
/** Bind only the selected definition to current credentials and compile its input decoder. */
|
|
81
|
+
export declare const adaptGraphqlTool: (client: Effect.Success<ReturnType<typeof graphqlClientEffect>>, definition: GraphqlToolDefinition) => Effect.Effect<import("../contracts/graphql.js").GraphqlTool, GraphqlError, never>;
|
|
82
|
+
/** Low-level callers can still request a complete invocation-owned tool map. */
|
|
83
|
+
export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal zlib (RFC 1950) and DEFLATE (RFC 1951) decoder. Git packfiles concatenate zlib streams
|
|
3
|
+
* without lengths, so readers must know where each stream ends. Platform decompression streams do
|
|
4
|
+
* not report that, so this decoder returns the offset after the stream's Adler-32 checksum.
|
|
5
|
+
*/
|
|
6
|
+
/** The stream is malformed. */
|
|
7
|
+
export declare class InflateError extends Error {
|
|
8
|
+
}
|
|
9
|
+
/** The decoded stream would exceed the caller's limit. */
|
|
10
|
+
export declare class InflateLimitExceeded extends Error {
|
|
11
|
+
}
|
|
12
|
+
/** Decode one zlib stream starting at `start`, returning its bytes and the offset after it. */
|
|
13
|
+
export declare const inflateZlib: (input: Uint8Array, start: number, limit: number) => {
|
|
14
|
+
readonly data: Uint8Array;
|
|
15
|
+
readonly end: number;
|
|
16
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderError } from "../contracts/provider-error.js";
|
|
1
2
|
/** One upstream call, with form requests forwarded to the invocation's existing elicitation capability. */
|
|
2
3
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
4
|
import { Effect, Schema } from "effect";
|
|
@@ -5,7 +6,7 @@ import { ElicitationFailed } from "../contracts/elicitation.js";
|
|
|
5
6
|
import { McpError, type McpToolContext } from "../contracts/mcp.js";
|
|
6
7
|
import type { JsonObject } from "../contracts/schema.js";
|
|
7
8
|
/** Register prompts only around tools/call, preserve metadata, and close every callback with the call. Never retries. */
|
|
8
|
-
export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError) => Effect.Effect<{
|
|
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<{
|
|
9
10
|
readonly content: readonly {
|
|
10
11
|
readonly [x: string]: Schema.Json;
|
|
11
12
|
}[];
|
|
@@ -16,4 +17,4 @@ export declare const mcpCall: (client: Client, name: string, input: JsonObject,
|
|
|
16
17
|
readonly [x: string]: Schema.Json;
|
|
17
18
|
} | undefined;
|
|
18
19
|
readonly isError?: boolean | undefined;
|
|
19
|
-
}, ElicitationFailed | McpError, never>;
|
|
20
|
+
}, ProviderError | ElicitationFailed | McpError, never>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import type { DynamicTools } from "../contracts/dynamic-tools.js";
|
|
3
|
+
import { McpToolsOptions } from "../contracts/mcp.js";
|
|
4
|
+
import { type CatalogCacheOptions } from "./catalog-cache.js";
|
|
5
|
+
import { type OperationKinds } from "./protocol-operations.js";
|
|
6
|
+
/** Metadata policy for HTTP/SSE sources. A missing cache keeps discovery invocation-local. */
|
|
7
|
+
export interface McpCatalogOptions extends McpToolsOptions, CatalogCacheOptions {
|
|
8
|
+
}
|
|
9
|
+
/** Construction opens no transport unless explicit revalidation is requested. */
|
|
10
|
+
export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<{
|
|
11
|
+
dynamicTools: DynamicTools;
|
|
12
|
+
}, unknown, never>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ProviderError } from "../contracts/provider-error.js";
|
|
1
2
|
/** Shared MCP pagination, wire parsing and calls. Transport owns connection lifetime. */
|
|
2
3
|
import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
4
|
import type { jsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/types.js";
|
|
@@ -8,20 +9,23 @@ import type { JsonObject } from "../effect.js";
|
|
|
8
9
|
export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
|
|
9
10
|
/** An operation owns its connection; it must close even when interrupted. */
|
|
10
11
|
export interface WithMcpClient {
|
|
11
|
-
<A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError>;
|
|
12
|
+
<A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError>;
|
|
12
13
|
}
|
|
13
14
|
/** Shared client operations never cache catalogs or account credentials. */
|
|
14
|
-
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError): {
|
|
15
|
+
export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError): {
|
|
15
16
|
list: Effect.Effect<{
|
|
16
17
|
readonly name: string;
|
|
17
18
|
readonly inputSchema: {
|
|
18
19
|
readonly [x: string]: Schema.Json;
|
|
19
20
|
};
|
|
21
|
+
readonly description?: string | undefined;
|
|
20
22
|
readonly _meta?: {
|
|
21
23
|
readonly [x: string]: Schema.Json;
|
|
22
24
|
} | undefined;
|
|
23
25
|
readonly title?: string | undefined;
|
|
24
|
-
readonly
|
|
26
|
+
readonly outputSchema?: {
|
|
27
|
+
readonly [x: string]: Schema.Json;
|
|
28
|
+
} | undefined;
|
|
25
29
|
readonly annotations?: {
|
|
26
30
|
readonly title?: string;
|
|
27
31
|
readonly readOnlyHint?: boolean;
|
|
@@ -29,10 +33,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
29
33
|
readonly idempotentHint?: boolean;
|
|
30
34
|
readonly openWorldHint?: boolean;
|
|
31
35
|
} | undefined;
|
|
32
|
-
|
|
33
|
-
readonly [x: string]: Schema.Json;
|
|
34
|
-
} | undefined;
|
|
35
|
-
}[], McpError, never>;
|
|
36
|
+
}[], ProviderError | McpError, never>;
|
|
36
37
|
call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
|
|
37
38
|
readonly content: readonly {
|
|
38
39
|
readonly [x: string]: Schema.Json;
|
|
@@ -44,7 +45,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
|
|
|
44
45
|
readonly [x: string]: Schema.Json;
|
|
45
46
|
} | undefined;
|
|
46
47
|
readonly isError?: boolean | undefined;
|
|
47
|
-
}, import("../index.js").ElicitationFailed | McpError, never>;
|
|
48
|
+
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
48
49
|
};
|
|
49
50
|
/** Transport-independent operations consumed by the app tool adapter. */
|
|
50
51
|
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>>, McpError, never>;
|
|
4
|
+
export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | McpError, never>;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { ProviderError } from "../contracts/provider-error.js";
|
|
1
2
|
/** Adapt any MCP transport into ordinary tools with shared validation behavior. */
|
|
2
3
|
import { Effect } from "effect";
|
|
3
|
-
import { McpError, type McpTools } from "../contracts/mcp.js";
|
|
4
|
+
import { McpError, type McpTools, type McpToolMetadata } from "../contracts/mcp.js";
|
|
4
5
|
import type { McpClient } from "./mcp-client.js";
|
|
5
|
-
/**
|
|
6
|
-
export declare const
|
|
6
|
+
/** Compile only the selected tool and bind its executable to the current invocation. */
|
|
7
|
+
export declare const adaptMcpTool: (client: McpClient, tool: McpToolMetadata) => Effect.Effect<import("../contracts/mcp.js").McpTool, McpError, never>;
|
|
8
|
+
/** Discover a complete catalog for probes and uncached low-level callers. */
|
|
9
|
+
export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError>;
|
|
@@ -1,4 +1,41 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ProviderError } from "../contracts/provider-error.js";
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
2
3
|
import { McpError, McpToolsOptions } from "../contracts/mcp.js";
|
|
3
4
|
/** Discover and call with a fresh selected-account transport for each operation. */
|
|
4
|
-
export declare const
|
|
5
|
+
export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
|
|
6
|
+
list: Effect.Effect<{
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly inputSchema: {
|
|
9
|
+
readonly [x: string]: Schema.Json;
|
|
10
|
+
};
|
|
11
|
+
readonly description?: string | undefined;
|
|
12
|
+
readonly _meta?: {
|
|
13
|
+
readonly [x: string]: Schema.Json;
|
|
14
|
+
} | undefined;
|
|
15
|
+
readonly title?: string | undefined;
|
|
16
|
+
readonly outputSchema?: {
|
|
17
|
+
readonly [x: string]: Schema.Json;
|
|
18
|
+
} | undefined;
|
|
19
|
+
readonly annotations?: {
|
|
20
|
+
readonly title?: string;
|
|
21
|
+
readonly readOnlyHint?: boolean;
|
|
22
|
+
readonly destructiveHint?: boolean;
|
|
23
|
+
readonly idempotentHint?: boolean;
|
|
24
|
+
readonly openWorldHint?: boolean;
|
|
25
|
+
} | undefined;
|
|
26
|
+
}[], ProviderError | McpError, never>;
|
|
27
|
+
call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
|
|
28
|
+
readonly content: readonly {
|
|
29
|
+
readonly [x: string]: Schema.Json;
|
|
30
|
+
}[];
|
|
31
|
+
readonly _meta?: {
|
|
32
|
+
readonly [x: string]: Schema.Json;
|
|
33
|
+
} | undefined;
|
|
34
|
+
readonly structuredContent?: {
|
|
35
|
+
readonly [x: string]: Schema.Json;
|
|
36
|
+
} | undefined;
|
|
37
|
+
readonly isError?: boolean | undefined;
|
|
38
|
+
}, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
|
|
39
|
+
}, McpError, never>;
|
|
40
|
+
/** Discover and compile all tools for connection probes and low-level consumers. */
|
|
41
|
+
export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | McpError, never>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/** Compile an OpenAPI document into tool declarations inside the app runtime, never a second execution engine. */
|
|
2
|
+
import { Effect, Schema } from "effect";
|
|
3
|
+
import { JsonObject } from "../contracts/schema.js";
|
|
4
|
+
import "../contracts/swagger-client.ts";
|
|
5
|
+
import { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
|
|
6
|
+
import type { OpenApiImport } from "../contracts/openapi-document.js";
|
|
7
|
+
import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/openapi-document.js";
|
|
8
|
+
/** Compile a revision of a live OpenAPI source into tool declarations for the app runtime. */
|
|
9
|
+
export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: unknown, options?: {
|
|
10
|
+
readonly baseUrl?: string;
|
|
11
|
+
readonly allowedOrigin?: string;
|
|
12
|
+
readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
|
|
13
|
+
readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
|
|
14
|
+
}) => Effect.Effect<{
|
|
15
|
+
operations: {
|
|
16
|
+
readonly name: string;
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly description: string;
|
|
19
|
+
readonly request: {
|
|
20
|
+
readonly parameters: readonly {
|
|
21
|
+
readonly name: string;
|
|
22
|
+
readonly in: "query" | "path" | "header" | "cookie";
|
|
23
|
+
readonly required?: boolean;
|
|
24
|
+
readonly schema?: {
|
|
25
|
+
readonly [x: string]: Schema.Json;
|
|
26
|
+
};
|
|
27
|
+
readonly content?: {
|
|
28
|
+
readonly [x: string]: Schema.Json;
|
|
29
|
+
};
|
|
30
|
+
readonly style?: string;
|
|
31
|
+
readonly explode?: boolean;
|
|
32
|
+
readonly allowReserved?: boolean;
|
|
33
|
+
readonly allowEmptyValue?: boolean;
|
|
34
|
+
}[];
|
|
35
|
+
readonly security: readonly {
|
|
36
|
+
readonly [x: string]: readonly string[];
|
|
37
|
+
}[];
|
|
38
|
+
readonly responses: {
|
|
39
|
+
readonly [x: string]: {
|
|
40
|
+
readonly [x: string]: Schema.Json;
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
readonly requestBody?: {
|
|
44
|
+
readonly content: {
|
|
45
|
+
readonly [x: string]: {
|
|
46
|
+
readonly schema?: {
|
|
47
|
+
readonly [x: string]: Schema.Json;
|
|
48
|
+
};
|
|
49
|
+
readonly encoding?: {
|
|
50
|
+
readonly [x: string]: Schema.Json;
|
|
51
|
+
};
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
readonly required?: boolean;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
readonly input: {
|
|
58
|
+
readonly [x: string]: Schema.Json;
|
|
59
|
+
};
|
|
60
|
+
readonly method: "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
|
|
61
|
+
readonly securitySchemes: {
|
|
62
|
+
readonly [x: string]: {
|
|
63
|
+
readonly [x: string]: Schema.Json;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
readonly baseUrl: string;
|
|
67
|
+
readonly openapi: string;
|
|
68
|
+
readonly outputSchema?: {
|
|
69
|
+
readonly [x: string]: Schema.Json;
|
|
70
|
+
};
|
|
71
|
+
readonly streaming?: true;
|
|
72
|
+
readonly errorResponses?: readonly {
|
|
73
|
+
readonly code: string;
|
|
74
|
+
readonly status: number;
|
|
75
|
+
readonly message: {
|
|
76
|
+
readonly source: "body";
|
|
77
|
+
} | {
|
|
78
|
+
readonly source: "schema";
|
|
79
|
+
readonly value: string;
|
|
80
|
+
};
|
|
81
|
+
readonly schema: {
|
|
82
|
+
readonly [x: string]: Schema.Json;
|
|
83
|
+
};
|
|
84
|
+
}[];
|
|
85
|
+
}[];
|
|
86
|
+
definitions: {
|
|
87
|
+
[k: string]: {
|
|
88
|
+
readonly [x: string]: Schema.Json;
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
methods: {
|
|
92
|
+
[k: string]: readonly {
|
|
93
|
+
readonly scheme: string;
|
|
94
|
+
readonly field: string;
|
|
95
|
+
readonly part: "value" | "username" | "password";
|
|
96
|
+
readonly prefix: string;
|
|
97
|
+
}[];
|
|
98
|
+
};
|
|
99
|
+
secrets: GeneratedSecrets[];
|
|
100
|
+
oauth: {
|
|
101
|
+
name: string;
|
|
102
|
+
config: {
|
|
103
|
+
discover: string;
|
|
104
|
+
} | {
|
|
105
|
+
authorizationUrl: string;
|
|
106
|
+
tokenUrl: string;
|
|
107
|
+
scopes: readonly string[];
|
|
108
|
+
};
|
|
109
|
+
}[];
|
|
110
|
+
schemes: {
|
|
111
|
+
[x: string]: {
|
|
112
|
+
readonly [x: string]: Schema.Json;
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
pinnedOrigin: string | undefined;
|
|
116
|
+
fallback: readonly {
|
|
117
|
+
readonly [x: string]: readonly string[];
|
|
118
|
+
}[] | undefined;
|
|
119
|
+
}, TemplateError, never>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/** OpenAPI reference and dialect rules, shared by every part of the app importer. */
|
|
2
|
+
import "../contracts/swagger-client.ts";
|
|
3
|
+
import { Schema } from "effect";
|
|
4
|
+
import { JsonObject } from "../contracts/schema.js";
|
|
5
|
+
/** Resolve OpenAPI objects once with Swagger; schemas retain their original recursive references.
|
|
6
|
+
* Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer has one dialect and
|
|
7
|
+
* 3.1 keywords that appear in 3.0 documents keep their meaning.
|
|
8
|
+
* Unsupported versions, references and conversions throw TemplateError at the import boundary.
|
|
9
|
+
*/
|
|
10
|
+
export declare function openApiDocument(input: unknown): Promise<{
|
|
11
|
+
spec: {
|
|
12
|
+
readonly openapi: string;
|
|
13
|
+
readonly paths: {
|
|
14
|
+
readonly [x: string]: {
|
|
15
|
+
readonly [x: string]: Schema.Json;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
readonly security?: readonly {
|
|
19
|
+
readonly [x: string]: readonly string[];
|
|
20
|
+
}[];
|
|
21
|
+
readonly servers?: readonly {
|
|
22
|
+
readonly url: string;
|
|
23
|
+
readonly variables?: {
|
|
24
|
+
readonly [x: string]: Schema.Json;
|
|
25
|
+
};
|
|
26
|
+
}[];
|
|
27
|
+
readonly components?: {
|
|
28
|
+
readonly securitySchemes?: {
|
|
29
|
+
readonly [x: string]: {
|
|
30
|
+
readonly [x: string]: Schema.Json;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
readonly schemas?: {
|
|
34
|
+
readonly [x: string]: {
|
|
35
|
+
readonly [x: string]: Schema.Json;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
definitions: Map<string, {
|
|
41
|
+
readonly [x: string]: Schema.Json;
|
|
42
|
+
}>;
|
|
43
|
+
/** Inspect a component schema without expanding its children. OpenAPI object refs must already be resolved by Swagger. */
|
|
44
|
+
resolve(value: JsonObject): JsonObject;
|
|
45
|
+
/** Compose a Draft 2020-12 schema around API Schema Objects. Only values passed to
|
|
46
|
+
* `api` use the document's OpenAPI dialect; Executor-authored wrappers are already
|
|
47
|
+
* Draft 2020-12 and must not be reinterpreted. Reached components are converted once into
|
|
48
|
+
* the shared `definitions` and stay references here; nothing is inlined or copied per operation.
|
|
49
|
+
*/
|
|
50
|
+
schema(build: (api: (input: Schema.Json) => JsonObject) => JsonObject): JsonObject;
|
|
51
|
+
}>;
|
|
52
|
+
/** A parsed document with one reference scope and one schema dialect. */
|
|
53
|
+
export type OpenApiDocument = Awaited<ReturnType<typeof openApiDocument>>;
|