@graftland/plugin-remote 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,83 +0,0 @@
|
|
|
1
|
-
import { n as __exportAll } from "./rolldown-runtime-DYf_mQCB.js";
|
|
2
|
-
import { t as Priority } from "./port--3x2zJ4D.js";
|
|
3
|
-
import { a as provide } from "./Graft-B71CPA2Y.js";
|
|
4
|
-
import { Array, Context, Effect, Predicate, Record, Schema } from "effect";
|
|
5
|
-
import { Rpc, RpcClient, RpcGroup, RpcServer } from "effect/rpc";
|
|
6
|
-
// packages/remote/src/internal/control.ts
|
|
7
|
-
const Log = Schema.Struct({
|
|
8
|
-
level: Schema.Literals([
|
|
9
|
-
"Fatal",
|
|
10
|
-
"Error",
|
|
11
|
-
"Warn",
|
|
12
|
-
"Info",
|
|
13
|
-
"Debug",
|
|
14
|
-
"Trace",
|
|
15
|
-
"All",
|
|
16
|
-
"None"
|
|
17
|
-
]),
|
|
18
|
-
message: Schema.Defect({ includeStack: true }),
|
|
19
|
-
cause: Schema.Json,
|
|
20
|
-
annotations: Schema.Record(Schema.String, Schema.Defect({ includeStack: true }))
|
|
21
|
-
});
|
|
22
|
-
const Event = Schema.Union([
|
|
23
|
-
Schema.TaggedStruct("Failed", { cause: Schema.Json }),
|
|
24
|
-
Schema.TaggedStruct("Stopped", {}),
|
|
25
|
-
Schema.TaggedStruct("Withdrawing", {})
|
|
26
|
-
]);
|
|
27
|
-
const LogEvent = Schema.Union([Schema.TaggedStruct("Log", {
|
|
28
|
-
entry: Log,
|
|
29
|
-
dropped: Schema.Int
|
|
30
|
-
}), Schema.TaggedStruct("LogsEnded", { dropped: Schema.Int })]);
|
|
31
|
-
const endpoint = "@graftland/plugin-remote/control";
|
|
32
|
-
const make$1 = (cause) => RpcGroup.make(Rpc.make("Load", {
|
|
33
|
-
payload: { input: Schema.Json },
|
|
34
|
-
error: cause
|
|
35
|
-
}), Rpc.make("Events", {
|
|
36
|
-
success: Event,
|
|
37
|
-
stream: true
|
|
38
|
-
}), Rpc.make("Dispose", { error: cause })).annotateRpcs(Priority, "control").add(Rpc.make("Logs", {
|
|
39
|
-
success: LogEvent,
|
|
40
|
-
stream: true
|
|
41
|
-
}).annotate(Priority, "log"));
|
|
42
|
-
// packages/remote/src/internal/services.ts
|
|
43
|
-
const service = (key, group, mapping) => ({
|
|
44
|
-
key,
|
|
45
|
-
group,
|
|
46
|
-
serve: Effect.fnUntraced(function* (port) {
|
|
47
|
-
const context = yield* Effect.context();
|
|
48
|
-
const value = yield* Effect.fromOption(Context.getOption(context, key)).pipe(Effect.orDie);
|
|
49
|
-
const handlers = yield* group.toHandlers(mapping.toHandlers(value));
|
|
50
|
-
return yield* RpcServer.make(group, { disableFatalDefects: true }).pipe(Effect.provideContext(handlers), Effect.provideService(RpcServer.Protocol, port.serverProtocol(key.key)));
|
|
51
|
-
}),
|
|
52
|
-
publish: Effect.fnUntraced(function* (port) {
|
|
53
|
-
const client = yield* RpcClient.make(group).pipe(Effect.provideService(RpcClient.Protocol, port.clientProtocol(key.key)));
|
|
54
|
-
yield* provide(key, mapping.fromClient(client));
|
|
55
|
-
})
|
|
56
|
-
});
|
|
57
|
-
const endpoints = (services) => Record.fromEntries(Array.map(services, (service) => [service.key.key, service.group]));
|
|
58
|
-
// packages/remote/src/Contract.ts
|
|
59
|
-
var Contract_exports = /* @__PURE__ */ __exportAll({
|
|
60
|
-
UndeclaredFailure: () => UndeclaredFailure,
|
|
61
|
-
fromModule: () => fromModule,
|
|
62
|
-
isContract: () => isContract,
|
|
63
|
-
make: () => make,
|
|
64
|
-
service: () => service
|
|
65
|
-
});
|
|
66
|
-
const TypeId = "~@graftland/plugin-remote/Contract";
|
|
67
|
-
/** An undeclared failure still crosses the boundary, with its diagnostic value. */
|
|
68
|
-
var UndeclaredFailure = class extends Schema.TaggedError()("UndeclaredFailure", { original: Schema.Defect({ includeStack: true }) }) {};
|
|
69
|
-
function make(options) {
|
|
70
|
-
const keys = Array.map([...options.inject ?? [], ...options.provides ?? []], (service) => service.key.key);
|
|
71
|
-
if (Array.dedupe(keys).length !== keys.length || keys.includes("@graftland/plugin-remote/control")) throw new Error("Service keys must be unique within a remote contract and must not use the control endpoint");
|
|
72
|
-
return {
|
|
73
|
-
...options,
|
|
74
|
-
error: options.error ?? Schema.Never,
|
|
75
|
-
inject: options.inject ?? [],
|
|
76
|
-
provides: options.provides ?? [],
|
|
77
|
-
[TypeId]: TypeId
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
const isContract = (value) => Predicate.hasProperty(value, TypeId) && value[TypeId] === TypeId;
|
|
81
|
-
/** A contract module exports either default or a named contract. */
|
|
82
|
-
const fromModule = (module) => Array.findFirst([Predicate.hasProperty(module, "default") ? module.default : void 0, Predicate.hasProperty(module, "contract") ? module.contract : void 0], isContract);
|
|
83
|
-
export { make as a, endpoint as c, isContract as i, make$1 as l, UndeclaredFailure as n, endpoints as o, fromModule as r, service as s, Contract_exports as t };
|
package/dist/Errors-DYhsGZcZ.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { Option, Schema } from "effect";
|
|
2
|
-
// packages/remote/src/Errors.ts
|
|
3
|
-
var ProcessExited = class extends Schema.TaggedError()("ProcessExited", {
|
|
4
|
-
pid: Schema.Option(Schema.Int),
|
|
5
|
-
threadId: Schema.optionalKey(Schema.Int),
|
|
6
|
-
exitCode: Schema.NullOr(Schema.Int),
|
|
7
|
-
stderr: Schema.String,
|
|
8
|
-
statusCause: Schema.Cause(Schema.Unknown, Schema.Unknown)
|
|
9
|
-
}) {
|
|
10
|
-
get message() {
|
|
11
|
-
return this.threadId !== void 0 ? `Remote worker ${this.threadId} exited unexpectedly (${this.exitCode})` : `Remote process${Option.isSome(this.pid) ? ` ${this.pid.value}` : ""} exited unexpectedly (${this.exitCode ?? "signal"})`;
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
var TransportError = class extends Schema.TaggedError()("TransportError", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {};
|
|
15
|
-
/** The remote export lease was withdrawn; host consumers must drain before Dispose. */
|
|
16
|
-
var RemoteWithdrawn = class extends Schema.TaggedError()("RemoteWithdrawn", {}) {
|
|
17
|
-
get message() {
|
|
18
|
-
return "Remote services were withdrawn";
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
/** Infrastructure failure at the plugin boundary; the complete underlying cause remains inspectable. */
|
|
22
|
-
var RemoteError = class extends Schema.TaggedError()("RemoteError", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {};
|
|
23
|
-
/** A network execution needs a stable logical identity across host restarts. */
|
|
24
|
-
var MissingInstance = class extends Schema.TaggedError()("MissingInstance", {}) {
|
|
25
|
-
get message() {
|
|
26
|
-
return "A runner connection requires an instance or a loader entry id; set connect.instance when loading without Loader.";
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/** Dispose completed, but Node still owns live handles; process-scope cleanup must terminate it. */
|
|
30
|
-
var LocalTerminationTimeout = class extends Schema.TaggedError()("LocalTerminationTimeout", {
|
|
31
|
-
pid: Schema.optionalKey(Schema.Int),
|
|
32
|
-
threadId: Schema.optionalKey(Schema.Int)
|
|
33
|
-
}) {
|
|
34
|
-
get message() {
|
|
35
|
-
return this.threadId !== void 0 ? `Remote worker ${this.threadId} did not exit within one second after Dispose; terminating it` : `Remote process ${this.pid} did not exit within one second after Dispose; terminating it`;
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
/** A credential source failed; the original failure remains available. */
|
|
39
|
-
var CredentialsError = class extends Schema.TaggedError()("CredentialsError", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {};
|
|
40
|
-
var AuthenticationFailed = class extends Schema.TaggedError()("AuthenticationFailed", {
|
|
41
|
-
reason: Schema.Literals(["missing", "invalid"]),
|
|
42
|
-
challenge: Schema.optionalKey(Schema.String),
|
|
43
|
-
cause: Schema.optionalKey(Schema.Cause(Schema.Unknown, Schema.Unknown))
|
|
44
|
-
}) {};
|
|
45
|
-
/** The authenticator could not reach what it needs to decide, such as its key set; the credential may still be valid. */
|
|
46
|
-
var AuthenticatorUnavailable = class extends Schema.TaggedError()("AuthenticatorUnavailable", { cause: Schema.Cause(Schema.Unknown, Schema.Unknown) }) {};
|
|
47
|
-
/** A remote entry could not be resolved or configured at the indicated field. */
|
|
48
|
-
var RemoteEntryError = class extends Schema.TaggedError()("RemoteEntryError", {
|
|
49
|
-
entry: Schema.Option(Schema.String),
|
|
50
|
-
directory: Schema.Option(Schema.String),
|
|
51
|
-
field: Schema.String,
|
|
52
|
-
cause: Schema.Cause(Schema.Unknown, Schema.Unknown)
|
|
53
|
-
}) {
|
|
54
|
-
get message() {
|
|
55
|
-
return `Remote entry ${Option.getOrElse(this.entry, () => "<programmatic>")} failed at ${this.field}`;
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
export { MissingInstance as a, RemoteError as c, LocalTerminationTimeout as i, RemoteWithdrawn as l, AuthenticatorUnavailable as n, ProcessExited as o, CredentialsError as r, RemoteEntryError as s, AuthenticationFailed as t, TransportError as u };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { n as close, t as ReleaseInterrupted } from "./release-DfZPuIcK.js";
|
|
2
|
-
import { f as CleanupError } from "./Graft-B71CPA2Y.js";
|
|
3
|
-
import { Array, Cause, Data, Deferred, Effect, Exit, Fiber, FiberSet, Ref, Schema, Scope, TxRef } from "effect";
|
|
4
|
-
// packages/remote/src/internal/cleanup.ts
|
|
5
|
-
/** Finalizers have no typed failure channel. Keep reasons and their annotations flat. */
|
|
6
|
-
const cleanupCause = (cause) => Cause.fromReasons(Array.flatMap(cause.reasons, (reason) => {
|
|
7
|
-
const error = reason._tag === "Fail" ? reason.error : reason._tag === "Die" ? reason.defect : void 0;
|
|
8
|
-
if (Schema.is(CleanupError)(error)) return Array.map(cleanupCause(error.cause).reasons, (inner) => inner.annotate(Cause.reasonAnnotations(reason)));
|
|
9
|
-
return [reason._tag === "Fail" ? Cause.makeDieReason(reason.error).annotate(Cause.reasonAnnotations(reason)) : reason];
|
|
10
|
-
}));
|
|
11
|
-
/** Assembly children close before the entry reports their cleanup as its own result. */
|
|
12
|
-
const children = Effect.acquireRelease(Scope.make(), (scope, exit) => close(scope, exit).pipe(Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause)))));
|
|
13
|
-
// packages/remote/src/internal/FailureGroup.ts
|
|
14
|
-
const State = Data.taggedEnum();
|
|
15
|
-
/** One owner for first failure, transaction wakeups, and interruption of sibling work. */
|
|
16
|
-
const make = Effect.fnUntraced(function* () {
|
|
17
|
-
const fibers = yield* FiberSet.make();
|
|
18
|
-
const state = yield* TxRef.make(State.Open());
|
|
19
|
-
const failures = yield* Ref.make(Cause.empty);
|
|
20
|
-
const cleanup = yield* Ref.make(Cause.empty);
|
|
21
|
-
const check = TxRef.get(state).pipe(Effect.flatMap((s) => s._tag === "Failed" ? Effect.failCause(s.cause) : s._tag === "Closed" ? Effect.interrupt : Effect.void));
|
|
22
|
-
const publish = (cause) => TxRef.update(state, (s) => s._tag === "Open" ? State.Failed({ cause }) : s);
|
|
23
|
-
const observe = (effect) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
|
|
24
|
-
const scope = yield* Scope.make();
|
|
25
|
-
const ownerId = yield* Effect.withFiber((self) => Effect.succeed(self.id));
|
|
26
|
-
const worker = yield* Effect.forkIn(restore(Scope.provide(scope)(effect)), scope);
|
|
27
|
-
const waiting = yield* Effect.exit(restore(Fiber.await(worker)));
|
|
28
|
-
if (Exit.isFailure(waiting)) yield* Fiber.interrupt(worker);
|
|
29
|
-
const body = yield* Fiber.await(worker);
|
|
30
|
-
const closed = yield* Effect.exit(close(scope, body));
|
|
31
|
-
const expected = Exit.isFailure(waiting) && Exit.isFailure(body) && Array.every(body.cause.reasons, (reason) => reason._tag === "Interrupt" && reason.fiberId === ownerId);
|
|
32
|
-
const bodyCause = Exit.isFailure(body) && !expected ? body.cause : Cause.empty;
|
|
33
|
-
const releaseCause = Exit.isFailure(closed) && !Cause.hasInterruptsOnly(closed.cause) ? closed.cause : Cause.empty;
|
|
34
|
-
const failure = Cause.combine(bodyCause, releaseCause);
|
|
35
|
-
const closing = Cause.combine(Cause.hasInterrupts(bodyCause) || Array.some(bodyCause.reasons, (reason) => reason._tag === "Die" && Schema.is(ReleaseInterrupted)(reason.defect)) ? bodyCause : Cause.empty, releaseCause);
|
|
36
|
-
yield* Ref.update(cleanup, (cause) => Cause.combine(cause, closing));
|
|
37
|
-
if (failure.reasons.length > 0) {
|
|
38
|
-
yield* Ref.update(failures, (cause) => Cause.combine(cause, failure));
|
|
39
|
-
yield* publish(failure);
|
|
40
|
-
yield* Deferred.failCause(fibers.deferred, failure);
|
|
41
|
-
}
|
|
42
|
-
if (Exit.isFailure(closed)) return yield* Effect.failCause(Exit.isFailure(body) ? Cause.combine(body.cause, closed.cause) : closed.cause);
|
|
43
|
-
if (Exit.isFailure(waiting) && Exit.isSuccess(body)) return yield* Effect.failCause(waiting.cause);
|
|
44
|
-
return yield* body;
|
|
45
|
-
}));
|
|
46
|
-
yield* FiberSet.join(fibers).pipe(Effect.catchCause((cause) => publish(cause).pipe(Effect.andThen(FiberSet.clear(fibers)), Effect.uninterruptible)), Effect.forkScoped);
|
|
47
|
-
const failure = Effect.tx(check.pipe(Effect.andThen(Effect.txRetry)));
|
|
48
|
-
const failCause = (cause) => FiberSet.run(fibers, observe(Effect.failCause(cause))).pipe(Effect.asVoid);
|
|
49
|
-
const close$1 = TxRef.update(state, (s) => s._tag === "Open" ? State.Closed() : s).pipe(Effect.andThen(FiberSet.clear(fibers)), Effect.andThen(Ref.get(cleanup)), Effect.flatMap((cause) => cause.reasons.length > 0 ? Effect.failCause(cause) : Effect.void), Effect.uninterruptible);
|
|
50
|
-
yield* Effect.addFinalizer(() => close$1.pipe(Effect.catchCause((cause) => Effect.failCause(cleanupCause(cause)))));
|
|
51
|
-
return {
|
|
52
|
-
await: failure,
|
|
53
|
-
check,
|
|
54
|
-
cause: Ref.get(failures),
|
|
55
|
-
runtime: () => FiberSet.runtime(fibers)().pipe(Effect.map((run) => (effect) => run(check.pipe(Effect.andThen(observe(effect)))))),
|
|
56
|
-
run: (effect) => FiberSet.run(fibers, check.pipe(Effect.andThen(observe(effect)))),
|
|
57
|
-
fail: (error) => failCause(Cause.fail(error)),
|
|
58
|
-
failCause,
|
|
59
|
-
race: (effect) => check.pipe(Effect.andThen(Effect.raceFirst(effect, failure))),
|
|
60
|
-
close: close$1
|
|
61
|
-
};
|
|
62
|
-
});
|
|
63
|
-
export { children as n, cleanupCause as r, make as t };
|
package/dist/Framing-G9eSaeLb.js
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Array, Effect, MutableRef, Option, Result, Schema } from "effect";
|
|
2
|
-
// packages/remote/src/internal/runner/Framing.ts
|
|
3
|
-
var FrameError = class extends Schema.TaggedError()("FrameError", { detail: Schema.String }) {
|
|
4
|
-
get message() {
|
|
5
|
-
return this.detail;
|
|
6
|
-
}
|
|
7
|
-
};
|
|
8
|
-
/** A complete byte stream ended; malformed trailing bytes remain FrameError. */
|
|
9
|
-
var EndOfStream = class extends Schema.TaggedError()("RunnerEndOfStream", {}) {
|
|
10
|
-
get message() {
|
|
11
|
-
return "Runner byte channel ended";
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
const maxPayload = 1048576;
|
|
15
|
-
const invalid = (detail) => FrameError.make({ detail });
|
|
16
|
-
/** Version 2 carries only channel and length; request admission belongs to port. */
|
|
17
|
-
const encode = Effect.fnUntraced(function* (frame) {
|
|
18
|
-
if (frame.payload.byteLength > 1048576) return yield* invalid("Runner frame exceeds the payload limit");
|
|
19
|
-
const bytes = new Uint8Array(8 + frame.payload.byteLength);
|
|
20
|
-
bytes.set([
|
|
21
|
-
2,
|
|
22
|
-
frame.channel,
|
|
23
|
-
0,
|
|
24
|
-
0
|
|
25
|
-
]);
|
|
26
|
-
new DataView(bytes.buffer).setUint32(4, frame.payload.byteLength);
|
|
27
|
-
bytes.set(frame.payload, 8);
|
|
28
|
-
return bytes;
|
|
29
|
-
});
|
|
30
|
-
/** Check a message boundary; the decoder still validates the frame's contents. */
|
|
31
|
-
const isCompleteFrame = (bytes) => bytes.byteLength >= 8 && new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint32(4) === bytes.byteLength - 8;
|
|
32
|
-
/** The decoder owns its byte buffer. Results expose malformed frames without throwing through a generator. */
|
|
33
|
-
const decoder = () => {
|
|
34
|
-
const pending = MutableRef.make(Result.succeed(/* @__PURE__ */ new Uint8Array(0)));
|
|
35
|
-
const decode = (chunk) => Result.flatMap(MutableRef.get(pending), (previous) => {
|
|
36
|
-
const bytes = new Uint8Array(previous.length + chunk.length);
|
|
37
|
-
bytes.set(previous);
|
|
38
|
-
bytes.set(chunk, previous.length);
|
|
39
|
-
const frames = Array.unfold(0, (offset) => {
|
|
40
|
-
if (bytes.length - offset < 8) return Option.none();
|
|
41
|
-
const header = new DataView(bytes.buffer, offset, 8);
|
|
42
|
-
const channel = header.getUint8(1);
|
|
43
|
-
const length = header.getUint32(4);
|
|
44
|
-
if (header.getUint8(0) !== 2 || channel !== 0 && channel !== 1 || header.getUint16(2) !== 0 || length > 1048576) return Option.some([Result.fail(invalid("Invalid runner frame header or payload length")), bytes.length]);
|
|
45
|
-
const end = offset + 8 + length;
|
|
46
|
-
if (end > bytes.length) return Option.none();
|
|
47
|
-
return Option.some([Result.succeed({
|
|
48
|
-
channel,
|
|
49
|
-
payload: bytes.subarray(offset + 8, end)
|
|
50
|
-
}), end]);
|
|
51
|
-
});
|
|
52
|
-
const result = Result.all(frames);
|
|
53
|
-
MutableRef.set(pending, Result.map(result, (frames) => bytes.subarray(Array.reduce(frames, 0, (used, frame) => used + 8 + frame.payload.length))));
|
|
54
|
-
return result;
|
|
55
|
-
});
|
|
56
|
-
return {
|
|
57
|
-
decode,
|
|
58
|
-
finish: Effect.suspend(() => Effect.fromResult(Result.flatMap(MutableRef.get(pending), (bytes) => bytes.length === 0 ? Result.succeed(void 0) : Result.fail(invalid("Runner connection ended inside a frame")))))
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export { isCompleteFrame as a, encode as i, FrameError as n, maxPayload as o, decoder as r, EndOfStream as t };
|