@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.
Files changed (42) hide show
  1. package/AGENTS.md +6 -6
  2. package/CHANGELOG.md +56 -0
  3. package/README.md +15 -19
  4. package/bin/connecta.mjs +1 -5
  5. package/dist/activity.d.ts +5 -4
  6. package/dist/activity.js +1 -10
  7. package/dist/artifacts/json.js +10 -0
  8. package/dist/artifacts/operations.js +1 -1
  9. package/dist/artifacts/validate.js +1 -2
  10. package/dist/catalog-service.js +1 -1
  11. package/dist/execute.js +92 -368
  12. package/dist/executors/quickjs.js +1 -1
  13. package/dist/exempt-writes.js +162 -0
  14. package/dist/index.d.ts +12 -31
  15. package/dist/index.js +14 -47
  16. package/dist/invocation.js +6 -19
  17. package/dist/meta-tools.js +1 -2
  18. package/dist/operator-ui/generated.js +1 -1
  19. package/dist/operator-ui/model.d.ts +3 -3
  20. package/dist/operator-ui/view.js +6 -4
  21. package/dist/routes/mcp.js +5 -21
  22. package/dist/routes/shared.d.ts +1 -6
  23. package/dist/server.js +0 -4
  24. package/dist/skills.js +8 -23
  25. package/dist/tool-safety.d.ts +1 -1
  26. package/dist/tool-safety.js +1 -1
  27. package/dist/types.d.ts +2 -2
  28. package/dist/version.d.ts +1 -1
  29. package/dist/version.js +1 -1
  30. package/documentation/architecture.md +10 -14
  31. package/documentation/code-mode.md +91 -194
  32. package/documentation/meta-tools.md +38 -41
  33. package/ethos.md +6 -7
  34. package/examples/worker/README.md +10 -14
  35. package/examples/worker/src/d1-activity-row.ts +4 -1
  36. package/examples/worker/src/index.ts +1 -9
  37. package/package.json +2 -2
  38. package/templates/node/AGENTS.md +4 -3
  39. package/templates/node/README.md +3 -4
  40. package/templates/node/package.json +1 -1
  41. package/dist/resumable.js +0 -1323
  42. 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 eight-tool surface and requires 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 eight tools with:
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 eight-tool surface. Do not add `bindings`, `modules`, or
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 — resumable writes, where two `resume_execution` calls
333
- racing for one paused program must send its writes once. **Workers KV cannot
334
- provide it**, so on KV this example turns resumable writes off
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 — the scope a resumed
482
- program's approval covered, `call` or `tool` — and is otherwise null.
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 resumable writes; read as null. */
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 eight-tool surface.
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.27.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 eight meta-tools.",
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"
@@ -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 eight-tool code-first
7
- surface. File storage supports resumable writes, so a program pauses at a
8
- write until `resume_execution` approves it.
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.
@@ -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 eight-tool
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, eight tools, plus any catalog drift, and
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 eight-tool surface.
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 —
@@ -15,7 +15,7 @@
15
15
  "typecheck": "tsc --noEmit"
16
16
  },
17
17
  "dependencies": {
18
- "@zackbart/connecta": "0.27.0",
18
+ "@zackbart/connecta": "0.28.0",
19
19
  "quickjs-emscripten": "0.32.0"
20
20
  },
21
21
  "devDependencies": {