@graftland/plugin-remote 0.3.1 → 0.3.3

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 (184) hide show
  1. package/dist/Auth.d.ts +2 -2
  2. package/dist/Auth.d.ts.map +1 -1
  3. package/dist/Auth.js.map +1 -1
  4. package/dist/{Bootstrap-Dr6sX7el.js → Bootstrap-H9gDsgsC.js} +2 -2
  5. package/dist/{Contract-DL2mHvaT.js → Contract-DsJtisvL.js} +2 -2
  6. package/dist/Contract.js +1 -1
  7. package/dist/{Errors-BMKmu5Y7.js → Errors-DYhsGZcZ.js} +3 -1
  8. package/dist/Errors.d.ts +7 -0
  9. package/dist/Errors.d.ts.map +1 -1
  10. package/dist/Errors.js +3 -1
  11. package/dist/Errors.js.map +1 -1
  12. package/dist/{FailureGroup-BcH0XOBi.js → FailureGroup-BgT73AaR.js} +14 -4
  13. package/dist/{Framing-zaYdOJnT.js → Framing-G9eSaeLb.js} +1 -1
  14. package/dist/{Graft-CVyueNOf.js → Graft-B71CPA2Y.js} +20 -16
  15. package/dist/{Packages-JNL34JpS.js → Packages-AgoCGotL.js} +23 -26
  16. package/dist/{Peer-BT7eAGmh.js → Peer-DXeVrGBh.js} +5 -5
  17. package/dist/{ProcessObservation-DEGrEMfP.js → ProcessObservation-gLgGirYv.js} +1 -1
  18. package/dist/{ServeLifecycle-CJM0gG5B.js → ServeLifecycle-Bd1FPJ6e.js} +1 -1
  19. package/dist/Transport.d.ts +2 -2
  20. package/dist/Transport.d.ts.map +1 -1
  21. package/dist/Transport.js.map +1 -1
  22. package/dist/bin.js +48 -47
  23. package/dist/bin.js.map +1 -1
  24. package/dist/{childRuntime-An0HsIzl.js → childRuntime-Bm3iSg_N.js} +29 -26
  25. package/dist/{connectionEnded-DCpFCjMX.js → connectionEnded-BwcxQ7W8.js} +4 -4
  26. package/dist/{entry-B89sepMU.js → entry-psOpX3Bj.js} +72 -35
  27. package/dist/host/auth/bearer.d.ts +9 -1
  28. package/dist/host/auth/bearer.d.ts.map +1 -1
  29. package/dist/host/auth/bearer.js +1 -1
  30. package/dist/host/auth/jwt.d.ts +9 -1
  31. package/dist/host/auth/jwt.d.ts.map +1 -1
  32. package/dist/host/auth/jwt.js +1 -1
  33. package/dist/host/auth/mtls.d.ts +8 -1
  34. package/dist/host/auth/mtls.d.ts.map +1 -1
  35. package/dist/host/auth/mtls.js +2 -2
  36. package/dist/host/auth/none.d.ts +3 -1
  37. package/dist/host/auth/none.js +1 -1
  38. package/dist/host/command.d.ts +14 -1
  39. package/dist/host/command.d.ts.map +1 -1
  40. package/dist/host/command.js +4 -4
  41. package/dist/host/local.d.ts +2 -1
  42. package/dist/host/local.d.ts.map +1 -1
  43. package/dist/host/local.js +3 -3
  44. package/dist/host/unix.d.ts +6 -1
  45. package/dist/host/unix.d.ts.map +1 -1
  46. package/dist/host/unix.js +3 -3
  47. package/dist/host/websocket.d.ts +10 -1
  48. package/dist/host/websocket.d.ts.map +1 -1
  49. package/dist/host/websocket.js +3 -3
  50. package/dist/host/worker.d.ts +3 -1
  51. package/dist/host/worker.d.ts.map +1 -1
  52. package/dist/host/worker.js +4 -5
  53. package/dist/{importer-Bk6U_sn4.js → importer-Cvf88eAY.js} +5 -8
  54. package/dist/index.js +9 -9
  55. package/dist/index.js.map +1 -1
  56. package/dist/internal/Certificates.js +4 -4
  57. package/dist/internal/Certificates.js.map +1 -1
  58. package/dist/internal/FailureGroup.js +3 -2
  59. package/dist/internal/FailureGroup.js.map +1 -1
  60. package/dist/internal/assembly.d.ts +2 -1
  61. package/dist/internal/assembly.js +9 -2
  62. package/dist/internal/assembly.js.map +1 -1
  63. package/dist/internal/auth/mtls.js +1 -1
  64. package/dist/internal/auth/mtls.js.map +1 -1
  65. package/dist/internal/auth/tokenCredentials.d.ts +2 -1
  66. package/dist/internal/auth/tokenCredentials.d.ts.map +1 -1
  67. package/dist/internal/child.js +20 -17
  68. package/dist/internal/child.js.map +1 -1
  69. package/dist/internal/childRuntime.js +4 -4
  70. package/dist/internal/childRuntime.js.map +1 -1
  71. package/dist/internal/credentials.d.ts +1 -1
  72. package/dist/internal/directTransport.d.ts +1 -1
  73. package/dist/internal/entry.d.ts +415 -3
  74. package/dist/internal/entry.d.ts.map +1 -1
  75. package/dist/internal/entry.js +1 -1
  76. package/dist/internal/entry.js.map +1 -1
  77. package/dist/internal/execution.js +40 -5
  78. package/dist/internal/execution.js.map +1 -1
  79. package/dist/internal/host/runner.js +7 -6
  80. package/dist/internal/host/runner.js.map +1 -1
  81. package/dist/internal/host.js +5 -5
  82. package/dist/internal/host.js.map +1 -1
  83. package/dist/internal/port.js +5 -5
  84. package/dist/internal/port.js.map +1 -1
  85. package/dist/internal/release.js +1 -1
  86. package/dist/internal/release.js.map +1 -1
  87. package/dist/internal/runner/Connection.d.ts +1 -1
  88. package/dist/internal/runner/Connection.js +4 -4
  89. package/dist/internal/runner/Connection.js.map +1 -1
  90. package/dist/internal/runner/Execution.js +3 -3
  91. package/dist/internal/runner/Execution.js.map +1 -1
  92. package/dist/internal/runner/Framing.js +1 -1
  93. package/dist/internal/runner/Framing.js.map +1 -1
  94. package/dist/internal/runner/Local.js +1 -1
  95. package/dist/internal/runner/Local.js.map +1 -1
  96. package/dist/internal/runner/Lock.js +1 -1
  97. package/dist/internal/runner/Lock.js.map +1 -1
  98. package/dist/internal/runner/Packages.d.ts +1 -1
  99. package/dist/internal/runner/Packages.js +22 -25
  100. package/dist/internal/runner/Packages.js.map +1 -1
  101. package/dist/internal/runner/Processes.js +7 -9
  102. package/dist/internal/runner/Processes.js.map +1 -1
  103. package/dist/internal/runner/Store.js +3 -3
  104. package/dist/internal/runner/Store.js.map +1 -1
  105. package/dist/internal/runner/Supervisor.js +46 -47
  106. package/dist/internal/runner/Supervisor.js.map +1 -1
  107. package/dist/internal/runner/accept.js +3 -3
  108. package/dist/internal/runner/accept.js.map +1 -1
  109. package/dist/internal/runner/model.js +1 -1
  110. package/dist/internal/runner/model.js.map +1 -1
  111. package/dist/internal/serve.js +1 -1
  112. package/dist/internal/serve.js.map +1 -1
  113. package/dist/internal/supervisorPlugin.js +1 -1
  114. package/dist/internal/watchdogMain.js +5 -5
  115. package/dist/internal/watchdogMain.js.map +1 -1
  116. package/dist/internal/websocketServer.js +3 -1
  117. package/dist/internal/websocketServer.js.map +1 -1
  118. package/dist/internal/workerMain.js +3 -3
  119. package/dist/{port-DSVUY8Bq.js → port--3x2zJ4D.js} +8 -8
  120. package/dist/{release-BY4Mlluy.js → release-DfZPuIcK.js} +1 -1
  121. package/dist/runner/auth/bearer.d.ts +6 -1
  122. package/dist/runner/auth/bearer.d.ts.map +1 -1
  123. package/dist/runner/auth/bearer.js +2 -2
  124. package/dist/runner/auth/jwt.d.ts +29 -2
  125. package/dist/runner/auth/jwt.d.ts.map +1 -1
  126. package/dist/runner/auth/jwt.js +4 -4
  127. package/dist/runner/auth/jwt.js.map +1 -1
  128. package/dist/runner/auth/mtls.d.ts +6 -1
  129. package/dist/runner/auth/mtls.d.ts.map +1 -1
  130. package/dist/runner/auth/mtls.js +3 -3
  131. package/dist/runner/auth/none.d.ts +7 -1
  132. package/dist/runner/auth/none.js +1 -1
  133. package/dist/runner/index.d.ts +310 -1
  134. package/dist/runner/index.d.ts.map +1 -1
  135. package/dist/runner/index.js +5 -5
  136. package/dist/runner/stdio.d.ts +6 -1
  137. package/dist/runner/stdio.d.ts.map +1 -1
  138. package/dist/runner/stdio.js +3 -3
  139. package/dist/runner/unix.d.ts +6 -1
  140. package/dist/runner/unix.d.ts.map +1 -1
  141. package/dist/runner/unix.js +3 -3
  142. package/dist/runner/websocket.d.ts +24 -1
  143. package/dist/runner/websocket.d.ts.map +1 -1
  144. package/dist/runner/websocket.js +4 -4
  145. package/dist/{socketChannel-C_ppdSzz.js → socketChannel-CJvL2DiB.js} +2 -2
  146. package/dist/{supervisorPlugin-CivhM7x5.js → supervisorPlugin-t6Z6PrhD.js} +72 -76
  147. package/dist/{token-Cc_1CTbE.js → token-CYBNNlhS.js} +1 -1
  148. package/dist/{tokenCredentials-CI6mMRRd.js → tokenCredentials-CbCuk-Rt.js} +3 -3
  149. package/dist/{websocketServer-D2Hk7wsA.js → websocketServer-NQhODlEt.js} +5 -3
  150. package/dist/{workerChannel-cmLc13vm.js → workerChannel-C8hhBJzA.js} +1 -1
  151. package/package.json +4 -4
  152. package/src/Auth.ts +9 -2
  153. package/src/Errors.ts +8 -0
  154. package/src/Transport.ts +6 -2
  155. package/src/bin.ts +28 -30
  156. package/src/index.ts +5 -3
  157. package/src/internal/Certificates.ts +10 -13
  158. package/src/internal/FailureGroup.ts +128 -121
  159. package/src/internal/assembly.ts +19 -10
  160. package/src/internal/auth/mtls.ts +19 -20
  161. package/src/internal/child.ts +248 -239
  162. package/src/internal/childRuntime.ts +81 -80
  163. package/src/internal/entry.ts +10 -11
  164. package/src/internal/execution.ts +69 -12
  165. package/src/internal/host/runner.ts +153 -153
  166. package/src/internal/host.ts +116 -120
  167. package/src/internal/port.ts +100 -103
  168. package/src/internal/release.ts +3 -2
  169. package/src/internal/runner/Connection.ts +52 -60
  170. package/src/internal/runner/Execution.ts +163 -164
  171. package/src/internal/runner/Framing.ts +9 -10
  172. package/src/internal/runner/Local.ts +26 -27
  173. package/src/internal/runner/Lock.ts +23 -25
  174. package/src/internal/runner/Packages.ts +67 -70
  175. package/src/internal/runner/Processes.ts +89 -92
  176. package/src/internal/runner/Store.ts +110 -114
  177. package/src/internal/runner/Supervisor.ts +392 -405
  178. package/src/internal/runner/accept.ts +76 -84
  179. package/src/internal/runner/model.ts +20 -21
  180. package/src/internal/serve.ts +15 -13
  181. package/src/internal/watchdogMain.ts +16 -11
  182. package/src/internal/websocketServer.ts +18 -3
  183. package/src/runner/auth/jwt.ts +10 -6
  184. package/dist/cleanup-CXLa1Wd9.js +0 -13
