@zackbart/connecta 0.24.3 → 0.24.4

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 (67) hide show
  1. package/AGENTS.md +18 -20
  2. package/CHANGELOG.md +64 -1
  3. package/README.md +5 -6
  4. package/dist/branding.d.ts +31 -2
  5. package/dist/branding.js +116 -8
  6. package/dist/connectors/api.d.ts +1 -1
  7. package/dist/connectors/api.js +10 -2
  8. package/dist/connectors/guarded-fetch.d.ts +5 -1
  9. package/dist/connectors/guarded-fetch.js +34 -4
  10. package/dist/connectors/remote-mcp.js +8 -4
  11. package/dist/errors.d.ts +11 -3
  12. package/dist/errors.js +2 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +12 -1
  15. package/dist/meta-tools.js +105 -29
  16. package/dist/operator-ui/generated.js +2 -2
  17. package/dist/operator-ui/view.d.ts +38 -1
  18. package/dist/operator-ui/view.js +71 -0
  19. package/dist/providers/cloudflare.d.ts +14 -2
  20. package/dist/providers/cloudflare.js +107 -16
  21. package/dist/providers/linear.d.ts +26 -4
  22. package/dist/providers/linear.js +19 -4
  23. package/dist/providers/mixpanel.d.ts +16 -3
  24. package/dist/providers/mixpanel.js +13 -2
  25. package/dist/providers/notion.d.ts +8 -1
  26. package/dist/providers/notion.js +83 -10
  27. package/dist/providers/revenuecat.d.ts +30 -4
  28. package/dist/providers/revenuecat.js +42 -4
  29. package/dist/providers/stripe.d.ts +7 -1
  30. package/dist/providers/stripe.js +30 -4
  31. package/dist/providers/vercel.js +11 -1
  32. package/dist/registry.d.ts +12 -4
  33. package/dist/registry.js +22 -8
  34. package/dist/types.d.ts +37 -0
  35. package/dist/ui.js +18 -10
  36. package/dist/version.d.ts +1 -1
  37. package/dist/version.js +1 -1
  38. package/documentation/architecture.md +193 -181
  39. package/documentation/auth.md +197 -176
  40. package/documentation/code-mode.md +426 -321
  41. package/documentation/meta-tools.md +356 -416
  42. package/examples/worker/AGENTS.md +2 -1
  43. package/examples/worker/README.md +12 -10
  44. package/examples/worker/src/index.ts +12 -15
  45. package/package.json +1 -2
  46. package/templates/node/.env.example +3 -3
  47. package/templates/node/AGENTS.md +5 -4
  48. package/templates/node/README.md +2 -1
  49. package/templates/node/package.json +1 -1
  50. package/templates/node/src/index.ts +23 -22
  51. package/documentation/call-admission.md +0 -158
  52. package/documentation/cloudflare.md +0 -471
  53. package/documentation/connector-guides.md +0 -176
  54. package/documentation/connectors.md +0 -431
  55. package/documentation/linear.md +0 -193
  56. package/documentation/mixpanel.md +0 -160
  57. package/documentation/notion.md +0 -308
  58. package/documentation/operations.md +0 -359
  59. package/documentation/operator-ui.md +0 -135
  60. package/documentation/optional-modules-upgrade.md +0 -243
  61. package/documentation/provider-conventions.md +0 -729
  62. package/documentation/request-admission.md +0 -204
  63. package/documentation/revenuecat.md +0 -305
  64. package/documentation/storage-and-credentials.md +0 -254
  65. package/documentation/stripe.md +0 -262
  66. package/documentation/upgrading.md +0 -768
  67. package/documentation/vercel.md +0 -241
