@invokta/gateway 0.0.0-stage → 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.
- package/LICENSE +21 -0
- package/README.md +274 -2
- package/dist/access.d.ts +14 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +30 -0
- package/dist/access.js.map +1 -0
- package/dist/authentication.d.ts +49 -0
- package/dist/authentication.d.ts.map +1 -0
- package/dist/authentication.js +92 -0
- package/dist/authentication.js.map +1 -0
- package/dist/discovery.d.ts +81 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +471 -0
- package/dist/discovery.js.map +1 -0
- package/dist/engine-upstream.d.ts +34 -0
- package/dist/engine-upstream.d.ts.map +1 -0
- package/dist/engine-upstream.js +110 -0
- package/dist/engine-upstream.js.map +1 -0
- package/dist/gateway.d.ts +32 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +208 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/json-schema-contract.d.ts +37 -0
- package/dist/json-schema-contract.d.ts.map +1 -0
- package/dist/json-schema-contract.js +131 -0
- package/dist/json-schema-contract.js.map +1 -0
- package/dist/mcp-upstream.d.ts +121 -0
- package/dist/mcp-upstream.d.ts.map +1 -0
- package/dist/mcp-upstream.js +401 -0
- package/dist/mcp-upstream.js.map +1 -0
- package/dist/patterns.d.ts +19 -0
- package/dist/patterns.d.ts.map +1 -0
- package/dist/patterns.js +57 -0
- package/dist/patterns.js.map +1 -0
- package/dist/search-index.d.ts +24 -0
- package/dist/search-index.d.ts.map +1 -0
- package/dist/search-index.js +102 -0
- package/dist/search-index.js.map +1 -0
- package/dist/types.d.ts +120 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/upstream-registry.d.ts +5 -0
- package/dist/upstream-registry.d.ts.map +1 -0
- package/dist/upstream-registry.js +21 -0
- package/dist/upstream-registry.js.map +1 -0
- package/package.json +39 -4
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { CapabilityMap } from "@invokta/core";
|
|
2
|
+
import type { GatewayOptions, GatewayRoute, GatewayVisibility } from "./types.js";
|
|
3
|
+
export interface Gateway {
|
|
4
|
+
/**
|
|
5
|
+
* A plain capability map. Pass it to `createEngine`, optionally through
|
|
6
|
+
* `applyMiddleware` or next to engine-local capabilities, and serve that
|
|
7
|
+
* engine with any adapter.
|
|
8
|
+
*/
|
|
9
|
+
readonly capabilities: CapabilityMap;
|
|
10
|
+
/** Every published capability, its upstream, and the rule governing it. */
|
|
11
|
+
readonly routes: ReadonlyArray<GatewayRoute>;
|
|
12
|
+
/**
|
|
13
|
+
* Per-caller visibility derived from the rules, for the `visibility`
|
|
14
|
+
* option of the MCP and HTTP adapters. Capabilities the gateway did not
|
|
15
|
+
* create are hidden.
|
|
16
|
+
*/
|
|
17
|
+
readonly visibility: GatewayVisibility;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Builds the capability map of a gateway over explicitly configured
|
|
21
|
+
* upstreams.
|
|
22
|
+
*
|
|
23
|
+
* Authentication stays at the adapter boundary: the HTTP and MCP HTTP
|
|
24
|
+
* adapters run their `authenticate` hook before `engine.invoke`. The gateway
|
|
25
|
+
* adds authorization: every capability gets the access rule of the first
|
|
26
|
+
* matching gateway rule, or `defaultAccess`, which denies by default. The
|
|
27
|
+
* upstream still enforces its own access rule after the gateway allows.
|
|
28
|
+
*/
|
|
29
|
+
export declare function createGateway(options: GatewayOptions): Gateway;
|
|
30
|
+
/** Whether a value is a gateway returned by `createGateway`. */
|
|
31
|
+
export declare function isCreatedGateway(value: unknown): value is Gateway;
|
|
32
|
+
//# sourceMappingURL=gateway.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../src/gateway.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAGV,aAAa,EAGd,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAGV,cAAc,EACd,YAAY,EAGZ,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,QAAQ,CAAC,YAAY,EAAE,aAAa,CAAC;IACrC,2EAA2E;IAC3E,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,CAAC;IAC7C;;;;OAIG;IACH,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;CACxC;AAiBD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CA2G9D;AAID,gEAAgE;AAChE,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAEjE"}
|
package/dist/gateway.js
ADDED
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import { principalPredicate } from "./access.js";
|
|
2
|
+
import { compilePatterns } from "./patterns.js";
|
|
3
|
+
import { upstreamCapabilities } from "./upstream-registry.js";
|
|
4
|
+
/**
|
|
5
|
+
* Builds the capability map of a gateway over explicitly configured
|
|
6
|
+
* upstreams.
|
|
7
|
+
*
|
|
8
|
+
* Authentication stays at the adapter boundary: the HTTP and MCP HTTP
|
|
9
|
+
* adapters run their `authenticate` hook before `engine.invoke`. The gateway
|
|
10
|
+
* adds authorization: every capability gets the access rule of the first
|
|
11
|
+
* matching gateway rule, or `defaultAccess`, which denies by default. The
|
|
12
|
+
* upstream still enforces its own access rule after the gateway allows.
|
|
13
|
+
*/
|
|
14
|
+
export function createGateway(options) {
|
|
15
|
+
if (!Array.isArray(options.upstreams) || options.upstreams.length === 0) {
|
|
16
|
+
throw new TypeError("A gateway must configure at least one upstream.");
|
|
17
|
+
}
|
|
18
|
+
const onDecision = options.onDecision;
|
|
19
|
+
if (onDecision !== undefined && typeof onDecision !== "function") {
|
|
20
|
+
throw new TypeError("Gateway onDecision must be a function.");
|
|
21
|
+
}
|
|
22
|
+
const rules = compileRules(options.rules ?? []);
|
|
23
|
+
const defaultAccess = assertAccess(options.defaultAccess ?? "deny", "Gateway defaultAccess");
|
|
24
|
+
const defaultVisible = visibleFor(defaultAccess, undefined);
|
|
25
|
+
const entries = [];
|
|
26
|
+
const owners = new Map();
|
|
27
|
+
const names = new Set();
|
|
28
|
+
for (const upstream of options.upstreams) {
|
|
29
|
+
const capabilities = upstreamCapabilities(upstream);
|
|
30
|
+
if (names.has(upstream.name)) {
|
|
31
|
+
throw new TypeError(`Gateway upstream ${upstream.name} is configured twice.`);
|
|
32
|
+
}
|
|
33
|
+
names.add(upstream.name);
|
|
34
|
+
for (const capability of capabilities) {
|
|
35
|
+
const { capabilityId } = capability.route;
|
|
36
|
+
const owner = owners.get(capabilityId);
|
|
37
|
+
if (owner !== undefined) {
|
|
38
|
+
throw new TypeError(`Gateway capability ${capabilityId} is published by both ${owner} and ${upstream.name}.`);
|
|
39
|
+
}
|
|
40
|
+
owners.set(capabilityId, upstream.name);
|
|
41
|
+
entries.push(capability);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const usedRules = new Set();
|
|
45
|
+
const capabilities = {};
|
|
46
|
+
const routes = [];
|
|
47
|
+
const visibleById = new Map();
|
|
48
|
+
for (const entry of entries) {
|
|
49
|
+
const { capabilityId } = entry.route;
|
|
50
|
+
const rule = rules.find(({ patterns }) => patterns.some(({ matches }) => matches(capabilityId)));
|
|
51
|
+
if (rule !== undefined)
|
|
52
|
+
usedRules.add(rule);
|
|
53
|
+
const ruleName = rule?.name ?? "default";
|
|
54
|
+
const { route, ...contract } = entry;
|
|
55
|
+
// A data property, so an ID such as `__proto__` cannot reach the prototype.
|
|
56
|
+
Object.defineProperty(capabilities, capabilityId, {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
value: Object.freeze({
|
|
59
|
+
...contract,
|
|
60
|
+
access: toAccessRule(rule?.access ?? defaultAccess, route, ruleName, onDecision),
|
|
61
|
+
}),
|
|
62
|
+
});
|
|
63
|
+
routes.push(Object.freeze({ ...route, rule: ruleName }));
|
|
64
|
+
visibleById.set(capabilityId, {
|
|
65
|
+
visible: rule?.visible ?? defaultVisible,
|
|
66
|
+
route,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
for (const rule of rules) {
|
|
70
|
+
// Every pattern must select something, so a typo cannot silently drop
|
|
71
|
+
// part of a rule, such as one entry of a deny list.
|
|
72
|
+
for (const { pattern, matches } of rule.patterns) {
|
|
73
|
+
if (!entries.some(({ route }) => matches(route.capabilityId))) {
|
|
74
|
+
throw new TypeError(`Gateway rule ${rule.name} pattern ${pattern} matches no capability.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (!usedRules.has(rule)) {
|
|
78
|
+
throw new TypeError(`Gateway rule ${rule.name} is shadowed by earlier rules.`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const visibility = ({ principal, capabilityId }) => {
|
|
82
|
+
const bound = visibleById.get(capabilityId);
|
|
83
|
+
if (bound === undefined)
|
|
84
|
+
return false;
|
|
85
|
+
try {
|
|
86
|
+
return bound.visible(principal, bound.route) === true;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const gateway = Object.freeze({
|
|
93
|
+
capabilities: Object.freeze(capabilities),
|
|
94
|
+
routes: Object.freeze(routes),
|
|
95
|
+
visibility,
|
|
96
|
+
});
|
|
97
|
+
createdGateways.add(gateway);
|
|
98
|
+
return gateway;
|
|
99
|
+
}
|
|
100
|
+
const createdGateways = new WeakSet();
|
|
101
|
+
/** Whether a value is a gateway returned by `createGateway`. */
|
|
102
|
+
export function isCreatedGateway(value) {
|
|
103
|
+
return createdGateways.has(value);
|
|
104
|
+
}
|
|
105
|
+
/** The listing counterpart of an access value, which a listing can evaluate without input. */
|
|
106
|
+
function visibleFor(access, declared) {
|
|
107
|
+
if (declared !== undefined)
|
|
108
|
+
return declared;
|
|
109
|
+
switch (access) {
|
|
110
|
+
case "public":
|
|
111
|
+
return () => true;
|
|
112
|
+
case "authenticated":
|
|
113
|
+
return (principal) => principal !== null;
|
|
114
|
+
case "deny":
|
|
115
|
+
return () => false;
|
|
116
|
+
default:
|
|
117
|
+
return principalPredicate(access) ?? ((principal) => principal !== null);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function compileRules(rules) {
|
|
121
|
+
if (!Array.isArray(rules)) {
|
|
122
|
+
throw new TypeError("Gateway rules must be an array.");
|
|
123
|
+
}
|
|
124
|
+
const names = new Set();
|
|
125
|
+
return rules.map((rule, index) => {
|
|
126
|
+
const name = rule.name ?? `rules[${String(index)}]`;
|
|
127
|
+
if (typeof name !== "string" || name === "" || names.has(name)) {
|
|
128
|
+
throw new TypeError(`Gateway rule ${name} must have a unique name.`);
|
|
129
|
+
}
|
|
130
|
+
names.add(name);
|
|
131
|
+
if (rule.visible !== undefined && typeof rule.visible !== "function") {
|
|
132
|
+
throw new TypeError(`Gateway rule ${name} visible must be a function.`);
|
|
133
|
+
}
|
|
134
|
+
const access = assertAccess(rule.access, `Gateway rule ${name} access`);
|
|
135
|
+
return Object.freeze({
|
|
136
|
+
name,
|
|
137
|
+
patterns: compilePatterns(rule.match, `Gateway rule ${name} match`),
|
|
138
|
+
access,
|
|
139
|
+
visible: visibleFor(access, rule.visible),
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function assertAccess(access, label) {
|
|
144
|
+
if (access === "public" ||
|
|
145
|
+
access === "authenticated" ||
|
|
146
|
+
access === "deny" ||
|
|
147
|
+
typeof access === "function") {
|
|
148
|
+
return access;
|
|
149
|
+
}
|
|
150
|
+
throw new TypeError(`${label} must be public, authenticated, deny, or a function.`);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Converts a gateway access value into a core access function. Every decision
|
|
154
|
+
* is reported, and a throwing or rejecting function is a denial rather than an
|
|
155
|
+
* execution failure, so an unavailable policy dependency fails closed.
|
|
156
|
+
*/
|
|
157
|
+
function toAccessRule(access, route, rule, onDecision) {
|
|
158
|
+
return async ({ principal, input, context }) => {
|
|
159
|
+
let outcome;
|
|
160
|
+
try {
|
|
161
|
+
outcome = (await decide(access, principal, input, context, route))
|
|
162
|
+
? "allowed"
|
|
163
|
+
: "denied";
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
outcome = "failed";
|
|
167
|
+
context.logger.warn("Gateway access rule failed; access was denied.", {
|
|
168
|
+
requestId: context.requestId,
|
|
169
|
+
capabilityId: route.capabilityId,
|
|
170
|
+
rule,
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
report(onDecision, {
|
|
174
|
+
requestId: context.requestId,
|
|
175
|
+
capabilityId: route.capabilityId,
|
|
176
|
+
upstream: route.upstream,
|
|
177
|
+
rule,
|
|
178
|
+
outcome,
|
|
179
|
+
...(principal === null ? {} : { principalId: principal.id }),
|
|
180
|
+
});
|
|
181
|
+
return outcome === "allowed";
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
async function decide(access, principal, input, context, route) {
|
|
185
|
+
switch (access) {
|
|
186
|
+
case "public":
|
|
187
|
+
return true;
|
|
188
|
+
case "authenticated":
|
|
189
|
+
return principal !== null;
|
|
190
|
+
case "deny":
|
|
191
|
+
return false;
|
|
192
|
+
default:
|
|
193
|
+
return (await access({ principal, input, context, route })) === true;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
function report(onDecision, decision) {
|
|
197
|
+
if (onDecision === undefined)
|
|
198
|
+
return;
|
|
199
|
+
try {
|
|
200
|
+
const pending = onDecision(Object.freeze(decision));
|
|
201
|
+
if (pending instanceof Promise)
|
|
202
|
+
pending.catch(() => undefined);
|
|
203
|
+
}
|
|
204
|
+
catch {
|
|
205
|
+
// An audit sink cannot change an authorization decision.
|
|
206
|
+
}
|
|
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K,SAAS,CAAC;IAC/B,CAAC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,MAAM,CACnB,MAAqB,EACrB,SAA2B,EAC3B,KAAiB,EACjB,OAAyB,EACzB,KAA2B;IAE3B,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ;YACX,OAAO,IAAI,CAAC;QACd,KAAK,eAAe;YAClB,OAAO,SAAS,KAAK,IAAI,CAAC;QAC5B,KAAK,MAAM;YACT,OAAO,KAAK,CAAC;QACf;YACE,OAAO,CAAC,MAAM,MAAM,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;IACzE,CAAC;AACH,CAAC;AAED,SAAS,MAAM,CACb,UAAwC,EACxC,QAAyB;IAEzB,IAAI,UAAU,KAAK,SAAS;QAAE,OAAO;IACrC,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpD,IAAI,OAAO,YAAY,OAAO;YAAE,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC;IAAC,MAAM,CAAC;QACP,yDAAyD;IAC3D,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { type ApiKeyAuthenticatorOptions, type ApiKeyCredential, apiKeyAuthenticator, chainAuthenticators, type GatewayAuthenticationRequest, type GatewayAuthenticator, hashApiKey, } from "./authentication.js";
|
|
2
|
+
export { requireScopes } from "./access.js";
|
|
3
|
+
export { createDiscovery, type Discovery, type DiscoveryCandidate, type DiscoveryOptions, type DiscoveryRanker, type DiscoverySearchEvent, } from "./discovery.js";
|
|
4
|
+
export { type EngineUpstreamOptions, engineUpstream, } from "./engine-upstream.js";
|
|
5
|
+
export { createGateway, type Gateway } from "./gateway.js";
|
|
6
|
+
export type { JsonObject, JsonSchemaIssue, JsonSchemaValidator, } from "./json-schema-contract.js";
|
|
7
|
+
export { createSearchIndex, type SearchDocument, type SearchIndex, tokenize, } from "./search-index.js";
|
|
8
|
+
export { type GatewayMcpConnection, type GatewayMcpTool, type McpCatalogLock, McpCatalogLockError, type McpGatewayUpstream, type McpUpstreamOptions, mcpUpstream, } from "./mcp-upstream.js";
|
|
9
|
+
export type { GatewayAccess, GatewayAccessArgs, GatewayAccessFunction, GatewayDecision, GatewayOptions, GatewayRoute, GatewayRule, GatewayUpstream, GatewayUpstreamKind, GatewayUpstreamRoute, GatewayVisibility, } from "./types.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,gBAAgB,EACrB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,4BAA4B,EACjC,KAAK,oBAAoB,EACzB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,eAAe,EACf,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,KAAK,qBAAqB,EAC1B,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,KAAK,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3D,YAAY,EACV,UAAU,EACV,eAAe,EACf,mBAAmB,GACpB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,cAAc,EACnB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,WAAW,GACZ,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { apiKeyAuthenticator, chainAuthenticators, hashApiKey, } from "./authentication.js";
|
|
2
|
+
export { requireScopes } from "./access.js";
|
|
3
|
+
export { createDiscovery, } from "./discovery.js";
|
|
4
|
+
export { engineUpstream, } from "./engine-upstream.js";
|
|
5
|
+
export { createGateway } from "./gateway.js";
|
|
6
|
+
export { createSearchIndex, tokenize, } from "./search-index.js";
|
|
7
|
+
export { McpCatalogLockError, mcpUpstream, } from "./mcp-upstream.js";
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,EAGnB,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACL,eAAe,GAMhB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAM3D,OAAO,EACL,iBAAiB,EAGjB,QAAQ,GACT,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAIL,mBAAmB,EAGnB,WAAW,GACZ,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { EngineSchema } from "@invokta/core";
|
|
2
|
+
export type JsonObject = Readonly<Record<string, unknown>>;
|
|
3
|
+
/** One failed check reported by a JSON Schema validator. */
|
|
4
|
+
export interface JsonSchemaIssue {
|
|
5
|
+
readonly message: string;
|
|
6
|
+
readonly path?: ReadonlyArray<string | number>;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Validates a JSON value against a JSON Schema document, for example with
|
|
10
|
+
* Ajv. It is synchronous and returns the failed checks, or `undefined` or an
|
|
11
|
+
* empty list when the value is valid; a returned promise fails closed. The
|
|
12
|
+
* gateway passes the same frozen document object on every call, so a
|
|
13
|
+
* validator may compile it once and cache it by identity. It must not change
|
|
14
|
+
* the value, which is the caller's input. MCP schemas are chosen by the
|
|
15
|
+
* server: refuse asynchronous schemas and run `pattern` keywords on a
|
|
16
|
+
* linear-time regular expression engine.
|
|
17
|
+
*/
|
|
18
|
+
export type JsonSchemaValidator = (schema: JsonObject, value: JsonObject) => ReadonlyArray<JsonSchemaIssue> | undefined;
|
|
19
|
+
/**
|
|
20
|
+
* Wraps a JSON Schema document published by an upstream as an engine schema.
|
|
21
|
+
*
|
|
22
|
+
* The gateway republishes the document unchanged. It always checks that the
|
|
23
|
+
* value is a JSON object; with a `validator`, it also validates the value
|
|
24
|
+
* against the document, so invalid input fails as `INPUT_INVALID` before the
|
|
25
|
+
* upstream is called and an invalid result fails as `OUTPUT_INVALID`. A
|
|
26
|
+
* validator that throws or returns anything but a list or `undefined`,
|
|
27
|
+
* including a promise, fails closed. The core still enforces the lossless
|
|
28
|
+
* JSON data model on every value.
|
|
29
|
+
*/
|
|
30
|
+
export declare function jsonSchemaContract(document: JsonObject, validator?: JsonSchemaValidator): EngineSchema<JsonObject>;
|
|
31
|
+
export declare function isJsonObject(value: unknown): value is JsonObject;
|
|
32
|
+
/**
|
|
33
|
+
* A gateway-owned contract that validates its own input: `check` returns an
|
|
34
|
+
* issue message, or `undefined` when the object is valid.
|
|
35
|
+
*/
|
|
36
|
+
export declare function checkedContract(document: JsonObject, check: (value: JsonObject) => string | undefined): EngineSchema<JsonObject>;
|
|
37
|
+
//# sourceMappingURL=json-schema-contract.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-contract.d.ts","sourceRoot":"","sources":["../src/json-schema-contract.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAE3D,4DAA4D;AAC5D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,aAAa,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;CAChD;AAED;;;;;;;;;GASG;AACH,MAAM,MAAM,mBAAmB,GAAG,CAChC,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,UAAU,KACd,aAAa,CAAC,eAAe,CAAC,GAAG,SAAS,CAAC;AA6ChD;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,UAAU,EACpB,SAAS,CAAC,EAAE,mBAAmB,GAC9B,YAAY,CAAC,UAAU,CAAC,CAmC1B;AAmBD,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAUD;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,UAAU,EACpB,KAAK,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,MAAM,GAAG,SAAS,GAC/C,YAAY,CAAC,UAAU,CAAC,CAiB1B"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const notAnObjectIssues = Object.freeze([
|
|
2
|
+
Object.freeze({ message: "Expected a JSON object." }),
|
|
3
|
+
]);
|
|
4
|
+
const unvalidatedIssues = Object.freeze([
|
|
5
|
+
Object.freeze({ message: "The value could not be validated." }),
|
|
6
|
+
]);
|
|
7
|
+
const MAX_ISSUES = 100;
|
|
8
|
+
const MAX_ISSUE_MESSAGE_LENGTH = 512;
|
|
9
|
+
/** Copies at most 100 issues with bounded messages; anything else fails closed. */
|
|
10
|
+
function snapshotIssues(issues) {
|
|
11
|
+
if (issues === undefined)
|
|
12
|
+
return undefined;
|
|
13
|
+
// A promise or any other non-list cannot prove the value valid.
|
|
14
|
+
if (!Array.isArray(issues))
|
|
15
|
+
return unvalidatedIssues;
|
|
16
|
+
if (issues.length === 0)
|
|
17
|
+
return undefined;
|
|
18
|
+
return Object.freeze(issues.slice(0, MAX_ISSUES).map((issue) => {
|
|
19
|
+
const { message, path } = (issue ?? {});
|
|
20
|
+
const validPath = Array.isArray(path) &&
|
|
21
|
+
path.every((segment) => typeof segment === "string" ||
|
|
22
|
+
(typeof segment === "number" && Number.isInteger(segment)));
|
|
23
|
+
return Object.freeze({
|
|
24
|
+
message: typeof message === "string" && message !== ""
|
|
25
|
+
? message.slice(0, MAX_ISSUE_MESSAGE_LENGTH)
|
|
26
|
+
: "The value does not match the schema.",
|
|
27
|
+
...(validPath
|
|
28
|
+
? { path: Object.freeze([...path]) }
|
|
29
|
+
: {}),
|
|
30
|
+
});
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Wraps a JSON Schema document published by an upstream as an engine schema.
|
|
35
|
+
*
|
|
36
|
+
* The gateway republishes the document unchanged. It always checks that the
|
|
37
|
+
* value is a JSON object; with a `validator`, it also validates the value
|
|
38
|
+
* against the document, so invalid input fails as `INPUT_INVALID` before the
|
|
39
|
+
* upstream is called and an invalid result fails as `OUTPUT_INVALID`. A
|
|
40
|
+
* validator that throws or returns anything but a list or `undefined`,
|
|
41
|
+
* including a promise, fails closed. The core still enforces the lossless
|
|
42
|
+
* JSON data model on every value.
|
|
43
|
+
*/
|
|
44
|
+
export function jsonSchemaContract(document, validator) {
|
|
45
|
+
if (document.type !== "object") {
|
|
46
|
+
throw new TypeError("A gateway schema contract must have an object root.");
|
|
47
|
+
}
|
|
48
|
+
const snapshot = deepFreeze(structuredClone(document));
|
|
49
|
+
const converter = Object.freeze({
|
|
50
|
+
input: () => snapshot,
|
|
51
|
+
output: () => snapshot,
|
|
52
|
+
});
|
|
53
|
+
return Object.freeze({
|
|
54
|
+
"~standard": Object.freeze({
|
|
55
|
+
version: 1,
|
|
56
|
+
vendor: "invokta-gateway",
|
|
57
|
+
validate(value) {
|
|
58
|
+
if (!isJsonObject(value))
|
|
59
|
+
return { issues: notAnObjectIssues };
|
|
60
|
+
if (validator === undefined)
|
|
61
|
+
return { value };
|
|
62
|
+
let issues;
|
|
63
|
+
try {
|
|
64
|
+
const result = validator(snapshot, value);
|
|
65
|
+
if (isThenable(result)) {
|
|
66
|
+
// A promise cannot prove the value valid. Observe its rejection so
|
|
67
|
+
// it cannot surface as an unhandled rejection, then fail closed.
|
|
68
|
+
result.then(undefined, () => undefined);
|
|
69
|
+
issues = unvalidatedIssues;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
issues = snapshotIssues(result);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
issues = unvalidatedIssues;
|
|
77
|
+
}
|
|
78
|
+
return issues === undefined ? { value } : { issues };
|
|
79
|
+
},
|
|
80
|
+
jsonSchema: converter,
|
|
81
|
+
}),
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
function isThenable(value) {
|
|
85
|
+
if ((typeof value !== "object" && typeof value !== "function") ||
|
|
86
|
+
value === null) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
return typeof value.then === "function";
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
// A throwing `then` getter is not a usable promise; it still fails closed.
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export function isJsonObject(value) {
|
|
98
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
99
|
+
}
|
|
100
|
+
function deepFreeze(value) {
|
|
101
|
+
if (typeof value === "object" && value !== null && !Object.isFrozen(value)) {
|
|
102
|
+
for (const nested of Object.values(value))
|
|
103
|
+
deepFreeze(nested);
|
|
104
|
+
Object.freeze(value);
|
|
105
|
+
}
|
|
106
|
+
return value;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* A gateway-owned contract that validates its own input: `check` returns an
|
|
110
|
+
* issue message, or `undefined` when the object is valid.
|
|
111
|
+
*/
|
|
112
|
+
export function checkedContract(document, check) {
|
|
113
|
+
const published = jsonSchemaContract(document);
|
|
114
|
+
const standard = published["~standard"];
|
|
115
|
+
return Object.freeze({
|
|
116
|
+
"~standard": Object.freeze({
|
|
117
|
+
version: 1,
|
|
118
|
+
vendor: standard.vendor,
|
|
119
|
+
validate(value) {
|
|
120
|
+
if (!isJsonObject(value))
|
|
121
|
+
return { issues: notAnObjectIssues };
|
|
122
|
+
const issue = check(value);
|
|
123
|
+
return issue === undefined
|
|
124
|
+
? { value }
|
|
125
|
+
: { issues: Object.freeze([Object.freeze({ message: issue })]) };
|
|
126
|
+
},
|
|
127
|
+
jsonSchema: standard.jsonSchema,
|
|
128
|
+
}),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=json-schema-contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json-schema-contract.js","sourceRoot":"","sources":["../src/json-schema-contract.ts"],"names":[],"mappings":"AAyBA,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;CACtD,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,mCAAmC,EAAE,CAAC;CAChE,CAAC,CAAC;AACH,MAAM,UAAU,GAA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;YACzB,OAAO,EAAE,CAAU;YACnB,MAAM,EAAE,QAAQ,CAAC,MAAM;YACvB,QAAQ,CAAC,KAAc;gBACrB,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC;oBAAE,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,CAAC;gBAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC3B,OAAO,KAAK,KAAK,SAAS;oBACxB,CAAC,CAAC,EAAE,KAAK,EAAE;oBACX,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,CAAC;YACD,UAAU,EAAE,QAAQ,CAAC,UAAU;SAChC,CAAC;KACH,CAA6B,CAAC;AACjC,CAAC"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { type JsonObject, type JsonSchemaValidator } from "./json-schema-contract.js";
|
|
2
|
+
import type { GatewayUpstream } from "./types.js";
|
|
3
|
+
/** One tool as an MCP client lists it. `McpClientTool` from `@invokta/mcp` fits. */
|
|
4
|
+
export interface GatewayMcpTool {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly title?: string;
|
|
7
|
+
readonly description?: string;
|
|
8
|
+
readonly inputSchema: JsonObject;
|
|
9
|
+
readonly outputSchema?: JsonObject;
|
|
10
|
+
readonly annotations?: JsonObject;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The MCP client operations the gateway uses. The `McpClientConnection`
|
|
14
|
+
* returned by `connectMcpClient` from `@invokta/mcp` satisfies it, so the
|
|
15
|
+
* gateway does not depend on the MCP SDK.
|
|
16
|
+
*/
|
|
17
|
+
export interface GatewayMcpConnection {
|
|
18
|
+
listTools(cursor?: string, options?: {
|
|
19
|
+
readonly signal?: AbortSignal;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
readonly tools: ReadonlyArray<GatewayMcpTool>;
|
|
22
|
+
readonly nextCursor?: string;
|
|
23
|
+
}>;
|
|
24
|
+
callTool(name: string, argumentsValue?: JsonObject, options?: {
|
|
25
|
+
readonly signal?: AbortSignal;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
readonly response: JsonObject;
|
|
28
|
+
}>;
|
|
29
|
+
}
|
|
30
|
+
export interface McpUpstreamOptions {
|
|
31
|
+
/** Unique upstream name used in routes, decisions, and diagnostics. */
|
|
32
|
+
readonly name: string;
|
|
33
|
+
/** A connected MCP client. The host owns its credentials and lifetime. */
|
|
34
|
+
readonly connection: GatewayMcpConnection;
|
|
35
|
+
/** The gateway publishes `<namespace>.<tool name>`. Defaults to `name`. */
|
|
36
|
+
readonly namespace?: string;
|
|
37
|
+
/** Tool name patterns to publish. Defaults to every listed tool. */
|
|
38
|
+
readonly include?: ReadonlyArray<string>;
|
|
39
|
+
/** Finite timeout of every tool call. Defaults to 30,000 ms. */
|
|
40
|
+
readonly timeoutMs?: number;
|
|
41
|
+
/** Maximum listed tools before discovery fails. Defaults to 256. */
|
|
42
|
+
readonly maxTools?: number;
|
|
43
|
+
/** Expected catalog fingerprint; discovery fails when the catalog differs. */
|
|
44
|
+
readonly pin?: string;
|
|
45
|
+
/**
|
|
46
|
+
* A reviewed catalog lock, usually `upstream.lock` committed as JSON.
|
|
47
|
+
* Discovery fails with an `McpCatalogLockError` naming every added,
|
|
48
|
+
* removed, and changed tool.
|
|
49
|
+
*/
|
|
50
|
+
readonly lock?: McpCatalogLock;
|
|
51
|
+
/**
|
|
52
|
+
* Trust every annotation hint of this server. Defaults to `false`: an
|
|
53
|
+
* untrusted hint is republished only when it makes a tool look riskier,
|
|
54
|
+
* and it never makes a tool read-only.
|
|
55
|
+
*/
|
|
56
|
+
readonly trustAnnotations?: boolean;
|
|
57
|
+
/** Tool names the operator vouches are read-only, whatever their hints. */
|
|
58
|
+
readonly readOnlyTools?: ReadonlyArray<string>;
|
|
59
|
+
/**
|
|
60
|
+
* Required choice. A validator checks input and structured results against
|
|
61
|
+
* each tool's schemas, so invalid input fails as `INPUT_INVALID` before the
|
|
62
|
+
* call and gateway rules read validated input. `"delegate-to-upstream"`
|
|
63
|
+
* leaves validation to the MCP server: the gateway then checks only that
|
|
64
|
+
* values are JSON objects, rules read unvalidated input, and the server's
|
|
65
|
+
* rejection of invalid input is an `UPSTREAM_TOOL_ERROR`.
|
|
66
|
+
*/
|
|
67
|
+
readonly validator: JsonSchemaValidator | "delegate-to-upstream";
|
|
68
|
+
/**
|
|
69
|
+
* Forward the first text block of a tool error, at most 1,024 characters,
|
|
70
|
+
* as public `UPSTREAM_TOOL_ERROR` details. Defaults to `false`: upstream
|
|
71
|
+
* text may hold internal details, so it is never published unless the host
|
|
72
|
+
* trusts it.
|
|
73
|
+
*/
|
|
74
|
+
readonly forwardToolErrors?: boolean;
|
|
75
|
+
/** Deadline of the whole discovery. Defaults to 30,000 ms, at most 300,000. */
|
|
76
|
+
readonly discoveryTimeoutMs?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Maximum UTF-8 size of one published tool's canonical definition.
|
|
79
|
+
* Defaults to 65,536 bytes, at most 1,048,576.
|
|
80
|
+
*/
|
|
81
|
+
readonly maxToolBytes?: number;
|
|
82
|
+
/** Cancels catalog discovery. */
|
|
83
|
+
readonly signal?: AbortSignal;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* A reviewable record of a published MCP catalog: one SHA-256 digest of the
|
|
87
|
+
* canonical JSON of each tool (name, title, description, schemas, and
|
|
88
|
+
* annotations), keyed by tool name in sorted order.
|
|
89
|
+
*/
|
|
90
|
+
export interface McpCatalogLock {
|
|
91
|
+
readonly version: 1;
|
|
92
|
+
readonly upstream: string;
|
|
93
|
+
/** The catalog fingerprint, equal to the upstream's `fingerprint`. */
|
|
94
|
+
readonly fingerprint: string;
|
|
95
|
+
readonly tools: Readonly<Record<string, string>>;
|
|
96
|
+
}
|
|
97
|
+
/** The published catalog differs from its reviewed lock. */
|
|
98
|
+
export declare class McpCatalogLockError extends Error {
|
|
99
|
+
readonly upstream: string;
|
|
100
|
+
readonly added: ReadonlyArray<string>;
|
|
101
|
+
readonly removed: ReadonlyArray<string>;
|
|
102
|
+
readonly changed: ReadonlyArray<string>;
|
|
103
|
+
constructor(upstream: string, added: ReadonlyArray<string>, removed: ReadonlyArray<string>, changed: ReadonlyArray<string>);
|
|
104
|
+
}
|
|
105
|
+
export interface McpGatewayUpstream extends GatewayUpstream {
|
|
106
|
+
readonly kind: "mcp";
|
|
107
|
+
/** SHA-256 of the canonical JSON of the published tools, sorted by name. */
|
|
108
|
+
readonly fingerprint: string;
|
|
109
|
+
/** The lock of the published catalog, to review and commit as JSON. */
|
|
110
|
+
readonly lock: McpCatalogLock;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Publishes the tools of a connected MCP server through the gateway.
|
|
114
|
+
*
|
|
115
|
+
* Discovery runs once, at the composition root, with bounded pagination. The
|
|
116
|
+
* resulting catalog is frozen: the gateway never re-lists tools at runtime, so
|
|
117
|
+
* an upstream cannot add or change a published tool without a restart, and a
|
|
118
|
+
* configured `pin` turns any change into a startup failure.
|
|
119
|
+
*/
|
|
120
|
+
export declare function mcpUpstream(options: McpUpstreamOptions): Promise<McpGatewayUpstream>;
|
|
121
|
+
//# sourceMappingURL=mcp-upstream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-upstream.d.ts","sourceRoot":"","sources":["../src/mcp-upstream.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,mBAAmB,EAEzB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,eAAe,EAGhB,MAAM,YAAY,CAAC;AAGpB,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CA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