@graftland/plugin-remote 0.3.3 → 0.4.1

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 (323) hide show
  1. package/README.md +18 -54
  2. package/README.zh-CN.md +17 -51
  3. package/README.zh-TW.md +17 -51
  4. package/dist/Auth.d.ts.map +1 -1
  5. package/dist/Auth.js.map +1 -1
  6. package/dist/Config.d.ts +1151 -0
  7. package/dist/Config.d.ts.map +1 -0
  8. package/dist/Config.js +183 -0
  9. package/dist/Config.js.map +1 -0
  10. package/dist/Contract.d.ts +1 -1
  11. package/dist/Contract.d.ts.map +1 -1
  12. package/dist/Contract.js +32 -1
  13. package/dist/Contract.js.map +1 -1
  14. package/dist/Instance.d.ts.map +1 -1
  15. package/dist/Instance.js.map +1 -1
  16. package/dist/Testing.d.ts +1 -1
  17. package/dist/Testing.d.ts.map +1 -1
  18. package/dist/Testing.js.map +1 -1
  19. package/dist/Transport.d.ts +1 -1
  20. package/dist/Transport.d.ts.map +1 -1
  21. package/dist/Transport.js.map +1 -1
  22. package/dist/cli.d.ts +4 -0
  23. package/dist/cli.d.ts.map +1 -0
  24. package/dist/cli.js +25 -0
  25. package/dist/cli.js.map +1 -0
  26. package/dist/host/auth/bearer.d.ts.map +1 -1
  27. package/dist/host/auth/bearer.js +4 -2
  28. package/dist/host/auth/bearer.js.map +1 -1
  29. package/dist/host/auth/jwt.d.ts.map +1 -1
  30. package/dist/host/auth/jwt.js +4 -2
  31. package/dist/host/auth/jwt.js.map +1 -1
  32. package/dist/host/auth/mtls.d.ts +3 -7
  33. package/dist/host/auth/mtls.d.ts.map +1 -1
  34. package/dist/host/auth/mtls.js +13 -14
  35. package/dist/host/auth/mtls.js.map +1 -1
  36. package/dist/host/auth/none.d.ts +1 -1
  37. package/dist/host/auth/none.js +7 -5
  38. package/dist/host/auth/none.js.map +1 -1
  39. package/dist/host/command.d.ts +1 -1
  40. package/dist/host/command.d.ts.map +1 -1
  41. package/dist/host/command.js +11 -9
  42. package/dist/host/command.js.map +1 -1
  43. package/dist/host/local.d.ts.map +1 -1
  44. package/dist/host/local.js +9 -30
  45. package/dist/host/local.js.map +1 -1
  46. package/dist/host/unix.d.ts +1 -1
  47. package/dist/host/unix.d.ts.map +1 -1
  48. package/dist/host/unix.js +13 -9
  49. package/dist/host/unix.js.map +1 -1
  50. package/dist/host/websocket.d.ts +1 -1
  51. package/dist/host/websocket.d.ts.map +1 -1
  52. package/dist/host/websocket.js +11 -8
  53. package/dist/host/websocket.js.map +1 -1
  54. package/dist/host/worker.d.ts +1 -1
  55. package/dist/host/worker.d.ts.map +1 -1
  56. package/dist/host/worker.js +13 -9
  57. package/dist/host/worker.js.map +1 -1
  58. package/dist/index.d.ts +6 -8
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +30 -64
  61. package/dist/index.js.map +1 -1
  62. package/dist/internal/Certificates.js.map +1 -1
  63. package/dist/internal/FailureGroup.js +6 -6
  64. package/dist/internal/FailureGroup.js.map +1 -1
  65. package/dist/internal/Peer.js.map +1 -1
  66. package/dist/internal/{ServeLifecycle.js → RunnerLifecycle.js} +6 -6
  67. package/dist/internal/RunnerLifecycle.js.map +1 -0
  68. package/dist/internal/Supervisor.js.map +1 -1
  69. package/dist/internal/assembly.d.ts +3 -3
  70. package/dist/internal/assembly.js +8 -8
  71. package/dist/internal/assembly.js.map +1 -1
  72. package/dist/internal/auth/config.d.ts +27 -0
  73. package/dist/internal/auth/config.d.ts.map +1 -0
  74. package/dist/internal/auth/config.js +29 -0
  75. package/dist/internal/auth/config.js.map +1 -0
  76. package/dist/internal/auth/mtls.js.map +1 -1
  77. package/dist/internal/auth/token.js.map +1 -1
  78. package/dist/internal/auth/tokenCredentials.d.ts +1 -1
  79. package/dist/internal/auth/tokenCredentials.d.ts.map +1 -1
  80. package/dist/internal/auth/tokenCredentials.js +1 -1
  81. package/dist/internal/auth/tokenCredentials.js.map +1 -1
  82. package/dist/internal/child.js +3 -3
  83. package/dist/internal/child.js.map +1 -1
  84. package/dist/internal/childMain.js +47 -0
  85. package/dist/internal/childMain.js.map +1 -0
  86. package/dist/internal/childRuntime.js +8 -8
  87. package/dist/internal/childRuntime.js.map +1 -1
  88. package/dist/internal/cleanup.js +3 -3
  89. package/dist/internal/cleanup.js.map +1 -1
  90. package/dist/internal/contract.js.map +1 -1
  91. package/dist/internal/credentials.d.ts +3 -2
  92. package/dist/internal/credentials.d.ts.map +1 -1
  93. package/dist/internal/credentials.js +1 -1
  94. package/dist/internal/credentials.js.map +1 -1
  95. package/dist/internal/directTransport.js.map +1 -1
  96. package/dist/internal/entry.d.ts +104 -26
  97. package/dist/internal/entry.d.ts.map +1 -1
  98. package/dist/internal/entry.js +22 -9
  99. package/dist/internal/entry.js.map +1 -1
  100. package/dist/internal/entryConfig.d.ts +2 -202
  101. package/dist/internal/entryConfig.js +2 -136
  102. package/dist/internal/entryConfig.js.map +1 -1
  103. package/dist/internal/execution.d.ts +4 -4
  104. package/dist/internal/execution.js +11 -11
  105. package/dist/internal/execution.js.map +1 -1
  106. package/dist/internal/follow.js +1 -1
  107. package/dist/internal/follow.js.map +1 -1
  108. package/dist/internal/forkTree.js.map +1 -1
  109. package/dist/internal/host/local.js.map +1 -1
  110. package/dist/internal/host/runner.js +4 -4
  111. package/dist/internal/host/runner.js.map +1 -1
  112. package/dist/internal/host.js +2 -2
  113. package/dist/internal/host.js.map +1 -1
  114. package/dist/internal/importer.js +1 -1
  115. package/dist/internal/importer.js.map +1 -1
  116. package/dist/internal/listenerStartup.js +1 -1
  117. package/dist/internal/listenerStartup.js.map +1 -1
  118. package/dist/internal/loadModule.js.map +1 -1
  119. package/dist/internal/platform.js +1 -9
  120. package/dist/internal/port.d.ts +1 -1
  121. package/dist/internal/port.js +2 -2
  122. package/dist/internal/port.js.map +1 -1
  123. package/dist/internal/runner/Bootstrap.js.map +1 -1
  124. package/dist/internal/runner/Connection.d.ts +3 -2
  125. package/dist/internal/runner/Connection.js +6 -6
  126. package/dist/internal/runner/Connection.js.map +1 -1
  127. package/dist/internal/runner/Execution.js +6 -6
  128. package/dist/internal/runner/Execution.js.map +1 -1
  129. package/dist/internal/runner/Local.js +1 -1
  130. package/dist/internal/runner/Local.js.map +1 -1
  131. package/dist/internal/runner/Lock.js.map +1 -1
  132. package/dist/internal/runner/Multiplex.js.map +1 -1
  133. package/dist/internal/runner/Packages.js.map +1 -1
  134. package/dist/internal/runner/ProcessObservation.js.map +1 -1
  135. package/dist/internal/runner/Processes.js.map +1 -1
  136. package/dist/internal/runner/Retention.js.map +1 -1
  137. package/dist/internal/runner/Store.js.map +1 -1
  138. package/dist/internal/runner/Supervisor.js +5 -5
  139. package/dist/internal/runner/Supervisor.js.map +1 -1
  140. package/dist/internal/runner/Watchdog.js.map +1 -1
  141. package/dist/internal/runner/Wire.d.ts +1 -1
  142. package/dist/internal/runner/Wire.js.map +1 -1
  143. package/dist/internal/runner/accept.js +2 -2
  144. package/dist/internal/runner/accept.js.map +1 -1
  145. package/dist/internal/runner/command.js +1 -1
  146. package/dist/internal/runner/command.js.map +1 -1
  147. package/dist/internal/runner/connectionEnded.js +1 -1
  148. package/dist/internal/runner/connectionEnded.js.map +1 -1
  149. package/dist/internal/runner/model.d.ts.map +1 -1
  150. package/dist/internal/runner/model.js.map +1 -1
  151. package/dist/internal/services.d.ts.map +1 -1
  152. package/dist/internal/services.js +1 -1
  153. package/dist/internal/services.js.map +1 -1
  154. package/dist/internal/socketChannel.js.map +1 -1
  155. package/dist/internal/stdioChannel.js.map +1 -1
  156. package/dist/internal/supervisorPlugin.js +48 -1
  157. package/dist/internal/supervisorPlugin.js.map +1 -1
  158. package/dist/internal/transportOptions.d.ts.map +1 -1
  159. package/dist/internal/watchdogMain.js +5 -3
  160. package/dist/internal/watchdogMain.js.map +1 -1
  161. package/dist/internal/websocket.js.map +1 -1
  162. package/dist/internal/websocketServer.js +1 -1
  163. package/dist/internal/websocketServer.js.map +1 -1
  164. package/dist/internal/workerChannel.js.map +1 -1
  165. package/dist/internal/workerMain.js +13 -6
  166. package/dist/internal/workerMain.js.map +1 -1
  167. package/dist/runner/auth/bearer.d.ts +3 -5
  168. package/dist/runner/auth/bearer.d.ts.map +1 -1
  169. package/dist/runner/auth/bearer.js +13 -11
  170. package/dist/runner/auth/bearer.js.map +1 -1
  171. package/dist/runner/auth/jwt.d.ts +4 -18
  172. package/dist/runner/auth/jwt.d.ts.map +1 -1
  173. package/dist/runner/auth/jwt.js +16 -28
  174. package/dist/runner/auth/jwt.js.map +1 -1
  175. package/dist/runner/auth/mtls.d.ts +3 -6
  176. package/dist/runner/auth/mtls.d.ts.map +1 -1
  177. package/dist/runner/auth/mtls.js +13 -29
  178. package/dist/runner/auth/mtls.js.map +1 -1
  179. package/dist/runner/auth/none.d.ts +1 -1
  180. package/dist/runner/auth/none.js +7 -5
  181. package/dist/runner/auth/none.js.map +1 -1
  182. package/dist/runner/index.d.ts +3 -308
  183. package/dist/runner/index.d.ts.map +1 -1
  184. package/dist/runner/index.js +62 -30
  185. package/dist/runner/index.js.map +1 -1
  186. package/dist/runner/stdio.d.ts +1 -1
  187. package/dist/runner/stdio.d.ts.map +1 -1
  188. package/dist/runner/stdio.js +11 -9
  189. package/dist/runner/stdio.js.map +1 -1
  190. package/dist/runner/unix.d.ts +1 -1
  191. package/dist/runner/unix.d.ts.map +1 -1
  192. package/dist/runner/unix.js +10 -8
  193. package/dist/runner/unix.js.map +1 -1
  194. package/dist/runner/websocket.d.ts +1 -1
  195. package/dist/runner/websocket.d.ts.map +1 -1
  196. package/dist/runner/websocket.js +12 -10
  197. package/dist/runner/websocket.js.map +1 -1
  198. package/package.json +14 -12
  199. package/schema.json +2269 -0
  200. package/src/Auth.ts +8 -2
  201. package/src/Config.ts +196 -0
  202. package/src/Contract.ts +12 -3
  203. package/src/Instance.ts +1 -0
  204. package/src/Testing.ts +6 -4
  205. package/src/Transport.ts +12 -3
  206. package/src/cli.ts +60 -0
  207. package/src/host/auth/bearer.ts +1 -0
  208. package/src/host/auth/jwt.ts +1 -0
  209. package/src/host/auth/mtls.ts +7 -12
  210. package/src/host/auth/none.ts +3 -1
  211. package/src/host/command.ts +8 -5
  212. package/src/host/local.ts +4 -2
  213. package/src/host/unix.ts +11 -7
  214. package/src/host/websocket.ts +10 -7
  215. package/src/host/worker.ts +8 -5
  216. package/src/index.ts +36 -23
  217. package/src/internal/Certificates.ts +1 -0
  218. package/src/internal/FailureGroup.ts +5 -3
  219. package/src/internal/Peer.ts +1 -0
  220. package/src/internal/{ServeLifecycle.ts → RunnerLifecycle.ts} +7 -5
  221. package/src/internal/Supervisor.ts +5 -4
  222. package/src/internal/assembly.ts +11 -9
  223. package/src/internal/auth/config.ts +44 -0
  224. package/src/internal/auth/mtls.ts +1 -0
  225. package/src/internal/auth/token.ts +1 -0
  226. package/src/internal/auth/tokenCredentials.ts +4 -2
  227. package/src/internal/child.ts +8 -6
  228. package/src/{bin.ts → internal/childMain.ts} +16 -61
  229. package/src/internal/childRuntime.ts +12 -10
  230. package/src/internal/cleanup.ts +3 -2
  231. package/src/internal/contract.ts +1 -0
  232. package/src/internal/credentials.ts +3 -1
  233. package/src/internal/directTransport.ts +9 -2
  234. package/src/internal/entry.ts +53 -16
  235. package/src/internal/entryConfig.ts +10 -132
  236. package/src/internal/execution.ts +17 -15
  237. package/src/internal/follow.ts +2 -1
  238. package/src/internal/forkTree.ts +2 -1
  239. package/src/internal/host/local.ts +1 -0
  240. package/src/internal/host/runner.ts +7 -5
  241. package/src/internal/host.ts +9 -8
  242. package/src/internal/importer.ts +3 -2
  243. package/src/internal/listenerStartup.ts +4 -2
  244. package/src/internal/loadModule.ts +1 -0
  245. package/src/internal/platform.ts +1 -12
  246. package/src/internal/port.ts +11 -6
  247. package/src/internal/runner/Bootstrap.ts +1 -0
  248. package/src/internal/runner/Connection.ts +13 -11
  249. package/src/internal/runner/Execution.ts +14 -13
  250. package/src/internal/runner/Local.ts +3 -2
  251. package/src/internal/runner/Lock.ts +1 -0
  252. package/src/internal/runner/Multiplex.ts +2 -1
  253. package/src/internal/runner/Packages.ts +7 -5
  254. package/src/internal/runner/ProcessObservation.ts +2 -1
  255. package/src/internal/runner/Processes.ts +3 -1
  256. package/src/internal/runner/Retention.ts +1 -0
  257. package/src/internal/runner/Store.ts +3 -2
  258. package/src/internal/runner/Supervisor.ts +22 -20
  259. package/src/internal/runner/Watchdog.ts +3 -1
  260. package/src/internal/runner/Wire.ts +13 -12
  261. package/src/internal/runner/accept.ts +6 -5
  262. package/src/internal/runner/command.ts +3 -2
  263. package/src/internal/runner/connectionEnded.ts +2 -1
  264. package/src/internal/runner/model.ts +5 -3
  265. package/src/internal/services.ts +9 -2
  266. package/src/internal/socketChannel.ts +2 -1
  267. package/src/internal/stdioChannel.ts +4 -2
  268. package/src/internal/supervisorPlugin.ts +10 -8
  269. package/src/internal/transportOptions.ts +1 -0
  270. package/src/internal/watchdogMain.ts +5 -3
  271. package/src/internal/websocket.ts +5 -2
  272. package/src/internal/websocketServer.ts +6 -4
  273. package/src/internal/workerChannel.ts +1 -0
  274. package/src/internal/workerMain.ts +21 -5
  275. package/src/runner/auth/bearer.ts +10 -6
  276. package/src/runner/auth/jwt.ts +10 -41
  277. package/src/runner/auth/mtls.ts +6 -3
  278. package/src/runner/auth/none.ts +3 -1
  279. package/src/runner/index.ts +102 -11
  280. package/src/runner/stdio.ts +15 -10
  281. package/src/runner/unix.ts +7 -4
  282. package/src/runner/websocket.ts +9 -7
  283. package/dist/Auth-BElTC9_X.js +0 -6
  284. package/dist/Bootstrap-H9gDsgsC.js +0 -9
  285. package/dist/ConfigDirectory-BCC6q2R4.js +0 -5
  286. package/dist/Contract-DsJtisvL.js +0 -83
  287. package/dist/Errors-DYhsGZcZ.js +0 -58
  288. package/dist/FailureGroup-BgT73AaR.js +0 -63
  289. package/dist/Framing-G9eSaeLb.js +0 -61
  290. package/dist/Graft-B71CPA2Y.js +0 -996
  291. package/dist/Packages-AgoCGotL.js +0 -108
  292. package/dist/Peer-DXeVrGBh.js +0 -342
  293. package/dist/ProcessObservation-gLgGirYv.js +0 -38
  294. package/dist/ServeLifecycle-Bd1FPJ6e.js +0 -24
  295. package/dist/Transport-DULzpsgR.js +0 -6
  296. package/dist/WatchdogProtocol-BZmVxrBP.js +0 -17
  297. package/dist/bin.js +0 -28276
  298. package/dist/bin.js.map +0 -1
  299. package/dist/childRuntime-Bm3iSg_N.js +0 -192
  300. package/dist/command-9zrHdbwT.js +0 -7
  301. package/dist/connectionEnded-BwcxQ7W8.js +0 -54
  302. package/dist/directTransport-DrexuPSm.js +0 -5
  303. package/dist/entry-psOpX3Bj.js +0 -736
  304. package/dist/importer-Cvf88eAY.js +0 -344
  305. package/dist/internal/ServeLifecycle.js.map +0 -1
  306. package/dist/internal/entryConfig.d.ts.map +0 -1
  307. package/dist/internal/platform.js.map +0 -1
  308. package/dist/internal/release.js +0 -25
  309. package/dist/internal/release.js.map +0 -1
  310. package/dist/internal/serve.js +0 -60
  311. package/dist/internal/serve.js.map +0 -1
  312. package/dist/port--3x2zJ4D.js +0 -285
  313. package/dist/release-DfZPuIcK.js +0 -23
  314. package/dist/rolldown-runtime-DYf_mQCB.js +0 -34
  315. package/dist/socketChannel-CJvL2DiB.js +0 -3658
  316. package/dist/supervisorPlugin-t6Z6PrhD.js +0 -733
  317. package/dist/token-CYBNNlhS.js +0 -17
  318. package/dist/tokenCredentials-CbCuk-Rt.js +0 -31
  319. package/dist/websocketServer-NQhODlEt.js +0 -60
  320. package/dist/workerChannel-C8hhBJzA.js +0 -27
  321. package/src/internal/release.ts +0 -72
  322. package/src/internal/serve.ts +0 -119
  323. /package/dist/{bin.d.ts → internal/childMain.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"child.js","names":[],"sources":["../../src/internal/child.ts"],"sourcesContent":["import { loadModule } from \"./loadModule\"\nimport { AlreadyLoaded, ActivationFailed } from \"./childErrors\"\nimport { Graft, Plugin, type Fork } from \"@graftland/graft\"\nimport {\n\tArray,\n\tCause,\n\tData,\n\tDeferred,\n\tEffect,\n\tExit,\n\tFiber,\n\tLogger,\n\tMutableRef,\n\tOption,\n\tQueue,\n\tRef,\n\tReferences,\n\tScope,\n\tStream,\n\tSynchronizedRef,\n} from \"effect\"\nimport type { Schema } from \"effect\"\nimport { type RunnerContract } from \"./contract\"\nimport { Instance, type Identity } from \"../Instance\"\nimport type * as Port from \"./port\"\nimport type { Event, Log, LogEvent } from \"./control\"\n\ntype Peer = Port.Port\ntype ChildEvent = Data.TaggedEnum<{\n\tFailed: { readonly cause: Cause.Cause<unknown> }\n\tWithdrawing: {}\n\tStopped: {}\n}>\nconst ChildEvent = Data.taggedEnum<ChildEvent>()\ntype LogEntry = Omit<typeof Log.Type, \"cause\"> & {\n\treadonly cause: Cause.Cause<unknown>\n}\n\n/** Queue data; serialization belongs to the RPC consumer, outside synchronous logger callbacks. */\nexport const telemetry = Effect.fnUntraced(function* (\n\tcontract: RunnerContract,\n) {\n\tconst events = yield* Queue.bounded<ChildEvent>(2)\n\tconst logs = yield* Queue.dropping<LogEntry, Cause.Done>(128)\n\tconst dropped = MutableRef.make(0)\n\tconst encode = (cause: Cause.Cause<unknown>) =>\n\t\tcontract.encodeCause(cause).pipe(Effect.orDie)\n\tconst logger = Logger.make((entry) => {\n\t\t// Logger callbacks are synchronous; a dropping offer and loss counter cannot suspend.\n\t\tconst accepted = Queue.offerUnsafe(logs, {\n\t\t\tlevel: entry.logLevel,\n\t\t\tmessage: entry.message,\n\t\t\tcause: entry.cause,\n\t\t\tannotations: entry.fiber.getRef(References.CurrentLogAnnotations),\n\t\t})\n\t\tif (!accepted) MutableRef.increment(dropped)\n\t})\n\treturn {\n\t\tevents,\n\t\tlogs,\n\t\tlogger,\n\t\teventStream: Stream.fromQueue(events).pipe(\n\t\t\tStream.mapEffect((event): Effect.Effect<typeof Event.Type> =>\n\t\t\t\tevent._tag === \"Failed\"\n\t\t\t\t\t? encode(event.cause).pipe(\n\t\t\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\t\t\t({\n\t\t\t\t\t\t\t\t\t\t_tag: \"Failed\",\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t}) satisfies typeof Event.Type,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t: Effect.succeed(event),\n\t\t\t),\n\t\t),\n\t\tlogStream: Stream.fromQueue(logs).pipe(\n\t\t\tStream.mapEffect((entry) =>\n\t\t\t\tencode(entry.cause).pipe(\n\t\t\t\t\tEffect.map((cause): typeof LogEvent.Type => ({\n\t\t\t\t\t\t_tag: \"Log\",\n\t\t\t\t\t\tentry: { ...entry, cause },\n\t\t\t\t\t\tdropped: MutableRef.get(dropped),\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t),\n\t\t\tStream.concat(\n\t\t\t\tStream.sync((): typeof LogEvent.Type => ({\n\t\t\t\t\t_tag: \"LogsEnded\",\n\t\t\t\t\tdropped: MutableRef.get(dropped),\n\t\t\t\t})),\n\t\t\t),\n\t\t),\n\t}\n})\ntype Telemetry = Effect.Success<ReturnType<typeof telemetry>>\ninterface Running {\n\treadonly fork: Pick<Fork.Fork<never, unknown>, \"dispose\" | \"state\">\n\treadonly bridge: Pick<Fork.Fork<never, never>, \"dispose\" | \"state\">\n\treadonly observation: Fiber.Fiber<void>\n\treadonly observedFailure: Ref.Ref<Cause.Cause<unknown>>\n}\ntype Lifecycle = Data.TaggedEnum<{\n\tIdle: {}\n\tLoading: {}\n\tRunning: { readonly running: Running }\n\tWithdrawing: { readonly running: Option.Option<Running> }\n\tDisposing: { readonly running: Option.Option<Running> }\n}>\nconst Lifecycle = Data.taggedEnum<Lifecycle>()\nconst runningOf = (state: Lifecycle): Option.Option<Running> =>\n\tstate._tag === \"Running\"\n\t\t? Option.some(state.running)\n\t\t: state._tag === \"Withdrawing\" || state._tag === \"Disposing\"\n\t\t\t? state.running\n\t\t\t: Option.none()\n\nconst cleanup = Effect.fnUntraced(function* (\n\trunning: Running,\n\tretired: boolean,\n) {\n\tconst pluginExit = yield* Effect.exit(running.fork.dispose)\n\tconst bridgeExit = yield* Effect.exit(running.bridge.dispose)\n\tyield* Fiber.join(running.observation)\n\tconst failed = yield* Ref.get(running.observedFailure)\n\treturn Array.reduce(\n\t\t[bridgeExit, pluginExit],\n\t\tretired ? failed : Cause.empty,\n\t\t(cause, exit) =>\n\t\t\tExit.isFailure(exit)\n\t\t\t\t? Cause.combine(\n\t\t\t\t\t\tcause,\n\t\t\t\t\t\tCause.fromReasons(\n\t\t\t\t\t\t\tArray.flatMap(exit.cause.reasons, (reason) =>\n\t\t\t\t\t\t\t\treason._tag === \"Fail\" ? reason.error.cause.reasons : [reason],\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t: cause,\n\t)\n})\n\nexport const lifecycle = Effect.fnUntraced(function* (\n\tcontract: RunnerContract,\n\tpeer: Peer,\n\tidentity: typeof Identity.Type,\n\ttelemetry: Telemetry,\n) {\n\tconst scope = yield* Effect.scope\n\tconst instanceScope = yield* Scope.fork(scope)\n\tconst releaseExports = yield* Deferred.make<void>()\n\tconst state = yield* SynchronizedRef.make<Lifecycle>(Lifecycle.Idle())\n\t// This gate represents host consumers draining, not a second lifecycle state.\n\tconst disposing = (current: Lifecycle) =>\n\t\tLifecycle.Disposing({ running: runningOf(current) })\n\tconst release = SynchronizedRef.update(state, disposing).pipe(\n\t\tEffect.andThen(Deferred.succeed(releaseExports, undefined)),\n\t)\n\n\tconst exportBridge = Graft.plugin(\n\t\tPlugin.make({\n\t\t\tname: `${contract.name}/exports`,\n\t\t\tinject: Array.map(contract.provides, (service) => service.key),\n\t\t\tapply: Effect.fnUntraced(function* () {\n\t\t\t\tfor (const service of contract.provides)\n\t\t\t\t\tyield* service.serve(peer).pipe(\n\t\t\t\t\t\tEffect.tapCause((cause) =>\n\t\t\t\t\t\t\tCause.hasInterruptsOnly(cause)\n\t\t\t\t\t\t\t\t? Effect.void\n\t\t\t\t\t\t\t\t: Queue.offer(telemetry.events, ChildEvent.Failed({ cause })),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tEffect.forkScoped,\n\t\t\t\t\t)\n\t\t\t\tyield* Effect.addFinalizer(\n\t\t\t\t\tEffect.fnUntraced(function* () {\n\t\t\t\t\t\tconst withdrawing = yield* SynchronizedRef.modify(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t(current) =>\n\t\t\t\t\t\t\t\tcurrent._tag === \"Disposing\"\n\t\t\t\t\t\t\t\t\t? [false, current]\n\t\t\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t\t\t\tLifecycle.Withdrawing({\n\t\t\t\t\t\t\t\t\t\t\t\trunning: runningOf(current),\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif (withdrawing)\n\t\t\t\t\t\t\tyield* Queue.offer(telemetry.events, ChildEvent.Withdrawing())\n\t\t\t\t\t\tyield* Deferred.await(releaseExports)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}),\n\t\t}),\n\t).pipe(Scope.provide(instanceScope))\n\n\tconst start = Effect.fnUntraced(function* (input: Schema.Json) {\n\t\t// Imported clients outlive Load and remain available during plugin cleanup.\n\t\tfor (const service of contract.inject)\n\t\t\tyield* service.publish(peer).pipe(\n\t\t\t\tScope.provide(scope),\n\t\t\t\tEffect.mapError((error) =>\n\t\t\t\t\tActivationFailed.make({\n\t\t\t\t\t\tdetail: \"Publishing imported services failed\",\n\t\t\t\t\t\tcause: Cause.fail(error),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t)\n\t\tconst module = yield* loadModule(contract.module)\n\t\tconst plugin = Plugin.fromModule(module)\n\t\tif (Option.isNone(plugin))\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The implementation module exports no plugin\",\n\t\t\t})\n\t\tconst fork = yield* Graft.plugin(\n\t\t\t{ ...plugin.value, retry: undefined },\n\t\t\tinput,\n\t\t).pipe(\n\t\t\tEffect.provideService(Instance, identity),\n\t\t\tScope.provide(instanceScope),\n\t\t)\n\t\tconst observedFailure = yield* Ref.make<Cause.Cause<unknown>>(Cause.empty)\n\t\tconst observation = yield* fork.state.pipe(\n\t\t\tStream.runForEach((state) =>\n\t\t\t\tstate._tag === \"Failed\"\n\t\t\t\t\t? Ref.set(observedFailure, state.cause)\n\t\t\t\t\t: Effect.void,\n\t\t\t),\n\t\t\tEffect.forkIn(instanceScope),\n\t\t)\n\t\tconst bridge = yield* exportBridge\n\t\treturn { fork, bridge, observedFailure, observation } satisfies Running\n\t})\n\tconst awaitActive = Effect.fnUntraced(function* (running: Running) {\n\t\tconst first = yield* running.fork.state.pipe(\n\t\t\tStream.filter((state) => state._tag !== \"Loading\"),\n\t\t\tStream.runHead,\n\t\t)\n\t\tif (Option.isNone(first))\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The remote fork disappeared during startup\",\n\t\t\t})\n\t\tif (first.value._tag === \"Failed\")\n\t\t\treturn yield* Effect.fail(contract.normalizeCause(first.value.cause))\n\t\tif (first.value._tag !== \"Active\")\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail:\n\t\t\t\t\t\"The remote plugin did not become active; check its declared dependencies\",\n\t\t\t})\n\t\tyield* running.fork.state.pipe(\n\t\t\tStream.runForEach((state) =>\n\t\t\t\tstate._tag === \"Failed\"\n\t\t\t\t\t? Queue.offer(\n\t\t\t\t\t\t\ttelemetry.events,\n\t\t\t\t\t\t\tChildEvent.Failed({ cause: state.cause }),\n\t\t\t\t\t\t)\n\t\t\t\t\t: Effect.void,\n\t\t\t),\n\t\t\tEffect.forkIn(instanceScope),\n\t\t)\n\t\tconst exported = yield* running.bridge.state.pipe(\n\t\t\tStream.filter(\n\t\t\t\t(state) =>\n\t\t\t\t\tstate._tag === \"Active\" ||\n\t\t\t\t\tstate._tag === \"Failed\" ||\n\t\t\t\t\tstate._tag === \"Disposed\",\n\t\t\t),\n\t\t\tStream.runHead,\n\t\t)\n\t\tif (Option.isSome(exported) && exported.value._tag === \"Failed\")\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The remote export bridge failed during startup\",\n\t\t\t\tcause: exported.value.cause,\n\t\t\t})\n\t\tif (Option.isNone(exported) || exported.value._tag !== \"Active\")\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The remote export bridge stopped during startup\",\n\t\t\t})\n\t})\n\tconst load = Effect.fnUntraced(\n\t\tfunction* (input: Schema.Json) {\n\t\t\tyield* SynchronizedRef.updateEffect(state, (current) =>\n\t\t\t\tcurrent._tag === \"Idle\"\n\t\t\t\t\t? Effect.succeed(Lifecycle.Loading())\n\t\t\t\t\t: Effect.fail(AlreadyLoaded.make({})),\n\t\t\t)\n\t\t\tconst running = yield* start(input)\n\t\t\tconst disposed = yield* SynchronizedRef.modify(\n\t\t\t\tstate,\n\t\t\t\t(current): readonly [boolean, Lifecycle] =>\n\t\t\t\t\tcurrent._tag === \"Withdrawing\"\n\t\t\t\t\t\t? [false, Lifecycle.Withdrawing({ running: Option.some(running) })]\n\t\t\t\t\t\t: current._tag === \"Disposing\"\n\t\t\t\t\t\t\t? [true, Lifecycle.Disposing({ running: Option.some(running) })]\n\t\t\t\t\t\t\t: [false, Lifecycle.Running({ running })],\n\t\t\t)\n\t\t\t// Dispose saw Loading and found nothing to stop; this load owns the cleanup.\n\t\t\tif (disposed) {\n\t\t\t\tconst cause = yield* cleanup(running, false)\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tCause.combine(\n\t\t\t\t\t\tCause.fail(\n\t\t\t\t\t\t\tActivationFailed.make({\n\t\t\t\t\t\t\t\tdetail: \"The execution was disposed during load\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcause,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t\tyield* awaitActive(running)\n\t\t},\n\t\tEffect.mapError((error) =>\n\t\t\tcontract.normalizeCause(Cause.isCause(error) ? error : Cause.fail(error)),\n\t\t),\n\t)\n\tconst dispose = Effect.gen(function* () {\n\t\t// One transition, so a concurrent Load or export withdrawal cannot slip between read and write.\n\t\tconst previous = yield* SynchronizedRef.getAndUpdate(state, disposing)\n\t\tyield* Deferred.succeed(releaseExports, undefined)\n\t\tconst current = runningOf(previous)\n\t\tconst retired = previous._tag === \"Withdrawing\"\n\t\tconst cause = Option.isSome(current)\n\t\t\t? yield* cleanup(current.value, retired)\n\t\t\t: Cause.empty\n\t\tyield* Queue.offer(telemetry.events, ChildEvent.Stopped())\n\t\tyield* Queue.end(telemetry.logs)\n\t\tif (cause.reasons.length > 0)\n\t\t\treturn yield* Effect.fail(contract.normalizeCause(cause))\n\t})\n\treturn { load, dispose, release }\n})\n"],"mappings":";;;;;;AAiCA,MAAM,aAAa,KAAK,WAAuB;;AAM/C,MAAa,YAAY,OAAO,WAAW,WAC1C,UACC;CACD,MAAM,SAAS,OAAO,MAAM,QAAoB,CAAC;CACjD,MAAM,OAAO,OAAO,MAAM,SAA+B,GAAG;CAC5D,MAAM,UAAU,WAAW,KAAK,CAAC;CACjC,MAAM,UAAU,UACf,SAAS,YAAY,KAAK,CAAC,CAAC,KAAK,OAAO,KAAK;CAW9C,OAAO;EACN;EACA;EACA,QAbc,OAAO,MAAM,UAAU;GAQrC,IAAI,CANa,MAAM,YAAY,MAAM;IACxC,OAAO,MAAM;IACb,SAAS,MAAM;IACf,OAAO,MAAM;IACb,aAAa,MAAM,MAAM,OAAO,WAAW,qBAAqB;GACjE,CACY,GAAG,WAAW,UAAU,OAAO;EAC5C,CAIM;EACL,aAAa,OAAO,UAAU,MAAM,CAAC,CAAC,KACrC,OAAO,WAAW,UACjB,MAAM,SAAS,WACZ,OAAO,MAAM,KAAK,CAAC,CAAC,KACpB,OAAO,KACL,WACC;GACA,MAAM;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AAI,aAAa;GAEvC,MAAM,WAAW,OAAO,gBAAgB,aAAa,OAAO,SAAS;GACrE,OAAO,SAAS,QAAQ,gBAAgB,KAAA,CAAS;GACjD,MAAM,UAAU,UAAU,QAAQ;GAClC,MAAM,UAAU,SAAS,SAAS;GAClC,MAAM,QAAQ,OAAO,OAAO,OAAO,IAChC,OAAO,QAAQ,QAAQ,OAAO,OAAO,IACrC,MAAM;GACT,OAAO,MAAM,MAAM,UAAU,QAAQ,WAAW,QAAQ,CAAC;GACzD,OAAO,MAAM,IAAI,UAAU,IAAI;GAC/B,IAAI,MAAM,QAAQ,SAAS,GAC1B,OAAO,OAAO,OAAO,KAAK,SAAS,eAAe,KAAK,CAAC;EAC1D,CACqB;EAAG;CAAQ;AACjC,CAAC"}
