apps 0.0.1-beta.1 → 0.0.1-beta.100

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 (211) hide show
  1. package/README.md +112 -72
  2. package/framework-reference.json +1 -1
  3. package/js/browser-XIPJGLH2.js +65 -0
  4. package/js/chunk-2CURR5Y7.js +264 -0
  5. package/js/chunk-2LSGC7XY.js +42 -0
  6. package/js/{chunk-YEJOQEII.js → chunk-4PIQKACY.js} +65 -10
  7. package/js/chunk-4UPC36ZL.js +5185 -0
  8. package/js/{chunk-4LPG6RCH.js → chunk-4X2UI4R2.js} +7 -27
  9. package/js/chunk-5C6RAGAS.js +335 -0
  10. package/js/chunk-62NVUKED.js +39 -0
  11. package/js/chunk-74H25C4X.js +95 -0
  12. package/js/chunk-7HG422GB.js +90 -0
  13. package/js/chunk-7STIP5CS.js +171 -0
  14. package/js/{chunk-QKHR7BMF.js → chunk-ACQXVKVQ.js} +87 -51
  15. package/js/{chunk-OHRT55C4.js → chunk-DILSCQPJ.js} +226 -265
  16. package/js/chunk-ILYCJ3HV.js +449 -0
  17. package/js/chunk-K6TSCYAO.js +712 -0
  18. package/js/{chunk-EVJUVWN2.js → chunk-KLSEU35Y.js} +463 -218
  19. package/js/chunk-OD3KFKZD.js +1617 -0
  20. package/js/chunk-OWN3DP2W.js +88 -0
  21. package/js/{chunk-ZTFQHGEB.js → chunk-PBGPES67.js} +3 -5
  22. package/js/chunk-QI66R4FP.js +786 -0
  23. package/js/chunk-RN4YB4JT.js +1922 -0
  24. package/js/{chunk-ZCAMUXSG.js → chunk-URKOTNDA.js} +795 -177
  25. package/js/{chunk-NCYXZN2G.js → chunk-UVL56Z6E.js} +390 -23
  26. package/js/{chunk-2HHMABB6.js → chunk-VAI3EVCS.js} +700 -78
  27. package/js/chunk-VCYWAA4N.js +49 -0
  28. package/js/{chunk-HDJH3RPR.js → chunk-YDW7DX3A.js} +4 -4
  29. package/js/chunk-YWVISRZD.js +268 -0
  30. package/js/{chunk-FW5HBOIK.js → chunk-ZKDXML77.js} +19272 -18299
  31. package/js/client.js +148 -100
  32. package/js/contracts.js +208 -24
  33. package/js/effect.js +18 -19
  34. package/js/es-DIULA3ZF.js +39371 -0
  35. package/js/graphql.js +62 -58
  36. package/js/host.js +83 -60
  37. package/js/index.js +381 -263
  38. package/js/mcp/effect.js +21 -21
  39. package/js/mcp.js +117 -74
  40. package/js/openapi.js +4613 -42691
  41. package/js/react.js +2 -3
  42. package/js/skills/effect.js +6 -4
  43. package/js/skills.js +233 -70
  44. package/js/storage/facet.js +1 -540
  45. package/js/ui/auth/contracts.js +8 -9
  46. package/js/ui/auth.js +16 -14
  47. package/js/ui/contracts.js +9 -8
  48. package/js/ui/serving.js +8609 -227
  49. package/package.json +3 -8
  50. package/runtime.json +1 -1
  51. package/types/app-cache/src/contracts/cache.d.ts +60 -2
  52. package/types/app-cache/src/index.d.ts +92 -2
  53. package/types/app-data/src/contracts/database.d.ts +33 -6
  54. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  55. package/types/apps/src/contracts/app.d.ts +63 -17
  56. package/types/apps/src/contracts/cache.d.ts +24 -1
  57. package/types/apps/src/contracts/context.d.ts +60 -17
  58. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  59. package/types/apps/src/contracts/events.d.ts +94 -0
  60. package/types/apps/src/contracts/failure.d.ts +54 -0
  61. package/types/apps/src/contracts/graphql.d.ts +2 -1
  62. package/types/apps/src/contracts/host.d.ts +1325 -534
  63. package/types/apps/src/contracts/icons.d.ts +28 -0
  64. package/types/apps/src/contracts/live.d.ts +2 -0
  65. package/types/apps/src/contracts/mcp.d.ts +97 -20
  66. package/types/apps/src/contracts/network.d.ts +120 -0
  67. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  68. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  69. package/types/apps/src/contracts/openapi.d.ts +51 -9
  70. package/types/apps/src/contracts/operations.d.ts +14 -12
  71. package/types/apps/src/contracts/placement.d.ts +102 -0
  72. package/types/apps/src/contracts/protocol-version.d.ts +6 -0
  73. package/types/apps/src/contracts/protocols/1.d.ts +2241 -0
  74. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  75. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  76. package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
  77. package/types/apps/src/contracts/protocols/2.d.ts +711 -0
  78. package/types/apps/src/contracts/protocols/3.d.ts +776 -0
  79. package/types/apps/src/contracts/protocols/4.d.ts +1306 -0
  80. package/types/apps/src/contracts/protocols/5.d.ts +1200 -0
  81. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  82. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  83. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  84. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  85. package/types/apps/src/contracts/protocols/current.d.ts +6857 -0
  86. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  87. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  88. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  89. package/types/apps/src/contracts/provider.d.ts +140 -10
  90. package/types/apps/src/contracts/router.d.ts +59 -0
  91. package/types/apps/src/contracts/schedules.d.ts +7 -1
  92. package/types/apps/src/contracts/schema.d.ts +21 -0
  93. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  94. package/types/apps/src/contracts/skills.d.ts +60 -14
  95. package/types/apps/src/contracts/sql.d.ts +63 -0
  96. package/types/apps/src/contracts/ui-auth.d.ts +6 -14
  97. package/types/apps/src/contracts/ui.d.ts +70 -30
  98. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  99. package/types/apps/src/contracts/workflows.d.ts +89 -36
  100. package/types/apps/src/facet.d.ts +4 -5
  101. package/types/apps/src/graphql.d.ts +1 -3
  102. package/types/apps/src/host.d.ts +5 -0
  103. package/types/apps/src/implementation/account-router.d.ts +13 -0
  104. package/types/apps/src/implementation/app.d.ts +44 -16
  105. package/types/apps/src/implementation/authoring.d.ts +25 -5
  106. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  107. package/types/apps/src/implementation/cache.d.ts +32 -3
  108. package/types/apps/src/implementation/catalog-cache.d.ts +43 -5
  109. package/types/apps/src/implementation/elicitation.d.ts +18 -15
  110. package/types/apps/src/implementation/events.d.ts +64 -0
  111. package/types/apps/src/implementation/failure-detail.d.ts +48 -0
  112. package/types/apps/src/implementation/graphql-catalog.d.ts +4 -7
  113. package/types/apps/src/implementation/graphql.d.ts +4 -3
  114. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  115. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  116. package/types/apps/src/implementation/live.d.ts +2 -2
  117. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  118. package/types/apps/src/implementation/mcp-catalog.d.ts +7 -8
  119. package/types/apps/src/implementation/mcp-client.d.ts +49 -25
  120. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  121. package/types/apps/src/implementation/mcp.d.ts +52 -25
  122. package/types/apps/src/implementation/network.d.ts +16 -0
  123. package/types/apps/src/implementation/openapi-compile.d.ts +30 -8
  124. package/types/apps/src/implementation/openapi-document.d.ts +46 -21
  125. package/types/apps/src/implementation/openapi-names.d.ts +23 -0
  126. package/types/apps/src/implementation/openapi-request.d.ts +10 -3
  127. package/types/apps/src/implementation/openapi-source.d.ts +30 -8
  128. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  129. package/types/apps/src/implementation/operations.d.ts +84 -10
  130. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  131. package/types/apps/src/implementation/placement.d.ts +60 -0
  132. package/types/apps/src/implementation/protocol-operations.d.ts +6 -4
  133. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  134. package/types/apps/src/implementation/provider.d.ts +26 -6
  135. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  136. package/types/apps/src/implementation/router-catalog.d.ts +227 -0
  137. package/types/apps/src/implementation/router.d.ts +78 -0
  138. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  139. package/types/apps/src/implementation/schedules.d.ts +39 -8
  140. package/types/apps/src/implementation/schema.d.ts +111 -15
  141. package/types/apps/src/implementation/skills.d.ts +18 -24
  142. package/types/apps/src/implementation/sql.d.ts +71 -0
  143. package/types/apps/src/implementation/swagger-client.d.ts +28 -0
  144. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  145. package/types/apps/src/implementation/ui-auth.d.ts +12 -6
  146. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  147. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  148. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  149. package/types/apps/src/implementation/ui-serving.d.ts +31 -12
  150. package/types/apps/src/implementation/ui-watch.d.ts +1 -1
  151. package/types/apps/src/implementation/upstream-error.d.ts +7 -0
  152. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  153. package/types/apps/src/implementation/workflow-context.d.ts +17 -5
  154. package/types/apps/src/implementation/workflows.d.ts +11 -4
  155. package/types/apps/src/index.d.ts +71 -21
  156. package/types/apps/src/mcp.d.ts +25 -5
  157. package/types/apps/src/openapi.d.ts +11 -6
  158. package/types/apps/src/react.d.ts +1 -1
  159. package/types/apps/src/skills.d.ts +13 -8
  160. package/types/apps/src/ui-auth.d.ts +2 -2
  161. package/types/apps/src/ui-serving.d.ts +1 -1
  162. package/types/telemetry/src/app-records.d.ts +42 -0
  163. package/types/telemetry/src/browser-operations.d.ts +7 -4
  164. package/types/telemetry/src/browser.d.ts +8 -3
  165. package/types/telemetry/src/config.d.ts +2 -2
  166. package/types/telemetry/src/index.d.ts +2 -1
  167. package/types/telemetry/src/layer.d.ts +10 -4
  168. package/types/telemetry/src/measurements.d.ts +1 -1
  169. package/types/telemetry/src/ownership.d.ts +60 -0
  170. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  171. package/types/telemetry/src/relay.d.ts +16 -6
  172. package/types/telemetry/src/span-attributes.d.ts +17 -1
  173. package/types/telemetry/src/transport.d.ts +8 -1
  174. package/types/utils/src/api-error.d.ts +55 -0
  175. package/types/utils/src/connection-failure.d.ts +33 -0
  176. package/types/utils/src/legacy-keys.d.ts +20 -0
  177. package/types/utils/src/recorded-message.d.ts +18 -0
  178. package/types/utils/src/schema-definitions.d.ts +13 -0
  179. package/types/utils/src/user-facing-error.d.ts +83 -0
  180. package/js/chunk-6IIO4NPI.js +0 -29
  181. package/js/chunk-6YBRWRK3.js +0 -160
  182. package/js/chunk-BMOIAIVR.js +0 -138
  183. package/js/chunk-FZJOYIZO.js +0 -19
  184. package/js/chunk-G7IE6BKC.js +0 -224
  185. package/js/chunk-IHQ4ML7K.js +0 -2193
  186. package/js/chunk-KOXMLKTM.js +0 -1288
  187. package/js/chunk-M6ZRRIBI.js +0 -877
  188. package/js/chunk-PLCMJREA.js +0 -590
  189. package/js/chunk-PZ36XMXW.js +0 -93
  190. package/js/chunk-RBAC33PQ.js +0 -267
  191. package/js/chunk-SATWJKN6.js +0 -34
  192. package/js/chunk-SWPD52J7.js +0 -35
  193. package/js/chunk-TE4KO4HI.js +0 -47
  194. package/js/chunk-W7D7WVSY.js +0 -18
  195. package/js/chunk-X7SFGU4Q.js +0 -280
  196. package/js/chunk-ZJWDMTE3.js +0 -63
  197. package/js/mcp/stdio.js +0 -128
  198. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  199. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  200. package/types/app-data/src/implementation/promise.d.ts +0 -68
  201. package/types/app-data/src/implementation/range.d.ts +0 -8
  202. package/types/app-data/src/implementation/schema.d.ts +0 -33
  203. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  204. package/types/app-data/src/index.d.ts +0 -4
  205. package/types/apps/src/contracts/dynamic-tools.d.ts +0 -13
  206. package/types/apps/src/contracts/storage.d.ts +0 -68
  207. package/types/apps/src/implementation/account-operations.d.ts +0 -151
  208. package/types/apps/src/implementation/dynamic-tools.d.ts +0 -8
  209. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  210. package/types/apps/src/implementation/storage.d.ts +0 -13
  211. package/types/apps/src/mcp-stdio.d.ts +0 -8
