@hediet/linkrpc 0.0.1

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.
Files changed (39) hide show
  1. package/README.md +383 -0
  2. package/dist/chunks/_empty-crypto-Bi0tGx5K.js +8 -0
  3. package/dist/chunks/boundedTrafficSubscription-1L592xc7.js +1126 -0
  4. package/dist/chunks/boundedTrafficSubscription-1L592xc7.js.map +1 -0
  5. package/dist/chunks/hub.interfaces-BzWfsVT2.js +526 -0
  6. package/dist/chunks/hub.interfaces-BzWfsVT2.js.map +1 -0
  7. package/dist/chunks/hubAccess-DwTZPiI8.d.ts +79 -0
  8. package/dist/chunks/hubAccess-DwTZPiI8.d.ts.map +1 -0
  9. package/dist/chunks/hubFacade-CQflVkVC.js +85 -0
  10. package/dist/chunks/hubFacade-CQflVkVC.js.map +1 -0
  11. package/dist/chunks/hubFacade-Dkgw2pTi.d.ts +101 -0
  12. package/dist/chunks/hubFacade-Dkgw2pTi.d.ts.map +1 -0
  13. package/dist/chunks/linkRpcConnection-CtlQmetO.d.ts +3623 -0
  14. package/dist/chunks/linkRpcConnection-CtlQmetO.d.ts.map +1 -0
  15. package/dist/chunks/rolldown-runtime-4LSo1kEK.js +17 -0
  16. package/dist/chunks/src-D3NUIwyo.js +7795 -0
  17. package/dist/chunks/src-D3NUIwyo.js.map +1 -0
  18. package/dist/hub/client/index.d.ts +50 -0
  19. package/dist/hub/client/index.d.ts.map +1 -0
  20. package/dist/hub/client/index.js +97 -0
  21. package/dist/hub/client/index.js.map +1 -0
  22. package/dist/hub/common/index.d.ts +1189 -0
  23. package/dist/hub/common/index.d.ts.map +1 -0
  24. package/dist/hub/common/index.js +267 -0
  25. package/dist/hub/common/index.js.map +1 -0
  26. package/dist/index.d.ts +6 -0
  27. package/dist/index.js +7 -0
  28. package/dist/inspection/index.d.ts +66 -0
  29. package/dist/inspection/index.d.ts.map +1 -0
  30. package/dist/inspection/index.js +6 -0
  31. package/dist/node.d.ts +548 -0
  32. package/dist/node.d.ts.map +1 -0
  33. package/dist/node.js +1087 -0
  34. package/dist/node.js.map +1 -0
  35. package/dist/web.d.ts +44 -0
  36. package/dist/web.d.ts.map +1 -0
  37. package/dist/web.js +58 -0
  38. package/dist/web.js.map +1 -0
  39. package/package.json +59 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/hub/common/serviceId.ts","../../../src/hub/common/transportServer.ts","../../../src/hub/common/hub.interfaces.ts","../../../src/hub/common/baseCapabilities.ts","../../../src/hub/common/managedSigning.ts","../../../src/hub/common/directoryWalk.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;KAmBY;;cAGC,iBAAiB;;cAGjB;;;;;;iBAOG,iBAAiB;;;;;;;;iBAcjB,eAAe,IAAI;;;;;;iBASnB,iBAAiB,WAAW,WAAW,QAAQ;;;;;;;;;;UC7C9C,kBAAkB;;WAEtB,eAAe;;;;;;EAMxB,WAAW;;;;;;;;UASE,iBAAiB,UAAU;;;;;EAKxC,qBAAqB,UAAU,WAAW;EAC1C;;;;;;;;;;iBAWY,aAAa,WAAW,WAAW,WAAW,WAC1D,QAAQ,iBAAiB,KACzB,MAAM,WAAW,OAAO,iBAAiB,QAAQ,kBAClD,iBAAiB;;;;;;;;;;;;;cCoIP;;;;;;;;;;;;;;;;;;;;;;;;cAmCA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAsEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BA;UAUA;UAsBA;UASA;UAUA;UAeA;UAaA;UAMA;UAOA;UAOA;UAIA;UAWA;UAOA"}
