@proveanything/smartlinks 2.1.39 → 2.1.41
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/README.md +754 -754
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/adminViews.d.ts +1 -1
- package/dist/adminViews.js +3 -1
- package/dist/ai-tools.d.ts +2 -1
- package/dist/ai-tools.js +3 -0
- package/dist/api/ai.d.ts +2 -21
- package/dist/api/ai.js +0 -35
- package/dist/api/collection.d.ts +8 -1
- package/dist/api/collection.js +10 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/knowledge.d.ts +64 -0
- package/dist/api/knowledge.js +97 -0
- package/dist/baseline.css +194 -194
- package/dist/docs/API_SUMMARY.md +1046 -964
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/admin-views.md +257 -255
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1834
- package/dist/docs/analytics.md +39 -39
- package/dist/docs/app-data-storage.md +277 -277
- package/dist/docs/app-docs.md +73 -73
- package/dist/docs/app-manifest.md +852 -852
- package/dist/docs/app-records-pattern.md +388 -388
- package/dist/docs/appConfig.md +550 -550
- package/dist/docs/assistant-apps.md +172 -172
- package/dist/docs/assistant-context.md +119 -119
- package/dist/docs/bookings.md +442 -442
- package/dist/docs/comms.md +686 -686
- package/dist/docs/connectors.md +340 -340
- package/dist/docs/css-baseline.md +133 -133
- package/dist/docs/customer-guide.md +70 -70
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +210 -210
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +545 -545
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +102 -0
- package/dist/docs/lots.md +111 -111
- package/dist/docs/loyalty.md +352 -352
- package/dist/docs/members.md +182 -182
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +482 -482
- package/dist/docs/proof-comms-triggers.md +142 -142
- package/dist/docs/proof-ownership-transfer.md +155 -155
- package/dist/docs/proof-product-data-scoping.md +462 -462
- package/dist/docs/proof-share-grants.md +305 -305
- package/dist/docs/realtime.md +138 -138
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/standard-query.md +187 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/openapi.yaml +320 -306
- package/dist/theme-boot.js +78 -78
- package/dist/theme.css +75 -75
- package/dist/types/ai.d.ts +9 -91
- package/dist/types/appManifest.d.ts +21 -0
- package/dist/types/collection.d.ts +26 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/knowledge.d.ts +120 -0
- package/dist/types/knowledge.js +2 -0
- package/docs/API_SUMMARY.md +1046 -964
- package/docs/admin-cards.md +189 -189
- package/docs/admin-views.md +257 -255
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1834
- package/docs/analytics.md +39 -39
- package/docs/app-data-storage.md +277 -277
- package/docs/app-docs.md +73 -73
- package/docs/app-manifest.md +852 -852
- package/docs/app-records-pattern.md +388 -388
- package/docs/appConfig.md +550 -550
- package/docs/assistant-apps.md +172 -172
- package/docs/assistant-context.md +119 -119
- package/docs/bookings.md +442 -442
- package/docs/comms.md +686 -686
- package/docs/connectors.md +340 -340
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/deploying-apps.md +340 -340
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +210 -210
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +545 -545
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +102 -0
- package/docs/lots.md +111 -111
- package/docs/loyalty.md +352 -352
- package/docs/members.md +182 -182
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +482 -482
- package/docs/proof-comms-triggers.md +142 -142
- package/docs/proof-ownership-transfer.md +155 -155
- package/docs/proof-product-data-scoping.md +462 -462
- package/docs/proof-share-grants.md +305 -305
- package/docs/realtime.md +138 -138
- package/docs/standard-query.md +187 -187
- package/docs/tag-codes.md +97 -97
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +320 -306
- package/package.json +87 -87
- package/scripts/headless-check.mjs +87 -87
- package/scripts/lib/bare-imports.mjs +57 -57
- package/scripts/lib/keyed-app-data.mjs +21 -21
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
|
@@ -1,133 +1,133 @@
|
|
|
1
|
-
# SmartLinks CSS baseline (`sl-baseline`)
|
|
2
|
-
|
|
3
|
-
> **Status: SHIPPED — `v1`, frozen.** The SDK ships `@proveanything/smartlinks/baseline.css`
|
|
4
|
-
> (+ `baseline.classes.json`); the Portal/Hub serve it and apps opt in via
|
|
5
|
-
> `meta.cssBaseline: "v1"`. `v1` is frozen: an existing `sl-*` rule's meaning never changes;
|
|
6
|
-
> new capability ships as `v2` alongside. Supersedes the earlier "shared Tailwind base" idea —
|
|
7
|
-
> that approach (sharing raw generated Tailwind) was too large and could never safely change;
|
|
8
|
-
> this is the version that survives being frozen for years.
|
|
9
|
-
|
|
10
|
-
A small, **frozen, namespaced** set of structural CSS helpers the platform guarantees are
|
|
11
|
-
present, so any sub-app — and any AI/markdown/dynamic content renderer inside one — can rely
|
|
12
|
-
on them. It is **mechanics, not aesthetics**: layout, spacing, sizing, type scale,
|
|
13
|
-
responsive flow, radius/border/shadow, and a little motion. It never defines colours, fonts,
|
|
14
|
-
or components — those are brand data and per-app.
|
|
15
|
-
|
|
16
|
-
It is the CSS sibling of the JS shared-dependency contract, and like that contract **the SDK
|
|
17
|
-
is the source of truth**: the SDK authors and ships the baseline; hosts and apps consume it.
|
|
18
|
-
|
|
19
|
-
## Why this shape (and not the alternatives)
|
|
20
|
-
|
|
21
|
-
- **Small + frozen** → maintainable for years. A 60–120-rule hand-authored contract can be
|
|
22
|
-
honoured indefinitely; a giant generated Tailwind sheet can't.
|
|
23
|
-
- **Namespaced (`sl-`)** → zero collision with an app's own Tailwind (`flex`, `p-4`) or the
|
|
24
|
-
host. Apps use `sl-*` for the guaranteed floor *and* their own utilities side by side. This
|
|
25
|
-
is what removes the cascade/coexistence fragility.
|
|
26
|
-
- **A stable contract, decoupled from Tailwind underneath** → the SDK may build it with
|
|
27
|
-
Tailwind 4/5/6 internally, but apps target `sl-*`, so Tailwind upgrades are free.
|
|
28
|
-
- **Teachable** → ~100 stable primitives can be put in an AI prompt; the full Tailwind
|
|
29
|
-
surface cannot. Dynamic/AI content gets a guaranteed floor instead of hand-rolling CSS.
|
|
30
|
-
- **A floor, not a ceiling** → opt-in, additive; apps are free to ignore it or write their
|
|
31
|
-
own CSS. It just guarantees a consistent structural baseline when they want it.
|
|
32
|
-
|
|
33
|
-
## Responsive: container-query-backed, breakpoint-named
|
|
34
|
-
|
|
35
|
-
Apps render **both** as containers (in the host document) and as iframes. Plain viewport
|
|
36
|
-
`@media` is inconsistent across those — in an iframe it sees the iframe size (usually right),
|
|
37
|
-
in a container it sees the *host* viewport (wrong for a sub-region). So the responsive
|
|
38
|
-
primitives are **container-query based** (`@container`), exposed with familiar breakpoint
|
|
39
|
-
names so authors/AI still think "phone / tablet / desktop":
|
|
40
|
-
|
|
41
|
-
- The app's mount root is a **container context** (`sl-container`, i.e. `container-type:
|
|
42
|
-
inline-size`) — set by the host on container mounts and by the app root in iframe mode.
|
|
43
|
-
- `sl-md-grid-2` then means "when **my** box is ≥ tablet width", correct in both embed modes.
|
|
44
|
-
- Breakpoints (container widths): `sm` ≥ 480px, `md` ≥ 768px, `lg` ≥ 1024px.
|
|
45
|
-
|
|
46
|
-
This is the "works well on mobile / tablet / desktop" house opinion, done correctly for an
|
|
47
|
-
embed-first platform.
|
|
48
|
-
|
|
49
|
-
## The v1 surface (frozen)
|
|
50
|
-
|
|
51
|
-
All names `sl-`-prefixed. Responsive variants exist only for the layout-flow primitives
|
|
52
|
-
marked ✦ (as `sl-{sm|md|lg}-<name>`), to keep the set teachable and small.
|
|
53
|
-
|
|
54
|
-
**Reset & a11y**
|
|
55
|
-
`sl-reset` (border-box + margin:0 on self/descendants) · `sl-media` (max-width:100%,
|
|
56
|
-
height:auto) · `sl-focus` (keyboard-only focus ring) · `sl-sr-only` · `sl-container`
|
|
57
|
-
(responsive container context)
|
|
58
|
-
|
|
59
|
-
**Display ✦** `sl-block` · `sl-inline-block` · `sl-inline` · `sl-flex` · `sl-inline-flex` ·
|
|
60
|
-
`sl-grid` · `sl-hidden`
|
|
61
|
-
|
|
62
|
-
**Flex ✦(direction)** `sl-flex-row` · `sl-flex-col` · `sl-flex-wrap` · `sl-flex-nowrap` ·
|
|
63
|
-
`sl-items-{start,center,end,stretch,baseline}` · `sl-justify-{start,center,end,between,around}`
|
|
64
|
-
· `sl-flex-1` · `sl-flex-auto` · `sl-grow-0` · `sl-shrink-0`
|
|
65
|
-
|
|
66
|
-
**Grid ✦(columns)** `sl-grid-{2,3,4}` (collapse to 1 col below `sm`) · `sl-grid-auto`
|
|
67
|
-
(auto-fit minmax) · `sl-col-span-full`
|
|
68
|
-
|
|
69
|
-
**Spacing** — curated 8-step scale `0,1,2,3,4,5,6,7` ≈ `0, .25, .5, .75, 1, 1.5, 2, 3 rem`.
|
|
70
|
-
Logical properties (RTL-safe): `sl-gap-{0..7}` · `sl-p-{0..7}` · `sl-px-{0..7}` ·
|
|
71
|
-
`sl-py-{0..7}` · `sl-ps-{0..7}` / `sl-pe-{0..7}` (inline start/end) · `sl-m-{0..7}` ·
|
|
72
|
-
`sl-mx-auto` · `sl-mt-{0..7}` · `sl-mb-{0..7}`
|
|
73
|
-
|
|
74
|
-
**Sizing** `sl-w-full` · `sl-h-full` · `sl-min-w-0` · `sl-max-w-{reading(42rem),prose(65ch),
|
|
75
|
-
page(72rem)}` · `sl-aspect-{square,wide(16/9)}`
|
|
76
|
-
|
|
77
|
-
**Typography** — static rem scale (predictable in any embed; use the responsive `✦` align
|
|
78
|
-
and per-breakpoint sizing where you want type to change). `sl-text-{xs,sm,base,lg,xl,2xl,3xl,
|
|
79
|
-
4xl}` · `sl-font-{normal,medium,semibold,bold}` · `sl-leading-{tight,normal,relaxed}` ·
|
|
80
|
-
`sl-tracking-{tight,normal}` · `sl-text-{left,center,right}` ✦(align) · `sl-truncate` ·
|
|
81
|
-
`sl-line-clamp-{2,3}` · `sl-balance` (text-wrap:balance) · `sl-pretty`
|
|
82
|
-
|
|
83
|
-
**Radius / border / shadow** — neutral mechanics only (no brand colour). `sl-rounded-{sm,md,
|
|
84
|
-
lg,xl,full}` · `sl-border` / `sl-border-0` (colour = `--sl-border`, a subtle
|
|
85
|
-
`color-mix(currentColor 14%, transparent)` default, overridable) · `sl-shadow-{sm,md,lg}`
|
|
86
|
-
(neutral)
|
|
87
|
-
|
|
88
|
-
**Object-fit / overflow** `sl-cover` · `sl-contain` · `sl-overflow-hidden` · `sl-overflow-auto`
|
|
89
|
-
|
|
90
|
-
**Position & layering** `sl-relative` · `sl-absolute` · `sl-sticky` · `sl-inset-0` ·
|
|
91
|
-
`sl-z-{base,raised,overlay}` (named levels — a house layering convention so apps don't fight
|
|
92
|
-
over z-index)
|
|
93
|
-
|
|
94
|
-
**Motion** (small, reduced-motion-safe; keyframes are `sl-`-namespaced) `sl-transition`
|
|
95
|
-
(standard ease/duration) · `sl-reveal` (fade-up on view) · `sl-hover-lift` · all motion is
|
|
96
|
-
**disabled under `prefers-reduced-motion`**. Rich motion vocabularies stay per-app (and may
|
|
97
|
-
become a separate versioned motion contract later if several apps want to share one).
|
|
98
|
-
|
|
99
|
-
### Explicitly NOT in the baseline (non-goals)
|
|
100
|
-
- **No colours** — brand data, delivered via CSS variables / theme params.
|
|
101
|
-
- **No fonts** — per-app; the baseline sets a *scale*, never a family.
|
|
102
|
-
- **No components** — no buttons/cards/nav; those are per-app aesthetics.
|
|
103
|
-
- **No full utility surface** — anything bespoke ships in the app's own scoped CSS.
|
|
104
|
-
|
|
105
|
-
## Delivery — one SDK source, two paths
|
|
106
|
-
|
|
107
|
-
The SDK ships the compiled baseline as `@proveanything/smartlinks/baseline.css` (+ the
|
|
108
|
-
machine-readable class list for the doctor). One authored source; two delivery mechanisms:
|
|
109
|
-
|
|
110
|
-
| Embed mode | How the app gets it |
|
|
111
|
-
|---|---|
|
|
112
|
-
| **Container (ESM/UMD)** — same document as host | Host has already loaded `baseline.css`; the app **ships nothing** and just uses `sl-*`. Declares `meta.cssBaseline: "v1"`. |
|
|
113
|
-
| **Iframe** — its own document | The app **imports the SDK's `baseline.css`** into its own document (it inherits nothing, exactly like it must carry its own modules). Byte-identical to the host copy. |
|
|
114
|
-
|
|
115
|
-
Cascade: baseline loads first; app CSS after → app rules win ties. `sl-*` never collides with
|
|
116
|
-
app utilities regardless.
|
|
117
|
-
|
|
118
|
-
## SDK / build support (kept minimal — no CSS surgery)
|
|
119
|
-
- The SDK **exports `baseline.css`** (and `baseline.classes.json`), built in the SDK's own
|
|
120
|
-
build so the file and the class list can't drift.
|
|
121
|
-
- Manifest field **`meta.cssBaseline: "v1"`** — declares reliance so the host can guarantee
|
|
122
|
-
it's present.
|
|
123
|
-
- `smartlinks-doctor`: warn if an app declares `cssBaseline` but uses an `sl-*` class outside
|
|
124
|
-
the declared version (the useful invariant — spirit of the JS import check). No subtraction
|
|
125
|
-
tooling needed: `sl-*` is a fixed vocabulary apps just use.
|
|
126
|
-
|
|
127
|
-
## Versioning & freeze
|
|
128
|
-
- `v1` is **frozen**: an existing `sl-*` class's meaning/output never changes in place.
|
|
129
|
-
- New capability ships as `v2` **alongside** `v1` (both served), never a silent mutation.
|
|
130
|
-
- Tailwind (or whatever builds it) may be upgraded underneath as long as the `sl-*` contract
|
|
131
|
-
keeps its meaning.
|
|
132
|
-
- Governance: additions to the surface go through review (it's a decades-long contract);
|
|
133
|
-
err toward *stable and generous* over minimal, since the AI builders target it.
|
|
1
|
+
# SmartLinks CSS baseline (`sl-baseline`)
|
|
2
|
+
|
|
3
|
+
> **Status: SHIPPED — `v1`, frozen.** The SDK ships `@proveanything/smartlinks/baseline.css`
|
|
4
|
+
> (+ `baseline.classes.json`); the Portal/Hub serve it and apps opt in via
|
|
5
|
+
> `meta.cssBaseline: "v1"`. `v1` is frozen: an existing `sl-*` rule's meaning never changes;
|
|
6
|
+
> new capability ships as `v2` alongside. Supersedes the earlier "shared Tailwind base" idea —
|
|
7
|
+
> that approach (sharing raw generated Tailwind) was too large and could never safely change;
|
|
8
|
+
> this is the version that survives being frozen for years.
|
|
9
|
+
|
|
10
|
+
A small, **frozen, namespaced** set of structural CSS helpers the platform guarantees are
|
|
11
|
+
present, so any sub-app — and any AI/markdown/dynamic content renderer inside one — can rely
|
|
12
|
+
on them. It is **mechanics, not aesthetics**: layout, spacing, sizing, type scale,
|
|
13
|
+
responsive flow, radius/border/shadow, and a little motion. It never defines colours, fonts,
|
|
14
|
+
or components — those are brand data and per-app.
|
|
15
|
+
|
|
16
|
+
It is the CSS sibling of the JS shared-dependency contract, and like that contract **the SDK
|
|
17
|
+
is the source of truth**: the SDK authors and ships the baseline; hosts and apps consume it.
|
|
18
|
+
|
|
19
|
+
## Why this shape (and not the alternatives)
|
|
20
|
+
|
|
21
|
+
- **Small + frozen** → maintainable for years. A 60–120-rule hand-authored contract can be
|
|
22
|
+
honoured indefinitely; a giant generated Tailwind sheet can't.
|
|
23
|
+
- **Namespaced (`sl-`)** → zero collision with an app's own Tailwind (`flex`, `p-4`) or the
|
|
24
|
+
host. Apps use `sl-*` for the guaranteed floor *and* their own utilities side by side. This
|
|
25
|
+
is what removes the cascade/coexistence fragility.
|
|
26
|
+
- **A stable contract, decoupled from Tailwind underneath** → the SDK may build it with
|
|
27
|
+
Tailwind 4/5/6 internally, but apps target `sl-*`, so Tailwind upgrades are free.
|
|
28
|
+
- **Teachable** → ~100 stable primitives can be put in an AI prompt; the full Tailwind
|
|
29
|
+
surface cannot. Dynamic/AI content gets a guaranteed floor instead of hand-rolling CSS.
|
|
30
|
+
- **A floor, not a ceiling** → opt-in, additive; apps are free to ignore it or write their
|
|
31
|
+
own CSS. It just guarantees a consistent structural baseline when they want it.
|
|
32
|
+
|
|
33
|
+
## Responsive: container-query-backed, breakpoint-named
|
|
34
|
+
|
|
35
|
+
Apps render **both** as containers (in the host document) and as iframes. Plain viewport
|
|
36
|
+
`@media` is inconsistent across those — in an iframe it sees the iframe size (usually right),
|
|
37
|
+
in a container it sees the *host* viewport (wrong for a sub-region). So the responsive
|
|
38
|
+
primitives are **container-query based** (`@container`), exposed with familiar breakpoint
|
|
39
|
+
names so authors/AI still think "phone / tablet / desktop":
|
|
40
|
+
|
|
41
|
+
- The app's mount root is a **container context** (`sl-container`, i.e. `container-type:
|
|
42
|
+
inline-size`) — set by the host on container mounts and by the app root in iframe mode.
|
|
43
|
+
- `sl-md-grid-2` then means "when **my** box is ≥ tablet width", correct in both embed modes.
|
|
44
|
+
- Breakpoints (container widths): `sm` ≥ 480px, `md` ≥ 768px, `lg` ≥ 1024px.
|
|
45
|
+
|
|
46
|
+
This is the "works well on mobile / tablet / desktop" house opinion, done correctly for an
|
|
47
|
+
embed-first platform.
|
|
48
|
+
|
|
49
|
+
## The v1 surface (frozen)
|
|
50
|
+
|
|
51
|
+
All names `sl-`-prefixed. Responsive variants exist only for the layout-flow primitives
|
|
52
|
+
marked ✦ (as `sl-{sm|md|lg}-<name>`), to keep the set teachable and small.
|
|
53
|
+
|
|
54
|
+
**Reset & a11y**
|
|
55
|
+
`sl-reset` (border-box + margin:0 on self/descendants) · `sl-media` (max-width:100%,
|
|
56
|
+
height:auto) · `sl-focus` (keyboard-only focus ring) · `sl-sr-only` · `sl-container`
|
|
57
|
+
(responsive container context)
|
|
58
|
+
|
|
59
|
+
**Display ✦** `sl-block` · `sl-inline-block` · `sl-inline` · `sl-flex` · `sl-inline-flex` ·
|
|
60
|
+
`sl-grid` · `sl-hidden`
|
|
61
|
+
|
|
62
|
+
**Flex ✦(direction)** `sl-flex-row` · `sl-flex-col` · `sl-flex-wrap` · `sl-flex-nowrap` ·
|
|
63
|
+
`sl-items-{start,center,end,stretch,baseline}` · `sl-justify-{start,center,end,between,around}`
|
|
64
|
+
· `sl-flex-1` · `sl-flex-auto` · `sl-grow-0` · `sl-shrink-0`
|
|
65
|
+
|
|
66
|
+
**Grid ✦(columns)** `sl-grid-{2,3,4}` (collapse to 1 col below `sm`) · `sl-grid-auto`
|
|
67
|
+
(auto-fit minmax) · `sl-col-span-full`
|
|
68
|
+
|
|
69
|
+
**Spacing** — curated 8-step scale `0,1,2,3,4,5,6,7` ≈ `0, .25, .5, .75, 1, 1.5, 2, 3 rem`.
|
|
70
|
+
Logical properties (RTL-safe): `sl-gap-{0..7}` · `sl-p-{0..7}` · `sl-px-{0..7}` ·
|
|
71
|
+
`sl-py-{0..7}` · `sl-ps-{0..7}` / `sl-pe-{0..7}` (inline start/end) · `sl-m-{0..7}` ·
|
|
72
|
+
`sl-mx-auto` · `sl-mt-{0..7}` · `sl-mb-{0..7}`
|
|
73
|
+
|
|
74
|
+
**Sizing** `sl-w-full` · `sl-h-full` · `sl-min-w-0` · `sl-max-w-{reading(42rem),prose(65ch),
|
|
75
|
+
page(72rem)}` · `sl-aspect-{square,wide(16/9)}`
|
|
76
|
+
|
|
77
|
+
**Typography** — static rem scale (predictable in any embed; use the responsive `✦` align
|
|
78
|
+
and per-breakpoint sizing where you want type to change). `sl-text-{xs,sm,base,lg,xl,2xl,3xl,
|
|
79
|
+
4xl}` · `sl-font-{normal,medium,semibold,bold}` · `sl-leading-{tight,normal,relaxed}` ·
|
|
80
|
+
`sl-tracking-{tight,normal}` · `sl-text-{left,center,right}` ✦(align) · `sl-truncate` ·
|
|
81
|
+
`sl-line-clamp-{2,3}` · `sl-balance` (text-wrap:balance) · `sl-pretty`
|
|
82
|
+
|
|
83
|
+
**Radius / border / shadow** — neutral mechanics only (no brand colour). `sl-rounded-{sm,md,
|
|
84
|
+
lg,xl,full}` · `sl-border` / `sl-border-0` (colour = `--sl-border`, a subtle
|
|
85
|
+
`color-mix(currentColor 14%, transparent)` default, overridable) · `sl-shadow-{sm,md,lg}`
|
|
86
|
+
(neutral)
|
|
87
|
+
|
|
88
|
+
**Object-fit / overflow** `sl-cover` · `sl-contain` · `sl-overflow-hidden` · `sl-overflow-auto`
|
|
89
|
+
|
|
90
|
+
**Position & layering** `sl-relative` · `sl-absolute` · `sl-sticky` · `sl-inset-0` ·
|
|
91
|
+
`sl-z-{base,raised,overlay}` (named levels — a house layering convention so apps don't fight
|
|
92
|
+
over z-index)
|
|
93
|
+
|
|
94
|
+
**Motion** (small, reduced-motion-safe; keyframes are `sl-`-namespaced) `sl-transition`
|
|
95
|
+
(standard ease/duration) · `sl-reveal` (fade-up on view) · `sl-hover-lift` · all motion is
|
|
96
|
+
**disabled under `prefers-reduced-motion`**. Rich motion vocabularies stay per-app (and may
|
|
97
|
+
become a separate versioned motion contract later if several apps want to share one).
|
|
98
|
+
|
|
99
|
+
### Explicitly NOT in the baseline (non-goals)
|
|
100
|
+
- **No colours** — brand data, delivered via CSS variables / theme params.
|
|
101
|
+
- **No fonts** — per-app; the baseline sets a *scale*, never a family.
|
|
102
|
+
- **No components** — no buttons/cards/nav; those are per-app aesthetics.
|
|
103
|
+
- **No full utility surface** — anything bespoke ships in the app's own scoped CSS.
|
|
104
|
+
|
|
105
|
+
## Delivery — one SDK source, two paths
|
|
106
|
+
|
|
107
|
+
The SDK ships the compiled baseline as `@proveanything/smartlinks/baseline.css` (+ the
|
|
108
|
+
machine-readable class list for the doctor). One authored source; two delivery mechanisms:
|
|
109
|
+
|
|
110
|
+
| Embed mode | How the app gets it |
|
|
111
|
+
|---|---|
|
|
112
|
+
| **Container (ESM/UMD)** — same document as host | Host has already loaded `baseline.css`; the app **ships nothing** and just uses `sl-*`. Declares `meta.cssBaseline: "v1"`. |
|
|
113
|
+
| **Iframe** — its own document | The app **imports the SDK's `baseline.css`** into its own document (it inherits nothing, exactly like it must carry its own modules). Byte-identical to the host copy. |
|
|
114
|
+
|
|
115
|
+
Cascade: baseline loads first; app CSS after → app rules win ties. `sl-*` never collides with
|
|
116
|
+
app utilities regardless.
|
|
117
|
+
|
|
118
|
+
## SDK / build support (kept minimal — no CSS surgery)
|
|
119
|
+
- The SDK **exports `baseline.css`** (and `baseline.classes.json`), built in the SDK's own
|
|
120
|
+
build so the file and the class list can't drift.
|
|
121
|
+
- Manifest field **`meta.cssBaseline: "v1"`** — declares reliance so the host can guarantee
|
|
122
|
+
it's present.
|
|
123
|
+
- `smartlinks-doctor`: warn if an app declares `cssBaseline` but uses an `sl-*` class outside
|
|
124
|
+
the declared version (the useful invariant — spirit of the JS import check). No subtraction
|
|
125
|
+
tooling needed: `sl-*` is a fixed vocabulary apps just use.
|
|
126
|
+
|
|
127
|
+
## Versioning & freeze
|
|
128
|
+
- `v1` is **frozen**: an existing `sl-*` class's meaning/output never changes in place.
|
|
129
|
+
- New capability ships as `v2` **alongside** `v1` (both served), never a silent mutation.
|
|
130
|
+
- Tailwind (or whatever builds it) may be upgraded underneath as long as the `sl-*` contract
|
|
131
|
+
keeps its meaning.
|
|
132
|
+
- Governance: additions to the surface go through review (it's a decades-long contract);
|
|
133
|
+
err toward *stable and generous* over minimal, since the AI builders target it.
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
# The customer guide
|
|
2
|
-
|
|
3
|
-
A business's assistant for its visitors, in Portal and the Hub, by voice or by text. It knows the business
|
|
4
|
-
(a brief written for visitors), where the visitor is (the product, the item scanned, the app on screen) and
|
|
5
|
-
what that screen says, and it can open another app for them. The business switches it on and shapes it in
|
|
6
|
-
Studio (Configure → Guide). Design: prove `server/docs/design/customer-assistant.md`.
|
|
7
|
-
|
|
8
|
-
Everything that shapes the guide — its instructions, voice, tools and limits — is fixed by SmartLinks when a
|
|
9
|
-
conversation starts. A page only says where the visitor is and what is on their screen.
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
## For a host (Portal, the Hub, a custom site)
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
import * as SL from '@proveanything/smartlinks'
|
|
17
|
-
|
|
18
|
-
const info = await SL.ai.guide.get(collectionId, 'portal') // { enabled, name, modes, suggestions, handoff }
|
|
19
|
-
if (!info.enabled) return
|
|
20
|
-
|
|
21
|
-
const chat = await SL.ai.guide.start(collectionId, {
|
|
22
|
-
surface: 'portal', // or 'hub'
|
|
23
|
-
mode: info.modes.start, // 'voice' or 'text'
|
|
24
|
-
productId, proofId,
|
|
25
|
-
apps: [{ id: 'recipes', title: 'Recipes' }], // the apps on the visitor's page: their pages come from the deep-link registry
|
|
26
|
-
where: { appId: 'recipes', path: '/method' }, // where the visitor is now
|
|
27
|
-
screen: await SL.ai.content.request({ frame: appIframe.contentWindow }),
|
|
28
|
-
showApp: (appId) => openApp(appId),
|
|
29
|
-
openPage: ({ appId, path, params }) => openApp(appId, path, params), // a page the guide chose (look_in → open_page)
|
|
30
|
-
goTo: (productId) => openProduct(productId), // another product it found (find → go_to)
|
|
31
|
-
onShow: (card) => showFound(card), // what find found, rows with goTo
|
|
32
|
-
offerPerson: (handoff) => showContact(handoff),
|
|
33
|
-
onState: setState, // idle | connecting | listening | hearing | thinking | speaking | paused | error
|
|
34
|
-
onCaption: setCaption, // what it is saying or writing, as it goes
|
|
35
|
-
onError: setError,
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
chat.pause(); chat.resume(); chat.stop()
|
|
39
|
-
chat.send('What is it made of?') // text mode (works in voice mode too)
|
|
40
|
-
chat.note('The visitor is now on Dishwasher DW-60 (product id p9), in Manual at /troubleshooting.') // where they are; it doesn't answer
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
The guide knows the pages around the visitor from SmartLinks' deep-link registry (`linkable` in each app's
|
|
44
|
-
manifest, and each app's config `linkable` per collection and per product; see deep-link-discovery.md).
|
|
45
|
-
Register your pages there and the guide can open them by name.
|
|
46
|
-
|
|
47
|
-
- Voice needs the microphone; ask for it on a tap (browsers require it).
|
|
48
|
-
- A signed-in visitor (Auth Kit bearer on the SDK) owns their conversation; otherwise it is anonymous.
|
|
49
|
-
- The guide's `read_screen` tool asks the app on screen what it shows (below). Pass `readScreen` to answer
|
|
50
|
-
it yourself.
|
|
51
|
-
- Limits per visitor and per business are set in Studio; a refusal comes back as `GUIDE_LIMIT` (429).
|
|
52
|
-
|
|
53
|
-
## For an app: say what your screen shows
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
useEffect(() => SL.ai.content.provide(() => ({
|
|
57
|
-
appId: 'pages',
|
|
58
|
-
title: page.title,
|
|
59
|
-
content: page.text, // plain words: the exhibit, the recipe, what this form is for
|
|
60
|
-
})), [page])
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
`provide` works the same in an iframe (the host asks by message) and as a direct component. Return what a
|
|
64
|
-
person reading the screen would take in, not markup. Without it, a host may fall back to the page's text.
|
|
65
|
-
|
|
66
|
-
## Your own live conversation
|
|
67
|
-
|
|
68
|
-
`SL.ai.live.start({ endpoints: { mint, tool, event }, mode, screenTools, … })` is the client the guide and the
|
|
69
|
-
Studio assistant use: WebRTC straight to the realtime service with a key your server minted, tools split
|
|
70
|
-
between the page (`screenTools`) and your server (`endpoints.tool`). See `src/live.ts`.
|
|
1
|
+
# The customer guide
|
|
2
|
+
|
|
3
|
+
A business's assistant for its visitors, in Portal and the Hub, by voice or by text. It knows the business
|
|
4
|
+
(a brief written for visitors), where the visitor is (the product, the item scanned, the app on screen) and
|
|
5
|
+
what that screen says, and it can open another app for them. The business switches it on and shapes it in
|
|
6
|
+
Studio (Configure → Guide). Design: prove `server/docs/design/customer-assistant.md`.
|
|
7
|
+
|
|
8
|
+
Everything that shapes the guide — its instructions, voice, tools and limits — is fixed by SmartLinks when a
|
|
9
|
+
conversation starts. A page only says where the visitor is and what is on their screen.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## For a host (Portal, the Hub, a custom site)
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import * as SL from '@proveanything/smartlinks'
|
|
17
|
+
|
|
18
|
+
const info = await SL.ai.guide.get(collectionId, 'portal') // { enabled, name, modes, suggestions, handoff }
|
|
19
|
+
if (!info.enabled) return
|
|
20
|
+
|
|
21
|
+
const chat = await SL.ai.guide.start(collectionId, {
|
|
22
|
+
surface: 'portal', // or 'hub'
|
|
23
|
+
mode: info.modes.start, // 'voice' or 'text'
|
|
24
|
+
productId, proofId,
|
|
25
|
+
apps: [{ id: 'recipes', title: 'Recipes' }], // the apps on the visitor's page: their pages come from the deep-link registry
|
|
26
|
+
where: { appId: 'recipes', path: '/method' }, // where the visitor is now
|
|
27
|
+
screen: await SL.ai.content.request({ frame: appIframe.contentWindow }),
|
|
28
|
+
showApp: (appId) => openApp(appId),
|
|
29
|
+
openPage: ({ appId, path, params }) => openApp(appId, path, params), // a page the guide chose (look_in → open_page)
|
|
30
|
+
goTo: (productId) => openProduct(productId), // another product it found (find → go_to)
|
|
31
|
+
onShow: (card) => showFound(card), // what find found, rows with goTo
|
|
32
|
+
offerPerson: (handoff) => showContact(handoff),
|
|
33
|
+
onState: setState, // idle | connecting | listening | hearing | thinking | speaking | paused | error
|
|
34
|
+
onCaption: setCaption, // what it is saying or writing, as it goes
|
|
35
|
+
onError: setError,
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
chat.pause(); chat.resume(); chat.stop()
|
|
39
|
+
chat.send('What is it made of?') // text mode (works in voice mode too)
|
|
40
|
+
chat.note('The visitor is now on Dishwasher DW-60 (product id p9), in Manual at /troubleshooting.') // where they are; it doesn't answer
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
The guide knows the pages around the visitor from SmartLinks' deep-link registry (`linkable` in each app's
|
|
44
|
+
manifest, and each app's config `linkable` per collection and per product; see deep-link-discovery.md).
|
|
45
|
+
Register your pages there and the guide can open them by name.
|
|
46
|
+
|
|
47
|
+
- Voice needs the microphone; ask for it on a tap (browsers require it).
|
|
48
|
+
- A signed-in visitor (Auth Kit bearer on the SDK) owns their conversation; otherwise it is anonymous.
|
|
49
|
+
- The guide's `read_screen` tool asks the app on screen what it shows (below). Pass `readScreen` to answer
|
|
50
|
+
it yourself.
|
|
51
|
+
- Limits per visitor and per business are set in Studio; a refusal comes back as `GUIDE_LIMIT` (429).
|
|
52
|
+
|
|
53
|
+
## For an app: say what your screen shows
|
|
54
|
+
|
|
55
|
+
```ts
|
|
56
|
+
useEffect(() => SL.ai.content.provide(() => ({
|
|
57
|
+
appId: 'pages',
|
|
58
|
+
title: page.title,
|
|
59
|
+
content: page.text, // plain words: the exhibit, the recipe, what this form is for
|
|
60
|
+
})), [page])
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`provide` works the same in an iframe (the host asks by message) and as a direct component. Return what a
|
|
64
|
+
person reading the screen would take in, not markup. Without it, a host may fall back to the page's text.
|
|
65
|
+
|
|
66
|
+
## Your own live conversation
|
|
67
|
+
|
|
68
|
+
`SL.ai.live.start({ endpoints: { mint, tool, event }, mode, screenTools, … })` is the client the guide and the
|
|
69
|
+
Studio assistant use: WebRTC straight to the realtime service with a key your server minted, tools split
|
|
70
|
+
between the page (`screenTools`) and your server (`endpoints.tool`). See `src/live.ts`.
|