@opencode/browse 0.0.15-dev.98 → 0.0.16-dev.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/dist/{Undici-88kyhfpm.mjs → Undici-mxpvn7gy.mjs} +1 -1
  2. package/dist/{cli-yw23xxk6.mjs → cli-w2fh82cm.mjs} +136 -132
  3. package/dist/cli.mjs +17 -16
  4. package/dist/{helpers-5bz1ykzf.mjs → helpers-sqdncq18.mjs} +4 -2
  5. package/dist/{index-yzz55kxm.mjs → index-6gkr235e.mjs} +1 -1
  6. package/dist/main-1v5qj3tz.mjs +4 -0
  7. package/dist/{main-nf4p3mes.mjs → main-2k6722hd.mjs} +25 -11
  8. package/dist/{main-x58yhgrq.mjs → main-2wkmdtb5.mjs} +3 -3
  9. package/dist/main-4dvs5xfg.mjs +1694 -0
  10. package/dist/{main-z0a00g4g.mjs → main-6w2gc76b.mjs} +2 -2
  11. package/dist/{main-y2e9e5kz.mjs → main-7pybhksm.mjs} +2 -2
  12. package/dist/main-7tnwdkrz.mjs +1274 -0
  13. package/dist/{main-br0znez7.mjs → main-8a08z3ad.mjs} +2 -2
  14. package/dist/main-9t2s5ptx.mjs +5405 -0
  15. package/dist/{main-n0qm6500.mjs → main-ak8d0t3n.mjs} +57 -10
  16. package/dist/{main-vgzr4689.mjs → main-azpzpy0x.mjs} +1 -1
  17. package/dist/main-ckssvk4c.mjs +18 -0
  18. package/dist/{main-sr7x6ex2.mjs → main-ddvq4m1x.mjs} +4 -4
  19. package/dist/{main-8z9d979q.mjs → main-er120rjm.mjs} +2 -2
  20. package/dist/{main-yf9xhpn4.mjs → main-ken6azcs.mjs} +2 -2
  21. package/dist/{main-hz7wj5ze.mjs → main-sfq88bty.mjs} +67 -58
  22. package/dist/{main-csnx585b.mjs → main-yf5j8g79.mjs} +2800 -8017
  23. package/dist/{mcp-q0wgd05d.mjs → mcp-3pte9nv0.mjs} +418 -414
  24. package/dist/{migrate-tmsm0mc7.mjs → migrate-53d11s9h.mjs} +11 -14
  25. package/dist/{relay-pg3r3re0.mjs → relay-0qp40nxq.mjs} +1229 -408
  26. package/dist/{runtime-update-65ffn31x.mjs → runtime-update-5vem027v.mjs} +7 -6
  27. package/dist/{setup-wkp99mwd.mjs → setup-sb36xpjf.mjs} +30 -20
  28. package/dist/{skill-text-28va391t.mjs → skill-text-v0etv8b7.mjs} +20 -8
  29. package/dist/{supervisor-p0agjsxt.mjs → supervisor-xfdqs9g3.mjs} +5 -5
  30. package/dist/{update-rrk7rh0w.mjs → update-93baztt2.mjs} +3 -3
  31. package/dist/{version-t3shmxrb.mjs → version-eggebgzz.mjs} +1 -1
  32. package/package.json +1 -1
  33. package/skills/browse/SKILL.md +20 -8
  34. package/dist/main-630yypmy.mjs +0 -2924
  35. package/dist/main-bccm3dk2.mjs +0 -4
