@invokta/gateway 0.0.0 → 0.10.0

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 (51) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +273 -1
  3. package/dist/access.d.ts +14 -0
  4. package/dist/access.d.ts.map +1 -0
  5. package/dist/access.js +30 -0
  6. package/dist/access.js.map +1 -0
  7. package/dist/authentication.d.ts +49 -0
  8. package/dist/authentication.d.ts.map +1 -0
  9. package/dist/authentication.js +92 -0
  10. package/dist/authentication.js.map +1 -0
  11. package/dist/discovery.d.ts +81 -0
  12. package/dist/discovery.d.ts.map +1 -0
  13. package/dist/discovery.js +471 -0
  14. package/dist/discovery.js.map +1 -0
  15. package/dist/engine-upstream.d.ts +34 -0
  16. package/dist/engine-upstream.d.ts.map +1 -0
  17. package/dist/engine-upstream.js +110 -0
  18. package/dist/engine-upstream.js.map +1 -0
  19. package/dist/gateway.d.ts +32 -0
  20. package/dist/gateway.d.ts.map +1 -0
  21. package/dist/gateway.js +208 -0
  22. package/dist/gateway.js.map +1 -0
  23. package/dist/index.d.ts +10 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +8 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/json-schema-contract.d.ts +37 -0
  28. package/dist/json-schema-contract.d.ts.map +1 -0
  29. package/dist/json-schema-contract.js +131 -0
  30. package/dist/json-schema-contract.js.map +1 -0
  31. package/dist/mcp-upstream.d.ts +121 -0
  32. package/dist/mcp-upstream.d.ts.map +1 -0
  33. package/dist/mcp-upstream.js +401 -0
  34. package/dist/mcp-upstream.js.map +1 -0
  35. package/dist/patterns.d.ts +19 -0
  36. package/dist/patterns.d.ts.map +1 -0
  37. package/dist/patterns.js +57 -0
  38. package/dist/patterns.js.map +1 -0
  39. package/dist/search-index.d.ts +24 -0
  40. package/dist/search-index.d.ts.map +1 -0
  41. package/dist/search-index.js +102 -0
  42. package/dist/search-index.js.map +1 -0
  43. package/dist/types.d.ts +120 -0
  44. package/dist/types.d.ts.map +1 -0
  45. package/dist/types.js +2 -0
  46. package/dist/types.js.map +1 -0
  47. package/dist/upstream-registry.d.ts +5 -0
  48. package/dist/upstream-registry.d.ts.map +1 -0
  49. package/dist/upstream-registry.js +21 -0
  50. package/dist/upstream-registry.js.map +1 -0
  51. package/package.json +37 -3
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Vini Lana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,275 @@
1
1
  # @invokta/gateway
2
2
 
