@zackbart/connecta 0.15.1 → 0.16.1

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 (335) hide show
  1. package/AGENTS.md +40 -20
  2. package/CHANGELOG.md +653 -0
  3. package/README.md +25 -5
  4. package/bin/connecta.mjs +44 -3
  5. package/dist/access-tokens.d.ts +0 -1
  6. package/dist/access-tokens.js +0 -1
  7. package/dist/activity.d.ts +50 -2
  8. package/dist/activity.js +34 -1
  9. package/dist/apps-shell.d.ts +0 -1
  10. package/dist/apps-shell.js +0 -1
  11. package/dist/auth/bearer.d.ts +0 -1
  12. package/dist/auth/bearer.js +0 -1
  13. package/dist/auth/clerk.d.ts +0 -1
  14. package/dist/auth/clerk.js +45 -9
  15. package/dist/auth/downstream-oauth.d.ts +0 -1
  16. package/dist/auth/downstream-oauth.js +0 -1
  17. package/dist/call-admission.d.ts +0 -1
  18. package/dist/call-admission.js +0 -1
  19. package/dist/catalog-drift.d.ts +99 -0
  20. package/dist/catalog-drift.js +251 -0
  21. package/dist/catalog-fingerprint.d.ts +0 -1
  22. package/dist/catalog-fingerprint.js +0 -1
  23. package/dist/catalog-limits.d.ts +0 -1
  24. package/dist/catalog-limits.js +0 -1
  25. package/dist/catalog-service.d.ts +0 -1
  26. package/dist/catalog-service.js +41 -5
  27. package/dist/catalog.d.ts +11 -1
  28. package/dist/catalog.js +20 -1
  29. package/dist/concurrency.d.ts +0 -1
  30. package/dist/concurrency.js +0 -1
  31. package/dist/connector-scope.d.ts +0 -1
  32. package/dist/connector-scope.js +0 -1
  33. package/dist/connectors/api.d.ts +29 -21
  34. package/dist/connectors/api.js +45 -19
  35. package/dist/connectors/guarded-fetch.d.ts +106 -0
  36. package/dist/connectors/guarded-fetch.js +289 -0
  37. package/dist/connectors/remote-mcp.d.ts +0 -1
  38. package/dist/connectors/remote-mcp.js +0 -1
  39. package/dist/credentials.d.ts +0 -1
  40. package/dist/credentials.js +0 -1
  41. package/dist/errors.d.ts +30 -3
  42. package/dist/errors.js +1 -1
  43. package/dist/execute.d.ts +0 -1
  44. package/dist/execute.js +0 -1
  45. package/dist/executor-admission.d.ts +11 -1
  46. package/dist/executor-admission.js +28 -1
  47. package/dist/executor-result.d.ts +0 -1
  48. package/dist/executor-result.js +0 -1
  49. package/dist/executors/quickjs-child.d.ts +0 -1
  50. package/dist/executors/quickjs-child.js +0 -1
  51. package/dist/executors/quickjs-protocol.d.ts +0 -1
  52. package/dist/executors/quickjs-protocol.js +0 -1
  53. package/dist/executors/quickjs-runtime.d.ts +0 -1
  54. package/dist/executors/quickjs-runtime.js +0 -1
  55. package/dist/executors/quickjs.d.ts +0 -1
  56. package/dist/executors/quickjs.js +2 -1
  57. package/dist/favicon.d.ts +0 -1
  58. package/dist/favicon.js +0 -1
  59. package/dist/index.d.ts +2 -3
  60. package/dist/index.js +24 -7
  61. package/dist/invocation.d.ts +0 -1
  62. package/dist/invocation.js +0 -1
  63. package/dist/json-schema.d.ts +0 -1
  64. package/dist/json-schema.js +0 -1
  65. package/dist/mcp-result.d.ts +0 -1
  66. package/dist/mcp-result.js +0 -1
  67. package/dist/meta-tools.d.ts +0 -1
  68. package/dist/meta-tools.js +0 -1
  69. package/dist/node.d.ts +0 -1
  70. package/dist/node.js +0 -1
  71. package/dist/operator-ui/generated.d.ts +2 -3
  72. package/dist/operator-ui/generated.js +3 -4
  73. package/dist/operator-ui/model.d.ts +10 -1
  74. package/dist/operator-ui/model.js +0 -1
  75. package/dist/operator-ui/view.d.ts +167 -0
  76. package/dist/operator-ui/view.js +270 -0
  77. package/dist/providers/cloudflare.d.ts +0 -1
  78. package/dist/providers/cloudflare.js +261 -299
  79. package/dist/providers/linear.d.ts +26 -5
  80. package/dist/providers/linear.js +32 -61
  81. package/dist/providers/mixpanel.d.ts +35 -4
  82. package/dist/providers/mixpanel.js +53 -79
  83. package/dist/providers/notion.d.ts +0 -1
  84. package/dist/providers/notion.js +87 -42
  85. package/dist/providers/stripe.d.ts +13 -1
  86. package/dist/providers/stripe.js +31 -60
  87. package/dist/registry.d.ts +34 -2
  88. package/dist/registry.js +85 -5
  89. package/dist/retired-toolkits.d.ts +0 -1
  90. package/dist/retired-toolkits.js +0 -1
  91. package/dist/routes/access-tokens.d.ts +0 -1
  92. package/dist/routes/access-tokens.js +0 -1
  93. package/dist/routes/activity.d.ts +0 -1
  94. package/dist/routes/activity.js +0 -1
  95. package/dist/routes/credentials.d.ts +0 -1
  96. package/dist/routes/credentials.js +0 -1
  97. package/dist/routes/mcp.d.ts +0 -1
  98. package/dist/routes/mcp.js +0 -1
  99. package/dist/routes/oauth.d.ts +0 -1
  100. package/dist/routes/oauth.js +0 -1
  101. package/dist/routes/shared.d.ts +2 -1
  102. package/dist/routes/shared.js +0 -1
  103. package/dist/routes/ui.d.ts +0 -1
  104. package/dist/routes/ui.js +0 -1
  105. package/dist/server.d.ts +0 -1
  106. package/dist/server.js +11 -1
  107. package/dist/skills.d.ts +0 -1
  108. package/dist/skills.js +0 -1
  109. package/dist/storage/file.d.ts +0 -1
  110. package/dist/storage/file.js +0 -1
  111. package/dist/storage/memory.d.ts +0 -1
  112. package/dist/storage/memory.js +0 -1
  113. package/dist/timeout.d.ts +0 -1
  114. package/dist/timeout.js +0 -1
  115. package/dist/tool-safety.d.ts +0 -1
  116. package/dist/tool-safety.js +0 -1
  117. package/dist/types.d.ts +45 -1
  118. package/dist/types.js +0 -1
  119. package/dist/ui.d.ts +0 -1
  120. package/dist/ui.js +13 -137
  121. package/dist/validate.d.ts +13 -15
  122. package/dist/validate.js +24 -11
  123. package/dist/version.d.ts +1 -2
  124. package/dist/version.js +1 -2
  125. package/documentation/architecture.md +186 -5
  126. package/documentation/auth.md +11 -0
  127. package/documentation/call-admission.md +142 -6
  128. package/documentation/cloudflare.md +92 -10
  129. package/documentation/code-first-exploration.md +2 -2
  130. package/documentation/code-mode.md +14 -14
  131. package/documentation/connector-guides.md +172 -5
  132. package/documentation/connectors.md +89 -0
  133. package/documentation/linear.md +20 -2
  134. package/documentation/mcp-ui-design.md +2 -2
  135. package/documentation/meta-tools.md +7 -1
  136. package/documentation/mixpanel.md +42 -9
  137. package/documentation/notion.md +23 -2
  138. package/documentation/operations.md +325 -5
  139. package/documentation/operator-ui.md +120 -5
  140. package/documentation/provider-audit.md +160 -0
  141. package/documentation/provider-conventions.md +667 -0
  142. package/documentation/request-admission.md +167 -5
  143. package/documentation/rich-output-design.md +1 -2
  144. package/documentation/stripe.md +15 -0
  145. package/documentation/upgrading.md +454 -0
  146. package/ethos.md +14 -9
  147. package/examples/worker/README.md +102 -12
  148. package/examples/worker/src/index.ts +46 -1
  149. package/examples/worker/wrangler.jsonc +14 -1
  150. package/package.json +10 -6
  151. package/templates/node/.dockerignore +10 -0
  152. package/templates/node/.env.example +40 -3
  153. package/templates/node/AGENTS.md +16 -1
  154. package/templates/node/Dockerfile +49 -0
  155. package/templates/node/README.md +117 -2
  156. package/templates/node/docker-compose.yml +39 -0
  157. package/templates/node/package.json +1 -1
  158. package/templates/node/src/file-activity.ts +182 -0
  159. package/templates/node/src/index.ts +80 -4
  160. package/assets/connecta-clay-hero.png +0 -0
  161. package/dist/access-tokens.d.ts.map +0 -1
  162. package/dist/access-tokens.js.map +0 -1
  163. package/dist/activity.d.ts.map +0 -1
  164. package/dist/activity.js.map +0 -1
  165. package/dist/apps-shell.d.ts.map +0 -1
  166. package/dist/apps-shell.js.map +0 -1
  167. package/dist/auth/bearer.d.ts.map +0 -1
  168. package/dist/auth/bearer.js.map +0 -1
  169. package/dist/auth/clerk.d.ts.map +0 -1
  170. package/dist/auth/clerk.js.map +0 -1
  171. package/dist/auth/downstream-oauth.d.ts.map +0 -1
  172. package/dist/auth/downstream-oauth.js.map +0 -1
  173. package/dist/call-admission.d.ts.map +0 -1
  174. package/dist/call-admission.js.map +0 -1
  175. package/dist/catalog-fingerprint.d.ts.map +0 -1
  176. package/dist/catalog-fingerprint.js.map +0 -1
  177. package/dist/catalog-limits.d.ts.map +0 -1
  178. package/dist/catalog-limits.js.map +0 -1
  179. package/dist/catalog-service.d.ts.map +0 -1
  180. package/dist/catalog-service.js.map +0 -1
  181. package/dist/catalog.d.ts.map +0 -1
  182. package/dist/catalog.js.map +0 -1
  183. package/dist/concurrency.d.ts.map +0 -1
  184. package/dist/concurrency.js.map +0 -1
  185. package/dist/connector-scope.d.ts.map +0 -1
  186. package/dist/connector-scope.js.map +0 -1
  187. package/dist/connectors/api.d.ts.map +0 -1
  188. package/dist/connectors/api.js.map +0 -1
  189. package/dist/connectors/remote-mcp.d.ts.map +0 -1
  190. package/dist/connectors/remote-mcp.js.map +0 -1
  191. package/dist/credentials.d.ts.map +0 -1
  192. package/dist/credentials.js.map +0 -1
  193. package/dist/errors.d.ts.map +0 -1
  194. package/dist/errors.js.map +0 -1
  195. package/dist/execute.d.ts.map +0 -1
  196. package/dist/execute.js.map +0 -1
  197. package/dist/executor-admission.d.ts.map +0 -1
  198. package/dist/executor-admission.js.map +0 -1
  199. package/dist/executor-result.d.ts.map +0 -1
  200. package/dist/executor-result.js.map +0 -1
  201. package/dist/executors/quickjs-child.d.ts.map +0 -1
  202. package/dist/executors/quickjs-child.js.map +0 -1
  203. package/dist/executors/quickjs-protocol.d.ts.map +0 -1
  204. package/dist/executors/quickjs-protocol.js.map +0 -1
  205. package/dist/executors/quickjs-runtime.d.ts.map +0 -1
  206. package/dist/executors/quickjs-runtime.js.map +0 -1
  207. package/dist/executors/quickjs.d.ts.map +0 -1
  208. package/dist/executors/quickjs.js.map +0 -1
  209. package/dist/favicon.d.ts.map +0 -1
  210. package/dist/favicon.js.map +0 -1
  211. package/dist/index.d.ts.map +0 -1
  212. package/dist/index.js.map +0 -1
  213. package/dist/invocation.d.ts.map +0 -1
  214. package/dist/invocation.js.map +0 -1
  215. package/dist/json-schema.d.ts.map +0 -1
  216. package/dist/json-schema.js.map +0 -1
  217. package/dist/mcp-result.d.ts.map +0 -1
  218. package/dist/mcp-result.js.map +0 -1
  219. package/dist/meta-tools.d.ts.map +0 -1
  220. package/dist/meta-tools.js.map +0 -1
  221. package/dist/node.d.ts.map +0 -1
  222. package/dist/node.js.map +0 -1
  223. package/dist/operator-ui/generated.d.ts.map +0 -1
  224. package/dist/operator-ui/generated.js.map +0 -1
  225. package/dist/operator-ui/model.d.ts.map +0 -1
  226. package/dist/operator-ui/model.js.map +0 -1
  227. package/dist/providers/cloudflare.d.ts.map +0 -1
  228. package/dist/providers/cloudflare.js.map +0 -1
  229. package/dist/providers/linear.d.ts.map +0 -1
  230. package/dist/providers/linear.js.map +0 -1
  231. package/dist/providers/mixpanel.d.ts.map +0 -1
  232. package/dist/providers/mixpanel.js.map +0 -1
  233. package/dist/providers/notion.d.ts.map +0 -1
  234. package/dist/providers/notion.js.map +0 -1
  235. package/dist/providers/stripe.d.ts.map +0 -1
  236. package/dist/providers/stripe.js.map +0 -1
  237. package/dist/registry.d.ts.map +0 -1
  238. package/dist/registry.js.map +0 -1
  239. package/dist/retired-toolkits.d.ts.map +0 -1
  240. package/dist/retired-toolkits.js.map +0 -1
  241. package/dist/routes/access-tokens.d.ts.map +0 -1
  242. package/dist/routes/access-tokens.js.map +0 -1
  243. package/dist/routes/activity.d.ts.map +0 -1
  244. package/dist/routes/activity.js.map +0 -1
  245. package/dist/routes/credentials.d.ts.map +0 -1
  246. package/dist/routes/credentials.js.map +0 -1
  247. package/dist/routes/mcp.d.ts.map +0 -1
  248. package/dist/routes/mcp.js.map +0 -1
  249. package/dist/routes/oauth.d.ts.map +0 -1
  250. package/dist/routes/oauth.js.map +0 -1
  251. package/dist/routes/shared.d.ts.map +0 -1
  252. package/dist/routes/shared.js.map +0 -1
  253. package/dist/routes/ui.d.ts.map +0 -1
  254. package/dist/routes/ui.js.map +0 -1
  255. package/dist/server.d.ts.map +0 -1
  256. package/dist/server.js.map +0 -1
  257. package/dist/skills.d.ts.map +0 -1
  258. package/dist/skills.js.map +0 -1
  259. package/dist/storage/file.d.ts.map +0 -1
  260. package/dist/storage/file.js.map +0 -1
  261. package/dist/storage/memory.d.ts.map +0 -1
  262. package/dist/storage/memory.js.map +0 -1
  263. package/dist/timeout.d.ts.map +0 -1
  264. package/dist/timeout.js.map +0 -1
  265. package/dist/tool-safety.d.ts.map +0 -1
  266. package/dist/tool-safety.js.map +0 -1
  267. package/dist/types.d.ts.map +0 -1
  268. package/dist/types.js.map +0 -1
  269. package/dist/ui.d.ts.map +0 -1
  270. package/dist/ui.js.map +0 -1
  271. package/dist/validate.d.ts.map +0 -1
  272. package/dist/validate.js.map +0 -1
  273. package/dist/version.d.ts.map +0 -1
  274. package/dist/version.js.map +0 -1
  275. package/examples/node/README.md +0 -52
  276. package/examples/node/src/index.ts +0 -71
  277. package/src/access-tokens.ts +0 -289
  278. package/src/activity.ts +0 -234
  279. package/src/apps-shell.ts +0 -370
  280. package/src/auth/bearer.ts +0 -61
  281. package/src/auth/clerk.ts +0 -553
  282. package/src/auth/downstream-oauth.ts +0 -575
  283. package/src/call-admission.ts +0 -521
  284. package/src/catalog-fingerprint.ts +0 -52
  285. package/src/catalog-limits.ts +0 -11
  286. package/src/catalog-service.ts +0 -1153
  287. package/src/catalog.ts +0 -790
  288. package/src/concurrency.ts +0 -39
  289. package/src/connector-scope.ts +0 -66
  290. package/src/connectors/api.ts +0 -159
  291. package/src/connectors/remote-mcp.ts +0 -1090
  292. package/src/credentials.ts +0 -428
  293. package/src/errors.ts +0 -364
  294. package/src/execute.ts +0 -1406
  295. package/src/executor-admission.ts +0 -328
  296. package/src/executor-result.ts +0 -107
  297. package/src/executors/quickjs-child.ts +0 -172
  298. package/src/executors/quickjs-protocol.ts +0 -99
  299. package/src/executors/quickjs-runtime.ts +0 -470
  300. package/src/executors/quickjs.ts +0 -776
  301. package/src/favicon.ts +0 -53
  302. package/src/index.ts +0 -666
  303. package/src/invocation.ts +0 -655
  304. package/src/json-schema.ts +0 -11
  305. package/src/mcp-result.ts +0 -43
  306. package/src/meta-tools.ts +0 -1607
  307. package/src/node.ts +0 -206
  308. package/src/operator-ui/browser.css +0 -423
  309. package/src/operator-ui/browser.ts +0 -1281
  310. package/src/operator-ui/generated.ts +0 -4
  311. package/src/operator-ui/model.ts +0 -111
  312. package/src/providers/cloudflare.ts +0 -3999
  313. package/src/providers/linear.ts +0 -302
  314. package/src/providers/mixpanel.ts +0 -229
  315. package/src/providers/notion.ts +0 -1879
  316. package/src/providers/stripe.ts +0 -307
  317. package/src/registry.ts +0 -1085
  318. package/src/retired-toolkits.ts +0 -14
  319. package/src/routes/access-tokens.ts +0 -115
  320. package/src/routes/activity.ts +0 -215
  321. package/src/routes/credentials.ts +0 -254
  322. package/src/routes/mcp.ts +0 -429
  323. package/src/routes/oauth.ts +0 -322
  324. package/src/routes/shared.ts +0 -247
  325. package/src/routes/ui.ts +0 -152
  326. package/src/server.ts +0 -195
  327. package/src/skills.ts +0 -271
  328. package/src/storage/file.ts +0 -123
  329. package/src/storage/memory.ts +0 -44
  330. package/src/timeout.ts +0 -84
  331. package/src/tool-safety.ts +0 -15
  332. package/src/types.ts +0 -523
  333. package/src/ui.ts +0 -744
  334. package/src/validate.ts +0 -387
  335. package/src/version.ts +0 -7
