@zackbart/connecta 0.27.0 → 0.28.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 +6 -6
- package/CHANGELOG.md +56 -0
- package/README.md +15 -19
- package/bin/connecta.mjs +1 -5
- package/dist/activity.d.ts +5 -4
- package/dist/activity.js +1 -10
- package/dist/artifacts/json.js +10 -0
- package/dist/artifacts/operations.js +1 -1
- package/dist/artifacts/validate.js +1 -2
- package/dist/catalog-service.js +1 -1
- package/dist/execute.js +92 -368
- package/dist/executors/quickjs.js +1 -1
- package/dist/exempt-writes.js +162 -0
- package/dist/index.d.ts +12 -31
- package/dist/index.js +14 -47
- package/dist/invocation.js +6 -19
- package/dist/meta-tools.js +1 -2
- package/dist/operator-ui/generated.js +1 -1
- package/dist/operator-ui/model.d.ts +3 -3
- package/dist/operator-ui/view.js +6 -4
- package/dist/routes/mcp.js +5 -21
- package/dist/routes/shared.d.ts +1 -6
- package/dist/server.js +0 -4
- package/dist/skills.js +8 -23
- package/dist/tool-safety.d.ts +1 -1
- package/dist/tool-safety.js +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/documentation/architecture.md +10 -14
- package/documentation/code-mode.md +91 -194
- package/documentation/meta-tools.md +38 -41
- package/ethos.md +6 -7
- package/examples/worker/README.md +10 -14
- package/examples/worker/src/d1-activity-row.ts +4 -1
- package/examples/worker/src/index.ts +1 -9
- package/package.json +2 -2
- package/templates/node/AGENTS.md +4 -3
- package/templates/node/README.md +3 -4
- package/templates/node/package.json +1 -1
- package/dist/resumable.js +0 -1323
- package/dist/run-journal.js +0 -347
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A deployable Worker that aggregates a downstream remote MCP and an in-code HTTP
|
|
4
4
|
API connector, guarded by Cloudflare Access, with state in a KV namespace. Its
|
|
5
|
-
required Worker Loader binding backs the
|
|
5
|
+
required Worker Loader binding backs the seven-tool surface and requires the
|
|
6
6
|
Workers Paid plan.
|
|
7
7
|
|
|
8
8
|
This is also the **starting template for a deployment**: a real deployment
|
|
@@ -296,7 +296,7 @@ below. Omit the module and store wiring to record no history and show no
|
|
|
296
296
|
Activity tab. Diagnostics remain independent; `logger: "silent"` suppresses
|
|
297
297
|
them explicitly.
|
|
298
298
|
|
|
299
|
-
Verify MCP health and the exact
|
|
299
|
+
Verify MCP health and the exact seven tools with:
|
|
300
300
|
|
|
301
301
|
```sh
|
|
302
302
|
CF_ACCESS_CLIENT_ID=… CF_ACCESS_CLIENT_SECRET=… \
|
|
@@ -321,7 +321,7 @@ The required Worker Loader binding is checked into `wrangler.jsonc`:
|
|
|
321
321
|
```
|
|
322
322
|
|
|
323
323
|
`src/index.ts` constructs `DynamicWorkerExecutor` with only `env.LOADER` and
|
|
324
|
-
serves the
|
|
324
|
+
serves the seven-tool surface. Do not add `bindings`, `modules`, or
|
|
325
325
|
`globalOutbound`; they grant guest code ambient authority. A copied deployment
|
|
326
326
|
owns the package install — see
|
|
327
327
|
[copied into its own repository](#copied-into-its-own-repository).
|
|
@@ -329,11 +329,9 @@ owns the package install — see
|
|
|
329
329
|
## Strongly consistent storage (optional)
|
|
330
330
|
|
|
331
331
|
`KVStorage` has an optional atomic `compareAndSet`, for a subsystem that must
|
|
332
|
-
claim a key exactly once
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
(`execute: { resumableWrites: false }` in `src/index.ts`) and its programs
|
|
336
|
-
refuse writes. It is eventually
|
|
332
|
+
claim a key exactly once: artifacts commit every write by it, issuing access
|
|
333
|
+
tokens requires it, and an OAuth handoff binds its owner with it when it is
|
|
334
|
+
there. **Workers KV cannot provide it.** It is eventually
|
|
337
335
|
consistent: two locations can each read a key as absent and both write, so
|
|
338
336
|
`cloudflare-kv.ts` declares no `compareAndSet` rather than fake one with a read
|
|
339
337
|
followed by a write. `src/d1-storage.ts` is a complete `KVStorage` over D1
|
|
@@ -370,10 +368,6 @@ of connecta state lives in one store.
|
|
|
370
368
|
const storage = d1Storage(env.STORAGE_DB);
|
|
371
369
|
```
|
|
372
370
|
|
|
373
|
-
Then delete the `execute: { resumableWrites: false }` line: on D1,
|
|
374
|
-
resumable writes default on, and programs pause at a write until
|
|
375
|
-
`resume_execution` approves it.
|
|
376
|
-
|
|
377
371
|
Switching an existing deployment starts from empty state: downstream OAuth
|
|
378
372
|
connections must be re-authorized and vault credentials re-entered, because
|
|
379
373
|
nothing copies them out of the KV namespace.
|
|
@@ -478,8 +472,10 @@ To enable it:
|
|
|
478
472
|
ALTER TABLE tool_call_activity ADD COLUMN approval TEXT;
|
|
479
473
|
```
|
|
480
474
|
|
|
481
|
-
`approval` is set only on an `approved` row
|
|
482
|
-
|
|
475
|
+
`approval` is history: it is set only on an `approved` row written before
|
|
476
|
+
0.28.0 removed program pauses — the scope a resumed program's approval
|
|
477
|
+
covered, `call` or `tool` — and is null on every row since. Keep the
|
|
478
|
+
column; the Activity tab still renders those older rows.
|
|
483
479
|
|
|
484
480
|
`friction` is stored rather than derived because one of its classes belongs
|
|
485
481
|
to a call that *succeeded*: a result too large to return inline is friction
|
|
@@ -19,12 +19,14 @@ export interface ActivityEvent {
|
|
|
19
19
|
| "call_destructive_tool"
|
|
20
20
|
| "batch_call"
|
|
21
21
|
| "execute_code"
|
|
22
|
+
// History only: rows written before 0.28.0 removed program pauses.
|
|
22
23
|
| "resume_execution";
|
|
23
24
|
outcome:
|
|
24
25
|
| "success"
|
|
25
26
|
| "error"
|
|
26
27
|
| "timeout"
|
|
27
28
|
| "cancelled"
|
|
29
|
+
// History only, like `resume_execution` above.
|
|
28
30
|
| "paused"
|
|
29
31
|
| "approved";
|
|
30
32
|
durationMs: number;
|
|
@@ -36,6 +38,7 @@ export interface ActivityEvent {
|
|
|
36
38
|
| "destructive_reroute"
|
|
37
39
|
| "auth_required"
|
|
38
40
|
| "result_too_large";
|
|
41
|
+
/** History only: the scope an `approved` row covered, before 0.28.0. */
|
|
39
42
|
approval?: "call" | "tool";
|
|
40
43
|
serverName: string;
|
|
41
44
|
serverVersion: string;
|
|
@@ -84,7 +87,7 @@ export interface ActivityRow {
|
|
|
84
87
|
attempts: number;
|
|
85
88
|
error_code: string | null;
|
|
86
89
|
friction: ActivityEvent["friction"] | null;
|
|
87
|
-
/** Absent from tables created before
|
|
90
|
+
/** Absent from tables created before 0.26.0; null on every row since 0.28.0. */
|
|
88
91
|
approval?: ActivityEvent["approval"] | null;
|
|
89
92
|
server_name: string;
|
|
90
93
|
server_version: string;
|
|
@@ -8,7 +8,7 @@ import { encryptedCredentialVault } from "@zackbart/connecta/credentials";
|
|
|
8
8
|
* by Cloudflare Access, with OAuth/cache state in a KV namespace. Access
|
|
9
9
|
* authenticates the request before this Worker runs and supplies the trusted
|
|
10
10
|
* identity through ctx.access. The required Worker Loader binding in
|
|
11
|
-
* wrangler.jsonc backs the
|
|
11
|
+
* wrangler.jsonc backs the seven-tool surface.
|
|
12
12
|
*
|
|
13
13
|
* The operator surface is wired here except for activity history, which needs
|
|
14
14
|
* a database this example does not create for you: sign-in and the credential
|
|
@@ -76,14 +76,6 @@ function build(env: Env) {
|
|
|
76
76
|
publicUrl: env.PUBLIC_URL,
|
|
77
77
|
storage,
|
|
78
78
|
executor: new DynamicWorkerExecutor({ loader: env.LOADER }),
|
|
79
|
-
// Resumable writes — a program pausing at a write until resume_execution
|
|
80
|
-
// approves it — need storage with an atomic compareAndSet, and Workers KV
|
|
81
|
-
// cannot provide one. On KV they are off: programs refuse writes and
|
|
82
|
-
// resume_execution says there is nothing to resume. This line states that
|
|
83
|
-
// choice (without it connecta would warn once at startup). To let programs
|
|
84
|
-
// pause, switch to the D1 store in README.md § "Strongly consistent
|
|
85
|
-
// storage" and delete this line.
|
|
86
|
-
execute: { resumableWrites: false },
|
|
87
79
|
auth: [
|
|
88
80
|
// Access owns admission policy. A human identity may use MCP and the
|
|
89
81
|
// operator pages; a service token may use MCP but cannot mutate operator
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zackbart/connecta",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
|
-
"description": "One MCP to rule them all — a single MCP endpoint aggregating many downstream connectors behind a code-first surface of
|
|
6
|
+
"description": "One MCP to rule them all — a single MCP endpoint aggregating many downstream connectors behind a code-first surface of seven meta-tools.",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"engines": {
|
|
9
9
|
"node": ">=22.0.0"
|
package/templates/node/AGENTS.md
CHANGED
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
This repository is deployment configuration, not a copy of Connecta itself.
|
|
4
4
|
|
|
5
5
|
- Edit `src/index.ts` for connectors, authentication, storage, and public URL.
|
|
6
|
-
- Keep `executor: quickJsExecutor()` for the prescribed
|
|
7
|
-
surface.
|
|
8
|
-
write
|
|
6
|
+
- Keep `executor: quickJsExecutor()` for the prescribed seven-tool code-first
|
|
7
|
+
surface. Programs run read-only tools and any writes `execute.approval`
|
|
8
|
+
exempts; every other write is its own `call_destructive_tool` call, which
|
|
9
|
+
the MCP host asks about.
|
|
9
10
|
- Keep credentials in environment variables or an external secret store.
|
|
10
11
|
Never commit `.env`, `.connecta-state.json`, `.connecta-activity.jsonl`,
|
|
11
12
|
tokens, or credential values.
|
package/templates/node/README.md
CHANGED
|
@@ -159,17 +159,16 @@ npm run typecheck
|
|
|
159
159
|
CONNECTA_TOKEN=dev-token npm run doctor
|
|
160
160
|
```
|
|
161
161
|
|
|
162
|
-
Doctor checks health, the executor, and the exact prescribed
|
|
162
|
+
Doctor checks health, the executor, and the exact prescribed seven-tool
|
|
163
163
|
model-facing surface by running a harmless sandbox program. It reads the bearer
|
|
164
164
|
from `CONNECTA_TOKEN`; it never accepts the secret as a command-line argument.
|
|
165
165
|
Remote URLs must use HTTPS.
|
|
166
166
|
|
|
167
167
|
A fully-wired deployment reports exactly the same line as a bare one —
|
|
168
|
-
connector count, QuickJS executed,
|
|
169
|
-
a note if resumable writes are off:
|
|
168
|
+
connector count, QuickJS executed, seven tools, plus any catalog drift:
|
|
170
169
|
|
|
171
170
|
```text
|
|
172
|
-
Connecta doctor passed: 1 connector(s), QuickJS executed, prescribed
|
|
171
|
+
Connecta doctor passed: 1 connector(s), QuickJS executed, prescribed seven-tool surface.
|
|
173
172
|
```
|
|
174
173
|
|
|
175
174
|
`QuickJS` is this deployment's sandbox, reported by the deployment itself —
|