@@ -1,23 +1,22 @@
1
- import { c as isPlugin, i as plugin, l as make, o as fork, t as forks, u as optional } from "./Graft-CVyueNOf.js";
1
+ import { c as isPlugin, i as plugin, l as make, o as fork, t as forks, u as optional } from "./Graft-B71CPA2Y.js";
2
2
  import { t as ConfigDirectory } from "./ConfigDirectory-BCC6q2R4.js";
3
- import { i as make$2, m as isSubtreeActive, n as ModuleInvalid, o as CurrentId, p as findSubtree, r as ModuleResolver, t as make$1 } from "./importer-Bk6U_sn4.js";
4
- import { c as endpoint, n as UndeclaredFailure, o as endpoints, r as fromModule } from "./Contract-DL2mHvaT.js";
5
- import { a as ProcessExited, c as RemoteWithdrawn, i as MissingInstance, l as TransportError, o as RemoteEntryError, r as LocalTerminationTimeout, s as RemoteError, t as AuthenticationFailed } from "./Errors-BMKmu5Y7.js";
3
+ import { i as make$2, m as isSubtreeActive, n as ModuleInvalid, o as CurrentId, p as findSubtree, r as ModuleResolver, t as make$1 } from "./importer-Cvf88eAY.js";
4
+ import { c as endpoint, n as UndeclaredFailure, o as endpoints, r as fromModule } from "./Contract-DsJtisvL.js";
5
+ import { a as MissingInstance, c as RemoteError, i as LocalTerminationTimeout, l as RemoteWithdrawn, o as ProcessExited, r as CredentialsError, s as RemoteEntryError, t as AuthenticationFailed, u as TransportError } from "./Errors-DYhsGZcZ.js";
6
6
  import { n as WorkerTransport, t as LocalTransport } from "./directTransport-DrexuPSm.js";
