@zackbart/connecta 0.15.1 → 0.16.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/AGENTS.md +40 -20
- package/CHANGELOG.md +653 -0
- package/README.md +25 -5
- package/bin/connecta.mjs +44 -3
- package/dist/access-tokens.d.ts +0 -1
- package/dist/access-tokens.js +0 -1
- package/dist/activity.d.ts +50 -2
- package/dist/activity.js +34 -1
- package/dist/apps-shell.d.ts +0 -1
- package/dist/apps-shell.js +0 -1
- package/dist/auth/bearer.d.ts +0 -1
- package/dist/auth/bearer.js +0 -1
- package/dist/auth/clerk.d.ts +0 -1
- package/dist/auth/clerk.js +45 -9
- package/dist/auth/downstream-oauth.d.ts +0 -1
- package/dist/auth/downstream-oauth.js +0 -1
- package/dist/call-admission.d.ts +0 -1
- package/dist/call-admission.js +0 -1
- package/dist/catalog-drift.d.ts +99 -0
- package/dist/catalog-drift.js +251 -0
- package/dist/catalog-fingerprint.d.ts +0 -1
- package/dist/catalog-fingerprint.js +0 -1
- package/dist/catalog-limits.d.ts +0 -1
- package/dist/catalog-limits.js +0 -1
- package/dist/catalog-service.d.ts +0 -1
- package/dist/catalog-service.js +41 -5
- package/dist/catalog.d.ts +11 -1
- package/dist/catalog.js +20 -1
- package/dist/concurrency.d.ts +0 -1
- package/dist/concurrency.js +0 -1
- package/dist/connector-scope.d.ts +0 -1
- package/dist/connector-scope.js +0 -1
- package/dist/connectors/api.d.ts +29 -21
- package/dist/connectors/api.js +45 -19
- package/dist/connectors/guarded-fetch.d.ts +106 -0
- package/dist/connectors/guarded-fetch.js +289 -0
- package/dist/connectors/remote-mcp.d.ts +0 -1
- package/dist/connectors/remote-mcp.js +0 -1
- package/dist/credentials.d.ts +0 -1
- package/dist/credentials.js +0 -1
- package/dist/errors.d.ts +30 -3
- package/dist/errors.js +1 -1
- package/dist/execute.d.ts +0 -1
- package/dist/execute.js +0 -1
- package/dist/executor-admission.d.ts +11 -1
- package/dist/executor-admission.js +28 -1
- package/dist/executor-result.d.ts +0 -1
- package/dist/executor-result.js +0 -1
- package/dist/executors/quickjs-child.d.ts +0 -1
- package/dist/executors/quickjs-child.js +0 -1
- package/dist/executors/quickjs-protocol.d.ts +0 -1
- package/dist/executors/quickjs-protocol.js +0 -1
- package/dist/executors/quickjs-runtime.d.ts +0 -1
- package/dist/executors/quickjs-runtime.js +0 -1
- package/dist/executors/quickjs.d.ts +0 -1
- package/dist/executors/quickjs.js +2 -1
- package/dist/favicon.d.ts +0 -1
- package/dist/favicon.js +0 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +24 -7
- package/dist/invocation.d.ts +0 -1
- package/dist/invocation.js +0 -1
- package/dist/json-schema.d.ts +0 -1
- package/dist/json-schema.js +0 -1
- package/dist/mcp-result.d.ts +0 -1
- package/dist/mcp-result.js +0 -1
- package/dist/meta-tools.d.ts +0 -1
- package/dist/meta-tools.js +0 -1
- package/dist/node.d.ts +0 -1
- package/dist/node.js +0 -1
- package/dist/operator-ui/generated.d.ts +2 -3
- package/dist/operator-ui/generated.js +3 -4
- package/dist/operator-ui/model.d.ts +10 -1
- package/dist/operator-ui/model.js +0 -1
- package/dist/operator-ui/view.d.ts +167 -0
- package/dist/operator-ui/view.js +270 -0
- package/dist/providers/cloudflare.d.ts +0 -1
- package/dist/providers/cloudflare.js +261 -299
- package/dist/providers/linear.d.ts +26 -5
- package/dist/providers/linear.js +32 -61
- package/dist/providers/mixpanel.d.ts +35 -4
- package/dist/providers/mixpanel.js +53 -79
- package/dist/providers/notion.d.ts +0 -1
- package/dist/providers/notion.js +87 -42
- package/dist/providers/stripe.d.ts +13 -1
- package/dist/providers/stripe.js +31 -60
- package/dist/registry.d.ts +34 -2
- package/dist/registry.js +85 -5
- package/dist/retired-toolkits.d.ts +0 -1
- package/dist/retired-toolkits.js +0 -1
- package/dist/routes/access-tokens.d.ts +0 -1
- package/dist/routes/access-tokens.js +0 -1
- package/dist/routes/activity.d.ts +0 -1
- package/dist/routes/activity.js +0 -1
- package/dist/routes/credentials.d.ts +0 -1
- package/dist/routes/credentials.js +0 -1
- package/dist/routes/mcp.d.ts +0 -1
- package/dist/routes/mcp.js +0 -1
- package/dist/routes/oauth.d.ts +0 -1
- package/dist/routes/oauth.js +0 -1
- package/dist/routes/shared.d.ts +2 -1
- package/dist/routes/shared.js +0 -1
- package/dist/routes/ui.d.ts +0 -1
- package/dist/routes/ui.js +0 -1
- package/dist/server.d.ts +0 -1
- package/dist/server.js +11 -1
- package/dist/skills.d.ts +0 -1
- package/dist/skills.js +0 -1
- package/dist/storage/file.d.ts +0 -1
- package/dist/storage/file.js +0 -1
- package/dist/storage/memory.d.ts +0 -1
- package/dist/storage/memory.js +0 -1
- package/dist/timeout.d.ts +0 -1
- package/dist/timeout.js +0 -1
- package/dist/tool-safety.d.ts +0 -1
- package/dist/tool-safety.js +0 -1
- package/dist/types.d.ts +45 -1
- package/dist/types.js +0 -1
- package/dist/ui.d.ts +0 -1
- package/dist/ui.js +13 -137
- package/dist/validate.d.ts +13 -15
- package/dist/validate.js +24 -11
- package/dist/version.d.ts +1 -2
- package/dist/version.js +1 -2
- package/documentation/architecture.md +186 -5
- package/documentation/auth.md +11 -0
- package/documentation/call-admission.md +142 -6
- package/documentation/cloudflare.md +92 -10
- package/documentation/code-first-exploration.md +2 -2
- package/documentation/code-mode.md +14 -14
- package/documentation/connector-guides.md +172 -5
- package/documentation/connectors.md +89 -0
- package/documentation/linear.md +20 -2
- package/documentation/mcp-ui-design.md +2 -2
- package/documentation/meta-tools.md +7 -1
- package/documentation/mixpanel.md +42 -9
- package/documentation/notion.md +23 -2
- package/documentation/operations.md +325 -5
- package/documentation/operator-ui.md +120 -5
- package/documentation/provider-audit.md +160 -0
- package/documentation/provider-conventions.md +667 -0
- package/documentation/request-admission.md +167 -5
- package/documentation/rich-output-design.md +1 -2
- package/documentation/stripe.md +15 -0
- package/documentation/upgrading.md +454 -0
- package/ethos.md +14 -9
- package/examples/worker/README.md +102 -12
- package/examples/worker/src/index.ts +46 -1
- package/examples/worker/wrangler.jsonc +14 -1
- package/package.json +10 -6
- package/templates/node/.dockerignore +10 -0
- package/templates/node/.env.example +40 -3
- package/templates/node/AGENTS.md +16 -1
- package/templates/node/Dockerfile +49 -0
- package/templates/node/README.md +117 -2
- package/templates/node/docker-compose.yml +39 -0
- package/templates/node/package.json +1 -1
- package/templates/node/src/file-activity.ts +182 -0
- package/templates/node/src/index.ts +80 -4
- package/assets/connecta-clay-hero.png +0 -0
- package/dist/access-tokens.d.ts.map +0 -1
- package/dist/access-tokens.js.map +0 -1
- package/dist/activity.d.ts.map +0 -1
- package/dist/activity.js.map +0 -1
- package/dist/apps-shell.d.ts.map +0 -1
- package/dist/apps-shell.js.map +0 -1
- package/dist/auth/bearer.d.ts.map +0 -1
- package/dist/auth/bearer.js.map +0 -1
- package/dist/auth/clerk.d.ts.map +0 -1
- package/dist/auth/clerk.js.map +0 -1
- package/dist/auth/downstream-oauth.d.ts.map +0 -1
- package/dist/auth/downstream-oauth.js.map +0 -1
- package/dist/call-admission.d.ts.map +0 -1
- package/dist/call-admission.js.map +0 -1
- package/dist/catalog-fingerprint.d.ts.map +0 -1
- package/dist/catalog-fingerprint.js.map +0 -1
- package/dist/catalog-limits.d.ts.map +0 -1
- package/dist/catalog-limits.js.map +0 -1
- package/dist/catalog-service.d.ts.map +0 -1
- package/dist/catalog-service.js.map +0 -1
- package/dist/catalog.d.ts.map +0 -1
- package/dist/catalog.js.map +0 -1
- package/dist/concurrency.d.ts.map +0 -1
- package/dist/concurrency.js.map +0 -1
- package/dist/connector-scope.d.ts.map +0 -1
- package/dist/connector-scope.js.map +0 -1
- package/dist/connectors/api.d.ts.map +0 -1
- package/dist/connectors/api.js.map +0 -1
- package/dist/connectors/remote-mcp.d.ts.map +0 -1
- package/dist/connectors/remote-mcp.js.map +0 -1
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js.map +0 -1
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js.map +0 -1
- package/dist/execute.d.ts.map +0 -1
- package/dist/execute.js.map +0 -1
- package/dist/executor-admission.d.ts.map +0 -1
- package/dist/executor-admission.js.map +0 -1
- package/dist/executor-result.d.ts.map +0 -1
- package/dist/executor-result.js.map +0 -1
- package/dist/executors/quickjs-child.d.ts.map +0 -1
- package/dist/executors/quickjs-child.js.map +0 -1
- package/dist/executors/quickjs-protocol.d.ts.map +0 -1
- package/dist/executors/quickjs-protocol.js.map +0 -1
- package/dist/executors/quickjs-runtime.d.ts.map +0 -1
- package/dist/executors/quickjs-runtime.js.map +0 -1
- package/dist/executors/quickjs.d.ts.map +0 -1
- package/dist/executors/quickjs.js.map +0 -1
- package/dist/favicon.d.ts.map +0 -1
- package/dist/favicon.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/invocation.d.ts.map +0 -1
- package/dist/invocation.js.map +0 -1
- package/dist/json-schema.d.ts.map +0 -1
- package/dist/json-schema.js.map +0 -1
- package/dist/mcp-result.d.ts.map +0 -1
- package/dist/mcp-result.js.map +0 -1
- package/dist/meta-tools.d.ts.map +0 -1
- package/dist/meta-tools.js.map +0 -1
- package/dist/node.d.ts.map +0 -1
- package/dist/node.js.map +0 -1
- package/dist/operator-ui/generated.d.ts.map +0 -1
- package/dist/operator-ui/generated.js.map +0 -1
- package/dist/operator-ui/model.d.ts.map +0 -1
- package/dist/operator-ui/model.js.map +0 -1
- package/dist/providers/cloudflare.d.ts.map +0 -1
- package/dist/providers/cloudflare.js.map +0 -1
- package/dist/providers/linear.d.ts.map +0 -1
- package/dist/providers/linear.js.map +0 -1
- package/dist/providers/mixpanel.d.ts.map +0 -1
- package/dist/providers/mixpanel.js.map +0 -1
- package/dist/providers/notion.d.ts.map +0 -1
- package/dist/providers/notion.js.map +0 -1
- package/dist/providers/stripe.d.ts.map +0 -1
- package/dist/providers/stripe.js.map +0 -1
- package/dist/registry.d.ts.map +0 -1
- package/dist/registry.js.map +0 -1
- package/dist/retired-toolkits.d.ts.map +0 -1
- package/dist/retired-toolkits.js.map +0 -1
- package/dist/routes/access-tokens.d.ts.map +0 -1
- package/dist/routes/access-tokens.js.map +0 -1
- package/dist/routes/activity.d.ts.map +0 -1
- package/dist/routes/activity.js.map +0 -1
- package/dist/routes/credentials.d.ts.map +0 -1
- package/dist/routes/credentials.js.map +0 -1
- package/dist/routes/mcp.d.ts.map +0 -1
- package/dist/routes/mcp.js.map +0 -1
- package/dist/routes/oauth.d.ts.map +0 -1
- package/dist/routes/oauth.js.map +0 -1
- package/dist/routes/shared.d.ts.map +0 -1
- package/dist/routes/shared.js.map +0 -1
- package/dist/routes/ui.d.ts.map +0 -1
- package/dist/routes/ui.js.map +0 -1
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/skills.d.ts.map +0 -1
- package/dist/skills.js.map +0 -1
- package/dist/storage/file.d.ts.map +0 -1
- package/dist/storage/file.js.map +0 -1
- package/dist/storage/memory.d.ts.map +0 -1
- package/dist/storage/memory.js.map +0 -1
- package/dist/timeout.d.ts.map +0 -1
- package/dist/timeout.js.map +0 -1
- package/dist/tool-safety.d.ts.map +0 -1
- package/dist/tool-safety.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/ui.d.ts.map +0 -1
- package/dist/ui.js.map +0 -1
- package/dist/validate.d.ts.map +0 -1
- package/dist/validate.js.map +0 -1
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js.map +0 -1
- package/examples/node/README.md +0 -52
- package/examples/node/src/index.ts +0 -71
- package/src/access-tokens.ts +0 -289
- package/src/activity.ts +0 -234
- package/src/apps-shell.ts +0 -370
- package/src/auth/bearer.ts +0 -61
- package/src/auth/clerk.ts +0 -553
- package/src/auth/downstream-oauth.ts +0 -575
- package/src/call-admission.ts +0 -521
- package/src/catalog-fingerprint.ts +0 -52
- package/src/catalog-limits.ts +0 -11
- package/src/catalog-service.ts +0 -1153
- package/src/catalog.ts +0 -790
- package/src/concurrency.ts +0 -39
- package/src/connector-scope.ts +0 -66
- package/src/connectors/api.ts +0 -159
- package/src/connectors/remote-mcp.ts +0 -1090
- package/src/credentials.ts +0 -428
- package/src/errors.ts +0 -364
- package/src/execute.ts +0 -1406
- package/src/executor-admission.ts +0 -328
- package/src/executor-result.ts +0 -107
- package/src/executors/quickjs-child.ts +0 -172
- package/src/executors/quickjs-protocol.ts +0 -99
- package/src/executors/quickjs-runtime.ts +0 -470
- package/src/executors/quickjs.ts +0 -776
- package/src/favicon.ts +0 -53
- package/src/index.ts +0 -666
- package/src/invocation.ts +0 -655
- package/src/json-schema.ts +0 -11
- package/src/mcp-result.ts +0 -43
- package/src/meta-tools.ts +0 -1607
- package/src/node.ts +0 -206
- package/src/operator-ui/browser.css +0 -423
- package/src/operator-ui/browser.ts +0 -1281
- package/src/operator-ui/generated.ts +0 -4
- package/src/operator-ui/model.ts +0 -111
- package/src/providers/cloudflare.ts +0 -3999
- package/src/providers/linear.ts +0 -302
- package/src/providers/mixpanel.ts +0 -229
- package/src/providers/notion.ts +0 -1879
- package/src/providers/stripe.ts +0 -307
- package/src/registry.ts +0 -1085
- package/src/retired-toolkits.ts +0 -14
- package/src/routes/access-tokens.ts +0 -115
- package/src/routes/activity.ts +0 -215
- package/src/routes/credentials.ts +0 -254
- package/src/routes/mcp.ts +0 -429
- package/src/routes/oauth.ts +0 -322
- package/src/routes/shared.ts +0 -247
- package/src/routes/ui.ts +0 -152
- package/src/server.ts +0 -195
- package/src/skills.ts +0 -271
- package/src/storage/file.ts +0 -123
- package/src/storage/memory.ts +0 -44
- package/src/timeout.ts +0 -84
- package/src/tool-safety.ts +0 -15
- package/src/types.ts +0 -523
- package/src/ui.ts +0 -744
- package/src/validate.ts +0 -387
- package/src/version.ts +0 -7
package/src/types.ts
DELETED
|
@@ -1,523 +0,0 @@
|
|
|
1
|
-
// Core contracts for connecta. Web-API only — no node: imports here.
|
|
2
|
-
|
|
3
|
-
/** A JSON Schema object describing a tool's input. */
|
|
4
|
-
export type JsonSchema = Record<string, unknown>;
|
|
5
|
-
|
|
6
|
-
/** Minimal key/value store — the only state connecta needs. */
|
|
7
|
-
export interface KVStorage {
|
|
8
|
-
get(key: string): Promise<string | null>;
|
|
9
|
-
set(
|
|
10
|
-
key: string,
|
|
11
|
-
value: string,
|
|
12
|
-
opts?: { ttlSeconds?: number },
|
|
13
|
-
): Promise<void>;
|
|
14
|
-
delete(key: string): Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* Sorted keys beginning with `prefix`. Optional for existing adapters;
|
|
17
|
-
* subsystems that need independent, enumerable records require it explicitly.
|
|
18
|
-
*/
|
|
19
|
-
list?(prefix: string): Promise<string[]>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface Logger {
|
|
23
|
-
debug(...args: unknown[]): void;
|
|
24
|
-
info(...args: unknown[]): void;
|
|
25
|
-
warn(...args: unknown[]): void;
|
|
26
|
-
error(...args: unknown[]): void;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export interface ToolDef {
|
|
30
|
-
name: string; // unique within the connector
|
|
31
|
-
description?: string;
|
|
32
|
-
inputSchema?: JsonSchema;
|
|
33
|
-
/** Optional JSON Schema describing the tool's structured result. */
|
|
34
|
-
outputSchema?: JsonSchema;
|
|
35
|
-
/**
|
|
36
|
-
* Standard MCP tool behavior hints plus provider-specific extensions.
|
|
37
|
-
* Connecta fails closed: only readOnlyHint === true (without a contradictory
|
|
38
|
-
* destructiveHint) may use call_tool or execute_code. Every other tool must
|
|
39
|
-
* cross the call_destructive_tool approval boundary.
|
|
40
|
-
*/
|
|
41
|
-
annotations?: ToolAnnotations;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface ToolAnnotations extends Record<string, unknown> {
|
|
45
|
-
title?: string;
|
|
46
|
-
readOnlyHint?: boolean;
|
|
47
|
-
destructiveHint?: boolean;
|
|
48
|
-
idempotentHint?: boolean;
|
|
49
|
-
openWorldHint?: boolean;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** Inputs a connector may reduce to a non-secret admission partition key. */
|
|
53
|
-
export interface ConnectorCallAdmissionInput {
|
|
54
|
-
toolName: string;
|
|
55
|
-
args: unknown;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
/** Exact sliding-window budget for one connector-call partition. */
|
|
59
|
-
export interface ConnectorRollingWindowBudget {
|
|
60
|
-
kind: "rolling-window";
|
|
61
|
-
/** Calls admitted during `windowMs` before another is proactively refused. */
|
|
62
|
-
maxCalls: number;
|
|
63
|
-
/** Width of the rolling window in milliseconds. */
|
|
64
|
-
windowMs: number;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* One connector-level downstream call-admission rule.
|
|
69
|
-
*
|
|
70
|
-
* This release accepts the plural `rules` container below but enforces exactly
|
|
71
|
-
* one rule. That keeps the public shape ready for providers whose concurrency
|
|
72
|
-
* and budget limits eventually need different partition dimensions without
|
|
73
|
-
* pretending multi-rule admission is already atomic.
|
|
74
|
-
*/
|
|
75
|
-
export interface ConnectorCallAdmissionRule {
|
|
76
|
-
/** Maximum simultaneous Connector.callTool attempts in one partition. */
|
|
77
|
-
maxConcurrency?: number;
|
|
78
|
-
/** Callers allowed to wait behind the concurrency bound. Default 32. */
|
|
79
|
-
maxQueueSize?: number;
|
|
80
|
-
/** Maximum concurrency-queue wait in milliseconds. Default 5,000. */
|
|
81
|
-
queueTimeoutMs?: number;
|
|
82
|
-
/** Retry hint for concurrency overloads. Default 1,000. */
|
|
83
|
-
retryAfterMs?: number;
|
|
84
|
-
/** Optional exact rolling-window call-start budget. */
|
|
85
|
-
budget?: ConnectorRollingWindowBudget;
|
|
86
|
-
/**
|
|
87
|
-
* Derive a bounded, non-secret partition key from the tool call. Omit for
|
|
88
|
-
* one connector-wide partition. Connecta retains the returned key only; it
|
|
89
|
-
* never copies arguments into limiter state.
|
|
90
|
-
*/
|
|
91
|
-
partitionKey?(
|
|
92
|
-
input: Readonly<ConnectorCallAdmissionInput>,
|
|
93
|
-
): string;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** Optional downstream call-admission policy declared by one connector. */
|
|
97
|
-
export interface ConnectorCallAdmissionPolicy {
|
|
98
|
-
/**
|
|
99
|
-
* Plural-ready policy container. Exactly one rule is supported in this
|
|
100
|
-
* release; empty or multi-rule policies fail construction.
|
|
101
|
-
*/
|
|
102
|
-
rules: readonly ConnectorCallAdmissionRule[];
|
|
103
|
-
/** Maximum simultaneously retained partition states. Default 1,024. */
|
|
104
|
-
maxPartitions?: number;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export type ConnectorCredentialValues = Record<string, string>;
|
|
108
|
-
|
|
109
|
-
/** Read-only access to the credentials assigned to one connector. */
|
|
110
|
-
export interface ConnectorCredentialAccess {
|
|
111
|
-
/**
|
|
112
|
-
* Returns one decrypted field. Omitting `field` preserves the original
|
|
113
|
-
* single-credential behavior and reads the reserved `value` field.
|
|
114
|
-
*/
|
|
115
|
-
get(field?: string): Promise<string | null>;
|
|
116
|
-
/** Returns every decrypted field, or null when nothing is configured. */
|
|
117
|
-
getAll(): Promise<ConnectorCredentialValues | null>;
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/** Operator-facing description of one named credential field. */
|
|
121
|
-
export interface ConnectorCredentialFieldConfig {
|
|
122
|
-
/** Stable field name used by connector code and the credential API. */
|
|
123
|
-
name: string;
|
|
124
|
-
/** Short field label, e.g. "Account email". */
|
|
125
|
-
label: string;
|
|
126
|
-
/** Plain-language guidance shown in /credentials. Never include the credential itself. */
|
|
127
|
-
description?: string;
|
|
128
|
-
/** Input placeholder, e.g. "you@example.com". */
|
|
129
|
-
placeholder?: string;
|
|
130
|
-
/** Browser input type. Defaults to password. */
|
|
131
|
-
inputType?: "email" | "password" | "text";
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/** Operator-facing description of the credential set a connector needs. */
|
|
135
|
-
export interface ConnectorCredentialConfig {
|
|
136
|
-
/** Short group or field label, e.g. "API token" or "Service credentials". */
|
|
137
|
-
label: string;
|
|
138
|
-
/** Plain-language guidance shown in /credentials. Never include the credential itself. */
|
|
139
|
-
description?: string;
|
|
140
|
-
/** Password-field placeholder, e.g. "Paste API token". */
|
|
141
|
-
placeholder?: string;
|
|
142
|
-
/**
|
|
143
|
-
* Named fields for multi-value authentication. Omit to retain the original
|
|
144
|
-
* one-secret credential behavior.
|
|
145
|
-
*/
|
|
146
|
-
fields?: ConnectorCredentialFieldConfig[];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface CredentialTestResult {
|
|
150
|
-
ok: boolean;
|
|
151
|
-
message?: string;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export interface ConnectorContext {
|
|
155
|
-
/** Storage namespaced to this connector. */
|
|
156
|
-
storage: KVStorage;
|
|
157
|
-
logger: Logger;
|
|
158
|
-
/** Public base URL of this deployment (origin), used for OAuth callbacks. */
|
|
159
|
-
baseUrl: string;
|
|
160
|
-
/**
|
|
161
|
-
* Read-only access to this connector's operator-managed credential. Present
|
|
162
|
-
* only when the connector declares `credential` and the deployment configures
|
|
163
|
-
* `credentials.encryptionKey`.
|
|
164
|
-
*/
|
|
165
|
-
credential?: ConnectorCredentialAccess;
|
|
166
|
-
/**
|
|
167
|
-
* Identity shared by connector calls that belong to one inbound request.
|
|
168
|
-
* Connectors may use it to reuse request-safe resources within that request,
|
|
169
|
-
* but must never retain I/O resources beyond the scope's lifetime. For
|
|
170
|
-
* probe-only scopes the core owns, `Connector.closeScope` signals that end.
|
|
171
|
-
*
|
|
172
|
-
* Optional for custom/test contexts; the context object itself is the scope
|
|
173
|
-
* when omitted.
|
|
174
|
-
*/
|
|
175
|
-
requestScope?: object;
|
|
176
|
-
/** Best-effort cancellation signal for this connector operation. */
|
|
177
|
-
signal?: AbortSignal;
|
|
178
|
-
/** Requested connector-operation deadline in milliseconds. */
|
|
179
|
-
timeoutMs?: number;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
type ConnectorStatusState = "ok" | "auth_required" | "error";
|
|
183
|
-
|
|
184
|
-
export interface ConnectorStatus {
|
|
185
|
-
state: ConnectorStatusState;
|
|
186
|
-
/** When state === "auth_required", the URL the operator should open. */
|
|
187
|
-
authorizationUrl?: string;
|
|
188
|
-
message?: string;
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** The whole plugin contract — the one open seam. */
|
|
192
|
-
export interface Connector {
|
|
193
|
-
id: string; // address prefix; [a-z0-9_-]+
|
|
194
|
-
/** Human-readable display name; the stable `id` remains the tool-address prefix. */
|
|
195
|
-
title?: string;
|
|
196
|
-
/** How call_tool wraps results. "mcp" passes the content array through; anything else is JSON-wrapped. */
|
|
197
|
-
kind?: "mcp" | "api";
|
|
198
|
-
description?: string;
|
|
199
|
-
/**
|
|
200
|
-
* Max inline result size (bytes) for this connector's tools before
|
|
201
|
-
* call_tool truncates and stashes the full text for get_result
|
|
202
|
-
* paging. Overrides `ConnectaConfig.calls.maxResultBytes`;
|
|
203
|
-
* omit to inherit it (which itself defaults to 50_000). Must be a whole
|
|
204
|
-
* number of bytes >= 1; anything else warns at startup and is ignored, so
|
|
205
|
-
* the connector inherits the deployment-wide cap.
|
|
206
|
-
*/
|
|
207
|
-
maxResultBytes?: number;
|
|
208
|
-
/**
|
|
209
|
-
* Optional per-runtime admission policy for downstream tool calls. It covers
|
|
210
|
-
* call_tool, call_destructive_tool, and every execute_code host call, but
|
|
211
|
-
* not catalog/status/auth operations.
|
|
212
|
-
*/
|
|
213
|
-
callAdmission?: ConnectorCallAdmissionPolicy;
|
|
214
|
-
/**
|
|
215
|
-
* Optional agent-facing usage guide for this connector. A string preserves
|
|
216
|
-
* the original markdown-only contract. The structured form can add a short
|
|
217
|
-
* discovery summary and require review when even a complete compact schema
|
|
218
|
-
* cannot describe correct use (for example a generic API wrapper or a
|
|
219
|
-
* cross-operation sequencing rule).
|
|
220
|
-
*
|
|
221
|
-
* Listed by `skills` as `connector:<id>` and returned verbatim by
|
|
222
|
-
* `skills({ name: "connector:<id>" })`. The guide remains deployment-owned
|
|
223
|
-
* configuration; no runtime registration or shared mutable copy exists.
|
|
224
|
-
*/
|
|
225
|
-
usageGuide?: string | ConnectorUsageGuide;
|
|
226
|
-
/** Optional operator-managed credential slot rendered on /credentials. */
|
|
227
|
-
credential?: ConnectorCredentialConfig;
|
|
228
|
-
/** Optional server-side check used by /credentials' Test action. */
|
|
229
|
-
testCredential?(
|
|
230
|
-
value: string,
|
|
231
|
-
ctx: ConnectorContext,
|
|
232
|
-
): Promise<CredentialTestResult>;
|
|
233
|
-
/** Optional multi-field credential check used by /credentials' Test action. */
|
|
234
|
-
testCredentials?(
|
|
235
|
-
values: ConnectorCredentialValues,
|
|
236
|
-
ctx: ConnectorContext,
|
|
237
|
-
): Promise<CredentialTestResult>;
|
|
238
|
-
/**
|
|
239
|
-
* Statically-known tool defs, exposed by in-code connectors (`api()`) for
|
|
240
|
-
* startup convention checks. Remote connectors omit this — their tools are
|
|
241
|
-
* fetched lazily over the network and are not known at construction time.
|
|
242
|
-
*/
|
|
243
|
-
staticTools?: ToolDef[];
|
|
244
|
-
listTools(ctx: ConnectorContext): Promise<ToolDef[]>;
|
|
245
|
-
callTool(
|
|
246
|
-
name: string,
|
|
247
|
-
args: unknown,
|
|
248
|
-
ctx: ConnectorContext,
|
|
249
|
-
): Promise<unknown>;
|
|
250
|
-
/**
|
|
251
|
-
* Optional best-effort teardown for resources retained under
|
|
252
|
-
* `ctx.requestScope`. The core calls this at most once when a scope it created
|
|
253
|
-
* solely for probing ends, and never uses that scope again. Teardown gets a
|
|
254
|
-
* small, fixed best-effort completion window; a missing, rejected, or
|
|
255
|
-
* never-settling hook cannot change or hold open the operation's result
|
|
256
|
-
* beyond that bound.
|
|
257
|
-
*
|
|
258
|
-
* Per-request `/mcp` scopes are not closed through this hook: their
|
|
259
|
-
* request-local reuse remains in force until the request boundary.
|
|
260
|
-
*/
|
|
261
|
-
closeScope?(ctx: ConnectorContext): Promise<void>;
|
|
262
|
-
/** Optional connector-level health/auth status for the operator UI. */
|
|
263
|
-
status?(ctx: ConnectorContext): Promise<ConnectorStatus>;
|
|
264
|
-
/**
|
|
265
|
-
* Optional: start (or with force, restart from scratch) a downstream OAuth
|
|
266
|
-
* flow (called by authorize_connector). Present only on connectors that use
|
|
267
|
-
* downstream OAuth. Returns the resulting status — "auth_required" with an
|
|
268
|
-
* authorizationUrl when there is a URL to open, "ok" when already authorized.
|
|
269
|
-
*/
|
|
270
|
-
startAuth?(
|
|
271
|
-
ctx: ConnectorContext,
|
|
272
|
-
opts?: { force?: boolean },
|
|
273
|
-
): Promise<ConnectorStatus>;
|
|
274
|
-
/**
|
|
275
|
-
* Optional: remove every stored downstream OAuth credential and pending flow
|
|
276
|
-
* without immediately starting a replacement flow. Present only on
|
|
277
|
-
* connectors whose authorization can be managed by the operator UI.
|
|
278
|
-
*/
|
|
279
|
-
disconnectAuth?(ctx: ConnectorContext): Promise<void>;
|
|
280
|
-
/**
|
|
281
|
-
* Verify the OAuth `state` returned to /oauth/callback/<id> against the value
|
|
282
|
-
* this connector generated when it started the flow. Required whenever
|
|
283
|
-
* `finishAuth` is present: the callback rejects before `finishAuth` when this
|
|
284
|
-
* hook is absent, throws, or returns false — otherwise anyone holding the
|
|
285
|
-
* pending URL could complete consent with their own account.
|
|
286
|
-
*/
|
|
287
|
-
verifyState?(state: string | null, ctx: ConnectorContext): Promise<boolean>;
|
|
288
|
-
/**
|
|
289
|
-
* Optional: complete a downstream OAuth flow (called by
|
|
290
|
-
* /oauth/callback/<id>). `callbackParams` preserves the authorization
|
|
291
|
-
* server's RFC 9207 `iss` response parameter for SDK validation.
|
|
292
|
-
*/
|
|
293
|
-
finishAuth?(
|
|
294
|
-
code: string,
|
|
295
|
-
ctx: ConnectorContext,
|
|
296
|
-
callbackParams?: URLSearchParams,
|
|
297
|
-
): Promise<void>;
|
|
298
|
-
/**
|
|
299
|
-
* Optional: serve a connector-owned HTTP route — for example a signed
|
|
300
|
-
* download link minted by one of the connector's tools. Called only after
|
|
301
|
-
* every built-in route misses, so a connector can never shadow `/mcp`,
|
|
302
|
-
* `/`, `/credentials`, `/activity`, `/health`, or the credential API. The
|
|
303
|
-
* first connector to return a
|
|
304
|
-
* Response wins, in registration order; return null to decline.
|
|
305
|
-
*
|
|
306
|
-
* These routes are PUBLIC: connecta applies no auth gate to them. A
|
|
307
|
-
* connector that serves data here MUST authenticate the request itself — for
|
|
308
|
-
* example with a signed capability token in the URL.
|
|
309
|
-
*/
|
|
310
|
-
handleRequest?(
|
|
311
|
-
request: Request,
|
|
312
|
-
ctx: ConnectorContext,
|
|
313
|
-
): Promise<Response | null>;
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
export interface ConnectorUsageGuide {
|
|
317
|
-
/** Markdown returned verbatim by `skills({ name: "connector:<id>" })`. */
|
|
318
|
-
content: string;
|
|
319
|
-
/**
|
|
320
|
-
* Bounded discovery hint describing the conventions the guide covers. When
|
|
321
|
-
* omitted, Connecta derives a summary from the guide's first meaningful line.
|
|
322
|
-
*/
|
|
323
|
-
summary?: string;
|
|
324
|
-
/**
|
|
325
|
-
* Require review before every operation on this connector. Reserve this for
|
|
326
|
-
* cases whose correct arguments or sequence cannot be expressed by the
|
|
327
|
-
* downstream tool schema; mutations and truncated schemas are required
|
|
328
|
-
* automatically and do not need this flag.
|
|
329
|
-
*/
|
|
330
|
-
required?: boolean;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
/** Result of one sandboxed code execution. */
|
|
334
|
-
export interface ExecuteResult {
|
|
335
|
-
result: unknown;
|
|
336
|
-
error?: string;
|
|
337
|
-
logs?: string[];
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
/** A named group of host functions exposed to sandboxed code as a global. */
|
|
341
|
-
export interface ExecutorProvider {
|
|
342
|
-
name: string;
|
|
343
|
-
fns: Record<string, (...args: unknown[]) => Promise<unknown>>;
|
|
344
|
-
/**
|
|
345
|
-
* Optional trusted sandbox-side setup run after provider globals exist.
|
|
346
|
-
* Connecta uses this to install lazy connector namespace proxies without
|
|
347
|
-
* materializing one host closure per tool. This is host-authored code, never
|
|
348
|
-
* model input.
|
|
349
|
-
*/
|
|
350
|
-
prelude?: string;
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/**
|
|
354
|
-
* Runs model-written JavaScript in a sandbox where the ONLY capabilities are
|
|
355
|
-
* the provider functions — no network, filesystem, env, or timers. Structurally
|
|
356
|
-
* compatible with `DynamicWorkerExecutor` from `@cloudflare/codemode` (Workers);
|
|
357
|
-
* `quickJsExecutor()` from "@zackbart/connecta/quickjs" is the Node implementation.
|
|
358
|
-
* NEVER back this with an unsandboxed eval — the code is untrusted.
|
|
359
|
-
*/
|
|
360
|
-
export interface Executor {
|
|
361
|
-
execute(code: string, providers: ExecutorProvider[]): Promise<ExecuteResult>;
|
|
362
|
-
/** Release runtime resources. Node's built-in pool implements this. */
|
|
363
|
-
close?(): void | Promise<void>;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
/** Payload-free, monotonically increasing admission observations. */
|
|
367
|
-
export interface AdmissionSnapshot {
|
|
368
|
-
concurrency: number;
|
|
369
|
-
maxQueueSize: number;
|
|
370
|
-
queueTimeoutMs: number;
|
|
371
|
-
retryAfterMs: number;
|
|
372
|
-
active: number;
|
|
373
|
-
queued: number;
|
|
374
|
-
closed: boolean;
|
|
375
|
-
totals: {
|
|
376
|
-
admitted: number;
|
|
377
|
-
queued: number;
|
|
378
|
-
rejected: number;
|
|
379
|
-
cancelled: number;
|
|
380
|
-
closed: number;
|
|
381
|
-
};
|
|
382
|
-
queueWaitMs: {
|
|
383
|
-
count: number;
|
|
384
|
-
total: number;
|
|
385
|
-
max: number;
|
|
386
|
-
};
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
/**
|
|
390
|
-
* Optional admission capability used by bounded executors. The acquired lease
|
|
391
|
-
* carries execution so an already-admitted caller cannot accidentally acquire
|
|
392
|
-
* a second slot and deadlock a pool of one.
|
|
393
|
-
*/
|
|
394
|
-
export interface AdmittingExecutor extends Executor {
|
|
395
|
-
acquire(options?: { signal?: AbortSignal }): Promise<ExecutorLease>;
|
|
396
|
-
/** Payload-free health/metrics view when the executor exposes one. */
|
|
397
|
-
admissionSnapshot?(): AdmissionSnapshot;
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
export interface ExecutorLease {
|
|
401
|
-
/** Time spent waiting before this lease was granted, when observed. */
|
|
402
|
-
readonly waitMs?: number;
|
|
403
|
-
execute(code: string, providers: ExecutorProvider[]): Promise<ExecuteResult>;
|
|
404
|
-
/** Idempotent. Call from finally even when provider construction fails. */
|
|
405
|
-
release(): void;
|
|
406
|
-
}
|
|
407
|
-
|
|
408
|
-
/** Result of an inbound-auth check. */
|
|
409
|
-
export type AuthResult =
|
|
410
|
-
| {
|
|
411
|
-
ok: true;
|
|
412
|
-
userId?: string;
|
|
413
|
-
subjectId?: string;
|
|
414
|
-
}
|
|
415
|
-
| { ok: false; response: Response };
|
|
416
|
-
|
|
417
|
-
/** Public browser-auth configuration exposed to connecta's status UI. */
|
|
418
|
-
export type UiAuthConfig = {
|
|
419
|
-
kind: "clerk";
|
|
420
|
-
publishableKey: string;
|
|
421
|
-
/**
|
|
422
|
-
* Origin the operator shell fetches its browser sign-in loader from. **Must be an absolute
|
|
423
|
-
* `https:` URL** — the value lands in a `<script src>`, so the gate is
|
|
424
|
-
* stricter than the branding href gate: no `http:`, no loopback exemption, and
|
|
425
|
-
* no root-relative form (a relative path is rejected, not resolved). The
|
|
426
|
-
* shipped `clerkAuth` adapter derives this from the publishable key and
|
|
427
|
-
* Clerk's Frontend API is always https, so nothing legitimate needs a
|
|
428
|
-
* carve-out. A value that fails the gate reaches neither the loader tag nor
|
|
429
|
-
* the page's inline auth config: operator pages render without it and report
|
|
430
|
-
* that Clerk could not load, and `createConnecta` names the drop in a startup
|
|
431
|
-
* warning.
|
|
432
|
-
*/
|
|
433
|
-
frontendApiUrl: string;
|
|
434
|
-
/**
|
|
435
|
-
* Hosted Account Portal sign-in address, handed to `Clerk.load`. **Must be an
|
|
436
|
-
* absolute `https:` URL** — the same gate `frontendApiUrl` passes, because
|
|
437
|
-
* this value is where Clerk *navigates* the operator's browser. An Account
|
|
438
|
-
* Portal address is always https, so the stricter gate costs nothing real: a
|
|
439
|
-
* value that fails it (a `javascript:`/`data:` payload, a cleartext `http:`
|
|
440
|
-
* address, a relative path) reaches no part of the page, the shell signs in
|
|
441
|
-
* through Clerk's default instead, and `createConnecta` names the drop in a
|
|
442
|
-
* startup warning.
|
|
443
|
-
*/
|
|
444
|
-
signInUrl?: string;
|
|
445
|
-
/** Hosted Account Portal sign-up address. Gated exactly like `signInUrl`. */
|
|
446
|
-
signUpUrl?: string;
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
/**
|
|
450
|
-
* Optional labels and marks used by the browser UI and OAuth result pages.
|
|
451
|
-
* Every deployment-identifying string and image is configurable here — nothing
|
|
452
|
-
* about the operator is baked into the package.
|
|
453
|
-
*/
|
|
454
|
-
export interface ConnectaBranding {
|
|
455
|
-
/** Product label. Defaults to "Connecta". */
|
|
456
|
-
productName?: string;
|
|
457
|
-
/** Optional link for the product label. */
|
|
458
|
-
productUrl?: string;
|
|
459
|
-
/** Organization or owner shown beside the product label. */
|
|
460
|
-
ownerName?: string;
|
|
461
|
-
/** Optional link for the organization or owner label. */
|
|
462
|
-
ownerUrl?: string;
|
|
463
|
-
/** Operator-page introduction and meta description. */
|
|
464
|
-
description?: string;
|
|
465
|
-
/**
|
|
466
|
-
* Browser tab title and page meta name. Defaults to
|
|
467
|
-
* `"<productName> — <ownerName>"`, or just `productName` when no owner is set.
|
|
468
|
-
*/
|
|
469
|
-
pageTitle?: string;
|
|
470
|
-
/**
|
|
471
|
-
* Replace the default monochrome "C" mark. `svg` is served at
|
|
472
|
-
* `/favicon.svg`, `ico` at `/favicon.ico`; omit either to keep the default
|
|
473
|
-
* for that format. Use `href` instead to point the page at an icon you host
|
|
474
|
-
* elsewhere (it replaces the `/favicon.svg` link in the page head; the
|
|
475
|
-
* `/favicon.*` routes still serve whatever `svg`/`ico` provide). `href` must
|
|
476
|
-
* be an absolute `http(s)` URL or a root-relative path; anything else falls
|
|
477
|
-
* back to the default mark.
|
|
478
|
-
*/
|
|
479
|
-
favicon?: {
|
|
480
|
-
svg?: string;
|
|
481
|
-
ico?: Uint8Array;
|
|
482
|
-
href?: string;
|
|
483
|
-
};
|
|
484
|
-
/** `theme-color` meta value. Defaults to "#ffffff". */
|
|
485
|
-
themeColor?: string;
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
/** An inbound authentication provider (bearer token, Clerk, ...). */
|
|
489
|
-
export interface InboundAuth {
|
|
490
|
-
kind: string;
|
|
491
|
-
/**
|
|
492
|
-
* Stable, non-secret namespace of the identity directory behind
|
|
493
|
-
* `activityActorLabel`. Stored with new activity actors so two providers with
|
|
494
|
-
* the same `kind` never receive each other's ids. Legacy actors without a
|
|
495
|
-
* namespace are resolved only when exactly one directory is unambiguous.
|
|
496
|
-
* Must be 1–256 printable, non-space ASCII characters; invalid values are
|
|
497
|
-
* treated as an unknown directory and are not persisted.
|
|
498
|
-
*/
|
|
499
|
-
activityActorNamespace?: string;
|
|
500
|
-
/**
|
|
501
|
-
* Best-effort friendly label for a stable activity actor id. Called only
|
|
502
|
-
* while serving an authorized activity read, never during tool admission or
|
|
503
|
-
* event writes. The result is display-only and cannot grant access.
|
|
504
|
-
*/
|
|
505
|
-
activityActorLabel?(
|
|
506
|
-
subjectId: string,
|
|
507
|
-
): string | undefined | Promise<string | undefined>;
|
|
508
|
-
/**
|
|
509
|
-
* Optional browser sign-in configuration. When present, operator pages use it
|
|
510
|
-
* provider instead of asking the operator to paste a static bearer secret.
|
|
511
|
-
*/
|
|
512
|
-
uiAuth?: UiAuthConfig;
|
|
513
|
-
/** Serve/short-circuit .well-known + OPTIONS. Return null when not handled. */
|
|
514
|
-
handleMetadata?(
|
|
515
|
-
request: Request,
|
|
516
|
-
baseUrl: string,
|
|
517
|
-
): Response | null | Promise<Response | null>;
|
|
518
|
-
/** Attempt to authorize a request. */
|
|
519
|
-
authorize(
|
|
520
|
-
request: Request,
|
|
521
|
-
baseUrl: string,
|
|
522
|
-
): AuthResult | Promise<AuthResult>;
|
|
523
|
-
}
|