@dual-os/discord-api 8.0.3 → 8.0.4

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