@opencode/browse 0.0.7 → 0.0.8-dev.38

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.
@@ -36,6 +36,7 @@ import {
36
36
  normalize,
37
37
  isFailure,
38
38
  isSuccess,
39
+ filter,
39
40
  take,
40
41
  empty2,
41
42
  Scheduler,
@@ -70,9 +71,11 @@ import {
70
71
  provide,
71
72
  addFinalizerExit,
72
73
  addFinalizer,
74
+ fork,
73
75
  forkUnsafe,
74
76
  close,
75
77
  closeUnsafe,
78
+ use,
76
79
  succeed5,
77
80
  effect,
78
81
  effectDiscard,
@@ -130,6 +133,7 @@ import {
130
133
  orElseSucceed,
131
134
  timeout,
132
135
  timeoutOption,
136
+ race,
133
137
  when,
134
138
  match3,
135
139
  matchCauseEffect,
@@ -138,7 +142,9 @@ import {
138
142
  contextWith,
139
143
  provide3,
140
144
  provideContext,
145
+ serviceOption,
141
146
  provideService,
147
+ scope,
142
148
  scoped,
143
149
  acquireRelease,
144
150
  ensuring,
@@ -182,11 +188,14 @@ import {
182
188
  makeUnsafe5,
183
189
  Empty,
184
190
  make9,
191
+ append,
185
192
  prepend,
186
193
  takeAll,
187
194
  take2,
195
+ remove2,
188
196
  make10,
189
197
  bounded,
198
+ dropping,
190
199
  offer,
191
200
  offerUnsafe,
192
201
  offerAll,
@@ -236,8 +245,10 @@ import {
236
245
  decodeTo2,
237
246
  TaggedStruct,
238
247
  Finite,
248
+ isGreaterThanOrEqualTo2,
239
249
  isBetween,
240
250
  Int2,
251
+ isMaxLength,
241
252
  Defect,
242
253
  toCodecJson,
243
254
  Json,
@@ -246,13 +257,13 @@ import {
246
257
  jsonUnsafe,
247
258
  Stdio,
248
259
  layer
249
- } from "./main-9z6jbwdp.mjs";
260
+ } from "./main-ta3yc4kx.mjs";
250
261
  import {
251
262
  opencodeBrowserVersion2
252
- } from "./main-g2y00taz.mjs";
263
+ } from "./main-7fjsxr93.mjs";
253
264
  import {
254
265
  autoUpdateStatus
255
- } from "./main-pzxxc274.mjs";
266
+ } from "./main-zc2xv4zh.mjs";
256
267
  import"./main-3gthmkzw.mjs";
257
268
  import {
258
269
  option,
@@ -263,12 +274,12 @@ import {
263
274
  relayBuildProblem,
264
275
  ensureRelay,
265
276
  ensureExtensionConnected
266
- } from "./main-r11ss6ah.mjs";
267
- import"./main-76r1c0hp.mjs";
277
+ } from "./main-t4vvf2np.mjs";
278
+ import"./main-7mhya2p5.mjs";
268
279
  import {
269
280
  updateJson2,
270
281
  createUpdateWatcher2
271
- } from "./main-jwjwc6a6.mjs";
282
+ } from "./main-jfv7n10a.mjs";
272
283
  import {
273
284
  makeUnsafe,
274
285
  make,
@@ -299,6 +310,7 @@ import {
299
310
  ProgressNotification,
300
311
  ResourceListChangedNotification,
301
312
  ResourceUpdatedNotification,
313
+ Prompt,
302
314
  TextContent,
303
315
  PromptListChangedNotification,
304
316
  Tool,
@@ -340,16 +352,21 @@ import {
340
352
  mcpErrorMessage2,
341
353
  toolResult,
342
354
  listSecrets
343
- } from "./main-krfmwmrb.mjs";
355
+ } from "./main-vtchyn7z.mjs";
344
356
  import {
345
357
  Clock,
358
+ type,
346
359
  value2,
347
360
  when2,
348
361
  tag2,
349
362
  tags,
350
363
  is2,
364
+ string,
365
+ number,
366
+ boolean,
367
+ orElse,
351
368
  exhaustive
352
- } from "./main-brs53cap.mjs";
369
+ } from "./main-kxbs88e4.mjs";
353
370
  import {
354
371
  pipeArguments,
355
372
  dual,
@@ -406,6 +423,41 @@ var unsubscribe = (self) => uninterruptible(withFiber2((state) => {
406
423
  self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers);
407
424
  })), when(self.shutdownHook.open), asVoid2);
408
425
  }));
426
+ var take4 = (self) => suspend2(() => {
427
+ if (self.shutdownFlag.current) {
428
+ return interrupt2;
429
+ }
430
+ if (self.replayWindow.remaining > 0) {
431
+ const message = self.replayWindow.take();
432
+ return succeed6(message);
433
+ }
434
+ const message = self.pollers.length === 0 ? self.subscription.poll() : Empty;
435
+ if (message === Empty) {
436
+ return pollForItem(self);
437
+ } else {
438
+ self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers);
439
+ return succeed6(message);
440
+ }
441
+ });
442
+ var pollForItem = (self) => callback2((resume) => {
443
+ if (self.shutdownFlag.current)
444
+ return resume(interrupt2);
445
+ if (isSome(self.ended.current))
446
+ return resume(succeed6(self.ended.current.value));
447
+ const deferred = makeUnsafe3();
448
+ let set = self.subscribers.get(self.subscription);
449
+ if (!set) {
450
+ set = new Set;
451
+ self.subscribers.set(self.subscription, set);
452
+ }
453
+ set.add(self.pollers);
454
+ append(self.pollers, deferred);
455
+ self.strategy.completePollersUnsafe(self.pubsub, self.subscribers, self.subscription, self.pollers);
456
+ if (deferred.effect)
457
+ return resume(deferred.effect);
458
+ deferred.resumes = [resume];
459
+ return sync2(() => remove2(self.pollers, deferred));
460
+ });
409
461
  var AbsentValue = /* @__PURE__ */ Symbol.for("effect/PubSub/AbsentValue");
410
462
  var addSubscribers = (subscribers, subscription, pollers) => {
411
463
  if (!subscribers.has(subscription)) {
@@ -896,7 +948,7 @@ var getRefKey = (bucket, key) => {
896
948
  }
897
949
  }
898
950
  };
