apps 0.0.1-beta.3 → 0.0.1-beta.30

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 (139) hide show
  1. package/README.md +68 -44
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-G7ZIRKMK.js → chunk-2D2PKLGQ.js} +118 -197
  4. package/js/chunk-3SPRHIEE.js +42 -0
  5. package/js/{chunk-FDNTX5QJ.js → chunk-4N26L465.js} +2 -2
  6. package/js/chunk-5ZHHO4OM.js +92 -0
  7. package/js/{chunk-EVJUVWN2.js → chunk-65SZ23BK.js} +2 -2
  8. package/js/{chunk-M6ZRRIBI.js → chunk-6JBTHTI5.js} +1 -1
  9. package/js/{chunk-J7O55ZV7.js → chunk-6NK26ONC.js} +332 -187
  10. package/js/chunk-6VWYEQ4X.js +254 -0
  11. package/js/{chunk-RN2MXB4R.js → chunk-AE4FWJQU.js} +128 -24
  12. package/js/{chunk-HDJH3RPR.js → chunk-BBTELEAN.js} +2 -2
  13. package/js/{chunk-LGIYBDWA.js → chunk-BRGF7VFN.js} +65 -1
  14. package/js/{chunk-MYYEW3RA.js → chunk-BSRU52RU.js} +984 -61
  15. package/js/{chunk-FZJOYIZO.js → chunk-BTJMXW4I.js} +1 -1
  16. package/js/{chunk-HDTGZWP2.js → chunk-IMCEF6KE.js} +139 -32
  17. package/js/chunk-KQCMHI3K.js +118 -0
  18. package/js/{chunk-BMOIAIVR.js → chunk-M2KEEOIQ.js} +49 -1
  19. package/js/{chunk-YEJOQEII.js → chunk-MYCVMDWI.js} +45 -7
  20. package/js/{chunk-FW5HBOIK.js → chunk-NXTXZ635.js} +1841 -1701
  21. package/js/chunk-OD3KFKZD.js +1617 -0
  22. package/js/{chunk-JN55AYQH.js → chunk-OI5CKSBU.js} +61 -32
  23. package/js/{chunk-NQ3OMCA5.js → chunk-P46HIAX6.js} +2 -2
  24. package/js/chunk-PUC24GZP.js +801 -0
  25. package/js/{chunk-SATWJKN6.js → chunk-PWF2DRJ3.js} +1 -1
  26. package/js/{chunk-D47C7KG5.js → chunk-VUVBMNKC.js} +2 -2
  27. package/js/{chunk-ZCAMUXSG.js → chunk-WGBI5MVX.js} +3 -4
  28. package/js/{chunk-T2LAZCAD.js → chunk-WQ5MVBTP.js} +1 -1
  29. package/js/{chunk-PLCMJREA.js → chunk-XBQTJP76.js} +60 -20
  30. package/js/{chunk-QKHR7BMF.js → chunk-XGN5IFOZ.js} +3 -3
  31. package/js/{chunk-WFSQXYUT.js → chunk-YML53Z7H.js} +42 -5
  32. package/js/{chunk-5MQZEB6Y.js → chunk-ZZOCEUTB.js} +37 -12
  33. package/js/client.js +120 -84
  34. package/js/contracts.js +110 -16
  35. package/js/effect.js +20 -20
  36. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  37. package/js/graphql.js +58 -54
  38. package/js/host.js +20 -20
  39. package/js/index.js +247 -204
  40. package/js/mcp/effect.js +24 -22
  41. package/js/mcp/stdio.js +35 -30
  42. package/js/mcp.js +105 -68
  43. package/js/openapi.js +4087 -1503
  44. package/js/react.js +3 -3
  45. package/js/skills/effect.js +5 -3
  46. package/js/skills.js +15 -15
  47. package/js/storage/facet.js +4 -4
  48. package/js/ui/auth/contracts.js +2 -2
  49. package/js/ui/auth.js +5 -5
  50. package/js/ui/contracts.js +5 -4
  51. package/js/ui/serving.js +8516 -214
  52. package/package.json +1 -1
  53. package/runtime.json +1 -1
  54. package/types/app-data/src/contracts/database.d.ts +33 -6
  55. package/types/app-data/src/implementation/schema.d.ts +2 -17
  56. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  57. package/types/apps/src/contracts/app.d.ts +7 -6
  58. package/types/apps/src/contracts/failure.d.ts +54 -0
  59. package/types/apps/src/contracts/graphql.d.ts +2 -1
  60. package/types/apps/src/contracts/host.d.ts +34 -11
  61. package/types/apps/src/contracts/mcp.d.ts +91 -10
  62. package/types/apps/src/contracts/network.d.ts +84 -0
  63. package/types/apps/src/contracts/openapi-compile.d.ts +31 -3
  64. package/types/apps/src/contracts/openapi.d.ts +45 -9
  65. package/types/apps/src/contracts/operations.d.ts +5 -6
  66. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  67. package/types/apps/src/contracts/protocols/1.d.ts +251 -69
  68. package/types/apps/src/contracts/protocols/2.d.ts +710 -0
  69. package/types/apps/src/contracts/protocols/3.d.ts +716 -0
  70. package/types/apps/src/contracts/protocols/4.d.ts +1298 -0
  71. package/types/apps/src/contracts/protocols/5.d.ts +1174 -0
  72. package/types/apps/src/contracts/protocols/6.d.ts +1620 -0
  73. package/types/apps/src/contracts/protocols/7.d.ts +1784 -0
  74. package/types/apps/src/contracts/protocols/8.d.ts +1119 -0
  75. package/types/apps/src/contracts/protocols/oauth.d.ts +89 -0
  76. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  77. package/types/apps/src/contracts/provider.d.ts +115 -10
  78. package/types/apps/src/contracts/router.d.ts +59 -0
  79. package/types/apps/src/contracts/skills.d.ts +18 -5
  80. package/types/apps/src/contracts/storage.d.ts +3 -3
  81. package/types/apps/src/contracts/ui.d.ts +18 -0
  82. package/types/apps/src/contracts/workflows.d.ts +34 -3
  83. package/types/apps/src/graphql.d.ts +1 -3
  84. package/types/apps/src/implementation/account-router.d.ts +12 -0
  85. package/types/apps/src/implementation/app.d.ts +5 -4
  86. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  87. package/types/apps/src/implementation/catalog-cache.d.ts +34 -4
  88. package/types/apps/src/implementation/elicitation.d.ts +9 -9
  89. package/types/apps/src/implementation/failure-detail.d.ts +46 -0
  90. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  91. package/types/apps/src/implementation/graphql.d.ts +4 -3
  92. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  93. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  94. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  95. package/types/apps/src/implementation/mcp-stdio.d.ts +1 -1
  96. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  97. package/types/apps/src/implementation/mcp.d.ts +52 -25
  98. package/types/apps/src/implementation/network.d.ts +16 -0
  99. package/types/apps/src/implementation/openapi-compile.d.ts +27 -6
  100. package/types/apps/src/implementation/openapi-document.d.ts +35 -8
  101. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  102. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  103. package/types/apps/src/implementation/openapi-source.d.ts +8 -6
  104. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  105. package/types/apps/src/implementation/operations.d.ts +36 -3
  106. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  107. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  108. package/types/apps/src/implementation/provider.d.ts +19 -5
  109. package/types/apps/src/implementation/router-catalog.d.ts +224 -0
  110. package/types/apps/src/implementation/router.d.ts +68 -0
  111. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  112. package/types/apps/src/implementation/schema.d.ts +52 -1
  113. package/types/apps/src/implementation/skills.d.ts +2 -2
  114. package/types/apps/src/implementation/storage.d.ts +5 -3
  115. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  116. package/types/apps/src/implementation/ui-client.d.ts +2 -2
  117. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  118. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  119. package/types/apps/src/implementation/ui-serving.d.ts +10 -4
  120. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  121. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  122. package/types/apps/src/implementation/webhooks.d.ts +1 -1
  123. package/types/apps/src/implementation/workflow-context.d.ts +11 -3
  124. package/types/apps/src/index.d.ts +29 -11
  125. package/types/apps/src/mcp-stdio.d.ts +2 -5
  126. package/types/apps/src/mcp.d.ts +25 -5
  127. package/types/apps/src/openapi.d.ts +6 -6
  128. package/types/apps/src/skills.d.ts +4 -4
  129. package/types/telemetry/src/browser-operations.d.ts +5 -2
  130. package/types/telemetry/src/config.d.ts +2 -2
  131. package/types/utils/src/api-error.d.ts +48 -0
  132. package/js/chunk-PYUYJRSK.js +0 -93
  133. package/js/chunk-SWPD52J7.js +0 -35
  134. package/js/chunk-W7D7WVSY.js +0 -18
  135. package/js/chunk-Z5NMEGJN.js +0 -29
  136. package/js/chunk-ZJWDMTE3.js +0 -63
  137. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  138. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  139. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
