apps 0.0.1-beta.13 → 0.0.1-beta.130

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 (205) hide show
  1. package/README.md +60 -42
  2. package/framework-reference.json +1 -1
  3. package/js/{chunk-M3B3DE4K.js → chunk-2XDCAXAR.js} +612 -246
  4. package/js/{chunk-IPI4MFSN.js → chunk-34RH47V5.js} +2 -2
  5. package/js/chunk-3ICMSVNC.js +175 -0
  6. package/js/chunk-4SIYTPIK.js +724 -0
  7. package/js/{chunk-KUMBKVJD.js → chunk-6QZVXLF2.js} +2 -2
  8. package/js/chunk-7MPPHKRW.js +5418 -0
  9. package/js/chunk-AR22I6UO.js +1016 -0
  10. package/js/chunk-BMHEVNGF.js +49 -0
  11. package/js/{chunk-RFVIONFX.js → chunk-BSSBP57D.js} +136 -45
  12. package/js/{chunk-ODEIDRGW.js → chunk-DWYOLPWT.js} +1133 -503
  13. package/js/chunk-H2K7OZ47.js +90 -0
  14. package/js/chunk-I6QAWNUM.js +161 -0
  15. package/js/{chunk-QS6CAHKC.js → chunk-J52LZT2Y.js} +4 -3
  16. package/js/chunk-JLW4LQS7.js +335 -0
  17. package/js/chunk-L2RUGQAM.js +576 -0
  18. package/js/chunk-LSOHA2RH.js +88 -0
  19. package/js/{chunk-UK573G7W.js → chunk-MB6L5YZE.js} +1817 -632
  20. package/js/chunk-OBT33ZDK.js +95 -0
  21. package/js/chunk-OD3KFKZD.js +1617 -0
  22. package/js/{chunk-JU7VHODU.js → chunk-QTX7OUFH.js} +65 -10
  23. package/js/chunk-T7MXJSCW.js +1945 -0
  24. package/js/{chunk-VFZKSM3T.js → chunk-VX36SA7Y.js} +3 -3
  25. package/js/chunk-WX773GGX.js +449 -0
  26. package/js/{chunk-5T57N25Q.js → chunk-WXHRUWNT.js} +651 -70
  27. package/js/{chunk-CDL5PM2Q.js → chunk-YFSOSNF3.js} +17265 -12477
  28. package/js/{chunk-IJX4CYZO.js → chunk-YVN2AMAU.js} +976 -447
  29. package/js/client.js +234 -92
  30. package/js/contracts.js +154 -21
  31. package/js/effect.js +18 -19
  32. package/js/{es-APDZKREY.js → es-DIULA3ZF.js} +62 -1659
  33. package/js/graphql.js +231 -188
  34. package/js/host.js +138 -80
  35. package/js/index.js +153 -300
  36. package/js/mcp/effect.js +21 -21
  37. package/js/mcp.js +91 -57
  38. package/js/openapi.js +4357 -1415
  39. package/js/react.js +2 -3
  40. package/js/skills/effect.js +6 -3
  41. package/js/skills.js +220 -81
  42. package/js/storage/facet.js +1 -540
  43. package/js/ui/auth/contracts.js +2 -2
  44. package/js/ui/auth.js +5 -5
  45. package/js/ui/contracts.js +9 -8
  46. package/js/ui/serving.js +8618 -235
  47. package/package.json +3 -8
  48. package/runtime.json +1 -1
  49. package/types/app-cache/src/contracts/cache.d.ts +18 -0
  50. package/types/app-cache/src/index.d.ts +34 -2
  51. package/types/apps/src/contracts/api-response-error.d.ts +4 -0
  52. package/types/apps/src/contracts/app.d.ts +56 -11
  53. package/types/apps/src/contracts/cache.d.ts +20 -0
  54. package/types/apps/src/contracts/context.d.ts +60 -17
  55. package/types/apps/src/contracts/elicitation.d.ts +23 -7
  56. package/types/apps/src/contracts/events.d.ts +94 -0
  57. package/types/apps/src/contracts/failure.d.ts +30 -1
  58. package/types/apps/src/contracts/graphql.d.ts +40 -2
  59. package/types/apps/src/contracts/help-text.d.ts +31 -0
  60. package/types/apps/src/contracts/host.d.ts +1493 -20
  61. package/types/apps/src/contracts/icons.d.ts +28 -0
  62. package/types/apps/src/contracts/live.d.ts +2 -0
  63. package/types/apps/src/contracts/mcp.d.ts +81 -20
  64. package/types/apps/src/contracts/network.d.ts +120 -0
  65. package/types/apps/src/contracts/openapi-compile.d.ts +82 -3
  66. package/types/apps/src/contracts/openapi-document.d.ts +1 -1
  67. package/types/apps/src/contracts/openapi.d.ts +40 -8
  68. package/types/apps/src/contracts/operations.d.ts +14 -7
  69. package/types/apps/src/contracts/placement.d.ts +102 -0
  70. package/types/apps/src/contracts/protocol-version.d.ts +2 -2
  71. package/types/apps/src/contracts/protocols/1.d.ts +513 -15
  72. package/types/apps/src/contracts/protocols/10.d.ts +1450 -0
  73. package/types/apps/src/contracts/protocols/11.d.ts +1149 -0
  74. package/types/apps/src/contracts/protocols/12.d.ts +3310 -0
  75. package/types/apps/src/contracts/protocols/13.d.ts +6001 -0
  76. package/types/apps/src/contracts/protocols/2.d.ts +9 -8
  77. package/types/apps/src/contracts/protocols/3.d.ts +73 -15
  78. package/types/apps/src/contracts/protocols/4.d.ts +22 -15
  79. package/types/apps/src/contracts/protocols/5.d.ts +37 -11
  80. package/types/apps/src/contracts/protocols/6.d.ts +1629 -0
  81. package/types/apps/src/contracts/protocols/7.d.ts +1785 -0
  82. package/types/apps/src/contracts/protocols/8.d.ts +1182 -0
  83. package/types/apps/src/contracts/protocols/9.d.ts +1104 -0
  84. package/types/apps/src/contracts/protocols/current.d.ts +7114 -0
  85. package/types/apps/src/contracts/protocols/oauth-6.d.ts +74 -0
  86. package/types/apps/src/contracts/protocols/oauth.d.ts +134 -0
  87. package/types/apps/src/contracts/provider-error.d.ts +9 -0
  88. package/types/apps/src/contracts/provider.d.ts +56 -0
  89. package/types/apps/src/contracts/router.d.ts +2 -1
  90. package/types/apps/src/contracts/schedules.d.ts +7 -1
  91. package/types/apps/src/contracts/schema.d.ts +21 -0
  92. package/types/apps/src/contracts/shared-catalog.d.ts +11 -0
  93. package/types/apps/src/contracts/skills.d.ts +50 -13
  94. package/types/apps/src/contracts/sql.d.ts +63 -0
  95. package/types/apps/src/contracts/ui.d.ts +70 -30
  96. package/types/apps/src/contracts/webhooks.d.ts +24 -7
  97. package/types/apps/src/contracts/workflows.d.ts +56 -34
  98. package/types/apps/src/facet.d.ts +4 -5
  99. package/types/apps/src/host.d.ts +5 -0
  100. package/types/apps/src/implementation/account-router.d.ts +20 -3
  101. package/types/apps/src/implementation/app.d.ts +41 -14
  102. package/types/apps/src/implementation/authoring.d.ts +25 -5
  103. package/types/apps/src/implementation/browser-scripts.gen.d.ts +6 -0
  104. package/types/apps/src/implementation/cache.d.ts +29 -2
  105. package/types/apps/src/implementation/catalog-cache.d.ts +35 -4
  106. package/types/apps/src/implementation/elicitation.d.ts +16 -13
  107. package/types/apps/src/implementation/events.d.ts +64 -0
  108. package/types/apps/src/implementation/failure-detail.d.ts +28 -5
  109. package/types/apps/src/implementation/graphql-catalog.d.ts +3 -3
  110. package/types/apps/src/implementation/graphql.d.ts +4 -3
  111. package/types/apps/src/implementation/help-text.d.ts +5 -0
  112. package/types/apps/src/implementation/input-problems.d.ts +6 -2
  113. package/types/apps/src/implementation/invocation-timing.d.ts +18 -0
  114. package/types/apps/src/implementation/live.d.ts +2 -2
  115. package/types/apps/src/implementation/mcp-call.d.ts +6 -5
  116. package/types/apps/src/implementation/mcp-catalog.d.ts +6 -4
  117. package/types/apps/src/implementation/mcp-client.d.ts +17 -9
  118. package/types/apps/src/implementation/mcp-tools.d.ts +2 -1
  119. package/types/apps/src/implementation/mcp.d.ts +20 -9
  120. package/types/apps/src/implementation/network.d.ts +16 -0
  121. package/types/apps/src/implementation/openapi-compile.d.ts +38 -7
  122. package/types/apps/src/implementation/openapi-document.d.ts +50 -20
  123. package/types/apps/src/implementation/openapi-names.d.ts +9 -4
  124. package/types/apps/src/implementation/openapi-request.d.ts +10 -2
  125. package/types/apps/src/implementation/openapi-source.d.ts +23 -1
  126. package/types/apps/src/implementation/openapi-upgrade.d.ts +4 -0
  127. package/types/apps/src/implementation/operations.d.ts +58 -7
  128. package/types/apps/src/implementation/optimistic.d.ts +1 -1
  129. package/types/apps/src/implementation/placement.d.ts +60 -0
  130. package/types/apps/src/implementation/protocol-operations.d.ts +3 -0
  131. package/types/apps/src/implementation/provider-error.d.ts +28 -1
  132. package/types/apps/src/implementation/provider.d.ts +20 -4
  133. package/types/apps/src/implementation/query-commit.d.ts +1 -1
  134. package/types/apps/src/implementation/router-catalog.d.ts +22 -97
  135. package/types/apps/src/implementation/router.d.ts +26 -6
  136. package/types/apps/src/implementation/runtime-yield.d.ts +7 -0
  137. package/types/apps/src/implementation/schedules.d.ts +39 -8
  138. package/types/apps/src/implementation/schema.d.ts +125 -17
  139. package/types/apps/src/implementation/skills.d.ts +18 -24
  140. package/types/apps/src/implementation/sql.d.ts +71 -0
  141. package/types/apps/src/implementation/ui-account-notice.d.ts +9 -0
  142. package/types/apps/src/implementation/ui-auth.d.ts +1 -1
  143. package/types/apps/src/implementation/ui-client.d.ts +3 -3
  144. package/types/apps/src/implementation/ui-document.d.ts +5 -0
  145. package/types/apps/src/implementation/ui-errors.d.ts +1 -1
  146. package/types/apps/src/implementation/ui-serving.d.ts +38 -12
  147. package/types/apps/src/implementation/upstream-error.d.ts +17 -0
  148. package/types/apps/src/implementation/webhooks.d.ts +15 -6
  149. package/types/apps/src/implementation/workflow-context.d.ts +6 -2
  150. package/types/apps/src/implementation/workflows.d.ts +11 -4
  151. package/types/apps/src/index.d.ts +67 -17
  152. package/types/apps/src/mcp.d.ts +20 -1
  153. package/types/apps/src/openapi.d.ts +22 -1
  154. package/types/apps/src/react.d.ts +1 -1
  155. package/types/apps/src/skills.d.ts +10 -8
  156. package/types/apps/src/ui-serving.d.ts +1 -2
  157. package/types/telemetry/src/app-records.d.ts +42 -0
  158. package/types/telemetry/src/browser-operations.d.ts +2 -2
  159. package/types/telemetry/src/browser.d.ts +8 -3
  160. package/types/telemetry/src/config.d.ts +2 -2
  161. package/types/telemetry/src/index.d.ts +3 -2
  162. package/types/telemetry/src/keepalive.d.ts +36 -0
  163. package/types/telemetry/src/layer.d.ts +10 -4
  164. package/types/telemetry/src/measurements.d.ts +6 -2
  165. package/types/telemetry/src/ownership.d.ts +60 -0
  166. package/types/telemetry/src/recorded-failure.d.ts +29 -0
  167. package/types/telemetry/src/relay.d.ts +25 -7
  168. package/types/telemetry/src/span-attributes.d.ts +22 -3
  169. package/types/telemetry/src/transport.d.ts +8 -1
  170. package/types/utils/src/api-error.d.ts +55 -0
  171. package/types/utils/src/connection-failure.d.ts +33 -0
  172. package/types/utils/src/legacy-keys.d.ts +20 -0
  173. package/types/utils/src/random-uuid.d.ts +6 -0
  174. package/types/utils/src/recorded-message.d.ts +18 -0
  175. package/types/utils/src/schema-definitions.d.ts +13 -0
  176. package/types/utils/src/user-facing-error.d.ts +83 -0
  177. package/js/chunk-27F7W2LG.js +0 -34
  178. package/js/chunk-4ASNKGCV.js +0 -242
  179. package/js/chunk-4DWF4ZWI.js +0 -1280
  180. package/js/chunk-57RKNWL2.js +0 -75
  181. package/js/chunk-6HSH75OI.js +0 -2688
  182. package/js/chunk-G4FT53I7.js +0 -224
  183. package/js/chunk-MKWZPDR6.js +0 -63
  184. package/js/chunk-N7YDVXYJ.js +0 -186
  185. package/js/chunk-NKLWZJLE.js +0 -172
  186. package/js/chunk-PJJ24GU7.js +0 -877
  187. package/js/chunk-PZB6T6KU.js +0 -19
  188. package/js/chunk-R3EV5FTO.js +0 -97
  189. package/js/chunk-S73JGVR5.js +0 -507
  190. package/js/chunk-TG6DOCRO.js +0 -299
  191. package/js/chunk-YPKG2QO5.js +0 -209
  192. package/js/chunk-ZQINWV4W.js +0 -630
  193. package/js/mcp/stdio.js +0 -128
  194. package/types/app-data/src/implementation/cursor.d.ts +0 -10
  195. package/types/app-data/src/implementation/index-key.d.ts +0 -7
  196. package/types/app-data/src/implementation/promise.d.ts +0 -68
  197. package/types/app-data/src/implementation/range.d.ts +0 -8
  198. package/types/app-data/src/implementation/schema.d.ts +0 -18
  199. package/types/app-data/src/implementation/sqlite.d.ts +0 -11
  200. package/types/app-data/src/index.d.ts +0 -4
  201. package/types/apps/src/contracts/storage.d.ts +0 -68
  202. package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
  203. package/types/apps/src/implementation/storage.d.ts +0 -15
  204. package/types/apps/src/implementation/ui-watch.d.ts +0 -2
  205. package/types/apps/src/mcp-stdio.d.ts +0 -5