899
- var remove2 = /* @__PURE__ */ dual(2, (self, key_) => {
951
+ var remove3 = /* @__PURE__ */ dual(2, (self, key_) => {
900
952
  if (isSimpleKey(key_)) {
901
953
  self.backing.delete(key_);
902
954
  return self;
@@ -1012,7 +1064,7 @@ var removeInterrupted = (self, key, entry, context) => {
1012
1064
  const o = get2(self.state.map, key);
1013
1065
  if (o._tag === "None" || o.value !== entry)
1014
1066
  return;
1015
- remove2(self.state.map, key);
1067
+ remove3(self.state.map, key);
1016
1068
  if (entry.refCount > 0)
1017
1069
  return;
1018
1070
  closeEntry(entry).pipe(runForkWith(context), runIn(self.scope));
@@ -1029,7 +1081,7 @@ var release = (self, key, entry) => withFiber2((fiber) => {
1029
1081
  if (o._tag === "None" || o.value !== entry) {
1030
1082
  return closeEntry(entry);
1031
1083
  } else if (isZero(entry.idleTimeToLive)) {
1032
- remove2(self.state.map, key);
1084
+ remove3(self.state.map, key);
1033
1085
  return closeEntry(entry);
1034
1086
  } else if (!isFinite2(entry.idleTimeToLive)) {
1035
1087
  return void_3;
@@ -1047,7 +1099,7 @@ var release = (self, key, entry) => withFiber2((fiber) => {
1047
1099
  const o = get2(self.state.map, key);
1048
1100
  if (o._tag === "None" || o.value !== entry)
1049
1101
  return void_3;
1050
- remove2(self.state.map, key);
1102
+ remove3(self.state.map, key);
1051
1103
  return close(entry.scope, void_2);
1052
1104
  }
1053
1105
  return flatMap3(restore(clock.sleep(millis(remaining))), () => loop(restore));
@@ -1059,7 +1111,7 @@ var release = (self, key, entry) => withFiber2((fiber) => {
1059
1111
 
1060
1112
  // node_modules/effect/dist/LogLevel.js
1061
1113
  var Order = LogLevelOrder;
1062
- var isGreaterThanOrEqualTo2 = /* @__PURE__ */ isGreaterThanOrEqualTo(Order);
1114
+ var isGreaterThanOrEqualTo3 = /* @__PURE__ */ isGreaterThanOrEqualTo(Order);
1063
1115
 
1064
1116
  // node_modules/effect/dist/ErrorReporter.js
1065
1117
  var ignore2 = "~effect/ErrorReporter/ignore";
@@ -2087,6 +2139,16 @@ var invocationFromClient = (request) => ({
2087
2139
  }),
2088
2140
  serverClient: request
2089
2141
  });
2142
+ var invocationFromRequestContext = (request) => ({
2143
+ clientId: request.clientId,
2144
+ protocol: {
2145
+ protocolVersion: request.protocolVersion,
2146
+ clientCapabilities: request.clientCapabilities,
2147
+ clientInfo: request.clientInfo,
2148
+ requestMetadata: request.requestMetadata
2149
+ },
2150
+ requestContext: request
2151
+ });
2090
2152
  var requireCompleteOperation = (protocolVersion, outcome) => outcome._tag === "Complete" ? succeed6(outcome.value) : fail4(new UnsupportedByProtocol({
2091
2153
  protocolVersion,
2092
2154
  feature: "Client input"
@@ -2271,6 +2333,7 @@ var emptyMutableUnsafe = () => Object.create(Proto);
2271
2333
 
2272
2334
  // node_modules/effect/dist/http/HttpServerResponse.js
2273
2335
  var TypeId4 = "~effect/http/HttpServerResponse";
2336
+ var isHttpServerResponse = (u) => hasProperty(u, TypeId4);
2274
2337
  var empty7 = (options) => makeResponse({
2275
2338
  status: options?.status ?? 204,
2276
2339
  statusText: options?.statusText,
@@ -2296,6 +2359,11 @@ var jsonUnsafe2 = (body, options) => {
2296
2359
  };
2297
2360
  var setHeader = /* @__PURE__ */ dual(3, (self, key, value) => makeResponse(self, set(self.headers, key, value)));
2298
2361
  var setHeaders = /* @__PURE__ */ dual(2, (self, input) => makeResponse(self, setAll(self.headers, input)));
2362
+ var setStatus = /* @__PURE__ */ dual((args) => isHttpServerResponse(args[0]), (self, status, statusText) => makeResponse({
2363
+ ...self,
2364
+ status,
2365
+ statusText: statusText ?? self.statusText
2366
+ }));
2299
2367
  var Proto2 = {
2300
2368
  ...PipeInspectableProto,
2301
2369
  [TypeId4]: TypeId4,
@@ -2464,7 +2532,7 @@ var make15 = () => {
2464
2532
  const session = resolveSession(clientId, headers);
2465
2533
  if (notification._tag === "LoggingMessage") {
2466
2534
  const minimum = session?.logLevel;
2467
- return minimum?._tag === "Mcp" ? mcpLogLevels[notification.level].order >= mcpLogLevels[minimum.level].order : isGreaterThanOrEqualTo2(mcpLogLevels[notification.level].effect, minimum?.level ?? fallbackLogLevel);
2535
+ return minimum?._tag === "Mcp" ? mcpLogLevels[notification.level].order >= mcpLogLevels[minimum.level].order : isGreaterThanOrEqualTo3(mcpLogLevels[notification.level].effect, minimum?.level ?? fallbackLogLevel);
2468
2536
  }
2469
2537
  return notification._tag !== "ResourceUpdated" || session?.resourceSubscriptions?.has(notification.uri) === true;
2470
2538
  },
@@ -3020,7 +3088,7 @@ var PromptArgument = /* @__PURE__ */ Struct({
3020
3088
  description: /* @__PURE__ */ optional2(String3),
3021
3089
  required: /* @__PURE__ */ optional2(Boolean3)
3022
3090
  });
3023
- var Prompt = /* @__PURE__ */ Struct({
3091
+ var Prompt2 = /* @__PURE__ */ Struct({
3024
3092
  name: String3,
3025
3093
  description: /* @__PURE__ */ optional2(String3),
3026
3094
  arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(PromptArgument))
@@ -3094,7 +3162,7 @@ var ReadResourceResult = /* @__PURE__ */ Struct({
3094
3162
  });
3095
3163
  var ListPromptsResult = /* @__PURE__ */ Struct({
3096
3164
  ...PaginatedResult.fields,
3097
- prompts: /* @__PURE__ */ ArraySchema(Prompt)
3165
+ prompts: /* @__PURE__ */ ArraySchema(Prompt2)
3098
3166
  });
3099
3167
  var GetPromptResult = /* @__PURE__ */ Struct({
3100
3168
  ...ResultMeta.fields,
@@ -4085,8 +4153,8 @@ var PromptArgument2 = /* @__PURE__ */ Struct({
4085
4153
  ...PromptArgument.fields,
4086
4154
  title: /* @__PURE__ */ optional4(String3)
4087
4155
  });
4088
- var Prompt2 = /* @__PURE__ */ Struct({
4089
- ...Prompt.fields,
4156
+ var Prompt3 = /* @__PURE__ */ Struct({
4157
+ ...Prompt2.fields,
4090
4158
  title: /* @__PURE__ */ optional4(String3),
4091
4159
  arguments: /* @__PURE__ */ optional4(/* @__PURE__ */ ArraySchema(PromptArgument2)),
4092
4160
  _meta: Meta
@@ -4232,7 +4300,7 @@ var ReadResourceResult2 = /* @__PURE__ */ Struct({
4232
4300
  });
4233
4301
  var ListPromptsResult2 = /* @__PURE__ */ Struct({
4234
4302
  ...PaginatedResult.fields,
4235
- prompts: /* @__PURE__ */ ArraySchema(Prompt2)
4303
+ prompts: /* @__PURE__ */ ArraySchema(Prompt3)
4236
4304
  });
4237
4305
  var GetPromptResult3 = /* @__PURE__ */ Struct({
4238
4306
  ...ResultMeta.fields,
@@ -4696,8 +4764,8 @@ var ResourceTemplate3 = /* @__PURE__ */ Struct({
4696
4764
  annotations: /* @__PURE__ */ optional5(Annotations2),
4697
4765
  icons: /* @__PURE__ */ optional5(/* @__PURE__ */ ArraySchema(Icon))
4698
4766
  });
4699
- var Prompt3 = /* @__PURE__ */ Struct({
4700
- ...Prompt2.fields,
4767
+ var Prompt4 = /* @__PURE__ */ Struct({
4768
+ ...Prompt3.fields,
4701
4769
  icons: /* @__PURE__ */ optional5(/* @__PURE__ */ ArraySchema(Icon))
4702
4770
  });
4703
4771
  var TextContent4 = /* @__PURE__ */ Struct({
@@ -4938,7 +5006,7 @@ var ListResourceTemplatesResult3 = /* @__PURE__ */ Struct({
4938
5006
  });
4939
5007
  var ListPromptsResult3 = /* @__PURE__ */ Struct({
4940
5008
  ...PaginatedResult.fields,
4941
- prompts: /* @__PURE__ */ ArraySchema(Prompt3)
5009
+ prompts: /* @__PURE__ */ ArraySchema(Prompt4)
4942
5010
  });
4943
5011
  var GetPromptResult4 = /* @__PURE__ */ Struct({
4944
5012
  ...GetPromptResult3.fields,
@@ -5169,7 +5237,7 @@ var protocol4 = /* @__PURE__ */ make13({
5169
5237
  headers
5170
5238
  }) => lifecycle.unsubscribe(uri, client.id, headers).pipe(as({})),
5171
5239
  "prompts/list": () => McpServerClient.use((request) => core.prompts.list(profileFromClient(request))).pipe(map5((prompts) => ListPromptsResult3.make({
5172
- prompts: prompts.map((prompt) => Prompt3.make(prompt))
5240
+ prompts: prompts.map((prompt) => Prompt4.make(prompt))
5173
5241
  }))),
5174
5242
  "prompts/get": fnUntraced(function* ({
5175
5243
  arguments: args,
@@ -5316,8 +5384,1014 @@ var protocol4 = /* @__PURE__ */ make13({
5316
5384
  })))
5317
5385
  });
5318
5386
 
5387
+ // node_modules/effect/dist/ai/internal/mcpSchema/v2026_07_28.js
5388
+ var protocolVersion5 = "2026-07-28";
5389
+ var optional6 = optional2;
5390
+ var Meta3 = /* @__PURE__ */ optional6(JsonObject);
5391
+ var RequestId3 = /* @__PURE__ */ Union([String3, Int2]);
5392
+ var ProgressToken2 = RequestId3;
5393
+ var Role2 = Role;
5394
+ var LoggingLevel3 = LoggingLevel2;
5395
+ var Implementation5 = Implementation4;
5396
+ var ClientCapabilities5 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5397
+ experimental: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, JsonObject)),
5398
+ roots: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({})),
5399
+ sampling: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5400
+ context: /* @__PURE__ */ optional6(JsonObject),
5401
+ tools: /* @__PURE__ */ optional6(JsonObject)
5402
+ })),
5403
+ elicitation: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5404
+ form: /* @__PURE__ */ optional6(JsonObject),
5405
+ url: /* @__PURE__ */ optional6(JsonObject)
5406
+ })),
5407
+ extensions: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, JsonObject))
5408
+ }), [JsonObject]);
5409
+ var ServerCapabilities4 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5410
+ experimental: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, JsonObject)),
5411
+ logging: /* @__PURE__ */ optional6(JsonObject),
5412
+ completions: /* @__PURE__ */ optional6(JsonObject),
5413
+ prompts: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5414
+ listChanged: /* @__PURE__ */ optional6(Boolean3)
5415
+ })),
5416
+ resources: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5417
+ subscribe: /* @__PURE__ */ optional6(Boolean3),
5418
+ listChanged: /* @__PURE__ */ optional6(Boolean3)
5419
+ })),
5420
+ tools: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5421
+ listChanged: /* @__PURE__ */ optional6(Boolean3)
5422
+ })),
5423
+ extensions: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, JsonObject))
5424
+ }), [JsonObject]);
5425
+ var RequestMetaObject = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5426
+ progressToken: /* @__PURE__ */ optional6(ProgressToken2),
5427
+ "io.modelcontextprotocol/protocolVersion": String3,
5428
+ "io.modelcontextprotocol/clientInfo": /* @__PURE__ */ optional6(Implementation5),
5429
+ "io.modelcontextprotocol/clientCapabilities": ClientCapabilities5,
5430
+ "io.modelcontextprotocol/logLevel": /* @__PURE__ */ optional6(LoggingLevel3)
5431
+ }), [JsonObject]);
5432
+ var RequestParams = /* @__PURE__ */ Struct({
5433
+ _meta: RequestMetaObject
5434
+ });
5435
+ var NotificationMetaObject = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5436
+ "io.modelcontextprotocol/subscriptionId": /* @__PURE__ */ optional6(RequestId3)
5437
+ }), [JsonObject]);
5438
+ var NotificationParams = /* @__PURE__ */ Struct({
5439
+ _meta: /* @__PURE__ */ optional6(NotificationMetaObject)
5440
+ });
5441
+ var ResultMetaObject = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5442
+ "io.modelcontextprotocol/serverInfo": Implementation5
5443
+ }), [JsonObject]);
5444
+ var ResultMeta2 = {
5445
+ _meta: ResultMetaObject,
5446
+ resultType: /* @__PURE__ */ Literal("complete")
5447
+ };
5448
+ var McpError3 = /* @__PURE__ */ Struct({
5449
+ code: Int2,
5450
+ message: String3,
5451
+ data: /* @__PURE__ */ optional6(Json)
5452
+ });
5453
+ var METHOD_NOT_FOUND = -32601;
5454
+ var INVALID_PARAMS = -32602;
5455
+ var MISSING_REQUIRED_CLIENT_CAPABILITY = -32021;
5456
+ var Annotations3 = Annotations2;
5457
+ var Resource4 = /* @__PURE__ */ Struct({
5458
+ ...Resource3.fields,
5459
+ size: /* @__PURE__ */ optional6(Int2),
5460
+ annotations: /* @__PURE__ */ optional6(Annotations3)
5461
+ });
5462
+ var ResourceTemplate4 = ResourceTemplate3;
5463
+ var ResourceContents3 = ResourceContents2;
5464
+ var TextContent5 = TextContent4;
5465
+ var ImageContent4 = ImageContent3;
5466
+ var AudioContent4 = AudioContent3;
5467
+ var ResourceLink3 = /* @__PURE__ */ Struct({
5468
+ ...Resource4.fields,
5469
+ type: /* @__PURE__ */ Literal("resource_link")
5470
+ });
5471
+ var EmbeddedResource4 = EmbeddedResource3;
5472
+ var ContentBlock3 = /* @__PURE__ */ Union([TextContent5, ImageContent4, AudioContent4, ResourceLink3, EmbeddedResource4]);
5473
+ var Prompt5 = Prompt4;
5474
+ var PromptMessage5 = /* @__PURE__ */ Struct({
5475
+ role: Role2,
5476
+ content: ContentBlock3
5477
+ });
5478
+ var ToolInputSchema2 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5479
+ $schema: /* @__PURE__ */ optional6(String3),
5480
+ type: /* @__PURE__ */ Literal("object")
5481
+ }), [JsonObject]);
5482
+ var ToolOutputSchema = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5483
+ $schema: /* @__PURE__ */ optional6(String3)
5484
+ }), [JsonObject]);
5485
+ var ToolAnnotations2 = ToolAnnotations;
5486
+ var Tool6 = /* @__PURE__ */ Struct({
5487
+ ...Tool5.fields,
5488
+ inputSchema: ToolInputSchema2,
5489
+ outputSchema: /* @__PURE__ */ optional6(ToolOutputSchema),
5490
+ annotations: /* @__PURE__ */ optional6(ToolAnnotations2)
5491
+ });
5492
+ var ToolUseContent2 = ToolUseContent;
5493
+ var ToolResultContent2 = /* @__PURE__ */ Struct({
5494
+ type: /* @__PURE__ */ Literal("tool_result"),
5495
+ toolUseId: String3,
5496
+ content: /* @__PURE__ */ ArraySchema(ContentBlock3),
5497
+ structuredContent: /* @__PURE__ */ optional6(Json),
5498
+ isError: /* @__PURE__ */ optional6(Boolean3),
5499
+ _meta: Meta3
5500
+ });
5501
+ var SamplingMessageContentBlock2 = /* @__PURE__ */ Union([TextContent5, ImageContent4, AudioContent4, ToolUseContent2, ToolResultContent2]);
5502
+ var SamplingMessage5 = /* @__PURE__ */ Struct({
5503
+ role: Role2,
5504
+ content: /* @__PURE__ */ Union([SamplingMessageContentBlock2, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock2)]),
5505
+ _meta: Meta3
5506
+ });
5507
+ var ModelHint2 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5508
+ name: /* @__PURE__ */ optional6(String3)
5509
+ }), [JsonObject]);
5510
+ var ModelPriority = /* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
5511
+ minimum: 0,
5512
+ maximum: 1
5513
+ }));
5514
+ var ModelPreferences2 = /* @__PURE__ */ Struct({
5515
+ ...ModelPreferences.fields,
5516
+ hints: /* @__PURE__ */ optional6(/* @__PURE__ */ ArraySchema(ModelHint2)),
5517
+ costPriority: /* @__PURE__ */ optional6(ModelPriority),
5518
+ speedPriority: /* @__PURE__ */ optional6(ModelPriority),
5519
+ intelligencePriority: /* @__PURE__ */ optional6(ModelPriority)
5520
+ });
5521
+ var ToolChoice2 = ToolChoice;
5522
+ var CreateMessageRequest = /* @__PURE__ */ Struct({
5523
+ method: /* @__PURE__ */ Literal("sampling/createMessage"),
5524
+ params: /* @__PURE__ */ Struct({
5525
+ messages: /* @__PURE__ */ ArraySchema(SamplingMessage5),
5526
+ modelPreferences: /* @__PURE__ */ optional6(ModelPreferences2),
5527
+ systemPrompt: /* @__PURE__ */ optional6(String3),
5528
+ includeContext: /* @__PURE__ */ optional6(/* @__PURE__ */ Literals(["none", "thisServer", "allServers"])),
5529
+ temperature: /* @__PURE__ */ optional6(Finite),
5530
+ maxTokens: Int2,
5531
+ stopSequences: /* @__PURE__ */ optional6(/* @__PURE__ */ ArraySchema(String3)),
5532
+ metadata: /* @__PURE__ */ optional6(JsonObject),
5533
+ tools: /* @__PURE__ */ optional6(/* @__PURE__ */ ArraySchema(Tool6)),
5534
+ toolChoice: /* @__PURE__ */ optional6(ToolChoice2)
5535
+ })
5536
+ });
5537
+ var CreateMessageResult5 = /* @__PURE__ */ Struct({
5538
+ ...SamplingMessage5.fields,
5539
+ model: String3,
5540
+ stopReason: /* @__PURE__ */ optional6(String3)
5541
+ });
5542
+ var Root3 = Root2;
5543
+ var ListRootsRequest = /* @__PURE__ */ Struct({
5544
+ method: /* @__PURE__ */ Literal("roots/list"),
5545
+ params: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5546
+ _meta: Meta3
5547
+ }))
5548
+ });
5549
+ var ListRootsResult4 = /* @__PURE__ */ Struct({
5550
+ roots: /* @__PURE__ */ ArraySchema(Root3)
5551
+ });
5552
+ var StringSchema3 = StringSchema2;
5553
+ var NumberSchema3 = NumberSchema2;
5554
+ var BooleanSchema3 = BooleanSchema2;
5555
+ var SingleSelectEnumSchema2 = SingleSelectEnumSchema;
5556
+ var MultiSelectEnumSchema2 = MultiSelectEnumSchema;
5557
+ var LegacyTitledEnumSchema2 = LegacyTitledEnumSchema;
5558
+ var EnumSchema3 = /* @__PURE__ */ Union([LegacyTitledEnumSchema2, SingleSelectEnumSchema2, MultiSelectEnumSchema2]);
5559
+ var PrimitiveSchemaDefinition2 = /* @__PURE__ */ Union([EnumSchema3, StringSchema3, NumberSchema3, BooleanSchema3]);
5560
+ var RequestedSchema3 = /* @__PURE__ */ Struct({
5561
+ $schema: /* @__PURE__ */ optional6(String3),
5562
+ type: /* @__PURE__ */ Literal("object"),
5563
+ properties: /* @__PURE__ */ Record(String3, PrimitiveSchemaDefinition2),
5564
+ required: /* @__PURE__ */ optional6(/* @__PURE__ */ ArraySchema(String3))
5565
+ });
5566
+ var ElicitRequestFormParams2 = /* @__PURE__ */ Struct({
5567
+ mode: /* @__PURE__ */ optional6(/* @__PURE__ */ Literal("form")),
5568
+ message: String3,
5569
+ requestedSchema: RequestedSchema3
5570
+ });
5571
+ var ElicitRequestURLParams2 = /* @__PURE__ */ Struct({
5572
+ mode: /* @__PURE__ */ Literal("url"),
5573
+ message: String3,
5574
+ url: String3
5575
+ });
5576
+ var ElicitRequestParams2 = /* @__PURE__ */ Union([ElicitRequestFormParams2, ElicitRequestURLParams2]);
5577
+ var ElicitRequest = /* @__PURE__ */ Struct({
5578
+ method: /* @__PURE__ */ Literal("elicitation/create"),
5579
+ params: ElicitRequestParams2
5580
+ });
5581
+ var ElicitResult3 = /* @__PURE__ */ Struct({
5582
+ action: /* @__PURE__ */ Literals(["accept", "decline", "cancel"]),
5583
+ content: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Union([String3, Finite, Boolean3, /* @__PURE__ */ ArraySchema(String3)])))
5584
+ });
5585
+ var InputRequest = /* @__PURE__ */ Union([CreateMessageRequest, ListRootsRequest, ElicitRequest]);
5586
+ var InputResponse = /* @__PURE__ */ Union([CreateMessageResult5, ListRootsResult4, ElicitResult3]);
5587
+ var InputRequests = /* @__PURE__ */ Record(String3, InputRequest);
5588
+ var InputResponses = /* @__PURE__ */ Record(String3, InputResponse);
5589
+ var InputRequiredResultMeta = {
5590
+ _meta: ResultMetaObject,
5591
+ resultType: /* @__PURE__ */ Literal("input_required")
5592
+ };
5593
+ var InputRequiredResult = /* @__PURE__ */ Union([/* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5594
+ ...InputRequiredResultMeta,
5595
+ inputRequests: InputRequests,
5596
+ requestState: /* @__PURE__ */ optional6(String3)
5597
+ }), [JsonObject]), /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5598
+ ...InputRequiredResultMeta,
5599
+ inputRequests: /* @__PURE__ */ optional6(InputRequests),
5600
+ requestState: String3
5601
+ }), [JsonObject])]);
5602
+ var InputResponseRequestParams = {
5603
+ ...RequestParams.fields,
5604
+ inputResponses: /* @__PURE__ */ optional6(InputResponses),
5605
+ requestState: /* @__PURE__ */ optional6(String3)
5606
+ };
5607
+ var CacheableResult = {
5608
+ ...ResultMeta2,
5609
+ ttlMs: /* @__PURE__ */ Int2.check(/* @__PURE__ */ isGreaterThanOrEqualTo2(0)),
5610
+ cacheScope: /* @__PURE__ */ Literals(["public", "private"])
5611
+ };
5612
+ var PaginatedRequestParams = {
5613
+ ...RequestParams.fields,
5614
+ cursor: /* @__PURE__ */ optional6(String3)
5615
+ };
5616
+ var PaginatedResult2 = {
5617
+ ...ResultMeta2,
5618
+ nextCursor: /* @__PURE__ */ optional6(String3)
5619
+ };
5620
+ var DiscoverResult = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5621
+ ...CacheableResult,
5622
+ supportedVersions: /* @__PURE__ */ ArraySchema(String3),
5623
+ capabilities: ServerCapabilities4,
5624
+ instructions: /* @__PURE__ */ optional6(String3)
5625
+ }), [JsonObject]);
5626
+
5627
+ class Discover extends (/* @__PURE__ */ make2("server/discover", {
5628
+ success: DiscoverResult,
5629
+ error: McpError3,
5630
+ payload: RequestParams
5631
+ })) {
5632
+ }
5633
+ var ListResourcesResult4 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5634
+ ...PaginatedResult2,
5635
+ ...CacheableResult,
5636
+ resources: /* @__PURE__ */ ArraySchema(Resource4)
5637
+ }), [JsonObject]);
5638
+
5639
+ class ListResources4 extends (/* @__PURE__ */ make2("resources/list", {
5640
+ success: ListResourcesResult4,
5641
+ error: McpError3,
5642
+ payload: PaginatedRequestParams
5643
+ })) {
5644
+ }
5645
+ var ListResourceTemplatesResult4 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5646
+ ...PaginatedResult2,
5647
+ ...CacheableResult,
5648
+ resourceTemplates: /* @__PURE__ */ ArraySchema(ResourceTemplate4)
5649
+ }), [JsonObject]);
5650
+
5651
+ class ListResourceTemplates4 extends (/* @__PURE__ */ make2("resources/templates/list", {
5652
+ success: ListResourceTemplatesResult4,
5653
+ error: McpError3,
5654
+ payload: PaginatedRequestParams
5655
+ })) {
5656
+ }
5657
+ var ReadResourceResult3 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5658
+ ...CacheableResult,
5659
+ contents: /* @__PURE__ */ ArraySchema(ResourceContents3)
5660
+ }), [JsonObject]);
5661
+
5662
+ class ReadResource3 extends (/* @__PURE__ */ make2("resources/read", {
5663
+ success: /* @__PURE__ */ Union([ReadResourceResult3, InputRequiredResult]),
5664
+ error: McpError3,
5665
+ payload: {
5666
+ ...InputResponseRequestParams,
5667
+ uri: String3
5668
+ }
5669
+ })) {
5670
+ }
5671
+ var ListPromptsResult4 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5672
+ ...PaginatedResult2,
5673
+ ...CacheableResult,
5674
+ prompts: /* @__PURE__ */ ArraySchema(Prompt5)
5675
+ }), [JsonObject]);
5676
+
5677
+ class ListPrompts4 extends (/* @__PURE__ */ make2("prompts/list", {
5678
+ success: ListPromptsResult4,
5679
+ error: McpError3,
5680
+ payload: PaginatedRequestParams
5681
+ })) {
5682
+ }
5683
+ var GetPromptResult5 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5684
+ ...ResultMeta2,
5685
+ description: /* @__PURE__ */ optional6(String3),
5686
+ messages: /* @__PURE__ */ ArraySchema(PromptMessage5)
5687
+ }), [JsonObject]);
5688
+
5689
+ class GetPrompt5 extends (/* @__PURE__ */ make2("prompts/get", {
5690
+ success: /* @__PURE__ */ Union([GetPromptResult5, InputRequiredResult]),
5691
+ error: McpError3,
5692
+ payload: {
5693
+ ...InputResponseRequestParams,
5694
+ name: String3,
5695
+ arguments: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, String3))
5696
+ }
5697
+ })) {
5698
+ }
5699
+ var ListToolsResult5 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5700
+ ...PaginatedResult2,
5701
+ ...CacheableResult,
5702
+ tools: /* @__PURE__ */ ArraySchema(Tool6)
5703
+ }), [JsonObject]);
5704
+
5705
+ class ListTools5 extends (/* @__PURE__ */ make2("tools/list", {
5706
+ success: ListToolsResult5,
5707
+ error: McpError3,
5708
+ payload: PaginatedRequestParams
5709
+ })) {
5710
+ }
5711
+ var CallToolResult6 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5712
+ ...ResultMeta2,
5713
+ content: /* @__PURE__ */ ArraySchema(ContentBlock3),
5714
+ structuredContent: /* @__PURE__ */ optional6(Json),
5715
+ isError: /* @__PURE__ */ optional6(Boolean3)
5716
+ }), [JsonObject]);
5717
+
5718
+ class CallTool5 extends (/* @__PURE__ */ make2("tools/call", {
5719
+ success: /* @__PURE__ */ Union([CallToolResult6, InputRequiredResult]),
5720
+ error: McpError3,
5721
+ payload: {
5722
+ ...InputResponseRequestParams,
5723
+ name: String3,
5724
+ arguments: /* @__PURE__ */ optional6(JsonObject)
5725
+ }
5726
+ })) {
5727
+ }
5728
+ var PromptReference3 = PromptReference2;
5729
+ var ResourceTemplateReference2 = ResourceTemplateReference;
5730
+ var CompleteResult3 = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5731
+ ...ResultMeta2,
5732
+ completion: /* @__PURE__ */ Struct({
5733
+ values: /* @__PURE__ */ ArraySchema(String3).check(/* @__PURE__ */ isMaxLength(100)),
5734
+ total: /* @__PURE__ */ optional6(Int2),
5735
+ hasMore: /* @__PURE__ */ optional6(Boolean3)
5736
+ })
5737
+ }), [JsonObject]);
5738
+
5739
+ class Complete3 extends (/* @__PURE__ */ make2("completion/complete", {
5740
+ success: CompleteResult3,
5741
+ error: McpError3,
5742
+ payload: {
5743
+ ...RequestParams.fields,
5744
+ ref: /* @__PURE__ */ Union([PromptReference3, ResourceTemplateReference2]),
5745
+ argument: /* @__PURE__ */ Struct({
5746
+ name: String3,
5747
+ value: String3
5748
+ }),
5749
+ context: /* @__PURE__ */ optional6(/* @__PURE__ */ Struct({
5750
+ arguments: /* @__PURE__ */ optional6(/* @__PURE__ */ Record(String3, String3))
5751
+ }))
5752
+ }
5753
+ })) {
5754
+ }
5755
+ var SubscriptionFilter = /* @__PURE__ */ Struct({
5756
+ toolsListChanged: /* @__PURE__ */ optional6(Boolean3),
5757
+ promptsListChanged: /* @__PURE__ */ optional6(Boolean3),
5758
+ resourcesListChanged: /* @__PURE__ */ optional6(Boolean3),
5759
+ resourceSubscriptions: /* @__PURE__ */ optional6(/* @__PURE__ */ ArraySchema(String3))
5760
+ });
5761
+ var SubscriptionsListenResultMetaObject = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5762
+ "io.modelcontextprotocol/serverInfo": Implementation5,
5763
+ "io.modelcontextprotocol/subscriptionId": RequestId3
5764
+ }), [JsonObject]);
5765
+ var SubscriptionsListenResult = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
5766
+ _meta: SubscriptionsListenResultMetaObject,
5767
+ resultType: /* @__PURE__ */ Literal("complete")
5768
+ }), [JsonObject]);
5769
+
5770
+ class SubscriptionsListen extends (/* @__PURE__ */ make2("subscriptions/listen", {
5771
+ success: SubscriptionsListenResult,
5772
+ error: McpError3,
5773
+ payload: {
5774
+ ...RequestParams.fields,
5775
+ notifications: SubscriptionFilter
5776
+ }
5777
+ })) {
5778
+ }
5779
+
5780
+ class CancelledNotification3 extends (/* @__PURE__ */ make2("notifications/cancelled", {
5781
+ payload: {
5782
+ ...NotificationParams.fields,
5783
+ requestId: RequestId3,
5784
+ reason: /* @__PURE__ */ optional6(String3)
5785
+ }
5786
+ })) {
5787
+ }
5788
+
5789
+ class ProgressNotification4 extends (/* @__PURE__ */ make2("notifications/progress", {
5790
+ payload: {
5791
+ ...NotificationParams.fields,
5792
+ progressToken: ProgressToken2,
5793
+ progress: Finite,
5794
+ total: /* @__PURE__ */ optional6(Finite),
5795
+ message: /* @__PURE__ */ optional6(String3)
5796
+ }
5797
+ })) {
5798
+ }
5799
+
5800
+ class LoggingMessageNotification3 extends (/* @__PURE__ */ make2("notifications/message", {
5801
+ payload: {
5802
+ ...NotificationParams.fields,
5803
+ level: LoggingLevel3,
5804
+ logger: /* @__PURE__ */ optional6(String3),
5805
+ data: Json
5806
+ }
5807
+ })) {
5808
+ }
5809
+
5810
+ class ResourceUpdatedNotification3 extends (/* @__PURE__ */ make2("notifications/resources/updated", {
5811
+ payload: {
5812
+ ...NotificationParams.fields,
5813
+ uri: String3
5814
+ }
5815
+ })) {
5816
+ }
5817
+
5818
+ class ResourceListChangedNotification3 extends (/* @__PURE__ */ make2("notifications/resources/list_changed", {
5819
+ payload: /* @__PURE__ */ UndefinedOr(NotificationParams)
5820
+ })) {
5821
+ }
5822
+
5823
+ class ToolListChangedNotification3 extends (/* @__PURE__ */ make2("notifications/tools/list_changed", {
5824
+ payload: /* @__PURE__ */ UndefinedOr(NotificationParams)
5825
+ })) {
5826
+ }
5827
+
5828
+ class PromptListChangedNotification3 extends (/* @__PURE__ */ make2("notifications/prompts/list_changed", {
5829
+ payload: /* @__PURE__ */ UndefinedOr(NotificationParams)
5830
+ })) {
5831
+ }
5832
+
5833
+ class SubscriptionsAcknowledgedNotification extends (/* @__PURE__ */ make2("notifications/subscriptions/acknowledged", {
5834
+ payload: {
5835
+ ...NotificationParams.fields,
5836
+ notifications: SubscriptionFilter
5837
+ }
5838
+ })) {
5839
+ }
5840
+
5841
+ class ClientRequestRpcs9 extends (/* @__PURE__ */ make3(Discover, Complete3, GetPrompt5, ListPrompts4, ListResources4, ListResourceTemplates4, ReadResource3, SubscriptionsListen, CallTool5, ListTools5)) {
5842
+ }
5843
+
5844
+ class ClientNotificationRpcs5 extends (/* @__PURE__ */ make3(CancelledNotification3)) {
5845
+ }
5846
+
5847
+ class ClientRpcs5 extends (/* @__PURE__ */ ClientRequestRpcs9.merge(ClientNotificationRpcs5)) {
5848
+ }
5849
+
5850
+ class ServerRequestRpcs5 extends (/* @__PURE__ */ make3()) {
5851
+ }
5852
+
5853
+ class ServerNotificationRpcs6 extends (/* @__PURE__ */ make3(CancelledNotification3, ProgressNotification4, LoggingMessageNotification3, ResourceUpdatedNotification3, ResourceListChangedNotification3, ToolListChangedNotification3, PromptListChangedNotification3, SubscriptionsAcknowledgedNotification)) {
5854
+ }
5855
+
5856
+ // node_modules/effect/dist/ai/internal/mcpProtocol/v2026_07_28.js
5857
+ var InputResponses2 = /* @__PURE__ */ Record(String3, JsonObject);
5858
+ var decodeRequestMetadata = /* @__PURE__ */ decodeUnknownEffect2(RequestMetaObject);
5859
+ var decodeCancellation = /* @__PURE__ */ decodeUnknownEffect2(CancelledNotification3.payloadSchema);
5860
+ var isJson = /* @__PURE__ */ is(Json);
5861
+ var encodeImplementation = /* @__PURE__ */ encodeEffect(Implementation5);
5862
+ var MAX_PENDING_SUBSCRIPTION_NOTIFICATIONS = 64;
5863
+ var omitUndefined = (value) => {
5864
+ const result = {};
5865
+ for (const key in value) {
5866
+ if (value[key] !== undefined) {
5867
+ result[key] = value[key];
5868
+ }
5869
+ }
5870
+ return result;
5871
+ };
5872
+ var parameterHeaderMatches = (header, argument) => {
5873
+ if (isNullish(argument)) {
5874
+ return header === undefined;
5875
+ }
5876
+ if (header === undefined) {
5877
+ return false;
5878
+ }
5879
+ const decoded = decodeRoutingHeader(header);
5880
+ if (decoded === undefined) {
5881
+ return false;
5882
+ }
5883
+ return value2(argument).pipe(when2(string, (argument) => decoded === argument), when2(boolean, (argument) => decoded === String(argument)), when2(number, (argument) => Number.isSafeInteger(argument) && decoded.trim().length > 0 && Number(decoded) === argument), orElse(() => false));
5884
+ };
5885
+ var profileFromRequestMetadata = /* @__PURE__ */ fnUntraced(function* (metadata) {
5886
+ const requestMetadata = yield* decodeRequestMetadata(metadata);
5887
+ return {
5888
+ protocolVersion: protocolVersion5,
5889
+ clientCapabilities: requestMetadata["io.modelcontextprotocol/clientCapabilities"],
5890
+ clientInfo: requestMetadata["io.modelcontextprotocol/clientInfo"],
5891
+ requestMetadata
5892
+ };
5893
+ });
5894
+ var resultMetadata = (value, serverInfo) => {
5895
+ const metadata = value._meta;
5896
+ return {
5897
+ ...isReadonlyObject(metadata) ? metadata : {},
5898
+ "io.modelcontextprotocol/serverInfo": serverInfo
5899
+ };
5900
+ };
5901
+ var projectInputRequired = (outcome, serverInfo) => omitUndefined({
5902
+ _meta: {
5903
+ "io.modelcontextprotocol/serverInfo": serverInfo
5904
+ },
5905
+ resultType: "input_required",
5906
+ inputRequests: outcome.inputRequests,
5907
+ requestState: outcome.requestState
5908
+ });
5909
+ var decodeCallToolOutcome = /* @__PURE__ */ decodeUnknownEffect2(/* @__PURE__ */ Union([CallToolResult6, InputRequiredResult]));
5910
+ var projectCallToolOutcome = /* @__PURE__ */ fnUntraced(function* (outcome, serverInfo) {
5911
+ const encodedServerInfo = yield* encodeImplementation(serverInfo);
5912
+ if (outcome._tag === "Complete") {
5913
+ return yield* decodeCallToolOutcome({
5914
+ ...omitUndefined(outcome.value),
5915
+ _meta: resultMetadata(outcome.value, encodedServerInfo),
5916
+ resultType: "complete"
5917
+ });
5918
+ }
5919
+ return yield* decodeCallToolOutcome(projectInputRequired(outcome, encodedServerInfo));
5920
+ });
5921
+ var requiredCapabilitiesForInputRequests = (inputRequests, capabilities) => {
5922
+ const required = {};
5923
+ for (const request of Object.values(inputRequests ?? {})) {
5924
+ value2(request).pipe(when2({
5925
+ method: "roots/list"
5926
+ }, () => {
5927
+ if (capabilities.roots === undefined)
5928
+ required.roots = {};
5929
+ }), when2({
5930
+ method: "sampling/createMessage"
5931
+ }, (request) => {
5932
+ const sampling = required.sampling ?? {};
5933
+ if (samplingRequestRequiresTools(request.params) && capabilities.sampling?.tools === undefined) {
5934
+ sampling.tools = {};
5935
+ }
5936
+ if ((request.params.includeContext === "thisServer" || request.params.includeContext === "allServers") && capabilities.sampling?.context === undefined) {
5937
+ sampling.context = {};
5938
+ }
5939
+ if (capabilities.sampling === undefined || Object.keys(sampling).length > 0)
5940
+ required.sampling = sampling;
5941
+ }), when2({
5942
+ method: "elicitation/create"
5943
+ }, (request) => {
5944
+ const mode = request.params.mode === "url" ? "url" : "form";
5945
+ const elicitation = capabilities.elicitation;
5946
+ const supportsMode = elicitation !== undefined && (mode === "url" ? elicitation.url !== undefined : elicitation.form !== undefined || Object.keys(elicitation).length === 0);
5947
+ if (!supportsMode)
5948
+ (required.elicitation ??= {})[mode] = {};
5949
+ }), exhaustive);
5950
+ }
5951
+ return required;
5952
+ };
5953
+ var projectResourceContents3 = (resource) => omitUndefined({
5954
+ uri: resource.uri,
5955
+ mimeType: resource.mimeType,
5956
+ _meta: resource._meta,
5957
+ ..."text" in resource ? {
5958
+ text: resource.text
5959
+ } : {
5960
+ blob: encode(resource.blob)
5961
+ }
5962
+ });
5963
+ var projectContent5 = /* @__PURE__ */ type().pipe(/* @__PURE__ */ when2({
5964
+ type: /* @__PURE__ */ is2("text", "resource_link")
5965
+ }, (content) => content), /* @__PURE__ */ when2({
5966
+ type: /* @__PURE__ */ is2("image", "audio")
5967
+ }, (content) => omitUndefined({
5968
+ type: content.type,
5969
+ mimeType: content.mimeType,
5970
+ data: encode(content.data),
5971
+ annotations: content.annotations,
5972
+ _meta: content._meta
5973
+ })), /* @__PURE__ */ when2({
5974
+ type: "resource"
5975
+ }, (content) => omitUndefined({
5976
+ type: "resource",
5977
+ resource: projectResourceContents3(content.resource),
5978
+ annotations: content.annotations,
5979
+ _meta: content._meta
5980
+ })), exhaustive);
5981
+ var projectResource = (resource) => Resource4.make(resource);
5982
+ var projectResourceTemplate = (resourceTemplate) => ResourceTemplate4.make(resourceTemplate);
5983
+ var projectPrompt = (prompt) => transcode(Prompt, Prompt5, prompt);
5984
+ var projectTool = (tool) => transcode(Tool, Tool6, tool);
5985
+ var privateStaleCache = {
5986
+ ttlMs: 0,
5987
+ cacheScope: "private"
5988
+ };
5989
+ var projectCompleteResult = /* @__PURE__ */ fnUntraced(function* (value, serverInfo) {
5990
+ const encodedServerInfo = yield* encodeImplementation(serverInfo);
5991
+ return {
5992
+ ...omitUndefined(value),
5993
+ _meta: resultMetadata(value, encodedServerInfo),
5994
+ resultType: "complete"
5995
+ };
5996
+ });
5997
+ var matchedProtocolError = /* @__PURE__ */ type().pipe(/* @__PURE__ */ tag2("ResourceNotFound", (error) => new ProtocolError({
5998
+ code: INVALID_PARAMS,
5999
+ message: `Resource '${error.uri}' not found`,
6000
+ data: {
6001
+ uri: error.uri
6002
+ }
6003
+ })), /* @__PURE__ */ tag2("ToolNotFound", "InvalidToolInput", "InvalidToolContinuation", "ToolExecutionError", "UnsupportedByProtocol", ProtocolError.fromTool), /* @__PURE__ */ orElse(ProtocolError.fromFeature));
6004
+ var projectError = (error) => {
6005
+ const protocolError = matchedProtocolError(error);
6006
+ return McpError3.make({
6007
+ code: protocolError.code,
6008
+ message: protocolError.message,
6009
+ ...isJson(protocolError.data) ? {
6010
+ data: protocolError.data
6011
+ } : {}
6012
+ });
6013
+ };
6014
+ var failWithHttpStatus = /* @__PURE__ */ fnUntraced(function* (status, error) {
6015
+ const request = yield* serviceOption(HttpServerRequest);
6016
+ if (isSome(request)) {
6017
+ appendPreResponseHandlerUnsafe2(request.value, (_request, response) => succeed6(setStatus(response, status)));
6018
+ }
6019
+ return yield* error;
6020
+ });
6021
+ var normalizeCancellation = (payload) => decodeCancellation(payload).pipe(map5((request) => ({
6022
+ requestId: request.requestId,
6023
+ reason: request.reason,
6024
+ metadata: request._meta
6025
+ })));
6026
+ var unsupported5 = (operation) => new McpReverseOperationUnsupported({
6027
+ operation,
6028
+ protocolVersion: protocolVersion5,
6029
+ reason: "MCP 2026-07-28 carries server input requests in multi round-trip results"
6030
+ });
6031
+ var handlerRpcs = /* @__PURE__ */ ClientRequestRpcs9.merge(ClientNotificationRpcs5);
6032
+ var makeHandlers = (core, _lifecycle, context) => {
6033
+ const decodeInputResponses = decodeUnknownEffect2(InputResponses2);
6034
+ const decodeDiscoverResult = decodeUnknownEffect2(DiscoverResult);
6035
+ const decodeListResourcesResult = decodeUnknownEffect2(ListResourcesResult4);
6036
+ const decodeListResourceTemplatesResult = decodeUnknownEffect2(ListResourceTemplatesResult4);
6037
+ const decodeReadResourceResult = decodeUnknownEffect2(ReadResourceResult3);
6038
+ const decodeListPromptsResult = decodeUnknownEffect2(ListPromptsResult4);
6039
+ const decodeGetPromptResult = decodeUnknownEffect2(GetPromptResult5);
6040
+ const decodePromptOutcome = decodeUnknownEffect2(Union([GetPromptResult5, InputRequiredResult]));
6041
+ const decodeCompleteResult = decodeUnknownEffect2(CompleteResult3);
6042
+ const decodeListToolsResult = decodeUnknownEffect2(ListToolsResult5);
6043
+ const sendNotification = context.sendNotification;
6044
+ const supportsSubscriptions = sendNotification !== undefined;
6045
+ const extensions = context.serverInfo.extensions === undefined ? undefined : filter(context.serverInfo.extensions, (value) => isReadonlyObject(value));
6046
+ const getDiscovery = map5(context.registrationPresence, (presence) => {
6047
+ const capabilities = {
6048
+ completions: {},
6049
+ logging: {}
6050
+ };
6051
+ if (extensions !== undefined)
6052
+ capabilities.extensions = extensions;
6053
+ if (presence.tools)
6054
+ capabilities.tools = {
6055
+ listChanged: supportsSubscriptions
6056
+ };
6057
+ if (presence.resources) {
6058
+ capabilities.resources = {
6059
+ listChanged: supportsSubscriptions,
6060
+ subscribe: supportsSubscriptions
6061
+ };
6062
+ }
6063
+ if (presence.prompts)
6064
+ capabilities.prompts = {
6065
+ listChanged: supportsSubscriptions
6066
+ };
6067
+ return {
6068
+ supportedVersions: context.supportedVersions,
6069
+ capabilities,
6070
+ serverInfo: context.serverInfo
6071
+ };
6072
+ });
6073
+ const getInvocation = McpRequestContext.useSync(invocationFromRequestContext);
6074
+ const getInputInvocation = fnUntraced(function* (request) {
6075
+ const context = yield* McpRequestContext;
6076
+ const inputResponses = request.inputResponses === undefined ? undefined : yield* decodeInputResponses(request.inputResponses).pipe(orDie);
6077
+ return invocationFromRequestContext(McpRequestContext.of({
6078
+ ...context,
6079
+ inputResponses,
6080
+ requestState: request.requestState
6081
+ }));
6082
+ });
6083
+ const validateInputRequestCapabilities = fnUntraced(function* (inputRequired, capabilities) {
6084
+ const requiredCapabilities = requiredCapabilitiesForInputRequests(inputRequired.inputRequests, capabilities);
6085
+ if (Object.keys(requiredCapabilities).length === 0) {
6086
+ return;
6087
+ }
6088
+ return yield* failWithHttpStatus(400, new ProtocolError({
6089
+ code: MISSING_REQUIRED_CLIENT_CAPABILITY,
6090
+ message: "The request requires client capabilities that were not declared",
6091
+ data: {
6092
+ requiredCapabilities
6093
+ }
6094
+ }));
6095
+ });
6096
+ return {
6097
+ "subscriptions/listen": fnUntraced(function* (request, {
6098
+ client,
6099
+ requestId
6100
+ }) {
6101
+ if (sendNotification === undefined) {
6102
+ return yield* new ProtocolError({
6103
+ code: METHOD_NOT_FOUND,
6104
+ message: "Method not found: subscriptions/listen"
6105
+ });
6106
+ }
6107
+ const presence = yield* context.registrationPresence;
6108
+ const eventsScope = yield* fork(yield* scope);
6109
+ const events = yield* provide(context.subscribeServerNotifications, eventsScope);
6110
+ const honored = {
6111
+ ...presence.tools && request.notifications.toolsListChanged === true ? {
6112
+ toolsListChanged: true
6113
+ } : {},
6114
+ ...presence.prompts && request.notifications.promptsListChanged === true ? {
6115
+ promptsListChanged: true
6116
+ } : {},
6117
+ ...presence.resources && request.notifications.resourcesListChanged === true ? {
6118
+ resourcesListChanged: true
6119
+ } : {},
6120
+ ...presence.resources && request.notifications.resourceSubscriptions !== undefined ? {
6121
+ resourceSubscriptions: request.notifications.resourceSubscriptions
6122
+ } : {}
6123
+ };
6124
+ const subscriptionMetadata = {
6125
+ "io.modelcontextprotocol/subscriptionId": requestId
6126
+ };
6127
+ const resourceSubscriptions = new Set(honored.resourceSubscriptions);
6128
+ const pending = yield* dropping(MAX_PENDING_SUBSCRIPTION_NOTIFICATIONS);
6129
+ const overflowed = yield* make5();
6130
+ yield* gen(function* () {
6131
+ while (true) {
6132
+ const event = yield* take4(events);
6133
+ if (event.targetClientId !== undefined && event.targetClientId !== client.id) {
6134
+ continue;
6135
+ }
6136
+ const notification = event.notification;
6137
+ const rpc = value2(notification).pipe(tags({
6138
+ ToolsChanged: () => honored.toolsListChanged === true ? ToolListChangedNotification3 : undefined,
6139
+ PromptsChanged: () => honored.promptsListChanged === true ? PromptListChangedNotification3 : undefined,
6140
+ ResourcesChanged: () => honored.resourcesListChanged === true ? ResourceListChangedNotification3 : undefined,
6141
+ ResourceUpdated: (notification) => resourceSubscriptions.has(notification.uri) ? ResourceUpdatedNotification3 : undefined
6142
+ }), exhaustive);
6143
+ if (rpc === undefined) {
6144
+ continue;
6145
+ }
6146
+ const projected = {
6147
+ tag: rpc._tag,
6148
+ payload: rpc.payloadSchema.make({
6149
+ _meta: {
6150
+ ...notification.metadata,
6151
+ ...subscriptionMetadata
6152
+ },
6153
+ ...notification._tag === "ResourceUpdated" ? {
6154
+ uri: notification.uri
6155
+ } : {}
6156
+ })
6157
+ };
6158
+ if (!(yield* offer(pending, projected))) {
6159
+ break;
6160
+ }
6161
+ }
6162
+ }).pipe(use(eventsScope), andThen(suspend2(() => context.markSubscriptionCancelled?.(client.id, requestId) ?? void_3)), andThen(succeed4(overflowed, undefined)), forkScoped);
6163
+ yield* sendNotification(protocolVersion5, client.id, {
6164
+ tag: SubscriptionsAcknowledgedNotification._tag,
6165
+ payload: SubscriptionsAcknowledgedNotification.payloadSchema.make({
6166
+ _meta: subscriptionMetadata,
6167
+ notifications: honored
6168
+ })
6169
+ });
6170
+ const deliver = forever(take3(pending).pipe(flatMap3((notification) => sendNotification(protocolVersion5, client.id, notification))));
6171
+ yield* race(deliver, _await(overflowed));
6172
+ yield* context.terminateSubscription?.(protocolVersion5, client.id, requestId, "Pending notification limit exceeded") ?? void_3;
6173
+ const encodedServerInfo = yield* encodeImplementation(context.serverInfo);
6174
+ return SubscriptionsListenResult.make({
6175
+ _meta: {
6176
+ ...subscriptionMetadata,
6177
+ "io.modelcontextprotocol/serverInfo": encodedServerInfo
6178
+ },
6179
+ resultType: "complete"
6180
+ });
6181
+ }, mapError(projectError)),
6182
+ "server/discover": fnUntraced(function* (_request) {
6183
+ const discovery = yield* getDiscovery;
6184
+ const result = yield* projectCompleteResult({
6185
+ ...privateStaleCache,
6186
+ supportedVersions: Array.from(discovery.supportedVersions),
6187
+ capabilities: discovery.capabilities,
6188
+ instructions: context.serverInfo.instructions
6189
+ }, context.serverInfo);
6190
+ return yield* decodeDiscoverResult(result);
6191
+ }, mapError(projectError)),
6192
+ "resources/list": fnUntraced(function* (_request) {
6193
+ const invocation = yield* getInvocation;
6194
+ const resources = yield* core.resources.list(invocation.protocol);
6195
+ const result = yield* projectCompleteResult({
6196
+ ...privateStaleCache,
6197
+ resources: resources.map(projectResource)
6198
+ }, context.serverInfo);
6199
+ return yield* decodeListResourcesResult(result);
6200
+ }, mapError(projectError)),
6201
+ "resources/templates/list": fnUntraced(function* (_request) {
6202
+ const invocation = yield* getInvocation;
6203
+ const resourceTemplates = yield* core.resources.listTemplates(invocation.protocol);
6204
+ const result = yield* projectCompleteResult({
6205
+ ...privateStaleCache,
6206
+ resourceTemplates: resourceTemplates.map(projectResourceTemplate)
6207
+ }, context.serverInfo);
6208
+ return yield* decodeListResourceTemplatesResult(result);
6209
+ }, mapError(projectError)),
6210
+ "resources/read": fnUntraced(function* (request) {
6211
+ const invocation = yield* getInputInvocation(request);
6212
+ const read = yield* core.resources.read(request.uri, invocation);
6213
+ const contents = read.contents.map(projectResourceContents3);
6214
+ const result = yield* projectCompleteResult({
6215
+ ...privateStaleCache,
6216
+ contents,
6217
+ _meta: read._meta
6218
+ }, context.serverInfo);
6219
+ return yield* decodeReadResourceResult(result);
6220
+ }, mapError(projectError)),
6221
+ "prompts/list": fnUntraced(function* (_request) {
6222
+ const presence = yield* context.registrationPresence;
6223
+ if (!presence.prompts) {
6224
+ return yield* failWithHttpStatus(404, new ProtocolError({
6225
+ code: METHOD_NOT_FOUND_ERROR_CODE,
6226
+ message: "Method not found"
6227
+ }));
6228
+ }
6229
+ const invocation = yield* getInvocation;
6230
+ const prompts = yield* core.prompts.list(invocation.protocol);
6231
+ const projectedPrompts = yield* forEach(prompts, projectPrompt);
6232
+ const result = yield* projectCompleteResult({
6233
+ ...privateStaleCache,
6234
+ prompts: projectedPrompts
6235
+ }, context.serverInfo);
6236
+ return yield* decodeListPromptsResult(result);
6237
+ }, mapError(projectError)),
6238
+ "prompts/get": fnUntraced(function* (request) {
6239
+ const invocation = yield* getInputInvocation(request);
6240
+ const outcome = yield* core.prompts.get(request.name, request.arguments ?? {}, invocation);
6241
+ if (outcome._tag === "InputRequired") {
6242
+ yield* validateInputRequestCapabilities(outcome, invocation.protocol.clientCapabilities);
6243
+ const encodedServerInfo = yield* encodeImplementation(context.serverInfo);
6244
+ return yield* decodePromptOutcome(projectInputRequired(outcome, encodedServerInfo));
6245
+ }
6246
+ const prompt = outcome.value;
6247
+ const messages = prompt.messages.map((message) => ({
6248
+ role: message.role,
6249
+ content: projectContent5(message.content)
6250
+ }));
6251
+ const result = yield* projectCompleteResult({
6252
+ description: prompt.description,
6253
+ messages,
6254
+ _meta: prompt._meta
6255
+ }, context.serverInfo);
6256
+ return yield* decodeGetPromptResult(result);
6257
+ }, mapError(projectError)),
6258
+ "completion/complete": fnUntraced(function* (request) {
6259
+ const invocation = yield* getInvocation;
6260
+ const completion = yield* core.completions.complete({
6261
+ reference: request.ref.type === "ref/prompt" ? {
6262
+ type: "prompt",
6263
+ name: request.ref.name,
6264
+ title: request.ref.title
6265
+ } : {
6266
+ type: "resourceTemplate",
6267
+ uriTemplate: request.ref.uri
6268
+ },
6269
+ argument: request.argument,
6270
+ context: request.context?.arguments === undefined ? undefined : {
6271
+ arguments: request.context.arguments
6272
+ },
6273
+ metadata: request._meta
6274
+ }, invocation);
6275
+ const result = yield* projectCompleteResult({
6276
+ completion: omitUndefined({
6277
+ values: Array.from(completion.values),
6278
+ total: completion.total,
6279
+ hasMore: completion.hasMore
6280
+ }),
6281
+ _meta: completion.metadata
6282
+ }, context.serverInfo);
6283
+ return yield* decodeCompleteResult(result);
6284
+ }, mapError(projectError)),
6285
+ "tools/list": fnUntraced(function* (_request) {
6286
+ const invocation = yield* getInvocation;
6287
+ const tools = yield* core.tools.list(invocation.protocol);
6288
+ const projectedTools = yield* forEach(tools, projectTool);
6289
+ const result = yield* projectCompleteResult({
6290
+ ...privateStaleCache,
6291
+ tools: projectedTools
6292
+ }, context.serverInfo);
6293
+ return yield* decodeListToolsResult(result);
6294
+ }, mapError(projectError)),
6295
+ "tools/call": fnUntraced(function* (request) {
6296
+ const invocation = yield* getInputInvocation(request);
6297
+ const tool = (yield* core.tools.list(invocation.protocol)).find((tool) => tool.name === request.name);
6298
+ const httpRequest = yield* serviceOption(HttpServerRequest);
6299
+ if (tool !== undefined && isSome(httpRequest)) {
6300
+ const pending = [{
6301
+ schema: tool.inputSchema,
6302
+ argument: request.arguments,
6303
+ path: ""
6304
+ }];
6305
+ while (pending.length > 0) {
6306
+ const {
6307
+ schema,
6308
+ argument,
6309
+ path
6310
+ } = pending.pop();
6311
+ if (!isReadonlyObject(schema))
6312
+ continue;
6313
+ const annotation = schema["x-mcp-header"];
6314
+ if (typeof annotation === "string") {
6315
+ const headerName = `mcp-param-${annotation.toLowerCase()}`;
6316
+ if (!parameterHeaderMatches(httpRequest.value.headers[headerName], argument)) {
6317
+ return yield* failWithHttpStatus(400, new ProtocolError({
6318
+ code: HEADER_MISMATCH_ERROR_CODE,
6319
+ message: `${headerName} does not match argument '${path}'`
6320
+ }));
6321
+ }
6322
+ }
6323
+ if (isReadonlyObject(schema.properties)) {
6324
+ for (const [name, property] of Object.entries(schema.properties)) {
6325
+ pending.push({
6326
+ schema: property,
6327
+ argument: isReadonlyObject(argument) && Object.hasOwn(argument, name) ? argument[name] : undefined,
6328
+ path: path === "" ? name : `${path}.${name}`
6329
+ });
6330
+ }
6331
+ }
6332
+ }
6333
+ }
6334
+ const outcome = yield* core.tools.call({
6335
+ name: request.name,
6336
+ arguments: request.arguments ?? {}
6337
+ }, invocation).pipe(catchTag(["ToolExecutionError", "InvalidToolInput"], (error) => succeed6(OperationOutcome.Complete(CallToolResult.make({
6338
+ content: [TextContent.make({
6339
+ type: "text",
6340
+ text: error.message
6341
+ })],
6342
+ isError: true
6343
+ })))));
6344
+ if (outcome._tag === "InputRequired") {
6345
+ yield* validateInputRequestCapabilities(outcome, invocation.protocol.clientCapabilities);
6346
+ return yield* projectCallToolOutcome(outcome, context.serverInfo);
6347
+ }
6348
+ const toolResult = outcome.value;
6349
+ const content = toolResult.content.map(projectContent5);
6350
+ return yield* projectCallToolOutcome(OperationOutcome.Complete({
6351
+ content,
6352
+ structuredContent: toolResult.structuredContent,
6353
+ isError: toolResult.isError,
6354
+ _meta: toolResult._meta
6355
+ }), context.serverInfo);
6356
+ }, mapError(projectError)),
6357
+ "notifications/cancelled": fnUntraced(function* (_request) {
6358
+ return yield* void_3;
6359
+ })
6360
+ };
6361
+ };
6362
+ var runtime = {
6363
+ _tag: "Stateless",
6364
+ transport: {
6365
+ jsonRpc: {
6366
+ acceptsBatches: false
6367
+ },
6368
+ http: {}
6369
+ },
6370
+ profileFromRequestMetadata
6371
+ };
6372
+ var protocol5 = /* @__PURE__ */ make13({
6373
+ protocolVersion: protocolVersion5,
6374
+ runtime,
6375
+ clientRpcs: ClientRpcs5,
6376
+ clientNotificationRpcs: ClientNotificationRpcs5,
6377
+ serverRequestRpcs: ServerRequestRpcs5,
6378
+ serverNotificationRpcs: ServerNotificationRpcs6,
6379
+ handlerRpcs,
6380
+ makeHandlers,
6381
+ toReverseClient: () => ({
6382
+ listRoots: () => fail4(unsupported5("roots/list")),
6383
+ createMessage: () => fail4(unsupported5("sampling/createMessage")),
6384
+ elicit: () => fail4(unsupported5("elicitation/create"))
6385
+ }),
6386
+ projectNotification: (notification) => isSubscriptionServerNotification(notification) ? succeed6(undefined) : makeNotificationProjector({
6387
+ supportsProgressMessage: true
6388
+ }, notification),
6389
+ normalizeCancellation
6390
+ });
6391
+
5319
6392
  // node_modules/effect/dist/ai/McpProtocol.js
5320
- var v2025_11_25 = protocol4;
6393
+ var v2026_07_28 = protocol5;
6394
+ var v2025_11_252 = protocol4;
5321
6395
  var v2025_06_182 = protocol3;
5322
6396
  var v2025_03_262 = protocol2;
5323
6397
  var v2024_11_052 = protocol;
@@ -8500,7 +9574,7 @@ var registerTools = gen(function* () {
8500
9574
  var mcpServerLayer = layerStdio({
8501
9575
  name: "browse",
8502
9576
  version: opencodeBrowserVersion2,
8503
- protocols: [v2025_06_182, v2025_11_25, v2025_03_262, v2024_11_052]
9577
+ protocols: [v2026_07_28, v2025_11_252, v2025_06_182, v2025_03_262, v2024_11_052]
8504
9578
  });
8505
9579
  var mcpToolsLayer = effectDiscard(registerTools);
8506
9580
  var runMcpServer = launch(mcpToolsLayer.pipe(provide2(mcpServerLayer), provide2(layer), provide2(layerFetchMcp)));