@@ -1,8 +1,8 @@
1
1
  import { Duration, Effect, Schema } from "effect";
2
2
  import type { AppCache, CacheLoadContext } from "../contracts/cache.js";
3
- import { type JsonValue } from "../contracts/schema.js";
3
+ import { JsonObject, type JsonValue } from "../contracts/schema.js";
4
4
  export interface CatalogCacheOptions {
5
- /** App/build scope, optionally narrowed to the current account. */
5
+ /** The app's cache. An account's catalog is kept in that account's scope. */
6
6
  readonly cache?: AppCache;
7
7
  /** Reuse metadata for this duration. Defaults to five minutes. */
8
8
  readonly freshFor?: Duration.Input;
@@ -11,9 +11,37 @@ export interface CatalogCacheOptions {
11
11
  /** Await a fresh revision at an explicit logical connection or refresh boundary. */
12
12
  readonly revalidate?: boolean;
13
13
  }
14
+ /**
15
+ * Whose catalog a remote router reads. A public server takes neither field. Credential headers
16
+ * come only with the account they belong to, so an authenticated catalog always has its account.
17
+ */
18
+ export type CatalogAccount = {
19
+ readonly account?: undefined;
20
+ readonly headers?: undefined;
21
+ } | {
22
+ /** The selected account, as `accounts.<slot>` provides it. */
23
+ readonly account: {
24
+ readonly id: string;
25
+ };
26
+ /** Headers for this account's requests, such as its credentials. */
27
+ readonly headers?: Readonly<Record<string, string>>;
28
+ };
29
+ /**
30
+ * The cache an account's catalog lives in: the account's own scope, which token renewals keep.
31
+ * Credentials never enter a key. Headers without an account, or an account the app was not
32
+ * given, fail with `invalid`.
33
+ */
34
+ export declare const catalogScope: <E>(options: CatalogCacheOptions & CatalogAccount, invalid: () => E) => Effect.Effect<AppCache | undefined, E>;
35
+ /** One load: the tools, and optionally a record describing the whole catalog. */
36
+ export interface CatalogLoad<A> {
37
+ readonly tools: readonly A[];
38
+ readonly header?: JsonObject;
39
+ }
14
40
  export declare const catalogCache: <A extends {
15
41
  readonly name: string;
16
- }, S>(options: CatalogCacheOptions & {
42
+ }, S>(options: Omit<CatalogCacheOptions, "cache"> & {
43
+ /** The scope from `catalogScope`; undefined keeps discovery invocation-local. */
44
+ readonly cache: AppCache | undefined;
17
45
  readonly prefix: readonly JsonValue[];
18
46
  readonly schema: Schema.Decoder<A>;
19
47
  /** Schema-free projection stored beside the full pages, so browsing never reads schemas. */
@@ -21,9 +49,11 @@ export declare const catalogCache: <A extends {
21
49
  readonly schema: Schema.Decoder<S>;
22
50
  readonly of: (tool: A) => S;
23
51
  };
24
- readonly load: (context?: CacheLoadContext) => Effect.Effect<readonly A[], unknown>;
52
+ readonly load: (context?: CacheLoadContext) => Effect.Effect<CatalogLoad<A>, unknown>;
25
53
  }) => Effect.Effect<{
26
54
  list: () => Effect.Effect<readonly A[], unknown, never>;
55
+ /** The record stored with the current revision, if the source supplied one. */
56
+ header: () => Effect.Effect<JsonObject | undefined, unknown>;
27
57
  summaries: () => Effect.Effect<S[], unknown, never>;
28
58
  resolve: (name: string) => Effect.Effect<A | undefined, unknown, never>;
29
59
  }, unknown, never>;
@@ -12,15 +12,15 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
12
12
  readonly [x: string]: {
13
13
  readonly type: "string";
14
14
  readonly enum: readonly string[];
15
- readonly default?: string;
16
15
  readonly description?: string;
16
+ readonly default?: string;
17
17
  readonly title?: string;
18
18
  readonly enumNames?: readonly string[];
19
19
  } | {
20
20
  readonly type: "string";
21
21
  readonly enum: readonly string[];
22
- readonly default?: string;
23
22
  readonly description?: string;
23
+ readonly default?: string;
24
24
  readonly title?: string;
25
25
  } | {
26
26
  readonly type: "string";
@@ -28,8 +28,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
28
28
  readonly const: string;
29
29
  readonly title: string;
30
30
  }[];
31
- readonly default?: string;
32
31
  readonly description?: string;
32
+ readonly default?: string;
33
33
  readonly title?: string;
34
34
  } | {
35
35
  readonly type: "array";
@@ -37,8 +37,8 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
37
37
  readonly type: "string";
38
38
  readonly enum: readonly string[];
39
39
  };
40
- readonly default?: readonly string[];
41
40
  readonly description?: string;
41
+ readonly default?: readonly string[];
42
42
  readonly title?: string;
43
43
  readonly minItems?: number;
44
44
  readonly maxItems?: number;
@@ -50,30 +50,30 @@ export declare const prepareElicitation: (input: unknown) => Effect.Effect<{
50
50
  readonly title: string;
51
51
  }[];
52
52
  };
