@hediet/linkrpc-cli 0.0.3-next.20261022.2 → 0.0.3-next.20261022.4
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 +15 -12
- package/dist/chunks/{cli-C0AV_fi4.js → cli-DJREb0Dm.js} +18 -12
- package/dist/chunks/{cli-C0AV_fi4.js.map → cli-DJREb0Dm.js.map} +1 -1
- package/dist/chunks/{runApprovalUi-CkT1KK-X.js → runApprovalUi-CdC5_Qoo.js} +3 -3
- package/dist/chunks/{runApprovalUi-CkT1KK-X.js.map → runApprovalUi-CdC5_Qoo.js.map} +1 -1
- package/dist/chunks/{runComplete-HH0NuvsL.js → runComplete-C9LMCMk7.js} +7 -3
- package/dist/chunks/{runComplete-HH0NuvsL.js.map → runComplete-C9LMCMk7.js.map} +1 -1
- package/dist/chunks/{runUi-mpVqJ6QU.js → runUi-Bb6VATfB.js} +4 -4
- package/dist/chunks/{runUi-mpVqJ6QU.js.map → runUi-Bb6VATfB.js.map} +1 -1
- package/dist/chunks/{scroll-B5tGRXDE.js → scroll-BSzq6cdj.js} +2 -2
- package/dist/chunks/{scroll-B5tGRXDE.js.map → scroll-BSzq6cdj.js.map} +1 -1
- package/dist/chunks/{src-CCHXMIFR.js → src-CCyOTeN5.js} +2 -2
- package/dist/chunks/{src-CCHXMIFR.js.map → src-CCyOTeN5.js.map} +1 -1
- package/dist/hub.js +1 -1
- package/dist/index.js +1 -1
- package/dist/linkrpc.js +1 -1
- package/dist/rpc.js +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -800,22 +800,25 @@ process's stdin/stdout (`--stdio`) or a `--target-endpoint*`. It keeps full
|
|
|
800
800
|
LinkRPC semantics (service ids, streaming, cancellation) and adds what the
|
|
801
801
|
participant cannot do itself:
|
|
802
802
|
|
|
803
|
-
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
-
|
|
811
|
-
|
|
803
|
+
- By default the proxy signs nothing: calls the participant makes are
|
|
804
|
+
forwarded to the hub as they are (unsigned, or keeping the `$hubrpc`
|
|
805
|
+
envelope the participant attached). `--sign-as [principal]` re-signs every
|
|
806
|
+
such call as `principal` (`managed`, `user:<id>`, or `file:<path>`; default:
|
|
807
|
+
`--principal`, i.e. the managed Hub identity) and requests capabilities for
|
|
808
|
+
those calls, so a participant without signing support can call services
|
|
809
|
+
behind `forwardChecking`. This lends the participant that identity.
|
|
810
|
+
`--no-outbound` drops the participant's calls instead. The global `--sign`
|
|
811
|
+
is rejected here to keep this choice explicit.
|
|
812
|
+
- `--claim <serviceId>` registers the service id (that registration is signed
|
|
813
|
+
as `--principal`) and forwards requests the hub routes to it to the
|
|
814
|
+
participant unchanged, keeping callers' signatures.
|
|
812
815
|
|
|
813
816
|
```sh
|
|
814
817
|
# A Rust client that cannot sign yet reaches a gated remote service.
|
|
815
818
|
# Point it at this cmd-stdio endpoint and address calls to the remote service id:
|
|
816
|
-
# cmd-stdio:?argv=linkrpc&argv=hub&argv=proxy&argv=--stdio&argv=--sign
|
|
817
|
-
hub proxy --stdio --sign
|
|
818
|
-
hub proxy --stdio --sign
|
|
819
|
+
# cmd-stdio:?argv=linkrpc&argv=hub&argv=proxy&argv=--stdio&argv=--sign-as
|
|
820
|
+
hub proxy --stdio --sign-as
|
|
821
|
+
hub proxy --stdio --sign-as user:automation
|
|
819
822
|
|
|
820
823
|
# Serve a stdio program under a service id (equivalent to `tunnel`).
|
|
821
824
|
hub proxy --claim my/service --no-outbound --target-endpoint-cmd-stdio "my-server --stdio"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as requestTopologyAccess, B as proxyCommand, F as disconnectBroker, G as parseDuration, H as withStaticHubReflection, I as getBrokerStatus, L as readBrokerNotifications, M as readEndpointDiscovery, N as ContextStore, P as formatContextReference, Q as requestReflectionAccess, R as stopConnectionBroker, St as mcpForwardInterface, U as parseConnectionLimit, V as tunnelCommand, W as parseConnectionLimitMilliseconds, _t as validateValueAgainstSchema, a as resolveInvocationEndpoint, bt as parseParamOverride, c as resolveLocalEndpoint, ct as parsePrincipalSpec, dt as connectViaTransport, et as setupSigning, ft as resolveTargetEndpoint, gt as explainValidation, ht as describeSchema, i as resolveInvocationContext, it as walkHub, lt as connect, m as managedEndpointsInterface, mt as describeObjectParams, n as loadStaticHubSchema, nt as fetchSchema$1, o as resolveSigning, ot as logoutCliIdentity, pt as resolvedEndpointToConfig, q as resolveCliInvocation, r as resolveStaticHubSchemaSource, rt as findMethodInSchema, s as validationDefault, st as formatPrincipalSource, t as completeForLine, tt as fetchDefaults, ut as connectViaRootOverlay, xt as MethodRefWithOptHash, y as HubHome, yt as mergeParams, z as ConnectionBroker } from "./runComplete-
|
|
1
|
+
import { $ as requestTopologyAccess, B as proxyCommand, F as disconnectBroker, G as parseDuration, H as withStaticHubReflection, I as getBrokerStatus, L as readBrokerNotifications, M as readEndpointDiscovery, N as ContextStore, P as formatContextReference, Q as requestReflectionAccess, R as stopConnectionBroker, St as mcpForwardInterface, U as parseConnectionLimit, V as tunnelCommand, W as parseConnectionLimitMilliseconds, _t as validateValueAgainstSchema, a as resolveInvocationEndpoint, bt as parseParamOverride, c as resolveLocalEndpoint, ct as parsePrincipalSpec, dt as connectViaTransport, et as setupSigning, ft as resolveTargetEndpoint, gt as explainValidation, ht as describeSchema, i as resolveInvocationContext, it as walkHub, lt as connect, m as managedEndpointsInterface, mt as describeObjectParams, n as loadStaticHubSchema, nt as fetchSchema$1, o as resolveSigning, ot as logoutCliIdentity, pt as resolvedEndpointToConfig, q as resolveCliInvocation, r as resolveStaticHubSchemaSource, rt as findMethodInSchema, s as validationDefault, st as formatPrincipalSource, t as completeForLine, tt as fetchDefaults, ut as connectViaRootOverlay, xt as MethodRefWithOptHash, y as HubHome, yt as mergeParams, z as ConnectionBroker } from "./runComplete-C9LMCMk7.js";
|
|
2
2
|
import { ErrorCode, INTERFACE_TEMPLATES_EXTENSION, LinkRpcConnection, RpcError, computeInterfaceHash, connectTransports, createSchemaToZod, directoryInterface, exportStaticHubSchema, generateTsContract, generateTsInterface, interfaceTemplateArgumentsEquivalent, interfaceTemplateMemberName, interfaceTemplatesEqual, isAssignable, jcsCanonicalize, matchParams, schemaToZod, validateInterfaceTemplates } from "@hediet/linkrpc";
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { WebSocketTransport, connectNdjson, connectToHub, formatEndpointUri, isHubEndpoint, openWebSocket, parseEndpointUri, runInitializeHandshake, traceMessageTransport as traceMessageTransport$1 } from "@hediet/linkrpc/node";
|
|
@@ -406,7 +406,7 @@ function contextNamespace(reference) {
|
|
|
406
406
|
async function useLocalManagement(start, action) {
|
|
407
407
|
const home = HubHome.resolve();
|
|
408
408
|
if (start) {
|
|
409
|
-
const { startDaemon, nodeDaemonLaunch } = await import("./src-
|
|
409
|
+
const { startDaemon, nodeDaemonLaunch } = await import("./src-CCyOTeN5.js");
|
|
410
410
|
if (await startDaemon({
|
|
411
411
|
home,
|
|
412
412
|
launch: nodeDaemonLaunch(home)
|
|
@@ -426,7 +426,7 @@ async function useLocalManagement(start, action) {
|
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
async function restartLocalDaemon() {
|
|
429
|
-
const { startDaemon, stopDaemon, nodeDaemonLaunch } = await import("./src-
|
|
429
|
+
const { startDaemon, stopDaemon, nodeDaemonLaunch } = await import("./src-CCyOTeN5.js");
|
|
430
430
|
const home = HubHome.resolve();
|
|
431
431
|
process.stderr.write("Restarting the local Hub daemon: clients will disconnect and managed workloads will stop. OS autostart settings are unchanged.\n");
|
|
432
432
|
await stopDaemon(home);
|
|
@@ -8967,20 +8967,26 @@ Batch options:
|
|
|
8967
8967
|
local.close();
|
|
8968
8968
|
}
|
|
8969
8969
|
});
|
|
8970
|
-
addTargetEndpointOptions(program.command("proxy").description("
|
|
8970
|
+
addTargetEndpointOptions(program.command("proxy").description("Connect a participant to the hub (--endpoint*) through this process. The participant is this process's stdin/stdout (--stdio) or a target endpoint (--target-endpoint*). By default the proxy does not sign anything: calls the participant makes are forwarded to the hub as they are (unsigned, or with the signature the participant attached). --sign-as re-signs them with an identity of this machine, --no-outbound drops them, and --claim makes the hub route a service id to the participant. Runs until the participant disconnects or Ctrl-C.")).option("--stdio", "use this process's stdin/stdout as the participant").option("--sign-as [principal]", "sign every call the participant makes as <principal> (\"managed\", \"user:<id>\" or \"file:<path>\"; default: --principal, i.e. the managed Hub identity falling back to user:hubrpc-cli) and request capabilities for those calls, prompting for approval when needed. This lends the participant that identity; use it for participants that cannot sign but must call services behind forwardChecking").option("--claim <serviceId>", "register <serviceId> on the hub (this registration is signed as --principal) and forward requests for it to the participant unchanged, keeping callers' signatures").option("--no-outbound", "drop calls the participant makes instead of forwarding them to the hub").action(async (cmdOpts) => {
|
|
8971
8971
|
const localEp = needEndpoint(endpoint);
|
|
8972
8972
|
if (cmdOpts.stdio === hasTargetEndpoint(cmdOpts)) {
|
|
8973
8973
|
process.stderr.write("linkrpc: proxy requires exactly one of --stdio or --target-endpoint*.\n");
|
|
8974
8974
|
process.exit(2);
|
|
8975
8975
|
}
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
process.
|
|
8976
|
+
if (g_invocation?.cliOverrides.sign === true) {
|
|
8977
|
+
process.stderr.write("linkrpc: proxy does not use --sign; pass --sign-as [principal] to sign participant calls.\n");
|
|
8978
|
+
process.exit(2);
|
|
8979
|
+
}
|
|
8980
|
+
if (cmdOpts.signAs !== void 0 && !cmdOpts.outbound) {
|
|
8981
|
+
process.stderr.write("linkrpc: proxy --sign-as has no effect with --no-outbound.\n");
|
|
8979
8982
|
process.exit(2);
|
|
8980
8983
|
}
|
|
8981
8984
|
const targetEp = cmdOpts.stdio ? void 0 : resolveTargetEndpointOrExit(cmdOpts, program.opts(), "proxy");
|
|
8982
8985
|
const hub = await connect(localEp, wireLog("hub"));
|
|
8983
|
-
if (
|
|
8986
|
+
if (cmdOpts.signAs !== void 0 || cmdOpts.claim !== void 0) {
|
|
8987
|
+
const principal = typeof cmdOpts.signAs === "string" ? parsePrincipalSpec(cmdOpts.signAs) : getPrincipalSpec();
|
|
8988
|
+
reportIdentity(await setupSigning(hub.channel, hub.signing, principal, { negotiateHubCaps: isHubEndpoint(localEp) }));
|
|
8989
|
+
}
|
|
8984
8990
|
const participant = targetEp === void 0 ? await connectStdioParticipant() : {
|
|
8985
8991
|
connection: await connectTargetEndpoint(targetEp, cmdOpts.claim ?? ""),
|
|
8986
8992
|
closed: void 0
|
|
@@ -8989,7 +8995,7 @@ Batch options:
|
|
|
8989
8995
|
await proxyCommand({
|
|
8990
8996
|
hub,
|
|
8991
8997
|
participant: participant.connection,
|
|
8992
|
-
outbound: !cmdOpts.outbound ? "none" :
|
|
8998
|
+
outbound: !cmdOpts.outbound ? "none" : cmdOpts.signAs !== void 0 ? "signed" : "verbatim",
|
|
8993
8999
|
...cmdOpts.claim !== void 0 ? { claimServiceId: cmdOpts.claim } : {},
|
|
8994
9000
|
...participant.closed !== void 0 ? { stop: participant.closed } : {}
|
|
8995
9001
|
});
|
|
@@ -9119,7 +9125,7 @@ Batch options:
|
|
|
9119
9125
|
process.once("SIGINT", onSignal);
|
|
9120
9126
|
process.once("SIGTERM", onSignal);
|
|
9121
9127
|
try {
|
|
9122
|
-
const { runApprovalUi } = await import("./runApprovalUi-
|
|
9128
|
+
const { runApprovalUi } = await import("./runApprovalUi-CdC5_Qoo.js");
|
|
9123
9129
|
await runApprovalUi({
|
|
9124
9130
|
client,
|
|
9125
9131
|
signal: stop.signal
|
|
@@ -9134,7 +9140,7 @@ Batch options:
|
|
|
9134
9140
|
registerViewCommands(program, (action) => withChannel(endpoint, getPrincipalSpec(), action));
|
|
9135
9141
|
program.command("ui").description("Launch the terminal UI (form-based browser of services + methods).").action(async () => {
|
|
9136
9142
|
const acquired = await acquireConnection(endpoint);
|
|
9137
|
-
const { runUi } = await import("./runUi-
|
|
9143
|
+
const { runUi } = await import("./runUi-Bb6VATfB.js");
|
|
9138
9144
|
try {
|
|
9139
9145
|
await runUi({
|
|
9140
9146
|
endpoint: acquired.ep,
|
|
@@ -9670,4 +9676,4 @@ function safeJson(value) {
|
|
|
9670
9676
|
//#endregion
|
|
9671
9677
|
export { formatCondition as _, formatCommandLegend as a, targetId as b, safeTerminalText as c, ObservablePromise as d, observableValue as f, resolveViewTarget as g, Disposable as h, dispatchHostKey as i, approvalDetailLines as l, derived as m, views as n, hostCommands as o, autorun as p, ViewFrame as r, matchesKey as s, runCli as t, ObservableLazyPromise as u, interfaceTarget as v, matchesTarget as y };
|
|
9672
9678
|
|
|
9673
|
-
//# sourceMappingURL=cli-
|
|
9679
|
+
//# sourceMappingURL=cli-DJREb0Dm.js.map
|