@zackbart/connecta 0.18.3 → 0.20.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 +131 -4
- package/dist/apps-shell.d.ts +10 -12
- package/dist/apps-shell.js +29 -220
- package/dist/catalog-service.d.ts +16 -13
- package/dist/catalog-service.js +106 -115
- package/dist/catalog.js +29 -46
- package/dist/connector-scope.js +2 -7
- package/dist/connectors/api.d.ts +4 -16
- package/dist/connectors/api.js +19 -46
- package/dist/connectors/guarded-fetch.d.ts +9 -23
- package/dist/connectors/guarded-fetch.js +38 -76
- package/dist/connectors/remote-mcp.js +36 -79
- package/dist/errors.d.ts +6 -27
- package/dist/errors.js +8 -5
- package/dist/execute.d.ts +23 -28
- package/dist/execute.js +101 -257
- package/dist/executor-result.d.ts +1 -0
- package/dist/executor-result.js +4 -11
- package/dist/executors/quickjs-child.js +1 -3
- package/dist/executors/quickjs-runtime.js +1 -3
- package/dist/executors/quickjs.js +1 -3
- package/dist/index.js +134 -123
- package/dist/invocation.d.ts +1 -1
- package/dist/invocation.js +113 -183
- package/dist/meta-tools.d.ts +15 -29
- package/dist/meta-tools.js +41 -582
- package/dist/operator-ui/generated.d.ts +2 -2
- package/dist/providers/cloudflare.d.ts +2 -18
- package/dist/providers/cloudflare.js +1460 -2451
- package/dist/providers/linear.d.ts +4 -41
- package/dist/providers/linear.js +8 -39
- package/dist/providers/mixpanel.d.ts +3 -25
- package/dist/providers/mixpanel.js +7 -22
- package/dist/providers/notion.d.ts +1 -15
- package/dist/providers/notion.js +44 -173
- package/dist/providers/revenuecat.d.ts +4 -57
- package/dist/providers/revenuecat.js +10 -93
- package/dist/providers/stripe.d.ts +1 -12
- package/dist/providers/stripe.js +7 -45
- package/dist/registry.d.ts +9 -34
- package/dist/registry.js +9 -103
- package/dist/routes/mcp.js +1 -1
- package/dist/routes/oauth.js +3 -3
- package/dist/routes/shared.d.ts +15 -15
- package/dist/routes/shared.js +1 -3
- package/dist/skills.d.ts +1 -1
- package/dist/skills.js +5 -5
- package/dist/timeout.d.ts +8 -7
- package/dist/timeout.js +47 -38
- package/dist/types.d.ts +3 -3
- package/dist/ui.d.ts +1 -25
- package/dist/ui.js +18 -45
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/documentation/call-admission.md +1 -1
- package/documentation/cloudflare.md +1 -1
- package/documentation/code-mode.md +25 -25
- package/documentation/connectors.md +24 -1
- package/documentation/linear.md +1 -1
- package/documentation/meta-tools.md +4 -30
- package/documentation/mixpanel.md +1 -1
- package/documentation/notion.md +1 -1
- package/documentation/operations.md +29 -25
- package/documentation/provider-conventions.md +4 -5
- package/documentation/revenuecat.md +1 -1
- package/documentation/stripe.md +1 -1
- package/documentation/upgrading.md +43 -8
- package/ethos.md +75 -121
- package/package.json +3 -4
- package/templates/node/package.json +1 -1
- package/documentation/code-first-exploration.md +0 -292
- package/documentation/mcp-2026-07-28.md +0 -46
- package/documentation/mcp-ui-design.md +0 -382
- package/documentation/program-ui-read-calls.md +0 -213
- package/documentation/provider-audit.md +0 -198
- package/documentation/rich-output-design.md +0 -211
package/dist/index.js
CHANGED
|
@@ -42,71 +42,116 @@ function normalizeAuth(auth) {
|
|
|
42
42
|
return rank(a) - rank(b);
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
45
|
+
const admissionPoolSchema = {
|
|
46
|
+
concurrency: null,
|
|
47
|
+
maxQueueSize: null,
|
|
48
|
+
queueTimeoutMs: null,
|
|
49
|
+
retryAfterMs: null,
|
|
50
|
+
};
|
|
51
|
+
const CONFIG_SCHEMA = {
|
|
52
|
+
connectors: null,
|
|
53
|
+
auth: null,
|
|
54
|
+
storage: null,
|
|
55
|
+
publicUrl: null,
|
|
56
|
+
activity: {
|
|
57
|
+
store: null,
|
|
58
|
+
readGate: null,
|
|
59
|
+
deploymentId: null,
|
|
60
|
+
},
|
|
61
|
+
credentials: {
|
|
62
|
+
encryptionKey: null,
|
|
63
|
+
},
|
|
64
|
+
accessTokens: {
|
|
65
|
+
maxActive: null,
|
|
66
|
+
},
|
|
67
|
+
discovery: {
|
|
68
|
+
concurrency: null,
|
|
69
|
+
catalogTtlSeconds: null,
|
|
70
|
+
persistCatalog: null,
|
|
71
|
+
staleCatalogSeconds: null,
|
|
72
|
+
probeTimeoutMs: null,
|
|
73
|
+
},
|
|
74
|
+
calls: {
|
|
75
|
+
defaultTimeoutMs: null,
|
|
76
|
+
maxResultBytes: null,
|
|
77
|
+
},
|
|
78
|
+
execute: {
|
|
79
|
+
maxEmittedBytes: null,
|
|
80
|
+
maxEmittedBlocks: null,
|
|
81
|
+
},
|
|
82
|
+
admission: {
|
|
83
|
+
requests: admissionPoolSchema,
|
|
84
|
+
code: admissionPoolSchema,
|
|
85
|
+
},
|
|
86
|
+
branding: {
|
|
87
|
+
productName: null,
|
|
88
|
+
productUrl: null,
|
|
89
|
+
ownerName: null,
|
|
90
|
+
ownerUrl: null,
|
|
91
|
+
description: null,
|
|
92
|
+
pageTitle: null,
|
|
93
|
+
favicon: {
|
|
94
|
+
svg: null,
|
|
95
|
+
ico: null,
|
|
96
|
+
href: null,
|
|
97
|
+
},
|
|
98
|
+
themeColor: null,
|
|
99
|
+
},
|
|
100
|
+
logger: null,
|
|
101
|
+
serverInfo: {
|
|
102
|
+
name: null,
|
|
103
|
+
version: null,
|
|
104
|
+
title: null,
|
|
105
|
+
websiteUrl: null,
|
|
106
|
+
icons: [
|
|
107
|
+
{
|
|
108
|
+
src: null,
|
|
109
|
+
mimeType: null,
|
|
110
|
+
sizes: null,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
deploymentInfo: null,
|
|
115
|
+
executor: null,
|
|
116
|
+
};
|
|
117
|
+
function unknownOptionPaths(value, path, schema) {
|
|
118
|
+
if (schema === null)
|
|
119
|
+
return [];
|
|
120
|
+
if (Array.isArray(schema)) {
|
|
121
|
+
if (!Array.isArray(value))
|
|
122
|
+
return [];
|
|
123
|
+
return value.flatMap((entry, index) => unknownOptionPaths(entry, `${path}[${index}]`, schema[0]));
|
|
101
124
|
}
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
125
|
+
if (typeof value !== "object" || value === null)
|
|
126
|
+
return [];
|
|
127
|
+
const known = new Set(Object.keys(schema));
|
|
128
|
+
const unknown = Reflect.ownKeys(value)
|
|
129
|
+
.filter((key) => typeof key !== "string" || !known.has(key))
|
|
130
|
+
.map((key) => `${path}.${String(key)}`)
|
|
131
|
+
.sort();
|
|
132
|
+
if (unknown.length > 0)
|
|
133
|
+
return unknown;
|
|
134
|
+
for (const [key, childSchema] of Object.entries(schema)) {
|
|
135
|
+
unknown.push(...unknownOptionPaths(value[key], `${path}.${key}`, childSchema));
|
|
105
136
|
}
|
|
106
|
-
|
|
137
|
+
return unknown;
|
|
138
|
+
}
|
|
139
|
+
function rejectUnknownOptions(paths) {
|
|
140
|
+
if (paths.length === 0)
|
|
107
141
|
return;
|
|
108
|
-
throw new Error(
|
|
109
|
-
|
|
142
|
+
throw new Error(`Unknown Connecta configuration option${paths.length === 1 ? "" : "s"}:\n` +
|
|
143
|
+
paths.map((path) => `- ${path}`).join("\n"));
|
|
144
|
+
}
|
|
145
|
+
/** Reject JavaScript typos and removed options before construction does work. */
|
|
146
|
+
function assertKnownConfig(config) {
|
|
147
|
+
rejectUnknownOptions(unknownOptionPaths(config, "ConnectaConfig", CONFIG_SCHEMA));
|
|
148
|
+
const activity = config.activity;
|
|
149
|
+
if (activity !== undefined &&
|
|
150
|
+
(typeof activity !== "object" ||
|
|
151
|
+
activity === null ||
|
|
152
|
+
typeof activity.store?.record !== "function")) {
|
|
153
|
+
throw new Error("ConnectaConfig.activity.store must implement record(event)");
|
|
154
|
+
}
|
|
110
155
|
}
|
|
111
156
|
/**
|
|
112
157
|
* One-time construction warnings for deployment shapes that run fine but are
|
|
@@ -193,11 +238,7 @@ function warnInsecureConfig(config, inboundAuth, logger) {
|
|
|
193
238
|
}
|
|
194
239
|
}
|
|
195
240
|
export function createConnecta(config) {
|
|
196
|
-
|
|
197
|
-
if (Object.prototype.hasOwnProperty.call(config, "surface")) {
|
|
198
|
-
throw new Error("ConnectaConfig.surface was removed in issue #273. Remove it; connecta " +
|
|
199
|
-
"now serves one seven-tool surface.");
|
|
200
|
-
}
|
|
241
|
+
assertKnownConfig(config);
|
|
201
242
|
if (!config.executor) {
|
|
202
243
|
throw new Error("ConnectaConfig.executor is required. Configure quickJsExecutor() from " +
|
|
203
244
|
'"@zackbart/connecta/quickjs" on Node, or ' +
|
|
@@ -233,30 +274,20 @@ export function createConnecta(config) {
|
|
|
233
274
|
const registry = new Registry(config.connectors, {
|
|
234
275
|
storage,
|
|
235
276
|
logger,
|
|
236
|
-
|
|
237
|
-
|
|
277
|
+
credentialVault,
|
|
278
|
+
catalogDriftActivity: config.activity?.store
|
|
238
279
|
? {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
: {}),
|
|
245
|
-
},
|
|
280
|
+
sink: config.activity.store,
|
|
281
|
+
serverInfo,
|
|
282
|
+
...(config.activity.deploymentId !== undefined
|
|
283
|
+
? { deploymentId: config.activity.deploymentId }
|
|
284
|
+
: {}),
|
|
246
285
|
}
|
|
247
|
-
:
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
? { persistToolCatalog: config.discovery.persistCatalog }
|
|
253
|
-
: {}),
|
|
254
|
-
...(config.discovery?.staleCatalogSeconds !== undefined
|
|
255
|
-
? { toolCatalogStaleSeconds: config.discovery.staleCatalogSeconds }
|
|
256
|
-
: {}),
|
|
257
|
-
...(config.calls?.maxResultBytes !== undefined
|
|
258
|
-
? { maxResultBytes: config.calls.maxResultBytes }
|
|
259
|
-
: {}),
|
|
286
|
+
: undefined,
|
|
287
|
+
toolCacheTtlSeconds: config.discovery?.catalogTtlSeconds,
|
|
288
|
+
persistToolCatalog: config.discovery?.persistCatalog,
|
|
289
|
+
toolCatalogStaleSeconds: config.discovery?.staleCatalogSeconds,
|
|
290
|
+
maxResultBytes: config.calls?.maxResultBytes,
|
|
260
291
|
});
|
|
261
292
|
const inboundAuth = normalizeAuth(accessTokens ? [accessTokens.auth, ...configuredAuth] : configuredAuth);
|
|
262
293
|
warnInsecureConfig(config, inboundAuth, logger);
|
|
@@ -279,44 +310,24 @@ export function createConnecta(config) {
|
|
|
279
310
|
const handler = createFetchHandler({
|
|
280
311
|
registry,
|
|
281
312
|
auth: inboundAuth,
|
|
282
|
-
|
|
313
|
+
publicUrl: config.publicUrl,
|
|
283
314
|
serverInfo,
|
|
284
315
|
logger,
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
...(config.activity?.readGate !== undefined
|
|
289
|
-
? { activityReadGate: config.activity.readGate }
|
|
290
|
-
: {}),
|
|
291
|
-
...(config.activity?.deploymentId !== undefined
|
|
292
|
-
? { activityDeploymentId: config.activity.deploymentId }
|
|
293
|
-
: {}),
|
|
316
|
+
activity: config.activity?.store,
|
|
317
|
+
activityReadGate: config.activity?.readGate,
|
|
318
|
+
activityDeploymentId: config.activity?.deploymentId,
|
|
294
319
|
executor,
|
|
295
|
-
|
|
296
|
-
? { executorName: configuredExecutorName }
|
|
297
|
-
: {}),
|
|
320
|
+
executorName: configuredExecutorName,
|
|
298
321
|
requestAdmission,
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
...(config.execute?.maxEmittedBytes !== undefined
|
|
309
|
-
? { maxEmittedBytes: config.execute.maxEmittedBytes }
|
|
310
|
-
: {}),
|
|
311
|
-
...(config.execute?.maxEmittedBlocks !== undefined
|
|
312
|
-
? { maxEmittedBlocks: config.execute.maxEmittedBlocks }
|
|
313
|
-
: {}),
|
|
314
|
-
...(credentialVault !== undefined ? { credentialVault } : {}),
|
|
315
|
-
...(accessTokens !== undefined ? { accessTokens } : {}),
|
|
316
|
-
...(config.deploymentInfo !== undefined
|
|
317
|
-
? { deploymentInfo: config.deploymentInfo }
|
|
318
|
-
: {}),
|
|
319
|
-
...(config.branding !== undefined ? { branding: config.branding } : {}),
|
|
322
|
+
defaultToolTimeoutMs: config.calls?.defaultTimeoutMs,
|
|
323
|
+
probeTimeoutMs: config.discovery?.probeTimeoutMs,
|
|
324
|
+
discoveryConcurrency: config.discovery?.concurrency,
|
|
325
|
+
maxEmittedBytes: config.execute?.maxEmittedBytes,
|
|
326
|
+
maxEmittedBlocks: config.execute?.maxEmittedBlocks,
|
|
327
|
+
credentialVault,
|
|
328
|
+
accessTokens,
|
|
329
|
+
deploymentInfo: config.deploymentInfo,
|
|
330
|
+
branding: config.branding,
|
|
320
331
|
});
|
|
321
332
|
let closePromise;
|
|
322
333
|
return {
|
package/dist/invocation.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface InvocationContext<T> {
|
|
|
57
57
|
requestSignal?: AbortSignal;
|
|
58
58
|
unwrapResult?: boolean;
|
|
59
59
|
/**
|
|
60
|
-
* Caller-owned result policy. MCP
|
|
60
|
+
* Caller-owned result policy. MCP applies result paging here; code mode
|
|
61
61
|
* normally accepts the already-unwrapped value unchanged.
|
|
62
62
|
*/
|
|
63
63
|
processResult?: (value: unknown, resolved: ResolvedCatalogTool) => T | Promise<T>;
|