53
- readonly default?: readonly string[];
54
53
  readonly description?: string;
54
+ readonly default?: readonly string[];
55
55
  readonly title?: string;
56
56
  readonly minItems?: number;
57
57
  readonly maxItems?: number;
58
58
  } | {
59
59
  readonly type: "string";
60
+ readonly description?: string;
60
61
  readonly default?: string;
61
62
  readonly format?: "email" | "uri" | "date" | "date-time";
62
- readonly description?: string;
63
63
  readonly title?: string;
64
64
  readonly minLength?: number;
65
65
  readonly maxLength?: number;
66
66
  } | {
67
67
  readonly type: "number" | "integer";
68
- readonly default?: number;
69
68
  readonly description?: string;
69
+ readonly default?: number;
70
+ readonly maximum?: number;
70
71
  readonly title?: string;
71
72
  readonly minimum?: number;
72
- readonly maximum?: number;
73
73
  } | {
74
74
  readonly type: "boolean";
75
- readonly default?: boolean;
76
75
  readonly description?: string;
76
+ readonly default?: boolean;
77
77
  readonly title?: string;
78
78
  };
79
79
  };
@@ -0,0 +1,46 @@
1
+ import { Option, Redacted } from "effect";
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";
6
+ /** Fields of `FailureDetail` as constructor input. */
7
+ export interface FailureDetail {
8
+ readonly source?: "app" | "storage" | "service";
9
+ readonly errorName?: string;
10
+ readonly code?: string;
11
+ readonly message?: string;
12
+ readonly fields?: FailureFields;
13
+ }
14
+ /**
15
+ * Every credential field value of a slot-to-account record, longest first. Accepts both resolved
16
+ * host accounts and bound author accounts; each account keeps its credential values in `fields`.
17
+ */
18
+ export declare const accountFieldSecrets: (accounts: unknown) => string[];
19
+ /** Every credential field value of an invocation's selected accounts. */
20
+ export declare const accountSecrets: (accounts: Redacted.Redacted<ResolvedAccounts>) => string[];
21
+ /** Replace account secrets and bound the message for the runtime boundary. */
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>;
38
+ /** `Name: message` for any thrown value, before redaction. */
39
+ export declare const describeFailure: (error: unknown) => string;
40
+ /**
41
+ * Describe what an operation raised for the app's own caller. App data failures keep their
42
+ * reason as a code, as do app cache failures and OpenAPI and MCP service failures, such as an
43
+ * `mcpHealth` check that cannot reach its server or cannot verify the credentials; any other thrown
44
+ * value is the app's own error, with its own code and scalar fields. Account secrets are replaced.
45
+ */
46
+ export declare const failureDetail: (error: unknown, secrets: readonly string[]) => FailureDetail;
@@ -1,10 +1,7 @@
1
1
  import { Effect } from "effect";
