@opencode/browse 0.0.17-dev.148 → 0.0.17-dev.150
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/dist/Runtime-qfc1eg1n.mjs +16 -0
- package/dist/{Undici-mxpvn7gy.mjs → Undici-xgvbtsb1.mjs} +1 -1
- package/dist/{cli-mnatacxh.mjs → cli-nxa4be03.mjs} +69 -65
- package/dist/cli.mjs +30 -13
- package/dist/{helpers-p5ccdp6m.mjs → helpers-gnxbvn63.mjs} +2 -2
- package/dist/{index-6gkr235e.mjs → index-7d47yfra.mjs} +2 -1
- package/dist/{main-vfezh1ps.mjs → main-10w7c97b.mjs} +69 -67
- package/dist/main-37phhnge.mjs +4 -0
- package/dist/{main-xearn98x.mjs → main-3s4j1k2p.mjs} +71 -69
- package/dist/{main-er120rjm.mjs → main-4074weqb.mjs} +2 -2
- package/dist/{main-0dj0x4v6.mjs → main-4gtznd5c.mjs} +53 -27
- package/dist/{main-azpzpy0x.mjs → main-4h7rfhhr.mjs} +1 -1
- package/dist/main-9bk4pprj.mjs +64 -0
- package/dist/{main-9t2s5ptx.mjs → main-bc8cjey0.mjs} +32 -77
- package/dist/main-j98fzrvv.mjs +68 -0
- package/dist/{main-njy3y27f.mjs → main-ksfgzap6.mjs} +2 -2
- package/dist/{main-1mdsf5xe.mjs → main-md18jc5k.mjs} +3 -3
- package/dist/{main-r5tqkv4q.mjs → main-pw38k92k.mjs} +7 -5
- package/dist/{main-ken6azcs.mjs → main-qazf3bhk.mjs} +1 -68
- package/dist/main-v6hzbxjd.mjs +5547 -0
- package/dist/{main-nmyajqdg.mjs → main-vc68m0bh.mjs} +3 -3
- package/dist/{main-q495p3mp.mjs → main-x17fgxar.mjs} +2 -2
- package/dist/main-xycdhwqs.mjs +5196 -0
- package/dist/{main-zqsvbh95.mjs → main-z06ajk37.mjs} +2 -2
- package/dist/{main-687c47zw.mjs → main-zawbkazp.mjs} +4 -4
- package/dist/{mcp-kzwj8kxh.mjs → mcp-hq2ebg2s.mjs} +151 -148
- package/dist/{migrate-zh7f23ky.mjs → migrate-n3f5q6qj.mjs} +5 -5
- package/dist/{relay-ega4yy44.mjs → relay-wxnp7mgw.mjs} +53 -51
- package/dist/{runtime-update-6qna94mr.mjs → runtime-update-hewr1tyf.mjs} +8 -7
- package/dist/{setup-wz32kw2e.mjs → setup-q0vwkvd0.mjs} +8 -8
- package/dist/{supervisor-6e6rq4q3.mjs → supervisor-7hmg5qra.mjs} +26 -8
- package/dist/{update-1kdp2x13.mjs → update-y5bgqv5w.mjs} +3 -3
- package/dist/{version-x9pnjwap.mjs → version-x703dhvw.mjs} +1 -1
- package/package.json +1 -1
- package/dist/main-8e96v2gf.mjs +0 -4
- package/dist/main-yf5j8g79.mjs +0 -10662
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import"./main-9bk4pprj.mjs";
|
|
1
2
|
import {
|
|
2
3
|
filter,
|
|
3
4
|
empty,
|
|
@@ -41,14 +42,14 @@ import {
|
|
|
41
42
|
empty3,
|
|
42
43
|
jsonUnsafe,
|
|
43
44
|
layer
|
|
44
|
-
} from "./main-
|
|
45
|
+
} from "./main-bc8cjey0.mjs";
|
|
45
46
|
import {
|
|
46
47
|
opencodeBrowserVersion2
|
|
47
|
-
} from "./main-
|
|
48
|
+
} from "./main-37phhnge.mjs";
|
|
48
49
|
import {
|
|
49
50
|
cliCommand,
|
|
50
51
|
autoUpdateStatus
|
|
51
|
-
} from "./main-
|
|
52
|
+
} from "./main-md18jc5k.mjs";
|
|
52
53
|
import"./main-b3jrctcx.mjs";
|
|
53
54
|
import {
|
|
54
55
|
option,
|
|
@@ -68,12 +69,12 @@ import {
|
|
|
68
69
|
relayBuildProblem,
|
|
69
70
|
ensureRelay,
|
|
70
71
|
ensureExtensionConnected
|
|
71
|
-
} from "./main-
|
|
72
|
-
import"./main-
|
|
72
|
+
} from "./main-3s4j1k2p.mjs";
|
|
73
|
+
import"./main-4h7rfhhr.mjs";
|
|
73
74
|
import {
|
|
74
75
|
updateJson2,
|
|
75
76
|
createUpdateWatcher2
|
|
76
|
-
} from "./main-
|
|
77
|
+
} from "./main-x17fgxar.mjs";
|
|
77
78
|
import {
|
|
78
79
|
settingSpecs,
|
|
79
80
|
securityVariables,
|
|
@@ -154,12 +155,12 @@ import {
|
|
|
154
155
|
toolResultForValue2,
|
|
155
156
|
mcpErrorMessage2,
|
|
156
157
|
toolResult
|
|
157
|
-
} from "./main-
|
|
158
|
+
} from "./main-10w7c97b.mjs";
|
|
158
159
|
import {
|
|
159
160
|
makeUnsafe,
|
|
160
161
|
make3,
|
|
161
162
|
listSecrets
|
|
162
|
-
} from "./main-
|
|
163
|
+
} from "./main-4gtznd5c.mjs";
|
|
163
164
|
import {
|
|
164
165
|
Clock,
|
|
165
166
|
type,
|
|
@@ -173,8 +174,57 @@ import {
|
|
|
173
174
|
boolean,
|
|
174
175
|
orElse,
|
|
175
176
|
exhaustive
|
|
176
|
-
} from "./main-
|
|
177
|
-
import"./main-
|
|
177
|
+
} from "./main-4074weqb.mjs";
|
|
178
|
+
import"./main-ksfgzap6.mjs";
|
|
179
|
+
import {
|
|
180
|
+
Class,
|
|
181
|
+
taggedEnum,
|
|
182
|
+
TaggedError,
|
|
183
|
+
encode,
|
|
184
|
+
decode,
|
|
185
|
+
defaultFormatter,
|
|
186
|
+
passthrough,
|
|
187
|
+
transformOptional,
|
|
188
|
+
omit,
|
|
189
|
+
is2,
|
|
190
|
+
decodeUnknownEffect2,
|
|
191
|
+
decodeUnknownResult,
|
|
192
|
+
decodeSync,
|
|
193
|
+
encodeUnknownEffect,
|
|
194
|
+
encodeEffect,
|
|
195
|
+
encodeSync,
|
|
196
|
+
optionalKey,
|
|
197
|
+
optional,
|
|
198
|
+
toType,
|
|
199
|
+
toEncoded2,
|
|
200
|
+
Literal,
|
|
201
|
+
TemplateLiteral,
|
|
202
|
+
Any,
|
|
203
|
+
Unknown,
|
|
204
|
+
Null,
|
|
205
|
+
String3,
|
|
206
|
+
Boolean3,
|
|
207
|
+
Struct,
|
|
208
|
+
Record,
|
|
209
|
+
StructWithRest,
|
|
210
|
+
Tuple,
|
|
211
|
+
ArraySchema,
|
|
212
|
+
NonEmptyArray,
|
|
213
|
+
Union,
|
|
214
|
+
Literals,
|
|
215
|
+
UndefinedOr,
|
|
216
|
+
decodeTo2,
|
|
217
|
+
TaggedStruct,
|
|
218
|
+
Finite,
|
|
219
|
+
isGreaterThanOrEqualTo,
|
|
220
|
+
isBetween,
|
|
221
|
+
Int2,
|
|
222
|
+
isMaxLength,
|
|
223
|
+
Defect,
|
|
224
|
+
toCodecJson,
|
|
225
|
+
Json,
|
|
226
|
+
JsonObject
|
|
227
|
+
} from "./main-v6hzbxjd.mjs";
|
|
178
228
|
import {
|
|
179
229
|
hash,
|
|
180
230
|
equals,
|
|
@@ -184,7 +234,7 @@ import {
|
|
|
184
234
|
toJson,
|
|
185
235
|
assignProperty,
|
|
186
236
|
PipeInspectableProto,
|
|
187
|
-
|
|
237
|
+
isGreaterThanOrEqualTo2,
|
|
188
238
|
none,
|
|
189
239
|
some,
|
|
190
240
|
isNone,
|
|
@@ -215,9 +265,6 @@ import {
|
|
|
215
265
|
millis,
|
|
216
266
|
toMillis,
|
|
217
267
|
Scheduler,
|
|
218
|
-
Class2,
|
|
219
|
-
taggedEnum,
|
|
220
|
-
TaggedError,
|
|
221
268
|
ParentSpan,
|
|
222
269
|
externalSpan,
|
|
223
270
|
LogLevelOrder,
|
|
@@ -233,7 +280,7 @@ import {
|
|
|
233
280
|
succeed3,
|
|
234
281
|
failCause2,
|
|
235
282
|
fail4,
|
|
236
|
-
|
|
283
|
+
die2,
|
|
237
284
|
interrupt2,
|
|
238
285
|
void_2,
|
|
239
286
|
isSuccess2,
|
|
@@ -241,14 +288,14 @@ import {
|
|
|
241
288
|
hasInterrupts2,
|
|
242
289
|
isDeferred,
|
|
243
290
|
makeUnsafe4,
|
|
244
|
-
|
|
291
|
+
make11,
|
|
245
292
|
_await,
|
|
246
293
|
interruptWith,
|
|
247
294
|
succeed4,
|
|
248
295
|
doneUnsafe,
|
|
249
296
|
CurrentLogLevel,
|
|
250
297
|
Scope,
|
|
251
|
-
|
|
298
|
+
make12,
|
|
252
299
|
makeUnsafe5,
|
|
253
300
|
provide,
|
|
254
301
|
addFinalizerExit,
|
|
@@ -279,7 +326,7 @@ import {
|
|
|
279
326
|
never,
|
|
280
327
|
gen,
|
|
281
328
|
fail6,
|
|
282
|
-
|
|
329
|
+
die3,
|
|
283
330
|
try_2,
|
|
284
331
|
withFiber2,
|
|
285
332
|
flatMap3,
|
|
@@ -297,7 +344,7 @@ import {
|
|
|
297
344
|
catchDefect,
|
|
298
345
|
catchIf,
|
|
299
346
|
catchCauseIf,
|
|
300
|
-
|
|
347
|
+
mapError2,
|
|
301
348
|
orDie,
|
|
302
349
|
tapError,
|
|
303
350
|
tapCause,
|
|
@@ -308,7 +355,7 @@ import {
|
|
|
308
355
|
timeout,
|
|
309
356
|
race,
|
|
310
357
|
when2,
|
|
311
|
-
|
|
358
|
+
match4,
|
|
312
359
|
matchCauseEffect,
|
|
313
360
|
matchEffect2,
|
|
314
361
|
context2,
|
|
@@ -343,52 +390,8 @@ import {
|
|
|
343
390
|
logFatal,
|
|
344
391
|
logError,
|
|
345
392
|
logDebug,
|
|
346
|
-
annotateLogs
|
|
347
|
-
|
|
348
|
-
decode,
|
|
349
|
-
defaultFormatter,
|
|
350
|
-
passthrough,
|
|
351
|
-
transformOptional,
|
|
352
|
-
omit,
|
|
353
|
-
is2,
|
|
354
|
-
decodeUnknownEffect2,
|
|
355
|
-
decodeUnknownResult,
|
|
356
|
-
decodeSync,
|
|
357
|
-
encodeUnknownEffect,
|
|
358
|
-
encodeEffect,
|
|
359
|
-
encodeSync,
|
|
360
|
-
optionalKey,
|
|
361
|
-
optional,
|
|
362
|
-
toType,
|
|
363
|
-
toEncoded2,
|
|
364
|
-
Literal,
|
|
365
|
-
TemplateLiteral,
|
|
366
|
-
Any,
|
|
367
|
-
Unknown,
|
|
368
|
-
Null,
|
|
369
|
-
String3,
|
|
370
|
-
Boolean3,
|
|
371
|
-
Struct,
|
|
372
|
-
Record,
|
|
373
|
-
StructWithRest,
|
|
374
|
-
Tuple2,
|
|
375
|
-
ArraySchema,
|
|
376
|
-
NonEmptyArray,
|
|
377
|
-
Union,
|
|
378
|
-
Literals,
|
|
379
|
-
UndefinedOr,
|
|
380
|
-
decodeTo2,
|
|
381
|
-
TaggedStruct,
|
|
382
|
-
Finite,
|
|
383
|
-
isGreaterThanOrEqualTo2,
|
|
384
|
-
isBetween,
|
|
385
|
-
Int2,
|
|
386
|
-
isMaxLength,
|
|
387
|
-
Defect,
|
|
388
|
-
toCodecJson,
|
|
389
|
-
Json,
|
|
390
|
-
JsonObject
|
|
391
|
-
} from "./main-yf5j8g79.mjs";
|
|
393
|
+
annotateLogs
|
|
394
|
+
} from "./main-xycdhwqs.mjs";
|
|
392
395
|
import {
|
|
393
396
|
pipeArguments,
|
|
394
397
|
dual,
|
|
@@ -403,7 +406,7 @@ import {
|
|
|
403
406
|
isReadonlyObject,
|
|
404
407
|
hasProperty,
|
|
405
408
|
isTagged
|
|
406
|
-
} from "./main-
|
|
409
|
+
} from "./main-qazf3bhk.mjs";
|
|
407
410
|
|
|
408
411
|
// node_modules/effect/dist/PubSub.js
|
|
409
412
|
var TypeId = "~effect/PubSub";
|
|
@@ -1133,7 +1136,7 @@ var release = (self, key, entry) => withFiber2((fiber) => {
|
|
|
1133
1136
|
|
|
1134
1137
|
// node_modules/effect/dist/LogLevel.js
|
|
1135
1138
|
var Order = LogLevelOrder;
|
|
1136
|
-
var isGreaterThanOrEqualTo3 = /* @__PURE__ */
|
|
1139
|
+
var isGreaterThanOrEqualTo3 = /* @__PURE__ */ isGreaterThanOrEqualTo2(Order);
|
|
1137
1140
|
|
|
1138
1141
|
// node_modules/effect/dist/ErrorReporter.js
|
|
1139
1142
|
var ignore2 = "~effect/ErrorReporter/ignore";
|
|
@@ -1902,7 +1905,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
1902
1905
|
return message.exit._tag === "Success" ? end(entry.queue) : failCause(entry.queue, message.exit.cause);
|
|
1903
1906
|
}
|
|
1904
1907
|
case "Defect": {
|
|
1905
|
-
return clearEntries(
|
|
1908
|
+
return clearEntries(die2(message.defect));
|
|
1906
1909
|
}
|
|
1907
1910
|
case "ClientEnd": {
|
|
1908
1911
|
return void_3;
|
|
@@ -1932,7 +1935,7 @@ var makeNoSerialization = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
1932
1935
|
};
|
|
1933
1936
|
});
|
|
1934
1937
|
var clientIdCounter = 0;
|
|
1935
|
-
var
|
|
1938
|
+
var make10 = /* @__PURE__ */ fnUntraced(function* (group, options) {
|
|
1936
1939
|
const clientId = clientIdCounter++;
|
|
1937
1940
|
const {
|
|
1938
1941
|
codecFor,
|
|
@@ -2337,8 +2340,8 @@ var make13 = (options) => {
|
|
|
2337
2340
|
}
|
|
2338
2341
|
return codecs;
|
|
2339
2342
|
};
|
|
2340
|
-
const installHandlers = (core, lifecycle, target) => options.handlerRpcs === undefined || options.makeHandlers === undefined ? void_3 : lifecycle === undefined && options.runtime._tag === "Stateful" ?
|
|
2341
|
-
const makeReverseClient = (profile) =>
|
|
2343
|
+
const installHandlers = (core, lifecycle, target) => options.handlerRpcs === undefined || options.makeHandlers === undefined ? void_3 : lifecycle === undefined && options.runtime._tag === "Stateful" ? die3("MCP sessionful handler installation requires a lifecycle runtime") : target.install(options, options.handlerRpcs, options.makeHandlers(core, options.runtime._tag === "Stateful" ? lifecycle : undefined, target.context));
|
|
2344
|
+
const makeReverseClient = (profile) => make10(options.serverRequestRpcs, {
|
|
2342
2345
|
spanPrefix: "McpServer/Client"
|
|
2343
2346
|
}).pipe(map5((client) => options.toReverseClient(profile, client)));
|
|
2344
2347
|
return {
|
|
@@ -2474,7 +2477,7 @@ var make14 = /* @__PURE__ */ fnUntraced(function* (protocols) {
|
|
|
2474
2477
|
const namespacedRpc = clientRpcs.requests.get(`${prefix(protocol)}${rpcDefinition._tag}`);
|
|
2475
2478
|
const handler = handlerContext.mapUnsafe.get(rpcDefinition.key);
|
|
2476
2479
|
if (namespacedRpc === undefined || handler === undefined) {
|
|
2477
|
-
return yield*
|
|
2480
|
+
return yield* die3(`MCP handler registration invariant failed for ${protocol.protocolVersion}/${rpcDefinition._tag}`);
|
|
2478
2481
|
}
|
|
2479
2482
|
contextMap.set(namespacedRpc.key, handler);
|
|
2480
2483
|
}
|
|
@@ -2771,7 +2774,7 @@ var make16 = /* @__PURE__ */ fnUntraced(function* (protocols) {
|
|
|
2771
2774
|
};
|
|
2772
2775
|
}
|
|
2773
2776
|
if (statelessDescriptor === undefined) {
|
|
2774
|
-
return yield*
|
|
2777
|
+
return yield* die3("MCP stateless runtime invariant failed");
|
|
2775
2778
|
}
|
|
2776
2779
|
if (requestedVersion !== undefined && requestedVersion !== protocol.protocolVersion) {
|
|
2777
2780
|
return yield* new ProtocolError({
|
|
@@ -2906,7 +2909,7 @@ var make16 = /* @__PURE__ */ fnUntraced(function* (protocols) {
|
|
|
2906
2909
|
continue;
|
|
2907
2910
|
}
|
|
2908
2911
|
if (stateful === undefined) {
|
|
2909
|
-
return yield*
|
|
2912
|
+
return yield* die3("MCP sessionful runtime invariant failed");
|
|
2910
2913
|
}
|
|
2911
2914
|
yield* handlerTarget.install(protocol, PingRpcs, PingRpcs.of({
|
|
2912
2915
|
ping: () => succeed6({})
|
|
@@ -3568,7 +3571,7 @@ var protocol = /* @__PURE__ */ make13({
|
|
|
3568
3571
|
uri
|
|
3569
3572
|
}) {
|
|
3570
3573
|
const request = yield* McpServerClient;
|
|
3571
|
-
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(
|
|
3574
|
+
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
3572
3575
|
return ReadResourceResult.make({
|
|
3573
3576
|
contents: result.contents.map((content) => ("text" in content) ? {
|
|
3574
3577
|
uri: content.uri,
|
|
@@ -3610,7 +3613,7 @@ var protocol = /* @__PURE__ */ make13({
|
|
|
3610
3613
|
name
|
|
3611
3614
|
}) {
|
|
3612
3615
|
const request = yield* McpServerClient;
|
|
3613
|
-
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(
|
|
3616
|
+
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
3614
3617
|
if (outcome._tag === "InputRequired") {
|
|
3615
3618
|
return yield* ProtocolError.fromFeature(new UnsupportedByProtocol({
|
|
3616
3619
|
protocolVersion,
|
|
@@ -3621,7 +3624,7 @@ var protocol = /* @__PURE__ */ make13({
|
|
|
3621
3624
|
const messages = yield* forEach(result.messages, (message) => projectContent(message.content).pipe(map5((content) => ({
|
|
3622
3625
|
role: message.role,
|
|
3623
3626
|
content
|
|
3624
|
-
})),
|
|
3627
|
+
})), mapError2(ProtocolError.fromTool)));
|
|
3625
3628
|
return GetPromptResult.make({
|
|
3626
3629
|
description: result.description,
|
|
3627
3630
|
messages,
|
|
@@ -3640,7 +3643,7 @@ var protocol = /* @__PURE__ */ make13({
|
|
|
3640
3643
|
},
|
|
3641
3644
|
argument: completeRequest.argument,
|
|
3642
3645
|
metadata: completeRequest._meta
|
|
3643
|
-
}, invocationFromClient(request)).pipe(
|
|
3646
|
+
}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
3644
3647
|
return CompleteResult.make({
|
|
3645
3648
|
completion: {
|
|
3646
3649
|
values: Array.from(result.values),
|
|
@@ -3665,8 +3668,8 @@ var protocol = /* @__PURE__ */ make13({
|
|
|
3665
3668
|
const result = yield* core.tools.call({
|
|
3666
3669
|
...call,
|
|
3667
3670
|
arguments: call.arguments ?? {}
|
|
3668
|
-
}, invocationFromClient(request)).pipe(flatMap3((outcome) => requireCompleteOperation(protocolVersion, outcome)),
|
|
3669
|
-
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent).pipe(
|
|
3671
|
+
}, invocationFromClient(request)).pipe(flatMap3((outcome) => requireCompleteOperation(protocolVersion, outcome)), mapError2(ProtocolError.fromTool));
|
|
3672
|
+
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent).pipe(mapError2(ProtocolError.fromTool));
|
|
3670
3673
|
return CallToolResult2.make({
|
|
3671
3674
|
content,
|
|
3672
3675
|
isError: result.isError,
|
|
@@ -3677,19 +3680,19 @@ var protocol = /* @__PURE__ */ make13({
|
|
|
3677
3680
|
toReverseClient: (profile, client) => ({
|
|
3678
3681
|
listRoots: fnUntraced(function* (request) {
|
|
3679
3682
|
yield* requireCapability(profile, "roots/list", "roots");
|
|
3680
|
-
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots2.payloadSchema, request).pipe(
|
|
3683
|
+
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots2.payloadSchema, request).pipe(mapError2(() => unsupported("roots/list", "Request is not representable by this protocol")));
|
|
3681
3684
|
const {
|
|
3682
3685
|
roots
|
|
3683
|
-
} = yield* client["roots/list"](wireRequest).pipe(
|
|
3686
|
+
} = yield* client["roots/list"](wireRequest).pipe(mapError2(reverseError("roots/list")));
|
|
3684
3687
|
return new ListRootsResult({
|
|
3685
3688
|
roots
|
|
3686
3689
|
});
|
|
3687
3690
|
}),
|
|
3688
3691
|
createMessage: fnUntraced(function* (request) {
|
|
3689
3692
|
yield* requireCapability(profile, "sampling/createMessage", "sampling");
|
|
3690
|
-
const wireRequest = yield* transcodeStrict(CreateMessage.payloadSchema, CreateMessage2.payloadSchema, request).pipe(
|
|
3691
|
-
const result = yield* client["sampling/createMessage"](wireRequest).pipe(
|
|
3692
|
-
return yield* transcode(CreateMessage2.successSchema, CreateMessage.successSchema, result).pipe(
|
|
3693
|
+
const wireRequest = yield* transcodeStrict(CreateMessage.payloadSchema, CreateMessage2.payloadSchema, request).pipe(mapError2(() => unsupported("sampling/createMessage", "Request is not representable by this protocol")));
|
|
3694
|
+
const result = yield* client["sampling/createMessage"](wireRequest).pipe(mapError2(reverseError("sampling/createMessage")));
|
|
3695
|
+
return yield* transcode(CreateMessage2.successSchema, CreateMessage.successSchema, result).pipe(mapError2(() => unsupported("sampling/createMessage", "Response is not representable by the canonical model")));
|
|
3693
3696
|
}),
|
|
3694
3697
|
elicit: () => fail6(unsupported("elicitation/create", "Elicitation was introduced after this protocol revision"))
|
|
3695
3698
|
}),
|
|
@@ -3997,7 +4000,7 @@ var protocol2 = /* @__PURE__ */ make13({
|
|
|
3997
4000
|
uri
|
|
3998
4001
|
}) {
|
|
3999
4002
|
const request = yield* McpServerClient;
|
|
4000
|
-
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(
|
|
4003
|
+
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
4001
4004
|
return ReadResourceResult.make({
|
|
4002
4005
|
contents: result.contents.map(projectResourceContents),
|
|
4003
4006
|
_meta: result._meta
|
|
@@ -4031,7 +4034,7 @@ var protocol2 = /* @__PURE__ */ make13({
|
|
|
4031
4034
|
name
|
|
4032
4035
|
}) {
|
|
4033
4036
|
const request = yield* McpServerClient;
|
|
4034
|
-
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(
|
|
4037
|
+
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
4035
4038
|
if (outcome._tag === "InputRequired") {
|
|
4036
4039
|
return yield* ProtocolError.fromFeature(new UnsupportedByProtocol({
|
|
4037
4040
|
protocolVersion: protocolVersion2,
|
|
@@ -4042,7 +4045,7 @@ var protocol2 = /* @__PURE__ */ make13({
|
|
|
4042
4045
|
const messages = yield* forEach(result.messages, (message) => projectContent2(message.content).pipe(map5((content) => ({
|
|
4043
4046
|
role: message.role,
|
|
4044
4047
|
content
|
|
4045
|
-
})),
|
|
4048
|
+
})), mapError2(ProtocolError.fromTool)));
|
|
4046
4049
|
return GetPromptResult2.make({
|
|
4047
4050
|
description: result.description,
|
|
4048
4051
|
messages,
|
|
@@ -4061,7 +4064,7 @@ var protocol2 = /* @__PURE__ */ make13({
|
|
|
4061
4064
|
},
|
|
4062
4065
|
argument: completeRequest.argument,
|
|
4063
4066
|
metadata: completeRequest._meta
|
|
4064
|
-
}, invocationFromClient(request)).pipe(
|
|
4067
|
+
}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
4065
4068
|
return CompleteResult.make({
|
|
4066
4069
|
completion: {
|
|
4067
4070
|
values: Array.from(result.values),
|
|
@@ -4091,8 +4094,8 @@ var protocol2 = /* @__PURE__ */ make13({
|
|
|
4091
4094
|
const result = yield* core.tools.call({
|
|
4092
4095
|
...call,
|
|
4093
4096
|
arguments: call.arguments ?? {}
|
|
4094
|
-
}, invocationFromClient(request)).pipe(flatMap3((outcome) => requireCompleteOperation(protocolVersion2, outcome)),
|
|
4095
|
-
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent2).pipe(
|
|
4097
|
+
}, invocationFromClient(request)).pipe(flatMap3((outcome) => requireCompleteOperation(protocolVersion2, outcome)), mapError2(ProtocolError.fromTool));
|
|
4098
|
+
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent2).pipe(mapError2(ProtocolError.fromTool));
|
|
4096
4099
|
return CallToolResult3.make({
|
|
4097
4100
|
content,
|
|
4098
4101
|
isError: result.isError,
|
|
@@ -4103,19 +4106,19 @@ var protocol2 = /* @__PURE__ */ make13({
|
|
|
4103
4106
|
toReverseClient: (profile, client) => ({
|
|
4104
4107
|
listRoots: fnUntraced(function* (request) {
|
|
4105
4108
|
yield* requireCapability2(profile, "roots/list", "roots");
|
|
4106
|
-
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots2.payloadSchema, request).pipe(
|
|
4109
|
+
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots2.payloadSchema, request).pipe(mapError2(() => unsupported2("roots/list", "Request is not representable by this protocol")));
|
|
4107
4110
|
const {
|
|
4108
4111
|
roots
|
|
4109
|
-
} = yield* client["roots/list"](wireRequest).pipe(
|
|
4112
|
+
} = yield* client["roots/list"](wireRequest).pipe(mapError2(reverseError("roots/list")));
|
|
4110
4113
|
return new ListRootsResult({
|
|
4111
4114
|
roots
|
|
4112
4115
|
});
|
|
4113
4116
|
}),
|
|
4114
4117
|
createMessage: fnUntraced(function* (request) {
|
|
4115
4118
|
yield* requireCapability2(profile, "sampling/createMessage", "sampling");
|
|
4116
|
-
const wireRequest = yield* transcodeStrict(CreateMessage.payloadSchema, CreateMessage3.payloadSchema, request).pipe(
|
|
4117
|
-
const result = yield* client["sampling/createMessage"](wireRequest).pipe(
|
|
4118
|
-
return yield* transcode(CreateMessage3.successSchema, CreateMessage.successSchema, result).pipe(
|
|
4119
|
+
const wireRequest = yield* transcodeStrict(CreateMessage.payloadSchema, CreateMessage3.payloadSchema, request).pipe(mapError2(() => unsupported2("sampling/createMessage", "Request is not representable by this protocol")));
|
|
4120
|
+
const result = yield* client["sampling/createMessage"](wireRequest).pipe(mapError2(reverseError("sampling/createMessage")));
|
|
4121
|
+
return yield* transcode(CreateMessage3.successSchema, CreateMessage.successSchema, result).pipe(mapError2(() => unsupported2("sampling/createMessage", "Response is not representable by the canonical model")));
|
|
4119
4122
|
}),
|
|
4120
4123
|
elicit: () => fail6(unsupported2("elicitation/create", "Elicitation was introduced after this protocol revision"))
|
|
4121
4124
|
}),
|
|
@@ -4600,7 +4603,7 @@ var protocol3 = /* @__PURE__ */ make13({
|
|
|
4600
4603
|
uri
|
|
4601
4604
|
}) {
|
|
4602
4605
|
const request = yield* McpServerClient;
|
|
4603
|
-
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(
|
|
4606
|
+
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
4604
4607
|
return ReadResourceResult2.make({
|
|
4605
4608
|
contents: result.contents.map(projectResourceContents2),
|
|
4606
4609
|
_meta: result._meta
|
|
@@ -4626,7 +4629,7 @@ var protocol3 = /* @__PURE__ */ make13({
|
|
|
4626
4629
|
name
|
|
4627
4630
|
}) {
|
|
4628
4631
|
const request = yield* McpServerClient;
|
|
4629
|
-
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(
|
|
4632
|
+
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
4630
4633
|
if (outcome._tag === "InputRequired") {
|
|
4631
4634
|
return yield* ProtocolError.fromFeature(new UnsupportedByProtocol({
|
|
4632
4635
|
protocolVersion: protocolVersion3,
|
|
@@ -4637,7 +4640,7 @@ var protocol3 = /* @__PURE__ */ make13({
|
|
|
4637
4640
|
const messages = yield* forEach(result.messages, (message) => projectContent3(message.content).pipe(map5((content) => ({
|
|
4638
4641
|
role: message.role,
|
|
4639
4642
|
content
|
|
4640
|
-
})),
|
|
4643
|
+
})), mapError2(ProtocolError.fromTool)));
|
|
4641
4644
|
return GetPromptResult3.make({
|
|
4642
4645
|
description: result.description,
|
|
4643
4646
|
messages,
|
|
@@ -4660,7 +4663,7 @@ var protocol3 = /* @__PURE__ */ make13({
|
|
|
4660
4663
|
arguments: completeRequest.context.arguments
|
|
4661
4664
|
},
|
|
4662
4665
|
metadata: completeRequest._meta
|
|
4663
|
-
}, invocationFromClient(request)).pipe(
|
|
4666
|
+
}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
4664
4667
|
return CompleteResult2.make({
|
|
4665
4668
|
completion: {
|
|
4666
4669
|
values: Array.from(result.values),
|
|
@@ -4696,8 +4699,8 @@ var protocol3 = /* @__PURE__ */ make13({
|
|
|
4696
4699
|
const result = yield* core.tools.call({
|
|
4697
4700
|
...call,
|
|
4698
4701
|
arguments: call.arguments ?? {}
|
|
4699
|
-
}, invocationFromClient(request)).pipe(flatMap3((outcome) => requireCompleteOperation(protocolVersion3, outcome)),
|
|
4700
|
-
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent3).pipe(
|
|
4702
|
+
}, invocationFromClient(request)).pipe(flatMap3((outcome) => requireCompleteOperation(protocolVersion3, outcome)), mapError2(ProtocolError.fromTool));
|
|
4703
|
+
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent3).pipe(mapError2(ProtocolError.fromTool));
|
|
4701
4704
|
const structuredContent = projectStructuredContent(result.structuredContent);
|
|
4702
4705
|
return CallToolResult4.make({
|
|
4703
4706
|
content,
|
|
@@ -4710,28 +4713,28 @@ var protocol3 = /* @__PURE__ */ make13({
|
|
|
4710
4713
|
toReverseClient: (profile, client) => ({
|
|
4711
4714
|
listRoots: fnUntraced(function* (request) {
|
|
4712
4715
|
yield* requireCapability3(profile, "roots/list", "roots");
|
|
4713
|
-
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots2.payloadSchema, request).pipe(
|
|
4716
|
+
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots2.payloadSchema, request).pipe(mapError2(() => unsupported3("roots/list", "Request is not representable by this protocol")));
|
|
4714
4717
|
const {
|
|
4715
4718
|
roots
|
|
4716
|
-
} = yield* client["roots/list"](wireRequest).pipe(
|
|
4719
|
+
} = yield* client["roots/list"](wireRequest).pipe(mapError2(reverseError("roots/list")));
|
|
4717
4720
|
return new ListRootsResult({
|
|
4718
4721
|
roots
|
|
4719
4722
|
});
|
|
4720
4723
|
}),
|
|
4721
4724
|
createMessage: fnUntraced(function* (request) {
|
|
4722
4725
|
yield* requireCapability3(profile, "sampling/createMessage", "sampling");
|
|
4723
|
-
const wireRequest = yield* transcodeStrict(CreateMessage.payloadSchema, CreateMessage4.payloadSchema, request).pipe(
|
|
4724
|
-
const result = yield* client["sampling/createMessage"](wireRequest).pipe(
|
|
4725
|
-
return yield* transcode(CreateMessage4.successSchema, CreateMessage.successSchema, result).pipe(
|
|
4726
|
+
const wireRequest = yield* transcodeStrict(CreateMessage.payloadSchema, CreateMessage4.payloadSchema, request).pipe(mapError2(() => unsupported3("sampling/createMessage", "Request is not representable by this protocol")));
|
|
4727
|
+
const result = yield* client["sampling/createMessage"](wireRequest).pipe(mapError2(reverseError("sampling/createMessage")));
|
|
4728
|
+
return yield* transcode(CreateMessage4.successSchema, CreateMessage.successSchema, result).pipe(mapError2(() => unsupported3("sampling/createMessage", "Response is not representable by the canonical model")));
|
|
4726
4729
|
}),
|
|
4727
4730
|
elicit: fnUntraced(function* (request) {
|
|
4728
4731
|
yield* requireCapability3(profile, "elicitation/create", "elicitation");
|
|
4729
4732
|
const projected = request.mode === "form" ? omit(request, ["mode"]) : request;
|
|
4730
4733
|
const wireRequest = yield* decodeUnknownEffect2(Elicit2.payloadSchema, {
|
|
4731
4734
|
onExcessProperty: "error"
|
|
4732
|
-
})(projected).pipe(
|
|
4733
|
-
const result = yield* client["elicitation/create"](wireRequest).pipe(
|
|
4734
|
-
return yield* transcode(Elicit2.successSchema, Elicit.successSchema, result).pipe(
|
|
4735
|
+
})(projected).pipe(mapError2(() => unsupported3("elicitation/create", "Request is not representable by this protocol")));
|
|
4736
|
+
const result = yield* client["elicitation/create"](wireRequest).pipe(mapError2(reverseError("elicitation/create")));
|
|
4737
|
+
return yield* transcode(Elicit2.successSchema, Elicit.successSchema, result).pipe(mapError2(() => unsupported3("elicitation/create", "Response is not representable by the canonical model")));
|
|
4735
4738
|
})
|
|
4736
4739
|
}),
|
|
4737
4740
|
projectNotification: (notification) => makeNotificationProjector({
|
|
@@ -5230,7 +5233,7 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5230
5233
|
uri
|
|
5231
5234
|
}) {
|
|
5232
5235
|
const request = yield* McpServerClient;
|
|
5233
|
-
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(
|
|
5236
|
+
const result = yield* core.resources.read(uri, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
5234
5237
|
return ReadResourceResult2.make({
|
|
5235
5238
|
contents: result.contents.map((content) => ("text" in content) ? {
|
|
5236
5239
|
uri: content.uri,
|
|
@@ -5266,7 +5269,7 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5266
5269
|
name
|
|
5267
5270
|
}) {
|
|
5268
5271
|
const request = yield* McpServerClient;
|
|
5269
|
-
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(
|
|
5272
|
+
const outcome = yield* core.prompts.get(name, args ?? {}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
5270
5273
|
if (outcome._tag === "InputRequired") {
|
|
5271
5274
|
return yield* ProtocolError.fromFeature(new UnsupportedByProtocol({
|
|
5272
5275
|
protocolVersion: protocolVersion4,
|
|
@@ -5277,7 +5280,7 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5277
5280
|
const messages = yield* forEach(result.messages, (message) => projectContent4(message.content).pipe(map5((content) => ({
|
|
5278
5281
|
role: message.role,
|
|
5279
5282
|
content
|
|
5280
|
-
})),
|
|
5283
|
+
})), mapError2(ProtocolError.fromTool)));
|
|
5281
5284
|
return GetPromptResult4.make({
|
|
5282
5285
|
description: result.description,
|
|
5283
5286
|
messages,
|
|
@@ -5300,7 +5303,7 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5300
5303
|
arguments: completeRequest.context.arguments
|
|
5301
5304
|
},
|
|
5302
5305
|
metadata: completeRequest._meta
|
|
5303
|
-
}, invocationFromClient(request)).pipe(
|
|
5306
|
+
}, invocationFromClient(request)).pipe(mapError2(ProtocolError.fromFeature));
|
|
5304
5307
|
return CompleteResult2.make({
|
|
5305
5308
|
completion: {
|
|
5306
5309
|
values: Array.from(result.values),
|
|
@@ -5343,8 +5346,8 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5343
5346
|
text: error.message
|
|
5344
5347
|
})],
|
|
5345
5348
|
isError: true
|
|
5346
|
-
}))),
|
|
5347
|
-
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent4).pipe(
|
|
5349
|
+
}))), mapError2(ProtocolError.fromTool));
|
|
5350
|
+
const content = yield* forEach(unwrapStringStructuredContent(result), projectContent4).pipe(mapError2(ProtocolError.fromTool));
|
|
5348
5351
|
const structuredContent = projectStructuredContent2(result.structuredContent);
|
|
5349
5352
|
return CallToolResult5.make({
|
|
5350
5353
|
content,
|
|
@@ -5357,10 +5360,10 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5357
5360
|
toReverseClient: (profile, client) => ({
|
|
5358
5361
|
listRoots: fnUntraced(function* (request) {
|
|
5359
5362
|
yield* requireCapability4(profile, "roots/list", "roots");
|
|
5360
|
-
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots3.payloadSchema, request).pipe(
|
|
5363
|
+
const wireRequest = yield* transcode(ListRoots.payloadSchema, ListRoots3.payloadSchema, request).pipe(mapError2(() => unsupported4("roots/list", "Request is not representable by this protocol")));
|
|
5361
5364
|
const {
|
|
5362
5365
|
roots
|
|
5363
|
-
} = yield* client["roots/list"](wireRequest).pipe(
|
|
5366
|
+
} = yield* client["roots/list"](wireRequest).pipe(mapError2(reverseError("roots/list")));
|
|
5364
5367
|
return new ListRootsResult({
|
|
5365
5368
|
roots
|
|
5366
5369
|
});
|
|
@@ -5373,12 +5376,12 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5373
5376
|
if ((request.includeContext === "thisServer" || request.includeContext === "allServers") && profile.clientCapabilities.sampling?.context == undefined) {
|
|
5374
5377
|
return yield* unsupported4("sampling/createMessage", "Client did not advertise the sampling.context capability");
|
|
5375
5378
|
}
|
|
5376
|
-
const wireRequest = yield* transcode(CreateMessage.payloadSchema, CreateMessage5.payloadSchema, request).pipe(
|
|
5377
|
-
const result = yield* client["sampling/createMessage"](wireRequest).pipe(
|
|
5379
|
+
const wireRequest = yield* transcode(CreateMessage.payloadSchema, CreateMessage5.payloadSchema, request).pipe(mapError2(() => unsupported4("sampling/createMessage", "Request is not representable by this protocol")));
|
|
5380
|
+
const result = yield* client["sampling/createMessage"](wireRequest).pipe(mapError2(reverseError("sampling/createMessage")));
|
|
5378
5381
|
if (resultRequiresSamplingTools(result) && profile.clientCapabilities.sampling?.tools == undefined) {
|
|
5379
5382
|
return yield* unsupported4("sampling/createMessage", "Client did not advertise the sampling.tools capability");
|
|
5380
5383
|
}
|
|
5381
|
-
return yield* transcode(CreateMessage5.successSchema, CreateMessage.successSchema, result).pipe(
|
|
5384
|
+
return yield* transcode(CreateMessage5.successSchema, CreateMessage.successSchema, result).pipe(mapError2(() => unsupported4("sampling/createMessage", "Response is not representable by the canonical model")));
|
|
5382
5385
|
}),
|
|
5383
5386
|
elicit: fnUntraced(function* (request) {
|
|
5384
5387
|
yield* requireCapability4(profile, "elicitation/create", "elicitation");
|
|
@@ -5386,9 +5389,9 @@ var protocol4 = /* @__PURE__ */ make13({
|
|
|
5386
5389
|
if (!hasElicitationModeCapability(profile, mode)) {
|
|
5387
5390
|
return yield* unsupported4("elicitation/create", `Client did not advertise the elicitation.${mode} capability`);
|
|
5388
5391
|
}
|
|
5389
|
-
const wireRequest = yield* transcode(Elicit.payloadSchema, Elicit3.payloadSchema, request).pipe(
|
|
5390
|
-
const result = yield* client["elicitation/create"](wireRequest).pipe(
|
|
5391
|
-
return yield* transcode(Elicit3.successSchema, Elicit.successSchema, result).pipe(
|
|
5392
|
+
const wireRequest = yield* transcode(Elicit.payloadSchema, Elicit3.payloadSchema, request).pipe(mapError2(() => unsupported4("elicitation/create", "Request is not representable by this protocol")));
|
|
5393
|
+
const result = yield* client["elicitation/create"](wireRequest).pipe(mapError2(reverseError("elicitation/create")));
|
|
5394
|
+
return yield* transcode(Elicit3.successSchema, Elicit.successSchema, result).pipe(mapError2(() => unsupported4("elicitation/create", "Response is not representable by the canonical model")));
|
|
5392
5395
|
})
|
|
5393
5396
|
}),
|
|
5394
5397
|
projectNotification: (notification) => notification._tag === "ElicitationComplete" ? succeed6({
|
|
@@ -5628,7 +5631,7 @@ var InputResponseRequestParams = {
|
|
|
5628
5631
|
};
|
|
5629
5632
|
var CacheableResult = {
|
|
5630
5633
|
...ResultMeta2,
|
|
5631
|
-
ttlMs: /* @__PURE__ */ Int2.check(/* @__PURE__ */
|
|
5634
|
+
ttlMs: /* @__PURE__ */ Int2.check(/* @__PURE__ */ isGreaterThanOrEqualTo(0)),
|
|
5632
5635
|
cacheScope: /* @__PURE__ */ Literals(["public", "private"])
|
|
5633
5636
|
};
|
|
5634
5637
|
var PaginatedRequestParams = {
|
|
@@ -6148,7 +6151,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6148
6151
|
};
|
|
6149
6152
|
const resourceSubscriptions = new Set(honored.resourceSubscriptions);
|
|
6150
6153
|
const pending = yield* dropping(MAX_PENDING_SUBSCRIPTION_NOTIFICATIONS);
|
|
6151
|
-
const overflowed = yield*
|
|
6154
|
+
const overflowed = yield* make11();
|
|
6152
6155
|
yield* gen(function* () {
|
|
6153
6156
|
while (true) {
|
|
6154
6157
|
const event = yield* take4(events);
|
|
@@ -6200,7 +6203,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6200
6203
|
},
|
|
6201
6204
|
resultType: "complete"
|
|
6202
6205
|
});
|
|
6203
|
-
},
|
|
6206
|
+
}, mapError2(projectError)),
|
|
6204
6207
|
"server/discover": fnUntraced(function* (_request) {
|
|
6205
6208
|
const discovery = yield* getDiscovery;
|
|
6206
6209
|
const result = yield* projectCompleteResult({
|
|
@@ -6210,7 +6213,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6210
6213
|
instructions: context.serverInfo.instructions
|
|
6211
6214
|
}, context.serverInfo);
|
|
6212
6215
|
return yield* decodeDiscoverResult(result);
|
|
6213
|
-
},
|
|
6216
|
+
}, mapError2(projectError)),
|
|
6214
6217
|
"resources/list": fnUntraced(function* (_request) {
|
|
6215
6218
|
const invocation = yield* getInvocation;
|
|
6216
6219
|
const resources = yield* core.resources.list(invocation.protocol);
|
|
@@ -6219,7 +6222,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6219
6222
|
resources: resources.map(projectResource)
|
|
6220
6223
|
}, context.serverInfo);
|
|
6221
6224
|
return yield* decodeListResourcesResult(result);
|
|
6222
|
-
},
|
|
6225
|
+
}, mapError2(projectError)),
|
|
6223
6226
|
"resources/templates/list": fnUntraced(function* (_request) {
|
|
6224
6227
|
const invocation = yield* getInvocation;
|
|
6225
6228
|
const resourceTemplates = yield* core.resources.listTemplates(invocation.protocol);
|
|
@@ -6228,7 +6231,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6228
6231
|
resourceTemplates: resourceTemplates.map(projectResourceTemplate)
|
|
6229
6232
|
}, context.serverInfo);
|
|
6230
6233
|
return yield* decodeListResourceTemplatesResult(result);
|
|
6231
|
-
},
|
|
6234
|
+
}, mapError2(projectError)),
|
|
6232
6235
|
"resources/read": fnUntraced(function* (request) {
|
|
6233
6236
|
const invocation = yield* getInputInvocation(request);
|
|
6234
6237
|
const read = yield* core.resources.read(request.uri, invocation);
|
|
@@ -6239,7 +6242,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6239
6242
|
_meta: read._meta
|
|
6240
6243
|
}, context.serverInfo);
|
|
6241
6244
|
return yield* decodeReadResourceResult(result);
|
|
6242
|
-
},
|
|
6245
|
+
}, mapError2(projectError)),
|
|
6243
6246
|
"prompts/list": fnUntraced(function* (_request) {
|
|
6244
6247
|
const presence = yield* context.registrationPresence;
|
|
6245
6248
|
if (!presence.prompts) {
|
|
@@ -6256,7 +6259,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6256
6259
|
prompts: projectedPrompts
|
|
6257
6260
|
}, context.serverInfo);
|
|
6258
6261
|
return yield* decodeListPromptsResult(result);
|
|
6259
|
-
},
|
|
6262
|
+
}, mapError2(projectError)),
|
|
6260
6263
|
"prompts/get": fnUntraced(function* (request) {
|
|
6261
6264
|
const invocation = yield* getInputInvocation(request);
|
|
6262
6265
|
const outcome = yield* core.prompts.get(request.name, request.arguments ?? {}, invocation);
|
|
@@ -6276,7 +6279,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6276
6279
|
_meta: prompt._meta
|
|
6277
6280
|
}, context.serverInfo);
|
|
6278
6281
|
return yield* decodeGetPromptResult(result);
|
|
6279
|
-
},
|
|
6282
|
+
}, mapError2(projectError)),
|
|
6280
6283
|
"completion/complete": fnUntraced(function* (request) {
|
|
6281
6284
|
const invocation = yield* getInvocation;
|
|
6282
6285
|
const completion = yield* core.completions.complete({
|
|
@@ -6303,7 +6306,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6303
6306
|
_meta: completion.metadata
|
|
6304
6307
|
}, context.serverInfo);
|
|
6305
6308
|
return yield* decodeCompleteResult(result);
|
|
6306
|
-
},
|
|
6309
|
+
}, mapError2(projectError)),
|
|
6307
6310
|
"tools/list": fnUntraced(function* (_request) {
|
|
6308
6311
|
const invocation = yield* getInvocation;
|
|
6309
6312
|
const tools = yield* core.tools.list(invocation.protocol);
|
|
@@ -6313,7 +6316,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6313
6316
|
tools: projectedTools
|
|
6314
6317
|
}, context.serverInfo);
|
|
6315
6318
|
return yield* decodeListToolsResult(result);
|
|
6316
|
-
},
|
|
6319
|
+
}, mapError2(projectError)),
|
|
6317
6320
|
"tools/call": fnUntraced(function* (request) {
|
|
6318
6321
|
const invocation = yield* getInputInvocation(request);
|
|
6319
6322
|
const tool = (yield* core.tools.list(invocation.protocol)).find((tool) => tool.name === request.name);
|
|
@@ -6375,7 +6378,7 @@ var makeHandlers = (core, _lifecycle, context) => {
|
|
|
6375
6378
|
isError: toolResult.isError,
|
|
6376
6379
|
_meta: toolResult._meta
|
|
6377
6380
|
}), context.serverInfo);
|
|
6378
|
-
},
|
|
6381
|
+
}, mapError2(projectError)),
|
|
6379
6382
|
"notifications/cancelled": fnUntraced(function* (_request) {
|
|
6380
6383
|
return yield* void_3;
|
|
6381
6384
|
})
|
|
@@ -7356,7 +7359,7 @@ var makeNoSerialization2 = /* @__PURE__ */ fnUntraced(function* (group, options)
|
|
|
7356
7359
|
_tag: "Exit",
|
|
7357
7360
|
clientId: client.id,
|
|
7358
7361
|
requestId: request.id,
|
|
7359
|
-
exit:
|
|
7362
|
+
exit: die2(`Unknown request tag: ${request.tag}`)
|
|
7360
7363
|
}), (defect) => sendDefect(client, defect));
|
|
7361
7364
|
if (!client.ended || client.fibers.size > 0)
|
|
7362
7365
|
return write;
|
|
@@ -7558,7 +7561,7 @@ var make19 = /* @__PURE__ */ fnUntraced(function* (group, options) {
|
|
|
7558
7561
|
} = yield* Protocol2;
|
|
7559
7562
|
const encodeDefectUnsafe = encodeSync(codecFor(Defect()));
|
|
7560
7563
|
const services = yield* context2();
|
|
7561
|
-
const scope = yield*
|
|
7564
|
+
const scope = yield* make12();
|
|
7562
7565
|
const server = yield* makeNoSerialization2(group, {
|
|
7563
7566
|
...options,
|
|
7564
7567
|
disableClientAcks: !supportsAck,
|
|
@@ -7845,7 +7848,7 @@ class McpServer extends (/* @__PURE__ */ Service2()("effect/ai/McpServer")) {
|
|
|
7845
7848
|
const dispatcher = (yield* Scheduler).makeDispatcher();
|
|
7846
7849
|
const notifications = yield* makeNoSerialization(BroadcastServerNotificationRpcs, {
|
|
7847
7850
|
spanPrefix: "McpServer/Notifications",
|
|
7848
|
-
onFromClient: (options) =>
|
|
7851
|
+
onFromClient: (options) => make11().pipe(flatMap3((delivered) => withFiber2((fiber) => {
|
|
7849
7852
|
const message = options.message;
|
|
7850
7853
|
if (message._tag !== "Request") {
|
|
7851
7854
|
return void_3;
|
|
@@ -7889,7 +7892,7 @@ class McpServer extends (/* @__PURE__ */ Service2()("effect/ai/McpServer")) {
|
|
|
7889
7892
|
notifyElicitationComplete: ({
|
|
7890
7893
|
clientId,
|
|
7891
7894
|
elicitationId
|
|
7892
|
-
}) =>
|
|
7895
|
+
}) => make11().pipe(flatMap3((delivered) => offer(notificationsQueue, {
|
|
7893
7896
|
notification: ServerNotification.ElicitationComplete({
|
|
7894
7897
|
elicitationId
|
|
7895
7898
|
}),
|
|
@@ -7934,7 +7937,7 @@ class McpServer extends (/* @__PURE__ */ Service2()("effect/ai/McpServer")) {
|
|
|
7934
7937
|
}),
|
|
7935
7938
|
callTool: (request) => gen(function* () {
|
|
7936
7939
|
const client = yield* McpServerClient;
|
|
7937
|
-
const result = yield* internalCore.tools.call(request, invocationFromClient(client)).pipe(
|
|
7940
|
+
const result = yield* internalCore.tools.call(request, invocationFromClient(client)).pipe(mapError2((error) => new InvalidParams({
|
|
7938
7941
|
message: error._tag === "ToolNotFound" ? `Tool '${error.name}' not found` : error.message
|
|
7939
7942
|
})));
|
|
7940
7943
|
if (result._tag === "InputRequired") {
|
|
@@ -8120,7 +8123,7 @@ var MCP_INVALID_BATCH_METHOD = "invalid/json-rpc-batch";
|
|
|
8120
8123
|
var cancelledResponses = /* @__PURE__ */ new WeakMap;
|
|
8121
8124
|
var requestKey = (requestId) => `${typeof requestId}:${requestId}`;
|
|
8122
8125
|
|
|
8123
|
-
class McpClientKey extends
|
|
8126
|
+
class McpClientKey extends Class {
|
|
8124
8127
|
}
|
|
8125
8128
|
var runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, transport) {
|
|
8126
8129
|
const protocol = yield* Protocol2;
|
|
@@ -8161,7 +8164,7 @@ var runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, tra
|
|
|
8161
8164
|
const selectedProtocol = runtime.selectProtocol(protocolVersion);
|
|
8162
8165
|
const rpc = selectedProtocol.serverNotificationRpcs.requests.get(notification.tag);
|
|
8163
8166
|
if (rpc === undefined) {
|
|
8164
|
-
return
|
|
8167
|
+
return die3(`MCP protocol ${protocolVersion} does not define server notification ${notification.tag}`);
|
|
8165
8168
|
}
|
|
8166
8169
|
return selectedProtocol.payloadCodecs(rpc).encode(notification.payload).pipe(orDie, flatMap3((payload) => protocol.send(clientId, {
|
|
8167
8170
|
_tag: "Request",
|
|
@@ -8268,13 +8271,13 @@ var runWithRuntime = /* @__PURE__ */ fnUntraced(function* (options, runtime, tra
|
|
|
8268
8271
|
status: headers[MCP_SESSION_ID_HEADER3] === undefined ? 400 : 404
|
|
8269
8272
|
})));
|
|
8270
8273
|
}
|
|
8271
|
-
return
|
|
8274
|
+
return die3(new Error(`Mcp-Session-Id does not exist`));
|
|
8272
8275
|
}
|
|
8273
8276
|
const initializePayload = session?.initializePayload ?? payload;
|
|
8274
8277
|
const clientState = clientStates.get(client.id);
|
|
8275
8278
|
const selectedProtocol = session?.protocol ?? clientState?.protocol ?? runtime.protocolForInternalTag(rpc._tag);
|
|
8276
8279
|
if (!isProtocolVersion(selectedProtocol.protocolVersion) || selectedProtocol.protocolVersion === "2026-07-28") {
|
|
8277
|
-
return
|
|
8280
|
+
return die3(`Unsupported selected MCP protocol version: ${selectedProtocol.protocolVersion}`);
|
|
8278
8281
|
}
|
|
8279
8282
|
const profile = session?.negotiatedProfile ?? {
|
|
8280
8283
|
protocolVersion: selectedProtocol.protocolVersion,
|
|
@@ -8668,7 +8671,7 @@ var mcpStdioSerialization = (protocols) => {
|
|
|
8668
8671
|
});
|
|
8669
8672
|
};
|
|
8670
8673
|
var isEncodedMcpFailureCause = /* @__PURE__ */ is2(/* @__PURE__ */ TaggedStruct("Cause", {
|
|
8671
|
-
data: /* @__PURE__ */
|
|
8674
|
+
data: /* @__PURE__ */ Tuple([/* @__PURE__ */ TaggedStruct("Fail", {
|
|
8672
8675
|
error: /* @__PURE__ */ toEncoded2(McpError)
|
|
8673
8676
|
})])
|
|
8674
8677
|
}));
|
|
@@ -9627,7 +9630,7 @@ var registerTools = gen(function* () {
|
|
|
9627
9630
|
handle: (payload) => {
|
|
9628
9631
|
const requiresRelay = typeof spec.requiresRelayCompatibility === "function" ? spec.requiresRelayCompatibility(payload) : spec.requiresRelayCompatibility !== false;
|
|
9629
9632
|
const operation = requiresRelay ? ensureRelay({ relay }).pipe(flatMap3((readiness) => readiness.buildProblem ? fail6(new Error(readiness.buildProblem)) : spec.handle(payload))) : spec.handle(payload);
|
|
9630
|
-
return operation.pipe(
|
|
9633
|
+
return operation.pipe(match4({
|
|
9631
9634
|
onFailure: (error) => toolResult({ text: mcpErrorMessage2(spec.name, error.message), isError: true }),
|
|
9632
9635
|
onSuccess: (value) => spec.result ? spec.result(value) : toolResultForValue2(value, spec.outputSchema ? { outputSchema: spec.outputSchema } : {})
|
|
9633
9636
|
}), flatMap3((result) => ctx.caller.pipe(map5((caller) => withUpdateNote(caller, spec.name, result)))));
|