@hediet/linkrpc-cli 0.0.3-next.20261102.2 → 0.0.3-next.20261104.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 +35 -0
- package/dist/chunks/{cli-BY9fXhpJ.js → cli-DlRKUZEu.js} +82 -18
- package/dist/chunks/cli-DlRKUZEu.js.map +1 -0
- package/dist/chunks/{runApprovalUi-5soIqxOS.js → runApprovalUi-BLZTrXDW.js} +3 -3
- package/dist/chunks/{runApprovalUi-5soIqxOS.js.map → runApprovalUi-BLZTrXDW.js.map} +1 -1
- package/dist/chunks/{runComplete-BWhPmSgi.js → runComplete-D9FsRgZ1.js} +44 -5
- package/dist/chunks/runComplete-D9FsRgZ1.js.map +1 -0
- package/dist/chunks/{runUi-Dkm-6D6s.js → runUi-BusCK0Ka.js} +4 -4
- package/dist/chunks/runUi-BusCK0Ka.js.map +1 -0
- package/dist/chunks/{scroll-rkdCKbaP.js → scroll-XTaYmTi0.js} +2 -2
- package/dist/chunks/{scroll-rkdCKbaP.js.map → scroll-XTaYmTi0.js.map} +1 -1
- package/dist/chunks/{src-DIsGc3Ft.js → src-B7DEaKGS.js} +2 -2
- package/dist/chunks/{src-DIsGc3Ft.js.map → src-B7DEaKGS.js.map} +1 -1
- package/dist/daemon.js +54 -10
- package/dist/daemon.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 +6 -6
- package/dist/chunks/cli-BY9fXhpJ.js.map +0 -1
- package/dist/chunks/runComplete-BWhPmSgi.js.map +0 -1
- package/dist/chunks/runUi-Dkm-6D6s.js.map +0 -1
package/README.md
CHANGED
|
@@ -978,6 +978,35 @@ remaining unique and MCP-safe even for long service paths. Descriptions identify
|
|
|
978
978
|
the source service. Disconnecting stdio closes this client's forwarding sessions.
|
|
979
979
|
This version aggregates tools, not resources, prompts, or sampling.
|
|
980
980
|
|
|
981
|
+
`mcp-export` serves the same over Streamable HTTP on a loopback port, so all
|
|
982
|
+
agents of a machine share one process and one hub connection instead of
|
|
983
|
+
starting `hub mcp` per session. Run it as a hub daemon service and point the
|
|
984
|
+
agents at it, e.g. in `~/.copilot/mcp-config.json`:
|
|
985
|
+
|
|
986
|
+
```sh
|
|
987
|
+
LINKRPC_MCP_EXPORT_TOKEN=<secret> linkrpc hub mcp-export --port 8124
|
|
988
|
+
```
|
|
989
|
+
|
|
990
|
+
```json
|
|
991
|
+
{
|
|
992
|
+
"mcpServers": {
|
|
993
|
+
"hub": {
|
|
994
|
+
"type": "http",
|
|
995
|
+
"url": "http://127.0.0.1:8124/mcp",
|
|
996
|
+
"headers": { "Authorization": "Bearer <secret>" }
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
```
|
|
1001
|
+
|
|
1002
|
+
Clients must send the bearer token from the environment variable named by
|
|
1003
|
+
`--token-env` (default `LINKRPC_MCP_EXPORT_TOKEN`). Each MCP session has its own
|
|
1004
|
+
aggregator, forwarded sessions, and script state (`lastResultVal`, parked
|
|
1005
|
+
tasks); all sessions sign as the export's identity and share its grants.
|
|
1006
|
+
`--idle-timeout <minutes>` closes sessions without requests; a client then gets
|
|
1007
|
+
HTTP 404 and must initialize again. The export exits when its hub connection
|
|
1008
|
+
closes, so the daemon restarts it.
|
|
1009
|
+
|
|
981
1010
|
### Publishing MCP servers
|
|
982
1011
|
|
|
983
1012
|
Producers stay separate. `mcp-publish` publishes one MCP server, given as a
|
|
@@ -1176,6 +1205,12 @@ Schema validation is mandatory for explicit requests: `--no-validate` and
|
|
|
1176
1205
|
the permission; signed calls include that hash in their signed metadata.
|
|
1177
1206
|
The default requested duration is `persistent`; `--cap:duration shortLived` and
|
|
1178
1207
|
`--cap:duration longLived` are also supported. The Hub still decides what to grant.
|
|
1208
|
+
`call --cap:request --cap:duration once` instead requests a grant bound to the
|
|
1209
|
+
single call it executes (its exact params, nonce, and timestamp), so the approval
|
|
1210
|
+
authorizes that call only and is never stored. It cannot be combined with
|
|
1211
|
+
`caps request`, `--cap:allow-param`, or `--cap:delegate`, and needs a fully
|
|
1212
|
+
qualified `service::interface::method` reference. A durable grant that already
|
|
1213
|
+
covers the call is used without a new request.
|
|
1179
1214
|
`--cap:delegate` also requests `canDelegate`, so the identity can issue narrower
|
|
1180
1215
|
capabilities for that scope to other identities, e.g. a service it runs; a
|
|
1181
1216
|
stored grant without delegation does not satisfy such a request.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as proxyCommand, Ct as mergeParams, F as disconnectBroker, G as parseConnectionLimit, H as claimServiceId, I as getBrokerStatus, K as parseConnectionLimitMilliseconds, L as readBrokerNotifications, M as readEndpointDiscovery, N as ContextStore, P as formatContextReference, R as stopConnectionBroker, Tt as MethodRefWithOptHash, U as resolveServiceIdToClaim, V as tunnelCommand, W as withStaticHubReflection, Y as resolveCliInvocation, _t as resolvedEndpointToConfig, a as resolveInvocationEndpoint, at as findMethodInSchema, bt as explainValidation, c as resolveLocalEndpoint, ct as cliIdentityTarget, dt as formatPrincipalSource, et as requestReflectionAccess, ft as parsePrincipalSpec, gt as resolveTargetEndpoint, ht as connectViaTransport, i as resolveInvocationContext, it as fetchSchema$1, lt as deleteCliIdentity, m as managedEndpointsInterface, mt as connectViaRootOverlay, n as loadStaticHubSchema, nt as setupSigning, o as resolveSigning, ot as walkHub, pt as connect, q as parseDuration, r as resolveStaticHubSchemaSource, rt as fetchDefaults, s as validationDefault, t as completeForLine, tt as requestTopologyAccess, ut as readCliIdentity, vt as describeObjectParams, wt as parseParamOverride, xt as validateValueAgainstSchema, y as HubHome, yt as describeSchema, z as ConnectionBroker } from "./runComplete-
|
|
1
|
+
import { B as proxyCommand, Ct as mergeParams, F as disconnectBroker, G as parseConnectionLimit, H as claimServiceId, I as getBrokerStatus, K as parseConnectionLimitMilliseconds, L as readBrokerNotifications, M as readEndpointDiscovery, N as ContextStore, P as formatContextReference, R as stopConnectionBroker, Tt as MethodRefWithOptHash, U as resolveServiceIdToClaim, V as tunnelCommand, W as withStaticHubReflection, Y as resolveCliInvocation, _t as resolvedEndpointToConfig, a as resolveInvocationEndpoint, at as findMethodInSchema, bt as explainValidation, c as resolveLocalEndpoint, ct as cliIdentityTarget, dt as formatPrincipalSource, et as requestReflectionAccess, ft as parsePrincipalSpec, gt as resolveTargetEndpoint, ht as connectViaTransport, i as resolveInvocationContext, it as fetchSchema$1, lt as deleteCliIdentity, m as managedEndpointsInterface, mt as connectViaRootOverlay, n as loadStaticHubSchema, nt as setupSigning, o as resolveSigning, ot as walkHub, pt as connect, q as parseDuration, r as resolveStaticHubSchemaSource, rt as fetchDefaults, s as validationDefault, t as completeForLine, tt as requestTopologyAccess, ut as readCliIdentity, vt as describeObjectParams, wt as parseParamOverride, xt as validateValueAgainstSchema, y as HubHome, yt as describeSchema, z as ConnectionBroker } from "./runComplete-D9FsRgZ1.js";
|
|
2
2
|
import { HubMcpAggregator, McpToolHost, hostMcpServer, mcpExposeConfigSchema, mcpServerConfigSchema, serveMcpForwardInstance, streamInstanceTransport } from "@hediet/linkrpc-mcp/hub";
|
|
3
3
|
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";
|
|
4
4
|
import { WebSocketTransport, connectNdjson, connectToHub, formatEndpointUri, isHubEndpoint, openWebSocket, parseEndpointUri, runInitializeHandshake, traceMessageTransport as traceMessageTransport$1 } from "@hediet/linkrpc/node";
|
|
@@ -412,7 +412,7 @@ function contextNamespace(reference) {
|
|
|
412
412
|
async function useLocalManagement(start, action) {
|
|
413
413
|
const home = HubHome.resolve();
|
|
414
414
|
if (start) {
|
|
415
|
-
const { startDaemon, nodeDaemonLaunch } = await import("./src-
|
|
415
|
+
const { startDaemon, nodeDaemonLaunch } = await import("./src-B7DEaKGS.js");
|
|
416
416
|
if (await startDaemon({
|
|
417
417
|
home,
|
|
418
418
|
launch: nodeDaemonLaunch(home)
|
|
@@ -432,7 +432,7 @@ async function useLocalManagement(start, action) {
|
|
|
432
432
|
}
|
|
433
433
|
}
|
|
434
434
|
async function restartLocalDaemon() {
|
|
435
|
-
const { startDaemon, stopDaemon, nodeDaemonLaunch } = await import("./src-
|
|
435
|
+
const { startDaemon, stopDaemon, nodeDaemonLaunch } = await import("./src-B7DEaKGS.js");
|
|
436
436
|
const home = HubHome.resolve();
|
|
437
437
|
process.stderr.write("Restarting the local Hub daemon: clients will disconnect and managed workloads will stop. OS autostart settings are unchanged.\n");
|
|
438
438
|
await stopDaemon(home);
|
|
@@ -1485,14 +1485,20 @@ async function callCommand(channel, opts) {
|
|
|
1485
1485
|
if (!requestCap && opts.allowParams !== void 0) throw new Error("--cap:allow-param requires --cap:request.");
|
|
1486
1486
|
if (requestCap && (opts.noValidate || opts.validation === "off")) throw new Error("Capability requests require schema validation; remove --no-validate/--validation off.");
|
|
1487
1487
|
if (requestCap && opts.signingSession === void 0) throw new Error("Capability requests require a signed LinkRPC connection.");
|
|
1488
|
+
const once = requestCap && opts.duration === "once";
|
|
1489
|
+
if (once && opts.capabilityOnly) throw new Error("A once capability is bound to one call; use `call --cap:request --cap:duration once`.");
|
|
1490
|
+
if (once && (opts.allowParams !== void 0 || opts.delegate === true)) throw new Error("--cap:duration once cannot be combined with --cap:allow-param or --cap:delegate.");
|
|
1488
1491
|
const onStreamChunk = opts.onStreamChunk ?? writeChunkToStderr;
|
|
1489
1492
|
try {
|
|
1490
1493
|
const validation = requestCap ? "required" : opts.noValidate ? "off" : opts.validation ?? "required";
|
|
1491
1494
|
const schema = validation === "off" ? void 0 : await validateParams(channel, ref, params, "call", validation);
|
|
1492
1495
|
if (requestCap) {
|
|
1493
1496
|
if (schema === void 0 || opts.signingSession === void 0) throw new Error("Capability requests require a method schema and signing session.");
|
|
1494
|
-
|
|
1495
|
-
|
|
1497
|
+
if (once) opts.signingSession.requestOnceForNextCall(ref.getMethodOnWire());
|
|
1498
|
+
else {
|
|
1499
|
+
const result = await requestCallCapability(channel, opts.signingSession, ref, params, schema, opts);
|
|
1500
|
+
if (opts.capabilityOnly) return result;
|
|
1501
|
+
}
|
|
1496
1502
|
}
|
|
1497
1503
|
const result = await channel.sendRequestWithStream(ref.getMethodOnWire(), params, {
|
|
1498
1504
|
onStreamMessage: onStreamChunk,
|
|
@@ -3546,6 +3552,42 @@ const unsignedAccess = {
|
|
|
3546
3552
|
reason: "This connection does not sign calls."
|
|
3547
3553
|
})
|
|
3548
3554
|
};
|
|
3555
|
+
/**
|
|
3556
|
+
* Serve what {@link mcpCommand} serves over Streamable HTTP on a loopback port,
|
|
3557
|
+
* so many MCP clients share one process and one hub connection. Every MCP
|
|
3558
|
+
* session gets its own aggregator, forwarded sessions, and script state.
|
|
3559
|
+
*/
|
|
3560
|
+
async function mcpExportCommand(channel, options) {
|
|
3561
|
+
const log = options.log ?? ((message) => {
|
|
3562
|
+
process.stderr.write(`linkrpc mcp-export: ${message}\n`);
|
|
3563
|
+
});
|
|
3564
|
+
const { singleConnectionPool } = await import("@hediet/linkrpc-mcp");
|
|
3565
|
+
const { McpSocketHost } = await import("@hediet/linkrpc-mcp/node");
|
|
3566
|
+
const access = options.access ?? unsignedAccess;
|
|
3567
|
+
const host = await McpSocketHost.start({
|
|
3568
|
+
transport: "http",
|
|
3569
|
+
port: options.port,
|
|
3570
|
+
authorizationToken: options.authorizationToken,
|
|
3571
|
+
...options.idleSessionTimeoutMs !== void 0 ? { idleSessionTimeoutMs: options.idleSessionTimeoutMs } : {},
|
|
3572
|
+
log,
|
|
3573
|
+
createSession: async ({ sessionId }) => ({ serverOptions: {
|
|
3574
|
+
pool: singleConnectionPool(channel, access, `mcp-export:${sessionId}`),
|
|
3575
|
+
scriptTools: options.scripts !== false,
|
|
3576
|
+
hubTools: {
|
|
3577
|
+
requestDirectoryAccess: options.requestDirectoryAccess,
|
|
3578
|
+
log: (message) => log(`[${sessionId.slice(0, 8)}] ${message}`),
|
|
3579
|
+
...options.mcpIdentities !== void 0 ? { mcpIdentityFor: (serviceId) => options.mcpIdentities?.[serviceId] } : {}
|
|
3580
|
+
}
|
|
3581
|
+
} })
|
|
3582
|
+
});
|
|
3583
|
+
const endpoint = host.endpoint;
|
|
3584
|
+
if (endpoint.kind === "tcp") log(`listening at http://${endpoint.host}:${endpoint.port}${endpoint.requestPath}`);
|
|
3585
|
+
try {
|
|
3586
|
+
await options.stop;
|
|
3587
|
+
} finally {
|
|
3588
|
+
host.dispose();
|
|
3589
|
+
}
|
|
3590
|
+
}
|
|
3549
3591
|
//#endregion
|
|
3550
3592
|
//#region src/commands/jsonRpcStdio.ts
|
|
3551
3593
|
/** Expose a remote `jsonRpcConnection` service as an NDJSON stdio endpoint. */
|
|
@@ -8576,7 +8618,7 @@ async function main(rawArgv, executableName = "linkrpc") {
|
|
|
8576
8618
|
const profile = cliInvocation.profile;
|
|
8577
8619
|
const program = new Command();
|
|
8578
8620
|
program.configureHelp({ showGlobalOptions: true });
|
|
8579
|
-
program.name(cliInvocation.programName).description(profile === "hub" ? "CLI / TUI for LinkRPC hubs. Shared RPC commands use hub initialization, signing, capability negotiation, and required schema validation by default." : "CLI / TUI for JSON-RPC and LinkRPC endpoints. Shared commands use the RPC profile with automatic schema validation and no endpoint environment override by default.").option("--endpoint <uri>", "endpoint URI (linkrpc:local, unix:/path?token
|
|
8621
|
+
program.name(cliInvocation.programName).description(profile === "hub" ? "CLI / TUI for LinkRPC hubs. Shared RPC commands use hub initialization, signing, capability negotiation, and required schema validation by default." : "CLI / TUI for JSON-RPC and LinkRPC endpoints. Shared commands use the RPC profile with automatic schema validation and no endpoint environment override by default.").option("--endpoint <uri>", "endpoint URI (linkrpc:local, unix:/path?token=…, npipe://./pipe/…, ws[s]://host?token=…, ws-no-init://host?…, cmd:?command=… or cmd-stdio:?command=…)").option("--endpoint-cmd <command>", "spawn a server, connect via an injected env socket").option("--endpoint-cmd-stdio <command>", "spawn a child and talk over its stdio").option("--endpoint-cmd-env <key=value>", "env var for the --endpoint-cmd / --endpoint-cmd-stdio child (repeatable)", (val, acc) => {
|
|
8580
8622
|
const eq = val.indexOf("=");
|
|
8581
8623
|
if (eq === -1) throw new InvalidArgumentError(`expected key=value, got '${val}'`);
|
|
8582
8624
|
const next = acc ?? {};
|
|
@@ -8709,7 +8751,7 @@ async function main(rawArgv, executableName = "linkrpc") {
|
|
|
8709
8751
|
return result;
|
|
8710
8752
|
}
|
|
8711
8753
|
});
|
|
8712
|
-
program.command("attach [serviceId]").description("Attach to a console of any service implementing the `linkrpc.console.v1` interface template (found through the `linkrpc.console` directory tag). Without a service, list available consoles. Pipe consoles: Ctrl+D on an empty line detaches. TTY consoles: keys go to the program; the detach keys (default Ctrl+B, then d) detach.").option("--params <json>", "params of the console template instance, e.g. '{\"namespace\":\"
|
|
8754
|
+
program.command("attach [serviceId]").description("Attach to a console of any service implementing the `linkrpc.console.v1` interface template (found through the `linkrpc.console` directory tag). Without a service, list available consoles. Pipe consoles: Ctrl+D on an empty line detaches. TTY consoles: keys go to the program; the detach keys (default Ctrl+B, then d) detach.").option("--params <json>", "params of the console template instance, e.g. '{\"namespace\":\"…\",\"id\":\"main\"}'", "{}").option("--interface <id>", "interface containing the console instance").option("--instance <name>", "console template instance name, when an interface has several").option("--read-only", "observe output without sending input").action(async (serviceId, opts) => {
|
|
8713
8755
|
await withChannel(endpoint, getPrincipalSpec(), async (channel) => {
|
|
8714
8756
|
if (serviceId === void 0) {
|
|
8715
8757
|
process.stdout.write(`${await listConsoleTargets(channel)}\n`);
|
|
@@ -8968,7 +9010,8 @@ async function main(rawArgv, executableName = "linkrpc") {
|
|
|
8968
9010
|
});
|
|
8969
9011
|
});
|
|
8970
9012
|
const capsRequest = caps?.command("request [methodRef]").description("Request and store a capability without invoking the method.");
|
|
8971
|
-
const addCapabilityOptions = (cmd) => cmd.option("--cap:allow-param <kv...>", "top-level key=matcher JSON (exact, enum, prefix, subsetOf, any)").option("--cap:allow-prefix <prefix>", "allow a string prefix for the immediately preceding parameter").option("--cap:allow-any", "allow any JSON value for the immediately preceding parameter").option("--cap:allow-enum <json>", "allow one value from a JSON array for the preceding parameter").option("--cap:allow-subset <json>", "allow an array of items from a JSON string array for the preceding parameter").addOption(new Option("--cap:duration <duration>", "requested grant lifetime").choices([
|
|
9013
|
+
const addCapabilityOptions = (cmd) => cmd.option("--cap:allow-param <kv...>", "top-level key=matcher JSON (exact, enum, prefix, subsetOf, any)").option("--cap:allow-prefix <prefix>", "allow a string prefix for the immediately preceding parameter").option("--cap:allow-any", "allow any JSON value for the immediately preceding parameter").option("--cap:allow-enum <json>", "allow one value from a JSON array for the preceding parameter").option("--cap:allow-subset <json>", "allow an array of items from a JSON string array for the preceding parameter").addOption(new Option("--cap:duration <duration>", "requested grant lifetime; once (call --cap:request only) binds the grant to this single call").choices([
|
|
9014
|
+
"once",
|
|
8972
9015
|
"shortLived",
|
|
8973
9016
|
"longLived",
|
|
8974
9017
|
"persistent"
|
|
@@ -9324,6 +9367,27 @@ Batch options:
|
|
|
9324
9367
|
autoNegotiatePerCall: true
|
|
9325
9368
|
});
|
|
9326
9369
|
});
|
|
9370
|
+
program.command("mcp-export").description("Serve what `mcp` serves over Streamable HTTP on a loopback port (http://127.0.0.1:<port>/mcp), so many MCP clients share one process. Clients send `Authorization: Bearer <token>`; the token is read from an environment variable.").requiredOption("--port <n>", "loopback port to listen on", (value) => parsePositiveInteger(value, "--port")).option("--token-env <name>", "environment variable holding the bearer token", "LINKRPC_MCP_EXPORT_TOKEN").option("--no-scripts", "serve only the aggregated MCP tools, without loading the script sandbox").option("--mcp-identity <serviceId=identity>", "use this MCP identity (account) of a published MCP server instead of its default (repeatable)", collectKeyValue).option("--idle-timeout <minutes>", "close MCP sessions without requests for this long (clients must then initialize again)", (value) => parsePositiveInteger(value, "--idle-timeout")).action(async (cmdOpts) => {
|
|
9371
|
+
const token = process.env[cmdOpts.tokenEnv];
|
|
9372
|
+
if (!token) throw new Error(`mcp-export: set the bearer token in $${cmdOpts.tokenEnv}`);
|
|
9373
|
+
await withChannel(endpoint, getPrincipalSpec(), async (channel, session, closed) => {
|
|
9374
|
+
await mcpExportCommand(channel, {
|
|
9375
|
+
port: cmdOpts.port,
|
|
9376
|
+
authorizationToken: token,
|
|
9377
|
+
scripts: cmdOpts.scripts !== false,
|
|
9378
|
+
...cmdOpts.mcpIdentity !== void 0 ? { mcpIdentities: cmdOpts.mcpIdentity } : {},
|
|
9379
|
+
...cmdOpts.idleTimeout !== void 0 ? { idleSessionTimeoutMs: cmdOpts.idleTimeout * 6e4 } : {},
|
|
9380
|
+
requestDirectoryAccess: session === void 0 ? void 0 : (serviceId) => requestDirectoryAccess(session, serviceId, { watch: true }),
|
|
9381
|
+
...session !== void 0 ? { access: session } : {},
|
|
9382
|
+
stop: Promise.race([_untilSignalled(), closed.then(() => {
|
|
9383
|
+
throw new Error("mcp-export: the hub connection closed");
|
|
9384
|
+
})])
|
|
9385
|
+
});
|
|
9386
|
+
}, {
|
|
9387
|
+
requestReflectionAccess: false,
|
|
9388
|
+
autoNegotiatePerCall: true
|
|
9389
|
+
});
|
|
9390
|
+
});
|
|
9327
9391
|
program.command("json-rpc-stdio <serviceId>").description("Expose <serviceId>::jsonRpcConnection::connectRaw as a newline-delimited JSON-RPC endpoint on this process's stdin/stdout.").option("--params <json>", "JSON value passed to the remote transport factory").action(async (serviceId, opts) => {
|
|
9328
9392
|
const localEp = needEndpoint(endpoint);
|
|
9329
9393
|
let params;
|
|
@@ -9443,7 +9507,7 @@ Batch options:
|
|
|
9443
9507
|
hub.close();
|
|
9444
9508
|
}
|
|
9445
9509
|
});
|
|
9446
|
-
program.command("connect-as <binderServiceId> <slot>").description("Mint a single-use identity token for <slot> from the <binderServiceId> (a service implementing connectionTokenBinder, typically the hub service id), then splice a target endpoint onto the hub as a first-class participant with that slot's managed identity and a granted serviceId namespace (--granted-service-id, defaulting to <slot>). No local hub is started: the CLI proxies the connection (target
|
|
9510
|
+
program.command("connect-as <binderServiceId> <slot>").description("Mint a single-use identity token for <slot> from the <binderServiceId> (a service implementing connectionTokenBinder, typically the hub service id), then splice a target endpoint onto the hub as a first-class participant with that slot's managed identity and a granted serviceId namespace (--granted-service-id, defaulting to <slot>). No local hub is started: the CLI proxies the connection (target ⟷ CLI ⟷ hub), so it works with every target kind and --log-messages taps the full flow. The hub-facing bound-token listener is --hub-endpoint (defaults to --endpoint when that is a ws/socket). Runs until Ctrl-C.").option("--hub-endpoint <uri>", "ws/socket bound-token listener to splice the target onto (default: --endpoint)").option("--target-endpoint <uri>", "target endpoint URI (unix:/…, ws[s]://…)").option("--target-endpoint-cmd <command>", "spawn the target as a server; it dials the CLI back").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) => {
|
|
9447
9511
|
const eq = val.indexOf("=");
|
|
9448
9512
|
if (eq === -1) throw new InvalidArgumentError(`expected key=value, got '${val}'`);
|
|
9449
9513
|
const next = acc ?? {};
|
|
@@ -9566,7 +9630,7 @@ Batch options:
|
|
|
9566
9630
|
process.once("SIGINT", onSignal);
|
|
9567
9631
|
process.once("SIGTERM", onSignal);
|
|
9568
9632
|
try {
|
|
9569
|
-
const { runApprovalUi } = await import("./runApprovalUi-
|
|
9633
|
+
const { runApprovalUi } = await import("./runApprovalUi-BLZTrXDW.js");
|
|
9570
9634
|
await runApprovalUi({
|
|
9571
9635
|
client,
|
|
9572
9636
|
signal: stop.signal
|
|
@@ -9581,7 +9645,7 @@ Batch options:
|
|
|
9581
9645
|
registerViewCommands(program, (action) => withChannel(endpoint, getPrincipalSpec(), action));
|
|
9582
9646
|
program.command("ui").description("Launch the terminal UI (form-based browser of services + methods).").action(async () => {
|
|
9583
9647
|
const acquired = await acquireConnection(endpoint);
|
|
9584
|
-
const { runUi } = await import("./runUi-
|
|
9648
|
+
const { runUi } = await import("./runUi-BusCK0Ka.js");
|
|
9585
9649
|
try {
|
|
9586
9650
|
await runUi({
|
|
9587
9651
|
endpoint: acquired.ep,
|
|
@@ -9843,11 +9907,11 @@ async function withChannel(endpoint, principalSpec, fn, opts = {}) {
|
|
|
9843
9907
|
const channel = schemaSource === void 0 ? conn.channel : withStaticHubReflection(conn.channel, await loadStaticHubSchema(schemaSource));
|
|
9844
9908
|
if (acquired.ep.kind === "ws-no-init" || acquired.ep.kind === "socket" && acquired.ep.brokerMode === "raw") {
|
|
9845
9909
|
if (opts.requireSigning || g_invocation?.values.sign === true) throw new Error("Signing requires an initialized LinkRPC endpoint.");
|
|
9846
|
-
await fn(channel);
|
|
9910
|
+
await fn(channel, void 0, conn.closed);
|
|
9847
9911
|
return;
|
|
9848
9912
|
}
|
|
9849
9913
|
if (!sign) {
|
|
9850
|
-
await fn(channel);
|
|
9914
|
+
await fn(channel, void 0, conn.closed);
|
|
9851
9915
|
return;
|
|
9852
9916
|
}
|
|
9853
9917
|
const session = await setupSigning(conn.channel, conn.signing, principalSpec, {
|
|
@@ -9861,7 +9925,7 @@ async function withChannel(endpoint, principalSpec, fn, opts = {}) {
|
|
|
9861
9925
|
if (opts.requestTopologyAccess !== void 0 && (acquired.running !== void 0 || isHubEndpoint(acquired.ep))) {
|
|
9862
9926
|
if (await requestTopologyAccess(session, opts.requestTopologyAccess) === "denied") process.stderr.write("linkrpc: topology access denied; topology sources may be inaccessible.\n");
|
|
9863
9927
|
}
|
|
9864
|
-
await fn(channel, session);
|
|
9928
|
+
await fn(channel, session, conn.closed);
|
|
9865
9929
|
} finally {
|
|
9866
9930
|
conn.close();
|
|
9867
9931
|
acquired.running?.dispose();
|
|
@@ -9934,7 +9998,7 @@ let g_logTransport = false;
|
|
|
9934
9998
|
/**
|
|
9935
9999
|
* Build the wire-tap options for a direct {@link connect}, or `undefined` when
|
|
9936
10000
|
* `--log-messages` is off. Logs every JSON-RPC message crossing the client
|
|
9937
|
-
* transport to stderr, rendered like the hub "Flows" view
|
|
10001
|
+
* transport to stderr, rendered like the hub "Flows" view — the way to observe
|
|
9938
10002
|
* a connection that never routes through a local hub.
|
|
9939
10003
|
*/
|
|
9940
10004
|
function wireLog(remoteLabel) {
|
|
@@ -9998,7 +10062,7 @@ function ignoredEndpointEnvironmentHint() {
|
|
|
9998
10062
|
}
|
|
9999
10063
|
/** The `--target-endpoint*` options shared by `tunnel` and `proxy`. */
|
|
10000
10064
|
function addTargetEndpointOptions(command) {
|
|
10001
|
-
return command.option("--target-endpoint <uri>", "target endpoint URI (unix:/path?token
|
|
10065
|
+
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) => {
|
|
10002
10066
|
const eq = val.indexOf("=");
|
|
10003
10067
|
if (eq === -1) throw new InvalidArgumentError(`expected key=value, got '${val}'`);
|
|
10004
10068
|
const next = acc ?? {};
|
|
@@ -10031,7 +10095,7 @@ function resolveTargetEndpointOrExit(opts, globalOpts, commandName) {
|
|
|
10031
10095
|
} : targetEp;
|
|
10032
10096
|
}
|
|
10033
10097
|
/**
|
|
10034
|
-
* Connect straight to a target endpoint
|
|
10098
|
+
* Connect straight to a target endpoint — no routing hub. A spawned cmd-env
|
|
10035
10099
|
* child is fronted with a RootOverlay: its root-form calls (identity::*,
|
|
10036
10100
|
* hubGrantedServiceId::*, reflection, hubAccess) are served locally while every
|
|
10037
10101
|
* forwarded request is relayed to the child through the overlay splitter. This
|
|
@@ -10161,4 +10225,4 @@ function definedEnv(env) {
|
|
|
10161
10225
|
//#endregion
|
|
10162
10226
|
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 };
|
|
10163
10227
|
|
|
10164
|
-
//# sourceMappingURL=cli-
|
|
10228
|
+
//# sourceMappingURL=cli-DlRKUZEu.js.map
|