@@ -1,7 +1,143 @@
1
- # Call admission
1
+ # Downstream call admission
2
2
 
3
- > **Stub.** The old manual was retired in the phase-1 docs restructure. This
4
- > document will be rewritten as an agent-facing guide — what the subsystem is
5
- > for, how to work on it, and what it must never do once the ideas in
6
- > [ethos.md](../ethos.md) settle. The prior text lives in git history as
7
- > `docs/call-admission.md`.
3
+ One admitted MCP request can fan out into many downstream calls. A program
4
+ calls tools from loops, from `connecta.batch`, and from branches the caller
5
+ never saw. The deployment-wide request pool
6
+ ([request admission](./request-admission.md)) bounds the envelope; it cannot
7
+ see anything inside it. A provider that publishes "60 requests per minute"
8
+ needs a bound that counts calls, not requests.
9
+
10
+ So a connector may declare `callAdmission`: an optional per-runtime policy
11
+ around its own `Connector.callTool` attempts.
12
+
13
+ ```ts
14
+ const projects = api("projects", {
15
+ description: "Projects — issues and reports",
16
+ callAdmission: {
17
+ // Plural-ready public shape; this release requires exactly one rule.
18
+ rules: [{
19
+ maxConcurrency: 5,
20
+ maxQueueSize: 10, // default 32
21
+ queueTimeoutMs: 2_000, // default 5_000
22
+ retryAfterMs: 1_000, // concurrency-overload hint
23
+ budget: { kind: "rolling-window", maxCalls: 60, windowMs: 60 * 60_000 },
24
+ partitionKey({ toolName, args }) {
25
+ return projectIdFor(toolName, args);
26
+ },
27
+ }],
28
+ maxPartitions: 1_024, // default
29
+ },
30
+ tools: [/* … */],
31
+ });
32
+ ```
33
+
34
+ `api()`, `remoteMcp()`, and a hand-written `Connector` all accept it. Maintained
35
+ prebuilt connections set it themselves — but only when the provider documents a
36
+ number, which is convention
37
+ [P12](./provider-conventions.md#p12--declare-an-admission-budget-only-when-the-provider-documents-a-number).
38
+ An invented budget is a throttle with no source.
39
+
40
+ ## Policy contract
41
+
42
+ `maxConcurrency` and `budget` are independently optional, but a rule must
43
+ declare at least one — a rule that bounds nothing is a typo, not a policy.
44
+ Queue settings require `maxConcurrency`, because there is nothing to queue
45
+ behind without it, and `maxQueueSize: 0` is the fail-fast shape. Numeric bounds
46
+ are finite whole numbers: concurrency, timeouts, budget values, and
47
+ `maxPartitions` are positive; queue size and `retryAfterMs` may be zero.
48
+ `budget.kind` must be `"rolling-window"`. Everything invalid throws during
49
+ registry construction.
50
+
51
+ The container is an array so a later release can add atomic rules over
52
+ different partition dimensions, but **exactly one rule** is accepted today.
53
+ Zero or several throw rather than imply semantics the runtime does not have.
54
+ Multiple rules cannot be faked as sequential leases: consuming one rolling
55
+ token before a later rule refuses would charge a call that never reached the
56
+ provider — the exact accounting error a budget exists to prevent.
57
+
58
+ Omitting `partitionKey` gives one connector-wide partition. A callback runs
59
+ synchronously on model-supplied arguments and must return a non-secret string
60
+ of at most 128 UTF-8 bytes. A throw or an invalid return is a typed local
61
+ `connector_call_failed`; neither the callback text nor the arguments are
62
+ surfaced. The callback is operator code and may abort the caller synchronously,
63
+ so cancellation is rechecked after it returns — otherwise a cancelled call
64
+ could still consume a budget entry.
65
+
66
+ State retains the returned key, bounded timestamps, counters, signals, and
67
+ promise continuations. Nothing copies arguments into the limiter; the queued
68
+ waiter closure deliberately captures the `AbortSignal` rather than the input
69
+ object, because closing over the input would retain its `args`. At most
70
+ `maxPartitions` states are live, and an idle state is evicted only once its
71
+ active calls, queue, and rolling-window history are all empty — eviction must
72
+ not be a way to reset a live budget. Exhausted partition capacity is
73
+ `rate_limited` with the configured retry hint, not a silent unbounded map.
74
+
75
+ ## Attempt semantics
76
+
77
+ The registry owns the limiter, and `InvocationService.invoke` acquires a permit
78
+ immediately before `Connector.callTool` and releases it in `finally`. Both call
79
+ paths — top-level `call_tool` and a program's `connecta.call` or
80
+ `connecta.batch` — reach that same seam, so a program cannot buy itself a
81
+ second limit by taking the other route.
82
+
83
+ - **A retry is another attempt.** It reacquires and can consume another budget
84
+ entry, because the provider counts it that way. Backoff never holds a
85
+ concurrency permit.
86
+ - **A proactive short-window `rate_limited` refusal** participates in the
87
+ ordinary retry policy and counts as an attempt. Activity records the final
88
+ outcome and the attempt count.
89
+ - **A queued cancellation consumes nothing.** It is removed from the queue with
90
+ no rolling-window entry charged.
91
+ - **Caller cancellation is terminal.** It is non-retryable, releases its
92
+ permit, records a `cancelled` activity outcome, and is not connector-health
93
+ evidence.
94
+ - **Budget exhaustion fails immediately** as `rate_limited`, `retryable: true`,
95
+ with the exact `retryAfterMs` to the next free slot. Concurrency overflow
96
+ uses the configured hint instead, because there is no exact answer.
97
+ - **Local refusals are not connector health failures.** They are activity
98
+ errors, but no provider call happened, so poisoning the connector's health
99
+ with them would report the limiter's success as the downstream's failure.
100
+ `isCallAdmissionError` is what keeps `recordFailure` out of that path.
101
+
102
+ Only tool execution is covered. Catalog `listTools`, status probes, credential
103
+ checks, and authorization operations stay outside the budget: they are not the
104
+ calls a provider is rate-limiting, and charging discovery for them would make
105
+ a program's first search cost it capacity to act.
106
+
107
+ Queue admission and connector execution have separate clocks. `queueTimeoutMs`
108
+ bounds only the wait for a permit; a per-attempt `timeoutMs` starts after
109
+ admission. A saturated call can therefore take up to their sum. With
110
+ `diagnostics: true`, `admissionMs` reports the permit wait and `connectorMs`
111
+ the admitted attempt — which is the only way to tell "the provider is slow"
112
+ from "we are throttling ourselves".
113
+
114
+ ## Enforcement scope
115
+
116
+ This is deliberately **per-runtime**. It completely contains fan-out inside one
117
+ request, including a wide `connecta.batch` in one Worker isolate. A rolling
118
+ budget is exact inside one Node process or Worker isolate, and best-effort
119
+ across isolates, replicas, and restarts.
120
+
121
+ KV cannot coordinate the invariant without atomic operations, and this release
122
+ adds no Durable Object or other distributed coordinator. The async typed permit
123
+ is the seam a coordinator would slot into later; until then the guide says what
124
+ the bound actually is rather than implying a global one.
125
+
126
+ ## Observations
127
+
128
+ `/health` exposes payload-free aggregates at
129
+ `admission.downstreamCalls.connectors.<id>`: retained partition count, current
130
+ active and queued gauges, cumulative admitted/queued/rejected/rate-limited/
131
+ cancelled counts, and queue-wait count, total, and maximum. The open endpoint
132
+ never exposes partition keys, tool arguments, or results — a partition key can
133
+ be a customer identifier, which is precisely why it stays out of an unauthenticated
134
+ payload. Ordinary payload-free activity records the final call outcome and its
135
+ typed error code.
136
+
137
+ ## Tests that enforce this
138
+
139
+ | Invariant | Suite |
140
+ | --- | --- |
141
+ | Independent partitions, exact rolling-window reset and retry, queued cancellation charging no budget, synchronous cancel during partition derivation, validated values snapshotted rather than read from mutable config, bounded partition state and contained `partitionKey` failures, empty and multi-rule policies refused | `test/call-admission.test.ts` (controller) |
142
+ | One base-registry limiter shared by direct and program calls, batch bounds with input order preserved, cancellation threading, no dispatch or retry or health poisoning after cancellation, short proactive windows retried without poisoning health, payload-free `/health` aggregates | `test/call-admission.test.ts` (integration, Node + Workers) |
143
+ | Where provider budgets are allowed to come from at all | [provider conventions P12](./provider-conventions.md#p12--declare-an-admission-budget-only-when-the-provider-documents-a-number), [provider audit](./provider-audit.md) |
@@ -2,7 +2,7 @@
2
2
 
3
3
  Import `cloudflare()` independently from
4
4
  `@zackbart/connecta/providers/cloudflare`. It is a deliberate, hand-written
5
- surface over Cloudflare's v4 REST API. Fifty-five tools combine ergonomic,
5
+ surface over Cloudflare's v4 REST API. Fifty-one tools combine ergonomic,
6
6
  fully described operations for common work with three guarded escape hatches
7
7
  for the rest of Cloudflare's fast-moving control plane. Reads, JSON mutations,
8
8
  and raw/multipart uploads remain separate so safety routing does not depend on
@@ -140,11 +140,11 @@ projections:
140
140
 
141
141
  | Area | Reads | Writes |
142
142
  | --- | --- | --- |
143
- | Zones | discovery, details, settings, rulesets | update a setting |
143
+ | Zones | discovery, details, one setting at a time, rulesets | update a setting |
144
144
  | DNS/cache | list and get records | create, update, delete, targeted/full purge |
145
145
  | Workers | scripts, settings, deployments | delete a script |
146
146
  | KV | namespaces, keys, bulk values | create/rename/delete namespace, bulk write/delete |
147
- | R2 | buckets, object metadata, metrics, CORS | create/update/delete bucket, delete object, replace/delete CORS |
147
+ | R2 | buckets, object metadata, CORS | create/update/delete bucket, delete object |
148
148
  | Pages | projects, deployments, domains | retry/rollback/delete deployments, add/delete domains, purge build cache, delete project |
149
149
 
150
150
  Every named tool carries a complete hand-written input schema: closed
@@ -153,6 +153,63 @@ every constrained field, endpoint-specific pagination bounds, and a description
153
153
  on every property. `test/cloudflare-provider.test.ts` walks the surface and
154
154
  asserts those properties rather than leaving them as a claim.
155
155
 
156
+ ### What the named surface deliberately leaves out
157
+
158
+ A named tool is a permanent line item in every deployment's catalog, so the
159
+ surface was measured against the escape hatches rather than assumed to beat
160
+ them ([#350](https://github.com/zackbart/connecta/issues/350), evidence in
161
+ [`eval/current-version/results/issue-350-evidence.md`](https://github.com/zackbart/connecta/blob/main/eval/current-version/results/issue-350-evidence.md)).
162
+ Two named tools lost that comparison, a third followed one of them off the
163
+ surface to keep a policy pair on one route, and a fourth left because
164
+ Cloudflare deprecated the only endpoint it could call:
165
+
166
+ - **R2 CORS writes.** `set_r2_cors` declared its rule list as free-form objects
167
+ — the untyped body this connection refuses everywhere else — so its schema
168
+ validated the bucket name and waved through the part of the call that
169
+ actually fails. It also returned Cloudflare's response unprojected and was
170
+ destructive either way, which left nothing for it to beat
171
+ `cloudflare_api_mutate` on. `delete_r2_cors` did not lose that comparison:
172
+ it returned a fixed `{deleted: true}` behind a closed output schema and
173
+ refused every malformed argument locally. It went anyway, because naming only
174
+ the delete would mean one CORS policy is set through the raw route and
175
+ cleared through a named tool. Read a policy with `get_r2_cors`; change one
176
+ with `cloudflare_api_mutate` at
177
+ `PUT`/`DELETE /accounts/{accountId}/r2/buckets/{bucketName}/cors`. This is the
178
+ same split the [DNS record types](#dns-record-types) already use: structured
179
+ bodies stay readable through named tools and writable through the
180
+ approval-gated raw route.
181
+ - **R2 account metrics.** `get_r2_metrics` took one account id, put it in a
182
+ path, and returned the response untouched — `cloudflare_api_get` at
183
+ `/accounts/{accountId}/r2/metrics` does the same thing without a permanent
184
+ catalog line.
185
+ - **The bulk zone-settings read.** `list_zone_settings` called
186
+ `GET /zones/{zoneId}/settings`, which Cloudflare's published document now
187
+ marks `deprecated: true` along with its `PATCH` sibling
188
+ ([#361](https://github.com/zackbart/connecta/issues/361)). There is no bulk
189
+ replacement to repoint it at: the supported operations are the per-setting
190
+ `GET` and `PATCH /zones/{zoneId}/settings/{settingId}` that `get_zone_setting`
191
+ and `update_zone_setting` already call. Keeping the tool would have meant
192
+ maintaining a name over a contract Cloudflare has announced it intends to
193
+ stop honouring — and #350 had already measured this one as the sharpest
194
+ passthrough on the surface: it took a zone id, projected nothing, and *grew*
195
+ the payload 22.7% by wrapping Cloudflare's settings array in a page object an
196
+ unpaginated endpoint never filled. Read one setting with `get_zone_setting`.
197
+ Where the whole set is genuinely wanted — an audit, a config diff — an
198
+ operator can still ask for it explicitly through `cloudflare_api_get` at
199
+ `/zones/{zoneId}/settings`, which is the honest place for a call whose
200
+ endpoint is on its way out: named by the caller, at the caller's risk, rather
201
+ than promised by connecta's catalog.
202
+
203
+ Because `scripts/drift/cloudflare-endpoints.json` records the endpoints this
204
+ connection *calls*, dropping the tool drops the row — so
205
+ `npm run drift:check -- --specs` is quiet about zone settings by construction
206
+ rather than by a recorded exception. A path reached only through a hatch is
207
+ named by the caller, so it was never a touched endpoint.
208
+
209
+ The surviving 47 named tools all refuse malformed arguments locally, which is
210
+ the one thing no escape hatch can do: a hatch's path is an opaque string, so it
211
+ can only check that a path is a path.
212
+
156
213
  ### The whole-v4 escape hatch
157
214
 
158
215
  Cloudflare adds products and endpoints faster than a curated connector should
@@ -171,8 +228,14 @@ method classification into user input:
171
228
 
172
229
  All three accept explicit endpoint-specific headers, which supports R2
173
230
  jurisdictions, conditional requests, encryption controls, and object metadata.
174
- Authentication, host selection, content type, content length, and transfer
175
- framing remain connector-owned and cannot be overridden.
231
+ `Authorization`, `Cookie`, `Host`, `Content-Length`, `Content-Type`, and
232
+ `Transfer-Encoding` remain connector-owned and are refused: authentication,
233
+ host selection, content type, and request framing are not the caller's to set.
234
+ That refused list lives in the usage guide rather than in each header property
235
+ description, because the compact renderer inlines a property description once
236
+ per tool that shares it, and repeating it three times pushed
237
+ `cloudflare_api_upload`'s compact input shape past the 1,024-byte discovery
238
+ budget.
176
239
 
177
240
  Paths are relative to `/client/v4`. Absolute URLs, protocol-relative paths,
178
241
  `..` traversal, fragments, and embedded query strings are refused locally;
@@ -191,8 +254,8 @@ comes from Cloudflare's API reference.
191
254
 
192
255
  ### Where the `perPage` bounds come from
193
256
 
194
- `strictValidation` is on, so an out-of-range `perPage` is refused locally
195
- before it reaches Cloudflare. That is only a favor when the bound is really
257
+ `api()` enforces every hand-written schema, so an out-of-range `perPage` is
258
+ refused locally before it reaches Cloudflare. That is only a favor when the bound is really
196
259
  Cloudflare's, so the schemas record which ones are and the descriptions say so
197
260
  out loud:
198
261
 
@@ -260,8 +323,12 @@ Paginated lists add a `page` object derived from `result_info`:
260
323
  field to branch on.
261
324
 
262
325
  Some endpoints do not work that way, and the schemas say so rather than leaving
263
- an agent to discover it. `list_r2_buckets`, `list_r2_objects`, and
264
- `list_kv_keys` paginate by cursor and return `nextCursor` instead of `page`.
326
+ an agent to discover it. `list_zone_rulesets`, `list_r2_buckets`,
327
+ `list_r2_objects`, and `list_kv_keys` paginate by cursor and return
328
+ `nextCursor` instead of `page`. On those four the `cursor` argument says the
329
+ endpoint pages by cursor rather than page number, and the `nextCursor` result
330
+ says it is the only signal and that no `page` object is coming — so the loop
331
+ condition is legible from either end of one tool, without fetching the guide.
265
332
  `list_worker_scripts` reports no counters at all and omits `page` entirely.
266
333
 
267
334
  Projected resource reads expose `raw: true` where the provider's larger object
@@ -281,9 +348,17 @@ the failure message so the provider's own code number survives to the agent.
281
348
  | 401 or 403 | `auth_required`, not retryable | Stops and reports which permission is missing |
282
349
  | 400 with a credential-shaped code (1001, 6003, 6111, 9103, 9106, 9107) | `auth_required`, not retryable | Stops; the header or key is malformed, not the arguments |
283
350
  | 400, 409, 422 | `invalid_args`, not retryable | Repairs the arguments |
284
- | 404 | `connector_call_failed`, not retryable | Re-runs discovery for the id |
351
+ | 404 | `not_found`, not retryable | Re-runs discovery for the id |
285
352
  | 5xx or a transport error | `unavailable`, retryable | Retries |
286
353
 
354
+ The 404 row is the unambiguous half of the `not_found` rule
355
+ ([H11](./provider-conventions.md#h11--errors-are-mapped-to-what-the-caller-does-next)).
356
+ Cloudflare refuses a token that may not touch a resource with 401 or 403, so a
357
+ 404 is an absence rather than a permission gap wearing a miss, and an agent can
358
+ act on it: confirm the zone or account id with `list_zones` or `list_accounts`
359
+ and address the right one. Notion's 404, which proves neither, stays
360
+ `connector_call_failed`.
361
+
287
362
  The six credential-shaped codes deserve a caveat: Cloudflare publishes no
288
363
  official table mapping error codes to causes, so that set is assembled from
289
364
  community reports and probing, not from documentation. The same goes for the
@@ -329,3 +404,10 @@ dashboard traffic of a human sharing the account is counted by Cloudflare but
329
404
  not by Connecta. `maxConcurrency` is the bound that actually protects a shared
330
405
  credential, because a single `execute_code` program can fan out far faster than
331
406
  the window notices.
407
+
408
+ ## Conventions
409
+
410
+ This connection is audited against
411
+ [the provider conventions](./provider-conventions.md). Its verdict per
412
+ convention, including every recorded exception, is the Cloudflare section of
413
+ [the provider audit](./provider-audit.md).
@@ -13,7 +13,7 @@
13
13
  > constraint below was dropped.** The owner decided the default directly on
14
14
  > 2026-07-30 and [#224](https://github.com/zackbart/connecta/issues/224)
15
15
  > shipped it; the ethos records the eval-as-gate as `removed` and
16
- > [`eval/code-first-gate`](../eval/code-first-gate/README.md) continues as
16
+ > [`eval/code-first-gate`](https://github.com/zackbart/connecta/blob/main/eval/code-first-gate/README.md) continues as
17
17
  > measurement that nothing waits on.
18
18
 
19
19
  ## Executive summary
@@ -227,7 +227,7 @@ changing the default surface. Run at least 20 independent samples per task and
227
227
  model, with prompt variation.
228
228
 
229
229
  That suite was built under
230
- [`eval/code-first-gate`](../eval/code-first-gate/README.md). Its recorded results
230
+ [`eval/code-first-gate`](https://github.com/zackbart/connecta/blob/main/eval/code-first-gate/README.md). Its recorded results
231
231
  remain as measurement history; the runnable comparison was retired when #273
232
232
  removed the alternate deployment shapes.
233
233
 
@@ -8,10 +8,9 @@ it is specified in prose first and implemented second — the same discipline th
8
8
  [MCP spec bump](./mcp-2026-07-28.md) followed.
9
9
 
10
10
  Two executors implement this document: QuickJS in a child process on Node, and
11
- `DynamicWorkerExecutor` from `@cloudflare/codemode` on Workers. Divergence
12
- between them is a bug unless it appears in
13
- [Executor exceptions](#executor-exceptions), which names the reason. Anyone can
14
- implement a third executor from this document without reading either.
11
+ `DynamicWorkerExecutor` from `@cloudflare/codemode` on Workers. Divergence between
12
+ them is a bug unless it appears in [Executor exceptions](#executor-exceptions),
13
+ which names the reason. Anyone can implement a third from this document alone.
15
14
 
16
15
  The [code-first exploration](./code-first-exploration.md) is the evidence behind
17
16
  the direction; [`ethos.md`](../ethos.md) carries the verdicts. Where its prototype
@@ -43,7 +42,7 @@ const connecta = createConnecta({
43
42
  CPU, wall-time, memory, stack, queue, result, log, and IPC bounds are configured
44
43
  on the executor. Server bundlers must keep the `@zackbart/connecta/quickjs`
45
44
  package files external so the child entry stays on disk. The
46
- [Node example](../examples/node/README.md) carries the complete setup.
45
+ [Node template](../templates/node/README.md) carries the complete setup.
47
46
 
48
47
  On Cloudflare Workers, the Worker Loader binding provides the required sandbox:
49
48
 
@@ -54,9 +53,8 @@ createConnecta({
54
53
  });
55
54
  ```
56
55
 
57
- Dynamic Workers require the Workers Paid plan. The
58
- [Worker example](../examples/worker/README.md#code-mode) carries the complete
59
- required binding and package setup.
56
+ Dynamic Workers require the Workers Paid plan. The complete required binding and
57
+ package setup is in the [Worker example](../examples/worker/README.md#code-mode).
60
58
 
61
59
  ## What an executor must implement
62
60
 
@@ -64,6 +62,7 @@ The host side of the seam is two types in `src/types.ts` and nothing else.
64
62
 
65
63
  ```ts
66
64
  interface Executor {
65
+ readonly name?: string; // what /health and doctor report
67
66
  execute(code: string, providers: ExecutorProvider[]): Promise<ExecuteResult>;
68
67
  close?(): void | Promise<void>;
69
68
  }
@@ -113,11 +112,12 @@ Connecta passes exactly one provider, named `connecta`. An executor must:
113
112
 
114
113
  Optionally implement `AdmittingExecutor` (`acquire()` returning a lease whose
115
114
  `execute` runs once) for bounded admission (`L7`) and `close()` for shutdown;
116
- connecta wraps a plain `Executor` with `withExecutorAdmission` otherwise.
115
+ connecta wraps a plain `Executor` with `withExecutorAdmission` otherwise. The
116
+ optional `name` — else a class's constructor name, which a minifier may rewrite
117
+ — is what [`/health` and `doctor`](./operations.md#the-cli) report.
117
118
 
118
- Note what is *not* on this list: [emitted output](#emitted-output) asks
119
- nothing of an executor — `connecta.emit` is just another provider function
120
- (`M8`).
119
+ Note what is *not* on this list: [emitted output](#emitted-output) asks nothing
120
+ of an executor — `connecta.emit` is just another provider function (`M8`).
121
121
 
122
122
  ## The program
123
123
 
@@ -329,8 +329,7 @@ not in the always-loaded usage skill, which `test/meta-tools.test.ts` caps at
329
329
  2,500 bytes — a budget the guide already spends nearly all of, so new text there
330
330
  displaces old rather than adding to what every request pays for.
331
331
 
332
- **E2.** The taxonomy. `retryable` is what connecta reports; `Y3` says what a
333
- program may do about it.
332
+ **E2.** The taxonomy: `retryable` is what connecta reports, `Y3` what a program may do.
334
333
 
335
334
  | Code | Raised when | `retryable` |
336
335
  | --- | --- | --- |
@@ -340,6 +339,7 @@ program may do about it.
340
339
  | `destructive_tool_requires_approval` | the tool is not explicitly read-only | false |
341
340
  | `auth_required` | the credential is missing, expired, or rejected | false |
342
341
  | `invalid_args` | arguments or discovery bounds were rejected | false |
342
+ | `not_found` | the downstream answered and the resource is not there — the one code that says skip this id rather than stop, classified off `errorDetails` per `E1` and never off a caught error, raised only where the provider tells absence from a permission gap ([H11](./provider-conventions.md#h11--errors-are-mapped-to-what-the-caller-does-next)) | false |
343
343
  | `input_required_unsupported` | a downstream asked for mid-call input | false |
344
344
  | `rate_limited` | the downstream reported a rate limit | true |
345
345
  | `unavailable` | the downstream is down or unreachable | true |
@@ -1,7 +1,174 @@
1
1
  # Connector guides
2
2
 
3
- > **Stub.** The old manual was retired in the phase-1 docs restructure. This
4
- > document will be rewritten as an agent-facing guide what the subsystem is
5
- > for, how to work on it, and what it must never do — once the ideas in
6
- > [ethos.md](../ethos.md) settle. The prior text lives in git history as
7
- > `docs/connector-guides.md`.
3
+ Descriptions and schemas say *what* a connector's tools are. They do not say
4
+ which tool to prefer, which id format an address quirk expects, how the service
5
+ paginates, or how hard you may hammer it. A connector's optional `usageGuide`
6
+ is where that goes deployment-owned configuration, served by the `skills`
7
+ meta-tool as `connector:<id>` and returned verbatim, with a bounded `summary`
8
+ surfaced in discovery so an agent learns the guide exists at the moment it
9
+ matters. See [meta-tools](./meta-tools.md#connector-guide-selection) for the
10
+ discovery contract and [connectors](./connectors.md#catalog-contract) for how a
11
+ guide is configured.
12
+
13
+ ## The shape of a guide
14
+
15
+ `usageGuide` accepts a bare markdown string, which is still the shortest
16
+ correct configuration, or the structured form:
17
+
18
+ ```ts
19
+ const notion = remoteMcp("notion", {
20
+ url: "https://mcp.notion.com/mcp",
21
+ description: "Notion — pages, databases, comments",
22
+ auth: { type: "oauth" },
23
+ usageGuide: {
24
+ content: `# Notion usage
25
+
26
+ Search before listing: \`notion.search\` covers pages and databases in one call.
27
+
28
+ - Page ids are dashed UUIDs. Strip the trailing slug from a pasted URL first.
29
+ - Paginate with \`start_cursor\`; \`page_size\` is capped at 100.
30
+ - Writes replace blocks wholesale — read the block, merge, then write.
31
+ `,
32
+ summary: "Search before listing; dashed-UUID page ids; cursor pagination",
33
+ },
34
+ });
35
+ ```
36
+
37
+ The field is on the `Connector` interface, not on a factory, so it works
38
+ identically for `api()`, `remoteMcp()`, a prebuilt connection, and a
39
+ hand-written connector. It is deployment-owned configuration like everything
40
+ else here: an edit and a redeploy, never a runtime registration.
41
+
42
+ `content` is returned byte for byte by `skills({ name: "connector:<id>" })`.
43
+ `summary` is normalized and capped at 120 characters for discovery. Omit it and
44
+ connecta derives the same bounded line the skills listing uses: the first
45
+ meaningful body line, with frontmatter, fences, rules, comments, and table rows
46
+ skipped, a heading used only when the guide has no body, and the connector's
47
+ description as the last resort. A derived summary is usually worse than a
48
+ written one — it was written to open a document, not to answer "is this guide
49
+ relevant to what I am about to do".
50
+
51
+ `connector:<id>` is the only address for a guide, and built-in skill names are
52
+ bare identifiers, so a guide can never shadow or be shadowed by `usage`: a
53
+ connector whose id is literally `usage` is listed as `connector:usage`, and
54
+ `skills({ name: "usage" })` still returns the built-in guide. Every miss —
55
+ unknown name, unknown connector, connector with no guide — is an explicit
56
+ error. Nothing silently falls back to the generic guide, because a generic
57
+ answer to a specific question is worse than no answer.
58
+
59
+ Discovery text is conditional on the deployment actually having a guide. The
60
+ guide sentences in the `skills`, `search_tools`, `call_destructive_tool`, and
61
+ `execute_code` descriptions appear only when at least one visible connector
62
+ declares one — the connector set is fixed at construction, so this is stable
63
+ per deployment, and a deployment with no guides pays no always-loaded context
64
+ for a feature it does not use. The built-in `usage` skill is the deliberate
65
+ exception: it stays byte-identical across every deployment, including its
66
+ per-connector-guides section, so an agent that has read it once in a task never
67
+ needs a deployment-local copy of it.
68
+
69
+ ## What belongs in a guide
70
+
71
+ The test is not "is this true" but "can a schema carry it". If a schema can,
72
+ fix the schema instead — a constraint in the schema is enforced, is visible at
73
+ the moment of the call, and costs nothing to a caller who never fetches the
74
+ guide.
75
+
76
+ So a guide carries:
77
+
78
+ - **Tool preference.** Which of two plausible tools is the right one, and the
79
+ fact that decides it.
80
+ - **Sequence.** What must happen first — resolving a name to an id, listing a
81
+ parent before a child.
82
+ - **Identity and address quirks.** The id format an address expects, the
83
+ difference between the id in the URL and the id the API wants.
84
+ - **Pagination conventions.** The cursor field, the page cap, whether the
85
+ connector has more than one convention.
86
+ - **Units and aliases.** What a bare number means; what the service calls the
87
+ thing the caller calls something else.
88
+ - **Reduction advice.** Which fields matter, for a downstream whose results are
89
+ large and whose schemas you do not control.
90
+ - **Rate-limit etiquette**, with the number.
91
+
92
+ And a guide does not carry: anything readable off the schema, background on
93
+ what the service is, marketing, a tool list, or a second copy of the tool
94
+ descriptions. It is fetched into a live context window — every line that
95
+ repeats the schema is a line that displaced one that did not.
96
+
97
+ **Style.** Write for the agent, not the operator; the built-in `usage` skill
98
+ (`src/skills.ts`) is the model. Concise and imperative, leading with the
99
+ decision rather than the background ("Search before listing", not "Notion has a
100
+ search API"). Prefer short bullets to prose. Name exact tool addresses and
101
+ argument names. State a constraint with its number.
102
+
103
+ ## The `required` rule
104
+
105
+ `required: true` on the structured form means: fetch this guide before every
106
+ operation on this connector. It surfaces as `guideRequired: true` with
107
+ `guideRequiredReasons: ["connector_required"]` on discovery results.
108
+
109
+ It is an instruction, not a gate. Nothing refuses the call — connecta tells the
110
+ agent to read the guide first and then believes it, because a server-side
111
+ refusal here would be a policy engine, which
112
+ [`ethos.md`](../ethos.md) refuses.
113
+
114
+ Reserve it for connectors whose correct arguments or sequence *cannot* be
115
+ expressed by the downstream tool schema at all: generic API wrappers whose one
116
+ broad tool name carries no endpoint vocabulary, and cross-operation conventions
117
+ no single schema can state. Two categories already produce the flag on their
118
+ own and must not be hand-declared for it — an unannotated or write-capable tool
119
+ (`approval_required`) and a compact schema that was capped
120
+ (`schema_truncated`). `connector_required` and `approval_required` survive
121
+ exact schema expansion; `schema_truncated` clears once describe returns the
122
+ exact shape.
123
+
124
+ The failure mode of over-declaring is quiet and expensive: an agent that must
125
+ fetch a guide before every call pays that fetch on the calls where the schema
126
+ was already complete and unambiguous. `required` earns its cost on connectors
127
+ where the alternative is a wrong call, not on connectors where it is a slightly
128
+ slower right one.
129
+
130
+ ## Provider conventions
131
+
132
+ The maintained prebuilt connections come in two shapes, and each has its own
133
+ convention set — including the shape of its usage guide, which is one of the
134
+ few things both shapes fully own:
135
+
136
+ - [Hand-written HTTP providers](./provider-conventions.md#hand-written-http-providers)
137
+ (H1–H14) — `api()` surfaces where Connecta owns every name, schema,
138
+ projection, and error. Cloudflare and Notion.
139
+ - [Hosted-MCP proxies](./provider-conventions.md#hosted-mcp-proxies) (P1–P13) —
140
+ `remoteMcp()` wrappers where the downstream owns the catalog and Connecta
141
+ owns the endpoint, credential, classification, guide, and budget. Linear,
142
+ Stripe, and Mixpanel.
143
+
144
+ Both sets are judged by one measure: what the convention saves the model that
145
+ interacts with connecta, priced in discovery tokens, wrong-tool selection,
146
+ argument retries, or result size. The same document defines
147
+ [what a provider audit checks](./provider-conventions.md#what-the-audit-checks),
148
+ so [#342](https://github.com/zackbart/connecta/issues/342) can run against it
149
+ convention by convention rather than by taste.
150
+
151
+ Two of those conventions decide how a guide is written, and they differ by
152
+ shape. A hand-written provider's guide carries only what a schema cannot,
153
+ because it owns the schemas and should fix them instead
154
+ ([H13](./provider-conventions.md#h13--the-guide-carries-only-what-a-schema-cannot)).
155
+ A proxy's guide carries the reduction and identity-resolution advice its
156
+ schemas will never carry, because it cannot change them
157
+ ([P7](./provider-conventions.md#p7--the-guide-carries-the-reduction-advice-the-schemas-cannot),
158
+ [P8](./provider-conventions.md#p8--identity-resolution-comes-before-action)).
159
+
160
+ ## Tests that enforce this
161
+
162
+ `test/meta-tools.test.ts` owns the guide behavior end to end: the skills
163
+ listing carrying one entry per guided connector, summaries derived from the
164
+ first meaningful line and falling back to the connector description when the
165
+ guide is all markup, whitespace-only guides treated as no guide, content
166
+ returned verbatim including surrounding padding, identical content in two
167
+ deployments staying isolated, every miss erroring rather than falling back to
168
+ the generic guide with an identically labelled skills list on each branch, the
169
+ `guide` pointer in search output, and `guideRequired` appearing for
170
+ connector-required conventions, approval-bound tools, and truncated schemas —
171
+ and being absent from a search that asked for no schemas. `test/server.test.ts`
172
+ owns the conditional half: it compares a guide-free deployment's four tool
173
+ descriptions against a guided one's, and asserts the `usage` skill is
174
+ byte-identical between them.