@zackbart/connecta 0.41.0 → 0.42.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 (148) hide show
  1. package/CHANGELOG.md +61 -0
  2. package/bin/connecta.mjs +26 -17
  3. package/bin/meta-tool-names.d.mts +3 -1
  4. package/bin/meta-tool-names.mjs +4 -1
  5. package/bin/version.mjs +1 -1
  6. package/dist/activity.d.ts +2 -1
  7. package/dist/activity.js +5 -5
  8. package/dist/advertised-schema.js +15 -0
  9. package/dist/agent-routes.js +31 -5
  10. package/dist/auth/downstream-oauth/refresh-coordinator.js +4 -1
  11. package/dist/auth/downstream-oauth.js +3 -0
  12. package/dist/auth/static-oauth.js +26 -18
  13. package/dist/auth-elicitation.js +118 -61
  14. package/dist/authorization-handoff.js +36 -3
  15. package/dist/catalog-cache.js +292 -24
  16. package/dist/catalog-freshness.js +12 -0
  17. package/dist/catalog-service.js +373 -70
  18. package/dist/catalog.js +147 -58
  19. package/dist/config-defaults.d.ts +2 -1
  20. package/dist/config-defaults.js +4 -1
  21. package/dist/config.d.ts +43 -17
  22. package/dist/config.js +26 -10
  23. package/dist/connectors/remote-mcp/catalog.js +52 -28
  24. package/dist/connectors/remote-mcp/connection.js +62 -5
  25. package/dist/connectors/remote-mcp.js +10 -1
  26. package/dist/describe-config.d.ts +3 -2
  27. package/dist/discovery-health.js +26 -11
  28. package/dist/errors.d.ts +52 -3
  29. package/dist/errors.js +86 -3
  30. package/dist/execute.js +476 -200
  31. package/dist/executor-admission.js +2 -0
  32. package/dist/executor-contract.js +6 -0
  33. package/dist/executor-result.js +2 -2
  34. package/dist/executors/quickjs-child.js +13 -4
  35. package/dist/executors/quickjs-runtime.d.ts +2 -0
  36. package/dist/executors/quickjs-runtime.js +36 -19
  37. package/dist/executors/quickjs.js +23 -6
  38. package/dist/guest-functions.js +5 -4
  39. package/dist/guest-runtime.js +37 -1
  40. package/dist/guest-types.d.ts +18 -0
  41. package/dist/http/client.js +7 -2
  42. package/dist/http/errors.js +9 -4
  43. package/dist/http/fields.js +17 -5
  44. package/dist/http/hatch.js +9 -3
  45. package/dist/http/paging.js +1 -1
  46. package/dist/http/provider.js +2 -6
  47. package/dist/http/vendor.js +6 -1
  48. package/dist/index.d.ts +1 -1
  49. package/dist/index.js +5 -0
  50. package/dist/invocation.js +98 -34
  51. package/dist/meta-output.js +24 -18
  52. package/dist/meta-tool-names.d.ts +1 -1
  53. package/dist/meta-tool-names.js +1 -1
  54. package/dist/meta-tools.js +259 -60
  55. package/dist/native-recovery.js +4 -1
  56. package/dist/native-tools.js +166 -51
  57. package/dist/node.js +3 -1
  58. package/dist/oauth-handoff.js +53 -43
  59. package/dist/operation-activity.js +2 -1
  60. package/dist/operation-vocabulary.js +6 -0
  61. package/dist/operator-record.d.ts +1 -1
  62. package/dist/operator-record.js +1 -0
  63. package/dist/operator-ui/generated.js +2 -2
  64. package/dist/program-result.js +2 -0
  65. package/dist/program-source.js +1 -1
  66. package/dist/program-writes.js +112 -19
  67. package/dist/provider.d.ts +0 -13
  68. package/dist/provider.js +0 -3
  69. package/dist/providers/_shared/google/kit.js +2 -2
  70. package/dist/providers/breeze/api.js +2 -2
  71. package/dist/providers/breeze/skill.generated.js +1 -1
  72. package/dist/providers/ccb/api.js +2 -2
  73. package/dist/providers/ccb/skill.generated.js +1 -1
  74. package/dist/providers/cloudflare/api.js +2 -2
  75. package/dist/providers/cloudflare/index.js +2 -0
  76. package/dist/providers/cloudflare/skill.generated.js +1 -1
  77. package/dist/providers/docs/skill.generated.js +1 -1
  78. package/dist/providers/drive/skill.generated.js +1 -1
  79. package/dist/providers/forms/index.js +1 -0
  80. package/dist/providers/forms/skill.generated.js +1 -1
  81. package/dist/providers/github/api.js +98 -6
  82. package/dist/providers/github/index.js +7 -2
  83. package/dist/providers/github/lib/auth.d.ts +3 -1
  84. package/dist/providers/github/lib/auth.js +43 -12
  85. package/dist/providers/github/lib/discovery.js +11 -1
  86. package/dist/providers/github/lib/operations.js +8 -0
  87. package/dist/providers/github/safety.js +39 -0
  88. package/dist/providers/github/skill.generated.js +1 -1
  89. package/dist/providers/github/tools.js +12 -5
  90. package/dist/providers/gmail/index.js +1 -0
  91. package/dist/providers/gmail/skill.generated.js +1 -1
  92. package/dist/providers/granola/skill.generated.js +1 -1
  93. package/dist/providers/overflow/index.js +2 -0
  94. package/dist/providers/overflow/skill.generated.js +1 -1
  95. package/dist/providers/planning-center/index.js +11 -5
  96. package/dist/providers/planning-center/lib/constants.d.ts +1 -1
  97. package/dist/providers/planning-center/skill.generated.js +1 -1
  98. package/dist/providers/quickbooks/index.js +2 -5
  99. package/dist/providers/quickbooks/skill.generated.js +1 -1
  100. package/dist/providers/sheets/index.js +1 -0
  101. package/dist/providers/sheets/skill.generated.js +1 -1
  102. package/dist/providers/slides/index.js +2 -2
  103. package/dist/providers/slides/skill.generated.js +1 -1
  104. package/dist/providers/stripe/skill.generated.js +1 -1
  105. package/dist/providers/tithely/index.js +1 -0
  106. package/dist/providers/tithely/skill.generated.js +1 -1
  107. package/dist/providers/vercel/api.js +2 -2
  108. package/dist/providers/vercel/skill.generated.js +1 -1
  109. package/dist/registry.d.ts +36 -4
  110. package/dist/registry.js +127 -27
  111. package/dist/result-preview.js +210 -0
  112. package/dist/result-seal.js +168 -0
  113. package/dist/route-names.js +13 -4
  114. package/dist/routes/connect.js +21 -13
  115. package/dist/routes/mcp.js +55 -26
  116. package/dist/routes/shared.d.ts +6 -0
  117. package/dist/runtime/call.js +15 -10
  118. package/dist/runtime/request-scope.js +36 -1
  119. package/dist/runtime/run.js +4 -1
  120. package/dist/sent-secrets.d.ts +20 -0
  121. package/dist/sent-secrets.js +49 -1
  122. package/dist/skills.js +100 -33
  123. package/dist/storage/keys.js +9 -6
  124. package/dist/storage/sql-native.js +1 -1
  125. package/dist/tool-safety.d.ts +33 -0
  126. package/dist/tool-safety.js +51 -15
  127. package/dist/types.d.ts +31 -0
  128. package/dist/usage-guide.js +14 -13
  129. package/dist/validate.js +29 -10
  130. package/dist/version.d.ts +1 -1
  131. package/dist/version.js +1 -1
  132. package/dist/worker.js +28 -8
  133. package/documentation/architecture.md +104 -42
  134. package/documentation/auth.md +46 -19
  135. package/documentation/code-mode.md +378 -116
  136. package/documentation/deploying.md +10 -9
  137. package/documentation/hosted-mcp-migration.md +9 -3
  138. package/documentation/integrating.md +27 -5
  139. package/documentation/meta-tools.md +655 -153
  140. package/documentation/operating.md +5 -3
  141. package/documentation/providers.md +18 -6
  142. package/examples/worker/README.md +3 -3
  143. package/guides/how-it-works.md +2 -1
  144. package/guides/safety-and-trust.md +1 -3
  145. package/package.json +1 -1
  146. package/templates/node/AGENTS.md +3 -3
  147. package/templates/node/README.md +1 -1
  148. package/templates/node/package.json +1 -1
