@hediet/linkrpc-cli 0.0.3-next.20261022.1 → 0.0.3-next.20261022.3

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 CHANGED
@@ -800,27 +800,33 @@ 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
- - `--outbound signed` (default) re-signs every call the participant emits as
804
- the CLI's `--principal` and negotiates capabilities, so a participant without
805
- signing support can call services behind `forwardChecking`.
806
- `--outbound verbatim` forwards calls unsigned (keeping any `$hubrpc` envelope
807
- the participant attached); `--outbound none` drops them.
808
- - `--claim <serviceId>` claims the service id and forwards requests the hub
809
- routes to it to the participant, verbatim (callers' signatures are kept).
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.
810
815
 
811
816
  ```sh
812
817
  # A Rust client that cannot sign yet reaches a gated remote service.
813
818
  # Point it at this cmd-stdio endpoint and address calls to the remote service id:
814
- # cmd-stdio:?argv=linkrpc&argv=hub&argv=proxy&argv=--stdio
815
- hub proxy --stdio
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
816
822
 
817
823
  # Serve a stdio program under a service id (equivalent to `tunnel`).
818
- hub proxy --claim my/service --outbound none --target-endpoint-cmd-stdio "my-server --stdio"
824
+ hub proxy --claim my/service --no-outbound --target-endpoint-cmd-stdio "my-server --stdio"
819
825
  ```
820
826
 
821
827
  With `--stdio`, the proxy exits when stdin closes. `tunnel <serviceId>` is
822
- `proxy --claim <serviceId>` with `--bidi` selecting `--outbound verbatim`
823
- instead of `none`.
828
+ `proxy --claim <serviceId> --no-outbound`; with `--bidi` it forwards the
829
+ target's calls unsigned.
824
830
 
825
831
  ### Capabilities
826
832
 
@@ -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-HH0NuvsL.js";
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-CCHXMIFR.js");
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-CCHXMIFR.js");
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,19 +8967,26 @@ Batch options:
8967
8967
  local.close();
8968
8968
  }
8969
8969
  });
8970
- addTargetEndpointOptions(program.command("proxy").description("Stand in for a participant on the hub (--endpoint*). The participant is this process's stdin/stdout (--stdio) or a target endpoint (--target-endpoint*). Calls the participant emits are forwarded to the hub per --outbound: `signed` (default) re-signs them as this CLI's --principal with capability negotiation, so participants that cannot sign can call gated services; `verbatim` forwards them unsigned; `none` drops them. With --claim, requests the hub routes to <serviceId> are forwarded to the participant. Runs until the participant disconnects or Ctrl-C.")).option("--stdio", "use this process's stdin/stdout as the participant").option("--claim <serviceId>", "claim <serviceId> on the hub and forward its requests to the participant").addOption(new Option("--outbound <mode>", "how participant calls reach the hub").choices([
8971
- "signed",
8972
- "verbatim",
8973
- "none"
8974
- ]).default("signed")).action(async (cmdOpts) => {
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) => {
8975
8971
  const localEp = needEndpoint(endpoint);
8976
8972
  if (cmdOpts.stdio === hasTargetEndpoint(cmdOpts)) {
8977
8973
  process.stderr.write("linkrpc: proxy requires exactly one of --stdio or --target-endpoint*.\n");
8978
8974
  process.exit(2);
8979
8975
  }
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");
8982
+ process.exit(2);
8983
+ }
8980
8984
  const targetEp = cmdOpts.stdio ? void 0 : resolveTargetEndpointOrExit(cmdOpts, program.opts(), "proxy");
8981
8985
  const hub = await connect(localEp, wireLog("hub"));
8982
- reportIdentity(await setupSigning(hub.channel, hub.signing, getPrincipalSpec(), { negotiateHubCaps: isHubEndpoint(localEp) }));
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
+ }
8983
8990
  const participant = targetEp === void 0 ? await connectStdioParticipant() : {
8984
8991
  connection: await connectTargetEndpoint(targetEp, cmdOpts.claim ?? ""),
8985
8992
  closed: void 0
@@ -8988,7 +8995,7 @@ Batch options:
8988
8995
  await proxyCommand({
8989
8996
  hub,
8990
8997
  participant: participant.connection,
8991
- outbound: cmdOpts.outbound,
8998
+ outbound: !cmdOpts.outbound ? "none" : cmdOpts.signAs !== void 0 ? "signed" : "verbatim",
8992
8999
  ...cmdOpts.claim !== void 0 ? { claimServiceId: cmdOpts.claim } : {},
8993
9000
  ...participant.closed !== void 0 ? { stop: participant.closed } : {}
8994
9001
  });
@@ -9118,7 +9125,7 @@ Batch options:
9118
9125
  process.once("SIGINT", onSignal);
9119
9126
  process.once("SIGTERM", onSignal);
9120
9127
  try {
9121
- const { runApprovalUi } = await import("./runApprovalUi-DpoUwBpd.js");
9128
+ const { runApprovalUi } = await import("./runApprovalUi-CdC5_Qoo.js");
9122
9129
  await runApprovalUi({
9123
9130
  client,
9124
9131
  signal: stop.signal
@@ -9133,7 +9140,7 @@ Batch options:
9133
9140
  registerViewCommands(program, (action) => withChannel(endpoint, getPrincipalSpec(), action));
9134
9141
  program.command("ui").description("Launch the terminal UI (form-based browser of services + methods).").action(async () => {
9135
9142
  const acquired = await acquireConnection(endpoint);
9136
- const { runUi } = await import("./runUi-BbiA5lOP.js");
9143
+ const { runUi } = await import("./runUi-Bb6VATfB.js");
9137
9144
  try {
9138
9145
  await runUi({
9139
9146
  endpoint: acquired.ep,
@@ -9669,4 +9676,4 @@ function safeJson(value) {
9669
9676
  //#endregion
9670
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 };
9671
9678
 
9672
- //# sourceMappingURL=cli-Cw9kg0Dt.js.map
9679
+ //# sourceMappingURL=cli-DJREb0Dm.js.map