@zackbart/connecta 0.8.0 → 0.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +31 -55
- package/dist/activity.d.ts +0 -8
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js +0 -1
- package/dist/activity.js.map +1 -1
- package/dist/auth/bearer.d.ts +1 -7
- package/dist/auth/bearer.d.ts.map +1 -1
- package/dist/auth/bearer.js +2 -23
- package/dist/auth/bearer.js.map +1 -1
- package/dist/auth/clerk.d.ts +2 -11
- package/dist/auth/clerk.d.ts.map +1 -1
- package/dist/auth/clerk.js +31 -46
- package/dist/auth/clerk.js.map +1 -1
- package/dist/call-admission.d.ts.map +1 -1
- package/dist/call-admission.js +0 -1
- package/dist/call-admission.js.map +1 -1
- package/dist/catalog-service.d.ts +1 -2
- package/dist/catalog-service.d.ts.map +1 -1
- package/dist/catalog-service.js +12 -18
- package/dist/catalog-service.js.map +1 -1
- package/dist/catalog.d.ts +6 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +51 -0
- package/dist/catalog.js.map +1 -1
- package/dist/connectors/remote-mcp.d.ts.map +1 -1
- package/dist/connectors/remote-mcp.js +9 -22
- package/dist/connectors/remote-mcp.js.map +1 -1
- package/dist/errors.d.ts +18 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +1 -8
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +3 -13
- package/dist/execute.js.map +1 -1
- package/dist/executor-result.js +1 -1
- package/dist/executor-result.js.map +1 -1
- package/dist/index.d.ts +3 -82
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -90
- package/dist/index.js.map +1 -1
- package/dist/invocation.d.ts +5 -0
- package/dist/invocation.d.ts.map +1 -1
- package/dist/invocation.js +46 -10
- package/dist/invocation.js.map +1 -1
- package/dist/meta-tools.d.ts +3 -11
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +105 -157
- package/dist/meta-tools.js.map +1 -1
- package/dist/operator-ui/generated.d.ts +2 -2
- package/dist/operator-ui/generated.d.ts.map +1 -1
- package/dist/operator-ui/generated.js +2 -2
- package/dist/operator-ui/generated.js.map +1 -1
- package/dist/operator-ui/model.d.ts +1 -22
- package/dist/operator-ui/model.d.ts.map +1 -1
- package/dist/operator-ui/model.js.map +1 -1
- package/dist/registry.d.ts +11 -178
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +52 -330
- package/dist/registry.js.map +1 -1
- package/dist/retired-toolkits.d.ts +3 -0
- package/dist/retired-toolkits.d.ts.map +1 -0
- package/dist/retired-toolkits.js +9 -0
- package/dist/retired-toolkits.js.map +1 -0
- package/dist/routes/activity.d.ts.map +1 -1
- package/dist/routes/activity.js +2 -5
- package/dist/routes/activity.js.map +1 -1
- package/dist/routes/credentials.d.ts.map +1 -1
- package/dist/routes/credentials.js +1 -12
- package/dist/routes/credentials.js.map +1 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +32 -145
- package/dist/routes/mcp.js.map +1 -1
- package/dist/routes/oauth.d.ts.map +1 -1
- package/dist/routes/oauth.js +2 -7
- package/dist/routes/oauth.js.map +1 -1
- package/dist/routes/shared.d.ts +7 -28
- package/dist/routes/shared.d.ts.map +1 -1
- package/dist/routes/shared.js +10 -69
- package/dist/routes/shared.js.map +1 -1
- package/dist/routes/ui.d.ts.map +1 -1
- package/dist/routes/ui.js +4 -10
- package/dist/routes/ui.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +1 -31
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +3 -6
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +9 -38
- package/dist/skills.js.map +1 -1
- package/dist/timeout.d.ts.map +1 -1
- package/dist/timeout.js +2 -4
- package/dist/timeout.js.map +1 -1
- package/dist/types.d.ts +2 -59
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +1 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +5 -35
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/activity.ts +0 -9
- package/src/auth/bearer.ts +3 -32
- package/src/auth/clerk.ts +35 -48
- package/src/call-admission.ts +0 -1
- package/src/catalog-service.ts +23 -23
- package/src/catalog.ts +55 -0
- package/src/connectors/remote-mcp.ts +11 -23
- package/src/errors.ts +20 -0
- package/src/execute.ts +3 -18
- package/src/executor-result.ts +1 -1
- package/src/index.ts +24 -208
- package/src/invocation.ts +63 -10
- package/src/meta-tools.ts +122 -174
- package/src/operator-ui/browser.css +1 -54
- package/src/operator-ui/browser.ts +16 -150
- package/src/operator-ui/generated.ts +2 -2
- package/src/operator-ui/model.ts +1 -23
- package/src/registry.ts +59 -429
- package/src/retired-toolkits.ts +14 -0
- package/src/routes/activity.ts +1 -6
- package/src/routes/credentials.ts +0 -12
- package/src/routes/mcp.ts +40 -186
- package/src/routes/oauth.ts +1 -7
- package/src/routes/shared.ts +8 -98
- package/src/routes/ui.ts +2 -12
- package/src/server.ts +1 -31
- package/src/skills.ts +9 -38
- package/src/timeout.ts +2 -4
- package/src/types.ts +1 -60
- package/src/ui.ts +9 -46
- package/src/version.ts +1 -1
- package/dist/credential-health.d.ts +0 -205
- package/dist/credential-health.d.ts.map +0 -1
- package/dist/credential-health.js +0 -610
- package/dist/credential-health.js.map +0 -1
- package/dist/toolkits.d.ts +0 -124
- package/dist/toolkits.d.ts.map +0 -1
- package/dist/toolkits.js +0 -322
- package/dist/toolkits.js.map +0 -1
- package/src/credential-health.ts +0 -835
- package/src/toolkits.ts +0 -461
package/dist/routes/shared.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { resolveIdentityBinding } from "../toolkits.js";
|
|
2
1
|
import { operatorPageForPath } from "../ui.js";
|
|
3
2
|
export function msg(err) {
|
|
4
3
|
return err instanceof Error ? err.message : String(err);
|
|
@@ -12,21 +11,19 @@ export function privateJson(body, init = {}) {
|
|
|
12
11
|
}
|
|
13
12
|
const MAX_LOGGED_VALUE_LENGTH = 64;
|
|
14
13
|
/**
|
|
15
|
-
* Bounded, escaped form of a caller-influenced value (
|
|
16
|
-
*
|
|
14
|
+
* Bounded, escaped form of a caller-influenced value (an identity id or OAuth
|
|
15
|
+
* callback connector id) for the operator log. Goes
|
|
17
16
|
* through JSON.stringify so a caller-controlled newline or control character
|
|
18
17
|
* cannot forge a log line, plus a hand-rolled escape for U+2028/U+2029, which
|
|
19
18
|
* JSON.stringify leaves raw even though a log reader treats them as line
|
|
20
|
-
* terminators. Truncated to a small shared cap
|
|
21
|
-
*
|
|
19
|
+
* terminators. Truncated to a small shared cap so an oversized value cannot
|
|
20
|
+
* flood the log either.
|
|
22
21
|
*/
|
|
23
22
|
export function loggableValue(requested) {
|
|
24
23
|
const bounded = requested.slice(0, MAX_LOGGED_VALUE_LENGTH);
|
|
25
24
|
const escaped = JSON.stringify(bounded).replace(/[\u2028\u2029]/g, (ch) => `\\u${ch.charCodeAt(0).toString(16)}`);
|
|
26
25
|
return escaped + (bounded.length < requested.length ? " (truncated)" : "");
|
|
27
26
|
}
|
|
28
|
-
/** Length beyond which a rejected toolkit name is not echoed back. */
|
|
29
|
-
export const MAX_ECHOED_TOOLKIT_NAME = MAX_LOGGED_VALUE_LENGTH;
|
|
30
27
|
const ACTIVITY_ACTOR_NAMESPACE_RE = /^[\x21-\x7e]{1,256}$/;
|
|
31
28
|
export function activityActorNamespace(provider) {
|
|
32
29
|
return typeof provider.activityActorNamespace === "string" &&
|
|
@@ -34,16 +31,7 @@ export function activityActorNamespace(provider) {
|
|
|
34
31
|
? provider.activityActorNamespace
|
|
35
32
|
: undefined;
|
|
36
33
|
}
|
|
37
|
-
|
|
38
|
-
* Refusal for an identity whose toolkit binding cannot be trusted — a malformed
|
|
39
|
-
* declaration, or a malformed per-identity binding out of `authorize`. The
|
|
40
|
-
* caller is authenticated, so this is a 403, and it is deliberately opaque: the
|
|
41
|
-
* cause is an operator bug, and the operator reads it in the log, not the client.
|
|
42
|
-
*/
|
|
43
|
-
function unusableBinding() {
|
|
44
|
-
return privateJson({ error: "forbidden" }, { status: 403 });
|
|
45
|
-
}
|
|
46
|
-
export async function authorize(request, baseUrl, auth, logger) {
|
|
34
|
+
export async function authorize(request, baseUrl, auth) {
|
|
47
35
|
if (auth.length === 0) {
|
|
48
36
|
return { ok: true, actor: { kind: "anonymous" } };
|
|
49
37
|
}
|
|
@@ -52,19 +40,6 @@ export async function authorize(request, baseUrl, auth, logger) {
|
|
|
52
40
|
const result = await provider.authorize(request, baseUrl);
|
|
53
41
|
if (result.ok) {
|
|
54
42
|
const subjectId = result.subjectId ?? result.userId;
|
|
55
|
-
// Re-validate both halves and cap the per-identity one by the provider's
|
|
56
|
-
// declaration (see resolveIdentityBinding). A binding that does not
|
|
57
|
-
// type-check at runtime refuses the request rather than evaporating:
|
|
58
|
-
// dropping it would hand the caller the full registry, which is the one
|
|
59
|
-
// outcome a binding exists to prevent.
|
|
60
|
-
const binding = resolveIdentityBinding(provider.toolkitBinding, result.toolkitBinding);
|
|
61
|
-
if (!binding.ok) {
|
|
62
|
-
logger.warn(`[connecta] refused a request admitted by inbound auth provider ` +
|
|
63
|
-
`"${provider.kind}" with 403: ${binding.reason}. Until it is fixed ` +
|
|
64
|
-
"this provider cannot admit anyone, because connecta cannot tell " +
|
|
65
|
-
"which toolkits the identity may use.");
|
|
66
|
-
return { ok: false, response: unusableBinding() };
|
|
67
|
-
}
|
|
68
43
|
const actorNamespace = activityActorNamespace(provider);
|
|
69
44
|
return {
|
|
70
45
|
ok: true,
|
|
@@ -78,7 +53,6 @@ export async function authorize(request, baseUrl, auth, logger) {
|
|
|
78
53
|
...(result.userId && provider.uiAuth?.kind === "clerk"
|
|
79
54
|
? { uiAdminEligible: true }
|
|
80
55
|
: {}),
|
|
81
|
-
...(binding.binding ? { toolkitBinding: binding.binding } : {}),
|
|
82
56
|
};
|
|
83
57
|
}
|
|
84
58
|
lastResponse = result.response;
|
|
@@ -95,35 +69,15 @@ export async function authorize(request, baseUrl, auth, logger) {
|
|
|
95
69
|
}),
|
|
96
70
|
};
|
|
97
71
|
}
|
|
98
|
-
|
|
99
|
-
* True when this identity is confined to one or more toolkits — bound, without
|
|
100
|
-
* `unscoped`. Such a credential belongs to a team's agent, not to the operator
|
|
101
|
-
* running the deployment, so the deployment-wide operator surfaces (`/ui/data`,
|
|
102
|
-
* `/ui/activity`, the credential API) refuse it: their payloads describe every
|
|
103
|
-
* connector in the org, which is exactly what the binding exists to withhold.
|
|
104
|
-
*/
|
|
105
|
-
export function isToolkitRestricted(binding) {
|
|
106
|
-
return Boolean(binding && !binding.unscoped);
|
|
107
|
-
}
|
|
108
|
-
/** The refusal the deployment-wide operator surfaces give a bound identity. */
|
|
109
|
-
export function restrictedOperatorSurface() {
|
|
110
|
-
return privateJson({
|
|
111
|
-
error: "this credential is bound to a toolkit and may not read " +
|
|
112
|
-
"deployment-wide operator data",
|
|
113
|
-
}, { status: 403 });
|
|
114
|
-
}
|
|
115
|
-
export async function authorizeUiAdmin(request, baseUrl, auth, logger, purpose = "credential management") {
|
|
72
|
+
export async function authorizeUiAdmin(request, baseUrl, auth, purpose = "credential management") {
|
|
116
73
|
// Operator mutation is intentionally narrower than /mcp and /ui/data: only
|
|
117
74
|
// an interactive Clerk provider may admit it. A static bearer token is useful
|
|
118
75
|
// for headless tool calls but must not become a deployment-admin key.
|
|
119
76
|
//
|
|
120
|
-
//
|
|
121
|
-
//
|
|
122
|
-
//
|
|
123
|
-
//
|
|
124
|
-
// would refuse the operator outright, and a refusal here — a failed gate, a
|
|
125
|
-
// missing user, a toolkit-bound identity — is exactly the case where a later
|
|
126
|
-
// provider is the one meant to admit. The last refusal is returned if none do.
|
|
77
|
+
// Every Clerk provider gets a turn, the way the /mcp gate does. Stopping at
|
|
78
|
+
// the first would make admission depend on config order: a failed gate or
|
|
79
|
+
// missing user may simply mean a later provider is the one meant to admit.
|
|
80
|
+
// The last refusal is returned if none do.
|
|
127
81
|
const providers = auth.filter((candidate) => candidate.uiAuth?.kind === "clerk");
|
|
128
82
|
if (providers.length === 0) {
|
|
129
83
|
return {
|
|
@@ -142,19 +96,6 @@ export async function authorizeUiAdmin(request, baseUrl, auth, logger, purpose =
|
|
|
142
96
|
lastResponse = privateJson({ error: "authenticated user required" }, { status: 403 });
|
|
143
97
|
continue;
|
|
144
98
|
}
|
|
145
|
-
const binding = resolveIdentityBinding(provider.toolkitBinding, result.toolkitBinding);
|
|
146
|
-
if (!binding.ok) {
|
|
147
|
-
logger.warn(`[connecta] refused an operator-mutation request admitted by inbound auth ` +
|
|
148
|
-
`provider "${provider.kind}" with 403: ${binding.reason}.`);
|
|
149
|
-
lastResponse = unusableBinding();
|
|
150
|
-
continue;
|
|
151
|
-
}
|
|
152
|
-
// A toolkit-bound identity is a team's credential, not a vault admin key:
|
|
153
|
-
// credentials are deployment-wide, so writing one reaches every toolkit.
|
|
154
|
-
if (isToolkitRestricted(binding.binding)) {
|
|
155
|
-
lastResponse = restrictedOperatorSurface();
|
|
156
|
-
continue;
|
|
157
|
-
}
|
|
158
99
|
return { ok: true, userId: result.userId };
|
|
159
100
|
}
|
|
160
101
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/routes/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/routes/shared.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AA4C/C,MAAM,UAAU,GAAG,CAAC,GAAY;IAC9B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,WAAW,C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BAAyB,CAAC,EAAE,CAAC;YAC5C,OAAO,CAAC,GAAG,CAAC,yBAAyB,EAAE,wBAAwB,CAAC,CAAC;QACnE,CAAC;QACD,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE;QACjC,MAAM,EAAE,QAAQ,CAAC,MAAM;QACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
|
package/dist/routes/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/routes/ui.ts"],"names":[],"mappings":"AAQA,OAAO,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/routes/ui.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,YAAY,EAClB,MAAM,aAAa,CAAC;AAuCrB,wBAAsB,OAAO,CAC3B,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,QAAQ,GAAG,IAAI,CAAC,CAyF1B"}
|
package/dist/routes/ui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CONNECTA_FAVICON_ICO } from "../favicon.js";
|
|
2
2
|
import { buildUiData, CONNECTA_FAVICON_SVG, credentialManagementCapability, operatorPageForPath, renderUiHtml, } from "../ui.js";
|
|
3
|
-
import { authorize,
|
|
3
|
+
import { authorize, privateJson, } from "./shared.js";
|
|
4
4
|
/**
|
|
5
5
|
* Headers that make an operator-supplied favicon body inert on this origin.
|
|
6
6
|
* The SVG route is the sharp one: `image/svg+xml` is an *active* content type,
|
|
@@ -37,7 +37,7 @@ function uiScriptNonce() {
|
|
|
37
37
|
return btoa(binary);
|
|
38
38
|
}
|
|
39
39
|
export async function routeUi(context) {
|
|
40
|
-
const { request, url, path, baseUrl, opts, defer
|
|
40
|
+
const { request, url, path, baseUrl, opts, defer } = context;
|
|
41
41
|
if (request.method === "GET" && path === "/favicon.svg") {
|
|
42
42
|
return new Response(opts.branding?.favicon?.svg ?? CONNECTA_FAVICON_SVG, {
|
|
43
43
|
headers: {
|
|
@@ -96,15 +96,9 @@ export async function routeUi(context) {
|
|
|
96
96
|
}
|
|
97
97
|
if (path !== "/ui/data")
|
|
98
98
|
return null;
|
|
99
|
-
const authz = await authorize(request, baseUrl, opts.auth
|
|
99
|
+
const authz = await authorize(request, baseUrl, opts.auth);
|
|
100
100
|
if (!authz.ok)
|
|
101
101
|
return authz.response;
|
|
102
|
-
if (isToolkitRestricted(authz.toolkitBinding)) {
|
|
103
|
-
return restrictedOperatorSurface();
|
|
104
|
-
}
|
|
105
|
-
// After the restriction check, not before: an identity that may not
|
|
106
|
-
// read this surface should not get to trigger background work from it.
|
|
107
|
-
sweepCredentials();
|
|
108
102
|
const eligibleClerkOperator = authz.uiAdminEligible === true;
|
|
109
103
|
const credentialManagement = credentialManagementCapability({
|
|
110
104
|
eligibleClerkOperator,
|
|
@@ -116,7 +110,7 @@ export async function routeUi(context) {
|
|
|
116
110
|
const data = await buildUiData(opts.registry, baseUrl, opts.serverInfo,
|
|
117
111
|
// The static headless bearer may read connector health, but only a
|
|
118
112
|
// Clerk-authenticated operator receives credential metadata.
|
|
119
|
-
eligibleClerkOperator ? opts.credentialVault : undefined, Boolean(opts.activity?.list), credentialManagement,
|
|
113
|
+
eligibleClerkOperator ? opts.credentialVault : undefined, Boolean(opts.activity?.list), credentialManagement, defer, eligibleClerkOperator, opts.discoveryConcurrency);
|
|
120
114
|
return privateJson(data);
|
|
121
115
|
}
|
|
122
116
|
//# sourceMappingURL=ui.js.map
|
package/dist/routes/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/routes/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;A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CAAC;KAClD,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,WAAW,CAC5B,IAAI,CAAC,QAAQ,EACb,OAAO,EACP,IAAI,CAAC,UAAU;IACf,mEAAmE;IACnE,6DAA6D;IAC7D,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,EACxD,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAC5B,oBAAoB,EACpB,KAAK,EACL,qBAAqB,EACrB,IAAI,CAAC,oBAAoB,CAC1B,CAAC;IACF,OAAO,WAAW,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC"}
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,aAAa,GAClB,CACD,OAAO,EAAE,OAAO,EAChB,cAAc,CAAC,EAAE,uBAAuB,KACrC,OAAO,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAQA,OAAO,EAGL,KAAK,uBAAuB,EAC5B,KAAK,aAAa,EACnB,MAAM,oBAAoB,CAAC;AAG5B,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,aAAa,GAClB,CACD,OAAO,EAAE,OAAO,EAChB,cAAc,CAAC,EAAE,uBAAuB,KACrC,OAAO,CAAC,QAAQ,CAAC,CA+JrB"}
|
package/dist/server.js
CHANGED
|
@@ -13,7 +13,7 @@ import { routeUi } from "./routes/ui.js";
|
|
|
13
13
|
* wrapper is applied to every response.
|
|
14
14
|
*/
|
|
15
15
|
export function createFetchHandler(opts) {
|
|
16
|
-
const {
|
|
16
|
+
const { auth, publicUrl, registry } = opts;
|
|
17
17
|
const routeMcp = createMcpRoute(opts);
|
|
18
18
|
return async function fetch(request, runtimeContext) {
|
|
19
19
|
const url = new URL(request.url);
|
|
@@ -22,35 +22,6 @@ export function createFetchHandler(opts) {
|
|
|
22
22
|
const defer = runtimeContext
|
|
23
23
|
? runtimeContext.waitUntil.bind(runtimeContext)
|
|
24
24
|
: undefined;
|
|
25
|
-
/**
|
|
26
|
-
* Piggyback a DUE credential liveness sweep on traffic that has already been
|
|
27
|
-
* authenticated (issue #24). Started beside the request and never awaited by
|
|
28
|
-
* it: it must not add latency or change a result, so it is handed to
|
|
29
|
-
* `ctx.waitUntil` where the runtime has one (Workers, and the Node adapter's
|
|
30
|
-
* shim) to settle after the response. The registry answers `undefined`
|
|
31
|
-
* unless a sweep is actually due, so the ordinary request pays nothing.
|
|
32
|
-
*/
|
|
33
|
-
const sweepCredentials = () => {
|
|
34
|
-
// Belt and braces: a rejected sweep is already absorbed below, and this
|
|
35
|
-
// catches the synchronous half — arming the gate, or a connector list that
|
|
36
|
-
// throws while deciding whether anything is due. Nothing about a
|
|
37
|
-
// background health check may turn a served request into a 500.
|
|
38
|
-
try {
|
|
39
|
-
const sweep = registry.sweepCredentialHealthIfDue(baseUrl, defer);
|
|
40
|
-
if (!sweep)
|
|
41
|
-
return;
|
|
42
|
-
const settled = sweep.then(() => { }, (err) => {
|
|
43
|
-
opts.logger.warn("[connecta] credential health sweep failed", err);
|
|
44
|
-
});
|
|
45
|
-
if (defer)
|
|
46
|
-
defer(settled);
|
|
47
|
-
else
|
|
48
|
-
void settled;
|
|
49
|
-
}
|
|
50
|
-
catch (err) {
|
|
51
|
-
opts.logger.warn("[connecta] credential health sweep failed", err);
|
|
52
|
-
}
|
|
53
|
-
};
|
|
54
25
|
// Container and orchestrator probes reach /health over plain HTTP on
|
|
55
26
|
// loopback, where no proxy has set X-Forwarded-Proto. Redirecting them to
|
|
56
27
|
// the public origin would make an internal liveness check depend on
|
|
@@ -85,7 +56,6 @@ export function createFetchHandler(opts) {
|
|
|
85
56
|
opts,
|
|
86
57
|
defer,
|
|
87
58
|
runtimeContext,
|
|
88
|
-
sweepCredentials,
|
|
89
59
|
};
|
|
90
60
|
const route = async () => {
|
|
91
61
|
// Private mutations own OPTIONS so they never inherit wildcard CORS.
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,mBAAmB,GAIpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAIzC;;;;;;GAMG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAmB;IAKnB,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnE,OAAO,EACL,kBAAkB,EAClB,oBAA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mB,CAAC,MAAM,KAAK,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/skills.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Connector } from "./types.js";
|
|
2
|
-
export declare const CONNECTA_INSTRUCTIONS = "Connecta exposes many integrations behind meta-tools. When an address is unknown, start with search_tools and includeSchemas=\"compact\"; use describe_tools only when that schema is insufficient. Use call_tool for one explicitly read-only call, batch_call for 2\u201310 independent explicitly read-only calls, and execute_code (when available) only for dependent read-only steps, loops, joins, or reducing large results. Unannotated, write-capable, and destructive tools must use call_destructive_tool individually. Use authorize_connector only after auth_required and get_result only for truncated results.
|
|
3
|
-
export declare const USAGE_SKILL = "# Connecta usage\n\n## Choose the smallest execution tool\n\n- Unknown address: `search_tools({ query, includeSchemas: \"compact\" })`.\n- Schema still unclear: `describe_tools({ addresses: [...] })`.\n- One explicitly read-only call: `call_tool`.\n- Two to ten independent explicitly read-only calls: `batch_call`.\n- Dependent read-only calls, loops, joins, branching, or large-result reduction: `execute_code` when available.\n- Any unannotated, write-capable, or destructive call: `call_destructive_tool`, individually and only after reviewing its schema and consequences.\n- Truncated result: retry with `fields` when possible; otherwise page it with `get_result`.\n- `auth_required`: use `authorize_connector`,
|
|
2
|
+
export declare const CONNECTA_INSTRUCTIONS = "Connecta exposes many integrations behind meta-tools. When an address is unknown, start with search_tools and includeSchemas=\"compact\"; use describe_tools only when that schema is insufficient. Use call_tool for one explicitly read-only call, batch_call for 2\u201310 independent explicitly read-only calls, and execute_code (when available) only for dependent read-only steps, loops, joins, or reducing large results. Unannotated, write-capable, and destructive tools must use call_destructive_tool individually. Use authorize_connector only after auth_required and get_result only for truncated results. Fetch skills({ name: \"usage\" }) when this routing workflow is unfamiliar.";
|
|
3
|
+
export declare const USAGE_SKILL = "# Connecta usage\n\n## Choose the smallest execution tool\n\nUse exact addresses returned by discovery; never invent one.\n\n- Unknown address: `search_tools({ query, includeSchemas: \"compact\" })`.\n- Schema still unclear: `describe_tools({ addresses: [...] })`.\n- One explicitly read-only call: `call_tool`.\n- Two to ten independent explicitly read-only calls: `batch_call`.\n- Dependent read-only calls, loops, joins, branching, or large-result reduction: `execute_code` when available.\n- Any unannotated, write-capable, or destructive call: `call_destructive_tool`, individually and only after reviewing its schema and consequences.\n- Truncated result: retry with `fields` when possible; otherwise page it with `get_result`.\n- `auth_required`: use `authorize_connector`, give its recovery handoff to the operator, then retry the original call.\n\nUse `list_connectors({ probe: false })` for a fast inventory based on recent call observations and local credential-shape drift. Use `probe: true` only when diagnosing live health or authorization.\n\n## Code mode\n\nUse code mode when calls depend on earlier results, when joining connectors, or when sandbox filtering or aggregation will substantially shrink the response. Use `Promise.all` or `connecta.batch` for independent calls inside one execution.\n\nConnector namespace calls and `connecta.call` use the same read-only gate and throw on downstream errors. Catch only failures the workflow can handle; let authorization failures return to the agent for recovery.\n\nDo not use code mode for one call, independent calls already handled by `batch_call`, or any tool lacking `readOnlyHint: true`. Host calls and time are bounded. Return only the reduced value the agent needs.\n";
|
|
4
4
|
/**
|
|
5
5
|
* Appended to USAGE_SKILL only when the deployment actually has at least one
|
|
6
6
|
* connector guide. A deployment with none — every deployment that has not
|
|
@@ -21,10 +21,7 @@ export interface SkillListing {
|
|
|
21
21
|
/**
|
|
22
22
|
* Every fetchable skill: the built-in guides plus one entry per connector that
|
|
23
23
|
* carries a usage guide. Derived from the connector list passed in — the single
|
|
24
|
-
* place guide visibility is decided.
|
|
25
|
-
* connection's `registry.listConnectors()`, so a toolkit-scoped session lists
|
|
26
|
-
* only in-scope guides, and `resolveSkill` below reports an out-of-scope
|
|
27
|
-
* `connector:<id>` exactly as it reports an unknown connector.
|
|
24
|
+
* place guide visibility is decided.
|
|
28
25
|
*/
|
|
29
26
|
export declare function listSkills(connectors: readonly Connector[]): SkillListing[];
|
|
30
27
|
export type SkillLookup = {
|
package/dist/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,qBAAqB
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,qBAAqB,grBACooB,CAAC;AAEvqB,eAAO,MAAM,WAAW,ktDAwBvB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,odAIpC,CAAC;AAEF,oEAAoE;AACpE,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,OAAO,CAI5E;AA2BD,uDAAuD;AACvD,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,kFAAkF;AAClF,wBAAgB,cAAc,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,GAAG,SAAS,CAGvE;AAyDD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,SAAS,SAAS,EAAE,GAAG,YAAY,EAAE,CAc3E;AAED,MAAM,MAAM,WAAW,GACrB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,SAAS,SAAS,EAAE,GAC/B,WAAW,CAsCb"}
|
package/dist/skills.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
export const CONNECTA_INSTRUCTIONS = 'Connecta exposes many integrations behind meta-tools. When an address is unknown, start with search_tools and includeSchemas="compact"; use describe_tools only when that schema is insufficient. Use call_tool for one explicitly read-only call, batch_call for 2–10 independent explicitly read-only calls, and execute_code (when available) only for dependent read-only steps, loops, joins, or reducing large results. Unannotated, write-capable, and destructive tools must use call_destructive_tool individually. Use authorize_connector only after auth_required and get_result only for truncated results.
|
|
1
|
+
export const CONNECTA_INSTRUCTIONS = 'Connecta exposes many integrations behind meta-tools. When an address is unknown, start with search_tools and includeSchemas="compact"; use describe_tools only when that schema is insufficient. Use call_tool for one explicitly read-only call, batch_call for 2–10 independent explicitly read-only calls, and execute_code (when available) only for dependent read-only steps, loops, joins, or reducing large results. Unannotated, write-capable, and destructive tools must use call_destructive_tool individually. Use authorize_connector only after auth_required and get_result only for truncated results. Fetch skills({ name: "usage" }) when this routing workflow is unfamiliar.';
|
|
2
2
|
export const USAGE_SKILL = `# Connecta usage
|
|
3
3
|
|
|
4
4
|
## Choose the smallest execution tool
|
|
5
5
|
|
|
6
|
+
Use exact addresses returned by discovery; never invent one.
|
|
7
|
+
|
|
6
8
|
- Unknown address: \`search_tools({ query, includeSchemas: "compact" })\`.
|
|
7
9
|
- Schema still unclear: \`describe_tools({ addresses: [...] })\`.
|
|
8
10
|
- One explicitly read-only call: \`call_tool\`.
|
|
@@ -10,45 +12,17 @@ export const USAGE_SKILL = `# Connecta usage
|
|
|
10
12
|
- Dependent read-only calls, loops, joins, branching, or large-result reduction: \`execute_code\` when available.
|
|
11
13
|
- Any unannotated, write-capable, or destructive call: \`call_destructive_tool\`, individually and only after reviewing its schema and consequences.
|
|
12
14
|
- Truncated result: retry with \`fields\` when possible; otherwise page it with \`get_result\`.
|
|
13
|
-
- \`auth_required\`: use \`authorize_connector\`,
|
|
15
|
+
- \`auth_required\`: use \`authorize_connector\`, give its recovery handoff to the operator, then retry the original call.
|
|
14
16
|
|
|
15
|
-
Use \`list_connectors({ probe: false })\` for a fast inventory. Use \`probe: true\` only when diagnosing live health or authorization.
|
|
17
|
+
Use \`list_connectors({ probe: false })\` for a fast inventory based on recent call observations and local credential-shape drift. Use \`probe: true\` only when diagnosing live health or authorization.
|
|
16
18
|
|
|
17
19
|
## Code mode
|
|
18
20
|
|
|
19
|
-
Use code mode when
|
|
20
|
-
|
|
21
|
-
Do not use code mode for one straightforward call, for independent calls already handled by \`batch_call\`, or for any tool not explicitly annotated \`readOnlyHint: true\`. Code mode has a bounded host-call budget and per-call deadline. Return only the reduced value the agent needs; do not return a large upstream payload unchanged.
|
|
22
|
-
|
|
23
|
-
## Examples
|
|
21
|
+
Use code mode when calls depend on earlier results, when joining connectors, or when sandbox filtering or aggregation will substantially shrink the response. Use \`Promise.all\` or \`connecta.batch\` for independent calls inside one execution.
|
|
24
22
|
|
|
25
|
-
|
|
23
|
+
Connector namespace calls and \`connecta.call\` use the same read-only gate and throw on downstream errors. Catch only failures the workflow can handle; let authorization failures return to the agent for recovery.
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
\`\`\`json
|
|
29
|
-
{ "address": "crm.get_account", "args": { "id": "acct_123" }, "resultMode": "value" }
|
|
30
|
-
\`\`\`
|
|
31
|
-
|
|
32
|
-
Independent calls:
|
|
33
|
-
\`\`\`json
|
|
34
|
-
{ "calls": [
|
|
35
|
-
{ "address": "crm.get_account", "args": { "id": "acct_123" } },
|
|
36
|
-
{ "address": "billing.list_invoices", "args": { "status": "open" } }
|
|
37
|
-
] }
|
|
38
|
-
\`\`\`
|
|
39
|
-
|
|
40
|
-
Dependent code with reduction:
|
|
41
|
-
\`\`\`js
|
|
42
|
-
async () => {
|
|
43
|
-
const accounts = await crm.search_accounts({ query: "renewal" });
|
|
44
|
-
const details = await Promise.all(
|
|
45
|
-
accounts.results.slice(0, 5).map((account) =>
|
|
46
|
-
crm.get_account({ id: account.id })
|
|
47
|
-
)
|
|
48
|
-
);
|
|
49
|
-
return details.map(({ id, name, status }) => ({ id, name, status }));
|
|
50
|
-
}
|
|
51
|
-
\`\`\`
|
|
25
|
+
Do not use code mode for one call, independent calls already handled by \`batch_call\`, or any tool lacking \`readOnlyHint: true\`. Host calls and time are bounded. Return only the reduced value the agent needs.
|
|
52
26
|
`;
|
|
53
27
|
/**
|
|
54
28
|
* Appended to USAGE_SKILL only when the deployment actually has at least one
|
|
@@ -152,10 +126,7 @@ function summarizeGuide(connector, guide) {
|
|
|
152
126
|
/**
|
|
153
127
|
* Every fetchable skill: the built-in guides plus one entry per connector that
|
|
154
128
|
* carries a usage guide. Derived from the connector list passed in — the single
|
|
155
|
-
* place guide visibility is decided.
|
|
156
|
-
* connection's `registry.listConnectors()`, so a toolkit-scoped session lists
|
|
157
|
-
* only in-scope guides, and `resolveSkill` below reports an out-of-scope
|
|
158
|
-
* `connector:<id>` exactly as it reports an unknown connector.
|
|
129
|
+
* place guide visibility is decided.
|
|
159
130
|
*/
|
|
160
131
|
export function listSkills(connectors) {
|
|
161
132
|
const listing = AVAILABLE_SKILLS.map((skill) => ({
|
package/dist/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAChC,
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAChC,oqBAAoqB,CAAC;AAEvqB,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwB1B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;CAIvC,CAAC;AAEF,oEAAoE;AACpE,MAAM,UAAU,kBAAkB,CAAC,UAAgC;IACjE,OAAO,UAAU,CAAC,IAAI,CACpB,CAAC,SAAS,EAAE,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,KAAK,SAAS,CACvD,CAAC;AACJ,CAAC;AA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timeout.d.ts","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,wBAAwB,QAAS,CAAC;AAE/C,uEAAuE;AACvE,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,GAAG,SAAS,GACxB,MAAM,GAAG,SAAS,CAKpB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,EACnB,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,CAAC,CAAC,CAgBZ;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EAC9C,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,CAAC,CAAC,CA2BZ"}
|
package/dist/timeout.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// The deadline vocabulary shared by
|
|
2
|
-
//
|
|
3
|
-
// liveness checks (src/credential-health.ts). One definition so a "probe" means
|
|
4
|
-
// the same thing, and is bounded the same way, wherever one is issued.
|
|
1
|
+
// The deadline vocabulary shared by downstream discovery probes and tool calls.
|
|
2
|
+
// One definition keeps those waits bounded consistently.
|
|
5
3
|
/**
|
|
6
4
|
* Generous default bound for a single downstream probe/catalog call. High enough
|
|
7
5
|
* to trip only on a pathological hang, not a realistically slow probe.
|
package/dist/timeout.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"timeout.js","sourceRoot":"","sources":["../src/timeout.ts"],"names":[],"mappings":"AAAA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AY,GAAG,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,EAAE,IAAI,CAAC,CAAC;QACnE,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,UAAU,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;YAC/B,MAAM,CAAC,YAAY,CAAC,CAAC;QACvB,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,OAAmB,CAAC;QACxB,IAAI,CAAC;YACH,OAAO,GAAG,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QACzC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,GAAG,CAAC,CAAC;YACZ,OAAO;QACT,CAAC;QACD,OAAO,CAAC,IAAI,CACV,CAAC,KAAK,EAAE,EAAE;YACR,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC,EACD,CAAC,GAAG,EAAE,EAAE;YACN,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,GAAG,CAAC,CAAC;QACd,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ export interface ConnectorContext {
|
|
|
153
153
|
/** Requested connector-operation deadline in milliseconds. */
|
|
154
154
|
timeoutMs?: number;
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
type ConnectorStatusState = "ok" | "auth_required" | "error";
|
|
157
157
|
export interface ConnectorStatus {
|
|
158
158
|
state: ConnectorStatusState;
|
|
159
159
|
/** When state === "auth_required", the URL the operator should open. */
|
|
@@ -197,19 +197,6 @@ export interface Connector {
|
|
|
197
197
|
testCredential?(value: string, ctx: ConnectorContext): Promise<CredentialTestResult>;
|
|
198
198
|
/** Optional multi-field credential check used by /credentials' Test action. */
|
|
199
199
|
testCredentials?(values: ConnectorCredentialValues, ctx: ConnectorContext): Promise<CredentialTestResult>;
|
|
200
|
-
/**
|
|
201
|
-
* Optional: whether this connector currently holds a stored downstream
|
|
202
|
-
* credential — an OAuth grant it persisted, typically. Read only by the
|
|
203
|
-
* credential liveness checks: a connector with nothing stored has no
|
|
204
|
-
* credential whose liveness could be in question, and probing it anyway would
|
|
205
|
-
* start an authorization flow nobody asked for.
|
|
206
|
-
*
|
|
207
|
-
* Implement it on connectors that manage their own credential storage (the
|
|
208
|
-
* shipped `remoteMcp` does, for `auth: { type: "oauth" }`). Connectors whose
|
|
209
|
-
* credential lives in connecta's vault (`credential` above) need not: the
|
|
210
|
-
* vault answers for them. Must not perform downstream I/O.
|
|
211
|
-
*/
|
|
212
|
-
hasStoredCredential?(ctx: ConnectorContext): Promise<boolean>;
|
|
213
200
|
/**
|
|
214
201
|
* Statically-known tool defs, exposed by in-code connectors (`api()`) for
|
|
215
202
|
* startup convention checks. Remote connectors omit this — their tools are
|
|
@@ -342,48 +329,11 @@ export interface ExecutorLease {
|
|
|
342
329
|
/** Idempotent. Call from finally even when provider construction fails. */
|
|
343
330
|
release(): void;
|
|
344
331
|
}
|
|
345
|
-
/**
|
|
346
|
-
* Which toolkits one inbound identity may open — the membership half of the
|
|
347
|
-
* deployment=org / toolkit=team framing (documentation/toolkits.md). A mapping, never a
|
|
348
|
-
* policy engine: one identity → the toolkit names it may select, plus whether
|
|
349
|
-
* it may connect with no `?toolkit=` at all.
|
|
350
|
-
*
|
|
351
|
-
* An identity with NO binding is unbound and keeps the pre-binding behavior:
|
|
352
|
-
* any declared toolkit, or the full registry. A binding is enforced at connect
|
|
353
|
-
* time, before any scoped registry is constructed.
|
|
354
|
-
*/
|
|
355
|
-
export interface ToolkitBinding {
|
|
356
|
-
/** Toolkit names this identity may select with `?toolkit=<name>`. */
|
|
357
|
-
readonly toolkits: readonly string[];
|
|
358
|
-
/**
|
|
359
|
-
* Whether this identity may also connect with no `?toolkit=` and see the full
|
|
360
|
-
* registry (and read the deployment-wide operator surfaces). Defaults to
|
|
361
|
-
* false: binding a credential to a toolkit means binding it.
|
|
362
|
-
*/
|
|
363
|
-
readonly unscoped?: boolean;
|
|
364
|
-
}
|
|
365
332
|
/** Result of an inbound-auth check. */
|
|
366
333
|
export type AuthResult = {
|
|
367
334
|
ok: true;
|
|
368
335
|
userId?: string;
|
|
369
336
|
subjectId?: string;
|
|
370
|
-
/**
|
|
371
|
-
* Toolkit binding resolved for THIS identity — the seam for an adapter
|
|
372
|
-
* that maps its own users (or an IdP claim) to views. Omit to inherit the
|
|
373
|
-
* provider's `toolkitBinding`.
|
|
374
|
-
*
|
|
375
|
-
* When the provider also declares one, the declaration is a **CEILING**,
|
|
376
|
-
* not a default: connecta intersects the two, and grants `unscoped` only
|
|
377
|
-
* if both do. A per-identity binding can therefore narrow the credential's
|
|
378
|
-
* view but never widen it — otherwise an adapter reading a user-writable
|
|
379
|
-
* claim would let the user name their own toolkits. When the provider
|
|
380
|
-
* declares nothing, this binding is used as given.
|
|
381
|
-
*
|
|
382
|
-
* Validated on arrival (a malformed one refuses the request with 403
|
|
383
|
-
* rather than being ignored), but never checked against the configured
|
|
384
|
-
* toolkits, which is only possible for the static declaration at startup.
|
|
385
|
-
*/
|
|
386
|
-
toolkitBinding?: ToolkitBinding;
|
|
387
337
|
} | {
|
|
388
338
|
ok: false;
|
|
389
339
|
response: Response;
|
|
@@ -480,17 +430,10 @@ export interface InboundAuth {
|
|
|
480
430
|
* provider instead of asking the operator to paste a static bearer secret.
|
|
481
431
|
*/
|
|
482
432
|
uiAuth?: UiAuthConfig;
|
|
483
|
-
/**
|
|
484
|
-
* Optional toolkit binding for every identity this provider admits
|
|
485
|
-
* (documentation/toolkits.md). Declared statically so `createConnecta` can validate the
|
|
486
|
-
* names against `ConnectaConfig.toolkits` and throw on a typo — a binding
|
|
487
|
-
* nobody wrote is not one an operator can reason about. An `authorize` result
|
|
488
|
-
* may narrow it per identity with its own `toolkitBinding`.
|
|
489
|
-
*/
|
|
490
|
-
toolkitBinding?: ToolkitBinding;
|
|
491
433
|
/** Serve/short-circuit .well-known + OPTIONS. Return null when not handled. */
|
|
492
434
|
handleMetadata?(request: Request, baseUrl: string): Response | null | Promise<Response | null>;
|
|
493
435
|
/** Attempt to authorize a request. */
|
|
494
436
|
authorize(request: Request, baseUrl: string): AuthResult | Promise<AuthResult>;
|
|
495
437
|
}
|
|
438
|
+
export {};
|
|
496
439
|
//# sourceMappingURL=types.d.ts.map
|