create-ailk 0.46.6 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/README.md +180 -43
  2. package/component-catalog.json +223 -285
  3. package/component-catalog.md +1 -1
  4. package/dist/apply-design.d.ts +26 -68
  5. package/dist/apply-design.js +150 -322
  6. package/dist/cli.js +152 -17
  7. package/dist/compare-chrome.d.ts +108 -0
  8. package/dist/compare-chrome.js +481 -0
  9. package/dist/compare-look.d.ts +94 -0
  10. package/dist/compare-look.js +378 -0
  11. package/dist/copy.js +1 -1
  12. package/dist/design-compile.d.ts +17 -21
  13. package/dist/design-compile.js +32 -56
  14. package/dist/design-files.d.ts +93 -0
  15. package/dist/design-files.js +312 -0
  16. package/dist/design-home.d.ts +4 -2
  17. package/dist/design-home.js +88 -6
  18. package/dist/design-names.d.ts +13 -0
  19. package/dist/design-names.js +76 -0
  20. package/dist/design-package.d.ts +46 -56
  21. package/dist/design-package.js +285 -288
  22. package/dist/design-presets.d.ts +41 -0
  23. package/dist/design-presets.js +83 -4
  24. package/dist/design-scaffold.d.ts +12 -2
  25. package/dist/design-scaffold.js +72 -34
  26. package/dist/generated/design-settings.d.ts +56 -0
  27. package/dist/generated/design-settings.js +237 -0
  28. package/dist/index.d.ts +1 -1
  29. package/dist/index.js +2 -2
  30. package/dist/inventory.d.ts +3 -2
  31. package/dist/inventory.js +10 -4
  32. package/dist/lib/design-checks.d.ts +46 -0
  33. package/dist/lib/design-checks.js +79 -1
  34. package/dist/lib/env-catalog.js +5 -1
  35. package/dist/lib/module-license-gate.d.ts +1 -1
  36. package/dist/lib/module-license-gate.js +1 -1
  37. package/dist/lib/render-verdict.d.ts +13 -1
  38. package/dist/lib/render-verdict.js +41 -1
  39. package/dist/look-hub.d.ts +44 -0
  40. package/dist/look-hub.js +130 -0
  41. package/dist/look-record.d.ts +35 -0
  42. package/dist/look-record.js +85 -0
  43. package/dist/look-samples.d.ts +66 -0
  44. package/dist/look-samples.js +456 -0
  45. package/dist/look-settings.d.ts +53 -0
  46. package/dist/look-settings.js +363 -0
  47. package/dist/module-architecture.js +12 -0
  48. package/dist/parse-args.d.ts +10 -6
  49. package/dist/parse-args.js +26 -13
  50. package/dist/programmatic.d.ts +1 -19
  51. package/dist/programmatic.js +65 -103
  52. package/dist/retired-design-bodies.d.ts +29 -0
  53. package/dist/retired-design-bodies.js +51 -0
  54. package/dist/seed-flows.d.ts +1 -1
  55. package/dist/seed-flows.js +12 -14
  56. package/dist/seed-workspace.d.ts +4 -1
  57. package/dist/seed-workspace.js +139 -17
  58. package/dist/site-chrome.d.ts +41 -41
  59. package/dist/site-chrome.js +50 -70
  60. package/dist/site-fonts.d.ts +10 -14
  61. package/dist/site-fonts.js +5 -1
  62. package/dist/starter-grid.d.ts +2 -2
  63. package/dist/strip-look-copies.d.ts +67 -0
  64. package/dist/strip-look-copies.js +591 -0
  65. package/dist/template-manifest.d.ts +6 -14
  66. package/dist/template-manifest.js +0 -9
  67. package/dist/template-record.d.ts +3 -1
  68. package/dist/template-record.js +3 -1
  69. package/dist/topology.d.ts +15 -0
  70. package/dist/topology.js +60 -0
  71. package/dist/update.d.ts +57 -1
  72. package/dist/update.js +742 -13
  73. package/package.json +3 -4
  74. package/site-templates/aliases/hub.TEMPLATE-MANIFEST.json +2 -31
  75. package/site-templates/designs/minimalism/DESIGN.md +163 -297
  76. package/site-templates/designs/minimalism/LOOK.md +42 -0
  77. package/site-templates/designs/minimalism/design.yaml +167 -0
  78. package/site-templates/designs/standard/DESIGN.md +145 -149
  79. package/site-templates/designs/standard/LOOK.md +42 -0
  80. package/site-templates/designs/standard/design.yaml +72 -0
  81. package/site-templates/marketing-site/TEMPLATE-MANIFEST.json +2 -31
  82. package/site-templates/marketing-site/TEMPLATE-MANIFEST.md +1 -25
  83. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.json +2 -31
  84. package/site-templates/marketing-site-free/TEMPLATE-MANIFEST.md +1 -25
  85. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.json +2 -31
  86. package/site-templates/shapes/local-business-service/TEMPLATE-MANIFEST.md +1 -25
  87. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.json +2 -31
  88. package/site-templates/shapes/organization-service/TEMPLATE-MANIFEST.md +1 -25
  89. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.json +2 -31
  90. package/site-templates/shapes/person-service/TEMPLATE-MANIFEST.md +1 -25
  91. package/site-templates/shapes/person-service/content/_site.mdx +0 -26
  92. package/templates/.claude/rules/extending.md +3 -2
  93. package/templates/.env.example +11 -4
  94. package/templates/CLAUDE.md +1 -1
  95. package/templates/DESIGN.md +145 -149
  96. package/templates/README.md +15 -16
  97. package/templates/apps/api/.env.example +29 -4
  98. package/templates/apps/api/CLAUDE.md +7 -4
  99. package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
  100. package/templates/apps/api/src/lib/__mocks__/prisma.ts +30 -4
  101. package/templates/apps/api/src/vercel-handler.ts +32 -2
  102. package/templates/apps/mcp/.env.example +8 -0
  103. package/templates/apps/mcp/CLAUDE.md +5 -3
  104. package/templates/apps/web/.env.example +10 -3
  105. package/templates/apps/web/CLAUDE.md +31 -4
  106. package/templates/apps/web/app/[locale]/layout.tsx +141 -77
  107. package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
  108. package/templates/apps/web/app/not-found.tsx +11 -11
  109. package/templates/apps/web/auth.ts +48 -35
  110. package/templates/apps/web/jest.config.cjs +5 -0
  111. package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +542 -10
  112. package/templates/apps/web/lib/__tests__/library-fonts.test.ts +35 -0
  113. package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +233 -0
  114. package/templates/apps/web/lib/__tests__/page-chrome.test.ts +123 -26
  115. package/templates/apps/web/lib/__tests__/section-look.test.ts +150 -0
  116. package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
  117. package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
  118. package/templates/apps/web/lib/__tests__/site-theme.test.ts +81 -289
  119. package/templates/apps/web/lib/deck-page.ts +3 -10
  120. package/templates/apps/web/lib/deploy-fonts.ts +12 -0
  121. package/templates/apps/web/lib/hub-site-config.ts +237 -29
  122. package/templates/apps/web/lib/library-fonts.ts +41 -0
  123. package/templates/apps/web/lib/mcp-oauth.ts +11 -4
  124. package/templates/apps/web/lib/page-chrome.ts +105 -20
  125. package/templates/apps/web/lib/section-look.ts +28 -0
  126. package/templates/apps/web/lib/site-design.ts +205 -0
  127. package/templates/apps/web/lib/site-navigation.ts +208 -0
  128. package/templates/apps/web/lib/site-theme-head.ts +98 -13
  129. package/templates/apps/web/lib/site-theme.ts +40 -62
  130. package/templates/apps/web/messages/en.json +0 -6
  131. package/templates/apps/web/next.config.mjs +213 -11
  132. package/templates/apps/web/package.json +2 -0
  133. package/templates/apps/web/site-pages.config.tsx +4 -2
  134. package/templates/content/_site.mdx +0 -26
  135. package/templates/design.yaml +75 -0
  136. package/templates/project.yaml +14 -0
  137. package/versions.json +52 -51
  138. package/site-templates/marketing-site/DESIGN.md +0 -259
  139. package/site-templates/marketing-site-free/DESIGN.md +0 -259
  140. package/site-templates/saas-product/DESIGN.md +0 -259
  141. package/templates/apps/web/lib/__tests__/deck-page.test.ts +0 -288
  142. package/templates/apps/web/lib/__tests__/site-theme-head.test.ts +0 -70
  143. package/templates/apps/web/lib/site-chrome.ts +0 -46
  144. package/templates/apps/web/lib/site-fonts.ts +0 -15