7
- import { a as PositiveDuration, i as Supervisor, n as resolveEntry, r as verify } from "./Packages-JNL34JpS.js";
8
- import { E as make$3, b as awaitTermination, n as Session, r as channel, t as Peer, x as childOf } from "./Peer-BT7eAGmh.js";
7
+ import { a as PositiveDuration, i as Supervisor, n as resolveEntry, r as verify } from "./Packages-AgoCGotL.js";
8
+ import { E as make$3, _ as StateStorageError, a as ExecutionError, b as awaitTermination, c as PackageError, d as SessionAccessDenied, f as SessionConflict, g as StateDirectoryLocked, h as StaleSession, l as RemoteTerminationUnconfirmed, m as SessionStopped, n as Session, r as channel, s as LeaseExpired, t as Peer, u as RunnerClosing, x as childOf, y as TerminationUnconfirmed } from "./Peer-DXeVrGBh.js";
9
9
  import { n as Credentials, t as Authenticator } from "./Auth-BElTC9_X.js";
10
10
  import { n as Listener, t as Connector } from "./Transport-DULzpsgR.js";
11
- import { n as connectionEnded, r as prepare, t as closedNormally } from "./connectionEnded-DCpFCjMX.js";
12
- import { t as ServeLifecycle } from "./ServeLifecycle-CJM0gG5B.js";
13
- import { t as make$4 } from "./FailureGroup-BcH0XOBi.js";
14
- import { n as cleanupCause, t as children } from "./cleanup-CXLa1Wd9.js";
15
- import { n as make$5, o as defaults } from "./port-DSVUY8Bq.js";
16
- import { n as close } from "./release-BY4Mlluy.js";
17
- import { n as stdinExitTimeout } from "./ProcessObservation-DEGrEMfP.js";
18
- import { Array, Cause, Context, Deferred, Duration, Effect, Exit, Fiber, Option, Path, Ref, References, Schema, Scope, Stream, String } from "effect";
11
+ import { a as AlreadyLoaded, i as ActivationFailed, n as connectionEnded, o as ContractNotFound, r as prepare, s as ModuleImportFailed, t as closedNormally } from "./connectionEnded-BwcxQ7W8.js";
12
+ import { t as ServeLifecycle } from "./ServeLifecycle-Bd1FPJ6e.js";
13
+ import { n as children, r as cleanupCause, t as make$4 } from "./FailureGroup-BgT73AaR.js";
14
+ import { n as make$5, o as defaults } from "./port--3x2zJ4D.js";
15
+ import { n as close, t as ReleaseInterrupted } from "./release-DfZPuIcK.js";
16
+ import { n as stdinExitTimeout } from "./ProcessObservation-gLgGirYv.js";
17
+ import { Array, Cause, Context, Deferred, Duration, Effect, Exit, Fiber, Option, Path, PlatformError, Ref, References, Schema, Scope, Stream, String } from "effect";
19
18
  import { SecureRandom } from "effect/crypto";
20
- import { RpcClient } from "effect/rpc";
19
+ import { RpcClient, RpcClientError } from "effect/rpc";
21
20
  import { ChildProcessSpawner } from "effect/process";
22
21
  // packages/remote/src/internal/entryConfig.ts
