@zackbart/connecta 0.10.6 → 0.11.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 +8 -6
- package/CHANGELOG.md +40 -0
- package/README.md +5 -4
- package/bin/connecta.mjs +0 -7
- package/dist/activity.d.ts.map +1 -1
- package/dist/activity.js.map +1 -1
- package/dist/catalog-service.d.ts +2 -17
- package/dist/catalog-service.d.ts.map +1 -1
- package/dist/catalog-service.js +4 -6
- package/dist/catalog-service.js.map +1 -1
- package/dist/connectors/api.d.ts +2 -2
- package/dist/connectors/remote-mcp.d.ts +1 -1
- package/dist/errors.d.ts +1 -3
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/execute.d.ts +1 -3
- package/dist/execute.d.ts.map +1 -1
- package/dist/execute.js +7 -28
- package/dist/execute.js.map +1 -1
- package/dist/index.d.ts +15 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -37
- package/dist/index.js.map +1 -1
- package/dist/invocation.js +2 -2
- package/dist/invocation.js.map +1 -1
- package/dist/meta-tools.d.ts +19 -58
- package/dist/meta-tools.d.ts.map +1 -1
- package/dist/meta-tools.js +34 -431
- package/dist/meta-tools.js.map +1 -1
- package/dist/registry.d.ts +1 -10
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +3 -15
- package/dist/registry.js.map +1 -1
- package/dist/routes/mcp.d.ts.map +1 -1
- package/dist/routes/mcp.js +19 -30
- package/dist/routes/mcp.js.map +1 -1
- package/dist/routes/shared.d.ts +5 -11
- package/dist/routes/shared.d.ts.map +1 -1
- package/dist/routes/shared.js.map +1 -1
- package/dist/server.js +5 -4
- package/dist/server.js.map +1 -1
- package/dist/skills.d.ts +8 -18
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +13 -60
- package/dist/skills.js.map +1 -1
- package/dist/types.d.ts +6 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/documentation/code-first-exploration.md +16 -16
- package/documentation/code-mode.md +21 -35
- package/documentation/connectors.md +1 -1
- package/documentation/meta-tools.md +30 -43
- package/documentation/rich-output-design.md +4 -4
- package/examples/node/README.md +1 -2
- package/examples/node/src/index.ts +1 -3
- package/examples/worker/README.md +8 -13
- package/examples/worker/src/index.ts +6 -14
- package/examples/worker/wrangler.jsonc +3 -6
- package/package.json +1 -1
- package/src/activity.ts +5 -0
- package/src/catalog-service.ts +6 -26
- package/src/connectors/api.ts +2 -2
- package/src/connectors/remote-mcp.ts +1 -1
- package/src/errors.ts +2 -2
- package/src/execute.ts +7 -36
- package/src/index.ts +40 -69
- package/src/invocation.ts +2 -2
- package/src/meta-tools.ts +38 -565
- package/src/registry.ts +2 -33
- package/src/routes/mcp.ts +19 -30
- package/src/routes/shared.ts +4 -11
- package/src/server.ts +7 -7
- package/src/skills.ts +11 -74
- package/src/types.ts +6 -21
- package/src/version.ts +1 -1
- package/templates/node/README.md +2 -1
- package/templates/node/package.json +1 -1
- package/templates/node/src/index.ts +1 -1
package/src/index.ts
CHANGED
|
@@ -18,7 +18,6 @@ import type { ActivityReadGate, ActivityStore } from "./activity.js";
|
|
|
18
18
|
import type {
|
|
19
19
|
Connector,
|
|
20
20
|
ConnectaBranding,
|
|
21
|
-
ConnectaSurface,
|
|
22
21
|
Executor,
|
|
23
22
|
InboundAuth,
|
|
24
23
|
KVStorage,
|
|
@@ -77,10 +76,11 @@ export interface ConnectaDiscoveryConfig {
|
|
|
77
76
|
staleCatalogSeconds?: number;
|
|
78
77
|
/**
|
|
79
78
|
* Deadline (ms) for each downstream probe/catalog call fanned out by
|
|
80
|
-
* `
|
|
81
|
-
* 30_000. A timed-out connector degrades
|
|
82
|
-
* to tool calls. Catalog walks receive the
|
|
83
|
-
* aborts an in-flight page where supported and
|
|
79
|
+
* `search_tools` and by `connecta.search`/`connecta.describe` inside
|
|
80
|
+
* `execute_code`. Defaults to 30_000. A timed-out connector degrades
|
|
81
|
+
* independently; this does not apply to tool calls. Catalog walks receive the
|
|
82
|
+
* same cancellation signal, which aborts an in-flight page where supported and
|
|
83
|
+
* prevents another from starting.
|
|
84
84
|
*/
|
|
85
85
|
probeTimeoutMs?: number;
|
|
86
86
|
}
|
|
@@ -88,9 +88,9 @@ export interface ConnectaDiscoveryConfig {
|
|
|
88
88
|
/** Deployment-wide call deadlines and inline-result paging thresholds. */
|
|
89
89
|
export interface ConnectaCallsConfig {
|
|
90
90
|
/**
|
|
91
|
-
* Deadline (ms) for `call_tool`/`
|
|
92
|
-
* An explicit per-call value wins. Opt-in: unset by default, so
|
|
93
|
-
* long-running calls gain no surprise deadline.
|
|
91
|
+
* Deadline (ms) for `call_tool`/`call_destructive_tool` calls that pass no
|
|
92
|
+
* `timeoutMs`. An explicit per-call value wins. Opt-in: unset by default, so
|
|
93
|
+
* existing long-running calls gain no surprise deadline.
|
|
94
94
|
*
|
|
95
95
|
* This bounds one attempt, not all retries. `execute_code` host calls are
|
|
96
96
|
* unaffected because they already carry their own bound.
|
|
@@ -102,13 +102,6 @@ export interface ConnectaCallsConfig {
|
|
|
102
102
|
* 50_000. Connectors may override it individually.
|
|
103
103
|
*/
|
|
104
104
|
maxResultBytes?: number;
|
|
105
|
-
/**
|
|
106
|
-
* Max serialized `batch_call` envelope size (bytes) before the full batch is
|
|
107
|
-
* stashed for `get_result` and only an ordered outcome summary is returned
|
|
108
|
-
* inline. Must be a finite whole number >= 1; invalid values warn and fall
|
|
109
|
-
* back to 100_000. This cap is independent of per-connector child caps.
|
|
110
|
-
*/
|
|
111
|
-
maxBatchResultBytes?: number;
|
|
112
105
|
}
|
|
113
106
|
|
|
114
107
|
/** Budgets for rich output emitted by execute_code programs (`connecta.emit`). */
|
|
@@ -197,22 +190,12 @@ export interface ConnectaConfig {
|
|
|
197
190
|
/** Deployment metadata exposed by /health (for example a Worker version). */
|
|
198
191
|
deploymentInfo?: Record<string, unknown>;
|
|
199
192
|
/**
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* "@zackbart/connecta/quickjs".
|
|
193
|
+
* Required sandbox for `execute_code`. Workers use
|
|
194
|
+
* `new DynamicWorkerExecutor({ loader: env.LOADER })` from
|
|
195
|
+
* `@cloudflare/codemode`; Node uses `quickJsExecutor()` from
|
|
196
|
+
* `@zackbart/connecta/quickjs`.
|
|
205
197
|
*/
|
|
206
|
-
executor
|
|
207
|
-
/**
|
|
208
|
-
* Override the surface the `executor` implies. The only reason to set it is
|
|
209
|
-
* `"classic"` alongside an executor — ten tools, the shape the eval gate's
|
|
210
|
-
* *incremental* arm measures ("does adding `execute_code` to classic help on
|
|
211
|
-
* its own?"). The gate's control arm is executor-free classic, which needs no
|
|
212
|
-
* override. `"code-first"` is the default wherever an executor exists and
|
|
213
|
-
* throws without one.
|
|
214
|
-
*/
|
|
215
|
-
surface?: ConnectaSurface;
|
|
198
|
+
executor: Executor;
|
|
216
199
|
}
|
|
217
200
|
|
|
218
201
|
export interface Connecta {
|
|
@@ -306,6 +289,20 @@ function assertNoLegacyConfig(config: ConnectaConfig): void {
|
|
|
306
289
|
"issue #179. Credentials now fail at use; see ethos.md.",
|
|
307
290
|
);
|
|
308
291
|
}
|
|
292
|
+
const calls = candidate.calls;
|
|
293
|
+
if (
|
|
294
|
+
typeof calls === "object" &&
|
|
295
|
+
calls !== null &&
|
|
296
|
+
hasOwn(calls, "maxBatchResultBytes")
|
|
297
|
+
) {
|
|
298
|
+
throw new Error(
|
|
299
|
+
"`calls.maxBatchResultBytes` was removed in issue #273 along with " +
|
|
300
|
+
"batch_call. Remove it; a program's batching is bounded by " +
|
|
301
|
+
"execute_code's own limits — connecta.batch's per-run call ceiling " +
|
|
302
|
+
"and the executor result cap — while each call inside it still honours " +
|
|
303
|
+
"calls.maxResultBytes and any per-connector override.",
|
|
304
|
+
);
|
|
305
|
+
}
|
|
309
306
|
const found: Array<readonly [string, string]> = [];
|
|
310
307
|
if (hasOwn(candidate, "activity")) {
|
|
311
308
|
const activity = candidate.activity;
|
|
@@ -444,43 +441,22 @@ function warnInsecureConfig(
|
|
|
444
441
|
}
|
|
445
442
|
}
|
|
446
443
|
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
* program to fold discovery and batching into, so it serves classic.
|
|
451
|
-
*
|
|
452
|
-
* Two mistakes are structural rather than recoverable, so neither is warned
|
|
453
|
-
* past: a surface name connecta does not implement, which would otherwise
|
|
454
|
-
* resolve to something the operator did not ask for; and `code-first` without
|
|
455
|
-
* an executor, which would advertise six tools and no program surface.
|
|
456
|
-
*/
|
|
457
|
-
function resolveSurface(config: ConnectaConfig): ConnectaSurface {
|
|
458
|
-
const surface = config.surface;
|
|
459
|
-
if (surface === undefined) {
|
|
460
|
-
return config.executor ? "code-first" : "classic";
|
|
461
|
-
}
|
|
462
|
-
if (surface !== "classic" && surface !== "code-first") {
|
|
444
|
+
export function createConnecta(config: ConnectaConfig): Connecta {
|
|
445
|
+
assertNoLegacyConfig(config);
|
|
446
|
+
if (Object.prototype.hasOwnProperty.call(config, "surface")) {
|
|
463
447
|
throw new Error(
|
|
464
|
-
|
|
465
|
-
|
|
448
|
+
"ConnectaConfig.surface was removed in issue #273. Remove it; connecta " +
|
|
449
|
+
"now serves one seven-tool surface.",
|
|
466
450
|
);
|
|
467
451
|
}
|
|
468
|
-
if (
|
|
452
|
+
if (!config.executor) {
|
|
469
453
|
throw new Error(
|
|
470
|
-
|
|
471
|
-
"
|
|
472
|
-
"
|
|
473
|
-
"
|
|
474
|
-
"one (quickJsExecutor() from \"@zackbart/connecta/quickjs\" on Node, " +
|
|
475
|
-
"new DynamicWorkerExecutor({ loader: env.LOADER }) on Workers).",
|
|
454
|
+
"ConnectaConfig.executor is required. Configure quickJsExecutor() from " +
|
|
455
|
+
'"@zackbart/connecta/quickjs" on Node, or ' +
|
|
456
|
+
"new DynamicWorkerExecutor({ loader: env.LOADER }) from " +
|
|
457
|
+
'"@cloudflare/codemode" on Workers.',
|
|
476
458
|
);
|
|
477
459
|
}
|
|
478
|
-
return surface;
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
export function createConnecta(config: ConnectaConfig): Connecta {
|
|
482
|
-
assertNoLegacyConfig(config);
|
|
483
|
-
const surface = resolveSurface(config);
|
|
484
460
|
const storage = config.storage ?? memoryStorage();
|
|
485
461
|
const logger = config.logger ?? defaultLogger();
|
|
486
462
|
const credentialConnectors = config.connectors.filter((c) => c.credential);
|
|
@@ -524,9 +500,6 @@ export function createConnecta(config: ConnectaConfig): Connecta {
|
|
|
524
500
|
...(config.calls?.maxResultBytes !== undefined
|
|
525
501
|
? { maxResultBytes: config.calls.maxResultBytes }
|
|
526
502
|
: {}),
|
|
527
|
-
...(config.calls?.maxBatchResultBytes !== undefined
|
|
528
|
-
? { maxBatchResultBytes: config.calls.maxBatchResultBytes }
|
|
529
|
-
: {}),
|
|
530
503
|
});
|
|
531
504
|
const inboundAuth = normalizeAuth(
|
|
532
505
|
accessTokens ? [accessTokens.auth, ...configuredAuth] : configuredAuth,
|
|
@@ -542,10 +515,10 @@ export function createConnecta(config: ConnectaConfig): Connecta {
|
|
|
542
515
|
);
|
|
543
516
|
let codeAdmission: AdmissionController | undefined;
|
|
544
517
|
let executor = config.executor;
|
|
545
|
-
if (
|
|
518
|
+
if (!isAdmittingExecutor(executor)) {
|
|
546
519
|
codeAdmission = configuredCodeAdmission;
|
|
547
520
|
executor = withExecutorAdmission(executor, codeAdmission);
|
|
548
|
-
} else if (
|
|
521
|
+
} else if (config.admission?.code) {
|
|
549
522
|
logger.warn(
|
|
550
523
|
"[connecta] admission.code is ignored because the configured executor " +
|
|
551
524
|
"implements acquire() and owns its admission pool; configure that " +
|
|
@@ -571,8 +544,7 @@ export function createConnecta(config: ConnectaConfig): Connecta {
|
|
|
571
544
|
...(config.activity?.deploymentId !== undefined
|
|
572
545
|
? { activityDeploymentId: config.activity.deploymentId }
|
|
573
546
|
: {}),
|
|
574
|
-
|
|
575
|
-
surface,
|
|
547
|
+
executor,
|
|
576
548
|
requestAdmission,
|
|
577
549
|
...(config.calls?.defaultTimeoutMs !== undefined
|
|
578
550
|
? { defaultToolTimeoutMs: config.calls.defaultTimeoutMs }
|
|
@@ -653,7 +625,6 @@ export type {
|
|
|
653
625
|
ConnectorCallAdmissionRule,
|
|
654
626
|
ConnectorRollingWindowBudget,
|
|
655
627
|
ConnectaBranding,
|
|
656
|
-
ConnectaSurface,
|
|
657
628
|
ConnectorCredentialAccess,
|
|
658
629
|
ConnectorCredentialConfig,
|
|
659
630
|
ConnectorCredentialFieldConfig,
|
package/src/invocation.ts
CHANGED
|
@@ -395,8 +395,8 @@ export class InvocationService {
|
|
|
395
395
|
// A connector whose catalog cannot be fetched is as unusable as one
|
|
396
396
|
// whose execution fails, so it feeds health accounting the same way the
|
|
397
397
|
// attempt catch below does — otherwise a connector every call fails
|
|
398
|
-
// against (a revoked downstream grant, say) still reads clean
|
|
399
|
-
//
|
|
398
|
+
// against (a revoked downstream grant, say) still reads clean in the
|
|
399
|
+
// deployment's health log.
|
|
400
400
|
//
|
|
401
401
|
// Recorded HERE rather than inside the registry's catalog fetch because
|
|
402
402
|
// a cache hit that avoids a live listTools call records nothing — it is
|