apps 0.0.1-beta.0 → 0.0.1-beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/README.md +145 -30
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/{chunk-36DNRFZQ.js → chunk-27F7W2LG.js} +1 -1
  5. package/js/{chunk-VFUZI3NY.js → chunk-57RKNWL2.js} +4 -4
  6. package/js/{chunk-BPEFS4YF.js → chunk-5T57N25Q.js} +122 -18
  7. package/js/chunk-72JNVHPK.js +41 -0
  8. package/js/{chunk-2OTCEKL2.js → chunk-CDL5PM2Q.js} +2643 -1646
  9. package/js/{chunk-KWTCHVLT.js → chunk-CRDWFA74.js} +69 -54
  10. package/js/chunk-CZ7CSFO4.js +39 -0
  11. package/js/{chunk-WIDTG42X.js → chunk-EPT3ZP52.js} +79 -26
  12. package/js/chunk-FL2QR3XW.js +507 -0
  13. package/js/{chunk-3ANFZFCV.js → chunk-IJX4CYZO.js} +15 -18
  14. package/js/chunk-IPI4MFSN.js +78 -0
  15. package/js/chunk-JU7VHODU.js +104 -0
  16. package/js/chunk-KUMBKVJD.js +39 -0
  17. package/js/{chunk-YDR4CPJA.js → chunk-M3B3DE4K.js} +8 -8
  18. package/js/chunk-MKWZPDR6.js +63 -0
  19. package/js/{chunk-7JXHF5IF.js → chunk-N7YDVXYJ.js} +49 -1
  20. package/js/chunk-NKLWZJLE.js +172 -0
  21. package/js/{chunk-OWD2YICM.js → chunk-ODEIDRGW.js} +116 -88
  22. package/js/{chunk-D6BKYP2L.js → chunk-PJJ24GU7.js} +4 -4
  23. package/js/{chunk-EP6AEUZO.js → chunk-PZB6T6KU.js} +1 -1
  24. package/js/chunk-R3EV5FTO.js +97 -0
  25. package/js/chunk-RFVIONFX.js +189 -0
  26. package/js/{chunk-W7Q5EOTS.js → chunk-UK573G7W.js} +32 -32
  27. package/js/chunk-UVL56Z6E.js +6641 -0
  28. package/js/{chunk-Q2FD5IBM.js → chunk-V5KNQVCT.js} +505 -124
  29. package/js/{chunk-SBKHUC5L.js → chunk-VFZKSM3T.js} +5 -25
  30. package/js/{chunk-HP7E42X6.js → chunk-WLE7WX2U.js} +1158 -232
  31. package/js/{chunk-X3YBZCJW.js → chunk-YXQHV65J.js} +58 -62
  32. package/js/chunk-Z5M2LQOZ.js +209 -0
  33. package/js/{chunk-R6JMJSVT.js → chunk-ZQINWV4W.js} +60 -20
  34. package/js/client.js +11 -27
  35. package/js/contracts.js +138 -27
  36. package/js/effect.js +20 -15
  37. package/js/es-APDZKREY.js +40968 -0
  38. package/js/graphql.js +220 -123
  39. package/js/host.js +75 -19
  40. package/js/index.js +261 -117
  41. package/js/mcp/effect.js +24 -17
  42. package/js/mcp/stdio.js +26 -21
  43. package/js/mcp.js +127 -26
  44. package/js/openapi.js +3048 -150
  45. package/js/operations/approval.js +1 -1
  46. package/js/react.js +4 -4
  47. package/js/skills/effect.js +11 -0
  48. package/js/skills.js +893 -0
  49. package/js/storage/facet.js +7 -7
  50. package/js/ui/auth/contracts.js +9 -10
  51. package/js/ui/auth.js +17 -15
  52. package/js/ui/contracts.js +5 -5
  53. package/js/ui/serving.js +14 -13
  54. package/package.json +9 -1
  55. package/runtime.json +1 -1
  56. package/types/app-cache/src/contracts/cache.d.ts +119 -0
  57. package/types/app-cache/src/index.d.ts +93 -0
  58. package/types/app-data/src/contracts/database.d.ts +33 -6
  59. package/types/app-data/src/implementation/schema.d.ts +2 -17
  60. package/types/apps/src/contracts/api-response-error.d.ts +43 -0
  61. package/types/apps/src/contracts/app.d.ts +16 -4
  62. package/types/apps/src/contracts/cache.d.ts +44 -0
  63. package/types/apps/src/contracts/dynamic-skills.d.ts +10 -0
  64. package/types/apps/src/contracts/failure.d.ts +25 -0
  65. package/types/apps/src/contracts/graphql.d.ts +18 -1
  66. package/types/apps/src/contracts/host.d.ts +76 -528
  67. package/types/apps/src/contracts/mcp.d.ts +19 -1
  68. package/types/apps/src/contracts/openapi-compile.d.ts +11 -0
  69. package/types/apps/src/contracts/openapi-document.d.ts +53 -0
  70. package/types/apps/src/contracts/openapi.d.ts +160 -30
  71. package/types/apps/src/contracts/operations.d.ts +0 -5
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +1589 -0
  74. package/types/apps/src/contracts/protocols/2.d.ts +668 -0
  75. package/types/apps/src/contracts/protocols/3.d.ts +676 -0
  76. package/types/apps/src/contracts/protocols/4.d.ts +1229 -0
  77. package/types/apps/src/contracts/protocols/5.d.ts +1090 -0
  78. package/types/apps/src/contracts/provider-error.d.ts +15 -0
  79. package/types/apps/src/contracts/provider.d.ts +69 -6
  80. package/types/apps/src/contracts/router.d.ts +59 -0
  81. package/types/apps/src/contracts/skills.d.ts +122 -0
  82. package/types/apps/src/contracts/storage.d.ts +3 -3
  83. package/types/apps/src/contracts/swagger-client.d.ts +29 -0
  84. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  85. package/types/apps/src/contracts/workflows.d.ts +34 -3
  86. package/types/apps/src/graphql.d.ts +5 -7
  87. package/types/apps/src/host.d.ts +1 -0
  88. package/types/apps/src/implementation/account-router.d.ts +12 -0
  89. package/types/apps/src/implementation/app.d.ts +5 -4
  90. package/types/apps/src/implementation/cache-session.d.ts +7 -0
  91. package/types/apps/src/implementation/cache.d.ts +8 -0
  92. package/types/apps/src/implementation/catalog-cache.d.ts +36 -0
  93. package/types/apps/src/implementation/dynamic-skills.d.ts +7 -0
  94. package/types/apps/src/implementation/elicitation.d.ts +13 -13
  95. package/types/apps/src/implementation/failure-detail.d.ts +25 -0
  96. package/types/apps/src/implementation/git.d.ts +25 -0
  97. package/types/apps/src/implementation/graphql-catalog.d.ts +7 -0
  98. package/types/apps/src/implementation/graphql.d.ts +81 -3
  99. package/types/apps/src/implementation/inflate.d.ts +16 -0
  100. package/types/apps/src/implementation/input-problems.d.ts +3 -0
  101. package/types/apps/src/implementation/mcp-call.d.ts +3 -2
  102. package/types/apps/src/implementation/mcp-catalog.d.ts +9 -0
  103. package/types/apps/src/implementation/mcp-client.d.ts +39 -22
  104. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  105. package/types/apps/src/implementation/mcp-tools.d.ts +6 -3
  106. package/types/apps/src/implementation/mcp.d.ts +55 -2
  107. package/types/apps/src/implementation/openapi-compile.d.ts +120 -0
  108. package/types/apps/src/implementation/openapi-document.d.ts +51 -0
  109. package/types/apps/src/implementation/openapi-names.d.ts +18 -0
  110. package/types/apps/src/implementation/openapi-request.d.ts +10 -4
  111. package/types/apps/src/implementation/openapi-source.d.ts +36 -0
  112. package/types/apps/src/implementation/openapi.d.ts +39 -3
  113. package/types/apps/src/implementation/operations.d.ts +26 -3
  114. package/types/apps/src/implementation/protocol-operations.d.ts +3 -4
  115. package/types/apps/src/implementation/provider-error.d.ts +10 -0
  116. package/types/apps/src/implementation/provider.d.ts +9 -4
  117. package/types/apps/src/implementation/router-catalog.d.ts +225 -0
  118. package/types/apps/src/implementation/router.d.ts +59 -0
  119. package/types/apps/src/implementation/schema.d.ts +11 -6
  120. package/types/apps/src/implementation/skill-files.d.ts +10 -0
  121. package/types/apps/src/implementation/skills.d.ts +43 -0
  122. package/types/apps/src/implementation/storage.d.ts +5 -3
  123. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  124. package/types/apps/src/implementation/ui-auth.d.ts +11 -5
  125. package/types/apps/src/implementation/ui-serving.d.ts +4 -2
  126. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  127. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  128. package/types/apps/src/index.d.ts +11 -3
  129. package/types/apps/src/mcp-stdio.d.ts +2 -5
  130. package/types/apps/src/mcp.d.ts +8 -7
  131. package/types/apps/src/openapi.d.ts +8 -6
  132. package/types/apps/src/skills.d.ts +75 -0
  133. package/types/apps/src/ui-auth.d.ts +2 -2
  134. package/types/telemetry/src/browser-operations.d.ts +5 -2
  135. package/types/telemetry/src/config.d.ts +2 -0
  136. package/js/chunk-22WRQZT7.js +0 -389
  137. package/js/chunk-BKVL7XAJ.js +0 -47
  138. package/js/chunk-C24KEZXR.js +0 -59
  139. package/js/chunk-LOKGDT6B.js +0 -28
  140. package/js/chunk-MLKGABMK.js +0 -9
  141. package/types/apps/src/implementation/account-operations.d.ts +0 -32
