@opencode/browse 0.0.6-dev.28 → 0.0.6-dev.32

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.
@@ -2,16 +2,1340 @@ import {
2
2
  parseTargetSelection2,
3
3
  getObject2,
4
4
  getString2
5
- } from "./main-8h1nwn45.mjs";
5
+ } from "./main-aqzas8ts.mjs";
6
6
  import {
7
7
  isNodeError,
8
8
  writeJsonFileAtomically
9
- } from "./main-x8w3s3rv.mjs";
9
+ } from "./main-30dkfffj.mjs";
10
+ import {
11
+ getStackTraceLimit,
12
+ setStackTraceLimit,
13
+ withFiber,
14
+ none,
15
+ some,
16
+ isSome,
17
+ fromUndefinedOr,
18
+ flatMap,
19
+ Service2,
20
+ makeUnsafe2,
21
+ empty,
22
+ make4,
23
+ add,
24
+ getOrUndefinedUnsafe,
25
+ merge,
26
+ TaggedError,
27
+ getCurrentFiber,
28
+ succeed2,
29
+ sync,
30
+ suspend,
31
+ succeedNone,
32
+ void_,
33
+ callback,
34
+ asSome,
35
+ flatMap2,
36
+ onExitPrimitive,
37
+ uninterruptibleMask,
38
+ effectContext,
39
+ StackTrace,
40
+ isEffect,
41
+ promise,
42
+ tryPromise,
43
+ succeed6,
44
+ sync2,
45
+ callback2,
46
+ gen,
47
+ fail4,
48
+ try_,
49
+ option2,
50
+ catchIf,
51
+ mapError,
52
+ context,
53
+ contextWith,
54
+ provide3,
55
+ acquireUseRelease,
56
+ fnUntraced,
57
+ fn,
58
+ isStream,
59
+ provideContext2,
60
+ passthrough,
61
+ transformOptional,
62
+ withDefault2,
63
+ declare,
64
+ decodeUnknownEffect2,
65
+ decodeUnknownSync,
66
+ make11,
67
+ isSchema,
68
+ optionalKey,
69
+ optional,
70
+ toType,
71
+ Literal,
72
+ TemplateLiteral,
73
+ Never,
74
+ Any,
75
+ Unknown,
76
+ String3,
77
+ Boolean3,
78
+ Void,
79
+ Struct,
80
+ Record,
81
+ StructWithRest,
82
+ ArraySchema,
83
+ Union,
84
+ Literals,
85
+ UndefinedOr,
86
+ decodeTo2,
87
+ decode2,
88
+ withConstructorDefault,
89
+ tag,
90
+ Opaque,
91
+ makeFilter,
92
+ isPattern,
93
+ Finite,
94
+ isBetween,
95
+ Int2,
96
+ Defect,
97
+ Uint8ArrayFromBase64,
98
+ Exit,
99
+ Class2,
100
+ Error2,
101
+ TaggedError2,
102
+ Json,
103
+ JsonObject
104
+ } from "./main-9z6jbwdp.mjs";
10
105
  import {
11
106
  dataRoot,
12
107
  cliCommand
13
- } from "./main-8ncff5jp.mjs";
108
+ } from "./main-ea9djgtm.mjs";
109
+ import {
110
+ pipeArguments,
111
+ identity,
112
+ constTrue,
113
+ constFalse,
114
+ constUndefined,
115
+ isString,
116
+ isNumber,
117
+ isBoolean,
118
+ isObject,
119
+ hasProperty
120
+ } from "./main-yf9xhpn4.mjs";
121
+
122
+ // node_modules/effect/dist/Semaphore.js
123
+ var makeUnsafe = (permits) => new SemaphoreImpl(permits);
124
+ var waitForPermits = (self, n, effect) => callback((resume) => {
125
+ if (self.free >= n)
126
+ return resume(effect);
127
+ const observer = () => {
128
+ if (self.free < n)
129
+ return;
130
+ self.waiters.delete(observer);
131
+ resume(effect);
132
+ };
133
+ self.waiters.add(observer);
134
+ return sync(() => {
135
+ self.waiters.delete(observer);
136
+ });
137
+ });
138
+
139
+ class SemaphoreImpl {
140
+ waiters = /* @__PURE__ */ new Set;
141
+ taken = 0;
142
+ permits;
143
+ constructor(permits) {
144
+ this.permits = permits;
145
+ }
146
+ get free() {
147
+ return this.permits - this.taken;
148
+ }
149
+ take(n) {
150
+ const take = suspend(() => {
151
+ if (this.free < n) {
152
+ return waitForPermits(this, n, take);
153
+ }
154
+ this.taken += n;
155
+ return succeed2(n);
156
+ });
157
+ return take;
158
+ }
159
+ takeIfAvailable(n) {
160
+ return suspend(() => {
161
+ if (this.free < n)
162
+ return succeed2(false);
163
+ this.taken += n;
164
+ return succeed2(true);
165
+ });
166
+ }
167
+ releaseUnsafe(fiber, n) {
168
+ this.taken -= n;
169
+ if (this.waiters.size > 0) {
170
+ fiber.currentDispatcher.scheduleTask(() => {
171
+ for (const observer of this.waiters) {
172
+ if (this.free <= 0)
173
+ break;
174
+ observer();
175
+ }
176
+ }, 0);
177
+ }
178
+ return this.free;
179
+ }
180
+ resize(permits) {
181
+ return withFiber((fiber) => {
182
+ this.permits = permits;
183
+ if (this.free < 0)
184
+ return void_;
185
+ this.releaseUnsafe(fiber, 0);
186
+ return void_;
187
+ });
188
+ }
189
+ release(n) {
190
+ return withFiber((fiber) => succeed2(this.releaseUnsafe(fiber, n)));
191
+ }
192
+ get releaseAll() {
193
+ return withFiber((fiber) => succeed2(this.releaseUnsafe(fiber, this.taken)));
194
+ }
195
+ withPermits(n) {
196
+ return (self) => uninterruptibleMask((restore) => {
197
+ const acquire = suspend(() => {
198
+ if (this.free < n) {
199
+ const wait = waitForPermits(this, n, void_);
200
+ return flatMap2(restore(wait), () => acquire);
201
+ }
202
+ this.taken += n;
203
+ return onExitPrimitive(restore(self), () => {
204
+ this.releaseUnsafe(getCurrentFiber(), n);
205
+ return;
206
+ }, true);
207
+ });
208
+ return acquire;
209
+ });
210
+ }
211
+ withPermit = /* @__PURE__ */ this.withPermits(1);
212
+ withPermitsIfAvailable(n) {
213
+ return (self) => uninterruptibleMask((restore) => {
214
+ if (this.free < n)
215
+ return succeedNone;
216
+ this.taken += n;
217
+ return onExitPrimitive(restore(asSome(self)), () => {
218
+ this.releaseUnsafe(getCurrentFiber(), n);
219
+ return;
220
+ }, true);
221
+ });
222
+ }
223
+ }
224
+ var make = (permits) => sync(() => new SemaphoreImpl(permits));
225
+
226
+ // node_modules/effect/dist/PrimaryKey.js
227
+ var symbol = "~effect/PrimaryKey";
228
+ // node_modules/effect/dist/rpc/RpcSchema.js
229
+ var StreamSchemaTypeId = "~effect/rpc/RpcSchema/StreamSchema";
230
+ function isStreamSchema(schema) {
231
+ return hasProperty(schema, StreamSchemaTypeId);
232
+ }
233
+ function getStreamSchemas(schema) {
234
+ return isStreamSchema(schema) ? some({
235
+ success: schema.success,
236
+ error: schema.error
237
+ }) : none();
238
+ }
239
+ var schema = /* @__PURE__ */ declare(isStream);
240
+ function Stream(success, error) {
241
+ return make11(schema.ast, {
242
+ [StreamSchemaTypeId]: StreamSchemaTypeId,
243
+ success,
244
+ error
245
+ });
246
+ }
247
+
248
+ class ClientAbort extends (/* @__PURE__ */ Service2()("effect/rpc/RpcSchema/ClientAbort")) {
249
+ static annotation = /* @__PURE__ */ this.context(true).pipe(/* @__PURE__ */ add(StackTrace, {
250
+ name: "ClientAbort",
251
+ stack: constUndefined,
252
+ parent: undefined
253
+ }));
254
+ }
255
+
256
+ // node_modules/effect/dist/rpc/Rpc.js
257
+ var TypeId = "~effect/rpc/Rpc";
258
+ class ServerClient {
259
+ id;
260
+ annotations;
261
+ constructor(id) {
262
+ this.id = id;
263
+ this.annotations = empty();
264
+ }
265
+ annotate(tag, value) {
266
+ this.annotations = add(this.annotations, tag, value);
267
+ return this;
268
+ }
269
+ }
270
+ var Proto = {
271
+ [TypeId]: TypeId,
272
+ pipe() {
273
+ return pipeArguments(this, arguments);
274
+ },
275
+ setSuccess(successSchema) {
276
+ return makeProto({
277
+ _tag: this._tag,
278
+ payloadSchema: this.payloadSchema,
279
+ successSchema,
280
+ errorSchema: this.errorSchema,
281
+ defectSchema: this.defectSchema,
282
+ annotations: this.annotations,
283
+ middlewares: this.middlewares
284
+ });
285
+ },
286
+ setError(errorSchema) {
287
+ return makeProto({
288
+ _tag: this._tag,
289
+ payloadSchema: this.payloadSchema,
290
+ successSchema: this.successSchema,
291
+ errorSchema,
292
+ defectSchema: this.defectSchema,
293
+ annotations: this.annotations,
294
+ middlewares: this.middlewares
295
+ });
296
+ },
297
+ setPayload(payloadSchema) {
298
+ return makeProto({
299
+ _tag: this._tag,
300
+ payloadSchema: isSchema(payloadSchema) ? payloadSchema : Struct(payloadSchema),
301
+ successSchema: this.successSchema,
302
+ errorSchema: this.errorSchema,
303
+ defectSchema: this.defectSchema,
304
+ annotations: this.annotations,
305
+ middlewares: this.middlewares
306
+ });
307
+ },
308
+ middleware(middleware) {
309
+ return makeProto({
310
+ _tag: this._tag,
311
+ payloadSchema: this.payloadSchema,
312
+ successSchema: this.successSchema,
313
+ errorSchema: this.errorSchema,
314
+ defectSchema: this.defectSchema,
315
+ annotations: this.annotations,
316
+ middlewares: new Set([...this.middlewares, middleware])
317
+ });
318
+ },
319
+ prefix(prefix) {
320
+ return makeProto({
321
+ _tag: `${prefix}${this._tag}`,
322
+ payloadSchema: this.payloadSchema,
323
+ successSchema: this.successSchema,
324
+ errorSchema: this.errorSchema,
325
+ defectSchema: this.defectSchema,
326
+ annotations: this.annotations,
327
+ middlewares: this.middlewares
328
+ });
329
+ },
330
+ annotate(tag, value) {
331
+ return makeProto({
332
+ _tag: this._tag,
333
+ payloadSchema: this.payloadSchema,
334
+ successSchema: this.successSchema,
335
+ errorSchema: this.errorSchema,
336
+ defectSchema: this.defectSchema,
337
+ middlewares: this.middlewares,
338
+ annotations: add(this.annotations, tag, value)
339
+ });
340
+ },
341
+ annotateMerge(context) {
342
+ return makeProto({
343
+ _tag: this._tag,
344
+ payloadSchema: this.payloadSchema,
345
+ successSchema: this.successSchema,
346
+ errorSchema: this.errorSchema,
347
+ defectSchema: this.defectSchema,
348
+ middlewares: this.middlewares,
349
+ annotations: merge(this.annotations, context)
350
+ });
351
+ }
352
+ };
353
+ var makeProto = (options) => {
354
+ function Rpc() {}
355
+ Object.setPrototypeOf(Rpc, Proto);
356
+ Object.assign(Rpc, options);
357
+ Rpc.key = `effect/rpc/Rpc/${options._tag}`;
358
+ return Rpc;
359
+ };
360
+ var make2 = (tag, options) => {
361
+ const successSchema = options?.success ?? Void;
362
+ const errorSchema = options?.error ?? Never;
363
+ const defectSchema = options?.defect ?? Defect();
364
+ let payloadSchema;
365
+ if (options?.primaryKey) {
366
+ payloadSchema = class Payload extends Class2(`effect/rpc/Rpc/${tag}`)(options.payload) {
367
+ [symbol]() {
368
+ return options.primaryKey(this);
369
+ }
370
+ };
371
+ } else {
372
+ payloadSchema = isSchema(options?.payload) ? options?.payload : options?.payload ? Struct(options?.payload) : Void;
373
+ }
374
+ return makeProto({
375
+ _tag: tag,
376
+ payloadSchema,
377
+ successSchema: options?.stream ? Stream(successSchema, errorSchema) : successSchema,
378
+ errorSchema: options?.stream ? Never : errorSchema,
379
+ defectSchema,
380
+ annotations: empty(),
381
+ middlewares: new Set
382
+ });
383
+ };
384
+ var exitSchemaCache = /* @__PURE__ */ new WeakMap;
385
+ var exitSchema = (self) => {
386
+ if (exitSchemaCache.has(self)) {
387
+ return exitSchemaCache.get(self);
388
+ }
389
+ const rpc = self;
390
+ const failures = new Set([rpc.errorSchema]);
391
+ const streamSchemas = getStreamSchemas(rpc.successSchema);
392
+ if (isSome(streamSchemas)) {
393
+ failures.add(streamSchemas.value.error);
394
+ }
395
+ for (const middleware of rpc.middlewares) {
396
+ failures.add(middleware.error);
397
+ }
398
+ const schema = Exit(isSome(streamSchemas) ? Void : rpc.successSchema, Union([...failures]), rpc.defectSchema);
399
+ exitSchemaCache.set(self, schema);
400
+ return schema;
401
+ };
402
+ var WrapperTypeId = "~effect/rpc/Rpc/Wrapper";
403
+ var isWrapper = (u) => (WrapperTypeId in u);
404
+
405
+ // node_modules/effect/dist/rpc/RpcGroup.js
406
+ var RpcGroupProto = {
407
+ add(...rpcs) {
408
+ const requests = new Map(this.requests);
409
+ for (const rpc of rpcs) {
410
+ requests.set(rpc._tag, rpc);
411
+ }
412
+ return makeProto2({
413
+ requests,
414
+ annotations: this.annotations
415
+ });
416
+ },
417
+ merge(...groups) {
418
+ const requests = new Map(this.requests);
419
+ const annotations = new Map(this.annotations.mapUnsafe);
420
+ for (const group of groups) {
421
+ for (const [tag, rpc] of group.requests) {
422
+ requests.set(tag, rpc);
423
+ }
424
+ for (const [key, value] of group.annotations.mapUnsafe) {
425
+ annotations.set(key, value);
426
+ }
427
+ }
428
+ return makeProto2({
429
+ requests,
430
+ annotations: makeUnsafe2(annotations)
431
+ });
432
+ },
433
+ omit(...tags) {
434
+ const requests = new Map(this.requests);
435
+ for (const tag of tags) {
436
+ requests.delete(tag);
437
+ }
438
+ return makeProto2({
439
+ requests,
440
+ annotations: this.annotations
441
+ });
442
+ },
443
+ middleware(middleware) {
444
+ const requests = new Map;
445
+ for (const [tag, rpc] of this.requests) {
446
+ requests.set(tag, rpc.middleware(middleware));
447
+ }
448
+ return makeProto2({
449
+ requests,
450
+ annotations: this.annotations
451
+ });
452
+ },
453
+ toHandlers(build) {
454
+ const self = this;
455
+ return gen(function* () {
456
+ const services = yield* context();
457
+ const handlers = isEffect(build) ? yield* build : build;
458
+ const contextMap = new Map;
459
+ self.requests.forEach((rpc, tag) => {
460
+ contextMap.set(rpc.key, {
461
+ tag: rpc._tag,
462
+ handler: handlers[tag],
463
+ context: services
464
+ });
465
+ });
466
+ return makeUnsafe2(contextMap);
467
+ });
468
+ },
469
+ prefix(prefix) {
470
+ const requests = new Map;
471
+ for (const rpc of this.requests.values()) {
472
+ const newRpc = rpc.prefix(prefix);
473
+ requests.set(newRpc._tag, newRpc);
474
+ }
475
+ return makeProto2({
476
+ requests,
477
+ annotations: this.annotations
478
+ });
479
+ },
480
+ toLayer(build) {
481
+ return effectContext(this.toHandlers(build));
482
+ },
483
+ of: identity,
484
+ toLayerHandler(service, build) {
485
+ const self = this;
486
+ return effectContext(gen(function* () {
487
+ const services = yield* context();
488
+ const handler = isEffect(build) ? yield* build : build;
489
+ const contextMap = new Map;
490
+ const rpc = self.requests.get(service);
491
+ contextMap.set(rpc.key, {
492
+ handler,
493
+ context: services
494
+ });
495
+ return makeUnsafe2(contextMap);
496
+ }));
497
+ },
498
+ accessHandler(service) {
499
+ return contextWith((parentContext) => {
500
+ const rpc = this.requests.get(service);
501
+ const {
502
+ handler,
503
+ context
504
+ } = getOrUndefinedUnsafe(parentContext, rpc.key);
505
+ return succeed6((payload, options) => {
506
+ options.rpc = rpc;
507
+ const result = handler(payload, options);
508
+ const effectOrStream = isWrapper(result) ? result.value : result;
509
+ return isEffect(effectOrStream) ? provide3(effectOrStream, context) : provideContext2(effectOrStream, context);
510
+ });
511
+ });
512
+ },
513
+ annotate(service, value) {
514
+ return makeProto2({
515
+ requests: this.requests,
516
+ annotations: add(this.annotations, service, value)
517
+ });
518
+ },
519
+ annotateRpcs(service, value) {
520
+ return this.annotateRpcsMerge(make4(service, value));
521
+ },
522
+ annotateMerge(context) {
523
+ return makeProto2({
524
+ requests: this.requests,
525
+ annotations: merge(this.annotations, context)
526
+ });
527
+ },
528
+ annotateRpcsMerge(context) {
529
+ const requests = new Map;
530
+ for (const [tag, rpc] of this.requests) {
531
+ requests.set(tag, rpc.annotateMerge(merge(context, rpc.annotations)));
532
+ }
533
+ return makeProto2({
534
+ requests,
535
+ annotations: this.annotations
536
+ });
537
+ }
538
+ };
539
+ var makeProto2 = (options) => Object.assign(function() {}, RpcGroupProto, {
540
+ requests: options.requests,
541
+ annotations: options.annotations
542
+ });
543
+ var make3 = (...rpcs) => makeProto2({
544
+ requests: new Map(rpcs.map((rpc) => [rpc._tag, rpc])),
545
+ annotations: empty()
546
+ });
547
+
548
+ // node_modules/effect/dist/rpc/RpcMiddleware.js
549
+ var TypeId2 = "~effect/rpc/RpcMiddleware";
550
+ var Service = () => (id, options) => {
551
+ const limit = getStackTraceLimit();
552
+ let creationError;
553
+ if (limit !== 0) {
554
+ setStackTraceLimit(2);
555
+ creationError = new globalThis.Error;
556
+ setStackTraceLimit(limit);
557
+ }
558
+ function ServiceClass() {}
559
+ const ServiceClass_ = ServiceClass;
560
+ Object.setPrototypeOf(ServiceClass, Object.getPrototypeOf(Service2(id)));
561
+ ServiceClass.key = id;
562
+ Object.defineProperty(ServiceClass, "stack", {
563
+ get() {
564
+ return creationError?.stack;
565
+ }
566
+ });
567
+ ServiceClass_[TypeId2] = TypeId2;
568
+ ServiceClass_.error = options?.error ?? Never;
569
+ ServiceClass_.requiredForClient = options?.requiredForClient ?? false;
570
+ return ServiceClass;
571
+ };
572
+
573
+ // node_modules/effect/dist/ai/McpSchema.js
574
+ var optionalWithDefault = (schema, defaultValue) => {
575
+ const effect = sync2(defaultValue);
576
+ return optionalKey(schema).pipe(decode2({
577
+ decode: withDefault2(effect),
578
+ encode: passthrough()
579
+ }), withConstructorDefault(effect));
580
+ };
581
+ var optional2 = (schema) => optionalKey(schema).pipe(decodeTo2(toType(optional(schema)), {
582
+ decode: passthrough(),
583
+ encode: transformOptional(flatMap(fromUndefinedOr))
584
+ }));
585
+ var RequestId = /* @__PURE__ */ Union([String3, Finite]);
586
+ var ProgressToken = /* @__PURE__ */ Union([String3, Finite]);
587
+
588
+ class RequestMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
589
+ _meta: /* @__PURE__ */ optional2(/* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
590
+ progressToken: /* @__PURE__ */ optional2(ProgressToken)
591
+ }), [JsonObject]))
592
+ }))) {
593
+ }
594
+
595
+ class ResultMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
596
+ _meta: /* @__PURE__ */ optional2(JsonObject)
597
+ }))) {
598
+ }
599
+
600
+ class NotificationMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
601
+ _meta: /* @__PURE__ */ optional2(JsonObject)
602
+ }))) {
603
+ }
604
+ var Cursor = String3;
605
+
606
+ class PaginatedRequestMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
607
+ ...RequestMeta.fields,
608
+ cursor: /* @__PURE__ */ optional2(Cursor)
609
+ }))) {
610
+ }
611
+
612
+ class PaginatedResultMeta extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
613
+ ...ResultMeta.fields,
614
+ nextCursor: /* @__PURE__ */ optional2(Cursor)
615
+ }))) {
616
+ }
617
+ var Role = /* @__PURE__ */ Literals(["user", "assistant"]);
618
+
619
+ class Annotations extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
620
+ audience: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Role)),
621
+ priority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
622
+ minimum: 0,
623
+ maximum: 1
624
+ }))),
625
+ lastModified: /* @__PURE__ */ optional2(String3)
626
+ }))) {
627
+ }
628
+
629
+ class Icon extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/Icon")({
630
+ src: String3,
631
+ mimeType: /* @__PURE__ */ optional2(String3),
632
+ sizes: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3)),
633
+ theme: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["light", "dark"]))
634
+ })) {
635
+ }
636
+
637
+ class Implementation extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
638
+ name: String3,
639
+ title: /* @__PURE__ */ optional2(String3),
640
+ version: String3,
641
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
642
+ description: /* @__PURE__ */ optional2(String3),
643
+ websiteUrl: /* @__PURE__ */ optional2(String3)
644
+ }))) {
645
+ }
646
+
647
+ class ClientCapabilities extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ClientCapabilities")({
648
+ experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Struct({}))),
649
+ extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String3, "/", String3]), Json)),
650
+ roots: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
651
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
652
+ })),
653
+ sampling: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
654
+ context: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
655
+ tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
656
+ })),
657
+ elicitation: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
658
+ form: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
659
+ url: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({}))
660
+ }))
661
+ })) {
662
+ }
663
+
664
+ class ServerCapabilities extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
665
+ experimental: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Struct({}))),
666
+ extensions: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(/* @__PURE__ */ TemplateLiteral([String3, "/", String3]), Json)),
667
+ logging: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
668
+ completions: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({})),
669
+ prompts: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
670
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
671
+ })),
672
+ resources: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
673
+ subscribe: /* @__PURE__ */ optional2(Boolean3),
674
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
675
+ })),
676
+ tools: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct({
677
+ listChanged: /* @__PURE__ */ optional2(Boolean3)
678
+ }))
679
+ }))) {
680
+ }
681
+
682
+ class McpErrorBase extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/McpErrorBase")({
683
+ code: Int2,
684
+ message: String3,
685
+ data: /* @__PURE__ */ optional2(Any)
686
+ })) {
687
+ }
688
+ var INVALID_REQUEST_ERROR_CODE = -32600;
689
+ var METHOD_NOT_FOUND_ERROR_CODE = -32601;
690
+ var INVALID_PARAMS_ERROR_CODE = -32602;
691
+ var INTERNAL_ERROR_CODE = -32603;
692
+ var PARSE_ERROR_CODE = -32700;
693
+ var HEADER_MISMATCH_ERROR_CODE = -32020;
694
+
695
+ class ParseError extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/ParseError")({
696
+ ...McpErrorBase.fields,
697
+ _tag: /* @__PURE__ */ tag("ParseError"),
698
+ code: /* @__PURE__ */ tag(PARSE_ERROR_CODE)
699
+ })) {
700
+ }
701
+
702
+ class InvalidRequest extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InvalidRequest")({
703
+ ...McpErrorBase.fields,
704
+ _tag: /* @__PURE__ */ tag("InvalidRequest"),
705
+ code: /* @__PURE__ */ tag(INVALID_REQUEST_ERROR_CODE)
706
+ })) {
707
+ }
708
+
709
+ class MethodNotFound extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/MethodNotFound")({
710
+ ...McpErrorBase.fields,
711
+ _tag: /* @__PURE__ */ tag("MethodNotFound"),
712
+ code: /* @__PURE__ */ tag(METHOD_NOT_FOUND_ERROR_CODE)
713
+ })) {
714
+ }
715
+
716
+ class InvalidParams extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InvalidParams")({
717
+ ...McpErrorBase.fields,
718
+ _tag: /* @__PURE__ */ tag("InvalidParams"),
719
+ code: /* @__PURE__ */ tag(INVALID_PARAMS_ERROR_CODE)
720
+ })) {
721
+ }
722
+
723
+ class InternalError extends (/* @__PURE__ */ Error2("effect/ai/McpSchema/InternalError")({
724
+ ...McpErrorBase.fields,
725
+ _tag: /* @__PURE__ */ tag("InternalError"),
726
+ code: /* @__PURE__ */ tag(INTERNAL_ERROR_CODE)
727
+ })) {
728
+ static notImplemented = /* @__PURE__ */ new InternalError({
729
+ message: "Not implemented"
730
+ });
731
+ }
732
+ var McpError = /* @__PURE__ */ Union([ParseError, InvalidRequest, MethodNotFound, InvalidParams, InternalError, McpErrorBase]);
733
+
734
+ class Ping extends (/* @__PURE__ */ make2("ping", {
735
+ success: /* @__PURE__ */ Struct({}),
736
+ error: McpError,
737
+ payload: /* @__PURE__ */ UndefinedOr(RequestMeta)
738
+ })) {
739
+ }
740
+
741
+ class InitializeResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
742
+ ...ResultMeta.fields,
743
+ protocolVersion: String3,
744
+ capabilities: ServerCapabilities,
745
+ serverInfo: Implementation,
746
+ instructions: /* @__PURE__ */ optional2(String3)
747
+ }))) {
748
+ }
749
+
750
+ class Initialize extends (/* @__PURE__ */ make2("initialize", {
751
+ success: InitializeResult,
752
+ error: McpError,
753
+ payload: {
754
+ ...RequestMeta.fields,
755
+ protocolVersion: String3,
756
+ capabilities: ClientCapabilities,
757
+ clientInfo: Implementation
758
+ }
759
+ })) {
760
+ }
761
+ class CancelledNotification extends (/* @__PURE__ */ make2("notifications/cancelled", {
762
+ payload: {
763
+ ...NotificationMeta.fields,
764
+ requestId: RequestId,
765
+ reason: /* @__PURE__ */ optional2(String3)
766
+ }
767
+ })) {
768
+ }
14
769
 