23
22
  const Reference = Schema.Struct({
@@ -216,6 +215,13 @@ var CapabilityCombinationError = class extends Schema.TaggedError()("CapabilityC
216
215
  }
217
216
  };
218
217
  var CapabilityFailed = class extends Schema.TaggedError()("CapabilityFailed", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {};
218
+ /** Every failure class assembly raises; host error classification reads this list. */
219
+ const errors = [
220
+ ListenerConfigError,
221
+ CapabilityContractError,
222
+ CapabilityCombinationError,
223
+ CapabilityFailed
224
+ ];
219
225
  const definition = Schema.declare(isPlugin);
220
226
  /** Entries resolve capability modules before assembling their private providers. */
221
227
  const Invocation = Schema.Struct({
@@ -281,7 +287,7 @@ const compatible = (properties, kind) => {
281
287
  const kind = (auth) => auth._tag === "Mtls" ? "Certificate" : auth._tag === "Header" ? "Authorization" : "None";
282
288
  const warn = (properties, credentials, side) => Effect.all([properties.network && !properties.encrypted ? Effect.logWarning(credentials === "Authorization" ? `${properties.protocol}:// ${side === "host" ? "connection" : "listener"} is unencrypted; credentials are transmitted in plaintext` : `${properties.protocol}:// ${side === "host" ? "connection" : "listener"} is unencrypted`) : Effect.void, side === "runner" && properties.network && credentials === "None" ? Effect.logWarning("WebSocket listener has no authentication") : Effect.void], { discard: true });
283
289
  const directAuth = (properties, explicit) => explicit && (properties.protocol === "stdio" || properties.protocol === "command") ? Effect.fail(CapabilityCombinationError.make({ detail: `${properties.protocol} transports do not accept auth` })) : Effect.void;
284
- const connectWith = (explicitAuth = false) => Effect.gen(function* () {
290
+ const connectWith = Effect.fnUntraced(function* (explicitAuth = false) {
285
291
  const connector = yield* Connector;
286
292
  const credentials = yield* Credentials;
287
293
  yield* directAuth(connector.properties, explicitAuth);
@@ -321,7 +327,7 @@ const makeListenerConsumer = (prepare = () => Effect.void, ready = Effect.void)
321
327
  const listenerConsumer = makeListenerConsumer();
322
328
  connectWith();
323
329
  // packages/remote/src/internal/host/runner.ts
324
- const connect$1 = (target, contractModule, options, resources, processScope) => Effect.gen(function* () {
330
+ const connect$1 = Effect.fnUntraced(function* (target, contractModule, options, resources, processScope) {
325
331
  const instance = target.instance;
326
332
  const margin = Duration.toMillis(target.margin ?? "5 seconds");
327
333
  const channel$1 = yield* connectWith(target.explicitAuth).pipe(Scope.provide(processScope));
@@ -344,7 +350,7 @@ const connect$1 = (target, contractModule, options, resources, processScope) =>
344
350
  const finishStarted = yield* Ref.make(false);
345
351
  const terminate = yield* Effect.cached(Effect.gen(function* () {
346
352
  yield* Ref.set(finishStarted, true);
347
- yield* failures.close;
353
+ const closed = yield* Effect.exit(failures.close);
348
354
  const result = yield* awaitTermination(record.handle, session.Dispose(record.handle), record.leaseMillis, margin);
349
355
  const { code, signal, stderr, cause } = result.exit;
350
356
  yield* Effect.logInfo("Remote execution terminated", {
@@ -357,7 +363,8 @@ const connect$1 = (target, contractModule, options, resources, processScope) =>
357
363
  "remote.generation": record.handle.generation,
358
364
  "remote.termination": result.kind
359
365
  }));
360
- if (result.cause.reasons.length > 0) return yield* Effect.failCause(cleanupCause(result.cause));
366
+ const failure = Exit.isFailure(closed) ? Cause.combine(closed.cause, result.cause) : result.cause;
367
+ if (failure.reasons.length > 0) return yield* Effect.failCause(cleanupCause(failure));
361
368
  }));
362
369
  yield* Scope.addFinalizer(processScope, Effect.gen(function* () {
363
370
  if (!(yield* Ref.get(finishStarted))) yield* terminate.pipe(Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause))));
@@ -377,7 +384,7 @@ const connect$1 = (target, contractModule, options, resources, processScope) =>
377
384
  }).pipe(Scope.provide(resources));
378
385
  const report = (cause) => Cause.hasInterruptsOnly(cause) ? Effect.void : failures.failCause(Cause.map(cause, (error) => TransportError.make({ cause: Cause.fail(error) })));
379
386
  yield* failures.await.pipe(Effect.catchCause((cause) => Cause.hasInterruptsOnly(cause) ? Effect.void : peer.fail(TransportError.make({ cause }))), Effect.forkIn(resources));
380
- yield* failures.run(Fiber.join(renewed).pipe(Effect.catchCause((cause) => Effect.gen(function* () {
387
+ yield* failures.run(Fiber.join(renewed).pipe(Effect.catchCause(Effect.fnUntraced(function* (cause) {
381
388
  if (Cause.hasInterruptsOnly(cause)) return;
382
389
  const status = yield* Effect.exit(session.Status(record.handle).pipe(Effect.timeout("5 seconds")));
383
390
  if (Exit.isSuccess(status) && status.value.phase === "Stopped") {
@@ -394,7 +401,7 @@ const connect$1 = (target, contractModule, options, resources, processScope) =>
394
401
  resources,
395
402
  pid: Option.map(childOf(loaded), (child) => child.pid),
396
403
  diagnostics: failures.cause,
397
- terminate: () => Effect.gen(function* () {
404
+ terminate: Effect.fnUntraced(function* () {
398
405
  yield* Fiber.interrupt(renewed);
399
406
  yield* terminate;
400
407
  }),
@@ -426,7 +433,7 @@ const connect = Effect.fnUntraced(function* (execution, options) {
426
433
  report
427
434
  },
428
435
  diagnostics: Fiber.await(exited).pipe(Effect.andThen(failures.cause)),
429
- terminate: (graceful) => Effect.gen(function* () {
436
+ terminate: Effect.fnUntraced(function* (graceful) {
430
437
  yield* failures.close;
431
438
  if (!graceful) return;
432
439
  const status = yield* peer.end.pipe(Effect.catchCauseIf(Cause.hasInterruptsOnly, () => Effect.void), Effect.andThen(Fiber.join(exited)), Effect.interruptible, Effect.timeoutOrElse({
@@ -463,17 +470,17 @@ const finish = (causes) => {
463
470
  const scopes = Effect.acquireRelease(Effect.all({
464
471
  resources: Scope.make(),
465
472
  process: Scope.make()
466
- }), (scopes, exit) => Effect.gen(function* () {
473
+ }), Effect.fnUntraced(function* (scopes, exit) {
467
474
  const process = yield* Effect.exit(close(scopes.process, exit));
468
475
  const resources = yield* Effect.exit(close(scopes.resources, exit));
469
476
  yield* finish([reason(process), reason(resources)]);
470
477
  }));
471
478
  /** Setup supplies a concrete control lifecycle; release never reads a later-installed effect. */
472
- const acquire = (target, contractModule, options, setup, dispose, timeout) => Effect.gen(function* () {
479
+ const acquire = Effect.fnUntraced(function* (target, contractModule, options, setup, dispose, timeout) {
473
480
  const owned = yield* scopes;
474
481
  const connection = yield* Effect.acquireRelease(Effect.gen(function* () {
475
482
  return target._tag === "Local" || target._tag === "Worker" ? yield* Local(target, contractModule, options, owned.resources, owned.process).pipe(Effect.map(connected)) : yield* connect$1(target, contractModule, options, owned.resources, owned.process);
476
- }).pipe(Effect.interruptible), (connection, exit) => Effect.gen(function* () {
483
+ }).pipe(Effect.interruptible), Effect.fnUntraced(function* (connection, exit) {
477
484
  const process = yield* Effect.exit(close(owned.process, exit));
478
485
  yield* connection.diagnostics;
479
486
  const resources = yield* Effect.exit(close(owned.resources, exit));
@@ -484,7 +491,7 @@ const acquire = (target, contractModule, options, setup, dispose, timeout) => Ef
484
491
  diagnostics
485
492
  ]);
486
493
  }));
487
- return yield* Effect.acquireRelease(setup.pipe(Effect.provideService(Connection, connection)), (value) => Effect.gen(function* () {
494
+ return yield* Effect.acquireRelease(setup.pipe(Effect.provideService(Connection, connection)), Effect.fnUntraced(function* (value) {
488
495
  const graceful = yield* dispose(value).pipe(Effect.interruptible, Effect.timeout(timeout), Effect.exit);
489
496
  const terminated = yield* Effect.exit(connection.terminate(Exit.isSuccess(graceful)));
490
497
  yield* finish([Exit.isSuccess(graceful) ? graceful.value : graceful.cause, reason(terminated)]);
@@ -492,7 +499,7 @@ const acquire = (target, contractModule, options, setup, dispose, timeout) => Ef
492
499
  });
493
500
  // packages/remote/src/internal/host.ts
494
501
  const race = (connection, effect) => Effect.raceFirst(effect, connection.transport.failure);
495
- const forwardEvents = (contract, client, connection) => Effect.gen(function* () {
502
+ const forwardEvents = Effect.fnUntraced(function* (contract, client, connection) {
496
503
  const stopped = yield* Deferred.make();
497
504
  const remoteFailure = yield* make$4();
498
505
  return {
@@ -507,10 +514,10 @@ const forwardEvents = (contract, client, connection) => Effect.gen(function* ()
507
514
  }))).pipe(Effect.tapCause(connection.transport.report), Effect.forkIn(connection.resources))
508
515
  };
509
516
  });
510
- const forwardLogs = (contract, client, connection) => Effect.gen(function* () {
517
+ const forwardLogs = Effect.fnUntraced(function* (contract, client, connection) {
511
518
  const logsEnded = yield* Deferred.make();
512
519
  const reportedDrops = yield* Ref.make(0);
513
- yield* race(connection, client.Logs().pipe(Stream.runForEach((event) => Effect.gen(function* () {
520
+ yield* race(connection, client.Logs().pipe(Stream.runForEach(Effect.fnUntraced(function* (event) {
514
521
  const previous = yield* Ref.getAndSet(reportedDrops, event.dropped);
515
522
  if (event.dropped > previous) yield* Effect.logWarning("Remote logs were dropped").pipe(Effect.annotateLogs({
516
523
  ...Option.isSome(connection.pid) ? { "remote.pid": connection.pid.value } : {},
@@ -531,7 +538,7 @@ const forwardLogs = (contract, client, connection) => Effect.gen(function* () {
531
538
  })))).pipe(Effect.tapCause(connection.transport.report), Effect.forkIn(connection.resources));
532
539
  return logsEnded;
533
540
  });
534
- const initialize = (contract) => Effect.gen(function* () {
541
+ const initialize = Effect.fnUntraced(function* (contract) {
535
542
  const connection = yield* Connection;
536
543
  const client = yield* RpcClient.make(contract.control).pipe(Effect.provideService(RpcClient.Protocol, connection.transport.clientProtocol(endpoint)), Scope.provide(connection.resources));
537
544
  for (const service of contract.inject) yield* service.serve(connection.transport).pipe(Effect.tapCause(connection.transport.report), Effect.forkIn(connection.resources));
@@ -545,7 +552,7 @@ const initialize = (contract) => Effect.gen(function* () {
545
552
  };
546
553
  });
547
554
  const load$1 = (active, input) => race(active.connection, Effect.raceFirst(active.client.Load({ input }).pipe(Effect.catchIf((cause) => Cause.isCause(cause), Effect.failCause)), active.remoteFailure.await));
548
- const dispose = (active) => Effect.gen(function* () {
555
+ const dispose = Effect.fnUntraced(function* (active) {
549
556
  const result = yield* race(active.connection, active.client.Dispose().pipe(Effect.catchIf(Cause.isCause, Effect.succeed)));
550
557
  const cause = Cause.isCause(result) ? result : Cause.empty;
551
558
  yield* race(active.connection, Deferred.await(active.stopped).pipe(Effect.andThen(Deferred.await(active.logsEnded)))).pipe(Effect.onError(() => Effect.failCause(cleanupCause(cause))));
@@ -562,7 +569,7 @@ const executionPlugin = (contract, options, configured, annotations = {}) => mak
562
569
  ...Array.map(contract.inject, (service) => service.key)
563
570
  ],
564
571
  config: Schema.toEncoded(contract.config),
565
- apply: (input) => Effect.gen(function* () {
572
+ apply: Effect.fnUntraced(function* (input) {
566
573
  const prepared = prepare(contract);
567
574
  const session = yield* (yield* SecureRandom.SecureRandom).uuidV4();
568
575
  const active = yield* acquire(configured, options.contractModule, {
@@ -577,9 +584,39 @@ const executionPlugin = (contract, options, configured, annotations = {}) => mak
577
584
  for (const service of contract.provides) yield* service.publish(active.connection.transport).pipe(Scope.provide(active.connection.resources));
578
585
  yield* fork(Effect.raceFirst(Fiber.join(active.events), active.remoteFailure.await).pipe(Effect.mapError((error) => publicError(contract.error, error))));
579
586
  return () => Effect.succeed(false);
580
- }).pipe(Effect.annotateLogs(annotations), Effect.mapError((error) => publicError(contract.error, error)))
587
+ }, Effect.annotateLogs(annotations), Effect.mapError((error) => publicError(contract.error, error)))
581
588
  });
582
- const publicError = (declared, error) => Schema.is(declared)(error) ? error : Schema.is(UndeclaredFailure)(error) || Schema.is(RemoteWithdrawn)(error) || Schema.is(RemoteError)(error) || Schema.is(MissingInstance)(error) ? error : RemoteError.make({ cause: Cause.fail(error) });
589
+ /** Failures raised by the host machinery; a permissive declared schema must not claim them. */
590
+ const internalErrors = [
591
+ ProcessExited,
592
+ TransportError,
593
+ LocalTerminationTimeout,
594
+ CredentialsError,
595
+ AuthenticationFailed,
596
+ RemoteEntryError,
597
+ AlreadyLoaded,
598
+ ContractNotFound,
599
+ ModuleImportFailed,
600
+ ActivationFailed,
601
+ PackageError,
602
+ SessionAccessDenied,
603
+ StaleSession,
604
+ LeaseExpired,
605
+ SessionStopped,
606
+ SessionConflict,
607
+ StateStorageError,
608
+ ExecutionError,
609
+ TerminationUnconfirmed,
610
+ RunnerClosing,
611
+ StateDirectoryLocked,
612
+ RemoteTerminationUnconfirmed,
613
+ ReleaseInterrupted,
614
+ RpcClientError.RpcClientError,
615
+ ...errors
616
+ ];
617
+ const isInternal = (error) => Schema.isSchemaError(error) || PlatformError.isPlatformError(error) || Array.some(internalErrors, (Class) => error instanceof Class);
618
+ const isPublic = (error) => Schema.is(UndeclaredFailure)(error) || Schema.is(RemoteWithdrawn)(error) || Schema.is(RemoteError)(error) || Schema.is(MissingInstance)(error);
619
+ const publicError = (declared, error) => isPublic(error) ? error : !isInternal(error) && Schema.is(declared)(error) ? error : RemoteError.make({ cause: Cause.fail(error) });
583
620
  // packages/remote/src/internal/entry.ts
584
621
  const boundary = Effect.fnUntraced(function* (field) {
585
622
  const entry = yield* CurrentId;
@@ -598,7 +635,7 @@ const resolve = Effect.fnUntraced(function* (reference, field) {
598
635
  const directory = path.resolve(Option.getOrElse(source, () => "."));
599
636
  const resolver = yield* Option.match(existing, {
600
637
  onSome: Effect.succeed,
601
- onNone: () => Effect.gen(function* () {
638
+ onNone: Effect.fnUntraced(function* () {
602
639
  const importer = yield* make$1(directory);
603
640
  return yield* make$2({
604
641
  base: directory,
@@ -1,4 +1,12 @@
1
1
  import { Config } from "../../internal/auth/tokenCredentials.js";
2
- declare const capability: any;
2
+ declare const capability: import("@graftland/graft/Plugin").Definition<{
3
+ readonly token: import("effect/Redacted").Redacted<string> | {
4
+ readonly file: string;
5
+ };
6
+ }, {
7
+ readonly token: string | {
8
+ readonly file: string;
9
+ };
10
+ }, import("effect/Schema").SchemaError | import("@graftland/graft/Graft").ServiceConflict>;
3
11
  export { Config, capability as default };
4
12
  //# sourceMappingURL=bearer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bearer.d.ts","names":[],"sources":["../../../src/host/auth/bearer.ts"],"mappings":";cAGM"}
1
+ {"version":3,"file":"bearer.d.ts","names":[],"sources":["../../../src/host/auth/bearer.ts"],"mappings":";cAGM,8CAAU;;;;;;;;2BAAsC,+CAAA"}
@@ -1,4 +1,4 @@
1
- import { n as plugin, t as Config } from "../../tokenCredentials-CI6mMRRd.js";
1
+ import { n as plugin, t as Config } from "../../tokenCredentials-CbCuk-Rt.js";
2
2
  // packages/remote/src/host/auth/bearer.ts
3
3
  const capability = plugin("remote-bearer-credentials");
4
4
  export { Config, capability as default };
@@ -1,4 +1,12 @@
1
1
  import { Config } from "../../internal/auth/tokenCredentials.js";
2
- declare const capability: any;
2
+ declare const capability: import("@graftland/graft/Plugin").Definition<{
3
+ readonly token: import("effect/Redacted").Redacted<string> | {
4
+ readonly file: string;
5
+ };
6
+ }, {
7
+ readonly token: string | {
8
+ readonly file: string;
9
+ };
10
+ }, import("effect/Schema").SchemaError | import("@graftland/graft/Graft").ServiceConflict>;
3
11
  export { Config, capability as default };
4
12
  //# sourceMappingURL=jwt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jwt.d.ts","names":[],"sources":["../../../src/host/auth/jwt.ts"],"mappings":";cAGM"}
1
+ {"version":3,"file":"jwt.d.ts","names":[],"sources":["../../../src/host/auth/jwt.ts"],"mappings":";cAGM,8CAAU;;;;;;;;2BAAmC,+CAAA"}
@@ -1,4 +1,4 @@
1
- import { n as plugin, t as Config } from "../../tokenCredentials-CI6mMRRd.js";
1
+ import { n as plugin, t as Config } from "../../tokenCredentials-CbCuk-Rt.js";
2
2
  // packages/remote/src/host/auth/jwt.ts
3
3
  const capability = plugin("remote-jwt-credentials");
4
4
  export { Config, capability as default };
@@ -1,8 +1,15 @@
1
+ import { Graft, Plugin } from "@graftland/graft";
1
2
  import { Schema } from "effect";
2
3
  export declare const Config: Schema.Struct<{
3
4
  readonly cert: Schema.String;
4
5
  readonly key: Schema.String;
5
6
  }>;
6
- declare const _default: any;
7
+ declare const _default: Plugin.Definition<{
8
+ readonly cert: string;
9
+ readonly key: string;
10
+ }, {
11
+ readonly cert: string;
12
+ readonly key: string;
13
+ }, Schema.SchemaError | Graft.ServiceConflict>;
7
14
  export { _default as default };
8
15
  //# sourceMappingURL=mtls.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mtls.d.ts","names":[],"sources":["../../../src/host/auth/mtls.ts"],"mappings":";qBAca,QAAM,OAAA"}
1
+ {"version":3,"file":"mtls.d.ts","names":[],"sources":["../../../src/host/auth/mtls.ts"],"mappings":";;qBAca,QAAM,OAAA"}
@@ -1,5 +1,5 @@
1
- import { a as provide, l as make } from "../../Graft-CVyueNOf.js";
2
- import { n as CredentialsError } from "../../Errors-BMKmu5Y7.js";
1
+ import { a as provide, l as make } from "../../Graft-B71CPA2Y.js";
2
+ import { r as CredentialsError } from "../../Errors-DYhsGZcZ.js";
3
3
  import { t as ConfigDirectory } from "../../ConfigDirectory-BCC6q2R4.js";
4
4
  import { n as Credentials } from "../../Auth-BElTC9_X.js";
5
5
  import { Cause, Effect, FileSystem, Option, Path, Redacted, Schema } from "effect";
@@ -1,3 +1,5 @@
1
- declare const _default: any;
1
+ import { Graft, Plugin } from "@graftland/graft";
2
+ import { Schema } from "effect";
3
+ declare const _default: Plugin.Definition<{}, {}, Schema.SchemaError | Graft.ServiceConflict>;
2
4
  export { _default as default };
3
5
  //# sourceMappingURL=none.d.ts.map
@@ -1,4 +1,4 @@
1
- import { a as provide, l as make } from "../../Graft-CVyueNOf.js";
1
+ import { a as provide, l as make } from "../../Graft-B71CPA2Y.js";
2
2
  import { n as Credentials } from "../../Auth-BElTC9_X.js";
3
3
  import { Effect, Schema } from "effect";
4
4
  // packages/remote/src/host/auth/none.ts
@@ -1,5 +1,6 @@
1
1
  import { ConnectorApi } from "../Transport.js";
2
2
  import { CommandOptions } from "../internal/transportOptions.js";
3
+ import { Graft, Plugin } from "@graftland/graft";
3
4
  import { Cause, Effect, Schema } from "effect";
4
5
  import { ChildProcessSpawner } from "effect/process";
5
6
  declare const CommandExited_base: Schema.Class<CommandExited, Schema.TaggedStruct<"CommandExited", {
@@ -17,6 +18,18 @@ export declare const Config: Schema.Struct<{
17
18
  readonly cwd: Schema.optionalKey<Schema.String>;
18
19
  readonly env: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
19
20
  }>;
20
- declare const _default: any;
21
+ declare const _default: Plugin.Definition<{
22
+ readonly argv: readonly [string, ...string[]];
23
+ readonly cwd?: string;
24
+ readonly env?: {
25
+ readonly [x: string]: string;
26
+ };
27
+ }, {
28
+ readonly argv: readonly [string, ...string[]];
29
+ readonly cwd?: string;
30
+ readonly env?: {
31
+ readonly [x: string]: string;
32
+ };
33
+ }, Schema.SchemaError | Graft.ServiceConflict>;
21
34
  export { type CommandOptions as Options, _default as default };
22
35
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","names":["_$___Transport0.ConnectorApi"],"sources":["../../src/host/command.ts"],"mappings":";;;;;;;;;WAwBmB;;qBAFN,sBAAsB;;qBAUtB,OAAI,SAAa,mBAAc,OAAA,OAAdA,qBAAc,oBAAA;qBA2E/B,QAAM,OAAA"}
1
+ {"version":3,"file":"command.d.ts","names":["_$___Transport0.ConnectorApi"],"sources":["../../src/host/command.ts"],"mappings":";;;;;;;;;;WAwBmB;;qBAFN,sBAAsB;;qBAUtB,OAAI,SAAa,mBAAc,OAAA,OAAdA,qBAAc,oBAAA;qBA2E/B,QAAM,OAAA"}
@@ -1,9 +1,9 @@
1
- import { a as provide, l as make$1 } from "../Graft-CVyueNOf.js";
1
+ import { a as provide, l as make$1 } from "../Graft-B71CPA2Y.js";
2
2
  import { t as Connector } from "../Transport-DULzpsgR.js";
3
3
  import { t as ConfigDirectory } from "../ConfigDirectory-BCC6q2R4.js";
4
- import { l as TransportError } from "../Errors-BMKmu5Y7.js";
5
- import { n as cleanupCause } from "../cleanup-CXLa1Wd9.js";
6
- import { n as stdinExitTimeout, t as observe } from "../ProcessObservation-DEGrEMfP.js";
4
+ import { u as TransportError } from "../Errors-DYhsGZcZ.js";
5
+ import { r as cleanupCause } from "../FailureGroup-BgT73AaR.js";
6
+ import { n as stdinExitTimeout, t as observe } from "../ProcessObservation-gLgGirYv.js";
7
7
  import { Array, Cause, Effect, Option, Path, Schema, Scope, Sink, Stream } from "effect";
8
8
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
9
9
  // packages/remote/src/host/command.ts
@@ -1,3 +1,4 @@
1
- declare const plugin: any;
1
+ import { Plugin } from "@graftland/graft";
2
+ declare const plugin: Plugin.Definition<void, void, import("effect/Schema").SchemaError | import("@graftland/graft/Graft").ServiceConflict>;
2
3
  export { plugin as default };
3
4
  //# sourceMappingURL=local.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"local.d.ts","names":[],"sources":["../../src/host/local.ts"],"mappings":"A,cA+BM"}
1
+ {"version":3,"file":"local.d.ts","names":[],"sources":["../../src/host/local.ts"],"mappings":";cA+BM,QAAM,OAAA,+CAAA,+CAAA"}
@@ -1,8 +1,8 @@
1
- import { d as service } from "../Graft-CVyueNOf.js";
1
+ import { d as service } from "../Graft-B71CPA2Y.js";
2
2
  import { t as LocalTransport } from "../directTransport-DrexuPSm.js";
3
3
  import { t as command } from "../command-9zrHdbwT.js";
4
- import { a as ProcessExited, l as TransportError } from "../Errors-BMKmu5Y7.js";
5
- import { t as observe$1 } from "../ProcessObservation-DEGrEMfP.js";
4
+ import { o as ProcessExited, u as TransportError } from "../Errors-DYhsGZcZ.js";
5
+ import { t as observe$1 } from "../ProcessObservation-gLgGirYv.js";
6
6
  import { Array, Cause, Effect, Fiber, Option, Scope, Sink, Stream } from "effect";
7
7
  import { ChildProcess, ChildProcessSpawner } from "effect/process";
8
8
  // packages/remote/src/internal/host/local.ts
@@ -1,11 +1,16 @@
1
1
  import { UnixOptions } from "../internal/transportOptions.js";
2
2
  import { ConnectorApi } from "../Transport.js";
3
+ import { Graft, Plugin } from "@graftland/graft";
3
4
  import { Schema } from "effect";
4
5
  export declare const properties: ConnectorApi["properties"];
5
6
  export declare const make: (options: UnixOptions) => ConnectorApi;
6
7
  export declare const Config: Schema.Struct<{
7
8
  readonly path: Schema.String;
8
9
  }>;
9
- declare const _default: any;
10
+ declare const _default: Plugin.Definition<{
11
+ readonly path: string;
12
+ }, {
13
+ readonly path: string;
14
+ }, Schema.SchemaError | Graft.ServiceConflict>;
10
15
  export { type UnixOptions as Options, _default as default };
11
16
  //# sourceMappingURL=unix.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unix.d.ts","names":[],"sources":["../../src/host/unix.ts"],"mappings":";;;qBAca,YAAY;qBAmBZ,OAAI,SAAa,gBAAc;qBAe/B,QAAM,OAAA"}
1
+ {"version":3,"file":"unix.d.ts","names":[],"sources":["../../src/host/unix.ts"],"mappings":";;;;qBAca,YAAY;qBAmBZ,OAAI,SAAa,gBAAc;qBAe/B,QAAM,OAAA"}
package/dist/host/unix.js CHANGED
@@ -1,8 +1,8 @@
1
- import { a as provide, l as make$1 } from "../Graft-CVyueNOf.js";
1
+ import { a as provide, l as make$1 } from "../Graft-B71CPA2Y.js";
2
2
  import { t as ConfigDirectory } from "../ConfigDirectory-BCC6q2R4.js";
3
- import { a as payloadLimit, c as wrapper_default, i as path, s as protocol, t as fromSocket } from "../socketChannel-C_ppdSzz.js";
3
+ import { a as payloadLimit, c as wrapper_default, i as path, s as protocol, t as fromSocket } from "../socketChannel-CJvL2DiB.js";
4
4
  import { t as Connector } from "../Transport-DULzpsgR.js";
5
- import { l as TransportError } from "../Errors-BMKmu5Y7.js";
5
+ import { u as TransportError } from "../Errors-DYhsGZcZ.js";
6
6
  import { Cause, Effect, Layer, Option, Path, Redacted, Schema } from "effect";
7
7
  import { Socket } from "effect/socket";
8
8
  // packages/remote/src/host/unix.ts
@@ -1,5 +1,6 @@
1
1
  import { WebsocketOptions } from "../internal/transportOptions.js";
2
2
  import { ConnectorApi } from "../Transport.js";
3
+ import { Graft, Plugin } from "@graftland/graft";
3
4
  import { Schema } from "effect";
4
5
  /** Configured Connector; certificate paths belong to the enclosing configuration. */
5
6
  export declare const Config: Schema.Struct<{
@@ -8,6 +9,14 @@ export declare const Config: Schema.Struct<{
8
9
  readonly servername: Schema.optionalKey<Schema.String>;
9
10
  }>;
10
11
  export declare const make: (options: WebsocketOptions, properties: ConnectorApi["properties"]) => ConnectorApi;
11
- declare const _default: any;
12
+ declare const _default: Plugin.Definition<{
13
+ readonly url: URL;
14
+ readonly ca?: string;
15
+ readonly servername?: string;
16
+ }, {
17
+ readonly url: string;
18
+ readonly ca?: string;
19
+ readonly servername?: string;
20
+ }, import("effect/PlatformError").PlatformError | Schema.SchemaError | Graft.ServiceConflict>;
12
21
  export { type WebsocketOptions as Options, _default as default };
13
22
  //# sourceMappingURL=websocket.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"websocket.d.ts","names":[],"sources":["../../src/host/websocket.ts"],"mappings":";;;;qBAYa,QAAM,OAAA;;;;;qBAKN,OAAI,SACP,kBAAgB,YACb,+BACV"}
1
+ {"version":3,"file":"websocket.d.ts","names":[],"sources":["../../src/host/websocket.ts"],"mappings":";;;;;qBAYa,QAAM,OAAA;;;;;qBAKN,OAAI,SACP,kBAAgB,YACb,+BACV"}
@@ -1,8 +1,8 @@
1
- import { a as provide, l as make$1 } from "../Graft-CVyueNOf.js";
1
+ import { a as provide, l as make$1 } from "../Graft-B71CPA2Y.js";
2
2
  import { t as Connector } from "../Transport-DULzpsgR.js";
3
- import { l as TransportError } from "../Errors-BMKmu5Y7.js";
3
+ import { u as TransportError } from "../Errors-DYhsGZcZ.js";
4
4
  import { t as ConfigDirectory } from "../ConfigDirectory-BCC6q2R4.js";
5
- import { n as Url, o as properties, r as open, t as fromSocket } from "../socketChannel-C_ppdSzz.js";
5
+ import { n as Url, o as properties, r as open, t as fromSocket } from "../socketChannel-CJvL2DiB.js";
6
6
  import { Cause, Effect, FileSystem, Option, Path, Schema } from "effect";
7
7
  // packages/remote/src/host/websocket.ts
8
8
  /** Configured Connector; certificate paths belong to the enclosing configuration. */
@@ -1,3 +1,5 @@
1
- declare const plugin: any;
1
+ import { Plugin } from "@graftland/graft";
2
+ import { Schema } from "effect";
3
+ declare const plugin: Plugin.Definition<void, void, Schema.SchemaError | import("@graftland/graft/Graft").ServiceConflict>;
2
4
  export { plugin as default };
3
5
  //# sourceMappingURL=worker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"worker.d.ts","names":[],"sources":["../../src/host/worker.ts"],"mappings":"A,cAoFM"}
1
+ {"version":3,"file":"worker.d.ts","names":[],"sources":["../../src/host/worker.ts"],"mappings":";;cAoFM,QAAM,OAAA,uBAAA,OAAA,+CAAA"}
@@ -1,9 +1,8 @@
1
- import { d as service } from "../Graft-CVyueNOf.js";
1
+ import { d as service } from "../Graft-B71CPA2Y.js";
2
2
  import { n as WorkerTransport } from "../directTransport-DrexuPSm.js";
3
- import { a as ProcessExited, l as TransportError } from "../Errors-BMKmu5Y7.js";
4
- import { n as Bootstrap, t as make } from "../workerChannel-cmLc13vm.js";
5
- import { t as make$1 } from "../FailureGroup-BcH0XOBi.js";
6
- import { n as cleanupCause } from "../cleanup-CXLa1Wd9.js";
3
+ import { o as ProcessExited, u as TransportError } from "../Errors-DYhsGZcZ.js";
4
+ import { n as Bootstrap, t as make } from "../workerChannel-C8hhBJzA.js";
5
+ import { r as cleanupCause, t as make$1 } from "../FailureGroup-BgT73AaR.js";
7
6
  import { Cause, Deferred, Effect, FiberSet, Option, Schema } from "effect";
8
7
  import { Worker } from "node:worker_threads";
9
8
  // packages/remote/src/host/worker.ts
@@ -1,4 +1,4 @@
1
- import { s as fromModule } from "./Graft-CVyueNOf.js";
1
+ import { s as fromModule } from "./Graft-B71CPA2Y.js";
2
2
  import { t as ConfigDirectory } from "./ConfigDirectory-BCC6q2R4.js";
3
3
  import { registerHooks } from "node:module";
4
4
  import { Array, Cause, Config, Context, Data, Effect, Exit, HashMap, MutableList, Option, Path, Predicate, Record, Ref, Result, Schema, Scope, String } from "effect";
@@ -202,7 +202,7 @@ const inCandidateScope = (effect) => Effect.uninterruptibleMask((restore) => Eff
202
202
  * Importers may attach observation-only leases to the separate observationScope.
203
203
  * The caller keeps that scope through failure and closes it on retry or disposal.
204
204
  */
205
- const make$1 = (options) => Effect.gen(function* () {
205
+ const make$1 = Effect.fnUntraced(function* (options) {
206
206
  const path = yield* Path.Path;
207
207
  /** Keep the import target and Node's possible missing names in one normalization step. */
208
208
  const normalize = Effect.fnUntraced(function* (specifier) {
@@ -253,14 +253,11 @@ const make$1 = (options) => Effect.gen(function* () {
253
253
  });
254
254
  const environment = options.resolution;
255
255
  const revision = environment === void 0 ? 0 : yield* environment.revision;
256
- const cached = yield* Ref.get(plans);
257
- if (cached.revision === revision) {
258
- const found = HashMap.get(cached.entries, key);
259
- if (Option.isSome(found)) return found.value;
260
- } else yield* Ref.set(plans, {
256
+ const found = yield* Ref.modify(plans, (current) => current.revision === revision ? [HashMap.get(current.entries, key), current] : revision > current.revision ? [Option.none(), {
261
257
  revision,
262
258
  entries: HashMap.empty()
263
- });
259
+ }] : [Option.none(), current]);
260
+ if (Option.isSome(found)) return found.value;
264
261
  const normalized = yield* Effect.forEach(candidates(name), (specifier) => Effect.map(normalize(specifier), (candidate) => ({
265
262
  ...candidate,
266
263
  specifier
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
- import { a as provide, l as make, u as optional } from "./Graft-CVyueNOf.js";
2
- import { r as ModuleResolver } from "./importer-Bk6U_sn4.js";
3
- import { a as publicError, d as follow, f as Host, n as host, r as launch, s as CapabilityFailed } from "./entry-B89sepMU.js";
1
+ import { a as provide, l as make, u as optional } from "./Graft-B71CPA2Y.js";
2
+ import { r as ModuleResolver } from "./importer-Cvf88eAY.js";
3
+ import { a as publicError, d as follow, f as Host, n as host, r as launch, s as CapabilityFailed } from "./entry-psOpX3Bj.js";
4
4
  import { n as Credentials } from "./Auth-BElTC9_X.js";
5
- import { c as RemoteWithdrawn, i as MissingInstance, n as CredentialsError, s as RemoteError } from "./Errors-BMKmu5Y7.js";
6
- import { n as prepare } from "./token-Cc_1CTbE.js";
7
- import { n as UndeclaredFailure, t as Contract_exports } from "./Contract-DL2mHvaT.js";
8
- import { O as Instance, l as RemoteTerminationUnconfirmed } from "./Peer-BT7eAGmh.js";
5
+ import { a as MissingInstance, c as RemoteError, l as RemoteWithdrawn, r as CredentialsError } from "./Errors-DYhsGZcZ.js";
6
+ import { n as prepare } from "./token-CYBNNlhS.js";
7
+ import { n as UndeclaredFailure, t as Contract_exports } from "./Contract-DsJtisvL.js";
8
+ import { O as Instance, l as RemoteTerminationUnconfirmed } from "./Peer-DXeVrGBh.js";
9
9
  import { Array, Cause, Context, Effect, Path, Schema, Scope } from "effect";
10
10
  import { SecureRandom } from "effect/crypto";
11
11
  import { ChildProcessSpawner } from "effect/process";
@@ -69,7 +69,7 @@ const plugin = (contract, options) => make({
69
69
  ChildProcessSpawner.ChildProcessSpawner
70
70
  ],
71
71
  retry: options.retry,
72
- apply: () => Effect.gen(function* () {
72
+ apply: Effect.fnUntraced(function* () {
73
73
  const input = yield* Schema.decodeUnknownEffect(Host)({
74
74
  contract: options.contractModule,
75
75
  connect: options.connect,
@@ -81,6 +81,6 @@ const plugin = (contract, options) => make({
81
81
  shutdownTimeout: options.shutdownTimeout
82
82
  }, invocation(options.connect));
83
83
  yield* follow(child, (cause) => Effect.failCause(publicCause(contract.error, cause)));
84
- }).pipe(Effect.mapError((error) => publicError(contract.error, error)))
84
+ }, Effect.mapError((error) => publicError(contract.error, error)))
85
85
  });
86
86
  export { Contract_exports as Contract, Instance, MissingInstance, RemoteError, RemoteTerminationUnconfirmed, RemoteWithdrawn, UndeclaredFailure, host as default, plugin };