@@ -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
+ readonly maximum?: number;
69
70
  readonly description?: string;
71
+ readonly title?: string;
70
72
  readonly minimum?: number;
71
- 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
+ import { Redacted } from "effect";
2
+ import type { ResolvedAccounts } from "../contracts/host.js";
3
+ /** Fields of `FailureDetail` as constructor input. */
4
+ export interface FailureDetail {
5
+ readonly source?: "app" | "storage" | "service";
6
+ readonly errorName?: string;
7
+ readonly code?: string;
8
+ readonly message?: string;
9
+ }
10
+ /**
11
+ * Every credential field value of a slot-to-account record, longest first. Accepts both resolved
12
+ * host accounts and bound author accounts; each account keeps its credential values in `fields`.
13
+ */
14
+ export declare const accountFieldSecrets: (accounts: unknown) => string[];
15
+ /** Every credential field value of an invocation's selected accounts. */
16
+ export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
17
+ /** Replace account secrets and bound the message for the runtime boundary. */
18
+ export declare const boundFailureMessage: (message: string, secrets: readonly string[]) => string;
19
+ /** `Name: message` for any thrown value, before redaction. */
20
+ export declare const describeFailure: (error: unknown) => string;
21
+ /**
22
+ * Describe what an operation raised for the app's own caller. App data failures keep their
23
+ * reason as a code; any other thrown value is the app's own error. Account secrets are replaced.
24
+ */
25
+ export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
@@ -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,7 @@
1
+ import { Effect } from "effect";
2
+ import { GraphqlToolsOptions } from "../contracts/graphql.js";
3
+ import { type CatalogCacheOptions } from "./catalog-cache.js";
4
+ import { type OperationKinds } from "./protocol-operations.js";
5
+ export interface GraphqlCatalogOptions extends GraphqlToolsOptions, CatalogCacheOptions {
6
+ }
7
+ export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, 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 { GraphqlError, GraphqlToolsOptions, type GraphqlTools } from "../contracts/graphql.js";
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 graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError>;
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
+ };
@@ -0,0 +1,3 @@
1
+ import { HostInputInvalid } from "../contracts/host.js";
2
+ /** Failing input paths and expected shapes from a schema decode failure, without supplied values. */
3
+ export declare const inputInvalid: (error: unknown) => HostInputInvalid;
@@ -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,9 @@
1
+ import { Effect } from "effect";
2
+ import { McpToolsOptions } from "../contracts/mcp.js";
3
+ import { type CatalogCacheOptions } from "./catalog-cache.js";
4
+ import { type OperationKinds } from "./protocol-operations.js";
5
+ /** Metadata policy for HTTP/SSE sources. A missing cache keeps discovery invocation-local. */
6
+ export interface McpCatalogOptions extends McpToolsOptions, CatalogCacheOptions {
7
+ }
8
+ /** Construction opens no transport unless explicit revalidation is requested. */
9
+ export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, 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,31 +9,47 @@ 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
- readonly name: string;
17
- readonly inputSchema: {
18
- readonly [x: string]: Schema.Json;
19
- };
20
- readonly _meta?: {
21
- readonly [x: string]: Schema.Json;
22
- } | undefined;
23
- readonly title?: string | undefined;
24
- readonly description?: string | undefined;
25
- readonly annotations?: {
17
+ tools: {
18
+ readonly name: string;
19
+ readonly inputSchema: {
20
+ readonly [x: string]: Schema.Json;
21
+ };
22
+ readonly description?: string | undefined;
23
+ readonly _meta?: {
24
+ readonly [x: string]: Schema.Json;
25
+ } | undefined;
26
+ readonly title?: string | undefined;
27
+ readonly annotations?: {
28
+ readonly title?: string;
29
+ readonly readOnlyHint?: boolean;
30
+ readonly destructiveHint?: boolean;
31
+ readonly idempotentHint?: boolean;
32
+ readonly openWorldHint?: boolean;
33
+ } | undefined;
34
+ readonly outputSchema?: {
35
+ readonly [x: string]: Schema.Json;
36
+ } | undefined;
37
+ }[];
38
+ server: {
39
+ readonly version?: string;
40
+ readonly name?: string;
41
+ readonly description?: string;
26
42
  readonly title?: string;
27
- readonly readOnlyHint?: boolean;
28
- readonly destructiveHint?: boolean;
29
- readonly idempotentHint?: boolean;
30
- readonly openWorldHint?: boolean;
31
- } | undefined;
32
- readonly outputSchema?: {
33
- readonly [x: string]: Schema.Json;
34
- } | undefined;
35
- }[], McpError, never>;
43
+ readonly instructions?: string;
44
+ readonly icons?: readonly {
45
+ readonly src: string;
46
+ readonly mimeType?: string;
47
+ readonly sizes?: readonly string[];
48
+ readonly theme?: "light" | "dark";
49
+ }[];
50
+ readonly websiteUrl?: string;
51
+ } | {};
52
+ }, ProviderError | McpError, never>;
36
53
  call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