@@ -0,0 +1,28 @@
1
+ /** The icons an app declares beside its accounts, so a host shows them without evaluating it. */
2
+ import { Schema } from "effect";
3
+ /** At most this many icons, together at most this many characters of JSON (32 KiB). */
4
+ export declare const appIconLimits: {
5
+ readonly icons: 8;
6
+ readonly characters: number;
7
+ };
8
+ /**
9
+ * One image an app shows for itself, the same shape as a router's icon. `theme` names the color
10
+ * scheme it is drawn for; an icon without one suits both.
11
+ */
12
+ export declare const AppIcon: Schema.Struct<{
13
+ readonly src: Schema.String;
14
+ readonly mimeType: Schema.optionalKey<Schema.String>;
15
+ readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
16
+ readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
17
+ }>;
18
+ export type AppIcon = typeof AppIcon.Type;
19
+ /** An app's icons, bounded in number and total size. */
20
+ export declare const AppIcons: Schema.$Array<Schema.Struct<{
21
+ readonly src: Schema.String;
22
+ readonly mimeType: Schema.optionalKey<Schema.String>;
23
+ readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
24
+ readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
25
+ }>>;
26
+ export type AppIcons = typeof AppIcons.Type;
27
+ /** Why declared icons are refused, in the author's terms, or undefined when they are valid. */
28
+ export declare const appIconsProblem: (icons: unknown) => string | undefined;
@@ -1,6 +1,8 @@
1
1
  /** Browser subscription contracts contain no executable server declarations. */
