apps 0.0.1-beta.84 → 0.0.1-beta.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -12
- package/framework-reference.json +1 -1
- package/js/{chunk-KGCTYL2S.js → chunk-3FHDX4KB.js} +24 -5
- package/js/{chunk-T2B6GUVY.js → chunk-3ZHRJYP5.js} +2 -2
- package/js/{chunk-JKH7ALFN.js → chunk-BKK5HKJL.js} +3 -3
- package/js/{chunk-HNCCRVIT.js → chunk-BLM5MCKC.js} +2 -2
- package/js/{chunk-OHBKJ54H.js → chunk-CJ5F6UDG.js} +6 -6
- package/js/{chunk-TE25A7D6.js → chunk-F52NGWRV.js} +2 -2
- package/js/chunk-HODA4JY6.js +714 -0
- package/js/{chunk-AIXYBMMI.js → chunk-LNNDKHO6.js} +3 -3
- package/js/{chunk-NG56RPCA.js → chunk-WUPLD4VN.js} +0 -10
- package/js/{chunk-PL5KOEZD.js → chunk-YOGK42MH.js} +1 -1
- package/js/client.js +1 -1
- package/js/contracts.js +1 -1
- package/js/effect.js +7 -7
- package/js/graphql.js +9 -9
- package/js/host.js +7 -7
- package/js/index.js +4 -4
- package/js/mcp/effect.js +8 -9
- package/js/mcp.js +14 -16
- package/js/openapi.js +5 -5
- package/js/skills.js +3 -3
- package/package.json +1 -5
- package/runtime.json +1 -1
- package/types/apps/src/contracts/mcp.d.ts +1 -10
- package/types/apps/src/implementation/router-catalog.d.ts +2 -2
- package/js/chunk-BX2S3T2R.js +0 -348
- package/js/chunk-IGOYMUWZ.js +0 -394
- package/js/mcp/stdio.js +0 -138
- package/types/apps/src/implementation/mcp-stdio.d.ts +0 -4
- package/types/apps/src/mcp-stdio.d.ts +0 -5
|
@@ -14,7 +14,7 @@ export declare const McpClientLimits: Schema.Struct<{
|
|
|
14
14
|
readonly cleanupTimeoutMs: Schema.Int;
|
|
15
15
|
}>;
|
|
16
16
|
export type McpClientLimits = typeof McpClientLimits.Type;
|
|
17
|
-
/**
|
|
17
|
+
/** Discovery ceilings and the default provider timeout. */
|
|
18
18
|
export declare const defaultMcpClientLimits: {
|
|
19
19
|
readonly timeoutMs: number;
|
|
20
20
|
readonly maxTimeoutMs: number;
|
|
@@ -170,12 +170,3 @@ declare const McpCredentialsUnverified_base: Schema.Class<McpCredentialsUnverifi
|
|
|
170
170
|
*/
|
|
171
171
|
export declare class McpCredentialsUnverified extends McpCredentialsUnverified_base {
|
|
172
172
|
}
|
|
173
|
-
/** Public process configuration. Credentials arrive through the selected account. */
|
|
174
|
-
export declare const ProcessConfig: Schema.Struct<{
|
|
175
|
-
readonly command: Schema.NonEmptyString;
|
|
176
|
-
readonly args: Schema.$Array<Schema.String>;
|
|
177
|
-
readonly cwd: Schema.optional<Schema.String>;
|
|
178
|
-
readonly env: Schema.$Record<Schema.String, Schema.String>;
|
|
179
|
-
readonly timeoutMs: Schema.Int;
|
|
180
|
-
}>;
|
|
181
|
-
export type ProcessConfig = typeof ProcessConfig.Type;
|
|
@@ -95,8 +95,8 @@ export declare const operationDescription: (name: string, router: string, operat
|
|
|
95
95
|
readonly tags?: readonly string[];
|
|
96
96
|
}, HostDeclarationInvalid, never>;
|
|
97
97
|
/**
|
|
98
|
-
* A dynamic router over operations already discovered, such as an eager OpenAPI document
|
|
99
|
-
*
|
|
98
|
+
* A dynamic router over operations already discovered, such as an eager OpenAPI document.
|
|
99
|
+
* Upstream names can contain dots, which static router keys cannot.
|
|
100
100
|
*/
|
|
101
101
|
export declare const fixedRouter: (operations: Readonly<Record<string, AppOperation>>, meta?: RouterMeta) => DynamicRouter;
|
|
102
102
|
export interface CatalogOptions {
|
package/js/chunk-BX2S3T2R.js
DELETED
|
@@ -1,348 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
adaptMcpTools,
|
|
3
|
-
answeredError,
|
|
4
|
-
mcpClient,
|
|
5
|
-
mcpJsonSchemaValidator
|
|
6
|
-
} from "./chunk-IGOYMUWZ.js";
|
|
7
|
-
import {
|
|
8
|
-
failOnNetworkRefusal
|
|
9
|
-
} from "./chunk-I6Q7ZPKJ.js";
|
|
10
|
-
import {
|
|
11
|
-
accountProviderError,
|
|
12
|
-
bodyUpstreamError,
|
|
13
|
-
httpProviderError,
|
|
14
|
-
providerErrorDetail
|
|
15
|
-
} from "./chunk-W6XCQAXP.js";
|
|
16
|
-
import {
|
|
17
|
-
McpCredentialsUnverified,
|
|
18
|
-
McpError,
|
|
19
|
-
McpHealthInput,
|
|
20
|
-
McpToolsOptions,
|
|
21
|
-
defaultMcpClientLimits,
|
|
22
|
-
mcpHealthReserveMs
|
|
23
|
-
} from "./chunk-NG56RPCA.js";
|
|
24
|
-
import {
|
|
25
|
-
NetworkRefused,
|
|
26
|
-
ProviderError
|
|
27
|
-
} from "./chunk-Q4IZAUIF.js";
|
|
28
|
-
import {
|
|
29
|
-
captureTelemetry,
|
|
30
|
-
owned
|
|
31
|
-
} from "./chunk-QWQM3CLH.js";
|
|
32
|
-
import {
|
|
33
|
-
FetchHttpClient_exports
|
|
34
|
-
} from "./chunk-PD6I2SDG.js";
|
|
35
|
-
import {
|
|
36
|
-
HttpClientRequest_exports,
|
|
37
|
-
HttpClient_exports
|
|
38
|
-
} from "./chunk-EOPQ727L.js";
|
|
39
|
-
import {
|
|
40
|
-
Clock_exports,
|
|
41
|
-
Deferred_exports,
|
|
42
|
-
Effect_exports,
|
|
43
|
-
Match_exports,
|
|
44
|
-
Option_exports,
|
|
45
|
-
Predicate_exports,
|
|
46
|
-
Redacted_exports,
|
|
47
|
-
Ref_exports,
|
|
48
|
-
Schema_exports,
|
|
49
|
-
Stream_exports
|
|
50
|
-
} from "./chunk-IFJU5SYQ.js";
|
|
51
|
-
|
|
52
|
-
// src/implementation/mcp.ts
|
|
53
|
-
import { UnauthorizedError } from "@modelcontextprotocol/sdk/client/auth.js";
|
|
54
|
-
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
55
|
-
import {
|
|
56
|
-
ErrorCode,
|
|
57
|
-
McpError as ProtocolError,
|
|
58
|
-
ToolListChangedNotificationSchema
|
|
59
|
-
} from "@modelcontextprotocol/sdk/types.js";
|
|
60
|
-
import { SSEClientTransport, SseError } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
61
|
-
import {
|
|
62
|
-
StreamableHTTPClientTransport,
|
|
63
|
-
StreamableHTTPError
|
|
64
|
-
} from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
65
|
-
var unreadable = (error) => error instanceof SyntaxError || error instanceof Error && Predicate_exports.hasProperty(error, "issues") && Array.isArray(error.issues);
|
|
66
|
-
var failure = (phase, error) => {
|
|
67
|
-
if (Schema_exports.is(ProviderError)(error) || Schema_exports.is(McpError)(error) || Schema_exports.is(NetworkRefused)(error))
|
|
68
|
-
return error;
|
|
69
|
-
const code = error instanceof UnauthorizedError ? 401 : error instanceof StreamableHTTPError || error instanceof SseError ? error.code : void 0;
|
|
70
|
-
if (code !== void 0 && code >= 300 && code <= 599)
|
|
71
|
-
return httpProviderError(code) ?? new McpError({ phase, reason: "request", status: code });
|
|
72
|
-
const upstream = answeredError(error);
|
|
73
|
-
return new McpError({
|
|
74
|
-
phase,
|
|
75
|
-
reason: code !== void 0 || unreadable(error) ? "invalid_response" : error instanceof ProtocolError && error.code === ErrorCode.RequestTimeout ? "timeout" : "request",
|
|
76
|
-
...upstream === void 0 ? {} : { upstream }
|
|
77
|
-
});
|
|
78
|
-
};
|
|
79
|
-
var errorBodyLimits = { maxBytes: 65536, readTimeoutMs: 2e3 };
|
|
80
|
-
var errorBody = (response) => Effect_exports.gen(function* () {
|
|
81
|
-
const json = /^application\/(?:[\w.-]+\+)?json$/i.test(
|
|
82
|
-
response.headers["content-type"]?.split(";")[0]?.trim() ?? ""
|
|
83
|
-
);
|
|
84
|
-
const length = response.headers["content-length"];
|
|
85
|
-
if (!json || length !== void 0 && Number(length) > errorBodyLimits.maxBytes)
|
|
86
|
-
return { body: Stream_exports.toReadableStream(response.stream), upstream: void 0 };
|
|
87
|
-
const unreadable2 = new McpError({ phase: "transport", reason: "invalid_response" });
|
|
88
|
-
const read = yield* response.stream.pipe(
|
|
89
|
-
Stream_exports.mapError(() => unreadable2),
|
|
90
|
-
Stream_exports.limitBytes(errorBodyLimits.maxBytes, () => Stream_exports.fail(unreadable2)),
|
|
91
|
-
Stream_exports.decodeText,
|
|
92
|
-
Stream_exports.mkString,
|
|
93
|
-
Effect_exports.timeout(errorBodyLimits.readTimeoutMs),
|
|
94
|
-
Effect_exports.option
|
|
95
|
-
);
|
|
96
|
-
if (Option_exports.isNone(read)) return { body: null, upstream: void 0 };
|
|
97
|
-
const parsed = Schema_exports.decodeUnknownOption(Schema_exports.fromJsonString(Schema_exports.Json))(read.value);
|
|
98
|
-
return {
|
|
99
|
-
body: read.value,
|
|
100
|
-
upstream: Option_exports.isSome(parsed) ? bodyUpstreamError(parsed.value) : void 0
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
var transportFetch = (connection, telemetry, rejected, answered) => (url, init) => Effect_exports.runPromiseWith(telemetry.context)(
|
|
104
|
-
Effect_exports.gen(function* () {
|
|
105
|
-
const target = yield* Effect_exports.try({
|
|
106
|
-
try: () => new URL(url),
|
|
107
|
-
catch: () => new McpError({ phase: "transport", reason: "invalid_response" })
|
|
108
|
-
});
|
|
109
|
-
if (connection.url.username || connection.url.password)
|
|
110
|
-
return yield* new McpError({ phase: "transport", reason: "invalid_input" });
|
|
111
|
-
if (target.origin !== connection.url.origin || target.username || target.password)
|
|
112
|
-
return yield* new McpError({ phase: "transport", reason: "invalid_response" });
|
|
113
|
-
const request = yield* Effect_exports.try({
|
|
114
|
-
try: () => {
|
|
115
|
-
const headers = new Headers(Redacted_exports.value(connection.headers));
|
|
116
|
-
new Headers(init?.headers).forEach((value, name) => headers.set(name, value));
|
|
117
|
-
if (!headers.has("user-agent")) headers.set("user-agent", "Executor");
|
|
118
|
-
return HttpClientRequest_exports.fromWeb(new Request(target, { ...init, headers }));
|
|
119
|
-
},
|
|
120
|
-
// The provider's headers cannot form an HTTP request, such as a name with a space.
|
|
121
|
-
catch: () => new McpError({ phase: "transport", reason: "invalid_input" })
|
|
122
|
-
});
|
|
123
|
-
const client = yield* HttpClient_exports.HttpClient;
|
|
124
|
-
const response = yield* client.execute(request);
|
|
125
|
-
yield* failOnNetworkRefusal(response).pipe(
|
|
126
|
-
Effect_exports.tapError((refused) => Deferred_exports.fail(rejected, refused))
|
|
127
|
-
);
|
|
128
|
-
if (response.status < 400)
|
|
129
|
-
return new Response(
|
|
130
|
-
[204, 205, 304].includes(response.status) ? null : Stream_exports.toReadableStream(response.stream),
|
|
131
|
-
{
|
|
132
|
-
status: response.status,
|
|
133
|
-
headers: response.headers
|
|
134
|
-
}
|
|
135
|
-
);
|
|
136
|
-
const { body, upstream } = yield* errorBody(response);
|
|
137
|
-
const provider = httpProviderError(response.status, response.headers);
|
|
138
|
-
if (provider !== void 0) {
|
|
139
|
-
const refused = providerErrorDetail(provider, { upstream });
|
|
140
|
-
yield* Deferred_exports.fail(rejected, refused);
|
|
141
|
-
return yield* refused;
|
|
142
|
-
}
|
|
143
|
-
const session = new Headers(init?.headers).has("mcp-session-id");
|
|
144
|
-
yield* Ref_exports.update(
|
|
145
|
-
answered,
|
|
146
|
-
(responses) => new Map(responses).set(response.status, { upstream, session })
|
|
147
|
-
);
|
|
148
|
-
return new Response(body, { status: response.status, headers: response.headers });
|
|
149
|
-
}).pipe(
|
|
150
|
-
Effect_exports.provide(FetchHttpClient_exports.layer),
|
|
151
|
-
Effect_exports.provideService(FetchHttpClient_exports.RequestInit, { redirect: "manual" }),
|
|
152
|
-
Effect_exports.provideService(
|
|
153
|
-
FetchHttpClient_exports.Fetch,
|
|
154
|
-
(url2, options) => globalThis.fetch(url2, {
|
|
155
|
-
...options,
|
|
156
|
-
signal: AbortSignal.any([
|
|
157
|
-
...options?.signal ? [options.signal] : [],
|
|
158
|
-
...init?.signal ? [init.signal] : []
|
|
159
|
-
])
|
|
160
|
-
})
|
|
161
|
-
),
|
|
162
|
-
Effect_exports.mapError((error) => failure("transport", error))
|
|
163
|
-
),
|
|
164
|
-
init?.signal ? { signal: init.signal } : {}
|
|
165
|
-
);
|
|
166
|
-
var explain = (error, phase, responses) => {
|
|
167
|
-
if (Schema_exports.is(ProviderError)(error)) return providerErrorDetail(error, { phase });
|
|
168
|
-
if (phase === "call" && Schema_exports.is(McpError)(error) && error.phase === "transport" && error.reason === "request")
|
|
169
|
-
return new McpError({
|
|
170
|
-
phase,
|
|
171
|
-
reason: error.reason,
|
|
172
|
-
...error.status === void 0 ? {} : { status: error.status },
|
|
173
|
-
...error.upstream === void 0 ? {} : { upstream: error.upstream }
|
|
174
|
-
});
|
|
175
|
-
if (!Schema_exports.is(McpError)(error) || error.status === void 0) return error;
|
|
176
|
-
const response = responses.get(error.status);
|
|
177
|
-
if (response === void 0 || (error.upstream !== void 0 || response.upstream === void 0) && !response.session)
|
|
178
|
-
return error;
|
|
179
|
-
const upstream = error.upstream ?? response.upstream;
|
|
180
|
-
return new McpError({
|
|
181
|
-
phase: error.phase,
|
|
182
|
-
reason: error.reason,
|
|
183
|
-
status: error.status,
|
|
184
|
-
...upstream === void 0 ? {} : { upstream },
|
|
185
|
-
...response.session ? { session: true } : {}
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
|
-
var explained = (phase, answered) => (error) => Ref_exports.get(answered).pipe(
|
|
189
|
-
Effect_exports.flatMap((responses) => Effect_exports.fail(explain(error, phase, responses)))
|
|
190
|
-
);
|
|
191
|
-
function withClient(connection, mode, use, changed) {
|
|
192
|
-
const attempt = (kind) => Effect_exports.scoped(
|
|
193
|
-
Effect_exports.gen(function* () {
|
|
194
|
-
const telemetry = yield* captureTelemetry;
|
|
195
|
-
const rejected = yield* Deferred_exports.make();
|
|
196
|
-
const answered = yield* Ref_exports.make(/* @__PURE__ */ new Map());
|
|
197
|
-
const pending = /* @__PURE__ */ new Set();
|
|
198
|
-
const { client, transport } = yield* Effect_exports.acquireRelease(
|
|
199
|
-
Effect_exports.sync(() => {
|
|
200
|
-
const fetch = transportFetch(connection, telemetry, rejected, answered);
|
|
201
|
-
const client2 = new Client(
|
|
202
|
-
{ name: "executor-apps", version: "0.1.0" },
|
|
203
|
-
{
|
|
204
|
-
jsonSchemaValidator: mcpJsonSchemaValidator,
|
|
205
|
-
capabilities: mode === "call" ? { elicitation: { form: {} } } : {}
|
|
206
|
-
}
|
|
207
|
-
);
|
|
208
|
-
if (changed !== void 0) {
|
|
209
|
-
client2.setNotificationHandler(ToolListChangedNotificationSchema, () => {
|
|
210
|
-
const task = Effect_exports.runPromiseWith(telemetry.context)(
|
|
211
|
-
changed.pipe(
|
|
212
|
-
Effect_exports.timeout("5 seconds"),
|
|
213
|
-
Effect_exports.catchCause(() => Effect_exports.logWarning("MCP catalog invalidation failed"))
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
pending.add(task);
|
|
217
|
-
return task.finally(() => pending.delete(task));
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
return {
|
|
221
|
-
client: client2,
|
|
222
|
-
transport: kind === "http" ? new StreamableHTTPClientTransport(connection.url, {
|
|
223
|
-
fetch,
|
|
224
|
-
reconnectionOptions: {
|
|
225
|
-
maxRetries: 0,
|
|
226
|
-
initialReconnectionDelay: 1e3,
|
|
227
|
-
maxReconnectionDelay: 1e3,
|
|
228
|
-
reconnectionDelayGrowFactor: 1
|
|
229
|
-
}
|
|
230
|
-
}) : new SSEClientTransport(connection.url, { fetch })
|
|
231
|
-
};
|
|
232
|
-
}),
|
|
233
|
-
({ client: client2, transport: transport2 }) => Effect_exports.gen(function* () {
|
|
234
|
-
client2.removeNotificationHandler("notifications/tools/list_changed");
|
|
235
|
-
yield* Effect_exports.promise(async () => {
|
|
236
|
-
await Promise.allSettled(pending);
|
|
237
|
-
});
|
|
238
|
-
if (transport2 instanceof StreamableHTTPClientTransport && transport2.sessionId !== void 0) {
|
|
239
|
-
yield* Effect_exports.tryPromise(() => transport2.terminateSession()).pipe(
|
|
240
|
-
Effect_exports.timeout(defaultMcpClientLimits.cleanupTimeoutMs),
|
|
241
|
-
Effect_exports.ignore
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
yield* Effect_exports.tryPromise(() => client2.close()).pipe(
|
|
245
|
-
Effect_exports.timeout(defaultMcpClientLimits.cleanupTimeoutMs),
|
|
246
|
-
Effect_exports.ignore
|
|
247
|
-
);
|
|
248
|
-
}).pipe(owned("upstream", "provider.mcp.close"))
|
|
249
|
-
);
|
|
250
|
-
const wire = transport;
|
|
251
|
-
yield* Effect_exports.tryPromise({
|
|
252
|
-
try: (signal) => client.connect(wire, { signal, timeout: connection.timeoutMs }),
|
|
253
|
-
catch: (error) => failure("connect", error)
|
|
254
|
-
}).pipe(
|
|
255
|
-
Effect_exports.raceFirst(Deferred_exports.await(rejected)),
|
|
256
|
-
Effect_exports.catch(explained("connect", answered)),
|
|
257
|
-
Effect_exports.timeout(connection.timeoutMs),
|
|
258
|
-
owned("upstream", "provider.mcp.connect")
|
|
259
|
-
);
|
|
260
|
-
return yield* use(client).pipe(
|
|
261
|
-
Effect_exports.raceFirst(Deferred_exports.await(rejected)),
|
|
262
|
-
Effect_exports.catch(explained(mode, answered))
|
|
263
|
-
);
|
|
264
|
-
})
|
|
265
|
-
).pipe(
|
|
266
|
-
owned("upstream", "provider.mcp.session", {
|
|
267
|
-
attributes: {
|
|
268
|
-
"mcp.transport": kind,
|
|
269
|
-
"mcp.operation": mode,
|
|
270
|
-
"server.address": connection.url.hostname
|
|
271
|
-
}
|
|
272
|
-
})
|
|
273
|
-
);
|
|
274
|
-
return attempt("http").pipe(
|
|
275
|
-
// Fallback is only for negotiation. Tool calls are never automatically replayed.
|
|
276
|
-
Effect_exports.catch(
|
|
277
|
-
(error) => Schema_exports.is(McpError)(error) && error.phase === "connect" && (error.status === 404 || error.status === 405) ? attempt("sse") : Effect_exports.fail(error)
|
|
278
|
-
),
|
|
279
|
-
(operation) => mode === "discover" ? operation.pipe(Effect_exports.timeout(connection.timeoutMs)) : operation,
|
|
280
|
-
Effect_exports.catchTag(
|
|
281
|
-
"TimeoutError",
|
|
282
|
-
() => Effect_exports.fail(new McpError({ phase: "transport", reason: "timeout" }))
|
|
283
|
-
)
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
var mcpClientEffect = (input, changed) => Effect_exports.gen(function* () {
|
|
287
|
-
const options = yield* Schema_exports.decodeUnknownEffect(McpToolsOptions)(input).pipe(
|
|
288
|
-
Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" }))
|
|
289
|
-
);
|
|
290
|
-
const url = new URL(options.url);
|
|
291
|
-
if (url.username || url.password || url.hash)
|
|
292
|
-
return yield* new McpError({ phase: "connect", reason: "invalid_input" });
|
|
293
|
-
const connection = {
|
|
294
|
-
url,
|
|
295
|
-
headers: Redacted_exports.make({ ...options.headers }),
|
|
296
|
-
timeoutMs: options.timeoutMs ?? defaultMcpClientLimits.timeoutMs
|
|
297
|
-
};
|
|
298
|
-
return mcpClient(
|
|
299
|
-
(mode, use) => withClient(connection, mode, use, changed).pipe(
|
|
300
|
-
Effect_exports.mapError(
|
|
301
|
-
(error) => options.accountId === void 0 ? error : accountProviderError(error, options.accountId)
|
|
302
|
-
)
|
|
303
|
-
),
|
|
304
|
-
connection.timeoutMs,
|
|
305
|
-
failure
|
|
306
|
-
);
|
|
307
|
-
});
|
|
308
|
-
var refusesCredentials = (error) => Schema_exports.is(ProviderError)(error) && Match_exports.value(error.reason).pipe(
|
|
309
|
-
Match_exports.whenOr("unauthorized", "forbidden", "rejected", () => true),
|
|
310
|
-
Match_exports.whenOr("rate_limited", "unavailable", () => false),
|
|
311
|
-
Match_exports.exhaustive
|
|
312
|
-
);
|
|
313
|
-
var mcpHealthEffect = (check, options) => Effect_exports.gen(function* () {
|
|
314
|
-
const { deadline, timeoutMs, ...parsed } = yield* Schema_exports.decodeUnknownEffect(McpHealthInput)({
|
|
315
|
-
...options,
|
|
316
|
-
accountId: check.account.id,
|
|
317
|
-
signal: check.signal,
|
|
318
|
-
deadline: check.deadline
|
|
319
|
-
}).pipe(Effect_exports.mapError(() => new McpError({ phase: "connect", reason: "invalid_input" })));
|
|
320
|
-
const end = Math.min(
|
|
321
|
-
(yield* Clock_exports.currentTimeMillis) + (timeoutMs ?? defaultMcpClientLimits.timeoutMs),
|
|
322
|
-
deadline === void 0 ? Number.POSITIVE_INFINITY : deadline - mcpHealthReserveMs
|
|
323
|
-
);
|
|
324
|
-
const remaining = Effect_exports.flatMap(
|
|
325
|
-
Clock_exports.currentTimeMillis,
|
|
326
|
-
(now) => end - now >= 1 ? Effect_exports.succeed(Math.floor(end - now)) : Effect_exports.fail(new McpError({ phase: "transport", reason: "timeout" }))
|
|
327
|
-
);
|
|
328
|
-
yield* (yield* mcpClientEffect({ ...parsed, timeoutMs: yield* remaining })).check;
|
|
329
|
-
return yield* remaining.pipe(
|
|
330
|
-
Effect_exports.flatMap(
|
|
331
|
-
(timeoutMs2) => mcpClientEffect({ url: parsed.url, signal: parsed.signal, timeoutMs: timeoutMs2 })
|
|
332
|
-
),
|
|
333
|
-
Effect_exports.flatMap((anonymous) => anonymous.check),
|
|
334
|
-
Effect_exports.matchEffect({
|
|
335
|
-
onSuccess: () => Effect_exports.fail(new McpCredentialsUnverified({ anonymous: "answered" })),
|
|
336
|
-
// Executor's network refused the attempt, so the server never answered it.
|
|
337
|
-
onFailure: (error) => Schema_exports.is(NetworkRefused)(error) ? Effect_exports.fail(error) : refusesCredentials(error) ? Effect_exports.void : Effect_exports.fail(new McpCredentialsUnverified({ anonymous: error }))
|
|
338
|
-
}),
|
|
339
|
-
owned("upstream", "provider.mcp.anonymous")
|
|
340
|
-
);
|
|
341
|
-
}).pipe(owned("upstream", "provider.mcp.health"));
|
|
342
|
-
var mcpToolsEffect = (input) => mcpClientEffect(input).pipe(Effect_exports.flatMap(adaptMcpTools));
|
|
343
|
-
|
|
344
|
-
export {
|
|
345
|
-
mcpClientEffect,
|
|
346
|
-
mcpHealthEffect,
|
|
347
|
-
mcpToolsEffect
|
|
348
|
-
};
|