@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,108 +0,0 @@
|
|
|
1
|
-
import { c as PackageError } from "./Peer-DXeVrGBh.js";
|
|
2
|
-
import { Array, Cause, Context, Duration, Effect, FileSystem, Order, Path, Schema, Stream, String } from "effect";
|
|
3
|
-
import process from "node:process";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
6
|
-
import { createHash } from "node:crypto";
|
|
7
|
-
// packages/remote/src/internal/config.ts
|
|
8
|
-
const PositiveDuration = Schema.DurationFromString.check(Schema.makeFilter((value) => Duration.isFinite(value) && Duration.toMillis(value) > 0, { expected: "a finite, positive duration" }));
|
|
9
|
-
// packages/remote/src/internal/Supervisor.ts
|
|
10
|
-
/** A listener hands an authenticated byte channel to the supervisor. */
|
|
11
|
-
var Supervisor = class extends Context.Service()("@graftland/plugin-remote/internal/Supervisor") {};
|
|
12
|
-
// packages/remote/src/internal/runner/Packages.ts
|
|
13
|
-
const Manifest = Schema.Struct({
|
|
14
|
-
name: Schema.String,
|
|
15
|
-
version: Schema.String
|
|
16
|
-
});
|
|
17
|
-
const verify = (actual, expected = {}) => expected.version !== void 0 && actual.version !== expected.version ? Effect.fail(PackageError.make({ detail: `Package version mismatch: expected ${expected.version}, received ${actual.version}` })) : expected.digest !== void 0 && actual.digest !== expected.digest ? Effect.fail(PackageError.make({ detail: `Package digest mismatch: expected ${expected.digest}, received ${actual.digest}` })) : Effect.void;
|
|
18
|
-
/** A path-sensitive SHA-256 of sorted entries and bytes, excluding every node_modules subtree. */
|
|
19
|
-
const digest = Effect.fnUntraced(function* (directory) {
|
|
20
|
-
const fs = yield* FileSystem.FileSystem;
|
|
21
|
-
const path = yield* Path.Path;
|
|
22
|
-
const hash = yield* Effect.sync(() => createHash("sha256").update("graft-package-sha256-v1\0"));
|
|
23
|
-
const visit = Effect.fnUntraced(function* (relative) {
|
|
24
|
-
const filename = path.join(directory, relative);
|
|
25
|
-
const info = yield* fs.stat(filename);
|
|
26
|
-
if (info.type !== "File" && info.type !== "Directory") return yield* PackageError.make({ detail: `Unsupported package entry: ${relative}` });
|
|
27
|
-
const name = new TextEncoder().encode(relative);
|
|
28
|
-
yield* Effect.sync(() => {
|
|
29
|
-
hash.update(`${info.type}:${name.byteLength}:${info.type === "File" ? info.size : 0}:`);
|
|
30
|
-
hash.update(name);
|
|
31
|
-
});
|
|
32
|
-
if (info.type === "File") yield* fs.stream(filename).pipe(Stream.runForEach((bytes) => Effect.sync(() => {
|
|
33
|
-
hash.update(bytes);
|
|
34
|
-
})));
|
|
35
|
-
else {
|
|
36
|
-
const entries = yield* fs.readDirectory(filename);
|
|
37
|
-
for (const entry of Array.sort(entries, Order.String)) {
|
|
38
|
-
if (entry === "node_modules") continue;
|
|
39
|
-
yield* visit(relative === "" ? entry : `${relative}/${entry}`);
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
yield* visit("");
|
|
44
|
-
return yield* Effect.sync(() => hash.digest("hex"));
|
|
45
|
-
});
|
|
46
|
-
/**
|
|
47
|
-
* Resolve using Node's import conditions without importing executable package code.
|
|
48
|
-
* The helper's cwd is the installation root and it inherits no NODE_OPTIONS/loaders.
|
|
49
|
-
* The installation directory and its package exports are trusted.
|
|
50
|
-
*/
|
|
51
|
-
const resolve = Effect.fnUntraced(function* (root, specifier, includeDigest = false) {
|
|
52
|
-
const segments = String.split(specifier, "/");
|
|
53
|
-
const scoped = String.startsWith("@")(specifier);
|
|
54
|
-
const name = Array.join(Array.take(segments, scoped ? 2 : 1), "/");
|
|
55
|
-
const fs = yield* FileSystem.FileSystem;
|
|
56
|
-
const path = yield* Path.Path;
|
|
57
|
-
const installation = yield* fs.realPath(root);
|
|
58
|
-
const directory = yield* fs.realPath(path.join(installation, "node_modules", name));
|
|
59
|
-
const manifest = yield* fs.readFileString(path.join(directory, "package.json")).pipe(Effect.flatMap(Schema.decodeEffect(Schema.fromJsonString(Manifest))));
|
|
60
|
-
const resolved = yield* resolveEntry(installation, specifier);
|
|
61
|
-
const filename = yield* Effect.try({
|
|
62
|
-
try: () => fileURLToPath(resolved),
|
|
63
|
-
catch: (error) => PackageError.make({
|
|
64
|
-
detail: "The package export is not a file URL",
|
|
65
|
-
cause: Cause.die(error)
|
|
66
|
-
})
|
|
67
|
-
});
|
|
68
|
-
return {
|
|
69
|
-
directory,
|
|
70
|
-
entry: yield* fs.realPath(filename),
|
|
71
|
-
identity: {
|
|
72
|
-
...manifest,
|
|
73
|
-
...includeDigest ? { digest: yield* digest(directory) } : {}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}, Effect.catchTags({
|
|
77
|
-
PlatformError: (error) => Effect.fail(PackageError.make({
|
|
78
|
-
detail: "Reading the installed package failed",
|
|
79
|
-
cause: Cause.fail(error)
|
|
80
|
-
})),
|
|
81
|
-
SchemaError: (error) => Effect.fail(PackageError.make({
|
|
82
|
-
detail: "Reading the package manifest failed",
|
|
83
|
-
cause: Cause.fail(error)
|
|
84
|
-
}))
|
|
85
|
-
}));
|
|
86
|
-
const resolveEntry = Effect.fnUntraced(function* (installation, specifier) {
|
|
87
|
-
const child = yield* (yield* ChildProcessSpawner.ChildProcessSpawner).spawn(ChildProcess.make(process.execPath, [
|
|
88
|
-
"--input-type=module",
|
|
89
|
-
"--eval",
|
|
90
|
-
"process.stdout.write(import.meta.resolve(process.argv[1]))",
|
|
91
|
-
"--",
|
|
92
|
-
specifier
|
|
93
|
-
], {
|
|
94
|
-
cwd: installation,
|
|
95
|
-
env: {},
|
|
96
|
-
stdin: "ignore",
|
|
97
|
-
stdout: "pipe",
|
|
98
|
-
stderr: "pipe"
|
|
99
|
-
}));
|
|
100
|
-
const [code, stdout, stderr] = yield* Effect.all([
|
|
101
|
-
child.exitCode,
|
|
102
|
-
child.stdout.pipe(Stream.decodeText(), Stream.mkString),
|
|
103
|
-
child.stderr.pipe(Stream.decodeText(), Stream.mkString)
|
|
104
|
-
], { concurrency: "unbounded" });
|
|
105
|
-
if (code !== 0) return yield* PackageError.make({ detail: `Package resolution failed: ${stderr}` });
|
|
106
|
-
return stdout;
|
|
107
|
-
}, Effect.scoped);
|
|
108
|
-
export { PositiveDuration as a, Supervisor as i, resolveEntry as n, verify as r, resolve as t };
|
package/dist/Peer-DXeVrGBh.js
DELETED
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
import { u as TransportError } from "./Errors-DYhsGZcZ.js";
|
|
2
|
-
import { i as encode, r as decoder, t as EndOfStream } from "./Framing-G9eSaeLb.js";
|
|
3
|
-
import { t as make$1 } from "./FailureGroup-BgT73AaR.js";
|
|
4
|
-
import { a as PositiveInt, i as PositiveFinite, r as Limits, t as Priority } from "./port--3x2zJ4D.js";
|
|
5
|
-
import { Array, Cause, Context, Data, Duration, Effect, Fiber, Option, Queue, Schema, Sink, Stream, TxQueue } from "effect";
|
|
6
|
-
import { Rpc, RpcGroup } from "effect/rpc";
|
|
7
|
-
// packages/remote/src/Instance.ts
|
|
8
|
-
const Identity = Schema.Struct({
|
|
9
|
-
id: Schema.String,
|
|
10
|
-
generation: Schema.Int
|
|
11
|
-
});
|
|
12
|
-
/** Outside a remote activation the identity is local/0. Local activations use a fresh UUID/1; runners allocate persistent generations. */
|
|
13
|
-
const Instance = Context.Reference("@graftland/plugin-remote/Instance/Instance", { defaultValue: () => ({
|
|
14
|
-
id: "local",
|
|
15
|
-
generation: 0
|
|
16
|
-
}) });
|
|
17
|
-
// packages/remote/src/internal/runner/Multiplex.ts
|
|
18
|
-
/** Ports own admission and ACK backpressure. This layer only frames and separates session/instance bytes. */
|
|
19
|
-
const make = Effect.fnUntraced(function* (channel) {
|
|
20
|
-
const group = yield* make$1();
|
|
21
|
-
const incoming = {
|
|
22
|
-
0: yield* Queue.unbounded(),
|
|
23
|
-
1: yield* Queue.unbounded()
|
|
24
|
-
};
|
|
25
|
-
const outgoing = {
|
|
26
|
-
0: yield* TxQueue.unbounded(),
|
|
27
|
-
1: yield* TxQueue.unbounded()
|
|
28
|
-
};
|
|
29
|
-
const next = Effect.tx(Effect.gen(function* () {
|
|
30
|
-
const session = yield* TxQueue.poll(outgoing[0]);
|
|
31
|
-
if (Option.isSome(session)) return session.value;
|
|
32
|
-
const instance = yield* TxQueue.poll(outgoing[1]);
|
|
33
|
-
if (Option.isSome(instance)) return instance.value;
|
|
34
|
-
if ((yield* TxQueue.isDone(outgoing[0])) && (yield* TxQueue.isDone(outgoing[1]))) return yield* Cause.done();
|
|
35
|
-
return yield* Effect.txRetry;
|
|
36
|
-
}));
|
|
37
|
-
const writing = yield* group.run(Stream.fromEffectRepeat(next).pipe(Stream.run(channel.output), Effect.asVoid));
|
|
38
|
-
const decoder$1 = decoder();
|
|
39
|
-
yield* group.run(channel.input.pipe(Stream.runForEach((bytes) => Effect.fromResult(decoder$1.decode(bytes)).pipe(Effect.flatMap((frames) => Effect.forEach(frames, (frame) => Queue.offer(incoming[frame.channel], frame.payload), { discard: true })))), Effect.andThen(decoder$1.finish), Effect.andThen(Effect.fail(EndOfStream.make({}))), Effect.mapError((error) => error._tag === "TransportError" ? error : TransportError.make({ cause: Cause.fail(error) }))));
|
|
40
|
-
return {
|
|
41
|
-
await: group.await,
|
|
42
|
-
fail: group.fail,
|
|
43
|
-
end: Effect.tx(TxQueue.end(outgoing[0]).pipe(Effect.andThen(TxQueue.end(outgoing[1])))).pipe(Effect.andThen(Fiber.join(writing))),
|
|
44
|
-
send: (id, payload) => group.race(encode({
|
|
45
|
-
channel: id,
|
|
46
|
-
payload
|
|
47
|
-
}).pipe(Effect.flatMap((bytes) => TxQueue.offer(outgoing[id], bytes)), Effect.asVoid)),
|
|
48
|
-
take: (id) => group.race(Queue.take(incoming[id]))
|
|
49
|
-
};
|
|
50
|
-
});
|
|
51
|
-
Effect.fnUntraced(function* (socket) {
|
|
52
|
-
const reader = yield* socket.reader;
|
|
53
|
-
const writer = yield* socket.writer;
|
|
54
|
-
return yield* make({
|
|
55
|
-
input: Stream.fromEffectRepeat(reader.pull).pipe(Stream.flattenIterable, Stream.map((bytes) => typeof bytes === "string" ? new TextEncoder().encode(bytes) : bytes), Stream.mapError((error) => TransportError.make({ cause: Cause.fail(error) }))),
|
|
56
|
-
output: Sink.forEach((bytes) => writer.write(bytes)).pipe(Sink.mapError((error) => TransportError.make({ cause: Cause.fail(error) })))
|
|
57
|
-
});
|
|
58
|
-
});
|
|
59
|
-
// packages/remote/src/internal/runner/model.ts
|
|
60
|
-
const diagnosticCause = Schema.Cause(Schema.Defect({ includeStack: true }), Schema.Defect({ includeStack: true }));
|
|
61
|
-
var PackageError = class extends Schema.TaggedError()("PackageError", {
|
|
62
|
-
detail: Schema.String,
|
|
63
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
64
|
-
}) {
|
|
65
|
-
get message() {
|
|
66
|
-
return this.detail;
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
var SessionAccessDenied = class extends Schema.TaggedError()("SessionAccessDenied", {
|
|
70
|
-
detail: Schema.String,
|
|
71
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
72
|
-
}) {
|
|
73
|
-
get message() {
|
|
74
|
-
return this.detail;
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
var StaleSession = class extends Schema.TaggedError()("StaleSession", {
|
|
78
|
-
detail: Schema.String,
|
|
79
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
80
|
-
}) {
|
|
81
|
-
get message() {
|
|
82
|
-
return this.detail;
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
var LeaseExpired = class extends Schema.TaggedError()("LeaseExpired", {
|
|
86
|
-
detail: Schema.String,
|
|
87
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
88
|
-
}) {
|
|
89
|
-
get message() {
|
|
90
|
-
return this.detail;
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
var SessionStopped = class extends Schema.TaggedError()("SessionStopped", {
|
|
94
|
-
detail: Schema.String,
|
|
95
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
96
|
-
}) {
|
|
97
|
-
get message() {
|
|
98
|
-
return this.detail;
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
var SessionConflict = class extends Schema.TaggedError()("SessionConflict", {
|
|
102
|
-
detail: Schema.String,
|
|
103
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
104
|
-
}) {
|
|
105
|
-
get message() {
|
|
106
|
-
return this.detail;
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
var StateStorageError = class extends Schema.TaggedError()("StateStorageError", {
|
|
110
|
-
detail: Schema.String,
|
|
111
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
112
|
-
}) {
|
|
113
|
-
get message() {
|
|
114
|
-
return this.detail;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
var ExecutionError = class extends Schema.TaggedError()("ExecutionError", {
|
|
118
|
-
detail: Schema.String,
|
|
119
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
120
|
-
}) {
|
|
121
|
-
get message() {
|
|
122
|
-
return this.detail;
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var TerminationUnconfirmed = class extends Schema.TaggedError()("TerminationUnconfirmed", {
|
|
126
|
-
detail: Schema.String,
|
|
127
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
128
|
-
}) {
|
|
129
|
-
get message() {
|
|
130
|
-
return this.detail;
|
|
131
|
-
}
|
|
132
|
-
};
|
|
133
|
-
var RunnerClosing = class extends Schema.TaggedError()("RunnerClosing", {
|
|
134
|
-
detail: Schema.String,
|
|
135
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
136
|
-
}) {
|
|
137
|
-
get message() {
|
|
138
|
-
return this.detail;
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
var StateDirectoryLocked = class extends Schema.TaggedError()("StateDirectoryLocked", {
|
|
142
|
-
detail: Schema.String,
|
|
143
|
-
cause: Schema.optionalKey(diagnosticCause)
|
|
144
|
-
}) {
|
|
145
|
-
get message() {
|
|
146
|
-
return this.detail;
|
|
147
|
-
}
|
|
148
|
-
};
|
|
149
|
-
const Key = Schema.Struct({
|
|
150
|
-
identity: Schema.NonEmptyString,
|
|
151
|
-
instance: Schema.NonEmptyString
|
|
152
|
-
});
|
|
153
|
-
/** Structural keys keep identity namespaces separate without delimiter conventions. */
|
|
154
|
-
var SessionKey = class extends Data.Class {};
|
|
155
|
-
const keyOf = (key) => new SessionKey(key);
|
|
156
|
-
const negotiate = (local, peer) => ({
|
|
157
|
-
control: Math.min(local.control, peer.control),
|
|
158
|
-
data: Math.min(local.data, peer.data),
|
|
159
|
-
log: Math.min(local.log, peer.log)
|
|
160
|
-
});
|
|
161
|
-
const Handle = Schema.Struct({
|
|
162
|
-
key: Key,
|
|
163
|
-
token: Schema.NonEmptyString,
|
|
164
|
-
generation: PositiveInt
|
|
165
|
-
});
|
|
166
|
-
const ProcessIdentity = Schema.Struct({
|
|
167
|
-
pid: Schema.Int,
|
|
168
|
-
start: Schema.Struct({ born: Schema.String })
|
|
169
|
-
});
|
|
170
|
-
const ExitStatus = Schema.Struct({
|
|
171
|
-
stderr: Schema.optionalKey(Schema.String),
|
|
172
|
-
cause: Schema.optionalKey(diagnosticCause),
|
|
173
|
-
code: Schema.NullOr(Schema.Int),
|
|
174
|
-
signal: Schema.NullOr(Schema.String)
|
|
175
|
-
});
|
|
176
|
-
const CodeIdentity = Schema.Struct({
|
|
177
|
-
name: Schema.String,
|
|
178
|
-
version: Schema.String,
|
|
179
|
-
digest: Schema.optionalKey(Schema.String)
|
|
180
|
-
});
|
|
181
|
-
const Load = Schema.Struct({
|
|
182
|
-
specifier: Schema.String,
|
|
183
|
-
digest: Schema.optionalKey(Schema.Boolean)
|
|
184
|
-
});
|
|
185
|
-
const Termination = Schema.Struct({
|
|
186
|
-
kind: Schema.Literals(["Exited", "Killed"]),
|
|
187
|
-
exit: ExitStatus,
|
|
188
|
-
cause: diagnosticCause
|
|
189
|
-
});
|
|
190
|
-
const Fields = {
|
|
191
|
-
version: Schema.Literal(1),
|
|
192
|
-
handle: Handle,
|
|
193
|
-
requestId: Schema.String,
|
|
194
|
-
leaseMillis: Schema.Finite,
|
|
195
|
-
limits: Limits
|
|
196
|
-
};
|
|
197
|
-
const OpenRecord = Schema.Struct({
|
|
198
|
-
...Fields,
|
|
199
|
-
phase: Schema.Literal("Open")
|
|
200
|
-
});
|
|
201
|
-
const Launch = Schema.Union([Schema.TaggedStruct("Starting", {}), Schema.TaggedStruct("Registered", { child: ProcessIdentity })]);
|
|
202
|
-
const LoadingRecord = Schema.Struct({
|
|
203
|
-
...Fields,
|
|
204
|
-
phase: Schema.Literal("Loading"),
|
|
205
|
-
load: Load,
|
|
206
|
-
launch: Launch
|
|
207
|
-
});
|
|
208
|
-
const LoadedRecord = Schema.Struct({
|
|
209
|
-
...Fields,
|
|
210
|
-
phase: Schema.Literal("Loaded"),
|
|
211
|
-
load: Load,
|
|
212
|
-
child: ProcessIdentity,
|
|
213
|
-
code: CodeIdentity
|
|
214
|
-
});
|
|
215
|
-
const ActiveRecord = Schema.Union([
|
|
216
|
-
OpenRecord,
|
|
217
|
-
LoadingRecord,
|
|
218
|
-
LoadedRecord
|
|
219
|
-
]);
|
|
220
|
-
const StopReason = Schema.Union([...Array.map([
|
|
221
|
-
"Disposed",
|
|
222
|
-
"Expired",
|
|
223
|
-
"Superseded",
|
|
224
|
-
"Recovery",
|
|
225
|
-
"Shutdown",
|
|
226
|
-
"Exited"
|
|
227
|
-
], (tag) => Schema.TaggedStruct(tag, {})), Schema.TaggedStruct("LoadFailed", { cause: diagnosticCause })]);
|
|
228
|
-
const StoppingRecord = Schema.Struct({
|
|
229
|
-
...Fields,
|
|
230
|
-
phase: Schema.Literal("Stopping"),
|
|
231
|
-
previous: ActiveRecord,
|
|
232
|
-
reason: StopReason
|
|
233
|
-
});
|
|
234
|
-
const StoppedRecord = Schema.Struct({
|
|
235
|
-
...Fields,
|
|
236
|
-
phase: Schema.Literal("Stopped"),
|
|
237
|
-
previous: ActiveRecord,
|
|
238
|
-
reason: StopReason,
|
|
239
|
-
termination: Termination
|
|
240
|
-
});
|
|
241
|
-
const SessionRecord = Schema.Union([
|
|
242
|
-
OpenRecord,
|
|
243
|
-
LoadingRecord,
|
|
244
|
-
LoadedRecord,
|
|
245
|
-
StoppingRecord,
|
|
246
|
-
StoppedRecord
|
|
247
|
-
]);
|
|
248
|
-
const childOf = (record) => {
|
|
249
|
-
switch (record.phase) {
|
|
250
|
-
case "Open": return Option.none();
|
|
251
|
-
case "Loading": return record.launch._tag === "Registered" ? Option.some(record.launch.child) : Option.none();
|
|
252
|
-
case "Loaded": return Option.some(record.child);
|
|
253
|
-
case "Stopping":
|
|
254
|
-
case "Stopped": return childOf(record.previous);
|
|
255
|
-
}
|
|
256
|
-
};
|
|
257
|
-
const stoppingRecord = (previous, reason) => ({
|
|
258
|
-
version: previous.version,
|
|
259
|
-
handle: previous.handle,
|
|
260
|
-
requestId: previous.requestId,
|
|
261
|
-
leaseMillis: previous.leaseMillis,
|
|
262
|
-
limits: previous.limits,
|
|
263
|
-
phase: "Stopping",
|
|
264
|
-
previous,
|
|
265
|
-
reason
|
|
266
|
-
});
|
|
267
|
-
const stoppedRecord = (previous, reason, termination) => ({
|
|
268
|
-
...stoppingRecord(previous, reason),
|
|
269
|
-
phase: "Stopped",
|
|
270
|
-
termination
|
|
271
|
-
});
|
|
272
|
-
var Store = class extends Context.Service()("@graftland/plugin-remote/internal/runner/model/Store") {};
|
|
273
|
-
var Execution = class extends Context.Service()("@graftland/plugin-remote/internal/runner/model/Execution") {};
|
|
274
|
-
var RemoteTerminationUnconfirmed = class extends Schema.TaggedError()("RemoteTerminationUnconfirmed", { handle: Handle }) {};
|
|
275
|
-
/** Losing contact never becomes a successful stop merely because a lease duration passed. */
|
|
276
|
-
const awaitTermination = Effect.fnUntraced(function* (handle, confirmation, leaseMillis, marginMillis) {
|
|
277
|
-
const [elapsed, result] = yield* Effect.exit(Effect.timeoutOption(confirmation, leaseMillis + marginMillis)).pipe(Effect.timed);
|
|
278
|
-
if (result._tag === "Success") {
|
|
279
|
-
if (Option.isSome(result.value)) return result.value.value;
|
|
280
|
-
return yield* RemoteTerminationUnconfirmed.make({ handle });
|
|
281
|
-
}
|
|
282
|
-
yield* Effect.sleep(Math.max(0, leaseMillis + marginMillis - Duration.toMillis(elapsed)));
|
|
283
|
-
return yield* Effect.failCause(Cause.combine(result.cause, Cause.fail(RemoteTerminationUnconfirmed.make({ handle }))));
|
|
284
|
-
});
|
|
285
|
-
// packages/remote/src/internal/runner/Wire.ts
|
|
286
|
-
/** The RPC boundary is the only place that assembles the runner's error schema. */
|
|
287
|
-
const SessionError = Schema.Union([
|
|
288
|
-
SessionAccessDenied,
|
|
289
|
-
StaleSession,
|
|
290
|
-
LeaseExpired,
|
|
291
|
-
SessionStopped,
|
|
292
|
-
SessionConflict,
|
|
293
|
-
StateStorageError,
|
|
294
|
-
ExecutionError,
|
|
295
|
-
PackageError,
|
|
296
|
-
TerminationUnconfirmed,
|
|
297
|
-
RunnerClosing,
|
|
298
|
-
StateDirectoryLocked
|
|
299
|
-
]);
|
|
300
|
-
const Session = RpcGroup.make(Rpc.make("HighWater", {
|
|
301
|
-
payload: { instance: Schema.NonEmptyString },
|
|
302
|
-
success: Schema.NullOr(PositiveInt),
|
|
303
|
-
error: SessionError
|
|
304
|
-
}), Rpc.make("Open", {
|
|
305
|
-
payload: {
|
|
306
|
-
instance: Schema.NonEmptyString,
|
|
307
|
-
requestId: Schema.NonEmptyString,
|
|
308
|
-
expectedGeneration: Schema.NullOr(PositiveInt),
|
|
309
|
-
leaseMillis: Schema.optionalKey(PositiveFinite),
|
|
310
|
-
limits: Limits
|
|
311
|
-
},
|
|
312
|
-
success: SessionRecord,
|
|
313
|
-
error: SessionError
|
|
314
|
-
}), Rpc.make("Load", {
|
|
315
|
-
payload: {
|
|
316
|
-
handle: Handle,
|
|
317
|
-
specifier: Schema.NonEmptyString,
|
|
318
|
-
digest: Schema.optionalKey(Schema.Boolean)
|
|
319
|
-
},
|
|
320
|
-
success: CodeIdentity,
|
|
321
|
-
error: SessionError
|
|
322
|
-
}), Rpc.make("Renew", {
|
|
323
|
-
payload: Handle,
|
|
324
|
-
success: Schema.Finite,
|
|
325
|
-
error: SessionError
|
|
326
|
-
}), Rpc.make("Dispose", {
|
|
327
|
-
payload: Handle,
|
|
328
|
-
success: Termination,
|
|
329
|
-
error: SessionError
|
|
330
|
-
}), Rpc.make("Status", {
|
|
331
|
-
payload: Handle,
|
|
332
|
-
success: SessionRecord,
|
|
333
|
-
error: SessionError
|
|
334
|
-
})).annotateRpcs(Priority, "control");
|
|
335
|
-
/** Preserve the port writer order within each byte channel. */
|
|
336
|
-
const channel = (peer, id) => ({
|
|
337
|
-
input: Stream.fromEffectRepeat(peer.take(id)),
|
|
338
|
-
output: Sink.forEach((bytes) => peer.send(id, bytes).pipe(Effect.mapError((error) => TransportError.make({ cause: Cause.fail(error) }))))
|
|
339
|
-
});
|
|
340
|
-
// packages/remote/src/internal/Peer.ts
|
|
341
|
-
var Peer = class extends Context.Service()("@graftland/plugin-remote/internal/Peer") {};
|
|
342
|
-
export { negotiate as C, Identity as D, make as E, Instance as O, keyOf as S, stoppingRecord as T, StateStorageError as _, ExecutionError as a, awaitTermination as b, PackageError as c, SessionAccessDenied as d, SessionConflict as f, StateDirectoryLocked as g, StaleSession as h, Execution as i, RemoteTerminationUnconfirmed as l, SessionStopped as m, Session as n, Key as o, SessionRecord as p, channel as r, LeaseExpired as s, Peer as t, RunnerClosing as u, Store as v, stoppedRecord as w, childOf as x, TerminationUnconfirmed as y };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { t as make } from "./FailureGroup-BgT73AaR.js";
|
|
2
|
-
import { Array, Cause, Effect, Exit, Fiber, Ref, Schedule, Stream, String } from "effect";
|
|
3
|
-
// packages/remote/src/internal/runner/ProcessObservation.ts
|
|
4
|
-
/** Time allowed for a direct execution unit or launcher to exit after input EOF. */
|
|
5
|
-
const stdinExitTimeout = "1 second";
|
|
6
|
-
/** Readers outlive the failure monitor so forced termination still captures its diagnostic tail. */
|
|
7
|
-
const observe = Effect.fnUntraced(function* (child, options = {}) {
|
|
8
|
-
const failures = yield* make();
|
|
9
|
-
const tail = yield* Ref.make("");
|
|
10
|
-
const stdout = yield* (options.drainStdout === false ? Effect.void : Stream.runDrain(child.stdout)).pipe(Effect.forkScoped);
|
|
11
|
-
const stderr = yield* child.stderr.pipe(Stream.decodeText(), Stream.runForEach((text) => Ref.update(tail, (old) => String.takeRight(old + text, 8192))), Effect.forkScoped);
|
|
12
|
-
yield* failures.run(Fiber.join(stdout));
|
|
13
|
-
yield* failures.run(Fiber.join(stderr));
|
|
14
|
-
const exited = yield* Effect.gen(function* () {
|
|
15
|
-
const result = yield* Effect.exit(child.exitCode);
|
|
16
|
-
yield* child.isRunning.pipe(Effect.repeat({
|
|
17
|
-
schedule: Schedule.spaced("25 millis"),
|
|
18
|
-
while: (running) => running
|
|
19
|
-
}));
|
|
20
|
-
const err = yield* Fiber.await(stderr);
|
|
21
|
-
const out = yield* Fiber.await(stdout);
|
|
22
|
-
return {
|
|
23
|
-
code: Exit.isSuccess(result) ? result.value : null,
|
|
24
|
-
signal: null,
|
|
25
|
-
stderr: yield* Ref.get(tail),
|
|
26
|
-
cause: Array.reduce([
|
|
27
|
-
Exit.asVoid(result),
|
|
28
|
-
err,
|
|
29
|
-
out
|
|
30
|
-
], Cause.empty, (cause, exit) => Exit.isFailure(exit) ? Cause.combine(cause, exit.cause) : cause)
|
|
31
|
-
};
|
|
32
|
-
}).pipe(Effect.forkScoped);
|
|
33
|
-
return {
|
|
34
|
-
exited: Fiber.join(exited),
|
|
35
|
-
failure: failures.await
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
export { stdinExitTimeout as n, observe as t };
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { n as close } from "./release-DfZPuIcK.js";
|
|
2
|
-
import { Context, Deferred, Effect, Exit, Option, Schema, Scope } from "effect";
|
|
3
|
-
// packages/remote/src/internal/ServeLifecycle.ts
|
|
4
|
-
var StartupError = class extends Schema.TaggedError()("RunnerStartupError", {
|
|
5
|
-
detail: Schema.String,
|
|
6
|
-
cause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Defect()))
|
|
7
|
-
}) {
|
|
8
|
-
get message() {
|
|
9
|
-
return this.detail;
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
var ServeLifecycle = class extends Context.Service()("@graftland/plugin-remote/internal/ServeLifecycle") {};
|
|
13
|
-
const make = Effect.all({
|
|
14
|
-
ended: Deferred.make(),
|
|
15
|
-
released: Deferred.make()
|
|
16
|
-
});
|
|
17
|
-
/** Observe shutdown independently of the loader, which logs child cleanup failures. */
|
|
18
|
-
const resources = Effect.fnUntraced(function* (lifecycle) {
|
|
19
|
-
return yield* Effect.acquireRelease(Scope.make(), (scope, exit) => close(scope, exit).pipe(Effect.onExit((released) => Option.isNone(lifecycle) ? Effect.void : Deferred.done(lifecycle.value.released, Exit.isSuccess(released) ? Exit.void : Exit.fail(StartupError.make({
|
|
20
|
-
detail: "Supervisor shutdown failed",
|
|
21
|
-
cause: released.cause
|
|
22
|
-
}))).pipe(Effect.asVoid))));
|
|
23
|
-
});
|
|
24
|
-
export { resources as i, StartupError as n, make as r, ServeLifecycle as t };
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { Context } from "effect";
|
|
2
|
-
// packages/remote/src/Transport.ts
|
|
3
|
-
/** Execution and byte-channel capabilities; implementations live in host plugins. */
|
|
4
|
-
var Connector = class extends Context.Service()("@graftland/plugin-remote/Transport/Connector") {};
|
|
5
|
-
var Listener = class extends Context.Service()("@graftland/plugin-remote/Transport/Listener") {};
|
|
6
|
-
export { Listener as n, Connector as t };
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
// packages/remote/src/internal/runner/WatchdogProtocol.ts
|
|
3
|
-
const Command = Schema.Union([
|
|
4
|
-
Schema.Struct({
|
|
5
|
-
kind: Schema.Literal("renew"),
|
|
6
|
-
millis: Schema.Finite.check(Schema.isGreaterThan(0))
|
|
7
|
-
}),
|
|
8
|
-
Schema.Struct({ kind: Schema.Literal("start") }),
|
|
9
|
-
Schema.Struct({ kind: Schema.Literal("stop") })
|
|
10
|
-
]);
|
|
11
|
-
const CommandJson = Schema.fromJsonString(Command);
|
|
12
|
-
const Notice = Schema.Literals([
|
|
13
|
-
"ready",
|
|
14
|
-
"start",
|
|
15
|
-
"stop"
|
|
16
|
-
]);
|
|
17
|
-
export { Notice as n, CommandJson as t };
|