@dual-os/telegram 8.0.4 → 8.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Runner.js CHANGED
@@ -14,19 +14,15 @@ import {
14
14
  oauth2TokenRefresherLayer,
15
15
  make,
16
16
  isPlugin,
17
- Identity,
18
17
  filesUnavailable,
19
18
  PluginExecutionError,
20
- ipcMessages,
21
- sendIpc,
22
19
  decodeInput,
23
20
  encodeOutput,
24
21
  responseLimit,
25
22
  execute
26
- } from "./index-rakjqjpr.js";
23
+ } from "./index-ppnnem2q.js";
27
24
  import {
28
25
  pipeArguments,
29
- dual,
30
26
  identity,
31
27
  constVoid,
32
28
  pipe,
@@ -36,26 +32,21 @@ import {
36
32
  isNotNull,
37
33
  isNullish,
38
34
  hasProperty,
39
- hash,
40
- equals,
41
35
  byReferenceUnsafe,
42
36
  format,
43
37
  NodeInspectSymbol,
44
38
  toJson,
45
39
  BaseProto,
46
- PipeInspectableProto,
47
40
  Prototype,
48
41
  String2,
49
42
  mapInput,
50
43
  none,
51
44
  some,
52
- isSome,
53
45
  match2,
54
46
  getOrElse,
55
47
  orElse2,
56
48
  fromNullishOr,
57
49
  fromUndefinedOr,
58
- getOrUndefined,
59
50
  map,
60
51
  flatMap,
61
52
  Service2,
@@ -67,25 +58,18 @@ import {
67
58
  succeed,
68
59
  fail,
69
60
  getOrThrow,
70
- empty,
71
61
  sort,
72
62
  of,
73
- every,
74
63
  fromInputUnsafe,
75
64
  isFinite,
76
65
  toMillis,
77
- toPredicate,
78
- has,
79
- compose,
80
66
  Error2,
81
67
  TaggedError,
82
- forkUnsafe,
83
- isInterruptReason,
68
+ scopeRemoveFinalizerUnsafe,
69
+ fiberEnterUninterruptibleUnsafe,
84
70
  fail2,
85
- hasInterruptsOnly,
86
71
  squash,
87
72
  hasInterrupts,
88
- filterInterruptors,
89
73
  Done,
90
74
  done,
91
75
  UnknownError,
@@ -95,19 +79,21 @@ import {
95
79
  isSuccess2,
96
80
  isFailure,
97
81
  makeUnsafe2,
98
- make2,
99
82
  _await,
83
+ done2,
100
84
  fail4,
101
85
  isDone,
102
86
  isDoneUnsafe,
103
87
  doneUnsafe,
104
- into,
105
88
  Scope,
89
+ make2,
106
90
  makeUnsafe3,
107
91
  addFinalizerExit,
108
92
  addFinalizer,
109
- fork,
93
+ forkUnsafe,
110
94
  close,
95
+ makeMemoMapUnsafe,
96
+ buildWithMemoMap,
111
97
  buildWithScope,
112
98
  succeed3,
113
99
  effect,
@@ -135,6 +121,7 @@ import {
135
121
  try_2,
136
122
  withFiber,
137
123
  flatMap3,
124
+ flatten,
138
125
  andThen,
139
126
  tap,
140
127
  map3,
@@ -143,21 +130,19 @@ import {
143
130
  catch_,
144
131
  catchTag,
145
132
  catchReason,
146
- catchCause,
147
133
  catchIf,
148
134
  catchCauseIf,
149
135
  mapError,
150
136
  orDie,
151
- tapCause,
152
137
  ignore,
153
138
  ignoreCause,
154
139
  sleep,
155
140
  raceFirst,
156
141
  matchEffect,
157
142
  context,
158
- provide2,
159
143
  provideContext,
160
144
  serviceOption,
145
+ provideService,
161
146
  scope,
162
147
  scoped,
163
148
  acquireRelease,
@@ -175,14 +160,22 @@ import {
175
160
  forkScoped,
176
161
  runFork,
177
162
  runForkWith,
163
+ runCallbackWith,
164
+ runCallback,
165
+ runPromise,
166
+ runPromiseWith,
167
+ runPromiseExit,
168
+ runPromiseExitWith,
169
+ runSync,
170
+ runSyncWith,
171
+ runSyncExit,
172
+ runSyncExitWith,
178
173
  fnUntraced,
179
174
  clockWith,
180
- logError,
181
175
  effectify,
182
176
  await_,
183
177
  join2,
184
178
  interrupt2,
185
- interruptAll,
186
179
  getCurrent,
187
180
  runIn,
188
181
  make3,
@@ -202,8 +195,8 @@ import {
202
195
  encodeEffect,
203
196
  Unknown,
204
197
  String3,
198
+ Struct,
205
199
  Record,
206
- Tuple,
207
200
  Literals,
208
201
  tag,
209
202
  NonEmptyString,
@@ -220,7 +213,7 @@ import {
220
213
  fromChannel,
221
214
  fromPull,
222
215
  callback2,
223
- empty4,
216
+ empty3,
224
217
  suspend2,
225
218
  fail6,
226
219
  unwrap2,
@@ -232,10 +225,9 @@ import {
232
225
  splitLines,
233
226
  run,
234
227
  runCollect,
235
- runForEach,
236
228
  runDrain,
237
229
  mkString
238
- } from "./index-wxqy9zdg.js";
230
+ } from "./index-sdgqen8s.js";
239
231
  var __defProp = Object.defineProperty;
240
232
  var __returnValue = (v) => v;
241
233
  function __exportSetter(name, newValue) {
@@ -251,111 +243,6 @@ var __export = (target, all) => {
251
243
  });
252
244
  };
253
245
 
254
- // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/MutableHashMap.js
255
- var TypeId = "~effect/MutableHashMap";
256
- var MutableHashMapProto = {
257
- [TypeId]: TypeId,
258
- [Symbol.iterator]() {
259
- return this.backing[Symbol.iterator]();
260
- },
261
- toString() {
262
- return `MutableHashMap(${format(Array.from(this))})`;
263
- },
264
- toJSON() {
265
- return {
266
- _id: "MutableHashMap",
267
- values: toJson(Array.from(this))
268
- };
269
- },
270
- [NodeInspectSymbol]() {
271
- return this.toJSON();
272
- },
273
- pipe() {
274
- return pipeArguments(this, arguments);
275
- }
276
- };
277
- var empty2 = () => {
278
- const self = Object.create(MutableHashMapProto);
279
- self.backing = new Map;
280
- self.buckets = new Map;
281
- return self;
282
- };
283
- var get2 = /* @__PURE__ */ dual(2, (self, key) => {
284
- if (self.backing.has(key)) {
285
- return some(self.backing.get(key));
286
- } else if (isSimpleKey(key)) {
287
- return none();
288
- }
289
- const hash2 = hash(key);
290
- const bucket = self.buckets.get(hash2);
291
- if (bucket === undefined) {
292
- return none();
293
- }
294
- return getFromBucket(self, bucket, key);
295
- });
296
- var isSimpleKey = (u) => typeof u !== "object" && typeof u !== "function";
297
- var getFromBucket = (self, bucket, key) => {
298
- for (let i = 0, len = bucket.length;i < len; i++) {
299
- if (equals(key, bucket[i])) {
300
- const refKey = bucket[i];
301
- return some(self.backing.get(refKey));
302
- }
303
- }
304
- return none();
305
- };
306
- var has2 = /* @__PURE__ */ dual(2, (self, key) => isSome(get2(self, key)));
307
- var set = /* @__PURE__ */ dual(3, (self, key, value) => {
308
- if (self.backing.has(key) || isSimpleKey(key)) {
309
- self.backing.set(key, value);
310
- return self;
311
- }
312
- const hash2 = hash(key);
313
- const bucket = self.buckets.get(hash2);
314
- if (bucket === undefined) {
315
- self.buckets.set(hash2, [key]);
316
- self.backing.set(key, value);
317
- return self;
318
- }
319
- let refKey = getRefKey(bucket, key);
320
- if (refKey === undefined) {
321
- bucket.push(key);
322
- refKey = key;
323
- }
324
- self.backing.set(refKey, value);
325
- return self;
326
- });
327
- var getRefKey = (bucket, key) => {
328
- for (let i = 0, len = bucket.length;i < len; i++) {
329
- if (equals(key, bucket[i])) {
330
- return bucket[i];
331
- }
332
- }
333
- };
334
- var remove = /* @__PURE__ */ dual(2, (self, key_) => {
335
- if (isSimpleKey(key_)) {
336
- self.backing.delete(key_);
337
- return self;
338
- }
339
- const hash2 = hash(key_);
340
- const bucket = self.buckets.get(hash2);
341
- if (bucket === undefined) {
342
- return self;
343
- }
344
- for (let i = 0, len = bucket.length;i < len; i++) {
345
- const bkey = bucket[i];
346
- if (bkey === key_ || equals(key_, bkey)) {
347
- self.backing.delete(bkey);
348
- bucket.splice(i, 1);
349
- break;
350
- }
351
- }
352
- if (bucket.length === 0) {
353
- self.buckets.delete(hash2);
354
- }
355
- return self;
356
- });
357
- var size = (self) => self.backing.size;
358
-
359
246
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/ulid.js
360
247
  var maxTimestamp = 2 ** 48 - 1;
361
248
  var base32Chars = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
@@ -713,7 +600,7 @@ __export(exports_Aead, {
713
600
  });
714
601
 
715
602
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/crypto/CryptoError.js
716
- var TypeId2 = "~effect/crypto/CryptoError";
603
+ var TypeId = "~effect/crypto/CryptoError";
717
604
  var ReasonTypeId = "~effect/crypto/CryptoError/Reason";
718
605
 
719
606
  class InvalidArgument extends (/* @__PURE__ */ TaggedError("InvalidArgument")) {
@@ -752,7 +639,7 @@ class NotExtractable extends (/* @__PURE__ */ TaggedError("NotExtractable")) {
752
639
  }
753
640
 
754
641
  class CryptoError extends (/* @__PURE__ */ TaggedError("CryptoError")) {
755
- [TypeId2] = TypeId2;
642
+ [TypeId] = TypeId;
756
643
  cause = "cause" in this.reason ? this.reason.cause : undefined;
757
644
  get message() {
758
645
  return `${this.module}.${this.method}: ${this.reason.message}`;
@@ -1633,7 +1520,7 @@ var makeCache = (importKey) => {
1633
1520
  };
1634
1521
 
1635
1522
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/crypto/Aead.js
1636
- var TypeId3 = "~effect/crypto/Aead/Key";
1523
+ var TypeId2 = "~effect/crypto/Aead/Key";
1637
1524
  var aes128Gcm = {
1638
1525
  name: "aes128Gcm",
1639
1526
  keyLength: 16,
@@ -1662,8 +1549,8 @@ var xchacha20Poly13052 = {
1662
1549
  nonceLength: 24,
1663
1550
  implementation: /* @__PURE__ */ chachaImplementation(xchacha20Poly1305)
1664
1551
  };
1665
- var KeyProto = /* @__PURE__ */ redactedProto(TypeId3, "Aead.Key");
1666
- var isKey = (u) => hasProperty(u, TypeId3);
1552
+ var KeyProto = /* @__PURE__ */ redactedProto(TypeId2, "Aead.Key");
1553
+ var isKey = (u) => hasProperty(u, TypeId2);
1667
1554
 
1668
1555
  class Aead extends (/* @__PURE__ */ Service2()("effect/crypto/Aead")) {
1669
1556
  }
@@ -1763,7 +1650,7 @@ __export(exports_Cipher, {
1763
1650
  layerWebCrypto: () => layerWebCrypto3,
1764
1651
  toBytes: () => toBytes3
1765
1652
  });
1766
- var TypeId4 = "~effect/crypto/Cipher/Key";
1653
+ var TypeId3 = "~effect/crypto/Cipher/Key";
1767
1654
  var aes128Ctr = {
1768
1655
  name: "aes128Ctr",
1769
1656
  mode: "AES-CTR",
@@ -1784,8 +1671,8 @@ var aes256Cbc = {
1784
1671
  mode: "AES-CBC",
1785
1672
  keyLength: 32
1786
1673
  };
1787
- var KeyProto2 = /* @__PURE__ */ redactedProto(TypeId4, "Cipher.Key");
1788
- var isKey2 = (u) => hasProperty(u, TypeId4);
1674
+ var KeyProto2 = /* @__PURE__ */ redactedProto(TypeId3, "Cipher.Key");
1675
+ var isKey2 = (u) => hasProperty(u, TypeId3);
1789
1676
 
1790
1677
  class Cipher extends (/* @__PURE__ */ Service2()("effect/crypto/Cipher")) {
1791
1678
  }
@@ -2052,7 +1939,7 @@ __export(exports_Mac, {
2052
1939
  timingSafeEqual: () => timingSafeEqual,
2053
1940
  toBytes: () => toBytes5
2054
1941
  });
2055
- var TypeId5 = "~effect/crypto/Mac/Key";
1942
+ var TypeId4 = "~effect/crypto/Mac/Key";
2056
1943
  var hmacSha1 = {
2057
1944
  name: "hmacSha1",
2058
1945
  hash: sha1
@@ -2069,8 +1956,8 @@ var hmacSha512 = {
2069
1956
  name: "hmacSha512",
2070
1957
  hash: sha512
2071
1958
  };
2072
- var KeyProto3 = /* @__PURE__ */ redactedProto(TypeId5, "Mac.Key");
2073
- var isKey3 = (u) => hasProperty(u, TypeId5);
1959
+ var KeyProto3 = /* @__PURE__ */ redactedProto(TypeId4, "Mac.Key");
1960
+ var isKey3 = (u) => hasProperty(u, TypeId4);
2074
1961
  var blockSizes = {
2075
1962
  MD5: 64,
2076
1963
  "SHA-1": 64,
@@ -3082,7 +2969,7 @@ var walk = /* @__PURE__ */ fnUntraced(function* (fs, compiled, options) {
3082
2969
  });
3083
2970
 
3084
2971
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/PlatformError.js
3085
- var TypeId6 = "~effect/PlatformError";
2972
+ var TypeId5 = "~effect/PlatformError";
3086
2973
 
3087
2974
  class BadArgument extends (/* @__PURE__ */ TaggedError("BadArgument")) {
3088
2975
  get message() {
@@ -3109,7 +2996,7 @@ class PlatformError extends (/* @__PURE__ */ TaggedError("PlatformError")) {
3109
2996
  });
3110
2997
  }
3111
2998
  }
3112
- [TypeId6] = TypeId6;
2999
+ [TypeId5] = TypeId5;
3113
3000
  get message() {
3114
3001
  return this.reason.message;
3115
3002
  }
@@ -3118,7 +3005,7 @@ var systemError = (options) => new PlatformError(new SystemError(options));
3118
3005
  var badArgument = (options) => new PlatformError(new BadArgument(options));
3119
3006
 
3120
3007
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Sink.js
3121
- var TypeId7 = "~effect/Sink";
3008
+ var TypeId6 = "~effect/Sink";
3122
3009
  var endVoid = /* @__PURE__ */ succeed4([undefined]);
3123
3010
  var sinkVariance = {
3124
3011
  _A: identity,
@@ -3128,12 +3015,12 @@ var sinkVariance = {
3128
3015
  _R: identity
3129
3016
  };
3130
3017
  var SinkProto = {
3131
- [TypeId7]: sinkVariance,
3018
+ [TypeId6]: sinkVariance,
3132
3019
  pipe() {
3133
3020
  return pipeArguments(this, arguments);
3134
3021
  }
3135
3022
  };
3136
- var isSink = (u) => hasProperty(u, TypeId7);
3023
+ var isSink = (u) => hasProperty(u, TypeId6);
3137
3024
  var fromChannel2 = (channel) => fromTransform2((upstream, scope) => toTransform(channel)(upstream, scope).pipe(flatMap3(forever({
3138
3025
  disableYield: true
3139
3026
  })), catchDone(succeed4)));
@@ -3155,7 +3042,7 @@ var forEachArray = (f) => fromTransform2((upstream) => upstream.pipe(flatMap3(f)
3155
3042
  var unwrap3 = (effect) => fromChannel2(unwrap(map3(effect, toChannel)));
3156
3043
 
3157
3044
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/internal/rcRef.js
3158
- var TypeId8 = "~effect/RcRef";
3045
+ var TypeId7 = "~effect/RcRef";
3159
3046
  var stateEmpty = {
3160
3047
  _tag: "Empty"
3161
3048
  };
@@ -3168,7 +3055,7 @@ var variance = {
3168
3055
  };
3169
3056
 
3170
3057
  class RcRefImpl {
3171
- [TypeId8] = variance;
3058
+ [TypeId7] = variance;
3172
3059
  pipe() {
3173
3060
  return pipeArguments(this, arguments);
3174
3061
  }
@@ -3259,7 +3146,7 @@ var awaitAcquiring = (self, acquiring, restore) => onExit(restore(join2(acquirin
3259
3146
  self.state = stateEmpty;
3260
3147
  return interrupt2(acquiring.fiber);
3261
3148
  });
3262
- var get3 = (self_) => {
3149
+ var get2 = (self_) => {
3263
3150
  const self = self_;
3264
3151
  return uninterruptibleMask((restore) => flatMap3(scope, (scope) => flatMap3(getState(self, restore), (state) => as(addFinalizerExit(scope, () => release(self, state)), state.value))));
3265
3152
  };
@@ -3294,14 +3181,14 @@ var release = (self, state) => {
3294
3181
 
3295
3182
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/RcRef.js
3296
3183
  var make11 = make10;
3297
- var get4 = get3;
3184
+ var get3 = get2;
3298
3185
 
3299
3186
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/FileSystem.js
3300
- var TypeId9 = "~effect/FileSystem";
3187
+ var TypeId8 = "~effect/FileSystem";
3301
3188
  var FileSystem = /* @__PURE__ */ Service2("effect/FileSystem");
3302
3189
  var make12 = (impl) => FileSystem.of({
3303
3190
  ...impl,
3304
- [TypeId9]: TypeId9,
3191
+ [TypeId8]: TypeId8,
3305
3192
  glob: make9(impl),
3306
3193
  exists: (path) => pipe(impl.access(path), as(true), catchTag("PlatformError", (e) => e.reason._tag === "NotFound" ? succeed4(false) : fail5(e))),
3307
3194
  readFileString: (path, encoding) => flatMap3(impl.readFile(path), (_) => try_2({
@@ -3357,11 +3244,11 @@ class WatchBackend extends (/* @__PURE__ */ Service2()("effect/FileSystem/WatchB
3357
3244
  }
3358
3245
 
3359
3246
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Path.js
3360
- var TypeId10 = "~effect/Path";
3247
+ var TypeId9 = "~effect/Path";
3361
3248
  var Path = /* @__PURE__ */ Service2("effect/Path");
3362
3249
  var make13 = (impl) => Path.of({
3363
3250
  ...impl,
3364
- [TypeId10]: TypeId10,
3251
+ [TypeId9]: TypeId9,
3365
3252
  resolveWithin(root, input) {
3366
3253
  if (impl.parse(input).root !== "")
3367
3254
  return none();
@@ -3372,171 +3259,114 @@ var make13 = (impl) => Path.of({
3372
3259
  }
3373
3260
  });
3374
3261
 
3375
- // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/FiberMap.js
3376
- var TypeId11 = "~effect/FiberMap";
3377
- var isFiberMap = (u) => hasProperty(u, TypeId11);
3378
- var Proto = {
3379
- [TypeId11]: TypeId11,
3380
- [Symbol.iterator]() {
3381
- if (this.state._tag === "Closed") {
3382
- return empty();
3383
- }
3384
- return this.state.backing[Symbol.iterator]();
3385
- },
3386
- ...PipeInspectableProto,
3387
- toJSON() {
3388
- return {
3389
- _id: "FiberMap",
3390
- state: this.state
3391
- };
3392
- }
3393
- };
3394
- var makeUnsafe4 = (backing, deferred) => {
3395
- const self = Object.create(Proto);
3396
- self.state = {
3397
- _tag: "Open",
3398
- backing,
3399
- fibers: new Set
3400
- };
3401
- self.deferred = deferred;
3402
- return self;
3403
- };
3404
- var make14 = () => acquireRelease(sync(() => makeUnsafe4(empty2(), makeUnsafe2())), (map) => suspend(() => {
3405
- const state = map.state;
3406
- if (state._tag === "Closed")
3407
- return void_2;
3408
- map.state = {
3409
- _tag: "Closed"
3410
- };
3411
- return interruptAll(state.fibers).pipe(into(map.deferred));
3412
- }));
3413
- var internalFiberId = -1;
3414
- var isInternalInterruption = /* @__PURE__ */ toPredicate(/* @__PURE__ */ compose(filterInterruptors, /* @__PURE__ */ has(internalFiberId)));
3415
- var setUnsafe = /* @__PURE__ */ dual((args) => isFiberMap(args[0]), (self, key, fiber, options) => {
3416
- if (self.state._tag === "Closed") {
3417
- fiber.interruptUnsafe(internalFiberId);
3418
- return;
3419
- }
3420
- const previous = get2(self.state.backing, key);
3421
- if (previous._tag === "Some") {
3422
- if (previous.value === fiber) {
3423
- return;
3424
- } else if (options?.onlyIfMissing === true) {
3425
- fiber.interruptUnsafe(internalFiberId);
3426
- return;
3427
- }
3428
- }
3429
- set(self.state.backing, key, fiber);
3430
- self.state.fibers.add(fiber);
3431
- if (previous._tag === "Some") {
3432
- previous.value.interruptUnsafe(internalFiberId);
3433
- }
3434
- fiber.addObserver((exit) => {
3435
- if (self.state._tag === "Closed") {
3436
- return;
3437
- }
3438
- self.state.fibers.delete(fiber);
3439
- const current = get2(self.state.backing, key);
3440
- if (isSome(current) && fiber === current.value) {
3441
- remove(self.state.backing, key);
3442
- }
3443
- if (isFailure(exit) && (options?.propagateInterruption === true ? !isInternalInterruption(exit.cause) : !hasInterruptsOnly(exit.cause))) {
3444
- doneUnsafe(self.deferred, exit);
3445
- }
3446
- });
3262
+ // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/ManagedRuntime.js
3263
+ var TypeId10 = "~effect/ManagedRuntime";
3264
+ var DisposingRuntimes = /* @__PURE__ */ Reference("effect/ManagedRuntime/DisposingRuntimes", {
3265
+ defaultValue: () => new Set
3447
3266
  });
3448
- var getUnsafe2 = /* @__PURE__ */ dual(2, (self, key) => {
3449
- return self.state._tag === "Closed" ? none() : get2(self.state.backing, key);
3450
- });
3451
- var get5 = /* @__PURE__ */ dual(2, (self, key) => suspend(() => succeed4(getUnsafe2(self, key))));
3452
- var hasUnsafe = /* @__PURE__ */ dual(2, (self, key) => self.state._tag === "Closed" ? false : has2(self.state.backing, key));
3453
- var has3 = /* @__PURE__ */ dual(2, (self, key) => sync(() => hasUnsafe(self, key)));
3454
- var constInterruptedFiber = /* @__PURE__ */ function() {
3455
- let fiber = undefined;
3456
- return () => {
3457
- if (fiber === undefined) {
3458
- fiber = runFork(interrupt);
3459
- }
3460
- return fiber;
3267
+ var make14 = (layer, options) => {
3268
+ const memoMap = options?.memoMap ?? makeMemoMapUnsafe();
3269
+ const scope = makeUnsafe3("sequential");
3270
+ const layerScope = forkUnsafe(scope, "sequential");
3271
+ const fiberScope = forkUnsafe(scope, "parallel");
3272
+ const managedFibers = new WeakSet;
3273
+ const disposingFibers = new WeakSet;
3274
+ const defaultRunOptions = {
3275
+ onFiberStart(fiber) {
3276
+ managedFibers.add(fiber);
3277
+ if (disposingFibers.has(fiber))
3278
+ return;
3279
+ runIn(fiber, fiberScope);
3280
+ }
3461
3281
  };
3462
- }();
3463
- var run3 = function() {
3464
- const self = arguments[0];
3465
- if (isEffect(arguments[2])) {
3466
- return runImpl(self, arguments[1], arguments[2], arguments[3]);
3467
- }
3468
- const key = arguments[1];
3469
- const options = arguments[2];
3470
- return (effect) => runImpl(self, key, effect, options);
3471
- };
3472
- var runImpl = (self, key, effect, options) => withFiber((parent) => {
3473
- if (self.state._tag === "Closed") {
3474
- return interrupt;
3475
- } else if (options?.onlyIfMissing === true && hasUnsafe(self, key)) {
3476
- return sync(constInterruptedFiber);
3477
- }
3478
- const fiber = forkUnsafe(parent, effect, options?.startImmediately ?? true, true);
3479
- setUnsafe(self, key, fiber, options);
3480
- return succeed4(fiber);
3481
- });
3482
- var size2 = (self) => sync(() => self.state._tag === "Closed" ? 0 : size(self.state.backing));
3483
-
3484
- // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Runtime.js
3485
- var defaultTeardown = (exit, onExit) => {
3486
- if (isSuccess2(exit))
3487
- return onExit(0);
3488
- if (hasInterruptsOnly(exit.cause))
3489
- return onExit(130);
3490
- return onExit(getErrorExitCode(squash(exit.cause)));
3491
- };
3492
- var makeRunMain = (f) => dual((args) => isEffect(args[0]), (effect, options) => {
3493
- const main = options?.disableErrorReporting === true ? effect : tapCause(effect, (cause) => {
3494
- if (hasInterruptsOnly(cause))
3495
- return void_2;
3496
- const isReported = getErrorReported(squash(cause));
3497
- return isReported ? logError(cause) : void_2;
3498
- });
3499
- const teardown = options?.teardown ?? defaultTeardown;
3500
- runFork(withFiber((fiber) => {
3501
- try {
3502
- const keepAlive = globalThis.setInterval(constVoid, 2147483647);
3503
- fiber.addObserver(() => {
3504
- clearInterval(keepAlive);
3282
+ const mergeRunOptions = (options) => options ? {
3283
+ ...options,
3284
+ onFiberStart: options.onFiberStart ? (fiber) => {
3285
+ defaultRunOptions.onFiberStart(fiber);
3286
+ options.onFiberStart(fiber);
3287
+ } : defaultRunOptions.onFiberStart
3288
+ } : defaultRunOptions;
3289
+ let buildFiber;
3290
+ let disposed;
3291
+ const contextEffect = withFiber((fiber) => {
3292
+ if (!buildFiber) {
3293
+ buildFiber = runFork(tap(buildWithMemoMap(layer, memoMap, layerScope), (context) => sync(() => {
3294
+ self.cachedContext = context;
3295
+ })), {
3296
+ scheduler: fiber.cache.scheduler,
3297
+ onFiberStart(fiber) {
3298
+ managedFibers.add(fiber);
3299
+ runIn(fiber, fiberScope);
3300
+ }
3505
3301
  });
3506
- } catch {}
3507
- f({
3508
- fiber,
3509
- teardown
3510
- });
3511
- return main;
3512
- }));
3513
- });
3514
- var errorExitCode = "~effect/Runtime/errorExitCode";
3515
- var getErrorExitCode = (u) => {
3516
- if (typeof u === "object" && u !== null && errorExitCode in u) {
3517
- const code = u[errorExitCode];
3518
- if (typeof code === "number") {
3519
- return code;
3520
3302
  }
3521
- }
3522
- return 1;
3523
- };
3524
- var errorReported = "~effect/Runtime/errorReported";
3525
- var getErrorReported = (u) => {
3526
- if (typeof u === "object" && u !== null && errorReported in u) {
3527
- const isReported = u[errorReported];
3528
- if (typeof isReported === "boolean") {
3529
- return isReported;
3303
+ return flatten(await_(buildFiber));
3304
+ });
3305
+ const self = {
3306
+ [TypeId10]: TypeId10,
3307
+ memoMap,
3308
+ scope,
3309
+ contextEffect,
3310
+ cachedContext: undefined,
3311
+ context() {
3312
+ return self.cachedContext === undefined ? runPromise(self.contextEffect) : Promise.resolve(self.cachedContext);
3313
+ },
3314
+ dispose() {
3315
+ return runPromise(self.disposeEffect);
3316
+ },
3317
+ [Symbol.asyncDispose]() {
3318
+ return self.dispose();
3319
+ },
3320
+ disposeEffect: withFiber((fiber) => {
3321
+ if (disposed !== undefined) {
3322
+ if (fiber.getRef(DisposingRuntimes).has(self))
3323
+ return void_2;
3324
+ for (let current = fiber;current; current = current._parent) {
3325
+ if (managedFibers.has(current))
3326
+ return void_2;
3327
+ }
3328
+ return _await(disposed);
3329
+ }
3330
+ fiberEnterUninterruptibleUnsafe(fiber);
3331
+ const done = disposed = makeUnsafe2();
3332
+ for (let current = fiber;current; current = current._parent) {
3333
+ disposingFibers.add(current);
3334
+ scopeRemoveFinalizerUnsafe(fiberScope, current);
3335
+ }
3336
+ self.contextEffect = die("ManagedRuntime disposed");
3337
+ self.cachedContext = undefined;
3338
+ return close(self.scope, void_).pipe(provideService(DisposingRuntimes, new Set(fiber.getRef(DisposingRuntimes)).add(self)), ensuring(done2(done, void_)));
3339
+ }),
3340
+ runFork(effect, options) {
3341
+ return self.cachedContext === undefined ? runFork(provide2(self, effect), mergeRunOptions(options)) : runForkWith(self.cachedContext)(effect, mergeRunOptions(options));
3342
+ },
3343
+ runCallback(effect, options) {
3344
+ return self.cachedContext === undefined ? runCallback(provide2(self, effect), mergeRunOptions(options)) : runCallbackWith(self.cachedContext)(effect, mergeRunOptions(options));
3345
+ },
3346
+ runSyncExit(effect) {
3347
+ return self.cachedContext === undefined ? runSyncExit(provide2(self, effect)) : runSyncExitWith(self.cachedContext)(effect);
3348
+ },
3349
+ runSync(effect) {
3350
+ return self.cachedContext === undefined ? runSync(provide2(self, effect)) : runSyncWith(self.cachedContext)(effect);
3351
+ },
3352
+ runPromiseExit(effect, options) {
3353
+ return self.cachedContext === undefined ? runPromiseExit(provide2(self, effect), mergeRunOptions(options)) : runPromiseExitWith(self.cachedContext)(effect, mergeRunOptions(options));
3354
+ },
3355
+ runPromise(effect, options) {
3356
+ return self.cachedContext === undefined ? runPromise(provide2(self, effect), mergeRunOptions(options)) : runPromiseWith(self.cachedContext)(effect, mergeRunOptions(options));
3530
3357
  }
3531
- }
3532
- return true;
3358
+ };
3359
+ return self;
3533
3360
  };
3361
+ function provide2(managed, effect) {
3362
+ return flatMap3(managed.contextEffect, (context) => provideContext(effect, context));
3363
+ }
3534
3364
 
3535
3365
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Stdio.js
3536
- var TypeId12 = "~effect/Stdio";
3537
- var Stdio = /* @__PURE__ */ Service2(TypeId12);
3366
+ var TypeId11 = "~effect/Stdio";
3367
+ var Stdio = /* @__PURE__ */ Service2(TypeId11);
3538
3368
  var make15 = (options) => ({
3539
- [TypeId12]: TypeId12,
3369
+ [TypeId11]: TypeId11,
3540
3370
  stdinIsTerminal: succeed4(false),
3541
3371
  stdoutIsTerminal: succeed4(false),
3542
3372
  stderrIsTerminal: succeed4(false),
@@ -3544,7 +3374,7 @@ var make15 = (options) => ({
3544
3374
  });
3545
3375
 
3546
3376
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/Terminal.js
3547
- var TypeId13 = "~effect/Terminal";
3377
+ var TypeId12 = "~effect/Terminal";
3548
3378
  var QuitErrorTypeId = "~effect/Terminal/QuitError";
3549
3379
 
3550
3380
  class QuitError extends (/* @__PURE__ */ Error3("QuitError")({
@@ -3555,7 +3385,7 @@ class QuitError extends (/* @__PURE__ */ Error3("QuitError")({
3555
3385
  var Terminal = /* @__PURE__ */ Service2("effect/Terminal");
3556
3386
  var make16 = (impl) => Terminal.of({
3557
3387
  ...impl,
3558
- [TypeId13]: TypeId13
3388
+ [TypeId12]: TypeId12
3559
3389
  });
3560
3390
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/crypto/Kdf.js
3561
3391
  class Kdf extends (/* @__PURE__ */ Service2()("effect/crypto/Kdf")) {
@@ -3730,31 +3560,6 @@ var layerSignature = /* @__PURE__ */ layerWebCrypto7.pipe(/* @__PURE__ */ provid
3730
3560
  var layerKeyAgreement = /* @__PURE__ */ layerWebCrypto4.pipe(/* @__PURE__ */ provide(layerSecureRandom));
3731
3561
  var layerKeyWrap = /* @__PURE__ */ layerWebCrypto6.pipe(/* @__PURE__ */ provide(layerSecureRandom));
3732
3562
  var layer = /* @__PURE__ */ mergeAll(layerSecureRandom, layerDigest, layerMac, layerKdf, layerAead, layerCipher, layerSignature, layerKeyAgreement, layerKeyWrap);
3733
- // ../../../../node_modules/.bun/@effect+platform-node-shared@4.1.2+edf248c88a527e3e/node_modules/@effect/platform-node-shared/dist/NodeRuntime.js
3734
- var runMain = /* @__PURE__ */ makeRunMain(({
3735
- fiber,
3736
- teardown
3737
- }) => {
3738
- let receivedSignal = false;
3739
- fiber.addObserver((exit) => {
3740
- process.removeListener("SIGINT", onSigint);
3741
- process.removeListener("SIGTERM", onSigint);
3742
- teardown(exit, (code) => {
3743
- if (receivedSignal || code !== 0) {
3744
- process.exit(code);
3745
- }
3746
- });
3747
- });
3748
- function onSigint() {
3749
- receivedSignal = true;
3750
- fiber.interruptUnsafe(fiber.id);
3751
- }
3752
- process.on("SIGINT", onSigint);
3753
- process.on("SIGTERM", onSigint);
3754
- });
3755
-
3756
- // ../../../../node_modules/.bun/@effect+platform-node@4.1.2+22a1c27d4b1c9267/node_modules/@effect/platform-node/dist/NodeRuntime.js
3757
- var runMain2 = runMain;
3758
3563
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/process/ChildProcessSpawner.js
3759
3564
  var ExitCode = /* @__PURE__ */ nominal();
3760
3565
  var ProcessId = /* @__PURE__ */ nominal();
@@ -3983,17 +3788,17 @@ var parseTemplate = (texts, values) => {
3983
3788
  };
3984
3789
 
3985
3790
  // ../../../../node_modules/.bun/effect@4.1.2/node_modules/effect/dist/process/ChildProcess.js
3986
- var TypeId14 = "~effect/process/ChildProcess";
3987
- var Proto2 = {
3791
+ var TypeId13 = "~effect/process/ChildProcess";
3792
+ var Proto = {
3988
3793
  .../* @__PURE__ */ Prototype({
3989
3794
  label: "Command",
3990
3795
  evaluate(fiber) {
3991
3796
  return getUnsafe(fiber.context, ChildProcessSpawner).spawn(this);
3992
3797
  }
3993
3798
  }),
3994
- [TypeId14]: TypeId14
3799
+ [TypeId13]: TypeId13
3995
3800
  };
3996
- var makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto2), {
3801
+ var makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto), {
3997
3802
  _tag: "StandardCommand",
3998
3803
  command,
3999
3804
  args,
@@ -4482,7 +4287,7 @@ var make19 = /* @__PURE__ */ gen2(function* () {
4482
4287
  if (additionalFds.length === 0) {
4483
4288
  return {
4484
4289
  getInputFd: () => drain,
4485
- getOutputFd: () => empty4
4290
+ getOutputFd: () => empty3
4486
4291
  };
4487
4292
  }
4488
4293
  const inputSinks = new Map;
@@ -4505,7 +4310,7 @@ var make19 = /* @__PURE__ */ gen2(function* () {
4505
4310
  return void_2;
4506
4311
  });
4507
4312
  const setupOutput = (fd, nodeStream, sink) => {
4508
- let stream = empty4;
4313
+ let stream = empty3;
4509
4314
  if (nodeStream && "read" in nodeStream) {
4510
4315
  const passThrough = new PassThrough;
4511
4316
  let error = undefined;
@@ -4551,7 +4356,7 @@ var make19 = /* @__PURE__ */ gen2(function* () {
4551
4356
  }
4552
4357
  return {
4553
4358
  getInputFd: (fd) => inputSinks.get(fd) ?? drain,
4554
- getOutputFd: (fd) => outputStreams.get(fd) ?? empty4
4359
+ getOutputFd: (fd) => outputStreams.get(fd) ?? empty3
4555
4360
  };
4556
4361
  });
4557
4362
  const setupChildStdin = (command, childProcess, config, inputFailure) => suspend(() => {
@@ -4579,7 +4384,7 @@ var make19 = /* @__PURE__ */ gen2(function* () {
4579
4384
  evaluate: () => passThrough,
4580
4385
  onError: (error) => toPlatformError("fromReadable(stdout)", toError(error), command)
4581
4386
  });
4582
- })() : empty4;
4387
+ })() : empty3;
4583
4388
  let stderr = childProcess.stderr ? (() => {
4584
4389
  const passThrough = new PassThrough;
4585
4390
  childProcess.stderr.on("error", (error) => passThrough.destroy(error));
@@ -4588,7 +4393,7 @@ var make19 = /* @__PURE__ */ gen2(function* () {
4588
4393
  evaluate: () => passThrough,
4589
4394
  onError: (error) => toPlatformError("fromReadable(stderr)", toError(error), command)
4590
4395
  });
4591
- })() : empty4;
4396
+ })() : empty3;
4592
4397
  if (isSink(stdoutConfig.stream)) {
4593
4398
  stdout = transduce(stdout, stdoutConfig.stream);
4594
4399
  }
@@ -5013,7 +4818,7 @@ var removeFactory = (method) => {
5013
4818
  force: options?.force ?? false
5014
4819
  });
5015
4820
  };
5016
- var remove2 = /* @__PURE__ */ removeFactory("remove");
4821
+ var remove = /* @__PURE__ */ removeFactory("remove");
5017
4822
  var makeTempDirectoryScoped = /* @__PURE__ */ (() => {
5018
4823
  const makeDirectory = /* @__PURE__ */ makeTempDirectoryFactory("makeTempDirectoryScoped");
5019
4824
  const removeDirectory = /* @__PURE__ */ removeFactory("makeTempDirectoryScoped");
@@ -5402,7 +5207,7 @@ var makeFileSystem = /* @__PURE__ */ map3(/* @__PURE__ */ serviceOption(WatchBac
5402
5207
  readFile: readFile2,
5403
5208
  readLink,
5404
5209
  realPath,
5405
- remove: remove2,
5210
+ remove,
5406
5211
  rename: rename2,
5407
5212
  stat: stat2,
5408
5213
  symlink: symlink2,
@@ -5606,14 +5411,14 @@ var make20 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQui
5606
5411
  if (inputEnded) {
5607
5412
  handleEnd();
5608
5413
  } else {
5609
- yield* get4(rlRef);
5610
- yield* get4(rawModeRef);
5414
+ yield* get3(rlRef);
5415
+ yield* get3(rawModeRef);
5611
5416
  stdin.once("end", handleEnd);
5612
5417
  }
5613
5418
  return queue;
5614
5419
  });
5615
5420
  const readLine = suspend(() => poll(lines).pipe(flatMap3(match2({
5616
- onNone: () => scoped(andThen(get4(rlRef), take2(lines))),
5421
+ onNone: () => scoped(andThen(get3(rlRef), take2(lines))),
5617
5422
  onSome: succeed4
5618
5423
  })), mapError(() => new QuitError({}))));
5619
5424
  const display = (prompt) => uninterruptible(callback((resume) => {
@@ -5644,7 +5449,7 @@ var layer13 = layer12;
5644
5449
 
5645
5450
  // ../../../../node_modules/.bun/@effect+platform-node@4.1.2+22a1c27d4b1c9267/node_modules/@effect/platform-node/dist/NodeServices.js
5646
5451
  var layer14 = /* @__PURE__ */ provideMerge(layer2, /* @__PURE__ */ mergeAll(layer7, layer9, layer11, layer13));
5647
- // ../../../../node_modules/.bun/@dual-os+sdk@0.8.1+a827849ded09603e/node_modules/@dual-os/sdk/dist/Runner.js
5452
+ // ../../../../node_modules/.bun/@dual-os+sdk@0.9.0+a827849ded09603e/node_modules/@dual-os/sdk/dist/Runner.js
5648
5453
  var guestOAuth = pipe(oauth2TokenRefresherLayer, provideMerge(layer5), provide(layer3(fromUnknown({}))));
5649
5454
  function initializationError(cause) {
5650
5455
  if (is(PluginExecutionError)(cause))
@@ -5658,116 +5463,77 @@ function initializationError(cause) {
5658
5463
  }))) || "No error details returned by the plugin."
5659
5464
  });
5660
5465
  }
5661
- pipe(gen2(function* () {
5662
- const guestServices = yield* context();
5663
- const scope = yield* Scope;
5664
- const runtimeScope = yield* fork(scope, "sequential");
5665
- const failed = yield* make2();
5666
- const invocations = yield* make14();
5667
- const stdio = yield* Stdio;
5668
- const args = yield* decodeUnknownEffect(Tuple([
5669
- NonEmptyString,
5670
- NonEmptyString,
5671
- Literals(["inspect", "execute"]),
5672
- NonEmptyString
5673
- ]))(yield* stdio.args);
5674
- const load = yield* cached(forkIn(gen2(function* () {
5675
- const plugin = (yield* decodeUnknownEffect(Record(String3, Unknown))(yield* tryPromise({
5676
- try: () => import(args[0]),
5677
- catch: initializationError
5678
- })))[args[1]];
5679
- if (!isPlugin(plugin))
5680
- return yield* PluginExecutionError.make({
5681
- category: "protocol",
5682
- message: "The configured export is not an integration plugin"
5683
- });
5684
- yield* try_2({
5685
- try: () => make(plugin.identifier),
5686
- catch: initializationError
5687
- });
5688
- return {
5689
- plugin,
5690
- runtime: yield* cached(forkIn(pipe(buildWithScope(pipe(toLayer(fromPlugin(plugin, args[3])), provideMerge(mergeAll(filesUnavailable, layer4, guestOAuth))), runtimeScope), provideContext(makeUnsafe(guestServices.mapUnsafe))), runtimeScope))
5691
- };
5692
- }), runtimeScope));
5693
- const execute$1 = fnUntraced(function* (request) {
5694
- return yield* pipe(gen2(function* () {
5695
- const { plugin, runtime } = yield* join2(yield* load);
5696
- if (request.identity.pluginKey !== plugin.identifier && !(args[2] === "inspect" && ("_tag" in request) && request._tag === "extract"))
5697
- return yield* PluginExecutionError.make({
5698
- category: "protocol",
5699
- message: "Plugin identity does not match the request"
5700
- });
5701
- if (request.identity.pluginVersion !== args[3])
5466
+ var Options = Struct({
5467
+ entrypoint: NonEmptyString,
5468
+ exportName: NonEmptyString,
5469
+ mode: Literals(["inspect", "execute"]),
5470
+ version: NonEmptyString
5471
+ });
5472
+ var runtime = make14(mergeAll(layer14, layer));
5473
+ function load(input) {
5474
+ return runtime.runPromise(gen2(function* () {
5475
+ const options = yield* decodeUnknownEffect(Options)(input);
5476
+ const guestServices = yield* context();
5477
+ const scope = yield* make2("sequential");
5478
+ const loaded = yield* cached(forkIn(gen2(function* () {
5479
+ const plugin = (yield* decodeUnknownEffect(Record(String3, Unknown))(yield* tryPromise({
5480
+ try: () => import(options.entrypoint),
5481
+ catch: initializationError
5482
+ })))[options.exportName];
5483
+ if (!isPlugin(plugin))
5702
5484
  return yield* PluginExecutionError.make({
5703
5485
  category: "protocol",
5704
- message: "Plugin release does not match the request"
5486
+ message: "The configured export is not an integration plugin"
5705
5487
  });
5706
- if ("_tag" in request && request._tag === "extract")
5707
- return {
5708
- _tag: "success",
5709
- identity: request.identity,
5710
- value: yield* decodeEffect(fromJsonString(Json))(yield* encodeEffect(fromJsonString(Unknown))(materializePlugin(plugin, { version: request.identity.pluginVersion })))
5711
- };
5712
- return yield* pipe(execute(request), provideContext(yield* join2(yield* runtime)));
5713
- }), catchCauseIf((cause) => !hasInterrupts(cause), (cause) => args[2] === "inspect" ? fail5(initializationError(squash(cause))) : succeed4({
5714
- _tag: "failure",
5715
- identity: request.identity,
5716
- error: {
5717
- category: "initialization",
5718
- code: "PluginInitializationFailed",
5719
- message: "Cannot initialize the installed plugin",
5720
- retryable: false
5721
- }
5722
- })), mapError(initializationError));
5723
- });
5724
- yield* raceFirst(pipe(ipcMessages(process), runForEach(fnUntraced(function* (message) {
5725
- const input = yield* decodeInput(message);
5726
- const key = yield* encodeEffect(fromJsonString(Identity))(input.identity);
5727
- if ("_tag" in input && input._tag === "cancel") {
5728
- const fiber = getOrUndefined(yield* get5(invocations, key));
5729
- if (fiber !== undefined)
5730
- yield* pipe(interrupt2(fiber), forkIn(scope));
5731
- return;
5732
- }
5733
- if ((yield* has3(invocations, key)) || (yield* size2(invocations)) >= 16)
5734
- return yield* PluginExecutionError.make({
5735
- category: "protocol",
5736
- message: "Plugin invocation is duplicate or exceeds concurrency"
5488
+ yield* try_2({
5489
+ try: () => make(plugin.identifier),
5490
+ catch: initializationError
5737
5491
  });
5738
- const fiber = yield* run3(invocations, key, scoped(execute$1(input)));
5739
- yield* pipe(gen2(function* () {
5740
- const exit = yield* await_(fiber);
5741
- const send = fnUntraced(function* (output) {
5742
- const encoded = yield* encodeOutput(output, responseLimit(input));
5743
- if (args[2] !== "inspect")
5744
- return yield* sendIpc(process, encoded);
5745
- yield* callback((resume) => {
5746
- if (process.send === undefined) {
5747
- resume(fail5(initializationError("Plugin IPC channel is closed")));
5748
- return;
5749
- }
5750
- process.send(encoded, (error) => {
5751
- if (error !== null)
5752
- resume(fail5(initializationError(error)));
5753
- else
5754
- resume(void_2);
5492
+ return {
5493
+ plugin,
5494
+ services: yield* cached(forkIn(pipe(buildWithScope(pipe(toLayer(fromPlugin(plugin, options.version)), provideMerge(mergeAll(filesUnavailable, layer4, guestOAuth))), scope), provideContext(makeUnsafe(guestServices.mapUnsafe))), scope))
5495
+ };
5496
+ }), scope));
5497
+ const run = fnUntraced(function* (request) {
5498
+ return yield* pipe(gen2(function* () {
5499
+ const { plugin, services } = yield* join2(yield* loaded);
5500
+ if (request.identity.pluginKey !== plugin.identifier && !(options.mode === "inspect" && ("_tag" in request) && request._tag === "extract"))
5501
+ return yield* PluginExecutionError.make({
5502
+ category: "protocol",
5503
+ message: "Plugin identity does not match the request"
5755
5504
  });
5756
- });
5757
- if (process.connected)
5758
- process.disconnect();
5759
- });
5760
- if (isSuccess2(exit))
5761
- return yield* send(exit.value);
5762
- if (every(exit.cause.reasons, isInterruptReason))
5763
- return yield* send({
5764
- _tag: "interrupted",
5765
- identity: input.identity
5766
- });
5767
- return yield* initializationError(squash(exit.cause));
5768
- }), catchCause((cause) => fail4(failed, initializationError(squash(cause)))), forkIn(scope));
5769
- })), mapError(initializationError)), _await(failed));
5770
- }), scoped, provide2([layer14, layer]), runMain2({ disableErrorReporting: process.argv[4] !== "inspect" }));
5505
+ if (request.identity.pluginVersion !== options.version)
5506
+ return yield* PluginExecutionError.make({
5507
+ category: "protocol",
5508
+ message: "Plugin release does not match the request"
5509
+ });
5510
+ if ("_tag" in request && request._tag === "extract")
5511
+ return {
5512
+ _tag: "success",
5513
+ identity: request.identity,
5514
+ value: yield* decodeEffect(fromJsonString(Json))(yield* encodeEffect(fromJsonString(Unknown))(materializePlugin(plugin, { version: request.identity.pluginVersion })))
5515
+ };
5516
+ return yield* pipe(execute(request), provideContext(yield* join2(yield* services)));
5517
+ }), catchCauseIf((cause) => !hasInterrupts(cause), (cause) => options.mode === "inspect" ? fail5(initializationError(squash(cause))) : succeed4({
5518
+ _tag: "failure",
5519
+ identity: request.identity,
5520
+ error: {
5521
+ category: "initialization",
5522
+ code: "PluginInitializationFailed",
5523
+ message: "Cannot initialize the installed plugin",
5524
+ retryable: false
5525
+ }
5526
+ })));
5527
+ });
5528
+ return { execute: (message, signal) => runtime.runPromise(pipe(gen2(function* () {
5529
+ const request = yield* decodeInput(message);
5530
+ return yield* encodeOutput(yield* scoped(run(request)), responseLimit(request));
5531
+ }), mapError(initializationError)), { signal }) };
5532
+ }));
5533
+ }
5534
+ export {
5535
+ load
5536
+ };
5771
5537
 
5772
- //# debugId=F6CB055B9DAD9D3A64756E2164756E21
5538
+ //# debugId=5F931FC751C534DF64756E2164756E21
5773
5539
  //# sourceMappingURL=Runner.js.map