@zackbart/connecta 0.7.8 → 0.8.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 +94 -0
- package/README.md +67 -144
- package/dist/activity.d.ts +1 -1
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js.map +1 -1
- package/dist/auth/bearer.d.ts +1 -1
- package/dist/auth/bearer.js +4 -4
- package/dist/auth/bearer.js.map +1 -1
- package/dist/auth/clerk.d.ts +1 -1
- package/dist/auth/clerk.js +1 -1
- package/dist/call-admission.d.ts +81 -0
- package/dist/call-admission.d.ts.map +1 -0
- package/dist/call-admission.js +345 -0
- package/dist/call-admission.js.map +1 -0
- 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 +138 -0
- package/dist/catalog-service.d.ts.map +1 -0
- package/dist/catalog-service.js +407 -0
- package/dist/catalog-service.js.map +1 -0
- package/dist/catalog.js +2 -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 +3 -1
- package/dist/connectors/api.d.ts.map +1 -1
- package/dist/connectors/api.js +22 -11
- package/dist/connectors/api.js.map +1 -1
- package/dist/connectors/remote-mcp.d.ts +3 -1
- package/dist/connectors/remote-mcp.d.ts.map +1 -1
- package/dist/connectors/remote-mcp.js +44 -18
- package/dist/connectors/remote-mcp.js.map +1 -1
- package/dist/credential-health.d.ts +0 -22
- package/dist/credential-health.d.ts.map +1 -1
- package/dist/credential-health.js +14 -10
- package/dist/credential-health.js.map +1 -1
- package/dist/credentials.d.ts +3 -2
- package/dist/credentials.d.ts.map +1 -1
- package/dist/errors.d.ts +1 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +9 -8
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +144 -291
- 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 +2 -2
- 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 +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +45 -17
- package/dist/index.js.map +1 -1
- package/dist/invocation.d.ts +96 -0
- package/dist/invocation.d.ts.map +1 -0
- package/dist/invocation.js +369 -0
- package/dist/invocation.js.map +1 -0
- package/dist/meta-tools.d.ts +11 -86
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +145 -485
- 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 +94 -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 +47 -6
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +356 -35
- package/dist/registry.js.map +1 -1
- package/dist/routes/activity.d.ts +3 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/activity.js +173 -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 +181 -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 +383 -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 +268 -0
- package/dist/routes/oauth.js.map +1 -0
- package/dist/routes/shared.d.ts +97 -0
- package/dist/routes/shared.d.ts.map +1 -0
- package/dist/routes/shared.js +199 -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 +122 -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 +67 -1292
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +0 -15
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +6 -5
- 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/toolkits.d.ts +0 -22
- package/dist/toolkits.d.ts.map +1 -1
- package/dist/toolkits.js +2 -2
- package/dist/toolkits.js.map +1 -1
- package/dist/types.d.ts +64 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +3 -93
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +26 -1389
- 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 +5 -1
- package/src/auth/bearer.ts +4 -4
- package/src/auth/clerk.ts +1 -1
- package/src/call-admission.ts +522 -0
- 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 +2 -2
- package/src/concurrency.ts +39 -0
- package/src/connectors/api.ts +25 -11
- package/src/connectors/remote-mcp.ts +55 -21
- package/src/credential-health.ts +13 -10
- package/src/credentials.ts +2 -2
- package/src/errors.ts +1 -1
- package/src/execute.ts +194 -377
- package/src/executor-result.ts +2 -2
- 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 +54 -17
- package/src/invocation.ts +527 -0
- package/src/meta-tools.ts +369 -797
- package/src/operator-ui/browser.css +413 -0
- package/src/operator-ui/browser.ts +1121 -0
- package/src/operator-ui/generated.ts +4 -0
- package/src/operator-ui/model.ts +127 -0
- package/src/registry.ts +489 -44
- package/src/routes/activity.ts +220 -0
- package/src/routes/credentials.ts +266 -0
- package/src/routes/mcp.ts +485 -0
- package/src/routes/oauth.ts +328 -0
- package/src/routes/shared.ts +330 -0
- package/src/routes/ui.ts +153 -0
- package/src/server.ts +70 -1702
- package/src/skills.ts +6 -5
- package/src/storage/file.ts +3 -1
- package/src/storage/memory.ts +3 -1
- package/src/toolkits.ts +2 -2
- package/src/types.ts +70 -2
- package/src/ui.ts +52 -1489
- package/src/version.ts +1 -1
package/src/skills.ts
CHANGED
|
@@ -75,13 +75,13 @@ export function hasConnectorGuides(connectors: readonly Connector[]): boolean {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/** The built-in usage guide, plus the guides section when there is one to point at. */
|
|
78
|
-
|
|
78
|
+
function usageSkill(connectors: readonly Connector[]): string {
|
|
79
79
|
return hasConnectorGuides(connectors)
|
|
80
80
|
? USAGE_SKILL + CONNECTOR_GUIDES_SECTION
|
|
81
81
|
: USAGE_SKILL;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
const AVAILABLE_SKILLS = [
|
|
85
85
|
{
|
|
86
86
|
name: "usage",
|
|
87
87
|
description:
|
|
@@ -97,7 +97,7 @@ export const AVAILABLE_SKILLS = [
|
|
|
97
97
|
* The prefixed form is the ONLY way to reach a connector guide: a bare
|
|
98
98
|
* connector id is never resolved, so nothing shadows anything silently.
|
|
99
99
|
*/
|
|
100
|
-
|
|
100
|
+
const CONNECTOR_SKILL_PREFIX = "connector:";
|
|
101
101
|
|
|
102
102
|
/** The skill name that fetches `connector`'s guide. */
|
|
103
103
|
export function connectorSkillName(connectorId: string): string {
|
|
@@ -128,8 +128,9 @@ const NOT_SUMMARY_RE = /^\s*(?:<!--|\|)|^\s*(?:-{3,}|\*{3,}|_{3,})\s*$/;
|
|
|
128
128
|
/** Drop a leading YAML frontmatter block — metadata, not summary text. */
|
|
129
129
|
function withoutFrontmatter(lines: string[]): string[] {
|
|
130
130
|
let start = 0;
|
|
131
|
-
while (start < lines.length && lines[start].trim() === "") start++;
|
|
132
|
-
|
|
131
|
+
while (start < lines.length && (lines[start] ?? "").trim() === "") start++;
|
|
132
|
+
const openingRule = lines[start];
|
|
133
|
+
if (openingRule === undefined || !RULE_RE.test(openingRule)) return lines;
|
|
133
134
|
const close = lines.findIndex((line, i) => i > start && RULE_RE.test(line));
|
|
134
135
|
return close === -1 ? lines : lines.slice(close + 1);
|
|
135
136
|
}
|
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/toolkits.ts
CHANGED
|
@@ -137,7 +137,7 @@ function toolFilter(
|
|
|
137
137
|
* an allowlist is a scope the operator did not write, and a scope nobody wrote
|
|
138
138
|
* is not one an operator can reason about. (A definition scopes visibility only;
|
|
139
139
|
* WHICH identity may select it is the separate binding below — see the module
|
|
140
|
-
* header and
|
|
140
|
+
* header and documentation/toolkits.md.) Tool names are checked only for connectors that expose
|
|
141
141
|
* `staticTools` (i.e. `api()`); a remote connector's catalog is fetched lazily
|
|
142
142
|
* over the network and is unknown at construction time.
|
|
143
143
|
*/
|
|
@@ -331,7 +331,7 @@ export function resolveToolkitBinding(
|
|
|
331
331
|
* Returns a frozen, deduplicated copy: nothing downstream can be mutated by the
|
|
332
332
|
* adapter after the check, and every name is known to fit the grammar.
|
|
333
333
|
*/
|
|
334
|
-
|
|
334
|
+
function normalizeToolkitBinding(value: unknown): ToolkitBinding | null {
|
|
335
335
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
336
336
|
return null;
|
|
337
337
|
}
|
package/src/types.ts
CHANGED
|
@@ -44,6 +44,61 @@ export interface ToolAnnotations extends Record<string, unknown> {
|
|
|
44
44
|
openWorldHint?: boolean;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
+
/** Inputs a connector may reduce to a non-secret admission partition key. */
|
|
48
|
+
export interface ConnectorCallAdmissionInput {
|
|
49
|
+
toolName: string;
|
|
50
|
+
args: unknown;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Exact sliding-window budget for one connector-call partition. */
|
|
54
|
+
export interface ConnectorRollingWindowBudget {
|
|
55
|
+
kind: "rolling-window";
|
|
56
|
+
/** Calls admitted during `windowMs` before another is proactively refused. */
|
|
57
|
+
maxCalls: number;
|
|
58
|
+
/** Width of the rolling window in milliseconds. */
|
|
59
|
+
windowMs: number;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* One connector-level downstream call-admission rule.
|
|
64
|
+
*
|
|
65
|
+
* This release accepts the plural `rules` container below but enforces exactly
|
|
66
|
+
* one rule. That keeps the public shape ready for providers whose concurrency
|
|
67
|
+
* and budget limits eventually need different partition dimensions without
|
|
68
|
+
* pretending multi-rule admission is already atomic.
|
|
69
|
+
*/
|
|
70
|
+
export interface ConnectorCallAdmissionRule {
|
|
71
|
+
/** Maximum simultaneous Connector.callTool attempts in one partition. */
|
|
72
|
+
maxConcurrency?: number;
|
|
73
|
+
/** Callers allowed to wait behind the concurrency bound. Default 32. */
|
|
74
|
+
maxQueueSize?: number;
|
|
75
|
+
/** Maximum concurrency-queue wait in milliseconds. Default 5,000. */
|
|
76
|
+
queueTimeoutMs?: number;
|
|
77
|
+
/** Retry hint for concurrency overloads. Default 1,000. */
|
|
78
|
+
retryAfterMs?: number;
|
|
79
|
+
/** Optional exact rolling-window call-start budget. */
|
|
80
|
+
budget?: ConnectorRollingWindowBudget;
|
|
81
|
+
/**
|
|
82
|
+
* Derive a bounded, non-secret partition key from the tool call. Omit for
|
|
83
|
+
* one connector-wide partition. Connecta retains the returned key only; it
|
|
84
|
+
* never copies arguments into limiter state.
|
|
85
|
+
*/
|
|
86
|
+
partitionKey?(
|
|
87
|
+
input: Readonly<ConnectorCallAdmissionInput>,
|
|
88
|
+
): string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Optional downstream call-admission policy declared by one connector. */
|
|
92
|
+
export interface ConnectorCallAdmissionPolicy {
|
|
93
|
+
/**
|
|
94
|
+
* Plural-ready policy container. Exactly one rule is supported in this
|
|
95
|
+
* release; empty or multi-rule policies fail construction.
|
|
96
|
+
*/
|
|
97
|
+
rules: readonly ConnectorCallAdmissionRule[];
|
|
98
|
+
/** Maximum simultaneously retained partition states. Default 1,024. */
|
|
99
|
+
maxPartitions?: number;
|
|
100
|
+
}
|
|
101
|
+
|
|
47
102
|
export type ConnectorCredentialValues = Record<string, string>;
|
|
48
103
|
|
|
49
104
|
/** Read-only access to the credentials assigned to one connector. */
|
|
@@ -145,6 +200,12 @@ export interface Connector {
|
|
|
145
200
|
* the connector inherits the deployment-wide cap.
|
|
146
201
|
*/
|
|
147
202
|
maxResultBytes?: number;
|
|
203
|
+
/**
|
|
204
|
+
* Optional per-runtime admission policy for downstream tool calls. It covers
|
|
205
|
+
* call_tool, every batch_call child, and execute_code host calls, but not
|
|
206
|
+
* catalog/status/auth operations.
|
|
207
|
+
*/
|
|
208
|
+
callAdmission?: ConnectorCallAdmissionPolicy;
|
|
148
209
|
/**
|
|
149
210
|
* Optional agent-facing usage guide (markdown) for this connector — preferred
|
|
150
211
|
* tools, address quirks, pagination conventions, rate-limit etiquette, good
|
|
@@ -259,6 +320,13 @@ export interface ExecuteResult {
|
|
|
259
320
|
export interface ExecutorProvider {
|
|
260
321
|
name: string;
|
|
261
322
|
fns: Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
323
|
+
/**
|
|
324
|
+
* Optional trusted sandbox-side setup run after provider globals exist.
|
|
325
|
+
* Connecta uses this to install lazy connector namespace proxies without
|
|
326
|
+
* materializing one host closure per tool. This is host-authored code, never
|
|
327
|
+
* model input.
|
|
328
|
+
*/
|
|
329
|
+
prelude?: string;
|
|
262
330
|
}
|
|
263
331
|
|
|
264
332
|
/**
|
|
@@ -318,7 +386,7 @@ export interface ExecutorLease {
|
|
|
318
386
|
|
|
319
387
|
/**
|
|
320
388
|
* Which toolkits one inbound identity may open — the membership half of the
|
|
321
|
-
* deployment=org / toolkit=team framing (
|
|
389
|
+
* deployment=org / toolkit=team framing (documentation/toolkits.md). A mapping, never a
|
|
322
390
|
* policy engine: one identity → the toolkit names it may select, plus whether
|
|
323
391
|
* it may connect with no `?toolkit=` at all.
|
|
324
392
|
*
|
|
@@ -461,7 +529,7 @@ export interface InboundAuth {
|
|
|
461
529
|
uiAuth?: UiAuthConfig;
|
|
462
530
|
/**
|
|
463
531
|
* Optional toolkit binding for every identity this provider admits
|
|
464
|
-
* (
|
|
532
|
+
* (documentation/toolkits.md). Declared statically so `createConnecta` can validate the
|
|
465
533
|
* names against `ConnectaConfig.toolkits` and throw on a typo — a binding
|
|
466
534
|
* nobody wrote is not one an operator can reason about. An `authorize` result
|
|
467
535
|
* may narrow it per identity with its own `toolkitBinding`.
|