@zackbart/connecta 0.37.0 → 0.38.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 (183) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +2 -2
  3. package/bin/connecta.mjs +1 -39
  4. package/bin/version.mjs +1 -1
  5. package/dist/access-tokens.js +2 -4
  6. package/dist/agent-identity.js +1 -1
  7. package/dist/auth/clerk-sdk/generated.js +2 -1
  8. package/dist/auth/cloudflare-access.d.ts +3 -1
  9. package/dist/auth/cloudflare-access.js +22 -11
  10. package/dist/auth/downstream-oauth.js +195 -270
  11. package/dist/auth/downstream-revocation.js +1 -1
  12. package/dist/auth/oauth-grant.js +11 -0
  13. package/dist/auth/oauth-token-response.js +1 -1
  14. package/dist/auth/vercel-agent.js +2 -1
  15. package/dist/auth-elicitation.js +2 -2
  16. package/dist/branding.d.ts +1 -15
  17. package/dist/branding.js +2 -2
  18. package/dist/bytes.js +42 -0
  19. package/dist/call-admission-context.js +2 -5
  20. package/dist/call-admission.js +5 -0
  21. package/dist/call-recovery.js +0 -3
  22. package/dist/catalog-cache.js +26 -7
  23. package/dist/catalog-fingerprint.js +2 -18
  24. package/dist/catalog-revision.js +9 -0
  25. package/dist/catalog-service.js +51 -20
  26. package/dist/config-defaults.d.ts +1 -0
  27. package/dist/config-defaults.js +1 -0
  28. package/dist/config-schema.d.ts +1 -1
  29. package/dist/config-schema.js +6 -2
  30. package/dist/config.d.ts +41 -14
  31. package/dist/config.js +21 -71
  32. package/dist/connector-caller.js +1 -1
  33. package/dist/connectors/api-connector.js +4 -3
  34. package/dist/connectors/guarded-fetch.d.ts +0 -6
  35. package/dist/connectors/guarded-fetch.js +1 -11
  36. package/dist/connectors/remote-mcp.js +93 -69
  37. package/dist/connectors/resource-uri.js +0 -4
  38. package/dist/credentials.js +3 -0
  39. package/dist/d1.d.ts +0 -89
  40. package/dist/d1.js +0 -34
  41. package/dist/downstream-input.js +2 -2
  42. package/dist/execute.js +161 -116
  43. package/dist/executor-result.js +2 -1
  44. package/dist/executors/quickjs-runtime.js +2 -25
  45. package/dist/executors/quickjs.js +1 -1
  46. package/dist/guest-runtime.js +5 -3
  47. package/dist/guest-types.d.ts +5 -5
  48. package/dist/http/client.js +1 -1
  49. package/dist/http/errors.js +2 -2
  50. package/dist/http/json-schema.js +1 -1
  51. package/dist/http/node-transport.js +0 -1
  52. package/dist/http/oauth.js +1 -1
  53. package/dist/http/paging.js +6 -9
  54. package/dist/http/provider.js +1 -1
  55. package/dist/http/safety.js +1 -1
  56. package/dist/http/services.js +1 -8
  57. package/dist/http/tools.js +1 -7
  58. package/dist/http/vendor.js +7 -7
  59. package/dist/identity.js +2 -6
  60. package/dist/index.js +1 -2
  61. package/dist/invocation-auth.js +2 -1
  62. package/dist/invocation.js +8 -2
  63. package/dist/meta-tools.js +27 -27
  64. package/dist/native-tools.js +2 -1
  65. package/dist/oauth-handoff.js +2 -2
  66. package/dist/operation-vocabulary.js +1 -1
  67. package/dist/operator-record.d.ts +8 -2
  68. package/dist/operator-record.js +18 -50
  69. package/dist/operator-ui/contract.d.ts +4 -2
  70. package/dist/operator-ui/generated.js +3 -3
  71. package/dist/operator-ui/model.d.ts +7 -2
  72. package/dist/program-writes.js +3 -8
  73. package/dist/provider-call.js +0 -7
  74. package/dist/provider.d.ts +1 -1
  75. package/dist/providers/_shared/google/kit.js +1 -6
  76. package/dist/providers/_shared/google/service-account.js +1 -3
  77. package/dist/providers/_shared/google/workspace.d.ts +1 -1
  78. package/dist/providers/_shared/guide.js +3 -0
  79. package/dist/providers/_shared/json.js +12 -0
  80. package/dist/providers/_shared/rest/compact-index.js +1 -1
  81. package/dist/providers/_shared/rest/kit.js +1 -3
  82. package/dist/providers/_shared/rest/operation-index.js +1 -3
  83. package/dist/providers/_shared/rest/value-safety.js +26 -28
  84. package/dist/providers/breeze/api.js +2 -7
  85. package/dist/providers/breeze/index.js +4 -2
  86. package/dist/providers/breeze/tools.js +3 -4
  87. package/dist/providers/ccb/api.js +1 -6
  88. package/dist/providers/ccb/index.js +2 -1
  89. package/dist/providers/ccb/tools.js +1 -6
  90. package/dist/providers/cloudflare/api.js +2 -2
  91. package/dist/providers/cloudflare/index.js +2 -1
  92. package/dist/providers/cloudflare/safety.js +3 -3
  93. package/dist/providers/docs/tools.js +2 -10
  94. package/dist/providers/drive/tools.js +12 -25
  95. package/dist/providers/forms/tools.js +1 -9
  96. package/dist/providers/gmail/tools.js +5 -21
  97. package/dist/providers/overflow/api.js +1 -3
  98. package/dist/providers/overflow/index.js +2 -1
  99. package/dist/providers/overflow/tools.js +3 -7
  100. package/dist/providers/planning-center/api.js +2 -1
  101. package/dist/providers/planning-center/lib/constants.d.ts +1 -1
  102. package/dist/providers/planning-center/lib/json-api.js +1 -9
  103. package/dist/providers/planning-center/tools.js +2 -1
  104. package/dist/providers/sheets/tools.js +1 -9
  105. package/dist/providers/slides/tools.js +4 -13
  106. package/dist/providers/stripe/index.js +2 -1
  107. package/dist/providers/stripe/safety.js +2 -2
  108. package/dist/providers/tithely/api.js +2 -7
  109. package/dist/providers/tithely/index.js +3 -2
  110. package/dist/providers/tithely/tools.js +7 -5
  111. package/dist/providers/vercel/api.js +1 -6
  112. package/dist/providers/vercel/lib/pin.js +1 -1
  113. package/dist/providers/vercel/safety.js +1 -1
  114. package/dist/providers/vercel/tools.js +2 -1
  115. package/dist/redaction-marker.js +2 -2
  116. package/dist/registry.d.ts +4 -1
  117. package/dist/registry.js +35 -22
  118. package/dist/request-principal.js +15 -2
  119. package/dist/request-state.js +2 -2
  120. package/dist/routes/access-tokens.js +1 -1
  121. package/dist/routes/activity-disclosure.js +1 -1
  122. package/dist/routes/connect.js +2 -2
  123. package/dist/routes/credentials.js +1 -1
  124. package/dist/routes/dispatch.js +10 -0
  125. package/dist/routes/mcp.js +23 -21
  126. package/dist/routes/oauth-management.js +1 -1
  127. package/dist/routes/operator.js +53 -7
  128. package/dist/routes/shared.d.ts +8 -8
  129. package/dist/routes/shared.js +22 -15
  130. package/dist/routes/ui-config.js +6 -6
  131. package/dist/routes/ui-data.js +2 -2
  132. package/dist/routes/ui.js +9 -4
  133. package/dist/runtime/call-admission.js +1 -1
  134. package/dist/runtime/call.js +1 -1
  135. package/dist/runtime/settlement.js +1 -1
  136. package/dist/runtime/shared-read.js +2 -15
  137. package/dist/sent-secrets.d.ts +14 -6
  138. package/dist/sent-secrets.js +231 -85
  139. package/dist/server.js +4 -4
  140. package/dist/skills.js +8 -35
  141. package/dist/sqlite.d.ts +0 -19
  142. package/dist/sqlite.js +2 -83
  143. package/dist/storage/keys.js +29 -124
  144. package/dist/storage/sql-native.js +14 -111
  145. package/dist/storage/sql.d.ts +1 -24
  146. package/dist/storage/sql.js +1 -12
  147. package/dist/tool-error.js +4 -0
  148. package/dist/types.d.ts +4 -3
  149. package/dist/ui.js +3 -0
  150. package/dist/url-safety.js +0 -4
  151. package/dist/usage-guide.js +2 -2
  152. package/dist/version.d.ts +1 -1
  153. package/dist/version.js +1 -1
  154. package/dist/worker.js +1 -1
  155. package/documentation/README.md +6 -42
  156. package/documentation/architecture.md +190 -507
  157. package/documentation/auth.md +172 -58
  158. package/documentation/code-mode.md +98 -66
  159. package/documentation/deploying.md +19 -40
  160. package/documentation/integrating.md +8 -19
  161. package/documentation/meta-tools.md +23 -6
  162. package/documentation/migration-0.33.md +5 -5
  163. package/documentation/migration-0.34.md +2 -4
  164. package/documentation/migration-retired-layouts.md +74 -0
  165. package/documentation/operator-tests.md +19 -119
  166. package/documentation/operator-ui.md +46 -8
  167. package/documentation/provider-auth-migration.md +4 -10
  168. package/documentation/provider-migration-0.29.md +4 -15
  169. package/examples/worker/AGENTS.md +4 -6
  170. package/examples/worker/README.md +20 -115
  171. package/guides/connecting-agents.md +7 -30
  172. package/guides/how-it-works.md +2 -2
  173. package/guides/safety-and-trust.md +4 -1
  174. package/package.json +19 -19
  175. package/templates/node/README.md +9 -26
  176. package/templates/node/package.json +1 -1
  177. package/dist/auth/oauth-v2-migration.js +0 -135
  178. package/dist/provider-call-facts.d.ts +0 -115
  179. package/dist/provider-call.d.ts +0 -112
  180. package/dist/storage/d1-copy.js +0 -255
  181. package/dist/storage/sql-schema.d.ts +0 -6
  182. package/examples/worker/kv-to-d1.wrangler.jsonc +0 -26
  183. package/examples/worker/scripts/copy-kv-to-d1.mjs +0 -162