2
2
  import { GraphqlToolsOptions } from "../contracts/graphql.js";
3
- import type { DynamicTools } from "../contracts/dynamic-tools.js";
4
- import { type CatalogCacheOptions } from "./catalog-cache.js";
3
+ import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
5
4
  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>;
5
+ /** An endpoint, the account whose schema it is, and the metadata policy. */
6
+ export type GraphqlCatalogOptions = Omit<GraphqlToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
7
+ export declare const graphqlCatalog: (options: GraphqlCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
@@ -1,4 +1,5 @@
1
1
  import { ProviderError } from "../contracts/provider-error.js";
2
+ import { NetworkRefused } from "../contracts/network.js";
2
3
  /** Discover GraphQL tools live; transport, decoding and cancellation stay in Effect. */
3
4
  import { Effect, Schema } from "effect";
4
5
  import { OperationTypeNode } from "graphql";
@@ -8,7 +9,7 @@ import { JsonObject } from "../effect.js";
8
9
  export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect.Effect<{
9
10
  request: (phase: "discover" | "call", query: string, variables?: JsonObject) => Effect.Effect<{
10
11
  readonly [x: string]: Schema.Json;
11
- }, ProviderError | GraphqlError, never>;
12
+ }, ProviderError | NetworkRefused | GraphqlError, never>;
12
13
  discover: Effect.Effect<{
13
14
  readonly __schema: {
14
15
  readonly queryType: {
@@ -42,7 +43,7 @@ export declare const graphqlClientEffect: (input: GraphqlToolsOptions) => Effect
42
43
  }[] | null;
43
44
  }[];
44
45
  };
45
- }, ProviderError | GraphqlError, never>;
46
+ }, ProviderError | NetworkRefused | GraphqlError, never>;
46
47
  }, GraphqlError, never>;