1
+ {"version":3,"file":"child.js","names":[],"sources":["../../src/internal/child.ts"],"sourcesContent":["import {\n\tArray,\n\tCause,\n\tData,\n\tDeferred,\n\tEffect,\n\tExit,\n\tFiber,\n\tLogger,\n\tMutableRef,\n\tOption,\n\tQueue,\n\tRef,\n\tReferences,\n\tScope,\n\tStream,\n\tSynchronizedRef,\n\ttype Schema,\n} from \"effect\"\n\nimport { Graft, Plugin, type Fork } from \"@graftland/graft\"\n\nimport { Instance, type Identity } from \"../Instance\"\nimport { ActivationFailed, AlreadyLoaded } from \"./childErrors\"\nimport { type RunnerContract } from \"./contract\"\nimport type { Event, Log, LogEvent } from \"./control\"\nimport { loadModule } from \"./loadModule\"\nimport type * as Port from \"./port\"\n\ntype Peer = Port.Port\ntype ChildEvent = Data.TaggedEnum<{\n\tFailed: { readonly cause: Cause.Cause<unknown> }\n\tWithdrawing: {}\n\tStopped: {}\n}>\nconst ChildEvent = Data.taggedEnum<ChildEvent>()\ntype LogEntry = Omit<typeof Log.Type, \"cause\"> & {\n\treadonly cause: Cause.Cause<unknown>\n}\n\n/** Queue data; serialization belongs to the RPC consumer, outside synchronous logger callbacks. */\nexport const telemetry = Effect.fnUntraced(function* (\n\tcontract: RunnerContract,\n) {\n\tconst events = yield* Queue.bounded<ChildEvent>(2)\n\tconst logs = yield* Queue.dropping<LogEntry, Cause.Done>(128)\n\tconst dropped = MutableRef.make(0)\n\tconst encode = (cause: Cause.Cause<unknown>) =>\n\t\tcontract.encodeCause(cause).pipe(Effect.orDie)\n\tconst logger = Logger.make((entry) => {\n\t\t// Logger callbacks are synchronous; a dropping offer and loss counter cannot suspend.\n\t\tconst accepted = Queue.offerUnsafe(logs, {\n\t\t\tlevel: entry.logLevel,\n\t\t\tmessage: entry.message,\n\t\t\tcause: entry.cause,\n\t\t\tannotations: entry.fiber.getRef(References.CurrentLogAnnotations),\n\t\t})\n\t\tif (!accepted) MutableRef.increment(dropped)\n\t})\n\treturn {\n\t\tevents,\n\t\tlogs,\n\t\tlogger,\n\t\teventStream: Stream.fromQueue(events).pipe(\n\t\t\tStream.mapEffect((event): Effect.Effect<typeof Event.Type> =>\n\t\t\t\tevent._tag === \"Failed\"\n\t\t\t\t\t? encode(event.cause).pipe(\n\t\t\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t\t\t(cause) =>\n\t\t\t\t\t\t\t\t\t({\n\t\t\t\t\t\t\t\t\t\t_tag: \"Failed\",\n\t\t\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\t\t}) satisfies typeof Event.Type,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t: Effect.succeed(event),\n\t\t\t),\n\t\t),\n\t\tlogStream: Stream.fromQueue(logs).pipe(\n\t\t\tStream.mapEffect((entry) =>\n\t\t\t\tencode(entry.cause).pipe(\n\t\t\t\t\tEffect.map((cause): typeof LogEvent.Type => ({\n\t\t\t\t\t\t_tag: \"Log\",\n\t\t\t\t\t\tentry: { ...entry, cause },\n\t\t\t\t\t\tdropped: MutableRef.get(dropped),\n\t\t\t\t\t})),\n\t\t\t\t),\n\t\t\t),\n\t\t\tStream.concat(\n\t\t\t\tStream.sync((): typeof LogEvent.Type => ({\n\t\t\t\t\t_tag: \"LogsEnded\",\n\t\t\t\t\tdropped: MutableRef.get(dropped),\n\t\t\t\t})),\n\t\t\t),\n\t\t),\n\t}\n})\ntype Telemetry = Effect.Success<ReturnType<typeof telemetry>>\ninterface Running {\n\treadonly fork: Pick<Fork.Fork<never, unknown>, \"dispose\" | \"state\">\n\treadonly bridge: Pick<Fork.Fork<never, never>, \"dispose\" | \"state\">\n\treadonly observation: Fiber.Fiber<void>\n\treadonly observedFailure: Ref.Ref<Cause.Cause<unknown>>\n}\ntype Lifecycle = Data.TaggedEnum<{\n\tIdle: {}\n\tLoading: {}\n\tRunning: { readonly running: Running }\n\tWithdrawing: { readonly running: Option.Option<Running> }\n\tDisposing: { readonly running: Option.Option<Running> }\n}>\nconst Lifecycle = Data.taggedEnum<Lifecycle>()\nconst runningOf = (state: Lifecycle): Option.Option<Running> =>\n\tstate._tag === \"Running\"\n\t\t? Option.some(state.running)\n\t\t: state._tag === \"Withdrawing\" || state._tag === \"Disposing\"\n\t\t\t? state.running\n\t\t\t: Option.none()\n\nconst cleanup = Effect.fnUntraced(function* (\n\trunning: Running,\n\tretired: boolean,\n) {\n\tconst pluginExit = yield* Effect.exit(running.fork.dispose)\n\tconst bridgeExit = yield* Effect.exit(running.bridge.dispose)\n\tyield* Fiber.join(running.observation)\n\tconst failed = yield* Ref.get(running.observedFailure)\n\treturn Array.reduce(\n\t\t[bridgeExit, pluginExit],\n\t\tretired ? failed : Cause.empty,\n\t\t(cause, exit) =>\n\t\t\tExit.isFailure(exit)\n\t\t\t\t? Cause.combine(\n\t\t\t\t\t\tcause,\n\t\t\t\t\t\tCause.fromReasons(\n\t\t\t\t\t\t\tArray.flatMap(exit.cause.reasons, (reason) =>\n\t\t\t\t\t\t\t\treason._tag === \"Fail\" ? reason.error.cause.reasons : [reason],\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t: cause,\n\t)\n})\n\nexport const lifecycle = Effect.fnUntraced(function* (\n\tcontract: RunnerContract,\n\tpeer: Peer,\n\tidentity: typeof Identity.Type,\n\ttelemetry: Telemetry,\n) {\n\tconst scope = yield* Effect.scope\n\tconst instanceScope = yield* Scope.fork(scope)\n\tconst releaseExports = yield* Deferred.make<void>()\n\tconst state = yield* SynchronizedRef.make<Lifecycle>(Lifecycle.Idle())\n\t// This gate represents host consumers draining, not a second lifecycle state.\n\tconst disposing = (current: Lifecycle) =>\n\t\tLifecycle.Disposing({ running: runningOf(current) })\n\tconst release = SynchronizedRef.update(state, disposing).pipe(\n\t\tEffect.andThen(Deferred.succeed(releaseExports, undefined)),\n\t)\n\n\tconst exportBridge = Graft.plugin(\n\t\tPlugin.make({\n\t\t\tname: `${contract.name}/exports`,\n\t\t\tinject: Array.map(contract.provides, (service) => service.key),\n\t\t\tapply: Effect.fnUntraced(function* () {\n\t\t\t\tfor (const service of contract.provides)\n\t\t\t\t\tyield* service.serve(peer).pipe(\n\t\t\t\t\t\tEffect.tapCause((cause) =>\n\t\t\t\t\t\t\tCause.hasInterruptsOnly(cause)\n\t\t\t\t\t\t\t\t? Effect.void\n\t\t\t\t\t\t\t\t: Queue.offer(telemetry.events, ChildEvent.Failed({ cause })),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tEffect.forkScoped,\n\t\t\t\t\t)\n\t\t\t\tyield* Effect.addFinalizer(\n\t\t\t\t\tEffect.fnUntraced(function* () {\n\t\t\t\t\t\tconst withdrawing = yield* SynchronizedRef.modify(\n\t\t\t\t\t\t\tstate,\n\t\t\t\t\t\t\t(current) =>\n\t\t\t\t\t\t\t\tcurrent._tag === \"Disposing\"\n\t\t\t\t\t\t\t\t\t? [false, current]\n\t\t\t\t\t\t\t\t\t: [\n\t\t\t\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t\t\t\tLifecycle.Withdrawing({\n\t\t\t\t\t\t\t\t\t\t\t\trunning: runningOf(current),\n\t\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t)\n\t\t\t\t\t\tif (withdrawing)\n\t\t\t\t\t\t\tyield* Queue.offer(telemetry.events, ChildEvent.Withdrawing())\n\t\t\t\t\t\tyield* Deferred.await(releaseExports)\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}),\n\t\t}),\n\t).pipe(Scope.provide(instanceScope))\n\n\tconst start = Effect.fnUntraced(function* (input: Schema.Json) {\n\t\t// Imported clients outlive Load and remain available during plugin cleanup.\n\t\tfor (const service of contract.inject)\n\t\t\tyield* service.publish(peer).pipe(\n\t\t\t\tScope.provide(scope),\n\t\t\t\tEffect.mapError((error) =>\n\t\t\t\t\tActivationFailed.make({\n\t\t\t\t\t\tdetail: \"Publishing imported services failed\",\n\t\t\t\t\t\tcause: Cause.fail(error),\n\t\t\t\t\t}),\n\t\t\t\t),\n\t\t\t)\n\t\tconst module = yield* loadModule(contract.module)\n\t\tconst plugin = Plugin.fromModule(module)\n\t\tif (Option.isNone(plugin))\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The implementation module exports no plugin\",\n\t\t\t})\n\t\tconst fork = yield* Graft.plugin(\n\t\t\t{ ...plugin.value, retry: undefined },\n\t\t\tinput,\n\t\t).pipe(\n\t\t\tEffect.provideService(Instance, identity),\n\t\t\tScope.provide(instanceScope),\n\t\t)\n\t\tconst observedFailure = yield* Ref.make<Cause.Cause<unknown>>(Cause.empty)\n\t\tconst observation = yield* fork.state.pipe(\n\t\t\tStream.runForEach((state) =>\n\t\t\t\tstate._tag === \"Failed\"\n\t\t\t\t\t? Ref.set(observedFailure, state.cause)\n\t\t\t\t\t: Effect.void,\n\t\t\t),\n\t\t\tEffect.forkIn(instanceScope),\n\t\t)\n\t\tconst bridge = yield* exportBridge\n\t\treturn { fork, bridge, observedFailure, observation } satisfies Running\n\t})\n\tconst awaitActive = Effect.fnUntraced(function* (running: Running) {\n\t\tconst first = yield* running.fork.state.pipe(\n\t\t\tStream.filter((state) => state._tag !== \"Loading\"),\n\t\t\tStream.runHead,\n\t\t)\n\t\tif (Option.isNone(first))\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The remote fork disappeared during startup\",\n\t\t\t})\n\t\tif (first.value._tag === \"Failed\")\n\t\t\treturn yield* Effect.fail(contract.normalizeCause(first.value.cause))\n\t\tif (first.value._tag !== \"Active\")\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail:\n\t\t\t\t\t\"The remote plugin did not become active; check its declared dependencies\",\n\t\t\t})\n\t\tyield* running.fork.state.pipe(\n\t\t\tStream.runForEach((state) =>\n\t\t\t\tstate._tag === \"Failed\"\n\t\t\t\t\t? Queue.offer(\n\t\t\t\t\t\t\ttelemetry.events,\n\t\t\t\t\t\t\tChildEvent.Failed({ cause: state.cause }),\n\t\t\t\t\t\t)\n\t\t\t\t\t: Effect.void,\n\t\t\t),\n\t\t\tEffect.forkIn(instanceScope),\n\t\t)\n\t\tconst exported = yield* running.bridge.state.pipe(\n\t\t\tStream.filter(\n\t\t\t\t(state) =>\n\t\t\t\t\tstate._tag === \"Active\" ||\n\t\t\t\t\tstate._tag === \"Failed\" ||\n\t\t\t\t\tstate._tag === \"Disposed\",\n\t\t\t),\n\t\t\tStream.runHead,\n\t\t)\n\t\tif (Option.isSome(exported) && exported.value._tag === \"Failed\")\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The remote export bridge failed during startup\",\n\t\t\t\tcause: exported.value.cause,\n\t\t\t})\n\t\tif (Option.isNone(exported) || exported.value._tag !== \"Active\")\n\t\t\treturn yield* ActivationFailed.make({\n\t\t\t\tdetail: \"The remote export bridge stopped during startup\",\n\t\t\t})\n\t})\n\tconst load = Effect.fnUntraced(\n\t\tfunction* (input: Schema.Json) {\n\t\t\tyield* SynchronizedRef.updateEffect(state, (current) =>\n\t\t\t\tcurrent._tag === \"Idle\"\n\t\t\t\t\t? Effect.succeed(Lifecycle.Loading())\n\t\t\t\t\t: Effect.fail(AlreadyLoaded.make({})),\n\t\t\t)\n\t\t\tconst running = yield* start(input)\n\t\t\tconst disposed = yield* SynchronizedRef.modify(\n\t\t\t\tstate,\n\t\t\t\t(current): readonly [boolean, Lifecycle] =>\n\t\t\t\t\tcurrent._tag === \"Withdrawing\"\n\t\t\t\t\t\t? [false, Lifecycle.Withdrawing({ running: Option.some(running) })]\n\t\t\t\t\t\t: current._tag === \"Disposing\"\n\t\t\t\t\t\t\t? [true, Lifecycle.Disposing({ running: Option.some(running) })]\n\t\t\t\t\t\t\t: [false, Lifecycle.Running({ running })],\n\t\t\t)\n\t\t\t// Dispose saw Loading and found nothing to stop; this load owns the cleanup.\n\t\t\tif (disposed) {\n\t\t\t\tconst cause = yield* cleanup(running, false)\n\t\t\t\treturn yield* Effect.fail(\n\t\t\t\t\tCause.combine(\n\t\t\t\t\t\tCause.fail(\n\t\t\t\t\t\t\tActivationFailed.make({\n\t\t\t\t\t\t\t\tdetail: \"The execution was disposed during load\",\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t\tcause,\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t}\n\t\t\tyield* awaitActive(running)\n\t\t},\n\t\tEffect.mapError((error) =>\n\t\t\tcontract.normalizeCause(Cause.isCause(error) ? error : Cause.fail(error)),\n\t\t),\n\t)\n\tconst dispose = Effect.gen(function* () {\n\t\t// One transition, so a concurrent Load or export withdrawal cannot slip between read and write.\n\t\tconst previous = yield* SynchronizedRef.getAndUpdate(state, disposing)\n\t\tyield* Deferred.succeed(releaseExports, undefined)\n\t\tconst current = runningOf(previous)\n\t\tconst retired = previous._tag === \"Withdrawing\"\n\t\tconst cause = Option.isSome(current)\n\t\t\t? yield* cleanup(current.value, retired)\n\t\t\t: Cause.empty\n\t\tyield* Queue.offer(telemetry.events, ChildEvent.Stopped())\n\t\tyield* Queue.end(telemetry.logs)\n\t\tif (cause.reasons.length > 0)\n\t\t\treturn yield* Effect.fail(contract.normalizeCause(cause))\n\t})\n\treturn { load, dispose, release }\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4
+ import { Bootstrap } from "./runner/Bootstrap.js";
5
+ import { start } from "./runner/Watchdog.js";
6
+ import { bytes } from "./stdioChannel.js";
7
+ import { Array, Effect, Layer, Logger, Option, Schema } from "effect";
8
+ import { Graft } from "@graftland/graft";
9
+ import process from "node:process";
10
+ import { pathToFileURL } from "node:url";
11
+ import { Argument, CliError, Command } from "effect/cli";
12
+ import { NodeRuntime } from "@effect/platform-node";
13
+ // src/internal/childMain.ts
14
+ /** Internal executable for local and supervised child runtimes. */
15
+ const child = Command.make("child", {
16
+ contract: Argument.String("contract"),
17
+ session: Argument.String("session"),
18
+ bootstrap: Argument.String("bootstrap").pipe(Argument.withSchema(Schema.fromJsonString(Bootstrap)))
19
+ }, Effect.fnUntraced(function* ({ contract, session, bootstrap }) {
20
+ const watchdog = yield* start;
21
+ yield* Effect.addFinalizer(() => Effect.sync(() => {
22
+ process.stdin.destroy();
23
+ }));
24
+ if (!(yield* Effect.raceFirst(watchdog.begin.pipe(Effect.as(true)), watchdog.stop.pipe(Effect.as(false))))) return;
25
+ const definition = yield* load(pathToFileURL(contract).href);
26
+ const channel = yield* bytes;
27
+ return yield* run(definition, channel, session, bootstrap, watchdog.stop);
28
+ }));
29
+ const cli = Command.make("remote-child", {
30
+ contract: Argument.String("contract").pipe(Argument.optional),
31
+ session: Argument.String("session").pipe(Argument.withDefault("local"))
32
+ }, Effect.fnUntraced(function* ({ contract, session }) {
33
+ if (Option.isNone(contract)) return yield* CliError.UserError.make({
34
+ cause: "Missing contract module",
35
+ userMessage: "A contract module or the child subcommand is required"
36
+ });
37
+ const definition = yield* load(contract.value);
38
+ const channel = yield* bytes;
39
+ return yield* run(definition, channel, session);
40
+ })).pipe(Command.withSubcommands([child]));
41
+ NodeRuntime.runMain(Effect.scoped(Effect.gen(function* () {
42
+ const context = yield* Layer.build(Layer.provideMerge(Graft.layer, platform));
43
+ return yield* Command.run(cli, { version: "0.0.0" }).pipe(Effect.provideContext(context));
44
+ })).pipe((effect) => Effect.withFiber((main) => effect.pipe(Effect.tapCause((cause) => Array.every(cause.reasons, (reason) => reason._tag === "Interrupt" && reason.fiberId === main.id) || Array.every(cause.reasons, (reason) => reason._tag === "Fail" && CliError.isCliError(reason.error)) ? Effect.void : Effect.logError(cause)))), Effect.provideService(Logger.LogToStderr, true)), { disableErrorReporting: true });
45
+ export {};
46
+
47
+ //# sourceMappingURL=childMain.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"childMain.js","names":["Watchdog.start"],"sources":["../../src/internal/childMain.ts"],"sourcesContent":["#!/usr/bin/env node\n/** Internal executable for local and supervised child runtimes. */\nimport process from \"node:process\"\nimport { pathToFileURL } from \"node:url\"\n\nimport { Array, Effect, Layer, Logger, Option, Schema } from \"effect\"\nimport { Argument, CliError, Command } from \"effect/cli\"\nimport { NodeRuntime } from \"@effect/platform-node\"\n\nimport { Graft } from \"@graftland/graft\"\n\nimport { load, run } from \"./childRuntime\"\nimport { platform } from \"./platform\"\nimport { Bootstrap } from \"./runner/Bootstrap\"\nimport * as Watchdog from \"./runner/Watchdog\"\nimport { bytes } from \"./stdioChannel\"\n\nconst child = Command.make(\n\t\"child\",\n\t{\n\t\tcontract: Argument.String(\"contract\"),\n\t\tsession: Argument.String(\"session\"),\n\t\tbootstrap: Argument.String(\"bootstrap\").pipe(\n\t\t\tArgument.withSchema(Schema.fromJsonString(Bootstrap)),\n\t\t),\n\t},\n\tEffect.fnUntraced(function* ({ contract, session, bootstrap }) {\n\t\tconst watchdog = yield* Watchdog.start\n\t\t// The executable owns stdin; it must not retain the process after a supervisor stop.\n\t\tyield* Effect.addFinalizer(() =>\n\t\t\tEffect.sync(() => {\n\t\t\t\tprocess.stdin.destroy()\n\t\t\t}),\n\t\t)\n\t\tconst begin = yield* Effect.raceFirst(\n\t\t\twatchdog.begin.pipe(Effect.as(true)),\n\t\t\twatchdog.stop.pipe(Effect.as(false)),\n\t\t)\n\t\tif (!begin) return\n\t\tconst definition = yield* load(pathToFileURL(contract).href)\n\t\tconst channel = yield* bytes\n\t\treturn yield* run(definition, channel, session, bootstrap, watchdog.stop)\n\t}),\n)\nconst cli = Command.make(\n\t\"remote-child\",\n\t{\n\t\tcontract: Argument.String(\"contract\").pipe(Argument.optional),\n\t\tsession: Argument.String(\"session\").pipe(Argument.withDefault(\"local\")),\n\t},\n\tEffect.fnUntraced(function* ({ contract, session }) {\n\t\tif (Option.isNone(contract))\n\t\t\treturn yield* CliError.UserError.make({\n\t\t\t\tcause: \"Missing contract module\",\n\t\t\t\tuserMessage: \"A contract module or the child subcommand is required\",\n\t\t\t})\n\t\tconst definition = yield* load(contract.value)\n\t\tconst channel = yield* bytes\n\t\treturn yield* run(definition, channel, session)\n\t}),\n).pipe(Command.withSubcommands([child]))\n\nNodeRuntime.runMain(\n\tEffect.scoped(\n\t\tEffect.gen(function* () {\n\t\t\tconst context = yield* Layer.build(\n\t\t\t\tLayer.provideMerge(Graft.layer, platform),\n\t\t\t)\n\t\t\treturn yield* Command.run(cli, { version: \"0.0.0\" }).pipe(\n\t\t\t\tEffect.provideContext(context),\n\t\t\t)\n\t\t}),\n\t).pipe(\n\t\t(effect) =>\n\t\t\tEffect.withFiber((main) =>\n\t\t\t\teffect.pipe(\n\t\t\t\t\tEffect.tapCause((cause) =>\n\t\t\t\t\t\t// NodeRuntime uses this fiber's id; a self-interrupt here is indistinguishable, but worker cleanup is not.\n\t\t\t\t\t\tArray.every(\n\t\t\t\t\t\t\tcause.reasons,\n\t\t\t\t\t\t\t(reason) =>\n\t\t\t\t\t\t\t\treason._tag === \"Interrupt\" && reason.fiberId === main.id,\n\t\t\t\t\t\t) ||\n\t\t\t\t\t\tArray.every(\n\t\t\t\t\t\t\tcause.reasons,\n\t\t\t\t\t\t\t(reason) =>\n\t\t\t\t\t\t\t\treason._tag === \"Fail\" && CliError.isCliError(reason.error),\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\t? Effect.void\n\t\t\t\t\t\t\t: Effect.logError(cause),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t),\n\t\tEffect.provideService(Logger.LogToStderr, true),\n\t),\n\t// Report inside the stderr context, including failures from resource cleanup.\n\t{ disableErrorReporting: true },\n)\n"],"mappings":";;;;;;;;;;;;;;AAiBA,MAAM,QAAQ,QAAQ,KACrB,SACA;CACC,UAAU,SAAS,OAAO,UAAU;CACpC,SAAS,SAAS,OAAO,SAAS;CAClC,WAAW,SAAS,OAAO,WAAW,CAAC,CAAC,KACvC,SAAS,WAAW,OAAO,eAAe,SAAS,CAAC,CACrD;AACD,GACA,OAAO,WAAW,WAAW,EAAE,UAAU,SAAS,aAAa;CAC9D,MAAM,WAAW,OAAOA;CAExB,OAAO,OAAO,mBACb,OAAO,WAAW;EACjB,QAAQ,MAAM,QAAQ;CACvB,CAAC,CACF;CAKA,IAAI,EAAC,OAJgB,OAAO,UAC3B,SAAS,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC,GACnC,SAAS,KAAK,KAAK,OAAO,GAAG,KAAK,CAAC,CACpC,IACY;CACZ,MAAM,aAAa,OAAO,KAAK,cAAc,QAAQ,CAAC,CAAC,IAAI;CAC3D,MAAM,UAAU,OAAO;CACvB,OAAO,OAAO,IAAI,YAAY,SAAS,SAAS,WAAW,SAAS,IAAI;AACzE,CAAC,CACF;AACA,MAAM,MAAM,QAAQ,KACnB,gBACA;CACC,UAAU,SAAS,OAAO,UAAU,CAAC,CAAC,KAAK,SAAS,QAAQ;CAC5D,SAAS,SAAS,OAAO,SAAS,CAAC,CAAC,KAAK,SAAS,YAAY,OAAO,CAAC;AACvE,GACA,OAAO,WAAW,WAAW,EAAE,UAAU,WAAW;CACnD,IAAI,OAAO,OAAO,QAAQ,GACzB,OAAO,OAAO,SAAS,UAAU,KAAK;EACrC,OAAO;EACP,aAAa;CACd,CAAC;CACF,MAAM,aAAa,OAAO,KAAK,SAAS,KAAK;CAC7C,MAAM,UAAU,OAAO;CACvB,OAAO,OAAO,IAAI,YAAY,SAAS,OAAO;AAC/C,CAAC,CACF,CAAC,CAAC,KAAK,QAAQ,gBAAgB,CAAC,KAAK,CAAC,CAAC;AAEvC,YAAY,QACX,OAAO,OACN,OAAO,IAAI,aAAa;CACvB,MAAM,UAAU,OAAO,MAAM,MAC5B,MAAM,aAAa,MAAM,OAAO,QAAQ,CACzC;CACA,OAAO,OAAO,QAAQ,IAAI,KAAK,EAAE,SAAS,QAAQ,CAAC,CAAC,CAAC,KACpD,OAAO,eAAe,OAAO,CAC9B;AACD,CAAC,CACF,CAAC,CAAC,MACA,WACA,OAAO,WAAW,SACjB,OAAO,KACN,OAAO,UAAU,UAEhB,MAAM,MACL,MAAM,UACL,WACA,OAAO,SAAS,eAAe,OAAO,YAAY,KAAK,EACzD,KACA,MAAM,MACL,MAAM,UACL,WACA,OAAO,SAAS,UAAU,SAAS,WAAW,OAAO,KAAK,CAC5D,IACG,OAAO,OACP,OAAO,SAAS,KAAK,CACzB,CACD,CACD,GACD,OAAO,eAAe,OAAO,aAAa,IAAI,CAC/C,GAEA,EAAE,uBAAuB,KAAK,CAC/B"}
@@ -1,15 +1,15 @@
1
- import { loadModule } from "./loadModule.js";
2
- import { ContractNotFound } from "./childErrors.js";
3
1
  import { fromModule } from "../Contract.js";
4
- import { make } from "./port.js";
5
- import { prepare } from "./contract.js";
6
- import { endpoints } from "./services.js";
7
2
  import { lifecycle, telemetry } from "./child.js";
3
+ import { ContractNotFound } from "./childErrors.js";
4
+ import { prepare } from "./contract.js";
5
+ import { endpoint } from "./control.js";
6
+ import { loadModule } from "./loadModule.js";
7
+ import { make } from "./port.js";
8
+ import { closedNormally } from "./runner/connectionEnded.js";
9
+ import { ExecutionError } from "./runner/model.js";
8
10
  import { make as make$1 } from "./runner/Multiplex.js";
9
11
  import { channel } from "./runner/Wire.js";
10
- import { ExecutionError } from "./runner/model.js";
11
- import { closedNormally } from "./runner/connectionEnded.js";
12
- import { endpoint } from "./control.js";
12
+ import { endpoints } from "./services.js";
13
13
  import { Effect, Logger, Option } from "effect";
14
14
  import { RpcServer } from "effect/rpc";
15
15
  // src/internal/childRuntime.ts
@@ -1 +1 @@
1
- {"version":3,"file":"childRuntime.js","names":["Multiplex.make","channel","Port.make","Wire.channel","Services.endpoints","telemetry","Child.telemetry","Child.lifecycle"],"sources":["../../src/internal/childRuntime.ts"],"sourcesContent":["import { loadModule } from \"./loadModule\"\nimport { ContractNotFound } from \"./childErrors\"\nimport type { Graft } from \"@graftland/graft\"\nimport { Effect, Logger, Option } from \"effect\"\nimport { RpcServer } from \"effect/rpc\"\nimport { fromModule, type RunnerContract } from \"../Contract\"\nimport * as Port from \"./port\"\nimport { prepare, type RunnerContract as PreparedContract } from \"./contract\"\nimport * as Services from \"./services\"\nimport * as Child from \"./child\"\nimport * as Multiplex from \"./runner/Multiplex\"\nimport * as Wire from \"./runner/Wire\"\nimport type { Bootstrap } from \"./runner/Bootstrap\"\nimport { ExecutionError } from \"./runner/model\"\nimport { closedNormally } from \"./runner/connectionEnded\"\nimport { endpoint } from \"./control\"\n\n/** Import a contract in the runner installation; importing this module performs no I/O. */\nexport const load = Effect.fnUntraced(function* (specifier: string) {\n\tconst module = yield* loadModule(specifier)\n\tconst contract = fromModule(module)\n\tif (Option.isNone(contract))\n\t\treturn yield* ContractNotFound.make({ module: specifier })\n\treturn contract.value\n})\n\nconst connect = Effect.fnUntraced(function* (\n\tcontract: PreparedContract,\n\tchannel: Port.Channel,\n\tsession: string,\n\tbootstrap: Bootstrap | undefined,\n) {\n\tconst mux =\n\t\tbootstrap === undefined ? undefined : yield* Multiplex.make(channel)\n\treturn yield* Port.make(mux === undefined ? channel : Wire.channel(mux, 1), {\n\t\tsession,\n\t\tserve: {\n\t\t\t...Services.endpoints(contract.provides),\n\t\t\t[endpoint]: contract.control,\n\t\t},\n\t\tcall: Services.endpoints(contract.inject),\n\t\t...(bootstrap === undefined ? {} : { limits: bootstrap.limits }),\n\t})\n})\n\n/** One execution unit; the executable supplies the platform and Graft services. */\nexport const run: (\n\tdescriptor: RunnerContract,\n\tchannel: Port.Channel,\n\tsession?: string,\n\tbootstrap?: Bootstrap,\n\tstop?: Effect.Effect<unknown, ExecutionError>,\n) => Effect.Effect<void, ExecutionError, Graft.Graft> = Effect.fnUntraced(\n\tfunction* (\n\t\tdescriptor: RunnerContract,\n\t\tchannel: Port.Channel,\n\t\tsession: string = \"local\",\n\t\tbootstrap?: Bootstrap,\n\t\tstop: Effect.Effect<unknown, ExecutionError> = Effect.never,\n\t) {\n\t\tconst contract = prepare(descriptor)\n\t\tconst telemetry = yield* Child.telemetry(contract)\n\t\tconst loggers = yield* Logger.CurrentLoggers\n\t\tyield* Effect.gen(function* () {\n\t\t\tconst peer = yield* connect(contract, channel, session, bootstrap)\n\t\t\tconst instance = yield* Child.lifecycle(\n\t\t\t\tcontract,\n\t\t\t\tpeer,\n\t\t\t\tbootstrap?.identity ?? { id: session, generation: 1 },\n\t\t\t\ttelemetry,\n\t\t\t)\n\t\t\tconst handlers = yield* contract.control.toHandlers({\n\t\t\t\tLoad: ({ input }) => instance.load(input),\n\t\t\t\tDispose: () => instance.dispose,\n\t\t\t\tEvents: () => telemetry.eventStream,\n\t\t\t\tLogs: () => telemetry.logStream,\n\t\t\t})\n\t\t\tyield* RpcServer.make(contract.control, {\n\t\t\t\tdisableFatalDefects: true,\n\t\t\t}).pipe(\n\t\t\t\tEffect.provideContext(handlers),\n\t\t\t\tEffect.provideService(\n\t\t\t\t\tRpcServer.Protocol,\n\t\t\t\t\tpeer.serverProtocol(endpoint),\n\t\t\t\t),\n\t\t\t\tEffect.forkScoped,\n\t\t\t)\n\t\t\tyield* Effect.raceFirst(\n\t\t\t\tpeer.await.pipe(\n\t\t\t\t\tEffect.catchIf(\n\t\t\t\t\t\t(error) => closedNormally(error.cause),\n\t\t\t\t\t\t() => Effect.void,\n\t\t\t\t\t),\n\t\t\t\t\tEffect.mapError((error) =>\n\t\t\t\t\t\tExecutionError.make({\n\t\t\t\t\t\t\tdetail: \"Child transport failed\",\n\t\t\t\t\t\t\tcause: error.cause,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstop,\n\t\t\t).pipe(\n\t\t\t\t// Release exports before closing the instance scope, including on interruption.\n\t\t\t\tEffect.ensuring(instance.release),\n\t\t\t)\n\t\t}).pipe(\n\t\t\tEffect.provideService(\n\t\t\t\tLogger.CurrentLoggers,\n\t\t\t\tnew Set([...loggers, telemetry.logger]),\n\t\t\t),\n\t\t)\n\t},\n\tEffect.scoped,\n)\n"],"mappings":";;;;;;;;;;;;;;;;AAkBA,MAAa,OAAO,OAAO,WAAW,WAAW,WAAmB;CACnE,MAAM,SAAS,OAAO,WAAW,SAAS;CAC1C,MAAM,WAAW,WAAW,MAAM;CAClC,IAAI,OAAO,OAAO,QAAQ,GACzB,OAAO,OAAO,iBAAiB,KAAK,EAAE,QAAQ,UAAU,CAAC;CAC1D,OAAO,SAAS;AACjB,CAAC;AAED,MAAM,UAAU,OAAO,WAAW,WACjC,UACA,WACA,SACA,WACC;CACD,MAAM,MACL,cAAc,KAAA,IAAY,KAAA,IAAY,OAAOA,OAAeC,SAAO;CACpE,OAAO,OAAOC,KAAU,QAAQ,KAAA,IAAYD,YAAUE,QAAa,KAAK,CAAC,GAAG;EAC3E;EACA,OAAO;GACN,GAAGC,UAAmB,SAAS,QAAQ;IACtC,WAAW,SAAS;EACtB;EACA,MAAMA,UAAmB,SAAS,MAAM;EACxC,GAAI,cAAc,KAAA,IAAY,CAAC,IAAI,EAAE,QAAQ,UAAU,OAAO;CAC/D,CAAC;AACF,CAAC;;AAGD,MAAa,MAM2C,OAAO,WAC9D,WACC,YACA,SACA,UAAkB,SAClB,WACA,OAA+C,OAAO,OACrD;CACD,MAAM,WAAW,QAAQ,UAAU;CACnC,MAAMC,cAAY,OAAOC,UAAgB,QAAQ;CACjD,MAAM,UAAU,OAAO,OAAO;CAC9B,OAAO,OAAO,IAAI,aAAa;EAC9B,MAAM,OAAO,OAAO,QAAQ,UAAU,SAAS,SAAS,SAAS;EACjE,MAAM,WAAW,OAAOC,UACvB,UACA,MACA,WAAW,YAAY;GAAE,IAAI;GAAS,YAAY;EAAE,GACpDF,WACD;EACA,MAAM,WAAW,OAAO,SAAS,QAAQ,WAAW;GACnD,OAAO,EAAE,YAAY,SAAS,KAAK,KAAK;GACxC,eAAe,SAAS;GACxB,cAAcA,YAAU;GACxB,YAAYA,YAAU;EACvB,CAAC;EACD,OAAO,UAAU,KAAK,SAAS,SAAS,EACvC,qBAAqB,KACtB,CAAC,CAAC,CAAC,KACF,OAAO,eAAe,QAAQ,GAC9B,OAAO,eACN,UAAU,UACV,KAAK,eAAe,QAAQ,CAC7B,GACA,OAAO,UACR;EACA,OAAO,OAAO,UACb,KAAK,MAAM,KACV,OAAO,SACL,UAAU,eAAe,MAAM,KAAK,SAC/B,OAAO,IACd,GACA,OAAO,UAAU,UAChB,eAAe,KAAK;GACnB,QAAQ;GACR,OAAO,MAAM;EACd,CAAC,CACF,CACD,GACA,IACD,CAAC,CAAC,KAED,OAAO,SAAS,SAAS,OAAO,CACjC;CACD,CAAC,CAAC,CAAC,KACF,OAAO,eACN,OAAO,gCACP,IAAI,IAAI,CAAC,GAAG,SAASA,YAAU,MAAM,CAAC,CACvC,CACD;AACD,GACA,OAAO,MACR"}
1
+ {"version":3,"file":"childRuntime.js","names":["Multiplex.make","channel","Port.make","Wire.channel","Services.endpoints","telemetry","Child.telemetry","Child.lifecycle"],"sources":["../../src/internal/childRuntime.ts"],"sourcesContent":["import { Effect, Logger, Option } from \"effect\"\nimport { RpcServer } from \"effect/rpc\"\n\nimport type { Graft } from \"@graftland/graft\"\n\nimport { fromModule, type RunnerContract } from \"../Contract\"\nimport * as Child from \"./child\"\nimport { ContractNotFound } from \"./childErrors\"\nimport { prepare, type RunnerContract as PreparedContract } from \"./contract\"\nimport { endpoint } from \"./control\"\nimport { loadModule } from \"./loadModule\"\nimport * as Port from \"./port\"\nimport type { Bootstrap } from \"./runner/Bootstrap\"\nimport { closedNormally } from \"./runner/connectionEnded\"\nimport { ExecutionError } from \"./runner/model\"\nimport * as Multiplex from \"./runner/Multiplex\"\nimport * as Wire from \"./runner/Wire\"\nimport * as Services from \"./services\"\n\n/** Import a contract in the runner installation; importing this module performs no I/O. */\nexport const load = Effect.fnUntraced(function* (specifier: string) {\n\tconst module = yield* loadModule(specifier)\n\tconst contract = fromModule(module)\n\tif (Option.isNone(contract))\n\t\treturn yield* ContractNotFound.make({ module: specifier })\n\treturn contract.value\n})\n\nconst connect = Effect.fnUntraced(function* (\n\tcontract: PreparedContract,\n\tchannel: Port.Channel,\n\tsession: string,\n\tbootstrap: Bootstrap | undefined,\n) {\n\tconst mux =\n\t\tbootstrap === undefined ? undefined : yield* Multiplex.make(channel)\n\treturn yield* Port.make(mux === undefined ? channel : Wire.channel(mux, 1), {\n\t\tsession,\n\t\tserve: {\n\t\t\t...Services.endpoints(contract.provides),\n\t\t\t[endpoint]: contract.control,\n\t\t},\n\t\tcall: Services.endpoints(contract.inject),\n\t\t...(bootstrap === undefined ? {} : { limits: bootstrap.limits }),\n\t})\n})\n\n/** One execution unit; the executable supplies the platform and Graft services. */\nexport const run: (\n\tdescriptor: RunnerContract,\n\tchannel: Port.Channel,\n\tsession?: string,\n\tbootstrap?: Bootstrap,\n\tstop?: Effect.Effect<unknown, ExecutionError>,\n) => Effect.Effect<void, ExecutionError, Graft.Graft> = Effect.fnUntraced(\n\tfunction* (\n\t\tdescriptor: RunnerContract,\n\t\tchannel: Port.Channel,\n\t\tsession: string = \"local\",\n\t\tbootstrap?: Bootstrap,\n\t\tstop: Effect.Effect<unknown, ExecutionError> = Effect.never,\n\t) {\n\t\tconst contract = prepare(descriptor)\n\t\tconst telemetry = yield* Child.telemetry(contract)\n\t\tconst loggers = yield* Logger.CurrentLoggers\n\t\tyield* Effect.gen(function* () {\n\t\t\tconst peer = yield* connect(contract, channel, session, bootstrap)\n\t\t\tconst instance = yield* Child.lifecycle(\n\t\t\t\tcontract,\n\t\t\t\tpeer,\n\t\t\t\tbootstrap?.identity ?? { id: session, generation: 1 },\n\t\t\t\ttelemetry,\n\t\t\t)\n\t\t\tconst handlers = yield* contract.control.toHandlers({\n\t\t\t\tLoad: ({ input }) => instance.load(input),\n\t\t\t\tDispose: () => instance.dispose,\n\t\t\t\tEvents: () => telemetry.eventStream,\n\t\t\t\tLogs: () => telemetry.logStream,\n\t\t\t})\n\t\t\tyield* RpcServer.make(contract.control, {\n\t\t\t\tdisableFatalDefects: true,\n\t\t\t}).pipe(\n\t\t\t\tEffect.provideContext(handlers),\n\t\t\t\tEffect.provideService(\n\t\t\t\t\tRpcServer.Protocol,\n\t\t\t\t\tpeer.serverProtocol(endpoint),\n\t\t\t\t),\n\t\t\t\tEffect.forkScoped,\n\t\t\t)\n\t\t\tyield* Effect.raceFirst(\n\t\t\t\tpeer.await.pipe(\n\t\t\t\t\tEffect.catchIf(\n\t\t\t\t\t\t(error) => closedNormally(error.cause),\n\t\t\t\t\t\t() => Effect.void,\n\t\t\t\t\t),\n\t\t\t\t\tEffect.mapError((error) =>\n\t\t\t\t\t\tExecutionError.make({\n\t\t\t\t\t\t\tdetail: \"Child transport failed\",\n\t\t\t\t\t\t\tcause: error.cause,\n\t\t\t\t\t\t}),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\t\tstop,\n\t\t\t).pipe(\n\t\t\t\t// Release exports before closing the instance scope, including on interruption.\n\t\t\t\tEffect.ensuring(instance.release),\n\t\t\t)\n\t\t}).pipe(\n\t\t\tEffect.provideService(\n\t\t\t\tLogger.CurrentLoggers,\n\t\t\t\tnew Set([...loggers, telemetry.logger]),\n\t\t\t),\n\t\t)\n\t},\n\tEffect.scoped,\n)\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,MAAa,OAAO,OAAO,WAAW,WAAW,WAAmB;CACnE,MAAM,SAAS,OAAO,WAAW,SAAS;CAC1C,MAAM,WAAW,WAAW,MAAM;CAClC,IAAI,OAAO,OAAO,QAAQ,GACzB,OAAO,OAAO,iBAAiB,KAAK,EAAE,QAAQ,UAAU,CA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B,eAAe,KAAK;GACnB,QAAQ;GACR,OAAO,MAAM;EACd,CAAC,CACF,CACD,GACA,IACD,CAAC,CAAC,KAED,OAAO,SAAS,SAAS,OAAO,CACjC;CACD,CAAC,CAAC,CAAC,KACF,OAAO,eACN,OAAO,gCACP,IAAI,IAAI,CAAC,GAAG,SAASA,YAAU,MAAM,CAAC,CACvC,CACD;AACD,GACA,OAAO,MACR"}
@@ -1,6 +1,6 @@
1
- import { close } from "./release.js";
2
- import { Fork } from "@graftland/graft";
3
1
  import { Array, Cause, Effect, Schema, Scope } from "effect";
2
+ import { Fork } from "@graftland/graft";
3
+ import * as Release from "@graftland/graft/Release";
4
4
  // src/internal/cleanup.ts
5
5
  /** Finalizers have no typed failure channel. Keep reasons and their annotations flat. */
6
6
  const cleanupCause = (cause) => Cause.fromReasons(Array.flatMap(cause.reasons, (reason) => {
@@ -9,7 +9,7 @@ const cleanupCause = (cause) => Cause.fromReasons(Array.flatMap(cause.reasons, (
9
9
  return [reason._tag === "Fail" ? Cause.makeDieReason(reason.error).annotate(Cause.reasonAnnotations(reason)) : reason];
10
10
  }));
11
11
  /** Assembly children close before the entry reports their cleanup as its own result. */
12
- const children = Effect.acquireRelease(Scope.make(), (scope, exit) => close(scope, exit).pipe(Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause)))));
12
+ const children = Effect.acquireRelease(Scope.make(), (scope, exit) => Release.close(scope, exit).pipe(Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause)))));
13
13
  export { children, cleanupCause };
