@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
@@ -270,7 +270,7 @@ token and run doctor against a pool that lists the agent:
270
270
  CONNECTA_TOKEN='<stored-cta-token>' npx connecta doctor --url http://localhost:8787 --pool local-machine
271
271
  ```
272
272
 
273
- Doctor checks health, the required executor, and the current six-tool set. A
273
+ Doctor checks health, the required executor, and the current meta-tool set, running a harmless program on each listed program route. A
274
274
  `cta_` token is checked at `/agent/<pool>` and needs `--pool`.
275
275
  For a Worker protected by Access, `/health` still needs edge admission even
276
276
  though `/agent/*` bypasses Access. Use an Access service token admitted by the
@@ -297,14 +297,15 @@ connector; resolve credentials using [authorization recovery](./meta-tools.md#au
297
297
 
298
298
  Use the failed check to choose the next step:
299
299
 
300
- | Symptom | Action |
301
- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |
302
- | Connection refused or timeout | Check the public URL, listening process/port, proxy, and Worker deployment. |
303
- | `/health` fails behind Access | Check the Worker-level Access policy and the two service headers above. Do not broaden the agent bypass. |
304
- | Executor check fails | Retain `quickJsExecutor()` and its peer on Node, or `workerExecutor({ loader })`, the codemode peer, and `LOADER` on Workers. |
305
- | MCP 401 | Check the saved token, declared agent, and slot state; rotated/revoked tokens refuse. Use `/agent/<pool>` with `--pool`. |
306
- | MCP 404 | Check the pool name and `members: ["agent:assistant"]`; an existing but inaccessible pool is deliberately indistinguishable from a missing one. |
307
- | Doctor passes but a connector fails | Discover its tools in that pool, check credential status/account ownership, and perform a bounded read. Doctor does not prove downstream access. |
300
+ | Symptom | Action |
301
+ | ----------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
302
+ | Connection refused or timeout | Check the public URL, listening process/port, proxy, and Worker deployment. |
303
+ | `/health` fails behind Access | Check the Worker-level Access policy and the two service headers above. Do not broaden the agent bypass. |
304
+ | Executor check fails | Retain `quickJsExecutor()` and its peer on Node, or `workerExecutor({ loader })`, the codemode peer, and `LOADER` on Workers. |
305
+ | MCP 401 | Check the saved token, declared agent, and slot state; rotated/revoked tokens refuse. Use `/agent/<pool>` with `--pool`. |
306
+ | MCP 404 | Check the pool name and `members: ["agent:assistant"]`; an existing but inaccessible pool is deliberately indistinguishable from a missing one. |
307
+ | Doctor passes but a connector fails | Discover its tools in that pool, check credential status/account ownership, and perform a bounded read. Doctor does not prove downstream access. |
308
+ | `Native discovery degraded` | The named connectors did not answer and are listed from an older catalog. Check them with a scoped search; tools stay listed but calls check the live catalog. |
308
309
 
309
310
  After a fix, repeat doctor with the same client credentials and pool. Never
310
311
  paste a token or raw downstream failure body into a committed diagnostic log.
@@ -401,7 +401,13 @@ classification: {
401
401
  },
402
402
  ```
403
403
 
404
- `"read"` sets the effective read class for tool routing and read-only exposure.
404
+ `"read"` sets the effective read class for tool routing and read-only exposure
405
+ only when the server is silent about the tool, and asserts that the call is safe
406
+ to repeat. It has no effect on a tool the server explicitly declares a write
407
+ (`readOnlyHint: false`, `destructiveHint: true`, or contradictory hints); that tool
408
+ stays a write and an operator warning names the override.
409
+ `"read-repeatable"` serves such a tool as a read anyway, for a deployment that has
410
+ checked it and accepts that hosts may repeat the call, so the vendor can receive it twice.
405
411
  `"write"` selects the host approval path. `"hidden"` omits the tool from search
406
412
  and describe and refuses guessed-name calls, including programs. An absent
407
413
  runtime tool leaves its override dormant, with one operator warning per catalog
@@ -411,8 +417,8 @@ when live hints would expose them as reads. Never copy a retired review map
411
417
  wholesale or use it to broaden access or merely recover an old route.
412
418
 
413
419
  An override does not change replay safety. A call is write-like when either its
414
- effective class or its source class is write. The source class uses only the server's annotations: missing hints or
415
- `destructiveHint: true` count as write even when deployment policy sets read. Write-like
420
+ effective class or its source class is write. The source class uses only the server's annotations: missing hints
421
+ and declared writes count as write even when deployment policy serves them as reads. Write-like
416
422
  calls get one attempt across OAuth renewal, reconnect, authorization recovery
417
423
  and program re-runs. An ambiguous dispatched failure, including timeout or
418
424
  cancellation, reports an unknown outcome with no retry or wait advice. Approval,
@@ -202,7 +202,7 @@ only in deployment code through the existing `classification` map:
202
202
 
203
203
  ```ts
204
204
  classification: {
205
- crm: { list_tickets: "read", update_ticket: "write", internal_export: "hidden" },
205
+ crm: { list_tickets: "read", save_view: "read-repeatable", update_ticket: "write", internal_export: "hidden" },
206
206
  },
207
207
  ```
208
208
 
@@ -210,8 +210,30 @@ classification: {
210
210
  and describe and refuses guessed-name calls, including programs. An absent
211
211
  runtime tool leaves its override dormant with an operator warning once per catalog change; the override
212
212
  applies if that exact name returns. Unknown static tool names fail construction.
213
- No argument can change these rules. A write-to-read override changes exposure
214
- and approval. Replay and failure decisions treat a call as a write when either its
213
+ No argument can change these rules. `"read"` depends on what the tool's source
214
+ states:
215
+
216
+ - **The source explicitly declares a write** (`readOnlyHint: false`,
217
+ `destructiveHint: true`, or contradictory hints): the tool stays a write and is
218
+ never served read-annotated, because a host may resend a read-annotated call
219
+ after a connection failure. `call_tool` refuses it with the next step, naming
220
+ `call_destructive_tool`. It runs on `call_destructive_tool` and `execute_code`, and
221
+ read-only endpoints and connectors omit and refuse it. An operator warning names the override once per catalog change.
222
+ - **The source is silent** (no `readOnlyHint` and no `destructiveHint: true`): the
223
+ override is the only evidence, so the tool serves as a read with read
224
+ annotations. Setting it asserts that the call is safe to repeat, because the host
225
+ may resend it and Connecta cannot tell a resend from a new call.
226
+
227
+ `"read-repeatable"` is the opt-in for a tool whose source declares a write but which
228
+ you have checked: `crm.save_view` above adds one immutable record. It serves as a read
229
+ on every route, with read annotations, on read-only endpoints, through `call_tool`,
230
+ in programs and under its plain native name. You accept that a host may resend it after
231
+ a connection failure, so the vendor can receive the call twice; only use it where a
232
+ repeat is harmless. Connecta itself still sends it at most once, as the next paragraph
233
+ describes. Prefer `"read"`: if a vendor later declares a write, `"read"` fails safe and
234
+ `"read-repeatable"` does not.
235
+
236
+ Replay and failure decisions treat a call as a write when either its
215
237
  effective class or its source class is write. The source class is the verified
216
238
  server annotations;
217
239
  deployment overrides never change it. A write gets one wire attempt across
@@ -229,8 +251,8 @@ Remote catalogs evolve. Discovery, direct calls, and programs enforce the
229
251
  current annotations and `ConnectaConfig.classification` overrides. A leftover
230
252
  `classify` option throws at construction and names that map. Provider reviews,
231
253
  schema pins, `optional`, and `unlisted: "hide"` are removed. Missing or
232
- contradictory hints make the source class write, even when an override makes
233
- the effective class read. Review behavior before setting a read override;
254
+ contradictory hints make the source class write. Under `"read"`, contradictory hints also keep
255
+ the effective class write and missing hints do not. `"read-repeatable"` serves either as a read. Review behavior before setting a read override;
234
256
  classification does not replace downstream scopes or caller grants.
235
257
 
236
258
  ## A hand-written HTTP capability