@zackbart/connecta 0.7.9 → 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 +135 -0
- package/README.md +47 -148
- 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 +3 -24
- 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 +9 -4
- package/dist/call-admission.js.map +1 -1
- package/dist/catalog-fingerprint.d.ts +20 -0
- package/dist/catalog-fingerprint.d.ts.map +1 -0
- package/dist/catalog-fingerprint.js +34 -0
- package/dist/catalog-fingerprint.js.map +1 -0
- package/dist/catalog-limits.d.ts +10 -0
- package/dist/catalog-limits.d.ts.map +1 -0
- package/dist/catalog-limits.js +10 -0
- package/dist/catalog-limits.js.map +1 -0
- package/dist/catalog-service.d.ts +137 -0
- package/dist/catalog-service.d.ts.map +1 -0
- package/dist/catalog-service.js +401 -0
- package/dist/catalog-service.js.map +1 -0
- package/dist/catalog.d.ts +6 -0
- package/dist/catalog.d.ts.map +1 -1
- package/dist/catalog.js +53 -2
- package/dist/catalog.js.map +1 -1
- package/dist/concurrency.d.ts +4 -0
- package/dist/concurrency.d.ts.map +1 -0
- package/dist/concurrency.js +31 -0
- package/dist/concurrency.js.map +1 -0
- package/dist/connectors/api.d.ts.map +1 -1
- package/dist/connectors/api.js +22 -12
- package/dist/connectors/api.js.map +1 -1
- package/dist/connectors/remote-mcp.d.ts.map +1 -1
- package/dist/connectors/remote-mcp.js +53 -41
- package/dist/connectors/remote-mcp.js.map +1 -1
- package/dist/credentials.d.ts +3 -2
- package/dist/credentials.d.ts.map +1 -1
- package/dist/errors.d.ts +19 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +10 -16
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +143 -330
- package/dist/execute.js.map +1 -1
- package/dist/executor-result.d.ts +0 -3
- package/dist/executor-result.d.ts.map +1 -1
- package/dist/executor-result.js +3 -3
- package/dist/executor-result.js.map +1 -1
- package/dist/executors/quickjs-child.js +3 -3
- package/dist/executors/quickjs-child.js.map +1 -1
- package/dist/executors/quickjs-protocol.d.ts +4 -1
- package/dist/executors/quickjs-protocol.d.ts.map +1 -1
- package/dist/executors/quickjs-runtime.d.ts.map +1 -1
- package/dist/executors/quickjs-runtime.js +7 -2
- package/dist/executors/quickjs-runtime.js.map +1 -1
- package/dist/executors/quickjs.d.ts.map +1 -1
- package/dist/executors/quickjs.js +4 -1
- package/dist/executors/quickjs.js.map +1 -1
- package/dist/favicon.js +2 -2
- package/dist/favicon.js.map +1 -1
- package/dist/index.d.ts +8 -82
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -104
- package/dist/index.js.map +1 -1
- package/dist/invocation.d.ts +101 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +405 -0
- package/dist/invocation.js.map +1 -0
- package/dist/meta-tools.d.ts +9 -95
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +235 -725
- package/dist/meta-tools.js.map +1 -1
- package/dist/operator-ui/generated.d.ts +3 -0
- package/dist/operator-ui/generated.d.ts.map +1 -0
- package/dist/operator-ui/generated.js +5 -0
- package/dist/operator-ui/generated.js.map +1 -0
- package/dist/operator-ui/model.d.ts +73 -0
- package/dist/operator-ui/model.d.ts.map +1 -0
- package/dist/operator-ui/model.js +28 -0
- package/dist/operator-ui/model.js.map +1 -0
- package/dist/registry.d.ts +33 -184
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +345 -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 +3 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/activity.js +170 -0
- package/dist/routes/activity.js.map +1 -0
- package/dist/routes/credentials.d.ts +3 -0
- package/dist/routes/credentials.d.ts.map +1 -0
- package/dist/routes/credentials.js +170 -0
- package/dist/routes/credentials.js.map +1 -0
- package/dist/routes/mcp.d.ts +8 -0
- package/dist/routes/mcp.d.ts.map +1 -0
- package/dist/routes/mcp.js +270 -0
- package/dist/routes/mcp.js.map +1 -0
- package/dist/routes/oauth.d.ts +4 -0
- package/dist/routes/oauth.d.ts.map +1 -0
- package/dist/routes/oauth.js +263 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/shared.d.ts +76 -0
- package/dist/routes/shared.d.ts.map +1 -0
- package/dist/routes/shared.js +140 -0
- package/dist/routes/shared.js.map +1 -0
- package/dist/routes/ui.d.ts +3 -0
- package/dist/routes/ui.d.ts.map +1 -0
- package/dist/routes/ui.js +116 -0
- package/dist/routes/ui.js.map +1 -0
- package/dist/server.d.ts +9 -40
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +62 -1322
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +3 -21
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +15 -43
- package/dist/skills.js.map +1 -1
- package/dist/storage/file.d.ts.map +1 -1
- package/dist/storage/file.js +3 -1
- package/dist/storage/file.js.map +1 -1
- package/dist/storage/memory.d.ts.map +1 -1
- package/dist/storage/memory.js +3 -1
- package/dist/storage/memory.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 +9 -59
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +3 -94
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +30 -1427
- package/dist/ui.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +15 -8
- package/src/activity.ts +0 -9
- package/src/auth/bearer.ts +4 -33
- package/src/auth/clerk.ts +35 -48
- package/src/call-admission.ts +8 -6
- package/src/catalog-fingerprint.ts +52 -0
- package/src/catalog-limits.ts +11 -0
- package/src/catalog-service.ts +601 -0
- package/src/catalog.ts +57 -2
- package/src/concurrency.ts +39 -0
- package/src/connectors/api.ts +22 -12
- package/src/connectors/remote-mcp.ts +63 -45
- package/src/credentials.ts +2 -2
- package/src/errors.ts +21 -1
- package/src/execute.ts +193 -423
- package/src/executor-result.ts +3 -3
- package/src/executors/quickjs-child.ts +8 -4
- package/src/executors/quickjs-protocol.ts +1 -1
- package/src/executors/quickjs-runtime.ts +5 -1
- package/src/executors/quickjs.ts +11 -8
- package/src/favicon.ts +2 -2
- package/src/index.ts +70 -222
- package/src/invocation.ts +580 -0
- package/src/meta-tools.ts +393 -985
- package/src/operator-ui/browser.css +360 -0
- package/src/operator-ui/browser.ts +987 -0
- package/src/operator-ui/generated.ts +4 -0
- package/src/operator-ui/model.ts +105 -0
- package/src/registry.ts +459 -439
- package/src/retired-toolkits.ts +14 -0
- package/src/routes/activity.ts +215 -0
- package/src/routes/credentials.ts +254 -0
- package/src/routes/mcp.ts +339 -0
- package/src/routes/oauth.ts +322 -0
- package/src/routes/shared.ts +240 -0
- package/src/routes/ui.ts +143 -0
- package/src/server.ts +64 -1731
- package/src/skills.ts +15 -43
- package/src/storage/file.ts +3 -1
- package/src/storage/memory.ts +3 -1
- package/src/timeout.ts +2 -4
- package/src/types.ts +8 -60
- package/src/ui.ts +60 -1538
- package/src/version.ts +1 -1
- package/dist/credential-health.d.ts +0 -227
- package/dist/credential-health.d.ts.map +0 -1
- package/dist/credential-health.js +0 -606
- package/dist/credential-health.js.map +0 -1
- package/dist/toolkits.d.ts +0 -146
- 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 -832
- package/src/toolkits.ts +0 -461
package/src/skills.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type { Connector } from "./types.js";
|
|
2
2
|
|
|
3
3
|
export const CONNECTA_INSTRUCTIONS =
|
|
4
|
-
'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.
|
|
4
|
+
'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.';
|
|
5
5
|
|
|
6
6
|
export const USAGE_SKILL = `# Connecta usage
|
|
7
7
|
|
|
8
8
|
## Choose the smallest execution tool
|
|
9
9
|
|
|
10
|
+
Use exact addresses returned by discovery; never invent one.
|
|
11
|
+
|
|
10
12
|
- Unknown address: \`search_tools({ query, includeSchemas: "compact" })\`.
|
|
11
13
|
- Schema still unclear: \`describe_tools({ addresses: [...] })\`.
|
|
12
14
|
- One explicitly read-only call: \`call_tool\`.
|
|
@@ -14,45 +16,17 @@ export const USAGE_SKILL = `# Connecta usage
|
|
|
14
16
|
- Dependent read-only calls, loops, joins, branching, or large-result reduction: \`execute_code\` when available.
|
|
15
17
|
- Any unannotated, write-capable, or destructive call: \`call_destructive_tool\`, individually and only after reviewing its schema and consequences.
|
|
16
18
|
- Truncated result: retry with \`fields\` when possible; otherwise page it with \`get_result\`.
|
|
17
|
-
- \`auth_required\`: use \`authorize_connector\`,
|
|
19
|
+
- \`auth_required\`: use \`authorize_connector\`, give its recovery handoff to the operator, then retry the original call.
|
|
18
20
|
|
|
19
|
-
Use \`list_connectors({ probe: false })\` for a fast inventory. Use \`probe: true\` only when diagnosing live health or authorization.
|
|
21
|
+
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.
|
|
20
22
|
|
|
21
23
|
## Code mode
|
|
22
24
|
|
|
23
|
-
Use code mode when
|
|
24
|
-
|
|
25
|
-
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.
|
|
26
|
-
|
|
27
|
-
## Examples
|
|
28
|
-
|
|
29
|
-
These addresses are illustrative; always use the exact address returned by \`search_tools\`.
|
|
25
|
+
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.
|
|
30
26
|
|
|
31
|
-
|
|
32
|
-
\`\`\`json
|
|
33
|
-
{ "address": "crm.get_account", "args": { "id": "acct_123" }, "resultMode": "value" }
|
|
34
|
-
\`\`\`
|
|
27
|
+
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.
|
|
35
28
|
|
|
36
|
-
|
|
37
|
-
\`\`\`json
|
|
38
|
-
{ "calls": [
|
|
39
|
-
{ "address": "crm.get_account", "args": { "id": "acct_123" } },
|
|
40
|
-
{ "address": "billing.list_invoices", "args": { "status": "open" } }
|
|
41
|
-
] }
|
|
42
|
-
\`\`\`
|
|
43
|
-
|
|
44
|
-
Dependent code with reduction:
|
|
45
|
-
\`\`\`js
|
|
46
|
-
async () => {
|
|
47
|
-
const accounts = await crm.search_accounts({ query: "renewal" });
|
|
48
|
-
const details = await Promise.all(
|
|
49
|
-
accounts.results.slice(0, 5).map((account) =>
|
|
50
|
-
crm.get_account({ id: account.id })
|
|
51
|
-
)
|
|
52
|
-
);
|
|
53
|
-
return details.map(({ id, name, status }) => ({ id, name, status }));
|
|
54
|
-
}
|
|
55
|
-
\`\`\`
|
|
29
|
+
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.
|
|
56
30
|
`;
|
|
57
31
|
|
|
58
32
|
/**
|
|
@@ -75,13 +49,13 @@ export function hasConnectorGuides(connectors: readonly Connector[]): boolean {
|
|
|
75
49
|
}
|
|
76
50
|
|
|
77
51
|
/** The built-in usage guide, plus the guides section when there is one to point at. */
|
|
78
|
-
|
|
52
|
+
function usageSkill(connectors: readonly Connector[]): string {
|
|
79
53
|
return hasConnectorGuides(connectors)
|
|
80
54
|
? USAGE_SKILL + CONNECTOR_GUIDES_SECTION
|
|
81
55
|
: USAGE_SKILL;
|
|
82
56
|
}
|
|
83
57
|
|
|
84
|
-
|
|
58
|
+
const AVAILABLE_SKILLS = [
|
|
85
59
|
{
|
|
86
60
|
name: "usage",
|
|
87
61
|
description:
|
|
@@ -97,7 +71,7 @@ export const AVAILABLE_SKILLS = [
|
|
|
97
71
|
* The prefixed form is the ONLY way to reach a connector guide: a bare
|
|
98
72
|
* connector id is never resolved, so nothing shadows anything silently.
|
|
99
73
|
*/
|
|
100
|
-
|
|
74
|
+
const CONNECTOR_SKILL_PREFIX = "connector:";
|
|
101
75
|
|
|
102
76
|
/** The skill name that fetches `connector`'s guide. */
|
|
103
77
|
export function connectorSkillName(connectorId: string): string {
|
|
@@ -128,8 +102,9 @@ const NOT_SUMMARY_RE = /^\s*(?:<!--|\|)|^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/;
|
|
|
128
102
|
/** Drop a leading YAML frontmatter block — metadata, not summary text. */
|
|
129
103
|
function withoutFrontmatter(lines: string[]): string[] {
|
|
130
104
|
let start = 0;
|
|
131
|
-
while (start < lines.length && lines[start].trim() === "") start++;
|
|
132
|
-
|
|
105
|
+
while (start < lines.length && (lines[start] ?? "").trim() === "") start++;
|
|
106
|
+
const openingRule = lines[start];
|
|
107
|
+
if (openingRule === undefined || !RULE_RE.test(openingRule)) return lines;
|
|
133
108
|
const close = lines.findIndex((line, i) => i > start && RULE_RE.test(line));
|
|
134
109
|
return close === -1 ? lines : lines.slice(close + 1);
|
|
135
110
|
}
|
|
@@ -172,10 +147,7 @@ export interface SkillListing {
|
|
|
172
147
|
/**
|
|
173
148
|
* Every fetchable skill: the built-in guides plus one entry per connector that
|
|
174
149
|
* carries a usage guide. Derived from the connector list passed in — the single
|
|
175
|
-
* place guide visibility is decided.
|
|
176
|
-
* connection's `registry.listConnectors()`, so a toolkit-scoped session lists
|
|
177
|
-
* only in-scope guides, and `resolveSkill` below reports an out-of-scope
|
|
178
|
-
* `connector:<id>` exactly as it reports an unknown connector.
|
|
150
|
+
* place guide visibility is decided.
|
|
179
151
|
*/
|
|
180
152
|
export function listSkills(connectors: readonly Connector[]): SkillListing[] {
|
|
181
153
|
const listing: SkillListing[] = AVAILABLE_SKILLS.map((skill) => ({
|
package/src/storage/file.ts
CHANGED
|
@@ -104,7 +104,9 @@ export function fileStorage(
|
|
|
104
104
|
async set(key, value, opts) {
|
|
105
105
|
data[key] = {
|
|
106
106
|
value,
|
|
107
|
-
|
|
107
|
+
...(opts?.ttlSeconds
|
|
108
|
+
? { exp: Date.now() + opts.ttlSeconds * 1000 }
|
|
109
|
+
: {}),
|
|
108
110
|
};
|
|
109
111
|
persist();
|
|
110
112
|
},
|
package/src/storage/memory.ts
CHANGED
|
@@ -24,7 +24,9 @@ export function memoryStorage(): KVStorage {
|
|
|
24
24
|
async set(key, value, opts) {
|
|
25
25
|
map.set(key, {
|
|
26
26
|
value,
|
|
27
|
-
|
|
27
|
+
...(opts?.ttlSeconds
|
|
28
|
+
? { exp: Date.now() + opts.ttlSeconds * 1000 }
|
|
29
|
+
: {}),
|
|
28
30
|
});
|
|
29
31
|
},
|
|
30
32
|
async delete(key) {
|
package/src/timeout.ts
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
|
/**
|
|
7
5
|
* Generous default bound for a single downstream probe/catalog call. High enough
|
package/src/types.ts
CHANGED
|
@@ -174,7 +174,7 @@ export interface ConnectorContext {
|
|
|
174
174
|
timeoutMs?: number;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
type ConnectorStatusState = "ok" | "auth_required" | "error";
|
|
178
178
|
|
|
179
179
|
export interface ConnectorStatus {
|
|
180
180
|
state: ConnectorStatusState;
|
|
@@ -226,19 +226,6 @@ export interface Connector {
|
|
|
226
226
|
values: ConnectorCredentialValues,
|
|
227
227
|
ctx: ConnectorContext,
|
|
228
228
|
): Promise<CredentialTestResult>;
|
|
229
|
-
/**
|
|
230
|
-
* Optional: whether this connector currently holds a stored downstream
|
|
231
|
-
* credential — an OAuth grant it persisted, typically. Read only by the
|
|
232
|
-
* credential liveness checks: a connector with nothing stored has no
|
|
233
|
-
* credential whose liveness could be in question, and probing it anyway would
|
|
234
|
-
* start an authorization flow nobody asked for.
|
|
235
|
-
*
|
|
236
|
-
* Implement it on connectors that manage their own credential storage (the
|
|
237
|
-
* shipped `remoteMcp` does, for `auth: { type: "oauth" }`). Connectors whose
|
|
238
|
-
* credential lives in connecta's vault (`credential` above) need not: the
|
|
239
|
-
* vault answers for them. Must not perform downstream I/O.
|
|
240
|
-
*/
|
|
241
|
-
hasStoredCredential?(ctx: ConnectorContext): Promise<boolean>;
|
|
242
229
|
/**
|
|
243
230
|
* Statically-known tool defs, exposed by in-code connectors (`api()`) for
|
|
244
231
|
* startup convention checks. Remote connectors omit this — their tools are
|
|
@@ -320,6 +307,13 @@ export interface ExecuteResult {
|
|
|
320
307
|
export interface ExecutorProvider {
|
|
321
308
|
name: string;
|
|
322
309
|
fns: Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
310
|
+
/**
|
|
311
|
+
* Optional trusted sandbox-side setup run after provider globals exist.
|
|
312
|
+
* Connecta uses this to install lazy connector namespace proxies without
|
|
313
|
+
* materializing one host closure per tool. This is host-authored code, never
|
|
314
|
+
* model input.
|
|
315
|
+
*/
|
|
316
|
+
prelude?: string;
|
|
323
317
|
}
|
|
324
318
|
|
|
325
319
|
/**
|
|
@@ -377,50 +371,12 @@ export interface ExecutorLease {
|
|
|
377
371
|
release(): void;
|
|
378
372
|
}
|
|
379
373
|
|
|
380
|
-
/**
|
|
381
|
-
* Which toolkits one inbound identity may open — the membership half of the
|
|
382
|
-
* deployment=org / toolkit=team framing (docs/toolkits.md). A mapping, never a
|
|
383
|
-
* policy engine: one identity → the toolkit names it may select, plus whether
|
|
384
|
-
* it may connect with no `?toolkit=` at all.
|
|
385
|
-
*
|
|
386
|
-
* An identity with NO binding is unbound and keeps the pre-binding behavior:
|
|
387
|
-
* any declared toolkit, or the full registry. A binding is enforced at connect
|
|
388
|
-
* time, before any scoped registry is constructed.
|
|
389
|
-
*/
|
|
390
|
-
export interface ToolkitBinding {
|
|
391
|
-
/** Toolkit names this identity may select with `?toolkit=<name>`. */
|
|
392
|
-
readonly toolkits: readonly string[];
|
|
393
|
-
/**
|
|
394
|
-
* Whether this identity may also connect with no `?toolkit=` and see the full
|
|
395
|
-
* registry (and read the deployment-wide operator surfaces). Defaults to
|
|
396
|
-
* false: binding a credential to a toolkit means binding it.
|
|
397
|
-
*/
|
|
398
|
-
readonly unscoped?: boolean;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
374
|
/** Result of an inbound-auth check. */
|
|
402
375
|
export type AuthResult =
|
|
403
376
|
| {
|
|
404
377
|
ok: true;
|
|
405
378
|
userId?: string;
|
|
406
379
|
subjectId?: string;
|
|
407
|
-
/**
|
|
408
|
-
* Toolkit binding resolved for THIS identity — the seam for an adapter
|
|
409
|
-
* that maps its own users (or an IdP claim) to views. Omit to inherit the
|
|
410
|
-
* provider's `toolkitBinding`.
|
|
411
|
-
*
|
|
412
|
-
* When the provider also declares one, the declaration is a **CEILING**,
|
|
413
|
-
* not a default: connecta intersects the two, and grants `unscoped` only
|
|
414
|
-
* if both do. A per-identity binding can therefore narrow the credential's
|
|
415
|
-
* view but never widen it — otherwise an adapter reading a user-writable
|
|
416
|
-
* claim would let the user name their own toolkits. When the provider
|
|
417
|
-
* declares nothing, this binding is used as given.
|
|
418
|
-
*
|
|
419
|
-
* Validated on arrival (a malformed one refuses the request with 403
|
|
420
|
-
* rather than being ignored), but never checked against the configured
|
|
421
|
-
* toolkits, which is only possible for the static declaration at startup.
|
|
422
|
-
*/
|
|
423
|
-
toolkitBinding?: ToolkitBinding;
|
|
424
380
|
}
|
|
425
381
|
| { ok: false; response: Response };
|
|
426
382
|
|
|
@@ -520,14 +476,6 @@ export interface InboundAuth {
|
|
|
520
476
|
* provider instead of asking the operator to paste a static bearer secret.
|
|
521
477
|
*/
|
|
522
478
|
uiAuth?: UiAuthConfig;
|
|
523
|
-
/**
|
|
524
|
-
* Optional toolkit binding for every identity this provider admits
|
|
525
|
-
* (docs/toolkits.md). Declared statically so `createConnecta` can validate the
|
|
526
|
-
* names against `ConnectaConfig.toolkits` and throw on a typo — a binding
|
|
527
|
-
* nobody wrote is not one an operator can reason about. An `authorize` result
|
|
528
|
-
* may narrow it per identity with its own `toolkitBinding`.
|
|
529
|
-
*/
|
|
530
|
-
toolkitBinding?: ToolkitBinding;
|
|
531
479
|
/** Serve/short-circuit .well-known + OPTIONS. Return null when not handled. */
|
|
532
480
|
handleMetadata?(
|
|
533
481
|
request: Request,
|