14
14
 
15
15
  //# sourceMappingURL=cleanup.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cleanup.js","names":["Release.close"],"sources":["../../src/internal/cleanup.ts"],"sourcesContent":["import { Fork } from \"@graftland/graft\"\nimport { Array, Cause, Effect, Schema, Scope } from \"effect\"\nimport * as Release from \"./release\"\n\n/** Finalizers have no typed failure channel. Keep reasons and their annotations flat. */\nexport const cleanupCause = (cause: Cause.Cause<unknown>): Cause.Cause<never> =>\n\tCause.fromReasons(\n\t\tArray.flatMap(cause.reasons, (reason) => {\n\t\t\tconst error =\n\t\t\t\treason._tag === \"Fail\"\n\t\t\t\t\t? reason.error\n\t\t\t\t\t: reason._tag === \"Die\"\n\t\t\t\t\t\t? reason.defect\n\t\t\t\t\t\t: undefined\n\t\t\tif (Schema.is(Fork.CleanupError)(error))\n\t\t\t\treturn Array.map(cleanupCause(error.cause).reasons, (inner) =>\n\t\t\t\t\tinner.annotate(Cause.reasonAnnotations(reason)),\n\t\t\t\t)\n\t\t\treturn [\n\t\t\t\treason._tag === \"Fail\"\n\t\t\t\t\t? Cause.makeDieReason(reason.error).annotate(\n\t\t\t\t\t\t\tCause.reasonAnnotations(reason),\n\t\t\t\t\t\t)\n\t\t\t\t\t: reason,\n\t\t\t]\n\t\t}),\n\t)\n\n/** Assembly children close before the entry reports their cleanup as its own result. */\nexport const children = Effect.acquireRelease(Scope.make(), (scope, exit) =>\n\tRelease.close(scope, exit).pipe(\n\t\tEffect.catchCause((cause) => Effect.failCause(cleanupCause(cause))),\n\t),\n)\n"],"mappings":";;;;;AAKA,MAAa,gBAAgB,UAC5B,MAAM,YACL,MAAM,QAAQ,MAAM,UAAU,WAAW;CACxC,MAAM,QACL,OAAO,SAAS,SACb,OAAO,QACP,OAAO,SAAS,QACf,OAAO,SACP,KAAA;CACL,IAAI,OAAO,GAAG,KAAK,YAAY,CAAC,CAAC,KAAK,GACrC,OAAO,MAAM,IAAI,aAAa,MAAM,KAAK,CAAC,CAAC,UAAU,UACpD,MAAM,SAAS,MAAM,kBAAkB,MAAM,CAAC,CAC/C;CACD,OAAO,CACN,OAAO,SAAS,SACb,MAAM,cAAc,OAAO,KAAK,CAAC,CAAC,SAClC,MAAM,kBAAkB,MAAM,CAC/B,IACC,MACJ;AACD,CAAC,CACF;;AAGD,MAAa,WAAW,OAAO,eAAe,MAAM,KAAK,IAAI,OAAO,SACnEA,MAAc,OAAO,IAAI,CAAC,CAAC,KAC1B,OAAO,YAAY,UAAU,OAAO,UAAU,aAAa,KAAK,CAAC,CAAC,CACnE,CACD"}
