@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,4 +1,3 @@
1
- import { Plugin } from "@graftland/graft"
2
1
  import {
3
2
  Array,
4
3
  Cause,
@@ -7,29 +6,32 @@ import {
7
6
  PlatformError,
8
7
  Schema,
9
8
  Scope,
9
+ type Duration,
10
10
  } from "effect"
11
11
  import { SecureRandom } from "effect/crypto"
12
12
  import { RpcClientError } from "effect/rpc"
13
+
14
+ import { Plugin } from "@graftland/graft"
15
+ import { ReleaseInterrupted } from "@graftland/graft/Release"
16
+
17
+ import { Credentials } from "../Auth"
18
+ import * as Contract from "../Contract"
19
+ import * as Errors from "../Errors"
20
+ import { MissingInstance, RemoteError, RemoteWithdrawn } from "../Errors"
21
+ import { Connector } from "../Transport"
22
+ import * as Assembly from "./assembly"
23
+ import * as ChildErrors from "./childErrors"
24
+ import { prepare } from "./contract"
25
+ import * as Control from "./control"
26
+ import { LocalTransport, WorkerTransport } from "./directTransport"
27
+ import * as Host from "./host"
13
28
  import type {
14
29
  LocalTarget as Local,
15
30
  WorkerTarget as Worker,
16
31
  } from "./runner/Connection"
17
- import { Connector } from "../Transport"
18
- import { LocalTransport, WorkerTransport } from "./directTransport"
19
- import { Credentials } from "../Auth"
20
- import type { Duration } from "effect"
21
32
  import * as Connection from "./runner/Connection"
22
- import * as Services from "./services"
23
- import * as Host from "./host"
24
- import * as Errors from "../Errors"
25
- import { RemoteWithdrawn, RemoteError, MissingInstance } from "../Errors"
26
- import * as ChildErrors from "./childErrors"
27
- import * as Assembly from "./assembly"
28
33
  import * as Model from "./runner/model"
29
- import { ReleaseInterrupted } from "./release"
30
- import * as Contract from "../Contract"
31
- import * as Control from "./control"
32
- import { prepare } from "./contract"
34
+ import * as Services from "./services"
33
35
 
34
36
  export interface ExecutionOptions {
35
37
  readonly contractModule: string
@@ -1,6 +1,7 @@
1
- import { Plugin, type Fork, type Graft } from "@graftland/graft"
2
1
  import { Effect, Stream, type Cause, type Schema } from "effect"
3
2
 
3
+ import { Plugin, type Fork, type Graft } from "@graftland/graft"
4
+
4
5
  /** Follow startup and later failures without changing the caller's error boundary. */
5
6
  export const follow = Effect.fnUntraced(function* <I, E, F>(
6
7
  fork: Fork.Fork<I, E>,
@@ -1,6 +1,7 @@
1
- import type { Fork } from "@graftland/graft"
2
1
  import { Array, Option } from "effect"
3
2
 
3
+ import type { Fork } from "@graftland/graft"
4
+
4
5
  export const findSubtree = (
5
6
  trees: ReadonlyArray<Fork.ForkTree>,
6
7
  id: number,
@@ -1,5 +1,6 @@
1
1
  import { Cause, Effect, Fiber, Option, Sink, Stream } from "effect"
2
2
  import type { ChildProcessSpawner } from "effect/process"
3
+
3
4
  import { ProcessExited, TransportError } from "../../Errors"
4
5
  import * as ProcessObservation from "../runner/ProcessObservation"
5
6
 
@@ -1,8 +1,7 @@
1
- import * as FailureGroup from "../FailureGroup"
2
1
  import {
3
2
  Cause,
4
- Effect,
5
3
  Duration,
4
+ Effect,
6
5
  Exit,
7
6
  Fiber,
8
7
  Option,
@@ -10,15 +9,18 @@ import {
10
9
  Scope,
11
10
  } from "effect"
12
11
  import { RpcClient } from "effect/rpc"
13
- import { connectWith as connectCapability } from "../assembly"
14
- import type { ConfiguredRunner, Connected } from "../runner/Connection"
12
+
15
13
  import { ProcessExited, TransportError } from "../../Errors"
14
+ import { connectWith as connectCapability } from "../assembly"
16
15
  import { cleanupCause } from "../cleanup"
16
+ import * as FailureGroup from "../FailureGroup"
17
17
  import * as Port from "../port"
18
+ import type { ConfiguredRunner, Connected } from "../runner/Connection"
19
+ import { awaitTermination, childOf, defaults } from "../runner/model"
18
20
  import * as Multiplex from "../runner/Multiplex"
19
21
  import * as Packages from "../runner/Packages"
20
22
  import * as Wire from "../runner/Wire"
21
- import { awaitTermination, defaults, childOf } from "../runner/model"
23
+
22
24
  export const connect = Effect.fnUntraced(function* (
23
25
  target: ConfiguredRunner,
24
26
  contractModule: string,
@@ -1,24 +1,25 @@
1
- import * as FailureGroup from "./FailureGroup"
2
- import * as ContractModule from "../Contract"
3
1
  import {
4
- Cause,
5
2
  Array,
3
+ Cause,
6
4
  Deferred,
7
5
  Effect,
8
- Ref,
9
6
  Option,
7
+ Ref,
10
8
  Schema,
11
9
  Scope,
12
10
  Stream,
13
11
  } from "effect"
14
12
  import { RpcClient, type RpcClientError } from "effect/rpc"
15
- import { RemoteWithdrawn } from "../Errors"
16
- import * as Control from "./control"
17
- import { cleanupCause } from "./cleanup"
18
- import { Connection } from "./runner/Connection"
13
+
14
+ import * as ContractModule from "../Contract"
19
15
  import type { Service } from "../Contract"
16
+ import { RemoteWithdrawn } from "../Errors"
20
17
  import type { ChildFailure } from "./childErrors"
18
+ import { cleanupCause } from "./cleanup"
21
19
  import type { prepare } from "./contract"
20
+ import * as Control from "./control"
21
+ import * as FailureGroup from "./FailureGroup"
22
+ import { Connection } from "./runner/Connection"
22
23
 
23
24
  type ErrorSchema = Schema.Top & {
24
25
  readonly DecodingServices: never
@@ -1,6 +1,7 @@
1
+ import { registerHooks } from "node:module"
2
+
1
3
  import { Effect, Path, String } from "effect"
2
4
  import { SecureRandom } from "effect/crypto"
3
- import { registerHooks } from "node:module"
4
5
 
5
6
  /** Bare names resolve from the application; imported dependencies keep their own parent URLs. */
6
7
  export const make = Effect.fnUntraced(function* (directory: string) {
@@ -8,7 +9,7 @@ export const make = Effect.fnUntraced(function* (directory: string) {
8
9
  const base = yield* path.toFileUrl(path.join(directory, "graft.yml"))
9
10
  const random = yield* SecureRandom.SecureRandom
10
11
  const id = yield* random.uuidV4()
11
- const prefix = `graft-remote-${id}:`
12
+ const prefix = `graft-module-${id}:`
12
13
  yield* Effect.acquireRelease(
13
14
  Effect.sync(() =>
14
15
  registerHooks({
@@ -1,5 +1,7 @@
1
- import type { Fork } from "@graftland/graft"
2
1
  import { Array, Deferred, Effect, HashSet, Option, Stream } from "effect"
2
+
3
+ import type { Fork } from "@graftland/graft"
4
+
3
5
  import type { AuthenticatorApi } from "../Auth"
4
6
  import type { Properties } from "../Transport"
5
7
  import { CapabilityCombinationError, CapabilityFailed } from "./assembly"
@@ -33,7 +35,7 @@ export const validate = (listeners: ReadonlyArray<Description>) => {
33
35
  )
34
36
  return Effect.fail(
35
37
  CapabilityCombinationError.make({
36
- detail: "A stdio listener must be the only listener in serve",
38
+ detail: "A stdio listener must be the only listener in the runner",
37
39
  }),
38
40
  )
39
41
  const issuers = HashSet.fromIterable(
@@ -1,4 +1,5 @@
1
1
  import { Cause, Effect } from "effect"
2
+
2
3
  import { ModuleImportFailed } from "./childErrors"
3
4
 
4
5
  /** Native imports cannot be cancelled; late rejection still belongs to the importing context. */
@@ -1,12 +1 @@
1
- import { NodeServices } from "@effect/platform-node"
2
- import { Layer } from "effect"
3
- import { Digest, SecureRandom, Signature } from "effect/crypto"
4
- import { FetchHttpClient } from "effect/http"
5
-
6
- export const platform = Layer.mergeAll(
7
- NodeServices.layer,
8
- FetchHttpClient.layer,
9
- Digest.layerWebCrypto,
10
- SecureRandom.layerWebCrypto,
11
- Signature.layerWebCrypto.pipe(Layer.provide(SecureRandom.layerWebCrypto)),
12
- )
1
+ export { platform } from "@graftland/cli/Application"
@@ -1,6 +1,3 @@
1
- import { EndOfStream } from "./runner/Framing"
2
- export type { Channel } from "../Transport"
3
- import type { Channel } from "../Transport"
4
1
  import {
5
2
  Array,
6
3
  Cause,
@@ -15,21 +12,29 @@ import {
15
12
  Record,
16
13
  Result,
17
14
  Schema,
18
- type Scope,
19
15
  Stream,
20
16
  TxQueue,
21
17
  TxRef,
18
+ type Scope,
22
19
  } from "effect"
23
20
  import {
24
21
  RpcClient,
25
22
  RpcClientError,
26
23
  RpcSerialization,
27
24
  RpcServer,
25
+ type Rpc,
26
+ type RpcGroup,
27
+ type RpcMessage,
28
28
  } from "effect/rpc"
29
- import type { Rpc, RpcGroup, RpcMessage } from "effect/rpc"
30
- import * as FailureGroup from "./FailureGroup"
29
+
31
30
  import { TransportError } from "../Errors"
31
+ import type { Channel } from "../Transport"
32
+ import * as FailureGroup from "./FailureGroup"
32
33
  import { defaults, type Limits } from "./Limits"
34
+ import { EndOfStream } from "./runner/Framing"
35
+
36
+ export type { Channel } from "../Transport"
37
+
33
38
  export type Priority = keyof Limits
34
39
 
35
40
  export const Priority = Context.Reference<Priority>(
@@ -1,4 +1,5 @@
1
1
  import { Schema } from "effect"
2
+
2
3
  import { Identity } from "../../Instance"
3
4
  import { Limits } from "./model"
4
5
 
@@ -1,24 +1,18 @@
1
- import {
2
- LocalTransport,
3
- WorkerTransport,
4
- type Execution,
5
- } from "../directTransport"
6
- import * as RunnerConnection from "../host/runner"
7
1
  import {
8
2
  Array,
9
3
  Cause,
10
4
  Context,
11
- Effect,
12
5
  Duration,
6
+ Effect,
13
7
  Exit,
14
8
  Option,
15
9
  Scope,
10
+ type PlatformError,
11
+ type Schema,
16
12
  } from "effect"
17
- import * as Release from "../release"
18
13
  import type { RpcClientError } from "effect/rpc"
19
- import type { Schema, PlatformError } from "effect"
20
- import type { RemoteTerminationUnconfirmed } from "./model"
21
- import type { Expected } from "./Packages"
14
+
15
+ import * as Release from "@graftland/graft/Release"
22
16
 
23
17
  import {
24
18
  LocalTerminationTimeout,
@@ -26,8 +20,16 @@ import {
26
20
  TransportError,
27
21
  } from "../../Errors"
28
22
  import { cleanupCause } from "../cleanup"
23
+ import {
24
+ LocalTransport,
25
+ WorkerTransport,
26
+ type Execution,
27
+ } from "../directTransport"
28
+ import * as RunnerConnection from "../host/runner"
29
29
  import * as Port from "../port"
30
30
  import * as LocalProcess from "./Local"
31
+ import type { RemoteTerminationUnconfirmed } from "./model"
32
+ import type { Expected } from "./Packages"
31
33
  import * as Wire from "./Wire"
32
34
 
33
35
  export interface LocalTarget {
@@ -1,36 +1,37 @@
1
- import * as ProcessObservation from "./ProcessObservation"
2
- import * as FailureGroup from "../FailureGroup"
3
- import { Command, CommandJson } from "./WatchdogProtocol"
4
1
  import {
5
2
  Array,
6
3
  Cause,
7
- FileSystem,
8
- Path,
9
- Schema,
10
4
  Context,
11
5
  Effect,
6
+ FileSystem,
12
7
  HashMap,
13
8
  HashSet,
9
+ Layer,
10
+ Path,
14
11
  Queue,
15
12
  Ref,
13
+ Schema,
14
+ Scope,
16
15
  Sink,
17
16
  Stream,
18
- Layer,
19
- Scope,
20
17
  } from "effect"
21
18
  import { ChildProcess, ChildProcessSpawner } from "effect/process"
19
+
22
20
  import { TransportError } from "../../Errors"
23
- import * as Multiplex from "./Multiplex"
24
- import * as Packages from "./Packages"
25
- import * as Processes from "./Processes"
21
+ import * as FailureGroup from "../FailureGroup"
22
+ import { Bootstrap } from "./Bootstrap"
23
+ import { command } from "./command"
26
24
  import {
27
25
  Execution,
28
26
  ExecutionError,
29
27
  SessionConflict,
30
28
  SessionStopped,
31
29
  } from "./model"
32
- import { Bootstrap } from "./Bootstrap"
33
- import { command } from "./command"
30
+ import * as Multiplex from "./Multiplex"
31
+ import * as Packages from "./Packages"
32
+ import * as Processes from "./Processes"
33
+ import * as ProcessObservation from "./ProcessObservation"
34
+ import { Command, CommandJson } from "./WatchdogProtocol"
34
35
 
35
36
  export class Channels extends Context.Service<
36
37
  Channels,
@@ -1,11 +1,12 @@
1
1
  import { Cause, Effect, Fiber, Option } from "effect"
2
- import type { Execution } from "../directTransport"
3
- import * as FailureGroup from "../FailureGroup"
2
+
4
3
  import {
5
4
  LocalTerminationTimeout,
6
5
  ProcessExited,
7
6
  TransportError,
8
7
  } from "../../Errors"
8
+ import type { Execution } from "../directTransport"
9
+ import * as FailureGroup from "../FailureGroup"
9
10
  import * as Port from "../port"
10
11
  import { stdinExitTimeout } from "./ProcessObservation"
11
12
 
@@ -1,4 +1,5 @@
1
1
  import { Cause, Effect, FileSystem, Path } from "effect"
2
+
2
3
  import { StateDirectoryLocked } from "./model"
3
4
 
4
5
  /** SQLite owns the local directory lock for the enclosing scope, including failed startup. */
@@ -9,9 +9,10 @@ import {
9
9
  TxQueue,
10
10
  } from "effect"
11
11
  import type { Socket } from "effect/socket"
12
+
12
13
  import { TransportError } from "../../Errors"
13
- import type { Channel as ByteChannel } from "../port"
14
14
  import * as FailureGroup from "../FailureGroup"
15
+ import type { Channel as ByteChannel } from "../port"
15
16
  import * as Framing from "./Framing"
16
17
 
17
18
  export interface Peer {
@@ -1,3 +1,8 @@
1
+ // @effect-diagnostics-next-line nodeBuiltinImport:off -- WebCrypto has no incremental digest API; package files are hashed as streams without buffering the directory.
2
+ import { createHash } from "node:crypto"
3
+ import process from "node:process"
4
+ import { fileURLToPath } from "node:url"
5
+
1
6
  import {
2
7
  Array,
3
8
  Cause,
@@ -8,13 +13,10 @@ import {
8
13
  Schema,
9
14
  Stream,
10
15
  String,
16
+ type PlatformError,
11
17
  } from "effect"
12
- import type { PlatformError } from "effect"
13
18
  import { ChildProcess, ChildProcessSpawner } from "effect/process"
14
- // @effect-diagnostics-next-line nodeBuiltinImport:off -- WebCrypto has no incremental digest API; package files are hashed as streams without buffering the directory.
15
- import { createHash } from "node:crypto"
16
- import process from "node:process"
17
- import { fileURLToPath } from "node:url"
19
+
18
20
  import { PackageError, type CodeIdentity } from "./model"
19
21
 
20
22
  const Manifest = Schema.Struct({ name: Schema.String, version: Schema.String })
@@ -8,9 +8,10 @@ import {
8
8
  Schedule,
9
9
  Stream,
10
10
  String,
11
+ type PlatformError,
11
12
  } from "effect"
12
- import type { PlatformError } from "effect"
13
13
  import type { ChildProcessSpawner } from "effect/process"
14
+
14
15
  import * as FailureGroup from "../FailureGroup"
15
16
 
16
17
  /** Time allowed for a direct execution unit or launcher to exit after input EOF. */
@@ -1,6 +1,8 @@
1
+ import process from "node:process"
2
+
1
3
  import { Cause, Effect, Option, Schedule, Stream, String } from "effect"
2
4
  import { ChildProcess, ChildProcessSpawner } from "effect/process"
3
- import process from "node:process"
5
+
4
6
  import {
5
7
  ExecutionError,
6
8
  TerminationUnconfirmed,
@@ -1,4 +1,5 @@
1
1
  import { Array, HashMap, Option } from "effect"
2
+
2
3
  import { keyOf, type SessionKey, type SessionRecord } from "./model"
3
4
 
4
5
  /** A terminal high-water record fences every older Open, even after its request id is forgotten. */
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Array,
3
3
  Cause,
4
- Layer,
5
4
  Effect,
6
5
  FileSystem,
7
6
  HashMap,
8
7
  HashSet,
8
+ Layer,
9
9
  Path,
10
10
  Ref,
11
11
  Schema,
@@ -14,7 +14,8 @@ import {
14
14
  type PlatformError,
15
15
  } from "effect"
16
16
  import { Digest, SecureRandom } from "effect/crypto"
17
- import { Key, SessionRecord, Store, StateStorageError } from "./model"
17
+
18
+ import { Key, SessionRecord, StateStorageError, Store } from "./model"
18
19
  import * as Retention from "./Retention"
19
20
 
20
21
  /** Injectable store used by deterministic supervisor tests. */
@@ -1,4 +1,3 @@
1
- import * as FailureGroup from "../FailureGroup"
2
1
  import {
3
2
  Array,
4
3
  Cause,
@@ -22,28 +21,30 @@ import {
22
21
  Semaphore,
23
22
  SynchronizedRef,
24
23
  } from "effect"
25
- import * as Release from "../release"
26
24
  import { SecureRandom } from "effect/crypto"
27
- import * as Retention from "./Retention"
25
+
26
+ import * as Release from "@graftland/graft/Release"
27
+
28
28
  import { cleanupCause } from "../cleanup"
29
+ import * as FailureGroup from "../FailureGroup"
29
30
  import {
30
- Execution,
31
- Store,
32
- StaleSession,
33
- LeaseExpired,
34
- SessionStopped,
35
- SessionConflict,
36
- StateStorageError,
37
- ExecutionError,
38
- PackageError,
39
- TerminationUnconfirmed,
40
- RunnerClosing,
41
31
  childOf,
42
32
  defaults,
33
+ Execution,
34
+ ExecutionError,
43
35
  keyOf,
36
+ LeaseExpired,
44
37
  negotiate,
45
- stoppingRecord,
38
+ PackageError,
39
+ RunnerClosing,
40
+ SessionConflict,
41
+ SessionStopped,
42
+ StaleSession,
43
+ StateStorageError,
46
44
  stoppedRecord,
45
+ stoppingRecord,
46
+ Store,
47
+ TerminationUnconfirmed,
47
48
  type ActiveRecord,
48
49
  type CodeIdentity,
49
50
  type ExitStatus,
@@ -51,16 +52,17 @@ import {
51
52
  type Key,
52
53
  type Limits,
53
54
  type Load,
54
- type SessionRecord,
55
+ type LoadedRecord,
56
+ type OpenRecord,
55
57
  type SessionKey,
58
+ type SessionRecord,
59
+ type StoppedRecord,
60
+ type StoppingRecord,
56
61
  type StopReason,
57
62
  type Termination,
58
63
  type Unit,
59
- type OpenRecord,
60
- type LoadedRecord,
61
- type StoppingRecord,
62
- type StoppedRecord,
63
64
  } from "./model"
65
+ import * as Retention from "./Retention"
64
66
 
65
67
  export type SupervisorError =
66
68
  | StaleSession
@@ -1,6 +1,8 @@
1
+ import { Worker } from "node:worker_threads"
2
+
1
3
  import { Cause, Deferred, Effect, Schema } from "effect"
4
+
2
5
  import * as FailureGroup from "../FailureGroup"
3
- import { Worker } from "node:worker_threads"
4
6
  import { ExecutionError } from "./model"
5
7
  import { Notice } from "./WatchdogProtocol"
6
8
 
@@ -1,28 +1,29 @@
1
- import { Cause, Effect, Sink, Stream, Schema } from "effect"
1
+ import { Cause, Effect, Schema, Sink, Stream } from "effect"
2
2
  import { Rpc, RpcGroup } from "effect/rpc"
3
+
3
4
  import { TransportError } from "../../Errors"
4
5
  import * as Port from "../port"
5
- import type * as Multiplex from "./Multiplex"
6
6
  import {
7
7
  CodeIdentity,
8
+ ExecutionError,
8
9
  Handle,
10
+ LeaseExpired,
9
11
  Limits,
10
- PositiveInt,
12
+ PackageError,
11
13
  PositiveFinite,
12
- SessionRecord,
14
+ PositiveInt,
15
+ RunnerClosing,
13
16
  SessionAccessDenied,
14
- StaleSession,
15
- LeaseExpired,
16
- SessionStopped,
17
17
  SessionConflict,
18
- StateStorageError,
19
- ExecutionError,
20
- PackageError,
21
- TerminationUnconfirmed,
22
- RunnerClosing,
18
+ SessionRecord,
19
+ SessionStopped,
20
+ StaleSession,
23
21
  StateDirectoryLocked,
22
+ StateStorageError,
24
23
  Termination,
24
+ TerminationUnconfirmed,
25
25
  } from "./model"
26
+ import type * as Multiplex from "./Multiplex"
26
27
 
27
28
  /** The RPC boundary is the only place that assembles the runner's error schema. */
28
29
  export const SessionError = Schema.Union([
@@ -1,14 +1,15 @@
1
- import { Cause, Effect, Ref, Option, Scope, Semaphore } from "effect"
1
+ import { Cause, Effect, Option, Ref, Scope, Semaphore } from "effect"
2
2
  import { RpcServer } from "effect/rpc"
3
- import { Peer } from "../Peer"
3
+
4
4
  import { TransportError } from "../../Errors"
5
5
  import type { Channel } from "../../Transport"
6
- import type { Supervisor } from "./Supervisor"
7
- import type { Channels } from "./Execution"
6
+ import { Peer } from "../Peer"
8
7
  import * as Port from "../port"
8
+ import type { Channels } from "./Execution"
9
+ import { SessionAccessDenied, SessionConflict, type Handle } from "./model"
9
10
  import * as Multiplex from "./Multiplex"
11
+ import type { Supervisor } from "./Supervisor"
10
12
  import * as Wire from "./Wire"
11
- import { SessionAccessDenied, SessionConflict, type Handle } from "./model"
12
13
 
13
14
  export const accept = Effect.fnUntraced(function* (
14
15
  supervisor: typeof Supervisor.Service,
@@ -1,7 +1,8 @@
1
- import { Effect } from "effect"
2
1
  import process from "node:process"
3
2
  import { fileURLToPath } from "node:url"
4
3
 
4
+ import { Effect } from "effect"
5
+
5
6
  /** Resolve the executable through the installed package export, never a relative dist path. */
6
7
  export const command = (override?: readonly [string, ...string[]]) =>
7
8
  Effect.sync(
@@ -9,7 +10,7 @@ export const command = (override?: readonly [string, ...string[]]) =>
9
10
  override ?? [
10
11
  process.execPath,
11
12
  fileURLToPath(
12
- import.meta.resolve("@graftland/plugin-remote/internal/bin"),
13
+ import.meta.resolve("@graftland/plugin-remote/internal/child"),
13
14
  ),
14
15
  ],
15
16
  )
@@ -1,8 +1,9 @@
1
1
  import { Array, Cause, Effect, Schema } from "effect"
2
2
  import { Socket } from "effect/socket"
3
+
3
4
  import { TransportError } from "../../Errors"
4
- import { EndOfStream } from "./Framing"
5
5
  import { Peer } from "../Peer"
6
+ import { EndOfStream } from "./Framing"
6
7
 
7
8
  // Multiplex preserves the socket reason inside TransportError; only an entirely normal close is silent.
8
9
  export const closedNormally = (cause: Cause.Cause<unknown>): boolean =>
@@ -1,5 +1,3 @@
1
- import { Limits, PositiveInt } from "../Limits"
2
- export { Limits, PositiveInt, PositiveFinite, defaults } from "../Limits"
3
1
  import {
4
2
  Array,
5
3
  Cause,
@@ -9,8 +7,12 @@ import {
9
7
  Effect,
10
8
  Option,
11
9
  Schema,
10
+ type Scope,
12
11
  } from "effect"
13
- import type { Scope } from "effect"
12
+
13
+ import { Limits, PositiveInt } from "../Limits"
14
+
15
+ export { Limits, PositiveInt, PositiveFinite, defaults } from "../Limits"
14
16
 
15
17
  const diagnosticCause = Schema.Cause(
16
18
  Schema.Defect({ includeStack: true }),