@graftland/plugin-remote 0.3.3 → 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.
- package/README.md +18 -54
- package/README.zh-CN.md +17 -51
- package/README.zh-TW.md +17 -51
- package/dist/Auth.d.ts.map +1 -1
- package/dist/Auth.js.map +1 -1
- package/dist/Config.d.ts +1151 -0
- package/dist/Config.d.ts.map +1 -0
- package/dist/Config.js +183 -0
- package/dist/Config.js.map +1 -0
- package/dist/Contract.d.ts +1 -1
- package/dist/Contract.d.ts.map +1 -1
- package/dist/Contract.js +32 -1
- package/dist/Contract.js.map +1 -1
- package/dist/Instance.d.ts.map +1 -1
- package/dist/Instance.js.map +1 -1
- package/dist/Testing.d.ts +1 -1
- package/dist/Testing.d.ts.map +1 -1
- package/dist/Testing.js.map +1 -1
- package/dist/Transport.d.ts +1 -1
- package/dist/Transport.d.ts.map +1 -1
- package/dist/Transport.js.map +1 -1
- package/dist/cli.d.ts +4 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +25 -0
- package/dist/cli.js.map +1 -0
- package/dist/host/auth/bearer.d.ts.map +1 -1
- package/dist/host/auth/bearer.js +4 -2
- package/dist/host/auth/bearer.js.map +1 -1
- package/dist/host/auth/jwt.d.ts.map +1 -1
- package/dist/host/auth/jwt.js +4 -2
- package/dist/host/auth/jwt.js.map +1 -1
- package/dist/host/auth/mtls.d.ts +3 -7
- package/dist/host/auth/mtls.d.ts.map +1 -1
- package/dist/host/auth/mtls.js +13 -14
- package/dist/host/auth/mtls.js.map +1 -1
- package/dist/host/auth/none.d.ts +1 -1
- package/dist/host/auth/none.js +7 -5
- package/dist/host/auth/none.js.map +1 -1
- package/dist/host/command.d.ts +1 -1
- package/dist/host/command.d.ts.map +1 -1
- package/dist/host/command.js +11 -9
- package/dist/host/command.js.map +1 -1
- package/dist/host/local.d.ts.map +1 -1
- package/dist/host/local.js +9 -30
- package/dist/host/local.js.map +1 -1
- package/dist/host/unix.d.ts +1 -1
- package/dist/host/unix.d.ts.map +1 -1
- package/dist/host/unix.js +13 -9
- package/dist/host/unix.js.map +1 -1
- package/dist/host/websocket.d.ts +1 -1
- package/dist/host/websocket.d.ts.map +1 -1
- package/dist/host/websocket.js +11 -8
- package/dist/host/websocket.js.map +1 -1
- package/dist/host/worker.d.ts +1 -1
- package/dist/host/worker.d.ts.map +1 -1
- package/dist/host/worker.js +13 -9
- package/dist/host/worker.js.map +1 -1
- package/dist/index.d.ts +6 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -64
- package/dist/index.js.map +1 -1
- package/dist/internal/Certificates.js.map +1 -1
- package/dist/internal/FailureGroup.js +6 -6
- package/dist/internal/FailureGroup.js.map +1 -1
- package/dist/internal/Peer.js.map +1 -1
- package/dist/internal/{ServeLifecycle.js → RunnerLifecycle.js} +6 -6
- package/dist/internal/RunnerLifecycle.js.map +1 -0
- package/dist/internal/Supervisor.js.map +1 -1
- package/dist/internal/assembly.d.ts +3 -3
- package/dist/internal/assembly.js +8 -8
- package/dist/internal/assembly.js.map +1 -1
- package/dist/internal/auth/config.d.ts +27 -0
- package/dist/internal/auth/config.d.ts.map +1 -0
- package/dist/internal/auth/config.js +29 -0
- package/dist/internal/auth/config.js.map +1 -0
- package/dist/internal/auth/mtls.js.map +1 -1
- package/dist/internal/auth/token.js.map +1 -1
- package/dist/internal/auth/tokenCredentials.d.ts +1 -1
- package/dist/internal/auth/tokenCredentials.d.ts.map +1 -1
- package/dist/internal/auth/tokenCredentials.js +1 -1
- package/dist/internal/auth/tokenCredentials.js.map +1 -1
- package/dist/internal/child.js +3 -3
- package/dist/internal/child.js.map +1 -1
- package/dist/internal/childMain.js +47 -0
- package/dist/internal/childMain.js.map +1 -0
- package/dist/internal/childRuntime.js +8 -8
- package/dist/internal/childRuntime.js.map +1 -1
- package/dist/internal/cleanup.js +3 -3
- package/dist/internal/cleanup.js.map +1 -1
- package/dist/internal/contract.js.map +1 -1
- package/dist/internal/credentials.d.ts +3 -2
- package/dist/internal/credentials.d.ts.map +1 -1
- package/dist/internal/credentials.js +1 -1
- package/dist/internal/credentials.js.map +1 -1
- package/dist/internal/directTransport.js.map +1 -1
- package/dist/internal/entry.d.ts +104 -26
- package/dist/internal/entry.d.ts.map +1 -1
- package/dist/internal/entry.js +22 -9
- package/dist/internal/entry.js.map +1 -1
- package/dist/internal/entryConfig.d.ts +2 -202
- package/dist/internal/entryConfig.js +2 -136
- package/dist/internal/entryConfig.js.map +1 -1
- package/dist/internal/execution.d.ts +4 -4
- package/dist/internal/execution.js +11 -11
- package/dist/internal/execution.js.map +1 -1
- package/dist/internal/follow.js +1 -1
- package/dist/internal/follow.js.map +1 -1
- package/dist/internal/forkTree.js.map +1 -1
- package/dist/internal/host/local.js.map +1 -1
- package/dist/internal/host/runner.js +4 -4
- package/dist/internal/host/runner.js.map +1 -1
- package/dist/internal/host.js +2 -2
- package/dist/internal/host.js.map +1 -1
- package/dist/internal/importer.js +1 -1
- package/dist/internal/importer.js.map +1 -1
- package/dist/internal/listenerStartup.js +1 -1
- package/dist/internal/listenerStartup.js.map +1 -1
- package/dist/internal/loadModule.js.map +1 -1
- package/dist/internal/platform.js +1 -9
- package/dist/internal/port.d.ts +1 -1
- package/dist/internal/port.js +2 -2
- package/dist/internal/port.js.map +1 -1
- package/dist/internal/runner/Bootstrap.js.map +1 -1
- package/dist/internal/runner/Connection.d.ts +3 -2
- package/dist/internal/runner/Connection.js +6 -6
- package/dist/internal/runner/Connection.js.map +1 -1
- package/dist/internal/runner/Execution.js +6 -6
- package/dist/internal/runner/Execution.js.map +1 -1
- package/dist/internal/runner/Local.js +1 -1
- package/dist/internal/runner/Local.js.map +1 -1
- package/dist/internal/runner/Lock.js.map +1 -1
- package/dist/internal/runner/Multiplex.js.map +1 -1
- package/dist/internal/runner/Packages.js.map +1 -1
- package/dist/internal/runner/ProcessObservation.js.map +1 -1
- package/dist/internal/runner/Processes.js.map +1 -1
- package/dist/internal/runner/Retention.js.map +1 -1
- package/dist/internal/runner/Store.js.map +1 -1
- package/dist/internal/runner/Supervisor.js +5 -5
- package/dist/internal/runner/Supervisor.js.map +1 -1
- package/dist/internal/runner/Watchdog.js.map +1 -1
- package/dist/internal/runner/Wire.d.ts +1 -1
- package/dist/internal/runner/Wire.js.map +1 -1
- package/dist/internal/runner/accept.js +2 -2
- package/dist/internal/runner/accept.js.map +1 -1
- package/dist/internal/runner/command.js +1 -1
- package/dist/internal/runner/command.js.map +1 -1
- package/dist/internal/runner/connectionEnded.js +1 -1
- package/dist/internal/runner/connectionEnded.js.map +1 -1
- package/dist/internal/runner/model.d.ts.map +1 -1
- package/dist/internal/runner/model.js.map +1 -1
- package/dist/internal/services.d.ts.map +1 -1
- package/dist/internal/services.js +1 -1
- package/dist/internal/services.js.map +1 -1
- package/dist/internal/socketChannel.js.map +1 -1
- package/dist/internal/stdioChannel.js.map +1 -1
- package/dist/internal/supervisorPlugin.js +48 -1
- package/dist/internal/supervisorPlugin.js.map +1 -1
- package/dist/internal/transportOptions.d.ts.map +1 -1
- package/dist/internal/watchdogMain.js +5 -3
- package/dist/internal/watchdogMain.js.map +1 -1
- package/dist/internal/websocket.js.map +1 -1
- package/dist/internal/websocketServer.js +1 -1
- package/dist/internal/websocketServer.js.map +1 -1
- package/dist/internal/workerChannel.js.map +1 -1
- package/dist/internal/workerMain.js +13 -6
- package/dist/internal/workerMain.js.map +1 -1
- package/dist/runner/auth/bearer.d.ts +3 -5
- package/dist/runner/auth/bearer.d.ts.map +1 -1
- package/dist/runner/auth/bearer.js +13 -11
- package/dist/runner/auth/bearer.js.map +1 -1
- package/dist/runner/auth/jwt.d.ts +4 -18
- package/dist/runner/auth/jwt.d.ts.map +1 -1
- package/dist/runner/auth/jwt.js +16 -28
- package/dist/runner/auth/jwt.js.map +1 -1
- package/dist/runner/auth/mtls.d.ts +3 -6
- package/dist/runner/auth/mtls.d.ts.map +1 -1
- package/dist/runner/auth/mtls.js +13 -29
- package/dist/runner/auth/mtls.js.map +1 -1
- package/dist/runner/auth/none.d.ts +1 -1
- package/dist/runner/auth/none.js +7 -5
- package/dist/runner/auth/none.js.map +1 -1
- package/dist/runner/index.d.ts +3 -308
- package/dist/runner/index.d.ts.map +1 -1
- package/dist/runner/index.js +62 -30
- package/dist/runner/index.js.map +1 -1
- package/dist/runner/stdio.d.ts +1 -1
- package/dist/runner/stdio.d.ts.map +1 -1
- package/dist/runner/stdio.js +11 -9
- package/dist/runner/stdio.js.map +1 -1
- package/dist/runner/unix.d.ts +1 -1
- package/dist/runner/unix.d.ts.map +1 -1
- package/dist/runner/unix.js +10 -8
- package/dist/runner/unix.js.map +1 -1
- package/dist/runner/websocket.d.ts +1 -1
- package/dist/runner/websocket.d.ts.map +1 -1
- package/dist/runner/websocket.js +12 -10
- package/dist/runner/websocket.js.map +1 -1
- package/package.json +14 -12
- package/schema.json +2269 -0
- package/src/Auth.ts +8 -2
- package/src/Config.ts +196 -0
- package/src/Contract.ts +12 -3
- package/src/Instance.ts +1 -0
- package/src/Testing.ts +6 -4
- package/src/Transport.ts +12 -3
- package/src/cli.ts +60 -0
- package/src/host/auth/bearer.ts +1 -0
- package/src/host/auth/jwt.ts +1 -0
- package/src/host/auth/mtls.ts +7 -12
- package/src/host/auth/none.ts +3 -1
- package/src/host/command.ts +8 -5
- package/src/host/local.ts +4 -2
- package/src/host/unix.ts +11 -7
- package/src/host/websocket.ts +10 -7
- package/src/host/worker.ts +8 -5
- package/src/index.ts +36 -23
- package/src/internal/Certificates.ts +1 -0
- package/src/internal/FailureGroup.ts +5 -3
- package/src/internal/Peer.ts +1 -0
- package/src/internal/{ServeLifecycle.ts → RunnerLifecycle.ts} +7 -5
- package/src/internal/Supervisor.ts +5 -4
- package/src/internal/assembly.ts +11 -9
- package/src/internal/auth/config.ts +44 -0
- package/src/internal/auth/mtls.ts +1 -0
- package/src/internal/auth/token.ts +1 -0
- package/src/internal/auth/tokenCredentials.ts +4 -2
- package/src/internal/child.ts +8 -6
- package/src/{bin.ts → internal/childMain.ts} +16 -61
- package/src/internal/childRuntime.ts +12 -10
- package/src/internal/cleanup.ts +3 -2
- package/src/internal/contract.ts +1 -0
- package/src/internal/credentials.ts +3 -1
- package/src/internal/directTransport.ts +9 -2
- package/src/internal/entry.ts +53 -16
- package/src/internal/entryConfig.ts +10 -132
- package/src/internal/execution.ts +17 -15
- package/src/internal/follow.ts +2 -1
- package/src/internal/forkTree.ts +2 -1
- package/src/internal/host/local.ts +1 -0
- package/src/internal/host/runner.ts +7 -5
- package/src/internal/host.ts +9 -8
- package/src/internal/importer.ts +3 -2
- package/src/internal/listenerStartup.ts +4 -2
- package/src/internal/loadModule.ts +1 -0
- package/src/internal/platform.ts +1 -12
- package/src/internal/port.ts +11 -6
- package/src/internal/runner/Bootstrap.ts +1 -0
- package/src/internal/runner/Connection.ts +13 -11
- package/src/internal/runner/Execution.ts +14 -13
- package/src/internal/runner/Local.ts +3 -2
- package/src/internal/runner/Lock.ts +1 -0
- package/src/internal/runner/Multiplex.ts +2 -1
- package/src/internal/runner/Packages.ts +7 -5
- package/src/internal/runner/ProcessObservation.ts +2 -1
- package/src/internal/runner/Processes.ts +3 -1
- package/src/internal/runner/Retention.ts +1 -0
- package/src/internal/runner/Store.ts +3 -2
- package/src/internal/runner/Supervisor.ts +22 -20
- package/src/internal/runner/Watchdog.ts +3 -1
- package/src/internal/runner/Wire.ts +13 -12
- package/src/internal/runner/accept.ts +6 -5
- package/src/internal/runner/command.ts +3 -2
- package/src/internal/runner/connectionEnded.ts +2 -1
- package/src/internal/runner/model.ts +5 -3
- package/src/internal/services.ts +9 -2
- package/src/internal/socketChannel.ts +2 -1
- package/src/internal/stdioChannel.ts +4 -2
- package/src/internal/supervisorPlugin.ts +10 -8
- package/src/internal/transportOptions.ts +1 -0
- package/src/internal/watchdogMain.ts +5 -3
- package/src/internal/websocket.ts +5 -2
- package/src/internal/websocketServer.ts +6 -4
- package/src/internal/workerChannel.ts +1 -0
- package/src/internal/workerMain.ts +21 -5
- package/src/runner/auth/bearer.ts +10 -6
- package/src/runner/auth/jwt.ts +10 -41
- package/src/runner/auth/mtls.ts +6 -3
- package/src/runner/auth/none.ts +3 -1
- package/src/runner/index.ts +102 -11
- package/src/runner/stdio.ts +15 -10
- package/src/runner/unix.ts +7 -4
- package/src/runner/websocket.ts +9 -7
- package/dist/Auth-BElTC9_X.js +0 -6
- package/dist/Bootstrap-H9gDsgsC.js +0 -9
- package/dist/ConfigDirectory-BCC6q2R4.js +0 -5
- package/dist/Contract-DsJtisvL.js +0 -83
- package/dist/Errors-DYhsGZcZ.js +0 -58
- package/dist/FailureGroup-BgT73AaR.js +0 -63
- package/dist/Framing-G9eSaeLb.js +0 -61
- package/dist/Graft-B71CPA2Y.js +0 -996
- package/dist/Packages-AgoCGotL.js +0 -108
- package/dist/Peer-DXeVrGBh.js +0 -342
- package/dist/ProcessObservation-gLgGirYv.js +0 -38
- package/dist/ServeLifecycle-Bd1FPJ6e.js +0 -24
- package/dist/Transport-DULzpsgR.js +0 -6
- package/dist/WatchdogProtocol-BZmVxrBP.js +0 -17
- package/dist/bin.js +0 -28276
- package/dist/bin.js.map +0 -1
- package/dist/childRuntime-Bm3iSg_N.js +0 -192
- package/dist/command-9zrHdbwT.js +0 -7
- package/dist/connectionEnded-BwcxQ7W8.js +0 -54
- package/dist/directTransport-DrexuPSm.js +0 -5
- package/dist/entry-psOpX3Bj.js +0 -736
- package/dist/importer-Cvf88eAY.js +0 -344
- package/dist/internal/ServeLifecycle.js.map +0 -1
- package/dist/internal/entryConfig.d.ts.map +0 -1
- package/dist/internal/platform.js.map +0 -1
- package/dist/internal/release.js +0 -25
- package/dist/internal/release.js.map +0 -1
- package/dist/internal/serve.js +0 -60
- package/dist/internal/serve.js.map +0 -1
- package/dist/port--3x2zJ4D.js +0 -285
- package/dist/release-DfZPuIcK.js +0 -23
- package/dist/rolldown-runtime-DYf_mQCB.js +0 -34
- package/dist/socketChannel-CJvL2DiB.js +0 -3658
- package/dist/supervisorPlugin-t6Z6PrhD.js +0 -733
- package/dist/token-CYBNNlhS.js +0 -17
- package/dist/tokenCredentials-CbCuk-Rt.js +0 -31
- package/dist/websocketServer-NQhODlEt.js +0 -60
- package/dist/workerChannel-C8hhBJzA.js +0 -27
- package/src/internal/release.ts +0 -72
- package/src/internal/serve.ts +0 -119
- /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
|
|
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
|
package/src/internal/follow.ts
CHANGED
|
@@ -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>,
|
package/src/internal/forkTree.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
23
|
+
|
|
22
24
|
export const connect = Effect.fnUntraced(function* (
|
|
23
25
|
target: ConfiguredRunner,
|
|
24
26
|
contractModule: string,
|
package/src/internal/host.ts
CHANGED
|
@@ -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
|
-
|
|
16
|
-
import * as
|
|
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
|
package/src/internal/importer.ts
CHANGED
|
@@ -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-
|
|
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
|
|
38
|
+
detail: "A stdio listener must be the only listener in the runner",
|
|
37
39
|
}),
|
|
38
40
|
)
|
|
39
41
|
const issuers = HashSet.fromIterable(
|
package/src/internal/platform.ts
CHANGED
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
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"
|
package/src/internal/port.ts
CHANGED
|
@@ -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
|
-
|
|
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,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
|
-
|
|
20
|
-
import
|
|
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
|
|
24
|
-
import
|
|
25
|
-
import
|
|
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
|
|
33
|
-
import
|
|
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
|
-
|
|
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
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
5
|
+
|
|
4
6
|
import {
|
|
5
7
|
ExecutionError,
|
|
6
8
|
TerminationUnconfirmed,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
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
|
-
|
|
12
|
+
PackageError,
|
|
11
13
|
PositiveFinite,
|
|
12
|
-
|
|
14
|
+
PositiveInt,
|
|
15
|
+
RunnerClosing,
|
|
13
16
|
SessionAccessDenied,
|
|
14
|
-
StaleSession,
|
|
15
|
-
LeaseExpired,
|
|
16
|
-
SessionStopped,
|
|
17
17
|
SessionConflict,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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,
|
|
1
|
+
import { Cause, Effect, Option, Ref, Scope, Semaphore } from "effect"
|
|
2
2
|
import { RpcServer } from "effect/rpc"
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { TransportError } from "../../Errors"
|
|
5
5
|
import type { Channel } from "../../Transport"
|
|
6
|
-
import
|
|
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/
|
|
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
|
-
|
|
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 }),
|