47
48
  /** Build serializable definitions once per introspection revision, without compiling validators. */
48
49
  export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effect.Effect<{
@@ -80,4 +81,4 @@ export declare const graphqlDefinitions: (catalog: GraphqlIntrospection) => Effe
80
81
  /** Bind only the selected definition to current credentials and compile its input decoder. */
81
82
  export declare const adaptGraphqlTool: (client: Effect.Success<ReturnType<typeof graphqlClientEffect>>, definition: GraphqlToolDefinition) => Effect.Effect<import("../contracts/graphql.js").GraphqlTool, GraphqlError, never>;
82
83
  /** Low-level callers can still request a complete invocation-owned tool map. */
83
- export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError>;
84
+ export declare const graphqlToolsEffect: (input: GraphqlToolsOptions) => Effect.Effect<GraphqlTools, GraphqlError | ProviderError | NetworkRefused>;
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "../contracts/provider-error.js";
2
+ import type { NetworkRefused } from "../contracts/network.js";
2
3
  /** One upstream call, with form requests forwarded to the invocation's existing elicitation capability. */
3
4
  import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
5
  import { Effect, Schema } from "effect";
@@ -6,15 +7,15 @@ import { ElicitationFailed } from "../contracts/elicitation.js";
6
7
  import { McpError, type McpToolContext } from "../contracts/mcp.js";
7
8
  import type { JsonObject } from "../contracts/schema.js";
8
9
  /** Register prompts only around tools/call, preserve metadata, and close every callback with the call. Never retries. */
9
- export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError) => Effect.Effect<{
10
+ export declare const mcpCall: (client: Client, name: string, input: JsonObject, context: McpToolContext, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused) => Effect.Effect<{
10
11
  readonly content: readonly {
11
12
  readonly [x: string]: Schema.Json;
12
13
  }[];
13
14
  readonly _meta?: {
14
15
  readonly [x: string]: Schema.Json;
15
- } | undefined;
16
+ };
16
17
  readonly structuredContent?: {
17
18
  readonly [x: string]: Schema.Json;
18
- } | undefined;
19
- readonly isError?: boolean | undefined;
20
- }, ProviderError | ElicitationFailed | McpError, never>;
19
+ };
20
+ readonly isError?: boolean;
21
+ }, ProviderError | NetworkRefused | ElicitationFailed | McpError, never>;
@@ -1,12 +1,11 @@
1
1
  import { Effect } from "effect";
2
- import type { DynamicTools } from "../contracts/dynamic-tools.js";
3
2
  import { McpToolsOptions } from "../contracts/mcp.js";
4
- import { type CatalogCacheOptions } from "./catalog-cache.js";
3
+ import { type CatalogAccount, type CatalogCacheOptions } from "./catalog-cache.js";
5
4
  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
- }
5
+ /**
6
+ * A server, the account whose catalog it is, and the metadata policy for HTTP/SSE sources. A
7
+ * missing cache keeps discovery invocation-local.
8
+ */
9
+ export type McpCatalogOptions = Omit<McpToolsOptions, "accountId" | "headers"> & CatalogCacheOptions & CatalogAccount;
9
10
  /** 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>;
11
+ export declare const mcpCatalog: (options: McpCatalogOptions, kinds: OperationKinds) => Effect.Effect<import("./operations.js").RouterDeclaration<unknown, unknown>, unknown, never>;
@@ -1,51 +1,75 @@
1
1
  import type { ProviderError } from "../contracts/provider-error.js";
2
+ import type { NetworkRefused } from "../contracts/network.js";
2
3
  /** Shared MCP pagination, wire parsing and calls. Transport owns connection lifetime. */
3
4
  import type { Client } from "@modelcontextprotocol/sdk/client/index.js";
