@graftland/plugin-remote 0.3.2 → 0.4.0

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 (326) 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 +9 -1
  27. package/dist/host/auth/bearer.d.ts.map +1 -1
  28. package/dist/host/auth/bearer.js +4 -2
  29. package/dist/host/auth/bearer.js.map +1 -1
  30. package/dist/host/auth/jwt.d.ts +9 -1
  31. package/dist/host/auth/jwt.d.ts.map +1 -1
  32. package/dist/host/auth/jwt.js +4 -2
  33. package/dist/host/auth/jwt.js.map +1 -1
  34. package/dist/host/auth/mtls.d.ts +10 -7
  35. package/dist/host/auth/mtls.d.ts.map +1 -1
  36. package/dist/host/auth/mtls.js +13 -14
  37. package/dist/host/auth/mtls.js.map +1 -1
  38. package/dist/host/auth/none.d.ts +3 -1
  39. package/dist/host/auth/none.js +7 -5
  40. package/dist/host/auth/none.js.map +1 -1
  41. package/dist/host/command.d.ts +14 -1
  42. package/dist/host/command.d.ts.map +1 -1
  43. package/dist/host/command.js +11 -9
  44. package/dist/host/command.js.map +1 -1
  45. package/dist/host/local.d.ts +2 -1
  46. package/dist/host/local.d.ts.map +1 -1
  47. package/dist/host/local.js +9 -30
  48. package/dist/host/local.js.map +1 -1
  49. package/dist/host/unix.d.ts +6 -1
  50. package/dist/host/unix.d.ts.map +1 -1
  51. package/dist/host/unix.js +13 -9
  52. package/dist/host/unix.js.map +1 -1
  53. package/dist/host/websocket.d.ts +10 -1
  54. package/dist/host/websocket.d.ts.map +1 -1
  55. package/dist/host/websocket.js +11 -8
  56. package/dist/host/websocket.js.map +1 -1
  57. package/dist/host/worker.d.ts +3 -1
  58. package/dist/host/worker.d.ts.map +1 -1
  59. package/dist/host/worker.js +13 -9
  60. package/dist/host/worker.js.map +1 -1
  61. package/dist/index.d.ts +6 -8
  62. package/dist/index.d.ts.map +1 -1
  63. package/dist/index.js +30 -64
  64. package/dist/index.js.map +1 -1
  65. package/dist/internal/Certificates.js.map +1 -1
  66. package/dist/internal/FailureGroup.js +6 -6
  67. package/dist/internal/FailureGroup.js.map +1 -1
  68. package/dist/internal/Peer.js.map +1 -1
  69. package/dist/internal/{ServeLifecycle.js → RunnerLifecycle.js} +6 -6
  70. package/dist/internal/RunnerLifecycle.js.map +1 -0
  71. package/dist/internal/Supervisor.js.map +1 -1
  72. package/dist/internal/assembly.d.ts +3 -2
  73. package/dist/internal/assembly.js +8 -8
  74. package/dist/internal/assembly.js.map +1 -1
  75. package/dist/internal/auth/config.d.ts +27 -0
  76. package/dist/internal/auth/config.d.ts.map +1 -0
  77. package/dist/internal/auth/config.js +29 -0
  78. package/dist/internal/auth/config.js.map +1 -0
  79. package/dist/internal/auth/mtls.js.map +1 -1
  80. package/dist/internal/auth/token.js.map +1 -1
  81. package/dist/internal/auth/tokenCredentials.d.ts +2 -1
  82. package/dist/internal/auth/tokenCredentials.d.ts.map +1 -1
  83. package/dist/internal/auth/tokenCredentials.js +1 -1
  84. package/dist/internal/auth/tokenCredentials.js.map +1 -1
  85. package/dist/internal/child.js +3 -3
  86. package/dist/internal/child.js.map +1 -1
  87. package/dist/internal/childMain.js +47 -0
  88. package/dist/internal/childMain.js.map +1 -0
  89. package/dist/internal/childRuntime.js +8 -8
  90. package/dist/internal/childRuntime.js.map +1 -1
  91. package/dist/internal/cleanup.js +3 -3
  92. package/dist/internal/cleanup.js.map +1 -1
  93. package/dist/internal/contract.js.map +1 -1
  94. package/dist/internal/credentials.d.ts +3 -2
  95. package/dist/internal/credentials.d.ts.map +1 -1
  96. package/dist/internal/credentials.js +1 -1
  97. package/dist/internal/credentials.js.map +1 -1
  98. package/dist/internal/directTransport.js.map +1 -1
  99. package/dist/internal/entry.d.ts +493 -3
  100. package/dist/internal/entry.d.ts.map +1 -1
  101. package/dist/internal/entry.js +22 -9
  102. package/dist/internal/entry.js.map +1 -1
  103. package/dist/internal/entryConfig.d.ts +2 -202
  104. package/dist/internal/entryConfig.js +2 -136
  105. package/dist/internal/entryConfig.js.map +1 -1
  106. package/dist/internal/execution.d.ts +4 -4
  107. package/dist/internal/execution.js +11 -11
  108. package/dist/internal/execution.js.map +1 -1
  109. package/dist/internal/follow.js +1 -1
  110. package/dist/internal/follow.js.map +1 -1
  111. package/dist/internal/forkTree.js.map +1 -1
  112. package/dist/internal/host/local.js.map +1 -1
  113. package/dist/internal/host/runner.js +4 -4
  114. package/dist/internal/host/runner.js.map +1 -1
  115. package/dist/internal/host.js +2 -2
  116. package/dist/internal/host.js.map +1 -1
  117. package/dist/internal/importer.js +1 -1
  118. package/dist/internal/importer.js.map +1 -1
  119. package/dist/internal/listenerStartup.js +1 -1
  120. package/dist/internal/listenerStartup.js.map +1 -1
  121. package/dist/internal/loadModule.js.map +1 -1
  122. package/dist/internal/platform.js +1 -9
  123. package/dist/internal/port.d.ts +1 -1
  124. package/dist/internal/port.js +2 -2
  125. package/dist/internal/port.js.map +1 -1
  126. package/dist/internal/runner/Bootstrap.js.map +1 -1
  127. package/dist/internal/runner/Connection.d.ts +3 -2
  128. package/dist/internal/runner/Connection.js +6 -6
  129. package/dist/internal/runner/Connection.js.map +1 -1
  130. package/dist/internal/runner/Execution.js +6 -6
  131. package/dist/internal/runner/Execution.js.map +1 -1
  132. package/dist/internal/runner/Local.js +1 -1
  133. package/dist/internal/runner/Local.js.map +1 -1
  134. package/dist/internal/runner/Lock.js.map +1 -1
  135. package/dist/internal/runner/Multiplex.js.map +1 -1
  136. package/dist/internal/runner/Packages.js.map +1 -1
  137. package/dist/internal/runner/ProcessObservation.js.map +1 -1
  138. package/dist/internal/runner/Processes.js.map +1 -1
  139. package/dist/internal/runner/Retention.js.map +1 -1
  140. package/dist/internal/runner/Store.js.map +1 -1
  141. package/dist/internal/runner/Supervisor.js +5 -5
  142. package/dist/internal/runner/Supervisor.js.map +1 -1
  143. package/dist/internal/runner/Watchdog.js.map +1 -1
  144. package/dist/internal/runner/Wire.d.ts +1 -1
  145. package/dist/internal/runner/Wire.js.map +1 -1
  146. package/dist/internal/runner/accept.js +2 -2
  147. package/dist/internal/runner/accept.js.map +1 -1
  148. package/dist/internal/runner/command.js +1 -1
  149. package/dist/internal/runner/command.js.map +1 -1
  150. package/dist/internal/runner/connectionEnded.js +1 -1
  151. package/dist/internal/runner/connectionEnded.js.map +1 -1
  152. package/dist/internal/runner/model.d.ts.map +1 -1
  153. package/dist/internal/runner/model.js.map +1 -1
  154. package/dist/internal/services.d.ts.map +1 -1
  155. package/dist/internal/services.js +1 -1
  156. package/dist/internal/services.js.map +1 -1
  157. package/dist/internal/socketChannel.js.map +1 -1
  158. package/dist/internal/stdioChannel.js.map +1 -1
  159. package/dist/internal/supervisorPlugin.js +48 -1
  160. package/dist/internal/supervisorPlugin.js.map +1 -1
  161. package/dist/internal/transportOptions.d.ts.map +1 -1
  162. package/dist/internal/watchdogMain.js +5 -3
  163. package/dist/internal/watchdogMain.js.map +1 -1
  164. package/dist/internal/websocket.js.map +1 -1
  165. package/dist/internal/websocketServer.js +1 -1
  166. package/dist/internal/websocketServer.js.map +1 -1
  167. package/dist/internal/workerChannel.js.map +1 -1
  168. package/dist/internal/workerMain.js +13 -6
  169. package/dist/internal/workerMain.js.map +1 -1
  170. package/dist/runner/auth/bearer.d.ts +8 -5
  171. package/dist/runner/auth/bearer.d.ts.map +1 -1
  172. package/dist/runner/auth/bearer.js +13 -11
  173. package/dist/runner/auth/bearer.js.map +1 -1
  174. package/dist/runner/auth/jwt.d.ts +30 -17
  175. package/dist/runner/auth/jwt.d.ts.map +1 -1
  176. package/dist/runner/auth/jwt.js +16 -28
  177. package/dist/runner/auth/jwt.js.map +1 -1
  178. package/dist/runner/auth/mtls.d.ts +8 -6
  179. package/dist/runner/auth/mtls.d.ts.map +1 -1
  180. package/dist/runner/auth/mtls.js +13 -29
  181. package/dist/runner/auth/mtls.js.map +1 -1
  182. package/dist/runner/auth/none.d.ts +7 -1
  183. package/dist/runner/auth/none.js +7 -5
  184. package/dist/runner/auth/none.js.map +1 -1
  185. package/dist/runner/index.d.ts +5 -1
  186. package/dist/runner/index.d.ts.map +1 -1
  187. package/dist/runner/index.js +62 -30
  188. package/dist/runner/index.js.map +1 -1
  189. package/dist/runner/stdio.d.ts +6 -1
  190. package/dist/runner/stdio.d.ts.map +1 -1
  191. package/dist/runner/stdio.js +11 -9
  192. package/dist/runner/stdio.js.map +1 -1
  193. package/dist/runner/unix.d.ts +6 -1
  194. package/dist/runner/unix.d.ts.map +1 -1
  195. package/dist/runner/unix.js +10 -8
  196. package/dist/runner/unix.js.map +1 -1
  197. package/dist/runner/websocket.d.ts +24 -1
  198. package/dist/runner/websocket.d.ts.map +1 -1
  199. package/dist/runner/websocket.js +12 -10
  200. package/dist/runner/websocket.js.map +1 -1
  201. package/package.json +14 -12
  202. package/schema.json +2269 -0
  203. package/src/Auth.ts +8 -2
  204. package/src/Config.ts +196 -0
  205. package/src/Contract.ts +12 -3
  206. package/src/Instance.ts +1 -0
  207. package/src/Testing.ts +6 -4
  208. package/src/Transport.ts +12 -3
  209. package/src/cli.ts +60 -0
  210. package/src/host/auth/bearer.ts +1 -0
  211. package/src/host/auth/jwt.ts +1 -0
  212. package/src/host/auth/mtls.ts +7 -12
  213. package/src/host/auth/none.ts +3 -1
  214. package/src/host/command.ts +8 -5
  215. package/src/host/local.ts +4 -2
  216. package/src/host/unix.ts +11 -7
  217. package/src/host/websocket.ts +10 -7
  218. package/src/host/worker.ts +8 -5
  219. package/src/index.ts +36 -23
  220. package/src/internal/Certificates.ts +1 -0
  221. package/src/internal/FailureGroup.ts +5 -3
  222. package/src/internal/Peer.ts +1 -0
  223. package/src/internal/{ServeLifecycle.ts → RunnerLifecycle.ts} +7 -5
  224. package/src/internal/Supervisor.ts +5 -4
  225. package/src/internal/assembly.ts +11 -9
  226. package/src/internal/auth/config.ts +44 -0
  227. package/src/internal/auth/mtls.ts +1 -0
  228. package/src/internal/auth/token.ts +1 -0
  229. package/src/internal/auth/tokenCredentials.ts +4 -2
  230. package/src/internal/child.ts +8 -6
  231. package/src/{bin.ts → internal/childMain.ts} +16 -61
  232. package/src/internal/childRuntime.ts +12 -10
  233. package/src/internal/cleanup.ts +3 -2
  234. package/src/internal/contract.ts +1 -0
  235. package/src/internal/credentials.ts +3 -1
  236. package/src/internal/directTransport.ts +9 -2
  237. package/src/internal/entry.ts +53 -16
  238. package/src/internal/entryConfig.ts +10 -132
  239. package/src/internal/execution.ts +17 -15
  240. package/src/internal/follow.ts +2 -1
  241. package/src/internal/forkTree.ts +2 -1
  242. package/src/internal/host/local.ts +1 -0
  243. package/src/internal/host/runner.ts +7 -5
  244. package/src/internal/host.ts +9 -8
  245. package/src/internal/importer.ts +3 -2
  246. package/src/internal/listenerStartup.ts +4 -2
  247. package/src/internal/loadModule.ts +1 -0
  248. package/src/internal/platform.ts +1 -12
  249. package/src/internal/port.ts +11 -6
  250. package/src/internal/runner/Bootstrap.ts +1 -0
  251. package/src/internal/runner/Connection.ts +13 -11
  252. package/src/internal/runner/Execution.ts +14 -13
  253. package/src/internal/runner/Local.ts +3 -2
  254. package/src/internal/runner/Lock.ts +1 -0
  255. package/src/internal/runner/Multiplex.ts +2 -1
  256. package/src/internal/runner/Packages.ts +7 -5
  257. package/src/internal/runner/ProcessObservation.ts +2 -1
  258. package/src/internal/runner/Processes.ts +3 -1
  259. package/src/internal/runner/Retention.ts +1 -0
  260. package/src/internal/runner/Store.ts +3 -2
  261. package/src/internal/runner/Supervisor.ts +22 -20
  262. package/src/internal/runner/Watchdog.ts +3 -1
  263. package/src/internal/runner/Wire.ts +13 -12
  264. package/src/internal/runner/accept.ts +6 -5
  265. package/src/internal/runner/command.ts +3 -2
  266. package/src/internal/runner/connectionEnded.ts +2 -1
  267. package/src/internal/runner/model.ts +5 -3
  268. package/src/internal/services.ts +9 -2
  269. package/src/internal/socketChannel.ts +2 -1
  270. package/src/internal/stdioChannel.ts +4 -2
  271. package/src/internal/supervisorPlugin.ts +10 -8
  272. package/src/internal/transportOptions.ts +1 -0
  273. package/src/internal/watchdogMain.ts +5 -3
  274. package/src/internal/websocket.ts +5 -2
  275. package/src/internal/websocketServer.ts +6 -4
  276. package/src/internal/workerChannel.ts +1 -0
  277. package/src/internal/workerMain.ts +21 -5
  278. package/src/runner/auth/bearer.ts +10 -6
  279. package/src/runner/auth/jwt.ts +10 -41
  280. package/src/runner/auth/mtls.ts +6 -3
  281. package/src/runner/auth/none.ts +3 -1
  282. package/src/runner/index.ts +102 -11
  283. package/src/runner/stdio.ts +15 -10
  284. package/src/runner/unix.ts +7 -4
  285. package/src/runner/websocket.ts +9 -7
  286. package/dist/Auth-BElTC9_X.js +0 -6
  287. package/dist/Bootstrap-H9gDsgsC.js +0 -9
  288. package/dist/ConfigDirectory-BCC6q2R4.js +0 -5
  289. package/dist/Contract-DsJtisvL.js +0 -83
  290. package/dist/Errors-DYhsGZcZ.js +0 -58
  291. package/dist/FailureGroup-BgT73AaR.js +0 -63
  292. package/dist/Framing-G9eSaeLb.js +0 -61
  293. package/dist/Graft-B71CPA2Y.js +0 -996
  294. package/dist/Packages-AgoCGotL.js +0 -108
  295. package/dist/Peer-DXeVrGBh.js +0 -342
  296. package/dist/ProcessObservation-gLgGirYv.js +0 -38
  297. package/dist/ServeLifecycle-Bd1FPJ6e.js +0 -24
  298. package/dist/Transport-DULzpsgR.js +0 -6
  299. package/dist/WatchdogProtocol-BZmVxrBP.js +0 -17
  300. package/dist/bin.js +0 -28276
  301. package/dist/bin.js.map +0 -1
  302. package/dist/childRuntime-Bm3iSg_N.js +0 -192
  303. package/dist/command-9zrHdbwT.js +0 -7
  304. package/dist/connectionEnded-BwcxQ7W8.js +0 -54
  305. package/dist/directTransport-DrexuPSm.js +0 -5
  306. package/dist/entry-psOpX3Bj.js +0 -736
  307. package/dist/importer-Cvf88eAY.js +0 -344
  308. package/dist/internal/ServeLifecycle.js.map +0 -1
  309. package/dist/internal/entryConfig.d.ts.map +0 -1
  310. package/dist/internal/platform.js.map +0 -1
  311. package/dist/internal/release.js +0 -25
  312. package/dist/internal/release.js.map +0 -1
  313. package/dist/internal/serve.js +0 -60
  314. package/dist/internal/serve.js.map +0 -1
  315. package/dist/port--3x2zJ4D.js +0 -285
  316. package/dist/release-DfZPuIcK.js +0 -23
  317. package/dist/rolldown-runtime-DYf_mQCB.js +0 -34
  318. package/dist/socketChannel-CJvL2DiB.js +0 -3658
  319. package/dist/supervisorPlugin-t6Z6PrhD.js +0 -733
  320. package/dist/token-CYBNNlhS.js +0 -17
  321. package/dist/tokenCredentials-CbCuk-Rt.js +0 -31
  322. package/dist/websocketServer-NQhODlEt.js +0 -60
  323. package/dist/workerChannel-C8hhBJzA.js +0 -27
  324. package/src/internal/release.ts +0 -72
  325. package/src/internal/serve.ts +0 -119
  326. /package/dist/{bin.d.ts → internal/childMain.d.ts} +0 -0
