@eloxiv/cli 0.0.0-stage → 0.1.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.
- package/LICENSE +21 -0
- package/README.md +12 -2
- package/dist/AgentSkills.d.ts +51 -0
- package/dist/AgentSkills.d.ts.map +1 -0
- package/dist/AgentSkills.js +264 -0
- package/dist/AgentSkills.js.map +1 -0
- package/dist/AgentWeb.d.ts +83 -0
- package/dist/AgentWeb.d.ts.map +1 -0
- package/dist/AgentWeb.js +436 -0
- package/dist/AgentWeb.js.map +1 -0
- package/dist/App.d.ts +213 -0
- package/dist/App.d.ts.map +1 -0
- package/dist/App.js +357 -0
- package/dist/App.js.map +1 -0
- package/dist/Blueprint.d.ts +47 -0
- package/dist/Blueprint.d.ts.map +1 -0
- package/dist/Blueprint.js +241 -0
- package/dist/Blueprint.js.map +1 -0
- package/dist/Brand.d.ts +42 -0
- package/dist/Brand.d.ts.map +1 -0
- package/dist/Brand.js +370 -0
- package/dist/Brand.js.map +1 -0
- package/dist/Changelog.d.ts +22 -0
- package/dist/Changelog.d.ts.map +1 -0
- package/dist/Changelog.js +117 -0
- package/dist/Changelog.js.map +1 -0
- package/dist/Cli.d.ts +17 -0
- package/dist/Cli.d.ts.map +1 -0
- package/dist/Cli.js +810 -0
- package/dist/Cli.js.map +1 -0
- package/dist/DbAdmin.d.ts +18 -0
- package/dist/DbAdmin.d.ts.map +1 -0
- package/dist/DbAdmin.js +91 -0
- package/dist/DbAdmin.js.map +1 -0
- package/dist/Dependencies.d.ts +53 -0
- package/dist/Dependencies.d.ts.map +1 -0
- package/dist/Dependencies.js +132 -0
- package/dist/Dependencies.js.map +1 -0
- package/dist/Deploy.d.ts +39 -0
- package/dist/Deploy.d.ts.map +1 -0
- package/dist/Deploy.js +458 -0
- package/dist/Deploy.js.map +1 -0
- package/dist/Docs.d.ts +71 -0
- package/dist/Docs.d.ts.map +1 -0
- package/dist/Docs.js +240 -0
- package/dist/Docs.js.map +1 -0
- package/dist/Doctor.d.ts +56 -0
- package/dist/Doctor.d.ts.map +1 -0
- package/dist/Doctor.js +368 -0
- package/dist/Doctor.js.map +1 -0
- package/dist/Dossier.d.ts +23 -0
- package/dist/Dossier.d.ts.map +1 -0
- package/dist/Dossier.js +92 -0
- package/dist/Dossier.js.map +1 -0
- package/dist/Emit.d.ts +26 -0
- package/dist/Emit.d.ts.map +1 -0
- package/dist/Emit.js +51 -0
- package/dist/Emit.js.map +1 -0
- package/dist/Errors.d.ts +26 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +17 -0
- package/dist/Errors.js.map +1 -0
- package/dist/Evals.d.ts +52 -0
- package/dist/Evals.d.ts.map +1 -0
- package/dist/Evals.js +126 -0
- package/dist/Evals.js.map +1 -0
- package/dist/Files.d.ts +47 -0
- package/dist/Files.d.ts.map +1 -0
- package/dist/Files.js +145 -0
- package/dist/Files.js.map +1 -0
- package/dist/Generate.d.ts +80 -0
- package/dist/Generate.d.ts.map +1 -0
- package/dist/Generate.js +310 -0
- package/dist/Generate.js.map +1 -0
- package/dist/Guards.d.ts +45 -0
- package/dist/Guards.d.ts.map +1 -0
- package/dist/Guards.js +530 -0
- package/dist/Guards.js.map +1 -0
- package/dist/Inspect.d.ts +125 -0
- package/dist/Inspect.d.ts.map +1 -0
- package/dist/Inspect.js +270 -0
- package/dist/Inspect.js.map +1 -0
- package/dist/Keychain.d.ts +57 -0
- package/dist/Keychain.d.ts.map +1 -0
- package/dist/Keychain.js +73 -0
- package/dist/Keychain.js.map +1 -0
- package/dist/Lock.d.ts +13 -0
- package/dist/Lock.d.ts.map +1 -0
- package/dist/Lock.js +145 -0
- package/dist/Lock.js.map +1 -0
- package/dist/Mcp.d.ts +91 -0
- package/dist/Mcp.d.ts.map +1 -0
- package/dist/Mcp.js +128 -0
- package/dist/Mcp.js.map +1 -0
- package/dist/Merge.d.ts +18 -0
- package/dist/Merge.d.ts.map +1 -0
- package/dist/Merge.js +43 -0
- package/dist/Merge.js.map +1 -0
- package/dist/Migrate.d.ts +78 -0
- package/dist/Migrate.d.ts.map +1 -0
- package/dist/Migrate.js +288 -0
- package/dist/Migrate.js.map +1 -0
- package/dist/Plugins.d.ts +36 -0
- package/dist/Plugins.d.ts.map +1 -0
- package/dist/Plugins.js +304 -0
- package/dist/Plugins.js.map +1 -0
- package/dist/Postgres.d.ts +73 -0
- package/dist/Postgres.d.ts.map +1 -0
- package/dist/Postgres.js +294 -0
- package/dist/Postgres.js.map +1 -0
- package/dist/Publish.d.ts +23 -0
- package/dist/Publish.d.ts.map +1 -0
- package/dist/Publish.js +59 -0
- package/dist/Publish.js.map +1 -0
- package/dist/Registry.d.ts +539 -0
- package/dist/Registry.d.ts.map +1 -0
- package/dist/Registry.js +340 -0
- package/dist/Registry.js.map +1 -0
- package/dist/Remote.d.ts +90 -0
- package/dist/Remote.d.ts.map +1 -0
- package/dist/Remote.js +1006 -0
- package/dist/Remote.js.map +1 -0
- package/dist/Run.d.ts +120 -0
- package/dist/Run.d.ts.map +1 -0
- package/dist/Run.js +477 -0
- package/dist/Run.js.map +1 -0
- package/dist/SyncGen.d.ts +118 -0
- package/dist/SyncGen.d.ts.map +1 -0
- package/dist/SyncGen.js +392 -0
- package/dist/SyncGen.js.map +1 -0
- package/dist/Update.d.ts +301 -0
- package/dist/Update.d.ts.map +1 -0
- package/dist/Update.js +627 -0
- package/dist/Update.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +42 -0
- package/dist/bin.js.map +1 -0
- package/dist/docs/backlog.md +56 -0
- package/dist/docs/ci.md +277 -0
- package/dist/docs/cli.md +696 -0
- package/dist/docs/connectors/google.md +115 -0
- package/dist/docs/connectors/http-openapi.md +7 -0
- package/dist/docs/connectors/mcp.md +8 -0
- package/dist/docs/connectors/microsoft-graph.md +75 -0
- package/dist/docs/connectors/openai.md +25 -0
- package/dist/docs/connectors/slack.md +162 -0
- package/dist/docs/connectors/workos.md +39 -0
- package/dist/docs/contracts/README.md +173 -0
- package/dist/docs/contracts/action-consent.md +92 -0
- package/dist/docs/contracts/action-registry.md +85 -0
- package/dist/docs/contracts/actor.md +100 -0
- package/dist/docs/contracts/agent-resources.md +90 -0
- package/dist/docs/contracts/agent-runtime.md +257 -0
- package/dist/docs/contracts/approvals.md +126 -0
- package/dist/docs/contracts/audit.md +75 -0
- package/dist/docs/contracts/auth-provider.md +74 -0
- package/dist/docs/contracts/calendar-provider.md +46 -0
- package/dist/docs/contracts/client-sdk.md +245 -0
- package/dist/docs/contracts/collab-document.md +151 -0
- package/dist/docs/contracts/command.md +44 -0
- package/dist/docs/contracts/connections.md +235 -0
- package/dist/docs/contracts/context-accounting.md +50 -0
- package/dist/docs/contracts/daemon.md +243 -0
- package/dist/docs/contracts/db-tx.md +53 -0
- package/dist/docs/contracts/delegation.md +68 -0
- package/dist/docs/contracts/device-control.md +103 -0
- package/dist/docs/contracts/directory-provider.md +36 -0
- package/dist/docs/contracts/directory.md +161 -0
- package/dist/docs/contracts/document-source.md +33 -0
- package/dist/docs/contracts/files.md +115 -0
- package/dist/docs/contracts/flags.md +83 -0
- package/dist/docs/contracts/host.md +68 -0
- package/dist/docs/contracts/http-api.md +43 -0
- package/dist/docs/contracts/ingestion.md +130 -0
- package/dist/docs/contracts/ingress.md +141 -0
- package/dist/docs/contracts/invocation.md +260 -0
- package/dist/docs/contracts/local-client.md +110 -0
- package/dist/docs/contracts/locale.md +56 -0
- package/dist/docs/contracts/machine-identity.md +117 -0
- package/dist/docs/contracts/mail-provider.md +49 -0
- package/dist/docs/contracts/memory.md +53 -0
- package/dist/docs/contracts/messaging.md +40 -0
- package/dist/docs/contracts/metering.md +139 -0
- package/dist/docs/contracts/model-provider.md +84 -0
- package/dist/docs/contracts/module-manifest.md +213 -0
- package/dist/docs/contracts/notification-channel.md +90 -0
- package/dist/docs/contracts/notifications.md +123 -0
- package/dist/docs/contracts/outbox.md +80 -0
- package/dist/docs/contracts/privacy.md +110 -0
- package/dist/docs/contracts/progress.md +52 -0
- package/dist/docs/contracts/query-surface.md +108 -0
- package/dist/docs/contracts/readiness.md +63 -0
- package/dist/docs/contracts/release.md +142 -0
- package/dist/docs/contracts/result-rendering.md +61 -0
- package/dist/docs/contracts/sandbox.md +186 -0
- package/dist/docs/contracts/scheduler.md +148 -0
- package/dist/docs/contracts/screen-context.md +81 -0
- package/dist/docs/contracts/search.md +120 -0
- package/dist/docs/contracts/secrets.md +74 -0
- package/dist/docs/contracts/settings.md +109 -0
- package/dist/docs/contracts/sharing.md +77 -0
- package/dist/docs/contracts/slot.md +48 -0
- package/dist/docs/contracts/space.md +67 -0
- package/dist/docs/contracts/storage-adapter.md +45 -0
- package/dist/docs/contracts/storage-backend.md +56 -0
- package/dist/docs/contracts/sync.md +213 -0
- package/dist/docs/contracts/telemetry.md +80 -0
- package/dist/docs/contracts/theme-tokens.md +50 -0
- package/dist/docs/contracts/tool-source.md +58 -0
- package/dist/docs/contracts/versioning.md +99 -0
- package/dist/docs/contracts/view.md +65 -0
- package/dist/docs/contracts/work-items.md +99 -0
- package/dist/docs/contracts/workflow.md +82 -0
- package/dist/docs/decisions.md +163 -0
- package/dist/docs/example-app.md +192 -0
- package/dist/docs/getting-started.md +927 -0
- package/dist/docs/goal.md +54 -0
- package/dist/docs/parity.md +29 -0
- package/dist/docs/performance.md +129 -0
- package/dist/docs/registry/README.md +74 -0
- package/dist/docs/registry/app.md +38 -0
- package/dist/docs/registry/approvals-ui-foldkit.md +28 -0
- package/dist/docs/registry/calendar-ui-foldkit.md +27 -0
- package/dist/docs/registry/calendar.md +35 -0
- package/dist/docs/registry/chat-ui-foldkit.md +30 -0
- package/dist/docs/registry/desktop-rune.md +50 -0
- package/dist/docs/registry/desktop.md +32 -0
- package/dist/docs/registry/eloxiv-action.md +25 -0
- package/dist/docs/registry/eloxiv-connector.md +25 -0
- package/dist/docs/registry/eloxiv-module.md +25 -0
- package/dist/docs/registry/eloxiv-policy.md +25 -0
- package/dist/docs/registry/eloxiv-view.md +25 -0
- package/dist/docs/registry/hello-ui-foldkit.md +29 -0
- package/dist/docs/registry/hello.md +39 -0
- package/dist/docs/registry/home-ui-foldkit.md +27 -0
- package/dist/docs/registry/home.md +29 -0
- package/dist/docs/registry/inbox-ui-foldkit.md +27 -0
- package/dist/docs/registry/mail-ui-foldkit.md +27 -0
- package/dist/docs/registry/mail.md +34 -0
- package/dist/docs/registry/meeting-prep.md +26 -0
- package/dist/docs/registry/members-ui-foldkit.md +28 -0
- package/dist/docs/registry/mobile.md +37 -0
- package/dist/docs/registry/notes-ui-foldkit.md +27 -0
- package/dist/docs/registry/notes.md +26 -0
- package/dist/docs/registry/people-ui-foldkit.md +28 -0
- package/dist/docs/registry/people.md +38 -0
- package/dist/docs/registry/shell-foldkit.md +35 -0
- package/dist/docs/registry/theme.md +25 -0
- package/dist/docs/registry/ui-conformance.md +30 -0
- package/dist/docs/release.md +100 -0
- package/dist/docs/scaffold.md +826 -0
- package/dist/docs/security/threat-model.md +299 -0
- package/dist/docs/upstream/zero-cache-socket-handoff.md +105 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/package.json +48 -3
- package/src/AgentSkills.ts +329 -0
- package/src/AgentWeb.ts +507 -0
- package/src/App.ts +435 -0
- package/src/Blueprint.ts +276 -0
- package/src/Brand.ts +415 -0
- package/src/Changelog.ts +136 -0
- package/src/Cli.ts +1458 -0
- package/src/DbAdmin.ts +115 -0
- package/src/Dependencies.ts +170 -0
- package/src/Deploy.ts +563 -0
- package/src/Docs.ts +309 -0
- package/src/Doctor.ts +424 -0
- package/src/Dossier.ts +148 -0
- package/src/Emit.ts +68 -0
- package/src/Errors.ts +18 -0
- package/src/Evals.ts +153 -0
- package/src/Files.ts +152 -0
- package/src/Generate.ts +402 -0
- package/src/Guards.ts +541 -0
- package/src/Inspect.ts +358 -0
- package/src/Keychain.ts +107 -0
- package/src/Lock.ts +174 -0
- package/src/Mcp.ts +159 -0
- package/src/Merge.ts +70 -0
- package/src/Migrate.ts +331 -0
- package/src/Plugins.ts +347 -0
- package/src/Postgres.ts +353 -0
- package/src/Publish.ts +64 -0
- package/src/Registry.ts +405 -0
- package/src/Remote.ts +1158 -0
- package/src/Run.ts +541 -0
- package/src/SyncGen.ts +570 -0
- package/src/Update.ts +873 -0
- package/src/bin.ts +46 -0
- package/src/index.ts +7 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
# The google connector
|
|
2
|
+
|
|
3
|
+
Gmail, Google Calendar, the Google Workspace directory (Admin SDK) and Google Drive, implementing [MailProvider](../contracts/mail-provider.md), [CalendarProvider](../contracts/calendar-provider.md), [DirectoryProvider](../contracts/directory-provider.md) and [DocumentSource](../contracts/document-source.md) over a kernel [Connection](../contracts/connections.md). Plain `fetch` against Google's REST APIs; no SDK.
|
|
4
|
+
|
|
5
|
+
- Registry item: `google` 0.2.0 ([`registry/app/connectors/google`](../../registry/app/connectors/google)), kind `connector`.
|
|
6
|
+
- Proof today: **against real Google** (Gmail, Calendar, the Admin SDK and Drive of the Workspace test domain `agent964.com`), by [`connector-live.test.ts`](../../registry/test/connector-live.test.ts) locally and in CI's `live connector (google)` job, with the kernel on Bun and then on Node; what that covers and what it does not is under [Proven connections](#proven-connections). Against the protocol fake, every check including the ones a real account cannot be driven to ([`connector-google.test.ts`](../../registry/test/connector-google.test.ts), 62 checks and one skipped: the Admin SDK has no cursor to expire).
|
|
7
|
+
|
|
8
|
+
## What it uses
|
|
9
|
+
|
|
10
|
+
| Capability | API | Scope |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Mail | Gmail v1: `users.labels.list`, `users.messages.list` (by label), `users.messages.get` (`format=metadata`/`full`), `users.messages.send` (raw RFC 2822, base64url), `users.drafts.create`, `users.messages.modify`, `users.messages.trash`, `users.getProfile`, `users.history.list`, `users.settings.sendAs.list`; Gmail's own filters, `users.settings.filters` `list`, `create`, `delete` (never one that forwards) | read `gmail.readonly`, write `gmail.modify`, send `gmail.send`, settings `gmail.settings.basic` (filters' writes; asked for by incremental consent when the first filter is made, never when mail connects) |
|
|
13
|
+
| Calendar | Calendar v3: `calendarList.list`, `events.list` (range with `singleEvents`; delta with `syncToken`), `events.get`, `events.insert`, `events.patch`, `events.delete`, `freeBusy`; raw requests (`apiRead`, `apiWrite`) to anything under `<CALENDAR_URL>/calendar/v3`, nothing else on that host (Drive shares it) ([raw provider requests](../contracts/connections.md#raw-provider-requests)) | read `calendar.readonly`, write `calendar.events` |
|
|
14
|
+
| Directory | Admin SDK Directory v1: `users.list` (`customer=my_customer`), `users.get`, `groups.list` | `admin.directory.user.readonly`, `admin.directory.group.readonly` (the signed-in account must be a Workspace administrator) |
|
|
15
|
+
| Documents | Drive v3: `files.list`, `files.get` (`alt=media`, or `files.export` for Google Docs, Sheets, Slides), `changes.getStartPageToken`, `changes.list` | `drive.readonly` |
|
|
16
|
+
| Identity | OpenID Connect `userinfo` | `openid`, `email` |
|
|
17
|
+
|
|
18
|
+
(Scopes are `https://www.googleapis.com/auth/<name>`.)
|
|
19
|
+
|
|
20
|
+
- **Gmail delta** (default label `INBOX`): a full sync takes the profile's `historyId` first, then lists the label's messages; increments follow `history.list` from the stored history id, asking for every `historyTypes` (`messageAdded`, `messageDeleted`, `labelAdded`, `labelRemoved`) and with no `labelId` filter (a message moved out of the label no longer carries it, and the filter would hide the removal). Google documents that history's messages "typically only have id and threadId fields populated", and `labelsAdded`/`labelsRemoved` carry the changed labels beside the message, so no record is judged by labels on its message: a message deleted for good is a delete; every other message a record names is read as it is now: in the label (and not in TRASH or SPAM) an upsert; relabelled out of it (archived, trashed, spam) or gone, a delete; only added and not in the label (never synced), nothing. Nothing a record names is dropped, so the cursor moves only past changes the page reports. A history id older than Gmail keeps is 404 Not Found: `InvalidCursor` (so is one newer than the mailbox's, as the real Gmail answers).
|
|
21
|
+
- **Calendar delta**: a full sync lists events and ends with `nextSyncToken`; increments pass it as `syncToken` (cancelled events are deletes). 410 Gone `fullSyncRequired` (a token Calendar issued and no longer honours) and 400 `invalid` "Invalid sync token value." (one it does not recognise): both `InvalidCursor`.
|
|
22
|
+
- **Directory delta**: the Admin SDK has no delta query, so the connector compares each user's `etag` with a snapshot carried in the cursor (about 30 bytes a user), reports changes in id order, and never expires (`nativeDelta: false`).
|
|
23
|
+
- **Drive delta**: a full sync takes a start page token first, lists every file not in the trash, then follows `changes.list` (`nextPageToken`, then `newStartPageToken`); removed or trashed files are deletes. A page token Drive refuses (400 on `pageToken`) is `InvalidCursor`. Drive's feed reports an uploaded file again a few seconds after the upload (processing: a new `version` and thumbnail, nothing a client changed); the connector reports it as an upsert of the file as it is, so a consumer applies it idempotently.
|
|
24
|
+
- **Errors**: Google's 403 is a rate limit when its reason says so (`userRateLimitExceeded`, `rateLimitExceeded`, also 403 in Gmail and Drive) and is retried with backoff; a missing scope when it says `insufficientPermissions`, `ACCESS_TOKEN_SCOPE_INSUFFICIENT` or `WWW-Authenticate: ... insufficient_scope` (the kernel reports the scopes and offers incremental consent); otherwise a permission the account lacks (the Admin SDK's `forbidden` when the account's admin role lacks the privilege: no missing scopes, no offer). Gmail's 400 `Invalid id value` (an id that is not a Gmail id) is `NotFound`, as a well-formed unknown id's 404 is. 401 refreshes once. 429 and 503 honour `Retry-After`.
|
|
25
|
+
- **Finding a send by its client id** (`findSent`): `sendMessage` carries the client id in a custom header, `X-Eloxiv-Client-Id`, and `findSent` lists the `SENT` label (trash included) and reads each message's metadata for that header only, until it matches. Each read is a `messages.get`, 5 units of Gmail's per-user quota (a batch request costs the same per message), so the scan is bounded, and a message beyond a bound is not found (`found: false`, which proves nothing: the reconciliation records the effect `unknown` and never sends it again):
|
|
26
|
+
- **`sentAfter`** (MailProvider 1.4; the kernel's reconciliation passes when the effect was scheduled): the scan ends after three messages in a row sent more than a minute before it. The minute allows for the caller's clock against Gmail's (servers kept by NTP agree within a second; a clock further off only costs a `found: false`). Three in a row, not the first, because Gmail does not document the list's order (it is newest first in practice): a message listed a little out of order is still read. A lookup right after a send is one list and one to four reads (10 to 25 units).
|
|
27
|
+
- **At most 100 messages and seven days back**, with or without `sentAfter`: an unbounded lookup that finds nothing is 3 lists and 100 reads (515 units).
|
|
28
|
+
- Not a search, neither by header nor by date (`q=in:sent after:<epoch>`): Gmail replaces a sender's `Message-ID` with its own, its search indexes no custom header (below), and its index lags seconds behind a send, while the reconciliation reads back right after one. A label's list is not the search index, so a message is listed the moment it is sent.
|
|
29
|
+
- **A write is never hidden** ([capability contracts](../contracts/README.md#capability-contracts)): `createDraft` reads the draft back after creating it, and reports the draft as written (from the ids `drafts.create` answered, `version` null) if that read fails; `updateMessage` reads the message back after relabelling it, and a failure of that read is `Unavailable` (the labels changed), never a refusal. Every other write is its operation's last request.
|
|
30
|
+
- **Consent**: `access_type=offline` (a refresh token), `include_granted_scopes=true` (incremental authorization: each grant covers every scope granted before) and `prompt=consent`. Google does not rotate refresh tokens; the stored one is kept when a refresh returns none.
|
|
31
|
+
|
|
32
|
+
- **Token origins** (`apiOrigins`): the kernel sends the Connection's token only to the Gmail, Calendar, Admin SDK and Drive endpoints (the `*_URL` settings).
|
|
33
|
+
|
|
34
|
+
## Settings
|
|
35
|
+
|
|
36
|
+
`ELOXIV_CONNECTOR_GOOGLE__<KEY>`: `CLIENT_ID`, `CLIENT_SECRET` (required), and endpoint overrides `AUTHORIZE_URL`, `TOKEN_URL`, `USERINFO_URL`, `GMAIL_URL`, `CALENDAR_URL`, `ADMIN_URL`, `DRIVE_URL` (defaults: Google's public endpoints).
|
|
37
|
+
|
|
38
|
+
## The protocol fake
|
|
39
|
+
|
|
40
|
+
[`packages/testing/src/fakes/GoogleFake.ts`](../../packages/testing/src/fakes/GoogleFake.ts), a local HTTP server following Google's documentation, corrected where the live kits found the real services answering otherwise (each such point says "as the real API"):
|
|
41
|
+
|
|
42
|
+
- **OAuth 2.0**: `/o/oauth2/v2/auth` (PKCE S256 checked; a refresh token only with `access_type=offline`; consent accumulating as with `include_granted_scopes`) and `/token` (refresh tokens not rotated; `{ error: "invalid_grant", error_description: "Token has been expired or revoked." }`); OpenID Connect `/v1/userinfo` (`sub`, `email`); `email` listed back as `userinfo.email`.
|
|
43
|
+
- **Gmail**: system labels; messages listed by label (TRASH and SPAM excluded unless asked); search (`q`) only for `rfc822msgid:`, matching Gmail's own `Message-ID` and only once the message is indexed (`searchIndexDelayMs`, 2 s by default), any other query refused (as the real API: no custom header is searchable); `send` replacing the sender's `Message-ID` with Gmail's own and keeping custom `X-` headers as written (as the real API); `format=metadata|full|minimal` with RFC 2822 headers and base64url bodies (`metadata` keeps only the `metadataHeaders` asked for and no body); `modify`, `trash`, `send` parsing the raw message (a message to oneself lands in the inbox, unread), drafts; `history.list` built from the change log as `messagesAdded`, `messagesDeleted`, `labelsAdded`, `labelsRemoved` records whose messages carry only `id` and `threadId` (the changed labels beside them in `labelIds`), filtered by `historyTypes` and `labelId`, paged, with the mailbox's current `historyId`; 404 for a history id older than the retained history or newer than the mailbox (as the real API); 400 `Invalid id value` for a message id that is not hexadecimal (as the real API); filters (`settings/filters`: list, get, create, delete), listed with a read scope and written with `gmail.settings.basic` (as the real API), `{}` for none, 400 `FAILED_PRECONDITION` for one without a criterion or an action.
|
|
44
|
+
- **Calendar**: `calendarList`, `events.list` with time ranges, paging, `nextSyncToken` on the last page, `syncToken` returning only changes (cancelled events included, carrying only `id` and `status`, as Google guarantees no more for a deleted event), 400 when a sync token is combined with a range, 400 `invalid` "Invalid sync token value." for a token it never issued (as the real API), 410 `fullSyncRequired` for an expired one; insert, get, patch, delete (the event becomes `cancelled`; deleting it again is 410).
|
|
45
|
+
- **Admin SDK**: users (with etags; `customer=my_customer` required; `users` absent from an empty page), groups; 403 `forbidden` "Not Authorized to access this resource/api" for an account whose role lacks the privilege (as the real API).
|
|
46
|
+
- **Drive**: files by parent with `trashed = false`, metadata, `alt=media`; `changes/startPageToken` and `changes` with `removed` and trashed files, `nextPageToken`/`newStartPageToken`; 400 `invalid` on `pageToken` for an expired one; partial responses: only the `fields` asked for (Google's `a,b(c),d/e` syntax), by default a file's `kind`, `id`, `name` and `mimeType` only; an upload's processing change (its `version` bumped) made just after Drive answers its next request, so a cursor taken right after an upload is followed by it, as on the real Drive (deterministic here; `drive.settled()` makes the pending ones at once, the kit's `settle`).
|
|
47
|
+
- **Errors in Google's JSON error formats**: Gmail and the scope errors as `{ error: { code, message, errors: [{ domain, reason, ... }], status, details } }` (401 `UNAUTHENTICATED` with `WWW-Authenticate`; 403 `insufficientPermissions` with `ACCESS_TOKEN_SCOPE_INSUFFICIENT` and `WWW-Authenticate: ... error="insufficient_scope"`; 403 `userRateLimitExceeded`; 429 `RESOURCE_EXHAUSTED` and 503 `UNAVAILABLE` with `Retry-After`; 404 `NOT_FOUND`); Calendar, the Admin SDK and Drive in the older format without `status`, `{ error: { errors: [...], code, message } }` (as the real APIs).
|
|
48
|
+
- **Controls** for the kits: as for the Graph fake, plus Drive/Gmail-style 403 rate limiting, switching the account's administrator status, a log of the API requests received (`requests()`: what a connector asked for, and how often), and seeding a message with its `internalDate` and custom headers (a sent copy carrying a client id).
|
|
49
|
+
- **Not modelled**: search queries beyond `rfc822msgid:` (Gmail) and Drive's parent and trash filters, threads, attachments and multipart bodies, recurring events, shared drives, Google-native file exports, batch requests, and anything outside the endpoints above.
|
|
50
|
+
|
|
51
|
+
## Proven connections
|
|
52
|
+
|
|
53
|
+
Against real Google, the Workspace domain `agent964.com` and its test user `eloxiv-test@agent964.com` (2026-11-04; locally on Node, and in CI's `live connector (google)` job on Bun, run 41873789984 on PR #5 at `d1489f04`, 23 checks passed). Since 2026-11-15 the job has two lanes, the kernel on Bun (plan key `live-google`) and then on Node (`live-google-node`), one after the other in the same job: they share the test account and Gmail's per-user quota, and each seeds and removes its own containers. The same secrets, the same kits and the same exclusions (below) on both; the Node lane runs even when the Bun lane failed, and each passes only on its own report (at least 25 credentialed checks, every kit). First Node lane: run 43721374855 (by hand, `only=live-google-node`, on build/node-lanes at `ad5c0163`), 27 checks passed, every kit.
|
|
54
|
+
|
|
55
|
+
| Proven against the real service | How |
|
|
56
|
+
| --- | --- |
|
|
57
|
+
| A Connection from the test user's refresh token: the kernel's refresh, then every call | `importConnection`, every check below |
|
|
58
|
+
| **MailProvider**: folders (labels), send to oneself, list the inbox, read, mark read, draft, delete (to the trash); NotFound for an unknown id | the kit |
|
|
59
|
+
| `findSent`: a message sent with a client id found by it within the kit's 10 s, with `sentAfter` and without, and an unknown client id not found (2026-11-10, locally; bounded by `sentAfter`, the check takes 2.2 s, from 12 s) | the kit |
|
|
60
|
+
| Gmail delta of a label: full sync, then exactly the changes (an inserted message, one marked read, one trashed), resume after a crash, paging | the kit, over the run's own label |
|
|
61
|
+
| Gmail: a history id the mailbox does not have is 404, read as `InvalidCursor` | `Google's own answers` |
|
|
62
|
+
| **CalendarProvider**: calendars (one primary), create, read, list in a range, update, delete (read back as cancelled) | the kit |
|
|
63
|
+
| Calendar delta: full sync, then exactly the changes (created, updated, deleted as cancelled), resume after a crash, paging with sync tokens | the kit |
|
|
64
|
+
| Calendar: a sync token it does not recognise is 400 `invalid`, read as `InvalidCursor` | `Google's own answers` |
|
|
65
|
+
| **DirectoryProvider**, read-only: users listed page by page (two a page) and read, groups listed, NotFound for an unknown user | the kit, on the domain's existing users |
|
|
66
|
+
| Directory delta (emulated with etag snapshots): the full sync reports the existing users, a sync from its cursor reports nothing, and a crash mid-sync (one user a page) loses or repeats nothing | the kit, read-only (`ExistingItems`) |
|
|
67
|
+
| Admin SDK: a role without a privilege is 403 `forbidden`, read as Forbidden with no scope missing and no consent | seen for groups before Groups → Read was granted (2026-11-04, first live run); now `Google's own answers` lists groups, and asserts the refusal's shape if the privilege is removed |
|
|
68
|
+
| **DocumentSource**: the root lists the run's folder, the folder its file; metadata and content | the kit, over the run's own folder |
|
|
69
|
+
| Drive delta: full sync, then exactly the changes (uploaded, re-uploaded, trashed), resume after a crash, `changes.list` paging (two a page) | the kit, with Drive's feed settled first (below) |
|
|
70
|
+
| Drive: a page token it refuses is 400 on `pageToken`, read as `InvalidCursor` | `Google's own answers` |
|
|
71
|
+
| No token or secret in a failure message | `Google's own answers`; every live error passes `redactor` |
|
|
72
|
+
|
|
73
|
+
What the real services did differently from the fake, each fixed in the connector or the kit and corrected in the fake:
|
|
74
|
+
|
|
75
|
+
- **Gmail answers an id that is not one of its ids with 400** `invalidArgument` "Invalid id value", not 404, so the connector reported `InvalidInput` for a message that does not exist. Now `NotFound` (`classify`).
|
|
76
|
+
- **Calendar answers a sync token it does not recognise with 400** `invalid` "Invalid sync token value.", not 410 `fullSyncRequired`. Now `InvalidCursor` too.
|
|
77
|
+
- **Drive reports an uploaded file again a few seconds later**: one or two more changes (at about 2 and 5 s; its `version` went from 1 to 3 and its thumbnail changed) with nothing a client changed. A cursor taken right after an upload was followed by them, so the exact-delta checks saw extra upserts. The connector's handling is right (an upsert of the file as it is); the kit's seeds now have `settle`, which the delta checks call before each delta they compare: for live Drive a bounded poll until the start page token has not moved for six seconds (at most 90 s), for the fake making its pending processing changes at once. The fake now makes that processing change after its next answer, so without `settle` its kit fails as the live one did.
|
|
78
|
+
- **Error bodies**: Calendar, the Admin SDK and Drive answer in the older JSON error format, without `status`; Gmail and the scope errors carry `status`. The Admin SDK's 403 for a missing privilege has reason `forbidden` and message "Not Authorized to access this resource/api"; a missing scope is `insufficientPermissions` with `ACCESS_TOKEN_SCOPE_INSUFFICIENT` and `WWW-Authenticate: ... error="insufficient_scope", scope="..."`.
|
|
79
|
+
- **Gmail answers a history id newer than the mailbox's with 404**, as for an expired one; and kept the new account's whole history (`startHistoryId=1` answered 200), so expiry cannot be made on demand.
|
|
80
|
+
- **Drive accepts very old page tokens** (`pageToken=1` answered 200 with the account's whole history): no expiry to provoke there either.
|
|
81
|
+
- **Gmail replaces a sender's `Message-ID`** (2026-11-10, the first live run of `findSent`, which failed in CI's `live connector (google)` after build/business-modules merged): `messages.send` with `Message-ID: <clientId@eloxiv>` stored `Message-Id: <...@mail.gmail.com>`, so `rfc822msgid:<clientId@eloxiv>` found nothing in ten minutes of polling. A custom `X-Eloxiv-Client-Id` header is kept on the sent copy as written, but no search finds it (`X-Eloxiv-Client-Id:<id>`, the id as text, quoted, with `in:sent`: nothing in 80 s), while the subject's text is searchable after about 1.5 s and `messages.list?labelIds=SENT` has the message at once. The connector now carries the id in that header and reads it back from the sent messages (above); the fake replaces the `Message-ID`, keeps custom headers, delays its search index and refuses any search it cannot answer as Gmail would, so the connector's old search fails there too.
|
|
82
|
+
- **Gmail's per-user quota runs out within a live run** (2026-11-10, CI runs 42752338534 and 42752342858): the mail kit's resume-after-crash check got 403 "Quota exceeded for quota metric 'Total Query Cost' and limit 'Units per minute per user'", with no `Retry-After`, after the kernel's three attempts (1, 2 and 4 s of backoff). The run's mail checks had spent the minute's units, `findSent`'s 100 metadata reads for each lookup that found nothing among them. Now `findSent` reads back to `sentAfter` only (above), and the live run's kernel uses the connector with `patientConnector`'s limits (`LiveConnection.ts`: 12 attempts within 120 s a request), so the HTTP layer waits out each refused request and sends that request again; a write that went through is never repeated (an operation is never run again as a whole: `createDraft`, which writes and then reads, would make a second draft). The default limits stay short, since the same requests serve people waiting on an answer; past them `RateLimited` names `retryAt`, the sync engine resumes from its committed cursor at its next run, and an external effect runs again after it ([Invocation](../contracts/invocation.md#external-effects)).
|
|
83
|
+
- Unchanged and confirmed: Gmail history records carry only `id` and `threadId` on their messages (`labelsAdded`/`labelsRemoved` beside them); a message sent to oneself is one message labelled `SENT`, `INBOX` and `UNREAD`; the Admin SDK user id is the OpenID `sub`.
|
|
84
|
+
|
|
85
|
+
Not proven against the real service:
|
|
86
|
+
|
|
87
|
+
- **Directory writes**: the test user's admin role has Users → Read and Groups → Read only, and must not write. So the directory delta's changes and deletes (a user created, changed, removed) are proven against the fake only; against Google the delta checks run on the existing users (at least three are needed for the resume check; the domain has four).
|
|
88
|
+
- **A dedicated calendar**: creating a calendar needs `calendar.app.created` (or `calendar`), which the test grant lacks, so the run seeds the primary calendar, every event tagged with the run (`extendedProperties.private.eloxivRun`) and removed after it. A grant with `calendar.app.created` gets a calendar of its own per run, with no code change.
|
|
89
|
+
- **Expired cursors**: a Gmail history id past retention (404), a Calendar sync token past expiry (410 `fullSyncRequired`) and an expired Drive token cannot be produced on demand; their handling is proven against the fake, and the same mappings are exercised live by an id, token or page token the service does not have.
|
|
90
|
+
- **401, refresh failure, 403 missing scope, 429 and 503 with `Retry-After`, the shared cooldown, and Gmail/Drive's 403 rate limits**: the real service cannot be driven to them without revoking the grant or exhausting the project's quota, so they are proven against the fake only. The live run's first call does prove the refresh itself (the imported access token is expired on purpose).
|
|
91
|
+
- **Merged scopes and the consent flow**: a browser consent cannot be automated; the Connection is imported from the refresh token.
|
|
92
|
+
- Shared drives, Google-native exports (Docs, Sheets, Slides), attachments and multipart bodies, recurring events.
|
|
93
|
+
|
|
94
|
+
## Real-account setup (for the coordinator)
|
|
95
|
+
|
|
96
|
+
1. **A Google Workspace test domain** with a test user who holds a custom admin role with **Users → Read** and **Groups → Read** (and nothing else: the live run only reads the directory). A consumer Gmail account cannot use the Admin SDK. The domain needs at least three users.
|
|
97
|
+
2. **A Google Cloud project** (<https://console.cloud.google.com>):
|
|
98
|
+
- Enable the **Gmail API**, **Google Calendar API**, **Admin SDK API** and **Google Drive API**.
|
|
99
|
+
- OAuth consent screen: user type **Internal** (only the Workspace's users; no verification needed), app name `Eloxiv connector test`, and the scopes below.
|
|
100
|
+
- Credentials → Create OAuth client ID → **Web application**; authorised redirect URIs: `http://localhost:4100/connections/callback`, `http://localhost:4199/connections/callback`, the deployment's `<ELOXIV_BASE_URL>/connections/callback`, and `https://developers.google.com/oauthplayground` (to obtain the test refresh token).
|
|
101
|
+
3. **Scopes** (`https://www.googleapis.com/auth/` prefix): `gmail.readonly`, `gmail.modify`, `gmail.send`, `calendar.readonly`, `calendar.events`, `admin.directory.user.readonly`, `admin.directory.group.readonly`, `drive.readonly`, plus `openid` and `email`. For the live run's seeding also `drive.file` (its own folder and files), and optionally `calendar.app.created` (a calendar of its own per run instead of tagged events in the primary calendar).
|
|
102
|
+
4. **What a live run writes**, all in the test user's own account and named with the run's id `eloxiv-kit-<UTC yyyymmddhhmm>-<random>`: a hidden Gmail label with messages inserted into it (no delivery), events tomorrow (in its own calendar, or tagged in the primary one), and a Drive folder with text files; the mail kit also sends one message to itself and saves one draft (`conformance <uuid>`). After the run, failed or not, the label's messages are trashed (the grant cannot delete mail for good; Gmail empties the trash after 30 days), the label, events, draft, files and folder deleted. A run that could not clean up (a cancelled job) leaves them for the next run, which removes any older than six hours. Run one at a time per account (CI's concurrency group).
|
|
103
|
+
5. **A refresh token for the test user**: in the [OAuth 2.0 Playground](https://developers.google.com/oauthplayground), settings → *Use your own OAuth credentials* (the client id and secret), *Access type: Offline*; authorise all the scopes above as the test user; *Exchange authorization code for tokens*; keep `refresh_token`. The user's `sub` is `id` in `GET https://openidconnect.googleapis.com/v1/userinfo` with the access token.
|
|
104
|
+
6. **Variables**, locally from a mode-0600 file and never printed (for example `node --env-file=<file>`, or `set -a; . <file>; set +a` in a subshell), then `ELOXIV_SKIP_E2E=1 mise exec -- tools/scripts/test.sh --project registry registry/test/connector-live.test.ts` (the kernel on Bun; with `ELOXIV_RUNTIME=node`, the test runner and the kernel on Node); in CI the same names as repository secrets, which reach only the job's two test steps. `gh workflow run ci.yml --ref <branch> -f only=live-google-node` (or `live-google`) runs one lane by hand, without the rest of CI:
|
|
105
|
+
|
|
106
|
+
| Variable | Value |
|
|
107
|
+
| --- | --- |
|
|
108
|
+
| `ELOXIV_GOOGLE_TEST_CLIENT_ID` | the OAuth client's id |
|
|
109
|
+
| `ELOXIV_GOOGLE_TEST_CLIENT_SECRET` | its secret |
|
|
110
|
+
| `ELOXIV_GOOGLE_TEST_REFRESH_TOKEN` | the test user's refresh token |
|
|
111
|
+
| `ELOXIV_GOOGLE_TEST_USER` | the test user's email address |
|
|
112
|
+
| `ELOXIV_GOOGLE_TEST_USER_ID` | the test user's `sub` (also its directory user id) |
|
|
113
|
+
| `ELOXIV_GOOGLE_TEST_DOMAIN` | the Workspace domain |
|
|
114
|
+
|
|
115
|
+
An Internal app's refresh tokens do not expire after seven days (that limit applies to External apps in testing). The live run skips the checks that need a fake's controls and the consent flow; a pull request from a fork gets no secrets, and CI's job says so and passes without running. A live run takes about three minutes a lane, most of it Drive's feed settling.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# HTTP/OpenAPI connector
|
|
2
|
+
|
|
3
|
+
The registry's `http-openapi` connector ([`registry/app/connectors/http-openapi`](../../registry/app/connectors/http-openapi), installed with `eloxiv add http-openapi`; setup in its [README](../../registry/app/connectors/http-openapi/README.md)) implements [HttpApi](../contracts/http-api.md) over kernel endpoint Connections ([Connections, "Endpoint Connections"](../contracts/connections.md#endpoint-connections)).
|
|
4
|
+
|
|
5
|
+
- **Configuration**: none of its own. People add Connections with `connections.add`; a deployment allows endpoints on private addresses only with `ELOXIV_OUTBOUND_ALLOW`.
|
|
6
|
+
- **Credentials**: none, a secret the kernel holds (named, never given), or OAuth the kernel discovers from the endpoint. The connector never sees them.
|
|
7
|
+
- **Proven against**: the protocol fake in `packages/testing/src/fakes` (`registry/test/connector-http-openapi.test.ts`), not a real service.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# MCP connector
|
|
2
|
+
|
|
3
|
+
The registry's `mcp` connector ([`registry/app/connectors/mcp`](../../registry/app/connectors/mcp), installed with `eloxiv add mcp`; setup in its [README](../../registry/app/connectors/mcp/README.md)) implements [ToolSource](../contracts/tool-source.md) over kernel endpoint Connections ([Connections, "Endpoint Connections"](../contracts/connections.md#endpoint-connections)).
|
|
4
|
+
|
|
5
|
+
- **Configuration**: none of its own. People add Connections with `connections.add`; a deployment allows endpoints on private addresses only with `ELOXIV_OUTBOUND_ALLOW`.
|
|
6
|
+
- **Credentials**: none, a secret the kernel holds (named, never given), or OAuth the kernel discovers from the endpoint. The connector never sees them.
|
|
7
|
+
- **MCP Apps**: a tool's `_meta.ui` is reported (`RemoteTool.ui`) and its `ui://` view read with `readResource`, for the kernel's headless MCP App sessions (`connections.openApp`, `appCall`, `closeApp`; [ToolSource, "MCP App sessions"](../contracts/tool-source.md#mcp-app-sessions)). Version 0.2.0.
|
|
8
|
+
- **Proven against**: the protocol fake in `packages/testing/src/fakes` (`registry/test/connector-mcp.test.ts`), not a real service.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# The microsoft-graph connector
|
|
2
|
+
|
|
3
|
+
Outlook mail, calendars, the Entra ID directory and OneDrive over Microsoft Graph v1.0, implementing [MailProvider](../contracts/mail-provider.md), [CalendarProvider](../contracts/calendar-provider.md), [DirectoryProvider](../contracts/directory-provider.md) and [DocumentSource](../contracts/document-source.md) over a kernel [Connection](../contracts/connections.md). Plain `fetch` against Graph's REST API; no SDK.
|
|
4
|
+
|
|
5
|
+
- Registry item: `microsoft-graph` 0.2.0 ([`registry/app/connectors/microsoft-graph`](../../registry/app/connectors/microsoft-graph)), kind `connector`.
|
|
6
|
+
- Proof today: **proven against a protocol fake, not the real service** ([`registry/test/connector-microsoft-graph.test.ts`](../../registry/test/connector-microsoft-graph.test.ts), 51 checks; the sync engine in [`connection-sync.test.ts`](../../registry/test/connection-sync.test.ts)). A live run is not required (owner decision, 2026-11-17: a built connector proven by its protocol kits needs no live proof; bugs found against the real service are fixed as they come). Against a real tenant: [`connector-live.test.ts`](../../registry/test/connector-live.test.ts) runs once the variables below are set.
|
|
7
|
+
|
|
8
|
+
## What it uses
|
|
9
|
+
|
|
10
|
+
| Capability | Graph v1.0 | Delegated permission |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Mail | `GET /me/mailFolders` (and `/me/mailFolders/{inbox,sentitems,drafts,deleteditems,archive,junkemail}` to map well-known folders), `GET /me/mailFolders/{id}/messages`, `GET /me/messages/{id}`, `POST /me/sendMail` (202), `POST /me/messages` (draft), `PATCH /me/messages/{id}`, `POST /me/messages/{id}/move`, `DELETE /me/messages/{id}` (to Deleted Items), `GET /me/mailFolders/{id}/messages/delta`. No server-side filters (MailProvider's `filters` flag false: Outlook's inbox rules are another model and scope; the filter operations answer `InvalidInput`) | read `Mail.Read`, write `Mail.ReadWrite`, send `Mail.Send` |
|
|
13
|
+
| Calendar | `GET /me/calendars`, `GET /me/calendar`, `GET /me/calendarView` and `/me/calendars/{id}/calendarView`, `GET/PATCH/DELETE /me/events/{id}`, `POST /me/calendars/{id}/events`, `POST /me/events/{id}/{accept,decline,tentativelyAccept}`, `GET /me/calendarView/delta` (windowed), `POST /me/calendar/getSchedule`; raw requests (`apiRead`, `apiWrite`) to `<GRAPH_URL>/v1.0/me` under `/calendar`, `/calendars`, `/calendarGroups`, `/calendarView`, `/events` and `/findMeetingTimes` only: never the account's mail, files or anyone else ([raw provider requests](../contracts/connections.md#raw-provider-requests)) | read `Calendars.Read`, write `Calendars.ReadWrite` |
|
|
14
|
+
| Directory | `GET /users`, `GET /users/{id}`, `GET /groups`, `GET /users/delta` | `User.Read.All`, `GroupMember.Read.All` (both need an administrator's consent) |
|
|
15
|
+
| Documents | `GET /me/drive/root/children`, `/me/drive/items/{id}`, `/children`, `/content` (302 to a download URL, followed), `GET /me/drive/root/delta` | `Files.Read` |
|
|
16
|
+
| Identity | `GET /me` | `User.Read`, plus `offline_access` and `openid` |
|
|
17
|
+
|
|
18
|
+
- **Delta**: the connector keeps Graph's `@odata.nextLink` (more pages) or `@odata.deltaLink` (up to date) as the opaque cursor; `@removed` entries (and drive items with a `deleted` facet, and cancelled events) are deletes. A cursor is followed only if it points at the configured Graph origin. Pages are sized with `Prefer: odata.maxpagesize`. An expired delta token (410 Gone, `syncStateNotFound`/`resyncRequired`) is `InvalidCursor`.
|
|
19
|
+
- **Directory delta**: Graph represents an updated user "by their id with at least the updated properties", so an entry lacking any selected property is read whole (`GET /users/{id}`; gone meanwhile, a delete). A removed user (`@removed`, reason `changed` while restorable from deleted items, or `deleted`) is a delete.
|
|
20
|
+
- **Calendar delta** uses `calendarView/delta` with a window (default 90 days back, 365 ahead; `ELOXIV_CONNECTOR_MICROSOFT_GRAPH__CALENDAR_PAST_DAYS`, `__CALENDAR_FUTURE_DAYS`), because Graph v1.0 documents event delta only on a calendar view; the windowless `/me/events/delta` is beta-only and not used. The window is fixed when a full sync starts.
|
|
21
|
+
- **Ids**: mail and calendar requests send `Prefer: IdType="ImmutableId"` (ids survive moves) and `Prefer: outlook.timezone="UTC"`.
|
|
22
|
+
- **Errors**: Graph's 403s (`ErrorAccessDenied`, `Authorization_RequestDenied`, `accessDenied`) do not name the missing permission, so the kernel reports the operation's permissions as missing and offers incremental consent. 401 `InvalidAuthenticationToken` refreshes once. 429 (`TooManyRequests`, `ApplicationThrottled`) and 503 honour `Retry-After`. Concurrency is limited to 4 requests per Connection (Outlook's per-mailbox limit).
|
|
23
|
+
- **Tokens**: Microsoft rotates refresh tokens; the kernel stores each new one under its refresh lock.
|
|
24
|
+
- **A write is never hidden** ([capability contracts](../contracts/README.md#capability-contracts)): `updateMessage` with both a read state and a folder (or `archive`) writes twice, `PATCH` then `move`; a refused `move` after the `PATCH` is `Unavailable` (the read state changed), never a refusal (0.1.4). Every other write is its operation's last request.
|
|
25
|
+
- **Client ids** (`sendMessage.clientId`, `findSent`), **not yet verified against the real service** (the test tenant has no licence; a live run is not required, owner decision, 2026-11-17). Microsoft's documentation of the message resource says nothing about a supplied `internetMessageId` surviving `sendMail` (or `createReply`, which the connector does not use: a reply is a `sendMail` too), nor about searching by one, so the connector does not rely on it. A message carries its client id twice: as a custom internet message header, `x-eloxiv-client-id` (the docs: custom headers may be added only when a message is created, named `x-`; they are read-only after it is sent and returned only with `$select`, never filterable), and as a string single-value extended property, `String {7c3e2f4a-8d1b-4e6a-9f0c-2b5d8e1a4c7f} Name EloxivClientId` (the docs: settable on a new message, and filterable with `eq` on its id and value). `findSent` asks `GET /me/mailFolders/sentitems/messages?$filter=singleValueExtendedProperties/Any(ep: ep/id eq '…' and ep/value eq '<clientId>')&$select=id&$top=1`. What to check once the tenant is licensed: that the property reaches the Sent Items copy of a `sendMail` message (`saveToSentItems: true`), and how long Graph takes to file it (until then a lost answer whose message is not found yet stays `unknown`, never resent).
|
|
26
|
+
- **The account's own answer** (`CalendarEvent.selfResponse`): the event's `responseStatus` (`organizer`, `accepted`, `tentativelyAccepted`, `declined`, `notResponded`, `none`), which Graph keeps for the mailbox owner whatever address they were invited under. The kernel reconciles an interrupted answer by it, never by matching an attendee's address to the Connection's label.
|
|
27
|
+
|
|
28
|
+
- **Token origins** (`apiOrigins`): the kernel sends the Connection's token only to the Graph endpoint (`GRAPH_URL`); `/content` redirects to a download host are followed without it.
|
|
29
|
+
|
|
30
|
+
## Settings
|
|
31
|
+
|
|
32
|
+
`ELOXIV_CONNECTOR_MICROSOFT_GRAPH__<KEY>`: `CLIENT_ID`, `CLIENT_SECRET` (required), `TENANT` (default `common`; a tenant id or `organizations` for work accounts only), `AUTHORITY_URL` (default `https://login.microsoftonline.com`), `GRAPH_URL` (default `https://graph.microsoft.com`), the calendar window above.
|
|
33
|
+
|
|
34
|
+
## The protocol fake
|
|
35
|
+
|
|
36
|
+
[`packages/testing/src/fakes/MicrosoftGraphFake.ts`](../../packages/testing/src/fakes/MicrosoftGraphFake.ts), a local HTTP server following Microsoft's documentation:
|
|
37
|
+
|
|
38
|
+
- **Identity platform v2.0**: `/{tenant}/oauth2/v2.0/authorize` and `/token`; authorization code with PKCE S256 (the verifier checked), `redirect_uri` checked against the authorization, codes single use; refresh tokens **rotated, the used one refused**; consent accumulates per account; the token response's `scope` lists Graph scopes with their `https://graph.microsoft.com/` prefix and omits `openid`, `profile`, `email`, `offline_access`; AADSTS-style error bodies (`error`, `error_description`, `error_codes`, `trace_id`, `correlation_id`).
|
|
39
|
+
- **Graph**: every endpoint above, scope-checked per endpoint the way Graph's permissions reference says (reads accept `Mail.Read` or `Mail.ReadWrite`, and so on); paging with `$top`/`$skip`/`$skiptoken` and `@odata.nextLink`; delta with `$skiptoken`/`$deltatoken` links, an initial listing then changes since the delta link, net changes per item, `@removed: { reason: "deleted" }` (`changed` for a deleted user, which stays restorable), a changed user carrying only its id and changed properties, drive `deleted` facets and the root item in drive delta, `Prefer: odata.maxpagesize`; 410 Gone for an expired token; `sendMail` answering 202 and delivering to the sender's own inbox when addressed to themselves; deletes moving mail to Deleted Items; `/content` answering 302 to a pre-authenticated download URL.
|
|
40
|
+
- **Errors in Graph's shape**: `{ error: { code, message, innerError: { date, request-id, client-request-id } } }`; 401 with `WWW-Authenticate`; 403 per area; 404 per area; 429 and 503 with `Retry-After`.
|
|
41
|
+
- **Controls** for the kits: invalidate access tokens, revoke refresh tokens, withdraw scopes (the token keeps claiming them; the API answers 403), throttle the next requests, lose the next answers (carried out, then answered 503), expire every delta cursor, count API requests and refreshes, seed and change items as another client would (an invitation under an alias with its own `responseStatus`, say).
|
|
42
|
+
- **Messages** keep the custom headers and extended properties they were created with; headers and properties are never returned in a message (as Graph returns neither without `$select` or `$expand`), and a folder's messages (or all of them) can be filtered by a string extended property's id and value, the one `$filter` the fake answers (another is refused with 400). **Events** keep the owner's `responseStatus`, set by `accept`, `decline` and `tentativelyAccept`.
|
|
43
|
+
- **Not modelled**: `$select`/`$filter`/`$orderby` semantics beyond the above (accepted, not applied, except folder and window filters), attachments, recurring series, shared mailboxes, `Location` headers on 410, throttling budgets of its own, and anything outside the endpoints above.
|
|
44
|
+
|
|
45
|
+
## Real-account setup (for the coordinator)
|
|
46
|
+
|
|
47
|
+
1. **A test tenant.** A Microsoft 365 developer programme tenant (E5 sandbox with sample users), or any work tenant where you are a Global Administrator. Personal Microsoft accounts are not enough: the directory needs a work tenant.
|
|
48
|
+
2. **An app registration** (Entra admin centre → App registrations → New registration):
|
|
49
|
+
- Name `Eloxiv connector test`; supported account types: *Accounts in this organizational directory only* (single tenant) for the test tenant.
|
|
50
|
+
- Platform *Web*; redirect URIs: `http://localhost:4100/connections/callback` (the dev kernel), `http://localhost:4199/connections/callback` (the isolated test kernel), and the deployment's `<ELOXIV_BASE_URL>/connections/callback`.
|
|
51
|
+
- Certificates & secrets → a client secret (note its value once).
|
|
52
|
+
- API permissions → Microsoft Graph → **Delegated**: `offline_access`, `openid`, `User.Read`, `Mail.Read`, `Mail.ReadWrite`, `Mail.Send`, `Calendars.Read`, `Calendars.ReadWrite`, `User.Read.All`, `GroupMember.Read.All`, `Files.Read`. For the live kit's seeding also `User.ReadWrite.All` (create and delete test users) and `Files.ReadWrite` (upload test files). Then **Grant admin consent** for the tenant.
|
|
53
|
+
3. **A test user**: the developer tenant's admin, or a licensed user with a mailbox and OneDrive (sign in once at <https://outlook.office.com> and <https://onedrive.com> so both are provisioned). The live kit sends mail to itself, creates events tomorrow, creates disabled users named `eloxiv-kit-*`, and uploads `eloxiv-kit-*.txt` files to the OneDrive root; it deletes what it changes where it can.
|
|
54
|
+
4. **A refresh token for the test user**, obtained once with the authorization code flow (the live kit imports it; a browser consent cannot be automated):
|
|
55
|
+
```sh
|
|
56
|
+
# open in a browser, sign in as the test user, consent; copy `code` from the address bar it redirects to
|
|
57
|
+
https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/authorize?client_id=<client-id>&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A4199%2Fconnections%2Fcallback&response_mode=query&scope=offline_access%20openid%20User.Read%20Mail.ReadWrite%20Mail.Send%20Calendars.ReadWrite%20User.ReadWrite.All%20GroupMember.Read.All%20Files.ReadWrite
|
|
58
|
+
xh --form POST https://login.microsoftonline.com/<tenant-id>/oauth2/v2.0/token client_id=<client-id> client_secret=<secret> grant_type=authorization_code code=<code> redirect_uri=http://localhost:4199/connections/callback
|
|
59
|
+
```
|
|
60
|
+
Keep `refresh_token` from the answer, and the user's object id (`GET https://graph.microsoft.com/v1.0/me` with the access token, field `id`).
|
|
61
|
+
5. **Variables** (through `request_secret`, never in chat), then `mise exec -- bun --bun vitest run --project registry registry/test/connector-live.test.ts`:
|
|
62
|
+
|
|
63
|
+
| Variable | Value |
|
|
64
|
+
| --- | --- |
|
|
65
|
+
| `ELOXIV_GRAPH_TEST_CLIENT_ID` | the app registration's client id |
|
|
66
|
+
| `ELOXIV_GRAPH_TEST_CLIENT_SECRET` | its secret |
|
|
67
|
+
| `ELOXIV_GRAPH_TEST_TENANT` | the tenant id |
|
|
68
|
+
| `ELOXIV_GRAPH_TEST_REFRESH_TOKEN` | the test user's refresh token |
|
|
69
|
+
| `ELOXIV_GRAPH_TEST_USER` | the test user's email address |
|
|
70
|
+
| `ELOXIV_GRAPH_TEST_USER_ID` | the test user's object id |
|
|
71
|
+
| `ELOXIV_GRAPH_TEST_DOMAIN` | the tenant's domain (`contoso.onmicrosoft.com`), for test users |
|
|
72
|
+
|
|
73
|
+
Microsoft rotates refresh tokens and the kernel stores the new one in the test database only: a variable's token stays valid (90 days of inactivity, unless revoked), so the same value can be reused across runs.
|
|
74
|
+
|
|
75
|
+
The live run skips the checks that need a fake's controls (expired tokens, throttling, withdrawn scopes, expired cursors) and the consent flow (merged scopes); real Graph is eventually consistent, so its delta checks may need waits tuned once they run.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# The openai model connector
|
|
2
|
+
|
|
3
|
+
OpenAI's models as a [ModelProvider](../contracts/model-provider.md) for the [agent runtime](../contracts/agent-runtime.md), through the Vercel AI SDK's `@ai-sdk/openai` (decisions.md: the AI SDK behind ModelProvider). It also serves any OpenAI-compatible endpoint (a gateway, a local model server such as Ollama's `/v1`) through `base_url`. It is a model connector, not a kernel Connection: the app lists it in `KernelApp.agent.providers`, not in `KernelApp.connectors`.
|
|
4
|
+
|
|
5
|
+
- Registry item: `openai` 0.1.1 ([`registry/app/connectors/openai`](../../registry/app/connectors/openai)), kind `connector`, provides `ModelProvider`. Exports `openaiProvider(options)` and `OPENAI_MODELS`. Setup is in the item's README.
|
|
6
|
+
- Proof: against OpenAI's API, locally on 2026-11-09 with `gpt-5-mini` ([`registry/test/agent-real-model.test.ts`](../../registry/test/agent-real-model.test.ts): the ModelProvider kit and the agent runtime end to end, 11 checks; and the skill evals, below). In CI, the `model live` workflow (`.github/workflows/model-live.yml`, on pushes to main and build/** only, never on pull requests) runs both (the evals once; a run started by hand may repeat them up to five times, `eval_repeat`, and limit them to some modules, `eval_modules`) on Bun and on Node, two lanes of one run, with the repository secret `ELOXIV_MODEL_OPENAI_API_KEY`. Without a key, [`registry/test/model-openai.test.ts`](../../registry/test/model-openai.test.ts) checks the connector against an OpenAI-compatible fake (credentials, endpoint, streaming, a clear failure without a key).
|
|
7
|
+
|
|
8
|
+
## Credentials
|
|
9
|
+
|
|
10
|
+
Only what the kernel's `ModelCredentials` resolves for the calling organisation. **The default resolver shares one key across every organisation**; for a key per organisation, give `KernelApp.agent.credentials` a `ModelCredentials` of your own (the item's README shows one). By default: by default `ELOXIV_MODEL_OPENAI_API_KEY` (credential `api_key`, required), `ELOXIV_MODEL_OPENAI_BASE_URL` (`base_url`), `ELOXIV_MODEL_OPENAI_ORGANIZATION` and `_PROJECT`. The connector never lets the SDK read `OPENAI_API_KEY` from the environment: with no `api_key` resolved, building the model throws, and the kernel fails the call with `ModelUnavailable` (a run ends `failed`, `model-error`) before anything is sent. An organisation's key goes only to that organisation's calls. `base_url` must be https without credentials in it; plain http is accepted only to `localhost`, `127.0.0.1` or `::1`, and only with `allowLocalHttp: true` on the provider. A failed call reaches clients as a `ModelUnavailable` with a reason and a fixed message ([ModelProvider](../contracts/model-provider.md)); the provider's error text goes only to the kernel's log, redacted.
|
|
11
|
+
|
|
12
|
+
## What it does
|
|
13
|
+
|
|
14
|
+
| | |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| API | OpenAI's Responses API by default (`openai.responses(model)`); `api: "chat"` uses Chat Completions, which most compatible servers speak |
|
|
17
|
+
| Tool calls | returned by the SDK, never executed by it: the kernel runs each through the invocation path |
|
|
18
|
+
| Streaming | the agent runtime streams every model step (`streamText`); deltas reach the run's event stream as `text-delta` |
|
|
19
|
+
| Structured output | `generateObject` (the kernel's `complete` with a schema) |
|
|
20
|
+
| Usage and cost | the provider's token counts per call, priced from the model's `pricing` (`OPENAI_MODELS` carries OpenAI's list prices for `gpt-5`, `gpt-5-mini`, `gpt-5-nano`; an app lists what it pays) |
|
|
21
|
+
| Models | only those listed; any other is refused with `ModelUnavailable` |
|
|
22
|
+
|
|
23
|
+
## What a real model showed
|
|
24
|
+
|
|
25
|
+
Running the agent on a real model found two things the scripted model never did, both fixed in the kernel ([Delegation](../contracts/delegation.md)): offered free-form tool names, the model gave a sub-agent `functions.notebook_write` (OpenAI's internal namespace), so the delegate tool now lists its choices; and it asked for a sub-agent `maxTokens` of 1,500, below one call's output limit, so the child stopped without acting: such a request is now refused with the reason. The skill evals showed where the skill documents and descriptions left the model unsure (whether to ask before posting a private greeting, what to say after posting, where to check that a greeting was noted, sending `key: null`, answering "what can I see" without reading the view); their guidance was rewritten (hello 0.6.1 and 0.6.2, notes 0.6.1), with scores before and after in [progress.md](../progress.md) ("build/agent-evals").
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# The slack connector
|
|
2
|
+
|
|
3
|
+
A Slack app as a channel to and from the app: [Messaging](../contracts/messaging.md) over a kernel [Connection](../contracts/connections.md) made by Slack's OAuth v2 install with bot scopes, and Slack's Events API received through the kernel's [Ingress](../contracts/ingress.md). Plain `fetch` against Slack's Web API; no SDK.
|
|
4
|
+
|
|
5
|
+
- Registry item: `slack` 0.2.2 ([`registry/app/connectors/slack`](../../registry/app/connectors/slack)), kind `connector`. Exports `slack` (the connector), `slackEvents` (the Ingress source), `slackMessage`, `parseSlackEvent`, `linkCodeOf`, `urlVerification`.
|
|
6
|
+
- Proof today: the Messaging kit and Slack's own semantics against a protocol fake ([`registry/test/connector-slack.test.ts`](../../registry/test/connector-slack.test.ts), Bun and Node), and the Messaging kit against **the real Eloxiv Test workspace**: [`connector-slack-live.test.ts`](../../registry/test/connector-slack-live.test.ts) passed all four checks on 2026-11-09 from a local machine (81 s; Slack's own Events API deliveries through a cloudflared quick tunnel, the Request URL verified by Slack through Ingress), and runs in CI's `slack live` workflow.
|
|
7
|
+
|
|
8
|
+
## What it uses
|
|
9
|
+
|
|
10
|
+
| Operation | Web API | Bot scopes |
|
|
11
|
+
| --- | --- | --- |
|
|
12
|
+
| Identify the account | `auth.test` (`team_id`; the Enterprise id for an organisation-wide install) | none |
|
|
13
|
+
| `listChannels` | `conversations.list` (`types=public_channel,private_channel,mpim,im`, `exclude_archived`, cursors) | `channels:read`, `groups:read`, `im:read`, `mpim:read` |
|
|
14
|
+
| `listMessages` (channel) | `conversations.history` (cursors) | `channels:history`, `groups:history`, `im:history`, `mpim:history` |
|
|
15
|
+
| `listMessages` (thread) | `conversations.replies` (cursors) | the same |
|
|
16
|
+
| `sendMessage` | `chat.postMessage` (`thread_ts` for a reply) | `chat:write` |
|
|
17
|
+
| `receive` | none: parses an Events API delivery | none |
|
|
18
|
+
|
|
19
|
+
`messaging.read` asks for all eight read scopes and `messaging.write` for `chat:write`; `connections.connect` with `capabilities: ["messaging"]` asks for all nine. Extra scopes go in `scopes`, and only those the connector declares (asked for only by name): `chat:write.public` (to post in public channels the bot has not joined), `app_mentions:read` and `incoming-webhook`; any other is refused (`InvalidInput`).
|
|
20
|
+
|
|
21
|
+
- **The install.** OAuth v2 at `https://slack.com/oauth/v2/authorize` with the bot scopes comma-separated in `scope`, exchanged at `oauth.v2.access`. The Connection's account is the workspace (`team_id` from `auth.test`), its label the workspace's name: **one Connection per workspace and installing person**. Installing again in the same workspace, with more scopes or none, upgrades the same Connection and merges its scopes (Slack's answer lists every scope granted to the app in the workspace). The same person in another workspace gets a second Connection; another person in the same workspace gets their own (and the same bot token, without token rotation: Slack issues one per app and workspace).
|
|
22
|
+
- **No PKCE.** Slack takes PKCE only from apps marked as public clients, a one-way setting under which refresh tokens expire after 30 days, and answers a server app's PKCE with `pkce_not_allowed`. The connector sets `pkce: false`; the flow rests on the client secret and the state bound to the person's session (see [Connections, "Provider quirks"](../contracts/connections.md#provider-quirks)).
|
|
23
|
+
- **Tokens.** Without token rotation (Slack's default, and the manifest below) the bot token never expires and there is no refresh token: an `invalid_auth`, `token_revoked` or `account_inactive` (the app was uninstalled) marks the Connection for reauthorisation at once, and its owner is notified. With token rotation the access token lasts 12 hours, the kernel refreshes it ahead of expiry at `oauth.v2.access` with `grant_type=refresh_token`, and stores the rotated refresh token under the refresh lock (Slack's refresh tokens work once); a refused refresh (`200 { ok: false, error: "invalid_refresh_token" }`) needs reauthorisation, Slack's own failures (`internal_error`, `service_unavailable`, ...) are retried later.
|
|
24
|
+
- **Errors.** Slack answers every error but a rate limit `200 { ok: false, error }`; the connector's `classifySuccess` hands it to the kernel's rules: authentication errors are `unauthorized`, `missing_scope` is a missing scope (`Forbidden` naming the operation's scopes, with an offer of `connections.reconnect`), `channel_not_found` and `thread_not_found` are `NotFound`, `not_in_channel`, `is_archived` and `restricted_action` are `Forbidden` without a scope to offer, `invalid_cursor` is `InvalidCursor`, argument errors are `InvalidInput`, anything else `Unavailable`.
|
|
25
|
+
- **Rate limits.** Slack answers `429` with `Retry-After` (seconds), per method and workspace (`chat.postMessage` about one message a second per channel). [Metering](../contracts/metering.md) records the cooldown in the database, so every process waits it out before the Connection's next request, and a wait past `maxWaitMs` fails at once with `RateLimited`. Metering's cooldown is per Connection, Slack's limit per workspace: two people's Connections to one workspace each learn of a 429 on their own.
|
|
26
|
+
- **Reading a channel.** `conversations.history` returns the most recent messages first and has no forward order. Each `listMessages` page is put oldest first, and its `nextPageToken` (Slack's cursor, wrapped) leads to the messages before it. Thread replies stay in their thread (`conversations.replies`: the root, then its replies oldest first).
|
|
27
|
+
- **Text.** Slack escapes `&`, `<` and `>` in message text: `sendMessage` escapes them and reading unescapes them, so text round-trips exactly. Slack's own markup (`<@U123>`, `<#C123>`, links) is passed through as it is.
|
|
28
|
+
- **Token origins** (`apiOrigins`): the kernel sends the Connection's token only to the Web API (`API_URL`).
|
|
29
|
+
|
|
30
|
+
## Receiving: the Events API through Ingress
|
|
31
|
+
|
|
32
|
+
`slackEvents({ name, handler })` is an Ingress source for the Slack app's Request URL. Declared on the app as `slack.events`, Slack POSTs to `<ELOXIV_BASE_URL>/ingress/slack.events`:
|
|
33
|
+
|
|
34
|
+
- **Verification.** Slack's signing secret (`ELOXIV_INGRESS_SECRET_SLACK_EVENTS`, comma-separated while rotating), `x-slack-signature: v0=<hex>` over `v0:<x-slack-request-timestamp>:<body>`, compared in constant time; a timestamp more than five minutes away is refused.
|
|
35
|
+
- **`url_verification`.** Answered with its `challenge` as `text/plain`, only once the signature and the timestamp hold, and neither stored nor processed (the source's `answer`, Ingress 1.1.0).
|
|
36
|
+
- **Retries.** Slack retries a delivery not answered `2xx` within three seconds up to three times, with `x-slack-retry-num` and `x-slack-retry-reason`. Ingress answers once the delivery is committed, and every retry carries the same `event_id`, which is the delivery id: a retry joins the delivery already accepted and never acts twice. The retry headers are kept with the delivery (unsigned: informational only).
|
|
37
|
+
- **Linked identities.** The sender is `<team>:<user>` (the sender's own team in a shared channel). A person links theirs by creating a one-time code in the app (`POST /kernel/ingress/createLinkCode`, `{ "platform": "slack" }`) and sending `link <code>` from Slack, to the app directly or in a channel mentioning it (`@eloxiv link <code>`). Their later messages run the handler as their actor, under their policy, with surface `ingress`; anyone who has not linked never acts (the delivery is refused as `unlinked` and audited by hash).
|
|
38
|
+
- **Which organisation.** A delivery acts only in an organisation that has an active `slack` Connection to the workspace that received it (`authorizations[0]`: the workspace, or the Enterprise organisation of an organisation-wide install; else `context_team_id`, `team_id`; Ingress's `receivedBy`). In a Slack Connect channel shared with another company's workspace, a message from someone linked in organisation A that arrives through the workspace organisation B connected is refused as `unlinked`, not run in A; a link code from A sent through B's workspace is refused (`link-refused`) and stays usable through A's own. A workspace no organisation has connected acts nowhere. (Proven in `connector-slack.test.ts`, "acts only in the organisation of the receiving workspace's Connection: ...".)
|
|
39
|
+
- **What is a message.** A person's own `message` (no subtype, or `thread_broadcast`) or `app_mention`, as they posted it (no `edited`, `hidden`, `message` or `previous_message`: an edited message or mention, or a change record, is no one's, so an edit can never carry a link code): a `user` and none of Slack's bot or app markers (`bot_id`, `bot_profile`, `app_id`). One narrow exception: **the person through Eloxiv's own app**. A message a person posts with the user token they granted Eloxiv's app carries `bot_id`, `app_id` and a bot profile that all name Eloxiv's app (the delivery's signed `api_app_id`) and a profile naming no bot user; it is that person's, and still acts only if they have linked their identity (the live run's person posts this way, since Slack offers no user-token post without the app's marking: `as_user` is for classic apps only, and `chat.meMessage` is a `me_message`). Another app's message is never a person's, whatever its profile says or omits; the app's own bot posts (their profile, and the installation's `authorizations`, name the bot user) are no one's. Joins, file shares, edits, deletions and other events parse to nothing too; they reach Ingress (Slack delivers the bot's own posts to `message.*` subscriptions) and are refused as `unlinked`, acting as no one. An app that subscribes to both `message.channels` and `app_mention` gets a mention twice, under two event ids: the message `id` (its `ts`) is the same, so the handler should be idempotent on it, as the reference `chatlog.record` is.
|
|
40
|
+
|
|
41
|
+
## The agent in Slack
|
|
42
|
+
|
|
43
|
+
`slackAgent({ name, timeoutMs })` gives a source and a workflow; declare the source in `KernelApp.ingress` and the workflow in `KernelApp.workflows`, beside the kernel's agent module and a model provider. A linked person's message to the app (directly, or mentioning it; the mention is dropped) goes to their agent as them (`agent.send`, under their link). The agent's final answer is posted in the message's thread through the workspace's Connection. A run unfinished after `timeoutMs` (default five minutes) is cancelled and the person is told. The handler gives only the text; the kernel decides where it goes ([Ingress, "Replying"](../contracts/ingress.md#replying-in-the-deliverys-conversation)). A thread's messages from one person continue one conversation by default; each channel's settings (whether the agent answers there, `act` or `plan`, a daily token budget, what it remembers) are the Connection owner's to set ([Connections, "Channels"](../contracts/connections.md#channels)); a channel past its budget gets a short answer saying so. Proven against the protocol fake only (`registry/test/slack-agent.test.ts`).
|
|
44
|
+
|
|
45
|
+
## Settings
|
|
46
|
+
|
|
47
|
+
`ELOXIV_CONNECTOR_SLACK__<KEY>`: `CLIENT_ID`, `CLIENT_SECRET` (required: the app's Basic Information page), `CHANNEL_TYPES` (default `public_channel,private_channel,mpim,im`), and endpoint overrides `AUTHORIZE_URL`, `TOKEN_URL`, `API_URL` (defaults: `https://slack.com/oauth/v2/authorize`, `https://slack.com/api/oauth.v2.access`, `https://slack.com/api`; `slack-gov.com` for GovSlack). The signing secret is the Ingress source's: `ELOXIV_INGRESS_SECRET_SLACK_EVENTS`.
|
|
48
|
+
|
|
49
|
+
## The app manifest
|
|
50
|
+
|
|
51
|
+
Create the app from this manifest (api.slack.com/apps, "From a manifest"). The deployment's manifest adds the event subscriptions at once; the test app is created without them, since nothing can answer Slack's challenge before the first live run, which adds them (see below).
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"display_information": {
|
|
56
|
+
"name": "Eloxiv",
|
|
57
|
+
"description": "Eloxiv connector"
|
|
58
|
+
},
|
|
59
|
+
"features": {
|
|
60
|
+
"bot_user": { "display_name": "eloxiv", "always_online": false },
|
|
61
|
+
"app_home": { "home_tab_enabled": false, "messages_tab_enabled": true, "messages_tab_read_only_enabled": false }
|
|
62
|
+
},
|
|
63
|
+
"oauth_config": {
|
|
64
|
+
"redirect_urls": ["https://<ELOXIV_BASE_URL host>/connections/callback"],
|
|
65
|
+
"scopes": {
|
|
66
|
+
"bot": [
|
|
67
|
+
"channels:read",
|
|
68
|
+
"groups:read",
|
|
69
|
+
"im:read",
|
|
70
|
+
"mpim:read",
|
|
71
|
+
"channels:history",
|
|
72
|
+
"groups:history",
|
|
73
|
+
"im:history",
|
|
74
|
+
"mpim:history",
|
|
75
|
+
"chat:write"
|
|
76
|
+
],
|
|
77
|
+
"user": ["chat:write"]
|
|
78
|
+
},
|
|
79
|
+
"pkce_enabled": false
|
|
80
|
+
},
|
|
81
|
+
"settings": {
|
|
82
|
+
"event_subscriptions": {
|
|
83
|
+
"request_url": "https://<ELOXIV_BASE_URL host>/ingress/slack.events",
|
|
84
|
+
"bot_events": ["message.channels", "message.groups", "message.im", "message.mpim"]
|
|
85
|
+
},
|
|
86
|
+
"interactivity": { "is_enabled": false },
|
|
87
|
+
"org_deploy_enabled": false,
|
|
88
|
+
"socket_mode_enabled": false,
|
|
89
|
+
"token_rotation_enabled": false
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
- `redirect_urls` must be HTTPS. The `user` scope `chat:write` is only for the live test (the test person posts through it); a deployment can drop it.
|
|
95
|
+
- `messages_tab_enabled` lets people message the app directly (to link, or to talk to it).
|
|
96
|
+
- `token_rotation_enabled: true` works too (the kernel refreshes and rotates); Slack does not let it be turned off again.
|
|
97
|
+
|
|
98
|
+
## Receiving events locally and in CI
|
|
99
|
+
|
|
100
|
+
Slack must reach `/ingress/slack.events` over public HTTPS. For local and CI runs the live test opens a **Cloudflare quick tunnel**: `cloudflared tunnel --url http://localhost:<kernel port>` gives a random `https://<words>.trycloudflare.com` that forwards to the kernel, with no Cloudflare account and nothing to install by hand: [`registry/test/tunnel.ts`](../../registry/test/tunnel.ts) runs `mise exec cloudflared@2026.10.7 -- cloudflared ...` (mise's registry maps `cloudflared` to `aqua:cloudflare/cloudflared`, a pinned release download; `ELOXIV_CLOUDFLARED` names another binary). It waits until the kernel's `/health` answers through the tunnel; on this machine that took about a minute (the new hostname has to resolve), so the live run allows four minutes for setup.
|
|
101
|
+
|
|
102
|
+
The tunnel's URL changes on every run, so the run points the app's Request URL at it through the App Manifest API: `tooling.tokens.rotate` (an app configuration token from its refresh token), `apps.manifest.export`, then `apps.manifest.update` with `settings.event_subscriptions.request_url` set to `<tunnel>/ingress/slack.events`. Slack verifies a new Request URL with a signed `url_verification` before it saves it, so the update succeeding proves the kernel answered the challenge through Ingress.
|
|
103
|
+
|
|
104
|
+
**Keeping the configuration token.** Slack's configuration refresh tokens work once, and GitHub gives a queued run the secrets as they were when it was queued, so the latest refresh token is kept in a store read at run time ([`registry/test/slack-config-token.ts`](../../registry/test/slack-config-token.ts)): the file `config-refresh-token.sealed` on the branch `ci/slack-live-state`, sealed with AES-256-GCM under `ELOXIV_SLACK_TEST_STATE_KEY`, read and written through GitHub's contents API. Each run:
|
|
105
|
+
|
|
106
|
+
1. proves it can write the store by writing a probe file of its own (never the token);
|
|
107
|
+
2. reads the token with its version (the file's sha), and rotates only if the store is still at that version just before rotating; a store another run moved meanwhile holds a newer token, which it reads and uses instead;
|
|
108
|
+
3. rotates and stores in one critical section: the new token goes into `ELOXIV_SLACK_TEST_CONFIG_PENDING_FILE` with the version it replaces, then into the store as a compare-and-swap against the version it read (never a sha fetched afresh). If the store moved meanwhile (another run, an operator's reseed), it is re-read and never overwritten: the store's token is kept, the run's stays in the pending file and the run fails, for a person to decide. In CI the rotation is a step of its own ([`slack-config-rotate.ts`](../../registry/test/slack-config-rotate.ts)) that holds SIGINT and SIGTERM through that section (GitHub cancels with SIGINT, then SIGTERM about 7.5 s later, then kills the step); the new token is in the pending file before the store's write, so a step killed during that write loses nothing (step 4 stores it). Slack documents no grace for the presented refresh token (it works once; nothing says it lasts until the new access token is first used), so once the request leaves the old token counts as used: `tooling.tokens.rotate` gets 15 s and is never sent again (if its answer is lost, the next run's `invalid_refresh_token` says the token was used up, and a new configuration token is generated on the app's settings page and seeded). Each GitHub request gets 10 s; reads and the probe are tried again (three times in all, with a pause), and a write whose answer is lost is checked against the store before it is sent again: done if the store holds this token, sent again only if the store has not moved. Every failure names its request (method and path; never a token). (A 2 s deadline per GitHub request failed four runs in a row on 2026-11-10, on writes GitHub committed and answered a few seconds later; no rotation was lost.)
|
|
109
|
+
4. in CI, an `if: always()` step ([`slack-token-persist.ts`](../../registry/test/slack-token-persist.ts)) stores a pending token a stopped run rotated but did not store, if the store is still at the version it replaces.
|
|
110
|
+
|
|
111
|
+
The secret `ELOXIV_SLACK_TEST_CONFIG_REFRESH_TOKEN` only seeds the first run. Proven in [`registry/test/slack-config-token.test.ts`](../../registry/test/slack-config-token.test.ts) against a fake of GitHub's contents API: a second queued run with the same stale secret, two overlapping runs, a run cancelled between rotating and storing, a store reseeded during a rotation (kept), the rotation process sent a real SIGINT mid-rotation against a fake Slack (it finishes, stores, then exits 130), a write GitHub commits but answers too late, reads that time out before answering, and a rotation Slack does not answer (named, and not sent again), none losing the token. A local run uses the same store.
|
|
112
|
+
|
|
113
|
+
**The workflow.** [`.github/workflows/slack-live.yml`](../../.github/workflows/slack-live.yml) is a workflow of its own, in the concurrency group `slack-live` with `cancel-in-progress: false`, so a push never cancels a run in the middle of a rotation (a newer run waits). Its secrets live only in the `slack-live` environment, whose deployment branches are `build/*` and `main`, and it runs only by hand (`workflow_dispatch`) or on a push to `main` or `build/main` that changes what it exercises (path-filtered; topic branches never run it, since each run rotates the one configuration token); pull requests never run it, since a same-repository pull request would otherwise get the key and `contents: write`. Requiring the owner's approval on the environment would be cleaner still, but the organisation's plan refuses required reviewers on a private repository (`422`), so the branch policy and the push-only trigger are the boundary.
|
|
114
|
+
|
|
115
|
+
Between runs the Request URL points at a tunnel that no longer exists. Slack then fails any delivery (a person posting in a channel the bot is in), and disables an app's subscriptions for a while only when more than 95% of deliveries fail in an hour and it receives at least 1,000 an hour; the test workspace is quiet, and the next run sets a fresh URL.
|
|
116
|
+
|
|
117
|
+
**Socket Mode** (Slack pushes events over a WebSocket the app opens, no public URL) was considered and not used: its events never pass Ingress's pipeline. They carry no signature (the socket's app-level token authenticates the connection instead), so Ingress's signature verification, replay protection and audit of refusals would not apply, and a Socket Mode receiver would have to inject deliveries into Ingress past its verifier, a path that does not exist and should not. Criterion 5 asks for messaging "through Ingress", so the live test proves the Events API over HTTPS, as a deployment receives it. A deployment without a public URL could add a Socket Mode bridge later as a separate, explicitly trusted source.
|
|
118
|
+
|
|
119
|
+
## The protocol fake
|
|
120
|
+
|
|
121
|
+
[`packages/testing/src/fakes/SlackFake.ts`](../../packages/testing/src/fakes/SlackFake.ts), a local HTTP server following Slack's documentation (docs.slack.dev, read 2026-11-04):
|
|
122
|
+
|
|
123
|
+
- **OAuth v2**: `/oauth/v2/authorize` (comma-separated bot scopes, HTTPS or localhost `redirect_uri`, per-workspace installs whose scopes accumulate, `access_denied`) and `/api/oauth.v2.access` (HTTP Basic or form credentials; `invalid_client_id`, `bad_client_secret`, `invalid_code`, `bad_redirect_uri`, `pkce_not_allowed` for PKCE from a non-public app, `invalid_refresh_token`; the documented answer: `access_token`, `token_type: bot`, `scope`, `bot_user_id`, `app_id`, `team`, `enterprise`, `authed_user`, and `expires_in`/`refresh_token` with token rotation, whose refresh tokens work once).
|
|
124
|
+
- **Web API**: `auth.test`, `conversations.list`, `conversations.history` (newest first, replies left out, `oldest`/`latest`/`inclusive`, `has_more`), `conversations.replies`, `chat.postMessage`, with query, form or JSON arguments; errors as `200 { ok: false, error }` (`missing_scope` with `needed` and `provided`), rate limits as `429` with `Retry-After`; `x-oauth-scopes` on answers; cursors in `response_metadata.next_cursor`.
|
|
125
|
+
- **Events API**: a Request URL is kept only after a signed `url_verification` is answered with its challenge (plain text, form or JSON); every message in a conversation the bot is in, the bot's own included, is POSTed as a signed `event_callback` envelope; a delivery not answered `2xx` within three seconds is retried three times with `x-slack-retry-num` and `x-slack-retry-reason`, each attempt signed afresh, until `x-slack-no-retry: 1`.
|
|
126
|
+
- **Controls**: which person in which workspace installs, injected 429s per method, expiring and revoking tokens (uninstalling), removing scopes, a person posting, failing delivery attempts (as if Slack timed out), hand-signed deliveries.
|
|
127
|
+
- **Not modelled**: Slack's real per-method rate tiers (limits are injected), Enterprise Grid, Slack Connect, user-token methods, edits, deletions, reactions, files and blocks, and the retry schedule's real delays (one and five minutes, shortened).
|
|
128
|
+
|
|
129
|
+
## The live run (for the coordinator)
|
|
130
|
+
|
|
131
|
+
[`connector-slack-live.test.ts`](../../registry/test/connector-slack-live.test.ts) runs the Messaging kit against a real workspace when every required variable is set: the bot token from the app's installation is imported as the Connection (a bot token without rotation never expires, so the browser consent is not part of the run; the fake proves the consent), the kernel is reached through a quick tunnel, and the app's Request URL is set to it as above. The test person's messages are posted with their user token and arrive from Slack's Events API; the unlinked sender is a Slack-shaped delivery signed with the app's signing secret and sent through the same tunnel (a second human account would be needed otherwise). It posts `kit <id>: ...` messages and a `link elxl_...` message in the test channel, and leaves them.
|
|
132
|
+
|
|
133
|
+
| Variable | Required | Value |
|
|
134
|
+
| --- | --- | --- |
|
|
135
|
+
| `ELOXIV_SLACK_TEST_BOT_TOKEN` | yes | The Bot User OAuth Token (`xoxb-...`), OAuth & Permissions |
|
|
136
|
+
| `ELOXIV_SLACK_TEST_USER_TOKEN` | yes | The installing person's User OAuth Token (`xoxp-...`), same page |
|
|
137
|
+
| `ELOXIV_SLACK_TEST_SIGNING_SECRET` | yes | Basic Information, App Credentials, Signing Secret |
|
|
138
|
+
| `ELOXIV_SLACK_TEST_CHANNEL` | yes | The id (`C...`) of a channel the bot is in |
|
|
139
|
+
| `ELOXIV_SLACK_TEST_APP_ID` | yes | Basic Information, App ID (`A...`) |
|
|
140
|
+
| `ELOXIV_SLACK_TEST_CONFIG_REFRESH_TOKEN` | yes, or the next | An app configuration refresh token (`xoxe-...`) |
|
|
141
|
+
| `ELOXIV_SLACK_TEST_CONFIG_TOKEN` | instead of the above | An app configuration access token (`xoxe.xoxp-...`, valid 12 hours), for a one-off run |
|
|
142
|
+
| `ELOXIV_SLACK_TEST_STATE_KEY` | yes, with the next | The key sealing the stored refresh token (random; the same locally and in CI) |
|
|
143
|
+
| `ELOXIV_SLACK_TEST_STATE_GITHUB_TOKEN` | yes, with the above | A GitHub token that may read and write contents of `eloxiv/eloxiv` (CI: the job's `GITHUB_TOKEN`; locally: `gh auth token`) |
|
|
144
|
+
| `ELOXIV_SLACK_TEST_CONFIG_REFRESH_TOKEN_FILE` | without a store | Where the rotated refresh token is kept between runs of one machine that does not share CI's store |
|
|
145
|
+
| `ELOXIV_SLACK_TEST_CLIENT_ID`, `ELOXIV_SLACK_TEST_CLIENT_SECRET` | no | Basic Information, App Credentials (unused by the live run today; for a future consent run) |
|
|
146
|
+
| `ELOXIV_SLACK_TEST_SECRETS_TOKEN` | setup only | A GitHub fine-grained token with "Secrets: read and write" on this repository, for setting the secrets (no workflow uses it) |
|
|
147
|
+
|
|
148
|
+
Locally, with the variables loaded and `ELOXIV_SLACK_TEST_STATE_GITHUB_TOKEN=$(gh auth token)`: `mise exec -- bun --bun vitest run --project registry registry/test/connector-slack-live.test.ts`. It reads and writes the same store as CI, so nothing needs storing back. Never run it without the store once CI has run: the secret's token is used up by then.
|
|
149
|
+
|
|
150
|
+
### Setting up the workspace and the app (computer use)
|
|
151
|
+
|
|
152
|
+
Check the fleet runbook for which account the Slack test workspace uses (work or personal). Stop and ask the user for any verification code, passkey or phone approval, naming the service and account; never retry a failed verification. Store every value through `request_secret` (never in chat) and as GitHub repository secrets of `eloxiv/eloxiv` with the names above.
|
|
153
|
+
|
|
154
|
+
1. **Workspace.** At <https://slack.com/get-started#/createnew>, sign in with the test account's email and create a free workspace named `Eloxiv Test`. Skip inviting people. Create a public channel `#eloxiv-kit`.
|
|
155
|
+
2. **App.** At <https://api.slack.com/apps>, *Create New App*, *From a manifest*, pick `Eloxiv Test`, choose JSON, and paste the manifest above **without the `event_subscriptions` block** (leave `settings` with `interactivity`, `org_deploy_enabled`, `socket_mode_enabled`, `token_rotation_enabled`), with `display_information.name` `Eloxiv Test App` and `redirect_urls` `["https://localhost/connections/callback"]` (the live run does not use the consent flow). *Next*, *Create*.
|
|
156
|
+
3. **Credentials.** *Basic Information*: copy the App ID (`ELOXIV_SLACK_TEST_APP_ID`), Client ID, Client Secret (`ELOXIV_SLACK_TEST_CLIENT_ID`, `_CLIENT_SECRET`) and Signing Secret (*Show*; `ELOXIV_SLACK_TEST_SIGNING_SECRET`).
|
|
157
|
+
4. **Install.** *Install App*, *Install to Eloxiv Test*, *Allow*. On *OAuth & Permissions* copy the *Bot User OAuth Token* (`xoxb-...`, `ELOXIV_SLACK_TEST_BOT_TOKEN`) and the *User OAuth Token* (`xoxp-...`, `ELOXIV_SLACK_TEST_USER_TOKEN`).
|
|
158
|
+
5. **Channel.** In Slack, open `#eloxiv-kit` and send `/invite @eloxiv` (the bot's display name), confirming if asked. Open the channel's name, *About*/settings: the *Channel ID* at the bottom (`C...`, `ELOXIV_SLACK_TEST_CHANNEL`).
|
|
159
|
+
6. **Configuration token.** Back at <https://api.slack.com/apps>, under *Your App Configuration Tokens*, *Generate Token*, pick `Eloxiv Test`, *Generate*. Copy the *Refresh Token* (`xoxe-...`, `ELOXIV_SLACK_TEST_CONFIG_REFRESH_TOKEN`); the access token is not needed.
|
|
160
|
+
7. **A token for setting secrets.** On GitHub (the account that administers `eloxiv/eloxiv`), *Settings*, *Developer settings*, *Fine-grained tokens*, *Generate new token*: repository access only `eloxiv/eloxiv`, permission *Secrets: Read and write*, a year's expiry. Store it as `ELOXIV_SLACK_TEST_SECRETS_TOKEN`.
|
|
161
|
+
8. **The environment's secrets.** Add every value above as secrets of the `slack-live` environment (`gh secret set <NAME> --repo eloxiv/eloxiv --env slack-live`), not as repository secrets. The environment's deployment branches are `build/*` and `main`. Generate `ELOXIV_SLACK_TEST_STATE_KEY` at random (`openssl rand -base64 32`) and keep it in the env file too.
|
|
162
|
+
9. **Report** pass, fail or blocked with the steps taken, and screenshots of the app's *Basic Information* page (secrets hidden) and of `#eloxiv-kit` showing the bot as a member. The first run (the `slack live` workflow, or locally) adds the event subscriptions; afterwards the app's *Event Subscriptions* page shows the tunnel URL as verified.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# WorkOS (enterprise sign-in and provisioning)
|
|
2
|
+
|
|
3
|
+
WorkOS is the kernel's enterprise identity integration (decisions: "Auth: Better Auth; WorkOS when enterprise SSO or SCIM is needed"). It is built into the kernel, not a registry connector: SSO sign-in (federation) and Directory Sync (SCIM provisioning) for the organisations that opt in. What it does, operation by operation, is in the [Directory contract](../contracts/directory.md#enterprise-sign-in-and-provisioning); the code is [`packages/kernel/src/enterprise/`](../../packages/kernel/src/enterprise).
|
|
4
|
+
|
|
5
|
+
## Setting it up
|
|
6
|
+
|
|
7
|
+
1. In the WorkOS dashboard's environment (staging first), note its API key and client ID.
|
|
8
|
+
2. Add the kernel's SSO redirect URI to the environment's redirect URIs: `<ELOXIV_BASE_URL>/api/sso/callback`.
|
|
9
|
+
3. Add a webhook endpoint at `<ELOXIV_BASE_URL>/api/workos/webhook` subscribed to the `dsync.*` events, and note its signing secret.
|
|
10
|
+
4. Set `ELOXIV_WORKOS_API_KEY`, `ELOXIV_WORKOS_CLIENT_ID` and `ELOXIV_WORKOS_WEBHOOK_SECRET` (all three, or none; `ELOXIV_WORKOS_API_URL` only for a non-default API host).
|
|
11
|
+
5. For each customer: a WorkOS organisation with its domains verified in WorkOS, an SSO connection and (for provisioning) a directory, set up through WorkOS's Admin Portal. In Eloxiv, the customer's administrator verifies the same domains (Directory `addDomain`, `verifyDomain`), then links the organisation and opts in (`setEnterpriseAuth { workosOrganizationId, sso, directorySync }`), and may admit only `sso` (`setSignInMethods`).
|
|
12
|
+
|
|
13
|
+
The app's sign-in page starts SSO with `POST /api/sso/start { email, returnTo }` and sends the browser to the `url` it answers.
|
|
14
|
+
|
|
15
|
+
## What is proven, and against what
|
|
16
|
+
|
|
17
|
+
Everything in [`enterprise-auth.test.ts`](../../packages/testing/test/enterprise-auth.test.ts) runs against the WorkOS protocol fake ([`WorkOsFake.ts`](../../packages/testing/src/fakes/WorkOsFake.ts)), on Bun and Node: the mapping of a sign-in to the organisation by its verified domain, the refusals (an unverified domain, an organisation without SSO, another WorkOS organisation's profile, a flow the browser did not start), the `sso:<connection>` method under the organisation's policy (an organisation that admits only `sso` refuses password sign-in), provisioning (create, group created, renamed and its members changed, deactivation ending the person's sessions), a refused signature (wrong secret, stale), a replayed event that changes nothing, and the domain check on linking. That proves the kernel's handling of WorkOS's protocol as the fake speaks it, not WorkOS's own behaviour.
|
|
18
|
+
|
|
19
|
+
**No live test is planned or required.** The stand-in proof is sufficient for A-016, B-055 and C-018 (owner decision, 2026-11-16; a live run is not required, owner decision, 2026-11-17). The live test below stays ready for when a WorkOS environment exists.
|
|
20
|
+
|
|
21
|
+
## The live proof: what it needs
|
|
22
|
+
|
|
23
|
+
[`workos-live.test.ts`](../../packages/testing/test/workos-live.test.ts) runs against a real WorkOS environment when these are set (it is skipped otherwise):
|
|
24
|
+
|
|
25
|
+
| Variable | What it is |
|
|
26
|
+
| --- | --- |
|
|
27
|
+
| `ELOXIV_WORKOS_TEST_API_KEY` | A staging environment's API key. |
|
|
28
|
+
| `ELOXIV_WORKOS_TEST_CLIENT_ID` | Its client ID. |
|
|
29
|
+
| `ELOXIV_WORKOS_TEST_ORGANIZATION` | A WorkOS organisation with at least one verified domain and an SSO connection (WorkOS's Test Identity Provider is enough). |
|
|
30
|
+
| `ELOXIV_WORKOS_TEST_REDIRECT_URI` | A redirect URI registered in the environment. |
|
|
31
|
+
| `ELOXIV_WORKOS_TEST_WEBHOOK_SECRET`, `ELOXIV_WORKOS_TEST_EVENT_BODY`, `ELOXIV_WORKOS_TEST_EVENT_SIGNATURE` | Optional: a webhook endpoint's secret and one event WorkOS delivered to it (its raw body and `WorkOS-Signature`, captured with any request bin). |
|
|
32
|
+
|
|
33
|
+
It checks the Organizations API's domains, that the SSO API accepts the client and redirect, that the code exchange refuses a code WorkOS did not issue with `invalid_grant` (so the client's credentials were accepted), and the signature of a real event.
|
|
34
|
+
|
|
35
|
+
Still to do once an environment exists, and why it is not automated yet:
|
|
36
|
+
|
|
37
|
+
- **The browser half of SSO**: an identity provider's sign-in page. With WorkOS's Test Identity Provider, drive it once with a browser (`agent-browser`) against a kernel at a public URL, and record that the session lands in the right organisation with `sso:<connection>`.
|
|
38
|
+
- **Directory Sync deliveries**: WorkOS posts to a public HTTPS endpoint. A Cloudflare quick tunnel to the local kernel (as the Slack live lane does) and a directory in the environment (WorkOS's directory test tools, or a SCIM directory pointed at WorkOS) give create, deactivate and group events end to end.
|
|
39
|
+
- **CI**: a `workos-live` workflow with those variables in a protected environment, as `slack-live.yml` does, once the account exists.
|