@@ -1,243 +0,0 @@
1
- # Upgrade to 0.24.0 optional modules
2
-
3
- This is a breaking configuration change. Core still owns the same seven tools,
4
- connector discovery, execution, invocation, and enforcement. UI, encrypted
5
- credential storage, activity history, and configured bearer authentication now
6
- have explicit imports. Select features when constructing the deployment;
7
- there is no runtime plugin installation or registration.
8
-
9
- Do this migration in the deployment repository on a branch. Do not re-run
10
- `connecta init`, replace the connector set, or copy a template over local code.
11
- The examples below omit unchanged connectors, executors, and storage adapters.
12
- Install and pin `@zackbart/connecta@0.24.0` after completing the migration.
13
-
14
- ### Configuration and import changes
15
-
16
- | Before | After |
17
- | --- | --- |
18
- | UI implicitly available | Import `operatorUi` from `@zackbart/connecta/ui` and set `ui: operatorUi()` |
19
- | Root `branding` | `ui: operatorUi({ branding })` |
20
- | `credentials: { encryptionKey }` | Import `encryptedCredentialVault` from `@zackbart/connecta/credentials`; set `vault: encryptedCredentialVault(storage, encryptionKey)` |
21
- | `activity: { store, deploymentId, readGate }` | Import `activityHistory` from `@zackbart/connecta/activity`; set `activity: activityHistory({ store, deploymentId, readGate })` |
22
- | Root `bearerToken` import | Import from `@zackbart/connecta/auth/bearer`; preserve its token and subject configuration |
23
- | `accessTokens: { ... }` | Remove after migrating every client that uses a Connecta-issued token |
24
- | `identity.operatorAccess` | `identity.activityAccess` for global activity reads; grant auth management separately |
25
- | Visibility implicitly permits auth changes | Explicit `credentialAdministration` for shared auth and `personalConnection` for personal auth; both default to `"none"` |
26
-
27
- Removed configuration is refused at construction. Do not silence TypeScript
28
- errors with casts; they identify decisions this upgrade needs you to make.
29
-
30
- Before:
31
-
32
- ```ts
33
- import { createConnecta, bearerToken } from "@zackbart/connecta";
34
-
35
- const connecta = createConnecta({
36
- connectors,
37
- executor,
38
- storage,
39
- auth: [bearerToken(token), interactiveAuth],
40
- branding,
41
- credentials: { encryptionKey },
42
- accessTokens: {},
43
- activity: { store: activityStore, deploymentId: "production" },
44
- identity: {
45
- connectorAccess,
46
- operatorAccess: isOwner,
47
- },
48
- });
49
- ```
50
-
51
- After, with the same features except issued tokens:
52
-
53
- ```ts
54
- import { createConnecta } from "@zackbart/connecta";
55
- import { bearerToken } from "@zackbart/connecta/auth/bearer";
56
- import { operatorUi } from "@zackbart/connecta/ui";
57
- import { encryptedCredentialVault } from "@zackbart/connecta/credentials";
58
- import { activityHistory } from "@zackbart/connecta/activity";
59
-
60
- const connecta = createConnecta({
61
- connectors,
62
- executor,
63
- storage,
64
- auth: [bearerToken(token), interactiveAuth],
65
- ui: operatorUi({ branding }),
66
- vault: encryptedCredentialVault(storage, encryptionKey),
67
- activity: activityHistory({ store: activityStore, deploymentId: "production" }),
68
- identity: {
69
- connectorAccess,
70
- credentialAdministration: ({ principal }) =>
71
- principal && isOwner(principal) ? "all" : "none",
72
- personalConnection: () => "all",
73
- activityAccess: isOwner,
74
- },
75
- });
76
- ```
77
-
78
- `personalConnection: () => "all"` permits visible personal connections for
79
- interactive principals. It does not permit shared grant changes or create a
80
- principal for bearer or service identities. Use an explicit list of connector
81
- ids if only some personal connections should be connectable.
82
-
83
- ### Decide permissions explicitly
84
-
85
- A teammate who can use a shared connector should not automatically be able to
86
- replace the credentials everybody uses. Preserve the existing
87
- `connectorAccess` resolver, then add the two management resolvers. They return
88
- `"all"`, `"none"`, or declared connector ids and intersect with visibility.
89
- Thrown resolvers and unknown ids fail closed. Literal deployment-provided
90
- secrets remain configuration; UI permissions do not make them editable.
91
-
92
- For a team Worker using Cloudflare Access:
93
-
94
- ```ts
95
- import { cloudflareAccessAuth } from "@zackbart/connecta/auth/cloudflare-access";
96
-
97
- import type { ConnectaConfig } from "@zackbart/connecta";
98
-
99
- const identity: NonNullable<ConnectaConfig["identity"]> = {
100
- connectorAccess: ({ principal }) =>
101
- principal?.id === "owner-access-id" ? "all" : ["shared_docs", "personal_linear"],
102
- credentialAdministration: ({ principal }) =>
103
- principal?.id === "owner-access-id" ? "all" : "none",
104
- personalConnection: () => ["personal_linear"],
105
- activityAccess: ({ id }) => id === "owner-access-id",
106
- };
107
-
108
- createConnecta({
109
- connectors, executor, storage,
110
- auth: cloudflareAccessAuth(),
111
- identity,
112
- ui: operatorUi(),
113
- vault: encryptedCredentialVault(storage, encryptionKey),
114
- });
115
- ```
116
-
117
- Use ids declared in this deployment and the real identity provider's stable
118
- principal id. The strings above are illustrative, not a BePresent access
119
- policy. Retain the Worker `ctx` forwarding and Worker-level Access application
120
- with Managed OAuth. Access owns admission and identity; these resolvers own
121
- Connecta permissions. Do not introduce a second user roster.
122
-
123
- For a personal Node deployment with Clerk and a configured client bearer:
124
-
125
- ```ts
126
- import type { AuthenticatedIdentity } from "@zackbart/connecta";
127
-
128
- const isOwner = ({ principal }: AuthenticatedIdentity) =>
129
- principal?.id === "owner-clerk-id";
130
-
131
- createConnecta({
132
- connectors, executor, storage,
133
- auth: [bearerToken(token, { subjectId: "static-token" }), clerk],
134
- ui: operatorUi({ branding }),
135
- vault: encryptedCredentialVault(storage, encryptionKey),
136
- identity: {
137
- connectorAccess: () => "all",
138
- credentialAdministration: identity => isOwner(identity) ? "all" : "none",
139
- personalConnection: identity => isOwner(identity) ? "all" : "none",
140
- activityAccess: ({ id }) => id === "owner-clerk-id",
141
- },
142
- });
143
- ```
144
-
145
- This preserves shared-connector MCP access for the configured bearer while
146
- reserving auth changes for the owner signing in through Clerk. The bearer does
147
- not inherit the owner's personal connections. To make invocation owner-only
148
- as well, restrict inbound admission or `connectorAccess` explicitly. Do not
149
- replace an existing identity resolver with `"all"` just to match this example.
150
-
151
- `activityAccess` receives an `IdentityReference` with `id` and `namespace`,
152
- while management resolvers receive an `AuthenticatedIdentity` with `principal`.
153
- `activityAccess` defaults to interactive humans. Set it deliberately for a team
154
- if global activity must remain owner-only. Omitting it is broader than an old
155
- owner-only `operatorAccess` resolver.
156
-
157
- ### Migrate issued-token clients before upgrading
158
-
159
- Connecta no longer issues or authenticates `cta_` tokens. The Tokens tab and
160
- its creation, rename, and revocation endpoints are removed. Existing token
161
- secrets immediately stop admitting requests to the upgraded deployment;
162
- removing `accessTokens` alone does not migrate clients.
163
-
164
- 1. Inventory clients using issued tokens while the old deployment can still
165
- identify them. Do not paste secrets into logs, documentation, or a migration
166
- issue.
167
- 2. Move interactive clients to the configured identity provider's OAuth flow.
168
- On Workers, use Cloudflare Access Managed OAuth and keep the required client
169
- redirect allowlist. On Node, use the configured interactive provider.
170
- 3. If an actual unattended Node client remains, configure the optional
171
- `bearerToken` adapter and update that client. Preserve stable `subjectId`
172
- values for existing configured bearers. On Workers, Access service tokens
173
- provide edge admission; a Connecta bearer alone cannot cross Access.
174
- 4. Verify each replacement client before removing `accessTokens` and deploying
175
- the new package. An issued token previously inherited its creator's personal
176
- principal; a configured bearer does not. Clients needing personal grants
177
- must use a human identity flow.
178
-
179
- Stored issued-token records become inert. They are not deleted automatically
180
- and are not converted into configured bearer credentials. No storage sweep is
181
- required for this upgrade. If rolling back to an older binary, remember that it
182
- understands those old records again; retire or revoke old tokens in the old
183
- system before migration if rollback must not restore them.
184
-
185
- ### Preserve vault and OAuth state
186
-
187
- Pass the existing storage adapter and the same encryption key to
188
- `encryptedCredentialVault`. Do not generate a replacement key as part of this
189
- refactor. Keep connector ids, identity namespaces, principal ids, and owner
190
- partitions stable. The encrypted vault binds connector and owner into its
191
- AES-GCM context; moving records between owners does not migrate ownership.
192
-
193
- No vault record, OAuth grant, or catalog storage-format migration is required.
194
- Downstream OAuth continues to use connector storage, independently of the vault
195
- module. Existing activity stores and retention policies remain deployment-owned;
196
- wrap the existing store in `activityHistory` rather than creating a new database.
197
- A replacement `CredentialVault` must preserve connector and owner isolation.
198
-
199
- ### Omit features you do not need
200
-
201
- Omit `ui` and its import for an API-only deployment. UI shells, data APIs, and
202
- auth mutation routes disappear. Core `/mcp`, `/health`, auth metadata, and OAuth
203
- callbacks remain. An authorized interactive MCP caller can use
204
- `authorize_connector` and complete OAuth without UI. Static credential recovery
205
- returns `unavailable` without a mounted UI or vault, instead of a missing page.
206
- UI-free callbacks use neutral branding and offer no dead return link.
207
-
208
- Omit `activity` and its imports to stop recording and remove the Activity tab.
209
- Remove deployment-only store wiring or database bindings only if nothing else
210
- uses them. Existing history is not deleted. Diagnostic output is separate;
211
- set `logger: "silent"` only when you also want to suppress it.
212
-
213
- Omit `vault` when credentials come entirely from deployment configuration or
214
- OAuth. A connector declaring a vault slot then remains unmanageable; do not
215
- omit it while expecting stored vault credentials to keep resolving.
216
-
217
- There is no generic module list. Keep ordinary explicit imports and the typed
218
- configuration slots. The implementations may ship in the package, but core
219
- does not load them merely because the package is installed.
220
-
221
- ### Verify the upgraded deployment
222
-
223
- - Run the deployment's typecheck and build with the new imports and exact pin.
224
- Keep its connector declarations, executor, and custom routing intact.
225
- - Run `connecta doctor` against the running deployment using its actual inbound
226
- authentication. Confirm the same seven tools and a working executor.
227
- - Sign in as an owner and a teammate. Confirm visibility, shared auth controls,
228
- personal connection controls, and activity access match code. A member may
229
- invoke a shared connector while having no authority to change its grant.
230
- - Open Connections. Its configured list should appear before downstream details;
231
- one slow or failing provider should not delay the other cards. OAuth starts
232
- only after an explicit action, and action feedback does not await other probes.
233
- - Read existing vault-backed and personal OAuth connections without re-entering
234
- secrets. Exercise one permitted auth flow and confirm other principals cannot
235
- manage it. With UI omitted, verify OAuth callback completion and the honest
236
- unavailable response for static credential handoff.
237
- - Update bookmarks and operator instructions to the connection-centered UI.
238
- There is no separate Credentials or Tokens tab. Verify optional Activity and
239
- the absence of UI routes in a deployment that omits the UI.
240
-
241
- Keep the old pin, configuration, and storage backup available until these checks
242
- pass. This guide changes package configuration; it does not authorize or perform
243
- any deployment, credential rotation, or storage deletion.