@@ -1,202 +1,2 @@
1
- import { Schema } from "effect";
2
- export declare const Connect: Schema.Union<readonly [Schema.Struct<{
3
- unix: Schema.optionalKey<Schema.Never>;
4
- command: Schema.optionalKey<Schema.Never>;
5
- stdio: Schema.optionalKey<Schema.Never>;
6
- local: Schema.optionalKey<Schema.Never>;
7
- worker: Schema.optionalKey<Schema.Never>;
8
- transport: Schema.optionalKey<Schema.Never>;
9
- instance: Schema.optionalKey<Schema.String>;
10
- lease: Schema.optionalKey<Schema.DurationFromString>;
11
- margin: Schema.optionalKey<Schema.DurationFromString>;
12
- expect: Schema.optionalKey<Schema.Struct<{
13
- readonly version: Schema.optionalKey<Schema.String>;
14
- readonly digest: Schema.optionalKey<Schema.String>;
15
- }>>;
16
- auth: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
17
- readonly mtls: Schema.optionalKey<Schema.Never>;
18
- readonly bearer: Schema.optionalKey<Schema.Never>;
19
- readonly jwt: Schema.optionalKey<Schema.Never>;
20
- readonly none: Schema.optionalKey<Schema.Never>;
21
- readonly name: Schema.String;
22
- readonly config: Schema.optionalKey<Schema.Unknown>;
23
- }>, Schema.Struct<{
24
- readonly name: Schema.optionalKey<Schema.Never>;
25
- readonly config: Schema.optionalKey<Schema.Never>;
26
- readonly bearer: Schema.optionalKey<Schema.Never>;
27
- readonly jwt: Schema.optionalKey<Schema.Never>;
28
- readonly none: Schema.optionalKey<Schema.Never>;
29
- readonly mtls: Schema.Unknown;
30
- }>, Schema.Struct<{
31
- readonly name: Schema.optionalKey<Schema.Never>;
32
- readonly config: Schema.optionalKey<Schema.Never>;
33
- readonly mtls: Schema.optionalKey<Schema.Never>;
34
- readonly jwt: Schema.optionalKey<Schema.Never>;
35
- readonly none: Schema.optionalKey<Schema.Never>;
36
- readonly bearer: Schema.Unknown;
37
- }>, Schema.Struct<{
38
- readonly name: Schema.optionalKey<Schema.Never>;
39
- readonly config: Schema.optionalKey<Schema.Never>;
40
- readonly mtls: Schema.optionalKey<Schema.Never>;
41
- readonly bearer: Schema.optionalKey<Schema.Never>;
42
- readonly none: Schema.optionalKey<Schema.Never>;
43
- readonly jwt: Schema.Unknown;
44
- }>, Schema.Struct<{
45
- readonly name: Schema.optionalKey<Schema.Never>;
46
- readonly config: Schema.optionalKey<Schema.Never>;
47
- readonly mtls: Schema.optionalKey<Schema.Never>;
48
- readonly bearer: Schema.optionalKey<Schema.Never>;
49
- readonly jwt: Schema.optionalKey<Schema.Never>;
50
- readonly none: Schema.Unknown;
51
- }>]>>;
52
- url: Schema.String;
53
- ca: Schema.optionalKey<Schema.String>;
54
- servername: Schema.optionalKey<Schema.String>;
55
- }>, Schema.Struct<{
56
- readonly url: Schema.optionalKey<Schema.Never>;
57
- readonly command: Schema.optionalKey<Schema.Never>;
58
- readonly stdio: Schema.optionalKey<Schema.Never>;
59
- readonly local: Schema.optionalKey<Schema.Never>;
60
- readonly worker: Schema.optionalKey<Schema.Never>;
61
- readonly transport: Schema.optionalKey<Schema.Never>;
62
- readonly instance: Schema.optionalKey<Schema.String>;
63
- readonly lease: Schema.optionalKey<Schema.DurationFromString>;
64
- readonly margin: Schema.optionalKey<Schema.DurationFromString>;
65
- readonly expect: Schema.optionalKey<Schema.Struct<{
66
- readonly version: Schema.optionalKey<Schema.String>;
67
- readonly digest: Schema.optionalKey<Schema.String>;
68
- }>>;
69
- readonly auth: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
70
- readonly mtls: Schema.optionalKey<Schema.Never>;
71
- readonly bearer: Schema.optionalKey<Schema.Never>;
72
- readonly jwt: Schema.optionalKey<Schema.Never>;
73
- readonly none: Schema.optionalKey<Schema.Never>;
74
- readonly name: Schema.String;
75
- readonly config: Schema.optionalKey<Schema.Unknown>;
76
- }>, Schema.Struct<{
77
- readonly name: Schema.optionalKey<Schema.Never>;
78
- readonly config: Schema.optionalKey<Schema.Never>;
79
- readonly bearer: Schema.optionalKey<Schema.Never>;
80
- readonly jwt: Schema.optionalKey<Schema.Never>;
81
- readonly none: Schema.optionalKey<Schema.Never>;
82
- readonly mtls: Schema.Unknown;
83
- }>, Schema.Struct<{
84
- readonly name: Schema.optionalKey<Schema.Never>;
85
- readonly config: Schema.optionalKey<Schema.Never>;
86
- readonly mtls: Schema.optionalKey<Schema.Never>;
87
- readonly jwt: Schema.optionalKey<Schema.Never>;
88
- readonly none: Schema.optionalKey<Schema.Never>;
89
- readonly bearer: Schema.Unknown;
90
- }>, Schema.Struct<{
91
- readonly name: Schema.optionalKey<Schema.Never>;
92
- readonly config: Schema.optionalKey<Schema.Never>;
93
- readonly mtls: Schema.optionalKey<Schema.Never>;
94
- readonly bearer: Schema.optionalKey<Schema.Never>;
95
- readonly none: Schema.optionalKey<Schema.Never>;
96
- readonly jwt: Schema.Unknown;
97
- }>, Schema.Struct<{
98
- readonly name: Schema.optionalKey<Schema.Never>;
99
- readonly config: Schema.optionalKey<Schema.Never>;
100
- readonly mtls: Schema.optionalKey<Schema.Never>;
101
- readonly bearer: Schema.optionalKey<Schema.Never>;
102
- readonly jwt: Schema.optionalKey<Schema.Never>;
103
- readonly none: Schema.Unknown;
104
- }>]>>;
105
- readonly unix: Schema.String;
106
- }>, Schema.Struct<{
107
- readonly url: Schema.optionalKey<Schema.Never>;
108
- readonly unix: Schema.optionalKey<Schema.Never>;
109
- readonly stdio: Schema.optionalKey<Schema.Never>;
110
- readonly local: Schema.optionalKey<Schema.Never>;
111
- readonly worker: Schema.optionalKey<Schema.Never>;
112
- readonly transport: Schema.optionalKey<Schema.Never>;
113
- readonly instance: Schema.optionalKey<Schema.String>;
114
- readonly lease: Schema.optionalKey<Schema.DurationFromString>;
115
- readonly margin: Schema.optionalKey<Schema.DurationFromString>;
116
- readonly expect: Schema.optionalKey<Schema.Struct<{
117
- readonly version: Schema.optionalKey<Schema.String>;
118
- readonly digest: Schema.optionalKey<Schema.String>;
119
- }>>;
120
- readonly command: Schema.NonEmptyArray<Schema.String>;
121
- readonly auth: Schema.optionalKey<Schema.Never>;
122
- readonly cwd: Schema.optionalKey<Schema.String>;
123
- readonly env: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
124
- }>, Schema.Struct<{
125
- readonly url: Schema.optionalKey<Schema.Never>;
126
- readonly unix: Schema.optionalKey<Schema.Never>;
127
- readonly command: Schema.optionalKey<Schema.Never>;
128
- readonly stdio: Schema.optionalKey<Schema.Never>;
129
- readonly worker: Schema.optionalKey<Schema.Never>;
130
- readonly transport: Schema.optionalKey<Schema.Never>;
131
- readonly auth: Schema.optionalKey<Schema.Never>;
132
- readonly local: Schema.Struct<{
133
- readonly command: Schema.optionalKey<Schema.NonEmptyArray<Schema.String>>;
134
- }>;
135
- }>, Schema.Struct<{
136
- readonly url: Schema.optionalKey<Schema.Never>;
137
- readonly unix: Schema.optionalKey<Schema.Never>;
138
- readonly command: Schema.optionalKey<Schema.Never>;
139
- readonly stdio: Schema.optionalKey<Schema.Never>;
140
- readonly local: Schema.optionalKey<Schema.Never>;
141
- readonly transport: Schema.optionalKey<Schema.Never>;
142
- readonly auth: Schema.optionalKey<Schema.Never>;
143
- readonly worker: Schema.Struct<{
144
- readonly execArgv: Schema.optionalKey<Schema.$Array<Schema.String>>;
145
- }>;
146
- }>, Schema.Struct<{
147
- readonly url: Schema.optionalKey<Schema.Never>;
148
- readonly unix: Schema.optionalKey<Schema.Never>;
149
- readonly command: Schema.optionalKey<Schema.Never>;
150
- readonly stdio: Schema.optionalKey<Schema.Never>;
151
- readonly local: Schema.optionalKey<Schema.Never>;
152
- readonly worker: Schema.optionalKey<Schema.Never>;
153
- readonly instance: Schema.optionalKey<Schema.String>;
154
- readonly lease: Schema.optionalKey<Schema.DurationFromString>;
155
- readonly margin: Schema.optionalKey<Schema.DurationFromString>;
156
- readonly expect: Schema.optionalKey<Schema.Struct<{
157
- readonly version: Schema.optionalKey<Schema.String>;
158
- readonly digest: Schema.optionalKey<Schema.String>;
159
- }>>;
160
- readonly auth: Schema.optionalKey<Schema.Union<readonly [Schema.Struct<{
161
- readonly mtls: Schema.optionalKey<Schema.Never>;
162
- readonly bearer: Schema.optionalKey<Schema.Never>;
163
- readonly jwt: Schema.optionalKey<Schema.Never>;
164
- readonly none: Schema.optionalKey<Schema.Never>;
165
- readonly name: Schema.String;
166
- readonly config: Schema.optionalKey<Schema.Unknown>;
167
- }>, Schema.Struct<{
168
- readonly name: Schema.optionalKey<Schema.Never>;
169
- readonly config: Schema.optionalKey<Schema.Never>;
170
- readonly bearer: Schema.optionalKey<Schema.Never>;
171
- readonly jwt: Schema.optionalKey<Schema.Never>;
172
- readonly none: Schema.optionalKey<Schema.Never>;
173
- readonly mtls: Schema.Unknown;
174
- }>, Schema.Struct<{
175
- readonly name: Schema.optionalKey<Schema.Never>;
176
- readonly config: Schema.optionalKey<Schema.Never>;
177
- readonly mtls: Schema.optionalKey<Schema.Never>;
178
- readonly jwt: Schema.optionalKey<Schema.Never>;
179
- readonly none: Schema.optionalKey<Schema.Never>;
180
- readonly bearer: Schema.Unknown;
181
- }>, Schema.Struct<{
182
- readonly name: Schema.optionalKey<Schema.Never>;
183
- readonly config: Schema.optionalKey<Schema.Never>;
184
- readonly mtls: Schema.optionalKey<Schema.Never>;
185
- readonly bearer: Schema.optionalKey<Schema.Never>;
186
- readonly none: Schema.optionalKey<Schema.Never>;
187
- readonly jwt: Schema.Unknown;
188
- }>, Schema.Struct<{
189
- readonly name: Schema.optionalKey<Schema.Never>;
190
- readonly config: Schema.optionalKey<Schema.Never>;
191
- readonly mtls: Schema.optionalKey<Schema.Never>;
192
- readonly bearer: Schema.optionalKey<Schema.Never>;
193
- readonly jwt: Schema.optionalKey<Schema.Never>;
194
- readonly none: Schema.Unknown;
195
- }>]>>;
196
- readonly transport: Schema.Struct<{
197
- readonly name: Schema.String;
198
- readonly config: Schema.optionalKey<Schema.Unknown>;
199
- }>;
200
- }>]>;
201
- export type Connect = typeof Connect.Type;
202
- //# sourceMappingURL=entryConfig.d.ts.map
1
+ import { Authentication, Cli, Connect, Host, Listen, Reference, Runner, RunnerAuthentication, entries } from "../Config.js";
2
+ export { Authentication, Cli, Connect, Host, Listen, Reference, Runner, RunnerAuthentication, entries };
@@ -1,127 +1,5 @@
1
- import { PositiveDuration } from "./config.js";
2
- import { Effect, Schema } from "effect";
1
+ import { Authentication, Cli, Connect, Host, Listen, Reference, Runner, RunnerAuthentication, entries } from "../Config.js";
3
2
  // src/internal/entryConfig.ts
