@hediet/linkrpc-cli 0.0.3-next.20261024.1 → 0.0.3-next.20261025.2
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 +1 -1
- package/dist/chunks/{cli-CXAAnZDA.js → cli-BZ-4lHyj.js} +46 -18
- package/dist/chunks/{cli-CXAAnZDA.js.map → cli-BZ-4lHyj.js.map} +1 -1
- package/dist/chunks/{runApprovalUi-BdPp7WNP.js → runApprovalUi-DTSdmhod.js} +3 -3
- package/dist/chunks/{runApprovalUi-BdPp7WNP.js.map → runApprovalUi-DTSdmhod.js.map} +1 -1
- package/dist/chunks/{runComplete-M-eKaNkI.js → runComplete-1DjMsU_0.js} +66 -39
- package/dist/chunks/runComplete-1DjMsU_0.js.map +1 -0
- package/dist/chunks/{runUi-Deeox_Ef.js → runUi-C8VfjCWT.js} +4 -4
- package/dist/chunks/{runUi-Deeox_Ef.js.map → runUi-C8VfjCWT.js.map} +1 -1
- package/dist/chunks/{scroll-CYhlBDSN.js → scroll-UHQjKgoj.js} +2 -2
- package/dist/chunks/{scroll-CYhlBDSN.js.map → scroll-UHQjKgoj.js.map} +1 -1
- package/dist/chunks/{src-yrqRWXzG.js → src-DPg65Jd1.js} +2 -2
- package/dist/chunks/{src-yrqRWXzG.js.map → src-DPg65Jd1.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/dist/chunks/runComplete-M-eKaNkI.js.map +0 -1
package/README.md
CHANGED
|
@@ -581,7 +581,7 @@ it**. Pick one of:
|
|
|
581
581
|
| `--endpoint <uri>` | A strict endpoint URI (see below). |
|
|
582
582
|
| `--endpoint-cmd <command>` | Spawn a _server_, hand it a fresh socket + token via `LINKRPC_ENDPOINT`/`LINKRPC_TOKEN`, then connect to it. |
|
|
583
583
|
| `--endpoint-cmd-stdio <command>` | Spawn a child and talk linkrpc over its stdio. |
|
|
584
|
-
| `LINKRPC_ENDPOINT` (env) | A URI, or a legacy bare socket path / `ws://` URL. Token from `LINKRPC_TOKEN`; enabled by default in the Hub profile. |
|
|
584
|
+
| `LINKRPC_ENDPOINT` (env) | A URI, or a legacy bare socket path / `ws://` URL. Token from `LINKRPC_TOKEN`; enabled by default in the Hub profile and with `--use-env` in the RPC profile. |
|
|
585
585
|
|
|
586
586
|
Legacy `HUBRPC_ENDPOINT` and `HUBRPC_TOKEN` remain supported when the
|
|
587
587
|
corresponding `LINKRPC_*` variable is absent.
|
|
@@ -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
|
|
1
|
+
import { $ as requestTopologyAccess, B as proxyCommand, Ct as MethodRefWithOptHash, 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 parseParamOverride, U as parseConnectionLimit, V as tunnelCommand, W as parseConnectionLimitMilliseconds, _t as describeSchema, a as resolveInvocationEndpoint, c as resolveLocalEndpoint, ct as readCliIdentity, dt as connect, et as setupSigning, ft as connectViaRootOverlay, gt as describeObjectParams, ht as resolvedEndpointToConfig, i as resolveInvocationContext, it as walkHub, lt as formatPrincipalSource, m as managedEndpointsInterface, mt as resolveTargetEndpoint, n as loadStaticHubSchema, nt as fetchSchema$1, o as resolveSigning, ot as cliIdentityTarget, pt as connectViaTransport, q as resolveCliInvocation, r as resolveStaticHubSchemaSource, rt as findMethodInSchema, s as validationDefault, st as deleteCliIdentity, t as completeForLine, tt as fetchDefaults, ut as parsePrincipalSpec, vt as explainValidation, wt as mcpForwardInterface, xt as mergeParams, y as HubHome, yt as validateValueAgainstSchema, z as ConnectionBroker } from "./runComplete-1DjMsU_0.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";
|
|
@@ -13,15 +13,15 @@ import * as net from "node:net";
|
|
|
13
13
|
import { mkdir, open, readFile, writeFile } from "node:fs/promises";
|
|
14
14
|
import { DEFAULT_WALK_DEPTH, HubDirectoryExplorer, fetchSchema, findCoveringCapabilities, hubGrantedServiceIdInterface } from "@hediet/linkrpc/hub/common";
|
|
15
15
|
import { CONSOLE_INTERFACE_TAG, ConsoleTemplate, consoleAttachResultSchema, consoleServerMessageSchema, decodeConsoleData, encodeConsoleData } from "@hediet/linkrpc-infra/console";
|
|
16
|
+
import { createInterface } from "node:readline/promises";
|
|
16
17
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
17
18
|
import * as readline from "node:readline";
|
|
18
|
-
import { createInterface, emitKeypressEvents } from "node:readline";
|
|
19
|
+
import { createInterface as createInterface$1, emitKeypressEvents } from "node:readline";
|
|
19
20
|
import { parse, unknown } from "zod/mini";
|
|
20
21
|
import { bootstrapApprovalCapability, createHubApprovalClient } from "@hediet/linkrpc-infra/approval";
|
|
21
22
|
import { connectionTokenBinderInterface } from "@hediet/linkrpc-hub/hub/server/connection-token-binder";
|
|
22
23
|
import { spawn } from "node:child_process";
|
|
23
24
|
import { TopologyClient, TopologyNetworkClient, TrafficClient } from "@hediet/linkrpc-infra/inspection";
|
|
24
|
-
import { createInterface as createInterface$1 } from "node:readline/promises";
|
|
25
25
|
import { stdin, stdout } from "node:process";
|
|
26
26
|
import { TrafficFlowAggregator, createTerminalConsentPrompt, formatFlowSummary } from "@hediet/linkrpc-hub";
|
|
27
27
|
import { loadHubConfig, printHubConfigSchema } from "@hediet/linkrpc-hub/config-file";
|
|
@@ -49,7 +49,7 @@ var ServiceConsoleInput = class {
|
|
|
49
49
|
this._close = _close;
|
|
50
50
|
this._wasRaw = _input.isRaw ?? false;
|
|
51
51
|
if (_input.isTTY) {
|
|
52
|
-
this._readline = createInterface({
|
|
52
|
+
this._readline = createInterface$1({
|
|
53
53
|
input: _input,
|
|
54
54
|
output,
|
|
55
55
|
terminal: true,
|
|
@@ -407,7 +407,7 @@ function contextNamespace(reference) {
|
|
|
407
407
|
async function useLocalManagement(start, action) {
|
|
408
408
|
const home = HubHome.resolve();
|
|
409
409
|
if (start) {
|
|
410
|
-
const { startDaemon, nodeDaemonLaunch } = await import("./src-
|
|
410
|
+
const { startDaemon, nodeDaemonLaunch } = await import("./src-DPg65Jd1.js");
|
|
411
411
|
if (await startDaemon({
|
|
412
412
|
home,
|
|
413
413
|
launch: nodeDaemonLaunch(home)
|
|
@@ -427,7 +427,7 @@ async function useLocalManagement(start, action) {
|
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
429
|
async function restartLocalDaemon() {
|
|
430
|
-
const { startDaemon, stopDaemon, nodeDaemonLaunch } = await import("./src-
|
|
430
|
+
const { startDaemon, stopDaemon, nodeDaemonLaunch } = await import("./src-DPg65Jd1.js");
|
|
431
431
|
const home = HubHome.resolve();
|
|
432
432
|
process.stderr.write("Restarting the local Hub daemon: clients will disconnect and managed workloads will stop. OS autostart settings are unchanged.\n");
|
|
433
433
|
await stopDaemon(home);
|
|
@@ -3040,7 +3040,7 @@ function selectParticipant(participants, nodeId) {
|
|
|
3040
3040
|
return participants.length === 1 ? participants[0] : void 0;
|
|
3041
3041
|
}
|
|
3042
3042
|
async function promptForParticipant(participants, search) {
|
|
3043
|
-
const readline = createInterface
|
|
3043
|
+
const readline = createInterface({
|
|
3044
3044
|
input: stdin,
|
|
3045
3045
|
output: stdout
|
|
3046
3046
|
});
|
|
@@ -8734,7 +8734,8 @@ async function main(rawArgv, executableName = "linkrpc") {
|
|
|
8734
8734
|
return;
|
|
8735
8735
|
}
|
|
8736
8736
|
if (endpoint === void 0) {
|
|
8737
|
-
|
|
8737
|
+
const ignoredEnvironmentHint = ignoredEndpointEnvironmentHint();
|
|
8738
|
+
process.stdout.write(`\n(No endpoint configured: pass ${endpointOptionsDescription()}.\n` + (ignoredEnvironmentHint === void 0 ? "" : `${ignoredEnvironmentHint}.\n`) + "To see method-specific --p:<name> flags here.)\n");
|
|
8738
8739
|
return;
|
|
8739
8740
|
}
|
|
8740
8741
|
let ref;
|
|
@@ -9256,7 +9257,7 @@ Batch options:
|
|
|
9256
9257
|
process.once("SIGINT", onSignal);
|
|
9257
9258
|
process.once("SIGTERM", onSignal);
|
|
9258
9259
|
try {
|
|
9259
|
-
const { runApprovalUi } = await import("./runApprovalUi-
|
|
9260
|
+
const { runApprovalUi } = await import("./runApprovalUi-DTSdmhod.js");
|
|
9260
9261
|
await runApprovalUi({
|
|
9261
9262
|
client,
|
|
9262
9263
|
signal: stop.signal
|
|
@@ -9271,7 +9272,7 @@ Batch options:
|
|
|
9271
9272
|
registerViewCommands(program, (action) => withChannel(endpoint, getPrincipalSpec(), action));
|
|
9272
9273
|
program.command("ui").description("Launch the terminal UI (form-based browser of services + methods).").action(async () => {
|
|
9273
9274
|
const acquired = await acquireConnection(endpoint);
|
|
9274
|
-
const { runUi } = await import("./runUi-
|
|
9275
|
+
const { runUi } = await import("./runUi-C8VfjCWT.js");
|
|
9275
9276
|
try {
|
|
9276
9277
|
await runUi({
|
|
9277
9278
|
endpoint: acquired.ep,
|
|
@@ -9283,13 +9284,27 @@ Batch options:
|
|
|
9283
9284
|
acquired.running?.dispose();
|
|
9284
9285
|
}
|
|
9285
9286
|
});
|
|
9286
|
-
if (profile === "hub") program.command("logout").description("Delete the stored
|
|
9287
|
-
const
|
|
9288
|
-
|
|
9289
|
-
|
|
9287
|
+
if (profile === "hub") program.command("logout").description("Delete the stored keypair and cached capabilities of the identity selected by --principal (default: the user:hubrpc-cli fallback). Asks for confirmation unless --yes is given. The next call mints a fresh keypair, which hubs that trusted the old key do not accept.").option("-y, --yes", "delete without asking for confirmation").action(async (opts) => {
|
|
9288
|
+
const target = cliIdentityTarget(getPrincipalSpec());
|
|
9289
|
+
const principal = await readCliIdentity(target);
|
|
9290
|
+
if (principal === void 0) {
|
|
9291
|
+
process.stdout.write(`linkrpc: no stored identity for ${target.label} (${target.file}).\n`);
|
|
9290
9292
|
return;
|
|
9291
9293
|
}
|
|
9292
|
-
|
|
9294
|
+
const description = `identity ${target.label} (${principal}) at ${target.file}`;
|
|
9295
|
+
if (opts.yes !== true) {
|
|
9296
|
+
if (process.stdin.isTTY !== true || process.stderr.isTTY !== true) throw new Error(`Refusing to delete ${description} without confirmation; pass --yes.`);
|
|
9297
|
+
const readline = createInterface({
|
|
9298
|
+
input: process.stdin,
|
|
9299
|
+
output: process.stderr
|
|
9300
|
+
});
|
|
9301
|
+
const answer = await readline.question(`Delete ${description} and its cached capabilities? This cannot be undone. [y/N] `).finally(() => readline.close());
|
|
9302
|
+
if (!/^y(es)?$/i.test(answer.trim())) {
|
|
9303
|
+
process.stderr.write("linkrpc: logout cancelled.\n");
|
|
9304
|
+
return;
|
|
9305
|
+
}
|
|
9306
|
+
}
|
|
9307
|
+
for (const f of await deleteCliIdentity(target)) process.stdout.write(`removed ${f}\n`);
|
|
9293
9308
|
});
|
|
9294
9309
|
program.command("completions <shell>").description("Print a shell completion script. Supported: powershell. Install with `hub completions powershell | Out-String | Invoke-Expression` (one-shot) or append to $PROFILE.").action((shell) => {
|
|
9295
9310
|
try {
|
|
@@ -9639,7 +9654,8 @@ async function acquireConnection(endpoint) {
|
|
|
9639
9654
|
if (endpoint === void 0 && g_invocation?.profile === "hub") try {
|
|
9640
9655
|
return { ep: resolveLocalEndpoint() };
|
|
9641
9656
|
} catch {
|
|
9642
|
-
|
|
9657
|
+
const ignoredEnvironmentHint = ignoredEndpointEnvironmentHint();
|
|
9658
|
+
throw new Error(`No endpoint configured through flags, environment, or context, and the local Hub daemon is not running. Pass ${endpointOptionsDescription()}, or start the daemon (any \`hub services run\` starts it).` + (ignoredEnvironmentHint === void 0 ? "" : ` ${ignoredEnvironmentHint}.`));
|
|
9643
9659
|
}
|
|
9644
9660
|
return { ep: needEndpoint(endpoint) };
|
|
9645
9661
|
}
|
|
@@ -9649,11 +9665,23 @@ function reportIdentity(session) {
|
|
|
9649
9665
|
}
|
|
9650
9666
|
function needEndpoint(endpoint) {
|
|
9651
9667
|
if (!endpoint) {
|
|
9652
|
-
|
|
9668
|
+
const ignoredEnvironmentHint = ignoredEndpointEnvironmentHint();
|
|
9669
|
+
process.stderr.write(`linkrpc: this command requires ${endpointOptionsDescription()}.\n` + (ignoredEnvironmentHint === void 0 ? "" : `linkrpc: ${ignoredEnvironmentHint}.\n`));
|
|
9653
9670
|
process.exit(2);
|
|
9654
9671
|
}
|
|
9655
9672
|
return endpoint;
|
|
9656
9673
|
}
|
|
9674
|
+
function endpointOptionsDescription() {
|
|
9675
|
+
const options = "--endpoint / --endpoint-cmd / --endpoint-cmd-stdio or a configured context";
|
|
9676
|
+
return g_invocation?.profile === "hub" && g_invocation.environmentApplied ? `${options} or LINKRPC_ENDPOINT` : options;
|
|
9677
|
+
}
|
|
9678
|
+
function ignoredEndpointEnvironmentHint() {
|
|
9679
|
+
const invocation = g_invocation;
|
|
9680
|
+
if (invocation === void 0 || invocation.environmentApplied) return void 0;
|
|
9681
|
+
const variable = process.env.LINKRPC_ENDPOINT !== void 0 ? "LINKRPC_ENDPOINT" : process.env.HUBRPC_ENDPOINT !== void 0 ? "HUBRPC_ENDPOINT" : void 0;
|
|
9682
|
+
if (variable === void 0) return void 0;
|
|
9683
|
+
return invocation.profile === "rpc" ? `${variable} is set but only used by hub commands: run \`linkrpc hub <command>\` (or pass --use-env)` : `${variable} is set but ignored because environment overrides are disabled; pass --use-env to apply it`;
|
|
9684
|
+
}
|
|
9657
9685
|
/** The `--target-endpoint*` options shared by `tunnel` and `proxy`. */
|
|
9658
9686
|
function addTargetEndpointOptions(command) {
|
|
9659
9687
|
return command.option("--target-endpoint <uri>", "target endpoint URI (unix:/path?token=…, npipe://./pipe/…, ws[s]://host?token=…, cmd:?command=… or cmd-stdio:?command=…)").option("--target-endpoint-cmd <command>", "spawn the target as a server, connect via an injected env socket; the child sees the claimed service id as grantedServiceIdNamespace via hubGrantedServiceId::get").option("--target-endpoint-cmd-stdio <command>", "spawn the target and talk linkrpc over its stdio").option("--target-endpoint-cmd-env <key=value>", "env var for the --target-endpoint-cmd / --target-endpoint-cmd-stdio child (repeatable)", (val, acc) => {
|
|
@@ -9807,4 +9835,4 @@ function safeJson(value) {
|
|
|
9807
9835
|
//#endregion
|
|
9808
9836
|
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 };
|
|
9809
9837
|
|
|
9810
|
-
//# sourceMappingURL=cli-
|
|
9838
|
+
//# sourceMappingURL=cli-BZ-4lHyj.js.map
|