4
5
  import type { jsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/types.js";
5
6
  import { Effect, Schema } from "effect";
6
7
  import { McpError, type McpToolContext } from "../contracts/mcp.js";
8
+ import type { UpstreamError } from "../contracts/failure.js";
7
9
  import type { JsonObject } from "../effect.js";
10
+ /**
11
+ * The JSON-RPC error a server answered a request with, if `error` is one. The SDK formats its
12
+ * message as `MCP error <code>: <message>`; the server's own message follows that prefix.
13
+ */
14
+ export declare const answeredError: (error: unknown) => UpstreamError | undefined;
8
15
  /** Use the framework-owned interpreter at the MCP SDK's synchronous validation boundary. */
9
16
  export declare const mcpJsonSchemaValidator: jsonSchemaValidator;
10
17
  /** An operation owns its connection; it must close even when interrupted. */
11
18
  export interface WithMcpClient {
12
- <A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError>;
19
+ <A, E>(mode: "discover" | "call", use: (client: Client) => Effect.Effect<A, E>): Effect.Effect<A, E | McpError | ProviderError | NetworkRefused>;
13
20
  }
14
21
  /** Shared client operations never cache catalogs or account credentials. */
15
- export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError): {
22
+ export declare function mcpClient(withClient: WithMcpClient, timeoutMs: number, failure: (phase: McpError["phase"], error: unknown) => McpError | ProviderError | NetworkRefused): {
16
23
  list: Effect.Effect<{
17
- readonly name: string;
18
- readonly inputSchema: {
19
- readonly [x: string]: Schema.Json;
20
- };
21
- readonly description?: string | undefined;
22
- readonly _meta?: {
23
- readonly [x: string]: Schema.Json;
24
- } | undefined;
25
- readonly title?: string | undefined;
26
- readonly outputSchema?: {
27
- readonly [x: string]: Schema.Json;
28
- } | undefined;
29
- readonly annotations?: {
24
+ tools: {
25
+ readonly name: string;
26
+ readonly inputSchema: {
27
+ readonly [x: string]: Schema.Json;
28
+ };
29
+ readonly description?: string | undefined;
30
+ readonly _meta?: {
31
+ readonly [x: string]: Schema.Json;
32
+ } | undefined;
33
+ readonly title?: string | undefined;
34
+ readonly annotations?: {
35
+ readonly title?: string;
36
+ readonly readOnlyHint?: boolean;
37
+ readonly destructiveHint?: boolean;
38
+ readonly idempotentHint?: boolean;
39
+ readonly openWorldHint?: boolean;
40
+ } | undefined;
41
+ readonly outputSchema?: {
42
+ readonly [x: string]: Schema.Json;
43
+ } | undefined;
44
+ }[];
45
+ server: {
46
+ readonly description?: string;
47
+ readonly version?: string;
48
+ readonly name?: string;
30
49
  readonly title?: string;
31
- readonly readOnlyHint?: boolean;
32
- readonly destructiveHint?: boolean;
33
- readonly idempotentHint?: boolean;
34
- readonly openWorldHint?: boolean;
35
- } | undefined;
36
- }[], ProviderError | McpError, never>;
50
+ readonly instructions?: string;
51
+ readonly icons?: readonly {
52
+ readonly src: string;
53
+ readonly mimeType?: string;
54
+ readonly sizes?: readonly string[];
55
+ readonly theme?: "light" | "dark";
56
+ }[];
57
+ readonly websiteUrl?: string;
58
+ } | {};
59
+ }, ProviderError | NetworkRefused | McpError, never>;
60
+ check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
37
61
  call: (name: string, input: JsonObject, context: McpToolContext) => Effect.Effect<{
38
62
  readonly content: readonly {
39
63
  readonly [x: string]: Schema.Json;
40
64
  }[];
41
65
  readonly _meta?: {
42
66
  readonly [x: string]: Schema.Json;
43
- } | undefined;
67
+ };
44
68
  readonly structuredContent?: {
45
69
  readonly [x: string]: Schema.Json;
46
- } | undefined;
47
- readonly isError?: boolean | undefined;
48
- }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
70
+ };
71
+ readonly isError?: boolean;
72
+ }, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
49
73
  };
50
74
  /** Transport-independent operations consumed by the app tool adapter. */
51
75
  export type McpClient = ReturnType<typeof mcpClient>;
@@ -1,4 +1,4 @@
1
1
  import { Effect } from "effect";
2
2
  import { McpError, ProcessConfig } from "../contracts/mcp.js";
3
3
  /** Each discovery/call owns and closes its subprocess. Deployment never starts it. */
4
- export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | McpError, never>;
4
+ export declare const stdioToolsEffect: (input: ProcessConfig) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, import("../index.js").ProviderError | import("../index.js").NetworkRefused | McpError, never>;
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "../contracts/provider-error.js";
2
+ import type { NetworkRefused } from "../contracts/network.js";
2
3
  /** Adapt any MCP transport into ordinary tools with shared validation behavior. */
3
4
  import { Effect } from "effect";
4
5
  import { McpError, type McpTools, type McpToolMetadata } from "../contracts/mcp.js";
@@ -6,4 +7,4 @@ import type { McpClient } from "./mcp-client.js";
6
7
  /** Compile only the selected tool and bind its executable to the current invocation. */