2
2
  import { Schema } from "effect";
3
3
  import type { JsonValue } from "./schema.js";
4
+ /** Names of authored operations. */
5
+ export declare const OperationName: Schema.NonEmptyString;
4
6
  /** Serializable named reference; the phantom field is never populated at runtime. */
5
7
  export interface OperationReference<Input, Output, Kind extends "query" | "mutation"> {
6
8
  readonly name: string;
@@ -1,7 +1,9 @@
1
- import type { ProviderError } from "./provider-error.js";
1
+ import { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** MCP protocol data uses Effect Schema; executable tool methods use Effect. */
3
4
  import { type Effect, type Redacted, Schema } from "effect";
4
5
  import type { Elicit, ElicitationFailed } from "./elicitation.js";
6
+ import type { AccountCheckContext, AuthMethods } from "./provider.js";
5
7
  import { type JsonValue } from "./schema.js";
6
8
  /** Upstream MCP resource bounds, independent of the outer codemode execution budget. */
7
9
  export declare const McpClientLimits: Schema.Struct<{
@@ -12,7 +14,7 @@ export declare const McpClientLimits: Schema.Struct<{
12
14
  readonly cleanupTimeoutMs: Schema.Int;
13
15
  }>;
14
16
  export type McpClientLimits = typeof McpClientLimits.Type;
15
- /** HTTP and stdio share discovery ceilings and the default provider timeout. */
17
+ /** Discovery ceilings and the default provider timeout. */
16
18
  export declare const defaultMcpClientLimits: {
17
19
  readonly timeoutMs: number;
18
20
  readonly maxTimeoutMs: number;
@@ -31,6 +33,37 @@ export declare const McpToolsOptions: Schema.Struct<{
31
33
  readonly timeoutMs: Schema.optional<Schema.Number>;
32
34
  }>;
33
35
  export type McpToolsOptions = typeof McpToolsOptions.Type;
36
+ /**
37
+ * What `mcpHealth` checks, as decoded: its options, with the account's ID, signal and deadline
38
+ * taken from the check context.
39
+ */
40
+ export declare const McpHealthInput: Schema.Struct<{
41
+ readonly headers: Schema.$Record<Schema.String, Schema.String>;
42
+ readonly deadline: Schema.optional<Schema.Finite>;
43
+ readonly url: Schema.String;
44
+ readonly accountId: Schema.optional<Schema.brand<Schema.String, "acc">>;
45
+ readonly signal: Schema.optional<Schema.instanceOf<AbortSignal, AbortSignal>>;
46
+ readonly timeoutMs: Schema.optional<Schema.Number>;
47
+ }>;
48
+ /**
49
+ * The server a provider check verifies, and the headers that send the checked account's
50
+ * credentials. The account, signal and deadline come from the check context instead. Both attempts
51
+ * share one budget that ends `mcpHealthReserveMs` before the deadline. `timeoutMs` bounds the whole
52
+ * check too; it can shorten the budget, never extend it.
53
+ */
54
+ export type McpHealthOptions = Pick<typeof McpHealthInput.Type, "url" | "headers" | "timeoutMs">;
55
+ /** What `mcpHealth` reads from the check context the host passes to a provider's `health`. */
56
+ export type McpHealthCheck = Pick<AccountCheckContext<AuthMethods>, "signal" | "deadline"> & {
57
+ readonly account: {
58
+ readonly id: string;
59
+ };
60
+ };
61
+ /**
62
+ * How long before an account check's deadline `mcpHealth` stops waiting for the server, so it can
63
+ * still close its session, ending it and then its transport, each within `cleanupTimeoutMs`, and
64
+ * report why before the host stops waiting.
65
+ */
66
+ export declare const mcpHealthReserveMs: number;
34
67
  /** One parsed server and credential snapshot; never shared across account evaluations. */
35
68
  export interface McpConnection {
36
69
  readonly url: URL;
@@ -38,15 +71,21 @@ export interface McpConnection {
38
71
  readonly timeoutMs: number;
39
72
  }
40
73
  export { ToolAnnotations as McpToolAnnotations } from "./tools.js";
41
- /** Native MCP result semantics. Protocol/transport failures use the Effect error channel. */
74
+ /**
75
+ * Native MCP result semantics, and the value every MCP tool call returns. A tool's output
76
+ * schema is built from this declaration. Protocol/transport failures use the Effect error channel.
77
+ */
42
78
  export declare const McpToolResult: Schema.Struct<{
43
79
  readonly content: Schema.$Array<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
44
- readonly structuredContent: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
45
- readonly isError: Schema.optional<Schema.Boolean>;
46
- readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
80
+ readonly structuredContent: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
81
+ readonly isError: Schema.optionalKey<Schema.Boolean>;
82
+ readonly _meta: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
47
83
  }>;
48
84
  export type McpToolResult = typeof McpToolResult.Type;
49
- /** Remote metadata. Input/output schemas remain upstream JSON Schema documents. */
85
+ /**
86
+ * Remote metadata. Input/output schemas remain upstream JSON Schema documents; the upstream
87
+ * output schema describes only a result's `structuredContent`.
88
+ */
50
89
  export declare const McpToolMetadata: Schema.Struct<{
51
90
  readonly name: Schema.String;
52
91
  readonly title: Schema.optional<Schema.String>;
@@ -63,16 +102,37 @@ export declare const McpToolMetadata: Schema.Struct<{
63
102
  readonly _meta: Schema.optional<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
64
103
  }>;
65
104
  export type McpToolMetadata = typeof McpToolMetadata.Type;
105
+ /** What a server reports about itself when a session initializes. Icons are for display only. */
106
+ export declare const McpServerHeader: Schema.Struct<{
107
+ readonly name: Schema.optionalKey<Schema.String>;
108
+ readonly title: Schema.optionalKey<Schema.String>;
109
+ readonly version: Schema.optionalKey<Schema.String>;
110
+ readonly description: Schema.optionalKey<Schema.String>;
111
+ readonly websiteUrl: Schema.optionalKey<Schema.String>;
112
+ readonly icons: Schema.optionalKey<Schema.$Array<Schema.Struct<{
113
+ readonly src: Schema.NonEmptyString;
114
+ readonly mimeType: Schema.optionalKey<Schema.String>;
115
+ readonly sizes: Schema.optionalKey<Schema.$Array<Schema.String>>;
116
+ readonly theme: Schema.optionalKey<Schema.Literals<readonly ["light", "dark"]>>;
117
+ }>>>;
118
+ readonly instructions: Schema.optionalKey<Schema.String>;
119
+ }>;
120
+ export type McpServerHeader = typeof McpServerHeader.Type;
66
121
  /** Direct callers can omit interaction capabilities. A server that asks for input then fails explicitly. */
67
122
  export interface McpToolContext {
68
123
  readonly elicit?: Elicit;
69
124
  }
70
- /** A tool bound to one evaluation's account; do not reuse it with another account. */
71
- export interface McpTool extends McpToolMetadata {
125
+ /**
126
+ * A tool bound to one evaluation's account; do not reuse it with another account. `output`
127
+ * decodes and describes the `McpToolResult` that `run` returns, with the upstream output schema
128
+ * under `structuredContent`.
129
+ */
130
+ export interface McpTool extends Omit<McpToolMetadata, "outputSchema"> {
72
131
  readonly description: string;
73
132
  readonly input: Schema.Decoder<JsonValue>;
133
+ readonly output: Schema.Decoder<JsonValue>;
74
134
  readonly readOnly?: boolean;
75
- readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | ElicitationFailed>;
135
+ readonly run: (context: McpToolContext, input: JsonValue) => Effect.Effect<McpToolResult, McpError | ProviderError | NetworkRefused | ElicitationFailed>;
76
136
  }
77
137
  /** The discovered catalog keyed by remote tool name. */
78
138
  export type McpTools = Readonly<Record<string, McpTool>>;
@@ -80,16 +140,33 @@ declare const McpError_base: Schema.Class<McpError, Schema.TaggedStruct<"McpErro
80
140
  readonly phase: Schema.Literals<readonly ["connect", "discover", "call", "schema", "transport"]>;
81
141
  readonly reason: Schema.Literals<readonly ["request", "unauthorized", "invalid_response", "timeout", "invalid_input"]>;
82
142
  readonly status: Schema.optional<Schema.Number>;
143
+ readonly upstream: Schema.optional<Schema.Struct<{
144
+ readonly code: Schema.Union<readonly [Schema.Int, Schema.String]>;
145
+ readonly message: Schema.optionalKey<Schema.String>;
146
+ }>>;
147
+ readonly session: Schema.optional<Schema.Literal<true>>;
83
148
  }>, import("effect/Cause").YieldableError>;
84
- /** Safe protocol/transport failure; no raw upstream payloads or credentials. */
149
+ /**
150
+ * Safe protocol/transport failure; no raw upstream payloads or credentials. `status` is the HTTP
151
+ * status a `request` failure was redirected or refused with. Without one, a `request` failure in
152
+ * the `transport` phase never reached the server; in another phase it may be a JSON-RPC error the
153
+ * server answered with. `upstream` is that JSON-RPC error, bounded and with account secrets
154
+ * replaced. A response that is not MCP is `invalid_response`. `session` is set when the refused
155
+ * request carried the session ID the server issued at initialization.
156
+ *
157
+ * These fields describe the failure for whoever reads it. App code can set any of them, so they
158
+ * never show that the failure lies outside Executor.
159
+ */
85
160
  export declare class McpError extends McpError_base {
86
161
  }
87
- /** Public process configuration. Credentials arrive through the selected account. */
88
- export declare const ProcessConfig: Schema.Struct<{
89
- readonly command: Schema.NonEmptyString;
90
- readonly args: Schema.$Array<Schema.String>;
91
- readonly cwd: Schema.optional<Schema.String>;
92
- readonly env: Schema.$Record<Schema.String, Schema.String>;
93
- readonly timeoutMs: Schema.Int;
94
- }>;
95
- export type ProcessConfig = typeof ProcessConfig.Type;
162
+ declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverified, Schema.TaggedStruct<"McpCredentialsUnverified", {
163
+ readonly anonymous: Schema.Union<readonly [Schema.Literal<"answered">, typeof McpError, typeof ProviderError]>;
164
+ }>, import("effect/Cause").YieldableError>;
165
+ /**
166
+ * `mcpHealth` could not show that the server needs the account's credentials, although it accepted
167
+ * them. `anonymous` is what the same check without credentials met: `answered` when it succeeded,
168
+ * so a refused key would pass too, or the failure, other than a refusal, that left it undecided.
169
+ * Only app code raises it; the host reports its fixed message, so no host protocol carries it.
170
+ */
171
+ export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
172
+ }
@@ -0,0 +1,120 @@
1
+ /**
2
+ * What app code sees when Executor's app network refuses a request, and the fetch options the
3
+ * app runtime accepts. A refusal is Executor's decision, not the service's: the request never
4
+ * left Executor. App code runs on workerd, Cloudflare's runtime, on every host.
5
+ */
6
+ import { Schema } from "effect";
7
+ /**
8
+ * Why Executor's app network refused a request.
9
+ * - `private_address`: the destination is a private, loopback or internal address, and this
10
+ * instance lets apps reach only public addresses.
11
+ * - `credential_host`: the request carries a credential handle, and its provider does not allow
12
+ * the destination host.
13
+ * - `credential_app`: the request carries a credential handle that is not valid for this app.
14
+ * - `credential_expired`: the request carries an expired credential handle.
15
+ * - `credential_placement`: the request carries a credential handle somewhere its method does not
16
+ * place it, such as a body, the URL path or another header, or in a value that does not match
17
+ * the method's template exactly.
18
+ * - `credential_transport`: the request would send a placed credential over plain HTTP. Placed
19
+ * credentials go only over HTTPS, except to a loopback address on an instance whose operator
20
+ * lets apps reach private addresses, for local development.
21
+ * - `credential_method`: the request carries a credential handle and uses a method that asks the
22
+ * service to echo the request back, such as `TRACE`.
23
+ */
24
+ export declare const NetworkRefusal: Schema.Union<readonly [Schema.Struct<{
25
+ readonly reason: Schema.Literal<"private_address">;
26
+ }>, Schema.Struct<{
27
+ readonly reason: Schema.Literal<"credential_host">;
28
+ /** The provider of the credential handle the request carried. */
29
+ readonly provider: Schema.String;
30
+ /** The hosts that provider's credentials may reach; empty when it declares none. */
31
+ readonly allowedHosts: Schema.$Array<Schema.String>;
32
+ }>, Schema.Struct<{
33
+ readonly reason: Schema.Literal<"credential_app">;
34
+ }>, Schema.Struct<{
35
+ readonly reason: Schema.Literal<"credential_expired">;
36
+ /** The provider of the expired credential handle. */
37
+ readonly provider: Schema.String;
38
+ }>, Schema.Struct<{
39
+ readonly reason: Schema.Literal<"credential_placement">;
40
+ /** The provider of the misplaced credential handle. */
41
+ readonly provider: Schema.String;
42
+ /** Where the handle was found, such as `body` or `header x-note`. */
43
+ readonly location: Schema.String;
44
+ }>, Schema.Struct<{
45
+ readonly reason: Schema.Literal<"credential_transport">;
46
+ /** The provider of the credential handle the request carried. */
47
+ readonly provider: Schema.String;
48
+ }>, Schema.Struct<{
49
+ readonly reason: Schema.Literal<"credential_method">;
50
+ /** The refused HTTP method. */
51
+ readonly method: Schema.String;
52
+ }>]>;
53
+ export type NetworkRefusal = typeof NetworkRefusal.Type;
54
+ declare const NetworkRefused_base: Schema.Class<NetworkRefused, Schema.TaggedStruct<"NetworkRefused", {
55
+ /** The refused destination, with its port when the URL names one. */
56
+ readonly host: Schema.String;
57
+ readonly refusal: Schema.Union<readonly [Schema.Struct<{
58
+ readonly reason: Schema.Literal<"private_address">;
59
+ }>, Schema.Struct<{
60
+ readonly reason: Schema.Literal<"credential_host">;
61
+ /** The provider of the credential handle the request carried. */
62
+ readonly provider: Schema.String;
63
+ /** The hosts that provider's credentials may reach; empty when it declares none. */
64
+ readonly allowedHosts: Schema.$Array<Schema.String>;
65
+ }>, Schema.Struct<{
66
+ readonly reason: Schema.Literal<"credential_app">;
67
+ }>, Schema.Struct<{
68
+ readonly reason: Schema.Literal<"credential_expired">;
69
+ /** The provider of the expired credential handle. */
70
+ readonly provider: Schema.String;
71
+ }>, Schema.Struct<{
72
+ readonly reason: Schema.Literal<"credential_placement">;
73
+ /** The provider of the misplaced credential handle. */
74
+ readonly provider: Schema.String;
75
+ /** Where the handle was found, such as `body` or `header x-note`. */
76
+ readonly location: Schema.String;
77
+ }>, Schema.Struct<{
78
+ readonly reason: Schema.Literal<"credential_transport">;
79
+ /** The provider of the credential handle the request carried. */
80
+ readonly provider: Schema.String;
81
+ }>, Schema.Struct<{
82
+ readonly reason: Schema.Literal<"credential_method">;
83
+ /** The refused HTTP method. */
84
+ readonly method: Schema.String;
85
+ }>]>;
86
+ }>, import("effect/Cause").YieldableError>;
87
+ /** Executor's app network refused a request before it reached the service. */
88
+ export declare class NetworkRefused extends NetworkRefused_base {
89
+ get message(): string;
90
+ }
91
+ /**
92
+ * A refusal reaches app code as a response with this status and header. The header holds the
93
+ * encoded `NetworkRefused`, so it survives responses without a body, such as to `HEAD`; the
94
+ * body repeats it as JSON with its message. `ctx.fetch` and the framework's protocol helpers
95
+ * raise it as `NetworkRefused`; the platform's global `fetch` returns the response. Only
96
+ * Executor's app network sets the mark: it removes the header from a service's 421 response.
97
+ */
98
+ export declare const networkRefusalStatus = 421;
99
+ export declare const networkRefusalHeader = "x-executor-refused";
100
+ /** The header's value: the refusal as JSON, URI-encoded so any provider name fits in a header. */
101
+ export declare const NetworkRefusedHeader: Schema.compose<Schema.fromJsonString<typeof NetworkRefused>, Schema.StringFromUriComponent>;
102
+ /** The response Executor's app network returns in place of a request it refused. */
103
+ export declare const networkRefusalResponse: (refused: NetworkRefused) => Response;
104
+ /** RequestInit options the app runtime restricts. */
105
+ export declare const RestrictedFetchOption: Schema.Literals<readonly ["redirect", "cache", "integrity"]>;
106
+ export type RestrictedFetchOption = typeof RestrictedFetchOption.Type;
107
+ /** The values the app runtime accepts for each restricted option. */
108
+ export declare const supportedFetchOptions: Readonly<Record<RestrictedFetchOption, ReadonlyArray<string>>>;
109
+ declare const FetchOptionUnsupported_base: Schema.Class<FetchOptionUnsupported, Schema.TaggedStruct<"FetchOptionUnsupported", {
110
+ readonly option: Schema.Literals<readonly ["redirect", "cache", "integrity"]>;
111
+ readonly value: Schema.String;
112
+ readonly supported: Schema.$Array<Schema.String>;
113
+ }>, import("effect/Cause").YieldableError>;
114
+ /** `ctx.fetch` was given a standard RequestInit value the app runtime does not implement. */
115
+ export declare class FetchOptionUnsupported extends FetchOptionUnsupported_base {
116
+ get message(): string;
117
+ /** What to do instead, when the standard value has an equivalent the runtime supports. */
118
+ private get advice();
119
+ }
120
+ export {};
@@ -1,11 +1,90 @@
1
1
  /** Shared OpenAPI compilation diagnostics. */
2
2
  import { Schema } from "effect";
3
- export declare const OpenapiCompileErrorCode: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
3
+ /** Which part of an OpenAPI document could not be compiled into tools. */
4
+ export declare const OpenapiCompileErrorCode: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
5
+ /** A declared operation the importer left out, and why. */
6
+ export declare const OpenapiSkippedOperation: Schema.Struct<{
7
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
8
+ readonly name: Schema.String;
9
+ /** The HTTP method, such as `GET`. */
10
+ readonly method: Schema.String;
11
+ /** The path as the definition declares it. */
12
+ readonly path: Schema.String;
13
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
14
+ readonly reason: Schema.String;
15
+ }>;
16
+ export type OpenapiSkippedOperation = typeof OpenapiSkippedOperation.Type;
4
17
  declare const OpenapiCompileError_base: Schema.Class<OpenapiCompileError, Schema.TaggedStruct<"OpenapiCompileError", {
5
- readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
18
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
6
19
  readonly reason: Schema.String;
20
+ readonly skipped: Schema.optionalKey<Schema.$Array<Schema.Struct<{
21
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
22
+ readonly name: Schema.String;
23
+ /** The HTTP method, such as `GET`. */
24
+ readonly method: Schema.String;
25
+ /** The path as the definition declares it. */
26
+ readonly path: Schema.String;
27
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
28
+ readonly reason: Schema.String;
29
+ }>>>;
30
+ readonly origins: Schema.optionalKey<Schema.$Array<Schema.String>>;
7
31
  }>, import("effect/Cause").YieldableError>;
8
- /** A safe generation failure, translated into product HTTP errors at the boundary. */
32
+ /**
33
+ * A safe generation failure. `reason` explains the cause; `skipped` lists the declared operations
34
+ * it left out and why, and `origins` the origins operations resolve to when none of them matches
35
+ * the allowed origin. Reading one left-out tool fails with this error for that operation alone.
36
+ */
9
37
  export declare class OpenapiCompileError extends OpenapiCompileError_base {
38
+ get message(): string;
10
39
  }
40
+ /** A tool a generated OpenAPI router exposes, read from the definition alone. */
41
+ export declare const OpenapiToolName: Schema.Struct<{
42
+ /** The tool name relative to the router, as `withApprovals` receives it. */
43
+ readonly name: Schema.String;
44
+ /** The HTTP method, such as `GET`. */
45
+ readonly method: Schema.String;
46
+ /** The request path, including any `pathPrefix`. */
47
+ readonly path: Schema.String;
48
+ readonly operationId: Schema.optionalKey<Schema.String>;
49
+ /** After `kinds` (keyed by `operationId`, else `name`); otherwise reading methods are queries. */
50
+ readonly kind: Schema.Literals<readonly ["query", "mutation"]>;
51
+ /** Callable without credentials, so every account and a router without one expose it. */
52
+ readonly public: Schema.Boolean;
53
+ /** The `methods` and `oauth` entries whose accounts expose it. */
54
+ readonly methods: Schema.$Array<Schema.String>;
55
+ }>;
56
+ export type OpenapiToolName = typeof OpenapiToolName.Type;
57
+ /** Every tool a definition yields for some account, and the operations the compiler left out. */
58
+ export declare const OpenapiToolNames: Schema.Struct<{
59
+ readonly tools: Schema.$Array<Schema.Struct<{
60
+ /** The tool name relative to the router, as `withApprovals` receives it. */
61
+ readonly name: Schema.String;
62
+ /** The HTTP method, such as `GET`. */
63
+ readonly method: Schema.String;
64
+ /** The request path, including any `pathPrefix`. */
65
+ readonly path: Schema.String;
66
+ readonly operationId: Schema.optionalKey<Schema.String>;
67
+ /** After `kinds` (keyed by `operationId`, else `name`); otherwise reading methods are queries. */
68
+ readonly kind: Schema.Literals<readonly ["query", "mutation"]>;
69
+ /** Callable without credentials, so every account and a router without one expose it. */
70
+ readonly public: Schema.Boolean;
71
+ /** The `methods` and `oauth` entries whose accounts expose it. */
72
+ readonly methods: Schema.$Array<Schema.String>;
73
+ }>>;
74
+ /**
75
+ * Operations the compiler left out, and why. An operation it imports but no configured `methods`
76
+ * or `oauth` entry can authorize is missing from `tools` and is not listed here.
77
+ */
78
+ readonly skipped: Schema.$Array<Schema.Struct<{
79
+ /** The tool name the operation would have; reading that tool reports why it is missing. */
80
+ readonly name: Schema.String;
81
+ /** The HTTP method, such as `GET`. */
82
+ readonly method: Schema.String;
83
+ /** The path as the definition declares it. */
84
+ readonly path: Schema.String;
85
+ readonly code: Schema.Literals<readonly ["server_protocol", "server_url", "external_reference", "circular_reference", "schema_keyword", "schema_reference", "missing_component", "openapi_version", "auth_helper", "auth_missing", "operation_path", "operation_method", "duplicate_operation", "server_missing", "multiple_hosts", "parameter_encoding", "parameter_style", "request_body", "combined_oauth", "auth_method", "event_stream", "input_schema", "no_operations", "no_supported_operations", "invalid_document", "source_generation", "authoring_reference"]>;
86
+ readonly reason: Schema.String;
87
+ }>>;
88
+ }>;
89
+ export type OpenapiToolNames = typeof OpenapiToolNames.Type;
11
90
  export {};
@@ -1,4 +1,4 @@
1
- /** OpenAPI boundary parsing. Unsupported transport/auth features fail before deployment. */
1
+ /** OpenAPI boundary parsing. Unsupported transport/auth features fail before deploying. */
2
2
  import { Schema } from "effect";
3
3
  /** Parsed OpenAPI 3 source; individual operation references are resolved separately. */
4
4
  export declare const Specification: Schema.Struct<{
@@ -1,4 +1,5 @@
1
1
  import type { ProviderError } from "./provider-error.js";
2
+ import type { NetworkRefused } from "./network.js";
2
3
  /** Credential-free OpenAPI request declarations and validation schemas retained with app source. */
3
4
  import { Schema, type Effect } from "effect";
4
5
  import { JsonObject } from "./schema.js";
@@ -20,7 +21,8 @@ export type OpenapiErrorResponse = typeof OpenapiErrorResponse.Type;
20
21
  /** Resolved OpenAPI parameter shared by import validation and request construction. */
21
22
  export declare const OpenapiParameter: Schema.Struct<{
22
23
  readonly name: Schema.String;
23
- readonly in: Schema.Literals<readonly ["path", "query", "header", "cookie"]>;
24
+ /** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
25
+ readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
24
26
  readonly required: Schema.optionalKey<Schema.Boolean>;
25
27
  readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
26
28
  readonly style: Schema.optionalKey<Schema.String>;
@@ -40,9 +42,12 @@ export declare const OpenapiRequestBody: Schema.Struct<{
40
42
  }>;
41
43
  /** Credential-free operation data emitted by the OpenAPI importer. */
42
44
  export declare const OpenapiOperation: Schema.Struct<{
45
+ /** The tool name after `queries.` or `mutations.`, grouped as `<group>.<leaf>`. */
43
46
  readonly name: Schema.NonEmptyString;
47
+ /** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
48
+ readonly operationId: Schema.optionalKey<Schema.String>;
44
49
  readonly description: Schema.String;
45
- readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
50
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
46
51
  readonly path: Schema.String;
47
52
  readonly baseUrl: Schema.String;
48
53
  readonly openapi: Schema.String;
@@ -51,7 +56,8 @@ export declare const OpenapiOperation: Schema.Struct<{
51
56
  readonly request: Schema.Struct<{
52
57
  readonly parameters: Schema.$Array<Schema.Struct<{
53
58
  readonly name: Schema.String;
54
- readonly in: Schema.Literals<readonly ["path", "query", "header", "cookie"]>;
59
+ /** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
60
+ readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
55
61
  readonly required: Schema.optionalKey<Schema.Boolean>;
56
62
  readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
57
63
  readonly style: Schema.optionalKey<Schema.String>;
@@ -72,6 +78,8 @@ export declare const OpenapiOperation: Schema.Struct<{
72
78
  }>;
73
79
  /** Streams remain in the metadata but cannot run through a single-result tool call. */
74
80
  readonly streaming: Schema.optionalKey<Schema.Literal<true>>;
81
+ /** The operation's OpenAPI tags, shown to agents as labels within its router. */
82
+ readonly tags: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
75
83
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
76
84
  readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
77
85
  readonly errorResponses: Schema.optionalKey<Schema.$Array<Schema.Struct<{
@@ -87,6 +95,8 @@ export declare const OpenapiOperation: Schema.Struct<{
87
95
  }>>>;
88
96
  }>;
89
97
  export type OpenapiOperation = typeof OpenapiOperation.Type;
98
+ /** Safe methods, whose operations are queries unless `kinds` says otherwise. QUERY is OpenAPI 3.2's. */
99
+ export declare const isOpenapiReadMethod: (method: OpenapiOperation["method"]) => method is "HEAD" | "GET" | "OPTIONS" | "QUERY";
90
100
  /** Map a selected account field to one Swagger credential value. */
91
101
  export declare const CredentialBinding: Schema.Struct<{
92
102
  readonly scheme: Schema.String;
@@ -115,9 +125,12 @@ export type OpenapiParameterDefaults = typeof OpenapiParameterDefaults.Type;
115
125
  /** Parsed options for one account's evaluation. */
116
126
  export declare const OpenapiToolsOptions: Schema.Struct<{
117
127
  readonly operations: Schema.$Array<Schema.Struct<{
128
+ /** The tool name after `queries.` or `mutations.`, grouped as `<group>.<leaf>`. */
118
129
  readonly name: Schema.NonEmptyString;
130
+ /** The document's operationId, when it declares one. `kinds` overrides are keyed by it. */
131
+ readonly operationId: Schema.optionalKey<Schema.String>;
119
132
  readonly description: Schema.String;
120
- readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"]>;
133
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
121
134
  readonly path: Schema.String;
122
135
  readonly baseUrl: Schema.String;
123
136
  readonly openapi: Schema.String;
@@ -126,7 +139,8 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
126
139
  readonly request: Schema.Struct<{
127
140
  readonly parameters: Schema.$Array<Schema.Struct<{
128
141
  readonly name: Schema.String;
129
- readonly in: Schema.Literals<readonly ["path", "query", "header", "cookie"]>;
142
+ /** OpenAPI 3.2's `querystring` is the whole query string, serialized from one `content` value. */
143
+ readonly in: Schema.Literals<readonly ["path", "query", "querystring", "header", "cookie"]>;
130
144
  readonly required: Schema.optionalKey<Schema.Boolean>;
131
145
  readonly schema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
132
146
  readonly style: Schema.optionalKey<Schema.String>;
@@ -147,6 +161,8 @@ export declare const OpenapiToolsOptions: Schema.Struct<{
147
161
  }>;
148
162
  /** Streams remain in the metadata but cannot run through a single-result tool call. */
149
163
  readonly streaming: Schema.optionalKey<Schema.Literal<true>>;
164
+ /** The operation's OpenAPI tags, shown to agents as labels within its router. */
165
+ readonly tags: Schema.optionalKey<Schema.$Array<Schema.NonEmptyString>>;
150
166
  readonly input: Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>;
151
167
  readonly outputSchema: Schema.optionalKey<Schema.$Record<Schema.String, Schema.Codec<Schema.Json, Schema.Json, never, never>>>;
152
168
  readonly errorResponses: Schema.optionalKey<Schema.$Array<Schema.Struct<{
@@ -191,11 +207,32 @@ export type OpenapiToolsOptions = Omit<typeof OpenapiToolsOptions.Type, "operati
191
207
  readonly operations: unknown;
192
208
  readonly definitions?: unknown;
193
209
  };
210
+ /** The operation a failed call addressed: its method and templated path, never parameter values. */
211
+ export declare const OpenapiFailedOperation: Schema.Struct<{
212
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
213
+ readonly path: Schema.String;
214
+ }>;
215
+ export type OpenapiFailedOperation = typeof OpenapiFailedOperation.Type;
216
+ /** A response media type without parameters, such as `text/html`. */
217
+ export declare const OpenapiMediaType: Schema.String;
194
218
  declare const OpenapiError_base: Schema.Class<OpenapiError, Schema.TaggedStruct<"OpenapiError", {
195
219
  readonly reason: Schema.Literals<readonly ["invalid_definition", "invalid_input", "request"]>;
196
220
  readonly status: Schema.optional<Schema.Number>;
221
+ /** Absent only when the definition itself could not be read. */
222
+ readonly operation: Schema.optional<Schema.Struct<{
223
+ readonly method: Schema.Literals<readonly ["GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS", "QUERY"]>;
224
+ readonly path: Schema.String;
225
+ }>>;
226
+ readonly contentType: Schema.optional<Schema.String>;
227
+ /** The response's `content-length`, when it declared one. */
228
+ readonly bytes: Schema.optional<Schema.Int>;
197
229
  }>, import("effect/Cause").YieldableError>;
198
- /** Safe failures omit request headers, credentials and upstream bodies. */
230
+ /**
231
+ * Safe failures omit request headers, credentials and upstream body text: the failure message is
232
+ * also recorded in traces. A `request` failure with a status names the response that no declared
233
+ * error matched, or the success response whose body could not be read, by its media type and
234
+ * declared length.
235
+ */
199
236
  export declare class OpenapiError extends OpenapiError_base {
200
237
  }
201
238
  /** An ordinary native tool bound to one selected account. */
@@ -204,7 +241,7 @@ export interface OpenapiTool {
204
241
  readonly readOnly: boolean;
205
242
  readonly outputSchema?: JsonObject;
206
243
  readonly input: Schema.Decoder<Schema.Json>;
207
- readonly run: (context: unknown, input: Schema.Json) => Effect.Effect<unknown, OpenapiError | OpenapiResponseError | ProviderError>;
244
+ readonly run: (context: unknown, input: Schema.Json) => Effect.Effect<unknown, OpenapiError | OpenapiResponseError | ProviderError | NetworkRefused>;
208
245
  }
209
246
  /** Executable operations keyed by their generated names. */
210
247
  export type OpenapiTools = Readonly<Record<string, OpenapiTool>>;
@@ -213,7 +250,12 @@ export declare const defaultOpenapiResponseLimits: {
213
250
  readonly maxBodyBytes: 16777216;
214
251
  readonly readTimeoutMs: 30000;
215
252
  };
216
- /** Media returned as text rather than a base64 file. NDJSON remains an unparsed text result. */
253
+ /**
254
+ * A sequence of JSON values, one per line or record: NDJSON, JSON Lines and `json-seq`, whose
255
+ * items OpenAPI 3.2 describes with `itemSchema`. The body is not one JSON value.
256
+ */
257
+ export declare const isOpenapiJsonSequence: (type: string) => boolean;
258
+ /** Media returned as text rather than a base64 file. JSON sequences remain unparsed text. */
217
259
  export declare const isOpenapiTextMedia: (type: string) => boolean;
218
260
  /** A form field that carries raw file bytes: OpenAPI 3.1 `contentMediaType` without an
219
261
  * encoding, or the `format: binary` string that 3.1 documents still commonly use. */
@@ -221,5 +263,5 @@ export declare const isOpenapiFileSchema: (shape: Readonly<Record<string, unknow
221
263
  /** JSON-safe binary result, independent of the host's file storage. */
222
264
  export declare const openapiBinaryResultSchema: JsonObject;
223
265
  /** Classify request media for JSON-safe tool arguments; Swagger owns wire serialization. */
224
- export declare const openapiMediaKind: (type: string) => "form" | "text" | "binary" | "json" | "multipart";
266
+ export declare const openapiMediaKind: (type: string) => "form" | "json" | "binary" | "multipart" | "text";
225
267
  export {};
@@ -1,13 +1,16 @@
1
- /** Native operation declarations. Database access is an optional invocation capability. */
1
+ /** Native operation declarations. SQL access is an optional invocation capability. */
2
2
  import type { Effect, Schema } from "effect";
3
3
  import type { Approval } from "./approval.js";
4
- import type { BoundContext, AccountSlots } from "./app.js";
5
- import type { Database, DatabaseReader, Tables } from "./storage.js";
4
+ import type { EvaluationContext, ScopedSlots } from "./app.js";
5
+ import type { Sql, SqlReader } from "./sql.js";
6
6
  import type { ToolAnnotations } from "./tools.js";
7
7
  import type { JsonObject } from "./schema.js";
8
- /** Host-bound operation capabilities; the author declaration refines accounts and storage. */
9
- export type OperationContext = BoundContext<AccountSlots> & {
10
- readonly db?: DatabaseReader<Tables> | Database<Tables>;
8
+ /**
9
+ * Host-bound operation capabilities; the author declaration refines accounts and storage. `user` is
10
+ * absent when the invocation has no caller.
11
+ */
12
+ export type OperationContext = EvaluationContext<ScopedSlots> & {
13
+ readonly sql?: SqlReader | Sql;
11
14
  };
12
15
  /** The host validates input, checks approval, then owns the transaction and output validation. */
13
16
  export interface AppOperation<Input = unknown, Output = unknown> {
@@ -17,14 +20,13 @@ export interface AppOperation<Input = unknown, Output = unknown> {
17
20
  readonly annotations?: ToolAnnotations;
18
21
  readonly _meta?: JsonObject;
19
22
  readonly input: Schema.Decoder<Input>;
23
+ /** Checks every value `run` returns and is the output schema the operation is described with. */
20
24
  readonly output?: Schema.Decoder<Output>;
21
- /** Upstream protocol result metadata; the protocol adapter validates its own result envelope. */
25
+ /**
26
+ * An upstream protocol's description of the value `run` returns, used only when `output` is
27
+ * absent. The host does not check it, so declare `output` when the result can be checked.
28
+ */
22
29
  readonly outputSchema?: JsonObject;
23
30
  readonly approval?: Approval<Input>;
24
31
  readonly run: (context: OperationContext, input: Input) => Effect.Effect<Output, unknown>;
25
32
  }
26
- /** Agent tool names carry the operation kind; catalogs may reuse the same local name. */
27
- export declare const OperationToolPrefixes: {
28
- readonly query: "queries.";
29
- readonly mutate: "mutations.";
30
- };