@hediet/linkrpc-hub 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 (50) hide show
  1. package/README.md +101 -0
  2. package/dist/chunks/config-BCvkg7jv.d.ts +566 -0
  3. package/dist/chunks/configFile-y6Phntqu.d.ts +9 -0
  4. package/dist/chunks/connectionTokenBinder.interfaces-B-beCg06.js +40 -0
  5. package/dist/chunks/connectionTokenBinder.interfaces-B-beCg06.js.map +1 -0
  6. package/dist/chunks/connectionTokenBinder.interfaces-BhzQ1DTS.d.ts +36 -0
  7. package/dist/chunks/hubConnectionAcceptor-B5-8JsFY.js +2768 -0
  8. package/dist/chunks/hubConnectionAcceptor-B5-8JsFY.js.map +1 -0
  9. package/dist/chunks/hubConnectionAcceptor-BwydvFa4.d.ts +1560 -0
  10. package/dist/chunks/index-CLIUrV88.d.ts +481 -0
  11. package/dist/chunks/node-CTXsQ6oa.js +460 -0
  12. package/dist/chunks/node-CTXsQ6oa.js.map +1 -0
  13. package/dist/chunks/nodeTransit-CWeFnbwt.js +444 -0
  14. package/dist/chunks/nodeTransit-CWeFnbwt.js.map +1 -0
  15. package/dist/chunks/nodeTransit-cmtZgdpW.d.ts +226 -0
  16. package/dist/chunks/runHub-P3YUwwdv.js +1797 -0
  17. package/dist/chunks/runHub-P3YUwwdv.js.map +1 -0
  18. package/dist/chunks/server-BAxchQhy.js +1368 -0
  19. package/dist/chunks/server-BAxchQhy.js.map +1 -0
  20. package/dist/cli.d.ts +1 -0
  21. package/dist/cli.js +38 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/config.d.ts +2 -0
  24. package/dist/config.js +305 -0
  25. package/dist/config.js.map +1 -0
  26. package/dist/configFile.d.ts +2 -0
  27. package/dist/configFile.js +27 -0
  28. package/dist/configFile.js.map +1 -0
  29. package/dist/engine/runHub.d.ts +42 -0
  30. package/dist/engine/runHub.js +2 -0
  31. package/dist/hub/server/client.d.ts +2 -0
  32. package/dist/hub/server/client.js +2 -0
  33. package/dist/hub/server/connectionTokenBinder.d.ts +2 -0
  34. package/dist/hub/server/connectionTokenBinder.js +2 -0
  35. package/dist/hub/server/index.d.ts +5 -0
  36. package/dist/hub/server/index.js +5 -0
  37. package/dist/hub/server/node/index.d.ts +218 -0
  38. package/dist/hub/server/node/index.js +2 -0
  39. package/dist/hub/server/transit.d.ts +2 -0
  40. package/dist/hub/server/transit.js +2 -0
  41. package/dist/index.d.ts +512 -0
  42. package/dist/index.js +309 -0
  43. package/dist/index.js.map +1 -0
  44. package/dist/serve.d.ts +14 -0
  45. package/dist/serve.js +31 -0
  46. package/dist/serve.js.map +1 -0
  47. package/dist/spawn.d.ts +12 -0
  48. package/dist/spawn.js +25 -0
  49. package/dist/spawn.js.map +1 -0
  50. package/package.json +83 -0