1
+ {"version":3,"file":"cleanup.js","names":[],"sources":["../../src/internal/cleanup.ts"],"sourcesContent":["import { Array, Cause, Effect, Schema, Scope } from \"effect\"\n\nimport { Fork } from \"@graftland/graft\"\nimport * as Release from \"@graftland/graft/Release\"\n\n/** Finalizers have no typed failure channel. Keep reasons and their annotations flat. */\nexport const cleanupCause = (cause: Cause.Cause<unknown>): Cause.Cause<never> =>\n\tCause.fromReasons(\n\t\tArray.flatMap(cause.reasons, (reason) => {\n\t\t\tconst error =\n\t\t\t\treason._tag === \"Fail\"\n\t\t\t\t\t? reason.error\n\t\t\t\t\t: reason._tag === \"Die\"\n\t\t\t\t\t\t? reason.defect\n\t\t\t\t\t\t: undefined\n\t\t\tif (Schema.is(Fork.CleanupError)(error))\n\t\t\t\treturn Array.map(cleanupCause(error.cause).reasons, (inner) =>\n\t\t\t\t\tinner.annotate(Cause.reasonAnnotations(reason)),\n\t\t\t\t)\n\t\t\treturn [\n\t\t\t\treason._tag === \"Fail\"\n\t\t\t\t\t? Cause.makeDieReason(reason.error).annotate(\n\t\t\t\t\t\t\tCause.reasonAnnotations(reason),\n\t\t\t\t\t\t)\n\t\t\t\t\t: reason,\n\t\t\t]\n\t\t}),\n\t)\n\n/** Assembly children close before the entry reports their cleanup as its own result. */\nexport const children = Effect.acquireRelease(Scope.make(), (scope, exit) =>\n\tRelease.close(scope, exit).pipe(\n\t\tEffect.catchCause((cause) => Effect.failCause(cleanupCause(cause))),\n\t),\n)\n"],"mappings":";;;;;AAMA,MAAa,gBAAgB,UAC5B,MAAM,YACL,MAAM,QAAQ,MAAM,UAAU,WAAW;CACxC,MAAM,QACL,OAAO,SAAS,SACb,OAAO,QACP,OAAO,SAAS,QACf,OAAO,SACP,KAAA;CACL,IAAI,OAAO,GAAG,KAAK,YAAY,CAAC,CAAC,KAAK,GACrC,OAAO,MAAM,IAAI,aAAa,MAAM,KAAK,CAAC,CAAC,UAAU,UACpD,MAAM,SAAS,MAAM,kBAAkB,MAAM,CAAC,CAC/C;CACD,OAAO,CACN,OAAO,SAAS,SACb,MAAM,cAAc,OAAO,KAAK,CAAC,CAAC,SAClC,MAAM,kBAAkB,MAAM,CAC/B,IACC,MACJ;AACD,CAAC,CACF;;AAGD,MAAa,WAAW,OAAO,eAAe,MAAM,KAAK,IAAI,OAAO,SACnE,QAAQ,MAAM,OAAO,IAAI,CAAC,CAAC,KAC1B,OAAO,YAAY,UAAU,OAAO,UAAU,aAAa,KAAK,CAAC,CAAC,CACnE,CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"contract.js","names":["Contract.UndeclaredFailure","Control.make"],"sources":["../../src/internal/contract.ts"],"sourcesContent":["import { Cause, Schema } from \"effect\"\nimport * as Contract from \"../Contract\"\nimport { ChildFailure } from \"./childErrors\"\nimport * as Control from \"./control\"\n\n/** Control RPCs and child failures belong to the execution protocol, not the public descriptor. */\nexport const prepare = <\n\tS extends Schema.Top & {\n\t\treadonly Encoded: Schema.Json\n\t\treadonly DecodingServices: never\n\t\treadonly EncodingServices: never\n\t},\n\tE extends Schema.Top & {\n\t\treadonly DecodingServices: never\n\t\treadonly EncodingServices: never\n\t},\n>(\n\tcontract: Contract.Contract<S, E>,\n) => {\n\tconst failure = Schema.Union([\n\t\tcontract.error,\n\t\tContract.UndeclaredFailure,\n\t\tChildFailure,\n\t])\n\tconst codec = Schema.toCodecJson(\n\t\tSchema.Cause(failure, Schema.Defect({ includeStack: true })),\n\t)\n\tconst declared = Schema.is(failure)\n\tconst normalizeCause = (cause: Cause.Cause<unknown>) =>\n\t\tCause.map(cause, (error) =>\n\t\t\tdeclared(error)\n\t\t\t\t? error\n\t\t\t\t: Contract.UndeclaredFailure.make({ original: error }),\n\t\t)\n\treturn {\n\t\t...contract,\n\t\tcontrol: Control.make(codec),\n\t\tnormalizeCause,\n\t\tencodeCause: (cause: Cause.Cause<unknown>) =>\n\t\t\tnormalizeCause(cause).pipe(Schema.encodeEffect(codec)),\n\t\tdecodeCause: Schema.decodeUnknownEffect(codec),\n\t}\n}\n\nexport type RunnerContract = ReturnType<\n\ttypeof prepare<Schema.Codec<unknown, Schema.Json>, Schema.Codec<unknown>>\n>\n"],"mappings":";;;;;;AAMA,MAAa,WAWZ,aACI;CACJ,MAAM,UAAU,OAAO,MAAM;EAC5B,SAAS;EACTA;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,YACpB,OAAO,MAAM,SAAS,OAAO,OAAO,EAAE,cAAc,KAAK,CAAC,CAAC,CAC5D;CACA,MAAM,WAAW,OAAO,GAAG,OAAO;CAClC,MAAM,kBAAkB,UACvB,MAAM,IAAI,QAAQ,UACjB,SAAS,KAAK,IACX,QAAA,kBAC2B,KAAK,EAAE,UAAU,MAAM,CAAC,CACvD;CACD,OAAO;EACN,GAAG;EACH,SAASC,KAAa,KAAK;EAC3B;EACA,cAAc,UACb,eAAe,KAAK,CAAC,CAAC,KAAK,OAAO,aAAa,KAAK,CAAC;EACtD,aAAa,OAAO,oBAAoB,KAAK;CAC9C;AACD"}
1
+ {"version":3,"file":"contract.js","names":["Contract.UndeclaredFailure","Control.make"],"sources":["../../src/internal/contract.ts"],"sourcesContent":["import { Cause, Schema } from \"effect\"\n\nimport * as Contract from \"../Contract\"\nimport { ChildFailure } from \"./childErrors\"\nimport * as Control from \"./control\"\n\n/** Control RPCs and child failures belong to the execution protocol, not the public descriptor. */\nexport const prepare = <\n\tS extends Schema.Top & {\n\t\treadonly Encoded: Schema.Json\n\t\treadonly DecodingServices: never\n\t\treadonly EncodingServices: never\n\t},\n\tE extends Schema.Top & {\n\t\treadonly DecodingServices: never\n\t\treadonly EncodingServices: never\n\t},\n>(\n\tcontract: Contract.Contract<S, E>,\n) => {\n\tconst failure = Schema.Union([\n\t\tcontract.error,\n\t\tContract.UndeclaredFailure,\n\t\tChildFailure,\n\t])\n\tconst codec = Schema.toCodecJson(\n\t\tSchema.Cause(failure, Schema.Defect({ includeStack: true })),\n\t)\n\tconst declared = Schema.is(failure)\n\tconst normalizeCause = (cause: Cause.Cause<unknown>) =>\n\t\tCause.map(cause, (error) =>\n\t\t\tdeclared(error)\n\t\t\t\t? error\n\t\t\t\t: Contract.UndeclaredFailure.make({ original: error }),\n\t\t)\n\treturn {\n\t\t...contract,\n\t\tcontrol: Control.make(codec),\n\t\tnormalizeCause,\n\t\tencodeCause: (cause: Cause.Cause<unknown>) =>\n\t\t\tnormalizeCause(cause).pipe(Schema.encodeEffect(codec)),\n\t\tdecodeCause: Schema.decodeUnknownEffect(codec),\n\t}\n}\n\nexport type RunnerContract = ReturnType<\n\ttypeof prepare<Schema.Codec<unknown, Schema.Json>, Schema.Codec<unknown>>\n>\n"],"mappings":";;;;;;AAOA,MAAa,WAWZ,aACI;CACJ,MAAM,UAAU,OAAO,MAAM;EAC5B,SAAS;EACTA;EACA;CACD,CAAC;CACD,MAAM,QAAQ,OAAO,YACpB,OAAO,MAAM,SAAS,OAAO,OAAO,EAAE,cAAc,KAAK,CAAC,CAAC,CAC5D;CACA,MAAM,WAAW,OAAO,GAAG,OAAO;CAClC,MAAM,kBAAkB,UACvB,MAAM,IAAI,QAAQ,UACjB,SAAS,KAAK,IACX,QAAA,kBAC2B,KAAK,EAAE,UAAU,MAAM,CAAC,CACvD;CACD,OAAO;EACN,GAAG;EACH,SAASC,KAAa,KAAK;EAC3B;EACA,cAAc,UACb,eAAe,KAAK,CAAC,CAAC,KAAK,OAAO,aAAa,KAAK,CAAC;EACtD,aAAa,OAAO,oBAAoB,KAAK;CAC9C;AACD"}
@@ -1,7 +1,8 @@
1
1
  import { ClientCertificate } from "../Auth.js";
