@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
@@ -13,6 +13,7 @@ import {
13
13
  TxRef,
14
14
  } from "effect"
15
15
  import * as Release from "./release"
16
+ import { cleanupCause } from "./cleanup"
16
17
 
17
18
  type State<E> = Data.TaggedEnum<{
18
19
  Open: {}
@@ -44,133 +45,139 @@ export interface FailureGroup<E> {
44
45
  }
45
46
 
46
47
  /** One owner for first failure, transaction wakeups, and interruption of sibling work. */
47
- export const make = <E>(): Effect.Effect<FailureGroup<E>, never, Scope.Scope> =>
48
- Effect.gen(function* () {
49
- const fibers = yield* FiberSet.make<unknown, E>()
50
- const state = yield* TxRef.make<State<E>>(State.Open())
51
- const failures = yield* Ref.make<Cause.Cause<E>>(Cause.empty)
52
- const cleanup = yield* Ref.make<Cause.Cause<E>>(Cause.empty)
53
- const check = TxRef.get(state).pipe(
54
- Effect.flatMap((s) =>
55
- s._tag === "Failed"
56
- ? Effect.failCause(s.cause)
57
- : s._tag === "Closed"
58
- ? Effect.interrupt
59
- : Effect.void,
60
- ),
48
+ export const make = Effect.fnUntraced(function* <E>(): Effect.fn.Return<
49
+ FailureGroup<E>,
50
+ never,
51
+ Scope.Scope
52
+ > {
53
+ const fibers = yield* FiberSet.make<unknown, E>()
54
+ const state = yield* TxRef.make<State<E>>(State.Open())
55
+ const failures = yield* Ref.make<Cause.Cause<E>>(Cause.empty)
56
+ const cleanup = yield* Ref.make<Cause.Cause<E>>(Cause.empty)
57
+ const check = TxRef.get(state).pipe(
58
+ Effect.flatMap((s) =>
59
+ s._tag === "Failed"
60
+ ? Effect.failCause(s.cause)
61
+ : s._tag === "Closed"
62
+ ? Effect.interrupt
63
+ : Effect.void,
64
+ ),
65
+ )
66
+ const publish = (cause: Cause.Cause<E>) =>
67
+ TxRef.update(state, (s): State<E> =>
68
+ s._tag === "Open" ? State.Failed({ cause }) : s,
61
69
  )
62
- const publish = (cause: Cause.Cause<E>) =>
63
- TxRef.update(state, (s): State<E> =>
64
- s._tag === "Open" ? State.Failed({ cause }) : s,
65
- )
66
70
 
67
- const observe = <A, R>(effect: Effect.Effect<A, E, R>) =>
68
- Effect.uninterruptibleMask((restore) =>
69
- Effect.gen(function* () {
70
- const scope = yield* Scope.make()
71
- // The owned child makes cancellation explicit, even when a stream closes an internal scope.
72
- const ownerId = yield* Effect.withFiber((self) =>
73
- Effect.succeed(self.id),
74
- )
75
- const worker = yield* Effect.forkIn(
76
- restore(Scope.provide(scope)(effect)),
77
- scope,
71
+ const observe = <A, R>(effect: Effect.Effect<A, E, R>) =>
72
+ Effect.uninterruptibleMask((restore) =>
73
+ Effect.gen(function* () {
74
+ const scope = yield* Scope.make()
75
+ // The owned child makes cancellation explicit, even when a stream closes an internal scope.
76
+ const ownerId = yield* Effect.withFiber((self) =>
77
+ Effect.succeed(self.id),
78
+ )
79
+ const worker = yield* Effect.forkIn(
80
+ restore(Scope.provide(scope)(effect)),
81
+ scope,
82
+ )
83
+ const waiting = yield* Effect.exit(restore(Fiber.await(worker)))
84
+ if (Exit.isFailure(waiting)) yield* Fiber.interrupt(worker)
85
+ const body = yield* Fiber.await(worker)
86
+ const closed = yield* Effect.exit(Release.close(scope, body))
87
+ // Forwarding this exact cancellation from a finalizer is indistinguishable from acknowledging it.
88
+ const expected =
89
+ Exit.isFailure(waiting) &&
90
+ Exit.isFailure(body) &&
91
+ Array.every(
92
+ body.cause.reasons,
93
+ (reason) =>
94
+ reason._tag === "Interrupt" && reason.fiberId === ownerId,
78
95
  )
79
- const waiting = yield* Effect.exit(restore(Fiber.await(worker)))
80
- if (Exit.isFailure(waiting)) yield* Fiber.interrupt(worker)
81
- const body = yield* Fiber.await(worker)
82
- const closed = yield* Effect.exit(Release.close(scope, body))
83
- // Forwarding this exact cancellation from a finalizer is indistinguishable from acknowledging it.
84
- const expected =
85
- Exit.isFailure(waiting) &&
86
- Exit.isFailure(body) &&
87
- Array.every(
88
- body.cause.reasons,
96
+ const bodyCause =
97
+ Exit.isFailure(body) && !expected ? body.cause : Cause.empty
98
+ // Release.close marks independent interruptions; an unmarked one is pending cancellation.
99
+ const releaseCause =
100
+ Exit.isFailure(closed) && !Cause.hasInterruptsOnly(closed.cause)
101
+ ? closed.cause
102
+ : Cause.empty
103
+ const failure = Cause.combine(bodyCause, releaseCause)
104
+ // Body cleanup may carry either an interruption or a release defect from an inner group.
105
+ const closing = Cause.combine(
106
+ Cause.hasInterrupts(bodyCause) ||
107
+ Array.some(
108
+ bodyCause.reasons,
89
109
  (reason) =>
90
- reason._tag === "Interrupt" && reason.fiberId === ownerId,
110
+ reason._tag === "Die" &&
111
+ Schema.is(Release.ReleaseInterrupted)(reason.defect),
91
112
  )
92
- const bodyCause =
93
- Exit.isFailure(body) && !expected ? body.cause : Cause.empty
94
- // Release.close marks independent interruptions; an unmarked one is pending cancellation.
95
- const releaseCause =
96
- Exit.isFailure(closed) && !Cause.hasInterruptsOnly(closed.cause)
97
- ? closed.cause
98
- : Cause.empty
99
- const failure = Cause.combine(bodyCause, releaseCause)
100
- // Body cleanup may carry either an interruption or a release defect from an inner group.
101
- const closing = Cause.combine(
102
- Cause.hasInterrupts(bodyCause) ||
103
- Array.some(
104
- bodyCause.reasons,
105
- (reason) =>
106
- reason._tag === "Die" &&
107
- Schema.is(Release.ReleaseInterrupted)(reason.defect),
108
- )
109
- ? bodyCause
110
- : Cause.empty,
111
- releaseCause,
113
+ ? bodyCause
114
+ : Cause.empty,
115
+ releaseCause,
116
+ )
117
+ yield* Ref.update(cleanup, (cause) => Cause.combine(cause, closing))
118
+ if (failure.reasons.length > 0) {
119
+ yield* Ref.update(failures, (cause) => Cause.combine(cause, failure))
120
+ yield* publish(failure)
121
+ yield* Deferred.failCause(fibers.deferred, failure)
122
+ }
123
+ if (Exit.isFailure(closed))
124
+ return yield* Effect.failCause(
125
+ Exit.isFailure(body)
126
+ ? Cause.combine(body.cause, closed.cause)
127
+ : closed.cause,
112
128
  )
113
- yield* Ref.update(cleanup, (cause) => Cause.combine(cause, closing))
114
- if (failure.reasons.length > 0) {
115
- yield* Ref.update(failures, (cause) =>
116
- Cause.combine(cause, failure),
117
- )
118
- yield* publish(failure)
119
- yield* Deferred.failCause(fibers.deferred, failure)
120
- }
121
- if (Exit.isFailure(closed))
122
- return yield* Effect.failCause(
123
- Exit.isFailure(body)
124
- ? Cause.combine(body.cause, closed.cause)
125
- : closed.cause,
126
- )
127
- if (Exit.isFailure(waiting) && Exit.isSuccess(body))
128
- return yield* Effect.failCause(waiting.cause)
129
- return yield* body
130
- }),
131
- )
132
- yield* FiberSet.join(fibers).pipe(
133
- Effect.catchCause((cause) =>
134
- publish(cause).pipe(
135
- Effect.andThen(FiberSet.clear(fibers)),
136
- Effect.uninterruptible,
137
- ),
138
- ),
139
- Effect.forkScoped,
129
+ if (Exit.isFailure(waiting) && Exit.isSuccess(body))
130
+ return yield* Effect.failCause(waiting.cause)
131
+ return yield* body
132
+ }),
140
133
  )
141
- const failure = Effect.tx(check.pipe(Effect.andThen(Effect.txRetry)))
142
- const failCause = (cause: Cause.Cause<E>) =>
143
- // This is an explicit failure report, not cancellation of an owned worker.
144
- FiberSet.run(fibers, observe(Effect.failCause(cause))).pipe(Effect.asVoid)
145
- const close = TxRef.update(state, (s) =>
146
- s._tag === "Open" ? State.Closed() : s,
147
- ).pipe(
148
- Effect.andThen(FiberSet.clear(fibers)),
149
- Effect.andThen(Ref.get(cleanup)),
150
- Effect.flatMap((cause) =>
151
- cause.reasons.length > 0 ? Effect.failCause(cause) : Effect.void,
134
+ yield* FiberSet.join(fibers).pipe(
135
+ Effect.catchCause((cause) =>
136
+ publish(cause).pipe(
137
+ Effect.andThen(FiberSet.clear(fibers)),
138
+ Effect.uninterruptible,
152
139
  ),
153
- Effect.uninterruptible,
154
- )
155
- // Operational failure is delivered by await; release must also deliver sibling cleanup failures.
156
- yield* Effect.addFinalizer(() => close.pipe(Effect.orDie))
157
- return {
158
- await: failure,
159
- check,
160
- cause: Ref.get(failures),
161
- runtime: <R>() =>
162
- FiberSet.runtime(fibers)<R>().pipe(
163
- Effect.map(
164
- (run) => (effect: Effect.Effect<unknown, E, R>) =>
165
- run(check.pipe(Effect.andThen(observe(effect)))),
166
- ),
140
+ ),
141
+ Effect.forkScoped,
142
+ )
143
+ const failure = Effect.tx(check.pipe(Effect.andThen(Effect.txRetry)))
144
+ const failCause = (cause: Cause.Cause<E>) =>
145
+ // This is an explicit failure report, not cancellation of an owned worker.
146
+ FiberSet.run(fibers, observe(Effect.failCause(cause))).pipe(Effect.asVoid)
147
+ const close = TxRef.update(state, (s) =>
148
+ s._tag === "Open" ? State.Closed() : s,
149
+ ).pipe(
150
+ Effect.andThen(FiberSet.clear(fibers)),
151
+ Effect.andThen(Ref.get(cleanup)),
152
+ Effect.flatMap((cause) =>
153
+ cause.reasons.length > 0 ? Effect.failCause(cause) : Effect.void,
154
+ ),
155
+ Effect.uninterruptible,
156
+ )
157
+ // Operational failure is delivered by await; release must also deliver sibling cleanup failures.
158
+ // Every sibling failure and interruption survives as a defect; orDie would keep only the first failure.
159
+ yield* Effect.addFinalizer(() =>
160
+ close.pipe(
161
+ Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause))),
162
+ ),
163
+ )
164
+ return {
165
+ await: failure,
166
+ check,
167
+ cause: Ref.get(failures),
168
+ runtime: <R>() =>
169
+ FiberSet.runtime(fibers)<R>().pipe(
170
+ Effect.map(
171
+ (run) => (effect: Effect.Effect<unknown, E, R>) =>
172
+ run(check.pipe(Effect.andThen(observe(effect)))),
167
173
  ),
168
- run: (effect) =>
169
- FiberSet.run(fibers, check.pipe(Effect.andThen(observe(effect)))),
170
- fail: (error) => failCause(Cause.fail(error)),
171
- failCause,
172
- race: (effect) =>
173
- check.pipe(Effect.andThen(Effect.raceFirst(effect, failure))),
174
- close,
175
- }
176
- })
174
+ ),
175
+ run: (effect) =>
176
+ FiberSet.run(fibers, check.pipe(Effect.andThen(observe(effect)))),
177
+ fail: (error) => failCause(Cause.fail(error)),
178
+ failCause,
179
+ race: (effect) =>
180
+ check.pipe(Effect.andThen(Effect.raceFirst(effect, failure))),
181
+ close,
182
+ }
183
+ })
@@ -63,6 +63,14 @@ export class CapabilityFailed extends Schema.TaggedError<
63
63
  cause: Schema.Cause(Schema.Unknown, Schema.Unknown),
64
64
  }) {}
65
65
 
66
+ /** Every failure class assembly raises; host error classification reads this list. */
67
+ export const errors = [
68
+ ListenerConfigError,
69
+ CapabilityContractError,
70
+ CapabilityCombinationError,
71
+ CapabilityFailed,
72
+ ] as const
73
+
66
74
  const definition = Schema.declare(Plugin.isPlugin)
67
75
  /** Entries resolve capability modules before assembling their private providers. */
68
76
  export const Invocation = Schema.Struct({
@@ -235,16 +243,17 @@ export const directAuth = (properties: Properties, explicit: boolean) =>
235
243
  )
236
244
  : Effect.void
237
245
 
238
- export const connectWith = (explicitAuth = false) =>
239
- Effect.gen(function* () {
240
- const connector = yield* Connector
241
- const credentials = yield* Credentials
242
- yield* directAuth(connector.properties, explicitAuth)
243
- yield* compatible(connector.properties, credentials.kind)
244
- yield* warn(connector.properties, credentials.kind, "host")
245
- const prepared = yield* credentials.read
246
- return yield* connector.connect(prepared)
247
- })
246
+ export const connectWith = Effect.fnUntraced(function* (
247
+ explicitAuth: boolean = false,
248
+ ) {
249
+ const connector = yield* Connector
250
+ const credentials = yield* Credentials
251
+ yield* directAuth(connector.properties, explicitAuth)
252
+ yield* compatible(connector.properties, credentials.kind)
253
+ yield* warn(connector.properties, credentials.kind, "host")
254
+ const prepared = yield* credentials.read
255
+ return yield* connector.connect(prepared)
256
+ })
248
257
 
249
258
  export const accept =
250
259
  (
@@ -17,24 +17,23 @@ const uriValue = (field: string) => {
17
17
  }
18
18
 
19
19
  /** Read exactly one graft URI from Node's plain or JSON-quoted SAN representation. */
20
- export const identityFromSubjectAltName = (
20
+ export const identityFromSubjectAltName = Effect.fnUntraced(function* (
21
21
  san: string | undefined,
22
- ): Effect.Effect<string, AuthenticationFailed> =>
23
- Effect.gen(function* () {
24
- const values = yield* Effect.forEach(
25
- Array.filter(String.split(san ?? "", ", "), String.startsWith("URI:")),
26
- uriValue,
27
- )
28
- const uris = Array.filter(values, String.startsWith("graft://"))
29
- const [uri] = uris
30
- return yield* uris.length === 1 && uri !== undefined
31
- ? Effect.succeed(uri)
32
- : Effect.fail(
33
- AuthenticationFailed.make({
34
- reason: "invalid",
35
- cause: Cause.fail(
36
- "The peer certificate must contain exactly one graft SAN URI",
37
- ),
38
- }),
39
- )
40
- })
22
+ ): Effect.fn.Return<string, AuthenticationFailed> {
23
+ const values = yield* Effect.forEach(
24
+ Array.filter(String.split(san ?? "", ", "), String.startsWith("URI:")),
25
+ uriValue,
26
+ )
27
+ const uris = Array.filter(values, String.startsWith("graft://"))
28
+ const [uri] = uris
29
+ return yield* uris.length === 1 && uri !== undefined
30
+ ? Effect.succeed(uri)
31
+ : Effect.fail(
32
+ AuthenticationFailed.make({
33
+ reason: "invalid",
34
+ cause: Cause.fail(
35
+ "The peer certificate must contain exactly one graft SAN URI",
36
+ ),
37
+ }),
38
+ )
39
+ })