@hediet/linkrpc-cli 0.0.3-next.20261031.1 → 0.0.3-next.20261102.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 +71 -14
- package/dist/chunks/{cli-DQr3bq_u.js → cli-BY9fXhpJ.js} +149 -67
- package/dist/chunks/cli-BY9fXhpJ.js.map +1 -0
- package/dist/chunks/{runApprovalUi-CHLl-QDw.js → runApprovalUi-5soIqxOS.js} +3 -3
- package/dist/chunks/{runApprovalUi-CHLl-QDw.js.map → runApprovalUi-5soIqxOS.js.map} +1 -1
- package/dist/chunks/{runComplete-C__MHMiO.js → runComplete-BWhPmSgi.js} +228 -36
- package/dist/chunks/runComplete-BWhPmSgi.js.map +1 -0
- package/dist/chunks/{runUi-CtNlZncr.js → runUi-Dkm-6D6s.js} +5 -5
- package/dist/chunks/{runUi-CtNlZncr.js.map → runUi-Dkm-6D6s.js.map} +1 -1
- package/dist/chunks/{scroll-B_5Pakou.js → scroll-rkdCKbaP.js} +2 -2
- package/dist/chunks/{scroll-B_5Pakou.js.map → scroll-rkdCKbaP.js.map} +1 -1
- package/dist/chunks/{src-CAZT8apO.js → src-DIsGc3Ft.js} +2 -2
- package/dist/chunks/{src-CAZT8apO.js.map → src-DIsGc3Ft.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-DQr3bq_u.js.map +0 -1
- package/dist/chunks/runComplete-C__MHMiO.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { ErrorCode, InMemoryManagedIdentity, JsonRpcChannel, RpcError, SigningSender, TransportPair, base64UrlToBytes, capabilityFreshAt, defineInterface, isAssignable, issueCapability, parseStaticHubSchema, permissionMatchesTarget, permits, principalForPublicKey, requestType, traceMessageTransport, withRpcTimeout } from "@hediet/linkrpc";
|
|
2
2
|
import { LINKRPC_ENDPOINT_VAR, LINKRPC_TOKEN_VAR, WebSocketTransport, connectNdjson, connectToHub, createManagedPrincipal, createSelfManagedPrincipal, createSelfManagedPrincipalFromFile, formatEndpointUri, identityFilePath, isHubEndpoint, loadOrCreateIdentity, openWebSocket, parseEndpointUri, runInitializeHandshake } from "@hediet/linkrpc/node";
|
|
3
|
-
import { RootOverlay, registerHubServices, registerIdentityServices } from "@hediet/linkrpc-hub/hub/server/client";
|
|
3
|
+
import { Hub, HubConnectionAcceptor, RootOverlay, anonymousHandler, createHubServiceInterfaces, registerHubServices, registerIdentityServices } from "@hediet/linkrpc-hub/hub/server/client";
|
|
4
4
|
import { SocketServer } from "@hediet/linkrpc-hub/hub/server/node";
|
|
5
5
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
6
6
|
import * as fs$1 from "node:fs";
|
|
7
7
|
import * as os from "node:os";
|
|
8
|
+
import { hostname, userInfo } from "node:os";
|
|
8
9
|
import * as path$1 from "node:path";
|
|
9
10
|
import { resolve } from "node:path";
|
|
10
11
|
import { spawnCommand, spawnCommand as spawnCommand$1 } from "@hediet/linkrpc-hub/spawn";
|
|
@@ -430,13 +431,81 @@ function _describeValue(v) {
|
|
|
430
431
|
if (typeof v === "string") return `string (${JSON.stringify(v.length > 40 ? v.slice(0, 37) + "…" : v)})`;
|
|
431
432
|
return `${typeof v} (${JSON.stringify(v)})`;
|
|
432
433
|
}
|
|
434
|
+
//#endregion
|
|
435
|
+
//#region ../../packages-private/linkrpc-client-internal/src/localHub.ts
|
|
436
|
+
/** Default serviceId namespace the local-hub child may claim (and sees via `hubGrantedServiceId::get`). */
|
|
437
|
+
const DEFAULT_LOCAL_NAMESPACE = "local";
|
|
433
438
|
/** Re-export for backwards compatibility within the CLI. */
|
|
434
|
-
const LOCAL_NAMESPACE =
|
|
439
|
+
const LOCAL_NAMESPACE = DEFAULT_LOCAL_NAMESPACE;
|
|
435
440
|
/** Subfolder (under the linkrpc data dir) holding provisioned identity slots. */
|
|
436
441
|
const PROVISION_SUBDIR = "provisioned-identities";
|
|
437
442
|
/** Provisioned slots untouched for longer than this are swept on next run. */
|
|
438
443
|
const PROVISION_MAX_AGE_MS = 2592e6;
|
|
439
444
|
/**
|
|
445
|
+
* Start an in-process hub on a private socket, spawn `command` as a participant
|
|
446
|
+
* (handing it the socket + token via `LINKRPC_ENDPOINT` / `LINKRPC_TOKEN`), and
|
|
447
|
+
* resolve once the child has registered a service under {@link LOCAL_NAMESPACE}.
|
|
448
|
+
*
|
|
449
|
+
* The hub is single-tenant and local: no claim policy (every well-formed claim
|
|
450
|
+
* is allowed) and no provenance. Identity is either ephemeral (fresh per run)
|
|
451
|
+
* or, when `provisionSlot` is set, a persisted managed identity so the child's
|
|
452
|
+
* HPKE wrap/unwrap keys survive across runs.
|
|
453
|
+
*/
|
|
454
|
+
async function startLocalHub(opts) {
|
|
455
|
+
const resolveIdentity = _makeIdentityResolver(opts.provisionSlot);
|
|
456
|
+
const grantedNs = DEFAULT_LOCAL_NAMESPACE;
|
|
457
|
+
const hub = new Hub();
|
|
458
|
+
createHubServiceInterfaces(hub);
|
|
459
|
+
const socketPath = SocketServer.allocSocketPath();
|
|
460
|
+
const token = randomBytes(16).toString("hex");
|
|
461
|
+
const socketServer = await SocketServer.start({ endpoint: socketPath });
|
|
462
|
+
const acceptor = new HubConnectionAcceptor({
|
|
463
|
+
server: socketServer,
|
|
464
|
+
hub,
|
|
465
|
+
handlers: [anonymousHandler({
|
|
466
|
+
grantedServiceIdNamespace: grantedNs,
|
|
467
|
+
...resolveIdentity ? { resolveIdentity } : {}
|
|
468
|
+
})]
|
|
469
|
+
});
|
|
470
|
+
const child = spawnCommand(opts.command, {
|
|
471
|
+
stdio: [
|
|
472
|
+
"inherit",
|
|
473
|
+
"inherit",
|
|
474
|
+
"inherit"
|
|
475
|
+
],
|
|
476
|
+
env: {
|
|
477
|
+
...process.env,
|
|
478
|
+
...opts.env,
|
|
479
|
+
LINKRPC_ENDPOINT: socketPath,
|
|
480
|
+
LINKRPC_TOKEN: token
|
|
481
|
+
},
|
|
482
|
+
...opts.cwd !== void 0 ? { cwd: opts.cwd } : {}
|
|
483
|
+
});
|
|
484
|
+
let childExited = false;
|
|
485
|
+
child.once("exit", () => {
|
|
486
|
+
childExited = true;
|
|
487
|
+
});
|
|
488
|
+
const dispose = () => {
|
|
489
|
+
if (!child.killed) child.kill();
|
|
490
|
+
acceptor.dispose();
|
|
491
|
+
socketServer.dispose();
|
|
492
|
+
if (process.platform !== "win32") try {
|
|
493
|
+
fs$1.unlinkSync(socketPath);
|
|
494
|
+
} catch {}
|
|
495
|
+
};
|
|
496
|
+
try {
|
|
497
|
+
await _waitForClaim(hub, grantedNs, () => childExited, opts.readyTimeoutMs ?? 3e4);
|
|
498
|
+
} catch (e) {
|
|
499
|
+
dispose();
|
|
500
|
+
throw e;
|
|
501
|
+
}
|
|
502
|
+
return {
|
|
503
|
+
socketPath,
|
|
504
|
+
token,
|
|
505
|
+
dispose
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
440
509
|
* The overlay's claim front door has no routing table to write: the tunnel owns
|
|
441
510
|
* the real claim on the source hub, and the splitter relays every uplink request
|
|
442
511
|
* to the child regardless. So `hubGrantedServiceId::register` succeeds as a
|
|
@@ -598,6 +667,28 @@ function _sweepProvisionedIdentities(dir) {
|
|
|
598
667
|
} catch {}
|
|
599
668
|
}
|
|
600
669
|
}
|
|
670
|
+
/** Resolve once the child claims `prefix` (or a sub-prefix), else reject. */
|
|
671
|
+
function _waitForClaim(hub, prefix, childExited, timeoutMs) {
|
|
672
|
+
const deadline = Date.now() + timeoutMs;
|
|
673
|
+
return new Promise((resolve, reject) => {
|
|
674
|
+
const check = () => {
|
|
675
|
+
if (hub.claimedPrefixes().some((p) => p === prefix || p.startsWith(`${prefix}/`))) {
|
|
676
|
+
resolve();
|
|
677
|
+
return;
|
|
678
|
+
}
|
|
679
|
+
if (childExited()) {
|
|
680
|
+
reject(/* @__PURE__ */ new Error("connect: command exited before registering a service"));
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
if (Date.now() >= deadline) {
|
|
684
|
+
reject(/* @__PURE__ */ new Error(`connect: timed out waiting for command to register a service under '${prefix}'`));
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
setTimeout(check, 50);
|
|
688
|
+
};
|
|
689
|
+
check();
|
|
690
|
+
});
|
|
691
|
+
}
|
|
601
692
|
//#endregion
|
|
602
693
|
//#region ../../packages-private/linkrpc-client-internal/src/endpoint.ts
|
|
603
694
|
/**
|
|
@@ -865,10 +956,18 @@ function _commandFields(command) {
|
|
|
865
956
|
}
|
|
866
957
|
//#endregion
|
|
867
958
|
//#region ../../packages-private/linkrpc-client-internal/src/connect.ts
|
|
868
|
-
async function connect(endpoint, log) {
|
|
959
|
+
async function connect(endpoint, log, options = {}) {
|
|
869
960
|
switch (endpoint.kind) {
|
|
870
961
|
case "cmd-stdio": return _connectCmdStdio(endpoint.command, endpoint.env, endpoint.cwd, log);
|
|
871
|
-
case "cmd-env":
|
|
962
|
+
case "cmd-env":
|
|
963
|
+
if (options.cmdEnvLocalHub) return connectViaLocalHub({
|
|
964
|
+
command: endpoint.command,
|
|
965
|
+
provisionSlot: endpoint.provisionSlot,
|
|
966
|
+
...endpoint.env !== void 0 ? { env: endpoint.env } : {},
|
|
967
|
+
...endpoint.cwd !== void 0 ? { cwd: endpoint.cwd } : {},
|
|
968
|
+
...log !== void 0 ? { log } : {}
|
|
969
|
+
});
|
|
970
|
+
return _connectCmdEnv(endpoint.command, endpoint.provisionSlot, endpoint.env, endpoint.cwd, log);
|
|
872
971
|
case "ws": return _connectWs(endpoint, log);
|
|
873
972
|
case "ws-no-init": return _connectWs(endpoint, log);
|
|
874
973
|
case "socket": return _connectSocket(endpoint.path, endpoint.token, log);
|
|
@@ -923,6 +1022,32 @@ async function _connectCmdEnv(command, provisionSlot, env, cwd, log) {
|
|
|
923
1022
|
});
|
|
924
1023
|
}
|
|
925
1024
|
/**
|
|
1025
|
+
* Spawn a child under an in-process local hub (`startLocalHub`) and connect
|
|
1026
|
+
* to that hub over a socket. Unlike the standard `cmd-env` endpoint path, this
|
|
1027
|
+
* explicitly waits for a namespace claim. The hub and child close together.
|
|
1028
|
+
*/
|
|
1029
|
+
async function connectViaLocalHub(opts) {
|
|
1030
|
+
const hub = await startLocalHub({
|
|
1031
|
+
command: opts.command,
|
|
1032
|
+
provisionSlot: opts.provisionSlot,
|
|
1033
|
+
env: opts.env,
|
|
1034
|
+
...opts.cwd !== void 0 ? { cwd: opts.cwd } : {}
|
|
1035
|
+
});
|
|
1036
|
+
try {
|
|
1037
|
+
const conn = await _connectSocket(hub.socketPath, hub.token, opts.log);
|
|
1038
|
+
return {
|
|
1039
|
+
...conn,
|
|
1040
|
+
close: () => {
|
|
1041
|
+
conn.close();
|
|
1042
|
+
hub.dispose();
|
|
1043
|
+
}
|
|
1044
|
+
};
|
|
1045
|
+
} catch (e) {
|
|
1046
|
+
hub.dispose();
|
|
1047
|
+
throw e;
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
926
1051
|
* Connect to a spawned `cmd-env` child through a {@link startLocalOverlay}
|
|
927
1052
|
* RootOverlay instead of a full local hub. Root-form calls (`identity::*`,
|
|
928
1053
|
* `hubGrantedServiceId::*`, `hubrpc.directory`, `hubAccess`) are served locally;
|
|
@@ -2695,8 +2820,12 @@ const HUB_ONLY_COMMANDS = [
|
|
|
2695
2820
|
description: "Aggregate discoverable Hub MCP tools on stdio.",
|
|
2696
2821
|
positionals: [],
|
|
2697
2822
|
options: [{
|
|
2698
|
-
name: "--scripts",
|
|
2823
|
+
name: "--no-scripts",
|
|
2699
2824
|
takesValue: false
|
|
2825
|
+
}, {
|
|
2826
|
+
name: "--mcp-identity",
|
|
2827
|
+
takesValue: true,
|
|
2828
|
+
valueType: "free"
|
|
2700
2829
|
}]
|
|
2701
2830
|
},
|
|
2702
2831
|
{
|
|
@@ -2720,16 +2849,30 @@ const HUB_ONLY_COMMANDS = [
|
|
|
2720
2849
|
takesValue: true,
|
|
2721
2850
|
valueType: "free"
|
|
2722
2851
|
},
|
|
2852
|
+
{
|
|
2853
|
+
name: "--header-env",
|
|
2854
|
+
takesValue: true,
|
|
2855
|
+
valueType: "free"
|
|
2856
|
+
},
|
|
2857
|
+
{
|
|
2858
|
+
name: "--mcp-config",
|
|
2859
|
+
takesValue: true,
|
|
2860
|
+
valueType: "free"
|
|
2861
|
+
},
|
|
2723
2862
|
{
|
|
2724
2863
|
name: "--env",
|
|
2725
2864
|
takesValue: true,
|
|
2726
2865
|
valueType: "free"
|
|
2866
|
+
},
|
|
2867
|
+
{
|
|
2868
|
+
name: "--stdio",
|
|
2869
|
+
takesValue: false
|
|
2727
2870
|
}
|
|
2728
2871
|
]
|
|
2729
2872
|
},
|
|
2730
2873
|
{
|
|
2731
2874
|
name: "mcp-publish",
|
|
2732
|
-
description: "Publish an MCP server through the hub,
|
|
2875
|
+
description: "Publish an MCP server through the hub, as a service and/or forwarded.",
|
|
2733
2876
|
positionals: [],
|
|
2734
2877
|
variadic: "free",
|
|
2735
2878
|
options: [
|
|
@@ -2739,7 +2882,7 @@ const HUB_ONLY_COMMANDS = [
|
|
|
2739
2882
|
valueType: "serviceId"
|
|
2740
2883
|
},
|
|
2741
2884
|
{
|
|
2742
|
-
name: "--
|
|
2885
|
+
name: "--service",
|
|
2743
2886
|
takesValue: false
|
|
2744
2887
|
},
|
|
2745
2888
|
{
|
|
@@ -2751,6 +2894,11 @@ const HUB_ONLY_COMMANDS = [
|
|
|
2751
2894
|
takesValue: true,
|
|
2752
2895
|
valueType: "free"
|
|
2753
2896
|
},
|
|
2897
|
+
{
|
|
2898
|
+
name: "--group",
|
|
2899
|
+
takesValue: true,
|
|
2900
|
+
valueType: "free"
|
|
2901
|
+
},
|
|
2754
2902
|
{
|
|
2755
2903
|
name: "--url",
|
|
2756
2904
|
takesValue: true,
|
|
@@ -2761,10 +2909,24 @@ const HUB_ONLY_COMMANDS = [
|
|
|
2761
2909
|
takesValue: true,
|
|
2762
2910
|
valueType: "free"
|
|
2763
2911
|
},
|
|
2912
|
+
{
|
|
2913
|
+
name: "--header-env",
|
|
2914
|
+
takesValue: true,
|
|
2915
|
+
valueType: "free"
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
name: "--mcp-config",
|
|
2919
|
+
takesValue: true,
|
|
2920
|
+
valueType: "free"
|
|
2921
|
+
},
|
|
2764
2922
|
{
|
|
2765
2923
|
name: "--env",
|
|
2766
2924
|
takesValue: true,
|
|
2767
2925
|
valueType: "free"
|
|
2926
|
+
},
|
|
2927
|
+
{
|
|
2928
|
+
name: "--stdio",
|
|
2929
|
+
takesValue: false
|
|
2768
2930
|
}
|
|
2769
2931
|
]
|
|
2770
2932
|
},
|
|
@@ -3600,19 +3762,65 @@ function isRecord$1(value) {
|
|
|
3600
3762
|
return value !== void 0 && value !== null && typeof value === "object" && !Array.isArray(value);
|
|
3601
3763
|
}
|
|
3602
3764
|
//#endregion
|
|
3603
|
-
//#region src/commands/
|
|
3604
|
-
|
|
3605
|
-
* The wire method for the provenance claim front door. Mirrors
|
|
3606
|
-
* `Hub.registerServiceIdNamespace`, which calls
|
|
3607
|
-
* `connection.get(hubGrantedServiceIdInterface).register({ serviceId })`
|
|
3608
|
-
* with no serviceId prefix — i.e. interface-form
|
|
3609
|
-
* `hubGrantedServiceId::register`. The claimed serviceId must be
|
|
3610
|
-
* within the connection's granted namespace.
|
|
3611
|
-
*/
|
|
3765
|
+
//#region src/commands/serviceIdClaim.ts
|
|
3766
|
+
const GET_METHOD = `${hubGrantedServiceIdInterface.info.id}::get`;
|
|
3612
3767
|
const CLAIM_METHOD = `${hubGrantedServiceIdInterface.info.id}::register`;
|
|
3613
|
-
const GET_CLAIM_NAMESPACE_METHOD = `${hubGrantedServiceIdInterface.info.id}::get`;
|
|
3614
3768
|
const GET_HUB_SERVICE_ID_METHOD = `${hubGrantedServiceIdInterface.info.id}::getHubServiceId`;
|
|
3615
3769
|
/**
|
|
3770
|
+
* Resolve a service id to claim. `./<path>` is relative: it is placed under
|
|
3771
|
+
* the connection's granted namespace, or, without one, under a namespace made
|
|
3772
|
+
* up from the local user and host (claimed through the hub's consent flow).
|
|
3773
|
+
* `undefined` means the granted namespace itself.
|
|
3774
|
+
*/
|
|
3775
|
+
async function resolveServiceIdToClaim(local, requested) {
|
|
3776
|
+
const granted = await grantedNamespace(local);
|
|
3777
|
+
if (requested === void 0) {
|
|
3778
|
+
if (granted.length === 0) throw new Error("this connection has no granted serviceId namespace to claim; pass --serviceId (e.g. `./my-server` for a service under a namespace of your own).");
|
|
3779
|
+
return { serviceId: granted };
|
|
3780
|
+
}
|
|
3781
|
+
if (!requested.startsWith("./")) return { serviceId: requested };
|
|
3782
|
+
const relative = requested.slice(2);
|
|
3783
|
+
if (relative.length === 0 || relative.split("/").some((segment) => segment.length === 0)) throw new Error(`invalid relative serviceId: ${requested}`);
|
|
3784
|
+
return {
|
|
3785
|
+
serviceId: `${granted.length > 0 ? granted : localNamespace()}/${relative}`,
|
|
3786
|
+
relative
|
|
3787
|
+
};
|
|
3788
|
+
}
|
|
3789
|
+
/**
|
|
3790
|
+
* Claim `serviceId`: for free within the connection's granted namespace,
|
|
3791
|
+
* otherwise through the admin-gated `hubServiceIdRegistry::registerServiceId`
|
|
3792
|
+
* (which the CLI's capability negotiation turns into a consent request).
|
|
3793
|
+
*/
|
|
3794
|
+
async function claimServiceId(local, serviceId) {
|
|
3795
|
+
if (isServiceIdUnder(serviceId, await grantedNamespace(local))) {
|
|
3796
|
+
await local.channel.sendRequest(CLAIM_METHOD, { serviceId });
|
|
3797
|
+
return;
|
|
3798
|
+
}
|
|
3799
|
+
const result = await local.channel.sendRequest(GET_HUB_SERVICE_ID_METHOD, {});
|
|
3800
|
+
const hubServiceId = typeof result?.hubServiceId === "string" ? result.hubServiceId : void 0;
|
|
3801
|
+
if (!hubServiceId) throw new Error(`cannot claim '${serviceId}': the hub reports no service id`);
|
|
3802
|
+
await local.channel.sendRequest(`${hubServiceId}::${hubServiceIdRegistryInterface.info.id}::registerServiceId`, { requestedPrefix: serviceId });
|
|
3803
|
+
}
|
|
3804
|
+
/** `<user>@<host>`, restricted to characters valid in a service id segment. */
|
|
3805
|
+
function localNamespace() {
|
|
3806
|
+
const sanitize = (value) => value.replace(/[^A-Za-z0-9_-]+/g, "-").replace(/^-+|-+$/g, "") || "unknown";
|
|
3807
|
+
let user = "user";
|
|
3808
|
+
try {
|
|
3809
|
+
user = userInfo().username;
|
|
3810
|
+
} catch {}
|
|
3811
|
+
return `${sanitize(user)}@${sanitize(hostname())}`;
|
|
3812
|
+
}
|
|
3813
|
+
async function grantedNamespace(local) {
|
|
3814
|
+
const info = await local.channel.sendRequest(GET_METHOD, {});
|
|
3815
|
+
return typeof info?.grantedServiceIdNamespace === "string" ? info.grantedServiceIdNamespace : "";
|
|
3816
|
+
}
|
|
3817
|
+
function isServiceIdUnder(serviceId, namespace) {
|
|
3818
|
+
if (namespace === "") return false;
|
|
3819
|
+
return serviceId === namespace || serviceId.startsWith(`${namespace}/`);
|
|
3820
|
+
}
|
|
3821
|
+
//#endregion
|
|
3822
|
+
//#region src/commands/tunnel.ts
|
|
3823
|
+
/**
|
|
3616
3824
|
* Stand in for a participant on the hub until stopped.
|
|
3617
3825
|
*
|
|
3618
3826
|
* Requests the hub routes to this connection (e.g. for
|
|
@@ -3628,7 +3836,7 @@ async function proxyCommand(opts) {
|
|
|
3628
3836
|
opts.hub.setRequestHandler(createForwardingHandler(opts.participant));
|
|
3629
3837
|
if (opts.outbound !== "none") opts.participant.setRequestHandler(createForwardingHandler(opts.hub, opts.outbound));
|
|
3630
3838
|
if (opts.claimServiceId !== void 0) {
|
|
3631
|
-
await
|
|
3839
|
+
await claimServiceId(opts.hub, opts.claimServiceId);
|
|
3632
3840
|
log(`proxy: claimed '${opts.claimServiceId}' — forwarding its requests to the participant unchanged`);
|
|
3633
3841
|
}
|
|
3634
3842
|
log({
|
|
@@ -3666,22 +3874,6 @@ function createForwardingHandler(to, signing = "verbatim") {
|
|
|
3666
3874
|
handleNotification: (call) => _forwardNotification(to, call, ctx)
|
|
3667
3875
|
};
|
|
3668
3876
|
}
|
|
3669
|
-
async function _claimServiceId(local, serviceId) {
|
|
3670
|
-
const namespaceRes = await local.channel.sendRequest(GET_CLAIM_NAMESPACE_METHOD, {});
|
|
3671
|
-
if (_isServiceIdUnder(serviceId, typeof namespaceRes === "object" && namespaceRes !== null && "grantedServiceIdNamespace" in namespaceRes && typeof namespaceRes.grantedServiceIdNamespace === "string" ? namespaceRes.grantedServiceIdNamespace : "")) {
|
|
3672
|
-
await local.channel.sendRequest(CLAIM_METHOD, { serviceId });
|
|
3673
|
-
return;
|
|
3674
|
-
}
|
|
3675
|
-
const hubIdRes = await local.channel.sendRequest(GET_HUB_SERVICE_ID_METHOD, {});
|
|
3676
|
-
const hubServiceId = typeof hubIdRes === "object" && hubIdRes !== null && "hubServiceId" in hubIdRes && typeof hubIdRes.hubServiceId === "string" ? hubIdRes.hubServiceId : void 0;
|
|
3677
|
-
if (!hubServiceId) throw new Error("tunnel: failed to resolve hub service id for out-of-namespace claim");
|
|
3678
|
-
const registerMethod = `${hubServiceId}::${hubServiceIdRegistryInterface.info.id}::registerServiceId`;
|
|
3679
|
-
await local.channel.sendRequest(registerMethod, { requestedPrefix: serviceId });
|
|
3680
|
-
}
|
|
3681
|
-
function _isServiceIdUnder(serviceId, namespace) {
|
|
3682
|
-
if (namespace === "") return false;
|
|
3683
|
-
return serviceId === namespace || serviceId.startsWith(`${namespace}/`);
|
|
3684
|
-
}
|
|
3685
3877
|
/** Resolve on the next `SIGINT` / `SIGTERM`. */
|
|
3686
3878
|
function _untilSignalled() {
|
|
3687
3879
|
return new Promise((resolve) => {
|
|
@@ -5142,6 +5334,6 @@ function _endpointCacheKey(endpoint, staticSchema) {
|
|
|
5142
5334
|
return staticSchema === void 0 ? endpointKey : `${endpointKey}|schema:${JSON.stringify(staticSchema)}`;
|
|
5143
5335
|
}
|
|
5144
5336
|
//#endregion
|
|
5145
|
-
export {
|
|
5337
|
+
export { ChannelDirectorySource as $, CallRecordLevelSchema as A, proxyCommand as B, LogLineSchema as C, mergeParams as Ct, CallFilterSchema as D, hubDaemonManagementInterface as E, disconnectBroker as F, parseConnectionLimit as G, claimServiceId as H, getBrokerStatus as I, complete as J, parseConnectionLimitMilliseconds as K, readBrokerNotifications as L, readEndpointDiscovery as M, ContextStore as N, CallLogLevelSchema as O, formatContextReference as P, parseLine as Q, stopConnectionBroker as R, DaemonStatusSchema as S, valueToConstSchema as St, ServiceStatusSchema as T, MethodRefWithOptHash as Tt, resolveServiceIdToClaim as U, tunnelCommand as V, withStaticHubReflection as W, resolveSlot as X, resolveCliInvocation as Y, COMMAND_TREE as Z, runParams as _, resolvedEndpointToConfig as _t, resolveInvocationEndpoint as a, findMethodInSchema as at, LINKRPC_HUB_HOME_VAR as b, explainValidation as bt, resolveLocalEndpoint as c, cliIdentityTarget as ct, endpointAddress as d, formatPrincipalSource as dt, requestReflectionAccess as et, endpointDefinition as f, parsePrincipalSpec as ft, runEvent as g, resolveTargetEndpoint as gt, processSource as h, connectViaTransport as ht, resolveInvocationContext as i, fetchSchema$1 as it, CallRecordSchema as j, CallPeerSchema as k, connectToHubManagement as l, deleteCliIdentity as lt, managedEndpointsInterface as m, connectViaRootOverlay as mt, loadStaticHubSchema as n, setupSigning as nt, resolveSigning as o, walkHub as ot, endpointStatus as p, connect as pt, parseDuration as q, resolveStaticHubSchemaSource as r, fetchDefaults as rt, validationDefault as s, walkHubDetailed as st, completeForLine as t, requestTopologyAccess as tt, consoleAddress as u, readCliIdentity as ut, watchEvent as v, describeObjectParams as vt, ServiceStateSchema as w, parseParamOverride as wt, ConfigDocumentSchema as x, validateValueAgainstSchema as xt, HubHome as y, describeSchema as yt, ConnectionBroker as z };
|
|
5146
5338
|
|
|
5147
|
-
//# sourceMappingURL=runComplete-
|
|
5339
|
+
//# sourceMappingURL=runComplete-BWhPmSgi.js.map
|