@@ -0,0 +1,1694 @@
1
+ import {
2
+ SessionDeleted,
3
+ ExecuteLogEntry,
4
+ ExecuteLogSummary,
5
+ ExecuteAftermath,
6
+ ExtensionStatus,
7
+ RelayVersion,
8
+ AuthProfileSummary,
9
+ RecordingQuality,
10
+ SettingsGetResponse,
11
+ SettingsSetResponse,
12
+ parseTargetSelection2,
13
+ getObject2,
14
+ getString2
15
+ } from "./main-sfq88bty.mjs";
16
+ import {
17
+ isStream,
18
+ provideContext
19
+ } from "./main-9t2s5ptx.mjs";
20
+ import {
21
+ getStackTraceLimit,
22
+ setStackTraceLimit,
23
+ none,
24
+ some,
25
+ isSome,
26
+ fromUndefinedOr,
27
+ flatMap,
28
+ Service2,
29
+ makeUnsafe3,
30
+ empty4,
31
+ make9,
32
+ add,
33
+ getOrUndefinedUnsafe,
34
+ merge2,
35
+ TaggedError,
36
+ StackTrace,
37
+ effectContext,
38
+ isEffect,
39
+ succeed6,
40
+ sync2,
41
+ gen,
42
+ fail6,
43
+ context2,
44
+ contextWith,
45
+ provide3,
46
+ fnUntraced,
47
+ passthrough,
48
+ transformOptional,
49
+ withDefault2,
50
+ declare,
51
+ encodeUnknownOption,
52
+ make12,
53
+ isSchema,
54
+ optionalKey,
55
+ optional,
56
+ toType,
57
+ Literal,
58
+ TemplateLiteral,
59
+ Never,
60
+ Any,
61
+ Unknown,
62
+ String3,
63
+ Number2,
64
+ Boolean3,
65
+ Void,
66
+ Struct,
67
+ fieldsAssign,
68
+ Record,
69
+ StructWithRest,
70
+ ArraySchema,
71
+ Union,
72
+ Literals,
73
+ UndefinedOr,
74
+ decodeTo2,
75
+ decode2,
76
+ withConstructorDefault,
77
+ tag2,
78
+ Opaque,
79
+ Finite,
80
+ isBetween,
81
+ Int2,
82
+ Defect,
83
+ Uint8ArrayFromBase64,
84
+ Exit,
85
+ Class3,
86
+ Error3,
87
+ toJsonSchemaDocument,
88
+ Json,
89
+ JsonObject
90
+ } from "./main-yf5j8g79.mjs";
91
+ import {
92
+ pipeArguments,
93
+ identity,
94
+ constTrue,
95
+ constFalse,
96
+ constUndefined,
97
+ isString,
98
+ isNumber,
99
+ isBoolean,
100
+ hasProperty
101
+ } from "./main-ken6azcs.mjs";
102
+ import {
103
+ cliCommand
104
+ } from "./main-ak8d0t3n.mjs";
105
+
106
+ // node_modules/effect/dist/PrimaryKey.js
107
+ var symbol = "~effect/PrimaryKey";
108
+ // node_modules/effect/dist/rpc/RpcSchema.js
109
+ var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
110
+ function isStreamSchema(schema) {
111
+ return hasProperty(schema, StreamSchemaTypeId);
112
+ }
113
+ function getStreamSchemas(schema) {
114
+ return isStreamSchema(schema) ? some({
115
+ success: schema.success,
116
+ error: schema.error
117
+ }) : none();
118
+ }
119
+ var schema = /* @__PURE__ */ declare(isStream);
120
+ function Stream(success, error) {
121
+ return make12(schema.ast, {
122
+ [StreamSchemaTypeId]: StreamSchemaTypeId,
123
+ success,
124
+ error
125
+ });
126
+ }
127
+
128
+ class ClientAbort extends (/* @__PURE__ */ Service2()("effect/rpc/RpcSchema/ClientAbort")) {
129
+ static annotation = /* @__PURE__ */ this.context(true).pipe(/* @__PURE__ */ add(StackTrace, {
130
+ name: "ClientAbort",
131
+ stack: constUndefined,
132
+ parent: undefined
133
+ }));
134
+ }
135
+
136
+ // node_modules/effect/dist/rpc/Rpc.js
137
+ var TypeId = "~effect/rpc/Rpc";
138
+ class ServerClient {
139
+ id;
140
+ annotations;
141
+ constructor(id) {
142
+ this.id = id;
143
+ this.annotations = empty4();
144
+ }
145
+ annotate(tag, value) {
146
+ this.annotations = add(this.annotations, tag, value);
147
+ return this;
148
+ }
149
+ }
150
+ var Proto = {
151
+ [TypeId]: TypeId,
152
+ pipe() {
153
+ return pipeArguments(this, arguments);
154
+ },
155
+ setSuccess(successSchema) {
156
+ return makeProto({
157
+ _tag: this._tag,
158
+ payloadSchema: this.payloadSchema,
159
+ successSchema,
160
+ errorSchema: this.errorSchema,
161
+ defectSchema: this.defectSchema,
162
+ annotations: this.annotations,
163
+ middlewares: this.middlewares
164
+ });
165
+ },
166
+ setError(errorSchema) {
167
+ return makeProto({
168
+ _tag: this._tag,
169
+ payloadSchema: this.payloadSchema,
170
+ successSchema: this.successSchema,
171
+ errorSchema,
172
+ defectSchema: this.defectSchema,
173
+ annotations: this.annotations,
174
+ middlewares: this.middlewares
175
+ });
176
+ },
177
+ setPayload(payloadSchema) {
178
+ return makeProto({
179
+ _tag: this._tag,
180
+ payloadSchema: isSchema(payloadSchema) ? payloadSchema : Struct(payloadSchema),
181
+ successSchema: this.successSchema,
182
+ errorSchema: this.errorSchema,
183
+ defectSchema: this.defectSchema,
184
+ annotations: this.annotations,
185
+ middlewares: this.middlewares
186
+ });
187
+ },
188
+ middleware(middleware) {
189
+ return makeProto({
190
+ _tag: this._tag,
191
+ payloadSchema: this.payloadSchema,
192
+ successSchema: this.successSchema,
193
+ errorSchema: this.errorSchema,
194
+ defectSchema: this.defectSchema,
195
+ annotations: this.annotations,
196
+ middlewares: new Set([...this.middlewares, middleware])
197
+ });
198
+ },
199
+ prefix(prefix) {
200
+ return makeProto({
201
+ _tag: `${prefix}${this._tag}`,
202
+ payloadSchema: this.payloadSchema,
203
+ successSchema: this.successSchema,
204
+ errorSchema: this.errorSchema,
205
+ defectSchema: this.defectSchema,
206
+ annotations: this.annotations,
207
+ middlewares: this.middlewares
208
+ });
209
+ },
210
+ annotate(tag, value) {
211
+ return makeProto({
212
+ _tag: this._tag,
213
+ payloadSchema: this.payloadSchema,
214
+ successSchema: this.successSchema,
215
+ errorSchema: this.errorSchema,
216
+ defectSchema: this.defectSchema,
217
+ middlewares: this.middlewares,
218
+ annotations: add(this.annotations, tag, value)
219
+ });
220
+ },
221
+ annotateMerge(context) {
222
+ return makeProto({
223
+ _tag: this._tag,
224
+ payloadSchema: this.payloadSchema,
225
+ successSchema: this.successSchema,
226
+ errorSchema: this.errorSchema,
227
+ defectSchema: this.defectSchema,
228
+ middlewares: this.middlewares,
229
+ annotations: merge2(this.annotations, context)
230
+ });
231
+ }
232
+ };
233
+ var makeProto = (options) => {
234
+ function Rpc() {}
235
+ Object.setPrototypeOf(Rpc, Proto);
236
+ Object.assign(Rpc, options);
237
+ Rpc.key = `effect/rpc/Rpc/${options._tag}`;
238
+ return Rpc;
239
+ };
240
+ var make = (tag, options) => {
241
+ const successSchema = options?.success ?? Void;
242
+ const errorSchema = options?.error ?? Never;
243
+ const defectSchema = options?.defect ?? Defect();
244
+ let payloadSchema;
245
+ if (options?.primaryKey) {
246
+ payloadSchema = class Payload extends Class3(`effect/rpc/Rpc/${tag}`)(options.payload) {
247
+ [symbol]() {
248
+ return options.primaryKey(this);
249
+ }
250
+ };
251
+ } else {
252
+ payloadSchema = isSchema(options?.payload) ? options?.payload : options?.payload ? Struct(options?.payload) : Void;
253
+ }
254
+ return makeProto({
255
+ _tag: tag,
256
+ payloadSchema,
257
+ successSchema: options?.stream ? Stream(successSchema, errorSchema) : successSchema,
258
+ errorSchema: options?.stream ? Never : errorSchema,
259
+ defectSchema,
260
+ annotations: empty4(),
261
+ middlewares: new Set
262
+ });
263
+ };
264
+ var exitSchemaCache = /* @__PURE__ */ new WeakMap;
265
+ var exitSchema = (self) => {
266
+ if (exitSchemaCache.has(self)) {
267
+ return exitSchemaCache.get(self);
268
+ }
269
+ const rpc = self;
270
+ const failures = new Set([rpc.errorSchema]);
271
+ const streamSchemas = getStreamSchemas(rpc.successSchema);
272
+ if (isSome(streamSchemas)) {
273
+ failures.add(streamSchemas.value.error);
274
+ }
275
+ for (const middleware of rpc.middlewares) {
276
+ failures.add(middleware.error);
277
+ }
278
+ const schema = Exit(isSome(streamSchemas) ? Void : rpc.successSchema, Union([...failures]), rpc.defectSchema);
279
+ exitSchemaCache.set(self, schema);
280
+ return schema;
281
+ };
282
+ var WrapperTypeId = "~effect/rpc/Rpc/Wrapper";
283
+ var isWrapper = (u) => (WrapperTypeId in u);
284
+
285
+ // node_modules/effect/dist/rpc/RpcGroup.js
286
+ var RpcGroupProto = {
287
+ add(...rpcs) {
288
+ const requests = new Map(this.requests);
289
+ for (const rpc of rpcs) {
290
+ requests.set(rpc._tag, rpc);
291
+ }
292
+ return makeProto2({
293
+ requests,
294
+ annotations: this.annotations
295
+ });
296
+ },
297
+ merge(...groups) {
298
+ const requests = new Map(this.requests);
299
+ const annotations = new Map(this.annotations.mapUnsafe);
300
+ for (const group of groups) {
301
+ for (const [tag, rpc] of group.requests) {
302
+ requests.set(tag, rpc);
303
+ }
304
+ for (const [key, value] of group.annotations.mapUnsafe) {
305
+ annotations.set(key, value);
306
+ }
307
+ }
308
+ return makeProto2({
309
+ requests,
310
+ annotations: makeUnsafe3(annotations)
311
+ });
312
+ },
313
+ omit(...tags) {
314
+ const requests = new Map(this.requests);
315
+ for (const tag of tags) {
316
+ requests.delete(tag);
317
+ }
318
+ return makeProto2({
319
+ requests,
320
+ annotations: this.annotations
321
+ });
322
+ },
323
+ middleware(middleware) {
324
+ const requests = new Map;
325
+ for (const [tag, rpc] of this.requests) {
326
+ requests.set(tag, rpc.middleware(middleware));
327
+ }
328
+ return makeProto2({
329
+ requests,
330
+ annotations: this.annotations
331
+ });
332
+ },
333
+ toHandlers(build) {
334
+ const self = this;
335
+ return gen(function* () {
336
+ const services = yield* context2();
337
+ const handlers = isEffect(build) ? yield* build : build;
338
+ const contextMap = new Map;
339
+ self.requests.forEach((rpc, tag) => {
340
+ contextMap.set(rpc.key, {
341
+ tag: rpc._tag,
342
+ handler: handlers[tag],
343
+ context: services
344
+ });
345
+ });
346
+ return makeUnsafe3(contextMap);
347
+ });
348
+ },
349
+ prefix(prefix) {
350
+ const requests = new Map;
351
+ for (const rpc of this.requests.values()) {
352
+ const newRpc = rpc.prefix(prefix);
353
+ requests.set(newRpc._tag, newRpc);
354
+ }
355
+ return makeProto2({
356
+ requests,
357
+ annotations: this.annotations
358
+ });
359
+ },
360
+ toLayer(build) {
361
+ return effectContext(this.toHandlers(build));
362
+ },
363
+ of: identity,
364
+ toLayerHandler(service, build) {
365
+ const self = this;
366
+ return effectContext(gen(function* () {
367
+ const services = yield* context2();
368
+ const handler = isEffect(build) ? yield* build : build;
369
+ const contextMap = new Map;
370
+ const rpc = self.requests.get(service);
371
+ contextMap.set(rpc.key, {
372
+ handler,
373
+ context: services
374
+ });
375
+ return makeUnsafe3(contextMap);
376
+ }));
377
+ },
378
+ accessHandler(service) {
379
+ return contextWith((parentContext) => {
380
+ const rpc = this.requests.get(service);
381
+ const {
382
+ handler,
383
+ context
384
+ } = getOrUndefinedUnsafe(parentContext, rpc.key);
385
+ return succeed6((payload, options) => {
386
+ options.rpc = rpc;
387
+ const result = handler(payload, options);
388
+ const effectOrStream = isWrapper(result) ? result.value : result;
389
+ return isEffect(effectOrStream) ? provide3(effectOrStream, context) : provideContext(effectOrStream, context);
390
+ });
391
+ });
392
+ },
393
+ annotate(service, value) {
394
+ return makeProto2({
395
+ requests: this.requests,
396
+ annotations: add(this.annotations, service, value)
397
+ });
398
+ },
399
+ annotateRpcs(service, value) {
400
+ return this.annotateRpcsMerge(make9(service, value));
401
+ },
402
+ annotateMerge(context) {
403
+ return makeProto2({
404
+ requests: this.requests,
405
+ annotations: merge2(this.annotations, context)
406
+ });
407
+ },
408
+ annotateRpcsMerge(context) {
409
+ const requests = new Map;
410
+ for (const [tag, rpc] of this.requests) {
411
+ requests.set(tag, rpc.annotateMerge(merge2(context, rpc.annotations)));
412
+ }
413
+ return makeProto2({
414
+ requests,
415
+ annotations: this.annotations
416
+ });
417
+ }
418
+ };
419
+ var makeProto2 = (options) => Object.assign(function() {}, RpcGroupProto, {
420
+ requests: options.requests,
421
+ annotations: options.annotations
422
+ });
423
+ var make2 = (...rpcs) => makeProto2({
424
+ requests: new Map(rpcs.map((rpc) => [rpc._tag, rpc])),
425
+ annotations: empty4()
426
+ });
427
+
428
+ // node_modules/effect/dist/rpc/RpcMiddleware.js
429
+ var TypeId2 = "~effect/rpc/RpcMiddleware";
430
+ var Service = () => (id, options) => {
431
+ const limit = getStackTraceLimit();
432
+ let creationError;
433
+ if (limit !== 0) {
434
+ setStackTraceLimit(2);
435
+ creationError = new globalThis.Error;
436
+ setStackTraceLimit(limit);
437
+ }
438
+ function ServiceClass() {}
439
+ const ServiceClass_ = ServiceClass;
440
+ Object.setPrototypeOf(ServiceClass, Object.getPrototypeOf(Service2(id)));
441
+ ServiceClass.key = id;
442
+ Object.defineProperty(ServiceClass, "stack", {
443
+ get() {
444
+ return creationError?.stack;
445
+ }
446
+ });
447
+ ServiceClass_[TypeId2] = TypeId2;
448
+ ServiceClass_.error = options?.error ?? Never;
449
+ ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
450
+ return ServiceClass;
451
+ };
452
+
453
+ // node_modules/effect/dist/ai/McpSchema.js
454
+ var optionalWithDefault = (schema, defaultValue) => {
455
+ const effect = sync2(defaultValue);
456
+ return optionalKey(schema).pipe(decode2({
457
+ decode: withDefault2(effect),
458
+ encode: passthrough()
459
+ }), withConstructorDefault(effect));
460
+ };
461
+ var optional2 = (schema) => optionalKey(schema).pipe(decodeTo2(toType(optional(schema)), {
462
+ decode: passthrough(),
463
+ encode: transformOptional(flatMap(fromUndefinedOr))
464
+ }));
465
+ var RequestId = /* @__PURE__ */ Union([String3, Finite]);
466
+ var ProgressToken = /* @__PURE__ */ Union([String3, Finite]);
467
+
468
+ class RequestMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
469
+ _meta: /* @__PURE__ */ optional2(/* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
470
+ progressToken: /* @__PURE__ */ optional2(ProgressToken)
471
+ }), [JsonObject]))
472
+ }))) {
473
+ }
474
+
475
+ class ResultMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
476
+ _meta: /* @__PURE__ */ optional2(JsonObject)
477
+ }))) {
478
+ }
479
+
480
+ class NotificationMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
481
+ _meta: /* @__PURE__ */ optional2(JsonObject)
482
+ }))) {
483
+ }
484
+ var Cursor = String3;
485
+
486
+ class PaginatedRequestMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
487
+ ...RequestMeta.fields,
488
+ cursor: /* @__PURE__ */ optional2(Cursor)
489
+ }))) {
490
+ }
491
+
492
+ class PaginatedResultMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
493
+ ...ResultMeta.fields,
494
+ nextCursor: /* @__PURE__ */ optional2(Cursor)
495
+ }))) {
496
+ }
497
+ var Role = /* @__PURE__ */ Literals(["user", "assistant"]);
498
+
499
+ class Annotations extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
500
+ audience: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Role)),
501
+ priority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
502
+ minimum: 0,
503
+ maximum: 1
504
+ }))),
505
+ lastModified: /* @__PURE__ */ optional2(String3)
506
+ }))) {
507
+ }
508
+
509
+ class Icon extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/Icon")({
510
+ src: String3,
511
+ mimeType: /* @__PURE__ */ optional2(String3),
512
+ sizes: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3)),
513
+ theme: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["light", "dark"]))
514
+ })) {
515
+ }
516
+
517
+ class Implementation extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
518
+ name: String3,
519
+ title: /* @__PURE__ */ optional2(String3),
520
+ version: String3,
521
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
522
+ description: /* @__PURE__ */ optional2(String3),
523
+ websiteUrl: /* @__PURE__ */ optional2(String3)
524
+ }))) {
525
+ }
526
+
527
+ class ClientCapabilities extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ClientCapabilities")({
528
+ experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Struct({}))),
529
+ extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String3, "/", String3]), Json)),
530
+ roots: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
531
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
532
+ })),
533
+ sampling: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
534
+ context: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
535
+ tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
536
+ })),
537
+ elicitation: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
538
+ form: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
539
+ url: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
540
+ }))
541
+ })) {
542
+ }
543
+
544
+ class ServerCapabilities extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
545
+ experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Struct({}))),
546
+ extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String3, "/", String3]), Json)),
547
+ logging: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
548
+ completions: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
549
+ prompts: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
550
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
551
+ })),
552
+ resources: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
553
+ subscribe: /* @__PURE__ */ optional2(Boolean3),
554
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
555
+ })),
556
+ tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
557
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
558
+ }))
559
+ }))) {
560
+ }
561
+
562
+ class McpErrorBase extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/McpErrorBase")({
563
+ code: Int2,
564
+ message: String3,
565
+ data: /* @__PURE__ */ optional2(Any)
566
+ })) {
567
+ }
568
+ var INVALID_REQUEST_ERROR_CODE = -32600;
569
+ var METHOD_NOT_FOUND_ERROR_CODE = -32601;
570
+ var INVALID_PARAMS_ERROR_CODE = -32602;
571
+ var INTERNAL_ERROR_CODE = -32603;
572
+ var PARSE_ERROR_CODE = -32700;
573
+ var HEADER_MISMATCH_ERROR_CODE = -32020;
574
+
575
+ class ParseError extends (/* @__PURE__ */ Error3("effect/ai/McpSchema/ParseError")({
576
+ ...McpErrorBase.fields,
577
+ _tag: /* @__PURE__ */ tag2("ParseError"),
578
+ code: /* @__PURE__ */ tag2(PARSE_ERROR_CODE)
579
+ })) {
580
+ }
581
+
582
+ class InvalidRequest extends (/* @__PURE__ */ Error3("effect/ai/McpSchema/InvalidRequest")({
583
+ ...McpErrorBase.fields,
584
+ _tag: /* @__PURE__ */ tag2("InvalidRequest"),
585
+ code: /* @__PURE__ */ tag2(INVALID_REQUEST_ERROR_CODE)
586
+ })) {
587
+ }
588
+
589
+ class MethodNotFound extends (/* @__PURE__ */ Error3("effect/ai/McpSchema/MethodNotFound")({
590
+ ...McpErrorBase.fields,
591
+ _tag: /* @__PURE__ */ tag2("MethodNotFound"),
592
+ code: /* @__PURE__ */ tag2(METHOD_NOT_FOUND_ERROR_CODE)
593
+ })) {
594
+ }
595
+
596
+ class InvalidParams extends (/* @__PURE__ */ Error3("effect/ai/McpSchema/InvalidParams")({
597
+ ...McpErrorBase.fields,
598
+ _tag: /* @__PURE__ */ tag2("InvalidParams"),
599
+ code: /* @__PURE__ */ tag2(INVALID_PARAMS_ERROR_CODE)
600
+ })) {
601
+ }
602
+
603
+ class InternalError extends (/* @__PURE__ */ Error3("effect/ai/McpSchema/InternalError")({
604
+ ...McpErrorBase.fields,
605
+ _tag: /* @__PURE__ */ tag2("InternalError"),
606
+ code: /* @__PURE__ */ tag2(INTERNAL_ERROR_CODE)
607
+ })) {
608
+ static notImplemented = /* @__PURE__ */ new InternalError({
609
+ message: "Not implemented"
610
+ });
611
+ }
612
+ var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
613
+
614
+ class Ping extends (/* @__PURE__ */ make("ping", {
615
+ success: /* @__PURE__ */ Struct({}),
616
+ error: McpError,
617
+ payload: /* @__PURE__ */ UndefinedOr(RequestMeta)
618
+ })) {
619
+ }
620
+
621
+ class InitializeResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
622
+ ...ResultMeta.fields,
623
+ protocolVersion: String3,
624
+ capabilities: ServerCapabilities,
625
+ serverInfo: Implementation,
626
+ instructions: /* @__PURE__ */ optional2(String3)
627
+ }))) {
628
+ }
629
+
630
+ class Initialize extends (/* @__PURE__ */ make("initialize", {
631
+ success: InitializeResult,
632
+ error: McpError,
633
+ payload: {
634
+ ...RequestMeta.fields,
635
+ protocolVersion: String3,
636
+ capabilities: ClientCapabilities,
637
+ clientInfo: Implementation
638
+ }
639
+ })) {
640
+ }
641
+ class CancelledNotification extends (/* @__PURE__ */ make("notifications/cancelled", {
642
+ payload: {
643
+ ...NotificationMeta.fields,
644
+ requestId: RequestId,
645
+ reason: /* @__PURE__ */ optional2(String3)
646
+ }
647
+ })) {
648
+ }
649
+
650
+ class ProgressNotification extends (/* @__PURE__ */ make("notifications/progress", {
651
+ payload: {
652
+ ...NotificationMeta.fields,
653
+ progressToken: ProgressToken,
654
+ progress: Finite,
655
+ total: /* @__PURE__ */ optional2(Finite),
656
+ message: /* @__PURE__ */ optional2(String3)
657
+ }
658
+ })) {
659
+ }
660
+
661
+ class Resource extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/Resource")({
662
+ uri: String3,
663
+ name: String3,
664
+ title: /* @__PURE__ */ optional2(String3),
665
+ description: /* @__PURE__ */ optional2(String3),
666
+ mimeType: /* @__PURE__ */ optional2(String3),
667
+ annotations: /* @__PURE__ */ optional2(Annotations),
668
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
669
+ size: /* @__PURE__ */ optional2(Int2),
670
+ _meta: /* @__PURE__ */ optional2(JsonObject)
671
+ })) {
672
+ }
673
+
674
+ class ResourceTemplate extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ResourceTemplate")({
675
+ uriTemplate: String3,
676
+ name: String3,
677
+ title: /* @__PURE__ */ optional2(String3),
678
+ description: /* @__PURE__ */ optional2(String3),
679
+ mimeType: /* @__PURE__ */ optional2(String3),
680
+ annotations: /* @__PURE__ */ optional2(Annotations),
681
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
682
+ _meta: /* @__PURE__ */ optional2(JsonObject)
683
+ })) {
684
+ }
685
+
686
+ class ResourceContents extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
687
+ uri: String3,
688
+ mimeType: /* @__PURE__ */ optional2(String3),
689
+ _meta: /* @__PURE__ */ optional2(JsonObject)
690
+ }))) {
691
+ }
692
+
693
+ class TextResourceContents extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
694
+ ...ResourceContents.fields,
695
+ text: String3
696
+ }))) {
697
+ }
698
+
699
+ class BlobResourceContents extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
700
+ ...ResourceContents.fields,
701
+ blob: Uint8ArrayFromBase64
702
+ }))) {
703
+ }
704
+
705
+ class ListResourcesResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ListResourcesResult")({
706
+ ...PaginatedResultMeta.fields,
707
+ resources: /* @__PURE__ */ ArraySchema(Resource)
708
+ })) {
709
+ }
710
+ class ListResourceTemplatesResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ListResourceTemplatesResult")({
711
+ ...PaginatedResultMeta.fields,
712
+ resourceTemplates: /* @__PURE__ */ ArraySchema(ResourceTemplate)
713
+ })) {
714
+ }
715
+ class ReadResourceResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
716
+ ...ResultMeta.fields,
717
+ contents: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]))
718
+ }))) {
719
+ }
720
+
721
+ class ReadResource extends (/* @__PURE__ */ make("resources/read", {
722
+ success: ReadResourceResult,
723
+ error: McpError,
724
+ payload: {
725
+ ...RequestMeta.fields,
726
+ uri: String3
727
+ }
728
+ })) {
729
+ }
730
+
731
+ class ResourceListChangedNotification extends (/* @__PURE__ */ make("notifications/resources/list_changed", {
732
+ payload: /* @__PURE__ */ UndefinedOr(NotificationMeta)
733
+ })) {
734
+ }
735
+
736
+ class Subscribe extends (/* @__PURE__ */ make("resources/subscribe", {
737
+ success: /* @__PURE__ */ Struct({}),
738
+ error: McpError,
739
+ payload: {
740
+ ...RequestMeta.fields,
741
+ uri: String3
742
+ }
743
+ })) {
744
+ }
745
+
746
+ class Unsubscribe extends (/* @__PURE__ */ make("resources/unsubscribe", {
747
+ success: /* @__PURE__ */ Struct({}),
748
+ error: McpError,
749
+ payload: {
750
+ ...RequestMeta.fields,
751
+ uri: String3
752
+ }
753
+ })) {
754
+ }
755
+
756
+ class ResourceUpdatedNotification extends (/* @__PURE__ */ make("notifications/resources/updated", {
757
+ payload: {
758
+ ...NotificationMeta.fields,
759
+ uri: String3
760
+ }
761
+ })) {
762
+ }
763
+
764
+ class PromptArgument extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
765
+ name: String3,
766
+ title: /* @__PURE__ */ optional2(String3),
767
+ description: /* @__PURE__ */ optional2(String3),
768
+ required: /* @__PURE__ */ optional2(Boolean3)
769
+ }))) {
770
+ }
771
+
772
+ class Prompt extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/Prompt")({
773
+ name: String3,
774
+ title: /* @__PURE__ */ optional2(String3),
775
+ description: /* @__PURE__ */ optional2(String3),
776
+ arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(PromptArgument)),
777
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
778
+ _meta: /* @__PURE__ */ optional2(JsonObject)
779
+ })) {
780
+ }
781
+
782
+ class TextContent extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
783
+ type: /* @__PURE__ */ tag2("text"),
784
+ text: String3,
785
+ annotations: /* @__PURE__ */ optional2(Annotations),
786
+ _meta: /* @__PURE__ */ optional2(JsonObject)
787
+ }))) {
788
+ }
789
+
790
+ class ImageContent extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
791
+ type: /* @__PURE__ */ tag2("image"),
792
+ data: Uint8ArrayFromBase64,
793
+ mimeType: String3,
794
+ annotations: /* @__PURE__ */ optional2(Annotations),
795
+ _meta: /* @__PURE__ */ optional2(JsonObject)
796
+ }))) {
797
+ }
798
+
799
+ class AudioContent extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
800
+ type: /* @__PURE__ */ tag2("audio"),
801
+ data: Uint8ArrayFromBase64,
802
+ mimeType: String3,
803
+ annotations: /* @__PURE__ */ optional2(Annotations),
804
+ _meta: /* @__PURE__ */ optional2(JsonObject)
805
+ }))) {
806
+ }
807
+
808
+ class EmbeddedResource extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
809
+ type: /* @__PURE__ */ tag2("resource"),
810
+ resource: /* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]),
811
+ annotations: /* @__PURE__ */ optional2(Annotations),
812
+ _meta: /* @__PURE__ */ optional2(JsonObject)
813
+ }))) {
814
+ }
815
+
816
+ class ResourceLink extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
817
+ ...Resource.fields,
818
+ type: /* @__PURE__ */ tag2("resource_link")
819
+ }))) {
820
+ }
821
+ var ContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, EmbeddedResource, ResourceLink]);
822
+
823
+ class PromptMessage extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
824
+ role: Role,
825
+ content: ContentBlock
826
+ }))) {
827
+ }
828
+
829
+ class ListPromptsResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ListPromptsResult")({
830
+ ...PaginatedResultMeta.fields,
831
+ prompts: /* @__PURE__ */ ArraySchema(Prompt)
832
+ })) {
833
+ }
834
+ class GetPromptResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/GetPromptResult")({
835
+ ...ResultMeta.fields,
836
+ messages: /* @__PURE__ */ ArraySchema(PromptMessage),
837
+ description: /* @__PURE__ */ optional2(String3)
838
+ })) {
839
+ }
840
+
841
+ class GetPrompt extends (/* @__PURE__ */ make("prompts/get", {
842
+ success: GetPromptResult,
843
+ error: McpError,
844
+ payload: {
845
+ ...RequestMeta.fields,
846
+ name: String3,
847
+ title: /* @__PURE__ */ optional2(String3),
848
+ arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, String3))
849
+ }
850
+ })) {
851
+ }
852
+
853
+ class PromptListChangedNotification extends (/* @__PURE__ */ make("notifications/prompts/list_changed", {
854
+ payload: /* @__PURE__ */ UndefinedOr(NotificationMeta)
855
+ })) {
856
+ }
857
+
858
+ class ToolAnnotations extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
859
+ title: /* @__PURE__ */ optional2(String3),
860
+ readOnlyHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constFalse),
861
+ destructiveHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constTrue),
862
+ idempotentHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constFalse),
863
+ openWorldHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constTrue)
864
+ }))) {
865
+ }
866
+ var ToolJson = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
867
+ type: /* @__PURE__ */ Literal("object"),
868
+ properties: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, JsonObject)),
869
+ required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
870
+ }), [JsonObject]);
871
+ var ToolOutputJson = JsonObject;
872
+
873
+ class Tool extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/Tool")({
874
+ name: String3,
875
+ title: /* @__PURE__ */ optional2(String3),
876
+ description: /* @__PURE__ */ optional2(String3),
877
+ inputSchema: ToolJson,
878
+ outputSchema: /* @__PURE__ */ optional2(ToolOutputJson),
879
+ annotations: /* @__PURE__ */ optional2(ToolAnnotations),
880
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
881
+ _meta: /* @__PURE__ */ optional2(JsonObject)
882
+ })) {
883
+ }
884
+
885
+ class ListToolsResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ListToolsResult")({
886
+ ...PaginatedResultMeta.fields,
887
+ tools: /* @__PURE__ */ ArraySchema(Tool)
888
+ })) {
889
+ }
890
+ class CallToolResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/CallToolResult")({
891
+ ...ResultMeta.fields,
892
+ content: /* @__PURE__ */ ArraySchema(ContentBlock),
893
+ structuredContent: /* @__PURE__ */ optional2(Json),
894
+ isError: /* @__PURE__ */ optional2(Boolean3)
895
+ })) {
896
+ }
897
+
898
+ class CallTool extends (/* @__PURE__ */ make("tools/call", {
899
+ success: CallToolResult,
900
+ error: McpError,
901
+ payload: {
902
+ ...RequestMeta.fields,
903
+ name: String3,
904
+ arguments: /* @__PURE__ */ optionalWithDefault(/* @__PURE__ */ Record(String3, Any), () => ({}))
905
+ }
906
+ })) {
907
+ }
908
+
909
+ class ToolListChangedNotification extends (/* @__PURE__ */ make("notifications/tools/list_changed", {
910
+ payload: /* @__PURE__ */ UndefinedOr(NotificationMeta)
911
+ })) {
912
+ }
913
+ var LoggingLevel = /* @__PURE__ */ Literals(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
914
+
915
+ class SetLevel extends (/* @__PURE__ */ make("logging/setLevel", {
916
+ payload: {
917
+ ...RequestMeta.fields,
918
+ level: LoggingLevel
919
+ },
920
+ success: /* @__PURE__ */ Struct({}),
921
+ error: McpError
922
+ })) {
923
+ }
924
+
925
+ class LoggingMessageNotification extends (/* @__PURE__ */ make("notifications/message", {
926
+ payload: /* @__PURE__ */ Struct({
927
+ ...NotificationMeta.fields,
928
+ level: LoggingLevel,
929
+ logger: /* @__PURE__ */ optional2(String3),
930
+ data: Any
931
+ })
932
+ })) {
933
+ }
934
+
935
+ class ToolUseContent extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ToolUseContent")({
936
+ type: /* @__PURE__ */ tag2("tool_use"),
937
+ id: String3,
938
+ name: String3,
939
+ input: /* @__PURE__ */ Record(String3, Unknown),
940
+ _meta: /* @__PURE__ */ optional2(JsonObject)
941
+ })) {
942
+ }
943
+
944
+ class ToolResultContent extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ToolResultContent")({
945
+ type: /* @__PURE__ */ tag2("tool_result"),
946
+ toolUseId: String3,
947
+ content: /* @__PURE__ */ ArraySchema(ContentBlock),
948
+ structuredContent: /* @__PURE__ */ optional2(Json),
949
+ isError: /* @__PURE__ */ optional2(Boolean3),
950
+ _meta: /* @__PURE__ */ optional2(JsonObject)
951
+ })) {
952
+ }
953
+ var SamplingMessageContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, ToolUseContent, ToolResultContent]);
954
+
955
+ class SamplingMessage extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
956
+ role: Role,
957
+ content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
958
+ _meta: /* @__PURE__ */ optional2(JsonObject)
959
+ }))) {
960
+ }
961
+
962
+ class ToolChoice extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ToolChoice")({
963
+ mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["auto", "required", "none"]))
964
+ })) {
965
+ }
966
+
967
+ class ModelHint extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
968
+ name: /* @__PURE__ */ optional2(String3)
969
+ }))) {
970
+ }
971
+
972
+ class ModelPreferences extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ModelPreferences")({
973
+ hints: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(ModelHint)),
974
+ costPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
975
+ minimum: 0,
976
+ maximum: 1
977
+ }))),
978
+ speedPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
979
+ minimum: 0,
980
+ maximum: 1
981
+ }))),
982
+ intelligencePriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
983
+ minimum: 0,
984
+ maximum: 1
985
+ })))
986
+ })) {
987
+ }
988
+
989
+ class CreateMessageResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/CreateMessageResult")({
990
+ role: Role,
991
+ content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
992
+ _meta: /* @__PURE__ */ optional2(JsonObject),
993
+ model: String3,
994
+ stopReason: /* @__PURE__ */ optional2(String3)
995
+ })) {
996
+ }
997
+
998
+ class CreateMessage extends (/* @__PURE__ */ make("sampling/createMessage", {
999
+ success: CreateMessageResult,
1000
+ error: McpError,
1001
+ payload: {
1002
+ messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1003
+ modelPreferences: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ModelPreferences.fields)),
1004
+ systemPrompt: /* @__PURE__ */ optional2(String3),
1005
+ includeContext: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["none", "thisServer", "allServers"])),
1006
+ temperature: /* @__PURE__ */ optional2(Finite),
1007
+ maxTokens: Int2,
1008
+ stopSequences: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3)),
1009
+ metadata: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, Unknown)),
1010
+ tools: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct(Tool.fields))),
1011
+ toolChoice: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ToolChoice.fields))
1012
+ }
1013
+ })) {
1014
+ }
1015
+ class CompleteResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1016
+ ...ResultMeta.fields,
1017
+ completion: /* @__PURE__ */ Struct({
1018
+ values: /* @__PURE__ */ ArraySchema(String3),
1019
+ total: /* @__PURE__ */ optional2(Int2),
1020
+ hasMore: /* @__PURE__ */ optional2(Boolean3)
1021
+ })
1022
+ }))) {
1023
+ static empty = /* @__PURE__ */ CompleteResult.make({
1024
+ completion: {
1025
+ values: [],
1026
+ total: 0,
1027
+ hasMore: false
1028
+ }
1029
+ });
1030
+ }
1031
+ class Root extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/Root")({
1032
+ uri: String3,
1033
+ name: /* @__PURE__ */ optional2(String3),
1034
+ _meta: /* @__PURE__ */ optional2(JsonObject)
1035
+ })) {
1036
+ }
1037
+
1038
+ class ListRootsResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ListRootsResult")({
1039
+ roots: /* @__PURE__ */ ArraySchema(Root)
1040
+ })) {
1041
+ }
1042
+
1043
+ class ListRoots extends (/* @__PURE__ */ make("roots/list", {
1044
+ success: ListRootsResult,
1045
+ error: McpError,
1046
+ payload: /* @__PURE__ */ UndefinedOr(RequestMeta)
1047
+ })) {
1048
+ }
1049
+ class ElicitationString extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitationString")({
1050
+ type: /* @__PURE__ */ tag2("string"),
1051
+ title: /* @__PURE__ */ optional2(String3),
1052
+ description: /* @__PURE__ */ optional2(String3),
1053
+ minLength: /* @__PURE__ */ optional2(Int2),
1054
+ maxLength: /* @__PURE__ */ optional2(Int2),
1055
+ format: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["email", "uri", "date", "date-time"])),
1056
+ default: /* @__PURE__ */ optional2(String3)
1057
+ })) {
1058
+ }
1059
+
1060
+ class ElicitationNumber extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitationNumber")({
1061
+ type: /* @__PURE__ */ Literals(["number", "integer"]),
1062
+ title: /* @__PURE__ */ optional2(String3),
1063
+ description: /* @__PURE__ */ optional2(String3),
1064
+ minimum: /* @__PURE__ */ optional2(Finite),
1065
+ maximum: /* @__PURE__ */ optional2(Finite),
1066
+ default: /* @__PURE__ */ optional2(Finite)
1067
+ })) {
1068
+ }
1069
+
1070
+ class ElicitationBoolean extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitationBoolean")({
1071
+ type: /* @__PURE__ */ tag2("boolean"),
1072
+ title: /* @__PURE__ */ optional2(String3),
1073
+ description: /* @__PURE__ */ optional2(String3),
1074
+ default: /* @__PURE__ */ optional2(Boolean3)
1075
+ })) {
1076
+ }
1077
+
1078
+ class UntitledSingleSelectEnum extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/UntitledSingleSelectEnum")({
1079
+ type: /* @__PURE__ */ tag2("string"),
1080
+ title: /* @__PURE__ */ optional2(String3),
1081
+ description: /* @__PURE__ */ optional2(String3),
1082
+ enum: /* @__PURE__ */ ArraySchema(String3),
1083
+ default: /* @__PURE__ */ optional2(String3)
1084
+ })) {
1085
+ }
1086
+
1087
+ class TitledSingleSelectEnum extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/TitledSingleSelectEnum")({
1088
+ type: /* @__PURE__ */ tag2("string"),
1089
+ title: /* @__PURE__ */ optional2(String3),
1090
+ description: /* @__PURE__ */ optional2(String3),
1091
+ oneOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
1092
+ const: String3,
1093
+ title: String3
1094
+ })),
1095
+ default: /* @__PURE__ */ optional2(String3)
1096
+ })) {
1097
+ }
1098
+ var SingleSelectEnum = /* @__PURE__ */ Union([UntitledSingleSelectEnum, TitledSingleSelectEnum]);
1099
+
1100
+ class UntitledMultiSelectEnum extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/UntitledMultiSelectEnum")({
1101
+ type: /* @__PURE__ */ tag2("array"),
1102
+ title: /* @__PURE__ */ optional2(String3),
1103
+ description: /* @__PURE__ */ optional2(String3),
1104
+ minItems: /* @__PURE__ */ optional2(Int2),
1105
+ maxItems: /* @__PURE__ */ optional2(Int2),
1106
+ items: /* @__PURE__ */ Struct({
1107
+ type: /* @__PURE__ */ tag2("string"),
1108
+ enum: /* @__PURE__ */ ArraySchema(String3)
1109
+ }),
1110
+ default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
1111
+ })) {
1112
+ }
1113
+
1114
+ class TitledMultiSelectEnum extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/TitledMultiSelectEnum")({
1115
+ type: /* @__PURE__ */ tag2("array"),
1116
+ title: /* @__PURE__ */ optional2(String3),
1117
+ description: /* @__PURE__ */ optional2(String3),
1118
+ minItems: /* @__PURE__ */ optional2(Int2),
1119
+ maxItems: /* @__PURE__ */ optional2(Int2),
1120
+ items: /* @__PURE__ */ Struct({
1121
+ anyOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
1122
+ const: String3,
1123
+ title: String3
1124
+ }))
1125
+ }),
1126
+ default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
1127
+ })) {
1128
+ }
1129
+ var MultiSelectEnum = /* @__PURE__ */ Union([UntitledMultiSelectEnum, TitledMultiSelectEnum]);
1130
+
1131
+ class LegacyTitledEnum extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/LegacyTitledEnum")({
1132
+ type: /* @__PURE__ */ tag2("string"),
1133
+ title: /* @__PURE__ */ optional2(String3),
1134
+ description: /* @__PURE__ */ optional2(String3),
1135
+ enum: /* @__PURE__ */ ArraySchema(String3),
1136
+ enumNames: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3)),
1137
+ default: /* @__PURE__ */ optional2(String3)
1138
+ })) {
1139
+ }
1140
+ var ElicitationEnum = /* @__PURE__ */ Union([LegacyTitledEnum, SingleSelectEnum, MultiSelectEnum]);
1141
+ var PrimitiveSchemaDefinition = /* @__PURE__ */ Union([ElicitationEnum, ElicitationString, ElicitationNumber, ElicitationBoolean]);
1142
+ var ElicitationForm = /* @__PURE__ */ Struct({
1143
+ $schema: /* @__PURE__ */ optional2(String3),
1144
+ type: /* @__PURE__ */ tag2("object"),
1145
+ properties: /* @__PURE__ */ Record(String3, PrimitiveSchemaDefinition),
1146
+ required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
1147
+ });
1148
+
1149
+ class ElicitRequestFormParams extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitRequestFormParams")({
1150
+ ...RequestMeta.fields,
1151
+ mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literal("form")),
1152
+ message: String3,
1153
+ requestedSchema: ElicitationForm
1154
+ })) {
1155
+ }
1156
+
1157
+ class ElicitRequestURLParams extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitRequestURLParams")({
1158
+ ...RequestMeta.fields,
1159
+ mode: /* @__PURE__ */ Literal("url"),
1160
+ message: String3,
1161
+ elicitationId: String3,
1162
+ url: String3
1163
+ })) {
1164
+ }
1165
+ var ElicitRequestParams = /* @__PURE__ */ Union([ElicitRequestFormParams, ElicitRequestURLParams]);
1166
+
1167
+ class ElicitAcceptResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitAcceptResult")({
1168
+ ...ResultMeta.fields,
1169
+ action: /* @__PURE__ */ Literal("accept"),
1170
+ content: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Union([String3, Finite, Boolean3, /* @__PURE__ */ ArraySchema(String3)])))
1171
+ })) {
1172
+ }
1173
+
1174
+ class ElicitDeclineResult extends (/* @__PURE__ */ Class3("@effect/ai/McpSchema/ElicitDeclineResult")({
1175
+ ...ResultMeta.fields,
1176
+ action: /* @__PURE__ */ Literals(["cancel", "decline"])
1177
+ })) {
1178
+ }
1179
+ var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1180
+ class Elicit extends (/* @__PURE__ */ make("elicitation/create", {
1181
+ success: ElicitResult,
1182
+ error: McpError,
1183
+ payload: ElicitRequestParams
1184
+ })) {
1185
+ }
1186
+
1187
+ class ElicitationCompleteNotification extends (/* @__PURE__ */ make("notifications/elicitation/complete", {
1188
+ payload: {
1189
+ elicitationId: String3
1190
+ }
1191
+ })) {
1192
+ }
1193
+
1194
+ class ElicitationDeclined extends (/* @__PURE__ */ Error3("@effect/ai/McpSchema/ElicitationDeclined")({
1195
+ _tag: /* @__PURE__ */ tag2("ElicitationDeclined"),
1196
+ request: Elicit.payloadSchema,
1197
+ cause: /* @__PURE__ */ optional2(/* @__PURE__ */ Defect())
1198
+ })) {
1199
+ }
1200
+
1201
+ class McpReverseOperationUnsupported extends (/* @__PURE__ */ TaggedError("McpReverseOperationUnsupported")) {
1202
+ }
1203
+
1204
+ class McpReverseOperationError extends (/* @__PURE__ */ TaggedError("McpReverseOperationError")) {
1205
+ }
1206
+
1207
+ class McpRequestContext extends (/* @__PURE__ */ Service2()("effect/ai/McpSchema/McpRequestContext")) {
1208
+ }
1209
+
1210
+ class McpServerClient extends (/* @__PURE__ */ Service2()("effect/ai/McpSchema/McpServerClient")) {
1211
+ }
1212
+
1213
+ class McpServerClientMiddleware extends (/* @__PURE__ */ Service()("effect/ai/McpSchema/McpServerClientMiddleware")) {
1214
+ }
1215
+ class ServerNotificationRpcs extends (/* @__PURE__ */ make2(CancelledNotification, ProgressNotification, LoggingMessageNotification, ResourceUpdatedNotification, ResourceListChangedNotification, ToolListChangedNotification, PromptListChangedNotification, ElicitationCompleteNotification)) {
1216
+ }
1217
+ class EnabledWhen extends (/* @__PURE__ */ Service2()("effect/ai/McpSchema/EnabledWhen")) {
1218
+ }
1219
+ // src/relay/user-settings.ts
1220
+ var settingKeys = ["window", "grouping", "idleMinutes", "cursor", "humanInput", "handoffNotifications", "autoUpdate"];
1221
+ var relaySettingKeys = ["autoUpdate"];
1222
+ var settingSpecs = {
1223
+ window: { label: "Where agents open their tabs (current: the user's window; separate: an unfocused window of their own)", values: ["current", "separate"], variable: "OPENCODE_BROWSER_AGENT_WINDOW" },
1224
+ grouping: { label: "How agent tabs are grouped (one shared group, one group per session, or none)", values: ["shared", "session", "none"] },
1225
+ idleMinutes: { label: "Close agent tabs untouched for this many minutes", values: [10, 30, 60, "never"] },
1226
+ cursor: { label: "Agent cursor on agent tabs outside recordings (pages can detect it)", values: ["off", "always"], variable: "OPENCODE_BROWSER_GHOST_CURSOR" },
1227
+ humanInput: { label: "Human-like input (off is faster, but easier for sites to flag)", values: ["on", "off"], variable: "OPENCODE_BROWSER_HUMAN_INPUT" },
1228
+ handoffNotifications: { label: "System notification on a handoff (only while recorded, or every handoff)", values: ["recording", "always"] },
1229
+ autoUpdate: { label: "installs: install updates automatically when idle, only notify, or never check", values: ["on", "notify", "off"], variable: "OPENCODE_BROWSER_AUTO_UPDATE" }
1230
+ };
1231
+ var securityVariables = [
1232
+ "OPENCODE_BROWSER_ALLOW_NODE",
1233
+ "OPENCODE_BROWSER_ALLOW_ALL_COOKIES",
1234
+ "OPENCODE_BROWSER_ALLOW_FOREGROUND",
1235
+ "OPENCODE_BROWSER_ALLOW_ALL_STORAGE",
1236
+ "OPENCODE_BROWSER_ALLOW_FILE_URLS",
1237
+ "OPENCODE_BROWSER_UPDATE_CHECK"
1238
+ ];
1239
+
1240
+ class SettingsInputError extends Error {
1241
+ }
1242
+ var allowed = (key) => settingSpecs[key].values.map(String).join(", ");
1243
+ function parseSettingChanges(input) {
1244
+ if (input === null || typeof input !== "object" || Array.isArray(input))
1245
+ throw new SettingsInputError('Pass the settings to change as an object, for example { grouping: "shared" }.');
1246
+ const problems = [];
1247
+ const changes = {};
1248
+ for (const [key, raw] of Object.entries(input)) {
1249
+ if (!settingKeys.includes(key)) {
1250
+ problems.push(/allow|update|security|node|cookie|foreground|storage|file/i.test(key) ? `"${key}" is not a setting: security switches (${securityVariables.join(", ")}) are set only in the relay's environment, never here.` : `Unknown setting "${key}". Settings: ${settingKeys.join(", ")}.`);
1251
+ continue;
1252
+ }
1253
+ const setting = key;
1254
+ const value = setting === "idleMinutes" ? idleValue(raw) : raw;
1255
+ if (value === undefined || !settingSpecs[setting].values.includes(value)) {
1256
+ problems.push(`${setting} must be one of ${allowed(setting)} (got ${JSON.stringify(raw)}).`);
1257
+ continue;
1258
+ }
1259
+ changes[setting] = value;
1260
+ }
1261
+ if (problems.length)
1262
+ throw new SettingsInputError(problems.join(" "));
1263
+ if (!Object.keys(changes).length)
1264
+ throw new SettingsInputError(`Nothing to change. Settings: ${settingKeys.join(", ")}.`);
1265
+ return changes;
1266
+ }
1267
+ function idleValue(raw) {
1268
+ if (raw === "never" || raw === 0 || raw === "0")
1269
+ return "never";
1270
+ if (typeof raw === "number")
1271
+ return raw;
1272
+ if (typeof raw === "string" && /^\d+$/.test(raw))
1273
+ return Number(raw);
1274
+ return;
1275
+ }
1276
+ function settingsFromExtension(wire) {
1277
+ const values = wire && typeof wire.settings === "object" && wire.settings !== null && !Array.isArray(wire.settings) ? wire.settings : undefined;
1278
+ if (!values)
1279
+ throw new Error("The extension answered settings without them");
1280
+ const settings = {};
1281
+ for (const key of settingKeys) {
1282
+ const value = values[key];
1283
+ if (relaySettingKeys.includes(key))
1284
+ settings[key] = String(settingSpecs[key].values[0]);
1285
+ else if (key === "idleMinutes")
1286
+ settings[key] = value === 0 ? "never" : typeof value === "number" ? value : 10;
1287
+ else
1288
+ settings[key] = typeof value === "string" ? value : String(settingSpecs[key].values[0]);
1289
+ }
1290
+ return settings;
1291
+ }
1292
+ function settingsToExtension(changes) {
1293
+ return Object.fromEntries(Object.entries(changes).filter(([key]) => !relaySettingKeys.includes(key)).map(([key, value]) => [key, key === "idleMinutes" && value === "never" ? 0 : value]));
1294
+ }
1295
+ function report(stored, overrides) {
1296
+ return Object.fromEntries(settingKeys.map((key) => {
1297
+ const override = overrides[key];
1298
+ return [key, {
1299
+ value: stored[key],
1300
+ effective: override?.value ?? stored[key],
1301
+ allowed: settingSpecs[key].values,
1302
+ description: settingSpecs[key].label,
1303
+ ...override ? { overriddenBy: override.variable } : {}
1304
+ }];
1305
+ }));
1306
+ }
1307
+ var securityNote = `Security switches (${securityVariables.join(", ")}) are environment-only and can't be read or changed here.`;
1308
+ function describeSettings(stored, overrides) {
1309
+ return { settings: report(stored, overrides), note: securityNote };
1310
+ }
1311
+ function describeChanges(options) {
1312
+ const changed = [];
1313
+ const unchanged = [];
1314
+ const overridden = [];
1315
+ for (const [key, value] of Object.entries(options.requested)) {
1316
+ const override = options.overrides[key];
1317
+ if (override)
1318
+ overridden.push({ key, requested: value, variable: override.variable, effective: override.value });
1319
+ else if (options.before[key] === options.after[key])
1320
+ unchanged.push(key);
1321
+ else
1322
+ changed.push({ key, from: options.before[key], to: options.after[key] });
1323
+ }
1324
+ const lines = [];
1325
+ if (changed.length)
1326
+ lines.push(`Changed ${changed.map((item) => `${item.key} from ${item.from} to ${item.to}`).join(", ")}. Tell the user what you changed; they can change it back on the extension's options page.`);
1327
+ if (unchanged.length)
1328
+ lines.push(`Already set: ${unchanged.map((key) => `${key} is ${options.after[key]}`).join(", ")}.`);
1329
+ for (const item of overridden)
1330
+ lines.push(`Not changed: ${item.key} is fixed to ${item.effective} by ${item.variable} in the relay's environment, so this setting has no effect. Tell the user; to change it they remove or edit ${item.variable} where opencode starts, then run \`${cliCommand("relay restart")}\`.`);
1331
+ return { changed, unchanged, overridden, settings: report(options.after, options.overrides), message: lines.join(" ") };
1332
+ }
1333
+ function formatSettings(settings) {
1334
+ const width = Math.max(...settingKeys.map((key) => key.length));
1335
+ return settingKeys.map((key) => {
1336
+ const item = settings[key];
1337
+ const override = item.overriddenBy ? ` (in effect: ${item.effective}, set by ${item.overriddenBy} on the relay)` : "";
1338
+ return `${key.padEnd(width)} ${String(item.value).padEnd(9)} one of ${item.allowed.join(", ")}${override}`;
1339
+ });
1340
+ }
1341
+
1342
+ // src/mcp/schema.ts
1343
+ function mcpUpdateNote2(notice) {
1344
+ return `Note: browse has an update: ${notice.summary}. Tell the user they can run \`${notice.command}\` and then restart opencode, or ask you to run it for them.`;
1345
+ }
1346
+ function objectSchema(properties, required = []) {
1347
+ return {
1348
+ type: "object",
1349
+ properties,
1350
+ required: [...required],
1351
+ additionalProperties: false
1352
+ };
1353
+ }
1354
+ var emptyInputSchema = objectSchema({});
1355
+ var sessionSchemaProperty = {
1356
+ type: "string",
1357
+ description: "Optional session id. Defaults to this MCP server's current session."
1358
+ };
1359
+ var sessionAliasSchemaProperty = { type: "string", description: "Same as id." };
1360
+ var sessionOnlyInputSchema = objectSchema({
1361
+ session: sessionSchemaProperty
1362
+ });
1363
+ var ExecuteToolOutput = Struct({
1364
+ session: String3,
1365
+ value: optionalKey(Unknown),
1366
+ logs: optionalKey(ArraySchema(ExecuteLogEntry)),
1367
+ logSummary: optionalKey(ExecuteLogSummary),
1368
+ warnings: optionalKey(ArraySchema(String3)),
1369
+ diagnostic: optionalKey(String3),
1370
+ aftermath: optionalKey(ExecuteAftermath),
1371
+ notice: optionalKey(String3)
1372
+ });
1373
+ var StatusToolOutput = Struct({
1374
+ endpoint: String3,
1375
+ currentSession: String3,
1376
+ version: RelayVersion,
1377
+ status: ExtensionStatus,
1378
+ buildProblem: optionalKey(String3),
1379
+ update: optionalKey(Json),
1380
+ autoUpdate: Json
1381
+ });
1382
+ var CurrentSessionToolOutput = Struct({
1383
+ currentSession: String3
1384
+ });
1385
+ var SessionDeleteToolOutput = SessionDeleted.pipe(fieldsAssign({
1386
+ currentSession: String3
1387
+ }));
1388
+ var NetworkToolOutput = Struct({
1389
+ action: Literals(["start", "status", "stop", "cancel"]),
1390
+ session: String3,
1391
+ active: optionalKey(Boolean3),
1392
+ startedAt: optionalKey(String3),
1393
+ entryCount: optionalKey(Number2),
1394
+ responseCount: optionalKey(Number2),
1395
+ failureCount: optionalKey(Number2),
1396
+ capturedBodyBytes: optionalKey(Number2),
1397
+ truncatedBodyCount: optionalKey(Number2),
1398
+ droppedEntryCount: optionalKey(Number2),
1399
+ urlFilter: optionalKey(String3),
1400
+ resourceTypes: optionalKey(ArraySchema(String3)),
1401
+ content: optionalKey(Literals(["omit", "embed"])),
1402
+ secrets: optionalKey(String3),
1403
+ endsAt: optionalKey(String3),
1404
+ ended: optionalKey(String3),
1405
+ stoppedAt: optionalKey(String3),
1406
+ outputPath: optionalKey(String3),
1407
+ authProfile: optionalKey(AuthProfileSummary),
1408
+ updatedSecretRefs: optionalKey(ArraySchema(String3)),
1409
+ observedSecretRefs: optionalKey(ArraySchema(String3)),
1410
+ endpoints: optionalKey(ArraySchema(Struct({
1411
+ method: String3,
1412
+ url: String3,
1413
+ status: optionalKey(Number2),
1414
+ count: Number2,
1415
+ requestHeaders: optionalKey(ArraySchema(String3)),
1416
+ requestKeys: optionalKey(ArraySchema(String3)),
1417
+ responseKeys: optionalKey(ArraySchema(String3))
1418
+ }))),
1419
+ cancelled: optionalKey(Boolean3)
1420
+ });
1421
+ var RecordingToolOutput = Struct({
1422
+ action: Literals(["start", "stop", "status", "cancel"]),
1423
+ session: String3,
1424
+ success: optionalKey(Boolean3),
1425
+ tabId: optionalKey(Number2),
1426
+ startedAt: optionalKey(Number2),
1427
+ path: optionalKey(String3),
1428
+ mimeType: optionalKey(String3),
1429
+ mode: optionalKey(Literals(["tab-capture", "cdp"])),
1430
+ artifactType: optionalKey(Literals(["webm", "mp4"])),
1431
+ frameRate: optionalKey(Number2),
1432
+ duration: optionalKey(Number2),
1433
+ size: optionalKey(Number2),
1434
+ frameCount: optionalKey(Number2),
1435
+ quality: optionalKey(RecordingQuality),
1436
+ isRecording: optionalKey(Boolean3),
1437
+ error: optionalKey(String3)
1438
+ });
1439
+ var FlightRecorderToolOutput = Struct({
1440
+ action: Literals(["start", "status", "save_last", "cancel"]),
1441
+ session: String3,
1442
+ active: optionalKey(Boolean3),
1443
+ tabId: optionalKey(Number2),
1444
+ sessionId: optionalKey(String3),
1445
+ startedAt: optionalKey(Number2),
1446
+ retentionMs: optionalKey(Number2),
1447
+ retainedDurationMs: optionalKey(Number2),
1448
+ frameRate: optionalKey(Number2),
1449
+ bufferedFrames: optionalKey(Number2),
1450
+ bufferedBytes: optionalKey(Number2),
1451
+ sourceFrameCount: optionalKey(Number2),
1452
+ droppedFrameCount: optionalKey(Number2),
1453
+ saving: optionalKey(Boolean3),
1454
+ path: optionalKey(String3),
1455
+ durationMs: optionalKey(Number2),
1456
+ frameCount: optionalKey(Number2),
1457
+ cancelled: optionalKey(Boolean3)
1458
+ });
1459
+ var agentSettingKeys = settingKeys.filter((key) => key !== "autoUpdate");
1460
+ var AgentSettingValue = Union([String3, Number2]);
1461
+ var AgentSettingReport = Struct({
1462
+ value: AgentSettingValue,
1463
+ effective: AgentSettingValue,
1464
+ allowed: ArraySchema(AgentSettingValue),
1465
+ description: String3,
1466
+ overriddenBy: optionalKey(String3)
1467
+ });
1468
+ var AgentSettings = Record(Literals(agentSettingKeys), AgentSettingReport);
1469
+ var SettingsToolOutput = Struct({
1470
+ settings: AgentSettings,
1471
+ note: optionalKey(SettingsGetResponse.fields.note),
1472
+ changed: optionalKey(SettingsSetResponse.fields.changed),
1473
+ unchanged: optionalKey(SettingsSetResponse.fields.unchanged),
1474
+ overridden: optionalKey(SettingsSetResponse.fields.overridden),
1475
+ message: optionalKey(SettingsSetResponse.fields.message)
1476
+ });
1477
+ var SecretsListToolOutput = Struct({
1478
+ secrets: ArraySchema(Struct({
1479
+ name: String3,
1480
+ kind: Literals(["password", "totp"]),
1481
+ allowedOrigins: ArraySchema(String3),
1482
+ createdAt: String3,
1483
+ updatedAt: String3
1484
+ }))
1485
+ });
1486
+ function toolOutputJson(schema) {
1487
+ const document = toJsonSchemaDocument(schema);
1488
+ const json = Object.keys(document.definitions).length === 0 ? document.schema : { ...document.schema, $defs: document.definitions };
1489
+ return json;
1490
+ }
1491
+ function logSummaryHasContent(summary) {
1492
+ return summary !== undefined && (summary.totalCount > 0 || summary.returnedCount > 0 || summary.repeatedCount > 0 || summary.omittedCount > 0);
1493
+ }
1494
+ function aftermathHasContent(aftermath) {
1495
+ return aftermath !== undefined && (aftermath.startUrl !== aftermath.endUrl || aftermath.navigations.length > 0 || aftermath.consoleErrorCount > 0 || aftermath.pageErrorCount > 0 || aftermath.handoffs > 0 || aftermath.challenge !== undefined);
1496
+ }
1497
+ function executeToolOutput(result) {
1498
+ return {
1499
+ session: result.session.id,
1500
+ ...result.value === undefined ? {} : { value: result.value },
1501
+ ...result.logs.length > 0 ? { logs: result.logs } : {},
1502
+ ...logSummaryHasContent(result.logSummary) ? { logSummary: result.logSummary } : {},
1503
+ ...result.warnings && result.warnings.length > 0 ? { warnings: result.warnings } : {},
1504
+ ...result.diagnostic ? { diagnostic: result.diagnostic } : {},
1505
+ ...aftermathHasContent(result.aftermath) ? { aftermath: result.aftermath } : {},
1506
+ ...result.notice ? { notice: result.notice } : {}
1507
+ };
1508
+ }
1509
+ function executeToolText(result) {
1510
+ const text = result.isError ? result.text : isString(result.value) ? result.value : result.value === undefined ? result.text : JSON.stringify(result.value);
1511
+ return result.notice ? `${text}
1512
+
1513
+ ${result.notice}` : text;
1514
+ }
1515
+ function executeToolResult(value) {
1516
+ const result = value;
1517
+ if (result.media && result.media.length > 0) {
1518
+ return new CallToolResult({
1519
+ content: [
1520
+ TextContent.make({ text: result.text }),
1521
+ ...result.media.map((image) => ImageContent.make({
1522
+ data: new Uint8Array(Buffer.from(image.data, "base64")),
1523
+ mimeType: image.mimeType
1524
+ }))
1525
+ ],
1526
+ isError: result.isError
1527
+ });
1528
+ }
1529
+ return toolResultForValue2(executeToolOutput(result), {
1530
+ outputSchema: ExecuteToolOutput,
1531
+ text: executeToolText(result),
1532
+ isError: result.isError
1533
+ });
1534
+ }
1535
+ var ensureSessionExists = fnUntraced(function* (relay, id) {
1536
+ const sessions = yield* relay.sessions;
1537
+ const exists = sessions.some((session) => {
1538
+ return session.id === id;
1539
+ });
1540
+ if (!exists) {
1541
+ return yield* fail6(new Error(`Session not found: ${id}`));
1542
+ }
1543
+ });
1544
+ function parseExecuteArguments(input) {
1545
+ const object = requireObject(input);
1546
+ const code = requiredStringField(object, "code");
1547
+ const session = optionalStringField(object, "session");
1548
+ const timeoutMs = optionalNonNegativeIntegerField(object, "timeoutMs");
1549
+ const targetSelection = parseMcpTargetSelection(object);
1550
+ const browser = optionalStringField(object, "browser");
1551
+ return {
1552
+ code,
1553
+ ...session ? { session } : {},
1554
+ ...timeoutMs === undefined ? {} : { timeoutMs },
1555
+ ...targetSelection ? { targetSelection } : {},
1556
+ ...browser ? { browser } : {}
1557
+ };
1558
+ }
1559
+ function parseAdoptArguments(input) {
1560
+ const object = requireObject(input);
1561
+ const session = optionalStringField(object, "session");
1562
+ const targetSelection = parseMcpTargetSelection(object);
1563
+ const tabId = typeof object.tabId === "number" && Number.isInteger(object.tabId) ? object.tabId : undefined;
1564
+ if (tabId !== undefined && targetSelection)
1565
+ throw new Error("Use only one of tabId, targetUrl, or targetIndex");
1566
+ return {
1567
+ ...session ? { session } : {},
1568
+ ...targetSelection ? { targetSelection } : {},
1569
+ ...tabId === undefined ? {} : { tabId }
1570
+ };
1571
+ }
1572
+ function parseMcpTargetSelection(input) {
1573
+ const urlIncludes = optionalStringField(input, "targetUrl");
1574
+ const selection = parseTargetSelection2({
1575
+ ...urlIncludes ? { urlIncludes } : {},
1576
+ ...input.targetIndex === undefined ? {} : { index: input.targetIndex }
1577
+ });
1578
+ return selection?.urlIncludes || selection?.index !== undefined ? selection : undefined;
1579
+ }
1580
+ function requiredStringField(input, field) {
1581
+ const value = optionalStringField(input, field);
1582
+ if (!value) {
1583
+ throw new Error(`${field} is required`);
1584
+ }
1585
+ return value;
1586
+ }
1587
+ function requiredAction(input, actions) {
1588
+ const action = optionalStringField(input, "action");
1589
+ if (!action || !actions.includes(action)) {
1590
+ throw new Error(`action must be one of ${actions.join(", ")}`);
1591
+ }
1592
+ return action;
1593
+ }
1594
+ function optionalStringField(input, field) {
1595
+ const value = getString2(requireObject(input), field);
1596
+ return value ? value : undefined;
1597
+ }
1598
+ function optionalBooleanField(input, field) {
1599
+ const value = requireObject(input)[field];
1600
+ return isBoolean(value) ? value : undefined;
1601
+ }
1602
+ function optionalPositiveIntegerField(input, field) {
1603
+ const value = requireObject(input)[field];
1604
+ if (value === undefined)
1605
+ return;
1606
+ if (!isNumber(value) || !Number.isInteger(value) || value <= 0) {
1607
+ throw new Error(`${field} must be a positive integer`);
1608
+ }
1609
+ return value;
1610
+ }
1611
+ function optionalNonNegativeIntegerField(input, field) {
1612
+ const value = requireObject(input)[field];
1613
+ if (value === undefined)
1614
+ return;
1615
+ if (!isNumber(value) || !Number.isInteger(value) || value < 0) {
1616
+ throw new Error(`${field} must be a non-negative integer`);
1617
+ }
1618
+ return value;
1619
+ }
1620
+ function optionalStringArrayField(input, field) {
1621
+ const value = requireObject(input)[field];
1622
+ if (value === undefined)
1623
+ return;
1624
+ if (!Array.isArray(value) || !value.every((item) => isString(item) && item.length > 0)) {
1625
+ throw new Error(`${field} must be an array of non-empty strings`);
1626
+ }
1627
+ return value;
1628
+ }
1629
+ function requireObject(input) {
1630
+ const object = getObject2(input);
1631
+ if (!object) {
1632
+ throw new Error("Expected arguments object");
1633
+ }
1634
+ return object;
1635
+ }
1636
+ function stringifyResult(value) {
1637
+ if (isString(value)) {
1638
+ return value;
1639
+ }
1640
+ return JSON.stringify(value);
1641
+ }
1642
+ function encodedStructuredContent(value, schema) {
1643
+ if (!schema)
1644
+ return value;
1645
+ const encoded = encodeUnknownOption(schema)(value);
1646
+ return isSome(encoded) ? encoded.value : undefined;
1647
+ }
1648
+ function toolResultForValue2(value, options = {}) {
1649
+ const object = getObject2(value);
1650
+ const isError = options.isError ?? object?.isError === true;
1651
+ const media = Array.isArray(object?.media) ? object.media.flatMap((item) => {
1652
+ const image = getObject2(item);
1653
+ const mimeType = getString2(image, "mimeType");
1654
+ const data = getString2(image, "data");
1655
+ return image?.type === "image" && mimeType !== undefined && data !== undefined ? [{ data, mimeType }] : [];
1656
+ }) : [];
1657
+ const errorText = isError ? getString2(object, "text") : undefined;
1658
+ if (media.length > 0) {
1659
+ const { media: _media, ...rest } = object ?? {};
1660
+ const text = options.text ?? errorText ?? stringifyResult(rest);
1661
+ return new CallToolResult({
1662
+ content: [
1663
+ TextContent.make({ text }),
1664
+ ...media.map((image) => ImageContent.make({
1665
+ data: new Uint8Array(Buffer.from(image.data, "base64")),
1666
+ mimeType: image.mimeType
1667
+ }))
1668
+ ],
1669
+ isError
1670
+ });
1671
+ }
1672
+ const text = options.text ?? errorText ?? stringifyResult(value);
1673
+ const structuredContent = object ? encodedStructuredContent(object, options.outputSchema) : undefined;
1674
+ return toolResult({
1675
+ text,
1676
+ ...structuredContent === undefined ? {} : { structuredContent },
1677
+ isError
1678
+ });
1679
+ }
1680
+ function mcpErrorMessage2(tool, message) {
1681
+ if (!message.startsWith("Session not found:")) {
1682
+ return message;
1683
+ }
1684
+ return tool === "execute" || tool === "session_adopt" ? `${message} Create it with session_new first, or omit the explicit session id to use the MCP current session.` : `${message} Create it with session_new first.`;
1685
+ }
1686
+ function toolResult(options) {
1687
+ return new CallToolResult({
1688
+ content: [TextContent.make({ text: options.text })],
1689
+ structuredContent: options.structuredContent,
1690
+ isError: options.isError
1691
+ });
1692
+ }
1693
+
1694
+ export { settingKeys, settingSpecs, securityVariables, SettingsInputError, parseSettingChanges, settingsFromExtension, settingsToExtension, describeSettings, describeChanges, formatSettings, isStreamSchema, getStreamSchemas, ClientAbort, ServerClient, make, exitSchema, isWrapper, make2, Implementation, ClientCapabilities, INVALID_REQUEST_ERROR_CODE, METHOD_NOT_FOUND_ERROR_CODE, INVALID_PARAMS_ERROR_CODE, INTERNAL_ERROR_CODE, HEADER_MISMATCH_ERROR_CODE, ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpError, Ping, Initialize, CancelledNotification, ProgressNotification, ResourceListChangedNotification, ResourceUpdatedNotification, Prompt, TextContent, PromptListChangedNotification, Tool, CallToolResult, ToolListChangedNotification, LoggingLevel, LoggingMessageNotification, CreateMessage, ListRootsResult, ListRoots, Elicit, McpReverseOperationUnsupported, McpReverseOperationError, McpRequestContext, McpServerClient, McpServerClientMiddleware, ServerNotificationRpcs, EnabledWhen, mcpUpdateNote2, objectSchema, emptyInputSchema, sessionSchemaProperty, sessionAliasSchemaProperty, sessionOnlyInputSchema, ExecuteToolOutput, StatusToolOutput, CurrentSessionToolOutput, SessionDeleteToolOutput, NetworkToolOutput, RecordingToolOutput, FlightRecorderToolOutput, agentSettingKeys, SettingsToolOutput, SecretsListToolOutput, toolOutputJson, executeToolResult, ensureSessionExists, parseExecuteArguments, parseAdoptArguments, requiredStringField, requiredAction, optionalStringField, optionalBooleanField, optionalPositiveIntegerField, optionalStringArrayField, requireObject, toolResultForValue2, mcpErrorMessage2, toolResult };