770
+ class ProgressNotification extends (/* @__PURE__ */ make2("notifications/progress", {
771
+ payload: {
772
+ ...NotificationMeta.fields,
773
+ progressToken: ProgressToken,
774
+ progress: Finite,
775
+ total: /* @__PURE__ */ optional2(Finite),
776
+ message: /* @__PURE__ */ optional2(String3)
777
+ }
778
+ })) {
779
+ }
780
+
781
+ class Resource extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/Resource")({
782
+ uri: String3,
783
+ name: String3,
784
+ title: /* @__PURE__ */ optional2(String3),
785
+ description: /* @__PURE__ */ optional2(String3),
786
+ mimeType: /* @__PURE__ */ optional2(String3),
787
+ annotations: /* @__PURE__ */ optional2(Annotations),
788
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
789
+ size: /* @__PURE__ */ optional2(Int2),
790
+ _meta: /* @__PURE__ */ optional2(JsonObject)
791
+ })) {
792
+ }
793
+
794
+ class ResourceTemplate extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ResourceTemplate")({
795
+ uriTemplate: String3,
796
+ name: String3,
797
+ title: /* @__PURE__ */ optional2(String3),
798
+ description: /* @__PURE__ */ optional2(String3),
799
+ mimeType: /* @__PURE__ */ optional2(String3),
800
+ annotations: /* @__PURE__ */ optional2(Annotations),
801
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
802
+ _meta: /* @__PURE__ */ optional2(JsonObject)
803
+ })) {
804
+ }
805
+
806
+ class ResourceContents extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
807
+ uri: String3,
808
+ mimeType: /* @__PURE__ */ optional2(String3),
809
+ _meta: /* @__PURE__ */ optional2(JsonObject)
810
+ }))) {
811
+ }
812
+
813
+ class TextResourceContents extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
814
+ ...ResourceContents.fields,
815
+ text: String3
816
+ }))) {
817
+ }
818
+
819
+ class BlobResourceContents extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
820
+ ...ResourceContents.fields,
821
+ blob: Uint8ArrayFromBase64
822
+ }))) {
823
+ }
824
+
825
+ class ListResourcesResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ListResourcesResult")({
826
+ ...PaginatedResultMeta.fields,
827
+ resources: /* @__PURE__ */ ArraySchema(Resource)
828
+ })) {
829
+ }
830
+ class ListResourceTemplatesResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ListResourceTemplatesResult")({
831
+ ...PaginatedResultMeta.fields,
832
+ resourceTemplates: /* @__PURE__ */ ArraySchema(ResourceTemplate)
833
+ })) {
834
+ }
835
+ class ReadResourceResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
836
+ ...ResultMeta.fields,
837
+ contents: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]))
838
+ }))) {
839
+ }
840
+
841
+ class ReadResource extends (/* @__PURE__ */ make2("resources/read", {
842
+ success: ReadResourceResult,
843
+ error: McpError,
844
+ payload: {
845
+ ...RequestMeta.fields,
846
+ uri: String3
847
+ }
848
+ })) {
849
+ }
850
+
851
+ class ResourceListChangedNotification extends (/* @__PURE__ */ make2("notifications/resources/list_changed", {
852
+ payload: /* @__PURE__ */ UndefinedOr(NotificationMeta)
853
+ })) {
854
+ }
855
+
856
+ class Subscribe extends (/* @__PURE__ */ make2("resources/subscribe", {
857
+ success: /* @__PURE__ */ Struct({}),
858
+ error: McpError,
859
+ payload: {
860
+ ...RequestMeta.fields,
861
+ uri: String3
862
+ }
863
+ })) {
864
+ }
865
+
866
+ class Unsubscribe extends (/* @__PURE__ */ make2("resources/unsubscribe", {
867
+ success: /* @__PURE__ */ Struct({}),
868
+ error: McpError,
869
+ payload: {
870
+ ...RequestMeta.fields,
871
+ uri: String3
872
+ }
873
+ })) {
874
+ }
875
+
876
+ class ResourceUpdatedNotification extends (/* @__PURE__ */ make2("notifications/resources/updated", {
877
+ payload: {
878
+ ...NotificationMeta.fields,
879
+ uri: String3
880
+ }
881
+ })) {
882
+ }
883
+
884
+ class PromptArgument extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
885
+ name: String3,
886
+ title: /* @__PURE__ */ optional2(String3),
887
+ description: /* @__PURE__ */ optional2(String3),
888
+ required: /* @__PURE__ */ optional2(Boolean3)
889
+ }))) {
890
+ }
891
+
892
+ class Prompt extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/Prompt")({
893
+ name: String3,
894
+ title: /* @__PURE__ */ optional2(String3),
895
+ description: /* @__PURE__ */ optional2(String3),
896
+ arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(PromptArgument)),
897
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
898
+ _meta: /* @__PURE__ */ optional2(JsonObject)
899
+ })) {
900
+ }
901
+
902
+ class TextContent extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
903
+ type: /* @__PURE__ */ tag("text"),
904
+ text: String3,
905
+ annotations: /* @__PURE__ */ optional2(Annotations),
906
+ _meta: /* @__PURE__ */ optional2(JsonObject)
907
+ }))) {
908
+ }
909
+
910
+ class ImageContent extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
911
+ type: /* @__PURE__ */ tag("image"),
912
+ data: Uint8ArrayFromBase64,
913
+ mimeType: String3,
914
+ annotations: /* @__PURE__ */ optional2(Annotations),
915
+ _meta: /* @__PURE__ */ optional2(JsonObject)
916
+ }))) {
917
+ }
918
+
919
+ class AudioContent extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
920
+ type: /* @__PURE__ */ tag("audio"),
921
+ data: Uint8ArrayFromBase64,
922
+ mimeType: String3,
923
+ annotations: /* @__PURE__ */ optional2(Annotations),
924
+ _meta: /* @__PURE__ */ optional2(JsonObject)
925
+ }))) {
926
+ }
927
+
928
+ class EmbeddedResource extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
929
+ type: /* @__PURE__ */ tag("resource"),
930
+ resource: /* @__PURE__ */ Union([TextResourceContents, BlobResourceContents]),
931
+ annotations: /* @__PURE__ */ optional2(Annotations),
932
+ _meta: /* @__PURE__ */ optional2(JsonObject)
933
+ }))) {
934
+ }
935
+
936
+ class ResourceLink extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
937
+ ...Resource.fields,
938
+ type: /* @__PURE__ */ tag("resource_link")
939
+ }))) {
940
+ }
941
+ var ContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, EmbeddedResource, ResourceLink]);
942
+
943
+ class PromptMessage extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
944
+ role: Role,
945
+ content: ContentBlock
946
+ }))) {
947
+ }
948
+
949
+ class ListPromptsResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ListPromptsResult")({
950
+ ...PaginatedResultMeta.fields,
951
+ prompts: /* @__PURE__ */ ArraySchema(Prompt)
952
+ })) {
953
+ }
954
+ class GetPromptResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/GetPromptResult")({
955
+ ...ResultMeta.fields,
956
+ messages: /* @__PURE__ */ ArraySchema(PromptMessage),
957
+ description: /* @__PURE__ */ optional2(String3)
958
+ })) {
959
+ }
960
+
961
+ class GetPrompt extends (/* @__PURE__ */ make2("prompts/get", {
962
+ success: GetPromptResult,
963
+ error: McpError,
964
+ payload: {
965
+ ...RequestMeta.fields,
966
+ name: String3,
967
+ title: /* @__PURE__ */ optional2(String3),
968
+ arguments: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, String3))
969
+ }
970
+ })) {
971
+ }
972
+
973
+ class PromptListChangedNotification extends (/* @__PURE__ */ make2("notifications/prompts/list_changed", {
974
+ payload: /* @__PURE__ */ UndefinedOr(NotificationMeta)
975
+ })) {
976
+ }
977
+
978
+ class ToolAnnotations extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
979
+ title: /* @__PURE__ */ optional2(String3),
980
+ readOnlyHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constFalse),
981
+ destructiveHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constTrue),
982
+ idempotentHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constFalse),
983
+ openWorldHint: /* @__PURE__ */ optionalWithDefault(Boolean3, constTrue)
984
+ }))) {
985
+ }
986
+ var ToolJson = /* @__PURE__ */ StructWithRest(/* @__PURE__ */ Struct({
987
+ type: /* @__PURE__ */ Literal("object"),
988
+ properties: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, JsonObject)),
989
+ required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
990
+ }), [JsonObject]);
991
+ var ToolOutputJson = JsonObject;
992
+
993
+ class Tool extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/Tool")({
994
+ name: String3,
995
+ title: /* @__PURE__ */ optional2(String3),
996
+ description: /* @__PURE__ */ optional2(String3),
997
+ inputSchema: ToolJson,
998
+ outputSchema: /* @__PURE__ */ optional2(ToolOutputJson),
999
+ annotations: /* @__PURE__ */ optional2(ToolAnnotations),
1000
+ icons: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(Icon)),
1001
+ _meta: /* @__PURE__ */ optional2(JsonObject)
1002
+ })) {
1003
+ }
1004
+
1005
+ class ListToolsResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ListToolsResult")({
1006
+ ...PaginatedResultMeta.fields,
1007
+ tools: /* @__PURE__ */ ArraySchema(Tool)
1008
+ })) {
1009
+ }
1010
+ class CallToolResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/CallToolResult")({
1011
+ ...ResultMeta.fields,
1012
+ content: /* @__PURE__ */ ArraySchema(ContentBlock),
1013
+ structuredContent: /* @__PURE__ */ optional2(Json),
1014
+ isError: /* @__PURE__ */ optional2(Boolean3)
1015
+ })) {
1016
+ }
1017
+
1018
+ class CallTool extends (/* @__PURE__ */ make2("tools/call", {
1019
+ success: CallToolResult,
1020
+ error: McpError,
1021
+ payload: {
1022
+ ...RequestMeta.fields,
1023
+ name: String3,
1024
+ arguments: /* @__PURE__ */ optionalWithDefault(/* @__PURE__ */ Record(String3, Any), () => ({}))
1025
+ }
1026
+ })) {
1027
+ }
1028
+
1029
+ class ToolListChangedNotification extends (/* @__PURE__ */ make2("notifications/tools/list_changed", {
1030
+ payload: /* @__PURE__ */ UndefinedOr(NotificationMeta)
1031
+ })) {
1032
+ }
1033
+ var LoggingLevel = /* @__PURE__ */ Literals(["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"]);
1034
+
1035
+ class SetLevel extends (/* @__PURE__ */ make2("logging/setLevel", {
1036
+ payload: {
1037
+ ...RequestMeta.fields,
1038
+ level: LoggingLevel
1039
+ },
1040
+ success: /* @__PURE__ */ Struct({}),
1041
+ error: McpError
1042
+ })) {
1043
+ }
1044
+
1045
+ class LoggingMessageNotification extends (/* @__PURE__ */ make2("notifications/message", {
1046
+ payload: /* @__PURE__ */ Struct({
1047
+ ...NotificationMeta.fields,
1048
+ level: LoggingLevel,
1049
+ logger: /* @__PURE__ */ optional2(String3),
1050
+ data: Any
1051
+ })
1052
+ })) {
1053
+ }
1054
+
1055
+ class ToolUseContent extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ToolUseContent")({
1056
+ type: /* @__PURE__ */ tag("tool_use"),
1057
+ id: String3,
1058
+ name: String3,
1059
+ input: /* @__PURE__ */ Record(String3, Unknown),
1060
+ _meta: /* @__PURE__ */ optional2(JsonObject)
1061
+ })) {
1062
+ }
1063
+
1064
+ class ToolResultContent extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ToolResultContent")({
1065
+ type: /* @__PURE__ */ tag("tool_result"),
1066
+ toolUseId: String3,
1067
+ content: /* @__PURE__ */ ArraySchema(ContentBlock),
1068
+ structuredContent: /* @__PURE__ */ optional2(Json),
1069
+ isError: /* @__PURE__ */ optional2(Boolean3),
1070
+ _meta: /* @__PURE__ */ optional2(JsonObject)
1071
+ })) {
1072
+ }
1073
+ var SamplingMessageContentBlock = /* @__PURE__ */ Union([TextContent, ImageContent, AudioContent, ToolUseContent, ToolResultContent]);
1074
+
1075
+ class SamplingMessage extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1076
+ role: Role,
1077
+ content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
1078
+ _meta: /* @__PURE__ */ optional2(JsonObject)
1079
+ }))) {
1080
+ }
1081
+
1082
+ class ToolChoice extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ToolChoice")({
1083
+ mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["auto", "required", "none"]))
1084
+ })) {
1085
+ }
1086
+
1087
+ class ModelHint extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1088
+ name: /* @__PURE__ */ optional2(String3)
1089
+ }))) {
1090
+ }
1091
+
1092
+ class ModelPreferences extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ModelPreferences")({
1093
+ hints: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(ModelHint)),
1094
+ costPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
1095
+ minimum: 0,
1096
+ maximum: 1
1097
+ }))),
1098
+ speedPriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
1099
+ minimum: 0,
1100
+ maximum: 1
1101
+ }))),
1102
+ intelligencePriority: /* @__PURE__ */ optional2(/* @__PURE__ */ Finite.check(/* @__PURE__ */ isBetween({
1103
+ minimum: 0,
1104
+ maximum: 1
1105
+ })))
1106
+ })) {
1107
+ }
1108
+
1109
+ class CreateMessageResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/CreateMessageResult")({
1110
+ role: Role,
1111
+ content: /* @__PURE__ */ Union([SamplingMessageContentBlock, /* @__PURE__ */ ArraySchema(SamplingMessageContentBlock)]),
1112
+ _meta: /* @__PURE__ */ optional2(JsonObject),
1113
+ model: String3,
1114
+ stopReason: /* @__PURE__ */ optional2(String3)
1115
+ })) {
1116
+ }
1117
+
1118
+ class CreateMessage extends (/* @__PURE__ */ make2("sampling/createMessage", {
1119
+ success: CreateMessageResult,
1120
+ error: McpError,
1121
+ payload: {
1122
+ messages: /* @__PURE__ */ ArraySchema(SamplingMessage),
1123
+ modelPreferences: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ModelPreferences.fields)),
1124
+ systemPrompt: /* @__PURE__ */ optional2(String3),
1125
+ includeContext: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["none", "thisServer", "allServers"])),
1126
+ temperature: /* @__PURE__ */ optional2(Finite),
1127
+ maxTokens: Int2,
1128
+ stopSequences: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3)),
1129
+ metadata: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, Unknown)),
1130
+ tools: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct(Tool.fields))),
1131
+ toolChoice: /* @__PURE__ */ optional2(/* @__PURE__ */ Struct(ToolChoice.fields))
1132
+ }
1133
+ })) {
1134
+ }
1135
+ class CompleteResult extends (/* @__PURE__ */ Opaque()(/* @__PURE__ */ Struct({
1136
+ ...ResultMeta.fields,
1137
+ completion: /* @__PURE__ */ Struct({
1138
+ values: /* @__PURE__ */ ArraySchema(String3),
1139
+ total: /* @__PURE__ */ optional2(Int2),
1140
+ hasMore: /* @__PURE__ */ optional2(Boolean3)
1141
+ })
1142
+ }))) {
1143
+ static empty = /* @__PURE__ */ CompleteResult.make({
1144
+ completion: {
1145
+ values: [],
1146
+ total: 0,
1147
+ hasMore: false
1148
+ }
1149
+ });
1150
+ }
1151
+ class Root extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/Root")({
1152
+ uri: String3,
1153
+ name: /* @__PURE__ */ optional2(String3),
1154
+ _meta: /* @__PURE__ */ optional2(JsonObject)
1155
+ })) {
1156
+ }
1157
+
1158
+ class ListRootsResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ListRootsResult")({
1159
+ roots: /* @__PURE__ */ ArraySchema(Root)
1160
+ })) {
1161
+ }
1162
+
1163
+ class ListRoots extends (/* @__PURE__ */ make2("roots/list", {
1164
+ success: ListRootsResult,
1165
+ error: McpError,
1166
+ payload: /* @__PURE__ */ UndefinedOr(RequestMeta)
1167
+ })) {
1168
+ }
1169
+ class ElicitationString extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitationString")({
1170
+ type: /* @__PURE__ */ tag("string"),
1171
+ title: /* @__PURE__ */ optional2(String3),
1172
+ description: /* @__PURE__ */ optional2(String3),
1173
+ minLength: /* @__PURE__ */ optional2(Int2),
1174
+ maxLength: /* @__PURE__ */ optional2(Int2),
1175
+ format: /* @__PURE__ */ optional2(/* @__PURE__ */ Literals(["email", "uri", "date", "date-time"])),
1176
+ default: /* @__PURE__ */ optional2(String3)
1177
+ })) {
1178
+ }
1179
+
1180
+ class ElicitationNumber extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitationNumber")({
1181
+ type: /* @__PURE__ */ Literals(["number", "integer"]),
1182
+ title: /* @__PURE__ */ optional2(String3),
1183
+ description: /* @__PURE__ */ optional2(String3),
1184
+ minimum: /* @__PURE__ */ optional2(Finite),
1185
+ maximum: /* @__PURE__ */ optional2(Finite),
1186
+ default: /* @__PURE__ */ optional2(Finite)
1187
+ })) {
1188
+ }
1189
+
1190
+ class ElicitationBoolean extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitationBoolean")({
1191
+ type: /* @__PURE__ */ tag("boolean"),
1192
+ title: /* @__PURE__ */ optional2(String3),
1193
+ description: /* @__PURE__ */ optional2(String3),
1194
+ default: /* @__PURE__ */ optional2(Boolean3)
1195
+ })) {
1196
+ }
1197
+
1198
+ class UntitledSingleSelectEnum extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/UntitledSingleSelectEnum")({
1199
+ type: /* @__PURE__ */ tag("string"),
1200
+ title: /* @__PURE__ */ optional2(String3),
1201
+ description: /* @__PURE__ */ optional2(String3),
1202
+ enum: /* @__PURE__ */ ArraySchema(String3),
1203
+ default: /* @__PURE__ */ optional2(String3)
1204
+ })) {
1205
+ }
1206
+
1207
+ class TitledSingleSelectEnum extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/TitledSingleSelectEnum")({
1208
+ type: /* @__PURE__ */ tag("string"),
1209
+ title: /* @__PURE__ */ optional2(String3),
1210
+ description: /* @__PURE__ */ optional2(String3),
1211
+ oneOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
1212
+ const: String3,
1213
+ title: String3
1214
+ })),
1215
+ default: /* @__PURE__ */ optional2(String3)
1216
+ })) {
1217
+ }
1218
+ var SingleSelectEnum = /* @__PURE__ */ Union([UntitledSingleSelectEnum, TitledSingleSelectEnum]);
1219
+
1220
+ class UntitledMultiSelectEnum extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/UntitledMultiSelectEnum")({
1221
+ type: /* @__PURE__ */ tag("array"),
1222
+ title: /* @__PURE__ */ optional2(String3),
1223
+ description: /* @__PURE__ */ optional2(String3),
1224
+ minItems: /* @__PURE__ */ optional2(Int2),
1225
+ maxItems: /* @__PURE__ */ optional2(Int2),
1226
+ items: /* @__PURE__ */ Struct({
1227
+ type: /* @__PURE__ */ tag("string"),
1228
+ enum: /* @__PURE__ */ ArraySchema(String3)
1229
+ }),
1230
+ default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
1231
+ })) {
1232
+ }
1233
+
1234
+ class TitledMultiSelectEnum extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/TitledMultiSelectEnum")({
1235
+ type: /* @__PURE__ */ tag("array"),
1236
+ title: /* @__PURE__ */ optional2(String3),
1237
+ description: /* @__PURE__ */ optional2(String3),
1238
+ minItems: /* @__PURE__ */ optional2(Int2),
1239
+ maxItems: /* @__PURE__ */ optional2(Int2),
1240
+ items: /* @__PURE__ */ Struct({
1241
+ anyOf: /* @__PURE__ */ ArraySchema(/* @__PURE__ */ Struct({
1242
+ const: String3,
1243
+ title: String3
1244
+ }))
1245
+ }),
1246
+ default: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
1247
+ })) {
1248
+ }
1249
+ var MultiSelectEnum = /* @__PURE__ */ Union([UntitledMultiSelectEnum, TitledMultiSelectEnum]);
1250
+
1251
+ class LegacyTitledEnum extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/LegacyTitledEnum")({
1252
+ type: /* @__PURE__ */ tag("string"),
1253
+ title: /* @__PURE__ */ optional2(String3),
1254
+ description: /* @__PURE__ */ optional2(String3),
1255
+ enum: /* @__PURE__ */ ArraySchema(String3),
1256
+ enumNames: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3)),
1257
+ default: /* @__PURE__ */ optional2(String3)
1258
+ })) {
1259
+ }
1260
+ var ElicitationEnum = /* @__PURE__ */ Union([LegacyTitledEnum, SingleSelectEnum, MultiSelectEnum]);
1261
+ var PrimitiveSchemaDefinition = /* @__PURE__ */ Union([ElicitationEnum, ElicitationString, ElicitationNumber, ElicitationBoolean]);
1262
+ var ElicitationForm = /* @__PURE__ */ Struct({
1263
+ $schema: /* @__PURE__ */ optional2(String3),
1264
+ type: /* @__PURE__ */ tag("object"),
1265
+ properties: /* @__PURE__ */ Record(String3, PrimitiveSchemaDefinition),
1266
+ required: /* @__PURE__ */ optional2(/* @__PURE__ */ ArraySchema(String3))
1267
+ });
1268
+
1269
+ class ElicitRequestFormParams extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitRequestFormParams")({
1270
+ ...RequestMeta.fields,
1271
+ mode: /* @__PURE__ */ optional2(/* @__PURE__ */ Literal("form")),
1272
+ message: String3,
1273
+ requestedSchema: ElicitationForm
1274
+ })) {
1275
+ }
1276
+
1277
+ class ElicitRequestURLParams extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitRequestURLParams")({
1278
+ ...RequestMeta.fields,
1279
+ mode: /* @__PURE__ */ Literal("url"),
1280
+ message: String3,
1281
+ elicitationId: String3,
1282
+ url: String3
1283
+ })) {
1284
+ }
1285
+ var ElicitRequestParams = /* @__PURE__ */ Union([ElicitRequestFormParams, ElicitRequestURLParams]);
1286
+
1287
+ class ElicitAcceptResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitAcceptResult")({
1288
+ ...ResultMeta.fields,
1289
+ action: /* @__PURE__ */ Literal("accept"),
1290
+ content: /* @__PURE__ */ optional2(/* @__PURE__ */ Record(String3, /* @__PURE__ */ Union([String3, Finite, Boolean3, /* @__PURE__ */ ArraySchema(String3)])))
1291
+ })) {
1292
+ }
1293
+
1294
+ class ElicitDeclineResult extends (/* @__PURE__ */ Class2("@effect/ai/McpSchema/ElicitDeclineResult")({
1295
+ ...ResultMeta.fields,
1296
+ action: /* @__PURE__ */ Literals(["cancel", "decline"])
1297
+ })) {
1298
+ }
1299
+ var ElicitResult = /* @__PURE__ */ Union([ElicitAcceptResult, ElicitDeclineResult]);
1300
+ class Elicit extends (/* @__PURE__ */ make2("elicitation/create", {
1301
+ success: ElicitResult,
1302
+ error: McpError,
1303
+ payload: ElicitRequestParams
1304
+ })) {
1305
+ }
1306
+
1307
+ class ElicitationCompleteNotification extends (/* @__PURE__ */ make2("notifications/elicitation/complete", {
1308
+ payload: {
1309
+ elicitationId: String3
1310
+ }
1311
+ })) {
1312
+ }
1313
+
1314
+ class ElicitationDeclined extends (/* @__PURE__ */ Error2("@effect/ai/McpSchema/ElicitationDeclined")({
1315
+ _tag: /* @__PURE__ */ tag("ElicitationDeclined"),
1316
+ request: Elicit.payloadSchema,
1317
+ cause: /* @__PURE__ */ optional2(/* @__PURE__ */ Defect())
1318
+ })) {
1319
+ }
1320
+
1321
+ class McpReverseOperationUnsupported extends (/* @__PURE__ */ TaggedError("McpReverseOperationUnsupported")) {
1322
+ }
1323
+
1324
+ class McpReverseOperationError extends (/* @__PURE__ */ TaggedError("McpReverseOperationError")) {
1325
+ }
1326
+
1327
+ class McpRequestContext extends (/* @__PURE__ */ Service2()("effect/ai/McpSchema/McpRequestContext")) {
1328
+ }
1329
+
1330
+ class McpServerClient extends (/* @__PURE__ */ Service2()("effect/ai/McpSchema/McpServerClient")) {
1331
+ }
1332
+
1333
+ class McpServerClientMiddleware extends (/* @__PURE__ */ Service()("effect/ai/McpSchema/McpServerClientMiddleware")) {
1334
+ }
1335
+ class ServerNotificationRpcs extends (/* @__PURE__ */ make3(CancelledNotification, ProgressNotification, LoggingMessageNotification, ResourceUpdatedNotification, ResourceListChangedNotification, ToolListChangedNotification, PromptListChangedNotification, ElicitationCompleteNotification)) {
1336
+ }
1337
+ class EnabledWhen extends (/* @__PURE__ */ Service2()("effect/ai/McpSchema/EnabledWhen")) {
1338
+ }
15
1339
  // src/relay/user-settings.ts