7
8
  export declare const adaptMcpTool: (client: McpClient, tool: McpToolMetadata) => Effect.Effect<import("../contracts/mcp.js").McpTool, McpError, never>;
8
9
  /** Discover a complete catalog for probes and uncached low-level callers. */
9
- export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError>;
10
+ export declare const adaptMcpTools: (client: McpClient) => Effect.Effect<McpTools, McpError | ProviderError | NetworkRefused>;
@@ -1,41 +1,68 @@
1
1
  import { ProviderError } from "../contracts/provider-error.js";
2
2
  import { Effect, Schema } from "effect";
3
- import { McpError, McpToolsOptions } from "../contracts/mcp.js";
3
+ import { McpCredentialsUnverified, McpError, McpToolsOptions, type McpHealthCheck, type McpHealthOptions } from "../contracts/mcp.js";
4
+ import { NetworkRefused } from "../contracts/network.js";
4
5
  /** Discover and call with a fresh selected-account transport for each operation. */
5
6
  export declare const mcpClientEffect: (input: McpToolsOptions, changed?: Effect.Effect<void, unknown>) => Effect.Effect<{
6
7
  list: Effect.Effect<{
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?: {
8
+ tools: {
9
+ readonly name: string;
10
+ readonly inputSchema: {
11
+ readonly [x: string]: Schema.Json;
12
+ };
13
+ readonly description?: string | undefined;
14
+ readonly _meta?: {
15
+ readonly [x: string]: Schema.Json;
16
+ } | undefined;
17
+ readonly title?: string | undefined;
18
+ readonly annotations?: {
19
+ readonly title?: string;
20
+ readonly readOnlyHint?: boolean;
21
+ readonly destructiveHint?: boolean;
22
+ readonly idempotentHint?: boolean;
23
+ readonly openWorldHint?: boolean;
24
+ } | undefined;
25
+ readonly outputSchema?: {
26
+ readonly [x: string]: Schema.Json;
27
+ } | undefined;
28
+ }[];
29
+ server: {
30
+ readonly description?: string;
31
+ readonly version?: string;
32
+ readonly name?: string;
20
33
  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>;
34
+ readonly instructions?: string;
35
+ readonly icons?: readonly {
36
+ readonly src: string;
37
+ readonly mimeType?: string;
38
+ readonly sizes?: readonly string[];
39
+ readonly theme?: "light" | "dark";
40
+ }[];
41
+ readonly websiteUrl?: string;
42
+ } | {};
43
+ }, ProviderError | NetworkRefused | McpError, never>;
44
+ check: Effect.Effect<void, ProviderError | NetworkRefused | McpError, never>;
27
45
  call: (name: string, input: import("../index.js").JsonObject, context: import("../mcp.js").McpToolContext) => Effect.Effect<{
28
46
  readonly content: readonly {
29
47
  readonly [x: string]: Schema.Json;
30
48
  }[];
31
49
  readonly _meta?: {
32
50
  readonly [x: string]: Schema.Json;
33
- } | undefined;
51
+ };
34
52
  readonly structuredContent?: {
35
53
  readonly [x: string]: Schema.Json;
36
- } | undefined;
37
- readonly isError?: boolean | undefined;
38
- }, ProviderError | import("../index.js").ElicitationFailed | McpError, never>;
54
+ };
55
+ readonly isError?: boolean;
56
+ }, ProviderError | NetworkRefused | import("../index.js").ElicitationFailed | McpError, never>;
39
57
  }, McpError, never>;