package/dist/types.d.ts CHANGED
@@ -237,7 +237,7 @@ export interface ConnectorContext {
237
237
  /** Requested connector-operation deadline in milliseconds. */
238
238
  timeoutMs?: number;
239
239
  }
240
- type ConnectorStatusState = "ok" | "auth_required" | "credential_required" | "error";
240
+ type ConnectorStatusState = "ok" | "per_caller" | "auth_required" | "credential_required" | "error";
241
241
  /** The last agent-facing catalog read this runtime served for one connector. */
242
242
  export interface CatalogAccessObservation {
243
243
  /** Fresh means the read used a live or unexpired catalog; stale means SWR. */
@@ -248,6 +248,7 @@ export type ResourceTemplateRefusalCode = "resource_template_ambiguous" | "resou
248
248
  export interface ConnectorStatus {
249
249
  /** Distinct host-observed refusal codes, without URI or template text. */
250
250
  resourceTemplateRefusals?: ResourceTemplateRefusalCode[];
251
+ /** `per_caller` is non-error: caller-bound auth has no admitted caller to check. */
251
252
  state: ConnectorStatusState;
252
253
  /** When state === "auth_required", the URL the operator should open. */
253
254
  authorizationUrl?: string;
@@ -444,8 +445,8 @@ export interface Connector {
444
445
  consumeAuthError?(ctx: ConnectorContext): Promise<void>;
445
446
  /**
446
447
  * Optional: complete a downstream OAuth flow (called by
447
- * /oauth/callback/<id>). `callbackParams` preserves the authorization
448
- * server's RFC 9207 `iss` response parameter for validation. Built-in
448
+ * /oauth/callback/<id>). Declare only when the connector can exchange a code.
449
+ * `callbackParams` preserves the authorization server's RFC 9207 `iss` response parameter for validation. Built-in
449
450
  * OAuth adapters require a nonempty `state` in this parameter, including
450
451
  * programmatic calls and `api()` flows with PKCE disabled. Missing state
451
452
  * is refused before any downstream request.
package/dist/ui.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { assertKnownOptions, keys, optionsOf } from "./config-schema.js";
2
2
  import { routeUi } from "./routes/ui.js";
3
+ import { forwardsPrincipal } from "./request-principal.js";
3
4
  import { routeCredentials } from "./routes/credentials.js";
4
5
  import { routeOAuthManagement } from "./routes/oauth-management.js";
5
6
  import { uiData } from "./routes/ui-data.js";
@@ -60,6 +61,8 @@ export function uiProblemFor(connector, status, observed) {
60
61
  if (status === "error")
61
62
  return "connector_unavailable";
62
63
  if (status === "auth_required") {
64
+ if (forwardsPrincipal(connector))
65
+ return "caller_refused";
63
66
  if (connector.startAuth)
64
67
  return "oauth_required";
65
68
  return connector.credential ? "credential_required" : "auth_required";
@@ -117,10 +117,6 @@ export function classifyHost(hostname) {
117
117
  return "loopback";
118
118
  return "public";
119
119
  }
120
- /** True for loopback and private hosts alike. */
121
- export function isPrivateHost(hostname) {
122
- return classifyHost(hostname) !== "public";
123
- }
124
120
  /**
125
121
  * Why connecta must not fetch `target`, a URL the downstream advertised, for a
126
122
  * connector configured at `configured` — or undefined when it may.
@@ -84,8 +84,8 @@ Split remaining reads. Never replay writes for their output.
84
84
 
85
85
  ## Per-connector guides
86
86
 
87
- Fetch a listed guide with skills by its exact name, or \`connecta.skill(name)\`
88
- inside a program; it returns \`{ name, text, format: "text" }\`.
87
+ Fetch a listed guide by its exact name with the skills tool, or
88
+ \`connecta.skill(name)\` inside a program; it returns \`{ name, text, format: "text" }\`.
89
89
  \`guideRequired: true\` is a hard stop. connector_required and approval_required
90
90
  remain after schema expansion; schema_truncated clears after exact describe.
91
91
  Otherwise fetch for units, pagination, aliases, or sequences.
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const CONNECTA_VERSION = "0.37.0";
1
+ export declare const CONNECTA_VERSION = "0.38.0";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // Generated from package.json by scripts/generate-version.mjs.
2
2
  // Workers-safe: no runtime filesystem read or deployment override.
3
- export const CONNECTA_VERSION = "0.37.0";
3
+ export const CONNECTA_VERSION = "0.38.0";
package/dist/worker.js CHANGED
@@ -47,7 +47,7 @@ function routeGuestImports(source) {
47
47
  export function workerExecutor(options) {
48
48
  // One pool per executor, so per isolate. A queued run may wait out one
49
49
  // default guest deadline: programs spend it awaiting host calls, and a
50
- // five-second wait refused nearly every run queued behind one (#1106).
50
+ // five-second wait refused nearly every run queued behind one.
51
51
  const admission = new AdmissionController(options.admission ?? {
52
52
  concurrency: 2,
53
53
  maxQueueSize: 8,
@@ -36,20 +36,8 @@ The separate `@zackbart/connecta-eve` helper is available from 0.35.0. Its
36
36
  [package guide](https://github.com/zackbart/connecta/blob/main/packages/connecta-eve/README.md)
37
37
  owns installation, supported Node/Eve versions, and token-source setup.
38
38
 
39
- ## Audience rule
40
-
41
- `documentation/`, `templates/`, and `examples/worker/` are written first for an
42
- agent operating a deployment from the installed package. The root `README.md`
43
- and `guides/` explain the product for people and also ship in the package;
44
- they own no operator contracts. Operator conventions must be self-contained rules plus a
45
- neutral example. Decision records and issues explain why; no operator task
46
- requires them, `spec/`, `.claude/`, or the Connecta source checkout. Those
47
- three directories do not ship. Contributor source maps, INV citations, and
48
- implementation/test evidence belong under clearly labeled contributor
49
- headings and are optional for operators. Use `assistant`, `alice`, `bob`,
50
- `crm`, `tickets`, `notes_alice`, and `alice@example.com` in examples; never
51
- real deployment, client, person, or organization names. Maintained provider
52
- product names stay.
39
+ For pre-0.29 storage or OAuth grants, complete the [retired layout migrations](./migration-retired-layouts.md)
40
+ on 0.37.1 before upgrading past that bridge release.
53
41
 
54
42
  ## Contract reference
55
43
 
@@ -61,6 +49,7 @@ product names stay.
61
49
  | [Architecture (contributor reference)](./architecture.md) | Request lifetimes, routes, storage, configuration, import boundaries, and Effect implementation |
62
50
  | [Operator UI](./operator-ui.md) | Optional UI setup, scoped configuration and live-data contract, activity disclosure, and UI implementation |
63
51
  | [Operator UI tests (contributor reference)](./operator-tests.md) | Browser state matrix, real-server flows, and snapshot maintenance |
52
+ | [Retired layout migrations](./migration-retired-layouts.md) | Required 0.37.1 bridge for KV, JSON state, and OAuth layout-2 grants |
64
53
  | [Migration to 0.33](./migration-0.33.md) | Upgrade actions from 0.32 options to maintainers, members, agents, agent endpoints, and pool owners |
65
54
  | [Provider migration for 0.29](./provider-migration-0.29.md) | Upgrade actions for Notion, Vercel, and Cloudflare; provider reconciliation tables supply exact name mappings |
66
55
  | [Provider migration for 0.35](./provider-migration-0.35.md) | Provider upgrade actions for 0.35.0 |
@@ -72,34 +61,9 @@ implementation evidence.
72
61
 
73
62
  ## Contributor reference
74
63
 
75
- ### Documentation ownership
76
-
77
- The root [README](../README.md) explains the product for people. It owns what
78
- Connecta offers and the setup handoff. The human guides explain
79
- [how it works](../guides/how-it-works.md), [connecting agents](../guides/connecting-agents.md),
80
- and [safety and trust](../guides/safety-and-trust.md). Keep their examples small
81
- and consistent with these contracts. Configuration references, complete setup
82
- procedures, migrations, and internal module maps belong here in agent documentation.
83
-
84
- [AGENTS.md](https://github.com/zackbart/connecta/blob/main/AGENTS.md) is the
85
- canonical repository policy, with `CLAUDE.md` as its symlink. Do not copy its
86
- verification, review, or release rules into another policy document.
87
-
88
- Deployment-local READMEs and agent instructions own runnable platform setup:
89
- [Node and Docker](../templates/node/README.md), [Workers](../examples/worker/README.md).
90
- Keep those aligned with their configuration and with this task router.
91
- Repository [skills](https://github.com/zackbart/connecta/tree/main/.claude/skills)
92
- own scoped change procedures. Each [provider folder](https://github.com/zackbart/connecta/tree/main/src/providers)
93
- owns its maintained `SKILL.md`, options, tests, fixtures, and review data.
94
- Use those details instead of copying provider catalogs into general guides.
95
- The provider list in the human README is generated; preserve its marker pair
96
- and run `pnpm run check:providers-generated` after edits.
97
-
98
- When changing behavior, update its owning contract and task guide in the same
99
- change. Check examples against current source and point to the tests that
100
- defend the contract. Published Markdown links to repo-only files must use
101
- canonical `https://github.com/zackbart/connecta/blob/main/…` or `tree/main/…`
102
- links. Keep `documentation/` flat, with Markdown files only.
64
+ For source changes, follow [AGENTS.md](https://github.com/zackbart/connecta/blob/main/AGENTS.md).
65
+ Contributor references describe implementation and test evidence; deployment
66
+ operators can use the task procedures above without a source checkout.
103
67
 
104
68
  The [changelog](../CHANGELOG.md) records shipped releases.
105
69
  [Decisions](https://github.com/zackbart/connecta/tree/main/decisions) explain