16
1340
  var settingKeys = ["window", "grouping", "idleMinutes", "cursor", "humanInput", "handoffNotifications", "autoUpdate"];
17
1341
  var relaySettingKeys = ["autoUpdate"];
@@ -136,8 +1460,6 @@ function formatSettings(settings) {
136
1460
  }
137
1461
 
138
1462
  // src/mcp/schema.ts
139
- import { Effect, Predicate } from "effect";
140
- import { McpSchema } from "effect/ai";
141
1463
  function browsersNote2(browsers) {
142
1464
  if (browsers.length < 2)
143
1465
  return "";
@@ -164,13 +1486,13 @@ var sessionAliasSchemaProperty = { type: "string", description: "Same as id." };
164
1486
  var sessionOnlyInputSchema = objectSchema({
165
1487
  session: sessionSchemaProperty
166
1488
  });
167
- var ensureSessionExists = Effect.fnUntraced(function* (relay, id) {
1489
+ var ensureSessionExists = fnUntraced(function* (relay, id) {
168
1490
  const sessions = yield* relay.sessions;
169
1491
  const exists = sessions.some((session) => {
170
1492
  return session.id === id;
171
1493
  });
172
1494
  if (!exists) {
173
- return yield* Effect.fail(new Error(`Session not found: ${id}`));
1495
+ return yield* fail4(new Error(`Session not found: ${id}`));
174
1496
  }
175
1497
  });
176
1498
  function parseExecuteArguments(input) {
@@ -222,13 +1544,13 @@ function optionalStringField(input, field) {
222
1544
  }
223
1545
  function optionalBooleanField(input, field) {
224
1546
  const value = requireObject(input)[field];
225
- return Predicate.isBoolean(value) ? value : undefined;
1547
+ return isBoolean(value) ? value : undefined;
226
1548
  }
227
1549
  function optionalPositiveIntegerField(input, field) {
228
1550
  const value = requireObject(input)[field];
229
1551
  if (value === undefined)
230
1552
  return;
231
- if (!Predicate.isNumber(value) || !Number.isInteger(value) || value <= 0) {
1553
+ if (!isNumber(value) || !Number.isInteger(value) || value <= 0) {
232
1554
  throw new Error(`${field} must be a positive integer`);
233
1555
  }
234
1556
  return value;
@@ -237,7 +1559,7 @@ function optionalNonNegativeIntegerField(input, field) {
237
1559
  const value = requireObject(input)[field];
238
1560
  if (value === undefined)
239
1561
  return;
240
- if (!Predicate.isNumber(value) || !Number.isInteger(value) || value < 0) {
1562
+ if (!isNumber(value) || !Number.isInteger(value) || value < 0) {
241
1563
  throw new Error(`${field} must be a non-negative integer`);
242
1564
  }
243
1565
  return value;
@@ -246,7 +1568,7 @@ function optionalStringArrayField(input, field) {
246
1568
  const value = requireObject(input)[field];
247
1569
  if (value === undefined)
248
1570
  return;
249
- if (!Array.isArray(value) || !value.every((item) => Predicate.isString(item) && item.length > 0)) {
1571
+ if (!Array.isArray(value) || !value.every((item) => isString(item) && item.length > 0)) {
250
1572
  throw new Error(`${field} must be an array of non-empty strings`);
251
1573
  }
252
1574
  return value;
@@ -259,7 +1581,7 @@ function requireObject(input) {
259
1581
  return object;
260
1582
  }
261
1583
  function stringifyResult(value) {
262
- if (Predicate.isString(value)) {
1584
+ if (isString(value)) {
263
1585
  return value;
264
1586
  }
265
1587
  return JSON.stringify(value, null, 2);
@@ -277,10 +1599,10 @@ function toolResultForValue2(value) {
277
1599
  if (media.length > 0) {
278
1600
  const { media: _media, ...structuredContent } = object ?? {};
279
1601
  const text = errorText ?? stringifyResult(structuredContent);
280
- return new McpSchema.CallToolResult({
1602
+ return new CallToolResult({
281
1603
  content: [
282
- McpSchema.TextContent.make({ text }),
283
- ...media.map((image) => McpSchema.ImageContent.make({
1604
+ TextContent.make({ text }),
1605
+ ...media.map((image) => ImageContent.make({
284
1606
  data: new Uint8Array(Buffer.from(image.data, "base64")),
285
1607
  mimeType: image.mimeType
286
1608
  }))
@@ -299,8 +1621,8 @@ function mcpErrorMessage2(tool, message) {
299
1621
  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.`;
300
1622
  }
301
1623
  function toolResult(options) {
302
- return new McpSchema.CallToolResult({
303
- content: [McpSchema.TextContent.make({ text: options.text })],
1624
+ return new CallToolResult({
1625
+ content: [TextContent.make({ text: options.text })],
304
1626
  structuredContent: options.structuredContent,
305
1627
  isError: options.isError
306
1628
  });
@@ -310,10 +1632,8 @@ function toolResult(options) {
310
1632
  import crypto from "node:crypto";
311
1633
  import fs2 from "node:fs/promises";
312
1634
  import path2 from "node:path";
313
- import { Effect as Effect3, Schema as Schema2 } from "effect";
314
1635
 
315
1636
  // src/auth/profile.ts
316
- import { Effect as Effect2, Schema, Semaphore } from "effect";
317
1637
  import { spawn } from "node:child_process";
318
1638
  import fs from "node:fs/promises";
319
1639
  import path from "node:path";
@@ -349,7 +1669,6 @@ function signalChildProcess(child, signal) {
349
1669
  }
350
1670
 
351
1671
  // src/network-capture/redaction.ts
352
- import { Predicate as Predicate2 } from "effect";
353
1672
  var secretNamePattern = /auth(?:orization)?|cookie|credential|csrf|xsrf|token|secret|session|password|passwd|pwd|passcode|otp|(?:^|[-_.])code(?:$|[-_.])|(?:api|access|refresh)[-_.]?key|signature|(?:^|[-_.])sig(?:$|[-_.])/i;
354
1673
  var oneTimeFieldPattern = /pass(?:word|wd|code|phrase)|(?:^|[-_.])pwd(?:$|[-_.])|otp|totp|(?:^|[-_.])(?:mfa_?|2fa_?|verification_?|auth_?)?code(?:$|[-_.])|(?:^|[-_.])pin(?:$|[-_.])/i;
355
1674
  var referencePattern = String.raw`BC_(?:SECRET|REDACTED)_\d+`;
@@ -456,7 +1775,7 @@ class SecretCollector {
456
1775
  return redactKnownValue(value, this.redactionSlots());
457
1776
  }
458
1777
  redactExactValue(value, minimumLength) {
459
- if (!Predicate2.isString(value) && !Predicate2.isNumber(value) && !Predicate2.isBoolean(value))
1778
+ if (!isString(value) && !isNumber(value) && !isBoolean(value))
460
1779
  return value;
461
1780
  const serialized = String(value);
462
1781
  if (serialized.length < minimumLength)
@@ -547,7 +1866,7 @@ class SecretCollector {
547
1866
  if (Array.isArray(value)) {
548
1867
  return value.map((item, index) => this.protectJson(item, location, [...path, String(index)], inSecret));
549
1868
  }
550
- if (Predicate2.isObject(value)) {
1869
+ if (isObject(value)) {
551
1870
  return Object.fromEntries(Object.entries(value).map(([key, item]) => [
552
1871
  key,
553
1872
  this.protectJson(item, location, [...path, key], inSecret || secretNamePattern.test(key))
@@ -741,15 +2060,15 @@ function redactKnownValues(text, slots) {
741
2060
  return [...slots].sort((left, right) => right.value.length - left.value.length).reduce((output, slot) => replaceOutsideReferences(output, slot.value, `\${${slot.ref}}`), text);
742
2061
  }
743
2062
  function redactKnownValue(value, slots) {
744
- if (Predicate2.isString(value))
2063
+ if (isString(value))
745
2064
  return redactKnownValues(value, slots);
746
- if (Predicate2.isNumber(value) || Predicate2.isBoolean(value)) {
2065
+ if (isNumber(value) || isBoolean(value)) {
747
2066
  const slot = slots.find((candidate) => candidate.value === String(value));
748
2067
  return slot ? `\${${slot.ref}}` : value;
749
2068
  }
750
2069
  if (Array.isArray(value))
751
2070
  return value.map((item) => redactKnownValue(item, slots));
752
- if (!Predicate2.isObject(value))
2071
+ if (!isObject(value))
753
2072
  return value;
754
2073
  return Object.fromEntries(Object.entries(value).map(([key, item]) => [
755
2074
  key,
@@ -759,7 +2078,7 @@ function redactKnownValue(value, slots) {
759
2078
  function redactSecretValue(value) {
760
2079
  if (Array.isArray(value))
761
2080
  return value.map(redactSecretValue);
762
- if (Predicate2.isObject(value)) {
2081
+ if (isObject(value)) {
763
2082
  return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, redactSecretValue(item)]));
764
2083
  }
765
2084
  return value === null || value === "" ? value : "[REDACTED]";
@@ -784,26 +2103,26 @@ function jwtExpiration(value) {
784
2103
  return;
785
2104
  try {
786
2105
  const payload = JSON.parse(Buffer.from(parts[1], "base64url").toString("utf8"));
787
- return Predicate2.isNumber(payload.exp) ? new Date(payload.exp * 1000).toISOString() : undefined;
2106
+ return isNumber(payload.exp) ? new Date(payload.exp * 1000).toISOString() : undefined;
788
2107
  } catch {
789
2108
  return;
790
2109
  }
791
2110
  }
792
2111
 
793
2112
  // src/auth/profile.ts
794
- var StoredCredentialSlot = Schema.Struct({
795
- ref: Schema.String.check(Schema.isPattern(/^BC_SECRET_[1-9][0-9]*$/)),
796
- value: Schema.String,
797
- sources: Schema.Array(Schema.String),
798
- expiresAt: Schema.optionalKey(Schema.String)
2113
+ var StoredCredentialSlot = Struct({
2114
+ ref: String3.check(isPattern(/^BC_SECRET_[1-9][0-9]*$/)),
2115
+ value: String3,
2116
+ sources: ArraySchema(String3),
2117
+ expiresAt: optionalKey(String3)
799
2118
  });
800
- var StoredAuthProfile = Schema.Struct({
801
- version: Schema.Literal(1),
802
- name: Schema.String,
803
- createdAt: Schema.String,
804
- updatedAt: Schema.String,
805
- slots: Schema.Array(StoredCredentialSlot)
806
- }).check(Schema.makeFilter((profile) => {
2119
+ var StoredAuthProfile = Struct({
2120
+ version: Literal(1),
2121
+ name: String3,
2122
+ createdAt: String3,
2123
+ updatedAt: String3,
2124
+ slots: ArraySchema(StoredCredentialSlot)
2125
+ }).check(makeFilter((profile) => {
807
2126
  const refs = profile.slots.map((slot) => slot.ref);
808
2127
  if (new Set(refs).size !== refs.length)
809
2128
  return "Auth profile refs must be unique";
@@ -811,39 +2130,39 @@ var StoredAuthProfile = Schema.Struct({
811
2130
  return new Set(sources).size === sources.length ? undefined : "Auth profile sources must be unique";
812
2131
  }));
813
2132
 
814
- class AuthProfileError extends Schema.TaggedError()("AuthProfile.Error", {
815
- message: Schema.String,
816
- operation: Schema.String,
817
- reason: Schema.Literals(["invalid-name", "not-found", "read-failed", "invalid-json", "invalid-profile", "write-failed", "run-failed"]),
818
- cause: Schema.optionalKey(Schema.Defect())
2133
+ class AuthProfileError extends TaggedError2()("AuthProfile.Error", {
2134
+ message: String3,
2135
+ operation: String3,
2136
+ reason: Literals(["invalid-name", "not-found", "read-failed", "invalid-json", "invalid-profile", "write-failed", "run-failed"]),
2137
+ cause: optionalKey(Defect())
819
2138
  }) {
820
2139
  }
821
2140
  var defaultBaseDir = () => path.join(dataRoot(), "secrets");
822
- var writeLock = Semaphore.makeUnsafe(1);
2141
+ var writeLock = makeUnsafe(1);
823
2142
  var profileLockTimeoutMs = 30000;
824
2143
  var staleProfileLockMs = 60000;
825
2144
  var maximumRunOutputBytes = 1e7;
826
2145
  var maximumTimeoutMs = 2147483647;
827
- var read = Effect2.fn("AuthProfile.read")(function* (name, options = {}) {
2146
+ var read = fn("AuthProfile.read")(function* (name, options = {}) {
828
2147
  const filePath = yield* profilePath(options.baseDir ?? defaultBaseDir(), name);
829
- const text = yield* Effect2.tryPromise({
2148
+ const text = yield* tryPromise({
830
2149
  try: () => fs.readFile(filePath, "utf8"),
831
2150
  catch: (cause) => isNodeError(cause) && cause.code === "ENOENT" ? new AuthProfileError({ message: `Auth profile not found: ${name}`, operation: "read", reason: "not-found", cause }) : new AuthProfileError({ message: `Could not read auth profile: ${name}`, operation: "read", reason: "read-failed", cause })
832
2151
  });
833
- return yield* Schema.decodeUnknownEffect(StoredAuthProfile)(yield* Effect2.try({
2152
+ return yield* decodeUnknownEffect2(StoredAuthProfile)(yield* try_({
834
2153
  try: () => JSON.parse(text),
835
2154
  catch: (cause) => new AuthProfileError({ message: `Auth profile is not valid JSON: ${name}`, operation: "read", reason: "invalid-json", cause })
836
- })).pipe(Effect2.mapError((cause) => cause instanceof AuthProfileError ? cause : new AuthProfileError({ message: `Auth profile has an invalid shape: ${name}`, operation: "read", reason: "invalid-profile", cause })));
2155
+ })).pipe(mapError((cause) => cause instanceof AuthProfileError ? cause : new AuthProfileError({ message: `Auth profile has an invalid shape: ${name}`, operation: "read", reason: "invalid-profile", cause })));
837
2156
  });
838
- var readOptional = Effect2.fn("AuthProfile.readOptional")(function* (name, options = {}) {
839
- return yield* read(name, options).pipe(Effect2.catchIf((error) => error.reason === "not-found", () => Effect2.succeed(undefined)));
2157
+ var readOptional = fn("AuthProfile.readOptional")(function* (name, options = {}) {
2158
+ return yield* read(name, options).pipe(catchIf((error) => error.reason === "not-found", () => succeed6(undefined)));
840
2159
  });
841
2160
  function withLock(name, options, effect) {
842
2161
  const baseDir = options.baseDir ?? defaultBaseDir();
843
- const acquire = Effect2.gen(function* () {
2162
+ const acquire = gen(function* () {
844
2163
  const filePath = yield* profilePath(baseDir, name);
845
2164
  const lockPath = `${filePath}.lock`;
846
- yield* Effect2.tryPromise({
2165
+ yield* tryPromise({
847
2166
  try: async () => {
848
2167
  await fs.mkdir(baseDir, { recursive: true, mode: 448 });
849
2168
  await fs.chmod(baseDir, 448);
@@ -882,12 +2201,12 @@ function withLock(name, options, effect) {
882
2201
  });
883
2202
  return lockPath;
884
2203
  });
885
- return Effect2.acquireUseRelease(acquire, () => effect, (lockPath) => Effect2.tryPromise({
2204
+ return acquireUseRelease(acquire, () => effect, (lockPath) => tryPromise({
886
2205
  try: () => fs.unlink(lockPath).catch(() => {}).then(() => {}),
887
2206
  catch: (cause) => new AuthProfileError({ message: `Could not release auth profile lock: ${name}`, operation: "lock", reason: "write-failed", cause })
888
2207
  }));
889
2208
  }
890
- var writeProfile = Effect2.fnUntraced(function* (options) {
2209
+ var writeProfile = fnUntraced(function* (options) {
891
2210
  const baseDir = options.baseDir ?? defaultBaseDir();
892
2211
  const filePath = yield* profilePath(baseDir, options.name);
893
2212
  const existing = yield* readOptional(options.name, { baseDir });
@@ -904,22 +2223,22 @@ var writeProfile = Effect2.fnUntraced(function* (options) {
904
2223
  ...slot.expiresAt ? { expiresAt: slot.expiresAt } : {}
905
2224
  }))
906
2225
  };
907
- yield* Schema.decodeUnknownEffect(StoredAuthProfile)(profile).pipe(Effect2.mapError((cause) => new AuthProfileError({ message: `Auth profile has an invalid shape: ${options.name}`, operation: "write", reason: "invalid-profile", cause })));
2226
+ yield* decodeUnknownEffect2(StoredAuthProfile)(profile).pipe(mapError((cause) => new AuthProfileError({ message: `Auth profile has an invalid shape: ${options.name}`, operation: "write", reason: "invalid-profile", cause })));
908
2227
  if (existing && sameSlots(existing.slots, profile.slots))
909
2228
  return summary(existing);
910
- yield* Effect2.tryPromise({
2229
+ yield* tryPromise({
911
2230
  try: () => writeJsonFileAtomically(filePath, profile, { dirMode: 448 }),
912
2231
  catch: (cause) => new AuthProfileError({ message: `Could not write auth profile: ${options.name}`, operation: "write", reason: "write-failed", cause })
913
2232
  });
914
2233
  return summary(profile);
915
2234
  });
916
- var write = Effect2.fn("AuthProfile.write")(function* (options) {
2235
+ var write = fn("AuthProfile.write")(function* (options) {
917
2236
  return yield* writeLock.withPermit(writeProfile(options));
918
2237
  });
919
- var status = Effect2.fn("AuthProfile.status")(function* (name, options = {}) {
2238
+ var status = fn("AuthProfile.status")(function* (name, options = {}) {
920
2239
  return summary(yield* read(name, options));
921
2240
  });
922
- var run = Effect2.fn("AuthProfile.run")(function* (options) {
2241
+ var run = fn("AuthProfile.run")(function* (options) {
923
2242
  if (!options.command.trim()) {
924
2243
  return yield* new AuthProfileError({ message: "Auth command must not be empty", operation: "run", reason: "run-failed" });
925
2244
  }
@@ -941,7 +2260,7 @@ var run = Effect2.fn("AuthProfile.run")(function* (options) {
941
2260
  timeoutMs,
942
2261
  maxOutputBytes: maxOutputBytes + maxSecretBytes,
943
2262
  env: Object.fromEntries(profile.slots.map((slot) => [slot.ref, slot.value]))
944
- }).pipe(Effect2.mapError((cause) => new AuthProfileError({ message: `Could not run command with auth profile ${options.name}`, operation: "run", reason: "run-failed", cause })));
2263
+ }).pipe(mapError((cause) => new AuthProfileError({ message: `Could not run command with auth profile ${options.name}`, operation: "run", reason: "run-failed", cause })));
945
2264
  const stdout = redactOutput(result.stdout, profile.slots, maxOutputBytes);
946
2265
  const stderr = redactOutput(result.stderr, profile.slots, maxOutputBytes);
947
2266
  return {
@@ -970,7 +2289,7 @@ function summary(profile) {
970
2289
  }
971
2290
  var profileNamePattern = /^[a-z0-9][a-z0-9._-]{0,63}$/i;
972
2291
  function profilePath(baseDir, name) {
973
- return profileNamePattern.test(name) ? Effect2.succeed(path.join(baseDir, `${name}.json`)) : Effect2.fail(new AuthProfileError({ message: `Invalid auth profile name: ${name}`, operation: "path", reason: "invalid-name" }));
2292
+ return profileNamePattern.test(name) ? succeed6(path.join(baseDir, `${name}.json`)) : fail4(new AuthProfileError({ message: `Invalid auth profile name: ${name}`, operation: "path", reason: "invalid-name" }));
974
2293
  }
975
2294
  function sameSlots(left, right) {
976
2295
  return JSON.stringify(left) === JSON.stringify(right);
@@ -1002,7 +2321,7 @@ function redactOutput(text, slots, maxBytes) {
1002
2321
  };
1003
2322
  }
1004
2323
  function runChild(options) {
1005
- return Effect2.callback((resume) => {
2324
+ return callback2((resume) => {
1006
2325
  const child = spawn(options.command, [...options.args], {
1007
2326
  ...options.cwd ? { cwd: options.cwd } : {},
1008
2327
  env: childEnvironment(options.env),
@@ -1048,7 +2367,7 @@ function runChild(options) {
1048
2367
  if (settled)
1049
2368
  return;
1050
2369
  settled = true;
1051
- resume(Effect2.fail(cause));
2370
+ resume(fail4(cause));
1052
2371
  });
1053
2372
  child.once("close", (code, signal) => {
1054
2373
  clearTimeout(timeout);
@@ -1057,7 +2376,7 @@ function runChild(options) {
1057
2376
  if (settled)
1058
2377
  return;
1059
2378
  settled = true;
1060
- resume(Effect2.succeed({
2379
+ resume(succeed6({
1061
2380
  exitCode: code ?? 1,
1062
2381
  signal,
1063
2382
  stdout: Buffer.concat(stdout).toString("utf8"),
@@ -1066,7 +2385,7 @@ function runChild(options) {
1066
2385
  stderrTruncated
1067
2386
  }));
1068
2387
  });
1069
- return Effect2.promise(() => terminateChildProcess({ child, exit: closePromise, graceMs: 1000, isExited: () => closed }));
2388
+ return promise(() => terminateChildProcess({ child, exit: closePromise, graceMs: 1000, isExited: () => closed }));
1070
2389
  });
1071
2390
  }
1072
2391
  function childEnvironment(profile) {
@@ -1271,45 +2590,45 @@ async function checkNavigationUrl(rawUrl, rules) {
1271
2590
  }
1272
2591
 
1273
2592
  // src/auth/site-secrets.ts
1274
- var StoredSiteSecret = Schema2.Struct({
1275
- version: Schema2.Literal(1),
1276
- name: Schema2.String,
1277
- kind: Schema2.Literals(["password", "totp"]),
1278
- value: Schema2.String,
1279
- allowedOrigins: Schema2.Array(Schema2.String),
1280
- createdAt: Schema2.String,
1281
- updatedAt: Schema2.String
2593
+ var StoredSiteSecret = Struct({
2594
+ version: Literal(1),
2595
+ name: String3,
2596
+ kind: Literals(["password", "totp"]),
2597
+ value: String3,
2598
+ allowedOrigins: ArraySchema(String3),
2599
+ createdAt: String3,
2600
+ updatedAt: String3
1282
2601
  });
1283
2602
 
1284
- class SiteSecretError extends Schema2.TaggedError()("SiteSecret.Error", {
1285
- message: Schema2.String,
1286
- reason: Schema2.Literals(["invalid-name", "invalid-origins", "invalid-value", "not-found", "read-failed", "write-failed"]),
1287
- cause: Schema2.optionalKey(Schema2.Defect())
2603
+ class SiteSecretError extends TaggedError2()("SiteSecret.Error", {
2604
+ message: String3,
2605
+ reason: Literals(["invalid-name", "invalid-origins", "invalid-value", "not-found", "read-failed", "write-failed"]),
2606
+ cause: optionalKey(Defect())
1288
2607
  }) {
1289
2608
  }
1290
2609
  var defaultSiteSecretsDir = () => path2.join(dataRoot(), "site-secrets");
1291
2610
  function secretPath(baseDir, name) {
1292
- return profileNamePattern.test(name) ? Effect3.succeed(path2.join(baseDir, `${name}.json`)) : Effect3.fail(new SiteSecretError({ message: `Invalid secret name: ${name} (letters, digits, ".", "_" and "-", up to 64)`, reason: "invalid-name" }));
2611
+ return profileNamePattern.test(name) ? succeed6(path2.join(baseDir, `${name}.json`)) : fail4(new SiteSecretError({ message: `Invalid secret name: ${name} (letters, digits, ".", "_" and "-", up to 64)`, reason: "invalid-name" }));
1293
2612
  }
1294
2613
  function summary2(secret) {
1295
2614
  return { name: secret.name, kind: secret.kind, allowedOrigins: [...secret.allowedOrigins], createdAt: secret.createdAt, updatedAt: secret.updatedAt };
1296
2615
  }
1297
- var readSecret = Effect3.fn("SiteSecrets.read")(function* (name, options = {}) {
2616
+ var readSecret = fn("SiteSecrets.read")(function* (name, options = {}) {
1298
2617
  const filePath = yield* secretPath(options.baseDir ?? defaultSiteSecretsDir(), name);
1299
- const text = yield* Effect3.tryPromise({
2618
+ const text = yield* tryPromise({
1300
2619
  try: () => fs2.readFile(filePath, "utf8"),
1301
2620
  catch: (cause) => isNodeError(cause) && cause.code === "ENOENT" ? new SiteSecretError({ message: `Secret not found: ${name}. Ask the user to add it with \`opencode-browser secrets add ${name} --origin <origin>\`.`, reason: "not-found" }) : new SiteSecretError({ message: `Could not read secret ${name}`, reason: "read-failed", cause })
1302
2621
  });
1303
- return yield* Effect3.try({
1304
- try: () => Schema2.decodeUnknownSync(StoredSiteSecret)(JSON.parse(text)),
2622
+ return yield* try_({
2623
+ try: () => decodeUnknownSync(StoredSiteSecret)(JSON.parse(text)),
1305
2624
  catch: (cause) => new SiteSecretError({ message: `Secret ${name} is not a valid secret file`, reason: "read-failed", cause })
1306
2625
  });
1307
2626
  });
1308
- var addSecret = Effect3.fn("SiteSecrets.add")(function* (options) {
2627
+ var addSecret = fn("SiteSecrets.add")(function* (options) {
1309
2628
  const baseDir = options.baseDir ?? defaultSiteSecretsDir();
1310
2629
  const filePath = yield* secretPath(baseDir, options.name);
1311
2630
  const kind = options.kind ?? "password";
1312
- const allowedOrigins = yield* Effect3.try({
2631
+ const allowedOrigins = yield* try_({
1313
2632
  try: () => normalizeOriginPatterns(options.allowedOrigins),
1314
2633
  catch: (cause) => new SiteSecretError({ message: cause instanceof Error ? cause.message : "Invalid origins", reason: "invalid-origins", cause })
1315
2634
  });
@@ -1320,43 +2639,43 @@ var addSecret = Effect3.fn("SiteSecrets.add")(function* (options) {
1320
2639
  if (!value)
1321
2640
  return yield* new SiteSecretError({ message: "The secret value is empty", reason: "invalid-value" });
1322
2641
  if (kind === "totp")
1323
- yield* Effect3.try({
2642
+ yield* try_({
1324
2643
  try: () => totpCode(value),
1325
2644
  catch: (cause) => new SiteSecretError({ message: `Not a TOTP seed or otpauth:// URI: ${cause instanceof Error ? cause.message : "invalid"}`, reason: "invalid-value", cause })
1326
2645
  });
1327
- const write = Effect3.gen(function* () {
1328
- const existing = yield* readSecret(options.name, { baseDir }).pipe(Effect3.catchIf((error) => error.reason === "not-found", () => Effect3.succeed(undefined)));
2646
+ const write = gen(function* () {
2647
+ const existing = yield* readSecret(options.name, { baseDir }).pipe(catchIf((error) => error.reason === "not-found", () => succeed6(undefined)));
1329
2648
  const now = new Date().toISOString();
1330
2649
  const secret = { version: 1, name: options.name, kind, value, allowedOrigins: [...allowedOrigins], createdAt: existing?.createdAt ?? now, updatedAt: now };
1331
- yield* Effect3.tryPromise({
2650
+ yield* tryPromise({
1332
2651
  try: () => writeJsonFileAtomically(filePath, secret, { dirMode: 448 }),
1333
2652
  catch: (cause) => new SiteSecretError({ message: `Could not write secret ${options.name}`, reason: "write-failed", cause })
1334
2653
  });
1335
2654
  return summary2(secret);
1336
2655
  });
1337
- return yield* withLock(options.name, { baseDir }, write).pipe(Effect3.mapError((error) => error instanceof SiteSecretError ? error : new SiteSecretError({ message: error.message, reason: "write-failed", cause: error })));
2656
+ return yield* withLock(options.name, { baseDir }, write).pipe(mapError((error) => error instanceof SiteSecretError ? error : new SiteSecretError({ message: error.message, reason: "write-failed", cause: error })));
1338
2657
  });
1339
- var listSecrets = Effect3.fn("SiteSecrets.list")(function* (options = {}) {
2658
+ var listSecrets = fn("SiteSecrets.list")(function* (options = {}) {
1340
2659
  const baseDir = options.baseDir ?? defaultSiteSecretsDir();
1341
- const names = yield* Effect3.tryPromise({
2660
+ const names = yield* tryPromise({
1342
2661
  try: () => fs2.readdir(baseDir).catch((cause) => isNodeError(cause) && cause.code === "ENOENT" ? [] : Promise.reject(cause)),
1343
2662
  catch: (cause) => new SiteSecretError({ message: "Could not list secrets", reason: "read-failed", cause })
1344
2663
  });
1345
2664
  const secrets = [];
1346
2665
  for (const file of names.filter((entry) => entry.endsWith(".json")).sort()) {
1347
- const secret = yield* readSecret(file.slice(0, -".json".length), { baseDir }).pipe(Effect3.option);
2666
+ const secret = yield* readSecret(file.slice(0, -".json".length), { baseDir }).pipe(option2);
1348
2667
  if (secret._tag === "Some")
1349
2668
  secrets.push(summary2(secret.value));
1350
2669
  }
1351
2670
  return secrets;
1352
2671
  });
1353
- var removeSecret = Effect3.fn("SiteSecrets.remove")(function* (name, options = {}) {
2672
+ var removeSecret = fn("SiteSecrets.remove")(function* (name, options = {}) {
1354
2673
  const baseDir = options.baseDir ?? defaultSiteSecretsDir();
1355
2674
  const filePath = yield* secretPath(baseDir, name);
1356
- return yield* withLock(name, { baseDir }, Effect3.tryPromise({
2675
+ return yield* withLock(name, { baseDir }, tryPromise({
1357
2676
  try: () => fs2.rm(filePath).then(() => true, (cause) => isNodeError(cause) && cause.code === "ENOENT" ? false : Promise.reject(cause)),
1358
2677
  catch: (cause) => new SiteSecretError({ message: `Could not remove secret ${name}`, reason: "write-failed", cause })
1359
- })).pipe(Effect3.mapError((error) => error instanceof SiteSecretError ? error : new SiteSecretError({ message: error.message, reason: "write-failed", cause: error })));
2678
+ })).pipe(mapError((error) => error instanceof SiteSecretError ? error : new SiteSecretError({ message: error.message, reason: "write-failed", cause: error })));
1360
2679
  });
1361
2680
  function base32Decode(input) {
1362
2681
  const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
@@ -1405,4 +2724,4 @@ function secretText(secret) {
1405
2724
  return secret.kind === "totp" ? totpCode(secret.value) : secret.value;
1406
2725
  }
1407
2726
 
1408
- export { settingKeys, settingSpecs, securityVariables, SettingsInputError, parseSettingChanges, settingsFromExtension, settingsToExtension, describeSettings, describeChanges, formatSettings, browsersNote2, mcpUpdateNote2, objectSchema, emptyInputSchema, sessionSchemaProperty, sessionAliasSchemaProperty, sessionOnlyInputSchema, ensureSessionExists, parseExecuteArguments, parseAdoptArguments, requiredStringField, optionalStringField, optionalBooleanField, optionalPositiveIntegerField, optionalStringArrayField, requireObject, toolResultForValue2, mcpErrorMessage2, toolResult, terminateChildProcess, SecretCollector, looksLikeTokenSegment, AuthProfileError, read, readOptional, withLock, write, status, run, OriginPatternError, parseOriginPatterns, normalizeOriginPatterns, isPrivateAddress, explicitlyAllowsHost, checkUrl, checkNavigationUrl, readSecret, addSecret, listSecrets, removeSecret, secretText };
2727
+ export { makeUnsafe, make, isStreamSchema, getStreamSchemas, ClientAbort, ServerClient, make2, exitSchema, isWrapper, make3, 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, TextContent, PromptListChangedNotification, Tool, CallToolResult, ToolListChangedNotification, LoggingLevel, LoggingMessageNotification, CreateMessage, ListRootsResult, ListRoots, Elicit, McpReverseOperationUnsupported, McpReverseOperationError, McpRequestContext, McpServerClient, McpServerClientMiddleware, ServerNotificationRpcs, EnabledWhen, settingKeys, settingSpecs, securityVariables, SettingsInputError, parseSettingChanges, settingsFromExtension, settingsToExtension, describeSettings, describeChanges, formatSettings, browsersNote2, mcpUpdateNote2, objectSchema, emptyInputSchema, sessionSchemaProperty, sessionAliasSchemaProperty, sessionOnlyInputSchema, ensureSessionExists, parseExecuteArguments, parseAdoptArguments, requiredStringField, optionalStringField, optionalBooleanField, optionalPositiveIntegerField, optionalStringArrayField, requireObject, toolResultForValue2, mcpErrorMessage2, toolResult, terminateChildProcess, SecretCollector, looksLikeTokenSegment, AuthProfileError, read, readOptional, withLock, write, status, run, OriginPatternError, parseOriginPatterns, normalizeOriginPatterns, isPrivateAddress, explicitlyAllowsHost, checkUrl, checkNavigationUrl, readSecret, addSecret, listSecrets, removeSecret, secretText };