Every analytics tool wants a subscription. And your data. I built Twiligent instead. YouTube stats. Instagram stats. One dashboard. Runs locally on your machine.
docs(media): document the media tools, table, settings and consent copy
spacesdrive82d88a6548f9
diff --git a/DECISIONS.md b/DECISIONS.mdindex e0019f4..db3e276 100644--- a/DECISIONS.md+++ b/DECISIONS.md@@ -1120,3 +1120,22 @@ New row ids come from `crypto.randomUUID()` (`newRowId()` in `backend/lib/ids.ts- Claude's apps need the owner to turn on Supabase's OAuth server and set `MCP_OAUTH_ENABLED`; access tokens work without it.- Confirmations need `TOKEN_ENCRYPTION_KEY`; without it the confirming tools refuse to run.- Stateless JSON means no server-initiated messages or progress notifications; long work such as YouTube uploads is a background job the tools start and poll.++---++## ADR-052: Claude imports media through Cloudinary, which fetches the file itself++**Date:** 2026-11-05+**Status:** Accepted++**Decision:** The MCP media tools (#146) import an image or video by asking Cloudinary to download a public https address with the instance's existing unsigned upload preset. Twiligent keeps a `media_assets` row per file and person, since the Cloudinary account is shared by everyone on an instance. Deleting a file from Cloudinary needs two new optional Worker secrets, `CLOUDINARY_API_KEY` and `CLOUDINARY_API_SECRET`, kept out of the config the browser receives; without them a delete removes only Twiligent's record and says so.++**Context:** Claude needs a stable public address before Instagram can publish a file, and a tool call cannot stream a large upload through the Worker's 10 ms CPU and 50 subrequest budget.++**Alternatives considered:**+- Downloading the file in the Worker and uploading it. It would fetch addresses a caller chose (a server-side request forgery risk), and large videos exceed the Worker's limits.+- Signed uploads for imports too. The unsigned preset already exists on every instance; signing is only needed for deletes.++**Trade-offs:**+- A video larger than Cloudinary's plan limit, or slower than a tool call, cannot be imported this way.+- Without the API secret, files deleted in Twiligent stay on Cloudinary until the owner removes them.diff --git a/docs/architecture/backend/SERVICES.md b/docs/architecture/backend/SERVICES.mdindex 883f030..6224d6a 100644--- a/docs/architecture/backend/SERVICES.md+++ b/docs/architecture/backend/SERVICES.md@@ -51,6 +51,7 @@ A service receives only what it uses: repositories, the cleaned `AppConfig` from| `mcpAccess` | `mcpAccessService.ts` | MCP access tokens, MCP client grants, audit | `listTokens`, `createToken`, `revokeToken`, `listClients`, `approveClient`, `revokeClient`, `authenticateToken` and `authorizeClient` (used by `requireMcpAuth`) || `mcpFor(principal)` | `mcpService.ts` | (the other services, through the tools in `backend/mcp/`) | `handle(body, headers)`: one JSON-RPC message for one verified caller; lists only the tools the permission allows, asks for confirmation before publishing or deleting, stops a tool after 25 seconds, refuses a result over 40,000 characters, and audits write tools || `youtubeQuota` (internal, not on `Services`) | `youtubeQuotaService.ts` | YouTube quota counters (Redis) | `run(userId, apiKey, work)`: refuses a member who spent `USER_DAILY_UNITS` (2,500, a quarter of the default 10,000) on the current Pacific day with `RateLimitedError` (429), hands the work a metered key that `ytFetch` charges per call, and records the units once at the end, even when the work failed. `accounts`, `youtubeAnalytics`, `trackedContent` and `overview` run every YouTube call through it; refresh-all uses one run for all of a member's channels. Without Redis nothing is metered (audit lead L6) |+| `media` | `mediaService.ts`, `cloudinary/cloudinaryApi.ts` | media assets, audit | `list`, `importFromUrl` (Cloudinary fetches the public https address with the unsigned preset, then a `media_assets` row for the caller), `updateLabel`, `remove` (deletes the file from Cloudinary first when `CLOUDINARY_API_KEY` and `CLOUDINARY_API_SECRET` are set, otherwise only the record, and says which), `canDeleteFiles`. Used by the MCP media tools || `health` | `healthService.ts` | health | `readiness()` (`GET /api/health/ready`: one database read, timed; returns no data) |Every user-scoped method takes the verified `userId` as its first argument. Methods that need one of the user's records load it with a `...ForUser` repository method and throw `NotFoundError` when it is missing or on the wrong platform, so another user's record is never found. `scheduledPublisher`, `tokenRefresh`, `automationWebhook`, `automationProcessor`, `automationFollowups`, `automationPublicReplies`, `automationReconciler` and `retention` are the only services that use the cross-user repository methods (`listByPlatform`, `findById`, `updateById`, `listDue`, `listStale`, `claim`, and the automation queue, follow-up, review, intake and retention methods).diff --git a/docs/architecture/cloudflare/CI_CD.md b/docs/architecture/cloudflare/CI_CD.mdindex fca9375..a59ed99 100644--- a/docs/architecture/cloudflare/CI_CD.md+++ b/docs/architecture/cloudflare/CI_CD.md@@ -52,7 +52,7 @@ A type error or failing test stops the run before the deploy step.- `CLOUDFLARE_API_TOKEN` - API token with Worker deploy permission- `CLOUDFLARE_ACCOUNT_ID` - your Cloudflare account ID-The workflow does not set the Worker's own secrets (`SUPABASE_*`, `FRONTEND_URL`, the optional `ALLOWED_ORIGINS`, the optional email secrets `SEND_EMAIL_HOOK_SECRET`, `RESEND_API_KEY`, `EMAIL_FROM` and `EMAIL_DAILY_LIMIT`, the optional automation settings `INSTAGRAM_WEBHOOK_VERIFY_TOKEN`, `META_APP_SECRET` and `AUTOMATION_*`, the optional Claude settings `TOKEN_ENCRYPTION_KEY` and `MCP_OAUTH_ENABLED`, and the rest). They are set once with `npx wrangler secret put` and kept across deploys; see `WORKERS.md`.+The workflow does not set the Worker's own secrets (`SUPABASE_*`, `FRONTEND_URL`, the optional `ALLOWED_ORIGINS`, the optional email secrets `SEND_EMAIL_HOOK_SECRET`, `RESEND_API_KEY`, `EMAIL_FROM` and `EMAIL_DAILY_LIMIT`, the optional automation settings `INSTAGRAM_WEBHOOK_VERIFY_TOKEN`, `META_APP_SECRET` and `AUTOMATION_*`, the optional Claude settings `TOKEN_ENCRYPTION_KEY`, `MCP_OAUTH_ENABLED`, `CLOUDINARY_API_KEY` and `CLOUDINARY_API_SECRET`, and the rest). They are set once with `npx wrangler secret put` and kept across deploys; see `WORKERS.md`.**Does not** redeploy on frontend-only changes, documentation changes, or script changes.diff --git a/docs/architecture/cloudflare/WORKERS.md b/docs/architecture/cloudflare/WORKERS.mdindex 88e4a6c..b2f3222 100644--- a/docs/architecture/cloudflare/WORKERS.md+++ b/docs/architecture/cloudflare/WORKERS.md@@ -57,6 +57,7 @@ All secrets are set via `npx wrangler secret put <NAME>`, run from `backend/`. T| `EMAIL_FROM` | Optional | Sender of the auth emails on a domain verified in Resend, such as `Twiligent <[email protected]>` || `EMAIL_DAILY_LIMIT` | Optional | Auth emails a day across all users (each code sign-in is one) before the sign-in page pauses email codes and points to Google or a password; defaults to `100`, Resend's free daily quota || `INSTAGRAM_WEBHOOK_VERIFY_TOKEN` | Optional | The Verify Token typed into the Meta dashboard's Instagram webhook settings; `GET /api/webhooks/instagram` answers Meta's check only with it. Without it, and `INSTAGRAM_APP_SECRET`, no comment reaches the Worker and the Automations page says so |+| `CLOUDINARY_API_KEY`, `CLOUDINARY_API_SECRET` | Optional | The Cloudinary account's API key and secret (Settings, API Keys). Only for deleting files through the Claude `delete_media` tool; without them a delete removes Twiligent's record and says the file stays on Cloudinary. Never sent to the browser || `TOKEN_ENCRYPTION_KEY` | Optional | At least 32 random characters (`openssl rand -base64 48`). Keys derived from it sign the MCP confirmation tokens, so without it the Claude tools that publish or delete refuse to run; YouTube publishing will also encrypt stored tokens with it. Changing it voids confirmations in flight || `MCP_OAUTH_ENABLED` | Optional | `true` once Supabase Auth's OAuth server is turned on with the authorization path `/oauth/consent`; the MCP endpoint then publishes its protected resource metadata, so Claude on the web, desktop and mobile can connect. Access tokens work without it || `META_APP_SECRET` | Optional | The Meta app's own secret (App settings, Basic). Webhook signatures are checked against `INSTAGRAM_APP_SECRET` and, when this is set, against it too |diff --git a/docs/architecture/database/SCHEMA.md b/docs/architecture/database/SCHEMA.mdindex 09f05e1..e32d3ed 100644--- a/docs/architecture/database/SCHEMA.md+++ b/docs/architecture/database/SCHEMA.md@@ -451,6 +451,25 @@ Approving the same client again updates its row, so its id stays the same.---+## Table: `media_assets`++The images and videos each person imported through the Claude media tools. The Cloudinary account is shared by everyone on an instance, so this row is what ties a file to one person; listing, renaming and deleting only ever reach the caller's rows.++| Column | Type | Constraints | Description |+|---|---|---|---|+| `id` | text | primary key | `newRowId()` |+| `user_id` | uuid | not null, references `auth.users` on delete cascade | |+| `public_id` | text | not null, unique with `user_id` | Cloudinary's id for the file; it never leaves the Worker |+| `resource_type` | text | `image` or `video` | |+| `url` | text | not null, starts with `https://` | The public address Instagram publishes from |+| `format`, `bytes`, `width`, `height`, `duration_seconds` | text, bigint, integer, integer, numeric | | As Cloudinary reported them |+| `label` | text | not null, default `''`, at most 200 characters | The person's name for the file |+| `created_at`, `updated_at` | timestamptz | not null, default now() | |++Index `media_assets_user_created_idx` on `(user_id, created_at desc)` serves the list.++---+## Table: `audit_events`Who connected, reconnected or removed an account, changed a rule, paused or subscribed an account, or retried a reply. Rows reference only the user, so they outlive the account they describe.@@ -459,7 +478,7 @@ Who connected, reconnected or removed an account, changed a rule, paused or subs|---|---|---|---|| `id` | text | primary key | `newRowId()` || `user_id` | uuid | not null, references `auth.users` on delete cascade | |-| `action` | text | `^[a-z_]+\.[a-z_]+$` | `account.connected`, `account.reconnected`, `account.removed`, `automation_rule.created`, `.updated`, `.duplicated`, `.deleted`, `automation_account.paused`, `.resumed`, `.subscribed`, `automation_comment.retried`, `automation_public_reply.retried`, `mcp_access_token.created`, `.revoked`, `mcp_client.approved`, `.revoked`, and `mcp_access_token.called_tool` or `mcp_client.called_tool` for each write tool a Claude client ran (with the tool name and outcome) |+| `action` | text | `^[a-z_]+\.[a-z_]+$` | `account.connected`, `account.reconnected`, `account.removed`, `automation_rule.created`, `.updated`, `.duplicated`, `.deleted`, `automation_account.paused`, `.resumed`, `.subscribed`, `automation_comment.retried`, `automation_public_reply.retried`, `mcp_access_token.created`, `.revoked`, `mcp_client.approved`, `.revoked`, `media_asset.imported`, `.deleted`, and `mcp_access_token.called_tool` or `mcp_client.called_tool` for each write tool a Claude client ran (with the tool name and outcome) || `subject_type` | text | `account`, `automation_rule`, `automation_account`, `automation_comment`, `mcp_access_token`, `mcp_client`, `scheduled_post`, `tracked_post`, `media_asset`, `youtube_connection`, `youtube_upload`, `settings` | The last six are for changes made through Claude clients, publishing, media and YouTube || `subject_id` | text | | || `details` | jsonb | not null, default `{}`, an object | Small facts such as the platform or the changed field names; never tokens or comment text |diff --git a/docs/architecture/database/SECURITY.md b/docs/architecture/database/SECURITY.mdindex 75b4afe..1b2da48 100644--- a/docs/architecture/database/SECURITY.md+++ b/docs/architecture/database/SECURITY.md@@ -53,7 +53,7 @@ The migrations in `supabase/migrations/` enforce this on every instance:The service-role key used by the Worker and the GitHub Actions scheduler bypasses row level security and keeps its grants. The frontend never queries tables directly (it uses Supabase only for Auth). `backend/tests/database/migrations.test.ts` fails if a migration creates a function without the revoke.-To check a live instance, call the Data API with the anon key (`GET <SUPABASE_URL>/rest/v1/accounts` with the `apikey` header): it must answer 401 for all thirteen tables and for `POST /rest/v1/rpc/merge_account_data`, `POST /rest/v1/rpc/claim_automation_comments`, `POST /rest/v1/rpc/claim_automation_followups` and `POST /rest/v1/rpc/claim_automation_public_replies`. The manual check is in `docs/workflows/TESTING.md`.+To check a live instance, call the Data API with the anon key (`GET <SUPABASE_URL>/rest/v1/accounts` with the `apikey` header): it must answer 401 for all fourteen tables and for `POST /rest/v1/rpc/merge_account_data`, `POST /rest/v1/rpc/claim_automation_comments`, `POST /rest/v1/rpc/claim_automation_followups` and `POST /rest/v1/rpc/claim_automation_public_replies`. The manual check is in `docs/workflows/TESTING.md`.### What was wrong beforediff --git a/docs/platform-v2/MCP_DOCUMENTATION.md b/docs/platform-v2/MCP_DOCUMENTATION.mdindex 9ad2cf3..162e3a4 100644--- a/docs/platform-v2/MCP_DOCUMENTATION.md+++ b/docs/platform-v2/MCP_DOCUMENTATION.md@@ -126,6 +126,10 @@ Every tool works only on the caller's own data. Read tools need no confirmation.| `get_settings` | read | none | Which server keys are set (never their values); the GitHub repository setting || `get_instagram_publishing_limit` | read | `accountId` | Posts published in the last 24 hours and the limit || `update_github_settings` | write | `repoOwner`, `repoName`, `branch` | The saved setting |+| `list_media` | read | `limit`, `cursor` | `media` (id, type, public https `url`, size and dimensions, label), `nextCursor`, `total` |+| `import_media_from_url` | write | `url` (public https), `resourceType` (`image` or `video`), `label` | `media`. Cloudinary downloads the file, not the Worker; private and non-https addresses are refused |+| `update_media` | write | `mediaId`, `label` | `media` |+| `delete_media` | write, confirm | `mediaId` | `deleted`, `removedFromCloudinary`, and a `note` when the file stays on Cloudinary because the instance has no API secret || `list_scheduled_posts` | read | `status`, `limit` (1 to 50, default 20), `cursor` | `posts`, `nextCursor`, `total` || `get_scheduled_post` | read | `postId` | `post` || `schedule_instagram_post` | write, confirm | `accountId`, `mediaUrl` (public https), `scheduledAt` (future ISO 8601), `mediaType` (IMAGE, VIDEO, REELS, STORIES), `caption`, `shareToFeed`, `collaborators`, `altText`, `locationId` | `post`, `alreadyScheduled` (true when the same media was already scheduled for that account and time) |diff --git a/docs/workflows/DEPLOYMENT.md b/docs/workflows/DEPLOYMENT.mdindex b130e52..ff37dad 100644--- a/docs/workflows/DEPLOYMENT.md+++ b/docs/workflows/DEPLOYMENT.md@@ -144,6 +144,8 @@ npx wrangler secret put EMAIL_DAILY_LIMIT # optional; defaults to 100npx wrangler secret put INSTAGRAM_WEBHOOK_VERIFY_TOKEN # optional; comment-to-DM automation (with INSTAGRAM_APP_SECRET)npx wrangler secret put META_APP_SECRET # optional; a second key for webhook signaturesnpx wrangler secret put AUTOMATION_PAUSED # optional; "true" holds every automated reply+npx wrangler secret put CLOUDINARY_API_KEY # optional; with the secret below, lets Claude delete media files+npx wrangler secret put CLOUDINARY_API_SECRET # optionalnpx wrangler secret put TOKEN_ENCRYPTION_KEY # optional; signs MCP confirmations (openssl rand -base64 48)npx wrangler secret put MCP_OAUTH_ENABLED # optional; "true" after turning on Supabase's OAuth server```diff --git a/docs/workflows/TESTING.md b/docs/workflows/TESTING.mdindex c84354b..33510fd 100644--- a/docs/workflows/TESTING.md+++ b/docs/workflows/TESTING.md@@ -98,7 +98,7 @@ The database migrations have their own test. `tests/database/migrations.test.ts`Comment automation has its own tests. `tests/lib/automationMatching.test.ts` covers whole-word and exact matching, case, look-alike characters, literal punctuation in keywords, and that a comment on one reel never triggers a rule for another. `tests/lib/automationDelivery.test.ts` covers the Graph error classes, backoff with jitter, the cooldown from Meta's usage header, and what is recorded for each answer: accepted, rate limited, blocked, temporary errors up to the fifth try, already replied, a refused token (held), not allowed, no answer (needs review), and a request the runtime refused (not sent). `tests/lib/metaWebhookSignature.test.ts` checks signatures with either secret, changed bodies and malformed headers. `tests/fixtures/fakeAutomationQueue.ts` is an in-memory twin of the claim, reserve and finish functions, following the SQL's rules, and `tests/services/automationProcessor.test.ts` runs the processor against it: two comments at once, three reels with their own rules, two runs competing for the same jobs (each reply sent once), a burst over the batch and per-account fairness, a timeout that is never resent, a run that stopped before and during a send, a rate limit cooling one account while another keeps sending, the hourly and per-person limits, five temporary failures, a rule turned off, a deleted reel, an expired comment, a refused token holding the account, the instance pause, a database failure on one job and on the claim, a cancelled run and one without time for a whole send handing their jobs back unstarted, and a run claiming only what its subrequests pay for. `tests/services/automationWebhookService.test.ts` covers intake: per-reel matching, unmatched comments kept without words, own comments, duplicates within and across notifications, accounts without rules, a failed insert, and the verify token. `tests/repositories/automationCommentRepository.test.ts` pages through comments stored in the same instant without skipping or repeating one, and checks the hand-back of unstarted jobs. `tests/routes/instagramWebhookRoutes.test.ts` runs the public route end to end (challenge, signed comment stored then answered, duplicates, either secret, bad signatures, bad bodies, the 1 MB limit, a missing secret, a database failure), and `tests/routes/automationRoutes.test.ts` the user routes, including every route answering 404 for another user's rule, account or item. `tests/fixtures/metaWebhook.ts` signs notifications the way Meta does. `fakeAutomationQueue.ts` also mirrors the turn-taking claim, follow-ups, expiry and review. `tests/services/automationFollowupProcessor.test.ts` covers followers-only replies: a follower gets the link, someone not following gets a reminder and the second ends the wait, nothing is sent when Instagram cannot say, a lost answer needs review and is never sent again, and two runs at once send each follow-up once. `tests/services/automationReconciler.test.ts` covers a lost reply found in the conversation (accepted, nothing sent) or not found (left for a person), and the expiry and health warning. `tests/lib/automationRules.test.ts`, `automationReview.test.ts` and `automationHealth.test.ts` cover the rule checks, matching a lost reply by its digest and time, and the warning line; `tests/services/instagram/instagramMessaging.test.ts` the send, follow check, conversation read and subscription requests; `tests/repositories/automationFollowupRepository.test.ts` the follow-up database calls. Public replies (ADR-044): `tests/lib/automationPublicReply.test.ts` covers the stable wording per comment, the text bounds, what is recorded for each answer (posted only with an id, a lost answer for review, a deleted comment skipped, a public-only cooldown and a day-long block, retries, a held account, expiry) and when a lost reply goes out again. `tests/services/automationPublicReplyProcessor.test.ts` runs the public processor against the fake queue: posting with the stored text while the private reply is left alone, a failed private reply never repeating the public one and a public retry never repeating the private one, a lost answer never posted again by the dispatch, two runs at once posting each reply once, a rate limit cooling public replies only, one public reply per person and post, the account's hourly limit, a public reply turned off, an interrupted run and the instance pause. `tests/services/automationReconciler.test.ts` also covers a lost public reply found on the second page of replies, sent again once after two full reads, never sent again with a page unread or after a second lost answer, and a read Instagram refuses. `tests/services/instagram/instagramComments.test.ts` covers the reply request, answers without an id, refusals and paging; `tests/routes/instagramWebhookRoutes.test.ts` a rule with both replies end to end, where the private reply fails, the public one is posted and a redelivery sends neither again; `tests/routes/automationRoutes.test.ts` the public reply retry, the refused private retry of a public-only comment, and public-only rules. The SQL functions cannot run in Node; they were checked on a local Postgres (PGlite, and Postgres 18 for the public reply functions, including eight claims at once on 10,000 waiting replies with no reply claimed twice) before the first push: deduplication, fair claims and lease recovery, each limit, pause and cooldown, a late answer for an interrupted send, stats, cascades, browser access and every rollback.-The MCP server has its own tests. `tests/lib/mcp/protocol.test.ts` covers parsing JSON-RPC, the two protocol eras, the header checks and the error replies; `tests/lib/mcp/accessToken.test.ts` and `confirmation.test.ts` the token format and hash, and that a confirmation fails for other arguments, another tool, another person or after five minutes. `tests/services/mcpAccessService.test.ts` covers creating, listing, revoking and authenticating tokens and approving clients; `tests/services/mcpService.test.ts` the dispatch, that read-only callers never see or run write tools, the confirmation flow, the timeout, the result size cap and the audit lines. `tests/mcp/scheduledPostTools.test.ts` and `tests/mcp/analyticsTools.test.ts` check each tool's input checks, paging and that another person's records are not found and tokens never appear; `tests/routes/mcpRoutes.test.ts` runs `/mcp` and `/api/mcp/*` in the full app (401 with the challenge, the Origin check, 405 for GET, revoked tokens). On the frontend, `tests/features/settings/claudeAccessData.test.ts` covers the Settings section's helpers, `tests/lib/oauthConsent.test.ts` which return addresses the consent page accepts, and `tests/lib/signInPage.test.ts` that signing in returns only to a path on this site.+The MCP server has its own tests. `tests/lib/mcp/protocol.test.ts` covers parsing JSON-RPC, the two protocol eras, the header checks and the error replies; `tests/lib/mcp/accessToken.test.ts` and `confirmation.test.ts` the token format and hash, and that a confirmation fails for other arguments, another tool, another person or after five minutes. `tests/services/mcpAccessService.test.ts` covers creating, listing, revoking and authenticating tokens and approving clients; `tests/services/mcpService.test.ts` the dispatch, that read-only callers never see or run write tools, the confirmation flow, the timeout, the result size cap and the audit lines. `tests/mcp/scheduledPostTools.test.ts`, `tests/mcp/analyticsTools.test.ts` and `tests/mcp/mediaTools.test.ts` check each tool's input checks, paging and that another person's records are not found and tokens never appear; `tests/routes/mcpRoutes.test.ts` runs `/mcp` and `/api/mcp/*` in the full app (401 with the challenge, the Origin check, 405 for GET, revoked tokens). The media tools also have `tests/services/mediaService.test.ts` (records per person, no Cloudinary id in results, deletes with and without the API secret), `tests/validators/mediaValidators.test.ts` (only public https addresses) and `tests/services/cloudinary/cloudinaryApi.test.ts` (the request Cloudinary gets, and the signature checked against Cloudinary's documented example). On the frontend, `tests/features/settings/claudeAccessData.test.ts` covers the Settings section's helpers, `tests/lib/oauthConsent.test.ts` which return addresses the consent page accepts, and `tests/lib/signInPage.test.ts` that signing in returns only to a path on this site.The Send Email hook has its own tests: `tests/lib/webhookSignature.test.ts` (valid, tampered, wrong-key, multi-signature and replayed requests), `tests/validators/authHookValidators.test.ts`, `tests/services/email/authEmails.test.ts` (the email for each action, the verify links, HTML escaping and the two Secure Email Change emails), `tests/repositories/emailQuotaRepository.test.ts` (daily and per-address caps, hashed keys, Redis failures), `tests/services/authEmailService.test.ts` (Resend requests, idempotency keys, the caps and Resend's own quota errors, skipped notices) and `tests/routes/authHookRoutes.test.ts` (the hook error shape, and the route answering unsigned calls with 401 in the full app). `tests/fixtures/authHook.ts` signs requests the way Supabase Auth does. The Lua claim script cannot run in Node; the repository test runs the same rules in memory. On the frontend, `tests/lib/authErrors.test.ts` covers when the sign-in page shows the daily cap warning and whether it offers Google, `tests/lib/emailAddress.test.ts` when an address looks complete enough to enable the Continue arrow, `tests/lib/googleIdentity.test.ts` the label drawn on the Google button for each text option, and `tests/lib/signInPage.test.ts` when the sign-in page opens the dashboard for a stored session and when it leaves a sign-in on the page to finish.diff --git a/frontend/src/features/settings/ClaudeTokenForm.tsx b/frontend/src/features/settings/ClaudeTokenForm.tsxindex 9c30a66..2bb1350 100644--- a/frontend/src/features/settings/ClaudeTokenForm.tsx+++ b/frontend/src/features/settings/ClaudeTokenForm.tsx@@ -53,7 +53,7 @@ export default function ClaudeTokenForm({ creating, onCreate }: ClaudeTokenFormPclassName="max-w-sm"/></FieldRow>- <FieldRow label="What Claude may do" htmlFor="mcp-token-permission" group hint="Making changes covers scheduling, editing and cancelling posts and saving settings. Claude asks you to confirm before it schedules or cancels a post.">+ <FieldRow label="What Claude may do" htmlFor="mcp-token-permission" group hint="Making changes covers importing media, scheduling, editing and cancelling posts, and saving settings. Claude asks you to confirm before it schedules or cancels a post, or deletes media."><SegmentedChoice<McpPermission>name="mcp-token-permission"id="mcp-token-permission"diff --git a/frontend/src/lib/oauthConsent.ts b/frontend/src/lib/oauthConsent.tsindex 8f91a89..6f46586 100644--- a/frontend/src/lib/oauthConsent.ts+++ b/frontend/src/lib/oauthConsent.ts@@ -5,12 +5,13 @@ const LOCAL_HOSTS = new Set(['localhost', '127.0.0.1', '[::1]']);// what each choice on the consent page lets the app do, in the person's wordsexport const CONSENT_ABILITIES: Record<McpPermission, string[]> = {read: [- 'See your connected accounts, analytics and scheduled posts',+ 'See your connected accounts, analytics, imported media and scheduled posts','See your settings, without any keys or tokens',],write: ['Everything read only allows',- 'Schedule, edit and cancel Instagram posts, after you confirm each schedule or cancellation in Claude',+ 'Import images and videos from a public link, and rename or delete them',+ 'Schedule, edit and cancel Instagram posts; Claude asks you to confirm before it schedules, cancels or deletes anything','Change your GitHub scheduling settings',],};diff --git a/site/content/docs/reference/environment.mdx b/site/content/docs/reference/environment.mdxindex da0fb10..cda7bd2 100644--- a/site/content/docs/reference/environment.mdx+++ b/site/content/docs/reference/environment.mdx@@ -31,6 +31,7 @@ The backend only answers browsers on `FRONTEND_URL` and the addresses in `ALLOWE| `RESEND_API_KEY` <Badge tone="secret">Secret</Badge> | <Badge tone="optional">Optional</Badge> | Resend, API Keys (sending access) | Sends sign-in and verification codes and other auth emails. || `EMAIL_FROM` | <Badge tone="optional">Optional</Badge> | A sender on a domain verified in Resend, for example {'Twiligent <[email protected]>'} | The sender of those emails. || `EMAIL_DAILY_LIMIT` | <Badge tone="optional">Optional</Badge> | A whole number; 100 when not set | Emails a day before the sign-in page pauses email codes and points people to Google or a password. |+| `CLOUDINARY_API_KEY`, `CLOUDINARY_API_SECRET` <Badge tone="secret">Secret</Badge> | <Badge tone="optional">For Claude</Badge> | Cloudinary, Settings, API Keys | Lets Claude delete media files it imported. Without them, a delete only removes Twiligent's record. || `TOKEN_ENCRYPTION_KEY` <Badge tone="secret">Secret</Badge> | <Badge tone="optional">For Claude</Badge> | 32 or more random characters, for example from {'openssl rand -base64 48'} | Signs the confirmations Claude needs before it schedules or cancels a post. || `MCP_OAUTH_ENABLED` | <Badge tone="optional">For Claude</Badge> | `true` | Lets Claude on the web, desktop and mobile connect, after you turn on Supabase's OAuth server. |diff --git a/site/content/docs/use/claude.mdx b/site/content/docs/use/claude.mdxindex 9140c9f..345aa7c 100644--- a/site/content/docs/use/claude.mdx+++ b/site/content/docs/use/claude.mdx@@ -8,10 +8,10 @@ Each connection signs in as you and sees only your accounts. You decide whether| With | Claude can || --- | --- |-| Read only | List your accounts; read YouTube channel and Instagram account analytics; list videos and posts; compare your YouTube channels; read your scheduled posts, your settings (never keys or tokens) and an account's Instagram publishing limit |-| Read and make changes | Everything above, plus schedule, edit and cancel Instagram posts, and change the GitHub scheduling setting |+| Read only | List your accounts; read YouTube channel and Instagram account analytics; list videos and posts; compare your YouTube channels; list your imported media; read your scheduled posts, your settings (never keys or tokens) and an account's Instagram publishing limit |+| Read and make changes | Everything above, plus import images and videos from a public link, rename or delete them, schedule, edit and cancel Instagram posts, and change the GitHub scheduling setting |-Before Claude schedules or cancels a post, it must ask you. Twiligent gives it a one-time confirmation for exactly that post, and it can only go ahead after you agree.+Before Claude schedules or cancels a post, or deletes media, it must ask you. Twiligent gives it a one-time confirmation for exactly that post, and it can only go ahead after you agree.## Connect Claude Code