@sonordev/contracts 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -3
- package/README.md +11 -13
- package/dist/fleet.d.ts +9 -9
- package/dist/forms.d.ts +4 -10
- package/dist/llms.d.ts +1 -1
- package/dist/portfolio.d.ts +11 -15
- package/dist/seo-meta.d.ts +11 -12
- package/dist/seo-pages.d.ts +12 -18
- package/dist/site-cache.d.ts +4 -4
- package/dist/sites-normalize.d.ts +2 -4
- package/dist/sites.d.ts +3 -5
- package/dist/slot-content.d.ts +2 -2
- package/dist/slots.d.ts +6 -6
- package/dist/website.d.ts +2 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.1
|
|
4
|
+
|
|
5
|
+
- Docs only: the README names the Sonor API and the dashboard where it named internal repositories. No code changes.
|
|
6
|
+
|
|
3
7
|
## 2.1.0
|
|
4
8
|
|
|
5
9
|
A minor release: one new entry, `@sonordev/contracts/voice`. Every other entry is unchanged.
|
|
@@ -69,7 +73,7 @@ A major for one entry, `slots`, plus three new entries; every other entry is unc
|
|
|
69
73
|
`slots` re-exports all of it.
|
|
70
74
|
- **New entry `@sonordev/contracts/site-cache`**: how Sonor refreshes a
|
|
71
75
|
site's cached pages. `SITE_CACHE_TAGS` (the tag names site-kit's fetches
|
|
72
|
-
carry and
|
|
76
|
+
carry and the Sonor API expires), `SITE_REVALIDATE_PATH`, the webhook payload
|
|
73
77
|
and its `ping`, and `isSiteRevalidatePong`.
|
|
74
78
|
- **New entry `@sonordev/contracts/site-edit`**: Sonor's Edit on page. The
|
|
75
79
|
messages between a framed site and the dashboard, which origins may drive
|
|
@@ -80,5 +84,5 @@ A major for one entry, `slots`, plus three new entries; every other entry is unc
|
|
|
80
84
|
|
|
81
85
|
First release. The rules site-kit 6.x published as `@sonordev/site-kit/*/contract`
|
|
82
86
|
(website, color, sites, seo-pages, seo-meta, llms, forms, fleet, slots,
|
|
83
|
-
portfolio), as a dependency-free package, so
|
|
84
|
-
dashboard import them instead of keeping
|
|
87
|
+
portfolio), as a dependency-free package, so the Sonor APIs and the
|
|
88
|
+
dashboard import them instead of keeping copies.
|
package/README.md
CHANGED
|
@@ -9,19 +9,19 @@ pnpm add @sonordev/contracts
|
|
|
9
9
|
|
|
10
10
|
| Entry | What it decides | Who reads it |
|
|
11
11
|
|---|---|---|
|
|
12
|
-
| `@sonordev/contracts/website` | A site's design tokens and what a popup is made of (blocks, limits, the text sanitizer) | site-kit renders them,
|
|
12
|
+
| `@sonordev/contracts/website` | A site's design tokens and what a popup is made of (blocks, limits, the text sanitizer) | site-kit renders them, the Sonor API validates every write, the dashboard previews them, Signal's agents send them |
|
|
13
13
|
| `@sonordev/contracts/color` | Reading a CSS color, WCAG luminance and contrast | `website`, site-kit's brand extraction |
|
|
14
14
|
| `@sonordev/contracts/sites` | The canonical shape of a site host (the multi-site `site` dimension) | every ingest and read that filters by site |
|
|
15
|
-
| `@sonordev/contracts/seo-pages` | Which `seo_pages` row a path resolves to on a multi-site project |
|
|
15
|
+
| `@sonordev/contracts/seo-pages` | Which `seo_pages` row a path resolves to on a multi-site project | the Sonor API, Signal, site-kit's sitemap sync |
|
|
16
16
|
| `@sonordev/contracts/seo-meta` | Whether a title or description is fit to ship | site-kit, Signal's SEO gate |
|
|
17
|
-
| `@sonordev/contracts/llms` | llms.txt sanitizers and contract version | site-kit,
|
|
18
|
-
| `@sonordev/contracts/forms` | The honeypot policy | site-kit forms,
|
|
19
|
-
| `@sonordev/contracts/fleet` | The fleet heartbeat's wire shape | site-kit,
|
|
20
|
-
| `@sonordev/contracts/slots` | Slot payload signing, contract v2 (HMAC; Node only). Signs and verifies v1 for older site-kit releases |
|
|
21
|
-
| `@sonordev/contracts/slot-content` | What a slot of each kind may hold (`normalizeSlotValue`), safe links, the rich-text parser. No `crypto`, so browsers can import it |
|
|
22
|
-
| `@sonordev/contracts/site-cache` | The cache tags a site's Sonor fetches carry and the revalidation route's path, payload and ping | site-kit tags and serves the route,
|
|
17
|
+
| `@sonordev/contracts/llms` | llms.txt sanitizers and contract version | site-kit, the Sonor API, Signal's schema validation |
|
|
18
|
+
| `@sonordev/contracts/forms` | The honeypot policy | site-kit forms, the Sonor API's form intake |
|
|
19
|
+
| `@sonordev/contracts/fleet` | The fleet heartbeat's wire shape | site-kit, the Sonor API |
|
|
20
|
+
| `@sonordev/contracts/slots` | Slot payload signing, contract v2 (HMAC; Node only). Signs and verifies v1 for older site-kit releases | the Sonor API, site-kit on the server |
|
|
21
|
+
| `@sonordev/contracts/slot-content` | What a slot of each kind may hold (`normalizeSlotValue`), safe links, the rich-text parser. No `crypto`, so browsers can import it | the Sonor API, site-kit, the dashboard editor |
|
|
22
|
+
| `@sonordev/contracts/site-cache` | The cache tags a site's Sonor fetches carry and the revalidation route's path, payload and ping | site-kit tags and serves the route, the Sonor API calls it |
|
|
23
23
|
| `@sonordev/contracts/site-edit` | Edit on page: the messages between a framed site and the dashboard, trusted origins, how a slot is found on the page | site-kit's overlay, the dashboard's visual editor |
|
|
24
|
-
| `@sonordev/contracts/portfolio` | Where a portfolio number comes from and which may headline; the live-frame message |
|
|
24
|
+
| `@sonordev/contracts/portfolio` | Where a portfolio number comes from and which may headline; the live-frame message | the Sonor API, Signal, agency-site-kit |
|
|
25
25
|
| `@sonordev/contracts/voice` | The house voice's contraction rule. `findUncontracted` and `contractText` find and apply full forms that should be contractions; `findContracted` finds the contractions a question-form heading should expand | anything that checks or rewrites copy: Sonor's APIs and dashboard |
|
|
26
26
|
|
|
27
27
|
## The voice contract
|
|
@@ -137,10 +137,8 @@ pinned by a test, so changing it later is a visible change.
|
|
|
137
137
|
|
|
138
138
|
## Why it exists
|
|
139
139
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
parallel copies of a rule is how two of them end up disagreeing. Now there's
|
|
143
|
-
one: the source is `src/contracts/` in the site-kit repo, site-kit bundles it
|
|
140
|
+
A rule that lives in several copies is how two of them end up disagreeing.
|
|
141
|
+
This package means there's one: the source is `src/contracts/` in the site-kit repo, site-kit bundles it
|
|
144
142
|
into its own `*/contract` entries, and this package publishes the same files
|
|
145
143
|
for everyone else.
|
|
146
144
|
|
package/dist/fleet.d.ts
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* @sonordev/contracts/fleet — Fleet heartbeat wire contract (v1)
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for the heartbeat payload shape, shared by site-kit
|
|
5
|
-
* (send side, `@sonordev/site-kit/fleet/contract`) and
|
|
5
|
+
* (send side, `@sonordev/site-kit/fleet/contract`) and the Sonor API (ingest
|
|
6
6
|
* side: its DTO is type-checked against FleetHeartbeatPayload).
|
|
7
7
|
*
|
|
8
|
-
* Why it exists:
|
|
9
|
-
*
|
|
10
|
-
* site running" without
|
|
11
|
-
*
|
|
8
|
+
* Why it exists: sites run whatever site-kit version they last deployed, and
|
|
9
|
+
* Sonor should be able to answer "which version / modules / key state is each
|
|
10
|
+
* site running" without anyone opening each repo. The heartbeat answers that
|
|
11
|
+
* from live traffic. It is fire-and-forget, deferred to idle (never in the
|
|
12
12
|
* hydration path), and carries NO visitor data — only the site's own build
|
|
13
13
|
* fingerprint. Project identity is resolved server-side from the x-api-key
|
|
14
14
|
* header, exactly like every other /api/public/* endpoint; sites never send
|
|
@@ -56,7 +56,7 @@ export interface FleetHeartbeatPayload {
|
|
|
56
56
|
next_version?: string | null;
|
|
57
57
|
/** Client-observable active modules — deduped, validated, canonical order. */
|
|
58
58
|
modules: FleetModule[];
|
|
59
|
-
/** Normalized lowercase host (multi-site sub-dimension
|
|
59
|
+
/** Normalized lowercase host (multi-site sub-dimension). */
|
|
60
60
|
site?: string | null;
|
|
61
61
|
/** 'client' (runtime boot) or 'build' (CI/build step). Default 'client'. */
|
|
62
62
|
source?: FleetHeartbeatSource;
|
|
@@ -77,9 +77,9 @@ export declare function normalizeFleetModules(input: unknown): FleetModule[];
|
|
|
77
77
|
export declare function sanitizeFleetVersion(raw: unknown): string | null;
|
|
78
78
|
/**
|
|
79
79
|
* Light client-side site normalization to the canonical host shape (lowercase,
|
|
80
|
-
* no protocol/path/port).
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* no protocol/path/port). The Sonor API's normalizer is AUTHORITATIVE and
|
|
81
|
+
* re-runs on ingest; this just avoids sending obvious noise. Keep the two
|
|
82
|
+
* shapes aligned.
|
|
83
83
|
*/
|
|
84
84
|
export declare function normalizeFleetSite(raw: unknown): string | null;
|
|
85
85
|
/**
|
package/dist/forms.d.ts
CHANGED
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @sonordev/contracts/forms — managed-form honeypot policy (v1)
|
|
3
3
|
*
|
|
4
|
-
* Single source of truth for the honeypot
|
|
5
|
-
*
|
|
6
|
-
* the server (sonor-api names the trap in the form config it returns AND
|
|
7
|
-
* detects hits on intake). Both import this: site-kit as
|
|
8
|
-
* `@sonordev/site-kit/forms/contract`, sonor-api through
|
|
9
|
-
* `src/modules/forms/honeypot-contract.ts`.
|
|
4
|
+
* Single source of truth for the honeypot field's naming, shared by site-kit
|
|
5
|
+
* (which renders the field, as `@sonordev/site-kit/forms/contract`) and Sonor.
|
|
10
6
|
*
|
|
11
|
-
* The default field name
|
|
12
|
-
*
|
|
13
|
-
* as spam, so generic names are only trusted when they DON'T match a real
|
|
14
|
-
* field of the form (see `resolveHoneypotFieldNames`).
|
|
7
|
+
* The default field name is deliberately unlike a real field's, so it never
|
|
8
|
+
* collides with a form's own fields (see `resolveHoneypotFieldNames`).
|
|
15
9
|
*/
|
|
16
10
|
/** Bump on breaking changes to the honeypot policy. */
|
|
17
11
|
export declare const FORMS_HONEYPOT_CONTRACT_VERSION: 1;
|
package/dist/llms.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export declare const LLMS_PUBLIC_SUMMARY_MAX_LENGTH = 400;
|
|
|
14
14
|
/** Max length for optional llms.txt blockquote disclaimer line. */
|
|
15
15
|
export declare const LLMS_DISCLAIMER_MAX_LENGTH = 280;
|
|
16
16
|
/**
|
|
17
|
-
* Optional keys we allow inside managed_llm_schema JSON from
|
|
17
|
+
* Optional keys we allow inside managed_llm_schema JSON from Sonor.
|
|
18
18
|
* Values outside this set should not be relied on by consumers; strip unknown keys when emitting JSON-LD.
|
|
19
19
|
*/
|
|
20
20
|
export declare const MANAGED_LLM_SCHEMA_KNOWN_KEYS: Set<string>;
|
package/dist/portfolio.d.ts
CHANGED
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
* @sonordev/contracts/portfolio — portfolio proof display policy (v1)
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for the Lighthouse-KPI collapse policy shared by the
|
|
5
|
-
* content side (
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* from `src/portfolio/curate-proof.ts`, which keeps the render-only
|
|
9
|
-
* primitives that bind to its section types.
|
|
10
|
-
* - signal-api imports it through
|
|
11
|
-
* `src/modules/skills/portfolio/portfolio-kpi-policy.util.ts`.
|
|
5
|
+
* content side (Signal's case-study generation) and the render side
|
|
6
|
+
* (agency-site-kit, which imports it as `@sonordev/site-kit/portfolio/contract`
|
|
7
|
+
* and keeps the render-only primitives that bind to its section types).
|
|
12
8
|
*
|
|
13
9
|
* Why it exists: generated case studies arrived with four "100/100 Lighthouse X"
|
|
14
10
|
* KPIs repeated across hero, results cards, and a Performance section. One
|
|
@@ -17,8 +13,8 @@
|
|
|
17
13
|
*
|
|
18
14
|
* It is also the single source of truth for METRIC PROVENANCE (below): the
|
|
19
15
|
* three sources a portfolio number can have, what a client-reported number
|
|
20
|
-
* must carry, and which numbers may headline.
|
|
21
|
-
*
|
|
16
|
+
* must carry, and which numbers may headline. The Sonor API applies the same
|
|
17
|
+
* rules.
|
|
22
18
|
*/
|
|
23
19
|
/** The message a cross-origin-framed site-kit page posts to its embedder once it has painted. */
|
|
24
20
|
export declare const FRAME_READY_MESSAGE: 'sonor:frame-ready';
|
|
@@ -109,11 +105,11 @@ export declare const METRIC_SOURCES: readonly ['measured', 'reported', 'estimate
|
|
|
109
105
|
export type MetricSource = (typeof METRIC_SOURCES)[number];
|
|
110
106
|
/** Who stands behind a client-reported number. */
|
|
111
107
|
export interface MetricAttribution {
|
|
112
|
-
/** The person, e.g. "
|
|
108
|
+
/** The person, e.g. "Dana Reyes". */
|
|
113
109
|
name: string;
|
|
114
|
-
/** Their title, e.g. "Director of
|
|
110
|
+
/** Their title, e.g. "Director of Operations". */
|
|
115
111
|
role?: string;
|
|
116
|
-
/** Where they work: almost always the client, e.g. "
|
|
112
|
+
/** Where they work: almost always the client, e.g. "Northwind Engineering". */
|
|
117
113
|
organization: string;
|
|
118
114
|
/** The day they reported it, YYYY-MM-DD. */
|
|
119
115
|
date: string;
|
|
@@ -140,12 +136,12 @@ export declare function isHeadlineMetric(metric: SourcedMetric): boolean;
|
|
|
140
136
|
/** The badge a display shows, or null for a missing or unknown source (show nothing rather than guess). */
|
|
141
137
|
export declare function metricSourceLabel(source: unknown): string | null;
|
|
142
138
|
/**
|
|
143
|
-
* The full credit: "Reported by
|
|
144
|
-
*
|
|
139
|
+
* The full credit: "Reported by Dana Reyes, Director of Operations, Northwind
|
|
140
|
+
* Engineering, September 25, 2026". The date is read as a plain day,
|
|
145
141
|
* never through a time zone, so it can't slip to the day before.
|
|
146
142
|
*/
|
|
147
143
|
export declare function formatAttribution(by: MetricAttribution): string;
|
|
148
|
-
/** The credit for a tight space (a card, a carousel tile): "per
|
|
144
|
+
/** The credit for a tight space (a card, a carousel tile): "per Northwind Engineering". */
|
|
149
145
|
export declare function shortAttribution(by: Pick<MetricAttribution, 'organization'>): string;
|
|
150
146
|
/**
|
|
151
147
|
* Carry a person's reported numbers through a regeneration. The generator can
|
package/dist/seo-meta.d.ts
CHANGED
|
@@ -4,17 +4,16 @@
|
|
|
4
4
|
* Single source of truth for "is this machine-generated seo_pages.managed_title
|
|
5
5
|
* / managed_meta_description fit to ship?". site-kit applies it at render time
|
|
6
6
|
* (getManagedMetadata falls back to the page's own title/description), and
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* Signal applies it to every generated title before it's written, so the two
|
|
8
|
+
* can't disagree.
|
|
9
9
|
*
|
|
10
|
-
* Why it exists
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* rendered them verbatim.
|
|
10
|
+
* Why it exists: a meta generator that uses the raw domain as the brand when it
|
|
11
|
+
* can't resolve one ships titles like "Apartments for Rent |
|
|
12
|
+
* maplecourtapts.com", hard-cuts them at 60 chars ("… |
|
|
13
|
+
* brightsideheatingandcooli"), loses the suffix to a word-boundary cut
|
|
14
|
+
* ("Contact Brightside Heating and Cooling |"), or rebuilds a brand out of the
|
|
15
|
+
* domain ("About BBE Llis Apartments | BBE Llis" for bbellisapts.com, when the
|
|
16
|
+
* brand is BB Ellis Apartments). Sites render them verbatim.
|
|
18
17
|
*
|
|
19
18
|
* Every rule derives from the site's own identity (its hosts and brand), so
|
|
20
19
|
* there is no list of bad strings to maintain. Pure string logic — no I/O, no
|
|
@@ -24,7 +23,7 @@
|
|
|
24
23
|
export declare const SEO_META_CONTRACT_VERSION: 1;
|
|
25
24
|
/** Who the site is. Hosts come from the project/site config, the brand from the resolved business name — never from the domain. */
|
|
26
25
|
export interface MetaIdentity {
|
|
27
|
-
/** The site's brand, e.g. "
|
|
26
|
+
/** The site's brand, e.g. "BB Ellis Apartments". */
|
|
28
27
|
brand?: string | null;
|
|
29
28
|
/** Other correct spellings of the brand. */
|
|
30
29
|
brandAliases?: Array<string | null | undefined>;
|
|
@@ -34,7 +33,7 @@ export interface MetaIdentity {
|
|
|
34
33
|
export type TitleProblem = 'empty' | 'placeholder' | 'dangling-separator' | 'hostname' | 'mangled-brand';
|
|
35
34
|
export type DescriptionProblem = 'empty' | 'hostname' | 'mangled-brand' | 'truncated';
|
|
36
35
|
export type SuffixProblem = 'hostname' | 'mangled-brand';
|
|
37
|
-
/** "https://www.
|
|
36
|
+
/** "https://www.MapleCourtApts.com:443/x" → "maplecourtapts.com". Null for anything that isn't a host (no dot, or words). */
|
|
38
37
|
export declare function metaHost(value: string | null | undefined): string | null;
|
|
39
38
|
/** True when the text names the brand (an alias, or either one's core) word for word. */
|
|
40
39
|
export declare function namesBrand(text: string, id: MetaIdentity): boolean;
|
package/dist/seo-pages.d.ts
CHANGED
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for choosing ONE seo_pages row when a (project_id,
|
|
5
5
|
* path/url) lookup matches several, and for scoping a project's rows to one
|
|
6
|
-
* host. site-kit (`@sonordev/site-kit/seo/pages/contract`)
|
|
7
|
-
*
|
|
8
|
-
* (`src/shared/utils/seo-page-pick.util.ts`) all import this; none keeps a
|
|
9
|
-
* copy.
|
|
6
|
+
* host. site-kit (`@sonordev/site-kit/seo/pages/contract`) and both Sonor
|
|
7
|
+
* APIs import this; none keeps a copy.
|
|
10
8
|
*
|
|
11
|
-
* seo_pages identity
|
|
12
|
-
* 20260702150000_seo_pages_per_site_identity.sql: a multi-site project (one
|
|
9
|
+
* seo_pages identity is (project_id, site, url): a multi-site project (one
|
|
13
10
|
* Sonor project hosting many domains) keeps one row PER SUB-SITE HOST for
|
|
14
11
|
* shared paths like `/` or `/contact`. Any path/url lookup can therefore match
|
|
15
12
|
* several rows — `.single()`/`.maybeSingle()` error on them (PGRST116) — so
|
|
@@ -26,11 +23,9 @@ export declare const SEO_PAGES_CONTRACT_VERSION: 1;
|
|
|
26
23
|
*
|
|
27
24
|
* Retired pages are kept as tombstones (status='removed') so their history and
|
|
28
25
|
* redirects survive, which means every public read has to opt out of them
|
|
29
|
-
* explicitly.
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* was 32% dead URLs, advertising service areas in Atlanta, Detroit and Tampa
|
|
33
|
-
* that the business has never served.
|
|
26
|
+
* explicitly. A read that forgets serves dead URLs: an llms.txt, the file
|
|
27
|
+
* handed straight to AI crawlers, ends up advertising pages the business
|
|
28
|
+
* retired long ago.
|
|
34
29
|
*
|
|
35
30
|
* Null-safe by design: `status` is nullable with an 'active' default, so a row
|
|
36
31
|
* whose status was explicitly nulled stays live rather than vanishing from the
|
|
@@ -80,13 +75,12 @@ export declare function matchSitemapEntryRow<T extends SeoPageRowLike>(candidate
|
|
|
80
75
|
* that belongs to `site`, keeping at most one row per path.
|
|
81
76
|
*
|
|
82
77
|
* Why this exists: a multi-site project (one Sonor project hosting many
|
|
83
|
-
* domains
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* among same-path rows is broken by whatever order Postgres returns.
|
|
78
|
+
* domains, e.g. example.com plus dozens of city microsites) holds one row PER
|
|
79
|
+
* HOST for shared paths like `/` and `/terms`. Any project-wide read that
|
|
80
|
+
* dedupes by path alone therefore keeps an ARBITRARY host's row: example.com's
|
|
81
|
+
* llms.txt can describe `/` with a sibling's homepage copy, and which sibling
|
|
82
|
+
* wins changes every time a neighbour rebuilds, because the tie among
|
|
83
|
+
* same-path rows is broken by whatever order Postgres returns.
|
|
90
84
|
*
|
|
91
85
|
* Rules, per path, via `matchSitemapEntryRow`:
|
|
92
86
|
* - this host's row wins outright
|
package/dist/site-cache.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* How Sonor refreshes a site's cached pages when content changes.
|
|
3
3
|
*
|
|
4
4
|
* A site serves cached pages and caches every fetch from Sonor. When someone
|
|
5
|
-
* edits content in Sonor,
|
|
5
|
+
* edits content in Sonor, Sonor POSTs the paths and cache tags that
|
|
6
6
|
* changed to the site's revalidation route, authenticated with the project's
|
|
7
7
|
* API key, and the site regenerates just those. site-kit tags its fetches with
|
|
8
8
|
* these names and serves the route (`@sonordev/site-kit/revalidate`);
|
|
9
|
-
*
|
|
9
|
+
* Sonor sends them. Single source of truth for the names on both sides:
|
|
10
10
|
* never spell a tag as a string literal in either.
|
|
11
11
|
*/
|
|
12
12
|
/** Where the revalidation route lives on every site. */
|
|
@@ -29,7 +29,7 @@ export declare const SITE_CACHE_TAGS: {
|
|
|
29
29
|
readonly portfolio: 'portfolio';
|
|
30
30
|
};
|
|
31
31
|
export type SiteCacheTag = (typeof SITE_CACHE_TAGS)[keyof typeof SITE_CACHE_TAGS];
|
|
32
|
-
/** The body
|
|
32
|
+
/** The body Sonor POSTs to the revalidation route. */
|
|
33
33
|
export interface SiteRevalidatePayload {
|
|
34
34
|
/** Local paths to regenerate, e.g. `['/services/roofing']`. */
|
|
35
35
|
paths?: string[];
|
|
@@ -39,7 +39,7 @@ export interface SiteRevalidatePayload {
|
|
|
39
39
|
revalidateAll?: boolean;
|
|
40
40
|
/**
|
|
41
41
|
* Only check that the route is installed and the key matches; nothing is
|
|
42
|
-
* regenerated.
|
|
42
|
+
* regenerated. Sonor pings after it registers a site's route, so it
|
|
43
43
|
* knows whether an edit goes live in seconds or waits for the cache to age out.
|
|
44
44
|
*/
|
|
45
45
|
ping?: boolean;
|
|
@@ -14,9 +14,7 @@
|
|
|
14
14
|
* pushed those entries over their bundle budgets.
|
|
15
15
|
*
|
|
16
16
|
* `./sites` re-exports this, so `@sonordev/contracts/sites` (and site-kit's
|
|
17
|
-
* `sites/contract`) carry it too. The
|
|
18
|
-
* (sonor-api `src/common/utils/site-host.ts`, signal-api
|
|
19
|
-
* `src/shared/utils/seo-page-pick.util.ts`).
|
|
17
|
+
* `sites/contract`) carry it too. The Sonor APIs import it from there.
|
|
20
18
|
*
|
|
21
19
|
* Pure string logic only (no Node built-ins) so it is safe in the browser.
|
|
22
20
|
*/
|
|
@@ -24,7 +22,7 @@
|
|
|
24
22
|
* normalizeSiteHost — canonical normalizer for a sub-site host value before it
|
|
25
23
|
* is persisted or used as a filter.
|
|
26
24
|
*
|
|
27
|
-
* `https://
|
|
25
|
+
* `https://Ohio.Example.com:3000/path` → `ohio.example.com`
|
|
28
26
|
*
|
|
29
27
|
* Lowercases, strips protocol, keeps host only (drops path + query), strips
|
|
30
28
|
* port (rollups span dev/prod) and the FQDN root dot. Returns null for
|
package/dist/sites.d.ts
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
* @sonordev/contracts/sites — Multi-site "site" dimension host contract (v1)
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for normalizing and comparing sub-site host values
|
|
5
|
-
* (the multi-site `site` dimension
|
|
6
|
-
*
|
|
7
|
-
* (`src/shared/utils/seo-page-pick.util.ts`) all import it, so there's no
|
|
8
|
-
* copy to drift.
|
|
5
|
+
* (the multi-site `site` dimension). site-kit and both Sonor APIs import it,
|
|
6
|
+
* so there's no copy to drift.
|
|
9
7
|
*
|
|
10
8
|
* Pure string logic only (no Node built-ins) so it is safe in the browser:
|
|
11
9
|
* site-kit itself normalizes `__SITE_KIT_SITE__` with `normalizeSiteHost`.
|
|
@@ -28,7 +26,7 @@ export declare function stripWww(host: string): string;
|
|
|
28
26
|
*/
|
|
29
27
|
export declare function sameSite(a: string | null | undefined, b: string | null | undefined): boolean;
|
|
30
28
|
/**
|
|
31
|
-
* Host of a full URL ("https://
|
|
29
|
+
* Host of a full URL ("https://ohio.example.com/x" → "ohio.example.com"),
|
|
32
30
|
* null for site-relative paths ("/services") and unparseable input.
|
|
33
31
|
*/
|
|
34
32
|
export declare function hostFromUrl(value: string | null | undefined): string | null;
|
package/dist/slot-content.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The pure half of the slots contract: content types, value validation
|
|
5
5
|
* (normalizeSlotValue), safe links, and the rich-text subset parser. No
|
|
6
6
|
* crypto, so the dashboard can import it in the browser to validate and
|
|
7
|
-
* preview exactly what
|
|
7
|
+
* preview exactly what the Sonor API will accept and site-kit will render.
|
|
8
8
|
* `@sonordev/contracts/slots` re-exports all of it next to the signing.
|
|
9
9
|
*/
|
|
10
10
|
/**
|
|
@@ -66,7 +66,7 @@ export type SlotValueResult = {
|
|
|
66
66
|
/**
|
|
67
67
|
* Validate and normalize what an editor (or Signal) submits for a slot of
|
|
68
68
|
* `type`, returning the canonical `content` + `value` to store and sign.
|
|
69
|
-
* The single rule for "what a valid slot of this type is":
|
|
69
|
+
* The single rule for "what a valid slot of this type is": the Sonor API runs it
|
|
70
70
|
* on every write and verifySlotContent re-runs it on every read.
|
|
71
71
|
*/
|
|
72
72
|
export declare function normalizeSlotValue(type: SlotContentType, input: {
|
package/dist/slots.d.ts
CHANGED
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Single source of truth for the slot payload shape, value validation, the
|
|
5
5
|
* rich-text subset, and content signing, shared by site-kit (verify + render),
|
|
6
|
-
*
|
|
6
|
+
* the Sonor API (validate + sign) and the dashboard (preview). Node only: it signs
|
|
7
7
|
* with `crypto`.
|
|
8
8
|
*
|
|
9
9
|
* Security model: every SlotContent is HMAC-signed with the project API key.
|
|
10
10
|
* site-kit verifies before rendering and falls back to the developer's static
|
|
11
11
|
* content on any mismatch, so platform-originated content carries provenance
|
|
12
|
-
* end to end.
|
|
12
|
+
* end to end.
|
|
13
13
|
*
|
|
14
14
|
* v1 (site-kit ≤ 7.0) is plain text only. v2 adds rich text, links and lists,
|
|
15
|
-
* and signs the structured value too.
|
|
15
|
+
* and signs the structured value too. Sonor serves both: a v1 request gets
|
|
16
16
|
* text slots signed the v1 way and null for everything else.
|
|
17
17
|
*/
|
|
18
18
|
import { type SlotContentType, type SlotValue } from './slot-content';
|
|
19
19
|
export * from './slot-content';
|
|
20
20
|
/** The version this package speaks. Bump on breaking payload changes. */
|
|
21
21
|
export declare const SLOTS_CONTRACT_VERSION = 2;
|
|
22
|
-
/** Versions
|
|
22
|
+
/** Versions Sonor still serves. */
|
|
23
23
|
export declare const SUPPORTED_SLOTS_CONTRACT_VERSIONS: readonly number[];
|
|
24
24
|
export interface SlotContent {
|
|
25
25
|
slot_id: string;
|
|
@@ -63,7 +63,7 @@ export interface SlotResolveRequestEntry {
|
|
|
63
63
|
export interface SlotsResolveRequest {
|
|
64
64
|
contract_version: number;
|
|
65
65
|
slots: SlotResolveRequestEntry[];
|
|
66
|
-
/** Multi-site sub-dimension: normalized lowercase host
|
|
66
|
+
/** Multi-site sub-dimension: normalized lowercase host. */
|
|
67
67
|
site?: string;
|
|
68
68
|
}
|
|
69
69
|
export interface SlotsResolveResponse {
|
|
@@ -83,7 +83,7 @@ type Signable = Pick<SlotContent, 'slot_id' | 'type' | 'content'> & {
|
|
|
83
83
|
*/
|
|
84
84
|
export declare function slotSigningPayload(content: Signable, version?: number): string;
|
|
85
85
|
/**
|
|
86
|
-
* Sign slot content with the project API key (
|
|
86
|
+
* Sign slot content with the project API key (Sonor's side).
|
|
87
87
|
* Returns the hex HMAC-SHA256 signature.
|
|
88
88
|
*/
|
|
89
89
|
export declare function signSlotContent(content: Signable, apiKey: string, version?: number): string;
|
package/dist/website.d.ts
CHANGED
|
@@ -5,14 +5,14 @@
|
|
|
5
5
|
* SINGLE SOURCE OF TRUTH shared by every side of the Website module's popups:
|
|
6
6
|
* - the site (site-kit measures its own rendered design and reports it,
|
|
7
7
|
* publishes it as `--sk-site-*` CSS variables, and renders popup blocks),
|
|
8
|
-
* -
|
|
8
|
+
* - the Sonor API (validates the design report and every popup write with these
|
|
9
9
|
* normalizers, so a popup can't be saved in a shape the site can't draw),
|
|
10
10
|
* - the dashboard (the builder's preview reads the same tokens through the
|
|
11
11
|
* same CSS-variable mapping, so it looks like the site),
|
|
12
12
|
* - Signal's agents (the block shapes an MCP `propose_site_popup` sends).
|
|
13
13
|
*
|
|
14
14
|
* All four import it: site-kit as `@sonordev/site-kit/website/contract`,
|
|
15
|
-
*
|
|
15
|
+
* the API and the dashboard as `@sonordev/contracts/website`.
|
|
16
16
|
*
|
|
17
17
|
* Why popups carry blocks and the site carries tokens: a popup should look
|
|
18
18
|
* like the site it's on. It says WHAT (a heading, some formatted text, an
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonordev/contracts",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "The rules Sonor's sites, APIs and dashboard share: popup blocks and site design tokens, site hosts, SEO page identity, title quality, llms.txt sanitizers, the forms honeypot, fleet heartbeats, slot content and signing, site cache tags, portfolio metrics and the house voice's contraction rule. Pure functions, no dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|