58
+ /**
59
+ * Check one account: initialize and read the first page of tools with the account's headers, then
60
+ * repeat that with no headers on a fresh transport. A refused account fails with its
61
+ * `ProviderError`, and anything else that stops the first check is an `McpError`; the second never
62
+ * runs. The check passes only when the server refuses the second, which shows it checked the
63
+ * credentials. Otherwise it fails with `McpCredentialsUnverified`. Both share one budget, which
64
+ * ends early enough before the check context's deadline to close the session and report why.
65
+ */
66
+ export declare const mcpHealthEffect: (check: McpHealthCheck, options: McpHealthOptions) => Effect.Effect<void, ProviderError | NetworkRefused | McpError | McpCredentialsUnverified, never>;
40
67
  /** 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>;
68
+ export declare const mcpToolsEffect: (input: McpToolsOptions) => Effect.Effect<Readonly<Record<string, import("../contracts/mcp.js").McpTool>>, ProviderError | NetworkRefused | McpError, never>;
@@ -0,0 +1,16 @@
1
+ /** Typed refusals and option checks for the fetch app code receives from the framework. */
2
+ import { Effect } from "effect";
3
+ import type { HttpClientResponse } from "effect/unstable/http";
4
+ import { type NetworkRefused } from "../contracts/network.js";
5
+ type Fetch = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
6
+ /** Fail with the refusal a protocol helper's response carries, or continue to its own handling. */
7
+ export declare const failOnNetworkRefusal: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<void, NetworkRefused>;
8
+ /**
9
+ * The fetch app code receives as `ctx.fetch`. It rejects a RequestInit value the app runtime
10
+ * would reject, naming the option, on every host. A request Executor's app network refused
11
+ * rejects with `NetworkRefused`: the service never answered, so there is no response to return.
12
+ */
13
+ export declare const appFetch: (fetch: Fetch) => Fetch;
14
+ /** The invocation's correlated, cancellable fetch, as app code receives it. */
15
+ export declare const appInvocationFetch: (signal: AbortSignal) => Effect.Effect<Fetch, never, never>;
16
+ export {};
@@ -1,24 +1,35 @@
1
1
  /** Compile an OpenAPI document into tool declarations inside the app runtime, never a second execution engine. */
2
2
  import { Effect, Schema } from "effect";
3
3
  import { JsonObject } from "../contracts/schema.js";
4
+ import { OpenapiErrorResponse } from "../contracts/openapi.js";
4
5
  import { OpenapiCompileError as TemplateError } from "../contracts/openapi-compile.js";
5
6
  import type { OpenApiImport } from "../contracts/openapi-document.js";
6
7
  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?: {
8
+ import { type OpenApiDocument } from "./openapi-document.js";
9
+ /** Keep tagged errors, including response/component refs and anyOf alternatives.
10
+ * Public text comes from a declared string message or the schema's static description.
11
+ * `scripts/check-api-errors.ts` applies this to Executor's own API documents.
12
+ */
13
+ export declare function errorResponses(document: OpenApiDocument, operation: JsonObject, at: string): OpenapiErrorResponse[];
14
+ /** Compile a revision of a live OpenAPI source into tool declarations for the app runtime.
15
+ * The document is consumed: compilation upgrades it in place instead of copying it. It must be a
16
+ * tree, with no object reached twice, as parsed JSON is.
17
+ */
18
+ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocument: JsonObject, options?: {
9
19
  readonly baseUrl?: string;
10
20
  readonly allowedOrigin?: string;
21
+ /** Inserted between every operation's server and path; see `prefixParameters`. */
22
+ readonly pathPrefix?: string;
11
23
  readonly securitySchemes?: Readonly<Record<string, JsonObject>>;
12
24
  readonly fallbackSecurity?: GeneratedOperation["request"]["security"];
13
25
  }) => Effect.Effect<{
14
26
  operations: {
15
- readonly name: string;
16
- readonly path: string;
17
27
  readonly description: string;
28
+ readonly name: string;
18
29
  readonly request: {
19
30
  readonly parameters: readonly {
20
31
  readonly name: string;
21
- readonly in: "query" | "path" | "header" | "cookie";
32
+ readonly in: "query" | "path" | "querystring" | "header" | "cookie";
22
33
  readonly required?: boolean;
23
34
  readonly schema?: {
24
35
  readonly [x: string]: Schema.Json;
@@ -53,10 +64,11 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
53
64
  readonly required?: boolean;
54
65
  };
55
66
  };
67
+ readonly path: string;
56
68
  readonly input: {
57
69
  readonly [x: string]: Schema.Json;
58
70
  };
59
- readonly method: "HEAD" | "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS";
71
+ readonly method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "QUERY";
60
72
  readonly securitySchemes: {
61
73
  readonly [x: string]: {
62
74
  readonly [x: string]: Schema.Json;
@@ -67,6 +79,7 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
67
79
  readonly outputSchema?: {
68
80
  readonly [x: string]: Schema.Json;
69
81
  };
82
+ readonly tags?: readonly string[];
70
83
  readonly operationId?: string;
71
84
  readonly streaming?: true;
72
85
  readonly errorResponses?: readonly {
@@ -83,6 +96,14 @@ export declare const compileOpenApiDocument: (entry: OpenApiImport, inputDocumen
83
96
  };
84
97
  }[];
85
98
  }[];
99
+ /** Declared operations left out of `operations`, in definition order. */
100
+ skipped: {
101
+ readonly name: string;
102
+ readonly method: string;
103
+ readonly path: string;
104
+ 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";
105
+ readonly reason: string;
106
+ }[];
86
107
  definitions: {
87
108
  [k: string]: {
88
109
  readonly [x: string]: Schema.Json;