37
54
  readonly content: readonly {
38
55
  readonly [x: string]: Schema.Json;
@@ -44,7 +61,7 @@ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number,
44
61
  readonly [x: string]: Schema.Json;
45
62
  } | undefined;
46
63
  readonly isError?: boolean | undefined;
47
- }, import("../index.js").ElicitationFailed | McpError, never>;
64
+ }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
48
65
  };
49
66
  /** Transport-independent operations consumed by the app tool adapter. */
50
67
  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
- /** Evaluate fresh metadata for the account bound to this client. */
6
- export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError>;
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,57 @@
1
- import { Effect } from "effect";
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 mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, McpError, never>;
5
+ export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
6
+ list: Effect.Effect<{
7
+ tools: {
8
+ readonly name: string;
9
+ readonly inputSchema: {
10
+ readonly [x: string]: Schema.Json;
11
+ };
12
+ readonly description?: string | undefined;
13
+ readonly _meta?: {
14
+ readonly [x: string]: Schema.Json;
15
+ } | undefined;
16
+ readonly title?: string | undefined;
17
+ readonly annotations?: {
18
+ readonly title?: string;
19
+ readonly readOnlyHint?: boolean;
20
+ readonly destructiveHint?: boolean;
21
+ readonly idempotentHint?: boolean;
22
+ readonly openWorldHint?: boolean;
23
+ } | undefined;
24
+ readonly outputSchema?: {
25
+ readonly [x: string]: Schema.Json;
26
+ } | undefined;
27
+ }[];
28
+ server: {
29
+ readonly version?: string;
30
+ readonly name?: string;
31
+ readonly description?: string;
32
+ readonly title?: string;
33
+ readonly instructions?: string;
34
+ readonly icons?: readonly {
35
+ readonly src: string;
36
+ readonly mimeType?: string;
37
+ readonly sizes?: readonly string[];
38
+ readonly theme?: "light" | "dark";
39
+ }[];
40
+ readonly websiteUrl?: string;
41
+ } | {};
42
+ }, ProviderError | McpError, never>;
43
+ call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
44
+ readonly content: readonly {
45
+ readonly [x: string]: Schema.Json;
46
+ }[];
47
+ readonly _meta?: {
48
+ readonly [x: string]: Schema.Json;
49
+ } | undefined;
50
+ readonly structuredContent?: {
51
+ readonly [x: string]: Schema.Json;
52
+ } | undefined;
53
+ readonly isError?: boolean | undefined;
54
+ }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
55
+ }, McpError, never>;
56
+ /** Discover and compile all tools for connection probes and low-level consumers. */
57
+ export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | McpError, never>;
@@ -0,0 +1,120 @@
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 { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
5
+ import type { OpenApiImport } from "../contracts/openapi-document.js";
6
+ import { type GeneratedOperation, type GeneratedSecrets } from "../contracts/openapi-document.js";
7
+ /** Compile a revision of a live OpenAPI source into tool declarations for the app runtime. */
8
+ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: unknown, options?: {
9
+ readonly baseUrl?: string;
10
+ readonly allowedOrigin?: string;
11
+ readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
12
+ readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
13
+ }) => Effect.Effect<{
14
+ operations: {
15
+ readonly name: string;
16
+ readonly path: string;
17
+ readonly description: string;
18
+ readonly request: {
19
+ readonly parameters: readonly {
20
+ readonly name: string;
21
+ readonly in: "query" | "path" | "header" | "cookie";
22
+ readonly required?: boolean;
23
+ readonly schema?: {
24
+ readonly [x: string]: Schema.Json;
25
+ };
26
+ readonly content?: {
27
+ readonly [x: string]: Schema.Json;
28
+ };
29
+ readonly style?: string;
30
+ readonly explode?: boolean;
31
+ readonly allowReserved?: boolean;
32
+ readonly allowEmptyValue?: boolean;
33
+ }[];
34
+ readonly security: readonly {
35
+ readonly [x: string]: readonly string[];
36
+ }[];
37
+ readonly responses: {
38
+ readonly [x: string]: {
39
+ readonly [x: string]: Schema.Json;
40
+ };
41
+ };
42
+ readonly requestBody?: {
43
+ readonly content: {
44
+ readonly [x: string]: {
45
+ readonly schema?: {
46
+ readonly [x: string]: Schema.Json;
47
+ };
48
+ readonly encoding?: {
49
+ readonly [x: string]: Schema.Json;
50
+ };
51
+ };
52
+ };
53
+ readonly required?: boolean;
54
+ };
55
+ };
56
+ readonly input: {
57
+ readonly [x: string]: Schema.Json;
58
+ };
59
+ readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
60
+ readonly securitySchemes: {
61
+ readonly [x: string]: {
62
+ readonly [x: string]: Schema.Json;
63
+ };
64
+ };
65
+ readonly baseUrl: string;
66
+ readonly openapi: string;
67
+ readonly outputSchema?: {
68
+ readonly [x: string]: Schema.Json;
69
+ };
70
+ readonly tags?: readonly string[];
71
+ readonly operationId?: string;
72
+ readonly streaming?: true;
73
+ readonly errorResponses?: readonly {
74
+ readonly code: string;
75
+ readonly status: number;
76
+ readonly message: {
77
+ readonly source: "body";
78
+ } | {
79
+ readonly source: "schema";
80
+ readonly value: string;
81
+ };
82
+ readonly schema: {
83
+ readonly [x: string]: Schema.Json;
84
+ };
85
+ }[];
86
+ }[];
87
+ definitions: {
88
+ [k: string]: {
89
+ readonly [x: string]: Schema.Json;
90
+ };
91
+ };
92
+ methods: {
93
+ [k: string]: readonly {
94
+ readonly scheme: string;
95
+ readonly field: string;
96
+ readonly part: "value" | "username" | "password";
97
+ readonly prefix: string;
98
+ }[];
99
+ };
100
+ secrets: GeneratedSecrets[];
101
+ oauth: {
102
+ name: string;
103
+ config: {
104
+ discover: string;
105
+ } | {
106
+ authorizationUrl: string;
107
+ tokenUrl: string;
108
+ scopes: readonly string[];
109
+ };
110
+ }[];
111
+ schemes: {
112
+ [x: string]: {
113
+ readonly [x: string]: Schema.Json;
114
+ };
115
+ };
116
+ pinnedOrigin: string | undefined;
117
+ fallback: readonly {
118
+ readonly [x: string]: readonly string[];
119
+ }[] | undefined;
120
+ }, TemplateError, never>;
@@ -0,0 +1,51 @@
1
+ import { Schema } from "effect";
2
+ import { JsonObject } from "../contracts/schema.js";
3
+ /** Resolve OpenAPI objects once with Swagger; schemas retain their original recursive references.
4
+ * Scalar first upgrades Swagger 2.0 and OpenAPI 3.0 to 3.1, so the importer has one dialect and
5
+ * 3.1 keywords that appear in 3.0 documents keep their meaning.
6
+ * Unsupported versions, references and conversions throw TemplateError at the import boundary.
7
+ */
8
+ export declare function openApiDocument(input: unknown): Promise<{
9
+ spec: {
10
+ readonly openapi: string;
11
+ readonly paths: {
12
+ readonly [x: string]: {
13
+ readonly [x: string]: Schema.Json;
14
+ };
15
+ };
16
+ readonly security?: readonly {
17
+ readonly [x: string]: readonly string[];
18
+ }[];
19
+ readonly servers?: readonly {
20
+ readonly url: string;
21
+ readonly variables?: {
22
+ readonly [x: string]: Schema.Json;
23
+ };
24
+ }[];
25
+ readonly components?: {
26
+ readonly securitySchemes?: {
27
+ readonly [x: string]: {
28
+ readonly [x: string]: Schema.Json;
29
+ };
30
+ };
31
+ readonly schemas?: {
32
+ readonly [x: string]: {
33
+ readonly [x: string]: Schema.Json;
34
+ };
35
+ };
36
+ };
37
+ };
38
+ definitions: Map<string, {
39
+ readonly [x: string]: Schema.Json;
40
+ }>;
41
+ /** Inspect a component schema without expanding its children. OpenAPI object refs must already be resolved by Swagger. */
42
+ resolve(value: JsonObject): JsonObject;
43
+ /** Compose a Draft 2020-12 schema around API Schema Objects. Only values passed to
44
+ * `api` use the document's OpenAPI dialect; Executor-authored wrappers are already
45
+ * Draft 2020-12 and must not be reinterpreted. Reached components are converted once into
46
+ * the shared `definitions` and stay references here; nothing is inlined or copied per operation.
47
+ */
48
+ schema(build: (api: (input: Schema.Json) => JsonObject) => JsonObject): JsonObject;
49
+ }>;
50
+ /** A parsed document with one reference scope and one schema dialect. */
51
+ export type OpenApiDocument = Awaited<ReturnType<typeof openApiDocument>>;
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Group generated OpenAPI tool names as `<group>.<leaf>`, ported from Executor v1's tool paths.
3
+ * The group is the first tag, or the first meaningful path segment. The leaf is the operationId
4
+ * without a repeated group prefix, or a method-and-path name when there is no operationId.
5
+ */
6
+ export interface OperationNameInput {
7
+ readonly operationId: string | undefined;
8
+ /** The first non-empty tag. */
9
+ readonly tag: string | undefined;
10
+ readonly method: string;
11
+ readonly path: string;
12
+ }
13
+ /**
14
+ * Plan one name per input, in input order. Names that collide are refined together: first by
15
+ * the path's version segment, then by the HTTP method, then by a stable hash. Refinement only
16
+ * touches the colliding names, so adding an operation never renames an unrelated one.
17
+ */
18
+ export declare const planOperationNames: (inputs: readonly OperationNameInput[]) => string[];