@zackbart/connecta 0.4.1 → 0.6.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/CHANGELOG.md +527 -0
- package/README.md +83 -7
- package/SECURITY.md +10 -6
- package/dist/activity.d.ts +8 -0
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js +1 -0
- package/dist/activity.js.map +1 -1
- package/dist/auth/bearer.d.ts +10 -3
- package/dist/auth/bearer.d.ts.map +1 -1
- package/dist/auth/bearer.js +21 -0
- package/dist/auth/bearer.js.map +1 -1
- package/dist/auth/clerk.d.ts +26 -1
- package/dist/auth/clerk.d.ts.map +1 -1
- package/dist/auth/clerk.js +161 -4
- package/dist/auth/clerk.js.map +1 -1
- package/dist/connectors/api.d.ts +13 -0
- package/dist/connectors/api.d.ts.map +1 -1
- package/dist/connectors/api.js +2 -0
- package/dist/connectors/api.js.map +1 -1
- package/dist/connectors/remote-mcp.d.ts +13 -0
- package/dist/connectors/remote-mcp.d.ts.map +1 -1
- package/dist/connectors/remote-mcp.js +10 -0
- package/dist/connectors/remote-mcp.js.map +1 -1
- package/dist/credential-health.d.ts +212 -0
- package/dist/credential-health.d.ts.map +1 -0
- package/dist/credential-health.js +535 -0
- package/dist/credential-health.js.map +1 -0
- package/dist/execute.d.ts +4 -4
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +16 -4
- package/dist/execute.js.map +1 -1
- package/dist/index.d.ts +77 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +112 -2
- package/dist/index.js.map +1 -1
- package/dist/meta-tools.d.ts +76 -7
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +328 -98
- package/dist/meta-tools.js.map +1 -1
- package/dist/registry.d.ts +245 -2
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +377 -27
- package/dist/registry.js.map +1 -1
- package/dist/server.d.ts +7 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +342 -27
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +53 -2
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +162 -2
- package/dist/skills.js.map +1 -1
- package/dist/timeout.d.ts +16 -0
- package/dist/timeout.d.ts.map +1 -0
- package/dist/timeout.js +38 -0
- package/dist/timeout.js.map +1 -0
- package/dist/toolkits.d.ts +138 -0
- package/dist/toolkits.d.ts.map +1 -0
- package/dist/toolkits.js +319 -0
- package/dist/toolkits.js.map +1 -0
- package/dist/types.d.ts +90 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +63 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +176 -11
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -2
- package/src/activity.ts +9 -0
- package/src/auth/bearer.ts +35 -1
- package/src/auth/clerk.ts +202 -5
- package/src/connectors/api.ts +15 -0
- package/src/connectors/remote-mcp.ts +24 -0
- package/src/credential-health.ts +736 -0
- package/src/execute.ts +32 -8
- package/src/index.ts +226 -2
- package/src/meta-tools.ts +397 -119
- package/src/registry.ts +540 -29
- package/src/server.ts +431 -25
- package/src/skills.ts +185 -2
- package/src/timeout.ts +49 -0
- package/src/toolkits.ts +450 -0
- package/src/types.ts +96 -2
- package/src/ui.ts +190 -11
- package/src/version.ts +1 -1
package/dist/toolkits.js
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
// Toolkits: named, operator-defined scoped views over one deployment's
|
|
2
|
+
// registry, selected per client connection with `?toolkit=<name>` on /mcp.
|
|
3
|
+
//
|
|
4
|
+
// A connecta deployment belongs to an ORG; a toolkit is the view a GROUP OF
|
|
5
|
+
// TEAM MEMBERS inside that org gets — a "support" toolkit seeing Zendesk and
|
|
6
|
+
// Notion, an "exec" toolkit that also sees Gmail. This module only *defines and
|
|
7
|
+
// validates* scopes and the identity bindings that gate them. Enforcement lives
|
|
8
|
+
// in two places, each with one job:
|
|
9
|
+
//
|
|
10
|
+
// - WHICH toolkit an identity may open: the connect-time binding check in
|
|
11
|
+
// `resolveToolkitScope` (src/server.ts), run after the auth gate and before
|
|
12
|
+
// any scoped registry exists.
|
|
13
|
+
// - WHAT a selected toolkit may see: `ScopedRegistry` (src/registry.ts),
|
|
14
|
+
// which every meta-tool inherits through `RegistryView`.
|
|
15
|
+
/** Toolkit names share the connector-id grammar: URL-safe, no separators. */
|
|
16
|
+
export const TOOLKIT_NAME_RE = /^[a-z0-9_-]+$/;
|
|
17
|
+
/**
|
|
18
|
+
* Split `"<connectorId>.<toolName>"` on the FIRST dot — connector ids contain
|
|
19
|
+
* no dots, so a downstream tool name may. Returns null for a malformed address.
|
|
20
|
+
*/
|
|
21
|
+
export function splitAddress(address) {
|
|
22
|
+
const dot = address.indexOf(".");
|
|
23
|
+
if (dot <= 0 || dot === address.length - 1)
|
|
24
|
+
return null;
|
|
25
|
+
return {
|
|
26
|
+
connectorId: address.slice(0, dot),
|
|
27
|
+
toolName: address.slice(dot + 1),
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
/** Group tool addresses by connector id, validating each against the toolkit. */
|
|
31
|
+
function toolFilter(name, addresses, connectorIds, staticTools, field) {
|
|
32
|
+
const byConnector = new Map();
|
|
33
|
+
if (addresses !== undefined && !Array.isArray(addresses)) {
|
|
34
|
+
// A bare string would otherwise iterate character by character and produce
|
|
35
|
+
// a stream of confusing address errors; anything else would throw "not
|
|
36
|
+
// iterable" from deep inside the loop. Name the field instead.
|
|
37
|
+
throw new Error(`Toolkit "${name}" ${field} must be an array of "<connectorId>.<toolName>" addresses.`);
|
|
38
|
+
}
|
|
39
|
+
if (addresses !== undefined &&
|
|
40
|
+
addresses.length === 0 &&
|
|
41
|
+
field === "includeTools") {
|
|
42
|
+
// An empty allowlist reads as "only these tools" but would behave as "all
|
|
43
|
+
// of them" — the one shape here that fails OPEN. (An empty excludeTools is
|
|
44
|
+
// an honest no-op and is allowed.)
|
|
45
|
+
throw new Error(`Toolkit "${name}" has an empty includeTools: remove it to expose every tool, or list the addresses this toolkit may use.`);
|
|
46
|
+
}
|
|
47
|
+
for (const address of addresses ?? []) {
|
|
48
|
+
const parts = splitAddress(address);
|
|
49
|
+
if (!parts) {
|
|
50
|
+
throw new Error(`Toolkit "${name}" ${field} entry "${address}" is not a tool address: expected "<connectorId>.<toolName>".`);
|
|
51
|
+
}
|
|
52
|
+
if (!connectorIds.has(parts.connectorId)) {
|
|
53
|
+
// A typo here would silently do nothing, quietly widening the scope the
|
|
54
|
+
// operator believes they wrote. Fail at construction instead.
|
|
55
|
+
throw new Error(`Toolkit "${name}" ${field} entry "${address}" names connector "${parts.connectorId}", which is not in this toolkit's connectors list.`);
|
|
56
|
+
}
|
|
57
|
+
// Static-only, exactly like the registry's convention checks: an in-code
|
|
58
|
+
// connector's tool list is known now, so a misspelled name — an exclude
|
|
59
|
+
// that silently excludes nothing — is caught. Remote catalogs are fetched
|
|
60
|
+
// lazily over the network and cannot be checked at construction.
|
|
61
|
+
const known = staticTools.get(parts.connectorId);
|
|
62
|
+
if (known && !known.has(parts.toolName)) {
|
|
63
|
+
throw new Error(`Toolkit "${name}" ${field} entry "${address}" names no tool on connector "${parts.connectorId}".`);
|
|
64
|
+
}
|
|
65
|
+
const tools = byConnector.get(parts.connectorId) ?? new Set();
|
|
66
|
+
tools.add(parts.toolName);
|
|
67
|
+
byConnector.set(parts.connectorId, tools);
|
|
68
|
+
}
|
|
69
|
+
return byConnector;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Validate one toolkit definition against the deployment's connectors.
|
|
73
|
+
*
|
|
74
|
+
* Structural mistakes THROW at construction rather than warn: a typo'd id in
|
|
75
|
+
* an allowlist is a scope the operator did not write, and a scope nobody wrote
|
|
76
|
+
* is not one an operator can reason about. (A definition scopes visibility only;
|
|
77
|
+
* WHICH identity may select it is the separate binding below — see the module
|
|
78
|
+
* header and documentation.md §16.) Tool names are checked only for connectors that expose
|
|
79
|
+
* `staticTools` (i.e. `api()`); a remote connector's catalog is fetched lazily
|
|
80
|
+
* over the network and is unknown at construction time.
|
|
81
|
+
*/
|
|
82
|
+
function resolveToolkit(name, definition, known, staticTools) {
|
|
83
|
+
if (!TOOLKIT_NAME_RE.test(name)) {
|
|
84
|
+
throw new Error(`Invalid toolkit name "${name}": must match ${TOOLKIT_NAME_RE.source}`);
|
|
85
|
+
}
|
|
86
|
+
if (!Array.isArray(definition.connectors) ||
|
|
87
|
+
definition.connectors.length === 0) {
|
|
88
|
+
throw new Error(`Toolkit "${name}" selects no connectors: list at least one connector id in "connectors".`);
|
|
89
|
+
}
|
|
90
|
+
const connectorIds = new Set();
|
|
91
|
+
for (const id of definition.connectors) {
|
|
92
|
+
if (!known.has(id)) {
|
|
93
|
+
throw new Error(`Toolkit "${name}" references unknown connector "${id}".`);
|
|
94
|
+
}
|
|
95
|
+
connectorIds.add(id);
|
|
96
|
+
}
|
|
97
|
+
const includes = toolFilter(name, definition.includeTools, connectorIds, staticTools, "includeTools");
|
|
98
|
+
const excludes = toolFilter(name, definition.excludeTools, connectorIds, staticTools, "excludeTools");
|
|
99
|
+
return {
|
|
100
|
+
name,
|
|
101
|
+
...(definition.description ? { description: definition.description } : {}),
|
|
102
|
+
hasConnector: (connectorId) => connectorIds.has(connectorId),
|
|
103
|
+
hasTool: (connectorId, toolName) => {
|
|
104
|
+
if (!connectorIds.has(connectorId))
|
|
105
|
+
return false;
|
|
106
|
+
const include = includes.get(connectorId);
|
|
107
|
+
if (include && !include.has(toolName))
|
|
108
|
+
return false;
|
|
109
|
+
return !excludes.get(connectorId)?.has(toolName);
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Validate every declared toolkit against the connector set. Returns undefined
|
|
115
|
+
* when no toolkits are configured, so an existing deployment keeps exactly its
|
|
116
|
+
* current (unscoped) behavior.
|
|
117
|
+
*/
|
|
118
|
+
export function resolveToolkits(toolkits, connectors) {
|
|
119
|
+
if (!toolkits)
|
|
120
|
+
return undefined;
|
|
121
|
+
// Object.entries (not a keyed lookup) so no config key — `__proto__` and
|
|
122
|
+
// friends included — can ever resolve through the prototype chain. Names are
|
|
123
|
+
// then held in a Map, which has no prototype to pollute.
|
|
124
|
+
const entries = Object.entries(toolkits);
|
|
125
|
+
if (entries.length === 0)
|
|
126
|
+
return undefined;
|
|
127
|
+
const known = new Set(connectors.map((connector) => connector.id));
|
|
128
|
+
const staticTools = new Map();
|
|
129
|
+
for (const connector of connectors) {
|
|
130
|
+
if (connector.staticTools) {
|
|
131
|
+
staticTools.set(connector.id, new Set(connector.staticTools.map((tool) => tool.name)));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const resolved = new Map();
|
|
135
|
+
for (const [name, definition] of entries) {
|
|
136
|
+
resolved.set(name, resolveToolkit(name, definition, known, staticTools));
|
|
137
|
+
}
|
|
138
|
+
return resolved;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Validate one adapter's binding options into a `ToolkitBinding`, or undefined
|
|
142
|
+
* when the adapter declares none. Structural mistakes THROW where the operator
|
|
143
|
+
* wrote them (adapter construction), for the same reason toolkit definitions do:
|
|
144
|
+
* a binding that does not say what its author meant is worse than none, because
|
|
145
|
+
* it is invisible until the day it denies — or admits — the wrong caller.
|
|
146
|
+
*
|
|
147
|
+
* Names are only checked against the *grammar* here; cross-checking them
|
|
148
|
+
* against the configured toolkits happens in `validateToolkitBindings`, which
|
|
149
|
+
* runs in `createConnecta` where both halves are finally in scope.
|
|
150
|
+
*/
|
|
151
|
+
export function resolveToolkitBinding(source, options) {
|
|
152
|
+
const { toolkits, unscoped } = options;
|
|
153
|
+
if (toolkits === undefined) {
|
|
154
|
+
if (unscoped !== undefined) {
|
|
155
|
+
// `unscoped` alone reads like a permission but grants nothing an unbound
|
|
156
|
+
// identity does not already have, so it is almost certainly a half-written
|
|
157
|
+
// binding — the one shape here that would silently fail OPEN.
|
|
158
|
+
throw new Error(`${source}: \`unscoped\` only means something beside \`toolkits\`. ` +
|
|
159
|
+
"List the toolkits this credential may open, or drop `unscoped` to " +
|
|
160
|
+
"leave the credential unbound.");
|
|
161
|
+
}
|
|
162
|
+
return undefined;
|
|
163
|
+
}
|
|
164
|
+
if (!Array.isArray(toolkits)) {
|
|
165
|
+
throw new Error(`${source}: \`toolkits\` must be an array of toolkit names.`);
|
|
166
|
+
}
|
|
167
|
+
const names = [];
|
|
168
|
+
for (const name of toolkits) {
|
|
169
|
+
if (typeof name !== "string" || !TOOLKIT_NAME_RE.test(name)) {
|
|
170
|
+
// A name outside the grammar can never match a declared toolkit, so this
|
|
171
|
+
// would bind the credential to nothing selectable.
|
|
172
|
+
throw new Error(`${source}: \`toolkits\` entry ${JSON.stringify(name)} is not a ` +
|
|
173
|
+
`toolkit name (must match ${TOOLKIT_NAME_RE.source}).`);
|
|
174
|
+
}
|
|
175
|
+
if (!names.includes(name))
|
|
176
|
+
names.push(name);
|
|
177
|
+
}
|
|
178
|
+
if (names.length === 0 && unscoped !== true) {
|
|
179
|
+
throw new Error(`${source}: binds no toolkits and no unscoped access, so this credential ` +
|
|
180
|
+
"could authenticate but never connect. List at least one toolkit, or " +
|
|
181
|
+
"pass `unscoped: true` to bind it to the full registry only.");
|
|
182
|
+
}
|
|
183
|
+
return Object.freeze({
|
|
184
|
+
toolkits: Object.freeze(names),
|
|
185
|
+
...(unscoped === true ? { unscoped: true } : {}),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Coerce an arbitrary value into a `ToolkitBinding`, or null when it is not one.
|
|
190
|
+
*
|
|
191
|
+
* The shipped adapters build bindings through `resolveToolkitBinding` above, but
|
|
192
|
+
* `InboundAuth` is an open interface and `AuthResult.toolkitBinding` arrives at
|
|
193
|
+
* REQUEST time from code connecta does not own — a custom adapter, or one
|
|
194
|
+
* mapping an IdP claim. Every field is therefore re-checked here rather than
|
|
195
|
+
* trusted from the type, because each way of being wrong fails OPEN if it is
|
|
196
|
+
* merely believed:
|
|
197
|
+
*
|
|
198
|
+
* - `unscoped` is compared to `true` by identity, so a truthy non-boolean (the
|
|
199
|
+
* string `"false"` out of an env var, say) cannot grant the full registry;
|
|
200
|
+
* - `toolkits` must be a real array — a bare string would otherwise reach
|
|
201
|
+
* `String.prototype.includes`, where `?toolkit=sup` would "match" `"support"`
|
|
202
|
+
* by substring;
|
|
203
|
+
* - a missing/!array `toolkits` is not treated as an empty binding, because the
|
|
204
|
+
* caller of a null return refuses the request outright.
|
|
205
|
+
*
|
|
206
|
+
* Returns a frozen, deduplicated copy: nothing downstream can be mutated by the
|
|
207
|
+
* adapter after the check, and every name is known to fit the grammar.
|
|
208
|
+
*/
|
|
209
|
+
export function normalizeToolkitBinding(value) {
|
|
210
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
const { toolkits, unscoped } = value;
|
|
214
|
+
if (!Array.isArray(toolkits))
|
|
215
|
+
return null;
|
|
216
|
+
if (unscoped !== undefined && typeof unscoped !== "boolean")
|
|
217
|
+
return null;
|
|
218
|
+
const names = [];
|
|
219
|
+
for (const name of toolkits) {
|
|
220
|
+
if (typeof name !== "string" || !TOOLKIT_NAME_RE.test(name))
|
|
221
|
+
return null;
|
|
222
|
+
if (!names.includes(name))
|
|
223
|
+
names.push(name);
|
|
224
|
+
}
|
|
225
|
+
return Object.freeze({
|
|
226
|
+
toolkits: Object.freeze(names),
|
|
227
|
+
...(unscoped === true ? { unscoped: true } : {}),
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Resolve the binding one admitted identity is actually held to, from the
|
|
232
|
+
* provider's static declaration and whatever its `authorize` returned.
|
|
233
|
+
*
|
|
234
|
+
* - Neither ⇒ unbound (undefined), the pre-binding behavior.
|
|
235
|
+
* - Declaration only ⇒ the declaration.
|
|
236
|
+
* - Per-identity only ⇒ that binding, validated. This is the custom-adapter
|
|
237
|
+
* seam: a provider that declares nothing is asserting it resolves membership
|
|
238
|
+
* itself, so there is nothing to check it against.
|
|
239
|
+
* - Both ⇒ the **intersection**. The declaration is a CEILING, not a default: an
|
|
240
|
+
* adapter that maps a user-writable IdP claim to toolkits must not be able to
|
|
241
|
+
* widen the credential's own binding, which would turn "support token" into
|
|
242
|
+
* "any toolkit, plus the full registry" for anyone who can set that claim.
|
|
243
|
+
* Narrowing is fine and useful (per-user subsets of the team's view).
|
|
244
|
+
*
|
|
245
|
+
* A malformed binding on either side is not silently ignored — it returns
|
|
246
|
+
* `{ ok: false }` and the caller refuses the request, because the alternative
|
|
247
|
+
* (dropping it) is the fail-open reading.
|
|
248
|
+
*/
|
|
249
|
+
export function resolveIdentityBinding(declared, perIdentity) {
|
|
250
|
+
const ceiling = declared === undefined ? undefined : normalizeToolkitBinding(declared);
|
|
251
|
+
if (declared !== undefined && !ceiling) {
|
|
252
|
+
return {
|
|
253
|
+
ok: false,
|
|
254
|
+
reason: "the toolkit binding declared on the provider is malformed " +
|
|
255
|
+
"(`toolkits` must be an array of toolkit names, `unscoped` a boolean)",
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
if (perIdentity === undefined) {
|
|
259
|
+
return ceiling ? { ok: true, binding: ceiling } : { ok: true };
|
|
260
|
+
}
|
|
261
|
+
const identity = normalizeToolkitBinding(perIdentity);
|
|
262
|
+
if (!identity) {
|
|
263
|
+
return {
|
|
264
|
+
ok: false,
|
|
265
|
+
reason: "the toolkit binding its authorize() returned for this identity is " +
|
|
266
|
+
"malformed (`toolkits` must be an array of toolkit names, `unscoped` " +
|
|
267
|
+
"a boolean)",
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
if (!ceiling)
|
|
271
|
+
return { ok: true, binding: identity };
|
|
272
|
+
return {
|
|
273
|
+
ok: true,
|
|
274
|
+
binding: Object.freeze({
|
|
275
|
+
toolkits: Object.freeze(identity.toolkits.filter((name) => ceiling.toolkits.includes(name))),
|
|
276
|
+
...(identity.unscoped === true && ceiling.unscoped === true
|
|
277
|
+
? { unscoped: true }
|
|
278
|
+
: {}),
|
|
279
|
+
}),
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Cross-check every statically declared binding against the deployment's
|
|
284
|
+
* toolkits, in `createConnecta`. A name that no toolkit declares is a typo, and
|
|
285
|
+
* a typo here fails CLOSED — the credential would be refused every connection
|
|
286
|
+
* with a 403 the client reads as a transport failure — so it throws at
|
|
287
|
+
* construction rather than becoming a support ticket. A structurally malformed
|
|
288
|
+
* declaration (only reachable from a hand-written `InboundAuth`, since the
|
|
289
|
+
* shipped adapters validate their own options) throws here too, rather than
|
|
290
|
+
* waiting to refuse every request at runtime.
|
|
291
|
+
*
|
|
292
|
+
* Bindings a provider mints per-identity (`AuthResult.toolkitBinding`) do not
|
|
293
|
+
* exist yet and cannot be checked here; they are validated on arrival and capped
|
|
294
|
+
* by the declaration (`resolveIdentityBinding`).
|
|
295
|
+
*/
|
|
296
|
+
export function validateToolkitBindings(auth, toolkits) {
|
|
297
|
+
for (const provider of auth) {
|
|
298
|
+
if (provider.toolkitBinding === undefined)
|
|
299
|
+
continue;
|
|
300
|
+
const binding = normalizeToolkitBinding(provider.toolkitBinding);
|
|
301
|
+
if (!binding) {
|
|
302
|
+
throw new Error(`Inbound auth provider "${provider.kind}" declares a malformed ` +
|
|
303
|
+
"toolkitBinding: `toolkits` must be an array of toolkit names " +
|
|
304
|
+
`(matching ${TOOLKIT_NAME_RE.source}) and \`unscoped\` a boolean.`);
|
|
305
|
+
}
|
|
306
|
+
if (!toolkits || toolkits.size === 0) {
|
|
307
|
+
throw new Error(`Inbound auth provider "${provider.kind}" binds toolkits ` +
|
|
308
|
+
`(${binding.toolkits.join(", ")}) but this deployment configures no ` +
|
|
309
|
+
"toolkits. Declare them in `toolkits`, or drop the binding.");
|
|
310
|
+
}
|
|
311
|
+
for (const name of binding.toolkits) {
|
|
312
|
+
if (!toolkits.has(name)) {
|
|
313
|
+
throw new Error(`Inbound auth provider "${provider.kind}" binds unknown toolkit ` +
|
|
314
|
+
`"${name}". Configured toolkits: ${[...toolkits.keys()].join(", ")}.`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=toolkits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toolkits.js","sourceRoot":"","sources":["../src/toolkits.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,gFAAgF;AAChF,gFAAgF;AAChF,oCAAoC;AACpC,EAAE;AACF,4EAA4E;AAC5E,gFAAgF;AAChF,kCAAkC;AAClC,2EAA2E;AAC3E,6DAA6D;AAI7D,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,eAAe,CAAC;AA+B/C;;;GAGG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAe;IAEf,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACjC,IAAI,GAAG,IAAI,CAAC,IAAI,GAAG,KAAK,OAAO,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IACxD,OAAO;QACL,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAClC,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;KACjC,CAAC;AACJ,CAAC;AAED,iFAAiF;AACjF,SAAS,UAAU,CACjB,IAAY,EACZ,SAA+B,EAC/B,YAAiC,EACjC,WAAqD,EACrD,KAAsC;IAEtC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAuB,CAAC;IACnD,IAAI,SAAS,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,2EAA2E;QAC3E,uEAAuE;QACvE,+DAA+D;QA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OAAO,CAAC,QAAQ,EAAE,CAAC;YACpC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;gBACxB,MAAM,IAAI,KAAK,CACb,0BAA0B,QAAQ,CAAC,IAAI,0BAA0B;oBAC/D,IAAI,IAAI,2BAA2B,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CACxE,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -118,12 +118,42 @@ export interface Connector {
|
|
|
118
118
|
/** How call_tool wraps results. "mcp" passes the content array through; anything else is JSON-wrapped. */
|
|
119
119
|
kind?: "mcp" | "api";
|
|
120
120
|
description?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Max inline result size (bytes) for this connector's tools before
|
|
123
|
+
* call_tool/batch_call truncate and stash the full text for get_result
|
|
124
|
+
* paging. Overrides the deployment-wide `ConnectaConfig.maxResultBytes`;
|
|
125
|
+
* omit to inherit it (which itself defaults to 50_000). Must be a whole
|
|
126
|
+
* number of bytes >= 1; anything else warns at startup and is ignored, so
|
|
127
|
+
* the connector inherits the deployment-wide cap.
|
|
128
|
+
*/
|
|
129
|
+
maxResultBytes?: number;
|
|
130
|
+
/**
|
|
131
|
+
* Optional agent-facing usage guide (markdown) for this connector — preferred
|
|
132
|
+
* tools, address quirks, pagination conventions, rate-limit etiquette, good
|
|
133
|
+
* query patterns. Listed by the `skills` meta-tool as `connector:<id>` and
|
|
134
|
+
* returned verbatim by `skills({ name: "connector:<id>" })`. Keep it concise
|
|
135
|
+
* and imperative; it is read by agents, not operators.
|
|
136
|
+
*/
|
|
137
|
+
usageGuide?: string;
|
|
121
138
|
/** Optional operator-managed credential slot rendered inside this connector's /ui card. */
|
|
122
139
|
credential?: ConnectorCredentialConfig;
|
|
123
140
|
/** Optional server-side check used by /ui's Test action. */
|
|
124
141
|
testCredential?(value: string, ctx: ConnectorContext): Promise<CredentialTestResult>;
|
|
125
142
|
/** Optional multi-field credential check used by /ui's Test action. */
|
|
126
143
|
testCredentials?(values: ConnectorCredentialValues, ctx: ConnectorContext): Promise<CredentialTestResult>;
|
|
144
|
+
/**
|
|
145
|
+
* Optional: whether this connector currently holds a stored downstream
|
|
146
|
+
* credential — an OAuth grant it persisted, typically. Read only by the
|
|
147
|
+
* credential liveness checks: a connector with nothing stored has no
|
|
148
|
+
* credential whose liveness could be in question, and probing it anyway would
|
|
149
|
+
* start an authorization flow nobody asked for.
|
|
150
|
+
*
|
|
151
|
+
* Implement it on connectors that manage their own credential storage (the
|
|
152
|
+
* shipped `remoteMcp` does, for `auth: { type: "oauth" }`). Connectors whose
|
|
153
|
+
* credential lives in connecta's vault (`credential` above) need not: the
|
|
154
|
+
* vault answers for them. Must not perform downstream I/O.
|
|
155
|
+
*/
|
|
156
|
+
hasStoredCredential?(ctx: ConnectorContext): Promise<boolean>;
|
|
127
157
|
/**
|
|
128
158
|
* Statically-known tool defs, exposed by in-code connectors (`api()`) for
|
|
129
159
|
* startup convention checks. Remote connectors omit this — their tools are
|
|
@@ -187,11 +217,48 @@ export interface ExecutorProvider {
|
|
|
187
217
|
export interface Executor {
|
|
188
218
|
execute(code: string, providers: ExecutorProvider[]): Promise<ExecuteResult>;
|
|
189
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Which toolkits one inbound identity may open — the membership half of the
|
|
222
|
+
* deployment=org / toolkit=team framing (§16). A mapping, never a policy
|
|
223
|
+
* engine: one identity → the toolkit names it may select, plus whether it may
|
|
224
|
+
* connect with no `?toolkit=` at all.
|
|
225
|
+
*
|
|
226
|
+
* An identity with NO binding is unbound and keeps the pre-binding behavior:
|
|
227
|
+
* any declared toolkit, or the full registry. A binding is enforced at connect
|
|
228
|
+
* time, before any scoped registry is constructed.
|
|
229
|
+
*/
|
|
230
|
+
export interface ToolkitBinding {
|
|
231
|
+
/** Toolkit names this identity may select with `?toolkit=<name>`. */
|
|
232
|
+
readonly toolkits: readonly string[];
|
|
233
|
+
/**
|
|
234
|
+
* Whether this identity may also connect with no `?toolkit=` and see the full
|
|
235
|
+
* registry (and read the deployment-wide operator surfaces). Defaults to
|
|
236
|
+
* false: binding a credential to a toolkit means binding it.
|
|
237
|
+
*/
|
|
238
|
+
readonly unscoped?: boolean;
|
|
239
|
+
}
|
|
190
240
|
/** Result of an inbound-auth check. */
|
|
191
241
|
export type AuthResult = {
|
|
192
242
|
ok: true;
|
|
193
243
|
userId?: string;
|
|
194
244
|
subjectId?: string;
|
|
245
|
+
/**
|
|
246
|
+
* Toolkit binding resolved for THIS identity — the seam for an adapter
|
|
247
|
+
* that maps its own users (or an IdP claim) to views. Omit to inherit the
|
|
248
|
+
* provider's `toolkitBinding`.
|
|
249
|
+
*
|
|
250
|
+
* When the provider also declares one, the declaration is a **CEILING**,
|
|
251
|
+
* not a default: connecta intersects the two, and grants `unscoped` only
|
|
252
|
+
* if both do. A per-identity binding can therefore narrow the credential's
|
|
253
|
+
* view but never widen it — otherwise an adapter reading a user-writable
|
|
254
|
+
* claim would let the user name their own toolkits. When the provider
|
|
255
|
+
* declares nothing, this binding is used as given.
|
|
256
|
+
*
|
|
257
|
+
* Validated on arrival (a malformed one refuses the request with 403
|
|
258
|
+
* rather than being ignored), but never checked against the configured
|
|
259
|
+
* toolkits, which is only possible for the static declaration at startup.
|
|
260
|
+
*/
|
|
261
|
+
toolkitBinding?: ToolkitBinding;
|
|
195
262
|
} | {
|
|
196
263
|
ok: false;
|
|
197
264
|
response: Response;
|
|
@@ -200,6 +267,18 @@ export type AuthResult = {
|
|
|
200
267
|
export type UiAuthConfig = {
|
|
201
268
|
kind: "clerk";
|
|
202
269
|
publishableKey: string;
|
|
270
|
+
/**
|
|
271
|
+
* Origin `/ui` fetches its browser sign-in loader from. **Must be an absolute
|
|
272
|
+
* `https:` URL** — the value lands in a `<script src>`, so the gate is
|
|
273
|
+
* stricter than the branding href gate: no `http:`, no loopback exemption, and
|
|
274
|
+
* no root-relative form (a relative path is rejected, not resolved). The
|
|
275
|
+
* shipped `clerkAuth` adapter derives this from the publishable key and
|
|
276
|
+
* Clerk's Frontend API is always https, so nothing legitimate needs a
|
|
277
|
+
* carve-out. A value that fails the gate reaches neither the loader tag nor
|
|
278
|
+
* the page's inline auth config: `/ui` renders without the loader and reports
|
|
279
|
+
* that Clerk could not load, and `createConnecta` names the drop in a startup
|
|
280
|
+
* warning.
|
|
281
|
+
*/
|
|
203
282
|
frontendApiUrl: string;
|
|
204
283
|
signInUrl?: string;
|
|
205
284
|
signUpUrl?: string;
|
|
@@ -230,7 +309,9 @@ export interface ConnectaBranding {
|
|
|
230
309
|
* `/favicon.svg`, `ico` at `/favicon.ico`; omit either to keep the default
|
|
231
310
|
* for that format. Use `href` instead to point the page at an icon you host
|
|
232
311
|
* elsewhere (it replaces the `/favicon.svg` link in the page head; the
|
|
233
|
-
* `/favicon.*` routes still serve whatever `svg`/`ico` provide).
|
|
312
|
+
* `/favicon.*` routes still serve whatever `svg`/`ico` provide). `href` must
|
|
313
|
+
* be an absolute `http(s)` URL or a root-relative path; anything else falls
|
|
314
|
+
* back to the default mark.
|
|
234
315
|
*/
|
|
235
316
|
favicon?: {
|
|
236
317
|
svg?: string;
|
|
@@ -248,6 +329,14 @@ export interface InboundAuth {
|
|
|
248
329
|
* provider instead of asking the operator to paste a static bearer secret.
|
|
249
330
|
*/
|
|
250
331
|
uiAuth?: UiAuthConfig;
|
|
332
|
+
/**
|
|
333
|
+
* Optional toolkit binding for every identity this provider admits (§16).
|
|
334
|
+
* Declared statically so `createConnecta` can validate the names against
|
|
335
|
+
* `ConnectaConfig.toolkits` and throw on a typo — a binding nobody wrote is
|
|
336
|
+
* not one an operator can reason about. An `authorize` result may narrow it
|
|
337
|
+
* per identity with its own `toolkitBinding`.
|
|
338
|
+
*/
|
|
339
|
+
toolkitBinding?: ToolkitBinding;
|
|
251
340
|
/** Serve/short-circuit .well-known + OPTIONS. Return null when not handled. */
|
|
252
341
|
handleMetadata?(request: Request, baseUrl: string): Response | null | Promise<Response | null>;
|
|
253
342
|
/** Attempt to authorize a request. */
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,sDAAsD;AACtD,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,+DAA+D;AAC/D,MAAM,WAAW,SAAS;IACxB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,GAAG,CACD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAC7B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,MAAM;IACrB,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAChC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAC/B,KAAK,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,UAAU,CAAC;IACzB,oEAAoE;IACpE,YAAY,CAAC,EAAE,UAAU,CAAC;IAC1B;;;;;OAKG;IACH,WAAW,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,MAAM,WAAW,eAAgB,SAAQ,MAAM,CAAC,MAA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R,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,GAAG,CAAC,EAAE,UAAU,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,+EAA+E;IAC/E,cAAc,CAAC,CACb,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,QAAQ,GAAG,IAAI,GAAG,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAAC;IAC9C,sCAAsC;IACtC,SAAS,CACP,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,MAAM,GACd,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACrC"}
|
package/dist/ui.d.ts
CHANGED
|
@@ -15,13 +15,65 @@ interface ResolvedBranding {
|
|
|
15
15
|
faviconHref: string;
|
|
16
16
|
themeColor: string;
|
|
17
17
|
}
|
|
18
|
+
export declare const DEFAULT_FAVICON_HREF = "/favicon.svg";
|
|
18
19
|
export declare function resolveBranding(branding?: ConnectaBranding): ResolvedBranding;
|
|
20
|
+
/**
|
|
21
|
+
* Names of the branding URLs the operator set that failed their gate and were
|
|
22
|
+
* replaced by a default. Lives beside the gates so the startup warning cannot
|
|
23
|
+
* drift from them, and takes `unknown` fields for the same reason
|
|
24
|
+
* `resolveBranding` does — a warning helper must never throw.
|
|
25
|
+
*/
|
|
26
|
+
export declare function droppedBrandingUrls(branding?: ConnectaBranding): string[];
|
|
19
27
|
/**
|
|
20
28
|
* True only for absolute `http:`/`https:` URLs. Downstream connectors control
|
|
21
29
|
* their `authorizationUrl`, so a hostile/misconfigured one could hand back a
|
|
22
30
|
* `javascript:` (or other) scheme; gate it before it can become an href.
|
|
23
31
|
*/
|
|
24
32
|
export declare function isSafeHttpUrl(url: unknown): boolean;
|
|
33
|
+
/**
|
|
34
|
+
* True for values allowed in the page's `<link rel="icon" href>`: an absolute
|
|
35
|
+
* `http(s)` URL (an icon the operator hosts elsewhere) or a path rooted at this
|
|
36
|
+
* origin. The relative carve-out is deliberate rather than accidental — the
|
|
37
|
+
* default href is the relative `/favicon.svg`, which `isSafeHttpUrl` alone would
|
|
38
|
+
* reject — and it is kept narrow on both ends.
|
|
39
|
+
*
|
|
40
|
+
* Root-relative only, because `/ui` and `/oauth/callback/<id>` sit at different
|
|
41
|
+
* depths and a document-relative path would resolve differently on each.
|
|
42
|
+
*
|
|
43
|
+
* "Root-relative" is enforced structurally: exactly one leading `/` followed by
|
|
44
|
+
* a character that is neither `/` nor `\`. Both of those would make the value an
|
|
45
|
+
* authority (`//host`, and `/\host` because the URL parser folds `\` to `/` in
|
|
46
|
+
* special schemes), pointing at an origin this server does not control. The test
|
|
47
|
+
* runs on a copy with tab/newline/CR removed, since the parser strips those
|
|
48
|
+
* anywhere and `/\t/host` would otherwise slip through as single-slash. The
|
|
49
|
+
* origin comparison that follows is defense in depth, not the authority check —
|
|
50
|
+
* on its own it would accept an authority that happened to equal the probe host.
|
|
51
|
+
*/
|
|
52
|
+
export declare function isSafeIconHref(href: unknown): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* True only for an absolute `https:` URL — the gate for `uiAuth.frontendApiUrl`,
|
|
55
|
+
* the last operator-config value that lands in a URL-valued HTML position (the
|
|
56
|
+
* `<script src>` of `/ui`'s sign-in loader). `javascript:` in a `src` does not
|
|
57
|
+
* execute, so this closes a hole in the *invariant* rather than a live vector:
|
|
58
|
+
* every operator value reaching an `href`/`src` is validated, with no exception
|
|
59
|
+
* left to remember.
|
|
60
|
+
*
|
|
61
|
+
* Stricter than `isSafeHttpUrl` on purpose. There is no `http:` carve-out and no
|
|
62
|
+
* loopback carve-out, because nobody types this value: the shipped Clerk adapter
|
|
63
|
+
* derives it from the publishable key and Clerk's Frontend API is always https.
|
|
64
|
+
* A cleartext script source on the dashboard would be a downgrade even where a
|
|
65
|
+
* browser's mixed-content rules had not already blocked it.
|
|
66
|
+
*/
|
|
67
|
+
export declare function isSafeScriptSrcUrl(url: unknown): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Names of the `uiAuth` URLs an inbound-auth provider supplied that failed their
|
|
70
|
+
* gate. Lives beside the gate for the same reason `droppedBrandingUrls` does: the
|
|
71
|
+
* startup warning cannot then drift from what rendering actually drops. Every
|
|
72
|
+
* field is read defensively rather than trusted, because a custom `InboundAuth`
|
|
73
|
+
* is untyped at a JS call site — `isSafeScriptSrcUrl` takes `unknown`, and a
|
|
74
|
+
* `uiAuth` that is not the clerk shape is reported as nothing to warn about.
|
|
75
|
+
*/
|
|
76
|
+
export declare function droppedUiAuthUrls(uiAuth?: UiAuthConfig): string[];
|
|
25
77
|
export interface UiTool {
|
|
26
78
|
name: string;
|
|
27
79
|
address: string;
|
|
@@ -36,6 +88,17 @@ export interface UiConnector {
|
|
|
36
88
|
authorizationUrl?: string;
|
|
37
89
|
toolCount: number;
|
|
38
90
|
tools: UiTool[];
|
|
91
|
+
/**
|
|
92
|
+
* Verdict of the last proactive credential liveness check (issue #24), for the
|
|
93
|
+
* connectors that hold a credential connecta stores. Shown beside the live
|
|
94
|
+
* status so an operator can tell "checked just now" from "last verified an
|
|
95
|
+
* hour ago", and see a dead credential the page's own probe may not reach.
|
|
96
|
+
*/
|
|
97
|
+
credentialCheck?: {
|
|
98
|
+
state: "ok" | "auth_required" | "error";
|
|
99
|
+
checkedAt: string;
|
|
100
|
+
message?: string;
|
|
101
|
+
};
|
|
39
102
|
credential?: {
|
|
40
103
|
label: string;
|
|
41
104
|
description?: string;
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OA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