4
- const Reference = Schema.Struct({
5
- name: Schema.String,
6
- config: Schema.optionalKey(Schema.Unknown)
7
- });
8
- const absent = Schema.optionalKey(Schema.Never);
9
- const authFields = {
10
- name: absent,
11
- config: absent,
12
- mtls: absent,
13
- bearer: absent,
14
- jwt: absent,
15
- none: absent
16
- };
17
- const Authentication = Schema.Union([
18
- Schema.Struct({
19
- ...authFields,
20
- name: Schema.String,
21
- config: Schema.optionalKey(Schema.Unknown)
22
- }),
23
- Schema.Struct({
24
- ...authFields,
25
- mtls: Schema.Unknown
26
- }),
27
- Schema.Struct({
28
- ...authFields,
29
- bearer: Schema.Unknown
30
- }),
31
- Schema.Struct({
32
- ...authFields,
33
- jwt: Schema.Unknown
34
- }),
35
- Schema.Struct({
36
- ...authFields,
37
- none: Schema.Unknown
38
- })
39
- ]);
40
- const transportFields = {
41
- url: absent,
42
- unix: absent,
43
- command: absent,
44
- stdio: absent,
45
- local: absent,
46
- worker: absent,
47
- transport: absent
48
- };
49
- const auth = Schema.optionalKey(Authentication);
50
- const common = {
51
- instance: Schema.optionalKey(Schema.String),
52
- lease: Schema.optionalKey(PositiveDuration),
53
- margin: Schema.optionalKey(PositiveDuration),
54
- expect: Schema.optionalKey(Schema.Struct({
55
- version: Schema.optionalKey(Schema.String),
56
- digest: Schema.optionalKey(Schema.String)
57
- }))
58
- };
59
- const network = {
60
- ...transportFields,
61
- ...common,
62
- auth,
63
- url: Schema.String,
64
- ca: Schema.optionalKey(Schema.String),
65
- servername: Schema.optionalKey(Schema.String)
66
- };
67
- const Connect = Schema.Union([
68
- Schema.Struct(network),
69
- Schema.Struct({
70
- ...transportFields,
71
- ...common,
72
- auth,
73
- unix: Schema.String
74
- }),
75
- Schema.Struct({
76
- ...transportFields,
77
- ...common,
78
- command: Schema.NonEmptyArray(Schema.String),
79
- auth: Schema.optionalKey(Schema.Never.annotate({ message: "Direct and stdio transports do not accept auth" })),
80
- cwd: Schema.optionalKey(Schema.String),
81
- env: Schema.optionalKey(Schema.Record(Schema.String, Schema.String))
82
- }),
83
- Schema.Struct({
84
- ...transportFields,
85
- auth: Schema.optionalKey(Schema.Never.annotate({ message: "Direct and stdio transports do not accept auth" })),
86
- local: Schema.Struct({ command: Schema.optionalKey(Schema.NonEmptyArray(Schema.String)) })
87
- }),
88
- Schema.Struct({
89
- ...transportFields,
90
- auth: Schema.optionalKey(Schema.Never.annotate({ message: "Direct and stdio transports do not accept auth" })),
91
- worker: Schema.Struct({ execArgv: Schema.optionalKey(Schema.Array(Schema.String)) })
92
- }),
93
- Schema.Struct({
94
- ...transportFields,
95
- ...common,
96
- auth,
97
- transport: Reference
98
- })
99
- ]);
100
- const Listen = Schema.Union([
101
- Schema.Struct({
102
- ...transportFields,
103
- auth,
104
- url: Schema.String,
105
- cert: Schema.optionalKey(Schema.String),
106
- key: Schema.optionalKey(Schema.String)
107
- }),
108
- Schema.Struct({
109
- ...transportFields,
110
- auth,
111
- unix: Schema.String
112
- }),
113
- Schema.Struct({
114
- ...transportFields,
115
- stdio: Schema.Literal(true),
116
- auth: Schema.optionalKey(Schema.Never.annotate({ message: "Direct and stdio transports do not accept auth" })),
117
- identity: Schema.optionalKey(Schema.String)
118
- }),
119
- Schema.Struct({
120
- ...transportFields,
121
- auth,
122
- transport: Reference
123
- })
124
- ]);
125
3
  const capability = (side, name, config) => ({
126
4
  name: `@graftland/plugin-remote/${side}/${name}`,
127
5
  config
@@ -158,19 +36,7 @@ const runnerTransport = (input) => {
158
36
  if (input.unix !== void 0) return capability("runner", "unix", { path: input.unix });
159
37
  return capability("runner", "stdio", {});
160
38
  };
161
- const Host = Schema.Struct({
162
- contract: Schema.String,
163
- connect: Connect,
164
- config: Schema.Json.pipe(Schema.withDecodingDefaultKey(Effect.succeed({})))
165
- });
166
- const Runner = Schema.Struct({
167
- root: Schema.String,
168
- state: Schema.String,
169
- lease: Schema.optionalKey(PositiveDuration),
170
- grace: Schema.optionalKey(PositiveDuration),
171
- listen: Schema.Array(Listen)
172
- });
173
39
  const runnerAuthentication = (input) => input.stdio !== void 0 ? capability("runner", "auth/none", { identity: input.identity ?? "anonymous" }) : authentication("runner", input.auth);
174
- export { Authentication, Connect, Host, Listen, Reference, Runner, authentication, hostTransport, runnerAuthentication, runnerTransport };
40
+ export { Authentication, Cli, Connect, Host, Listen, Reference, Runner, RunnerAuthentication, authentication, entries, hostTransport, runnerAuthentication, runnerTransport };
175
41
 
176
42
  //# sourceMappingURL=entryConfig.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"entryConfig.js","names":[],"sources":["../../src/internal/entryConfig.ts"],"sourcesContent":["import { Effect, Schema } from \"effect\"\nimport { PositiveDuration } from \"./config\"\n\nexport const Reference = Schema.Struct({\n\tname: Schema.String,\n\tconfig: Schema.optionalKey(Schema.Unknown),\n})\nexport type Reference = typeof Reference.Type\nconst absent = Schema.optionalKey(Schema.Never)\nconst authFields = {\n\tname: absent,\n\tconfig: absent,\n\tmtls: absent,\n\tbearer: absent,\n\tjwt: absent,\n\tnone: absent,\n}\nexport const Authentication = Schema.Union([\n\tSchema.Struct({\n\t\t...authFields,\n\t\tname: Schema.String,\n\t\tconfig: Schema.optionalKey(Schema.Unknown),\n\t}),\n\tSchema.Struct({ ...authFields, mtls: Schema.Unknown }),\n\tSchema.Struct({ ...authFields, bearer: Schema.Unknown }),\n\tSchema.Struct({ ...authFields, jwt: Schema.Unknown }),\n\tSchema.Struct({ ...authFields, none: Schema.Unknown }),\n])\nconst transportFields = {\n\turl: absent,\n\tunix: absent,\n\tcommand: absent,\n\tstdio: absent,\n\tlocal: absent,\n\tworker: absent,\n\ttransport: absent,\n}\nconst auth = Schema.optionalKey(Authentication)\nconst common = {\n\tinstance: Schema.optionalKey(Schema.String),\n\tlease: Schema.optionalKey(PositiveDuration),\n\tmargin: Schema.optionalKey(PositiveDuration),\n\texpect: Schema.optionalKey(\n\t\tSchema.Struct({\n\t\t\tversion: Schema.optionalKey(Schema.String),\n\t\t\tdigest: Schema.optionalKey(Schema.String),\n\t\t}),\n\t),\n}\nconst network = {\n\t...transportFields,\n\t...common,\n\tauth,\n\turl: Schema.String,\n\tca: Schema.optionalKey(Schema.String),\n\tservername: Schema.optionalKey(Schema.String),\n}\nexport const Connect = Schema.Union([\n\tSchema.Struct(network),\n\tSchema.Struct({ ...transportFields, ...common, auth, unix: Schema.String }),\n\tSchema.Struct({\n\t\t...transportFields,\n\t\t...common,\n\t\tcommand: Schema.NonEmptyArray(Schema.String),\n\t\tauth: Schema.optionalKey(\n\t\t\tSchema.Never.annotate({\n\t\t\t\tmessage: \"Direct and stdio transports do not accept auth\",\n\t\t\t}),\n\t\t),\n\t\tcwd: Schema.optionalKey(Schema.String),\n\t\tenv: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),\n\t}),\n\tSchema.Struct({\n\t\t...transportFields,\n\t\tauth: Schema.optionalKey(\n\t\t\tSchema.Never.annotate({\n\t\t\t\tmessage: \"Direct and stdio transports do not accept auth\",\n\t\t\t}),\n\t\t),\n\t\tlocal: Schema.Struct({\n\t\t\tcommand: Schema.optionalKey(Schema.NonEmptyArray(Schema.String)),\n\t\t}),\n\t}),\n\tSchema.Struct({\n\t\t...transportFields,\n\t\tauth: Schema.optionalKey(\n\t\t\tSchema.Never.annotate({\n\t\t\t\tmessage: \"Direct and stdio transports do not accept auth\",\n\t\t\t}),\n\t\t),\n\t\tworker: Schema.Struct({\n\t\t\texecArgv: Schema.optionalKey(Schema.Array(Schema.String)),\n\t\t}),\n\t}),\n\tSchema.Struct({ ...transportFields, ...common, auth, transport: Reference }),\n])\nexport type Connect = typeof Connect.Type\nexport const Listen = Schema.Union([\n\tSchema.Struct({\n\t\t...transportFields,\n\t\tauth,\n\t\turl: Schema.String,\n\t\tcert: Schema.optionalKey(Schema.String),\n\t\tkey: Schema.optionalKey(Schema.String),\n\t}),\n\tSchema.Struct({ ...transportFields, auth, unix: Schema.String }),\n\tSchema.Struct({\n\t\t...transportFields,\n\t\tstdio: Schema.Literal(true),\n\t\tauth: Schema.optionalKey(\n\t\t\tSchema.Never.annotate({\n\t\t\t\tmessage: \"Direct and stdio transports do not accept auth\",\n\t\t\t}),\n\t\t),\n\t\tidentity: Schema.optionalKey(Schema.String),\n\t}),\n\tSchema.Struct({ ...transportFields, auth, transport: Reference }),\n])\nexport type Listen = typeof Listen.Type\nconst capability = (\n\tside: \"host\" | \"runner\",\n\tname: string,\n\tconfig: unknown,\n): Reference => ({ name: `@graftland/plugin-remote/${side}/${name}`, config })\nexport const authentication = (\n\tside: \"host\" | \"runner\",\n\tinput: typeof Authentication.Type | undefined,\n): Reference => {\n\tif (input === undefined) return capability(side, \"auth/none\", {})\n\tif (input.name !== undefined) return input\n\tif (input.mtls !== undefined) return capability(side, \"auth/mtls\", input.mtls)\n\tif (input.bearer !== undefined)\n\t\treturn capability(side, \"auth/bearer\", input.bearer)\n\tif (input.jwt !== undefined) return capability(side, \"auth/jwt\", input.jwt)\n\treturn capability(side, \"auth/none\", input.none)\n}\nexport const hostTransport = (\n\tinput: Exclude<\n\t\tConnect,\n\t\t{ readonly local: object } | { readonly worker: object }\n\t>,\n): Reference => {\n\tif (input.transport !== undefined) return input.transport\n\tif (input.url !== undefined)\n\t\treturn capability(\"host\", \"websocket\", {\n\t\t\turl: input.url,\n\t\t\t...(input.ca === undefined ? {} : { ca: input.ca }),\n\t\t\t...(input.servername === undefined\n\t\t\t\t? {}\n\t\t\t\t: { servername: input.servername }),\n\t\t})\n\tif (input.unix !== undefined)\n\t\treturn capability(\"host\", \"unix\", { path: input.unix })\n\treturn capability(\"host\", \"command\", {\n\t\targv: input.command,\n\t\t...(\"cwd\" in input && input.cwd !== undefined ? { cwd: input.cwd } : {}),\n\t\t...(\"env\" in input && input.env !== undefined ? { env: input.env } : {}),\n\t})\n}\nexport const runnerTransport = (input: Listen): Reference => {\n\tif (input.transport !== undefined) return input.transport\n\tif (input.url !== undefined)\n\t\treturn capability(\"runner\", \"websocket\", {\n\t\t\turl: input.url,\n\t\t\t...(input.cert === undefined ? {} : { cert: input.cert }),\n\t\t\t...(input.key === undefined ? {} : { key: input.key }),\n\t\t})\n\tif (input.unix !== undefined)\n\t\treturn capability(\"runner\", \"unix\", { path: input.unix })\n\treturn capability(\"runner\", \"stdio\", {})\n}\nexport const Host = Schema.Struct({\n\tcontract: Schema.String,\n\tconnect: Connect,\n\tconfig: Schema.Json.pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),\n})\nexport const Runner = Schema.Struct({\n\troot: Schema.String,\n\tstate: Schema.String,\n\tlease: Schema.optionalKey(PositiveDuration),\n\tgrace: Schema.optionalKey(PositiveDuration),\n\tlisten: Schema.Array(Listen),\n})\n\nexport const runnerAuthentication = (input: Listen): Reference =>\n\tinput.stdio !== undefined\n\t\t? capability(\"runner\", \"auth/none\", {\n\t\t\t\tidentity: input.identity ?? \"anonymous\",\n\t\t\t})\n\t\t: authentication(\"runner\", input.auth)\n"],"mappings":";;;AAGA,MAAa,YAAY,OAAO,OAAO;CACtC,MAAM,OAAO;CACb,QAAQ,OAAO,YAAY,OAAO,OAAO;AAC1C,CAAC;AAED,MAAM,SAAS,OAAO,YAAY,OAAO,KAAK;AAC9C,MAAM,aAAa;CAClB,MAAM;CACN,QAAQ;CACR,MAAM;CACN,QAAQ;CACR,KAAK;CACL,MAAM;AACP;AACA,MAAa,iBAAiB,OAAO,MAAM;CAC1C,OAAO,OAAO;EACb,GAAG;EACH,MAAM,OAAO;EACb,QAAQ,OAAO,YAAY,OAAO,OAAO;CAC1C,CAAC;CACD,OAAO,OAAO;EAAE,GAAG;EAAY,MAAM,OAAO;CAAQ,CAAC;CACrD,OAAO,OAAO;EAAE,GAAG;EAAY,QAAQ,OAAO;CAAQ,CAAC;CACvD,OAAO,OAAO;EAAE,GAAG;EAAY,KAAK,OAAO;CAAQ,CAAC;CACpD,OAAO,OAAO;EAAE,GAAG;EAAY,M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CACb,OAAO,OAAO;CACd,OAAO,OAAO,YAAY,gBAAgB;CAC1C,OAAO,OAAO,YAAY,gBAAgB;CAC1C,QAAQ,OAAO,MAAM,MAAM;AAC5B,CAAC;AAED,MAAa,wBAAwB,UACpC,MAAM,UAAU,KAAA,IACb,WAAW,UAAU,aAAa,EAClC,UAAU,MAAM,YAAY,YAC7B,CAAC,IACA,eAAe,UAAU,MAAM,IAAI"}
1
+ {"version":3,"file":"entryConfig.js","names":[],"sources":["../../src/internal/entryConfig.ts"],"sourcesContent":["import {\n\tReference,\n\tRunnerAuthentication,\n\ttype Authentication,\n\ttype Connect,\n\ttype Listen,\n} from \"../Config\"\n\nexport * from \"../Config\"\nconst capability = (\n\tside: \"host\" | \"runner\",\n\tname: string,\n\tconfig: unknown,\n): Reference => ({ name: `@graftland/plugin-remote/${side}/${name}`, config })\nexport const authentication = (\n\tside: \"host\" | \"runner\",\n\tinput:\n\t\ttypeof Authentication.Type | typeof RunnerAuthentication.Type | undefined,\n): Reference => {\n\tif (input === undefined) return capability(side, \"auth/none\", {})\n\tif (input.name !== undefined) return input\n\tif (input.mtls !== undefined) return capability(side, \"auth/mtls\", input.mtls)\n\tif (input.bearer !== undefined)\n\t\treturn capability(side, \"auth/bearer\", input.bearer)\n\tif (input.jwt !== undefined) return capability(side, \"auth/jwt\", input.jwt)\n\treturn capability(side, \"auth/none\", input.none)\n}\nexport const hostTransport = (\n\tinput: Exclude<\n\t\tConnect,\n\t\t{ readonly local: object } | { readonly worker: object }\n\t>,\n): Reference => {\n\tif (input.transport !== undefined) return input.transport\n\tif (input.url !== undefined)\n\t\treturn capability(\"host\", \"websocket\", {\n\t\t\turl: input.url,\n\t\t\t...(input.ca === undefined ? {} : { ca: input.ca }),\n\t\t\t...(input.servername === undefined\n\t\t\t\t? {}\n\t\t\t\t: { servername: input.servername }),\n\t\t})\n\tif (input.unix !== undefined)\n\t\treturn capability(\"host\", \"unix\", { path: input.unix })\n\treturn capability(\"host\", \"command\", {\n\t\targv: input.command,\n\t\t...(\"cwd\" in input && input.cwd !== undefined ? { cwd: input.cwd } : {}),\n\t\t...(\"env\" in input && input.env !== undefined ? { env: input.env } : {}),\n\t})\n}\nexport const runnerTransport = (input: Listen): Reference => {\n\tif (input.transport !== undefined) return input.transport\n\tif (input.url !== undefined)\n\t\treturn capability(\"runner\", \"websocket\", {\n\t\t\turl: input.url,\n\t\t\t...(input.cert === undefined ? {} : { cert: input.cert }),\n\t\t\t...(input.key === undefined ? {} : { key: input.key }),\n\t\t})\n\tif (input.unix !== undefined)\n\t\treturn capability(\"runner\", \"unix\", { path: input.unix })\n\treturn capability(\"runner\", \"stdio\", {})\n}\nexport const runnerAuthentication = (input: Listen): Reference =>\n\tinput.stdio !== undefined\n\t\t? capability(\"runner\", \"auth/none\", {\n\t\t\t\tidentity: input.identity ?? \"anonymous\",\n\t\t\t})\n\t\t: authentication(\"runner\", input.auth)\n"],"mappings":";;AASA,MAAM,cACL,MACA,MACA,YACgB;CAAE,MAAM,4BAA4B,KAAK,GAAG;CAAQ;AAAO;AAC5E,MAAa,kBACZ,MACA,UAEe;CACf,IAAI,UAAU,KAAA,GAAW,OAAO,WAAW,MAAM,aAAa,CAAC,CAAC;CAChE,IAAI,MAAM,SAAS,KAAA,GAAW,OAAO;CACrC,IAAI,MAAM,SAAS,KAAA,GAAW,OAAO,WAAW,MAAM,aAAa,MAAM,IAAI;CAC7E,IAAI,MAAM,WAAW,KAAA,GACpB,OAAO,WAAW,MAAM,eAAe,MAAM,MAAM;CACpD,IAAI,MAAM,QAAQ,KAAA,GAAW,OAAO,WAAW,MAAM,YAAY,MAAM,GAAG;CAC1E,OAAO,WAAW,MAAM,aAAa,MAAM,IAAI;AAChD;AACA,MAAa,iBACZ,UAIe;CACf,IAAI,MAAM,cAAc,KAAA,GAAW,OAAO,MAAM;CAChD,IAAI,MAAM,QAAQ,KAAA,GACjB,OAAO,WAAW,QAAQ,aAAa;EACtC,KAAK,MAAM;EACX,GAAI,MAAM,OAAO,KAAA,IAAY,CAAC,IAAI,EAAE,IAAI,MAAM,GAAG;EACjD,GAAI,MAAM,eAAe,KAAA,IACtB,CAAC,IACD,EAAE,YAAY,MAAM,WAAW;CACnC,CAAC;CACF,IAAI,MAAM,SAAS,KAAA,GAClB,OAAO,WAAW,QAAQ,QAAQ,EAAE,MAAM,MAAM,KAAK,CAAC;CACvD,OAAO,WAAW,QAAQ,WAAW;EACpC,MAAM,MAAM;EACZ,GAAI,SAAS,SAAS,MAAM,QAAQ,KAAA,IAAY,EAAE,KAAK,MAAM,IAAI,IAAI,CAAC;EACtE,GAAI,SAAS,SAAS,MAAM,QAAQ,KAAA,IAAY,EAAE,KAAK,MAAM,IAAI,IAAI,CAAC;CACvE,CAAC;AACF;AACA,MAAa,mBAAmB,UAA6B;CAC5D,IAAI,MAAM,cAAc,KAAA,GAAW,OAAO,MAAM;CAChD,IAAI,MAAM,QAAQ,KAAA,GACjB,OAAO,WAAW,UAAU,aAAa;EACxC,KAAK,MAAM;EACX,GAAI,MAAM,SAAS,KAAA,IAAY,CAAC,IAAI,EAAE,MAAM,MAAM,KAAK;EACvD,GAAI,MAAM,QAAQ,KAAA,IAAY,CAAC,IAAI,EAAE,KAAK,MAAM,IAAI;CACrD,CAAC;CACF,IAAI,MAAM,SAAS,KAAA,GAClB,OAAO,WAAW,UAAU,QAAQ,EAAE,MAAM,MAAM,KAAK,CAAC;CACzD,OAAO,WAAW,UAAU,SAAS,CAAC,CAAC;AACxC;AACA,MAAa,wBAAwB,UACpC,MAAM,UAAU,KAAA,IACb,WAAW,UAAU,aAAa,EAClC,UAAU,MAAM,YAAY,YAC7B,CAAC,IACA,eAAe,UAAU,MAAM,IAAI"}
@@ -1,5 +1,5 @@
1
- import "./runner/Connection.js";
2
- import "../Errors.js";
3
1
  import "../Contract.js";
4
- import { Plugin } from "@graftland/graft";
5
- import { Duration, Schema } from "effect";
2
+ import "../Errors.js";
3
+ import "./runner/Connection.js";
4
+ import { Duration, Schema } from "effect";
5
+ import { Plugin } from "@graftland/graft";
@@ -1,21 +1,21 @@
1
- import { Connector } from "../Transport.js";
2
- import { LocalTransport, WorkerTransport } from "./directTransport.js";
3
1
  import { Credentials } from "../Auth.js";
4
- import { acquire } from "./runner/Connection.js";
5
- import { endpoints } from "./services.js";
6
- import { dispose, initialize, load } from "./host.js";
2
+ import { UndeclaredFailure } from "../Contract.js";
7
3
  import { AuthenticationFailed, CredentialsError, LocalTerminationTimeout, MissingInstance, ProcessExited, RemoteEntryError, RemoteError, RemoteWithdrawn, TransportError } from "../Errors.js";
8
- import { ActivationFailed, AlreadyLoaded, ContractNotFound, ModuleImportFailed } from "./childErrors.js";
4
+ import { Connector } from "../Transport.js";
9
5
  import { errors } from "./assembly.js";
10
- import { ExecutionError, LeaseExpired, PackageError, RemoteTerminationUnconfirmed, RunnerClosing, SessionAccessDenied, SessionConflict, SessionStopped, StaleSession, StateDirectoryLocked, StateStorageError, TerminationUnconfirmed } from "./runner/model.js";
11
- import { ReleaseInterrupted } from "./release.js";
12
- import { UndeclaredFailure } from "../Contract.js";
13
- import { endpoint } from "./control.js";
6
+ import { ActivationFailed, AlreadyLoaded, ContractNotFound, ModuleImportFailed } from "./childErrors.js";
14
7
  import { prepare } from "./contract.js";
15
- import { Plugin } from "@graftland/graft";
8
+ import { endpoint } from "./control.js";
9
+ import { LocalTransport, WorkerTransport } from "./directTransport.js";
10
+ import { dispose, initialize, load } from "./host.js";
11
+ import { acquire } from "./runner/Connection.js";
12
+ import { ExecutionError, LeaseExpired, PackageError, RemoteTerminationUnconfirmed, RunnerClosing, SessionAccessDenied, SessionConflict, SessionStopped, StaleSession, StateDirectoryLocked, StateStorageError, TerminationUnconfirmed } from "./runner/model.js";
13
+ import { endpoints } from "./services.js";
16
14
  import { Array, Cause, Effect, Fiber, PlatformError, Schema, Scope } from "effect";
17
15
  import { SecureRandom } from "effect/crypto";
16
+ import { Plugin } from "@graftland/graft";
18
17
  import { RpcClientError } from "effect/rpc";
18
+ import { ReleaseInterrupted } from "@graftland/graft/Release";
19
19
  // src/internal/execution.ts
20
20
  const dependencies = (target) => target._tag === "Connector" ? [Connector, Credentials] : target._tag === "Local" ? [LocalTransport] : [WorkerTransport];
21
21
  /** One owned execution per activation, with explicitly mapped services. */
@@ -1 +1 @@
1
- {"version":3,"file":"execution.js","names":["Connection.acquire","Services.endpoints","Control.endpoint","Host.initialize","Host.dispose","Host.load","Errors.ProcessExited","Errors.TransportError","Errors.LocalTerminationTimeout","Errors.CredentialsError","Errors.AuthenticationFailed","Errors.RemoteEntryError","ChildErrors.AlreadyLoaded","ChildErrors.ContractNotFound","ChildErrors.ModuleImportFailed","ChildErrors.ActivationFailed","Model.PackageError","Model.SessionAccessDenied","Model.StaleSession","Model.LeaseExpired","Model.SessionStopped","Model.SessionConflict","Model.StateStorageError","Model.ExecutionError","Model.TerminationUnconfirmed","Model.RunnerClosing","Model.StateDirectoryLocked","Model.RemoteTerminationUnconfirmed","Assembly.errors","Contract.UndeclaredFailure"],"sources":["../../src/internal/execution.ts"],"sourcesContent":["import { Plugin } from \"@graftland/graft\"\nimport {\n\tArray,\n\tCause,\n\tEffect,\n\tFiber,\n\tPlatformError,\n\tSchema,\n\tScope,\n} from \"effect\"\nimport { SecureRandom } from \"effect/crypto\"\nimport { RpcClientError } from \"effect/rpc\"\nimport type {\n\tLocalTarget as Local,\n\tWorkerTarget as Worker,\n} from \"./runner/Connection\"\nimport { Connector } from \"../Transport\"\nimport { LocalTransport, WorkerTransport } from \"./directTransport\"\nimport { Credentials } from \"../Auth\"\nimport type { Duration } from \"effect\"\nimport * as Connection from \"./runner/Connection\"\nimport * as Services from \"./services\"\nimport * as Host from \"./host\"\nimport * as Errors from \"../Errors\"\nimport { RemoteWithdrawn, RemoteError, MissingInstance } from \"../Errors\"\nimport * as ChildErrors from \"./childErrors\"\nimport * as Assembly from \"./assembly\"\nimport * as Model from \"./runner/model\"\nimport { ReleaseInterrupted } from \"./release\"\nimport * as Contract from \"../Contract\"\nimport * as Control from \"./control\"\nimport { prepare } from \"./contract\"\n\nexport interface ExecutionOptions {\n\treadonly contractModule: string\n\treadonly shutdownTimeout?: Duration.Input | undefined\n}\n\nconst dependencies = (\n\ttarget: Local | Worker | Connection.ConfiguredRunner,\n): ReadonlyArray<Plugin.Dependency> =>\n\ttarget._tag === \"Connector\"\n\t\t? [Connector, Credentials]\n\t\t: target._tag === \"Local\"\n\t\t\t? [LocalTransport]\n\t\t\t: [WorkerTransport]\n\n/** One owned execution per activation, with explicitly mapped services. */\nexport const executionPlugin = <\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\toptions: ExecutionOptions,\n\tconfigured: Local | Worker | Connection.ConfiguredRunner,\n\tannotations: Readonly<Record<string, unknown>> = {},\n): Plugin.Plugin<\n\tS[\"Encoded\"],\n\tS[\"Encoded\"],\n\t| E[\"Type\"]\n\t| Contract.UndeclaredFailure\n\t| RemoteError\n\t| RemoteWithdrawn\n\t| MissingInstance\n> =>\n\tPlugin.make({\n\t\tname: contract.name,\n\t\tinject: [\n\t\t\tSecureRandom.SecureRandom,\n\t\t\t...dependencies(configured),\n\t\t\t...Array.map(contract.inject, (service) => service.key),\n\t\t],\n\t\tconfig: Schema.toEncoded(contract.config),\n\t\tapply: Effect.fnUntraced(\n\t\t\tfunction* (input: Schema.Json) {\n\t\t\t\tconst prepared = prepare(contract)\n\t\t\t\tconst random = yield* SecureRandom.SecureRandom\n\t\t\t\tconst session = yield* random.uuidV4()\n\t\t\t\tconst active = yield* Connection.acquire(\n\t\t\t\t\tconfigured,\n\t\t\t\t\toptions.contractModule,\n\t\t\t\t\t{\n\t\t\t\t\t\tsession,\n\t\t\t\t\t\tserve: Services.endpoints(contract.inject),\n\t\t\t\t\t\tcall: {\n\t\t\t\t\t\t\t...Services.endpoints(contract.provides),\n\t\t\t\t\t\t\t[Control.endpoint]: prepared.control,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tHost.initialize(prepared),\n\t\t\t\t\tHost.dispose,\n\t\t\t\t\toptions.shutdownTimeout ?? \"5 seconds\",\n\t\t\t\t)\n\t\t\t\tyield* Host.load(active, input)\n\t\t\t\tfor (const service of contract.provides)\n\t\t\t\t\tyield* service\n\t\t\t\t\t\t.publish(active.connection.transport)\n\t\t\t\t\t\t.pipe(Scope.provide(active.connection.resources))\n\t\t\t\tyield* Plugin.fork(\n\t\t\t\t\tEffect.raceFirst(\n\t\t\t\t\t\tFiber.join(active.events),\n\t\t\t\t\t\tactive.remoteFailure.await,\n\t\t\t\t\t).pipe(\n\t\t\t\t\t\tEffect.mapError((error) => publicError(contract.error, error)),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\treturn () => Effect.succeed(false)\n\t\t\t},\n\t\t\tEffect.annotateLogs(annotations),\n\t\t\tEffect.mapError((error) => publicError(contract.error, error)),\n\t\t),\n\t})\n\n/** Failures raised by the host machinery; a permissive declared schema must not claim them. */\nconst internalErrors: ReadonlyArray<abstract new (...args: never) => unknown> =\n\t[\n\t\tErrors.ProcessExited,\n\t\tErrors.TransportError,\n\t\tErrors.LocalTerminationTimeout,\n\t\tErrors.CredentialsError,\n\t\tErrors.AuthenticationFailed,\n\t\tErrors.RemoteEntryError,\n\t\tChildErrors.AlreadyLoaded,\n\t\tChildErrors.ContractNotFound,\n\t\tChildErrors.ModuleImportFailed,\n\t\tChildErrors.ActivationFailed,\n\t\tModel.PackageError,\n\t\tModel.SessionAccessDenied,\n\t\tModel.StaleSession,\n\t\tModel.LeaseExpired,\n\t\tModel.SessionStopped,\n\t\tModel.SessionConflict,\n\t\tModel.StateStorageError,\n\t\tModel.ExecutionError,\n\t\tModel.TerminationUnconfirmed,\n\t\tModel.RunnerClosing,\n\t\tModel.StateDirectoryLocked,\n\t\tModel.RemoteTerminationUnconfirmed,\n\t\tReleaseInterrupted,\n\t\tRpcClientError.RpcClientError,\n\t\t...Assembly.errors,\n\t]\nconst isInternal = (error: unknown) =>\n\tSchema.isSchemaError(error) ||\n\tPlatformError.isPlatformError(error) ||\n\tArray.some(internalErrors, (Class) => error instanceof Class)\nconst isPublic = (\n\terror: unknown,\n): error is\n\t| Contract.UndeclaredFailure\n\t| RemoteWithdrawn\n\t| RemoteError\n\t| MissingInstance =>\n\tSchema.is(Contract.UndeclaredFailure)(error) ||\n\tSchema.is(RemoteWithdrawn)(error) ||\n\tSchema.is(RemoteError)(error) ||\n\tSchema.is(MissingInstance)(error)\n\nexport const publicError = <E extends Schema.Top>(\n\tdeclared: E,\n\terror: unknown,\n):\n\t| E[\"Type\"]\n\t| Contract.UndeclaredFailure\n\t| RemoteWithdrawn\n\t| RemoteError\n\t| MissingInstance =>\n\tisPublic(error)\n\t\t? error\n\t\t: // Classify host failures before the declared schema, which may be structural.\n\t\t\t!isInternal(error) && Schema.is(declared)(error)\n\t\t\t? error\n\t\t\t: RemoteError.make({ cause: Cause.fail(error) })\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,MAAM,gBACL,WAEA,OAAO,SAAS,cACb,CAAC,WAAW,WAAW,IACvB,OAAO,SAAS,UACf,CAAC,cAAc,IACf,CAAC,eAAe;;AAGrB,MAAa,mBAWZ,UACA,SACA,YACA,cAAiD,CAAC,MAUlD,OAAO,KAAK;CACX,MAAM,SAAS;CACf,QAAQ;EACP,aAAa;EACb,GAAG,aAAa,UAAU;EAC1B,GAAG,MAAM,IAAI,SAAS,SAAS,YAAY,QAAQ,GAAG;CACvD;CACA,QAAQ,OAAO,UAAU,SAAS,MAAM;CACxC,OAAO,OAAO,WACb,WAAW,OAAoB;EAC9B,MAAM,WAAW,QAAQ,QAAQ;EAEjC,MAAM,UAAU,QAAO,OADD,aAAa,aAAA,CACL,OAAO;EACrC,MAAM,SAAS,OAAOA,QACrB,YACA,QAAQ,gBACR;GACC;GACA,OA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,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"execution.js","names":["Connection.acquire","Services.endpoints","Control.endpoint","Host.initialize","Host.dispose","Host.load","Errors.ProcessExited","Errors.TransportError","Errors.LocalTerminationTimeout","Errors.CredentialsError","Errors.AuthenticationFailed","Errors.RemoteEntryError","ChildErrors.AlreadyLoaded","ChildErrors.ContractNotFound","ChildErrors.ModuleImportFailed","ChildErrors.ActivationFailed","Model.PackageError","Model.SessionAccessDenied","Model.StaleSession","Model.LeaseExpired","Model.SessionStopped","Model.SessionConflict","Model.StateStorageError","Model.ExecutionError","Model.TerminationUnconfirmed","Model.RunnerClosing","Model.StateDirectoryLocked","Model.RemoteTerminationUnconfirmed","Assembly.errors","Contract.UndeclaredFailure"],"sources":["../../src/internal/execution.ts"],"sourcesContent":["import {\n\tArray,\n\tCause,\n\tEffect,\n\tFiber,\n\tPlatformError,\n\tSchema,\n\tScope,\n\ttype Duration,\n} from \"effect\"\nimport { SecureRandom } from \"effect/crypto\"\nimport { RpcClientError } from \"effect/rpc\"\n\nimport { Plugin } from \"@graftland/graft\"\nimport { ReleaseInterrupted } from \"@graftland/graft/Release\"\n\nimport { Credentials } from \"../Auth\"\nimport * as Contract from \"../Contract\"\nimport * as Errors from \"../Errors\"\nimport { MissingInstance, RemoteError, RemoteWithdrawn } from \"../Errors\"\nimport { Connector } from \"../Transport\"\nimport * as Assembly from \"./assembly\"\nimport * as ChildErrors from \"./childErrors\"\nimport { prepare } from \"./contract\"\nimport * as Control from \"./control\"\nimport { LocalTransport, WorkerTransport } from \"./directTransport\"\nimport * as Host from \"./host\"\nimport type {\n\tLocalTarget as Local,\n\tWorkerTarget as Worker,\n} from \"./runner/Connection\"\nimport * as Connection from \"./runner/Connection\"\nimport * as Model from \"./runner/model\"\nimport * as Services from \"./services\"\n\nexport interface ExecutionOptions {\n\treadonly contractModule: string\n\treadonly shutdownTimeout?: Duration.Input | undefined\n}\n\nconst dependencies = (\n\ttarget: Local | Worker | Connection.ConfiguredRunner,\n): ReadonlyArray<Plugin.Dependency> =>\n\ttarget._tag === \"Connector\"\n\t\t? [Connector, Credentials]\n\t\t: target._tag === \"Local\"\n\t\t\t? [LocalTransport]\n\t\t\t: [WorkerTransport]\n\n/** One owned execution per activation, with explicitly mapped services. */\nexport const executionPlugin = <\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\toptions: ExecutionOptions,\n\tconfigured: Local | Worker | Connection.ConfiguredRunner,\n\tannotations: Readonly<Record<string, unknown>> = {},\n): Plugin.Plugin<\n\tS[\"Encoded\"],\n\tS[\"Encoded\"],\n\t| E[\"Type\"]\n\t| Contract.UndeclaredFailure\n\t| RemoteError\n\t| RemoteWithdrawn\n\t| MissingInstance\n> =>\n\tPlugin.make({\n\t\tname: contract.name,\n\t\tinject: [\n\t\t\tSecureRandom.SecureRandom,\n\t\t\t...dependencies(configured),\n\t\t\t...Array.map(contract.inject, (service) => service.key),\n\t\t],\n\t\tconfig: Schema.toEncoded(contract.config),\n\t\tapply: Effect.fnUntraced(\n\t\t\tfunction* (input: Schema.Json) {\n\t\t\t\tconst prepared = prepare(contract)\n\t\t\t\tconst random = yield* SecureRandom.SecureRandom\n\t\t\t\tconst session = yield* random.uuidV4()\n\t\t\t\tconst active = yield* Connection.acquire(\n\t\t\t\t\tconfigured,\n\t\t\t\t\toptions.contractModule,\n\t\t\t\t\t{\n\t\t\t\t\t\tsession,\n\t\t\t\t\t\tserve: Services.endpoints(contract.inject),\n\t\t\t\t\t\tcall: {\n\t\t\t\t\t\t\t...Services.endpoints(contract.provides),\n\t\t\t\t\t\t\t[Control.endpoint]: prepared.control,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t\tHost.initialize(prepared),\n\t\t\t\t\tHost.dispose,\n\t\t\t\t\toptions.shutdownTimeout ?? \"5 seconds\",\n\t\t\t\t)\n\t\t\t\tyield* Host.load(active, input)\n\t\t\t\tfor (const service of contract.provides)\n\t\t\t\t\tyield* service\n\t\t\t\t\t\t.publish(active.connection.transport)\n\t\t\t\t\t\t.pipe(Scope.provide(active.connection.resources))\n\t\t\t\tyield* Plugin.fork(\n\t\t\t\t\tEffect.raceFirst(\n\t\t\t\t\t\tFiber.join(active.events),\n\t\t\t\t\t\tactive.remoteFailure.await,\n\t\t\t\t\t).pipe(\n\t\t\t\t\t\tEffect.mapError((error) => publicError(contract.error, error)),\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t\treturn () => Effect.succeed(false)\n\t\t\t},\n\t\t\tEffect.annotateLogs(annotations),\n\t\t\tEffect.mapError((error) => publicError(contract.error, error)),\n\t\t),\n\t})\n\n/** Failures raised by the host machinery; a permissive declared schema must not claim them. */\nconst internalErrors: ReadonlyArray<abstract new (...args: never) => unknown> =\n\t[\n\t\tErrors.ProcessExited,\n\t\tErrors.TransportError,\n\t\tErrors.LocalTerminationTimeout,\n\t\tErrors.CredentialsError,\n\t\tErrors.AuthenticationFailed,\n\t\tErrors.RemoteEntryError,\n\t\tChildErrors.AlreadyLoaded,\n\t\tChildErrors.ContractNotFound,\n\t\tChildErrors.ModuleImportFailed,\n\t\tChildErrors.ActivationFailed,\n\t\tModel.PackageError,\n\t\tModel.SessionAccessDenied,\n\t\tModel.StaleSession,\n\t\tModel.LeaseExpired,\n\t\tModel.SessionStopped,\n\t\tModel.SessionConflict,\n\t\tModel.StateStorageError,\n\t\tModel.ExecutionError,\n\t\tModel.TerminationUnconfirmed,\n\t\tModel.RunnerClosing,\n\t\tModel.StateDirectoryLocked,\n\t\tModel.RemoteTerminationUnconfirmed,\n\t\tReleaseInterrupted,\n\t\tRpcClientError.RpcClientError,\n\t\t...Assembly.errors,\n\t]\nconst isInternal = (error: unknown) =>\n\tSchema.isSchemaError(error) ||\n\tPlatformError.isPlatformError(error) ||\n\tArray.some(internalErrors, (Class) => error instanceof Class)\nconst isPublic = (\n\terror: unknown,\n): error is\n\t| Contract.UndeclaredFailure\n\t| RemoteWithdrawn\n\t| RemoteError\n\t| MissingInstance =>\n\tSchema.is(Contract.UndeclaredFailure)(error) ||\n\tSchema.is(RemoteWithdrawn)(error) ||\n\tSchema.is(RemoteError)(error) ||\n\tSchema.is(MissingInstance)(error)\n\nexport const publicError = <E extends Schema.Top>(\n\tdeclared: E,\n\terror: unknown,\n):\n\t| E[\"Type\"]\n\t| Contract.UndeclaredFailure\n\t| RemoteWithdrawn\n\t| RemoteError\n\t| MissingInstance =>\n\tisPublic(error)\n\t\t? error\n\t\t: // Classify host failures before the declared schema, which may be structural.\n\t\t\t!isInternal(error) && Schema.is(declared)(error)\n\t\t\t? error\n\t\t\t: RemoteError.make({ cause: Cause.fail(error) })\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,MAAM,gBACL,WAEA,OAAO,SAAS,cACb,CAAC,WAAW,WAAW,IACvB,OAAO,SAAS,UACf,CAAC,cAAc,IACf,CAAC,eAAe;;AAGrB,MAAa,mBAWZ,UACA,SACA,YACA,cAAiD,CAAC,MAUlD,OAAO,KAAK;CACX,MAAM,SAAS;CACf,QAAQ;EACP,aAAa;EACb,GAAG,aAAa,UAAU;EAC1B,GAAG,MAAM,IAAI,SAAS,SAAS,YAAY,QAAQ,GAAG;CACvD;CACA,QAAQ,OAAO,UAAU,SAAS,MAAM;CACxC,OAAO,OAAO,WACb,WAAW,OAAoB;EAC9B,MAAM,WAAW,QAAQ,QAAQ;EAEjC,MAAM,UAAU,QAAO,OADD,aAAa,aAAA,CACL,OAAO;EACrC,MAAM,SAAS,OAAOA,QACrB,YACA,QAAQ,gBACR;GACC;GACA,OAAOC,UAAmB,SAAS,MAAM;GACzC,MAAM;IACL,GAAGA,UAAmB,SAAS,QAAQ;KACtCC,WAAmB,SAAS;GAC9B;EACD,GACAC,WA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Stream } from "effect";
2
+ import { Plugin } from "@graftland/graft";
3
3
  // src/internal/follow.ts
4
4
  /** Follow startup and later failures without changing the caller's error boundary. */
5
5
  const follow = Effect.fnUntraced(function* (fork, fail) {
@@ -1 +1 @@
1
- {"version":3,"file":"follow.js","names":[],"sources":["../../src/internal/follow.ts"],"sourcesContent":["import { Plugin, type Fork, type Graft } from \"@graftland/graft\"\nimport { Effect, Stream, type Cause, type Schema } from \"effect\"\n\n/** Follow startup and later failures without changing the caller's error boundary. */\nexport const follow = Effect.fnUntraced(function* <I, E, F>(\n\tfork: Fork.Fork<I, E>,\n\tfail: (cause: Cause.Cause<E | Schema.SchemaError>) => Effect.Effect<never, F>,\n): Effect.fn.Return<void, F, Graft.Graft | Plugin.Tasks<F>> {\n\tyield* fork.await.pipe(Effect.catchCause(fail))\n\tyield* Plugin.fork(\n\t\tfork.state.pipe(\n\t\t\tStream.runForEach((state) =>\n\t\t\t\tstate._tag === \"Failed\" ? fail(state.cause) : Effect.void,\n\t\t\t),\n\t\t),\n\t)\n})\n"],"mappings":";;;;AAIA,MAAa,SAAS,OAAO,WAAW,WACvC,MACA,MAC2D;CAC3D,OAAO,KAAK,MAAM,KAAK,OAAO,WAAW,IAAI,CAAC;CAC9C,OAAO,OAAO,KACb,KAAK,MAAM,KACV,OAAO,YAAY,UAClB,MAAM,SAAS,WAAW,KAAK,MAAM,KAAK,IAAI,OAAO,IACtD,CACD,CACD;AACD,CAAC"}
1
+ {"version":3,"file":"follow.js","names":[],"sources":["../../src/internal/follow.ts"],"sourcesContent":["import { Effect, Stream, type Cause, type Schema } from \"effect\"\n\nimport { Plugin, type Fork, type Graft } from \"@graftland/graft\"\n\n/** Follow startup and later failures without changing the caller's error boundary. */\nexport const follow = Effect.fnUntraced(function* <I, E, F>(\n\tfork: Fork.Fork<I, E>,\n\tfail: (cause: Cause.Cause<E | Schema.SchemaError>) => Effect.Effect<never, F>,\n): Effect.fn.Return<void, F, Graft.Graft | Plugin.Tasks<F>> {\n\tyield* fork.await.pipe(Effect.catchCause(fail))\n\tyield* Plugin.fork(\n\t\tfork.state.pipe(\n\t\t\tStream.runForEach((state) =>\n\t\t\t\tstate._tag === \"Failed\" ? fail(state.cause) : Effect.void,\n\t\t\t),\n\t\t),\n\t)\n})\n"],"mappings":";;;;AAKA,MAAa,SAAS,OAAO,WAAW,WACvC,MACA,MAC2D;CAC3D,OAAO,KAAK,MAAM,KAAK,OAAO,WAAW,IAAI,CAAC;CAC9C,OAAO,OAAO,KACb,KAAK,MAAM,KACV,OAAO,YAAY,UAClB,MAAM,SAAS,WAAW,KAAK,MAAM,KAAK,IAAI,OAAO,IACtD,CACD,CACD;AACD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"forkTree.js","names":[],"sources":["../../src/internal/forkTree.ts"],"sourcesContent":["import type { Fork } from \"@graftland/graft\"\nimport { Array, Option } from \"effect\"\n\nexport const findSubtree = (\n\ttrees: ReadonlyArray<Fork.ForkTree>,\n\tid: number,\n): Option.Option<Fork.ForkTree> =>\n\tArray.findFirst(trees, (tree) =>\n\t\ttree.id === id ? Option.some(tree) : findSubtree(tree.children, id),\n\t)\n\nexport const isSubtreeActive = (tree: Fork.ForkTree): boolean =>\n\ttree.state._tag === \"Active\" && Array.every(tree.children, isSubtreeActive)\n"],"mappings":";;AAGA,MAAa,eACZ,OACA,OAEA,MAAM,UAAU,QAAQ,SACvB,KAAK,OAAO,KAAK,OAAO,KAAK,IAAI,IAAI,YAAY,KAAK,UAAU,EAAE,CACnE;AAED,MAAa,mBAAmB,SAC/B,KAAK,MAAM,SAAS,YAAY,MAAM,MAAM,KAAK,UAAU,eAAe"}
1
+ {"version":3,"file":"forkTree.js","names":[],"sources":["../../src/internal/forkTree.ts"],"sourcesContent":["import { Array, Option } from \"effect\"\n\nimport type { Fork } from \"@graftland/graft\"\n\nexport const findSubtree = (\n\ttrees: ReadonlyArray<Fork.ForkTree>,\n\tid: number,\n): Option.Option<Fork.ForkTree> =>\n\tArray.findFirst(trees, (tree) =>\n\t\ttree.id === id ? Option.some(tree) : findSubtree(tree.children, id),\n\t)\n\nexport const isSubtreeActive = (tree: Fork.ForkTree): boolean =>\n\ttree.state._tag === \"Active\" && Array.every(tree.children, isSubtreeActive)\n"],"mappings":";;AAIA,MAAa,eACZ,OACA,OAEA,MAAM,UAAU,QAAQ,SACvB,KAAK,OAAO,KAAK,OAAO,KAAK,IAAI,IAAI,YAAY,KAAK,UAAU,EAAE,CACnE;AAED,MAAa,mBAAmB,SAC/B,KAAK,MAAM,SAAS,YAAY,MAAM,MAAM,KAAK,UAAU,eAAe"}
@@ -1 +1 @@
1
- {"version":3,"file":"local.js","names":["ProcessObservation.observe"],"sources":["../../../src/internal/host/local.ts"],"sourcesContent":["import { Cause, Effect, Fiber, Option, Sink, Stream } from \"effect\"\nimport type { ChildProcessSpawner } from \"effect/process\"\nimport { ProcessExited, TransportError } from \"../../Errors\"\nimport * as ProcessObservation from \"../runner/ProcessObservation\"\n\nexport const observe = Effect.fnUntraced(function* (\n\tchild: ChildProcessSpawner.ChildProcessHandle,\n) {\n\tconst observation = yield* ProcessObservation.observe(child)\n\tconst exited = yield* observation.exited.pipe(\n\t\tEffect.mapBoth({\n\t\t\tonFailure: (error) => TransportError.make({ cause: Cause.fail(error) }),\n\t\t\tonSuccess: (status) =>\n\t\t\t\tProcessExited.make({\n\t\t\t\t\tpid: Option.some(child.pid),\n\t\t\t\t\texitCode: status.code,\n\t\t\t\t\tstderr: status.stderr,\n\t\t\t\t\tstatusCause: status.cause,\n\t\t\t\t}),\n\t\t}),\n\t\tEffect.forkScoped,\n\t)\n\treturn {\n\t\tpid: Option.some(child.pid),\n\t\texited: Fiber.join(exited),\n\t\tfailure: observation.failure.pipe(\n\t\t\tEffect.mapError((error) =>\n\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t),\n\t\t),\n\t\tchannel: {\n\t\t\tinput: child.getOutputFd(3).pipe(\n\t\t\t\t// EOF can precede Node's exit event; prefer complete process diagnostics.\n\t\t\t\tStream.concat(\n\t\t\t\t\tStream.fromEffect(\n\t\t\t\t\t\tFiber.join(exited).pipe(\n\t\t\t\t\t\t\tEffect.timeoutOption(\"1 second\"),\n\t\t\t\t\t\t\tEffect.asVoid,\n\t\t\t\t\t\t),\n\t\t\t\t\t).pipe(Stream.drain),\n\t\t\t\t),\n\t\t\t\tStream.mapError((error) =>\n\t\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t\t),\n\t\t\t),\n\t\t\toutput: child.stdin.pipe(\n\t\t\t\tSink.mapError((error) =>\n\t\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t\t),\n\t\t\t),\n\t\t},\n\t}\n})\n"],"mappings":";;;;AAKA,MAAa,UAAU,OAAO,WAAW,WACxC,OACC;CACD,MAAM,cAAc,OAAOA,UAA2B,KAAK;CAC3D,MAAM,SAAS,OAAO,YAAY,OAAO,KACxC,OAAO,QAAQ;EACd,YAAY,UAAU,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC;EACtE,YAAY,WACX,cAAc,KAAK;GAClB,KAAK,OAAO,KAAK,MAAM,GAAG;GAC1B,UAAU,OAAO;GACjB,QAAQ,OAAO;GACf,aAAa,OAAO;EACrB,CAAC;CACH,CAAC,GACD,OAAO,UACR;CACA,OAAO;EACN,KAAK,OAAO,KAAK,MAAM,GAAG;EAC1B,QAAQ,MAAM,KAAK,MAAM;EACzB,SAAS,YAAY,QAAQ,KAC5B,OAAO,UAAU,UAChB,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACjD,CACD;EACA,SAAS;GACR,OAAO,MAAM,YAAY,CAAC,CAAC,CAAC,KAE3B,OAAO,OACN,OAAO,WACN,MAAM,KAAK,MAAM,CAAC,CAAC,KAClB,OAAO,cAAc,UAAU,GAC/B,OAAO,MACR,CACD,CAAC,CAAC,KAAK,OAAO,KAAK,CACpB,GACA,OAAO,UAAU,UAChB,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACjD,CACD;GACA,QAAQ,MAAM,MAAM,KACnB,KAAK,UAAU,UACd,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACjD,CACD;EACD;CACD;AACD,CAAC"}
1
+ {"version":3,"file":"local.js","names":["ProcessObservation.observe"],"sources":["../../../src/internal/host/local.ts"],"sourcesContent":["import { Cause, Effect, Fiber, Option, Sink, Stream } from \"effect\"\nimport type { ChildProcessSpawner } from \"effect/process\"\n\nimport { ProcessExited, TransportError } from \"../../Errors\"\nimport * as ProcessObservation from \"../runner/ProcessObservation\"\n\nexport const observe = Effect.fnUntraced(function* (\n\tchild: ChildProcessSpawner.ChildProcessHandle,\n) {\n\tconst observation = yield* ProcessObservation.observe(child)\n\tconst exited = yield* observation.exited.pipe(\n\t\tEffect.mapBoth({\n\t\t\tonFailure: (error) => TransportError.make({ cause: Cause.fail(error) }),\n\t\t\tonSuccess: (status) =>\n\t\t\t\tProcessExited.make({\n\t\t\t\t\tpid: Option.some(child.pid),\n\t\t\t\t\texitCode: status.code,\n\t\t\t\t\tstderr: status.stderr,\n\t\t\t\t\tstatusCause: status.cause,\n\t\t\t\t}),\n\t\t}),\n\t\tEffect.forkScoped,\n\t)\n\treturn {\n\t\tpid: Option.some(child.pid),\n\t\texited: Fiber.join(exited),\n\t\tfailure: observation.failure.pipe(\n\t\t\tEffect.mapError((error) =>\n\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t),\n\t\t),\n\t\tchannel: {\n\t\t\tinput: child.getOutputFd(3).pipe(\n\t\t\t\t// EOF can precede Node's exit event; prefer complete process diagnostics.\n\t\t\t\tStream.concat(\n\t\t\t\t\tStream.fromEffect(\n\t\t\t\t\t\tFiber.join(exited).pipe(\n\t\t\t\t\t\t\tEffect.timeoutOption(\"1 second\"),\n\t\t\t\t\t\t\tEffect.asVoid,\n\t\t\t\t\t\t),\n\t\t\t\t\t).pipe(Stream.drain),\n\t\t\t\t),\n\t\t\t\tStream.mapError((error) =>\n\t\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t\t),\n\t\t\t),\n\t\t\toutput: child.stdin.pipe(\n\t\t\t\tSink.mapError((error) =>\n\t\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t\t),\n\t\t\t),\n\t\t},\n\t}\n})\n"],"mappings":";;;;AAMA,MAAa,UAAU,OAAO,WAAW,WACxC,OACC;CACD,MAAM,cAAc,OAAOA,UAA2B,KAAK;CAC3D,MAAM,SAAS,OAAO,YAAY,OAAO,KACxC,OAAO,QAAQ;EACd,YAAY,UAAU,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC;EACtE,YAAY,WACX,cAAc,KAAK;GAClB,KAAK,OAAO,KAAK,MAAM,GAAG;GAC1B,UAAU,OAAO;GACjB,QAAQ,OAAO;GACf,aAAa,OAAO;EACrB,CAAC;CACH,CAAC,GACD,OAAO,UACR;CACA,OAAO;EACN,KAAK,OAAO,KAAK,MAAM,GAAG;EAC1B,QAAQ,MAAM,KAAK,MAAM;EACzB,SAAS,YAAY,QAAQ,KAC5B,OAAO,UAAU,UAChB,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACjD,CACD;EACA,SAAS;GACR,OAAO,MAAM,YAAY,CAAC,CAAC,CAAC,KAE3B,OAAO,OACN,OAAO,WACN,MAAM,KAAK,MAAM,CAAC,CAAC,KAClB,OAAO,cAAc,UAAU,GAC/B,OAAO,MACR,CACD,CAAC,CAAC,KAAK,OAAO,KAAK,CACpB,GACA,OAAO,UAAU,UAChB,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACjD,CACD;GACA,QAAQ,MAAM,MAAM,KACnB,KAAK,UAAU,UACd,eAAe,KAAK,EAAE,OAAO,MAAM,KAAK,KAAK,EAAE,CAAC,CACjD,CACD;EACD;CACD;AACD,CAAC"}
@@ -1,13 +1,13 @@
1
- import { make } from "../FailureGroup.js";
2
- import { connectWith } from "../assembly.js";
3
1
  import { ProcessExited, TransportError } from "../../Errors.js";
4
- import { defaults } from "../Limits.js";
2
+ import { connectWith } from "../assembly.js";
5
3
  import { cleanupCause } from "../cleanup.js";
4
+ import { defaults } from "../Limits.js";
5
+ import { make } from "../FailureGroup.js";
6
6
  import { make as make$1 } from "../port.js";
7
+ import { awaitTermination, childOf } from "../runner/model.js";
7
8
  import { make as make$2 } from "../runner/Multiplex.js";
8
9
  import { verify } from "../runner/Packages.js";
9
10
  import { Session, channel } from "../runner/Wire.js";
10
- import { awaitTermination, childOf } from "../runner/model.js";
11
11
  import { Cause, Duration, Effect, Exit, Fiber, Option, Ref, Scope } from "effect";
12
12
  import { RpcClient } from "effect/rpc";
13
13
  // src/internal/host/runner.ts
@@ -1 +1 @@
1
- {"version":3,"file":"runner.js","names":["channel","connectCapability","Multiplex.make","Port.make","Wire.channel","Wire.Session","FailureGroup.make","Packages.verify"],"sources":["../../../src/internal/host/runner.ts"],"sourcesContent":["import * as FailureGroup from \"../FailureGroup\"\nimport {\n\tCause,\n\tEffect,\n\tDuration,\n\tExit,\n\tFiber,\n\tOption,\n\tRef,\n\tScope,\n} from \"effect\"\nimport { RpcClient } from \"effect/rpc\"\nimport { connectWith as connectCapability } from \"../assembly\"\nimport type { ConfiguredRunner, Connected } from \"../runner/Connection\"\nimport { ProcessExited, TransportError } from \"../../Errors\"\nimport { cleanupCause } from \"../cleanup\"\nimport * as Port from \"../port\"\nimport * as Multiplex from \"../runner/Multiplex\"\nimport * as Packages from \"../runner/Packages\"\nimport * as Wire from \"../runner/Wire\"\nimport { awaitTermination, defaults, childOf } from \"../runner/model\"\nexport const connect = Effect.fnUntraced(function* (\n\ttarget: ConfiguredRunner,\n\tcontractModule: string,\n\toptions: Port.Options,\n\tresources: Scope.Scope,\n\tprocessScope: Scope.Scope,\n) {\n\tconst instance = target.instance\n\n\tconst margin = Duration.toMillis(target.margin ?? \"5 seconds\")\n\tconst channel = yield* connectCapability(target.explicitAuth).pipe(\n\t\tScope.provide(processScope),\n\t)\n\tconst mux = yield* Multiplex.make(channel).pipe(Scope.provide(resources))\n\tconst control = yield* Port.make(Wire.channel(mux, 0), {\n\t\tsession: \"session-v1\",\n\t\tserve: {},\n\t\tcall: { session: Wire.Session },\n\t}).pipe(Scope.provide(resources))\n\tconst session = yield* RpcClient.make(Wire.Session).pipe(\n\t\tEffect.provideService(\n\t\t\tRpcClient.Protocol,\n\t\t\tcontrol.clientProtocol(\"session\"),\n\t\t),\n\t\tScope.provide(resources),\n\t)\n\tconst expectedGeneration = yield* session.HighWater({ instance })\n\tconst record = yield* session.Open({\n\t\tinstance,\n\t\texpectedGeneration,\n\t\trequestId: options.session,\n\t\tlimits: defaults,\n\t\t...(target.lease === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tleaseMillis: Duration.toMillis(target.lease),\n\t\t\t\t}),\n\t})\n\tconst failures = yield* FailureGroup.make<TransportError>().pipe(\n\t\tScope.provide(resources),\n\t)\n\tconst finishStarted = yield* Ref.make(false)\n\tconst terminate = yield* Effect.cached(\n\t\tEffect.gen(function* () {\n\t\t\tyield* Ref.set(finishStarted, true)\n\t\t\t// A failed close must not skip Dispose; both outcomes are reported together below.\n\t\t\tconst closed = yield* Effect.exit(failures.close)\n\t\t\tconst result = yield* awaitTermination(\n\t\t\t\trecord.handle,\n\t\t\t\tsession.Dispose(record.handle),\n\t\t\t\trecord.leaseMillis,\n\t\t\t\tmargin,\n\t\t\t)\n\t\t\tconst { code, signal, stderr, cause } = result.exit\n\t\t\tyield* Effect.logInfo(\"Remote execution terminated\", {\n\t\t\t\tcode,\n\t\t\t\t...(signal === null ? {} : { signal }),\n\t\t\t\t...(stderr === undefined || stderr === \"\" ? {} : { stderr }),\n\t\t\t\t...(cause === undefined || cause.reasons.length === 0 ? {} : { cause }),\n\t\t\t}).pipe(\n\t\t\t\tEffect.annotateLogs({\n\t\t\t\t\t\"remote.instance\": record.handle.key.instance,\n\t\t\t\t\t\"remote.generation\": record.handle.generation,\n\t\t\t\t\t\"remote.termination\": result.kind,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tconst failure = Exit.isFailure(closed)\n\t\t\t\t? Cause.combine(closed.cause, result.cause)\n\t\t\t\t: result.cause\n\t\t\tif (failure.reasons.length > 0)\n\t\t\t\treturn yield* Effect.failCause(cleanupCause(failure))\n\t\t}),\n\t)\n\tyield* Scope.addFinalizer(\n\t\tprocessScope,\n\t\tEffect.gen(function* () {\n\t\t\tif (!(yield* Ref.get(finishStarted)))\n\t\t\t\tyield* terminate.pipe(\n\t\t\t\t\tEffect.catchCause((cause) => Effect.failCause(cleanupCause(cause))),\n\t\t\t\t)\n\t\t}),\n\t)\n\tconst renewed = yield* Effect.forever(\n\t\tEffect.sleep(record.leaseMillis / 3).pipe(\n\t\t\tEffect.andThen(session.Renew(record.handle)),\n\t\t),\n\t).pipe(Effect.forkIn(resources))\n\tconst code = yield* session.Load({\n\t\thandle: record.handle,\n\t\tspecifier: contractModule,\n\t\tdigest: target.expect?.digest !== undefined,\n\t})\n\tyield* Packages.verify(code, target.expect)\n\tconst loaded = yield* session.Status(record.handle)\n\tconst peer = yield* Port.make(Wire.channel(mux, 1), {\n\t\t...options,\n\t\tsession: record.handle.token,\n\t\tlimits: record.limits,\n\t}).pipe(Scope.provide(resources))\n\t// RPC forwarding cancellation is expected; resource cleanup is collected by Connection's scopes.\n\tconst report = (cause: Cause.Cause<unknown>) =>\n\t\tCause.hasInterruptsOnly(cause)\n\t\t\t? Effect.void\n\t\t\t: failures.failCause(\n\t\t\t\t\tCause.map(cause, (error) =>\n\t\t\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t\t\t),\n\t\t\t\t)\n\tyield* failures.await.pipe(\n\t\tEffect.catchCause((cause) =>\n\t\t\tCause.hasInterruptsOnly(cause)\n\t\t\t\t? Effect.void\n\t\t\t\t: peer.fail(TransportError.make({ cause })),\n\t\t),\n\t\tEffect.forkIn(resources),\n\t)\n\n\tyield* failures.run(\n\t\tFiber.join(renewed).pipe(\n\t\t\tEffect.catchCause(\n\t\t\t\tEffect.fnUntraced(function* (cause) {\n\t\t\t\t\tif (Cause.hasInterruptsOnly(cause)) return\n\t\t\t\t\tconst status = yield* Effect.exit(\n\t\t\t\t\t\tsession.Status(record.handle).pipe(Effect.timeout(\"5 seconds\")),\n\t\t\t\t\t)\n\t\t\t\t\tif (Exit.isSuccess(status) && status.value.phase === \"Stopped\") {\n\t\t\t\t\t\tconst exit = status.value.termination.exit\n\t\t\t\t\t\tyield* report(\n\t\t\t\t\t\t\tCause.combine(\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\tCause.fail(\n\t\t\t\t\t\t\t\t\tProcessExited.make({\n\t\t\t\t\t\t\t\t\t\tpid: Option.map(childOf(loaded), (child) => child.pid),\n\t\t\t\t\t\t\t\t\t\texitCode: exit.code,\n\t\t\t\t\t\t\t\t\t\tstderr: exit.stderr ?? \"\",\n\t\t\t\t\t\t\t\t\t\tstatusCause: exit.cause ?? Cause.empty,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t} else\n\t\t\t\t\t\tyield* report(\n\t\t\t\t\t\t\tExit.isFailure(status)\n\t\t\t\t\t\t\t\t? Cause.combine(cause, status.cause)\n\t\t\t\t\t\t\t\t: cause,\n\t\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t)\n\treturn {\n\t\tresources,\n\t\tpid: Option.map(childOf(loaded), (child) => child.pid),\n\t\tdiagnostics: failures.cause,\n\t\tterminate: Effect.fnUntraced(function* () {\n\t\t\t// No renewal may extend a disconnected session while termination waits out its lease.\n\t\t\tyield* Fiber.interrupt(renewed)\n\t\t\tyield* terminate\n\t\t}),\n\t\ttransport: {\n\t\t\t...peer,\n\t\t\tfailure: peer.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GAAG;EACrD,aAAa,SAAS;EACtB,WAAW,OAAO,WAAW,aAAa;GAEzC,OAAO,MAAM,UAAU,OAAO;GAC9B,OAAO;EACR,CAAC;EACD,WAAW;GACV,GAAG;GACH,SAAS,KAAK;GACd;EACD;CACD;AACD,CAAC"}
1
+ {"version":3,"file":"runner.js","names":["channel","connectCapability","Multiplex.make","Port.make","Wire.channel","Wire.Session","FailureGroup.make","Packages.verify"],"sources":["../../../src/internal/host/runner.ts"],"sourcesContent":["import {\n\tCause,\n\tDuration,\n\tEffect,\n\tExit,\n\tFiber,\n\tOption,\n\tRef,\n\tScope,\n} from \"effect\"\nimport { RpcClient } from \"effect/rpc\"\n\nimport { ProcessExited, TransportError } from \"../../Errors\"\nimport { connectWith as connectCapability } from \"../assembly\"\nimport { cleanupCause } from \"../cleanup\"\nimport * as FailureGroup from \"../FailureGroup\"\nimport * as Port from \"../port\"\nimport type { ConfiguredRunner, Connected } from \"../runner/Connection\"\nimport { awaitTermination, childOf, defaults } from \"../runner/model\"\nimport * as Multiplex from \"../runner/Multiplex\"\nimport * as Packages from \"../runner/Packages\"\nimport * as Wire from \"../runner/Wire\"\n\nexport const connect = Effect.fnUntraced(function* (\n\ttarget: ConfiguredRunner,\n\tcontractModule: string,\n\toptions: Port.Options,\n\tresources: Scope.Scope,\n\tprocessScope: Scope.Scope,\n) {\n\tconst instance = target.instance\n\n\tconst margin = Duration.toMillis(target.margin ?? \"5 seconds\")\n\tconst channel = yield* connectCapability(target.explicitAuth).pipe(\n\t\tScope.provide(processScope),\n\t)\n\tconst mux = yield* Multiplex.make(channel).pipe(Scope.provide(resources))\n\tconst control = yield* Port.make(Wire.channel(mux, 0), {\n\t\tsession: \"session-v1\",\n\t\tserve: {},\n\t\tcall: { session: Wire.Session },\n\t}).pipe(Scope.provide(resources))\n\tconst session = yield* RpcClient.make(Wire.Session).pipe(\n\t\tEffect.provideService(\n\t\t\tRpcClient.Protocol,\n\t\t\tcontrol.clientProtocol(\"session\"),\n\t\t),\n\t\tScope.provide(resources),\n\t)\n\tconst expectedGeneration = yield* session.HighWater({ instance })\n\tconst record = yield* session.Open({\n\t\tinstance,\n\t\texpectedGeneration,\n\t\trequestId: options.session,\n\t\tlimits: defaults,\n\t\t...(target.lease === undefined\n\t\t\t? {}\n\t\t\t: {\n\t\t\t\t\tleaseMillis: Duration.toMillis(target.lease),\n\t\t\t\t}),\n\t})\n\tconst failures = yield* FailureGroup.make<TransportError>().pipe(\n\t\tScope.provide(resources),\n\t)\n\tconst finishStarted = yield* Ref.make(false)\n\tconst terminate = yield* Effect.cached(\n\t\tEffect.gen(function* () {\n\t\t\tyield* Ref.set(finishStarted, true)\n\t\t\t// A failed close must not skip Dispose; both outcomes are reported together below.\n\t\t\tconst closed = yield* Effect.exit(failures.close)\n\t\t\tconst result = yield* awaitTermination(\n\t\t\t\trecord.handle,\n\t\t\t\tsession.Dispose(record.handle),\n\t\t\t\trecord.leaseMillis,\n\t\t\t\tmargin,\n\t\t\t)\n\t\t\tconst { code, signal, stderr, cause } = result.exit\n\t\t\tyield* Effect.logInfo(\"Remote execution terminated\", {\n\t\t\t\tcode,\n\t\t\t\t...(signal === null ? {} : { signal }),\n\t\t\t\t...(stderr === undefined || stderr === \"\" ? {} : { stderr }),\n\t\t\t\t...(cause === undefined || cause.reasons.length === 0 ? {} : { cause }),\n\t\t\t}).pipe(\n\t\t\t\tEffect.annotateLogs({\n\t\t\t\t\t\"remote.instance\": record.handle.key.instance,\n\t\t\t\t\t\"remote.generation\": record.handle.generation,\n\t\t\t\t\t\"remote.termination\": result.kind,\n\t\t\t\t}),\n\t\t\t)\n\t\t\tconst failure = Exit.isFailure(closed)\n\t\t\t\t? Cause.combine(closed.cause, result.cause)\n\t\t\t\t: result.cause\n\t\t\tif (failure.reasons.length > 0)\n\t\t\t\treturn yield* Effect.failCause(cleanupCause(failure))\n\t\t}),\n\t)\n\tyield* Scope.addFinalizer(\n\t\tprocessScope,\n\t\tEffect.gen(function* () {\n\t\t\tif (!(yield* Ref.get(finishStarted)))\n\t\t\t\tyield* terminate.pipe(\n\t\t\t\t\tEffect.catchCause((cause) => Effect.failCause(cleanupCause(cause))),\n\t\t\t\t)\n\t\t}),\n\t)\n\tconst renewed = yield* Effect.forever(\n\t\tEffect.sleep(record.leaseMillis / 3).pipe(\n\t\t\tEffect.andThen(session.Renew(record.handle)),\n\t\t),\n\t).pipe(Effect.forkIn(resources))\n\tconst code = yield* session.Load({\n\t\thandle: record.handle,\n\t\tspecifier: contractModule,\n\t\tdigest: target.expect?.digest !== undefined,\n\t})\n\tyield* Packages.verify(code, target.expect)\n\tconst loaded = yield* session.Status(record.handle)\n\tconst peer = yield* Port.make(Wire.channel(mux, 1), {\n\t\t...options,\n\t\tsession: record.handle.token,\n\t\tlimits: record.limits,\n\t}).pipe(Scope.provide(resources))\n\t// RPC forwarding cancellation is expected; resource cleanup is collected by Connection's scopes.\n\tconst report = (cause: Cause.Cause<unknown>) =>\n\t\tCause.hasInterruptsOnly(cause)\n\t\t\t? Effect.void\n\t\t\t: failures.failCause(\n\t\t\t\t\tCause.map(cause, (error) =>\n\t\t\t\t\t\tTransportError.make({ cause: Cause.fail(error) }),\n\t\t\t\t\t),\n\t\t\t\t)\n\tyield* failures.await.pipe(\n\t\tEffect.catchCause((cause) =>\n\t\t\tCause.hasInterruptsOnly(cause)\n\t\t\t\t? Effect.void\n\t\t\t\t: peer.fail(TransportError.make({ cause })),\n\t\t),\n\t\tEffect.forkIn(resources),\n\t)\n\n\tyield* failures.run(\n\t\tFiber.join(renewed).pipe(\n\t\t\tEffect.catchCause(\n\t\t\t\tEffect.fnUntraced(function* (cause) {\n\t\t\t\t\tif (Cause.hasInterruptsOnly(cause)) return\n\t\t\t\t\tconst status = yield* Effect.exit(\n\t\t\t\t\t\tsession.Status(record.handle).pipe(Effect.timeout(\"5 seconds\")),\n\t\t\t\t\t)\n\t\t\t\t\tif (Exit.isSuccess(status) && status.value.phase === \"Stopped\") {\n\t\t\t\t\t\tconst exit = status.value.termination.exit\n\t\t\t\t\t\tyield* report(\n\t\t\t\t\t\t\tCause.combine(\n\t\t\t\t\t\t\t\tcause,\n\t\t\t\t\t\t\t\tCause.fail(\n\t\t\t\t\t\t\t\t\tProcessExited.make({\n\t\t\t\t\t\t\t\t\t\tpid: Option.map(childOf(loaded), (child) => child.pid),\n\t\t\t\t\t\t\t\t\t\texitCode: exit.code,\n\t\t\t\t\t\t\t\t\t\tstderr: exit.stderr ?? \"\",\n\t\t\t\t\t\t\t\t\t\tstatusCause: exit.cause ?? Cause.empty,\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t)\n\t\t\t\t\t} else\n\t\t\t\t\t\tyield* report(\n\t\t\t\t\t\t\tExit.isFailure(status)\n\t\t\t\t\t\t\t\t? Cause.combine(cause, status.cause)\n\t\t\t\t\t\t\t\t: cause,\n\t\t\t\t\t\t)\n\t\t\t\t}),\n\t\t\t),\n\t\t),\n\t)\n\treturn {\n\t\tresources,\n\t\tpid: Option.map(childOf(loaded), (child) => child.pid),\n\t\tdiagnostics: failures.cause,\n\t\tterminate: Effect.fnUntraced(function* () {\n\t\t\t// No renewal may extend a disconnected session while termination waits out its lease.\n\t\t\tyield* Fiber.interrupt(renewed)\n\t\t\tyield* terminate\n\t\t}),\n\t\ttransport: {\n\t\t\t...peer,\n\t\t\tfailure: peer.await,\n\t\t\treport,\n\t\t},\n\t} satisfies Connected\n})\n"],"mappings":";;;;;;;;;;;;;AAuBA,MAAa,UAAU,OAAO,WAAW,WACxC,QACA,gBACA,SACA,WACA,cACC;CACD,MAAM,WAAW,OAAO;CAExB,MAAM,SAAS,SAAS,SAAS,OAAO,UAAU,WAAW;CAC7D,MAAMA,YAAU,OAAOC,YAAkB,OAAO,YAAY,CAAC,CAAC,KAC7D,MAAM,QAAQ,YAAY,CAC3B;CACA,MAAM,MAAM,OAAOC,OAAeF,SAAO,CAAC,CAAC,KAAK,MAAM,QAAQ,S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UAClB,MAAM,kBAAkB,KAAK,IAC1B,OAAO,OACP,KAAK,KAAK,eAAe,KAAK,EAAE,MAAM,CAAC,CAAC,CAC5C,GACA,OAAO,OAAO,SAAS,CACxB;CAEA,OAAO,SAAS,IACf,MAAM,KAAK,OAAO,CAAC,CAAC,KACnB,OAAO,WACN,OAAO,WAAW,WAAW,OAAO;EACnC,IAAI,MAAM,kBAAkB,KAAK,GAAG;EACpC,MAAM,SAAS,OAAO,OAAO,KAC5B,QAAQ,OAAO,OAAO,MAAM,CAAC,CAAC,KAAK,OAAO,QAAQ,WAAW,CAAC,CAC/D;EACA,IAAI,KAAK,UAAU,MAAM,KAAK,OAAO,MAAM,UAAU,WAAW;GAC/D,MAAM,OAAO,OAAO,MAAM,YAAY;GACtC,OAAO,OACN,MAAM,QACL,OACA,MAAM,KACL,cAAc,KAAK;IAClB,KAAK,OAAO,IAAI,QAAQ,MAAM,IAAI,UAAU,MAAM,GAAG;IACrD,UAAU,KAAK;IACf,QAAQ,KAAK,UAAU;IACvB,aAAa,KAAK,SAAS,MAAM;GAClC,CAAC,CACF,CACD,CACD;EACD,OACC,OAAO,OACN,KAAK,UAAU,MAAM,IAClB,MAAM,QAAQ,OAAO,OAAO,KAAK,IACjC,KACJ;CACF,CAAC,CACF,CACD,CACD;CACA,OAAO;EACN;EACA,KAAK,OAAO,IAAI,QAAQ,MAAM,IAAI,UAAU,MAAM,GAAG;EACrD,aAAa,SAAS;EACtB,WAAW,OAAO,WAAW,aAAa;GAEzC,OAAO,MAAM,UAAU,OAAO;GAC9B,OAAO;EACR,CAAC;EACD,WAAW;GACV,GAAG;GACH,SAAS,KAAK;GACd;EACD;CACD;AACD,CAAC"}
@@ -1,7 +1,7 @@
1
- import { make } from "./FailureGroup.js";
2
1
  import { RemoteWithdrawn } from "../Errors.js";
3
- import { endpoint } from "./control.js";
4
2
  import { cleanupCause } from "./cleanup.js";
3
+ import { endpoint } from "./control.js";
4
+ import { make } from "./FailureGroup.js";
5
5
  import { Connection } from "./runner/Connection.js";
6
6
  import { Array, Cause, Deferred, Effect, Option, Ref, Scope, Stream } from "effect";
7
7
  import { RpcClient } from "effect/rpc";