@@ -12,7 +12,7 @@ Use your host's tool search, call a known operation directly, and follow its
12
12
  repair or authorization handoff. Use `execute_code` for combined work when
13
13
  listed; without code, page results through the listed `read_result` tool.
14
14
 
15
- Meta endpoints expose six top-level tools. Read [the tool table](./meta-tools.md#the-six-tools)
15
+ Meta endpoints expose six top-level tools, plus `execute_read_code` on a writable `/mcp` or `/mcp/<pool>`. Read [the tool table](./meta-tools.md#the-meta-tools)
16
16
  for exact arguments and result envelopes. Follow the endpoint's supplied
17
17
  instructions and `skills` usage guide for deployment-specific context.
18
18
 
@@ -22,7 +22,7 @@ instructions and `skills` usage guide for deployment-specific context.
22
22
  | Discover a tool, chain calls, combine services, or reduce a result | `execute_code` |
23
23
  | One known write on a writable endpoint | `call_destructive_tool` |
24
24
  | Obtain connector instructions | `skills` with the returned guide name |
25
- | Start a required authentication handoff | `authorize_connector`, using the returned recovery action |
25
+ | Start an authentication handoff no error has given you | `authorize_connector`, using the returned recovery action |
26
26
 
27
27
  Whether the endpoint is read-only or writable is part of its tool
28
28
  descriptions. On a writable endpoint, programs and `call_destructive_tool` may
@@ -127,7 +127,9 @@ which URIs may be read. Connector guides and native skills are described in
127
127
 
128
128
  ## Recover without replaying a write
129
129
 
130
- Read typed failures and their `nextAction`. Authorization recovery can point
130
+ Read typed failures and their `nextAction`. An auth error that carries a link
131
+ says so in `nextAction.url`: give that link to the user unchanged and stop, with
132
+ no further call. Authorization recovery can point
131
133
  to consent, operator credential setup, or deployment configuration. Discovery
132
134
  and status do not begin consent on their own. Follow
133
135
  [authorization recovery](./meta-tools.md#authorization-recovery),
@@ -409,9 +409,11 @@ path the current response lacks is never refused, and the selection omits it.
409
409
  `fields` entry matched nothing anywhere in a nonempty response. Each warning
410
410
  names the entry position, the segment where matching stopped and the
411
411
  properties the operation's contract declares there, for example
412
- `fields/1 matched nothing in this response after value safety and privacy
413
- filtering, at segment 2; declared there: id, name.` Where the contract
414
- declares none, such as inside an open map, it says so. A warning never lists
412
+ `fields/1 matched nothing after filtering, at segment 2; declared there: id,
413
+ name.` Filtering means value safety and privacy filtering. The list stops at
414
+ 160 characters with a count of the rest, and a later miss stopping at the same
415
+ place says `same as fields/1`. Where the contract declares none, such as inside
416
+ an open map, it says so. A warning never lists
415
417
  the response's own keys, which in an open map such as `metadata` are data, and
416
418
  never repeats the submitted path. A path that matched in any listed item, a
417
419
  path that runs past a scalar (selection keeps the scalar), and any path of an
@@ -941,10 +943,20 @@ Enable only vendor permissions needed by the workflows: Metadata read for
941
943
  repository lookup; Issues read for issues/comments/labels; Pull requests read
942
944
  for PRs/reviews/review comments/changed files/PR commits; Contents read for
943
945
  repository commits/comparisons/contents/releases; Actions read for workflows,
944
- runs and jobs. Release writes require Contents write. The guarded merge retains
946
+ runs and jobs; Checks read for check runs, suites and annotations; Commit statuses
947
+ read for commit statuses. Release writes require Contents write. The guarded merge retains
945
948
  Contents, Pull requests and Workflows write. Code search retains Contents read
946
949
  and GitHub's own search restrictions. Each operation token is narrowed to its
947
950
  reviewed permission and repository IDs; an org grant does not permit org admin.
951
+ A resource 403 that carries no rate-limit header is `provider_permission_denied`, with
952
+ no credential handoff, naming the repository and the permission the endpoint accepts.
953
+ It establishes the refusal, not its cause: a missing permission is likely, but a policy,
954
+ an unmarked secondary rate limit or a lockout gives the same answer, so its message
955
+ ends with credential checks for when every call is refused. A refused token mint is a
956
+ permission gap only when GitHub's installation record lacks the requested permission;
957
+ otherwise a 422 is a neutral `connector_call_failed` and a 403 stays
958
+ `provider_permission_denied` with its causes open. A 401, an unusable key or a 403 on
959
+ the App's own installation list is `auth_required`.
948
960
 
949
961
  The four github_api tools cover a pinned operation index with a bounded reviewed
950
962
  repository read and release-write allowlist. All other operations are refused.
@@ -963,8 +975,8 @@ File contents retain base64 encoding; the character bound applies after decoding
963
975
  Use `/repos/alice/widget/contents/src/index.ts` for a nested file and
964
976
  `/repos/alice/widget/contents` for the root directory. Contents paths must be
965
977
  canonical relative paths, without dot/empty segments, backslashes or encoded
966
- traversal. Encode branch-name slashes as `%2F` in `commits/{ref}` and
967
- `compare/{basehead}`. Owner-prefixed object refs and cross-repository compares are
978
+ traversal. Encode branch-name slashes as `%2F` in `commits/{ref}`, its check and
979
+ status reads, and `compare/{basehead}`. Owner-prefixed object refs and cross-repository compares are
968
980
  refused before authentication. PR-list head filters require `login:branch`, for
969
981
  example `head:"alice:feature/x"`; they filter the selected repository's PRs.
970
982
  Bare head branches are refused because GitHub silently ignores them. The base
@@ -10,7 +10,7 @@ runnable Worker steps.
10
10
  A deployable Worker that aggregates a downstream remote MCP and an in-code HTTP
11
11
  API connector, guarded by Cloudflare Access. It uses three Cloudflare resources
12
12
  and nothing else: one D1 database (`CONNECTA_DB`) for every piece of state, the
13
- Worker Loader binding (`LOADER`) behind the six-tool surface, which requires
13
+ Worker Loader binding (`LOADER`) behind the meta-tool surface, which requires
14
14
  the Workers Paid plan, and two secrets: `DOWNSTREAM_TOKEN` (the example remote
15
15
  MCP connector's token) and `CREDENTIAL_ENCRYPTION_KEY` (the credential vault).
16
16
 
@@ -493,7 +493,7 @@ from `@zackbart/connecta/d1`. See [Activity history](#activity-history-optional)
493
493
  Omit the module and store wiring to record no history and show no Activity tab. Diagnostics remain independent; `logger: "silent"` suppresses
494
494
  them explicitly.
495
495
 
496
- Verify MCP health and the exact six tools with the following. Doctor reads
496
+ Verify MCP health and the exact tool list with the following. Doctor reads
497
497
  `/health` through Access with the service credentials, then checks `/agent/ci`
498
498
  with the `cta_` token alone:
499
499
 
@@ -526,7 +526,7 @@ LOADER: Cloudflare.WorkerLoader(),
526
526
  `@zackbart/connecta/worker`. The adapter constructs the upstream
527
527
  `DynamicWorkerExecutor` with only the loader and a deadline, and disposes each
528
528
  run's loader and RPC handles when its lease ends, even if the guest has not
529
- settled. It serves the six-tool surface. Its admission pool is per isolate:
529
+ settled. It serves the meta-tool surface. Its admission pool is per isolate:
530
530
  two runs, eight queued for up to 60 seconds, then a retryable
531
531
  `executor_overloaded`. Pass `admission` to `workerExecutor()` to change it; see
532
532
  [code mode](../../documentation/code-mode.md#deploy-time-capability). Do not
@@ -77,7 +77,7 @@ account choices, including the Google Workspace exception.
77
77
  ## Finding a tool and using it are separate steps
78
78
 
79
79
  First the agent finds an action and learns what information it needs.
80
- Then it calls that action. The default connection gives the AI app six small
80
+ Then it calls that action. The default connection gives the AI app a few small
81
81
  **meta-tools** to help it do this without loading every service's tools into
82
82
  the conversation.
83
83
 
@@ -87,6 +87,7 @@ the conversation.
87
87
  | `call_tool` | Call a discovered action that reads data. |
88
88
  | `call_destructive_tool` | Call a discovered action that changes data, under the app's approval policy. |
89
89
  | `execute_code` | Combine discovery, actions, and a small answer in a program. |
90
+ | `execute_read_code` | The same for read-only work. It refuses anything that changes data. |
90
91
  | `authorize_connector` | Request the permitted account-connection handoff. |
91
92
  | `skills` | Read guidance for using a connection. |
92
93
 
@@ -74,9 +74,7 @@ credentials as another boundary where possible.
74
74
  The Eve helper defaults to unattended authorized writes. For interactive use,
75
75
  `gateWrites: true` asks before tools not marked read-only; an explicit Eve
76
76
  approval policy takes precedence. The AI app owns approvals. It may ask based
77
- on an earlier tool label. If a
78
- read becomes a write, a writable pool can execute it without a fresh
79
- approval; a read-only pool refuses it. Connecta does not pause a program to
77
+ on an earlier tool label. If a native tool becomes a write, its cached read name is refused before dispatch. Refresh `tools/list` and use the write's name; approval follows the host's policy. Read-only pools refuse writes. `execute_read_code` is the exception an app need not ask about: it refuses anything that can change data. It can still read, so a page's text can try to talk an agent into sending data through a read action; see [read programs](../documentation/meta-tools.md#read-programs). Connecta does not pause a program to
80
78
  ask a person partway through.
81
79
 
82
80
  See [read-only setup](../documentation/integrating.md#make-one-connection-read-only)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zackbart/connecta",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "One MCP to rule them all — a single MCP endpoint aggregating many downstream connectors behind a code-first surface of six meta-tools.",
@@ -10,10 +10,10 @@ tokens, upgrading, and diagnosis with `connecta doctor` to their procedures.
10
10
 
11
11
  - Edit `src/connecta.config.ts` for connectors, authentication, storage, public
12
12
  URL, and optional modules. `src/index.ts` only starts it.
13
- - Keep `executor: quickJsExecutor()` for the prescribed six-tool code-first
14
- surface. Keep the required `readOnly` choice in the config: `false` lets
13
+ - Keep `executor: quickJsExecutor()` for the prescribed code-first
14
+ meta-tool surface. Keep the required `readOnly` choice in the config: `false` lets
15
15
  `call_destructive_tool` and programs write and annotates `execute_code` as
16
- a write; `true` omits write tools from search and describe and refuses every
16
+ a write, with `execute_read_code` listed for read-only programs at `/mcp`; `true` omits write tools from search and describe and refuses every
17
17
  write call. Named pools inherit it unless they set their own `readOnly`.
18
18
  Approval belongs to the MCP host. Do not configure the removed `trust` or
19
19
  `execute.approval`.
@@ -272,7 +272,7 @@ npm run typecheck
272
272
  CONNECTA_TOKEN='cta_REPLACE_WITH_RETURNED_SECRET' npm run doctor
273
273
  ```
274
274
 
275
- Doctor checks health, the executor, and the exact prescribed six-tool
275
+ Doctor checks health, the executor, and the exact prescribed meta-tool
276
276
  model-facing surface by running a harmless sandbox program. It reads the bearer
277
277
  from `CONNECTA_TOKEN`; it never accepts the secret as a command-line argument.
278
278
  Remote URLs must use HTTPS.
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "@clerk/backend": "^3.12.0",
21
- "@zackbart/connecta": "0.41.0",
21
+ "@zackbart/connecta": "0.42.0",
22
22
  "quickjs-emscripten": "0.32.0",
23
23
  "undici": "6.29.1"
24
24
  },