@@ -0,0 +1,724 @@
1
+ import {
2
+ prepareElicitation
3
+ } from "./chunk-T7MXJSCW.js";
4
+ import {
5
+ failOnNetworkRefusal
6
+ } from "./chunk-BMHEVNGF.js";
7
+ import {
8
+ accountProviderError,
9
+ bodyUpstreamError,
10
+ fromPromise,
11
+ httpProviderError,
12
+ providerErrorDetail
13
+ } from "./chunk-3ICMSVNC.js";
14
+ import {
15
+ ElicitationFailed,
16
+ McpCredentialsUnverified,
17
+ McpError,
18
+ McpHealthInput,
19
+ McpServerHeader,
20
+ McpToolMetadata,
21
+ McpToolResult,
22
+ McpToolsOptions,
23
+ NetworkRefused,
24
+ ProviderError,
25
+ RouterIcon,
26
+ ToolResultObservation,
27
+ defaultElicitationLimits,
28
+ defaultMcpClientLimits,
29
+ mcpHealthReserveMs,
30
+ mcpSdkTimerCeilingMs
31
+ } from "./chunk-7MPPHKRW.js";
32
+ import {
33
+ jsonSchemaDecoder,
34
+ nestJsonSchema,
35
+ preparedJsonSchemaDecoder
36
+ } from "./chunk-WXHRUWNT.js";
37
+ import {
38
+ captureTelemetry,
39
+ owned
40
+ } from "./chunk-DWYOLPWT.js";
41
+ import {
42
+ FetchHttpClient_exports
43
+ } from "./chunk-I6QAWNUM.js";
44
+ import {
45
+ JsonObject
46
+ } from "./chunk-H2K7OZ47.js";
47
+ import {
48
+ HttpClientRequest_exports,
49
+ HttpClient_exports
50
+ } from "./chunk-MB6L5YZE.js";
51
+ import {
52
+ Clock_exports,
53
+ Deferred_exports,
54
+ Effect_exports,
55
+ Exit_exports,
56
+ Match_exports,
57
+ Option_exports,
58
+ Predicate_exports,
59
+ Queue_exports,
60
+ Redacted_exports,
61
+ Ref_exports,
62
+ Schema_exports,
63
+ Stream_exports
64
+ } from "./chunk-YFSOSNF3.js";
65
+
66
+ // src/implementation/mcp.ts
67
+ import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
68
+ import { Client } from "@modelcontextprotocol/sdk/client/index.js";
69
+ import {
70
+ ErrorCode as ErrorCode3,
71
+ McpError as ProtocolError3,
72
+ ToolListChangedNotificationSchema
73
+ } from "@modelcontextprotocol/sdk/types.js";
74
+ import { SSEClientTransport, SseError } from "@modelcontextprotocol/sdk/client/sse.js";
75
+ import {
76
+ StreamableHTTPClientTransport,
77
+ StreamableHTTPError
78
+ } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
79
+
80
+ // src/implementation/mcp-tools.ts
81
+ var resultFields = {
82
+ content: { type: "array", items: { type: "object" } },
83
+ structuredContent: { type: "object" },
84
+ isError: { type: "boolean" },
85
+ _meta: { type: "object" }
86
+ };
87
+ var definitionReference = /^#\/(?:\$defs|definitions)\/[^/]+$/;
88
+ var locating = /* @__PURE__ */ new Set(["$id", "$anchor", "$dynamicAnchor", "$recursiveAnchor"]);
89
+ var onlyDefinitionReferences = (value) => Array.isArray(value) ? value.every(onlyDefinitionReferences) : value === null || typeof value !== "object" ? true : Object.entries(value).every(
90
+ ([key, item]) => locating.has(key) || key === "$dynamicRef" || key === "$recursiveRef" ? false : key === "$ref" ? typeof item === "string" && definitionReference.test(item) : onlyDefinitionReferences(item)
91
+ );
92
+ var placed = (structuredContent, pointer) => {
93
+ if (onlyDefinitionReferences(structuredContent)) {
94
+ const { $defs, definitions, $schema: _draft, ...schema } = structuredContent;
95
+ return {
96
+ schema,
97
+ root: {
98
+ ...$defs === void 0 ? {} : { $defs },
99
+ ...definitions === void 0 ? {} : { definitions }
100
+ }
101
+ };
102
+ }
103
+ try {
104
+ return { schema: nestJsonSchema(structuredContent, pointer), root: {} };
105
+ } catch {
106
+ return { schema: structuredContent, root: {} };
107
+ }
108
+ };
109
+ var resultSchema = (structuredContent) => {
110
+ if (structuredContent === void 0)
111
+ return { type: "object", properties: resultFields, required: ["content"] };
112
+ const { schema, root } = placed(structuredContent, "#/anyOf/0/properties/structuredContent");
113
+ return {
114
+ // The envelope's keywords mean the same in every draft, so the server's draft applies.
115
+ ...structuredContent.$schema === void 0 ? {} : { $schema: structuredContent.$schema },
116
+ ...root,
117
+ anyOf: [
118
+ {
119
+ type: "object",
120
+ properties: { ...resultFields, structuredContent: schema, isError: { const: false } },
121
+ required: ["content", "structuredContent"]
122
+ },
123
+ {
124
+ type: "object",
125
+ properties: { ...resultFields, isError: { const: true } },
126
+ required: ["content", "isError"]
127
+ }
128
+ ]
129
+ };
130
+ };
131
+ var adaptMcpTool = (client, tool) => Effect_exports.gen(function* () {
132
+ const decoder = yield* jsonSchemaDecoder(tool.inputSchema).pipe(
133
+ Effect_exports.mapError(() => new McpError({ phase: "schema", reason: "invalid_response" }))
134
+ );
135
+ const output = preparedJsonSchemaDecoder(resultSchema(tool.outputSchema));
136
+ const { outputSchema: _upstream, ...metadata } = tool;
137
+ const adapted = {
138
+ ...metadata,
139
+ description: tool.description ?? tool.title ?? tool.name,
140
+ input: decoder,
141
+ output: output.decoder,
142
+ ...tool.annotations?.readOnlyHint === void 0 ? {} : { readOnly: tool.annotations.readOnlyHint },
143
+ run: (context, input) => Effect_exports.gen(function* () {
144
+ const arguments_ = yield* Schema_exports.decodeUnknownEffect(decoder)(input).pipe(
145
+ Effect_exports.flatMap(Schema_exports.decodeUnknownEffect(JsonObject)),
146
+ Effect_exports.mapError(() => new McpError({ phase: "call", reason: "invalid_input" }))
147
+ );
148
+ yield* output.compile.pipe(
149
+ Effect_exports.mapError(() => new McpError({ phase: "schema", reason: "invalid_response" }))
150
+ );
151
+ const result = yield* client.call(tool.name, arguments_, context);
152
+ if (result.isError === true) {
153
+ (yield* ToolResultObservation).failed();
154
+ yield* Effect_exports.annotateCurrentSpan({
155
+ "executor.outcome": "failed",
156
+ "error.type": "McpToolError"
157
+ });
158
+ }
159
+ return result;
160
+ })
161
+ };
162
+ return adapted;
163
+ });
164
+ var adaptMcpTools = (client) => Effect_exports.gen(function* () {
165
+ const { tools: metadata } = yield* client.list;
166
+ const entries = yield* Effect_exports.forEach(
167
+ metadata,
168
+ (tool) => adaptMcpTool(client, tool).pipe(Effect_exports.map((adapted) => [tool.name, adapted]))
169
+ );
170
+ return Object.fromEntries(entries);
171
+ });
172
+
173
+ // src/implementation/mcp-client.ts
174
+ import {
175
+ ErrorCode as ErrorCode2,
176
+ ListToolsResultSchema,
177
+ McpError as ProtocolError2
178
+ } from "@modelcontextprotocol/sdk/types.js";
179
+
180
+ // src/implementation/mcp-call.ts
181
+ import {
182
+ ElicitRequestSchema,
183
+ ElicitResultSchema,
184
+ ErrorCode,
185
+ McpError as ProtocolError
186
+ } from "@modelcontextprotocol/sdk/types.js";
187
+ function callBudget(timeoutMs) {
188
+ return Effect_exports.gen(function* () {
189
+ const clock = yield* Clock_exports.Clock;
190
+ const changes = yield* Queue_exports.unbounded();
191
+ let remaining = timeoutMs, updated = clock.currentTimeMillisUnsafe(), waiting = 0;
192
+ const account = () => {
193
+ const now = clock.currentTimeMillisUnsafe();
194
+ if (waiting === 0) remaining -= Math.max(0, now - updated);
195
+ updated = now;
196
+ return remaining;
197
+ };
198
+ return {
199
+ waitForInput: (input) => Effect_exports.acquireUseRelease(
200
+ Effect_exports.sync(() => {
201
+ account();
202
+ waiting++;
203
+ }).pipe(Effect_exports.andThen(Queue_exports.offer(changes, void 0))),
204
+ () => input,
205
+ () => Effect_exports.sync(() => {
206
+ account();
207
+ waiting--;
208
+ }).pipe(Effect_exports.andThen(Queue_exports.offer(changes, void 0)))
209
+ ),
210
+ expired: Effect_exports.gen(function* () {
211
+ while (true) {
212
+ const left = account();
213
+ if (waiting === 0 && left <= 0)
214
+ return yield* new McpError({ phase: "call", reason: "timeout" });
215
+ if (waiting > 0) yield* Queue_exports.take(changes);
216
+ else yield* Queue_exports.take(changes).pipe(Effect_exports.raceFirst(Effect_exports.sleep(Math.max(1, left))));
217
+ }
218
+ })
219
+ };
220
+ });
221
+ }
222
+ var decodeJsonText = Schema_exports.decodeUnknownOption(Schema_exports.fromJsonString(Schema_exports.Json));
223
+ var withoutStructuredCopy = (result) => {
224
+ const { structuredContent } = result;
225
+ if (structuredContent === void 0) return result;
226
+ const structured = JSON.stringify(structuredContent);
227
+ const content = result.content.filter(
228
+ (block) => !(block.type === "text" && typeof block.text === "string" && Option_exports.exists(decodeJsonText(block.text), (value) => JSON.stringify(value) === structured))
229
+ );
230
+ return content.length === result.content.length ? result : { ...result, content };
231
+ };
232
+ var mcpCall = (client, name, input, context, timeoutMs, failure2) => Effect_exports.scoped(
233
+ Effect_exports.gen(function* () {
234
+ const budget = yield* callBudget(timeoutMs);
235
+ const failed = yield* Deferred_exports.make();
236
+ const runtime = yield* Effect_exports.context();
237
+ const callbacks = /* @__PURE__ */ new Set();
238
+ const lifetime = yield* Effect_exports.acquireRelease(
239
+ Effect_exports.sync(() => new AbortController()),
240
+ (controller) => (
241
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- the MCP SDK's elicitation callbacks
242
+ Effect_exports.promise(async () => {
243
+ controller.abort();
244
+ client.removeRequestHandler("elicitation/create");
245
+ await Promise.allSettled(callbacks);
246
+ })
247
+ )
248
+ );
249
+ client.setRequestHandler(ElicitRequestSchema, (request, extra) => {
250
+ const signal = AbortSignal.any([lifetime.signal, extra.signal]);
251
+ const interaction = Effect_exports.gen(function* () {
252
+ const form = yield* prepareElicitation({
253
+ ...request.params,
254
+ mode: request.params.mode ?? "form"
255
+ });
256
+ const deliver = context.elicit;
257
+ if (deliver === void 0) return yield* new ElicitationFailed({ reason: "unavailable" });
258
+ const answer = yield* budget.waitForInput(
259
+ fromPromise(
260
+ deliver,
261
+ "elicitation"
262
+ )(form.request).pipe(
263
+ Effect_exports.mapError(
264
+ (error) => Option_exports.getOrElse(
265
+ Schema_exports.decodeUnknownOption(ElicitationFailed)(error),
266
+ () => new ElicitationFailed({ reason: "transport" })
267
+ )
268
+ ),
269
+ Effect_exports.timeoutOrElse({
270
+ duration: defaultElicitationLimits.timeoutMs,
271
+ orElse: () => Effect_exports.fail(new ElicitationFailed({ reason: "expired" }))
272
+ })
273
+ )
274
+ ).pipe(Effect_exports.withSpan("provider.mcp.elicitation"));
275
+ return yield* form.respond(answer).pipe(
276
+ Effect_exports.flatMap(
277
+ (response) => Effect_exports.try({
278
+ try: () => ElicitResultSchema.parse(response),
279
+ catch: () => new ElicitationFailed({ reason: "invalid-response" })
280
+ })
281
+ )
282
+ );
283
+ }).pipe(Effect_exports.tapError((error) => Deferred_exports.fail(failed, error)));
284
+ const callback = Effect_exports.runPromiseWith(runtime)(interaction, { signal }).catch(() => {
285
+ if (!lifetime.signal.aborted)
286
+ Effect_exports.runSync(Deferred_exports.fail(failed, new ElicitationFailed({ reason: "transport" })));
287
+ throw new ProtocolError(ErrorCode.InternalError, "User input could not be delivered");
288
+ });
289
+ callbacks.add(callback);
290
+ return callback.finally(() => callbacks.delete(callback));
291
+ });
292
+ return yield* Effect_exports.tryPromise({
293
+ try: (signal) => client.callTool({ name, arguments: input }, void 0, {
294
+ signal: AbortSignal.any([signal, lifetime.signal]),
295
+ timeout: mcpSdkTimerCeilingMs
296
+ }),
297
+ catch: (error) => failure2("call", error)
298
+ }).pipe(
299
+ Effect_exports.raceFirst(Deferred_exports.await(failed)),
300
+ Effect_exports.raceFirst(budget.expired),
301
+ Effect_exports.flatMap(
302
+ (result) => Schema_exports.decodeUnknownEffect(McpToolResult)(result).pipe(
303
+ Effect_exports.mapError(() => new McpError({ phase: "call", reason: "invalid_response" })),
304
+ Effect_exports.map(withoutStructuredCopy)
305
+ )
306
+ ),
307
+ Effect_exports.tap(
308
+ (result) => Effect_exports.annotateCurrentSpan("mcp.tool.is_error", result.isError === true)
309
+ )
310
+ );
311
+ })
312
+ ).pipe(
313
+ owned("upstream", "provider.mcp.request", {
314
+ kind: "client",
315
+ attributes: {
316
+ "rpc.system.name": "jsonrpc",
317
+ "rpc.method": "tools/call",
318
+ "mcp.tool.name": name
319
+ }
320
+ })
321
+ );
322
+
323
+ // src/implementation/mcp-client.ts
324
+ var clientCodes = /* @__PURE__ */ new Set([
325
+ ErrorCode2.RequestTimeout,
326
+ ErrorCode2.ConnectionClosed
327
+ ]);
328
+ var answeredError = (error) => {
329
+ if (!(error instanceof ProtocolError2) || clientCodes.has(error.code)) return void 0;
330
+ const prefix = `MCP error ${error.code}: `;
331
+ return bodyUpstreamError({
332
+ error: {
333
+ code: error.code,
334
+ message: error.message.startsWith(prefix) ? error.message.slice(prefix.length) : error.message
335
+ }
336
+ });
337
+ };
338
+ var mcpJsonSchemaValidator = {
339
+ getValidator(document) {
340
+ const decoder = Effect_exports.runSync(jsonSchemaDecoder(document));
341
+ return (input) => {
342
+ const result = Effect_exports.runSyncExit(Schema_exports.decodeUnknownEffect(decoder)(input));
343
+ if (Exit_exports.isFailure(result))
344
+ return {
345
+ valid: false,
346
+ data: void 0,
347
+ errorMessage: "Value does not match the supported JSON Schema"
348
+ };
349
+ return { valid: true, data: result.value, errorMessage: void 0 };
350
+ };
351
+ }
352
+ };
353
+ function mcpClient(withClient2, timeoutMs, failure2) {
354
+ const list = withClient2(
355
+ "discover",
356
+ (client) => Effect_exports.gen(function* () {
357
+ const tools = /* @__PURE__ */ new Map();
358
+ const cursors = /* @__PURE__ */ new Set();
359
+ let cursor;
360
+ do {
361
+ const page = yield* Effect_exports.tryPromise({
362
+ // This session only reads metadata. listTools() also eagerly compiles
363
+ // every output validator; mcpRouter validates the selected tool on call.
364
+ try: (signal) => client.request(
365
+ { method: "tools/list", params: cursor === void 0 ? {} : { cursor } },
366
+ ListToolsResultSchema,
367
+ { signal, timeout: timeoutMs }
368
+ ),
369
+ catch: (error) => failure2("discover", error)
370
+ }).pipe(
371
+ owned("upstream", "provider.mcp.request", {
372
+ kind: "client",
373
+ attributes: { "rpc.system.name": "jsonrpc", "rpc.method": "tools/list" }
374
+ })
375
+ );
376
+ const metadata = yield* Schema_exports.decodeUnknownEffect(Schema_exports.Array(McpToolMetadata))(
377
+ page.tools
378
+ ).pipe(
379
+ Effect_exports.mapError(() => new McpError({ phase: "discover", reason: "invalid_response" }))
380
+ );
381
+ for (const tool of metadata) {
382
+ if (!tool.name || tools.has(tool.name) || tools.size >= defaultMcpClientLimits.maxTools)
383
+ return yield* new McpError({ phase: "discover", reason: "invalid_response" });
384
+ tools.set(tool.name, tool);
385
+ }
386
+ cursor = page.nextCursor;
387
+ if (cursor !== void 0) {
388
+ if (cursors.has(cursor) || cursors.size >= defaultMcpClientLimits.maxPaginationCursors)
389
+ return yield* new McpError({ phase: "discover", reason: "invalid_response" });
390
+ cursors.add(cursor);
391
+ }
392
+ } while (cursor !== void 0);
393
+ const info = client.getServerVersion();
394
+ const instructions = client.getInstructions();
395
+ const icons = info?.icons?.flatMap(
396
+ (icon) => Option_exports.toArray(Schema_exports.decodeUnknownOption(RouterIcon)(icon))
397
+ );
398
+ const server = Schema_exports.decodeUnknownOption(McpServerHeader)({
399
+ ...info?.name === void 0 ? {} : { name: info.name },
400
+ ...info?.title === void 0 ? {} : { title: info.title },
401
+ ...info?.version === void 0 ? {} : { version: info.version },
402
+ ...info?.description === void 0 ? {} : { description: info.description },
403
+ ...info?.websiteUrl === void 0 ? {} : { websiteUrl: info.websiteUrl },
404
+ ...icons === void 0 ? {} : { icons },
405
+ ...instructions === void 0 ? {} : { instructions }
406
+ });
407
+ return {
408
+ tools: [...tools.values()],
409
+ server: Option_exports.getOrElse(server, () => ({}))
410
+ };
411
+ })
412
+ ).pipe(owned("upstream", "provider.mcp.discover"));
413
+ const check = withClient2(
414
+ "discover",
415
+ (client) => (
416
+ // oxlint-disable-next-line executor/authored-code-through-adapter -- MCP SDK
417
+ Effect_exports.tryPromise({
418
+ try: (signal) => client.request({ method: "tools/list", params: {} }, ListToolsResultSchema, {
419
+ signal,
420
+ timeout: timeoutMs
421
+ }),
422
+ catch: (error) => failure2("discover", error)
423
+ }).pipe(
424
+ Effect_exports.asVoid,
425
+ owned("upstream", "provider.mcp.request", {
426
+ kind: "client",
427
+ attributes: { "rpc.system.name": "jsonrpc", "rpc.method": "tools/list" }
428
+ })
429
+ )
430
+ )
431
+ ).pipe(owned("upstream", "provider.mcp.check"));
432
+ const call = (name, input, context) => withClient2("call", (client) => mcpCall(client, name, input, context, timeoutMs, failure2)).pipe(
433
+ owned("upstream", "provider.mcp.call", { attributes: { "mcp.tool.name": name } })
434
+ );
435
+ return { list, check, call };
436
+ }
437
+
438
+ // src/implementation/mcp.ts
439
+ var unreadable = (error) => error instanceof SyntaxError || error instanceof Error && Predicate_exports.hasProperty(error, "issues") && Array.isArray(error.issues);
440
+ var failure = (phase, error) => {
441
+ if (Schema_exports.is(ProviderError)(error) || Schema_exports.is(McpError)(error) || Schema_exports.is(NetworkRefused)(error))
442
+ return error;
443
+ const code = error instanceof UnauthorizedError ? 401 : error instanceof StreamableHTTPError || error instanceof SseError ? error.code : void 0;
444
+ if (code !== void 0 && code >= 300 && code <= 599)
445
+ return httpProviderError(code) ?? new McpError({ phase, reason: "request", status: code });
446
+ const upstream = answeredError(error);
447
+ return new McpError({
448
+ phase,
449
+ reason: code !== void 0 || unreadable(error) ? "invalid_response" : error instanceof ProtocolError3 && error.code === ErrorCode3.RequestTimeout ? "timeout" : "request",
450
+ ...upstream === void 0 ? {} : { upstream }
451
+ });
452
+ };
453
+ var errorBodyLimits = { maxBytes: 65536, readTimeoutMs: 2e3 };
454
+ var errorBody = (response) => Effect_exports.gen(function* () {
455
+ const json = /^application\/(?:[\w.-]+\+)?json$/i.test(
456
+ response.headers["content-type"]?.split(";")[0]?.trim() ?? ""
457
+ );
458
+ const length = response.headers["content-length"];
459
+ if (!json || length !== void 0 && Number(length) > errorBodyLimits.maxBytes)
460
+ return { body: Stream_exports.toReadableStream(response.stream), upstream: void 0 };
461
+ const unreadable2 = new McpError({ phase: "transport", reason: "invalid_response" });
462
+ const read = yield* response.stream.pipe(
463
+ Stream_exports.mapError(() => unreadable2),
464
+ Stream_exports.limitBytes(errorBodyLimits.maxBytes, () => Stream_exports.fail(unreadable2)),
465
+ Stream_exports.decodeText,
466
+ Stream_exports.mkString,
467
+ Effect_exports.timeout(errorBodyLimits.readTimeoutMs),
468
+ Effect_exports.option
469
+ );
470
+ if (Option_exports.isNone(read)) return { body: null, upstream: void 0 };
471
+ const parsed = Schema_exports.decodeUnknownOption(Schema_exports.fromJsonString(Schema_exports.Json))(read.value);
472
+ return {
473
+ body: read.value,
474
+ upstream: Option_exports.isSome(parsed) ? bodyUpstreamError(parsed.value) : void 0
475
+ };
476
+ });
477
+ var transportFetch = (connection, telemetry, rejected, answered, kind) => (url, init) => Effect_exports.runPromiseWith(telemetry.context)(
478
+ Effect_exports.gen(function* () {
479
+ const target = yield* Effect_exports.try({
480
+ try: () => new URL(url),
481
+ catch: () => new McpError({ phase: "transport", reason: "invalid_response" })
482
+ });
483
+ if (connection.url.username || connection.url.password)
484
+ return yield* new McpError({ phase: "transport", reason: "invalid_input" });
485
+ if (target.origin !== connection.url.origin || target.username || target.password)
486
+ return yield* new McpError({ phase: "transport", reason: "invalid_response" });
487
+ const request = yield* Effect_exports.try({
488
+ try: () => {
489
+ const headers = new Headers(Redacted_exports.value(connection.headers));
490
+ new Headers(init?.headers).forEach((value, name) => headers.set(name, value));
491
+ if (!headers.has("user-agent")) headers.set("user-agent", "Executor");
492
+ return HttpClientRequest_exports.fromWeb(new Request(target, { ...init, headers }));
493
+ },
494
+ // The provider's headers cannot form an HTTP request, such as a name with a space.
495
+ catch: () => new McpError({ phase: "transport", reason: "invalid_input" })
496
+ });
497
+ const client = yield* HttpClient_exports.HttpClient;
498
+ const response = yield* client.execute(request);
499
+ yield* failOnNetworkRefusal(response).pipe(
500
+ Effect_exports.tapError((refused) => Deferred_exports.fail(rejected, refused))
501
+ );
502
+ if (response.status < 400)
503
+ return new Response(
504
+ [204, 205, 304].includes(response.status) ? null : Stream_exports.toReadableStream(response.stream),
505
+ {
506
+ status: response.status,
507
+ headers: response.headers
508
+ }
509
+ );
510
+ const { body, upstream } = yield* errorBody(response);
511
+ const provider = httpProviderError(response.status, response.headers);
512
+ const optionalStream = kind === "http" && request.method === "GET";
513
+ if (provider !== void 0 && !optionalStream) {
514
+ const refused = providerErrorDetail(provider, { upstream });
515
+ yield* Deferred_exports.fail(rejected, refused);
516
+ return yield* refused;
517
+ }
518
+ const session = new Headers(init?.headers).has("mcp-session-id");
519
+ yield* Ref_exports.update(
520
+ answered,
521
+ (responses) => new Map(responses).set(response.status, { upstream, session })
522
+ );
523
+ return new Response(body, { status: response.status, headers: response.headers });
524
+ }).pipe(
525
+ Effect_exports.provide(FetchHttpClient_exports.layer),
526
+ Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
527
+ Effect_exports.provideService(
528
+ FetchHttpClient_exports.Fetch,
529
+ (url2, options) => globalThis.fetch(url2, {
530
+ ...options,
531
+ signal: AbortSignal.any([
532
+ ...options?.signal ? [options.signal] : [],
533
+ ...init?.signal ? [init.signal] : []
534
+ ])
535
+ })
536
+ ),
537
+ Effect_exports.mapError((error) => failure("transport", error))
538
+ ),
539
+ init?.signal ? { signal: init.signal } : {}
540
+ );
541
+ var explain = (error, phase, responses) => {
542
+ if (Schema_exports.is(ProviderError)(error)) return providerErrorDetail(error, { phase });
543
+ if (phase === "call" && Schema_exports.is(McpError)(error) && error.phase === "transport" && error.reason === "request")
544
+ return new McpError({
545
+ phase,
546
+ reason: error.reason,
547
+ ...error.status === void 0 ? {} : { status: error.status },
548
+ ...error.upstream === void 0 ? {} : { upstream: error.upstream }
549
+ });
550
+ if (!Schema_exports.is(McpError)(error) || error.status === void 0) return error;
551
+ const response = responses.get(error.status);
552
+ if (response === void 0 || (error.upstream !== void 0 || response.upstream === void 0) && !response.session)
553
+ return error;
554
+ const upstream = error.upstream ?? response.upstream;
555
+ return new McpError({
556
+ phase: error.phase,
557
+ reason: error.reason,
558
+ status: error.status,
559
+ ...upstream === void 0 ? {} : { upstream },
560
+ ...response.session ? { session: true } : {}
561
+ });
562
+ };
563
+ var explained = (phase, answered) => (error) => Ref_exports.get(answered).pipe(
564
+ Effect_exports.flatMap((responses) => Effect_exports.fail(explain(error, phase, responses)))
565
+ );
566
+ function withClient(connection, mode, use, changed) {
567
+ const attempt = (kind) => Effect_exports.scoped(
568
+ Effect_exports.gen(function* () {
569
+ const telemetry = yield* captureTelemetry;
570
+ const rejected = yield* Deferred_exports.make();
571
+ const answered = yield* Ref_exports.make(/* @__PURE__ */ new Map());
572
+ const pending = /* @__PURE__ */ new Set();
573
+ const { client, transport } = yield* Effect_exports.acquireRelease(
574
+ Effect_exports.sync(() => {
575
+ const fetch = transportFetch(connection, telemetry, rejected, answered, kind);
576
+ const client2 = new Client(
577
+ { name: "executor-apps", version: "0.1.0" },
578
+ {
579
+ jsonSchemaValidator: mcpJsonSchemaValidator,
580
+ capabilities: mode === "call" ? { elicitation: { form: {} } } : {}
581
+ }
582
+ );
583
+ if (changed !== void 0) {
584
+ client2.setNotificationHandler(ToolListChangedNotificationSchema, () => {
585
+ const task = Effect_exports.runPromiseWith(telemetry.context)(
586
+ changed.pipe(
587
+ Effect_exports.timeout("5 seconds"),
588
+ Effect_exports.catchCause(() => Effect_exports.logWarning("MCP catalog invalidation failed"))
589
+ )
590
+ );
591
+ pending.add(task);
592
+ return task.finally(() => pending.delete(task));
593
+ });
594
+ }
595
+ return {
596
+ client: client2,
597
+ transport: kind === "http" ? new StreamableHTTPClientTransport(connection.url, {
598
+ fetch,
599
+ reconnectionOptions: {
600
+ maxRetries: 0,
601
+ initialReconnectionDelay: 1e3,
602
+ maxReconnectionDelay: 1e3,
603
+ reconnectionDelayGrowFactor: 1
604
+ }
605
+ }) : new SSEClientTransport(connection.url, { fetch })
606
+ };
607
+ }),
608
+ ({ client: client2, transport: transport2 }) => Effect_exports.gen(function* () {
609
+ client2.removeNotificationHandler("notifications/tools/list_changed");
610
+ yield* Effect_exports.promise(async () => {
611
+ await Promise.allSettled(pending);
612
+ });
613
+ if (transport2 instanceof StreamableHTTPClientTransport && transport2.sessionId !== void 0) {
614
+ yield* Effect_exports.tryPromise(() => transport2.terminateSession()).pipe(
615
+ Effect_exports.timeout(defaultMcpClientLimits.cleanupTimeoutMs),
616
+ Effect_exports.ignore
617
+ );
618
+ }
619
+ yield* Effect_exports.tryPromise(() => client2.close()).pipe(
620
+ Effect_exports.timeout(defaultMcpClientLimits.cleanupTimeoutMs),
621
+ Effect_exports.ignore
622
+ );
623
+ }).pipe(owned("upstream", "provider.mcp.close"))
624
+ );
625
+ const wire = transport;
626
+ yield* Effect_exports.tryPromise({
627
+ try: (signal) => client.connect(wire, { signal, timeout: connection.timeoutMs }),
628
+ catch: (error) => failure("connect", error)
629
+ }).pipe(
630
+ Effect_exports.raceFirst(Deferred_exports.await(rejected)),
631
+ Effect_exports.catch(explained("connect", answered)),
632
+ Effect_exports.timeout(connection.timeoutMs),
633
+ owned("upstream", "provider.mcp.connect")
634
+ );
635
+ return yield* use(client).pipe(
636
+ Effect_exports.raceFirst(Deferred_exports.await(rejected)),
637
+ Effect_exports.catch(explained(mode, answered))
638
+ );
639
+ })
640
+ ).pipe(
641
+ owned("upstream", "provider.mcp.session", {
642
+ attributes: {
643
+ "mcp.transport": kind,
644
+ "mcp.operation": mode,
645
+ "server.address": connection.url.hostname
646
+ }
647
+ })
648
+ );
649
+ return attempt("http").pipe(
650
+ // Fallback is only for negotiation. Tool calls are never automatically replayed.
651
+ Effect_exports.catch(
652
+ (error) => Schema_exports.is(McpError)(error) && error.phase === "connect" && (error.status === 404 || error.status === 405) ? attempt("sse") : Effect_exports.fail(error)
653
+ ),
654
+ (operation) => mode === "discover" ? operation.pipe(Effect_exports.timeout(connection.timeoutMs)) : operation,
655
+ Effect_exports.catchTag(
656
+ "TimeoutError",
657
+ () => Effect_exports.fail(new McpError({ phase: "transport", reason: "timeout" }))
658
+ )
659
+ );
660
+ }
661
+ var mcpClientEffect = (input, changed) => Effect_exports.gen(function* () {
662
+ const options = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(input).pipe(
663
+ Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
664
+ );
665
+ const url = new URL(options.url);
666
+ if (url.username || url.password || url.hash)
667
+ return yield* new McpError({ phase: "connect", reason: "invalid_input" });
668
+ const connection = {
669
+ url,
670
+ headers: Redacted_exports.make({ ...options.headers }),
671
+ timeoutMs: options.timeoutMs ?? defaultMcpClientLimits.timeoutMs
672
+ };
673
+ return mcpClient(
674
+ (mode, use) => withClient(connection, mode, use, changed).pipe(
675
+ Effect_exports.mapError(
676
+ (error) => options.accountId === void 0 ? error : accountProviderError(error, options.accountId)
677
+ )
678
+ ),
679
+ connection.timeoutMs,
680
+ failure
681
+ );
682
+ });
683
+ var refusesCredentials = (error) => Schema_exports.is(ProviderError)(error) && Match_exports.value(error.reason).pipe(
684
+ Match_exports.whenOr("unauthorized", "forbidden", "rejected", () => true),
685
+ Match_exports.whenOr("rate_limited", "unavailable", () => false),
686
+ Match_exports.exhaustive
687
+ );
688
+ var mcpHealthEffect = (check, options) => Effect_exports.gen(function* () {
689
+ const { deadline, timeoutMs, ...parsed } = yield* Schema_exports.decodeUnknownEffect(McpHealthInput)({
690
+ ...options,
691
+ accountId: check.account.id,
692
+ signal: check.signal,
693
+ deadline: check.deadline
694
+ }).pipe(Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" })));
695
+ const end = Math.min(
696
+ (yield* Clock_exports.currentTimeMillis) + (timeoutMs ?? defaultMcpClientLimits.timeoutMs),
697
+ deadline === void 0 ? Number.POSITIVE_INFINITY : deadline - mcpHealthReserveMs
698
+ );
699
+ const remaining = Effect_exports.flatMap(
700
+ Clock_exports.currentTimeMillis,
701
+ (now) => end - now >= 1 ? Effect_exports.succeed(Math.floor(end - now)) : Effect_exports.fail(new McpError({ phase: "transport", reason: "timeout" }))
702
+ );
703
+ yield* (yield* mcpClientEffect({ ...parsed, timeoutMs: yield* remaining })).check;
704
+ return yield* remaining.pipe(
705
+ Effect_exports.flatMap(
706
+ (timeoutMs2) => mcpClientEffect({ url: parsed.url, signal: parsed.signal, timeoutMs: timeoutMs2 })
707
+ ),
708
+ Effect_exports.flatMap((anonymous) => anonymous.check),
709
+ Effect_exports.matchEffect({
710
+ onSuccess: () => Effect_exports.fail(new McpCredentialsUnverified({ anonymous: "answered" })),
711
+ // Executor's network refused the attempt, so the server never answered it.
712
+ onFailure: (error) => Schema_exports.is(NetworkRefused)(error) ? Effect_exports.fail(error) : refusesCredentials(error) ? Effect_exports.void : Effect_exports.fail(new McpCredentialsUnverified({ anonymous: error }))
713
+ }),
714
+ owned("upstream", "provider.mcp.anonymous")
715
+ );
716
+ }).pipe(owned("upstream", "provider.mcp.health"));
717
+ var mcpToolsEffect = (input) => mcpClientEffect(input).pipe(Effect_exports.flatMap(adaptMcpTools));
718
+
719
+ export {
720
+ adaptMcpTool,
721
+ mcpClientEffect,
722
+ mcpHealthEffect,
723
+ mcpToolsEffect
724
+ };