package/README.md ADDED
@@ -0,0 +1,101 @@
1
+ # @hediet/linkrpc-hub
2
+
3
+ Standalone linkrpc hub that exposes a JSON-RPC-over-WebSocket endpoint.
4
+ Designed to run on a server behind a TLS-terminating reverse proxy
5
+ (Traefik, nginx, Caddy, …).
6
+
7
+ ## Quick start
8
+
9
+ ```sh
10
+ pnpm --filter @hediet/linkrpc-hub build
11
+ node packages/linkrpc-hub/dist/cli.js --port 7878 --token <shared-secret>
12
+ ```
13
+
14
+ When `--token` and `--tokens-file` are both omitted, a one-shot token is
15
+ minted and printed at startup.
16
+
17
+ ## CLI
18
+
19
+ ```
20
+ linkrpc-hub [options]
21
+
22
+ --host <h> interface to bind (default 127.0.0.1)
23
+ --port <n> TCP port (default 7878)
24
+ --path <p> URL path of the WebSocket endpoint (default /)
25
+ --identity <file> admin keypair file (auto-generated on first run)
26
+ --tokens-file <file> one accepted token per line; reloaded on SIGHUP
27
+ --token <t> accepted token (repeatable)
28
+ --open openMode — disable signature checks. LOCAL DEV ONLY.
29
+ --allowed-origin <o> restrict browser clients to this Origin (repeatable)
30
+ --max-payload <bytes> WebSocket max frame size (default 16 MiB)
31
+ --health-path <p> HTTP path returning 200 OK (default /healthz)
32
+ ```
33
+
34
+ ## Authenticating a connection
35
+
36
+ A client may present its token via `Authorization: Bearer <token>`
37
+
38
+ ## Node client
39
+
40
+ ```ts
41
+ import { connectToHubWs } from '@hediet/linkrpc-hub';
42
+
43
+ const hub = await connectToHubWs({
44
+ url: 'wss://hub.example.com/',
45
+ token: process.env.HUB_TOKEN!,
46
+ });
47
+ const result = await hub.channel.sendRequest('hubrpc.directory::list', {});
48
+ ```
49
+
50
+ ## Traefik recipe
51
+
52
+ Run the hub bound to loopback (or to a docker-internal interface) and let
53
+ Traefik handle TLS and the public hostname.
54
+
55
+ ```yaml
56
+ # docker-compose.yml
57
+ services:
58
+ linkrpc-hub:
59
+ image: node:22-alpine
60
+ command: node /app/packages/linkrpc-hub/dist/cli.js --host 0.0.0.0 --port 7878 --tokens-file /run/secrets/linkrpc-tokens
61
+ volumes:
62
+ - ./:/app
63
+ secrets:
64
+ - linkrpc-tokens
65
+ networks:
66
+ - infra
67
+ labels:
68
+ - traefik.enable=true
69
+ - traefik.http.routers.linkrpc-hub.rule=Host(`hub.example.com`)
70
+ - traefik.http.routers.linkrpc-hub.entrypoints=websecure
71
+ - traefik.http.routers.linkrpc-hub.tls.certresolver=le
72
+ - traefik.http.services.linkrpc-hub.loadbalancer.server.port=7878
73
+ # liveness
74
+ - traefik.http.services.linkrpc-hub.loadbalancer.healthcheck.path=/healthz
75
+
76
+ secrets:
77
+ linkrpc-tokens:
78
+ file: ./tokens.txt
79
+
80
+ networks:
81
+ infra:
82
+ external: true
83
+ ```
84
+
85
+ Traefik proxies WebSockets transparently — no `Upgrade` header munging
86
+ needed. The hub respects `X-Forwarded-For`, so connection logs show
87
+ real client IPs.
88
+
89
+ ## Security notes
90
+
91
+ - The hub starts in signed mode by default. Participants register
92
+ prefixes with capabilities issued by the admin keypair (see the
93
+ `linkrpc` README, Hub section). Without `--open`, every
94
+ `hubAccess::request` / `hubAccess::extend` / `hubAccess::requestAccess`
95
+ is rejected with `permissionRequired` — there is no interactive UI.
96
+ Mint capabilities out-of-band using the admin keypair.
97
+ - Use **separate tokens per client** when you can. Token rotation: drop
98
+ the new token into the tokens file and `kill -HUP $(pidof
99
+ linkrpc-hub)`; old tokens are accepted until removed from the file.
100
+ - The admin keypair file is written with mode `0o600`. Treat it like an
101
+ SSH host key.
@@ -0,0 +1,566 @@
1
+ import { z } from "zod";
2
+ //#region src/config.d.ts
3
+ /**
4
+ * A **provision**: the root services a connection is granted once admitted.
5
+ * Shared by listener handlers (static/anonymous forms) and endpoints. Each
6
+ * field is optional and names the root interface it enables.
7
+ */
8
+ declare const ConnectionTokenBinderSchema: z.ZodObject<{
9
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
10
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ type ConnectionTokenBinderConfig = z.infer<typeof ConnectionTokenBinderSchema>;
13
+ declare const provisionFields: {
14
+ /**
15
+ * Managed identity for the connection (`identity::*`), provisioned under
16
+ * `slot`. Omit for no managed identity.
17
+ */
18
+ managedIdentity: z.ZodOptional<z.ZodObject<{
19
+ slot: z.ZodString;
20
+ }, z.core.$strip>>;
21
+ /**
22
+ * ServiceId namespace the connection may claim freely
23
+ * (`hubGrantedServiceId::get`). Omit to grant no freely-claimable namespace.
24
+ */
25
+ grantedServiceId: z.ZodOptional<z.ZodString>;
26
+ /**
27
+ * Authorize the connection to mint single-use connection tokens by serving
28
+ * `connectionTokenBinder::bindConnectionToken` at its overlay root. The two
29
+ * prefixes bound **independent axes** of what a minted token may carry; set
30
+ * either, both, or neither.
31
+ */
32
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
33
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
34
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
35
+ }, z.core.$strip>>;
36
+ };
37
+ type ProvisionConfig = z.infer<z.ZodObject<typeof provisionFields>>;
38
+ /**
39
+ * A listener **connection handler**: a token match + (for the static forms) the
40
+ * provision to install when it claims. Discriminated by `token`:
41
+ *
42
+ * - `anonymous` — claims **any** connection (the catch-all "no auth"); provisions
43
+ * the inline fields.
44
+ * - `static` — claims connections whose presented token equals `value`;
45
+ * provisions the inline fields.
46
+ * - `bound` — claims connections whose token is live in the hub's
47
+ * connection-token store, **redeeming** it (single-use). The provision is
48
+ * **intrinsic** to the token's mint binding (identity slot and/or granted
49
+ * namespace), so it carries no inline provision.
50
+ */
51
+ declare const ConnectionHandlerSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
52
+ managedIdentity: z.ZodOptional<z.ZodObject<{
53
+ slot: z.ZodString;
54
+ }, z.core.$strip>>;
55
+ grantedServiceId: z.ZodOptional<z.ZodString>;
56
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
57
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
58
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>>;
60
+ token: z.ZodLiteral<"anonymous">;
61
+ }, z.core.$strip>, z.ZodObject<{
62
+ managedIdentity: z.ZodOptional<z.ZodObject<{
63
+ slot: z.ZodString;
64
+ }, z.core.$strip>>;
65
+ grantedServiceId: z.ZodOptional<z.ZodString>;
66
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
67
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
68
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
69
+ }, z.core.$strip>>;
70
+ token: z.ZodLiteral<"static">;
71
+ value: z.ZodString;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ token: z.ZodLiteral<"bound">;
74
+ }, z.core.$strip>], "token">;
75
+ type ConnectionHandlerConfig = z.infer<typeof ConnectionHandlerSchema>;
76
+ /**
77
+ * Outbound participant kinds that can be attached to an already-running Hub
78
+ * without host-specific admission or identity provisioning.
79
+ */
80
+ declare const ParticipantConnectorConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
81
+ managedIdentity: z.ZodOptional<z.ZodObject<{
82
+ slot: z.ZodString;
83
+ }, z.core.$strip>>;
84
+ grantedServiceId: z.ZodOptional<z.ZodString>;
85
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
86
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
87
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
88
+ }, z.core.$strip>>;
89
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
90
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
91
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
92
+ kind: z.ZodLiteral<"uri">;
93
+ uri: z.ZodString;
94
+ token: z.ZodOptional<z.ZodString>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ managedIdentity: z.ZodOptional<z.ZodObject<{
97
+ slot: z.ZodString;
98
+ }, z.core.$strip>>;
99
+ grantedServiceId: z.ZodOptional<z.ZodString>;
100
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
101
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
102
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
103
+ }, z.core.$strip>>;
104
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
105
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
106
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
107
+ kind: z.ZodLiteral<"ws">;
108
+ url: z.ZodString;
109
+ token: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>, z.ZodObject<{
111
+ managedIdentity: z.ZodOptional<z.ZodObject<{
112
+ slot: z.ZodString;
113
+ }, z.core.$strip>>;
114
+ grantedServiceId: z.ZodOptional<z.ZodString>;
115
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
116
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
117
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
118
+ }, z.core.$strip>>;
119
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
120
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
121
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
122
+ kind: z.ZodLiteral<"socket">;
123
+ path: z.ZodString;
124
+ token: z.ZodOptional<z.ZodString>;
125
+ }, z.core.$strip>, z.ZodObject<{
126
+ managedIdentity: z.ZodOptional<z.ZodObject<{
127
+ slot: z.ZodString;
128
+ }, z.core.$strip>>;
129
+ grantedServiceId: z.ZodOptional<z.ZodString>;
130
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
131
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
132
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
133
+ }, z.core.$strip>>;
134
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
135
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
136
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
137
+ cmd: z.ZodOptional<z.ZodString>;
138
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
139
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
140
+ cwd: z.ZodOptional<z.ZodString>;
141
+ kind: z.ZodLiteral<"cmd-stdio">;
142
+ }, z.core.$strip>], "kind">;
143
+ type ParticipantConnectorConfig = z.infer<typeof ParticipantConnectorConfigSchema>;
144
+ declare const EndpointConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
145
+ managedIdentity: z.ZodOptional<z.ZodObject<{
146
+ slot: z.ZodString;
147
+ }, z.core.$strip>>;
148
+ grantedServiceId: z.ZodOptional<z.ZodString>;
149
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
150
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
151
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
152
+ }, z.core.$strip>>;
153
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
154
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
155
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
156
+ kind: z.ZodLiteral<"uri">;
157
+ uri: z.ZodString;
158
+ token: z.ZodOptional<z.ZodString>;
159
+ }, z.core.$strip>, z.ZodObject<{
160
+ managedIdentity: z.ZodOptional<z.ZodObject<{
161
+ slot: z.ZodString;
162
+ }, z.core.$strip>>;
163
+ grantedServiceId: z.ZodOptional<z.ZodString>;
164
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
165
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
166
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strip>>;
168
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
169
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
170
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
171
+ kind: z.ZodLiteral<"ws">;
172
+ url: z.ZodString;
173
+ token: z.ZodOptional<z.ZodString>;
174
+ }, z.core.$strip>, z.ZodObject<{
175
+ managedIdentity: z.ZodOptional<z.ZodObject<{
176
+ slot: z.ZodString;
177
+ }, z.core.$strip>>;
178
+ grantedServiceId: z.ZodOptional<z.ZodString>;
179
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
180
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
181
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
182
+ }, z.core.$strip>>;
183
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
184
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
185
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
186
+ kind: z.ZodLiteral<"socket">;
187
+ path: z.ZodString;
188
+ token: z.ZodOptional<z.ZodString>;
189
+ }, z.core.$strip>, z.ZodObject<{
190
+ managedIdentity: z.ZodOptional<z.ZodObject<{
191
+ slot: z.ZodString;
192
+ }, z.core.$strip>>;
193
+ grantedServiceId: z.ZodOptional<z.ZodString>;
194
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
195
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
196
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
197
+ }, z.core.$strip>>;
198
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
199
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
200
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
201
+ cmd: z.ZodOptional<z.ZodString>;
202
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
203
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
204
+ cwd: z.ZodOptional<z.ZodString>;
205
+ kind: z.ZodLiteral<"cmd-env">;
206
+ }, z.core.$strip>, z.ZodObject<{
207
+ managedIdentity: z.ZodOptional<z.ZodObject<{
208
+ slot: z.ZodString;
209
+ }, z.core.$strip>>;
210
+ grantedServiceId: z.ZodOptional<z.ZodString>;
211
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
212
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
213
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
214
+ }, z.core.$strip>>;
215
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
216
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
217
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
218
+ cmd: z.ZodOptional<z.ZodString>;
219
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
220
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
221
+ cwd: z.ZodOptional<z.ZodString>;
222
+ kind: z.ZodLiteral<"cmd-stdio">;
223
+ }, z.core.$strip>], "kind">;
224
+ type EndpointConfig = z.infer<typeof EndpointConfigSchema>;
225
+ declare const ListenerConfigSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
226
+ handlers: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
227
+ managedIdentity: z.ZodOptional<z.ZodObject<{
228
+ slot: z.ZodString;
229
+ }, z.core.$strip>>;
230
+ grantedServiceId: z.ZodOptional<z.ZodString>;
231
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
232
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
233
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
234
+ }, z.core.$strip>>;
235
+ token: z.ZodLiteral<"anonymous">;
236
+ }, z.core.$strip>, z.ZodObject<{
237
+ managedIdentity: z.ZodOptional<z.ZodObject<{
238
+ slot: z.ZodString;
239
+ }, z.core.$strip>>;
240
+ grantedServiceId: z.ZodOptional<z.ZodString>;
241
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
242
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
243
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
244
+ }, z.core.$strip>>;
245
+ token: z.ZodLiteral<"static">;
246
+ value: z.ZodString;
247
+ }, z.core.$strip>, z.ZodObject<{
248
+ token: z.ZodLiteral<"bound">;
249
+ }, z.core.$strip>], "token">>>;
250
+ type: z.ZodLiteral<"websocket">;
251
+ host: z.ZodDefault<z.ZodString>;
252
+ port: z.ZodDefault<z.ZodNumber>;
253
+ path: z.ZodDefault<z.ZodString>;
254
+ healthPath: z.ZodDefault<z.ZodNullable<z.ZodString>>;
255
+ maxPayload: z.ZodDefault<z.ZodNumber>;
256
+ allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
257
+ }, z.core.$strip>, z.ZodObject<{
258
+ handlers: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
259
+ managedIdentity: z.ZodOptional<z.ZodObject<{
260
+ slot: z.ZodString;
261
+ }, z.core.$strip>>;
262
+ grantedServiceId: z.ZodOptional<z.ZodString>;
263
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
264
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
265
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
266
+ }, z.core.$strip>>;
267
+ token: z.ZodLiteral<"anonymous">;
268
+ }, z.core.$strip>, z.ZodObject<{
269
+ managedIdentity: z.ZodOptional<z.ZodObject<{
270
+ slot: z.ZodString;
271
+ }, z.core.$strip>>;
272
+ grantedServiceId: z.ZodOptional<z.ZodString>;
273
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
274
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
275
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
276
+ }, z.core.$strip>>;
277
+ token: z.ZodLiteral<"static">;
278
+ value: z.ZodString;
279
+ }, z.core.$strip>, z.ZodObject<{
280
+ token: z.ZodLiteral<"bound">;
281
+ }, z.core.$strip>], "token">>>;
282
+ type: z.ZodLiteral<"socket">;
283
+ path: z.ZodString;
284
+ }, z.core.$strip>], "type">;
285
+ type ListenerConfig = z.infer<typeof ListenerConfigSchema>;
286
+ /**
287
+ * Forward-checking policy for the hub's inbound listeners. When enabled, the
288
+ * hub mints an admin signing identity, serves the signed
289
+ * `hubServiceIdRegistry::registerServiceId` + `hubAccess` front doors, and gates
290
+ * every forwarded (fully-qualified) call at each listener boundary:
291
+ *
292
+ * - `verifySignatures` — forwarded calls must carry a valid `$hubrpc`
293
+ * signature (authenticity).
294
+ * - `requireCapability` — forwarded calls must additionally present a
295
+ * capability chain rooting at the hub admin (authorization). Granting
296
+ * capabilities is gated by the {@link HubAccessManifestHost} consent rendezvous.
297
+ *
298
+ * `true` is shorthand for both flags on; `false` disables forward checking
299
+ * entirely (open hub, no consent surface).
300
+ */
301
+ declare const ForwardCheckingSchema: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
302
+ verifySignatures: z.ZodDefault<z.ZodBoolean>;
303
+ requireCapability: z.ZodDefault<z.ZodBoolean>;
304
+ }, z.core.$strip>]>>;
305
+ type ForwardCheckingConfig = z.infer<typeof ForwardCheckingSchema>;
306
+ /**
307
+ * Where the built-in terminal consent approver sources its pending requests
308
+ * from. The approver consumes `hubAccessManifest::{getDesired,watchDesired,
309
+ * setCurrent}` **over a connection** — never the in-process host object — so the
310
+ * same loop works against a remote source unchanged.
311
+ *
312
+ * - `true` (default) — consume this hub's own manifest (served under
313
+ * {@link HubConfig.hubServiceId}). The common, local-operator case.
314
+ * - `{ serviceId }` — consume the manifest served at `serviceId` (e.g. an
315
+ * upstream hub the operator approves on behalf of).
316
+ * - `false` — install no built-in approver; rely entirely on external approvers
317
+ * (configured {@link HubConfig.rootPrincipalIds}) deciding via the manifest.
318
+ *
319
+ * The approver is only started when stdin is a TTY (it drives a terminal
320
+ * prompt); a non-interactive hub is keyless regardless of this setting.
321
+ */
322
+ declare const ConsentApproverSchema: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
323
+ serviceId: z.ZodString;
324
+ }, z.core.$strip>]>>;
325
+ type ConsentApproverConfig = z.infer<typeof ConsentApproverSchema>;
326
+ declare const HubConfigSchema: z.ZodObject<{
327
+ $schema: z.ZodOptional<z.ZodString>;
328
+ hubServiceId: z.ZodDefault<z.ZodString>;
329
+ listeners: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
330
+ handlers: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
331
+ managedIdentity: z.ZodOptional<z.ZodObject<{
332
+ slot: z.ZodString;
333
+ }, z.core.$strip>>;
334
+ grantedServiceId: z.ZodOptional<z.ZodString>;
335
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
336
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
337
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
338
+ }, z.core.$strip>>;
339
+ token: z.ZodLiteral<"anonymous">;
340
+ }, z.core.$strip>, z.ZodObject<{
341
+ managedIdentity: z.ZodOptional<z.ZodObject<{
342
+ slot: z.ZodString;
343
+ }, z.core.$strip>>;
344
+ grantedServiceId: z.ZodOptional<z.ZodString>;
345
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
346
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
347
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
348
+ }, z.core.$strip>>;
349
+ token: z.ZodLiteral<"static">;
350
+ value: z.ZodString;
351
+ }, z.core.$strip>, z.ZodObject<{
352
+ token: z.ZodLiteral<"bound">;
353
+ }, z.core.$strip>], "token">>>;
354
+ type: z.ZodLiteral<"websocket">;
355
+ host: z.ZodDefault<z.ZodString>;
356
+ port: z.ZodDefault<z.ZodNumber>;
357
+ path: z.ZodDefault<z.ZodString>;
358
+ healthPath: z.ZodDefault<z.ZodNullable<z.ZodString>>;
359
+ maxPayload: z.ZodDefault<z.ZodNumber>;
360
+ allowedOrigins: z.ZodDefault<z.ZodArray<z.ZodString>>;
361
+ }, z.core.$strip>, z.ZodObject<{
362
+ handlers: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
363
+ managedIdentity: z.ZodOptional<z.ZodObject<{
364
+ slot: z.ZodString;
365
+ }, z.core.$strip>>;
366
+ grantedServiceId: z.ZodOptional<z.ZodString>;
367
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
368
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
369
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
370
+ }, z.core.$strip>>;
371
+ token: z.ZodLiteral<"anonymous">;
372
+ }, z.core.$strip>, z.ZodObject<{
373
+ managedIdentity: z.ZodOptional<z.ZodObject<{
374
+ slot: z.ZodString;
375
+ }, z.core.$strip>>;
376
+ grantedServiceId: z.ZodOptional<z.ZodString>;
377
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
378
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
379
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
380
+ }, z.core.$strip>>;
381
+ token: z.ZodLiteral<"static">;
382
+ value: z.ZodString;
383
+ }, z.core.$strip>, z.ZodObject<{
384
+ token: z.ZodLiteral<"bound">;
385
+ }, z.core.$strip>], "token">>>;
386
+ type: z.ZodLiteral<"socket">;
387
+ path: z.ZodString;
388
+ }, z.core.$strip>], "type">>>;
389
+ endpoints: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
390
+ managedIdentity: z.ZodOptional<z.ZodObject<{
391
+ slot: z.ZodString;
392
+ }, z.core.$strip>>;
393
+ grantedServiceId: z.ZodOptional<z.ZodString>;
394
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
395
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
396
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
397
+ }, z.core.$strip>>;
398
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
399
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
400
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
401
+ kind: z.ZodLiteral<"uri">;
402
+ uri: z.ZodString;
403
+ token: z.ZodOptional<z.ZodString>;
404
+ }, z.core.$strip>, z.ZodObject<{
405
+ managedIdentity: z.ZodOptional<z.ZodObject<{
406
+ slot: z.ZodString;
407
+ }, z.core.$strip>>;
408
+ grantedServiceId: z.ZodOptional<z.ZodString>;
409
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
410
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
411
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
412
+ }, z.core.$strip>>;
413
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
414
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
415
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
416
+ kind: z.ZodLiteral<"ws">;
417
+ url: z.ZodString;
418
+ token: z.ZodOptional<z.ZodString>;
419
+ }, z.core.$strip>, z.ZodObject<{
420
+ managedIdentity: z.ZodOptional<z.ZodObject<{
421
+ slot: z.ZodString;
422
+ }, z.core.$strip>>;
423
+ grantedServiceId: z.ZodOptional<z.ZodString>;
424
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
425
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
426
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
427
+ }, z.core.$strip>>;
428
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
429
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
430
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
431
+ kind: z.ZodLiteral<"socket">;
432
+ path: z.ZodString;
433
+ token: z.ZodOptional<z.ZodString>;
434
+ }, z.core.$strip>, z.ZodObject<{
435
+ managedIdentity: z.ZodOptional<z.ZodObject<{
436
+ slot: z.ZodString;
437
+ }, z.core.$strip>>;
438
+ grantedServiceId: z.ZodOptional<z.ZodString>;
439
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
440
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
441
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
442
+ }, z.core.$strip>>;
443
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
444
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
445
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
446
+ cmd: z.ZodOptional<z.ZodString>;
447
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
448
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
449
+ cwd: z.ZodOptional<z.ZodString>;
450
+ kind: z.ZodLiteral<"cmd-env">;
451
+ }, z.core.$strip>, z.ZodObject<{
452
+ managedIdentity: z.ZodOptional<z.ZodObject<{
453
+ slot: z.ZodString;
454
+ }, z.core.$strip>>;
455
+ grantedServiceId: z.ZodOptional<z.ZodString>;
456
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
457
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
458
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
459
+ }, z.core.$strip>>;
460
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
461
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
462
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
463
+ cmd: z.ZodOptional<z.ZodString>;
464
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
465
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
466
+ cwd: z.ZodOptional<z.ZodString>;
467
+ kind: z.ZodLiteral<"cmd-stdio">;
468
+ }, z.core.$strip>], "kind">>>;
469
+ namedEndpoints: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodDiscriminatedUnion<[z.ZodObject<{
470
+ managedIdentity: z.ZodOptional<z.ZodObject<{
471
+ slot: z.ZodString;
472
+ }, z.core.$strip>>;
473
+ grantedServiceId: z.ZodOptional<z.ZodString>;
474
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
475
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
476
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
477
+ }, z.core.$strip>>;
478
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
479
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
480
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
481
+ kind: z.ZodLiteral<"uri">;
482
+ uri: z.ZodString;
483
+ token: z.ZodOptional<z.ZodString>;
484
+ }, z.core.$strip>, z.ZodObject<{
485
+ managedIdentity: z.ZodOptional<z.ZodObject<{
486
+ slot: z.ZodString;
487
+ }, z.core.$strip>>;
488
+ grantedServiceId: z.ZodOptional<z.ZodString>;
489
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
490
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
491
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
492
+ }, z.core.$strip>>;
493
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
494
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
495
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
496
+ kind: z.ZodLiteral<"ws">;
497
+ url: z.ZodString;
498
+ token: z.ZodOptional<z.ZodString>;
499
+ }, z.core.$strip>, z.ZodObject<{
500
+ managedIdentity: z.ZodOptional<z.ZodObject<{
501
+ slot: z.ZodString;
502
+ }, z.core.$strip>>;
503
+ grantedServiceId: z.ZodOptional<z.ZodString>;
504
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
505
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
506
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
507
+ }, z.core.$strip>>;
508
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
509
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
510
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
511
+ kind: z.ZodLiteral<"socket">;
512
+ path: z.ZodString;
513
+ token: z.ZodOptional<z.ZodString>;
514
+ }, z.core.$strip>, z.ZodObject<{
515
+ managedIdentity: z.ZodOptional<z.ZodObject<{
516
+ slot: z.ZodString;
517
+ }, z.core.$strip>>;
518
+ grantedServiceId: z.ZodOptional<z.ZodString>;
519
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
520
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
521
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
522
+ }, z.core.$strip>>;
523
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
524
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
525
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
526
+ cmd: z.ZodOptional<z.ZodString>;
527
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
528
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
529
+ cwd: z.ZodOptional<z.ZodString>;
530
+ kind: z.ZodLiteral<"cmd-env">;
531
+ }, z.core.$strip>, z.ZodObject<{
532
+ managedIdentity: z.ZodOptional<z.ZodObject<{
533
+ slot: z.ZodString;
534
+ }, z.core.$strip>>;
535
+ grantedServiceId: z.ZodOptional<z.ZodString>;
536
+ connectionTokenBinder: z.ZodOptional<z.ZodObject<{
537
+ identitySlotPrefix: z.ZodOptional<z.ZodString>;
538
+ serviceIdPrefix: z.ZodOptional<z.ZodString>;
539
+ }, z.core.$strip>>;
540
+ routeServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
541
+ claimServiceIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
542
+ defaultRoute: z.ZodDefault<z.ZodBoolean>;
543
+ cmd: z.ZodOptional<z.ZodString>;
544
+ argv: z.ZodOptional<z.ZodArray<z.ZodString>>;
545
+ env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
546
+ cwd: z.ZodOptional<z.ZodString>;
547
+ kind: z.ZodLiteral<"cmd-stdio">;
548
+ }, z.core.$strip>], "kind">>>;
549
+ forwardChecking: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
550
+ verifySignatures: z.ZodDefault<z.ZodBoolean>;
551
+ requireCapability: z.ZodDefault<z.ZodBoolean>;
552
+ }, z.core.$strip>]>>;
553
+ adminIdentitySlot: z.ZodDefault<z.ZodString>;
554
+ rootPrincipalIds: z.ZodDefault<z.ZodArray<z.ZodString>>;
555
+ consentApprover: z.ZodDefault<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
556
+ serviceId: z.ZodString;
557
+ }, z.core.$strip>]>>;
558
+ }, z.core.$strip>;
559
+ type HubConfig = z.infer<typeof HubConfigSchema>;
560
+ /** Parse + validate an in-memory config object. Throws `ZodError` on failure. */
561
+ declare function parseHubConfig(raw: unknown): HubConfig;
562
+ /** JSON-Schema for the config file (for `--print-schema` / editor tooling). */
563
+ declare function hubConfigJsonSchema(): unknown;
564
+ //#endregion
565
+ export { ProvisionConfig as _, ConsentApproverConfig as a, EndpointConfigSchema as c, HubConfig as d, HubConfigSchema as f, ParticipantConnectorConfigSchema as g, ParticipantConnectorConfig as h, ConnectionTokenBinderSchema as i, ForwardCheckingConfig as l, ListenerConfigSchema as m, ConnectionHandlerSchema as n, ConsentApproverSchema as o, ListenerConfig as p, ConnectionTokenBinderConfig as r, EndpointConfig as s, ConnectionHandlerConfig as t, ForwardCheckingSchema as u, hubConfigJsonSchema as v, parseHubConfig as y };
566
+ //# sourceMappingURL=config-BCvkg7jv.d.ts.map
@@ -0,0 +1,9 @@
1
+ import { d as HubConfig } from "./config-BCvkg7jv.js";
2
+ //#region src/configFile.d.ts
3
+ /** Read and validate a hub config file. */
4
+ declare function loadHubConfig(configPath: string): HubConfig;
5
+ /** The config JSON Schema, pretty-printed. */
6
+ declare function printHubConfigSchema(): string;
7
+ //#endregion
8
+ export { printHubConfigSchema as n, loadHubConfig as t };
9
+ //# sourceMappingURL=configFile-y6Phntqu.d.ts.map