3
- Placeholder for npm trusted publishing setup. Not a release; install a released version of @invokta/gateway.
3
+ Serve several Action Engines and MCP servers behind one endpoint that checks
4
+ the authentication and authorization rules you configure.
5
+
6
+ The gateway is not a new runtime. `createGateway` returns an ordinary
7
+ capability map: pass it to `createEngine` and serve that engine with
8
+ `@invokta/mcp`, `@invokta/http`, or `@invokta/cli`. Every call still goes
9
+ through `engine.invoke`.
10
+
11
+ ## Install
12
+
13
+ ```sh
14
+ npm install @invokta/core @invokta/gateway
15
+ ```
16
+
17
+ The package is native ESM and an optional runtime helper. Its only dependency
18
+ is `@invokta/core`; it depends on no adapter or MCP SDK, and its modules use
19
+ only ECMAScript and Web platform globals. It is tested on Node.js 22.20.0 or
20
+ later, the version its manifest declares.
21
+
22
+ ## Use
23
+
24
+ ```ts
25
+ import { createEngine } from "@invokta/core";
26
+ import { createJwtBearerAuthenticator } from "@invokta/auth-jwt";
27
+ import { connectMcpClient, serveMcpHttp } from "@invokta/mcp";
28
+ import {
29
+ apiKeyAuthenticator,
30
+ chainAuthenticators,
31
+ createGateway,
32
+ engineUpstream,
33
+ mcpUpstream,
34
+ requireScopes,
35
+ } from "@invokta/gateway";
36
+
37
+ const docs = await connectMcpClient({
38
+ transport: "http",
39
+ url: "https://docs.internal.example/mcp",
40
+ authentication: { type: "bearer", token: process.env.DOCS_SERVICE_TOKEN! },
41
+ });
42
+
43
+ const gateway = createGateway({
44
+ upstreams: [
45
+ engineUpstream({ name: "billing", engine: billingEngine }),
46
+ await mcpUpstream({
47
+ name: "docs",
48
+ namespace: "kb",
49
+ connection: docs,
50
+ validator, // or "delegate-to-upstream"; see Validation
51
+ }),
52
+ ],
53
+ rules: [
54
+ { name: "no-refunds", match: "billing.refund", access: "deny" },
55
+ { name: "billing-read", match: "billing.*", access: "authenticated" },
56
+ { name: "kb-read", match: "kb.*", access: requireScopes("kb:read") },
57
+ ],
58
+ onDecision: (decision) => console.error(JSON.stringify(decision)),
59
+ });
60
+
61
+ const engine = createEngine({
62
+ name: "acme-gateway",
63
+ version: "1.0.0",
64
+ capabilities: gateway.capabilities,
65
+ });
66
+
67
+ await serveMcpHttp(engine, {
68
+ auth: {
69
+ mode: "required",
70
+ authenticate: chainAuthenticators(
71
+ createJwtBearerAuthenticator({
72
+ issuer: "https://identity.example.com",
73
+ audience: "https://gateway.example.com/mcp",
74
+ algorithms: ["RS256"],
75
+ jwksUrl: "https://identity.example.com/.well-known/jwks.json",
76
+ }),
77
+ apiKeyAuthenticator({
78
+ keys: [
79
+ {
80
+ id: "support-agent",
81
+ // A digest printed once with hashApiKey; never the key itself.
82
+ sha256: process.env.SUPPORT_AGENT_KEY_SHA256!,
83
+ attributes: { scopes: ["kb:read"] },
84
+ },
85
+ ],
86
+ }),
87
+ ),
88
+ },
89
+ visibility: gateway.visibility,
90
+ });
91
+ ```
92
+
93
+ ## What it does
94
+
95
+ | Concern | Behavior |
96
+ | --- | --- |
97
+ | Engine upstream | Republishes the engine's contracts from `list` and `describe` and forwards to its `invoke`; the upstream's validation, access rule, timeout, progress, and events still apply |
98
+ | MCP upstream | Lists tools once at startup within bounds, publishes `<namespace>.<tool>`, and forwards to `callTool` with a finite timeout; `pin` and `lock` fail startup when the catalog changes |
99
+ | Validation | Every MCP upstream chooses a synchronous JSON Schema validator or `"delegate-to-upstream"` |
100
+ | Authentication | The adapter's `authenticate` hook; `chainAuthenticators` combines methods such as `@invokta/auth-jwt` and `apiKeyAuthenticator` |
101
+ | Authorization | First matching rule by capability ID (`id`, `prefix.*`, `*`); `deny` by default; a throwing rule denies |
102
+ | Audit | `onDecision` receives request ID, capability, upstream, rule, outcome, and principal ID; never payloads |
103
+ | Exposure | `include` per upstream; `gateway.routes` lists every published capability, its rule, and its trusted read-only status |
104
+ | Visibility | `gateway.visibility` for the adapters' `visibility` option: each caller lists and calls only what its rules can allow; hidden equals nonexistent |
105
+ | Annotation trust | Untrusted MCP hints only make a tool look riskier; `trustAnnotations` or `readOnlyTools` vouch for an upstream's tools |
106
+ | Discovery | `createDiscovery` publishes `search-tools`, `invoke-read-tool`, and `invoke-tool`, plus an optional `alwaysList`, whatever the catalog size |
107
+
108
+ ## Upstreams
109
+
110
+ `engineUpstream(options)` returns synchronously. `mcpUpstream(options)` lists
111
+ tools and returns a promise; await it before serving.
112
+
113
+ | `mcpUpstream` option | Default | Contract |
114
+ | --- | --- | --- |
115
+ | `name` | Required | 1-64 lowercase letters, digits, or inner hyphens; unique per gateway |
116
+ | `connection` | Required | `listTools` and `callTool`; `McpClientConnection` from `@invokta/mcp` fits |
117
+ | `validator` | Required | A `JsonSchemaValidator` or `"delegate-to-upstream"` |
118
+ | `namespace` | `name` | Prefix of the published IDs |
119
+ | `include` | Every tool | Tool name patterns; each must match a tool |
120
+ | `timeoutMs` | `30000` | Finite timeout of every tool call |
121
+ | `discoveryTimeoutMs` | `30000` | Deadline of the whole discovery, at most `300000` |
122
+ | `maxTools` | `256` | At most `4096`; discovery also reads at most 64 pages |
123
+ | `maxToolBytes` | `65536` | Canonical size of one tool definition, at most `1048576` |
124
+ | `pin` | None | Expected catalog fingerprint |
125
+ | `lock` | None | A reviewed `McpCatalogLock`; differences fail with `McpCatalogLockError` |
126
+ | `trustAnnotations` | `false` | Trust every annotation hint of this server |
127
+ | `readOnlyTools` | None | Tool names the operator vouches are read-only |
128
+ | `forwardToolErrors` | `false` | Publish the first 1,024 characters of a tool error's text |
129
+ | `signal` | None | Cancels discovery |
130
+
131
+ A tool name must have 1 to 128 characters from `A-Z`, `a-z`, `0-9`, `.`, `_`,
132
+ and `-`. A tool error is the declared domain error `UPSTREAM_TOOL_ERROR`. Its
133
+ upstream text may hold internal details, so it reaches callers only with
134
+ `forwardToolErrors: true`.
135
+
136
+ `engineUpstream` accepts `name`, `engine`, `namespace`, `include`, `principal`
137
+ (maps the gateway caller to the upstream principal), and `validator`. An
138
+ upstream `DOMAIN_ERROR` is raised again with the same code, and the upstream
139
+ `timeoutMs` is republished.
140
+
141
+ ## Validation
142
+
143
+ Every MCP upstream makes an explicit choice. A validator, such as Ajv, checks
144
+ input against the tool's input schema before the gateway rule and the call,
145
+ failing as `INPUT_INVALID`, and a structured result against the output schema,
146
+ failing as `OUTPUT_INVALID`:
147
+
148
+ ```ts
149
+ import { Ajv, type ValidateFunction } from "ajv";
150
+ import type { JsonSchemaValidator } from "@invokta/gateway";
151
+
152
+ const ajv = new Ajv({ strict: false });
153
+ const compiled = new WeakMap<object, ValidateFunction>();
154
+
155
+ export const validator: JsonSchemaValidator = (schema, value) => {
156
+ let validate = compiled.get(schema);
157
+ if (validate === undefined) {
158
+ validate = ajv.compile(schema);
159
+ // An upstream schema with "$async": true compiles to a validator that
160
+ // returns a promise, which is always truthy: refuse it.
161
+ if ("$async" in validate) {
162
+ throw new TypeError("Asynchronous schemas are not supported.");
163
+ }
164
+ compiled.set(schema, validate);
165
+ }
166
+ if (validate(value) === true) return undefined;
167
+ return (validate.errors ?? []).map((error) => ({
168
+ message: error.message ?? "Invalid value.",
169
+ path: error.instancePath.split("/").slice(1),
170
+ }));
171
+ };
172
+ ```
173
+
174
+ The validator is synchronous, and the gateway passes the same frozen schema on
175
+ every call so it can be compiled once. A validator that throws or returns
176
+ anything but a list or `undefined`, including a promise, fails closed.
177
+
178
+ MCP schemas are chosen by the upstream server, so treat them as untrusted
179
+ input to the validator:
180
+
181
+ - Refuse asynchronous schemas, as above; compare `validate(value)` with `true`.
182
+ - A `pattern` keyword runs a regular expression the server chose. Use Ajv's
183
+ `code: { regExp }` option with a linear-time engine such as RE2, or reject
184
+ schemas with patterns you have not reviewed; `lock` makes such a review
185
+ stick.
186
+ - Do not enable options that change the value, such as `useDefaults`,
187
+ `coerceTypes`, or `removeAdditional`. The gateway does not support mutating
188
+ validators: the value a validator receives is the caller's input.
189
+
190
+ `"delegate-to-upstream"` names the trade-off: the gateway checks only that
191
+ values are JSON objects, rules read unvalidated input, and the server's
192
+ rejection of invalid input is an `UPSTREAM_TOOL_ERROR`. Engine upstreams need
193
+ no validator, because the upstream `engine.invoke` validates; pass one to make
194
+ gateway rules read validated input.
195
+
196
+ ## Rules
197
+
198
+ A rule is `{ name?, match, access, visible? }`. `access` is `public`,
199
+ `authenticated`, `deny`, or a function of `{ principal, input, context, route }`
200
+ that allows only when it returns `true`. The first matching rule governs a
201
+ capability; unmatched capabilities get `defaultAccess`, `deny` by default.
202
+ Every pattern must match a capability and a rule shadowed by earlier rules
203
+ fails construction, so a typo cannot silently change policy.
204
+
205
+ An MCP upstream sees only the gateway's service credential, so every caller
206
+ the gateway allows acts with that credential's authority. Give the service
207
+ credential no more authority than the rules allow. Engine upstreams still
208
+ enforce their own access rules against the mapped principal.
209
+
210
+ ## Large catalogs
211
+
212
+ Filter the catalog per caller with the adapters' `visibility` option, as in
213
+ the example above. For clients that should not receive hundreds of tools,
214
+ serve search-based discovery as its own engine. Every invocation still goes
215
+ through the target's gateway rule:
216
+
217
+ ```ts
218
+ const discovery = createDiscovery({
219
+ gateway,
220
+ alwaysList: ["kb.docs_search"],
221
+ onSearch: (event) => audit.write(event),
222
+ });
223
+
224
+ // The full catalog, for clients that search tools on their own.
225
+ await serveMcpHttp(discovery.gatewayEngine, {
226
+ auth,
227
+ visibility: gateway.visibility,
228
+ });
229
+
230
+ // Three discovery tools plus alwaysList.
231
+ await serveMcpHttp(
232
+ createEngine({
233
+ name: "acme-gateway-discovery",
234
+ version: "1.0.0",
235
+ capabilities: discovery.capabilities,
236
+ }),
237
+ { port: 3001, path: "/search/mcp", auth, visibility: discovery.visibility },
238
+ );
239
+ ```
240
+
241
+ `search-tools` ranks with deterministic BM25 over the weighted ID, title, and
242
+ description, with diacritic and plural folding. It does not cross languages:
243
+ write descriptions and queries in the same language, or inject a `rank` port
244
+ for semantic search. A ranker can only reorder or drop visible tools, and a
245
+ ranker that fails or misses `rankTimeoutMs` (2,000 ms by default) falls back
246
+ to lexical search. Results stay within 64 KiB of structured content.
247
+
248
+ ## Limits
249
+
250
+ | Concern | Behavior |
251
+ | --- | --- |
252
+ | Catalog | Read once at startup; the gateway never re-lists tools |
253
+ | Dropped upstream connection | Calls fail until the host reconnects and restarts |
254
+ | Rich MCP content of a tool without an output schema | Returned as structured `{ content }` |
255
+ | Caller credentials | Never forwarded to an upstream |
256
+ | Rules | Match on the capability ID; anything else needs an access function |
257
+ | Search query | At most 256 characters; at most 20 results |
258
+
259
+ ## Examples
260
+
261
+ The repository has four runnable examples:
262
+
263
+ - `examples/gateway-engine`: two in-process engines and another team's MCP
264
+ server behind API-key and JWT authentication, first-match rules, per-caller
265
+ visibility, and audit.
266
+ - `examples/gateway-discovery-engine`: a vendor's 200-tool MCP server served
267
+ as a per-caller catalog and as search-based discovery, with a host-owned
268
+ Portuguese glossary ranker.
269
+ - `examples/gateway-jev-engine`: TypeSafe's Jev as the `rank` port, deciding
270
+ which visible tools a task needs.
271
+ - `examples/gateway-semantic-search-engine`: an embeddings index prepared at
272
+ startup as the `rank` port.
273
+
274
+ Read the [gateway reference](https://docs.invokta.dev/reference/gateway/) for
275
+ the full API.
@@ -0,0 +1,14 @@
1
+ import type { Principal } from "@invokta/core";
2
+ import type { GatewayAccessFunction } from "./types.js";
3
+ /**
4
+ * Returns the principal-only predicate of an access function built by this
5
+ * module, which the gateway uses as its visibility, or `undefined`.
6
+ */
7
+ export declare function principalPredicate(access: GatewayAccessFunction): ((principal: Principal | null) => boolean) | undefined;
8
+ /**
9
+ * An access function requiring every listed scope in
10
+ * `principal.attributes.scopes`, the attribute the default principal mapping
11
+ * of `@invokta/auth-jwt` fills from the `scope` claim.
12
+ */
13
+ export declare function requireScopes(...scopes: ReadonlyArray<string>): GatewayAccessFunction;
14
+ //# sourceMappingURL=access.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.d.ts","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAOxD;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,qBAAqB,GAC5B,CAAC,CAAC,SAAS,EAAE,SAAS,GAAG,IAAI,KAAK,OAAO,CAAC,GAAG,SAAS,CAExD;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAC3B,GAAG,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,GAC/B,qBAAqB,CAoBvB"}
package/dist/access.js ADDED
@@ -0,0 +1,30 @@
1
+ const principalOnly = new WeakMap();
2
+ /**
3
+ * Returns the principal-only predicate of an access function built by this
4
+ * module, which the gateway uses as its visibility, or `undefined`.
5
+ */
6
+ export function principalPredicate(access) {
7
+ return principalOnly.get(access);
8
+ }
9
+ /**
10
+ * An access function requiring every listed scope in
11
+ * `principal.attributes.scopes`, the attribute the default principal mapping
12
+ * of `@invokta/auth-jwt` fills from the `scope` claim.
13
+ */
14
+ export function requireScopes(...scopes) {
15
+ if (scopes.length === 0 ||
16
+ scopes.some((scope) => typeof scope !== "string" || scope === "")) {
17
+ throw new TypeError("requireScopes needs at least one non-empty scope.");
18
+ }
19
+ const required = Object.freeze([...scopes]);
20
+ const holdsScopes = (principal) => {
21
+ const granted = principal?.attributes?.scopes;
22
+ return (Array.isArray(granted) &&
23
+ required.every((scope) => granted.includes(scope)));
24
+ };
25
+ const access = ({ principal }) => holdsScopes(principal);
26
+ // The decision reads only the principal, so it is also the visibility.
27
+ principalOnly.set(access, holdsScopes);
28
+ return access;
29
+ }
30
+ //# sourceMappingURL=access.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"access.js","sourceRoot":"","sources":["../src/access.ts"],"names":[],"mappings":"AAIA,MAAM,aAAa,GAAG,IAAI,OAAO,EAG9B,CAAC;AAEJ;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAChC,MAA6B;IAE7B,OAAO,aAAa,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACnC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAC3B,GAAG,MAA6B;IAEhC,IACE,MAAM,CAAC,MAAM,KAAK,CAAC;QACnB,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,EACjE,CAAC;QACD,MAAM,IAAI,SAAS,CAAC,mDAAmD,CAAC,CAAC;IAC3E,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;IAC5C,MAAM,WAAW,GAAG,CAAC,SAA2B,EAAW,EAAE;QAC3D,MAAM,OAAO,GAAG,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC;QAC9C,OAAO,CACL,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;YACtB,QAAQ,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CACnD,CAAC;IACJ,CAAC,CAAC;IACF,MAAM,MAAM,GAA0B,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CACtD,WAAW,CAAC,SAAS,CAAC,CAAC;IACzB,uEAAuE;IACvE,aAAa,CAAC,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,49 @@
1
+ import type { Principal } from "@invokta/core";
2
+ /**
3
+ * The request an HTTP adapter passes to its `authenticate` hook. It is
4
+ * structurally identical to `HttpAuthenticationRequest` from `@invokta/http`
5
+ * and `McpHttpAuthenticationRequest` from `@invokta/mcp`.
6
+ */
7
+ export interface GatewayAuthenticationRequest {
8
+ readonly path: string;
9
+ readonly method: string;
10
+ readonly headers: {
11
+ readonly get: (name: string) => string | null;
12
+ readonly has: (name: string) => boolean;
13
+ };
14
+ readonly signal: AbortSignal;
15
+ }
16
+ /**
17
+ * An `authenticate` hook: a principal for valid credentials, `null` for
18
+ * missing or invalid credentials, and a thrown error for an infrastructure
19
+ * failure. `createJwtBearerAuthenticator` from `@invokta/auth-jwt` is one.
20
+ */
21
+ export type GatewayAuthenticator = (request: GatewayAuthenticationRequest) => Principal | null | Promise<Principal | null>;
22
+ /**
23
+ * Tries several authentication methods in order and returns the first
24
+ * principal. A method that throws stops the chain, so the adapter answers
25
+ * with its sanitized infrastructure failure instead of trying weaker methods.
26
+ */
27
+ export declare function chainAuthenticators(...authenticators: ReadonlyArray<GatewayAuthenticator>): GatewayAuthenticator;
28
+ /** One accepted API key, stored as the SHA-256 digest of the key. */
29
+ export interface ApiKeyCredential {
30
+ /** The principal ID of the key's holder. */
31
+ readonly id: string;
32
+ /** Lowercase hex SHA-256 of the key, for example from `hashApiKey`. */
33
+ readonly sha256: string;
34
+ readonly attributes?: Readonly<Record<string, unknown>>;
35
+ }
36
+ export interface ApiKeyAuthenticatorOptions {
37
+ /** The request header carrying the key. Defaults to `x-api-key`. */
38
+ readonly header?: string;
39
+ readonly keys: ReadonlyArray<ApiKeyCredential>;
40
+ }
41
+ /** Returns the lowercase hex SHA-256 digest of an API key. */
42
+ export declare function hashApiKey(key: string): Promise<string>;
43
+ /**
44
+ * Authenticates static API keys sent in one header. The configuration holds
45
+ * only digests; every presented key is hashed and compared against every
46
+ * configured digest without an early exit.
47
+ */
48
+ export declare function apiKeyAuthenticator(options: ApiKeyAuthenticatorOptions): GatewayAuthenticator;
49
+ //# sourceMappingURL=authentication.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;QAC9C,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;KACzC,CAAC;IACF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,MAAM,oBAAoB,GAAG,CACjC,OAAO,EAAE,4BAA4B,KAClC,SAAS,GAAG,IAAI,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;AAElD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,GAAG,cAAc,EAAE,aAAa,CAAC,oBAAoB,CAAC,GACrD,oBAAoB,CAqBtB;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CACzD;AAED,MAAM,WAAW,0BAA0B;IACzC,oEAAoE;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CAChD;AAMD,8DAA8D;AAC9D,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ7D;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,0BAA0B,GAClC,oBAAoB,CA0CtB"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Tries several authentication methods in order and returns the first
3
+ * principal. A method that throws stops the chain, so the adapter answers
4
+ * with its sanitized infrastructure failure instead of trying weaker methods.
5
+ */
6
+ export function chainAuthenticators(...authenticators) {
7
+ if (authenticators.length === 0) {
8
+ throw new TypeError("chainAuthenticators needs at least one authenticator.");
9
+ }
10
+ for (const authenticator of authenticators) {
11
+ if (typeof authenticator !== "function") {
12
+ throw new TypeError("Every authenticator must be a function.");
13
+ }
14
+ }
15
+ const chain = Object.freeze([...authenticators]);
16
+ return async (request) => {
17
+ for (const authenticate of chain) {
18
+ // A disconnected request stops before the next method runs.
19
+ if (request.signal.aborted)
20
+ throw request.signal.reason;
21
+ const principal = await authenticate(request);
22
+ if (principal !== null && principal !== undefined)
23
+ return principal;
24
+ }
25
+ return null;
26
+ };
27
+ }
28
+ const HEADER_NAME = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
29
+ const DIGEST = /^[0-9a-f]{64}$/u;
30
+ const MAXIMUM_KEY_LENGTH = 1_024;
31
+ /** Returns the lowercase hex SHA-256 digest of an API key. */
32
+ export async function hashApiKey(key) {
33
+ const digest = await globalThis.crypto.subtle.digest("SHA-256", new TextEncoder().encode(key));
34
+ return [...new Uint8Array(digest)]
35
+ .map((byte) => byte.toString(16).padStart(2, "0"))
36
+ .join("");
37
+ }
38
+ /**
39
+ * Authenticates static API keys sent in one header. The configuration holds
40
+ * only digests; every presented key is hashed and compared against every
41
+ * configured digest without an early exit.
42
+ */
43
+ export function apiKeyAuthenticator(options) {
44
+ const header = options.header ?? "x-api-key";
45
+ if (typeof header !== "string" || !HEADER_NAME.test(header)) {
46
+ throw new TypeError("apiKeyAuthenticator header must be a header name.");
47
+ }
48
+ if (!Array.isArray(options.keys) || options.keys.length === 0) {
49
+ throw new TypeError("apiKeyAuthenticator needs at least one key.");
50
+ }
51
+ const ids = new Set();
52
+ const keys = options.keys.map((key) => {
53
+ if (typeof key.id !== "string" || key.id === "" || ids.has(key.id)) {
54
+ throw new TypeError("Every API key needs a unique, non-empty id.");
55
+ }
56
+ if (typeof key.sha256 !== "string" || !DIGEST.test(key.sha256)) {
57
+ throw new TypeError(`API key ${key.id} sha256 must be a hex digest.`);
58
+ }
59
+ ids.add(key.id);
60
+ const principal = Object.freeze({
61
+ id: key.id,
62
+ ...(key.attributes === undefined
63
+ ? {}
64
+ : { attributes: Object.freeze(structuredClone(key.attributes)) }),
65
+ });
66
+ return Object.freeze({ digest: key.sha256, principal });
67
+ });
68
+ return async ({ headers }) => {
69
+ const presented = headers.get(header);
70
+ if (presented === null ||
71
+ presented === "" ||
72
+ presented.length > MAXIMUM_KEY_LENGTH) {
73
+ return null;
74
+ }
75
+ const digest = await hashApiKey(presented);
76
+ let match = null;
77
+ for (const key of keys) {
78
+ if (constantTimeEqual(digest, key.digest))
79
+ match = key.principal;
80
+ }
81
+ return match === null ? null : structuredClone(match);
82
+ };
83
+ }
84
+ function constantTimeEqual(left, right) {
85
+ let difference = left.length ^ right.length;
86
+ for (let index = 0; index < left.length; index += 1) {
87
+ difference |=
88
+ left.charCodeAt(index) ^ right.charCodeAt(index % right.length);
89
+ }
90
+ return difference === 0;
91
+ }
92
+ //# sourceMappingURL=authentication.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.js","sourceRoot":"","sources":["../src/authentication.ts"],"names":[],"mappings":"AA0BA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CACjC,GAAG,cAAmD;IAEtD,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,SAAS,CACjB,uDAAuD,CACxD,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,aAAa,IAAI,cAAc,EAAE,CAAC;QAC3C,IAAI,OAAO,aAAa,KAAK,UAAU,EAAE,CAAC;YACxC,MAAM,IAAI,SAAS,CAAC,yCAAyC,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC;IACjD,OAAO,KAAK,EAAE,OAAO,EAAE,EAAE;QACvB,KAAK,MAAM,YAAY,IAAI,KAAK,EAAE,CAAC;YACjC,4DAA4D;YAC5D,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO;gBAAE,MAAM,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC;YACxD,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,CAAC;YAC9C,IAAI,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,SAAS;gBAAE,OAAO,SAAS,CAAC;QACtE,CAA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GAAqB,IAAI,CAAC;QACnC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;gBAAE,KAAK,GAAG,GAAG,CAAC,SAAS,CAAC;QACnE,CAAC;QACD,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACxD,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,iBAAiB,CAAC,IAAY,EAAE,KAAa;IACpD,IAAI,UAAU,GAAG,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC5C,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,UAAU;YACR,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,UAAU,KAAK,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,81 @@
1
+ import { type CapabilityMiddleware, type CapabilityMap, type Engine, type EngineEvent, type EngineLogger } from "@invokta/core";
2
+ import { type Gateway } from "./gateway.js";
3
+ import type { GatewayVisibility } from "./types.js";
4
+ /** One visible capability as a host ranker receives it. */
5
+ export interface DiscoveryCandidate {
6
+ readonly id: string;
7
+ readonly title?: string;
8
+ readonly description: string;
9
+ }
10
+ /**
11
+ * A host-owned ranker, for example embedding search. It may reorder or drop
12
+ * candidates; IDs outside the candidates are ignored.
13
+ */
14
+ export type DiscoveryRanker = (query: string, candidates: ReadonlyArray<DiscoveryCandidate>, options: {
15
+ readonly signal: AbortSignal;
16
+ }) => Promise<ReadonlyArray<string>>;
17
+ /** One search, without the query text, which may contain sensitive data. */
18
+ export interface DiscoverySearchEvent {
19
+ readonly requestId: string;
20
+ readonly principalId?: string;
21
+ readonly resultCount: number;
22
+ readonly truncated: boolean;
23
+ readonly ranker: "lexical" | "custom" | "lexical-fallback";
24
+ }
25
+ export interface DiscoveryOptions {
26
+ readonly gateway: Gateway;
27
+ /** Prefix of the discovery capability IDs. Defaults to `gateway`. */
28
+ readonly prefix?: string;
29
+ /** Gateway capability patterns also published directly, at most 32. */
30
+ readonly alwaysList?: ReadonlyArray<string>;
31
+ /** Language the model should search in. Defaults to `English`. */
32
+ readonly queryLanguage?: string;
33
+ /**
34
+ * Replaces the default "a few keywords" instruction in the
35
+ * `search-tools` description, for rankers that understand whole tasks,
36
+ * such as embedding search or a decision model. 1-500 characters.
37
+ */
38
+ readonly queryGuidance?: string;
39
+ readonly rank?: DiscoveryRanker;
40
+ /** Ranker deadline before falling back to lexical search. Defaults to 2,000 ms. */
41
+ readonly rankTimeoutMs?: number;
42
+ /** Receives every search. Failures and returned promises are ignored. */
43
+ readonly onSearch?: (event: DiscoverySearchEvent) => void | Promise<void>;
44
+ /** Definition of the internal engine over `gateway.capabilities`. */
45
+ readonly gatewayEngine?: {
46
+ readonly name?: string;
47
+ readonly version?: string;
48
+ readonly logger?: EngineLogger;
49
+ readonly onEvent?: (event: EngineEvent) => void | Promise<void>;
50
+ /**
51
+ * Middleware applied to every gateway capability, for example a rate
52
+ * limit per target, so it runs for direct and discovered calls alike.
53
+ */
54
+ readonly middleware?: ReadonlyArray<CapabilityMiddleware>;
55
+ };
56
+ }
57
+ export interface Discovery {
58
+ /** The discovery tools plus `alwaysList`; serve them as their own engine. */
59
+ readonly capabilities: CapabilityMap;
60
+ /** The `visibility` option for the adapters serving `capabilities`. */
61
+ readonly visibility: GatewayVisibility;
62
+ /**
63
+ * The engine over `gateway.capabilities` that every invocation goes
64
+ * through. It may also serve the full catalog to clients that search
65
+ * tools on their own.
66
+ */
67
+ readonly gatewayEngine: Engine;
68
+ }
69
+ /**
70
+ * Builds search-based discovery over a gateway: a client sees
71
+ * `search-tools`, `invoke-read-tool`, and `invoke-tool` (plus `alwaysList`)
72
+ * whatever the catalog size.
73
+ *
74
+ * Every invocation goes through an engine built here from
75
+ * `gateway.capabilities`, so the target's gateway rule, upstream validation
76
+ * and access, timeout, events, and authorization decision apply exactly as
77
+ * for a direct call. Search and invocation only ever see capabilities that
78
+ * `gateway.visibility` shows to the caller.
79
+ */
80
+ export declare function createDiscovery(options: DiscoveryOptions): Discovery;
81
+ //# sourceMappingURL=discovery.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAGlB,KAAK,MAAM,EAEX,KAAK,WAAW,EAChB,KAAK,YAAY,EAGlB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAE,KAAK,OAAO,EAAoB,MAAM,cAAc,CAAC;AAS9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAGpD,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;GAGG;AACH,MAAM,MAAM,eAAe,GAAG,CAC5B,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,aAAa,CAAC,kBAAkB,CAAC,EAC7C,OAAO,EAAE;IAAE,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAA;CAAE,KACtC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AAEpC,4EAA4E;AAC5E,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;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