@@ -0,0 +1,267 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { $ as walkHubDetailed, G as fetchDirectory, J as intersectServiceIdScopes, K as fetchSchema, Q as walkHub, U as DEFAULT_WALK_DEPTH, W as HubDirectoryExplorer, X as serviceIdMatchesPattern, Y as normalizeServiceIdScopes, Z as serviceIdMatchesScopes, g as createManagedPrincipal, ht as permissionMatchesTarget, m as SigningSender, mt as matchParams, q as findMethodInSchema, s as capabilityFreshAt, ut as methodNameToTarget } from "../../chunks/src-D3NUIwyo.js";
6
+ import { i as hubServiceIdRegistryInterface, n as hubAccessManifestInterface, r as hubGrantedServiceIdInterface, t as hubAccessInterface } from "../../chunks/hub.interfaces-BzWfsVT2.js";
7
+ //#region src/hub/common/serviceId.ts
8
+ /** The root service id — the hub's own local services. */
9
+ const ROOT_SERVICE_ID = "";
10
+ /** The separator between service id segments. */
11
+ const SERVICE_ID_SEPARATOR = "/";
12
+ /**
13
+ * Whether `id` is a well-formed {@link ServiceId}. The root (`""`) is
14
+ * valid; any other value must be non-empty segments joined by single
15
+ * `'/'`s, with no leading, trailing, or empty segments.
16
+ */
17
+ function isValidServiceId(id) {
18
+ if (id === "") return true;
19
+ if (id.startsWith("/") || id.endsWith("/")) return false;
20
+ if (id.includes("//")) return false;
21
+ return true;
22
+ }
23
+ /**
24
+ * Split a {@link ServiceId} into its segments. The root (`""`) yields the
25
+ * empty array; `"foo/bar"` yields `["foo", "bar"]`.
26
+ *
27
+ * Does not validate — pair with {@link isValidServiceId} when the input is
28
+ * untrusted.
29
+ */
30
+ function splitServiceId(id) {
31
+ return id === "" ? [] : id.split("/");
32
+ }
33
+ /**
34
+ * Whether `serviceId` is equal to or nested beneath `prefix` (segment-aware):
35
+ * `"a/b"` covers `"a/b"` and `"a/b/c"` but **not** `"a/bc"`. The root prefix
36
+ * (`""`) covers everything.
37
+ */
38
+ function isServiceIdUnder(serviceId, prefix) {
39
+ if (prefix === "") return true;
40
+ if (serviceId === prefix) return true;
41
+ return serviceId.startsWith(prefix + "/");
42
+ }
43
+ //#endregion
44
+ //#region src/hub/common/transportServer.ts
45
+ /**
46
+ * Lift a transport server from emitting `T1` to emitting `T2`. The `map` may
47
+ * be async (e.g. to attest a peer before exposing it) and may return
48
+ * `undefined` to **drop** a connection — the downstream handler is simply not
49
+ * invoked for it. The transport's identity is preserved when the map returns
50
+ * the same object (important: the hub keys routing state on the transport
51
+ * reference), so prefer annotating in place over wrapping.
52
+ */
53
+ function mapTransport(source, map) {
54
+ return new MappedTransportServer(source, map);
55
+ }
56
+ var MappedTransportServer = class {
57
+ _source;
58
+ _map;
59
+ _handler;
60
+ _wired = false;
61
+ constructor(_source, _map) {
62
+ this._source = _source;
63
+ this._map = _map;
64
+ }
65
+ setConnectionHandler(handler) {
66
+ this._handler = handler;
67
+ if (this._wired) return;
68
+ this._wired = true;
69
+ this._source.setConnectionHandler((t1) => {
70
+ this._onIncoming(t1);
71
+ });
72
+ }
73
+ async _onIncoming(t1) {
74
+ const t2 = await this._map(t1);
75
+ if (t2 !== void 0 && this._handler) this._handler(t2);
76
+ }
77
+ dispose() {
78
+ this._source.dispose();
79
+ }
80
+ };
81
+ //#endregion
82
+ //#region src/hub/common/hubAccess.ts
83
+ /**
84
+ * Return fresh durable capabilities that collectively cover an explicit access
85
+ * request, or `undefined` when the caller must ask the hub for more authority.
86
+ *
87
+ * This is the broad-request counterpart to checking whether a cap bag covers
88
+ * one concrete call. Clients use it before opening consent so persisted grants
89
+ * are reused without weakening any service/interface/member pattern.
90
+ */
91
+ function findCoveringCapabilities(capabilities, requested, options = {}) {
92
+ if (requested.length === 0) return void 0;
93
+ const nowMs = options.nowMs ?? Date.now();
94
+ const freshnessMarginMs = options.freshnessMarginMs ?? 0;
95
+ const reusable = capabilities.filter((capability) => capabilityFreshAt(capability, nowMs, freshnessMarginMs) && capability.permissions.every((permission) => permission.callBind === void 0));
96
+ const matching = /* @__PURE__ */ new Set();
97
+ for (const request of requested) {
98
+ const capability = reusable.find((candidate) => candidate.permissions.some((granted) => permissionCovers(granted, request)));
99
+ if (!capability) return void 0;
100
+ matching.add(capability);
101
+ }
102
+ return [...matching];
103
+ }
104
+ function permissionCovers(granted, requested) {
105
+ if (requested.canInvoke && !granted.canInvoke) return false;
106
+ if (requested.canDelegate && !granted.canDelegate) return false;
107
+ if (!patternCovers(granted.target.serviceId, requested.target.serviceId, "/")) return false;
108
+ if (!patternCovers(granted.target.interfaceId, requested.target.interfaceId, ".")) return false;
109
+ if (granted.target.interfaceHash !== void 0 && granted.target.interfaceHash !== requested.target.interfaceHash) return false;
110
+ if (!requested.target.members.every((requestedMember) => granted.target.members.some((grantedMember) => patternCovers(grantedMember, requestedMember, "")))) return false;
111
+ if (requested.params === void 0) return granted.params === void 0;
112
+ if (granted.params === void 0) return true;
113
+ return paramsEqual(granted.params, requested.params);
114
+ }
115
+ function patternCovers(granted, requested, delimiter) {
116
+ if ("exact" in granted) return "exact" in requested && granted.exact === requested.exact;
117
+ if (granted.prefix === "") return true;
118
+ if ("exact" in requested) return requested.exact === granted.prefix || requested.exact.startsWith(granted.prefix + delimiter);
119
+ if (requested.prefix === granted.prefix) return true;
120
+ return delimiter === "" ? requested.prefix.startsWith(granted.prefix) : requested.prefix.startsWith(granted.prefix + delimiter);
121
+ }
122
+ function paramsEqual(granted, requested) {
123
+ return JSON.stringify(granted) === JSON.stringify(requested);
124
+ }
125
+ //#endregion
126
+ //#region src/hub/common/baseCapabilities.ts
127
+ /**
128
+ * Claim a serviceId prefix within this connection's provenance-granted
129
+ * namespace via `hubGrantedServiceId::register` (no capability needed).
130
+ * Resolves once the claim is registered. Rejects when the prefix is outside
131
+ * the granted namespace or already owned.
132
+ */
133
+ async function registerGrantedServiceId(sender, serviceId) {
134
+ await sender.sendRequest(`${hubGrantedServiceIdInterface.info.id}::register`, { serviceId });
135
+ }
136
+ //#endregion
137
+ //#region src/hub/common/managedSigning.ts
138
+ /** How long before expiry a cap is considered stale (transit + clock skew). */
139
+ const CAP_FRESHNESS_MARGIN_MS = 2e3;
140
+ /**
141
+ * Build a managed-identity signing {@link Channel} from a raw channel, with
142
+ * optional per-call capability auto-negotiation.
143
+ *
144
+ * Like {@link SigningSender.fromChannelWithManagedPrincipal}, the
145
+ * `identity::*` bootstrap rides the raw (unsigned) sender, and the returned
146
+ * signing channel is what callers hand to `LinkRpcConnection`. When
147
+ * {@link ManagedSigningOptions.autoNegotiateCaps} is set, the returned
148
+ * channel additionally negotiates capabilities on demand — the browser-safe
149
+ * equivalent of the CLI's `setupSigning({ autoNegotiatePerCall: true })`.
150
+ */
151
+ async function createManagedSigningChannel(channel, opts) {
152
+ const principal = await createManagedPrincipal(channel.sender);
153
+ const config = { principal };
154
+ const signing = SigningSender.wrapChannel(channel, config);
155
+ if (opts?.autoNegotiateCaps) config.capProvider = createAutoNegotiatingCapProvider({
156
+ sender: signing.sender,
157
+ principal,
158
+ consumer: opts.consumer ?? { name: "linkrpc client" }
159
+ });
160
+ return {
161
+ channel: signing,
162
+ principal
163
+ };
164
+ }
165
+ /**
166
+ * A sign-time {@link CapProvider} that negotiates access per gated call.
167
+ *
168
+ * For each outbound call it: presents any fresh caps already in the bag; if
169
+ * none cover the call, bootstraps the root `hubAccess` capability (once), then
170
+ * asks `hubAccess::requestAccess` for a grant scoped to exactly this call
171
+ * (`callIntent` pinned to the method/params/nonce). Durable grants are added to
172
+ * the bag; a one-shot grant is attached to just this call.
173
+ *
174
+ * Fail-soft: any negotiation error (open hub, denied consent, unreachable front
175
+ * door) falls back to presenting the current bag, letting the call surface
176
+ * `permissionRequired` if it is truly gated.
177
+ */
178
+ function createAutoNegotiatingCapProvider(opts) {
179
+ const { sender, principal, consumer } = opts;
180
+ let inAccessNegotiation = false;
181
+ const hubAccessMethod = `${hubAccessInterface.info.id}::requestAccess`;
182
+ return async ({ method, params, nonce, signedAtMs, interfaceHash }) => {
183
+ const fresh = principal.capBag.capabilities.filter((c) => capabilityFreshAt(c, signedAtMs, CAP_FRESHNESS_MARGIN_MS));
184
+ const present = fresh.length > 0 ? { capabilities: fresh } : {};
185
+ if (inAccessNegotiation) return present;
186
+ let call;
187
+ try {
188
+ call = {
189
+ ...methodNameToTarget(method),
190
+ ...interfaceHash !== void 0 ? { interfaceHash } : {}
191
+ };
192
+ } catch {
193
+ return present;
194
+ }
195
+ if (call.serviceId === "" || call.interfaceId === hubAccessInterface.info.id) return present;
196
+ if (capBagCovers(fresh, call, params)) return present;
197
+ inAccessNegotiation = true;
198
+ try {
199
+ const granted = await requestAccessForCall(sender, hubAccessMethod, {
200
+ ...consumer,
201
+ principal: principal.id
202
+ }, {
203
+ call,
204
+ method,
205
+ params,
206
+ nonce,
207
+ signedAtMs,
208
+ interfaceHash
209
+ });
210
+ if (granted.length === 0) return present;
211
+ const oneShot = granted.filter(isOneShotCap);
212
+ const persistent = granted.filter((c) => !isOneShotCap(c));
213
+ if (persistent.length > 0) await principal.capBag.add(...persistent);
214
+ const durable = principal.capBag.capabilities.filter((c) => capabilityFreshAt(c, signedAtMs, CAP_FRESHNESS_MARGIN_MS));
215
+ if (oneShot.length > 0) return { capabilities: [...durable, ...oneShot] };
216
+ return durable.length > 0 ? { capabilities: durable } : {};
217
+ } catch {
218
+ return present;
219
+ } finally {
220
+ inAccessNegotiation = false;
221
+ }
222
+ };
223
+ }
224
+ /** A cap is one-shot when any permission pins it to a single call via `callBind`. */
225
+ function isOneShotCap(sc) {
226
+ return sc.permissions.some((p) => p.callBind !== void 0);
227
+ }
228
+ /** True when a durable (non-one-shot) cap in the bag authorises this call. */
229
+ function capBagCovers(caps, target, params) {
230
+ return caps.some((sc) => !isOneShotCap(sc) && sc.permissions.some((p) => permissionMatchesTarget(target, p) && (p.params === void 0 || matchParams(p.params, params).ok)));
231
+ }
232
+ async function requestAccessForCall(sender, hubAccessMethod, consumer, req) {
233
+ const result = await sender.sendRequest(hubAccessMethod, {
234
+ consumer: {
235
+ ...consumer,
236
+ purpose: consumer.purpose ?? `Invoke ${req.method}.`
237
+ },
238
+ permissions: [{
239
+ target: {
240
+ serviceId: { exact: req.call.serviceId },
241
+ interfaceId: { exact: req.call.interfaceId },
242
+ members: [{ exact: req.call.member }]
243
+ },
244
+ canInvoke: true,
245
+ params: exactParamMatchers(req.params),
246
+ callIntent: {
247
+ method: req.method,
248
+ params: req.params,
249
+ nonce: req.nonce,
250
+ signedAtMs: req.signedAtMs,
251
+ ...req.interfaceHash !== void 0 ? { interfaceHash: req.interfaceHash } : {},
252
+ suggestion: "once"
253
+ }
254
+ }],
255
+ duration: "once"
256
+ });
257
+ if (result.status !== "granted") return [];
258
+ return result.capabilities ?? [];
259
+ }
260
+ function exactParamMatchers(params) {
261
+ if (params === null || typeof params !== "object" || Array.isArray(params)) return {};
262
+ return Object.fromEntries(Object.entries(params).map(([key, value]) => [key, { exact: value }]));
263
+ }
264
+ //#endregion
265
+ export { DEFAULT_WALK_DEPTH, HubDirectoryExplorer, ROOT_SERVICE_ID, SERVICE_ID_SEPARATOR, createAutoNegotiatingCapProvider, createManagedSigningChannel, fetchDirectory, fetchSchema, findCoveringCapabilities, findMethodInSchema, hubAccessInterface, hubAccessManifestInterface, hubGrantedServiceIdInterface, hubServiceIdRegistryInterface, intersectServiceIdScopes, isServiceIdUnder, isValidServiceId, mapTransport, normalizeServiceIdScopes, registerGrantedServiceId, serviceIdMatchesPattern, serviceIdMatchesScopes, splitServiceId, walkHub, walkHubDetailed };
266
+
267
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../../src/hub/common/serviceId.ts","../../../src/hub/common/transportServer.ts","../../../src/hub/common/hubAccess.ts","../../../src/hub/common/baseCapabilities.ts","../../../src/hub/common/managedSigning.ts"],"sourcesContent":["/**\n * A **ServiceId** is a `'/'`-segmented address naming a routing destination\n * on a {@link Hub}. The empty string is the **root** (the hub's own / local\n * services); every other id is one or more non-empty segments joined by\n * `'/'`.\n *\n * Examples:\n * - `\"\"` → root (valid)\n * - `\"foo\"` → valid\n * - `\"foo/bar\"` → valid\n * - `\"/\"` → invalid (empty segments)\n * - `\"/foo\"` → invalid (leading separator)\n * - `\"foo/\"` → invalid (trailing separator)\n * - `\"foo//bar\"` → invalid (empty interior segment)\n *\n * It is a plain `string` alias — the name exists only to mark the role at\n * call sites. Use {@link isValidServiceId} / {@link splitServiceId} to work\n * with it structurally.\n */\nexport type ServiceId = string;\n\n/** The root service id — the hub's own local services. */\nexport const ROOT_SERVICE_ID: ServiceId = '';\n\n/** The separator between service id segments. */\nexport const SERVICE_ID_SEPARATOR = '/';\n\n/**\n * Whether `id` is a well-formed {@link ServiceId}. The root (`\"\"`) is\n * valid; any other value must be non-empty segments joined by single\n * `'/'`s, with no leading, trailing, or empty segments.\n */\nexport function isValidServiceId(id: string): boolean {\n if (id === ROOT_SERVICE_ID) return true;\n if (id.startsWith(SERVICE_ID_SEPARATOR) || id.endsWith(SERVICE_ID_SEPARATOR)) return false;\n if (id.includes(SERVICE_ID_SEPARATOR + SERVICE_ID_SEPARATOR)) return false;\n return true;\n}\n\n/**\n * Split a {@link ServiceId} into its segments. The root (`\"\"`) yields the\n * empty array; `\"foo/bar\"` yields `[\"foo\", \"bar\"]`.\n *\n * Does not validate — pair with {@link isValidServiceId} when the input is\n * untrusted.\n */\nexport function splitServiceId(id: ServiceId): string[] {\n return id === ROOT_SERVICE_ID ? [] : id.split(SERVICE_ID_SEPARATOR);\n}\n\n/**\n * Whether `serviceId` is equal to or nested beneath `prefix` (segment-aware):\n * `\"a/b\"` covers `\"a/b\"` and `\"a/b/c\"` but **not** `\"a/bc\"`. The root prefix\n * (`\"\"`) covers everything.\n */\nexport function isServiceIdUnder(serviceId: ServiceId, prefix: ServiceId): boolean {\n if (prefix === ROOT_SERVICE_ID) return true;\n if (serviceId === prefix) return true;\n return serviceId.startsWith(prefix + SERVICE_ID_SEPARATOR);\n}\n","import type { IMessageTransport } from '../../index';\nimport type { TopologyTransportInfo } from '../../inspection/inspection.interfaces';\n\n/**\n * A link the hub can route, plus a close signal. {@link IMessageTransport}\n * on its own has no \"closed\" event (it only learns of teardown through its\n * own `dispose`), but a *server*-produced connection must be able to tell\n * downstream consumers when the remote end goes away so overlays can be torn\n * down and prefixes released. {@link Transport} adds exactly that.\n */\nexport interface Transport extends IMessageTransport {\n /** Optional diagnostics surfaced on the corresponding topology link. Never include credentials or payloads. */\n readonly topologyInfo?: TopologyTransportInfo;\n /**\n * Register a handler fired exactly once when the transport closes (remote\n * hang-up or local {@link IMessageTransport.dispose}). Handlers added\n * after close fire on the next microtask.\n */\n onDidClose(handler: () => void): void;\n}\n\n/**\n * A source of inbound {@link Transport}s — the single seam every transport\n * backend (UDS socket, websocket, iframe postMessage, in-process pair)\n * implements. The hub side consumes only this; it never names `net.Socket`\n * or any backend-specific type.\n */\nexport interface ITransportServer<T extends Transport> {\n /**\n * Install the handler invoked once per accepted transport. Replacing the\n * handler is allowed; only the most recent one receives new connections.\n */\n setConnectionHandler(handler: (transport: T) => void): void;\n dispose(): void;\n}\n\n/**\n * Lift a transport server from emitting `T1` to emitting `T2`. The `map` may\n * be async (e.g. to attest a peer before exposing it) and may return\n * `undefined` to **drop** a connection — the downstream handler is simply not\n * invoked for it. The transport's identity is preserved when the map returns\n * the same object (important: the hub keys routing state on the transport\n * reference), so prefer annotating in place over wrapping.\n */\nexport function mapTransport<T1 extends Transport, T2 extends Transport>(\n source: ITransportServer<T1>,\n map: (transport: T1) => T2 | undefined | Promise<T2 | undefined>,\n): ITransportServer<T2> {\n return new MappedTransportServer(source, map);\n}\n\nclass MappedTransportServer<T1 extends Transport, T2 extends Transport>\n implements ITransportServer<T2>\n{\n private _handler: ((transport: T2) => void) | undefined;\n private _wired = false;\n\n constructor(\n private readonly _source: ITransportServer<T1>,\n private readonly _map: (t: T1) => T2 | undefined | Promise<T2 | undefined>,\n ) {}\n\n public setConnectionHandler(handler: (transport: T2) => void): void {\n this._handler = handler;\n if (this._wired) {\n return;\n }\n this._wired = true;\n this._source.setConnectionHandler((t1) => {\n void this._onIncoming(t1);\n });\n }\n\n private async _onIncoming(t1: T1): Promise<void> {\n const t2 = await this._map(t1);\n if (t2 !== undefined && this._handler) {\n this._handler(t2);\n }\n }\n\n public dispose(): void {\n this._source.dispose();\n }\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport {\n type ParamMatcher,\n type Pattern,\n type Permission,\n type SignedCapability,\n} from '../../protocol';\nimport { capabilityFreshAt } from '../../identity/capability';\n\n/**\n * The client-facing wire shapes of the hub's capability-negotiation protocol\n * (`hubAccess::requestAccess`, see {@link hubAccessInterface}). Any hub client —\n * the CLI, the MCP server, or an embedder — speaks these shapes to ask a hub\n * for authority in a single consent prompt.\n */\n\n/** How long a granted capability should live. */\nexport type HubAccessDuration = 'once' | 'shortLived' | 'longLived' | 'persistent';\n\n/** A `serviceId` / `interfaceId` / member matcher (wire shape of `TargetPattern`). */\nexport type HubAccessPattern = { readonly exact: string; } | { readonly prefix: string; };\n\n/** One authority the consumer wants — the wire shape of a `requestAccess` permission. */\nexport interface HubAccessPermission {\n readonly target: {\n readonly serviceId: HubAccessPattern;\n readonly interfaceId: HubAccessPattern;\n readonly interfaceHash?: string;\n readonly members: readonly HubAccessPattern[];\n };\n /** Default false (fail closed). Set true to actually call the members. */\n readonly canInvoke?: boolean;\n /** Default false. Set true to let the consumer re-delegate this authority. */\n readonly canDelegate?: boolean;\n readonly params?: Record<string, unknown>;\n}\n\n/** A batched, explicit access request — possibly many permissions in one prompt. */\nexport interface HubAccessRequest {\n readonly consumer: { readonly name: string; readonly origin?: string; readonly purpose?: string; };\n /** One or more authorities to request together (single consent prompt). */\n readonly permissions: readonly HubAccessPermission[];\n /** `once` (short-lived), `session` (this connection), or `persistent` (saved). */\n readonly duration?: HubAccessDuration;\n}\n\n/**\n * Outcome of a `requestAccess` call. `granted` carries every capability the hub\n * minted plus how many of them were durable and added to the connection's cap\n * bag (a client-side augmentation over the pure wire result).\n */\nexport type HubAccessResult =\n | {\n readonly status: 'granted';\n /** Every capability the hub minted for this request. */\n readonly capabilities: readonly SignedCapability[];\n /** How many of them were durable and added to the connection's cap bag. */\n readonly addedDurable: number;\n }\n | { readonly status: 'denied'; readonly reason?: string; }\n | { readonly status: string; readonly reason?: string; };\n\n/**\n * Return fresh durable capabilities that collectively cover an explicit access\n * request, or `undefined` when the caller must ask the hub for more authority.\n *\n * This is the broad-request counterpart to checking whether a cap bag covers\n * one concrete call. Clients use it before opening consent so persisted grants\n * are reused without weakening any service/interface/member pattern.\n */\nexport function findCoveringCapabilities(\n capabilities: readonly SignedCapability[],\n requested: readonly HubAccessPermission[],\n options: {\n readonly nowMs?: number;\n readonly freshnessMarginMs?: number;\n } = {},\n): readonly SignedCapability[] | undefined {\n if (requested.length === 0) return undefined;\n const nowMs = options.nowMs ?? Date.now();\n const freshnessMarginMs = options.freshnessMarginMs ?? 0;\n const reusable = capabilities.filter((capability) =>\n capabilityFreshAt(capability, nowMs, freshnessMarginMs)\n && capability.permissions.every((permission) => permission.callBind === undefined),\n );\n const matching = new Set<SignedCapability>();\n\n for (const request of requested) {\n const capability = reusable.find((candidate) =>\n candidate.permissions.some((granted) => permissionCovers(granted, request)),\n );\n if (!capability) return undefined;\n matching.add(capability);\n }\n\n return [...matching];\n}\n\nfunction permissionCovers(\n granted: Permission,\n requested: HubAccessPermission,\n): boolean {\n if (requested.canInvoke && !granted.canInvoke) return false;\n if (requested.canDelegate && !granted.canDelegate) return false;\n if (!patternCovers(granted.target.serviceId, requested.target.serviceId, '/')) return false;\n if (!patternCovers(granted.target.interfaceId, requested.target.interfaceId, '.')) return false;\n if (\n granted.target.interfaceHash !== undefined\n && granted.target.interfaceHash !== requested.target.interfaceHash\n ) {\n return false;\n }\n if (!requested.target.members.every((requestedMember) =>\n granted.target.members.some((grantedMember) =>\n patternCovers(grantedMember, requestedMember, ''),\n ),\n )) {\n return false;\n }\n\n if (requested.params === undefined) return granted.params === undefined;\n if (granted.params === undefined) return true;\n return paramsEqual(granted.params, requested.params);\n}\n\nfunction patternCovers(granted: Pattern, requested: HubAccessPattern, delimiter: string): boolean {\n if ('exact' in granted) {\n return 'exact' in requested && granted.exact === requested.exact;\n }\n if (granted.prefix === '') return true;\n if ('exact' in requested) {\n return requested.exact === granted.prefix\n || requested.exact.startsWith(granted.prefix + delimiter);\n }\n if (requested.prefix === granted.prefix) return true;\n return delimiter === ''\n ? requested.prefix.startsWith(granted.prefix)\n : requested.prefix.startsWith(granted.prefix + delimiter);\n}\n\nfunction paramsEqual(\n granted: Record<string, ParamMatcher>,\n requested: Record<string, unknown>,\n): boolean {\n // HubAccessPermission keeps this field dependency-light as `unknown`, but\n // broad explicit requests carry the same ParamMatcher wire shapes as a\n // Permission. Exact equality is the only safe coverage claim here.\n return JSON.stringify(granted) === JSON.stringify(requested);\n}\n","import type { IRequestSender, SigningCallCtx } from '../../index';\nimport { hubGrantedServiceIdInterface } from './hub.interfaces';\n\n/**\n * Claim a serviceId prefix within this connection's provenance-granted\n * namespace via `hubGrantedServiceId::register` (no capability needed).\n * Resolves once the claim is registered. Rejects when the prefix is outside\n * the granted namespace or already owned.\n */\nexport async function registerGrantedServiceId(\n sender: IRequestSender<SigningCallCtx>,\n serviceId: string,\n): Promise<void> {\n await sender.sendRequest(\n `${hubGrantedServiceIdInterface.info.id}::register`,\n { serviceId } as never,\n );\n}\n","import type {\n CapProvider,\n CapProviderResult,\n CallTarget,\n Channel,\n IRequestSender,\n ManagedSigningChannel,\n Principal,\n SignedCapability,\n SigningCallCtx,\n SigningSenderConfig,\n} from '../../index';\nimport {\n capabilityFreshAt,\n createManagedPrincipal,\n matchParams,\n methodNameToTarget,\n permissionMatchesTarget,\n SigningSender,\n} from '../../index';\nimport { hubAccessInterface } from './hub.interfaces';\n\n/** How long before expiry a cap is considered stale (transit + clock skew). */\nconst CAP_FRESHNESS_MARGIN_MS = 2000;\n\n/** Who is asking — surfaced in the hub's consent prompt. */\nexport interface AutoNegotiateConsumer {\n readonly name: string;\n readonly origin?: string;\n readonly purpose?: string;\n}\n\n/** Options for {@link createManagedSigningChannel}. */\nexport interface ManagedSigningOptions {\n /**\n * When set, install a sign-time {@link CapProvider} that lazily negotiates\n * the capability each gated call needs through the hub's `hubAccess`\n * consent front door. Durable grants are absorbed into the principal's cap\n * bag so later calls present them automatically; one-shot grants are\n * attached to just the call that prompted them.\n *\n * Without it, the channel signs every call but presents no capabilities —\n * gated calls then fail with `permissionRequired` unless the caller has\n * arranged a capability some other way.\n */\n readonly autoNegotiateCaps?: boolean;\n /** Consumer identity shown in the consent prompt. */\n readonly consumer?: AutoNegotiateConsumer;\n}\n\n/**\n * Build a managed-identity signing {@link Channel} from a raw channel, with\n * optional per-call capability auto-negotiation.\n *\n * Like {@link SigningSender.fromChannelWithManagedPrincipal}, the\n * `identity::*` bootstrap rides the raw (unsigned) sender, and the returned\n * signing channel is what callers hand to `LinkRpcConnection`. When\n * {@link ManagedSigningOptions.autoNegotiateCaps} is set, the returned\n * channel additionally negotiates capabilities on demand — the browser-safe\n * equivalent of the CLI's `setupSigning({ autoNegotiatePerCall: true })`.\n */\nexport async function createManagedSigningChannel(\n channel: Channel<undefined>,\n opts?: ManagedSigningOptions,\n): Promise<ManagedSigningChannel<undefined>> {\n const principal = await createManagedPrincipal(channel.sender);\n\n // Mutable config: the SigningSender reads its fields fresh per call, so we\n // can install the cap provider *after* the signing sender exists (the\n // provider needs to issue its `hubAccess` calls through that same signed\n // sender).\n const config: { principal: Principal; capProvider?: CapProvider } = { principal };\n const signing = SigningSender.wrapChannel(channel, config as SigningSenderConfig);\n\n if (opts?.autoNegotiateCaps) {\n config.capProvider = createAutoNegotiatingCapProvider({\n sender: signing.sender,\n principal,\n consumer: opts.consumer ?? { name: 'linkrpc client' },\n });\n }\n\n return { channel: signing, principal };\n}\n\n/**\n * A sign-time {@link CapProvider} that negotiates access per gated call.\n *\n * For each outbound call it: presents any fresh caps already in the bag; if\n * none cover the call, bootstraps the root `hubAccess` capability (once), then\n * asks `hubAccess::requestAccess` for a grant scoped to exactly this call\n * (`callIntent` pinned to the method/params/nonce). Durable grants are added to\n * the bag; a one-shot grant is attached to just this call.\n *\n * Fail-soft: any negotiation error (open hub, denied consent, unreachable front\n * door) falls back to presenting the current bag, letting the call surface\n * `permissionRequired` if it is truly gated.\n */\nexport function createAutoNegotiatingCapProvider(opts: {\n readonly sender: IRequestSender<SigningCallCtx>;\n readonly principal: Principal;\n readonly consumer: AutoNegotiateConsumer;\n}): CapProvider {\n const { sender, principal, consumer } = opts;\n let inAccessNegotiation = false;\n\n // `hubAccess` is served at the connection root (never forwarded, never\n // gated), so it is addressed in root form with no serviceId prefix and no\n // bootstrap capability.\n const hubAccessMethod = `${hubAccessInterface.info.id}::requestAccess`;\n\n return async ({ method, params, nonce, signedAtMs, interfaceHash }) => {\n const fresh = principal.capBag.capabilities.filter((c) =>\n capabilityFreshAt(c, signedAtMs, CAP_FRESHNESS_MARGIN_MS),\n );\n const present: CapProviderResult = fresh.length > 0 ? { capabilities: fresh } : {};\n\n // Reentrancy guard: the `hubAccess` calls this provider issues are\n // themselves signed through the same sender, which re-enters here.\n // Present only what is in the bag for those.\n if (inAccessNegotiation) return present;\n\n let call: CallTarget;\n try {\n call = {\n ...methodNameToTarget(method),\n ...(interfaceHash !== undefined ? { interfaceHash } : {}),\n };\n } catch {\n return present;\n }\n // Never negotiate for the root or the hub's own consent front door.\n if (call.serviceId === '' || call.interfaceId === hubAccessInterface.info.id) {\n return present;\n }\n if (capBagCovers(fresh, call, params)) return present;\n\n inAccessNegotiation = true;\n try {\n const granted = await requestAccessForCall(sender, hubAccessMethod, {\n ...consumer,\n principal: principal.id,\n }, {\n call,\n method,\n params,\n nonce,\n signedAtMs,\n interfaceHash,\n });\n if (granted.length === 0) return present;\n\n const oneShot = granted.filter(isOneShotCap);\n const persistent = granted.filter((c) => !isOneShotCap(c));\n if (persistent.length > 0) await principal.capBag.add(...persistent);\n\n const durable = principal.capBag.capabilities.filter((c) =>\n capabilityFreshAt(c, signedAtMs, CAP_FRESHNESS_MARGIN_MS),\n );\n if (oneShot.length > 0) return { capabilities: [...durable, ...oneShot] };\n return durable.length > 0 ? { capabilities: durable } : {};\n } catch {\n return present;\n } finally {\n inAccessNegotiation = false;\n }\n };\n}\n\n/** A cap is one-shot when any permission pins it to a single call via `callBind`. */\nfunction isOneShotCap(sc: SignedCapability): boolean {\n return sc.permissions.some((p) => p.callBind !== undefined);\n}\n\n/** True when a durable (non-one-shot) cap in the bag authorises this call. */\nfunction capBagCovers(caps: readonly SignedCapability[], target: CallTarget, params: unknown): boolean {\n return caps.some((sc) =>\n !isOneShotCap(sc) &&\n sc.permissions.some((p) =>\n permissionMatchesTarget(target, p) &&\n (p.params === undefined || matchParams(p.params, params).ok),\n ),\n );\n}\n\ninterface AccessCallRequest {\n readonly call: CallTarget;\n readonly method: string;\n readonly params: unknown;\n readonly nonce: string;\n readonly signedAtMs: number;\n readonly interfaceHash?: string;\n}\n\nasync function requestAccessForCall(\n sender: IRequestSender<SigningCallCtx>,\n hubAccessMethod: string,\n consumer: AutoNegotiateConsumer & { readonly principal: string },\n req: AccessCallRequest,\n): Promise<SignedCapability[]> {\n const raw = await sender.sendRequest(hubAccessMethod, {\n consumer: { ...consumer, purpose: consumer.purpose ?? `Invoke ${req.method}.` },\n permissions: [{\n target: {\n serviceId: { exact: req.call.serviceId },\n interfaceId: { exact: req.call.interfaceId },\n members: [{ exact: req.call.member }],\n },\n canInvoke: true,\n params: exactParamMatchers(req.params),\n callIntent: {\n method: req.method,\n params: req.params,\n nonce: req.nonce,\n signedAtMs: req.signedAtMs,\n ...(req.interfaceHash !== undefined ? { interfaceHash: req.interfaceHash } : {}),\n suggestion: 'once' as const,\n },\n }],\n // The hub mints both a once and an always proposal regardless; this\n // only nudges the default. The user's choice decides one-shot vs durable.\n duration: 'once',\n } as never);\n const result = raw as unknown as { status: string; capabilities?: SignedCapability[] };\n if (result.status !== 'granted') return [];\n return result.capabilities ?? [];\n}\n\nfunction exactParamMatchers(params: unknown): Record<string, { exact: unknown }> {\n if (params === null || typeof params !== 'object' || Array.isArray(params)) return {};\n return Object.fromEntries(\n Object.entries(params as Record<string, unknown>).map(([key, value]) => [key, { exact: value }]),\n );\n}\n"],"mappings":";;;;;;;;AAsBA,MAAa,kBAA6B;;AAG1C,MAAa,uBAAuB;;;;;;AAOpC,SAAgB,iBAAiB,IAAqB;CAClD,IAAI,OAAA,IAAwB,OAAO;CACnC,IAAI,GAAG,WAAA,GAA+B,KAAK,GAAG,SAAA,GAA6B,GAAG,OAAO;CACrF,IAAI,GAAG,SAAS,IAA2C,GAAG,OAAO;CACrE,OAAO;AACX;;;;;;;;AASA,SAAgB,eAAe,IAAyB;CACpD,OAAO,OAAA,KAAyB,CAAC,IAAI,GAAG,MAAA,GAA0B;AACtE;;;;;;AAOA,SAAgB,iBAAiB,WAAsB,QAA4B;CAC/E,IAAI,WAAA,IAA4B,OAAO;CACvC,IAAI,cAAc,QAAQ,OAAO;CACjC,OAAO,UAAU,WAAW,SAAA,GAA6B;AAC7D;;;;;;;;;;;ACfA,SAAgB,aACZ,QACA,KACoB;CACpB,OAAO,IAAI,sBAAsB,QAAQ,GAAG;AAChD;AAEA,IAAM,wBAAN,MAEA;CAKyB;CACA;CALrB;CACA,SAAiB;CAEjB,YACI,SACA,MACF;EAFmB,KAAA,UAAA;EACA,KAAA,OAAA;CAClB;CAEH,qBAA4B,SAAwC;EAChE,KAAK,WAAW;EAChB,IAAI,KAAK,QACL;EAEJ,KAAK,SAAS;EACd,KAAK,QAAQ,sBAAsB,OAAO;GACtC,KAAU,YAAY,EAAE;EAC5B,CAAC;CACL;CAEA,MAAc,YAA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"}
@@ -0,0 +1,6 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { $ as ManagedIdentityStorageBackend, $i as DiscriminatorSchema, $n as signedHash, $r as zTopologyLinkEndpoint, $t as Result, A as VerifyRpcCallResult, Ai as InterfaceMemberRefMap, An as Capability, Ar as nodeInterface, B as OneShotCapStaging, Bi as RequestType, Bn as permissionPermits, Br as TopologyTransportInfo, Bt as ExpBackoffOptions, C as VerifyCallOptions, Ca as JsonValue, Ci as computeInterfaceHash, Cn as ParsedMethodName, Cr as StreamControlReason, Ct as CmdEnvEndpoint, D as SignRpcCallOptions, Di as InterfaceHandlers, Dn as Call, Dr as streamInterface, Dt as ResolvedEndpoint, E as verifyCall, Ei as InterfaceDefinitionOpts, En as Ability, Er as StreamSendParams, Et as FormatEndpointOptions, F as identityStorageInterface, Fi as defineInterface, Fn as TargetPattern, Fr as TopologyLink, Ft as DEFAULT_RPC_TIMEOUT_MS, G as createManagedPrincipal, Gi as zodToSvcJsonSchema, Gn as LINKRPC_META_KEY, Gr as TrafficWatchResult, Gt as Channel, H as SigningSender, Hi as ZodToSvcJsonSchemaOptions, Hn as HUBRPC_META_KEY, Hr as TrafficOverflowEvent, Ht as OnChannelConnect, I as crypto_d_exports, Ii as interfaceFromSchema, In as capabilityPermits, Ir as TopologyLinkEndpoint, It as withRpcTimeout, J as CapBagOptions, Ji as MemberAnnotations, Jn as SignDomain, Jr as zParticipantDescriptor, Jt as IRequestSender, K as Principal, Ki as ErrorSchema, Kn as LINKRPC_SIGNATURE_KEY, Kr as topologyInterface, Kt as ChannelTransport, L as CapProvider, Li as MemberDocs, Ln as hasSignedCapabilityShape, Lr as TopologyNode, Lt as JsonRpcChannel, M as signRpcCall, Mi as StreamApi, Mn as Pattern, Mr as ParticipantDescriptorSource, Mt as isHubEndpoint, N as verifyRpcCall, Ni as StreamCallOptions, Nn as Permission, Nr as RouteClaim, Nt as parseEndpointUri, O as SignedRpcCall, Oi as InterfaceInfo, On as CallBind, Or as NodeInfo, Ot as SocketEndpoint, P as identityInterface, Pi as StreamingCall, Pn as SignedCapability, Pr as TopologyGraph, Pt as CancellableRequest, Q as ManagedIdentityStorage, Qi as ConstSchema, Qn as readSignature, Qr as zTopologyLink, Qt as RawStreamingCall, R as CapProviderResult, Ri as MemberType, Rn as matchParams, Rr as TopologyPort, Rt as ChannelConnector, S as SignParamsOptions, Sa as isResponse, Si as EXTENSION_PREFIX, Sn as stripLinkRpcWireMeta, Sr as STREAM_METHOD, St as WrappingIdentity, T as signParams, Ti as InterfaceDefinition, Tn as parseMethodName, Tr as StreamDir, Tt as EndpointCommand, U as SigningSenderConfig, Ui as notificationType, Un as HUBRPC_SIGNATURE_KEY, Ur as TrafficTransitEndpoint, Ut as BareInterfaceTarget, V as SigningCallCtx, Vi as Schema, Vn as Base64Sha256, Vr as TrafficEvent, Vt as KeepConnectedHandle, W as PrincipalWithStore, Wi as requestType, Wn as HUBRPC_UNSIGNED_KEY, Wr as TrafficTransitEvent, Wt as bareInterfaceTarget, X as InMemoryManagedIdentityStorage, Xi as ArraySchema, Xn as Signatures, Xr as zRouteClaim, Xt as IncomingStream, Y as InMemoryManagedIdentity, Yi as MethodSchema, Yn as SignatureEnvelope, Yr as zParticipantDescriptorSource, Yt as IncomingCall, Z as ManagedIdentity, Zi as BooleanSchema, Zn as getKeyId, Zr as zTopologyGraph, Zt as MessageWithCtx, _ as SeededPrincipalOptions, _a as JsonRpcResponse, _i as componentSchemaName, _n as LinkRpcJsonRpcRequest, _r as principalForPublicKey, _t as KeypairSigningIdentity, a as LinkRpcConnection, aa as ObjectSchema, ai as zTrafficOverflowEvent, an as IMessageTransport, ar as Keypair, at as ParamMatcherFor, b as createSeededSigningIdentity, ba as isNotification, bi as isAssignable, bn as LinkRpcWireParams, br as jcsCanonicalize, bt as SerializedKeypairSigningIdentity, c as ServiceHandle, ca as SchemaBase, ci as zTrafficWatchResult, cn as MessageTransportWithContext, cr as PrivateKey, ct as capBagFreshAt, d as ServiceIdPattern, da as UnionSchema, di as SchemaToZodContext, dn as connectTransports, dr as Signature, dt as issueCapability, ea as EnumSchema, ei as zTopologyNode, en as RpcError, er as signingDomainValue, et as createManagedIdentity, f as defaultsInterface, fa as ErrorCode, fi as createSchemaToZod, fn as traceMessageTransport, fr as X25519Keypair, ft as permits, g as zServiceIdPattern, ga as JsonRpcRequest, gi as assertSchemaReferences, gn as LinkRpcJsonRpcNotification, gr as keyIdForPublicKey, gt as KeypairIdentity, h as schemasInterface, ha as JsonRpcNotification, hi as materializeJsonSchema, hn as LinkRpcJsonRpcMessage, hr as keyIdForPrincipal, ht as Identity, i as InterfaceRegistration, ia as NumberSchema, ii as zTrafficEvent, in as MuxEnvelope, ir as KeyId, it as IssueCapabilityOptions, j as attachCapabilities, ji as MemberMap, jn as ParamMatcher, jr as ParticipantDescriptor, jt as formatEndpointUri, k as VerifyRpcCallOptions, ki as InterfaceMemberRef, kn as CallTarget, kr as TopologyIdGenerator, kt as WsEndpoint, l as RootPrincipalReq, la as StringSchema, li as GenerateInterfaceOptions, ln as MessageWithContext, lr as PublicKey, lt as capabilityFreshAt, m as directoryWatchNever, ma as JsonRpcMessage, mi as MaterializedJsonSchema, mn as CallMeta, mr as bytesToBase64Url, mt as signCapability, n as GetOptions, na as LinkRpcJsonSchema, ni as zTopologyTransportEndpoint, nn as StreamSendOpts, nr as withSignature, nt as registerLazyIdentityOnOverlay, o as LinkRpcConnectionOptions, oa as OneOfSchema, oi as zTrafficTransitEndpoint, on as MessageTransportDirection, or as PRINCIPAL_PREFIX, ot as ParamMatchers, p as directoryInterface, pa as JsonRpcError, pi as schemaToZod, pr as base64UrlToBytes, pt as prefix, q as CapBag, qi as LinkRpcInterfaceSchema, qn as LINKRPC_UNSIGNED_KEY, qr as trafficInterface, qt as IRequestHandler, r as InspectionRegistration, ra as NullSchema, ri as zTopologyTransportInfo, rn as MultiplexedTransport, rr as KEY_ID_PREFIX, rt as AcceptedRootIssuer, s as RegisterOptions, sa as RefSchema, si as zTrafficTransitEvent, sn as MessageTransportTrace, sr as PrincipalId, st as PermitResult, t as BareGetOptions, ta as IntegerSchema, ti as zTopologyPort, tn as SendOpts, tr as signingInput, tt as registerIdentityOnOverlay, u as RootPrincipalSet, ua as TupleSchema, ui as generateTsInterface, un as TransportPair, ur as ResolveSigningKeyArgs, ut as invoke, v as createMemoryPrincipal, va as JsonRpcSuccess, vi as componentSchemaRef, vn as LinkRpcUnsigned, vr as publicKeyForKeyId, vt as PublicSigningIdentity, w as VerifyResult, wi as InterfaceClient, wn as methodNameToTarget, wr as StreamControlType, wt as CmdStdioEndpoint, x as JsonObject, xa as isRequest, xi as normalizeJsonSchema, xn as requireObjectParams, xr as jcsCanonicalizeBytes, xt as SigningIdentity, y as createSeededMemoryPrincipal, ya as RequestId, yi as Components, yn as LinkRpcWireMeta, yr as resolveSigningKey, yt as PublicWrappingIdentity, z as ManagedSigningChannel, zi as NotificationType, zn as permissionMatchesTarget, zr as TopologyTransportEndpoint, zt as ConnectableChannel } from "./chunks/linkRpcConnection-CtlQmetO.js";
6
+ export { Ability, type AcceptedRootIssuer, ArraySchema, BareGetOptions, type BareInterfaceTarget, Base64Sha256, BooleanSchema, Call, CallBind, CallMeta, CallTarget, type CancellableRequest, CapBag, CapBagOptions, type CapProvider, type CapProviderResult, Capability, Channel, ChannelConnector, type ChannelTransport, type CmdEnvEndpoint, type CmdStdioEndpoint, Components, type ConnectableChannel, ConstSchema, DEFAULT_RPC_TIMEOUT_MS, DiscriminatorSchema, EXTENSION_PREFIX, type EndpointCommand, EnumSchema, ErrorCode, ErrorSchema, type ExpBackoffOptions, type FormatEndpointOptions, GenerateInterfaceOptions, GetOptions, HUBRPC_META_KEY, HUBRPC_SIGNATURE_KEY, HUBRPC_UNSIGNED_KEY, IMessageTransport, type IRequestHandler, type IRequestSender, Identity, InMemoryManagedIdentity, InMemoryManagedIdentityStorage, type IncomingCall, type IncomingStream, InspectionRegistration, IntegerSchema, InterfaceClient, InterfaceDefinition, InterfaceDefinitionOpts, InterfaceHandlers, InterfaceInfo, InterfaceMemberRef, InterfaceMemberRefMap, InterfaceRegistration, type IssueCapabilityOptions, JsonObject, JsonRpcChannel, JsonRpcError, JsonRpcMessage, JsonRpcNotification, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccess, JsonValue, KEY_ID_PREFIX, type KeepConnectedHandle, KeyId, Keypair, KeypairIdentity, KeypairSigningIdentity, LINKRPC_META_KEY, LINKRPC_SIGNATURE_KEY, LINKRPC_UNSIGNED_KEY, LinkRpcConnection, LinkRpcConnectionOptions, LinkRpcInterfaceSchema, LinkRpcJsonRpcMessage, LinkRpcJsonRpcNotification, LinkRpcJsonRpcRequest, LinkRpcJsonSchema, LinkRpcUnsigned, LinkRpcWireMeta, LinkRpcWireParams, ManagedIdentity, ManagedIdentityStorage, ManagedIdentityStorageBackend, type ManagedSigningChannel, MaterializedJsonSchema, MemberAnnotations, MemberDocs, MemberMap, MemberType, MessageTransportDirection, MessageTransportTrace, MessageTransportWithContext, MessageWithContext, type MessageWithCtx, MethodSchema, MultiplexedTransport, MuxEnvelope, NodeInfo, NotificationType, NullSchema, NumberSchema, ObjectSchema, type OnChannelConnect, OneOfSchema, OneShotCapStaging, PRINCIPAL_PREFIX, ParamMatcher, type ParamMatcherFor, type ParamMatchers, ParsedMethodName, ParticipantDescriptor, ParticipantDescriptorSource, Pattern, Permission, type PermitResult, Principal, PrincipalId, PrincipalWithStore, PrivateKey, PublicKey, PublicSigningIdentity, PublicWrappingIdentity, type RawStreamingCall, RefSchema, RegisterOptions, RequestId, RequestType, ResolveSigningKeyArgs, type ResolvedEndpoint, type Result, RootPrincipalReq, RootPrincipalSet, RouteClaim, RpcError, STREAM_METHOD, Schema, SchemaBase, SchemaToZodContext, SeededPrincipalOptions, type SendOpts, SerializedKeypairSigningIdentity, ServiceHandle, ServiceIdPattern, SignDomain, SignParamsOptions, SignRpcCallOptions, Signature, SignatureEnvelope, Signatures, SignedCapability, SignedRpcCall, type SigningCallCtx, SigningIdentity, SigningSender, type SigningSenderConfig, type SocketEndpoint, StreamApi, StreamCallOptions, StreamControlReason, StreamControlType, StreamDir, type StreamSendOpts, StreamSendParams, StreamingCall, StringSchema, TargetPattern, TopologyGraph, TopologyIdGenerator, TopologyLink, TopologyLinkEndpoint, TopologyNode, TopologyPort, TopologyTransportEndpoint, TopologyTransportInfo, TrafficEvent, TrafficOverflowEvent, TrafficTransitEndpoint, TrafficTransitEvent, TrafficWatchResult, TransportPair, TupleSchema, UnionSchema, VerifyCallOptions, VerifyResult, VerifyRpcCallOptions, VerifyRpcCallResult, WrappingIdentity, type WsEndpoint, X25519Keypair, ZodToSvcJsonSchemaOptions, assertSchemaReferences, attachCapabilities, bareInterfaceTarget, base64UrlToBytes, bytesToBase64Url, capBagFreshAt, capabilityFreshAt, capabilityPermits, componentSchemaName, componentSchemaRef, computeInterfaceHash, connectTransports, createManagedIdentity, createManagedPrincipal, createMemoryPrincipal, createSchemaToZod, createSeededMemoryPrincipal, createSeededSigningIdentity, crypto_d_exports as crypto, defaultsInterface, defineInterface, directoryInterface, directoryWatchNever, formatEndpointUri, generateTsInterface, getKeyId, hasSignedCapabilityShape, identityInterface, identityStorageInterface, interfaceFromSchema, invoke, isAssignable, isHubEndpoint, isNotification, isRequest, isResponse, issueCapability, jcsCanonicalize, jcsCanonicalizeBytes, keyIdForPrincipal, keyIdForPublicKey, matchParams, materializeJsonSchema, methodNameToTarget, nodeInterface, normalizeJsonSchema, notificationType, parseEndpointUri, parseMethodName, permissionMatchesTarget, permissionPermits, permits, prefix, principalForPublicKey, publicKeyForKeyId, readSignature, registerIdentityOnOverlay, registerLazyIdentityOnOverlay, requestType, requireObjectParams, resolveSigningKey, schemaToZod, schemasInterface, signCapability, signParams, signRpcCall, signedHash, signingDomainValue, signingInput, streamInterface, stripLinkRpcWireMeta, topologyInterface, traceMessageTransport, trafficInterface, verifyCall, verifyRpcCall, withRpcTimeout, withSignature, zParticipantDescriptor, zParticipantDescriptorSource, zRouteClaim, zServiceIdPattern, zTopologyGraph, zTopologyLink, zTopologyLinkEndpoint, zTopologyNode, zTopologyPort, zTopologyTransportEndpoint, zTopologyTransportInfo, zTrafficEvent, zTrafficOverflowEvent, zTrafficTransitEndpoint, zTrafficTransitEvent, zTrafficWatchResult, zodToSvcJsonSchema };
package/dist/index.js ADDED
@@ -0,0 +1,7 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { A as NotificationType, C as defineInterface, E as computeInterfaceHash, F as normalizeJsonSchema, M as notificationType, N as requestType, O as jcsCanonicalize, P as zodToSvcJsonSchema, S as InterfaceDefinition, T as EXTENSION_PREFIX, _ as zTrafficEvent, a as topologyInterface, b as zTrafficTransitEvent, c as zParticipantDescriptorSource, d as zTopologyLink, f as zTopologyLinkEndpoint, g as zTopologyTransportInfo, h as zTopologyTransportEndpoint, i as nodeInterface, j as RequestType, k as jcsCanonicalizeBytes, l as zRouteClaim, m as zTopologyPort, o as trafficInterface, p as zTopologyNode, s as zParticipantDescriptor, u as zTopologyGraph, v as zTrafficOverflowEvent, w as interfaceFromSchema, x as zTrafficWatchResult, y as zTrafficTransitEndpoint } from "./chunks/boundedTrafficSubscription-1L592xc7.js";
6
+ import { $t as bareInterfaceTarget, A as attachCapabilities, At as PRINCIPAL_PREFIX, B as LinkRpcConnection, Bt as isRequest, C as identityStorageInterface, Ct as getKeyId, D as PublicWrappingIdentity, Dt as signingInput, E as PublicSigningIdentity, Et as signingDomainValue, Ft as principalForPublicKey, Gt as StreamDir, H as JsonRpcChannel, Ht as STREAM_METHOD, I as formatEndpointUri, It as publicKeyForKeyId, Jt as directoryInterface, Kt as streamInterface, L as isHubEndpoint, Lt as resolveSigningKey, M as verifyRpcCall, Mt as bytesToBase64Url, N as crypto_exports, Nt as keyIdForPrincipal, O as Principal, Ot as withSignature, Pt as keyIdForPublicKey, Qt as generateTsInterface, R as parseEndpointUri, Rt as ErrorCode, S as identityInterface, St as LINKRPC_UNSIGNED_KEY, T as KeypairSigningIdentity, Tt as signedHash, Ut as StreamControlReason, V as ServiceHandle, Vt as isResponse, Wt as StreamControlType, Xt as schemasInterface, Yt as directoryWatchNever, Zt as zServiceIdPattern, _ as InMemoryManagedIdentity, _t as HUBRPC_META_KEY, a as verifyCall, an as componentSchemaRef, at as TransportPair, b as registerIdentityOnOverlay, bt as LINKRPC_META_KEY, c as invoke, ct as requireObjectParams, d as prefix, dt as parseMethodName, en as createSchemaToZod, et as DEFAULT_RPC_TIMEOUT_MS, f as signCapability, ft as capabilityPermits, g as createManagedPrincipal, gt as permissionPermits, h as PrincipalWithStore, ht as permissionMatchesTarget, i as signParams, in as componentSchemaName, it as MultiplexedTransport, j as signRpcCall, jt as base64UrlToBytes, k as CapBag, kt as KEY_ID_PREFIX, l as issueCapability, lt as stripLinkRpcWireMeta, m as SigningSender, mt as matchParams, n as createSeededMemoryPrincipal, nn as materializeJsonSchema, nt as Channel, o as capBagFreshAt, on as isAssignable, ot as connectTransports, p as OneShotCapStaging, pt as hasSignedCapabilityShape, qt as defaultsInterface, r as createSeededSigningIdentity, rn as assertSchemaReferences, rt as RpcError, s as capabilityFreshAt, st as traceMessageTransport, t as createMemoryPrincipal, tn as schemaToZod, tt as withRpcTimeout, u as permits, ut as methodNameToTarget, v as InMemoryManagedIdentityStorage, vt as HUBRPC_SIGNATURE_KEY, w as KeypairIdentity, wt as readSignature, x as registerLazyIdentityOnOverlay, xt as LINKRPC_SIGNATURE_KEY, y as createManagedIdentity, yt as HUBRPC_UNSIGNED_KEY, z as ChannelConnector, zt as isNotification } from "./chunks/src-D3NUIwyo.js";
7
+ export { CapBag, Channel, ChannelConnector, DEFAULT_RPC_TIMEOUT_MS, EXTENSION_PREFIX, ErrorCode, HUBRPC_META_KEY, HUBRPC_SIGNATURE_KEY, HUBRPC_UNSIGNED_KEY, InMemoryManagedIdentity, InMemoryManagedIdentityStorage, InterfaceDefinition, JsonRpcChannel, KEY_ID_PREFIX, KeypairIdentity, KeypairSigningIdentity, LINKRPC_META_KEY, LINKRPC_SIGNATURE_KEY, LINKRPC_UNSIGNED_KEY, LinkRpcConnection, MultiplexedTransport, NotificationType, OneShotCapStaging, PRINCIPAL_PREFIX, Principal, PrincipalWithStore, PublicSigningIdentity, PublicWrappingIdentity, RequestType, RpcError, STREAM_METHOD, ServiceHandle, SigningSender, StreamControlReason, StreamControlType, StreamDir, TransportPair, assertSchemaReferences, attachCapabilities, bareInterfaceTarget, base64UrlToBytes, bytesToBase64Url, capBagFreshAt, capabilityFreshAt, capabilityPermits, componentSchemaName, componentSchemaRef, computeInterfaceHash, connectTransports, createManagedIdentity, createManagedPrincipal, createMemoryPrincipal, createSchemaToZod, createSeededMemoryPrincipal, createSeededSigningIdentity, crypto_exports as crypto, defaultsInterface, defineInterface, directoryInterface, directoryWatchNever, formatEndpointUri, generateTsInterface, getKeyId, hasSignedCapabilityShape, identityInterface, identityStorageInterface, interfaceFromSchema, invoke, isAssignable, isHubEndpoint, isNotification, isRequest, isResponse, issueCapability, jcsCanonicalize, jcsCanonicalizeBytes, keyIdForPrincipal, keyIdForPublicKey, matchParams, materializeJsonSchema, methodNameToTarget, nodeInterface, normalizeJsonSchema, notificationType, parseEndpointUri, parseMethodName, permissionMatchesTarget, permissionPermits, permits, prefix, principalForPublicKey, publicKeyForKeyId, readSignature, registerIdentityOnOverlay, registerLazyIdentityOnOverlay, requestType, requireObjectParams, resolveSigningKey, schemaToZod, schemasInterface, signCapability, signParams, signRpcCall, signedHash, signingDomainValue, signingInput, streamInterface, stripLinkRpcWireMeta, topologyInterface, traceMessageTransport, trafficInterface, verifyCall, verifyRpcCall, withRpcTimeout, withSignature, zParticipantDescriptor, zParticipantDescriptorSource, zRouteClaim, zServiceIdPattern, zTopologyGraph, zTopologyLink, zTopologyLinkEndpoint, zTopologyNode, zTopologyPort, zTopologyTransportEndpoint, zTopologyTransportInfo, zTrafficEvent, zTrafficOverflowEvent, zTrafficTransitEndpoint, zTrafficTransitEvent, zTrafficWatchResult, zodToSvcJsonSchema };
@@ -0,0 +1,66 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { $r as zTopologyLinkEndpoint, Ar as nodeInterface, Br as TopologyTransportInfo, Fr as TopologyLink, Gr as TrafficWatchResult, Hr as TrafficOverflowEvent, Ir as TopologyLinkEndpoint, Jr as zParticipantDescriptor, Kr as topologyInterface, Lr as TopologyNode, Mr as ParticipantDescriptorSource, Nr as RouteClaim, Or as NodeInfo, Pr as TopologyGraph, Qr as zTopologyLink, Rr as TopologyPort, Ur as TrafficTransitEndpoint, Vr as TrafficEvent, Wr as TrafficTransitEvent, Xr as zRouteClaim, Yr as zParticipantDescriptorSource, Zr as zTopologyGraph, ai as zTrafficOverflowEvent, ci as zTrafficWatchResult, ei as zTopologyNode, ii as zTrafficEvent, jr as ParticipantDescriptor, kr as TopologyIdGenerator, ni as zTopologyTransportEndpoint, oi as zTrafficTransitEndpoint, qr as trafficInterface, ri as zTopologyTransportInfo, si as zTrafficTransitEvent, ti as zTopologyPort, zr as TopologyTransportEndpoint } from "../chunks/linkRpcConnection-CtlQmetO.js";
6
+ //#region src/inspection/trafficFlowFilter.d.ts
7
+ interface TrafficRequestRef {
8
+ readonly portId: string;
9
+ readonly requestId: string | number;
10
+ }
11
+ interface TrafficFlowFilterOptions {
12
+ readonly focus?: TrafficRequestRef;
13
+ }
14
+ declare class TrafficFlowFilter {
15
+ private readonly _focused;
16
+ constructor(options: TrafficFlowFilterOptions);
17
+ shouldInclude(transit: TrafficTransitEvent): boolean;
18
+ }
19
+ declare class TrafficWatchFlowTracker {
20
+ private readonly _active;
21
+ private readonly _unclaimed;
22
+ accept(transit: TrafficTransitEvent): boolean;
23
+ private _findFlow;
24
+ private _removeFlow;
25
+ claim(trafficIgnoreKey: string): boolean;
26
+ clear(): void;
27
+ }
28
+ //#endregion
29
+ //#region src/inspection/boundedTrafficSubscription.d.ts
30
+ interface TrafficSubscriptionOptions {
31
+ readonly methodPrefix?: string;
32
+ readonly maxPayloadBytes?: number;
33
+ readonly trafficIgnoreKey?: string;
34
+ readonly focusRequest?: TrafficRequestRef;
35
+ }
36
+ interface TrafficSubscription {
37
+ readonly closed: Promise<TrafficWatchResult>;
38
+ dispose(): void;
39
+ }
40
+ /**
41
+ * Applies per-subscriber filtering and payload policy while isolating traffic
42
+ * producers from slow or failed stream consumers.
43
+ */
44
+ declare class BoundedTrafficSubscription implements TrafficSubscription {
45
+ private readonly _options;
46
+ private readonly _send;
47
+ private readonly _onDispose;
48
+ private readonly _queueLimit;
49
+ private readonly _queue;
50
+ private _active;
51
+ private _pumping;
52
+ private _overflowPending;
53
+ private _delivered;
54
+ private _dropped;
55
+ private readonly _resolveClosed;
56
+ private readonly _filter;
57
+ readonly closed: Promise<TrafficWatchResult>;
58
+ constructor(_options: TrafficSubscriptionOptions, _send: (event: TrafficEvent) => Promise<void>, _onDispose: () => void, _queueLimit?: number);
59
+ enqueue(transit: TrafficTransitEvent): void;
60
+ dispose(): void;
61
+ private _pump;
62
+ private _complete;
63
+ }
64
+ //#endregion
65
+ export { BoundedTrafficSubscription, NodeInfo, ParticipantDescriptor, ParticipantDescriptorSource, RouteClaim, TopologyGraph, TopologyIdGenerator, TopologyLink, TopologyLinkEndpoint, TopologyNode, TopologyPort, TopologyTransportEndpoint, TopologyTransportInfo, TrafficEvent, TrafficFlowFilter, type TrafficFlowFilterOptions, TrafficOverflowEvent, type TrafficRequestRef, type TrafficSubscription, type TrafficSubscriptionOptions, TrafficTransitEndpoint, TrafficTransitEvent, TrafficWatchFlowTracker, TrafficWatchResult, nodeInterface, topologyInterface, trafficInterface, zParticipantDescriptor, zParticipantDescriptorSource, zRouteClaim, zTopologyGraph, zTopologyLink, zTopologyLinkEndpoint, zTopologyNode, zTopologyPort, zTopologyTransportEndpoint, zTopologyTransportInfo, zTrafficEvent, zTrafficOverflowEvent, zTrafficTransitEndpoint, zTrafficTransitEvent, zTrafficWatchResult };
66
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","names":[],"sources":["../../src/inspection/trafficFlowFilter.ts","../../src/inspection/boundedTrafficSubscription.ts"],"mappings":";;;;;;UAKiB;WACJ;WACA;;UAGI;WACJ,QAAQ;;cAGR;mBACQ;EAEL,YAAA,SAAS;EAMd,cAAc,SAAS;;cAMrB;mBACQ;mBACA;EAEV,OAAO,SAAS;UA+Bf;UAOA;EAOD,MAAM;EAIN;;;;UCrEM;WACJ;WACA;WACA;WACA,eAAe;;UAGX;WACJ,QAAQ,QAAQ;EACzB;;;;;;cAOS,sCAAsC;mBAY1B;mBACA;mBACA;mBACA;mBAdJ;UACT;UACA;UACA;UACA;UACA;mBACS;mBACA;WACD,QAAQ,QAAQ;EAGX,YAAA,UAAU,4BACV,QAAQ,OAAO,iBAAiB,eAChC,wBACA;EAUd,QAAQ,SAAS;EAyBjB;UAUO;UA2BN"}
@@ -0,0 +1,6 @@
1
+ /*---------------------------------------------------------------------------------------------
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License. See License.txt in the project root for license information.
4
+ *--------------------------------------------------------------------------------------------*/
5
+ import { _ as zTrafficEvent, a as topologyInterface, b as zTrafficTransitEvent, c as zParticipantDescriptorSource, d as zTopologyLink, f as zTopologyLinkEndpoint, g as zTopologyTransportInfo, h as zTopologyTransportEndpoint, i as nodeInterface, l as zRouteClaim, m as zTopologyPort, n as TrafficFlowFilter, o as trafficInterface, p as zTopologyNode, r as TrafficWatchFlowTracker, s as zParticipantDescriptor, t as BoundedTrafficSubscription, u as zTopologyGraph, v as zTrafficOverflowEvent, x as zTrafficWatchResult, y as zTrafficTransitEndpoint } from "../chunks/boundedTrafficSubscription-1L592xc7.js";
6
+ export { BoundedTrafficSubscription, TrafficFlowFilter, TrafficWatchFlowTracker, nodeInterface, topologyInterface, trafficInterface, zParticipantDescriptor, zParticipantDescriptorSource, zRouteClaim, zTopologyGraph, zTopologyLink, zTopologyLinkEndpoint, zTopologyNode, zTopologyPort, zTopologyTransportEndpoint, zTopologyTransportInfo, zTrafficEvent, zTrafficOverflowEvent, zTrafficTransitEndpoint, zTrafficTransitEvent, zTrafficWatchResult };