2
- import { Connect as Connect$1 } from "./entryConfig.js";
3
- import { Graft, Plugin } from "@graftland/graft";
2
+ import { Connect as Connect$1 } from "../Config.js";
3
+ import "./entryConfig.js";
4
4
  import { Effect, Redacted, Scope } from "effect";
5
+ import { Graft, Plugin } from "@graftland/graft";
5
6
  export type Source<A, D extends ReadonlyArray<Plugin.Dependency>, E = unknown> = Effect.Effect<A, E, Scope.Scope> | {
6
7
  readonly inject: D;
7
8
  readonly read: Effect.Effect<A, unknown, NoInfer<Plugin.Required<D>> | Scope.Scope>;
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.d.ts","names":[],"sources":["../../src/internal/credentials.ts"],"mappings":";;;;YAOY,OAAO,GAAG,UAAU,cAAc,OAAO,aAAa,eAC/D,OAAO,OAAO,GAAG,GAAG,MAAM;WAEjB,QAAQ;WACR,MAAM,OAAO,OACrB,YAEA,QAAQ,OAAO,SAAS,MAAM,MAAM;;;YAI5B,MAAM,UAAU,cAAc,OAAO;WAC5B;IAAiB,OAAO,SAAS,kBAAkB;;YAE5D,eAAe,UAAU,cAAc,OAAO;WAC5C;WAAuB;;WACvB;aAAiB;;;WAEnB;aACK;aAAuB;MAClC,OAAO,mBAAmB;;WAElB;aAAmB,OAAO,MAAM;;;WAChC;aAAgB,OAAO,MAAM;;;YAC/B,QAAQ,UAAU,cAAc,OAAO,oCACrB,UAAA,uBAAsB,KAChD;WACa;;WACA;;WACA,SAAS;IACrB,IACA,KAAK;WAAwB,OAAO,eAAe"}
1
+ {"version":3,"file":"credentials.d.ts","names":[],"sources":["../../src/internal/credentials.ts"],"mappings":";;;;;YASY,OAAO,GAAG,UAAU,cAAc,OAAO,aAAa,eAC/D,OAAO,OAAO,GAAG,GAAG,MAAM;WAEjB,QAAQ;WACR,MAAM,OAAO,OACrB,YAEA,QAAQ,OAAO,SAAS,MAAM,MAAM;;;YAI5B,MAAM,UAAU,cAAc,OAAO;WAC5B;IAAiB,OAAO,SAAS,kBAAkB;;YAE5D,eAAe,UAAU,cAAc,OAAO;WAC5C;WAAuB;;WACvB;aAAiB;;;WAEnB;aACK;aAAuB;MAClC,OAAO,mBAAmB;;WAElB;aAAmB,OAAO,MAAM;;;WAChC;aAAgB,OAAO,MAAM;;;YAC/B,QAAQ,UAAU,cAAc,OAAO,oCACrB,UAAA,uBAAsB,KAChD;WACa;;WACA;;WACA,SAAS;IACrB,IACA,KAAK;WAAwB,OAAO,eAAe"}
@@ -1,8 +1,8 @@
1
1
  import { Credentials } from "../Auth.js";
2
2
  import { CredentialsError } from "../Errors.js";
3
3
  import { prepare } from "./auth/token.js";
4
- import { Graft, Plugin } from "@graftland/graft";
5
4
  import { Cause, Context, Effect, Scope } from "effect";
5
+ import { Graft, Plugin } from "@graftland/graft";
6
6
  // src/internal/credentials.ts
7
7
  const provider = (source, encode) => {
8
8
  const input = Effect.isEffect(source) ? {
@@ -1 +1 @@
1
- {"version":3,"file":"credentials.js","names":[],"sources":["../../src/internal/credentials.ts"],"sourcesContent":["import { Graft, Plugin } from \"@graftland/graft\"\nimport { Cause, Context, Effect, Redacted, Scope } from \"effect\"\nimport { Credentials, type ClientCertificate, type Prepared } from \"../Auth\"\nimport { CredentialsError } from \"../Errors\"\nimport { prepare } from \"./auth/token\"\nimport type * as Configuration from \"./entryConfig\"\n\nexport type Source<A, D extends ReadonlyArray<Plugin.Dependency>, E = unknown> =\n\t| Effect.Effect<A, E, Scope.Scope>\n\t| {\n\t\t\treadonly inject: D\n\t\t\treadonly read: Effect.Effect<\n\t\t\t\tA,\n\t\t\t\tunknown,\n\t\t\t\tNoInfer<Plugin.Required<D>> | Scope.Scope\n\t\t\t>\n\t }\n/** A token value, a file, or a credential effect with declared dependencies. */\nexport type Token<D extends ReadonlyArray<Plugin.Dependency>> =\n\tstring | { readonly file: string } | Source<Redacted.Redacted<string>, D>\n/** Authentication configuration shared by TypeScript connection descriptions. */\nexport type Authentication<D extends ReadonlyArray<Plugin.Dependency>> =\n\t| { readonly name: string; readonly config?: unknown }\n\t| { readonly none: { readonly identity?: string } }\n\t| {\n\t\t\treadonly mtls:\n\t\t\t\t| { readonly cert: string; readonly key: string }\n\t\t\t\t| Source<ClientCertificate, D>\n\t }\n\t| { readonly bearer: { readonly token: Token<D> } }\n\t| { readonly jwt: { readonly token: Token<D> } }\nexport type Connect<D extends ReadonlyArray<Plugin.Dependency> = readonly []> =\n\ttypeof Configuration.Connect.Encoded extends infer C\n\t\t? C extends\n\t\t\t\t| { readonly local: object }\n\t\t\t\t| { readonly worker: object }\n\t\t\t\t| { readonly command: ReadonlyArray<string> }\n\t\t\t? C\n\t\t\t: Omit<C, \"auth\"> & { readonly auth?: Authentication<D> }\n\t\t: never\n\nconst provider = <A, E, D extends ReadonlyArray<Plugin.Dependency>>(\n\tsource: Source<A, D, E>,\n\tencode: (\n\t\tread: Effect.Effect<A, CredentialsError, Scope.Scope>,\n\t) => typeof Credentials.Service,\n) => {\n\tconst input = Effect.isEffect(source) ? { inject: [], read: source } : source\n\treturn Plugin.make({\n\t\tname: \"remote-effect-credentials\",\n\t\tinject: input.inject,\n\t\tapply: Effect.fnUntraced(function* () {\n\t\t\t// Restore the provider's context without replacing each read's owning scope.\n\t\t\tconst context = yield* Effect.context<\n\t\t\t\tPlugin.Required<D> | Scope.Scope\n\t\t\t>().pipe(Effect.map(Context.omit(Scope.Scope)))\n\t\t\tconst read = input.read.pipe(\n\t\t\t\tEffect.provideContext(context),\n\t\t\t\tEffect.mapError((error) =>\n\t\t\t\t\tCredentialsError.make({ cause: Cause.fail(error) }),\n\t\t\t\t),\n\t\t\t)\n\t\t\tyield* Graft.provide(Credentials, encode(read))\n\t\t}),\n\t})\n}\nexport const invocation = <D extends ReadonlyArray<Plugin.Dependency>>(\n\tconnect: Connect<D>,\n) => {\n\tconst auth = connect.auth\n\tif (auth === undefined) return undefined\n\tif (\"mtls\" in auth) {\n\t\tconst source = auth.mtls\n\t\tif (Effect.isEffect(source) || \"read\" in source)\n\t\t\treturn {\n\t\t\t\tplugin: provider(source, (read) => ({\n\t\t\t\t\tkind: \"Certificate\",\n\t\t\t\t\tread: read.pipe(\n\t\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t\t(value): Extract<Prepared, { readonly _tag: \"Certificate\" }> => ({\n\t\t\t\t\t\t\t\t_tag: \"Certificate\",\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t})),\n\t\t\t\tconfig: undefined,\n\t\t\t}\n\t}\n\tif (\"bearer\" in auth || \"jwt\" in auth) {\n\t\tconst source = \"bearer\" in auth ? auth.bearer.token : auth.jwt.token\n\t\tif (\n\t\t\ttypeof source !== \"string\" &&\n\t\t\t(Effect.isEffect(source) || \"read\" in source)\n\t\t)\n\t\t\treturn {\n\t\t\t\tplugin: provider(source, (read) => ({\n\t\t\t\t\tkind: \"Authorization\",\n\t\t\t\t\tread: read.pipe(\n\t\t\t\t\t\tEffect.flatMap(prepare),\n\t\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t): Extract<Prepared, { readonly _tag: \"Authorization\" }> => ({\n\t\t\t\t\t\t\t\t_tag: \"Authorization\",\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t})),\n\t\t\t\tconfig: undefined,\n\t\t\t}\n\t}\n\treturn undefined\n}\n"],"mappings":";;;;;;AAyCA,MAAM,YACL,QACA,WAGI;CACJ,MAAM,QAAQ,OAAO,SAAS,MAAM,IAAI;EAAE,QAAQ,CAAC;EAAG,MAAM;CAAO,IAAI;CACvE,OAAO,OAAO,KAAK;EAClB,MAAM;EACN,QAAQ,MAAM;EACd,OAAO,OAAO,WAAW,aAAa;GAErC,MAAM,UAAU,OAAO,OAAO,QAE5B,CAAC,CAAC,KAAK,OAAO,IAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,CAAC;GAC9C,MAAM,OAAO,MAAM,KAAK,KACvB,OAAO,eAAe,OAAO,GAC7B,OAAO,UAAU,UAChB,iBAAiB,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACnD,CACD;GACA,OAAO,MAAM,QAAQ,aAAa,OAAO,IAAI,CAAC;EAC/C,CAAC;CACF,CAAC;AACF;AACA,MAAa,cACZ,YACI;CACJ,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,IAAI,UAAU,MAAM;EACnB,MAAM,SAAS,KAAK;EACpB,IAAI,OAAO,SAAS,MAAM,KAAK,UAAU,QACxC,OAAO;GACN,QAAQ,SAAS,SAAS,UAAU;IACnC,MAAM;IACN,MAAM,KAAK,KACV,OAAO,KACL,WAAgE;KAChE,MAAM;KACN;IACD,EACD,CACD;GACD,EAAE;GACF,QAAQ,KAAA;EACT;CACF;CACA,IAAI,YAAY,QAAQ,SAAS,MAAM;EACtC,MAAM,SAAS,YAAY,OAAO,KAAK,OAAO,QAAQ,KAAK,IAAI;EAC/D,IACC,OAAO,WAAW,aACjB,OAAO,SAAS,MAAM,KAAK,UAAU,SAEtC,OAAO;GACN,QAAQ,SAAS,SAAS,UAAU;IACnC,MAAM;IACN,MAAM,KAAK,KACV,OAAO,QAAQ,OAAO,GACtB,OAAO,KAEL,WAC4D;KAC5D,MAAM;KACN;IACD,EACD,CACD;GACD,EAAE;GACF,QAAQ,KAAA;EACT;CACF;AAED"}
1
+ {"version":3,"file":"credentials.js","names":[],"sources":["../../src/internal/credentials.ts"],"sourcesContent":["import { Cause, Context, Effect, Redacted, Scope } from \"effect\"\n\nimport { Graft, Plugin } from \"@graftland/graft\"\n\nimport { Credentials, type ClientCertificate, type Prepared } from \"../Auth\"\nimport { CredentialsError } from \"../Errors\"\nimport { prepare } from \"./auth/token\"\nimport type * as Configuration from \"./entryConfig\"\n\nexport type Source<A, D extends ReadonlyArray<Plugin.Dependency>, E = unknown> =\n\t| Effect.Effect<A, E, Scope.Scope>\n\t| {\n\t\t\treadonly inject: D\n\t\t\treadonly read: Effect.Effect<\n\t\t\t\tA,\n\t\t\t\tunknown,\n\t\t\t\tNoInfer<Plugin.Required<D>> | Scope.Scope\n\t\t\t>\n\t }\n/** A token value, a file, or a credential effect with declared dependencies. */\nexport type Token<D extends ReadonlyArray<Plugin.Dependency>> =\n\tstring | { readonly file: string } | Source<Redacted.Redacted<string>, D>\n/** Authentication configuration shared by TypeScript connection descriptions. */\nexport type Authentication<D extends ReadonlyArray<Plugin.Dependency>> =\n\t| { readonly name: string; readonly config?: unknown }\n\t| { readonly none: { readonly identity?: string } }\n\t| {\n\t\t\treadonly mtls:\n\t\t\t\t| { readonly cert: string; readonly key: string }\n\t\t\t\t| Source<ClientCertificate, D>\n\t }\n\t| { readonly bearer: { readonly token: Token<D> } }\n\t| { readonly jwt: { readonly token: Token<D> } }\nexport type Connect<D extends ReadonlyArray<Plugin.Dependency> = readonly []> =\n\ttypeof Configuration.Connect.Encoded extends infer C\n\t\t? C extends\n\t\t\t\t| { readonly local: object }\n\t\t\t\t| { readonly worker: object }\n\t\t\t\t| { readonly command: ReadonlyArray<string> }\n\t\t\t? C\n\t\t\t: Omit<C, \"auth\"> & { readonly auth?: Authentication<D> }\n\t\t: never\n\nconst provider = <A, E, D extends ReadonlyArray<Plugin.Dependency>>(\n\tsource: Source<A, D, E>,\n\tencode: (\n\t\tread: Effect.Effect<A, CredentialsError, Scope.Scope>,\n\t) => typeof Credentials.Service,\n) => {\n\tconst input = Effect.isEffect(source) ? { inject: [], read: source } : source\n\treturn Plugin.make({\n\t\tname: \"remote-effect-credentials\",\n\t\tinject: input.inject,\n\t\tapply: Effect.fnUntraced(function* () {\n\t\t\t// Restore the provider's context without replacing each read's owning scope.\n\t\t\tconst context = yield* Effect.context<\n\t\t\t\tPlugin.Required<D> | Scope.Scope\n\t\t\t>().pipe(Effect.map(Context.omit(Scope.Scope)))\n\t\t\tconst read = input.read.pipe(\n\t\t\t\tEffect.provideContext(context),\n\t\t\t\tEffect.mapError((error) =>\n\t\t\t\t\tCredentialsError.make({ cause: Cause.fail(error) }),\n\t\t\t\t),\n\t\t\t)\n\t\t\tyield* Graft.provide(Credentials, encode(read))\n\t\t}),\n\t})\n}\nexport const invocation = <D extends ReadonlyArray<Plugin.Dependency>>(\n\tconnect: Connect<D>,\n) => {\n\tconst auth = connect.auth\n\tif (auth === undefined) return undefined\n\tif (\"mtls\" in auth) {\n\t\tconst source = auth.mtls\n\t\tif (Effect.isEffect(source) || \"read\" in source)\n\t\t\treturn {\n\t\t\t\tplugin: provider(source, (read) => ({\n\t\t\t\t\tkind: \"Certificate\",\n\t\t\t\t\tread: read.pipe(\n\t\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t\t(value): Extract<Prepared, { readonly _tag: \"Certificate\" }> => ({\n\t\t\t\t\t\t\t\t_tag: \"Certificate\",\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t})),\n\t\t\t\tconfig: undefined,\n\t\t\t}\n\t}\n\tif (\"bearer\" in auth || \"jwt\" in auth) {\n\t\tconst source = \"bearer\" in auth ? auth.bearer.token : auth.jwt.token\n\t\tif (\n\t\t\ttypeof source !== \"string\" &&\n\t\t\t(Effect.isEffect(source) || \"read\" in source)\n\t\t)\n\t\t\treturn {\n\t\t\t\tplugin: provider(source, (read) => ({\n\t\t\t\t\tkind: \"Authorization\",\n\t\t\t\t\tread: read.pipe(\n\t\t\t\t\t\tEffect.flatMap(prepare),\n\t\t\t\t\t\tEffect.map(\n\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t): Extract<Prepared, { readonly _tag: \"Authorization\" }> => ({\n\t\t\t\t\t\t\t\t_tag: \"Authorization\",\n\t\t\t\t\t\t\t\tvalue,\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\t})),\n\t\t\t\tconfig: undefined,\n\t\t\t}\n\t}\n\treturn undefined\n}\n"],"mappings":";;;;;;AA2CA,MAAM,YACL,QACA,WAGI;CACJ,MAAM,QAAQ,OAAO,SAAS,MAAM,IAAI;EAAE,QAAQ,CAAC;EAAG,MAAM;CAAO,IAAI;CACvE,OAAO,OAAO,KAAK;EAClB,MAAM;EACN,QAAQ,MAAM;EACd,OAAO,OAAO,WAAW,aAAa;GAErC,MAAM,UAAU,OAAO,OAAO,QAE5B,CAAC,CAAC,KAAK,OAAO,IAAI,QAAQ,KAAK,MAAM,KAAK,CAAC,CAAC;GAC9C,MAAM,OAAO,MAAM,KAAK,KACvB,OAAO,eAAe,OAAO,GAC7B,OAAO,UAAU,UAChB,iBAAiB,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACnD,CACD;GACA,OAAO,MAAM,QAAQ,aAAa,OAAO,IAAI,CAAC;EAC/C,CAAC;CACF,CAAC;AACF;AACA,MAAa,cACZ,YACI;CACJ,MAAM,OAAO,QAAQ;CACrB,IAAI,SAAS,KAAA,GAAW,OAAO,KAAA;CAC/B,IAAI,UAAU,MAAM;EACnB,MAAM,SAAS,KAAK;EACpB,IAAI,OAAO,SAAS,MAAM,KAAK,UAAU,QACxC,OAAO;GACN,QAAQ,SAAS,SAAS,UAAU;IACnC,MAAM;IACN,MAAM,KAAK,KACV,OAAO,KACL,WAAgE;KAChE,MAAM;KACN;IACD,EACD,CACD;GACD,EAAE;GACF,QAAQ,KAAA;EACT;CACF;CACA,IAAI,YAAY,QAAQ,SAAS,MAAM;EACtC,MAAM,SAAS,YAAY,OAAO,KAAK,OAAO,QAAQ,KAAK,IAAI;EAC/D,IACC,OAAO,WAAW,aACjB,OAAO,SAAS,MAAM,KAAK,UAAU,SAEtC,OAAO;GACN,QAAQ,SAAS,SAAS,UAAU;IACnC,MAAM;IACN,MAAM,KAAK,KACV,OAAO,QAAQ,OAAO,GACtB,OAAO,KAEL,WAC4D;KAC5D,MAAM;KACN;IACD,EACD,CACD;GACD,EAAE;GACF,QAAQ,KAAA;EACT;CACF;AAED"}
@@ -1 +1 @@
1
- {"version":3,"file":"directTransport.js","names":[],"sources":["../../src/internal/directTransport.ts"],"sourcesContent":["import { Context } from \"effect\"\nimport type { Effect, Option, Scope, PlatformError } from \"effect\"\nimport type { ProcessExited, TransportError } from \"../Errors\"\nimport type { Channel } from \"../Transport\"\nexport interface LocalOptions {\n\treadonly command?: readonly [string, ...string[]]\n\treadonly contractModule: string\n\treadonly session: string\n}\nexport interface Execution {\n\treadonly channel: Channel\n\treadonly pid: Option.Option<number>\n\treadonly threadId?: number\n\treadonly exited: Effect.Effect<ProcessExited, TransportError>\n\treadonly failure: Effect.Effect<never, TransportError>\n}\nexport class LocalTransport extends Context.Service<\n\tLocalTransport,\n\t{\n\t\treadonly start: (\n\t\t\toptions: LocalOptions,\n\t\t) => Effect.Effect<Execution, PlatformError.PlatformError, Scope.Scope>\n\t}\n>()(\"@graftland/plugin-remote/internal/directTransport/LocalTransport\") {}\n\nexport interface WorkerOptions {\n\treadonly execArgv?: ReadonlyArray<string>\n\treadonly contractModule: string\n\treadonly session: string\n}\nexport class WorkerTransport extends Context.Service<\n\tWorkerTransport,\n\t{\n\t\treadonly start: (\n\t\t\toptions: WorkerOptions,\n\t\t) => Effect.Effect<Execution, TransportError, Scope.Scope>\n\t}\n>()(\"@graftland/plugin-remote/internal/directTransport/WorkerTransport\") {}\n"],"mappings":";;AAgBA,IAAa,iBAAb,cAAoC,QAAQ,QAO1C,CAAC,CAAC,kEAAkE,CAAC,CAAC,CAAC;AAOzE,IAAa,kBAAb,cAAqC,QAAQ,QAO3C,CAAC,CAAC,mEAAmE,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"directTransport.js","names":[],"sources":["../../src/internal/directTransport.ts"],"sourcesContent":["import {\n\tContext,\n\ttype Effect,\n\ttype Option,\n\ttype PlatformError,\n\ttype Scope,\n} from \"effect\"\n\nimport type { ProcessExited, TransportError } from \"../Errors\"\nimport type { Channel } from \"../Transport\"\n\nexport interface LocalOptions {\n\treadonly command?: readonly [string, ...string[]]\n\treadonly contractModule: string\n\treadonly session: string\n}\nexport interface Execution {\n\treadonly channel: Channel\n\treadonly pid: Option.Option<number>\n\treadonly threadId?: number\n\treadonly exited: Effect.Effect<ProcessExited, TransportError>\n\treadonly failure: Effect.Effect<never, TransportError>\n}\nexport class LocalTransport extends Context.Service<\n\tLocalTransport,\n\t{\n\t\treadonly start: (\n\t\t\toptions: LocalOptions,\n\t\t) => Effect.Effect<Execution, PlatformError.PlatformError, Scope.Scope>\n\t}\n>()(\"@graftland/plugin-remote/internal/directTransport/LocalTransport\") {}\n\nexport interface WorkerOptions {\n\treadonly execArgv?: ReadonlyArray<string>\n\treadonly contractModule: string\n\treadonly session: string\n}\nexport class WorkerTransport extends Context.Service<\n\tWorkerTransport,\n\t{\n\t\treadonly start: (\n\t\t\toptions: WorkerOptions,\n\t\t) => Effect.Effect<Execution, TransportError, Scope.Scope>\n\t}\n>()(\"@graftland/plugin-remote/internal/directTransport/WorkerTransport\") {}\n"],"mappings":";;AAuBA,IAAa,iBAAb,cAAoC,QAAQ,QAO1C,CAAC,CAAC,kEAAkE,CAAC,CAAC,CAAC;AAOzE,IAAa,kBAAb,cAAqC,QAAQ,QAO3C,CAAC,CAAC,mEAAmE,CAAC,CAAC,CAAC"}
@@ -3,11 +3,11 @@ import "../Contract.js";
3
3
  import { RemoteEntryError } from "../Errors.js";
4
4
  import "./directTransport.js";
5
5
  import "./execution.js";
6
- import { Fork, Graft, Plugin } from "@graftland/graft";
7
- import { ModuleResolver } from "@graftland/loader";
8
6
  import { Cause, Effect, Path, Schema, Scope } from "effect";
9
7
  import { SecureRandom } from "effect/crypto";
10
8
  import { ChildProcessSpawner } from "effect/process";
9
+ import { Fork, Graft, Plugin } from "@graftland/graft";
10
+ import { ModuleResolver } from "@graftland/loader";
11
11
  export declare const host: Plugin.Definition<{
12
12
  readonly contract: string;
13
13
  readonly connect: {
@@ -37,28 +37,41 @@ export declare const host: Plugin.Definition<{
37
37
  readonly bearer?: never;
38
38
  readonly jwt?: never;
39
39
  readonly none?: never;
40
- readonly mtls: unknown;
40
+ readonly mtls: {
41
+ readonly cert: string;
42
+ readonly key: string;
43
+ };
41
44
  } | {
42
45
  readonly name?: never;
43
46
  readonly config?: never;
44
47
  readonly mtls?: never;
45
48
  readonly jwt?: never;
46
49
  readonly none?: never;
47
- readonly bearer: unknown;
50
+ readonly bearer: {
51
+ readonly token: string | {
52
+ readonly file: string;
53
+ };
54
+ };
48
55
  } | {
49
56
  readonly name?: never;
50
57
  readonly config?: never;
51
58
  readonly mtls?: never;
52
59
  readonly bearer?: never;
53
60
  readonly none?: never;
54
- readonly jwt: unknown;
61
+ readonly jwt: {
62
+ readonly token: string | {
63
+ readonly file: string;
64
+ };
65
+ };
55
66
  } | {
56
67
  readonly name?: never;
57
68
  readonly config?: never;
58
69
  readonly mtls?: never;
59
70
  readonly bearer?: never;
60
71
  readonly jwt?: never;
61
- readonly none: unknown;
72
+ readonly none: {
73
+ readonly identity?: string;
74
+ };
62
75
  };
63
76
  readonly url: string;
64
77
  readonly ca?: string;
@@ -90,28 +103,41 @@ export declare const host: Plugin.Definition<{
90
103
  readonly bearer?: never;
91
104
  readonly jwt?: never;
92
105
  readonly none?: never;
93
- readonly mtls: unknown;
106
+ readonly mtls: {
107
+ readonly cert: string;
108
+ readonly key: string;
109
+ };
94
110
  } | {
95
111
  readonly name?: never;
96
112
  readonly config?: never;
97
113
  readonly mtls?: never;
98
114
  readonly jwt?: never;
99
115
  readonly none?: never;
100
- readonly bearer: unknown;
116
+ readonly bearer: {
117
+ readonly token: string | {
118
+ readonly file: string;
119
+ };
120
+ };
101
121
  } | {
102
122
  readonly name?: never;
103
123
  readonly config?: never;
104
124
  readonly mtls?: never;
105
125
  readonly bearer?: never;
106
126
  readonly none?: never;
107
- readonly jwt: unknown;
127
+ readonly jwt: {
128
+ readonly token: string | {
129
+ readonly file: string;
130
+ };
131
+ };
108
132
  } | {
109
133
  readonly name?: never;
110
134
  readonly config?: never;
111
135
  readonly mtls?: never;
112
136
  readonly bearer?: never;
113
137
  readonly jwt?: never;
114
- readonly none: unknown;
138
+ readonly none: {
139
+ readonly identity?: string;
140
+ };
115
141
  };
116
142
  readonly unix: string;
117
143
  } | {
@@ -183,28 +209,41 @@ export declare const host: Plugin.Definition<{
183
209
  readonly bearer?: never;
184
210
  readonly jwt?: never;
185
211
  readonly none?: never;
186
- readonly mtls: unknown;
212
+ readonly mtls: {
213
+ readonly cert: string;
214
+ readonly key: string;
215
+ };
187
216
  } | {
188
217
  readonly name?: never;
189
218
  readonly config?: never;
190
219
  readonly mtls?: never;
191
220
  readonly jwt?: never;
192
221
  readonly none?: never;
193
- readonly bearer: unknown;
222
+ readonly bearer: {
223
+ readonly token: string | {
224
+ readonly file: string;
225
+ };
226
+ };
194
227
  } | {
195
228
  readonly name?: never;
196
229
  readonly config?: never;
197
230
  readonly mtls?: never;
198
231
  readonly bearer?: never;
199
232
  readonly none?: never;
200
- readonly jwt: unknown;
233
+ readonly jwt: {
234
+ readonly token: string | {
235
+ readonly file: string;
236
+ };
237
+ };
201
238
  } | {
202
239
  readonly name?: never;
203
240
  readonly config?: never;
204
241
  readonly mtls?: never;
205
242
  readonly bearer?: never;
206
243
  readonly jwt?: never;
207
- readonly none: unknown;
244
+ readonly none: {
245
+ readonly identity?: string;
246
+ };
208
247
  };
209
248
  readonly transport: {
210
249
  readonly name: string;
@@ -241,28 +280,41 @@ export declare const host: Plugin.Definition<{
241
280
  readonly bearer?: never;
242
281
  readonly jwt?: never;
243
282
  readonly none?: never;
244
- readonly mtls: unknown;
283
+ readonly mtls: {
284
+ readonly cert: string;
285
+ readonly key: string;
286
+ };
245
287
  } | {
246
288
  readonly name?: never;
247
289
  readonly config?: never;
248
290
  readonly mtls?: never;
249
291
  readonly jwt?: never;
250
292
  readonly none?: never;
251
- readonly bearer: unknown;
293
+ readonly bearer: {
294
+ readonly token: string | {
295
+ readonly file: string;
296
+ };
297
+ };
252
298
  } | {
253
299
  readonly name?: never;
254
300
  readonly config?: never;
255
301
  readonly mtls?: never;
256
302
  readonly bearer?: never;
257
303
  readonly none?: never;
258
- readonly jwt: unknown;
304
+ readonly jwt: {
305
+ readonly token: string | {
306
+ readonly file: string;
307
+ };
308
+ };
259
309
  } | {
260
310
  readonly name?: never;
261
311
  readonly config?: never;
262
312
  readonly mtls?: never;
263
313
  readonly bearer?: never;
264
314
  readonly jwt?: never;
265
- readonly none: unknown;
315
+ readonly none: {
316
+ readonly identity?: string;
317
+ };
266
318
  };
267
319
  readonly url: string;
268
320
  readonly ca?: string;
@@ -294,28 +346,41 @@ export declare const host: Plugin.Definition<{
294
346
  readonly bearer?: never;
295
347
  readonly jwt?: never;
296
348
  readonly none?: never;
297
- readonly mtls: unknown;
349
+ readonly mtls: {
350
+ readonly cert: string;
351
+ readonly key: string;
352
+ };
298
353
  } | {
299
354
  readonly name?: never;
300
355
  readonly config?: never;
301
356
  readonly mtls?: never;
302
357
  readonly jwt?: never;
303
358
  readonly none?: never;
304
- readonly bearer: unknown;
359
+ readonly bearer: {
360
+ readonly token: string | {
361
+ readonly file: string;
362
+ };
363
+ };
305
364
  } | {
306
365
  readonly name?: never;
307
366
  readonly config?: never;
308
367
  readonly mtls?: never;
309
368
  readonly bearer?: never;
310
369
  readonly none?: never;
311
- readonly jwt: unknown;
370
+ readonly jwt: {
371
+ readonly token: string | {
372
+ readonly file: string;
373
+ };
374
+ };
312
375
  } | {
313
376
  readonly name?: never;
314
377
  readonly config?: never;
315
378
  readonly mtls?: never;
316
379
  readonly bearer?: never;
317
380
  readonly jwt?: never;
318
- readonly none: unknown;
381
+ readonly none: {
382
+ readonly identity?: string;
383
+ };
319
384
  };
320
385
  readonly unix: string;
321
386
  } | {
@@ -387,28 +452,41 @@ export declare const host: Plugin.Definition<{
387
452
  readonly bearer?: never;
388
453
  readonly jwt?: never;
389
454
  readonly none?: never;
390
- readonly mtls: unknown;
455
+ readonly mtls: {
456
+ readonly cert: string;
457
+ readonly key: string;
458
+ };
391
459
  } | {
392
460
  readonly name?: never;
393
461
  readonly config?: never;
394
462
  readonly mtls?: never;
395
463
  readonly jwt?: never;
396
464
  readonly none?: never;
397
- readonly bearer: unknown;
465
+ readonly bearer: {
466
+ readonly token: string | {
467
+ readonly file: string;
468
+ };
469
+ };
398
470
  } | {
399
471
  readonly name?: never;
400
472
  readonly config?: never;
401
473
  readonly mtls?: never;
402
474
  readonly bearer?: never;
403
475
  readonly none?: never;
404
- readonly jwt: unknown;
476
+ readonly jwt: {
477
+ readonly token: string | {
478
+ readonly file: string;
479
+ };
480
+ };
405
481
  } | {
406
482
  readonly name?: never;
407
483
  readonly config?: never;
408
484
  readonly mtls?: never;
409
485
  readonly bearer?: never;
410
486
  readonly jwt?: never;
411
- readonly none: unknown;
487
+ readonly none: {
488
+ readonly identity?: string;
489
+ };
412
490
  };
413
491
  readonly transport: {
414
492
  readonly name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"entry.d.ts","names":["EntryError"],"sources":["../../src/internal/entry.ts"],"mappings":";;;;;;;;;;qBAuQa,MAAI,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAUfA,mBAAA,OAAA"}
1
+ {"version":3,"file":"entry.d.ts","names":["EntryError"],"sources":["../../src/internal/entry.ts"],"mappings":";;;;;;;;;;qBA4Sa,MAAI,OAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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