@@ -98,16 +98,17 @@ Routes are versioned under `/v1/*`:
98
98
  - `GET /v1/workspaces/:workspaceId/knowledge` — the workspace knowledge read (#9683, spec `docs/specs/9683-agent-session-audit-knowledge-spec.md`; `packages-paid/api-workspace/src/routes/workspaces/knowledge.ts`, `// oss: false`): what the business offers, runs and serves, as `workspaceKnowledgeSchema` — `offerings` (the shown offering set, only while the commerce claim is held), `magnets` (the newest flows page's `live` rows), `meetingTypes` (the enabled slugs minus `privateSlugs`, titled by slug), `sitesServed` (the installed hub's live spokes for this workspace, read only when the hub's own gate answers `claimed`, through the optional `HubRegistry.listLiveSpokesForWorkspace`) and `strategyDocs` (`lib/strategy-docs.ts`, `[]` until a store exists) — every key always present, each entry an id, a title and a summary (`null` when it fails its check; an entry whose id or title fails is skipped and counted). Takes no query. Gate: `allows(people-read) || allows(people-memory-propose)` — a person member holds both; an agent only by grant. Every authenticated call writes one `workspace.knowledge.read` audit row (counts only; an agent's carries its session, thread `workspace:<workspaceId>`); `Cache-Control: private, no-store`. Same registration scope as the routes above (`workspace || multi-tenant`, `tenant:settings`). MCP twin: `get_workspace_knowledge` on `/mcp/workspace`.
99
99
  - `GET /v1/workspaces/:workspaceId/craft/:command` — one command's craft (#12015, spec `docs/specs/12015-the-admin-serves-a-plugin-spec.md`; `packages-paid/api-content-write/src/routes/workspaces/craft.ts`, `// oss: false`, in the content-write tenant scope after the overview): any tenant of the workspace (an agent or a cookie session; a personal API token is refused by both guards). `readCommandCraft` (`services/entitlements.ts`) reads the packs the tenant's own workspace has with one resolve call and asks the delivery service once, for this one command, with the site's licence key (`licenseToken()`). It answers 200 `{ command, pack, minShellVersion, craft }` (the craft byte for byte), 403 `pack_required` with `details: { pack, name, where }`, 404 `unknown_command`, or 503 `craft_unavailable` with `details.service` (`entitlements` or `delivery`) — an outage is never a `pack_required`. A command that is not `^[a-z][a-z0-9-]{0,39}$`, or any query key, is 400 `validation_failed`. Nothing is cached, stored or written; `Cache-Control: private, no-store`; one log line per call, `{ event: "craft", outcome, command, workspaceId, pack?, service? }`, never the craft or the key. MCP twin: `get_command_craft` on `/mcp/workspace`.
100
100
  - `/v1/workspaces/:workspaceId/agents` (GET `?userId=`, POST), `/v1/workspaces/:workspaceId/agents/:agentId/key` (POST), `/v1/workspaces/:workspaceId/agents/:agentId` (PATCH `{ enabled }`), `PUT /v1/workspaces/:workspaceId/agents/:agentId/grants` (`{ grants }`, #7864), and `/v1/agent/context` (GET) — the agent seat (#3591, `src/routes/workspaces/agents.ts` over `src/lib/agent-store.ts`, `// oss: false`). An agent is a stored delegate of one person, bound to one workspace. The five management routes refuse an agent caller outright (403), check `agents-manage` (owner, admin) before any read, and scope every read and write to `tenant.organizationId`, never a body or query value; an agent of another organization is the same 404 as a missing one. Create returns 201 with the key shown once; re-key returns the new key once. Each successful create, re-key, switch and grant change writes an `agents.*` audit record. **Grants (#7864, `docs/specs/7864-agent-key-grants-spec.md`).** An agent acts at `member`, plus any of nine permissions an owner or admin granted it one by one — `content-edit`, `content-publish`, `assets-write`, `magnets-manage`, `meeting-types-manage`, `people-read` since #852, `member-pieces-manage` since #7878, and `people-memory-propose` and `inbox-act` since #9679 (`@working-theory/validation`'s `AGENT_GRANTABLE_PERMISSIONS`, held to that set by the `agents_grants_allowed` CHECK). The grant PUT replaces the whole set (an empty list removes every grant) and refuses a grant the agent's person's own role does not hold, `409 grant_exceeds_person`. The clamp is one function both tenant guards call (`services/default-tenant.ts`'s `agentTenant`): an agent holds a stored grant only while its person's role holds it, so a demoted person's agent keeps the row but not the permission. The routes for the nine check `allows(tenant, "<permission>")`, which reads the grants — except that the six existing inbox `inbox-act` checks still read `can(tenant.role, …)` until #9686 moves them, and `people-memory-propose` is read today only by the workspace knowledge read (#9683, beside `people-read`); every other check keeps `can(tenant.role, …)`, so no other owner or admin permission is reachable. Every agent write on content, assets and meeting types writes one `recordAgentWrite` row naming the agent and its person (magnets already did); a person's writes there stay unaudited. The member-area writes audit every caller through `recordAuditAction`, whose actor names an agent as the agent. No grant raises the ceiling. `/v1/agent/context` is the agent's own read, unchanged by grants, and needs no permission beyond the workspace guard. Its `packs` field (#12062, `docs/specs/12062-a-connected-claude-can-read-spec.md`) lists each pack of the tenant's workspace — id, name (`PACK_NAMES`) and `has`, in `PLUGIN_IDS` order, every pack even when the workspace has none — from one `readWorkspacePacks` call, or `{ status: "unavailable" }` when the entitlements service cannot be read, never a "no"; it reads no other workspace, and an all-workspaces call naming no workspace is refused `workspace_required` before any read. Same registration scope as the routes above (`workspace || multi-tenant`).
101
- - `GET /v1/workspaces/:workspaceId/clients`, `DELETE /v1/workspaces/:workspaceId/clients/:clientId[?userId=]` and `PUT /v1/workspaces/:workspaceId/clients/:clientId/outside-send[?userId=]` — the workspace's Connected clients (#10393, `src/routes/workspaces/clients.ts` over `src/lib/connected-clients-store.ts`, `// oss: false`). The GET lists, as one table, the workspace's live OAuth authorizations (one row per client and person, from the token rows bound to this workspace; `lastUsedAt` is the newest sign-in or refresh) and its enabled agent keys, each row `kind`, `id`, `client.name`, `person`, `scopes`, `lastUsedAt`, `outsideSend` and never a token or key. A person holding `agents-manage` (owner, admin) sees every row; anyone else, an agent principal included, sees only their own person's. The DELETE refuses every agent caller (403), ends an OAuth authorization by deleting its token rows for this workspace only (a caller without `agents-manage` may name only themselves — another person's row is the same 404 as a missing one) and an agent key by switching it off (`agents-manage`), touches no session, and writes one audit row and one `connected-client-revoked` log line. A revoke of either kind also clears the connection's outside-send switch. The PUT (#12063, body `{ allowed }`, over `packages/api/src/lib/outside-send-store.ts`) is an owner's switch for one row: it refuses every agent caller and anyone not holding `outside-send` (403), answers 404 for a connection not listed in this workspace now, and refuses to turn on a connection whose person is not an owner now (409 `owner_only`), while turning one off is never refused there; each accepted PUT writes one audit row and one `connected-client-outside-send` log line. Each row's `outsideSend` is `allowed`, `not-allowed` or `unavailable` (its person is not an owner), and a connected Claude reads its own as `outsideSend` in `GET /v1/agent/context`; the Admin cannot stop an outside send, which never passes through it. The GET's MCP twin is `list_connected_clients`; the DELETE and the PUT have no tool, by decision. Same registration scope as the routes above (`workspace || multi-tenant`).
101
+ - `GET /v1/workspaces/:workspaceId/clients`, `DELETE /v1/workspaces/:workspaceId/clients/:clientId[?userId=]`, `PUT /v1/workspaces/:workspaceId/clients/:clientId/outside-send[?userId=]` and `PUT /v1/workspaces/:workspaceId/clients/:clientId/abilities?userId=` — the workspace's Connected clients (#10393, `src/routes/workspaces/clients.ts` over `src/lib/connected-clients-store.ts`, `// oss: false`). The GET lists, as one table, the workspace's live OAuth authorizations (one row per client and person, from the token rows bound to this workspace; `lastUsedAt` is the newest sign-in or refresh) and its enabled agent keys, each row `kind`, `id`, `client.name`, `person`, `scopes`, `switchedOff`, `lockedOff`, `lastUsedAt`, `outsideSend` and never a token or key. `scopes` are the abilities the connection holds now (#12465): an OAuth row's consent narrowed to its person's live role here, less what an owner or admin switched off for it here (`switchedOff`; `lockedOff` the ones an owner switched off); an agent key's stored grants its acting role holds. A person holding `agents-manage` (owner, admin) sees every row; anyone else, an agent principal included, sees only their own person's. The DELETE refuses every agent caller (403), ends an OAuth authorization by deleting its token rows for this workspace only (a caller without `agents-manage` may name only themselves — another person's row is the same 404 as a missing one) and an agent key by switching it off (`agents-manage`), touches no session, and writes one audit row and one `connected-client-revoked` log line. A revoke of either kind also clears the connection's outside-send switch. The PUT (#12063, body `{ allowed }`, over `packages/api/src/lib/outside-send-store.ts`) is an owner's switch for one row: it refuses every agent caller and anyone not holding `outside-send` (403), answers 404 for a connection not listed in this workspace now, and refuses to turn on a connection whose person is not an owner now (409 `owner_only`), while turning one off is never refused there; each accepted PUT writes one audit row and one `connected-client-outside-send` log line. Each row's `outsideSend` is `allowed`, `not-allowed` or `unavailable` (its person is not an owner), and a connected Claude reads its own as `outsideSend` in `GET /v1/agent/context`; the Admin cannot stop an outside send, which never passes through it. The abilities PUT (#12465, body `{ permission, on }`, over `packages/api/src/lib/agent-store.ts`'s `connection_ability_offs` reads and writes) switches one ability of one OAuth row: it refuses every agent caller and anyone not holding `members-manage` (403), answers 400 for an agent key (switched in Workforce), 404 for a connection not listed in this workspace now, 409 `ability_not_held` for an ability its consent never named (and, switching on, one its person's role does not hold), and 403 `owner_switched_off` when a non-owner switches on an ability on their own connection or one an owner switched off; each accepted PUT writes one `agents.set_connection_ability` audit row and one `connected-client-ability` log line. A switched-off ability is gone from the connection's next call (`findOauthPrincipal`) and from `GET /v1/agent/workspaces`. The GET's MCP twin is `list_connected_clients`; the DELETE and both PUTs have no tool, by decision. Same registration scope as the routes above (`workspace || multi-tenant`).
102
102
  - `GET /v1/workspaces/:workspaceId/discovery` and `PUT /v1/workspaces/:workspaceId/discovery` — the owner's discovery switch, whether AI and search tools can find the workspace's site (#10510, `src/routes/workspaces/discovery.ts`, `// oss: false`, over `packages/api/src/services/site-discovery.ts`). Both parse `:workspaceId` with `inboxWorkspaceParamsSchema` (`400 validation_failed`) and act on `request.tenant.workspaceId` only. The GET needs any tenant, an agent included, and answers `{ ok: true, data: { discoverable } }`; the PUT needs `workspace-settings` (owner, admin — an agent is refused, `403`), checked before the strict `{ discoverable: boolean }` body (`400 validation_failed` on anything else), and answers the stored value. The GET's MCP twin is `get_site_discovery`; the PUT has no tool, by decision. Same registration scope as the routes above (`workspace || multi-tenant`, one `tenant:settings` row).
103
103
  - `GET /v1/workspaces/:workspaceId/agent-tools` and `PUT /v1/workspaces/:workspaceId/agent-tools` — what agents can do on the workspace's site, and the owner's per-capability switch for it (#11953, `src/routes/workspaces/agent-tools.ts`, `// oss: false`). Both parse `:workspaceId` with `inboxWorkspaceParamsSchema` (`400 validation_failed`) and act on `request.tenant.workspaceId` only. The GET needs any tenant, an agent included, and answers `{ ok: true, data: { capabilities, deploymentMcp } }` — the three flags `GET /v1/content/agent-tools` answers, from the same `readAgentToolState` (`packages/api/src/services/agent-tool-state.ts`, reached through `buildServer()`'s root decoration), plus whether a keyless MCP server at this deployment is served this workspace. The PUT needs `workspace-settings` (owner, admin — an agent is refused, `403`), checked before the strict `{ off: AgentToolCapability[] }` body (`400 validation_failed` on anything else), writes the `site.agent-tools` row through `writeAgentToolSwitches`, and answers the GET's `data`, recomputed. Neither has a tool, by decision. Same registration scope as the routes above (`workspace || multi-tenant`, one `tenant:settings` row).
104
104
  - `/v1/workspaces/:workspaceId/content` (GET, POST), `/v1/workspaces/:workspaceId/content/:type/:slug` (GET, PATCH), `/v1/workspaces/:workspaceId/content/:type/:slug/{publish,unpublish}` (POST) — the tenant-guarded content editor's write surface (#5853, `src/routes/workspaces/content.ts`): list, create, read/save the draft tip (under `X-Draft-Version`; `If-Match` still accepted for one release, #10264), and publish/unpublish, all over `Artifact`/`ArtifactVersion`. `:type` is validated against the page-type registry (`z.enum(SCHEMA_ORG_TYPES)`) rather than accepted as a free string on every addressed operation — an unregistered type is a 400 before any lookup, since it is echoed back and passed to `notifyRevalidate` as the site's cache tag. Role floors from `@working-theory/validation`'s permission table (#7636 D2): publish and unpublish need `content-publish`, and create, read and save need `content-edit` (both owner, admin — an admin builds, a member operates). The list serves `content-edit` the editor's full view and a caller holding only `docs-read` (a member) a published-only projection (D4): draft rows dropped, every row `status: "published"`, `version: null`, `valid: true`, and a `published_with_draft` page's `type`/`tags` read from its PUBLISHED version — applied before every filter, so a member's `?status=draft` or a draft tip's `?tag=` matches nothing. **The GET list is a UNION of page artifacts and DOCUMENT assets** (#6093, D1/D9 — "one store, two views"): every row carries `tags: string[]` (never null, read from the draft tip's stored content for a page, from `Asset.tags` for a file) and a DERIVED `kind: "page" | "post" | "file"` (`BlogPosting` alone maps to `"post"`; an asset row is always `"file"`) — an optional `?tag=<slug>` filters the union AFTER it is built, so a file is returned under either its own tag or a shared one. The asset half of the union (`DOCUMENT_CONTENT_TYPES`, i.e. `application/pdf`) is skipped entirely when `locale`/`type` is supplied or `status` names anything but `"published"`, since a file row can never satisfy those. A foreign `:workspaceId` costs zero artifact **and** zero asset queries. MCP parity: on `/mcp/workspace`, the create's twin is `create_page` (#10956), the draft read and save are `read_report` and `save_draft` (#10336), and the publish is `publish_draft` (#10661); the list and unpublish have none, as `tests/parity/README.md` and the registry record. `POST /v1/workspaces/:workspaceId/documents/save` (#11811) saves a `Document` — agent context or a plugin-owned document — in the common shape, its address in the body as `POST …/assets/save`'s is: `content-edit` is checked before the body (an agent without it `403 agent_refused`, audited), `version: null` creates and a version edits under a compare-and-swap on the tip, a moved tip or a `null` on an existing document is `409 stale` with `currentVersion`, and a wrong field or word — a plugin contract's misfit included — is `422 invalid` with each issue's path; it never publishes. Its twin is `save_document`; the page save (`PUT …/content/:type/:slug`, `save_page`) also takes an editorial page, whose words are `{ body }`, carrying its stored layout forward. While both ways live, `create_page`, `save_draft` and `save_structure` say they are deprecated. `GET /v1/workspaces/:workspaceId/content/:type/:slug/open?locale=&as=` (#11808, #11882) opens a page laid out in sections as the page envelope: `content-edit` is checked before the query or any read, `as` is `record` (the default: its `fields` and its `words`, the stored layout with the body's words applied) or `working-copy` (a `workingCopy`, `{ document, settings }`, in their place) — `form` is its old name, answered until the release after #11882, and the two sent with different values are `422 invalid` at `as` — a type not laid out in sections is `422 invalid` at `address.type` (a `Document` naming `open_document`), a missing page — or one the caller may not read — a blank built in memory and never stored (#11809): `version` and `structureToken` `null`, `state: "draft"`, `report: null`, `fields: {}` and its template's starting sections headed by the slug, in the shape asked for, a page not in the section form, or whose body's words do not apply cleanly to its layout, `409 not_outlined`, and a page whose working copy would lose a value or exceed the working copy's bounds `409 not_representable` with each issue's path; it never writes or audits, and is limited to 60 calls a minute per workspace. Its twin is `open_page`.
105
105
  - `/v1/workspaces/:workspaceId/library/pages` (GET, `?type=&status=&limit=&page=`) and `/v1/workspaces/:workspaceId/library/assets` (GET, `?tag=&type=&limit=&page=`) — the library reads, each answering `{ workspace: { id, name }, items, total, page, nextPage }` newest first (`limit` 1–200, default 50; `page` from 1; `libraryPageListQuerySchema` / `libraryAssetListQuerySchema` in `@working-theory/validation`). The page list (`packages-paid/api-content-write/src/routes/workspaces/library-pages.ts`, in the content-write tenant scope) serves every page, drafts included, as `{ id, type, slug, locale, title, status, updatedAt }`; `status` is the Docs list's rule — `disabled` when switched off, else `live` when a version is published (a newer draft included), else `draft` — and the route needs `content-edit` (`allows`, so an agent needs the grant). A disabled page is asked for only on a person's behalf: `tenantDb` keeps every disabled row from an agent. The asset list (`packages-paid/api-workspace/src/routes/assets/manage.ts`, beside the manage list, `assets-read`) serves each file's whole record (#11801), `{ id, key, filename, title, description, version, type, size, dimensions, audience, tags, url, updatedAt }` — `title` and `description` with hidden code points removed (`null` when none is written, never left out), `version` the file's record version (`r<n>`, #11803), `type` the content type, `size` its bytes, `dimensions` a raster image's `{ width, height }` as the Admin's Details panel shows it — read from the head of the file — the few bytes a PNG, GIF or WebP needs, at most 64 KiB for a JPEG or AVIF (`tenantDb.assets.fileHeads`, which never reads a private, Knowledge or disabled file) for the answered page's images alone, a JPEG's Exif and an AVIF's `irot` quarter-turn swapping the two (`routes/assets/dimensions.ts`) — and `null` for an SVG, any other file, or a header that does not say, `audience` who may read it, `url` the public read's path, `updatedAt` when the current file was uploaded — the `createdAt` of the version `currentVersion` names (`tenantDb.assets.currentVersionTimes`), so a replace moves it, a restore takes the restored version's upload time, and a metadata edit does not move it; the list is ordered by it, newest first — narrowed by an exact `tag` and a `type` that is a whole content type (`image/png`) or its top-level part (`image`); a file tagged `private` never lists, `?tag=private` included. MCP parity: `list_workspace_pages` and `list_assets` on `/mcp/workspace`.
106
106
  - `/v1/workspaces/:workspaceId/assets/save` (POST, #11803) — save a file's title, description and type: the body is `assetSaveBodySchema` (`{ address: { key }, version: "r<n>" | null, words: { title?, description? }, fields?: { type? } }`, strict at every level; `fields.type` (#11879) is one of the ten asset types and replaces the one the file held, every other tag kept; a type-only save sends `words: {}`), and the answer `{ kind: "asset", address, version, fields: { type }, words, state: "live" }` with the new record version. `assets-write` (`allows`, so an agent may hold it by grant) before the body is read; a wrong body is `422 invalid` with `details.issues` (`{ path, message }`, at most 20); a file the caller may not reach — for an agent also a disabled, private or Knowledge one — the plugin's one `404 not_found`; a save based on another record version, or on `null`, `409 stale` with `details.currentVersion`. One conditional UPDATE (`tenantDb.assets.saveRecord`) writes only `title`, `description`, the type tag and `record_version`, whose `where` carries the version and the reach — and, with a type, the tags it read, so a concurrent tags write reruns it. Every agent call that reaches the body is audited (`assets.save`). An agent's `PATCH …/assets/:assetId` is refused `403 agent_refused`; a person's PATCH of a title or description moves the record version. MCP parity: `save_asset` on `/mcp/workspace`.
107
+ - `/v1/workspaces/:workspaceId/assets/from-url` (POST, #12418; `packages-paid/api-workspace/src/routes/assets/from-url.ts`, registered by `workspaceAssetManageRoutes`, so it shares that plugin's tenant scope and JSON body) — the fetch door: the hub fetches an image from a public `https` address an agent or a person sends and stores it as a NEW public file. The body is `assetFromUrlBodySchema` (`{ url, key, type, title? }`, strict; `url` `https:` with no user name, at most 2,048 characters; `type` one of the ten). Order: `assets-write` (`allows`) before the body; the per-minute limits (`chargeWriteBudget` scope `asset-from-url`, fail closed: 10 per caller keyed as `language.ts` keys its writes, 30 per workspace, `429 rate_limited`; the store unable to count `503 fetch_unavailable`); the body (`422 invalid` with `details.issues`); the key (`tenantDb.assets.keyTaken`, then the Live-page scan — `403 agent_refused` for an agent, `409 key_taken` for a person); the daily cap from the workspace's own rows (`tenantDb.assets.fetchedSince`: 200 files or 500 MB, `429 fetch_quota`); four fetches per process and two per workspace per 10 seconds (`503 fetch_busy`); 400 starts a day (`429 fetch_quota`); then the fetch — every hop's name, every address it resolves to through c-ares (never `dns.lookup`) and the address its socket dials, checked before TLS; at most three redirects; `200`, a raster type proven by its signature, `identity`-encoded, within `assetUploadLimit` and 10 seconds — its metadata stripped to an allowlist without re-encoding and its pixel size bounded; the page scan again; and the write through #12428's seam (`blob`: written with `ttlDays: 1`, recorded with `replace({ createOnly: true, type, title, sourceUrl })`, kept only after the record commits). A refusal answers its own code (`fetch_not_public`, `fetch_bad_redirect`, `fetch_too_many_redirects`, `fetch_type_refused`, `fetch_type_mismatch`, `fetch_image_refused`, `fetch_too_large`, `fetch_unreachable`, `fetch_bad_status`, `fetch_timed_out`) and stores nothing; success is `201` with the open envelope plus `file: { url, contentType, size, version }`. No log line carries the address, its host, the key or the title. `GET …/assets/open` answers `source`, the address the file's first version was fetched from (origin and path only), `null` for an upload. MCP parity: `create_asset_from_url` on `/mcp/workspace`.
107
108
  - `/v1/workspaces/:workspaceId/overview` (GET) — the workspace overview (#11806; `packages-paid/api-content-write/src/routes/workspaces/workspace-overview.ts`, in the content-write tenant scope beside the knowledge-base reads), any tenant of the workspace; any query key is 400 `validation_failed` (`Invalid query`, the key never echoed). It answers `{ site: { name, description, defaultLocale }, knowledge: { documents, complete }, language: { term, faq, topic, proof }, magnets: { draft, live }, withheld: [{ part, reason }] }`, each part by the code and under the gate of the read it replaces: the identity and SEO blobs (any tenant), `addressLocale(undefined)`, the knowledge list's own rows for `context: "knowledge"` (`docs-read`, at the list's reading role) with `version` — the draft tip's id — only where `content-edit` holds and the caller's own role reads the doc's audience, the Language count per kind (`docs-read`, at the caller's own role, one `groupBy`, no cap), and the magnet count per state through `magnetListView` (`draft` only for `magnets-manage`; the part needs `multi-tenant` or `signal-collectors`). A part the caller may not read is `null` (or, for `version` and `draft`, absent) and named in `withheld` with reason `grant` or `module` — never a refusal of the read. At most six queries in one `Promise.all`; the answer is re-parsed against `workspaceOverviewSchemaFor` (a version or draft count the caller may not see is a 500, never a leak); `Cache-Control: private, no-store`; an agent read logs one `agent_read` line, and the knowledge or Language part withheld for its grant one `denied_read` line each, naming the `part`, none naming a document. MCP parity: `get_workspace_overview` on `/mcp/workspace`.
108
109
  - `/v1/workspaces/:workspaceId/documents/open` (`?type=Document&slug=&locale=&as=`, #11808 #11853 #11882 — `as` is `record` or, at a plugin-owned address only, `working-copy`, else `422 invalid` at the key sent; `form` is its old name, as the page open's), `/v1/workspaces/:workspaceId/language/:kind/:slug/open` (`?locale=`) and `/v1/workspaces/:workspaceId/assets/open` (`?key=`) (all GET; the latter two #11809) — open a document, a Language item or a file's record under the common names, beside `open_page`'s route (#11808): each sits beside the read it parallels and takes that read's gate (`content-edit`, `docs-read`, `assets-read`) before any store read, and answers the thing in the common envelope with the `version` its save takes. Nothing at the address — or a thing the caller's read could not see — answers a blank built in memory and never stored: `version: null`, `state: "draft"` and the kind's starting layout (a contract document's `contract`/`contract_version` and required headings, an item's empty words); a file is never blank (`404 not_found`, under the reach `save_asset` gives an agent, for every caller). No open writes or audits. MCP parity: `open_document`, `open_language_item` and `open_asset` on `/mcp/workspace`.
109
- - `/v1/workspaces/:workspaceId/page-types` (GET) and `/v1/workspaces/:workspaceId/tag-vocabulary` (GET) — the site-vocabulary reads (#11680; `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`, in the content-write tenant scope), any tenant of the workspace, no query, no row read. `page-types` answers `{ types: [{ type, route, fixed, template, headings }] }`: every page-type registry entry that is a page, in registry order, with its template's headings as `PAGE_TEMPLATES` states them (`key`, `text`, `required`, `section`, `hint`), filtered per request by the module map `pageTypeModule` in `@working-theory/validation` (the one create-ailk's page-types reference generator reads): `marketing` types always, `scheduling` and `signal-collectors` types when `isModuleEnabled`, and `docs-blog` types when `AILK_ENABLED_MODULES` names `docs-blog` — a site that carries the blog and docs sets that key, since `docs-blog` has no API module. `tag-vocabulary` answers `tagVocabulary()`: `{ classes, topics, status }`, each a list of `{ tag, means, setBy }`. MCP parity: `list_page_types` and `get_tag_vocabulary` on `/mcp/workspace`.
110
- - `/v1/workspaces/:workspaceId/section-types` (GET, optional `?type=`) — the section-types read (#11790; the same file and scope), any tenant of the workspace, no row read. It answers `sectionTypes()` from `@working-theory/validation`: `{ sections: [{ type, dataSection, pins, fields, lists, rules }] }`, every member of `PageSectionSchema` in the union's order — or the one `type` names — with every leaf of its `data` (`path`, words or data, the Markdown `form`, `required` and `within`, value types, `values`, `bounds`), derived from the section schemas and `SECTION_WORDS`. An unknown `type`, or any other query key, is 400 `validation_failed` with the fixed message `Invalid section type filter`. MCP parity: `list_section_types` on `/mcp/workspace`.
110
+ - `/v1/workspaces/:workspaceId/page-types` (GET) and `/v1/workspaces/:workspaceId/tag-vocabulary` (GET) — the site-vocabulary reads (#11680; `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`, in the content-write tenant scope), any tenant of the workspace, no query, no row read. `page-types` answers `{ types: [{ type, route, fixed, template, headings, sections }] }`: every page-type registry entry that is a page, in registry order, with its template's headings as `PAGE_TEMPLATES` states them (`key`, `text`, `required`, `section`, `hint`) and `sections`, the layout a new page of the type starts with (`{ id, type }` per section in order, read off the same template by `startingSectionsOf`, so it equals what `templateSections` creates a page with, #12516); the rows are filtered per request by the module map `pageTypeModule` in `@working-theory/validation` (the one create-ailk's page-types reference generator reads): `marketing` types always, `scheduling` and `signal-collectors` types when `isModuleEnabled`, and `docs-blog` types when `AILK_ENABLED_MODULES` names `docs-blog` — a site that carries the blog and docs sets that key, since `docs-blog` has no API module. `tag-vocabulary` answers `tagVocabulary()`: `{ classes, topics, status }`, each a list of `{ tag, means, setBy }`. MCP parity: `list_page_types` and `get_tag_vocabulary` on `/mcp/workspace`.
111
+ - `/v1/workspaces/:workspaceId/section-types` (GET, optional `?type=`) — the section-types read (#11790; the same file and scope), any tenant of the workspace, no row read. It answers `sectionTypes()` from `@working-theory/validation`: `{ sections: [{ type, purpose, whenToUse, carries, dataSection, pins, fields, lists, rules }] }`, every member of `PageSectionSchema` in the union's order — or the one `type` names — with what it is for, when to choose it and the parts of a page's pyramid it can carry (`carries: { answer, claims, frame }`, in `SUPPORT_KINDS` and `FRAME_PARTS`; read from `SECTION_PURPOSES`, #12514), and every leaf of its `data` (`path`, words or data, the Markdown `form`, `required` and `within`, value types, `values`, `bounds`), derived from the section schemas and `SECTION_WORDS`. An unknown `type`, or any other query key, is 400 `validation_failed` with the fixed message `Invalid section type filter`. MCP parity: `list_section_types` on `/mcp/workspace`.
111
112
  - `/v1/workspaces/:workspaceId/kinds` (GET) — the kinds read (#11805; the same file and scope), any tenant of the workspace, no query, no row read. It answers `listKinds(request.tenant, isModuleEnabled)` from `@working-theory/metadata`: `{ kinds: [{ kind, address, fields, moreFields, sectionTypes, states, moves }] }`, one entry per kind of `ADMIN_KIND_REGISTRY` (`@working-theory/validation`) — page, document, language_item, magnet, asset — whose address, fields and states are read off that kind's own schemas, and whose `moves` are the catalog rows tagged with the kind, kept only when the row's gate holds for the CLAMPED tenant the guard built (never an agent's stored grants or a token's raw scopes) and one of its modules runs on this hub; a page's `sectionTypes` names `list_section_types` rather than repeating it. Beside `kinds` (#11878) it answers `forms` (`[{ kind, field, values }]` — each kind's form field and its values, read off that field's own schema through `KIND_FORMS`, then an offering's `ailkGroup` and an appointment with no form), `offSiteForms` (`[{ form, formats }]`), `formats` and `origins`, all from `adminKinds()` and the same for every caller and hub. Advice, never an entitlement: no write path may gate on it. MCP parity: `list_kinds` on `/mcp/workspace`.
112
113
  - `/v1/workspaces/:workspaceId/assets` (GET, POST), `/v1/workspaces/:workspaceId/assets/:assetId` (PATCH, DELETE), `/v1/assets/:assetId` (GET, public/anonymous) — the workspace asset store (#5854 upload/read; #6093 list/PATCH/DELETE, `src/routes/assets/{index,upload,read,manage}.ts`). Upload accepts an allowlisted union of three named classes (`src/routes/assets/index.ts`): five RASTER images (`image/png`, `image/jpeg`, `image/gif`, `image/webp`, `image/avif`), one VECTOR image (`image/svg+xml`, admitted under the operator's 2026-09-18 `allow-svg-assets` ruling — issue #6093 comment `5731573595` — superseding #5854's original SVG exclusion) and one DOCUMENT type (`application/pdf`), all under the existing 20 MB cap; `?tags=<slug>[,<slug>…]` stores tags on the row. The public read serves a RASTER type `inline` exactly as before; every OTHER admitted type (SVG, PDF) is served `attachment`, with the filename's extension pinned to the stored content type (closing extension spoofing) and a five-directive `Content-Security-Policy` (`default-src 'none'; sandbox; frame-ancestors 'none'; form-action 'none'; base-uri 'none'`) that makes the bytes never a document on this origin — this is what makes admitting SVG safe with NO server-side sanitizer. `GET …/assets` (`assets-read` — every role, a member included) lists a workspace's assets, metadata only, never `bytes`, with an optional `?tag=<slug>` filter; this is what narrows the store's prior "nothing lists assets" premise to its precise form — no ANONYMOUS and no CROSS-TENANT enumeration, both still true. `PATCH …/assets/:assetId` updates `title`/`description`/`tags` (`assets-write`, owner and admin, the upload's permission too; `null` clears a text field to SQL `NULL`, `""` stores empty; the asset's `id` and public URL are untouched). `DELETE …/assets/:assetId` (`assets-write`) removes the row and the bytes at the ORIGIN only — already-cached copies elsewhere are not recallable under the year-long `immutable` promise, and no reference check protects a page that still embeds the URL; absent and foreign ids both take the same 404. Every tenant route here is identity-bound; no MCP twin (#3591 exception). The public read has no MCP twin either — it serves bytes to an `<img>`/download, the same boundary `upload.ts` records for its own sibling. **A client's file is never in the library's public life (#7877 D18):** the default `GET …/assets` listing leaves out every asset tagged `private` — only `?tag=private` lists them (the Admin's Compose) — and the public read answers its uniform 404 for an asset tagged `private`, attached to any member-area message, or (#8171 D3) named by a delivered piece version (one `pieceVersion.count`, since the tag can be removed after delivery), so such a file's bytes are served only by its owner's member reads.
113
114
  - `/v1/subscription/me` (GET) — `?include=billing` (#8171 D7), from a cookie session only, adds the optional `planName` and `paymentMethod` (brand, last four, expiry) read from Stripe through `lib/stripe.ts`'s `readCustomerBillingSummary` for the caller's own resolved customer: cached per customer for 60 s (a failure too), one read in flight per customer, bounded at 3 s; a failure leaves both keys absent, a value outside the schema's bounds is `null`, and no id is served or logged. A bearer token, another value or none answers exactly as before.
@@ -247,7 +248,9 @@ sweep's own DB constraint (never a caller-side lock).
247
248
  - Don't bundle `apps/api` (esbuild, rollup, webpack). Slice specifiers cannot survive it — see `## Deploy path`.
248
249
  - Don't construct Fastify with `logger: true` or any `logger:` option. Pass `loggerInstance` built from `createLogger` in `@working-theory/observability` (see `packages/api/src/server.ts`). Fastify's own pino carries none of the redaction.
249
250
 
250
- Last updated: 2026-11-25 — #12337: `POST /v1/billing/trial-card` and its check order beside plan-checkout, the portal session's payer check and Plan overview return token, and a paused plan offering no change — verified against `packages-paid/api-multi-tenant/src/routes/billing/{trial-card,portal}.ts`, `packages/api/src/lib/write-reservations.ts` and `packages/api/src/services/offerings/{plan-change,member-billing}.ts`.
251
+ Last updated: 2026-11-28 — #12516: the page-types row's `sections`, a new page's starting layout read off its template — verified against `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts` and `packages/validation/src/contract/templates.ts`.
252
+
253
+ Prior: 2026-11-25 — #12337: `POST /v1/billing/trial-card` and its check order beside plan-checkout, the portal session's payer check and Plan overview return token, and a paused plan offering no change — verified against `packages-paid/api-multi-tenant/src/routes/billing/{trial-card,portal}.ts`, `packages/api/src/lib/write-reservations.ts` and `packages/api/src/services/offerings/{plan-change,member-billing}.ts`.
251
254
 
252
255
  Prior: 2026-11-25 — #12336: the plan-checkout sentence names the `change` branch and its check order, and the webhook gains the plan-change path after the plugin path — verified against `packages-paid/api-multi-tenant/src/routes/billing/plan-checkout.ts`, `packages/api/src/services/offerings/{plan-change,member-billing}.ts` and `packages/api/src/routes/webhooks/stripe.ts`.
253
256
 
@@ -35,7 +35,7 @@
35
35
  */
36
36
 
37
37
  import { createHmac } from 'node:crypto';
38
- import { PassThrough } from 'node:stream';
38
+ import { PassThrough, Readable } from 'node:stream';
39
39
 
40
40
  import type { VercelRequest, VercelResponse } from '@vercel/node';
41
41
  import Fastify from 'fastify';
@@ -245,7 +245,7 @@ jest.mock('@working-theory/license', () => ({
245
245
  jest.mock('@working-theory/analytics/server', () => ({
246
246
  track: jest.fn().mockResolvedValue(undefined),
247
247
  }));
248
- // eslint-disable-next-line no-restricted-syntax -- lib/prisma.ts wraps the external DB boundary (PrismaClient requires a live connection); __mocks__/prisma.ts is the repo-standard test double for this boundary.
248
+
249
249
  jest.mock('@working-theory/api/lib/prisma.js');
250
250
 
251
251
  /** Stripe's v1 scheme: `t=<ts>,v1=<hex HMAC-SHA256(secret, "<ts>.<payload>")>`. */
@@ -671,3 +671,177 @@ describe('vercel-handler — the request log carries no query string (#5970)', (
671
671
  expect(inject.mock.calls[0][0]).toMatchObject({ url: '/v1/webhooks/stripe/whk_SECRETTOKEN123' });
672
672
  });
673
673
  });
674
+
675
+ // ── #12428 D4: a deliverable leaves the handler as a stream ─────────────────
676
+ //
677
+ // Vercel refuses a whole response over 4.5 MB; a streamed one is exempt. A
678
+ // `GET`/`HEAD` under `/v1/deliverables/` is injected with `payloadAsStream`
679
+ // and piped into `res`; every other request keeps the whole-payload `send`.
680
+
681
+ /** A writable `res` that records what is piped into it. */
682
+ function makeStreamRes() {
683
+ const res = Object.assign(new PassThrough(), {
684
+ headersSent: false,
685
+ _status: undefined as number | undefined,
686
+ _headers: {} as Record<string, string>,
687
+ _sent: undefined as unknown,
688
+ chunks: [] as Buffer[],
689
+ ended: false,
690
+ status(code: number) {
691
+ this._status = code;
692
+ return this;
693
+ },
694
+ setHeader(key: string, value: string) {
695
+ this._headers[key] = value;
696
+ return this;
697
+ },
698
+ getHeader(key: string) {
699
+ return this._headers[key];
700
+ },
701
+ send(body: unknown) {
702
+ this._sent = body;
703
+ return this;
704
+ },
705
+ json(body: unknown) {
706
+ this._sent = body;
707
+ return this;
708
+ },
709
+ });
710
+ res.on('data', (chunk: Buffer) => res.chunks.push(chunk));
711
+ res.on('finish', () => {
712
+ res.ended = true;
713
+ });
714
+ return res;
715
+ }
716
+
717
+ function asStreamResponse(stub: ReturnType<typeof makeStreamRes>): VercelResponse {
718
+ // @ts-expect-error: a PassThrough carrying the MockRes surface satisfies the
719
+ // subset of VercelResponse the handler calls (status/setHeader/getHeader/
720
+ // send/json, plus the Writable `pipe` writes to).
721
+ return stub;
722
+ }
723
+
724
+ describe('vercel-handler — a deliverable answer leaves as a stream (#12428 D4)', () => {
725
+ const FILE = Buffer.from([0x25, 0x50, 0x44, 0x46, 0x2d, 0x80, 0xff, 0xfe, 0x00, 0x01]);
726
+ let app: ReturnType<typeof Fastify>;
727
+
728
+ beforeEach(async () => {
729
+ jest.resetModules();
730
+ app = Fastify();
731
+ app.get('/v1/deliverables/:grantId', async (_request, reply) => {
732
+ reply
733
+ .header('content-type', 'application/pdf')
734
+ .header('content-disposition', 'attachment; filename="report.pdf"')
735
+ .header('cache-control', 'private, no-store');
736
+ return reply.send(Readable.from([FILE.subarray(0, 4), FILE.subarray(4)]));
737
+ });
738
+ // `/late` fails after the first chunk has gone out; `/early` fails before
739
+ // the handler has read the stream at all.
740
+ app.get('/v1/deliverables/broken/:when', async (request, reply) => {
741
+ const { when } = request.params as { when: string };
742
+ const failure = new Error('store said https://x.private.blob.vercel-storage.com/a');
743
+ let reads = 0;
744
+ const failing = new Readable({
745
+ read() {
746
+ if (when === 'early') {
747
+ this.push(FILE.subarray(0, 4));
748
+ this.destroy(failure);
749
+ } else if (reads++ === 0) {
750
+ this.push(FILE.subarray(0, 4));
751
+ } else {
752
+ setImmediate(() => this.destroy(failure));
753
+ }
754
+ },
755
+ });
756
+ reply.header('content-type', 'application/pdf');
757
+ return reply.send(failing);
758
+ });
759
+ app.get('/v1/other', async () => ({ ok: true }));
760
+ await app.ready();
761
+ });
762
+
763
+ afterEach(async () => {
764
+ await app.close();
765
+ });
766
+
767
+ it('pipes a GET under /v1/deliverables/ with payloadAsStream and no Location', async () => {
768
+ const inject = jest.spyOn(app, 'inject');
769
+ jest.doMock('../server', () => ({ build: jest.fn().mockResolvedValue(app) }));
770
+ const handler = loadHandler();
771
+ const res = makeStreamRes();
772
+ const send = jest.spyOn(res, 'send');
773
+
774
+ await handler(
775
+ asRequest({ method: 'GET', url: '/v1/deliverables/grant_1', headers: {}, body: undefined, query: {} }),
776
+ asStreamResponse(res),
777
+ );
778
+
779
+ expect(inject.mock.calls[0][0]).toMatchObject({ payloadAsStream: true });
780
+ expect(send).not.toHaveBeenCalled();
781
+ expect(res._status).toBe(200);
782
+ expect(res._headers['content-type']).toBe('application/pdf');
783
+ expect(res._headers['content-disposition']).toBe('attachment; filename="report.pdf"');
784
+ expect(Object.keys(res._headers).map((k) => k.toLowerCase())).not.toContain('location');
785
+ expect(res.ended).toBe(true);
786
+ expect(Buffer.compare(Buffer.concat(res.chunks), FILE)).toBe(0);
787
+ });
788
+
789
+ it('streams a HEAD under /v1/deliverables/ too', async () => {
790
+ const inject = jest.spyOn(app, 'inject');
791
+ jest.doMock('../server', () => ({ build: jest.fn().mockResolvedValue(app) }));
792
+ const handler = loadHandler();
793
+ const res = makeStreamRes();
794
+
795
+ await handler(
796
+ asRequest({ method: 'HEAD', url: '/v1/deliverables/grant_1', headers: {}, body: undefined, query: {} }),
797
+ asStreamResponse(res),
798
+ );
799
+
800
+ expect(inject.mock.calls[0][0]).toMatchObject({ payloadAsStream: true });
801
+ expect(res._status).toBe(200);
802
+ expect(res.ended).toBe(true);
803
+ });
804
+
805
+ it.each(['late', 'early'])('ends the response when the stream fails (%s) and logs the error name only', async (when) => {
806
+ jest.doMock('../server', () => ({ build: jest.fn().mockResolvedValue(app) }));
807
+ const handler = loadHandler();
808
+ const res = makeStreamRes();
809
+
810
+ await handler(
811
+ asRequest({ method: 'GET', url: `/v1/deliverables/broken/${when}`, headers: {}, body: undefined, query: {} }),
812
+ asStreamResponse(res),
813
+ );
814
+
815
+ const { logger } = require('@working-theory/observability') as {
816
+ logger: { error: jest.Mock };
817
+ };
818
+ const failure = logger.error.mock.calls.find(
819
+ ([, msg]) => msg === '[Vercel Handler] Streamed response failed',
820
+ );
821
+ expect(failure?.[0]).toEqual({ err: 'Error' });
822
+ expect(JSON.stringify(logger.error.mock.calls)).not.toContain('blob.vercel-storage.com');
823
+ // `pipeline` destroys the response on a failure: the download aborts.
824
+ expect(res.ended || res.destroyed).toBe(true);
825
+ });
826
+
827
+ it.each([
828
+ ['GET', '/v1/other'],
829
+ ['POST', '/v1/deliverables/grant_1'],
830
+ ])('keeps the whole payload for %s %s', async (method, url) => {
831
+ const rawPayload = Buffer.from('{"ok":true}');
832
+ const inject = jest.fn().mockResolvedValue({
833
+ statusCode: 200,
834
+ headers: { 'content-type': 'application/json' },
835
+ body: rawPayload.toString(),
836
+ rawPayload,
837
+ });
838
+ jest.doMock('../server', () => ({ build: jest.fn().mockResolvedValue({ inject }) }));
839
+ const handler = loadHandler();
840
+ const res = makeRes();
841
+
842
+ await handler(asRequest({ method, url, headers: {}, body: undefined, query: {} }), asResponse(res));
843
+
844
+ expect(inject.mock.calls[0][0]).not.toHaveProperty('payloadAsStream');
845
+ expect(res._sent).toBe(rawPayload);
846
+ });
847
+ });
@@ -198,19 +198,45 @@ export const prisma = {
198
198
  findMany: jest.fn(),
199
199
  },
200
200
  // ── Config namespace (per-workspace site config — #3641/#3634) ───────────
201
- workspaceTheme: {
201
+ workspaceSiteIdentity: {
202
202
  findUnique: jest.fn(),
203
203
  upsert: jest.fn(),
204
204
  deleteMany: jest.fn(),
205
205
  },
206
- workspaceSiteIdentity: {
206
+ workspaceSEO: {
207
207
  findUnique: jest.fn(),
208
208
  upsert: jest.fn(),
209
209
  deleteMany: jest.fn(),
210
210
  },
211
- workspaceSEO: {
211
+ // #12400 D2 — the site navigation and its versions: the accessor's guarded
212
+ // save, list and read, and the workspace-delete helper's `deleteMany`.
213
+ workspaceSiteNavigation: {
212
214
  findUnique: jest.fn(),
213
- upsert: jest.fn(),
215
+ findMany: jest.fn(),
216
+ createManyAndReturn: jest.fn(),
217
+ updateManyAndReturn: jest.fn(),
218
+ deleteMany: jest.fn(),
219
+ },
220
+ workspaceSiteNavigationVersion: {
221
+ findUnique: jest.fn(),
222
+ findFirst: jest.fn(),
223
+ findMany: jest.fn(),
224
+ create: jest.fn(),
225
+ deleteMany: jest.fn(),
226
+ },
227
+ // #12470 D4 — the design record and its versions: the accessor's guarded
228
+ // save, list and read, the site's hub read and the workspace-delete helper.
229
+ workspaceSiteDesign: {
230
+ findUnique: jest.fn(),
231
+ createManyAndReturn: jest.fn(),
232
+ updateManyAndReturn: jest.fn(),
233
+ deleteMany: jest.fn(),
234
+ },
235
+ workspaceSiteDesignVersion: {
236
+ findUnique: jest.fn(),
237
+ findFirst: jest.fn(),
238
+ findMany: jest.fn(),
239
+ create: jest.fn(),
214
240
  deleteMany: jest.fn(),
215
241
  },
216
242
  // `findUnique` — the public meetings read (`lib/public-meetings-config.ts`),
@@ -3,6 +3,8 @@
3
3
  * This file wraps the Fastify server for Vercel's serverless functions
4
4
  */
5
5
 
6
+ import { pipeline } from "node:stream";
7
+
6
8
  import type { VercelRequest, VercelResponse } from "@vercel/node";
7
9
  import { redactLogPath } from "@working-theory/api";
8
10
  import { logger } from "@working-theory/observability";
@@ -240,7 +242,18 @@ export default async function handler(
240
242
  query: req.query as Record<string, string>,
241
243
  };
242
244
 
243
- const response = await server.inject(fastifyRequest as InjectOptions);
245
+ // A deliverable's file leaves as a STREAM (#12428 D4): Vercel refuses a
246
+ // whole response over 4.5 MB, and a streamed one is exempt. Every other
247
+ // request keeps the whole-payload path below, byte for byte.
248
+ const streamed =
249
+ (method === "GET" || method === "HEAD") &&
250
+ pathname.startsWith("/v1/deliverables/");
251
+
252
+ const response = await server.inject(
253
+ (streamed
254
+ ? { ...fastifyRequest, payloadAsStream: true }
255
+ : fastifyRequest) as InjectOptions,
256
+ );
244
257
 
245
258
  logger.info(
246
259
  { status: response.statusCode },
@@ -264,7 +277,24 @@ export default async function handler(
264
277
  res.setHeader("Content-Type", "application/json");
265
278
  }
266
279
 
267
- if (!res.headersSent) {
280
+ if (streamed && !res.headersSent) {
281
+ // A stream that fails mid-file ends the response — `pipeline` destroys
282
+ // it, so the client sees an aborted download, never a short file as if
283
+ // whole — and the log names the error alone, never its message (which
284
+ // could carry a store address). It also destroys the file stream when
285
+ // the client goes away, so an aborted download holds no store read open.
286
+ await new Promise<void>((resolve) => {
287
+ pipeline(response.stream(), res, (error) => {
288
+ if (error) {
289
+ logger.error(
290
+ { err: error.name },
291
+ "[Vercel Handler] Streamed response failed",
292
+ );
293
+ }
294
+ resolve();
295
+ });
296
+ });
297
+ } else if (!res.headersSent) {
268
298
  // Forward the raw bytes light-my-request kept alongside `.body` — the
269
299
  // decoded-as-UTF-8-string form corrupts any non-UTF-8 response (a
270
300
  // generated PDF, any binary payload) by replacing every invalid byte
@@ -105,6 +105,14 @@ MCP_ABUSE_BLOCKED_USER_AGENTS=
105
105
  # Required ONLY on a hub's CONTENT_ADAPTER=database — never on a spoke.
106
106
  # DATABASE_URL=
107
107
 
108
+ # A hub's CONTENT_ADAPTER=database only (#12420): the hub API's public URL —
109
+ # the SAME value the hub's apps/api holds. A page's stored images (asset:<key>)
110
+ # resolve onto its origin, so read_content, list_pages and search_content
111
+ # answer the address the API's routes do. Unset or not http(s), stored images
112
+ # are left out of every read and the server writes one stderr line saying so.
113
+ # A spoke reads its hub's API, which resolves them: leave it unset there.
114
+ # AILK_PUBLIC_API_URL=
115
+
108
116
  # ── STEALTH ──────────────────────────────────────────────────────────────────
109
117
 
110
118
  # Optional. Set to "true" on this server's own hosting project to keep its
@@ -204,7 +204,7 @@ here. Spec: `docs/specs/3591-tenant-scoped-agent-auth-secure-spec.md` D13–D16.
204
204
  - **apps/mcp checks only the key's shape.** The key is attached as the SDK's `req.auth` for that
205
205
  request alone and reaches a tool as `extra.authInfo.token`. apps/api is the one place it is
206
206
  checked, and its tenant guard and the caller's clamped role decide every answer.
207
- - **Ninety tools (eighty-seven plus three deprecated aliases), each a `twin`.** The catalog rows carry `surface: "workspace"`, `tier: "pro"`
207
+ - **A hundred tools (ninety-seven plus three deprecated aliases), each a `twin`.** The catalog rows carry `surface: "workspace"`, `tier: "pro"`
208
208
  and `modulesAnyOf` (the modules any one of which registers the tool — its twin route's gate):
209
209
  `get_agent_context`, (#9683) `get_workspace_knowledge` — twin of `GET
210
210
  /v1/workspaces/:workspaceId/knowledge`: the business's shown offerings, live magnets, listed
@@ -226,7 +226,7 @@ here. Spec: `docs/specs/3591-tenant-scoped-agent-auth-secure-spec.md` D13–D16.
226
226
  tools, `list_proposals` and `create_proposal`, twinning `GET`/`POST
227
227
  /v1/workspaces/:workspaceId/people/:personId/proposals` with the same grant: a proposal is
228
228
  private to one client, `payments` says whether approval leads to a Stripe page, and an agent's
229
- price is refused `proposal_needs_person` (a person prices) — and (#10957) `send_person_message`, twinning `POST …/people/:personId/messages`: one message on a client's member feed, saved then emailed (an agent's only to a proved address), needing `inbox-act` with `people-read` or `member-pieces-manage`, and `assets-write` for a file; the operator's message list has no tool, by decision — and (#9681) the four person-thread tools, `get_person_thread`, `set_person_thread_state`, `list_external_threads` and `add_external_thread`, twinning `GET`/`PATCH …/people/:personId/thread` and `GET`/`POST …/people/:personId/external-threads`: a client's whole thread page by page with its read/archived/resolved state, and pointers to email and Slack threads (never message text); reading needs the `people-read` grant, writing also `inbox-act`, and the client erasure route has no tool, by decision — and (#9682) the three person-memory tools, `list_person_memories`, `get_person_memory` and `propose_person_memory`, twinning `GET …/people/:personId/memories`, `GET …/memories/:path` and `POST …/memories`: an agent reads only live, unexpired memories (confirmed by a person, read within 180 days) and its proposal is never live — a new path is a draft, a confirmed one gets a pending version — needing the `people-read` or `people-memory-propose` grant to read and `people-memory-propose` to propose; the six person-only memory routes (edit, delete, confirm, redact, the versions list, restore) have no tool, by decision — and (#9749) `get_slack_connection_status`, twin of `GET /v1/workspaces/:workspaceId/slack-connection` (registered with `workspace`/`multi-tenant`, its route's `TENANCY` row: whether the Organization's Slack is connected, its team name and the date, never a credential; connect and disconnect are a person's act and have no tool, by decision), and `get_prospect_channel_settings` / `set_prospect_channel_settings`, twins of `GET`/`PUT …/prospect-channel` (registered with `scheduling`, their routes' module): the update replaces every field, needs the `meeting-types-manage` grant, is refused `slack_not_connected` while the Organization has no Slack connection, and an agent may change only `enabled`, `channelPrefix` and `archiveDays` — a change to `memberIds` or `welcomeTemplate` is refused `prospect_channel_needs_person` — and (#10950) the three meeting tools, `list_meeting_types`, `save_meeting_types` and `list_appointments`, twinning `GET`/`PUT …/meetings` and `GET /v1/schedule/appointments` (registered with `scheduling`): the meeting types from the connected calendar, each with whether it is Live (`enabled`) and who can book it (`visibility`: `public`, `private` or `authenticated`), the provider's `providerEventTypeId` and `createdAt` when it serves them, and, with the `meeting-types-manage` grant, `providerEditUrl` — the read takes no `include` (#11122 D4); the save needs that grant and its required `enabledSlugs` replaces the Live list, while `customerSlugs` (Authenticated) and `privateSlugs` (Private) are exclusive — a slug in both is refused — and an omitted one keeps the stored list less the sent list's slugs, and no price is set there; the appointments read is every role's, and an agent's only with the `people-read` grant (#10986), takes `eventTypeId` for one type's bookings (#11122 D12) and `workspaceId` when the connection reaches several workspaces (#11753), and its attendee names and emails are public-written text; the three scheduling-connection routes have no tool, by decision — and (#10218) the content-suggestion pair, `draft_page_suggestions` and `decide_page_suggestion` — and (#10336) the draft pair, `save_draft` and `read_report`, twinning `PATCH`/`GET …/content/:type/:slug` with the `content-edit` grant: `save_draft` takes the page's `content` whole as the PATCH body and its `version` as `X-Draft-Version`, writes a draft version that never goes live, and answers 409 `conflict` with `currentVersion` when the draft moved; `read_report` returns the draft tip, the version a save must send, the page's stored layout (`structure`, #10962) and the token `save_structure` must send, its open suggestions and the route's check report (`ready`, `needs repair` or `needs your words`), computed by the route and never by the tool — and (#10956) `create_page`, twinning `POST …/content` with the `content-edit` grant: it creates a page and its first draft from `content` sent whole (its `type` and `slug` are the address) — a page type laid out in sections sent no words (no body, an empty one, or only its template's headings) starts from its template (#11793): the hub lays out the template's sections, each headed by its default headline with an empty field to write under, and stores the words and the layout together, refusing a title or description the words rules refuse, or a `sections` key, 422 `invalid` — never publishes, and answers 409 `conflict` when the page exists and 409 `slug_taken` when another page holds the link — and (#11791) `save_page`, twinning `PUT …/content/:type/:slug` with the `content-edit` grant, under the common names of `docs/internal/decisions/one-way-common-names.md`: it saves a page laid out in sections — its `fields` and its `words` (its sections in order, each `{ id, type, data }`) — in one draft version that holds the body the hub builds from the words and the layout together; `address` (type, slug, locale) rides the URL, and `version` with `structureToken` is what the save was based on, both `null` for a new page; a save whose basis is no longer the tip, or `null` for a page that exists, answers 409 `stale` with `currentVersion` and `currentStructureToken`, and a wrong field or word 422 `invalid` with `issues` (`path`, `message`), the one refusal pair whose details reach the tool; it never publishes; since #11811 it also saves an editorial page, whose `words` are `{ body }`, its Markdown, carrying the stored layout forward; since #11808 (#11852) a page laid out in sections may send `workingCopy`, `{ document, settings }` — the two tabs of a working copy as exported — in place of `fields` and `words`: the hub converts it against the tip it was based on (409 `stale` before converting), keeps the stored fields a Settings table cannot carry, refuses a wrong copy 422 `invalid` at `workingCopy.settings`, `workingCopy.document` or the envelope path, and answers the page as a working copy — and (#11811) `save_document`, twinning `POST …/documents/save` with the `content-edit` grant: it saves a `Document` (Instructions, Knowledge or a plugin-owned document) in the same common shape — `address` (`type` always `Document`, slug, locale) rides the body, as `save_asset`'s does, `version` is `null` for a new document, `fields` are the page save's, and `words` is `{ body }`; a moved tip or a `null` on an existing document answers 409 `stale` with `currentVersion` alone, and a wrong field or word — a plugin contract's misfit included, each issue at its path (`fields.contract_version`, `words.body`) — 422 `invalid`, both details rebuilt in `workspace-server.ts`; a document never goes live; since #11808 it takes, at a plugin-owned contract address only, `workingCopy` (`{ document, settings }`, the two tabs of a working copy as exported) in place of `fields` and `words`, which the hub converts against the tip it was based on and answers in the same form (the record form when the copy would outgrow its bounds) — and (#11808) `open_document`, twinning `GET …/documents/open` with the `content-edit` grant: the read twin of `save_document`, its `address` in the query, answering the envelope as the record or, with `as: "working-copy"` and only at a plugin-owned address (else 422 `invalid` at the key sent), the working copy (409 `not_representable` when it would outgrow its bounds); since #11882 `open_page` and `open_document` take `as` where they took `form`, which stays the old name for one release (the catalog keeps it, so the SDK never strips it), and the route refuses the two sent with different values 422 `invalid` at `as`; it never writes, and its `invalid` keeps `issues` (`path`, `message`, each cut to 200 characters). — and (#11809) `open_language_item` and `open_asset` (`mcp-workspace`'s `language.ts` and `library.ts`), twinning `GET …/language/:kind/:slug/open` and `GET …/assets/open` under the gate of the read each parallels (`docs-read`, `assets-read`): each takes `{ workspaceId, address }` (plus `locale` for an item) and answers the thing in the common envelope with the `version` its save takes, or — nothing at the address, or nothing the caller may read there — an item's blank, `version: null` and its kind's empty words, which the save with `version: null` starts; a file is never blank (`404 not_found`); and `open_page` and `open_document` answer the same kind of blank where they answered 404 — a page its template's starting sections, headed by the slug, and a document at a plugin-owned contract address its contract's constant fields and required headings, else nothing; no open writes, and the section map lists `open_` tools as reads. While both ways live, `create_page`, `save_draft` and `save_structure` open their descriptions with a deprecation naming `save_page` or `save_document`; nothing else about them changes until the removal (#11811 D2, D6) — and (#10661) `publish_draft`, twinning `POST …/content/:type/:slug/publish` with the `content-publish` grant: it publishes the draft tip (or a named version) exactly as a person holding that permission does, an agent without the grant is refused 403 `agent_refused` before anything is read, and it never widens Audience or re-enables a doc — and (#10345) the knowledge-base pair, `read_knowledge` and `read_knowledge_doc`, twinning `GET …/knowledge-base` and `GET …/knowledge-base/:type/:slug` with no grant (`docs-read` is every role's): the docs a named member may read (`userId`, by default the agent's own person), at the lower of the agent's person's role and that member's, so naming someone only narrows; Live does not gate them and a disabled doc never appears; `filter: "workspace-memory"` answers the always-loaded set with its `totalTokens` and an 8000-token `warning` — and (#10951) `get_workspace_settings`, twin of `GET /v1/workspaces/:workspaceId/general` (`mcp-workspace`'s `workspace_settings.ts`, no grant): the workspace's name, its own logo (`null` when the organization's applies) and the deployment's deliverable sender (`null` when none is configured, so a magnet's results and completion emails do not go out); the PUT, which renames the workspace and sets its logo, has no tool, by decision — it needs `workspace-settings`, which is never agent-grantable — and (#11806) `get_workspace_overview`, twin of `GET /v1/workspaces/:workspaceId/overview` (`mcp-workspace`'s `workspace_overview.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"`, no query): a command's starting picture in one call — the site identity's name and SEO description, the default locale, the Knowledge docs `read_knowledge` lists for the caller with each one's draft `version` where `read_report` would answer it (`content-edit`, and the caller's own role reads the doc), and the Language items by kind and the magnets by state (`draft` only with `magnets-manage`); a part the caller's grants or the site's modules do not allow is `null` or left out and named in `withheld` (`grant` or `module`), never a refusal of the read — and (#12015) `get_command_craft`, twin of `GET /v1/workspaces/:workspaceId/craft/:command` (`mcp-workspace`'s `command_craft.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"`): one command's craft for the session, `{ command, pack, minShellVersion, craft }`, served only to a workspace that has the command's pack; a `pack_required` refusal carries `details` rebuilt from `pack`, `name` and `where` alone, and a `craft_unavailable` carries `service` alone (`entitlements`, `delivery` or `null`) — and the six site-profile tools, `get_site_identity`, `set_site_identity`, `get_site_seo`, `set_site_seo`, `get_welcome_email` and `set_welcome_email` (`mcp-workspace`'s `site_profile.ts`), twinning `GET`/`PUT …/identity`, `…/seo` and `…/welcome-email`: any member reads; each write needs the `site-profile` grant (`ailk:site-profile`), under which every logo and every SEO field but the description — robots and indexing above all — must be sent as read, else `site_profile_field_locked`; the theme pair has no tool, by decision — and (#10733, issue 10905, #10952) the six Language tools, `list_language_items`, `get_language_item`, `save_language_item`, `set_language_item_live`, `list_language_item_pages` and `get_topic_brief`, twinning `GET …/language`, `GET`/`PUT …/language/:kind/:slug`, `POST …/language/:kind/:slug/live`, `GET …/language/:kind/:slug/appears-on` and `GET …/language/topic/:slug/brief` (`mcp-workspace`'s `language.ts`): a workspace's glossary terms, FAQs and topics; reading needs no grant, saving the `content-edit` grant (`version: null` creates, a tip id updates, 409 `slug_taken` / `stale` otherwise), the Live switch `content-publish` with the `version` the person reviewed — `live: false` is how an agent takes an item off the site; the `DELETE` has no tool, by decision (#11802): it is permanent (nothing restores the item and its slug stays taken), so a person deletes in the Admin and the route refuses every agent `agent_refused`; tags are the hub's and never written by a tool; a topic is a keyword cluster for agents and is never shown to visitors, and `get_topic_brief` reads it as a writing brief — its kept rows scored best bets first, from the Live version when Live; the Topic's Keyword Planner import and the value-thresholds pair are a person's and have no tool, by decision — and (#10948) the three magnet tools, `list_magnets`, `get_magnet` and `save_magnet`, twinning `GET …/magnets`, `GET …/magnets/:id` and (#11810) `POST …/magnets/save` (`mcp-workspace`'s `magnets.ts`, registered with `multi-tenant` or `signal-collectors`): with the `magnets-manage` grant every magnet in full, without it only live ones as `{ id, slug, kind, title, landingPage, tags }`; `save_magnet` takes the save body whole, the magnet's `id` in it, so going live is `status: "live"` and the route alone refuses it (`402 plan_required`, `409 conversion_needs_email`), and an agent cannot set or change what a magnet charges (`403 magnet_pricing_needs_person`); with no `id` and `version: null` it creates a draft magnet — a slug another magnet holds is `409 stale` with its `currentVersion`, a slug the site reads by name `409 slug_reserved`, and the plan check is the Admin create's; the Admin's PATCH and create (which refuses every agent `403 agent_refused`) and the four captured-people lists have no tool, by decision — and (#10949) `get_workspace_offerings`, twin of `GET /v1/workspaces/:workspaceId/offerings` (registered with `multi-tenant` alone, its route's module; `mcp-workspace`'s `offerings.ts`): the Offerings tab's view — unavailable with `no_commerce` or `no_connection`, or the Organization's enabled products with this workspace's shown Prices and Recommended — read with no grant; its PUT, which switches a Price on or off, needs `workspace-settings`, which is never agent-grantable, and has no tool, by decision — and the two library reads, `list_workspace_pages` and `list_assets` (`mcp-workspace`'s `library.ts`, registered with `workspace` or `multi-tenant`), twinning `GET …/library/pages` and `GET …/library/assets`: every page with drafts included and its status (`live`, `draft`, or `disabled` — a person editor's alone), needing the `content-edit` grant, and the asset library read-only with each file's whole record (#11801) — its public path, title, description and record version, its size, an image's pixel size as the Admin's Details panel shows it, and its audience — for every role; both filter, page and name the workspace `{ id, name }` they read, and uploading has no tool — and (#11803) `save_asset` (`library.ts`, `gate: { allows: "assets-write" }`), twinning `POST …/assets/save`: it saves a file's title and description — and (#11879) its type, `fields.type`, one of the ten asset types — by its key, based on the record version `list_assets` returned; a stale save is `409 stale` and its tool error carries `details.currentVersion`, a wrong argument `422 invalid` with `details.issues` (`{ path, message }`, at most twenty, each cut to 200 characters, rebuilt in `workspace-server.ts`); it never replaces, renames, re-privacies or deletes a file, and never reaches a private, Knowledge or disabled one — and (#11680) the two site-vocabulary reads, `list_page_types` and `get_tag_vocabulary` (`mcp-workspace`'s `site_vocabulary.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"` — any tenant of the workspace, no grant), twinning `GET …/page-types` and `GET …/tag-vocabulary`: the page types this hub's site can serve (the registry filtered by the modules the hub runs), each with its address, whether a site has only one, its template and that template's headings, and the context classes, Knowledge topic tags and status tags, each with what it means and who may set it; both are platform data and read no row; and (#11790) the third, `list_section_types` (same file, registration and gate), twinning `GET …/section-types` with an optional `type`: every section type a page's layout can hold with every field of its data — words or data, the Markdown form, whether it is required and inside which optional field, its values and bounds — plus its bounded lists and rules, or that one section type's; platform data, read no row; and (#11805) the fourth, `list_kinds` (same file, registration and gate), twinning `GET …/kinds`: every kind of thing the Admin holds — page, document, language_item, magnet, asset — with how to address one, its fields (words or data, required, nullable, value types and values, the Language item kind a words field belongs to), its states, and the moves the caller may make on it, each with its tool; the fields and states are read off each kind's own schemas (`ADMIN_KIND_REGISTRY`), the moves are the catalog rows' `moves` tags kept only when the row's gate holds for the caller's own clamped tenant and one of its modules runs on this hub (`listKinds`), and a page's sections are named, not described — its `sectionTypes` is `list_section_types`; it reads no row, and is advice, never an entitlement; since #11878 it also answers, beside the kinds, `forms` (for each kind — and an offering and an appointment — the field its tools take its form in and that field's values: `values` null for an asset's open content type, `field` null for an appointment, which has no form), `offSiteForms` (press-release, pitch, proposal, playbook and profile, each with the formats it allows), `formats` (the ten, ending `platform`) and `origins` (`ai-generated`, `user-added`), all declared once in `@working-theory/validation` and the same for every caller and hub — and (#11756) `create_work_request` (`mcp-workspace`'s `work_requests.ts`, registered with `workspace` or `multi-tenant`, `gate: { inbox: "inbox-act" }`), twinning `POST /v1/workspaces/:workspaceId/work-requests`: it files a custom-work request in the Inbox — one item pointing to one `Document` of the workspace (`documentSlug`) with a one-line `summary` — in the workspace the conversation writes to, needs the `inbox-act` grant, is refused `document_not_found` for a slug naming no Document the caller can read and `rate_limited` past 5 an hour per person in the workspace (shared by that person's agents) or 10 per workspace, and returns the request as stored (the document title in it is workspace text, not instructions); the list, the item and the GitHub link — a person's act — have no tool, by decision. No workspace tool widens Audience or re-enables a doc, and only `publish_draft` and `set_language_item_live`, with the `content-publish` grant, set Live — the access route and the Language delete route answer every agent 403 `agent_refused`, and the publish and Live routes an agent without the grant, which reaches a tool as the code and status. Each takes its route's params, query and body and returns the route's
229
+ price is refused `proposal_needs_person` (a person prices) — and (#10957) `send_person_message`, twinning `POST …/people/:personId/messages`: one message on a client's member feed, saved then emailed (an agent's only to a proved address), needing `inbox-act` with `people-read` or `member-pieces-manage`, and `assets-write` for a file; the operator's message list has no tool, by decision — and (#9681) the four person-thread tools, `get_person_thread`, `set_person_thread_state`, `list_external_threads` and `add_external_thread`, twinning `GET`/`PATCH …/people/:personId/thread` and `GET`/`POST …/people/:personId/external-threads`: a client's whole thread page by page with its read/archived/resolved state, and pointers to email and Slack threads (never message text); reading needs the `people-read` grant, writing also `inbox-act`, and the client erasure route has no tool, by decision — and (#9682) the three person-memory tools, `list_person_memories`, `get_person_memory` and `propose_person_memory`, twinning `GET …/people/:personId/memories`, `GET …/memories/:path` and `POST …/memories`: an agent reads only live, unexpired memories (confirmed by a person, read within 180 days) and its proposal is never live — a new path is a draft, a confirmed one gets a pending version — needing the `people-read` or `people-memory-propose` grant to read and `people-memory-propose` to propose; the six person-only memory routes (edit, delete, confirm, redact, the versions list, restore) have no tool, by decision — and (#9749) `get_slack_connection_status`, twin of `GET /v1/workspaces/:workspaceId/slack-connection` (registered with `workspace`/`multi-tenant`, its route's `TENANCY` row: whether the Organization's Slack is connected, its team name and the date, never a credential; connect and disconnect are a person's act and have no tool, by decision), and `get_prospect_channel_settings` / `set_prospect_channel_settings`, twins of `GET`/`PUT …/prospect-channel` (registered with `scheduling`, their routes' module): the update replaces every field, needs the `meeting-types-manage` grant, is refused `slack_not_connected` while the Organization has no Slack connection, and an agent may change only `enabled`, `channelPrefix` and `archiveDays` — a change to `memberIds` or `welcomeTemplate` is refused `prospect_channel_needs_person` — and (#10950) the three meeting tools, `list_meeting_types`, `save_meeting_types` and `list_appointments`, twinning `GET`/`PUT …/meetings` and `GET /v1/schedule/appointments` (registered with `scheduling`): the meeting types from the connected calendar, each with whether it is Live (`enabled`) and who can book it (`visibility`: `public`, `private` or `authenticated`), the provider's `providerEventTypeId` and `createdAt` when it serves them, and, with the `meeting-types-manage` grant, `providerEditUrl` — the read takes no `include` (#11122 D4); the save needs that grant and its required `enabledSlugs` replaces the Live list, while `customerSlugs` (Authenticated) and `privateSlugs` (Private) are exclusive — a slug in both is refused — and an omitted one keeps the stored list less the sent list's slugs, and no price is set there; the appointments read is every role's, and an agent's only with the `people-read` grant (#10986), takes `eventTypeId` for one type's bookings (#11122 D12) and `workspaceId` when the connection reaches several workspaces (#11753), and its attendee names and emails are public-written text; the three scheduling-connection routes have no tool, by decision — and (#10218) the content-suggestion pair, `draft_page_suggestions` and `decide_page_suggestion` — and (#10336) the draft pair, `save_draft` and `read_report`, twinning `PATCH`/`GET …/content/:type/:slug` with the `content-edit` grant: `save_draft` takes the page's `content` whole as the PATCH body and its `version` as `X-Draft-Version`, writes a draft version that never goes live, and answers 409 `conflict` with `currentVersion` when the draft moved; `read_report` returns the draft tip, the version a save must send, the page's stored layout (`structure`, #10962) and the token `save_structure` must send, its open suggestions and the route's check report (`ready`, `needs repair` or `needs your words`), computed by the route and never by the tool — and (#10956) `create_page`, twinning `POST …/content` with the `content-edit` grant: it creates a page and its first draft from `content` sent whole (its `type` and `slug` are the address) — a page type laid out in sections sent no words (no body, an empty one, or only its template's headings) starts from its template (#11793): the hub lays out the template's sections, each headed by its default headline with an empty field to write under, and stores the words and the layout together, refusing a title or description the words rules refuse, or a `sections` key, 422 `invalid` — never publishes, and answers 409 `conflict` when the page exists and 409 `slug_taken` when another page holds the link — and (#11791) `save_page`, twinning `PUT …/content/:type/:slug` with the `content-edit` grant, under the common names of `docs/internal/decisions/one-way-common-names.md`: it saves a page laid out in sections — its `fields` and its `words` (its sections in order, each `{ id, type, data }`) — in one draft version that holds the body the hub builds from the words and the layout together; `address` (type, slug, locale) rides the URL, and `version` with `structureToken` is what the save was based on, both `null` for a new page; a save whose basis is no longer the tip, or `null` for a page that exists, answers 409 `stale` with `currentVersion` and `currentStructureToken`, and a wrong field or word 422 `invalid` with `issues` (`path`, `message`), the one refusal pair whose details reach the tool; it never publishes; since #11811 it also saves an editorial page, whose `words` are `{ body }`, its Markdown, carrying the stored layout forward; since #11808 (#11852) a page laid out in sections may send `workingCopy`, `{ document, settings }` — the two tabs of a working copy as exported — in place of `fields` and `words`: the hub converts it against the tip it was based on (409 `stale` before converting), keeps the stored fields a Settings table cannot carry, refuses a wrong copy 422 `invalid` at `workingCopy.settings`, `workingCopy.document` or the envelope path, and answers the page as a working copy — and (#11811) `save_document`, twinning `POST …/documents/save` with the `content-edit` grant: it saves a `Document` (Instructions, Knowledge or a plugin-owned document) in the same common shape — `address` (`type` always `Document`, slug, locale) rides the body, as `save_asset`'s does, `version` is `null` for a new document, `fields` are the page save's, and `words` is `{ body }`; a moved tip or a `null` on an existing document answers 409 `stale` with `currentVersion` alone, and a wrong field or word — a plugin contract's misfit included, each issue at its path (`fields.contract_version`, `words.body`) — 422 `invalid`, both details rebuilt in `workspace-server.ts`; a document never goes live; since #11808 it takes, at a plugin-owned contract address only, `workingCopy` (`{ document, settings }`, the two tabs of a working copy as exported) in place of `fields` and `words`, which the hub converts against the tip it was based on and answers in the same form (the record form when the copy would outgrow its bounds) — and (#11808) `open_document`, twinning `GET …/documents/open` with the `content-edit` grant: the read twin of `save_document`, its `address` in the query, answering the envelope as the record or, with `as: "working-copy"` and only at a plugin-owned address (else 422 `invalid` at the key sent), the working copy (409 `not_representable` when it would outgrow its bounds); since #11882 `open_page` and `open_document` take `as` where they took `form`, which stays the old name for one release (the catalog keeps it, so the SDK never strips it), and the route refuses the two sent with different values 422 `invalid` at `as`; it never writes, and its `invalid` keeps `issues` (`path`, `message`, each cut to 200 characters). — and (#11809) `open_language_item` and `open_asset` (`mcp-workspace`'s `language.ts` and `library.ts`), twinning `GET …/language/:kind/:slug/open` and `GET …/assets/open` under the gate of the read each parallels (`docs-read`, `assets-read`): each takes `{ workspaceId, address }` (plus `locale` for an item) and answers the thing in the common envelope with the `version` its save takes, or — nothing at the address, or nothing the caller may read there — an item's blank, `version: null` and its kind's empty words, which the save with `version: null` starts; a file is never blank (`404 not_found`); and `open_page` and `open_document` answer the same kind of blank where they answered 404 — a page its template's starting sections, headed by the slug, and a document at a plugin-owned contract address its contract's constant fields and required headings, else nothing; no open writes, and the section map lists `open_` tools as reads. While both ways live, `create_page`, `save_draft` and `save_structure` open their descriptions with a deprecation naming `save_page` or `save_document`; nothing else about them changes until the removal (#11811 D2, D6) — and (#10661) `publish_draft`, twinning `POST …/content/:type/:slug/publish` with the `content-publish` grant: it publishes the draft tip (or a named version) exactly as a person holding that permission does, an agent without the grant is refused 403 `agent_refused` before anything is read, and it never widens Audience or re-enables a doc — and (#10345) the knowledge-base pair, `read_knowledge` and `read_knowledge_doc`, twinning `GET …/knowledge-base` and `GET …/knowledge-base/:type/:slug` with no grant (`docs-read` is every role's): the docs a named member may read (`userId`, by default the agent's own person), at the lower of the agent's person's role and that member's, so naming someone only narrows; Live does not gate them and a disabled doc never appears; `filter: "workspace-memory"` answers the always-loaded set with its `totalTokens` and an 8000-token `warning` — and (#10951) `get_workspace_settings`, twin of `GET /v1/workspaces/:workspaceId/general` (`mcp-workspace`'s `workspace_settings.ts`, no grant): the workspace's name, its own logo (`null` when the organization's applies) and the deployment's deliverable sender (`null` when none is configured, so a magnet's results and completion emails do not go out); the PUT, which renames the workspace and sets its logo, has no tool, by decision — it needs `workspace-settings`, which is never agent-grantable — and (#11806) `get_workspace_overview`, twin of `GET /v1/workspaces/:workspaceId/overview` (`mcp-workspace`'s `workspace_overview.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"`, no query): a command's starting picture in one call — the site identity's name and SEO description, the default locale, the Knowledge docs `read_knowledge` lists for the caller with each one's draft `version` where `read_report` would answer it (`content-edit`, and the caller's own role reads the doc), and the Language items by kind and the magnets by state (`draft` only with `magnets-manage`); a part the caller's grants or the site's modules do not allow is `null` or left out and named in `withheld` (`grant` or `module`), never a refusal of the read — and (#12015) `get_command_craft`, twin of `GET /v1/workspaces/:workspaceId/craft/:command` (`mcp-workspace`'s `command_craft.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"`): one command's craft for the session, `{ command, pack, minShellVersion, craft }`, served only to a workspace that has the command's pack; a `pack_required` refusal carries `details` rebuilt from `pack`, `name` and `where` alone, and a `craft_unavailable` carries `service` alone (`entitlements`, `delivery` or `null`) — and the six site-profile tools, `get_site_identity`, `set_site_identity`, `get_site_seo`, `set_site_seo`, `get_welcome_email` and `set_welcome_email` (`mcp-workspace`'s `site_profile.ts`), twinning `GET`/`PUT …/identity`, `…/seo` and `…/welcome-email`: any member reads; each write needs the `site-profile` grant (`ailk:site-profile`), under which every logo and every SEO field but the description — robots and indexing above all — must be sent as read, else `site_profile_field_locked`; the theme pair has no tool, by decision — and (#10733, issue 10905, #10952) the six Language tools, `list_language_items`, `get_language_item`, `save_language_item`, `set_language_item_live`, `list_language_item_pages` and `get_topic_brief`, twinning `GET …/language`, `GET`/`PUT …/language/:kind/:slug`, `POST …/language/:kind/:slug/live`, `GET …/language/:kind/:slug/appears-on` and `GET …/language/topic/:slug/brief` (`mcp-workspace`'s `language.ts`): a workspace's glossary terms, FAQs and topics; reading needs no grant, saving the `content-edit` grant (`version: null` creates, a tip id updates, 409 `slug_taken` / `stale` otherwise), the Live switch `content-publish` with the `version` the person reviewed — `live: false` is how an agent takes an item off the site; the `DELETE` has no tool, by decision (#11802): it is permanent (nothing restores the item and its slug stays taken), so a person deletes in the Admin and the route refuses every agent `agent_refused`; tags are the hub's and never written by a tool; a topic is a keyword cluster for agents and is never shown to visitors, and `get_topic_brief` reads it as a writing brief — its kept rows scored best bets first, from the Live version when Live; the Topic's Keyword Planner import and the value-thresholds pair are a person's and have no tool, by decision — and (#10948) the three magnet tools, `list_magnets`, `get_magnet` and `save_magnet`, twinning `GET …/magnets`, `GET …/magnets/:id` and (#11810) `POST …/magnets/save` (`mcp-workspace`'s `magnets.ts`, registered with `multi-tenant` or `signal-collectors`): with the `magnets-manage` grant every magnet in full, without it only live ones as `{ id, slug, kind, title, landingPage, tags }`; `save_magnet` takes the save body whole, the magnet's `id` in it, so going live is `status: "live"` and the route alone refuses it (`402 plan_required`, `409 conversion_needs_email`), and an agent cannot set or change what a magnet charges (`403 magnet_pricing_needs_person`); with no `id` and `version: null` it creates a draft magnet — a slug another magnet holds is `409 stale` with its `currentVersion`, a slug the site reads by name `409 slug_reserved`, and the plan check is the Admin create's; the Admin's PATCH and create (which refuses every agent `403 agent_refused`) and the four captured-people lists have no tool, by decision — and (#10949) `get_workspace_offerings`, twin of `GET /v1/workspaces/:workspaceId/offerings` (registered with `multi-tenant` alone, its route's module; `mcp-workspace`'s `offerings.ts`): the Offerings tab's view — unavailable with `no_commerce` or `no_connection`, or the Organization's enabled products with this workspace's shown Prices and Recommended — read with no grant; its PUT, which switches a Price on or off, needs `workspace-settings`, which is never agent-grantable, and has no tool, by decision — and the two library reads, `list_workspace_pages` and `list_assets` (`mcp-workspace`'s `library.ts`, registered with `workspace` or `multi-tenant`), twinning `GET …/library/pages` and `GET …/library/assets`: every page with drafts included and its status (`live`, `draft`, or `disabled` — a person editor's alone), needing the `content-edit` grant, and the asset library read-only with each file's whole record (#11801) — its public path, title, description and record version, its size, an image's pixel size as the Admin's Details panel shows it, and its audience — for every role; both filter, page and name the workspace `{ id, name }` they read, and uploading has no tool — and (#11803) `save_asset` (`library.ts`, `gate: { allows: "assets-write" }`), twinning `POST …/assets/save`: it saves a file's title and description — and (#11879) its type, `fields.type`, one of the ten asset types — by its key, based on the record version `list_assets` returned; a stale save is `409 stale` and its tool error carries `details.currentVersion`, a wrong argument `422 invalid` with `details.issues` (`{ path, message }`, at most twenty, each cut to 200 characters, rebuilt in `workspace-server.ts`); it never replaces, renames, re-privacies or deletes a file, and never reaches a private, Knowledge or disabled one — and (#11680) the two site-vocabulary reads, `list_page_types` and `get_tag_vocabulary` (`mcp-workspace`'s `site_vocabulary.ts`, registered with `workspace` or `multi-tenant`, `gate: "tenant"` — any tenant of the workspace, no grant), twinning `GET …/page-types` and `GET …/tag-vocabulary`: the page types this hub's site can serve (the registry filtered by the modules the hub runs), each with its address, whether a site has only one, its template and that template's headings, and the sections a new page of the type starts with, read off that template (#12516), and the context classes, Knowledge topic tags and status tags, each with what it means and who may set it; both are platform data and read no row; and (#11790) the third, `list_section_types` (same file, registration and gate), twinning `GET …/section-types` with an optional `type`: every section type a page's layout can hold with what it is for, when to choose it and the parts of a page's pyramid it can carry (the answer, the kinds of support a claim may rest on, the frame parts; #12514), and every field of its data — words or data, the Markdown form, whether it is required and inside which optional field, its values and bounds — plus its bounded lists and rules, or that one section type's; platform data, read no row; and (#12419) `list_image_slots` (`mcp-workspace`'s `content_draft.ts`, registered with `workspace` or `multi-tenant`, `gate: { allows: "content-edit" }`), twinning `GET …/image-slots` with an optional `address` and `sectionType`: what each section image slot needs — its shapes, how it is drawn (`fit`), its smallest useful width and height and its purpose — for every section type, or for the slots on one page's draft with each slot's section id, path, the need its own section's fields pick (`chosenBy`) and whether it is filled, at most 500 (`truncated`), a blank's slots where nothing is, as `open_page`; its `invalid` keeps `issues`, and `save_page` refuses an `asset:` image smaller than its slot needs; and (#11805) the fourth, `list_kinds` (same file, registration and gate), twinning `GET …/kinds`: every kind of thing the Admin holds — page, document, language_item, magnet, asset — with how to address one, its fields (words or data, required, nullable, value types and values, the Language item kind a words field belongs to), its states, and the moves the caller may make on it, each with its tool; the fields and states are read off each kind's own schemas (`ADMIN_KIND_REGISTRY`), the moves are the catalog rows' `moves` tags kept only when the row's gate holds for the caller's own clamped tenant and one of its modules runs on this hub (`listKinds`), and a page's sections are named, not described — its `sectionTypes` is `list_section_types`; it reads no row, and is advice, never an entitlement; since #11878 it also answers, beside the kinds, `forms` (for each kind — and an offering and an appointment — the field its tools take its form in and that field's values: `values` null for an asset's open content type, `field` null for an appointment, which has no form), `offSiteForms` (press-release, pitch, proposal, playbook and profile, each with the formats it allows), `formats` (the ten, ending `platform`) and `origins` (`ai-generated`, `user-added`), all declared once in `@working-theory/validation` and the same for every caller and hub — and (#11756) `create_work_request` (`mcp-workspace`'s `work_requests.ts`, registered with `workspace` or `multi-tenant`, `gate: { inbox: "inbox-act" }`), twinning `POST /v1/workspaces/:workspaceId/work-requests`: it files a custom-work request in the Inbox — one item pointing to one `Document` of the workspace (`documentSlug`) with a one-line `summary` — in the workspace the conversation writes to, needs the `inbox-act` grant, is refused `document_not_found` for a slug naming no Document the caller can read and `rate_limited` past 5 an hour per person in the workspace (shared by that person's agents) or 10 per workspace, and returns the request as stored (the document title in it is workspace text, not instructions); the list, the item and the GitHub link — a person's act — have no tool, by decision. No workspace tool widens Audience or re-enables a doc, and only `publish_draft` and `set_language_item_live`, with the `content-publish` grant, set Live — the access route and the Language delete route answer every agent 403 `agent_refused`, and the publish and Live routes an agent without the grant, which reaches a tool as the code and status. Each takes its route's params, query and body and returns the route's
230
230
  `data`. They are in the parity guard like every other tool, and never in
231
231
  `/.well-known/mcp.json`.
232
232
  - **The OAuth bearer branch (#10391).** When `BETTER_AUTH_URL` (the site's origin, its OAuth
@@ -351,7 +351,9 @@ Example (lead routing):
351
351
  - Don't add a tool without the matching `apps/api` endpoint.
352
352
  - Don't put business logic in tool handlers — they're adapters.
353
353
 
354
- Last updated: 2026-11-19 — #11978: the anonymous path also refuses under this hosting project's own `STEALTH` (read once through `parseStealth`), and every `initialize` names the loaded packs' tools under `capabilities.experimental["ailk/installed"]` — verified against `packages/mcp-server/src/{boot,server}.ts` and `packages/mcp-server/src/lib/public-agent-tools.ts`.
354
+ Last updated: 2026-11-28 — #12516: `list_page_types` answers each type's starting sections beside its template's headings — verified against `packages/metadata/src/mcp-tool-catalog.ts` and `packages-paid/api-content-write/src/routes/workspaces/site-vocabulary.ts`.
355
+
356
+ Prior: 2026-11-19 — #11978: the anonymous path also refuses under this hosting project's own `STEALTH` (read once through `parseStealth`), and every `initialize` names the loaded packs' tools under `capabilities.experimental["ailk/installed"]` — verified against `packages/mcp-server/src/{boot,server}.ts` and `packages/mcp-server/src/lib/public-agent-tools.ts`.
355
357
 
356
358
  Prior: 2026-11-19 — #11977: `list_meetings` returns the site's public meetings only, for every caller; a private meeting stays bookable by its calLink — verified against `packages/metadata/src/mcp-tool-catalog.ts`, `packages-paid/mcp-scheduling/src/list_meetings.ts` and `packages-paid/api-scheduling/src/services/scheduling/meetings.ts`.
357
359
 
@@ -185,10 +185,17 @@ CONTENT_ADAPTER=mdx
185
185
  # only sign-in. It must be an https: URL (http: only on a loopback host).
186
186
  # BETTER_AUTH_URL=http://localhost:3000
187
187
  #
188
- # The hub Admin's absolute https URL (admin-team-invitation-accept). Optional:
189
- # a team invitation link mailed before invitations moved to the Admin
188
+ # The hub Admin's absolute https URL (admin-team-invitation-accept).
189
+ # Required when the Admin is not at admin.<BETTER_AUTH_URL host> — a site at
190
+ # account.example.com derives admin.account.example.com, so an Admin at
191
+ # admin.example.com needs it set, here and on apps/api, whose invitation links
192
+ # use it (the Admin's Workforce page refuses to send until they open the
193
+ # Admin). A team invitation link mailed before invitations moved to the Admin
190
194
  # (/account/invitations/<id>) is sent on to <Admin>/invitations/<id>. Unset,
191
- # or not a valid https URL, it uses admin.<BETTER_AUTH_URL host>.
195
+ # or not a valid https URL, it uses admin.<BETTER_AUTH_URL host>. Use the
196
+ # production Admin's address, never a preview deployment's. For local
197
+ # development only: a stack on localhost derives no address, so set it to the
198
+ # local Admin's http://localhost:<port>.
192
199
  # AILK_ADMIN_URL=https://admin.example.com
193
200
  #
194
201
  # Secret used to sign session cookies AND the email-verification tokens.