create-ailk 0.46.5 → 0.47.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.
- package/component-catalog.json +90 -7
- package/dist/lib/env-catalog.js +4 -0
- package/package.json +3 -3
- package/templates/apps/api/.env.example +18 -0
- package/templates/apps/api/CLAUDE.md +7 -2
- package/templates/apps/api/src/__tests__/vercel-handler.test.ts +176 -2
- package/templates/apps/api/src/lib/__mocks__/prisma.ts +31 -0
- package/templates/apps/api/src/vercel-handler.ts +32 -2
- package/templates/apps/mcp/.env.example +8 -0
- package/templates/apps/mcp/CLAUDE.md +2 -2
- package/templates/apps/web/CLAUDE.md +31 -3
- package/templates/apps/web/app/[locale]/layout.tsx +98 -37
- package/templates/apps/web/app/llms.txt/__tests__/site-listing.test.ts +13 -3
- package/templates/apps/web/lib/__tests__/grid-read.test.ts +212 -0
- package/templates/apps/web/lib/__tests__/hub-read.test.ts +90 -0
- package/templates/apps/web/lib/__tests__/hub-site-config.test.ts +394 -10
- package/templates/apps/web/lib/__tests__/page-chrome-navigation.test.ts +194 -0
- package/templates/apps/web/lib/__tests__/pricing-page.test.ts +210 -0
- package/templates/apps/web/lib/__tests__/site-identity-feature-list.test.ts +19 -1
- package/templates/apps/web/lib/__tests__/site-navigation.test.ts +288 -0
- package/templates/apps/web/lib/grid-read.ts +115 -0
- package/templates/apps/web/lib/hub-read.ts +35 -0
- package/templates/apps/web/lib/hub-site-config.ts +154 -29
- package/templates/apps/web/lib/in-page-blocks.ts +11 -67
- package/templates/apps/web/lib/in-page-magnet.ts +5 -24
- package/templates/apps/web/lib/page-chrome.ts +70 -3
- package/templates/apps/web/lib/pricing-page.ts +33 -2
- package/templates/apps/web/lib/site-navigation.ts +208 -0
- package/templates/apps/web/next.config.mjs +19 -6
- package/versions.json +51 -51
|
@@ -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
|
-
- **
|
|
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 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 (#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
|
|
@@ -813,6 +813,18 @@ key), so the page names none. It renders one of three pages:
|
|
|
813
813
|
reading that workspace has taken this release with or before its hub: an
|
|
814
814
|
older site's strict shown-set readers refuse such a product and show the
|
|
815
815
|
contact email in place of its Stripe cards.
|
|
816
|
+
- **A comparison table that reads an Offerings grid (#12370).** A
|
|
817
|
+
`comparison-table` section holds typed `columns` and `groups`, or one
|
|
818
|
+
`grid` setting — the Grid block's own fields, less `price` and `button`
|
|
819
|
+
(the section's `planBar` is its one header control) — never both. On every
|
|
820
|
+
Pricing page `pricingSections` runs `withGrids` before `withPlanColumns`:
|
|
821
|
+
each grid-bound table takes its columns and groups from `gridTable`
|
|
822
|
+
(`lib/grid-read.ts`, the one read a `<Grid … />` block line also uses) and
|
|
823
|
+
keeps every field it sets itself, so a grid's plan columns then resolve
|
|
824
|
+
from the shown set like a typed table's. A read that fails, takes longer
|
|
825
|
+
than 3,000 ms or answers no row draws no table, and nothing typed is kept
|
|
826
|
+
as a fallback. On a page that is not a Pricing page the setting is not
|
|
827
|
+
resolved and the table draws nothing.
|
|
816
828
|
- **A comparison table's plan columns (#12246).** A `comparison-table`
|
|
817
829
|
column is a typed name (`{ key, name }`) or a Stripe plan named by its slug
|
|
818
830
|
(`{ key, plan }`, `name` optional and winning when set), and one table
|
|
@@ -1101,13 +1113,25 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
1101
1113
|
|
|
1102
1114
|
## A hub-connected site's identity
|
|
1103
1115
|
|
|
1104
|
-
**A site connected to its hub reads its name, description, legal name, contact and sameAs from the hub (#11456).** Hub-connected means a spoke key on the wire (`sendsSpokeKey()`),
|
|
1116
|
+
**A site connected to its hub reads its name, description, legal name, contact and sameAs from the hub (#11456).** Hub-connected means a spoke key on the wire (`sendsSpokeKey()`), or — a single-tenant site, its own hub (#12390) — no key but an API address the site names (`apiBaseConfigured()`: `AILK_API_URL`, `NEXT_PUBLIC_AILK_API_URL` or `NEXT_PUBLIC_API_URL`; `getApiBase()`'s `localhost:3001` default does not count) over `https:` or loopback (`isSafeTransport`), whatever the content adapter (#11515). `lib/hub-site-config.ts`'s `readHubSite()` then reads `GET /v1/content/site-config` through `siteConfig.get()` — a key's own workspace's identity and seo rows, or for a keyless call the deployment's one workspace's on a deployment that has exactly one and is not a hub; 401 to any other caller — cached by `unstable_cache` under `siteConfigTag()` for at most 300 s, keyed by the spoke key's digest or, keyless, `keyless:` plus the API address's digest. A site with neither a key nor an API address makes no call and renders from `_site.mdx` exactly as before.
|
|
1117
|
+
|
|
1118
|
+
- **A refused keyless read is "no rows".** A 401 to a keyless read resolves `{ identity: null, seo: null }` inside the cached callback, so the refusal is held for the cache's lifetime with one `console.warn`, and the site renders from `_site.mdx` — the hub's own web app and a site on a multi-workspace deployment land here. A keyed 401 still throws, so a spoke whose key was revoked keeps its last good value. Any other failed keyless read makes the instance wait 15 s (`HUB_SITE_RETRY_SECONDS`) before asking again.
|
|
1105
1119
|
|
|
1106
1120
|
- **Who reads it.** `resolveSiteBrand()` (`lib/site-brand.tsx`) gives the locale layout's title, description, og/twitter copy, Nav/Footer `siteName` and copyright holder, and both llms.txt headings; `lib/site-identity.ts` registers a JSON-LD reader (`setSiteIdentityReader`) whose registration keeps the file's `baseUrl`, so no hub value moves an `@id`; the contact email and the closing footer's contact lines read the value the last read resolved (`heldHubSite()`), because their seam is synchronous. `SITE_NAME`'s other readers (og image, icons, auth, mcp.json) keep the file value. The seo row's `robots.index` (the retired Allow search indexing) is read by nothing (#11978 D7).
|
|
1107
1121
|
- **A hub row is the whole identity.** A field the operator cleared is absent, never refilled from the file; only a missing row, an unreadable one or a failed read falls back to `_site.mdx`. The file's top-level `contactEmail` stays the contact email's fallback. Hub values are collapsed to one line.
|
|
1108
|
-
- **A save shows without a redeploy.** A 200 PUT of `identity` or `seo` sends the signed `site-config` revalidate event (`notifySiteConfigRevalidate`) to the site and
|
|
1122
|
+
- **A save shows without a redeploy.** A 200 PUT of `identity` or `seo` sends the signed `site-config` revalidate event (`notifySiteConfigRevalidate`) to the env site target (`CONTENT_REVALIDATE_URL`) and the hub's spokes; `app/api/revalidate/route.ts` answers it by purging `siteConfigTag()`. The 300 s expiry is the net for a site with no revalidate target.
|
|
1109
1123
|
- **A hub outage never breaks a page**: a failed read writes no cache entry and serves the instance's last good value, else the file.
|
|
1110
1124
|
|
|
1125
|
+
## A site's navigation from its hub
|
|
1126
|
+
|
|
1127
|
+
**A hub-connected site renders its header and footer from its workspace's navigation record when its hub read carries one (#12401).** The record (#12400, `siteNavigationSchema` in `@working-theory/validation`) rides the identity read: `readHubSite()` (`lib/hub-site-config.ts`) answers `navigation: { version, record } | null` beside `identity` and `seo`, in the same request, the same `unstable_cache` entry under `siteConfigTag()` and the same 300 s expiry, so the `site-config` purge a save sends refreshes it on the next request. The cache key carries a shape part (`nav1`), so an entry written by older site code is never served as this shape.
|
|
1128
|
+
|
|
1129
|
+
- **What is read as no record.** An absent `navigation` key (a hub older than #12400), `null`, a version that is not a positive integer, or a record this site's schema refuses — the last two with one warning per distinct refused field path (`[hub-site-config] navigation unreadable at <path>`), never a value. The schema check is the only barrier between a hub value and a link (`localeHref` passes any scheme through), so only its parsed output is kept; `identity` and `seo` are parsed as before in every case.
|
|
1130
|
+
- **One translator.** `lib/site-navigation.ts`'s `navigationChrome(record, locale)` turns the record into the existing `Nav` and `Footer` props — no `@working-theory/ui` prop changes. A `page` target goes to the page's public path (`pagePath` at `SERVICES_PATH`, then `toPublicDocsHref`); a `path` or `url` target is used as stored, and the layout's three rewrite passes never run on a record. A label is the visitor's locale's text (a case-insensitive `byLocale` match), else its default text. Keys are positional and every one contains a dot (`rec.h0`, `rec.h1.g0.l2`, `rec.f0`), so a record label never replaces a `nav` message. Order is the record's; the hub has already removed every item whose page is not live. Every emitted address must be a site path or an `http:`/`https:` URL, else it throws; `safeNavigationChrome` catches that, logs one `[site-navigation] record not rendered (<error name>)` and answers `null`.
|
|
1131
|
+
- **The layout.** With a translation (`app/[locale]/layout.tsx`), the header items and menus, the header button (its Sign in display the record's where it sets one, else `_site.mdx`'s `header.signIn`), the footer columns, the bottom bar (the record's links, then the cookie-settings link; no FAQ) and the closing footer's locality and actions come from it; a part the record leaves out is absent, never refilled from the files. The legal bar, the mark-only rule, "Your account", the bare header's back arrow, the social links and the logo are unchanged. Every page carries one `<meta name="ailk-nav-source">` in `<head>`, `content="record"` with `data-version="<n>"` or `content="files"`, whatever the header style; the element wrapping the site header, when one renders, carries the same as `data-nav-source` / `data-nav-version` (for #12403's and #12404's proof of render).
|
|
1132
|
+
- **Styles.** `resolveHomeChrome` (`lib/page-chrome.ts`) lays the record's `header.style`, `footer.style` and each route family's `header` / `footer` over `_site.mdx`'s through `withNavigationStyles`, where the record sets them, and only when the record renders: a record the translator refuses renders the files under the files' styles. A family's `path` stays the file's, and a page's own frontmatter still wins over both. It answers the rendered record as `navigation`, which is the layout's one read of it.
|
|
1133
|
+
- **The fallback, until #12404.** With no record, no hub read, or a failed read with nothing held, every page renders from `lib/nav-config.ts`, its `nav` labels and `_site.mdx` exactly as before; those stay read on every request until #12404 removes them.
|
|
1134
|
+
|
|
1111
1135
|
## AEO & performance
|
|
1112
1136
|
|
|
1113
1137
|
- Static rendering is the default. Don't introduce client rendering without a reason.
|
|
@@ -1124,7 +1148,11 @@ A list page whose frontmatter sets `navOnly: true` (valid on a registry list typ
|
|
|
1124
1148
|
- Don't reach into `apps/api` or `apps/mcp` from `apps/web`. They're peer apps — talk via HTTP/MCP.
|
|
1125
1149
|
- Don't commit images to `screenshots/` — only the `.gitkeep` is tracked.
|
|
1126
1150
|
|
|
1127
|
-
Last updated: 2026-11-
|
|
1151
|
+
Last updated: 2026-11-26 — § A site's navigation from its hub: the hub read carries the workspace's navigation record, one translator turns it into the Nav and Footer props, the record's styles win over `_site.mdx`'s where it sets them and only when it renders, and the `<head>` meta and the header wrapper name its source (#12401) — verified against `lib/{hub-site-config,site-navigation,page-chrome}.ts` and `app/[locale]/layout.tsx`.
|
|
1152
|
+
|
|
1153
|
+
Prior: 2026-11-25 — § A hub-connected site's identity: a single-tenant site with no spoke key reads its one workspace's identity and seo when it names an API address over `https:` or loopback, a refused keyless read is held as no rows, and a failed one waits 15 s (#12390) — verified against `lib/hub-site-config.ts`, `packages/api-client/src/http.ts`, `packages/api/src/routes/content/site-config.ts` and `packages/api/src/services/revalidation.ts`.
|
|
1154
|
+
|
|
1155
|
+
Prior: 2026-11-24 — § Pricing page: the billing toggle's three `pricingOfferings` keys, placed on every pricing section by `renderPage` (#12284) — verified against `messages/en.json` and `packages/page-renderer/src/{index.tsx,billing-toggle-labels.ts}`; 2026-11-24 — § Pricing page: every pricing section with a shown or hidden billing toggle follows the `ailk:billing-period` event, so two sections on one page show one period (#12281) — verified against `packages/ui/src/sections/Pricing.tsx`; 2026-11-24 — § Pricing page: a plan column's price carries the product's Stripe unit label, as its card's does (#12280) — verified against `lib/offerings-pricing.ts` and `packages/ui/src/blocks/PlanBar.tsx`.
|
|
1128
1156
|
|
|
1129
1157
|
Prior: 2026-11-23 — § Pricing page: a comparison table's plan columns — the plan column, `withPlanColumns`, `offeringsPlanColumns`, the start period and the billing event, the unresolved column and its advisory finding, the checkout cell-link rule — and the retired `with-comparison-table` read as a pricing section and a comparison table (#12246) — verified against `lib/pricing-page.ts`, `lib/offerings-pricing.ts`, `packages/validation/src/schemas/{page-sections,offerings}.ts`, `packages/ui/src/blocks/PlanBar.tsx` and `packages/ui/src/sections/ComparisonTable.tsx`.
|
|
1130
1158
|
|
|
@@ -457,10 +457,30 @@ export default async function LocaleLayout({
|
|
|
457
457
|
// `account` namespace, beside the nav keys.
|
|
458
458
|
const tAccount = await getTranslations({ locale, namespace: "account" });
|
|
459
459
|
navItemLabels[ACCOUNT_LABEL_KEY] = tAccount("yourAccount");
|
|
460
|
+
// #12401 D3 — the workspace's navigation record, read with the identity
|
|
461
|
+
// (one hub read per request). With one, the header items, menus, button,
|
|
462
|
+
// footer columns, legal links and closing footer come from it, through the
|
|
463
|
+
// translator only — the record itself never reaches a component. With
|
|
464
|
+
// none, or when the translator refuses it, every line below runs as before
|
|
465
|
+
// from `nav-config.ts` and `_site.mdx` (removed by #12404). The home's
|
|
466
|
+
// chrome resolution (below) answers it, so the record's styles apply
|
|
467
|
+
// exactly when its links render.
|
|
468
|
+
const home = await resolveHomeChrome(locale, chrome);
|
|
469
|
+
const recordNavigation = home.navigation;
|
|
470
|
+
const recordChrome = recordNavigation?.chrome ?? null;
|
|
471
|
+
if (recordChrome) Object.assign(navItemLabels, recordChrome.labels);
|
|
460
472
|
// The site's own signed-out header button (#10046) — `_site.mdx`'s
|
|
461
|
-
// `header.cta
|
|
462
|
-
// the
|
|
463
|
-
|
|
473
|
+
// `header.cta`, or the record's button with its Sign in display (the
|
|
474
|
+
// record's where it sets one, else the file's). Its label is site content,
|
|
475
|
+
// written straight into the map; the composition is `signedOutHeaderActions` below.
|
|
476
|
+
const fileHeader = readSiteHeader();
|
|
477
|
+
const recordSignIn = recordChrome?.signIn ?? fileHeader?.signIn;
|
|
478
|
+
const siteHeader = recordChrome
|
|
479
|
+
? {
|
|
480
|
+
...(recordChrome.button ? { cta: recordChrome.button } : {}),
|
|
481
|
+
...(recordSignIn !== undefined ? { signIn: recordSignIn } : {}),
|
|
482
|
+
}
|
|
483
|
+
: fileHeader;
|
|
464
484
|
if (siteHeader?.cta) {
|
|
465
485
|
navItemLabels[HEADER_CTA_LABEL_KEY] = siteHeader.cta.label;
|
|
466
486
|
}
|
|
@@ -532,9 +552,8 @@ export default async function LocaleLayout({
|
|
|
532
552
|
// design's chrome exactly as before: the deck home and `innerPages: "bare"`
|
|
533
553
|
// (#7721 D4 — bare header + one-bar footer on every page but the home) are
|
|
534
554
|
// that resolver's design level. Fail-safe: a missing `x-pathname`
|
|
535
|
-
// resolves to the home path.
|
|
555
|
+
// resolves to the home path. `home` is resolved above, with the record.
|
|
536
556
|
const isHome = pathname === homePath;
|
|
537
|
-
const home = await resolveHomeChrome(locale, chrome);
|
|
538
557
|
const homeLayout = home.layout;
|
|
539
558
|
const isDeckHome = homeLayout === "deck" && isHome;
|
|
540
559
|
const pageChrome = isHome
|
|
@@ -566,7 +585,18 @@ export default async function LocaleLayout({
|
|
|
566
585
|
// on the closing footer in every header state) and its legal bar. The
|
|
567
586
|
// site's labels ride `itemLabels` under keys no nav key can collide with
|
|
568
587
|
// (no nav key contains a dot).
|
|
569
|
-
|
|
588
|
+
// #12401 D3 — with a record, its closing footer's location and buttons
|
|
589
|
+
// (none when it has none); the legal bar stays the file's.
|
|
590
|
+
const fileClosingFooter = readClosingFooterSettings();
|
|
591
|
+
const closingFooter = recordChrome
|
|
592
|
+
? {
|
|
593
|
+
legalBar: fileClosingFooter.legalBar,
|
|
594
|
+
...(recordChrome.closing?.locality !== undefined
|
|
595
|
+
? { locality: recordChrome.closing.locality }
|
|
596
|
+
: {}),
|
|
597
|
+
...(recordChrome.closing ? { actions: recordChrome.closing.actions } : {}),
|
|
598
|
+
}
|
|
599
|
+
: fileClosingFooter;
|
|
570
600
|
const closingFooterActions = closingFooter.actions?.map(
|
|
571
601
|
(action, i) => ({
|
|
572
602
|
labelKey: `closingFooter.action.${i}`,
|
|
@@ -729,12 +759,17 @@ export default async function LocaleLayout({
|
|
|
729
759
|
// site's docs path; `nav-config.ts` itself is never edited.
|
|
730
760
|
// #10043 D9 — likewise every path at `/services`, at the services base.
|
|
731
761
|
// #11385 D8 — a renamed route family's links follow its served segment.
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
762
|
+
// #12401 D3 — a record's items and columns are already at their public
|
|
763
|
+
// paths (the translator resolves its page targets), so no pass rewrites them.
|
|
764
|
+
const publicNavItems =
|
|
765
|
+
recordChrome?.navItems ?? withRenamedNavPaths(withPublicServicesPaths(withPublicDocsPaths(navItems)));
|
|
766
|
+
const footerColumnDefs =
|
|
767
|
+
recordChrome?.columns ??
|
|
768
|
+
withRenamedColumns(withPublicServicesColumns(withPublicDocsColumns(footerColumns))).map((col) => ({
|
|
769
|
+
heading: labelFor(col.headingKey),
|
|
770
|
+
headingKey: col.headingKey,
|
|
771
|
+
items: col.items.map((item) => ({ ...item, label: labelFor(item.labelKey) })),
|
|
772
|
+
}));
|
|
738
773
|
|
|
739
774
|
// The bare header's back arrow (operator handoff 2026-11-09): the page's
|
|
740
775
|
// served parent — a content page, a page route the app builds or a nav entry —
|
|
@@ -776,17 +811,22 @@ export default async function LocaleLayout({
|
|
|
776
811
|
// and `/terms`) — since a mark-only nav (its usual pairing, #5589) has
|
|
777
812
|
// nowhere else on the page linking it. The default `columns` footer keeps
|
|
778
813
|
// exactly today's two-entry list, byte-identical.
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
...
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
814
|
+
// #6739 — a link, not the reopen button: the privacy page's
|
|
815
|
+
// #cookie-settings anchor explains the choice, and arriving there
|
|
816
|
+
// reopens the consent banner (BannerConsentIsland).
|
|
817
|
+
const cookieSettingsLink = { label: tConsent("settingsLabel"), href: "/privacy#cookie-settings" };
|
|
818
|
+
// #12401 D3 — with a record, its bottom bar, then the cookie-settings link
|
|
819
|
+
// (the consent banner's reopen point, not navigation); FAQ is not added.
|
|
820
|
+
const legalLinks = recordChrome
|
|
821
|
+
? [...recordChrome.legalLinks, cookieSettingsLink]
|
|
822
|
+
: [
|
|
823
|
+
{ label: "Privacy Policy", href: "/privacy" },
|
|
824
|
+
{ label: "Terms of Service", href: "/terms" },
|
|
825
|
+
cookieSettingsLink,
|
|
826
|
+
...(siteChrome.footer === "centered"
|
|
827
|
+
? [{ label: tNav("faq"), href: "/faq" }]
|
|
828
|
+
: []),
|
|
829
|
+
];
|
|
790
830
|
|
|
791
831
|
// The site's own declared colours (`content/_site.mdx` `theme:` + `brand:`)
|
|
792
832
|
// as a token overlay, the design's web faces (#7720) beneath `brand.fonts`,
|
|
@@ -857,6 +897,13 @@ export default async function LocaleLayout({
|
|
|
857
897
|
<link rel="manifest" href="/site.webmanifest" />
|
|
858
898
|
<GoogleAnalytics />
|
|
859
899
|
<VerificationMeta />
|
|
900
|
+
{/* #12401 (SEC-12403-3, #12404 M3) — which navigation this page
|
|
901
|
+
renders, whatever the header style: one per page. */}
|
|
902
|
+
<meta
|
|
903
|
+
name="ailk-nav-source"
|
|
904
|
+
content={recordNavigation ? "record" : "files"}
|
|
905
|
+
{...(recordNavigation ? { "data-version": String(recordNavigation.version) } : {})}
|
|
906
|
+
/>
|
|
860
907
|
</head>
|
|
861
908
|
<body>
|
|
862
909
|
{/* Skip link (operator ruling 2026-09-23): the first Tab stop on every
|
|
@@ -978,20 +1025,34 @@ export default async function LocaleLayout({
|
|
|
978
1025
|
// people-slide rule.
|
|
979
1026
|
// #10049 D1 — `none` renders no header; a site-set `full`
|
|
980
1027
|
// header shows the menus even on a `mark-only` design.
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
)
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
1028
|
+
// #12401 (SEC-12403-3) — the wrapper names the header's
|
|
1029
|
+
// source, `record` with its version or `files`, so the
|
|
1030
|
+
// import (#12403) can prove which one a site renders;
|
|
1031
|
+
// `contents` adds no box.
|
|
1032
|
+
pageChrome.header === "none" ? undefined : (
|
|
1033
|
+
<div
|
|
1034
|
+
className="contents"
|
|
1035
|
+
data-nav-source={recordNavigation ? "record" : "files"}
|
|
1036
|
+
{...(recordNavigation
|
|
1037
|
+
? { "data-nav-version": String(recordNavigation.version) }
|
|
1038
|
+
: {})}
|
|
1039
|
+
>
|
|
1040
|
+
{bareBackLink ? (
|
|
1041
|
+
<Nav {...navProps} navItems={[]} bar="bare" backLink={bareBackLink} />
|
|
1042
|
+
) : (
|
|
1043
|
+
<Nav
|
|
1044
|
+
{...navProps}
|
|
1045
|
+
navItems={
|
|
1046
|
+
siteChrome.nav === "mark-only" &&
|
|
1047
|
+
(session !== null ||
|
|
1048
|
+
pageChrome.header === "bare" ||
|
|
1049
|
+
pageChrome.headerFromTemplate)
|
|
1050
|
+
? []
|
|
1051
|
+
: publicNavItems
|
|
1052
|
+
}
|
|
1053
|
+
/>
|
|
1054
|
+
)}
|
|
1055
|
+
</div>
|
|
995
1056
|
)
|
|
996
1057
|
}
|
|
997
1058
|
footer={
|
|
@@ -161,8 +161,9 @@ describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)
|
|
|
161
161
|
body: { identity: { kind: "Organization", name, url: "https://elsewhere.example" }, seo: null },
|
|
162
162
|
});
|
|
163
163
|
|
|
164
|
-
// #11515 — hub-connected is a spoke key on the wire
|
|
165
|
-
//
|
|
164
|
+
// #11515 — hub-connected is a spoke key on the wire, or (#12390) an API
|
|
165
|
+
// address with no key, whatever the content adapter, so these cases run a
|
|
166
|
+
// file-content site (CONTENT_ADAPTER unset).
|
|
166
167
|
beforeEach(() => {
|
|
167
168
|
delete process.env.CONTENT_ADAPTER;
|
|
168
169
|
process.env.NEXT_PUBLIC_BASE_URL = BASE;
|
|
@@ -191,10 +192,19 @@ describe("the llms.txt heading — a hub-connected site's name (#11456 D4, AC-2)
|
|
|
191
192
|
expect(text.split("\n")[1]).toBe("");
|
|
192
193
|
});
|
|
193
194
|
|
|
195
|
+
// #12390 D2, AC-6 — a single-tenant site (its own API's address, no key)
|
|
196
|
+
// reads its workspace's name too.
|
|
197
|
+
it("carries the workspace name on a site with no spoke key and an API address", async () => {
|
|
198
|
+
mockSiteConfigGet.mockResolvedValue(identity("Solo Co"));
|
|
199
|
+
expect((await llms("../route", PUBLIC_ROWS)).split("\n")[0]).toBe("# Solo Co — content index");
|
|
200
|
+
expect(mockSiteConfigGet).toHaveBeenCalled();
|
|
201
|
+
});
|
|
202
|
+
|
|
194
203
|
it.each([
|
|
195
204
|
["CONTENT_ADAPTER unset", () => undefined],
|
|
196
205
|
["CONTENT_ADAPTER=database", () => (process.env.CONTENT_ADAPTER = "database")],
|
|
197
|
-
])("carries SITE_NAME with no AILK_SPOKE_KEY (%s), and never calls the hub", async (_label, arrange) => {
|
|
206
|
+
])("carries SITE_NAME with no AILK_SPOKE_KEY and no API address (%s), and never calls the hub", async (_label, arrange) => {
|
|
207
|
+
delete process.env.AILK_API_URL;
|
|
198
208
|
arrange();
|
|
199
209
|
mockSiteConfigGet.mockResolvedValue(identity("Hub Co"));
|
|
200
210
|
const { SITE_NAME } = jest.requireActual<typeof import("../../../lib/site-brand")>("../../../lib/site-brand");
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* lib/grid-read.ts — the one read of an Offerings grid for a page (#12370,
|
|
3
|
+
* spec docs/specs/12370-a-comparison-table-reads-an-offerings-grid-spec.md
|
|
4
|
+
* D3, D9): AC-3, AC-6, AC-12, AC-13.
|
|
5
|
+
*
|
|
6
|
+
* A `<Grid … />` block line and a `comparison-table` section's `grid` go
|
|
7
|
+
* through the same `gridTable`. The grid read is mocked at
|
|
8
|
+
* `@working-theory/api-client`, so this suite pins what each path asks the
|
|
9
|
+
* hub for and that the two give the same table.
|
|
10
|
+
*/
|
|
11
|
+
import { readFileSync } from "node:fs";
|
|
12
|
+
import path from "node:path";
|
|
13
|
+
|
|
14
|
+
import { PageSectionsSchema, parseBlockLine, type GridAnswer, type GridBlock, type PageSection } from "@working-theory/validation";
|
|
15
|
+
|
|
16
|
+
jest.mock("@working-theory/api-client", () => ({
|
|
17
|
+
content: { grid: jest.fn() },
|
|
18
|
+
offerings: { shown: jest.fn() },
|
|
19
|
+
flows: { get: jest.fn() },
|
|
20
|
+
leads: { captureStatus: jest.fn() },
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
import { content, offerings } from "@working-theory/api-client";
|
|
24
|
+
|
|
25
|
+
import { GRID_READ_DEADLINE_MS, gridTable, withinGridDeadline } from "../grid-read";
|
|
26
|
+
import { withGrids } from "../pricing-page";
|
|
27
|
+
|
|
28
|
+
const grid = jest.mocked(content.grid);
|
|
29
|
+
|
|
30
|
+
/** `publicGrid`'s answer for a Capabilities grid: what it left in is all there is. */
|
|
31
|
+
const CAPABILITIES: GridAnswer = {
|
|
32
|
+
kind: "capabilities",
|
|
33
|
+
columns: [
|
|
34
|
+
{ key: "pro", ours: true, plan: "pro", name: "Pro" },
|
|
35
|
+
{ key: "pro-plus", ours: true, plan: "pro-plus", name: "Pro Plus" },
|
|
36
|
+
],
|
|
37
|
+
groups: [
|
|
38
|
+
{
|
|
39
|
+
id: "site",
|
|
40
|
+
name: "Site",
|
|
41
|
+
rows: [
|
|
42
|
+
{ id: "pages", name: "Pages", note: "Every page a site needs.", cells: { pro: false, "pro-plus": true } },
|
|
43
|
+
{ id: "seats", name: "Seats", cells: { pro: { value: "1" }, "pro-plus": { value: "3" } } },
|
|
44
|
+
],
|
|
45
|
+
summaries: {},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
factsAsOf: null,
|
|
49
|
+
};
|
|
50
|
+
const ALTERNATIVES: GridAnswer = {
|
|
51
|
+
kind: "alternatives",
|
|
52
|
+
columns: [
|
|
53
|
+
{ key: "ours", ours: true, name: "Growth Hub" },
|
|
54
|
+
{ key: "wix", ours: false, name: "Wix", what: "A website builder", source: { url: "https://wix.com/pricing" }, checkedOn: "2026-11-01" },
|
|
55
|
+
],
|
|
56
|
+
groups: [
|
|
57
|
+
{
|
|
58
|
+
id: "build",
|
|
59
|
+
name: "Build",
|
|
60
|
+
rows: [
|
|
61
|
+
{
|
|
62
|
+
id: "r1",
|
|
63
|
+
name: "Drafts",
|
|
64
|
+
cells: {
|
|
65
|
+
ours: { verdict: "yes", note: { code: "from-level", level: "Pro Plus" } },
|
|
66
|
+
wix: { verdict: "partial", words: "Blog only" },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
summaries: {},
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
factsAsOf: "2026-11-01",
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
let seq = 0;
|
|
77
|
+
beforeEach(() => {
|
|
78
|
+
grid.mockReset();
|
|
79
|
+
jest.mocked(offerings.shown).mockReset();
|
|
80
|
+
seq += 1;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/** A block line's grid, parsed by the one grammar. */
|
|
84
|
+
function block(text: string): GridBlock {
|
|
85
|
+
const line = parseBlockLine(text);
|
|
86
|
+
if (line === null || line.tag !== "Grid") throw new Error(`not a grid line: ${text}`);
|
|
87
|
+
return line.block;
|
|
88
|
+
}
|
|
89
|
+
/** A grid-bound section, parsed as a page's sections are. */
|
|
90
|
+
function section(setting: Record<string, unknown>, own: Record<string, unknown> = {}): PageSection {
|
|
91
|
+
return PageSectionsSchema.parse([{ id: "t", type: "comparison-table", data: { grid: setting, ...own } }])[0]!;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
describe("a grid-bound section and a Grid block line give the same table (AC-3)", () => {
|
|
95
|
+
it.each<[string, GridAnswer, () => [string, Record<string, unknown>]]>([
|
|
96
|
+
[
|
|
97
|
+
"capabilities, with levels",
|
|
98
|
+
CAPABILITIES,
|
|
99
|
+
() => [
|
|
100
|
+
`<Grid kind="capabilities" products="growth-hub-${seq}" levels="pro pro-plus" show="features" />`,
|
|
101
|
+
{ kind: "capabilities", products: [`growth-hub-${seq}`], levels: ["pro", "pro-plus"], show: "features" },
|
|
102
|
+
],
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
"alternatives, with ours, columns and source",
|
|
106
|
+
ALTERNATIVES,
|
|
107
|
+
() => [
|
|
108
|
+
`<Grid kind="alternatives" category="website-platform-${seq}" ours="growth-hub" columns="wix" show="features" source="true" />`,
|
|
109
|
+
{ kind: "alternatives", category: `website-platform-${seq}`, ours: "growth-hub", columns: ["wix"], show: "features", source: true },
|
|
110
|
+
],
|
|
111
|
+
],
|
|
112
|
+
])("%s", async (_label, answer, fields) => {
|
|
113
|
+
grid.mockResolvedValue({ ok: true, body: answer });
|
|
114
|
+
const [line, setting] = fields();
|
|
115
|
+
const fromBlock = await gridTable(block(line), "en");
|
|
116
|
+
const [resolved] = await withGrids([section(setting)], "en");
|
|
117
|
+
expect(fromBlock).not.toBeNull();
|
|
118
|
+
expect(resolved!.data).toEqual(fromBlock!.data);
|
|
119
|
+
// The same fields are one read of the hub, shared: the two paths cannot disagree.
|
|
120
|
+
expect(grid).toHaveBeenCalledTimes(1);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it("the section's planBar equals a block's price and button, from the same grid data", async () => {
|
|
124
|
+
grid.mockResolvedValue({ ok: true, body: CAPABILITIES });
|
|
125
|
+
const fromBlock = await gridTable(block(`<Grid kind="capabilities" products="g-${seq}" show="features" price="true" button="true" />`), "en");
|
|
126
|
+
const planBar = { pickerLabel: "Plan", price: true, button: true };
|
|
127
|
+
const [resolved] = await withGrids([section({ kind: "capabilities", products: [`g-${seq}`], show: "features" }, { planBar })], "en");
|
|
128
|
+
expect(fromBlock!.data.planBar).toEqual(planBar);
|
|
129
|
+
expect(resolved!.data).toEqual(fromBlock!.data);
|
|
130
|
+
expect(fromBlock!.plans).toEqual(["pro", "pro-plus"]);
|
|
131
|
+
});
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
describe("the section draws exactly what the public grid answers (AC-6, AC-12, AC-13)", () => {
|
|
135
|
+
it("adds, removes and reorders nothing: the answer's rows and columns are the table's", async () => {
|
|
136
|
+
// What `publicGrid` left out — a row not in Stripe yet, an unpublished
|
|
137
|
+
// record, an unapproved or hidden column, an unknown slug — is not in the
|
|
138
|
+
// answer, and the site has no second filter and no second source.
|
|
139
|
+
grid.mockResolvedValue({ ok: true, body: ALTERNATIVES });
|
|
140
|
+
const [resolved] = await withGrids([section({ kind: "alternatives", category: `c-${seq}`, show: "features" })], "en");
|
|
141
|
+
const data = resolved!.data as Extract<PageSection, { type: "comparison-table" }>["data"];
|
|
142
|
+
expect(data.columns.map((c) => c.key)).toEqual(ALTERNATIVES.columns.map((c) => c.key));
|
|
143
|
+
expect(data.groups.map((g) => g.rows.map((r) => r.featureName))).toEqual([["Drafts"]]);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("reads one route — the public grid read — with the grid's own fields and the locale, and nothing else", async () => {
|
|
147
|
+
grid.mockResolvedValue({ ok: true, body: CAPABILITIES });
|
|
148
|
+
await withGrids([section({ kind: "capabilities", products: [`growth-hub-${seq}`, "positionary"], levels: ["pro"], show: "capabilities" })], "de");
|
|
149
|
+
expect(grid.mock.calls).toEqual([
|
|
150
|
+
[{ kind: "capabilities", slug: `growth-hub-${seq} positionary`, show: "capabilities", levels: "pro", locale: "de" }],
|
|
151
|
+
]);
|
|
152
|
+
// No workspace, organization or shown-set read: the same call in single
|
|
153
|
+
// tenant, multi-tenant and from a spoke with its own client.
|
|
154
|
+
expect(offerings.shown).not.toHaveBeenCalled();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it("carries no lookup key, planning id or PRD link: an answer holding one is refused, and a table holds the answer's words alone", async () => {
|
|
158
|
+
// A hub that answered more than the public shape: `GridAnswerSchema` is strict, so no table is drawn.
|
|
159
|
+
grid.mockResolvedValue({
|
|
160
|
+
ok: true,
|
|
161
|
+
body: { ...CAPABILITIES, entitlement: "pack-site", planningId: "FEAT-1", prd: "https://example.com/prd" } as GridAnswer,
|
|
162
|
+
});
|
|
163
|
+
expect(await withGrids([section({ kind: "capabilities", products: [`k-${seq}`], show: "features" })], "en")).toEqual([]);
|
|
164
|
+
|
|
165
|
+
grid.mockResolvedValue({ ok: true, body: CAPABILITIES });
|
|
166
|
+
const [resolved] = await withGrids([section({ kind: "capabilities", products: [`k2-${seq}`], show: "features" })], "en");
|
|
167
|
+
const data = resolved!.data as Record<string, unknown>;
|
|
168
|
+
expect(Object.keys(data).sort()).toEqual(["columns", "groups", "labelHeader"]);
|
|
169
|
+
expect(JSON.stringify(data)).not.toMatch(/entitlement|planningId|prd|pack-/);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
describe("withinGridDeadline", () => {
|
|
174
|
+
afterEach(() => jest.useRealTimers());
|
|
175
|
+
|
|
176
|
+
it("answers the read when it lands in time, and null for a rejection", async () => {
|
|
177
|
+
expect(await withinGridDeadline(Promise.resolve("table"))).toBe("table");
|
|
178
|
+
expect(await withinGridDeadline(Promise.reject(new Error("down")))).toBeNull();
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
it("answers null once the deadline passes", async () => {
|
|
182
|
+
jest.useFakeTimers();
|
|
183
|
+
const late = withinGridDeadline(new Promise<string>(() => undefined));
|
|
184
|
+
await jest.advanceTimersByTimeAsync(GRID_READ_DEADLINE_MS);
|
|
185
|
+
expect(await late).toBeNull();
|
|
186
|
+
expect(GRID_READ_DEADLINE_MS).toBe(3_000);
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
describe("grid-read.ts imports nothing from in-page-magnet (#12385)", () => {
|
|
191
|
+
// pricing-page → grid-read → in-page-magnet → contact.actions →
|
|
192
|
+
// site-pages.config → pricing-page closed a cycle that stopped `next build`.
|
|
193
|
+
// Every specifier form — static and dynamic import, re-export, require.
|
|
194
|
+
it("names no in-page-magnet module in any import, re-export or require", () => {
|
|
195
|
+
const source = readFileSync(path.join(__dirname, "..", "grid-read.ts"), "utf8");
|
|
196
|
+
const specifiers = [
|
|
197
|
+
...source.matchAll(/(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*\(\s*)(["'`])([^"'`]+)\1/g),
|
|
198
|
+
].map((match) => match[2]);
|
|
199
|
+
expect(specifiers.length).toBeGreaterThan(0);
|
|
200
|
+
expect(specifiers.filter((s) => /(^|\/)in-page-magnet(\.tsx?)?$/.test(s!))).toEqual([]);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("reaches the site through hub-read.ts alone, so no other local module can lead back", () => {
|
|
204
|
+
const source = readFileSync(path.join(__dirname, "..", "grid-read.ts"), "utf8");
|
|
205
|
+
const local = [
|
|
206
|
+
...source.matchAll(/(?:\bfrom\s*|\bimport\s*\(\s*|\bimport\s+|\brequire\s*\(\s*)(["'`])([^"'`]+)\1/g),
|
|
207
|
+
]
|
|
208
|
+
.map((match) => match[2]!)
|
|
209
|
+
.filter((s) => s.startsWith(".") || s.startsWith("@/"));
|
|
210
|
+
expect(local).toEqual(["./hub-read"]);
|
|
211
|
+
});
|
|
212
|
+
});
|