@zackbart/connecta 0.22.3 → 0.24.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/AGENTS.md +5 -0
- package/CHANGELOG.md +82 -0
- package/README.md +19 -11
- package/dist/activity-friction.d.ts +3 -0
- package/dist/activity-friction.js +19 -0
- package/dist/activity.d.ts +11 -2
- package/dist/activity.js +15 -19
- package/dist/auth/downstream-oauth.d.ts +2 -1
- package/dist/auth/downstream-oauth.js +10 -1
- package/dist/branding.d.ts +67 -0
- package/dist/branding.js +176 -0
- package/dist/catalog-service.d.ts +1 -6
- package/dist/catalog-service.js +3 -53
- package/dist/connectors/remote-mcp.js +3 -5
- package/dist/credential-contract.d.ts +24 -0
- package/dist/credential-contract.js +1 -0
- package/dist/credential-rules.d.ts +85 -0
- package/dist/credential-rules.js +107 -0
- package/dist/credentials.d.ts +4 -100
- package/dist/credentials.js +3 -107
- package/dist/errors.d.ts +1 -1
- package/dist/execute.d.ts +5 -52
- package/dist/execute.js +40 -347
- package/dist/executors/quickjs-protocol.d.ts +0 -7
- package/dist/executors/quickjs-protocol.js +2 -10
- package/dist/executors/quickjs.js +1 -1
- package/dist/index.d.ts +23 -56
- package/dist/index.js +30 -58
- package/dist/invocation.d.ts +0 -33
- package/dist/invocation.js +56 -124
- package/dist/meta-tools.d.ts +7 -6
- package/dist/meta-tools.js +14 -21
- package/dist/module-contracts.d.ts +19 -0
- package/dist/module-contracts.js +1 -0
- package/dist/operator-ui/generated.js +2 -2
- package/dist/operator-ui/model.d.ts +6 -3
- package/dist/operator-ui/view.d.ts +2 -18
- package/dist/operator-ui/view.js +3 -20
- package/dist/registry.d.ts +4 -1
- package/dist/registry.js +8 -6
- package/dist/routes/activity.js +1 -1
- package/dist/routes/credentials.js +5 -2
- package/dist/routes/mcp.js +7 -51
- package/dist/routes/oauth-management.d.ts +2 -0
- package/dist/routes/oauth-management.js +108 -0
- package/dist/routes/oauth.d.ts +0 -1
- package/dist/routes/oauth.js +21 -121
- package/dist/routes/shared.d.ts +19 -17
- package/dist/routes/shared.js +48 -44
- package/dist/routes/ui.js +36 -33
- package/dist/server.d.ts +1 -2
- package/dist/server.js +7 -45
- package/dist/skills.d.ts +1 -1
- package/dist/skills.js +55 -19
- package/dist/types.d.ts +3 -15
- package/dist/ui.d.ts +15 -70
- package/dist/ui.js +176 -317
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/documentation/architecture.md +31 -26
- package/documentation/auth.md +65 -111
- package/documentation/call-admission.md +10 -11
- package/documentation/cloudflare.md +1 -1
- package/documentation/code-mode.md +65 -260
- package/documentation/connectors.md +8 -6
- package/documentation/linear.md +1 -1
- package/documentation/meta-tools.md +37 -18
- package/documentation/mixpanel.md +1 -1
- package/documentation/notion.md +2 -2
- package/documentation/operations.md +19 -23
- package/documentation/operator-ui.md +82 -104
- package/documentation/optional-modules-upgrade.md +243 -0
- package/documentation/provider-conventions.md +7 -5
- package/documentation/revenuecat.md +1 -1
- package/documentation/storage-and-credentials.md +59 -40
- package/documentation/stripe.md +1 -1
- package/documentation/upgrading.md +83 -8
- package/ethos.md +36 -43
- package/examples/worker/AGENTS.md +3 -1
- package/examples/worker/README.md +68 -84
- package/examples/worker/src/d1-activity.ts +1 -1
- package/examples/worker/src/index.ts +11 -6
- package/package.json +18 -2
- package/templates/node/AGENTS.md +8 -6
- package/templates/node/README.md +56 -67
- package/templates/node/package.json +1 -1
- package/templates/node/src/file-activity.ts +1 -1
- package/templates/node/src/index.ts +11 -12
- package/dist/access-tokens.d.ts +0 -31
- package/dist/access-tokens.js +0 -236
- package/dist/apps-shell.d.ts +0 -37
- package/dist/apps-shell.js +0 -174
- package/dist/routes/access-tokens.d.ts +0 -6
- package/dist/routes/access-tokens.js +0 -83
|
@@ -54,13 +54,6 @@ export interface ExecutionPayload {
|
|
|
54
54
|
*/
|
|
55
55
|
timedOut?: boolean;
|
|
56
56
|
}
|
|
57
|
-
/**
|
|
58
|
-
* How a host call should be named in an error a program will read. The lazy
|
|
59
|
-
* connector namespaces all dispatch through one internal function, so the raw
|
|
60
|
-
* provider/function pair would report every shortcut call as
|
|
61
|
-
* `connecta.__callNamespace` — an internal name that appears nowhere in the
|
|
62
|
-
* documented surface. Report the address the program actually called.
|
|
63
|
-
*/
|
|
64
57
|
export declare function hostCallLabel(payload: {
|
|
65
58
|
namespace: string;
|
|
66
59
|
functionName: string;
|
|
@@ -8,17 +8,9 @@ export const MAX_QUICKJS_IPC_BYTES = 1024 * 1024;
|
|
|
8
8
|
export const MAX_QUICKJS_LOG_TRANSPORT_BYTES = 512 * 1024;
|
|
9
9
|
/** Preserve #84's stopgap before a host value enters the child/WASM process. */
|
|
10
10
|
export const MAX_QUICKJS_HOST_RPC_BYTES = 256 * 1024;
|
|
11
|
-
/**
|
|
12
|
-
* How a host call should be named in an error a program will read. The lazy
|
|
13
|
-
* connector namespaces all dispatch through one internal function, so the raw
|
|
14
|
-
* provider/function pair would report every shortcut call as
|
|
15
|
-
* `connecta.__callNamespace` — an internal name that appears nowhere in the
|
|
16
|
-
* documented surface. Report the address the program actually called.
|
|
17
|
-
*/
|
|
18
11
|
export function hostCallLabel(payload) {
|
|
19
|
-
if (payload.functionName === "
|
|
20
|
-
|
|
21
|
-
return `${String(connectorId)}.${String(toolAlias)}`;
|
|
12
|
+
if (payload.namespace === "connecta" && payload.functionName === "call") {
|
|
13
|
+
return String(payload.args[0]);
|
|
22
14
|
}
|
|
23
15
|
return `${payload.namespace}.${payload.functionName}`;
|
|
24
16
|
}
|
|
@@ -411,7 +411,7 @@ class QuickJsChildPool {
|
|
|
411
411
|
}
|
|
412
412
|
catch (err) {
|
|
413
413
|
// The guest reads this text, so it names the address the program called
|
|
414
|
-
// rather than the
|
|
414
|
+
// rather than only the generic connecta.call bridge function.
|
|
415
415
|
const label = hostCallLabel(payload);
|
|
416
416
|
const detail = err instanceof RangeError
|
|
417
417
|
? `Host result from ${label} exceeds the ${MAX_QUICKJS_HOST_RPC_BYTES}-byte serialized bridge limit.`
|
package/dist/index.d.ts
CHANGED
|
@@ -1,34 +1,9 @@
|
|
|
1
|
+
import type { CredentialVault } from "./credential-contract.js";
|
|
1
2
|
import { Registry } from "./registry.js";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Privacy-minimal downstream tool activity storage. Writes are best-effort
|
|
8
|
-
* and never change tool results. Implement `list` to enable the Activity UI.
|
|
9
|
-
*/
|
|
10
|
-
store: ActivityStore;
|
|
11
|
-
/**
|
|
12
|
-
* Optional authorization gate for the Activity read API. MCP authentication
|
|
13
|
-
* is still required first. Omit to admit every authenticated actor.
|
|
14
|
-
*/
|
|
15
|
-
readGate?: ActivityReadGate;
|
|
16
|
-
/** Stable deployment label included in activity events, e.g. "production". */
|
|
17
|
-
deploymentId?: string;
|
|
18
|
-
}
|
|
19
|
-
/** Operator-vault encryption. */
|
|
20
|
-
export interface ConnectaCredentialsConfig {
|
|
21
|
-
/**
|
|
22
|
-
* Base64-encoded 32-byte AES key for credentials managed on /credentials.
|
|
23
|
-
* Keep this in the runtime's secret store, never in KV or source control.
|
|
24
|
-
*/
|
|
25
|
-
encryptionKey?: string;
|
|
26
|
-
}
|
|
27
|
-
/** Operator-issued credentials for clients connecting to this deployment. */
|
|
28
|
-
export interface ConnectaAccessTokensConfig {
|
|
29
|
-
/** Maximum simultaneously active access tokens. Defaults to 100. */
|
|
30
|
-
maxActive?: number;
|
|
31
|
-
}
|
|
3
|
+
import type { ActivityModule, OperatorSurface } from "./module-contracts.js";
|
|
4
|
+
export type { ActivityModule, OperatorSurface } from "./module-contracts.js";
|
|
5
|
+
export type { CredentialVault, CredentialMetadata } from "./credential-contract.js";
|
|
6
|
+
import type { AuthenticatedIdentity, Connector, Executor, IdentityReference, InboundAuth, KVStorage, Logger } from "./types.js";
|
|
32
7
|
/** Tool-catalog caching, persistence, stale fallback, and probe deadlines. */
|
|
33
8
|
export interface ConnectaDiscoveryConfig {
|
|
34
9
|
/**
|
|
@@ -65,7 +40,7 @@ export interface ConnectaCallsConfig {
|
|
|
65
40
|
* `timeoutMs`. An explicit per-call value wins. Opt-in: unset by default, so
|
|
66
41
|
* existing long-running calls gain no surprise deadline.
|
|
67
42
|
*
|
|
68
|
-
*
|
|
43
|
+
* Each call makes one attempt. `execute_code` host calls are
|
|
69
44
|
* unaffected because they already carry their own bound.
|
|
70
45
|
*/
|
|
71
46
|
defaultTimeoutMs?: number;
|
|
@@ -116,22 +91,22 @@ export interface ConnectaAdmissionConfig {
|
|
|
116
91
|
code?: AdmissionPoolConfig;
|
|
117
92
|
}
|
|
118
93
|
/** Config-owned identity rules for one deployment and tenant. */
|
|
94
|
+
export type ConnectorPermission = "all" | "none" | readonly string[];
|
|
119
95
|
export interface ConnectaIdentityConfig {
|
|
120
96
|
/** Connector ids this admitted identity may discover and call. */
|
|
121
97
|
connectorAccess?(identity: Readonly<AuthenticatedIdentity>): "all" | readonly string[] | Promise<"all" | readonly string[]>;
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
operatorAccess?(principal: Readonly<IdentityReference>): boolean | Promise<boolean>;
|
|
98
|
+
/** Global payload-free activity reads. Defaults to interactive humans. */
|
|
99
|
+
activityAccess?(principal: Readonly<IdentityReference>): boolean | Promise<boolean>;
|
|
100
|
+
/** Shared credential and OAuth administration. Defaults to none. */
|
|
101
|
+
credentialAdministration?(identity: Readonly<AuthenticatedIdentity>): ConnectorPermission | Promise<ConnectorPermission>;
|
|
102
|
+
/** Connecting or changing the caller's personal account. Defaults to none. */
|
|
103
|
+
personalConnection?(identity: Readonly<AuthenticatedIdentity>): ConnectorPermission | Promise<ConnectorPermission>;
|
|
129
104
|
}
|
|
130
105
|
export interface ConnectaConfig {
|
|
131
106
|
connectors: Connector[];
|
|
132
107
|
/** Inbound auth adapters. Includes bearerToken(...); omit for open (dev). */
|
|
133
108
|
auth?: InboundAuth | InboundAuth[];
|
|
134
|
-
/**
|
|
109
|
+
/** Code-derived connection visibility and independent management permissions. */
|
|
135
110
|
identity?: ConnectaIdentityConfig;
|
|
136
111
|
/** KVStorage impl. Defaults to memoryStorage(). */
|
|
137
112
|
storage?: KVStorage;
|
|
@@ -140,15 +115,12 @@ export interface ConnectaConfig {
|
|
|
140
115
|
* HTTPS URL also redirects matching inbound HTTP requests to HTTPS.
|
|
141
116
|
*/
|
|
142
117
|
publicUrl?: string;
|
|
143
|
-
/**
|
|
144
|
-
activity?:
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
/**
|
|
148
|
-
|
|
149
|
-
* require an eligible interactive operator; token secrets are returned once.
|
|
150
|
-
*/
|
|
151
|
-
accessTokens?: ConnectaAccessTokensConfig;
|
|
118
|
+
/** Optional recorder and reader, created by activityHistory() from /activity. */
|
|
119
|
+
activity?: ActivityModule;
|
|
120
|
+
/** Replaceable owner-partitioned credential storage. Omit for config-owned secrets. */
|
|
121
|
+
vault?: CredentialVault;
|
|
122
|
+
/** Optional connection UI, created by operatorUi() from /ui. */
|
|
123
|
+
ui?: OperatorSurface;
|
|
152
124
|
/** Tool-catalog caching, persistence, stale fallback, and probe deadlines. */
|
|
153
125
|
discovery?: ConnectaDiscoveryConfig;
|
|
154
126
|
/** Deployment-wide call deadlines and result paging threshold. */
|
|
@@ -157,9 +129,8 @@ export interface ConnectaConfig {
|
|
|
157
129
|
execute?: ConnectaExecuteConfig;
|
|
158
130
|
/** Bounded MCP and fallback code-mode admission. */
|
|
159
131
|
admission?: ConnectaAdmissionConfig;
|
|
160
|
-
/**
|
|
161
|
-
|
|
162
|
-
logger?: Logger;
|
|
132
|
+
/** Diagnostic output. Use "silent" to disable all diagnostic logging. */
|
|
133
|
+
logger?: Logger | "silent";
|
|
163
134
|
serverInfo?: {
|
|
164
135
|
name?: string;
|
|
165
136
|
version?: string;
|
|
@@ -198,14 +169,10 @@ export { ConnectorCallError } from "./errors.js";
|
|
|
198
169
|
export type { ConnectorCallErrorCode, CallErrorDetails } from "./errors.js";
|
|
199
170
|
export { validateToolInput } from "./validate.js";
|
|
200
171
|
export type { ValidateToolInputOptions } from "./validate.js";
|
|
201
|
-
export { bearerToken } from "./auth/bearer.js";
|
|
202
|
-
export type { BearerTokenOptions } from "./auth/bearer.js";
|
|
203
|
-
export type { AccessTokenMetadata, CreatedAccessToken, } from "./access-tokens.js";
|
|
204
172
|
export { memoryStorage } from "./storage/memory.js";
|
|
205
173
|
export { CONNECTA_VERSION } from "./version.js";
|
|
206
174
|
export type { Registry } from "./registry.js";
|
|
207
175
|
export type { RemoteMcpOptions, RemoteMcpAuth, RemoteMcpRedirectPolicy, } from "./connectors/remote-mcp.js";
|
|
208
176
|
export type { ApiOptions, ApiTool } from "./connectors/api.js";
|
|
209
|
-
export type { CatalogDriftCounts, CatalogDriftReport, Connector, ConnectorCallAdmissionInput, ConnectorCallAdmissionPolicy, ConnectorCallAdmissionRule, ConnectorRollingWindowBudget,
|
|
177
|
+
export type { CatalogDriftCounts, CatalogDriftReport, ConnectaBranding, Connector, ConnectorCallAdmissionInput, ConnectorCallAdmissionPolicy, ConnectorCallAdmissionRule, ConnectorRollingWindowBudget, ConnectorCredentialAccess, ConnectorCredentialConfig, ConnectorCredentialFieldConfig, ConnectorCredentialValues, ConnectorContext, ConnectorUsageGuide, ConnectorStatus, CredentialTestResult, AdmittingExecutor, AdmissionSnapshot, ExecuteResult, Executor, ExecutorLease, ExecutorProvider, InboundAuth, InboundAuthRuntimeContext, UiAuthConfig, AuthResult, AuthenticatedIdentity, IdentityReference, JsonSchema, KVStorage, Logger, ToolDef, ToolAnnotations, } from "./types.js";
|
|
210
178
|
export type { ActivityActor, ActivityCallSource, ActivityOutcome, ActivityPage, ActivityReadActor, ActivityReadEvent, ActivityReader, ActivityReadGate, ActivityReadPage, ActivitySink, ActivityStore, AgentFriction, CatalogDriftActivityEvent, ToolCallActivityEvent, } from "./activity.js";
|
|
211
|
-
export { InvalidActivityCursorError } from "./activity.js";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { AccessTokenManager } from "./access-tokens.js";
|
|
1
|
+
import { credentialTestRule, describeCredentialTestMismatch, } from "./credential-rules.js";
|
|
3
2
|
import { Registry } from "./registry.js";
|
|
4
3
|
import { createFetchHandler } from "./server.js";
|
|
5
|
-
import { droppedBrandingUrls, droppedUiAuthUrls } from "./
|
|
4
|
+
import { droppedBrandingUrls, droppedUiAuthUrls } from "./branding.js";
|
|
6
5
|
import { memoryStorage } from "./storage/memory.js";
|
|
7
6
|
import { CONNECTA_VERSION } from "./version.js";
|
|
8
7
|
import { AdmissionController, executorName, isAdmittingExecutor, withExecutorAdmission, } from "./executor-admission.js";
|
|
@@ -53,21 +52,15 @@ const CONFIG_SCHEMA = {
|
|
|
53
52
|
auth: null,
|
|
54
53
|
identity: {
|
|
55
54
|
connectorAccess: null,
|
|
56
|
-
|
|
55
|
+
activityAccess: null,
|
|
56
|
+
credentialAdministration: null,
|
|
57
|
+
personalConnection: null,
|
|
57
58
|
},
|
|
58
59
|
storage: null,
|
|
59
60
|
publicUrl: null,
|
|
60
|
-
activity:
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
deploymentId: null,
|
|
64
|
-
},
|
|
65
|
-
credentials: {
|
|
66
|
-
encryptionKey: null,
|
|
67
|
-
},
|
|
68
|
-
accessTokens: {
|
|
69
|
-
maxActive: null,
|
|
70
|
-
},
|
|
61
|
+
activity: null,
|
|
62
|
+
vault: null,
|
|
63
|
+
ui: null,
|
|
71
64
|
discovery: {
|
|
72
65
|
concurrency: null,
|
|
73
66
|
catalogTtlSeconds: null,
|
|
@@ -87,20 +80,6 @@ const CONFIG_SCHEMA = {
|
|
|
87
80
|
requests: admissionPoolSchema,
|
|
88
81
|
code: admissionPoolSchema,
|
|
89
82
|
},
|
|
90
|
-
branding: {
|
|
91
|
-
productName: null,
|
|
92
|
-
productUrl: null,
|
|
93
|
-
ownerName: null,
|
|
94
|
-
ownerUrl: null,
|
|
95
|
-
description: null,
|
|
96
|
-
pageTitle: null,
|
|
97
|
-
favicon: {
|
|
98
|
-
svg: null,
|
|
99
|
-
ico: null,
|
|
100
|
-
href: null,
|
|
101
|
-
},
|
|
102
|
-
themeColor: null,
|
|
103
|
-
},
|
|
104
83
|
logger: null,
|
|
105
84
|
serverInfo: {
|
|
106
85
|
name: null,
|
|
@@ -144,17 +123,24 @@ function rejectUnknownOptions(paths) {
|
|
|
144
123
|
if (paths.length === 0)
|
|
145
124
|
return;
|
|
146
125
|
throw new Error(`Unknown Connecta configuration option${paths.length === 1 ? "" : "s"}:\n` +
|
|
147
|
-
paths.map((path) => `- ${path}`).join("\n")
|
|
126
|
+
paths.map((path) => `- ${path}`).join("\n") +
|
|
127
|
+
(paths.includes("ConnectaConfig.credentials") ? "\nUse vault: encryptedCredentialVault(storage, key) from @zackbart/connecta/credentials." : "") +
|
|
128
|
+
(paths.includes("ConnectaConfig.accessTokens") ? "\nConnecta-issued tokens were removed. Configure an inbound auth adapter instead." : "") +
|
|
129
|
+
(paths.includes("ConnectaConfig.branding") ? "\nMove branding into ui: operatorUi({ branding }) from @zackbart/connecta/ui." : ""));
|
|
148
130
|
}
|
|
149
131
|
/** Reject JavaScript typos and removed options before construction does work. */
|
|
150
132
|
function assertKnownConfig(config) {
|
|
151
133
|
rejectUnknownOptions(unknownOptionPaths(config, "ConnectaConfig", CONFIG_SCHEMA));
|
|
134
|
+
if (config.vault && ["get", "getAll", "set", "setAll", "metadata", "delete"].some(key => typeof config.vault[key] !== "function"))
|
|
135
|
+
throw new Error("ConnectaConfig.vault must implement CredentialVault");
|
|
136
|
+
if (config.ui && (typeof config.ui.handle !== "function" || typeof config.ui.credentialHandoffUrl !== "function" || !Array.isArray(config.ui.reservedPaths)))
|
|
137
|
+
throw new Error("ConnectaConfig.ui must be created with operatorUi(...)");
|
|
152
138
|
const activity = config.activity;
|
|
153
139
|
if (activity !== undefined &&
|
|
154
140
|
(typeof activity !== "object" ||
|
|
155
141
|
activity === null ||
|
|
156
|
-
typeof activity.
|
|
157
|
-
throw new Error("ConnectaConfig.activity
|
|
142
|
+
typeof activity.recordTool !== "function")) {
|
|
143
|
+
throw new Error("ConnectaConfig.activity must be created with activityHistory(...)");
|
|
158
144
|
}
|
|
159
145
|
}
|
|
160
146
|
/**
|
|
@@ -171,7 +157,7 @@ function warnInsecureConfig(config, inboundAuth, logger) {
|
|
|
171
157
|
if (inboundAuth.length === 0 &&
|
|
172
158
|
(hasCredentialConnector || oauthConnectors.length > 0)) {
|
|
173
159
|
logger.warn("[connecta] running with no inbound authentication: any caller can " +
|
|
174
|
-
"invoke every connector
|
|
160
|
+
"invoke every shared connector. " +
|
|
175
161
|
"Configure `auth` (for example bearerToken(...) or Clerk) to gate access.");
|
|
176
162
|
}
|
|
177
163
|
// Unset publicUrl with OAuth connectors: the downstream redirect_uri is
|
|
@@ -186,7 +172,7 @@ function warnInsecureConfig(config, inboundAuth, logger) {
|
|
|
186
172
|
// Branding URLs that failed their scheme gate. Rendering silently falls back
|
|
187
173
|
// (a bad URL must not take the page down), so this warning is the only way an
|
|
188
174
|
// operator learns their value never reached the page.
|
|
189
|
-
const dropped = droppedBrandingUrls(config.branding);
|
|
175
|
+
const dropped = droppedBrandingUrls(config.ui?.branding);
|
|
190
176
|
if (dropped.length > 0) {
|
|
191
177
|
logger.warn(`[connecta] branding ${dropped.join(", ")} dropped: a branding URL is ` +
|
|
192
178
|
"used as an href, so it must be an absolute http(s) URL (favicon.href " +
|
|
@@ -250,26 +236,11 @@ export function createConnecta(config) {
|
|
|
250
236
|
'"@cloudflare/codemode" on Workers.');
|
|
251
237
|
}
|
|
252
238
|
const storage = config.storage ?? memoryStorage();
|
|
253
|
-
const logger = config.logger
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
logger.warn("Human-managed credentials are unavailable because " +
|
|
258
|
-
"credentials.encryptionKey is not configured for connectors: " +
|
|
259
|
-
credentialConnectors.map((c) => c.id).join(", "));
|
|
260
|
-
}
|
|
261
|
-
const credentialVault = encryptionKey
|
|
262
|
-
? new CredentialVault(storage, encryptionKey)
|
|
263
|
-
: undefined;
|
|
239
|
+
const logger = config.logger === "silent"
|
|
240
|
+
? { debug() { }, info() { }, warn() { }, error() { } }
|
|
241
|
+
: config.logger ?? defaultLogger();
|
|
242
|
+
const credentialVault = config.vault;
|
|
264
243
|
const configuredAuth = normalizeAuth(config.auth);
|
|
265
|
-
const accessTokens = config.accessTokens
|
|
266
|
-
? new AccessTokenManager(storage, config.accessTokens)
|
|
267
|
-
: undefined;
|
|
268
|
-
if (accessTokens &&
|
|
269
|
-
!configuredAuth.some((provider) => provider.interactiveOperator)) {
|
|
270
|
-
throw new Error("accessTokens requires an interactive operator auth provider: only an eligible " +
|
|
271
|
-
"operator may create, rename, or revoke deployment access tokens");
|
|
272
|
-
}
|
|
273
244
|
const serverInfo = {
|
|
274
245
|
...config.serverInfo,
|
|
275
246
|
name: config.serverInfo?.name ?? "connecta",
|
|
@@ -279,9 +250,11 @@ export function createConnecta(config) {
|
|
|
279
250
|
storage,
|
|
280
251
|
logger,
|
|
281
252
|
credentialVault,
|
|
253
|
+
credentialUi: Boolean(config.ui),
|
|
282
254
|
catalogDriftActivity: config.activity?.store
|
|
283
255
|
? {
|
|
284
256
|
sink: config.activity.store,
|
|
257
|
+
recordDrift: config.activity.recordDrift,
|
|
285
258
|
serverInfo,
|
|
286
259
|
...(config.activity.deploymentId !== undefined
|
|
287
260
|
? { deploymentId: config.activity.deploymentId }
|
|
@@ -293,7 +266,7 @@ export function createConnecta(config) {
|
|
|
293
266
|
toolCatalogStaleSeconds: config.discovery?.staleCatalogSeconds,
|
|
294
267
|
maxResultBytes: config.calls?.maxResultBytes,
|
|
295
268
|
});
|
|
296
|
-
const inboundAuth =
|
|
269
|
+
const inboundAuth = configuredAuth;
|
|
297
270
|
warnInsecureConfig(config, inboundAuth, logger);
|
|
298
271
|
const requestAdmission = admissionController(config.admission?.requests, REQUEST_ADMISSION_DEFAULTS);
|
|
299
272
|
const configuredCodeAdmission = admissionController(config.admission?.code, CODE_ADMISSION_DEFAULTS);
|
|
@@ -319,6 +292,7 @@ export function createConnecta(config) {
|
|
|
319
292
|
serverInfo,
|
|
320
293
|
logger,
|
|
321
294
|
activity: config.activity?.store,
|
|
295
|
+
activityModule: config.activity,
|
|
322
296
|
activityReadGate: config.activity?.readGate,
|
|
323
297
|
activityDeploymentId: config.activity?.deploymentId,
|
|
324
298
|
executor,
|
|
@@ -330,9 +304,9 @@ export function createConnecta(config) {
|
|
|
330
304
|
maxEmittedBytes: config.execute?.maxEmittedBytes,
|
|
331
305
|
maxEmittedBlocks: config.execute?.maxEmittedBlocks,
|
|
332
306
|
credentialVault,
|
|
333
|
-
|
|
307
|
+
ui: config.ui,
|
|
334
308
|
deploymentInfo: config.deploymentInfo,
|
|
335
|
-
branding: config.branding,
|
|
309
|
+
branding: config.ui?.branding,
|
|
336
310
|
});
|
|
337
311
|
let closePromise;
|
|
338
312
|
return {
|
|
@@ -358,7 +332,5 @@ export { ConnectorCallError } from "./errors.js";
|
|
|
358
332
|
// implement the Connector interface directly. Returns the error rather than
|
|
359
333
|
// throwing so the caller decides what to do with it.
|
|
360
334
|
export { validateToolInput } from "./validate.js";
|
|
361
|
-
export { bearerToken } from "./auth/bearer.js";
|
|
362
335
|
export { memoryStorage } from "./storage/memory.js";
|
|
363
336
|
export { CONNECTA_VERSION } from "./version.js";
|
|
364
|
-
export { InvalidActivityCursorError } from "./activity.js";
|
package/dist/invocation.d.ts
CHANGED
|
@@ -2,36 +2,10 @@ import { type ActivityCallSource, type ActivityRequestContext, type AgentFrictio
|
|
|
2
2
|
import { CatalogService, type ResolvedCatalogTool } from "./catalog-service.js";
|
|
3
3
|
import { type CallErrorDetails } from "./errors.js";
|
|
4
4
|
import { type RegistryView } from "./registry.js";
|
|
5
|
-
/**
|
|
6
|
-
* The longest the engine will park a synchronous inbound request in *waiting
|
|
7
|
-
* alone*. The engine already treats ~15 s as the outer bound of one reasonable
|
|
8
|
-
* connector call (EXECUTE_HOST_CALL_TIMEOUT_MS), so sleeping for minutes trades
|
|
9
|
-
* a fast, informative failure for a hung one. A connector-reported window this
|
|
10
|
-
* long isn't truncated — it's declined (see `retryBackoffMs`) and reported
|
|
11
|
-
* verbatim as `error.retryAfterMs`, so the agent, which can afford to wait,
|
|
12
|
-
* decides when to re-issue.
|
|
13
|
-
*/
|
|
14
|
-
export declare const MAX_RETRY_BACKOFF_MS = 10000;
|
|
15
|
-
/**
|
|
16
|
-
* How long to wait before the next attempt, or `undefined` for "don't retry".
|
|
17
|
-
*
|
|
18
|
-
* A connector that read a `Retry-After` header knows the window exactly, so it
|
|
19
|
-
* is honoured **exactly or not at all**: truncating an exponential *guess* is
|
|
20
|
-
* harmless, but truncating a *known* window means deliberately retrying inside
|
|
21
|
-
* a rate limit — the harm this channel exists to prevent. A window longer than
|
|
22
|
-
* `MAX_RETRY_BACKOFF_MS` therefore declines the retry rather than shortening
|
|
23
|
-
* it. (`retryAfterMs` is normalized non-negative, so `0` means "retry now".)
|
|
24
|
-
* Connectors that report no window keep the historical exponential guess.
|
|
25
|
-
*
|
|
26
|
-
* Waits are per attempt, matching the per-attempt `timeoutMs` race in
|
|
27
|
-
* `InvocationService.invoke`. Exported for direct testing.
|
|
28
|
-
*/
|
|
29
|
-
export declare function retryBackoffMs(attempt: number, retryAfterMs: number | undefined): number | undefined;
|
|
30
5
|
export interface InvocationTiming {
|
|
31
6
|
catalogMs: number;
|
|
32
7
|
admissionMs: number;
|
|
33
8
|
connectorMs: number;
|
|
34
|
-
backoffMs: number;
|
|
35
9
|
resultProcessingMs: number;
|
|
36
10
|
totalMs: number;
|
|
37
11
|
}
|
|
@@ -53,7 +27,6 @@ export interface InvocationContext<T> {
|
|
|
53
27
|
source: ActivityCallSource;
|
|
54
28
|
allowDestructive?: boolean;
|
|
55
29
|
timeoutMs?: number;
|
|
56
|
-
maxRetries?: number;
|
|
57
30
|
requestSignal?: AbortSignal;
|
|
58
31
|
unwrapResult?: boolean;
|
|
59
32
|
/**
|
|
@@ -97,11 +70,5 @@ export declare class InvocationService {
|
|
|
97
70
|
private readonly activity?;
|
|
98
71
|
constructor(registry: RegistryView, catalog: CatalogService, activity?: ActivityRequestContext | undefined);
|
|
99
72
|
invoke<T = unknown>(address: string, args: unknown, context: InvocationContext<T>): Promise<InvocationOutcome<T>>;
|
|
100
|
-
/**
|
|
101
|
-
* Code-mode namespace dispatch preserves JavaScript-safe tool aliases while
|
|
102
|
-
* still feeding the resolved catalog entry through the one invocation path.
|
|
103
|
-
*/
|
|
104
|
-
invokeToolAlias<T = unknown>(connectorId: string, toolAlias: string, aliasFor: (toolName: string) => string, args: unknown, context: InvocationContext<T>): Promise<InvocationOutcome<T>>;
|
|
105
|
-
private invokeWithResolution;
|
|
106
73
|
}
|
|
107
74
|
export {};
|