@proveanything/smartlinks 3.0.0-alpha.2 → 3.0.0-alpha.3
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 +741 -741
- package/dist/README.md +573 -573
- package/dist/adminCardsView.js +55 -55
- package/dist/api/bookings.d.ts +49 -2
- package/dist/api/bookings.js +59 -2
- package/dist/api/index.d.ts +1 -0
- package/dist/api/index.js +1 -0
- package/dist/api/payments.d.ts +60 -0
- package/dist/api/payments.js +94 -0
- package/dist/api/realtime.d.ts +3 -0
- package/dist/api/realtime.js +10 -2
- package/dist/baseline.css +194 -194
- package/dist/dataChanged.d.ts +74 -0
- package/dist/dataChanged.js +162 -0
- package/dist/docs/API_SUMMARY.md +1086 -858
- package/dist/docs/admin-cards.md +189 -189
- package/dist/docs/agent-tools.md +156 -156
- package/dist/docs/ai-tools-and-skills.md +180 -180
- package/dist/docs/ai.md +1721 -1721
- package/dist/docs/api-versions.md +85 -85
- 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 +105 -8
- package/dist/docs/caching.md +32 -3
- package/dist/docs/comms.md +689 -689
- 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/data-changed.md +91 -0
- package/dist/docs/deploying-apps.md +340 -340
- package/dist/docs/dpp.md +115 -115
- package/dist/docs/entitlements.md +90 -90
- package/dist/docs/files.md +69 -69
- package/dist/docs/host-dependency-contract.md +252 -252
- package/dist/docs/iframe-responder.md +11 -0
- package/dist/docs/integrations.md +322 -322
- package/dist/docs/interactions.md +544 -544
- package/dist/docs/item-context.md +181 -181
- package/dist/docs/knowledge.md +105 -105
- package/dist/docs/lists.md +157 -157
- package/dist/docs/lots.md +112 -112
- package/dist/docs/loyalty.md +348 -348
- package/dist/docs/members.md +183 -183
- package/dist/docs/memberships.md +150 -150
- package/dist/docs/mobile-admin-container.md +693 -693
- package/dist/docs/operations.md +281 -281
- package/dist/docs/overview.md +487 -485
- package/dist/docs/payments.md +94 -0
- 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 +149 -139
- package/dist/docs/records-admin-pattern.md +304 -304
- package/dist/docs/service-accounts.md +64 -64
- package/dist/docs/standard-query.md +196 -187
- package/dist/docs/tag-codes.md +97 -97
- package/dist/docs/tag-ranges.md +106 -106
- package/dist/docs/theme-tokens.md +252 -252
- package/dist/docs/upgrading-to-3.md +550 -532
- package/dist/docs/wallet-passes.md +107 -107
- package/dist/docs/websites.md +123 -123
- package/dist/http.d.ts +6 -3
- package/dist/http.js +48 -19
- package/dist/iframeResponder.d.ts +7 -0
- package/dist/iframeResponder.js +10 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/openapi.yaml +426 -3
- package/dist/testing/bookingsMemory.d.ts +29 -1
- package/dist/testing/bookingsMemory.js +89 -1
- package/dist/testing/index.js +4 -1
- package/dist/theme-boot.js +82 -82
- package/dist/theme.css +75 -75
- package/dist/types/appManifest.d.ts +26 -4
- package/dist/types/bookings.d.ts +99 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/payments.d.ts +101 -0
- package/dist/types/payments.js +5 -0
- package/dist/types/realtime.d.ts +5 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +1086 -858
- package/docs/admin-cards.md +189 -189
- package/docs/agent-tools.md +156 -156
- package/docs/ai-tools-and-skills.md +180 -180
- package/docs/ai.md +1721 -1721
- package/docs/api-versions.md +85 -85
- 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 +105 -8
- package/docs/caching.md +32 -3
- package/docs/comms.md +689 -689
- package/docs/connectors.md +340 -340
- package/docs/css-baseline.md +133 -133
- package/docs/customer-guide.md +70 -70
- package/docs/data-changed.md +91 -0
- package/docs/deploying-apps.md +340 -340
- package/docs/dpp.md +115 -115
- package/docs/entitlements.md +90 -90
- package/docs/files.md +69 -69
- package/docs/host-dependency-contract.md +252 -252
- package/docs/iframe-responder.md +11 -0
- package/docs/integrations.md +322 -322
- package/docs/interactions.md +544 -544
- package/docs/item-context.md +181 -181
- package/docs/knowledge.md +105 -105
- package/docs/lists.md +157 -157
- package/docs/lots.md +112 -112
- package/docs/loyalty.md +348 -348
- package/docs/members.md +183 -183
- package/docs/memberships.md +150 -150
- package/docs/mobile-admin-container.md +693 -693
- package/docs/operations.md +281 -281
- package/docs/overview.md +487 -485
- package/docs/payments.md +94 -0
- 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 +149 -139
- package/docs/service-accounts.md +64 -64
- package/docs/standard-query.md +196 -187
- package/docs/tag-codes.md +97 -97
- package/docs/tag-ranges.md +106 -106
- package/docs/theme-lookbook.v1.json +120 -120
- package/docs/theme-tokens.md +252 -252
- package/docs/upgrading-to-3.md +550 -532
- package/docs/wallet-passes.md +107 -107
- package/docs/websites.md +123 -123
- package/openapi.yaml +426 -3
- package/package.json +91 -91
- 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/lib/upgrade.mjs +708 -668
- package/scripts/publish.mjs +272 -272
- package/scripts/register-release.mjs +91 -91
- package/scripts/upgrade.mjs +79 -79
- package/upgrade/3.json +2 -2
|
@@ -1,852 +1,852 @@
|
|
|
1
|
-
# App Configuration Files: `app.manifest.json` & `app.admin.json`
|
|
2
|
-
|
|
3
|
-
Every SmartLinks app ships with two JSON configuration files that the platform reads to understand what the app is and how to configure it. They have clearly separated responsibilities:
|
|
4
|
-
|
|
5
|
-
| File | Role | Loaded by |
|
|
6
|
-
|------|------|-----------|
|
|
7
|
-
| `app.manifest.json` | **Definitional** — what the app *is*: its bundles, components, static routes | Platform on every page load; portals; AI orchestrators |
|
|
8
|
-
| `app.admin.json` | **Operational** — how to *set up and tune* the app: setup questions, import schemas, tunable fields, metrics | Admin UI, AI-assisted setup flows |
|
|
9
|
-
|
|
10
|
-
The manifest always references the admin config via its `admin` field. Consumers that only need to *render* the app work entirely from the manifest. Only admin/setup flows need to fetch `app.admin.json`.
|
|
11
|
-
|
|
12
|
-
```text
|
|
13
|
-
┌─────────────────────────────────────────────────────────────────┐
|
|
14
|
-
│ Platform boot sequence │
|
|
15
|
-
│ │
|
|
16
|
-
│ 1. GET /collection/:id/widgets │
|
|
17
|
-
│ └─→ CollectionWidgetsResponse { apps: [...] } │
|
|
18
|
-
│ each app has: manifest, widget bundle, container │
|
|
19
|
-
│ │
|
|
20
|
-
│ 2. manifest.admin ──→ "app.admin.json" (pointer only) │
|
|
21
|
-
│ │
|
|
22
|
-
│ 3. Admin UI fetches app.admin.json when setup/config needed │
|
|
23
|
-
└─────────────────────────────────────────────────────────────────┘
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
## `app.manifest.json`
|
|
29
|
-
|
|
30
|
-
The manifest is loaded automatically by the platform for every collection page. Keep it lean — it is fetched on every widget render.
|
|
31
|
-
|
|
32
|
-
### Full Schema
|
|
33
|
-
|
|
34
|
-
```json
|
|
35
|
-
{
|
|
36
|
-
"$schema": "https://smartlinks.app/schemas/app-manifest-v1.json",
|
|
37
|
-
|
|
38
|
-
"meta": {
|
|
39
|
-
"appId": "my-app",
|
|
40
|
-
"name": "My App",
|
|
41
|
-
"description": "A short human-readable description of what this app does.",
|
|
42
|
-
"version": "1.2.0",
|
|
43
|
-
"platformRevision": "R5",
|
|
44
|
-
"moduleFormat": "dual",
|
|
45
|
-
"sharedDependencies": "v7"
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
"admin": "app.admin.json",
|
|
49
|
-
|
|
50
|
-
"widgets": {
|
|
51
|
-
"instanceResolution": true,
|
|
52
|
-
"instanceParam": "widgetId",
|
|
53
|
-
"files": {
|
|
54
|
-
"js": {
|
|
55
|
-
"umd": "dist/widgets.umd.js",
|
|
56
|
-
"esm": "dist/widgets.esm.js"
|
|
57
|
-
},
|
|
58
|
-
"css": "dist/widgets.css"
|
|
59
|
-
},
|
|
60
|
-
"components": [
|
|
61
|
-
{
|
|
62
|
-
"name": "SummaryWidget",
|
|
63
|
-
"description": "Compact summary card for use on product pages.",
|
|
64
|
-
"sizes": ["compact", "standard"],
|
|
65
|
-
"props": {
|
|
66
|
-
"required": ["collectionId", "appId"],
|
|
67
|
-
"optional": ["productId", "proofId"]
|
|
68
|
-
},
|
|
69
|
-
"settings": {
|
|
70
|
-
"showImage": { "type": "boolean", "default": true }
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
"containers": {
|
|
77
|
-
"files": {
|
|
78
|
-
"js": {
|
|
79
|
-
"umd": "dist/containers.umd.js",
|
|
80
|
-
"esm": "dist/containers.esm.js"
|
|
81
|
-
},
|
|
82
|
-
"css": "dist/containers.css"
|
|
83
|
-
},
|
|
84
|
-
"components": [
|
|
85
|
-
{
|
|
86
|
-
"name": "FullApp",
|
|
87
|
-
"description": "Full public app experience with internal routing.",
|
|
88
|
-
"props": {
|
|
89
|
-
"required": ["collectionId", "appId"],
|
|
90
|
-
"optional": ["productId", "proofId", "className"]
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
]
|
|
94
|
-
},
|
|
95
|
-
|
|
96
|
-
"mobileAdmin": {
|
|
97
|
-
"files": {
|
|
98
|
-
"js": {
|
|
99
|
-
"umd": "dist/mobile-admin.umd.js",
|
|
100
|
-
"esm": "dist/mobile-admin.esm.js"
|
|
101
|
-
},
|
|
102
|
-
"css": null
|
|
103
|
-
},
|
|
104
|
-
"components": [
|
|
105
|
-
{
|
|
106
|
-
"name": "WarehousePickContainer",
|
|
107
|
-
"description": "In-field operator admin surface.",
|
|
108
|
-
"capabilities": ["nfc", "qr"],
|
|
109
|
-
"offline": true
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
},
|
|
113
|
-
|
|
114
|
-
"linkable": [
|
|
115
|
-
{ "title": "Home", "path": "/" },
|
|
116
|
-
{ "title": "Gallery", "path": "/gallery" },
|
|
117
|
-
{ "title": "Settings", "path": "/settings", "params": { "tab": "advanced" } }
|
|
118
|
-
],
|
|
119
|
-
|
|
120
|
-
"records": {
|
|
121
|
-
"nutrition": {
|
|
122
|
-
"label": "Nutrition info",
|
|
123
|
-
"cardinality": "singleton",
|
|
124
|
-
"allowFacetRules": true,
|
|
125
|
-
"scopes": ["collection", "rule", "product", "facet", "batch"],
|
|
126
|
-
"defaultScope": "product"
|
|
127
|
-
},
|
|
128
|
-
"cooking_steps": {
|
|
129
|
-
"label": "Cooking steps",
|
|
130
|
-
"cardinality": "singleton",
|
|
131
|
-
"allowFacetRules": false,
|
|
132
|
-
"scopes": ["collection", "product"],
|
|
133
|
-
"defaultScope": "product"
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
### Field Reference
|
|
140
|
-
|
|
141
|
-
#### `meta`
|
|
142
|
-
|
|
143
|
-
| Field | Type | Required | Description |
|
|
144
|
-
|-------|------|----------|-------------|
|
|
145
|
-
| `appId` | string | ✅ | Unique identifier for the app (slug-style, e.g. `"warranty-tracker"`) |
|
|
146
|
-
| `name` | string | ✅ | Human-readable display name |
|
|
147
|
-
| `description` | string | ❌ | Short description shown in app directories and AI context |
|
|
148
|
-
| `version` | string | ✅ | SemVer string, e.g. `"1.2.0"` |
|
|
149
|
-
| `platformRevision` | string | ❌ | Platform revision tag this build targets, e.g. `"R5"` (see [host-dependency-contract.md](host-dependency-contract.md)) |
|
|
150
|
-
| `moduleFormat` | `"umd"` \| `"esm"` \| `"dual"` | ❌ | How the host loads this app's bundles. Absent = `"umd"`. See [Module format](#module-format-umd-vs-esm) below. |
|
|
151
|
-
| `sharedDependencies` | string | ❌ | Shared-dependency contract version the bundle was built against, e.g. `"v7"`. Used by the host to pick a compatible ESM import map. |
|
|
152
|
-
| `globals` | object | ❌ | Per-app namespaced UMD globals (R4.7+), e.g. `{ "widgets": "MyAppWidgets" }`. UMD-only; ESM bundles don't need it. |
|
|
153
|
-
| `seo.priority` | number | ❌ | Controls which app's `title`/`description`/`ogImage` wins when multiple apps are on the same page. Default `0`; higher wins. See the [Executor guide](executor.md). |
|
|
154
|
-
|
|
155
|
-
#### Module format (UMD vs ESM)
|
|
156
|
-
|
|
157
|
-
The host provides shared libraries (React, Radix, the SmartLinks SDK, LiquidJS…) as **singletons**
|
|
158
|
-
so apps never bundle their own. Two delivery mechanisms exist, and `meta.moduleFormat` tells the host
|
|
159
|
-
which to use:
|
|
160
|
-
|
|
161
|
-
| `moduleFormat` | Host behaviour |
|
|
162
|
-
|---|---|
|
|
163
|
-
| `"umd"` *(default)* | Loads `files.js.umd` via the CommonJS `require` shim; shared deps resolve from **window globals**. Every existing app works unchanged. |
|
|
164
|
-
| `"dual"` | Prefers `files.js.esm` when the host has an **import map** for the declared `sharedDependencies` version; **falls back to UMD** otherwise. The safe transition setting. |
|
|
165
|
-
| `"esm"` | Loads `files.js.esm` **natively**; if the host has no matching import map it fails with an actionable error rather than a bare-specifier crash. Use only once you know your hosts are on the contract. |
|
|
166
|
-
|
|
167
|
-
The ESM bundle is declared in the **same** `files.js` block as `esm` (there is no separate `jsEsm`
|
|
168
|
-
field):
|
|
169
|
-
|
|
170
|
-
```jsonc
|
|
171
|
-
"widgets": {
|
|
172
|
-
"files": {
|
|
173
|
-
"js": { "umd": "dist/widgets.umd.js", "esm": "dist/widgets.esm.js" },
|
|
174
|
-
"css": "dist/widgets.css"
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
```
|
|
178
|
-
|
|
179
|
-
An ESM bundle **must externalize exactly the shared-dependency contract** — read it from the SDK
|
|
180
|
-
(`SHARED_DEPENDENCY_SPECIFIERS`) rather than hard-coding it, and stamp the version you built against
|
|
181
|
-
into `meta.sharedDependencies`. See [host-dependency-contract.md](host-dependency-contract.md).
|
|
182
|
-
|
|
183
|
-
##### Validate before you ship: `smartlinks doctor`
|
|
184
|
-
|
|
185
|
-
Run the checker (shipped with the SDK) against your built app — it reads the same contract the host
|
|
186
|
-
serves, so the two can't drift:
|
|
187
|
-
|
|
188
|
-
```bash
|
|
189
|
-
npx smartlinks-doctor # in the app dir, after building
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
It reads your manifest, and for every ESM surface confirms **every bare import in the bundle is a
|
|
193
|
-
contract entry**. A correctly-externalized ESM bundle inlines everything except the host singletons,
|
|
194
|
-
so anything else left as a bare import will either fail to resolve through the import map or silently
|
|
195
|
-
double-load (the duplicate-React class of bug). It also warns when a UMD app still declares stale
|
|
196
|
-
`*.es.js`/`*.esm.js` bundles the host will never load. Exit code is non-zero on violations, so it
|
|
197
|
-
drops straight into CI.
|
|
198
|
-
|
|
199
|
-
#### `build`
|
|
200
|
-
|
|
201
|
-
Optional build provenance. Recommended for the **Lovable dev publish** flow: stamp the content
|
|
202
|
-
hash your build already produces here so the platform can tell when a new version is live before it
|
|
203
|
-
registers (see [Deploying & registering](deploying-apps.md#a-from-lovable--hit-publish-no-key-anywhere-recommended-for-lovable-apps)).
|
|
204
|
-
|
|
205
|
-
| Field | Type | Description |
|
|
206
|
-
|-------|------|-------------|
|
|
207
|
-
| `build.hash` | string | Unique build/content hash — the platform waits for this to appear before registering, and uses it as the dev release version |
|
|
208
|
-
| `build.at` | string | ISO timestamp of the build (optional) |
|
|
209
|
-
|
|
210
|
-
```json
|
|
211
|
-
"build": { "hash": "a1b2c3d4", "at": "2026-09-20T10:00:00Z" }
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
#### `admin`
|
|
215
|
-
|
|
216
|
-
A relative path (from the app's public root) to the `app.admin.json` file. Omit entirely if the app has no admin UI.
|
|
217
|
-
|
|
218
|
-
```json
|
|
219
|
-
"admin": "app.admin.json"
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
#### `adminPage`
|
|
223
|
-
|
|
224
|
-
The page a host opens as the app's **admin screen**, from the app's root: `"admin.html"` or `"index.html"`.
|
|
225
|
-
Studio, the console and Forge's preview read it rather than guess. Omit it to take the host's default:
|
|
226
|
-
|
|
227
|
-
| App | Default admin page |
|
|
228
|
-
|-----|--------------------|
|
|
229
|
-
| An installed app | `admin.html` |
|
|
230
|
-
| A core app (`core-<name>`, one of Studio's own sections) | the root page, `index.html` |
|
|
231
|
-
|
|
232
|
-
Declare it when the default is wrong. AuthKit (`core-account`) is the example: its root page is the
|
|
233
|
-
**public sign-in screen** every site sends people to, so its admin lives at `admin.html`:
|
|
234
|
-
|
|
235
|
-
```json
|
|
236
|
-
"adminPage": "admin.html"
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
Never move a public page off the root to make room for the admin: sign-in links and embeds point at the root.
|
|
240
|
-
|
|
241
|
-
#### `widgets`
|
|
242
|
-
|
|
243
|
-
Declares the widget bundle. Omit if the app has no widget component.
|
|
244
|
-
|
|
245
|
-
| Field | Description |
|
|
246
|
-
|-------|-------------|
|
|
247
|
-
| `files.js.umd` | UMD bundle path — used for dynamic `<script>` loading |
|
|
248
|
-
| `files.js.esm` | ESM bundle path — used for `import()` / native ES modules (optional but recommended) |
|
|
249
|
-
| `files.css` | CSS bundle path — omit if the widget ships no styles |
|
|
250
|
-
| `instanceResolution` | Optional boolean. When `true`, this app supports resolving configured widget instances by ID from app config |
|
|
251
|
-
| `instanceParam` | Optional string. Query/hash param used for instance lookup. Defaults to `"widgetId"` |
|
|
252
|
-
| `components[]` | One entry per exported widget component (see below) |
|
|
253
|
-
|
|
254
|
-
**Widget instance resolution**
|
|
255
|
-
|
|
256
|
-
Apps such as widget toolkits often store reusable widget instances in collection-scoped app config, for example under `config.widgets.launch-countdown`. When your widget bundle can self-configure from one of those stored instances, declare that capability in the manifest:
|
|
257
|
-
|
|
258
|
-
```json
|
|
259
|
-
"widgets": {
|
|
260
|
-
"instanceResolution": true,
|
|
261
|
-
"instanceParam": "widgetId",
|
|
262
|
-
"files": {
|
|
263
|
-
"js": {
|
|
264
|
-
"umd": "dist/widgets.umd.js",
|
|
265
|
-
"esm": "dist/widgets.esm.js"
|
|
266
|
-
},
|
|
267
|
-
"css": null
|
|
268
|
-
},
|
|
269
|
-
"components": [
|
|
270
|
-
{
|
|
271
|
-
"name": "WidgetToolkitResolver",
|
|
272
|
-
"description": "Resolves and renders a configured widget instance by ID."
|
|
273
|
-
}
|
|
274
|
-
]
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
This tells the platform and other apps that they can deep-link into a stored widget instance using a URL or embed context such as `?appId=widget-toolkit&widgetId=launch-countdown`.
|
|
279
|
-
|
|
280
|
-
**Component fields:**
|
|
281
|
-
|
|
282
|
-
| Field | Type | Description |
|
|
283
|
-
|-------|------|-------------|
|
|
284
|
-
| `name` | string | Exported component name (must match the bundle export) |
|
|
285
|
-
| `description` | string | Human-readable description for portals and AI |
|
|
286
|
-
| `sizes` | string[] | Supported size hints: `"compact"`, `"standard"`, `"large"` |
|
|
287
|
-
| `props.required` | string[] | Props that must be provided for the component to render |
|
|
288
|
-
| `props.optional` | string[] | Props the component can use if provided |
|
|
289
|
-
| `settings` | object | JSON-Schema-style settings the widget accepts from its host |
|
|
290
|
-
|
|
291
|
-
#### `containers`
|
|
292
|
-
|
|
293
|
-
Same structure as `widgets` but declares the full-app container bundle. Lazy-loaded on demand.
|
|
294
|
-
|
|
295
|
-
See the [Containers guide](containers.md) for details on the container component model.
|
|
296
|
-
**Component fields** (same as widgets, plus):
|
|
297
|
-
|
|
298
|
-
| Field | Type | Description |
|
|
299
|
-
|-------|------|--------------|
|
|
300
|
-
| `name` | string | Exported component name |
|
|
301
|
-
| `description` | string | Human-readable description |
|
|
302
|
-
| `props.required` / `props.optional` | string[] | Required and optional prop names |
|
|
303
|
-
| `audience` | `"public"` \| `"admin"` \| `"both"` | Who can use/see this component. Defaults to `"public"`. |
|
|
304
|
-
| `scope` | `"collection"` \| `"product"` | Data scope hint. `"product"` means the component always renders in the context of a specific product. |
|
|
305
|
-
| `settings` | object | JSON Schema describing configurable settings |
|
|
306
|
-
|
|
307
|
-
#### `mobileAdmin`
|
|
308
|
-
|
|
309
|
-
Declares a **separate** mobile admin bundle — a sibling of `containers` with its own build output. Use this when the mobile admin surface needs a different runtime, native-only dependencies (Capacitor), or independent versioning. Omit if your app has no mobile admin surface.
|
|
310
|
-
|
|
311
|
-
See [mobile-admin-container.md](mobile-admin-container.md) for the `AdminMobileHostContext` prop contract, the capability matrix, event stream, error types, and build setup.
|
|
312
|
-
|
|
313
|
-
```json
|
|
314
|
-
"mobileAdmin": {
|
|
315
|
-
"files": {
|
|
316
|
-
"js": {
|
|
317
|
-
"umd": "dist/mobile-admin.umd.js",
|
|
318
|
-
"esm": "dist/mobile-admin.esm.js"
|
|
319
|
-
},
|
|
320
|
-
"css": null
|
|
321
|
-
},
|
|
322
|
-
"components": [
|
|
323
|
-
{
|
|
324
|
-
"name": "WarehousePickContainer",
|
|
325
|
-
"description": "Pick orders by scanning NFC tags",
|
|
326
|
-
"capabilities": ["nfc", "qr"],
|
|
327
|
-
"offline": true
|
|
328
|
-
}
|
|
329
|
-
]
|
|
330
|
-
}
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
| Field | Description |
|
|
334
|
-
|-------|-------------|
|
|
335
|
-
| `files.js.umd` | UMD bundle path — used for dynamic `<script>` loading |
|
|
336
|
-
| `files.js.esm` | ESM bundle path (optional but recommended) |
|
|
337
|
-
| `files.css` | CSS bundle path — set to `null` if no styles |
|
|
338
|
-
| `components[].name` | Exported component name (must match the UMD bundle export) |
|
|
339
|
-
| `components[].description` | Shown in the mobile launcher's app picker |
|
|
340
|
-
| `components[].capabilities` | Hardware capabilities this component needs or can use. See [capability list](mobile-admin-container.md#hardware-capabilities--the-capability-matrix). |
|
|
341
|
-
| `components[].offline` | Set to `true` if this component queues writes locally and needs offline sync support. |
|
|
342
|
-
#### `linkable`
|
|
343
|
-
|
|
344
|
-
Static deep-linkable states built into the app — fixed routes that exist regardless of per-collection content. Declared once at build time.
|
|
345
|
-
|
|
346
|
-
See the [Deep Link Discovery guide](deep-link-discovery.md) for the full dual-source pattern (static manifest routes + dynamic `appConfig.linkable`).
|
|
347
|
-
|
|
348
|
-
These are the app's **pages that a host opens**: portal menus and tabs, and websites that embed the app
|
|
349
|
-
(websites.md → "Using another app's pages"). A host opens them with its own signed-in session, so one
|
|
350
|
-
app can offer several pages that each know the visitor: book, upcoming bookings, past bookings, change a
|
|
351
|
-
booking.
|
|
352
|
-
|
|
353
|
-
```json
|
|
354
|
-
"linkable": [
|
|
355
|
-
{ "id": "book", "title": "Book an appointment", "path": "/",
|
|
356
|
-
"accepts": { "optional": ["service", "staff", "date"] } },
|
|
357
|
-
{ "id": "upcoming", "title": "Your upcoming bookings", "path": "/my-bookings" },
|
|
358
|
-
{ "id": "change", "title": "Change a booking", "path": "/booking",
|
|
359
|
-
"accepts": { "required": ["id"] } }
|
|
360
|
-
]
|
|
361
|
-
```
|
|
362
|
-
|
|
363
|
-
| Field | Type | Required | Description |
|
|
364
|
-
|-------|------|----------|-------------|
|
|
365
|
-
| `id` | string | ❌ | Stable id, unique within the app: hosts and sites refer to the page by it |
|
|
366
|
-
| `title` | string | ✅ | Human-readable label shown in menus and offered to AI agents |
|
|
367
|
-
| `path` | string | ❌ | Hash route within the app (defaults to `"/"` if omitted) |
|
|
368
|
-
| `params` | object | ❌ | Params this entry PINS, appended to the URL — do **not** include platform params (`collectionId`, `productId`, etc.) |
|
|
369
|
-
| `accepts` | `{ required?: string[]; optional?: string[] }` | ❌ | The params a host may supply when it opens the page (e.g. which service to start on) |
|
|
370
|
-
|
|
371
|
-
#### `publicViews`
|
|
372
|
-
|
|
373
|
-
Declares the app's **public views** — **standalone, external screens** served over your single public
|
|
374
|
-
bundle (`index.html` → HashRouter): a display board, a kiosk/TV screen, a dashboard, a public share
|
|
375
|
-
page. Without this, those routes/modes are invisible to the platform and the Dev Hub. Each view is a
|
|
376
|
-
`route` + fixed `set` params + caller `params`.
|
|
377
|
-
|
|
378
|
-
> **Public views are NOT portal.** They are completely external and independent. Their only input is
|
|
379
|
-
> **URL parameters** (often a `collectionId`, as a plain param). They expect **no** portal wrapper, **no**
|
|
380
|
-
> host-managed auth/session, and **no** physical-twin context (no QR/NFC/tag scan). They open at a URL
|
|
381
|
-
> and stand alone. For the two **portal** surfaces — where the app renders *inside* portal, and the
|
|
382
|
-
> entry points portal menus link to — see below.
|
|
383
|
-
|
|
384
|
-
```json
|
|
385
|
-
"publicViews": [
|
|
386
|
-
{ "id": "board", "title": "Display board", "route": "/display",
|
|
387
|
-
"params": { "required": ["collectionId"], "optional": ["orientation"] } },
|
|
388
|
-
{ "id": "tv", "title": "TV / big screen", "route": "/", "set": { "tvMode": "true" },
|
|
389
|
-
"params": { "required": ["collectionId", "voteId"] } }
|
|
390
|
-
]
|
|
391
|
-
```
|
|
392
|
-
|
|
393
|
-
| Field | Type | Required | Description |
|
|
394
|
-
|-------|------|----------|-------------|
|
|
395
|
-
| `id` | string | ✅ | Stable id, unique within the app |
|
|
396
|
-
| `title` | string | ✅ | Human label (Dev Hub dropdown, platform pickers) |
|
|
397
|
-
| `route` | string | ❌ | Hash route within the public bundle (defaults to `"/"`) |
|
|
398
|
-
| `set` | object | ❌ | Query params this view PINS (e.g. `{ "tvMode": "true" }`), merged under caller params |
|
|
399
|
-
| `params` | `{ required?: string[]; optional?: string[] }` | ❌ | The params the caller supplies via the URL |
|
|
400
|
-
|
|
401
|
-
Read the URL params with **`SL.readContext()`** (merges hash → search) instead of hand-rolling it.
|
|
402
|
-
|
|
403
|
-
##### The app's page on the business's address (`/_apps/<name>/`)
|
|
404
|
-
|
|
405
|
-
Every installed app with a public page also answers on the business's own address:
|
|
406
|
-
`https://<business>.smartlinks.host/_apps/<name>/#/your-route` (or their own domain). The name defaults to
|
|
407
|
-
the app id without its publisher handle and the business can rename it. There, the platform tells the page
|
|
408
|
-
who it belongs to, so **the URL carries no `collectionId` or `appId`**:
|
|
409
|
-
|
|
410
|
-
- Read context with **`SL.readContext()`**: it fills `collectionId` and `appId` from the page's address
|
|
411
|
-
when the URL doesn't carry them, and `basePath` (`/_apps/<name>`) for building share links:
|
|
412
|
-
`` `https://${location.host}${ctx.basePath ?? ''}/#/play` ``.
|
|
413
|
-
- Build with a **relative base** (`base: './'` in Vite) so assets load under `/_apps/<name>/`.
|
|
414
|
-
- Use hash routes (`#/play`); the path after `/_apps/<name>/` is served the app's `index.html` either way.
|
|
415
|
-
- Never put `collectionId` in your own share links: the address already says which business it is.
|
|
416
|
-
- **Linking to your page from anywhere else** (your admin's "Open the game", a QR code, an email): ask
|
|
417
|
-
where it is with **`await SL.address.page(collectionId, appId)`** and use its `url` plus your route
|
|
418
|
-
(`${link.url}#/play`). Never build `smartlinks.app/apps/<id>/stable/index.html…` by hand: the business
|
|
419
|
-
may have renamed the page, made it its front page, or put it on its own domain, and `url` follows all of
|
|
420
|
-
that. It's a test build's automatic address until the app is live there.
|
|
421
|
-
|
|
422
|
-
##### Public views vs the two portal surfaces
|
|
423
|
-
|
|
424
|
-
An app can have any combination of three setup styles. Only public views are external:
|
|
425
|
-
|
|
426
|
-
| Style | Declared by | Lives | Context |
|
|
427
|
-
|-------|-------------|-------|---------|
|
|
428
|
-
| **Portal components** — where the app renders inside portal (collection / product / batch / variant / proof) | module registry `components.*` (set at publish) | Inside portal | Physical twin (QR/NFC scan) |
|
|
429
|
-
| **App pages** — the entry points portal menus/tabs link to and websites embed (e.g. list vs calendar; book vs my bookings) | `linkable` / `DeepLinkEntry` | Inside a host: portal or a website | The host: its signed-in session, plus the page's `accepts` params |
|
|
430
|
-
| **Public views** — standalone external screens | `publicViews` (this block) | Outside portal | URL params only |
|
|
431
|
-
| **Admin views** — the admin side's screens by name, for its side menu, Studio's menu and the assistant | `adminViews` ([admin-views.md](admin-views.md)) | The admin page, in Studio | Studio's session; `chrome=none` when Studio carries the menu |
|
|
432
|
-
|
|
433
|
-
#### `records`
|
|
434
|
-
|
|
435
|
-
Declares which `app.records` record types the app stores, and which scopes each type supports. Required for any app that follows the [App Records Pattern](app-records-pattern.md). Omit if the app does not use scoped records.
|
|
436
|
-
|
|
437
|
-
The platform and the `<RecordsAdminShell>` from `@proveanything/smartlinks-utils-ui` read this block to render the right scope tabs, rule editor, and cardinality-appropriate right pane.
|
|
438
|
-
|
|
439
|
-
```json
|
|
440
|
-
"records": {
|
|
441
|
-
"<recordType>": {
|
|
442
|
-
"label": "Human-readable label",
|
|
443
|
-
"cardinality": "singleton",
|
|
444
|
-
"allowFacetRules": false,
|
|
445
|
-
"scopes": ["collection", "product", "variant", "batch", "facet"],
|
|
446
|
-
"defaultScope": "product"
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
```
|
|
450
|
-
|
|
451
|
-
| Field | Type | Default | Description |
|
|
452
|
-
|-------------------|----------|---------|-------------|
|
|
453
|
-
| `label` | string | — | Human-readable label for the record type, used in headings and tabs. |
|
|
454
|
-
| `cardinality` | string | `'singleton'` | `'singleton'` — one record wins per scope (e.g. ingredients, nutrition). `'collection'` — every matching record is returned in resolution order (e.g. FAQs, recipes). Drives which hook to use on the public side (`useResolvedRecord` vs `useCollectedRecords`) and how the shell lays out the right pane. |
|
|
455
|
-
| `allowFacetRules` | boolean | `false` | When `true`, the shell renders a **Rule** scope tab and embeds `<FacetRuleEditor>`. Add `'rule'` to `scopes` when setting this. |
|
|
456
|
-
| `scopes` | string[] | — | Allowed scope kinds in resolution order. Valid values: `"collection"`, `"product"`, `"variant"`, `"batch"`, `"facet"`, `"proof"`, `"rule"`. `'rule'` is a synthetic scope holding `facetRule`-targeted records. `'collection'` replaces the legacy empty-ref catch-all — **there is no `'global'` scope**. |
|
|
457
|
-
| `defaultScope` | string | — | The scope the "Create new" button targets in the admin shell. Must be one of the declared `scopes`. |
|
|
458
|
-
|
|
459
|
-
An app may declare multiple record types under different keys (e.g. `"nutrition"` and `"cooking_steps"`). See [app-records-pattern.md](app-records-pattern.md) for the full admin + public pattern.
|
|
460
|
-
|
|
461
|
-
#### `executor`
|
|
462
|
-
|
|
463
|
-
Declares the executor bundle — a standalone JS library for programmatic configuration, server-side SEO, and LLM content generation. Omit if the app has no executor.
|
|
464
|
-
|
|
465
|
-
See the **[Executor Model guide](executor.md)** for the full build setup, SEO contract, LLM content contract, and implementation patterns.
|
|
466
|
-
|
|
467
|
-
| Field | Type | Description |
|
|
468
|
-
|-------|------|-------------|
|
|
469
|
-
| `files.js.umd` | string | UMD bundle path |
|
|
470
|
-
| `files.js.esm` | string | ESM bundle path |
|
|
471
|
-
| `factory` | string | Name of the factory function that creates an executor instance |
|
|
472
|
-
| `exports` | string[] | All named exports — tells consumers what's available without loading the bundle |
|
|
473
|
-
| `description` | string | Human-readable summary for AI orchestrators |
|
|
474
|
-
| `llmContent.function` | string | Name of the `getLLMContent` export |
|
|
475
|
-
| `llmContent.timeout` | number | Timeout in ms (default 500) |
|
|
476
|
-
|
|
477
|
-
#### `functions`
|
|
478
|
-
|
|
479
|
-
Declares app-authored **server functions** — server-side handlers `(ctx, event) ⇒ result`
|
|
480
|
-
(http / event / cron), shipped in a self-contained UMD bundle. Omit if the app has no server
|
|
481
|
-
functions. The security model (`visibility`/`authority`/`capabilities`), the runtime surface, how
|
|
482
|
-
to build the bundle, and how to invoke are all in the **[Server Functions guide](server-functions.md)** —
|
|
483
|
-
this is just the manifest shape.
|
|
484
|
-
|
|
485
|
-
| Field | Type | Description |
|
|
486
|
-
|-------|------|-------------|
|
|
487
|
-
| `files.js.umd` | string | UMD bundle path, relative to the published build like the other bundles (e.g. `functions.umd.js`, built to `dist/functions.umd.js`) — a self-contained bundle exporting each handler by name |
|
|
488
|
-
| `definitions[]` | object[] | One entry per function |
|
|
489
|
-
| `definitions[].name` | string | Function name; also the handler export name (override with `handler`) |
|
|
490
|
-
| `definitions[].trigger` | object | `{ type: "http"|"event"|"cron", … }` |
|
|
491
|
-
| `definitions[].visibility` | string | `admin` \| `public` (http only) — who may call it |
|
|
492
|
-
| `definitions[].userGroups` | string[] | http only — the [user groups](user-groups.md) (by key) allowed to call it; the caller must be in at least one, or be a collection admin |
|
|
493
|
-
| `definitions[].authority` | string | `caller` \| `collection` — whose authority it runs as |
|
|
494
|
-
| `definitions[].capabilities` | string[] | Least-privilege grants (`sl:<res>:<read\|write>`, `network[:<host>]`, `secrets:<ref>`) |
|
|
495
|
-
|
|
496
|
-
#### `connector`
|
|
497
|
-
|
|
498
|
-
Marks the app as an integration **connector** for one external provider: the integrations console
|
|
499
|
-
lists it and draws its connect form and settings, and the integration engine calls its server
|
|
500
|
-
functions (`testConnection`, `describeTarget`, `sample`, `fetch`, `shape`, `serialize`, `send`). It adapts the provider's format; core does each customer's mapping. The full
|
|
501
|
-
contract is in the **[Connectors guide](connectors.md)**.
|
|
502
|
-
|
|
503
|
-
#### `assistant`
|
|
504
|
-
|
|
505
|
-
What the **Studio assistant** (the admin's own agent) knows about this app: skills and knowledge files
|
|
506
|
-
shipped with the build and loaded into its box on demand, and an optional page that renders a planned
|
|
507
|
-
change set before it is applied.
|
|
508
|
-
|
|
509
|
-
```jsonc
|
|
510
|
-
"assistant": {
|
|
511
|
-
"skills": [
|
|
512
|
-
{ "name": "theme", "description": "Changing the Hub's colours, fonts or logo", "file": "assistant/skills/theme.md" },
|
|
513
|
-
{ "name": "pages", "description": "Adding, ordering and editing pages and the menu", "file": "assistant/skills/pages.md" }
|
|
514
|
-
],
|
|
515
|
-
"knowledge": [
|
|
516
|
-
{ "name": "settings-schema", "description": "JSON Schema of the hub settings group", "file": "assistant/knowledge/settings.schema.json" }
|
|
517
|
-
],
|
|
518
|
-
"preview": "/admin/preview?changeSet={id}"
|
|
519
|
-
}
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
The files live under `public/assistant/` and ship with every release like any other static file. The
|
|
523
|
-
assistant sees one line per skill (its description) and reads the file only when the job calls for it,
|
|
524
|
-
so a big app can carry many skills at no cost to the conversation. Full guide, including what a skill
|
|
525
|
-
should say and how the assistant changes config with undo: **[assistant-apps.md](assistant-apps.md)**.
|
|
526
|
-
|
|
527
|
-
---
|
|
528
|
-
|
|
529
|
-
#### `docs`
|
|
530
|
-
|
|
531
|
-
The app's manual, for the people who use it: Markdown pages under `public/docs/`, shipped with every
|
|
532
|
-
release. For first-party apps, docs.smartlinks.app reads the stable release's pages directly, so
|
|
533
|
-
releasing the app publishes its manual.
|
|
534
|
-
|
|
535
|
-
```jsonc
|
|
536
|
-
"docs": {
|
|
537
|
-
"pages": [
|
|
538
|
-
{ "file": "docs/index.md", "title": "Messages", "description": "Send campaigns and answer people in one inbox.", "audience": "team" },
|
|
539
|
-
{ "file": "docs/setup.md", "title": "Setting up", "audience": "admin" }
|
|
540
|
-
]
|
|
541
|
-
}
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
The first page is the front page. `audience` is `team` (default), `admin`, `customer` or `developer`.
|
|
545
|
-
`listed: false` keeps a manual off the docs site. What to write and how: **[app-docs.md](app-docs.md)**.
|
|
546
|
-
|
|
547
|
-
---
|
|
548
|
-
|
|
549
|
-
## `app.admin.json`
|
|
550
|
-
|
|
551
|
-
Fetched only by the admin UI and AI-assisted setup flows — never loaded on the public-facing page. Keep setup logic and configuration schemas here, not in the manifest.
|
|
552
|
-
|
|
553
|
-
### Full Schema
|
|
554
|
-
|
|
555
|
-
```json
|
|
556
|
-
{
|
|
557
|
-
"$schema": "https://smartlinks.app/schemas/app-admin-v1.json",
|
|
558
|
-
|
|
559
|
-
"aiGuide": "ai-guide.md",
|
|
560
|
-
|
|
561
|
-
"setup": {
|
|
562
|
-
"description": "Configure the app for this collection.",
|
|
563
|
-
"questions": [
|
|
564
|
-
{
|
|
565
|
-
"id": "brandName",
|
|
566
|
-
"prompt": "What is your brand name?",
|
|
567
|
-
"type": "text",
|
|
568
|
-
"required": true
|
|
569
|
-
},
|
|
570
|
-
{
|
|
571
|
-
"id": "primaryColor",
|
|
572
|
-
"prompt": "Choose a primary theme colour.",
|
|
573
|
-
"type": "select",
|
|
574
|
-
"options": [
|
|
575
|
-
{ "value": "blue", "label": "Blue" },
|
|
576
|
-
{ "value": "green", "label": "Green" },
|
|
577
|
-
{ "value": "red", "label": "Red" }
|
|
578
|
-
]
|
|
579
|
-
},
|
|
580
|
-
{
|
|
581
|
-
"id": "welcomeEnabled",
|
|
582
|
-
"prompt": "Show a welcome message to first-time visitors?",
|
|
583
|
-
"type": "boolean",
|
|
584
|
-
"default": true
|
|
585
|
-
}
|
|
586
|
-
],
|
|
587
|
-
"configSchema": {
|
|
588
|
-
"brandName": { "type": "string" },
|
|
589
|
-
"primaryColor": { "type": "string" },
|
|
590
|
-
"welcomeEnabled": { "type": "boolean" }
|
|
591
|
-
},
|
|
592
|
-
"saveWith": {
|
|
593
|
-
"method": "appConfiguration.setConfig",
|
|
594
|
-
"scope": "collection",
|
|
595
|
-
"admin": true,
|
|
596
|
-
"note": "Saved under the collection scope; readable by all app users."
|
|
597
|
-
},
|
|
598
|
-
"contentHints": {
|
|
599
|
-
"welcomeMessage": {
|
|
600
|
-
"aiGenerate": true,
|
|
601
|
-
"prompt": "Write a short, friendly welcome message for a brand called {{brandName}}."
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
},
|
|
605
|
-
|
|
606
|
-
"import": {
|
|
607
|
-
"description": "Bulk-import items via CSV.",
|
|
608
|
-
"scope": "collection",
|
|
609
|
-
"fields": [
|
|
610
|
-
{ "name": "title", "type": "string", "required": true },
|
|
611
|
-
{ "name": "description", "type": "string" },
|
|
612
|
-
{ "name": "imageUrl", "type": "string" },
|
|
613
|
-
{ "name": "price", "type": "number", "default": 0 }
|
|
614
|
-
],
|
|
615
|
-
"csvExample": "title,description,imageUrl,price\nWidget A,Our first widget,https://example.com/img.jpg,9.99",
|
|
616
|
-
"saveWith": {
|
|
617
|
-
"method": "appObjects.createRecord",
|
|
618
|
-
"scope": "collection",
|
|
619
|
-
"admin": true
|
|
620
|
-
}
|
|
621
|
-
},
|
|
622
|
-
|
|
623
|
-
"tunable": {
|
|
624
|
-
"description": "Adjust display options after initial setup.",
|
|
625
|
-
"fields": [
|
|
626
|
-
{
|
|
627
|
-
"name": "displayMode",
|
|
628
|
-
"description": "How items are laid out on the page.",
|
|
629
|
-
"type": "select",
|
|
630
|
-
"options": ["grid", "list", "carousel"]
|
|
631
|
-
},
|
|
632
|
-
{
|
|
633
|
-
"name": "itemsPerPage",
|
|
634
|
-
"description": "Number of items shown per page.",
|
|
635
|
-
"type": "number"
|
|
636
|
-
}
|
|
637
|
-
]
|
|
638
|
-
},
|
|
639
|
-
|
|
640
|
-
"metrics": {
|
|
641
|
-
"interactions": [
|
|
642
|
-
{ "id": "view", "description": "User viewed an item." },
|
|
643
|
-
{ "id": "click", "description": "User clicked a link or CTA." },
|
|
644
|
-
{ "id": "purchase", "description": "User completed a purchase." }
|
|
645
|
-
],
|
|
646
|
-
"kpis": [
|
|
647
|
-
{ "name": "Click-through Rate", "compute": "click / view" },
|
|
648
|
-
{ "name": "Conversion Rate", "compute": "purchase / view" }
|
|
649
|
-
]
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
```
|
|
653
|
-
|
|
654
|
-
> `dynamic-select` widget pickers are a reasonable future extension for admin schemas, but they are not a built-in question type in the SDK today. For now, treat widget-instance selection as an app-level UI convention powered by `appConfiguration.listWidgetInstances()`.
|
|
655
|
-
|
|
656
|
-
### Field Reference
|
|
657
|
-
|
|
658
|
-
#### `aiGuide`
|
|
659
|
-
|
|
660
|
-
Path (relative to the app's public root) to a Markdown file providing natural-language context for AI-assisted configuration. See the [AI Guide Template](ai-guide-template.md).
|
|
661
|
-
|
|
662
|
-
```json
|
|
663
|
-
"aiGuide": "ai-guide.md"
|
|
664
|
-
```
|
|
665
|
-
|
|
666
|
-
---
|
|
667
|
-
|
|
668
|
-
#### `setup`
|
|
669
|
-
|
|
670
|
-
Drives the initial configuration wizard shown to admins when they first install the app for a collection.
|
|
671
|
-
|
|
672
|
-
| Field | Type | Description |
|
|
673
|
-
|-------|------|-------------|
|
|
674
|
-
| `description` | string | Intro text shown at the top of the setup wizard |
|
|
675
|
-
| `questions` | array | Ordered list of questions to ask the admin (see below) |
|
|
676
|
-
| `configSchema` | object | JSON-Schema-style shape of the resulting config object |
|
|
677
|
-
| `saveWith` | object | Which SDK method and scope to use when persisting answers |
|
|
678
|
-
| `contentHints` | object | Keys that AI should auto-generate based on question answers |
|
|
679
|
-
|
|
680
|
-
**`questions[]` fields:**
|
|
681
|
-
|
|
682
|
-
| Field | Type | Required | Description |
|
|
683
|
-
|-------|------|----------|-------------|
|
|
684
|
-
| `id` | string | ✅ | Key used in the saved config and in `contentHints` references |
|
|
685
|
-
| `prompt` | string | ✅ | Question text displayed to the admin |
|
|
686
|
-
| `type` | string | ✅ | Input type: `"text"`, `"number"`, `"boolean"`, `"select"`, `"multiselect"`, `"textarea"` |
|
|
687
|
-
| `required` | boolean | ❌ | Whether an answer is mandatory (default `false`) |
|
|
688
|
-
| `default` | any | ❌ | Pre-filled default value |
|
|
689
|
-
| `options` | array | ❌ | For `select`/`multiselect`: `[{ "value": "...", "label": "..." }]` |
|
|
690
|
-
|
|
691
|
-
**`saveWith` fields:**
|
|
692
|
-
|
|
693
|
-
| Field | Type | Description |
|
|
694
|
-
|-------|------|-------------|
|
|
695
|
-
| `method` | string | SDK method to call, e.g. `"appConfiguration.setConfig"` |
|
|
696
|
-
| `scope` | string | Data scope: `"collection"`, `"product"`, or `"proof"` |
|
|
697
|
-
| `admin` | boolean | Whether the save call requires admin credentials |
|
|
698
|
-
| `note` | string | Human-readable note explaining the save behaviour |
|
|
699
|
-
|
|
700
|
-
**`contentHints`:**
|
|
701
|
-
|
|
702
|
-
A map from content key to AI generation instructions. The AI setup flow uses this to pre-fill content fields after the admin answers setup questions.
|
|
703
|
-
|
|
704
|
-
```json
|
|
705
|
-
"contentHints": {
|
|
706
|
-
"welcomeMessage": {
|
|
707
|
-
"aiGenerate": true,
|
|
708
|
-
"prompt": "Write a short welcome message for a brand called {{brandName}}."
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
```
|
|
712
|
-
|
|
713
|
-
---
|
|
714
|
-
|
|
715
|
-
#### `import`
|
|
716
|
-
|
|
717
|
-
Defines a CSV bulk-import flow available in the admin UI.
|
|
718
|
-
|
|
719
|
-
| Field | Type | Description |
|
|
720
|
-
|-------|------|-------------|
|
|
721
|
-
| `description` | string | Explains what will be imported and how |
|
|
722
|
-
| `scope` | string | Data scope for the imported records |
|
|
723
|
-
| `fields` | array | Column definitions — `name`, `type`, `required`, `default`, `description` |
|
|
724
|
-
| `csvExample` | string | A sample CSV string (shown as a download template) |
|
|
725
|
-
| `saveWith` | object | SDK method used to persist each imported row (same shape as `setup.saveWith`) |
|
|
726
|
-
|
|
727
|
-
---
|
|
728
|
-
|
|
729
|
-
#### `tunable`
|
|
730
|
-
|
|
731
|
-
Post-setup display options that admins can tweak without re-running the full setup wizard.
|
|
732
|
-
|
|
733
|
-
| Field | Type | Description |
|
|
734
|
-
|-------|------|-------------|
|
|
735
|
-
| `description` | string | Explains what these settings control |
|
|
736
|
-
| `fields` | array | Tunable parameters — `name`, `description`, `type`, `options[]` |
|
|
737
|
-
|
|
738
|
-
---
|
|
739
|
-
|
|
740
|
-
#### `metrics`
|
|
741
|
-
|
|
742
|
-
Declares what interactions and KPIs the app reports. Used by the platform's analytics dashboard.
|
|
743
|
-
|
|
744
|
-
| Field | Type | Description |
|
|
745
|
-
|-------|------|-------------|
|
|
746
|
-
| `interactions` | array | Interaction event types: `{ id, description }` |
|
|
747
|
-
| `kpis` | array | Derived metrics: `{ name, compute }` — `compute` is a simple expression over interaction IDs |
|
|
748
|
-
|
|
749
|
-
---
|
|
750
|
-
|
|
751
|
-
## Widget settings schema (JSON Schema)
|
|
752
|
-
|
|
753
|
-
Each widget component's `settings` object uses **JSON Schema** to describe its configurable props, so schema-form renderers *and* AI orchestrators can auto-generate a config UI without per-widget code:
|
|
754
|
-
|
|
755
|
-
```json
|
|
756
|
-
"components": [
|
|
757
|
-
{
|
|
758
|
-
"name": "MyWidget",
|
|
759
|
-
"description": "What this widget does",
|
|
760
|
-
"sizes": ["compact", "standard", "large"],
|
|
761
|
-
"settings": {
|
|
762
|
-
"type": "object",
|
|
763
|
-
"properties": {
|
|
764
|
-
"displayMode": {
|
|
765
|
-
"type": "string", "title": "Display Mode",
|
|
766
|
-
"description": "How the widget renders",
|
|
767
|
-
"enum": ["compact", "standard", "large"],
|
|
768
|
-
"enumLabels": { "compact": "Icons only", "standard": "With names", "large": "Full cards" },
|
|
769
|
-
"default": "standard", "order": 1
|
|
770
|
-
},
|
|
771
|
-
"showImage": { "type": "boolean", "title": "Show Product Image", "default": true, "order": 2 }
|
|
772
|
-
}
|
|
773
|
-
}
|
|
774
|
-
}
|
|
775
|
-
]
|
|
776
|
-
```
|
|
777
|
-
|
|
778
|
-
| Field | Purpose |
|
|
779
|
-
|-------|---------|
|
|
780
|
-
| `type`, `enum` | Standard JSON Schema validation |
|
|
781
|
-
| `title` | Human-readable form label |
|
|
782
|
-
| `description` | Help text shown alongside the field |
|
|
783
|
-
| `enumLabels` | Friendly display names for enum values (`{ value → label }`) |
|
|
784
|
-
| `default` | Pre-selected value when no config exists |
|
|
785
|
-
| `order` | Field display order (lower number = higher) |
|
|
786
|
-
|
|
787
|
-
The schema serves both AI orchestrators (understand what a widget accepts, configure it conversationally) and schema-form renderers (auto-generate settings UIs).
|
|
788
|
-
|
|
789
|
-
## AI workflows the manifest enables
|
|
790
|
-
|
|
791
|
-
SmartLinks manifests are **AI-discoverable, -configurable, and -importable**: the structured manifest plus the prose `ai-guide.md` (start from [ai-guide-template.md](ai-guide-template.md)) let AI systems set up and populate apps without custom integration code. Three workflows read the manifest:
|
|
792
|
-
|
|
793
|
-
1. **Widget Builder** — reads `widgets.components[]` and each `settings` schema to embed a widget with correct props and auto-render its configuration UI.
|
|
794
|
-
2. **Setup Wizard** — reads `setup` from `app.admin.json`: walks `setup.questions[]`, validates against `setup.configSchema`, optionally auto-generates content via `SL.ai`, then saves per `setup.saveWith`.
|
|
795
|
-
3. **Data Importer** — reads `import` from `app.admin.json`: builds a CSV template from `import.fields[]`, normalises rows, and calls `import.saveWith.method` per row (multi-app imports merge fields into one CSV).
|
|
796
|
-
|
|
797
|
-
When you change your config shape, keep all three in sync: `app.manifest.json` (widget `settings`, containers, executor, linkable), `app.admin.json` (setup / import / tunable), and `ai-guide.md` (prose guidance).
|
|
798
|
-
|
|
799
|
-
This declarative model is canonical and works today. An app may **optionally** layer agent tools on top — a function that reads the declaration and returns a *context-adapted* result (e.g. "which setup questions for this collection?") — without changing the schema. That's additive and opt-in; see [agent-tools.md](agent-tools.md).
|
|
800
|
-
|
|
801
|
-
## Reading the Files at Runtime
|
|
802
|
-
|
|
803
|
-
### Manifest — available from the widgets endpoint
|
|
804
|
-
|
|
805
|
-
```typescript
|
|
806
|
-
import { appObjects } from '@proveanything/smartlinks';
|
|
807
|
-
import type { AppManifest, AppAdminConfig } from '@proveanything/smartlinks';
|
|
808
|
-
|
|
809
|
-
// The manifest arrives inline in the widgets response
|
|
810
|
-
const { apps } = await SL.collection.getWidgets(collectionId);
|
|
811
|
-
const { manifest, widget, container, admin: adminUrl } = apps[0];
|
|
812
|
-
|
|
813
|
-
// manifest.meta.name, manifest.linkable, manifest.widgets.components, …
|
|
814
|
-
```
|
|
815
|
-
|
|
816
|
-
### Admin config — fetch separately, only when needed
|
|
817
|
-
|
|
818
|
-
```typescript
|
|
819
|
-
// adminUrl is the fully-resolved URL from CollectionAppWidget.admin
|
|
820
|
-
if (adminUrl) {
|
|
821
|
-
const adminConfig: AppAdminConfig = await fetch(adminUrl).then(r => r.json());
|
|
822
|
-
// adminConfig.setup.questions, adminConfig.tunable.fields, …
|
|
823
|
-
}
|
|
824
|
-
```
|
|
825
|
-
|
|
826
|
-
---
|
|
827
|
-
|
|
828
|
-
## TypeScript Types
|
|
829
|
-
|
|
830
|
-
```typescript
|
|
831
|
-
import type {
|
|
832
|
-
AppManifest, // app.manifest.json
|
|
833
|
-
AppAdminConfig, // app.admin.json
|
|
834
|
-
DeepLinkEntry, // one entry in manifest.linkable or appConfig.linkable
|
|
835
|
-
AppWidgetComponent, // one entry in manifest.widgets.components
|
|
836
|
-
AppContainerComponent,
|
|
837
|
-
AppManifestExecutor, // executor block in app.manifest.json
|
|
838
|
-
AppBundle, // { js, css, source?, styles? }
|
|
839
|
-
AppManifestFiles, // { js: { umd, esm? }, css? }
|
|
840
|
-
CollectionAppWidget, // one app in the /widgets response
|
|
841
|
-
CollectionWidgetsResponse,
|
|
842
|
-
// Executor types
|
|
843
|
-
ExecutorContext, // { collectionId, appId, SL }
|
|
844
|
-
SEOInput,
|
|
845
|
-
SEOResult,
|
|
846
|
-
LLMContentInput,
|
|
847
|
-
LLMContentResult,
|
|
848
|
-
LLMContentSection,
|
|
849
|
-
} from '@proveanything/smartlinks';
|
|
850
|
-
```
|
|
851
|
-
|
|
852
|
-
All types live in `src/types/appManifest.ts`.
|
|
1
|
+
# App Configuration Files: `app.manifest.json` & `app.admin.json`
|
|
2
|
+
|
|
3
|
+
Every SmartLinks app ships with two JSON configuration files that the platform reads to understand what the app is and how to configure it. They have clearly separated responsibilities:
|
|
4
|
+
|
|
5
|
+
| File | Role | Loaded by |
|
|
6
|
+
|------|------|-----------|
|
|
7
|
+
| `app.manifest.json` | **Definitional** — what the app *is*: its bundles, components, static routes | Platform on every page load; portals; AI orchestrators |
|
|
8
|
+
| `app.admin.json` | **Operational** — how to *set up and tune* the app: setup questions, import schemas, tunable fields, metrics | Admin UI, AI-assisted setup flows |
|
|
9
|
+
|
|
10
|
+
The manifest always references the admin config via its `admin` field. Consumers that only need to *render* the app work entirely from the manifest. Only admin/setup flows need to fetch `app.admin.json`.
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
14
|
+
│ Platform boot sequence │
|
|
15
|
+
│ │
|
|
16
|
+
│ 1. GET /collection/:id/widgets │
|
|
17
|
+
│ └─→ CollectionWidgetsResponse { apps: [...] } │
|
|
18
|
+
│ each app has: manifest, widget bundle, container │
|
|
19
|
+
│ │
|
|
20
|
+
│ 2. manifest.admin ──→ "app.admin.json" (pointer only) │
|
|
21
|
+
│ │
|
|
22
|
+
│ 3. Admin UI fetches app.admin.json when setup/config needed │
|
|
23
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## `app.manifest.json`
|
|
29
|
+
|
|
30
|
+
The manifest is loaded automatically by the platform for every collection page. Keep it lean — it is fetched on every widget render.
|
|
31
|
+
|
|
32
|
+
### Full Schema
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
{
|
|
36
|
+
"$schema": "https://smartlinks.app/schemas/app-manifest-v1.json",
|
|
37
|
+
|
|
38
|
+
"meta": {
|
|
39
|
+
"appId": "my-app",
|
|
40
|
+
"name": "My App",
|
|
41
|
+
"description": "A short human-readable description of what this app does.",
|
|
42
|
+
"version": "1.2.0",
|
|
43
|
+
"platformRevision": "R5",
|
|
44
|
+
"moduleFormat": "dual",
|
|
45
|
+
"sharedDependencies": "v7"
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
"admin": "app.admin.json",
|
|
49
|
+
|
|
50
|
+
"widgets": {
|
|
51
|
+
"instanceResolution": true,
|
|
52
|
+
"instanceParam": "widgetId",
|
|
53
|
+
"files": {
|
|
54
|
+
"js": {
|
|
55
|
+
"umd": "dist/widgets.umd.js",
|
|
56
|
+
"esm": "dist/widgets.esm.js"
|
|
57
|
+
},
|
|
58
|
+
"css": "dist/widgets.css"
|
|
59
|
+
},
|
|
60
|
+
"components": [
|
|
61
|
+
{
|
|
62
|
+
"name": "SummaryWidget",
|
|
63
|
+
"description": "Compact summary card for use on product pages.",
|
|
64
|
+
"sizes": ["compact", "standard"],
|
|
65
|
+
"props": {
|
|
66
|
+
"required": ["collectionId", "appId"],
|
|
67
|
+
"optional": ["productId", "proofId"]
|
|
68
|
+
},
|
|
69
|
+
"settings": {
|
|
70
|
+
"showImage": { "type": "boolean", "default": true }
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
"containers": {
|
|
77
|
+
"files": {
|
|
78
|
+
"js": {
|
|
79
|
+
"umd": "dist/containers.umd.js",
|
|
80
|
+
"esm": "dist/containers.esm.js"
|
|
81
|
+
},
|
|
82
|
+
"css": "dist/containers.css"
|
|
83
|
+
},
|
|
84
|
+
"components": [
|
|
85
|
+
{
|
|
86
|
+
"name": "FullApp",
|
|
87
|
+
"description": "Full public app experience with internal routing.",
|
|
88
|
+
"props": {
|
|
89
|
+
"required": ["collectionId", "appId"],
|
|
90
|
+
"optional": ["productId", "proofId", "className"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
|
|
96
|
+
"mobileAdmin": {
|
|
97
|
+
"files": {
|
|
98
|
+
"js": {
|
|
99
|
+
"umd": "dist/mobile-admin.umd.js",
|
|
100
|
+
"esm": "dist/mobile-admin.esm.js"
|
|
101
|
+
},
|
|
102
|
+
"css": null
|
|
103
|
+
},
|
|
104
|
+
"components": [
|
|
105
|
+
{
|
|
106
|
+
"name": "WarehousePickContainer",
|
|
107
|
+
"description": "In-field operator admin surface.",
|
|
108
|
+
"capabilities": ["nfc", "qr"],
|
|
109
|
+
"offline": true
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
|
|
114
|
+
"linkable": [
|
|
115
|
+
{ "title": "Home", "path": "/" },
|
|
116
|
+
{ "title": "Gallery", "path": "/gallery" },
|
|
117
|
+
{ "title": "Settings", "path": "/settings", "params": { "tab": "advanced" } }
|
|
118
|
+
],
|
|
119
|
+
|
|
120
|
+
"records": {
|
|
121
|
+
"nutrition": {
|
|
122
|
+
"label": "Nutrition info",
|
|
123
|
+
"cardinality": "singleton",
|
|
124
|
+
"allowFacetRules": true,
|
|
125
|
+
"scopes": ["collection", "rule", "product", "facet", "batch"],
|
|
126
|
+
"defaultScope": "product"
|
|
127
|
+
},
|
|
128
|
+
"cooking_steps": {
|
|
129
|
+
"label": "Cooking steps",
|
|
130
|
+
"cardinality": "singleton",
|
|
131
|
+
"allowFacetRules": false,
|
|
132
|
+
"scopes": ["collection", "product"],
|
|
133
|
+
"defaultScope": "product"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Field Reference
|
|
140
|
+
|
|
141
|
+
#### `meta`
|
|
142
|
+
|
|
143
|
+
| Field | Type | Required | Description |
|
|
144
|
+
|-------|------|----------|-------------|
|
|
145
|
+
| `appId` | string | ✅ | Unique identifier for the app (slug-style, e.g. `"warranty-tracker"`) |
|
|
146
|
+
| `name` | string | ✅ | Human-readable display name |
|
|
147
|
+
| `description` | string | ❌ | Short description shown in app directories and AI context |
|
|
148
|
+
| `version` | string | ✅ | SemVer string, e.g. `"1.2.0"` |
|
|
149
|
+
| `platformRevision` | string | ❌ | Platform revision tag this build targets, e.g. `"R5"` (see [host-dependency-contract.md](host-dependency-contract.md)) |
|
|
150
|
+
| `moduleFormat` | `"umd"` \| `"esm"` \| `"dual"` | ❌ | How the host loads this app's bundles. Absent = `"umd"`. See [Module format](#module-format-umd-vs-esm) below. |
|
|
151
|
+
| `sharedDependencies` | string | ❌ | Shared-dependency contract version the bundle was built against, e.g. `"v7"`. Used by the host to pick a compatible ESM import map. |
|
|
152
|
+
| `globals` | object | ❌ | Per-app namespaced UMD globals (R4.7+), e.g. `{ "widgets": "MyAppWidgets" }`. UMD-only; ESM bundles don't need it. |
|
|
153
|
+
| `seo.priority` | number | ❌ | Controls which app's `title`/`description`/`ogImage` wins when multiple apps are on the same page. Default `0`; higher wins. See the [Executor guide](executor.md). |
|
|
154
|
+
|
|
155
|
+
#### Module format (UMD vs ESM)
|
|
156
|
+
|
|
157
|
+
The host provides shared libraries (React, Radix, the SmartLinks SDK, LiquidJS…) as **singletons**
|
|
158
|
+
so apps never bundle their own. Two delivery mechanisms exist, and `meta.moduleFormat` tells the host
|
|
159
|
+
which to use:
|
|
160
|
+
|
|
161
|
+
| `moduleFormat` | Host behaviour |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `"umd"` *(default)* | Loads `files.js.umd` via the CommonJS `require` shim; shared deps resolve from **window globals**. Every existing app works unchanged. |
|
|
164
|
+
| `"dual"` | Prefers `files.js.esm` when the host has an **import map** for the declared `sharedDependencies` version; **falls back to UMD** otherwise. The safe transition setting. |
|
|
165
|
+
| `"esm"` | Loads `files.js.esm` **natively**; if the host has no matching import map it fails with an actionable error rather than a bare-specifier crash. Use only once you know your hosts are on the contract. |
|
|
166
|
+
|
|
167
|
+
The ESM bundle is declared in the **same** `files.js` block as `esm` (there is no separate `jsEsm`
|
|
168
|
+
field):
|
|
169
|
+
|
|
170
|
+
```jsonc
|
|
171
|
+
"widgets": {
|
|
172
|
+
"files": {
|
|
173
|
+
"js": { "umd": "dist/widgets.umd.js", "esm": "dist/widgets.esm.js" },
|
|
174
|
+
"css": "dist/widgets.css"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
An ESM bundle **must externalize exactly the shared-dependency contract** — read it from the SDK
|
|
180
|
+
(`SHARED_DEPENDENCY_SPECIFIERS`) rather than hard-coding it, and stamp the version you built against
|
|
181
|
+
into `meta.sharedDependencies`. See [host-dependency-contract.md](host-dependency-contract.md).
|
|
182
|
+
|
|
183
|
+
##### Validate before you ship: `smartlinks doctor`
|
|
184
|
+
|
|
185
|
+
Run the checker (shipped with the SDK) against your built app — it reads the same contract the host
|
|
186
|
+
serves, so the two can't drift:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
npx smartlinks-doctor # in the app dir, after building
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
It reads your manifest, and for every ESM surface confirms **every bare import in the bundle is a
|
|
193
|
+
contract entry**. A correctly-externalized ESM bundle inlines everything except the host singletons,
|
|
194
|
+
so anything else left as a bare import will either fail to resolve through the import map or silently
|
|
195
|
+
double-load (the duplicate-React class of bug). It also warns when a UMD app still declares stale
|
|
196
|
+
`*.es.js`/`*.esm.js` bundles the host will never load. Exit code is non-zero on violations, so it
|
|
197
|
+
drops straight into CI.
|
|
198
|
+
|
|
199
|
+
#### `build`
|
|
200
|
+
|
|
201
|
+
Optional build provenance. Recommended for the **Lovable dev publish** flow: stamp the content
|
|
202
|
+
hash your build already produces here so the platform can tell when a new version is live before it
|
|
203
|
+
registers (see [Deploying & registering](deploying-apps.md#a-from-lovable--hit-publish-no-key-anywhere-recommended-for-lovable-apps)).
|
|
204
|
+
|
|
205
|
+
| Field | Type | Description |
|
|
206
|
+
|-------|------|-------------|
|
|
207
|
+
| `build.hash` | string | Unique build/content hash — the platform waits for this to appear before registering, and uses it as the dev release version |
|
|
208
|
+
| `build.at` | string | ISO timestamp of the build (optional) |
|
|
209
|
+
|
|
210
|
+
```json
|
|
211
|
+
"build": { "hash": "a1b2c3d4", "at": "2026-09-20T10:00:00Z" }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
#### `admin`
|
|
215
|
+
|
|
216
|
+
A relative path (from the app's public root) to the `app.admin.json` file. Omit entirely if the app has no admin UI.
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
"admin": "app.admin.json"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
#### `adminPage`
|
|
223
|
+
|
|
224
|
+
The page a host opens as the app's **admin screen**, from the app's root: `"admin.html"` or `"index.html"`.
|
|
225
|
+
Studio, the console and Forge's preview read it rather than guess. Omit it to take the host's default:
|
|
226
|
+
|
|
227
|
+
| App | Default admin page |
|
|
228
|
+
|-----|--------------------|
|
|
229
|
+
| An installed app | `admin.html` |
|
|
230
|
+
| A core app (`core-<name>`, one of Studio's own sections) | the root page, `index.html` |
|
|
231
|
+
|
|
232
|
+
Declare it when the default is wrong. AuthKit (`core-account`) is the example: its root page is the
|
|
233
|
+
**public sign-in screen** every site sends people to, so its admin lives at `admin.html`:
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
"adminPage": "admin.html"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Never move a public page off the root to make room for the admin: sign-in links and embeds point at the root.
|
|
240
|
+
|
|
241
|
+
#### `widgets`
|
|
242
|
+
|
|
243
|
+
Declares the widget bundle. Omit if the app has no widget component.
|
|
244
|
+
|
|
245
|
+
| Field | Description |
|
|
246
|
+
|-------|-------------|
|
|
247
|
+
| `files.js.umd` | UMD bundle path — used for dynamic `<script>` loading |
|
|
248
|
+
| `files.js.esm` | ESM bundle path — used for `import()` / native ES modules (optional but recommended) |
|
|
249
|
+
| `files.css` | CSS bundle path — omit if the widget ships no styles |
|
|
250
|
+
| `instanceResolution` | Optional boolean. When `true`, this app supports resolving configured widget instances by ID from app config |
|
|
251
|
+
| `instanceParam` | Optional string. Query/hash param used for instance lookup. Defaults to `"widgetId"` |
|
|
252
|
+
| `components[]` | One entry per exported widget component (see below) |
|
|
253
|
+
|
|
254
|
+
**Widget instance resolution**
|
|
255
|
+
|
|
256
|
+
Apps such as widget toolkits often store reusable widget instances in collection-scoped app config, for example under `config.widgets.launch-countdown`. When your widget bundle can self-configure from one of those stored instances, declare that capability in the manifest:
|
|
257
|
+
|
|
258
|
+
```json
|
|
259
|
+
"widgets": {
|
|
260
|
+
"instanceResolution": true,
|
|
261
|
+
"instanceParam": "widgetId",
|
|
262
|
+
"files": {
|
|
263
|
+
"js": {
|
|
264
|
+
"umd": "dist/widgets.umd.js",
|
|
265
|
+
"esm": "dist/widgets.esm.js"
|
|
266
|
+
},
|
|
267
|
+
"css": null
|
|
268
|
+
},
|
|
269
|
+
"components": [
|
|
270
|
+
{
|
|
271
|
+
"name": "WidgetToolkitResolver",
|
|
272
|
+
"description": "Resolves and renders a configured widget instance by ID."
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
}
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
This tells the platform and other apps that they can deep-link into a stored widget instance using a URL or embed context such as `?appId=widget-toolkit&widgetId=launch-countdown`.
|
|
279
|
+
|
|
280
|
+
**Component fields:**
|
|
281
|
+
|
|
282
|
+
| Field | Type | Description |
|
|
283
|
+
|-------|------|-------------|
|
|
284
|
+
| `name` | string | Exported component name (must match the bundle export) |
|
|
285
|
+
| `description` | string | Human-readable description for portals and AI |
|
|
286
|
+
| `sizes` | string[] | Supported size hints: `"compact"`, `"standard"`, `"large"` |
|
|
287
|
+
| `props.required` | string[] | Props that must be provided for the component to render |
|
|
288
|
+
| `props.optional` | string[] | Props the component can use if provided |
|
|
289
|
+
| `settings` | object | JSON-Schema-style settings the widget accepts from its host |
|
|
290
|
+
|
|
291
|
+
#### `containers`
|
|
292
|
+
|
|
293
|
+
Same structure as `widgets` but declares the full-app container bundle. Lazy-loaded on demand.
|
|
294
|
+
|
|
295
|
+
See the [Containers guide](containers.md) for details on the container component model.
|
|
296
|
+
**Component fields** (same as widgets, plus):
|
|
297
|
+
|
|
298
|
+
| Field | Type | Description |
|
|
299
|
+
|-------|------|--------------|
|
|
300
|
+
| `name` | string | Exported component name |
|
|
301
|
+
| `description` | string | Human-readable description |
|
|
302
|
+
| `props.required` / `props.optional` | string[] | Required and optional prop names |
|
|
303
|
+
| `audience` | `"public"` \| `"admin"` \| `"both"` | Who can use/see this component. Defaults to `"public"`. |
|
|
304
|
+
| `scope` | `"collection"` \| `"product"` | Data scope hint. `"product"` means the component always renders in the context of a specific product. |
|
|
305
|
+
| `settings` | object | JSON Schema describing configurable settings |
|
|
306
|
+
|
|
307
|
+
#### `mobileAdmin`
|
|
308
|
+
|
|
309
|
+
Declares a **separate** mobile admin bundle — a sibling of `containers` with its own build output. Use this when the mobile admin surface needs a different runtime, native-only dependencies (Capacitor), or independent versioning. Omit if your app has no mobile admin surface.
|
|
310
|
+
|
|
311
|
+
See [mobile-admin-container.md](mobile-admin-container.md) for the `AdminMobileHostContext` prop contract, the capability matrix, event stream, error types, and build setup.
|
|
312
|
+
|
|
313
|
+
```json
|
|
314
|
+
"mobileAdmin": {
|
|
315
|
+
"files": {
|
|
316
|
+
"js": {
|
|
317
|
+
"umd": "dist/mobile-admin.umd.js",
|
|
318
|
+
"esm": "dist/mobile-admin.esm.js"
|
|
319
|
+
},
|
|
320
|
+
"css": null
|
|
321
|
+
},
|
|
322
|
+
"components": [
|
|
323
|
+
{
|
|
324
|
+
"name": "WarehousePickContainer",
|
|
325
|
+
"description": "Pick orders by scanning NFC tags",
|
|
326
|
+
"capabilities": ["nfc", "qr"],
|
|
327
|
+
"offline": true
|
|
328
|
+
}
|
|
329
|
+
]
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
| Field | Description |
|
|
334
|
+
|-------|-------------|
|
|
335
|
+
| `files.js.umd` | UMD bundle path — used for dynamic `<script>` loading |
|
|
336
|
+
| `files.js.esm` | ESM bundle path (optional but recommended) |
|
|
337
|
+
| `files.css` | CSS bundle path — set to `null` if no styles |
|
|
338
|
+
| `components[].name` | Exported component name (must match the UMD bundle export) |
|
|
339
|
+
| `components[].description` | Shown in the mobile launcher's app picker |
|
|
340
|
+
| `components[].capabilities` | Hardware capabilities this component needs or can use. See [capability list](mobile-admin-container.md#hardware-capabilities--the-capability-matrix). |
|
|
341
|
+
| `components[].offline` | Set to `true` if this component queues writes locally and needs offline sync support. |
|
|
342
|
+
#### `linkable`
|
|
343
|
+
|
|
344
|
+
Static deep-linkable states built into the app — fixed routes that exist regardless of per-collection content. Declared once at build time.
|
|
345
|
+
|
|
346
|
+
See the [Deep Link Discovery guide](deep-link-discovery.md) for the full dual-source pattern (static manifest routes + dynamic `appConfig.linkable`).
|
|
347
|
+
|
|
348
|
+
These are the app's **pages that a host opens**: portal menus and tabs, and websites that embed the app
|
|
349
|
+
(websites.md → "Using another app's pages"). A host opens them with its own signed-in session, so one
|
|
350
|
+
app can offer several pages that each know the visitor: book, upcoming bookings, past bookings, change a
|
|
351
|
+
booking.
|
|
352
|
+
|
|
353
|
+
```json
|
|
354
|
+
"linkable": [
|
|
355
|
+
{ "id": "book", "title": "Book an appointment", "path": "/",
|
|
356
|
+
"accepts": { "optional": ["service", "staff", "date"] } },
|
|
357
|
+
{ "id": "upcoming", "title": "Your upcoming bookings", "path": "/my-bookings" },
|
|
358
|
+
{ "id": "change", "title": "Change a booking", "path": "/booking",
|
|
359
|
+
"accepts": { "required": ["id"] } }
|
|
360
|
+
]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
| Field | Type | Required | Description |
|
|
364
|
+
|-------|------|----------|-------------|
|
|
365
|
+
| `id` | string | ❌ | Stable id, unique within the app: hosts and sites refer to the page by it |
|
|
366
|
+
| `title` | string | ✅ | Human-readable label shown in menus and offered to AI agents |
|
|
367
|
+
| `path` | string | ❌ | Hash route within the app (defaults to `"/"` if omitted) |
|
|
368
|
+
| `params` | object | ❌ | Params this entry PINS, appended to the URL — do **not** include platform params (`collectionId`, `productId`, etc.) |
|
|
369
|
+
| `accepts` | `{ required?: string[]; optional?: string[] }` | ❌ | The params a host may supply when it opens the page (e.g. which service to start on) |
|
|
370
|
+
|
|
371
|
+
#### `publicViews`
|
|
372
|
+
|
|
373
|
+
Declares the app's **public views** — **standalone, external screens** served over your single public
|
|
374
|
+
bundle (`index.html` → HashRouter): a display board, a kiosk/TV screen, a dashboard, a public share
|
|
375
|
+
page. Without this, those routes/modes are invisible to the platform and the Dev Hub. Each view is a
|
|
376
|
+
`route` + fixed `set` params + caller `params`.
|
|
377
|
+
|
|
378
|
+
> **Public views are NOT portal.** They are completely external and independent. Their only input is
|
|
379
|
+
> **URL parameters** (often a `collectionId`, as a plain param). They expect **no** portal wrapper, **no**
|
|
380
|
+
> host-managed auth/session, and **no** physical-twin context (no QR/NFC/tag scan). They open at a URL
|
|
381
|
+
> and stand alone. For the two **portal** surfaces — where the app renders *inside* portal, and the
|
|
382
|
+
> entry points portal menus link to — see below.
|
|
383
|
+
|
|
384
|
+
```json
|
|
385
|
+
"publicViews": [
|
|
386
|
+
{ "id": "board", "title": "Display board", "route": "/display",
|
|
387
|
+
"params": { "required": ["collectionId"], "optional": ["orientation"] } },
|
|
388
|
+
{ "id": "tv", "title": "TV / big screen", "route": "/", "set": { "tvMode": "true" },
|
|
389
|
+
"params": { "required": ["collectionId", "voteId"] } }
|
|
390
|
+
]
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
| Field | Type | Required | Description |
|
|
394
|
+
|-------|------|----------|-------------|
|
|
395
|
+
| `id` | string | ✅ | Stable id, unique within the app |
|
|
396
|
+
| `title` | string | ✅ | Human label (Dev Hub dropdown, platform pickers) |
|
|
397
|
+
| `route` | string | ❌ | Hash route within the public bundle (defaults to `"/"`) |
|
|
398
|
+
| `set` | object | ❌ | Query params this view PINS (e.g. `{ "tvMode": "true" }`), merged under caller params |
|
|
399
|
+
| `params` | `{ required?: string[]; optional?: string[] }` | ❌ | The params the caller supplies via the URL |
|
|
400
|
+
|
|
401
|
+
Read the URL params with **`SL.readContext()`** (merges hash → search) instead of hand-rolling it.
|
|
402
|
+
|
|
403
|
+
##### The app's page on the business's address (`/_apps/<name>/`)
|
|
404
|
+
|
|
405
|
+
Every installed app with a public page also answers on the business's own address:
|
|
406
|
+
`https://<business>.smartlinks.host/_apps/<name>/#/your-route` (or their own domain). The name defaults to
|
|
407
|
+
the app id without its publisher handle and the business can rename it. There, the platform tells the page
|
|
408
|
+
who it belongs to, so **the URL carries no `collectionId` or `appId`**:
|
|
409
|
+
|
|
410
|
+
- Read context with **`SL.readContext()`**: it fills `collectionId` and `appId` from the page's address
|
|
411
|
+
when the URL doesn't carry them, and `basePath` (`/_apps/<name>`) for building share links:
|
|
412
|
+
`` `https://${location.host}${ctx.basePath ?? ''}/#/play` ``.
|
|
413
|
+
- Build with a **relative base** (`base: './'` in Vite) so assets load under `/_apps/<name>/`.
|
|
414
|
+
- Use hash routes (`#/play`); the path after `/_apps/<name>/` is served the app's `index.html` either way.
|
|
415
|
+
- Never put `collectionId` in your own share links: the address already says which business it is.
|
|
416
|
+
- **Linking to your page from anywhere else** (your admin's "Open the game", a QR code, an email): ask
|
|
417
|
+
where it is with **`await SL.address.page(collectionId, appId)`** and use its `url` plus your route
|
|
418
|
+
(`${link.url}#/play`). Never build `smartlinks.app/apps/<id>/stable/index.html…` by hand: the business
|
|
419
|
+
may have renamed the page, made it its front page, or put it on its own domain, and `url` follows all of
|
|
420
|
+
that. It's a test build's automatic address until the app is live there.
|
|
421
|
+
|
|
422
|
+
##### Public views vs the two portal surfaces
|
|
423
|
+
|
|
424
|
+
An app can have any combination of three setup styles. Only public views are external:
|
|
425
|
+
|
|
426
|
+
| Style | Declared by | Lives | Context |
|
|
427
|
+
|-------|-------------|-------|---------|
|
|
428
|
+
| **Portal components** — where the app renders inside portal (collection / product / batch / variant / proof) | module registry `components.*` (set at publish) | Inside portal | Physical twin (QR/NFC scan) |
|
|
429
|
+
| **App pages** — the entry points portal menus/tabs link to and websites embed (e.g. list vs calendar; book vs my bookings) | `linkable` / `DeepLinkEntry` | Inside a host: portal or a website | The host: its signed-in session, plus the page's `accepts` params |
|
|
430
|
+
| **Public views** — standalone external screens | `publicViews` (this block) | Outside portal | URL params only |
|
|
431
|
+
| **Admin views** — the admin side's screens by name, for its side menu, Studio's menu and the assistant | `adminViews` ([admin-views.md](admin-views.md)) | The admin page, in Studio | Studio's session; `chrome=none` when Studio carries the menu |
|
|
432
|
+
|
|
433
|
+
#### `records`
|
|
434
|
+
|
|
435
|
+
Declares which `app.records` record types the app stores, and which scopes each type supports. Required for any app that follows the [App Records Pattern](app-records-pattern.md). Omit if the app does not use scoped records.
|
|
436
|
+
|
|
437
|
+
The platform and the `<RecordsAdminShell>` from `@proveanything/smartlinks-utils-ui` read this block to render the right scope tabs, rule editor, and cardinality-appropriate right pane.
|
|
438
|
+
|
|
439
|
+
```json
|
|
440
|
+
"records": {
|
|
441
|
+
"<recordType>": {
|
|
442
|
+
"label": "Human-readable label",
|
|
443
|
+
"cardinality": "singleton",
|
|
444
|
+
"allowFacetRules": false,
|
|
445
|
+
"scopes": ["collection", "product", "variant", "batch", "facet"],
|
|
446
|
+
"defaultScope": "product"
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
| Field | Type | Default | Description |
|
|
452
|
+
|-------------------|----------|---------|-------------|
|
|
453
|
+
| `label` | string | — | Human-readable label for the record type, used in headings and tabs. |
|
|
454
|
+
| `cardinality` | string | `'singleton'` | `'singleton'` — one record wins per scope (e.g. ingredients, nutrition). `'collection'` — every matching record is returned in resolution order (e.g. FAQs, recipes). Drives which hook to use on the public side (`useResolvedRecord` vs `useCollectedRecords`) and how the shell lays out the right pane. |
|
|
455
|
+
| `allowFacetRules` | boolean | `false` | When `true`, the shell renders a **Rule** scope tab and embeds `<FacetRuleEditor>`. Add `'rule'` to `scopes` when setting this. |
|
|
456
|
+
| `scopes` | string[] | — | Allowed scope kinds in resolution order. Valid values: `"collection"`, `"product"`, `"variant"`, `"batch"`, `"facet"`, `"proof"`, `"rule"`. `'rule'` is a synthetic scope holding `facetRule`-targeted records. `'collection'` replaces the legacy empty-ref catch-all — **there is no `'global'` scope**. |
|
|
457
|
+
| `defaultScope` | string | — | The scope the "Create new" button targets in the admin shell. Must be one of the declared `scopes`. |
|
|
458
|
+
|
|
459
|
+
An app may declare multiple record types under different keys (e.g. `"nutrition"` and `"cooking_steps"`). See [app-records-pattern.md](app-records-pattern.md) for the full admin + public pattern.
|
|
460
|
+
|
|
461
|
+
#### `executor`
|
|
462
|
+
|
|
463
|
+
Declares the executor bundle — a standalone JS library for programmatic configuration, server-side SEO, and LLM content generation. Omit if the app has no executor.
|
|
464
|
+
|
|
465
|
+
See the **[Executor Model guide](executor.md)** for the full build setup, SEO contract, LLM content contract, and implementation patterns.
|
|
466
|
+
|
|
467
|
+
| Field | Type | Description |
|
|
468
|
+
|-------|------|-------------|
|
|
469
|
+
| `files.js.umd` | string | UMD bundle path |
|
|
470
|
+
| `files.js.esm` | string | ESM bundle path |
|
|
471
|
+
| `factory` | string | Name of the factory function that creates an executor instance |
|
|
472
|
+
| `exports` | string[] | All named exports — tells consumers what's available without loading the bundle |
|
|
473
|
+
| `description` | string | Human-readable summary for AI orchestrators |
|
|
474
|
+
| `llmContent.function` | string | Name of the `getLLMContent` export |
|
|
475
|
+
| `llmContent.timeout` | number | Timeout in ms (default 500) |
|
|
476
|
+
|
|
477
|
+
#### `functions`
|
|
478
|
+
|
|
479
|
+
Declares app-authored **server functions** — server-side handlers `(ctx, event) ⇒ result`
|
|
480
|
+
(http / event / cron), shipped in a self-contained UMD bundle. Omit if the app has no server
|
|
481
|
+
functions. The security model (`visibility`/`authority`/`capabilities`), the runtime surface, how
|
|
482
|
+
to build the bundle, and how to invoke are all in the **[Server Functions guide](server-functions.md)** —
|
|
483
|
+
this is just the manifest shape.
|
|
484
|
+
|
|
485
|
+
| Field | Type | Description |
|
|
486
|
+
|-------|------|-------------|
|
|
487
|
+
| `files.js.umd` | string | UMD bundle path, relative to the published build like the other bundles (e.g. `functions.umd.js`, built to `dist/functions.umd.js`) — a self-contained bundle exporting each handler by name |
|
|
488
|
+
| `definitions[]` | object[] | One entry per function |
|
|
489
|
+
| `definitions[].name` | string | Function name; also the handler export name (override with `handler`) |
|
|
490
|
+
| `definitions[].trigger` | object | `{ type: "http"|"event"|"cron", … }` |
|
|
491
|
+
| `definitions[].visibility` | string | `admin` \| `public` (http only) — who may call it |
|
|
492
|
+
| `definitions[].userGroups` | string[] | http only — the [user groups](user-groups.md) (by key) allowed to call it; the caller must be in at least one, or be a collection admin |
|
|
493
|
+
| `definitions[].authority` | string | `caller` \| `collection` — whose authority it runs as |
|
|
494
|
+
| `definitions[].capabilities` | string[] | Least-privilege grants (`sl:<res>:<read\|write>`, `network[:<host>]`, `secrets:<ref>`) |
|
|
495
|
+
|
|
496
|
+
#### `connector`
|
|
497
|
+
|
|
498
|
+
Marks the app as an integration **connector** for one external provider: the integrations console
|
|
499
|
+
lists it and draws its connect form and settings, and the integration engine calls its server
|
|
500
|
+
functions (`testConnection`, `describeTarget`, `sample`, `fetch`, `shape`, `serialize`, `send`). It adapts the provider's format; core does each customer's mapping. The full
|
|
501
|
+
contract is in the **[Connectors guide](connectors.md)**.
|
|
502
|
+
|
|
503
|
+
#### `assistant`
|
|
504
|
+
|
|
505
|
+
What the **Studio assistant** (the admin's own agent) knows about this app: skills and knowledge files
|
|
506
|
+
shipped with the build and loaded into its box on demand, and an optional page that renders a planned
|
|
507
|
+
change set before it is applied.
|
|
508
|
+
|
|
509
|
+
```jsonc
|
|
510
|
+
"assistant": {
|
|
511
|
+
"skills": [
|
|
512
|
+
{ "name": "theme", "description": "Changing the Hub's colours, fonts or logo", "file": "assistant/skills/theme.md" },
|
|
513
|
+
{ "name": "pages", "description": "Adding, ordering and editing pages and the menu", "file": "assistant/skills/pages.md" }
|
|
514
|
+
],
|
|
515
|
+
"knowledge": [
|
|
516
|
+
{ "name": "settings-schema", "description": "JSON Schema of the hub settings group", "file": "assistant/knowledge/settings.schema.json" }
|
|
517
|
+
],
|
|
518
|
+
"preview": "/admin/preview?changeSet={id}"
|
|
519
|
+
}
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
The files live under `public/assistant/` and ship with every release like any other static file. The
|
|
523
|
+
assistant sees one line per skill (its description) and reads the file only when the job calls for it,
|
|
524
|
+
so a big app can carry many skills at no cost to the conversation. Full guide, including what a skill
|
|
525
|
+
should say and how the assistant changes config with undo: **[assistant-apps.md](assistant-apps.md)**.
|
|
526
|
+
|
|
527
|
+
---
|
|
528
|
+
|
|
529
|
+
#### `docs`
|
|
530
|
+
|
|
531
|
+
The app's manual, for the people who use it: Markdown pages under `public/docs/`, shipped with every
|
|
532
|
+
release. For first-party apps, docs.smartlinks.app reads the stable release's pages directly, so
|
|
533
|
+
releasing the app publishes its manual.
|
|
534
|
+
|
|
535
|
+
```jsonc
|
|
536
|
+
"docs": {
|
|
537
|
+
"pages": [
|
|
538
|
+
{ "file": "docs/index.md", "title": "Messages", "description": "Send campaigns and answer people in one inbox.", "audience": "team" },
|
|
539
|
+
{ "file": "docs/setup.md", "title": "Setting up", "audience": "admin" }
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
```
|
|
543
|
+
|
|
544
|
+
The first page is the front page. `audience` is `team` (default), `admin`, `customer` or `developer`.
|
|
545
|
+
`listed: false` keeps a manual off the docs site. What to write and how: **[app-docs.md](app-docs.md)**.
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
## `app.admin.json`
|
|
550
|
+
|
|
551
|
+
Fetched only by the admin UI and AI-assisted setup flows — never loaded on the public-facing page. Keep setup logic and configuration schemas here, not in the manifest.
|
|
552
|
+
|
|
553
|
+
### Full Schema
|
|
554
|
+
|
|
555
|
+
```json
|
|
556
|
+
{
|
|
557
|
+
"$schema": "https://smartlinks.app/schemas/app-admin-v1.json",
|
|
558
|
+
|
|
559
|
+
"aiGuide": "ai-guide.md",
|
|
560
|
+
|
|
561
|
+
"setup": {
|
|
562
|
+
"description": "Configure the app for this collection.",
|
|
563
|
+
"questions": [
|
|
564
|
+
{
|
|
565
|
+
"id": "brandName",
|
|
566
|
+
"prompt": "What is your brand name?",
|
|
567
|
+
"type": "text",
|
|
568
|
+
"required": true
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
"id": "primaryColor",
|
|
572
|
+
"prompt": "Choose a primary theme colour.",
|
|
573
|
+
"type": "select",
|
|
574
|
+
"options": [
|
|
575
|
+
{ "value": "blue", "label": "Blue" },
|
|
576
|
+
{ "value": "green", "label": "Green" },
|
|
577
|
+
{ "value": "red", "label": "Red" }
|
|
578
|
+
]
|
|
579
|
+
},
|
|
580
|
+
{
|
|
581
|
+
"id": "welcomeEnabled",
|
|
582
|
+
"prompt": "Show a welcome message to first-time visitors?",
|
|
583
|
+
"type": "boolean",
|
|
584
|
+
"default": true
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
"configSchema": {
|
|
588
|
+
"brandName": { "type": "string" },
|
|
589
|
+
"primaryColor": { "type": "string" },
|
|
590
|
+
"welcomeEnabled": { "type": "boolean" }
|
|
591
|
+
},
|
|
592
|
+
"saveWith": {
|
|
593
|
+
"method": "appConfiguration.setConfig",
|
|
594
|
+
"scope": "collection",
|
|
595
|
+
"admin": true,
|
|
596
|
+
"note": "Saved under the collection scope; readable by all app users."
|
|
597
|
+
},
|
|
598
|
+
"contentHints": {
|
|
599
|
+
"welcomeMessage": {
|
|
600
|
+
"aiGenerate": true,
|
|
601
|
+
"prompt": "Write a short, friendly welcome message for a brand called {{brandName}}."
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
},
|
|
605
|
+
|
|
606
|
+
"import": {
|
|
607
|
+
"description": "Bulk-import items via CSV.",
|
|
608
|
+
"scope": "collection",
|
|
609
|
+
"fields": [
|
|
610
|
+
{ "name": "title", "type": "string", "required": true },
|
|
611
|
+
{ "name": "description", "type": "string" },
|
|
612
|
+
{ "name": "imageUrl", "type": "string" },
|
|
613
|
+
{ "name": "price", "type": "number", "default": 0 }
|
|
614
|
+
],
|
|
615
|
+
"csvExample": "title,description,imageUrl,price\nWidget A,Our first widget,https://example.com/img.jpg,9.99",
|
|
616
|
+
"saveWith": {
|
|
617
|
+
"method": "appObjects.createRecord",
|
|
618
|
+
"scope": "collection",
|
|
619
|
+
"admin": true
|
|
620
|
+
}
|
|
621
|
+
},
|
|
622
|
+
|
|
623
|
+
"tunable": {
|
|
624
|
+
"description": "Adjust display options after initial setup.",
|
|
625
|
+
"fields": [
|
|
626
|
+
{
|
|
627
|
+
"name": "displayMode",
|
|
628
|
+
"description": "How items are laid out on the page.",
|
|
629
|
+
"type": "select",
|
|
630
|
+
"options": ["grid", "list", "carousel"]
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
"name": "itemsPerPage",
|
|
634
|
+
"description": "Number of items shown per page.",
|
|
635
|
+
"type": "number"
|
|
636
|
+
}
|
|
637
|
+
]
|
|
638
|
+
},
|
|
639
|
+
|
|
640
|
+
"metrics": {
|
|
641
|
+
"interactions": [
|
|
642
|
+
{ "id": "view", "description": "User viewed an item." },
|
|
643
|
+
{ "id": "click", "description": "User clicked a link or CTA." },
|
|
644
|
+
{ "id": "purchase", "description": "User completed a purchase." }
|
|
645
|
+
],
|
|
646
|
+
"kpis": [
|
|
647
|
+
{ "name": "Click-through Rate", "compute": "click / view" },
|
|
648
|
+
{ "name": "Conversion Rate", "compute": "purchase / view" }
|
|
649
|
+
]
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
```
|
|
653
|
+
|
|
654
|
+
> `dynamic-select` widget pickers are a reasonable future extension for admin schemas, but they are not a built-in question type in the SDK today. For now, treat widget-instance selection as an app-level UI convention powered by `appConfiguration.listWidgetInstances()`.
|
|
655
|
+
|
|
656
|
+
### Field Reference
|
|
657
|
+
|
|
658
|
+
#### `aiGuide`
|
|
659
|
+
|
|
660
|
+
Path (relative to the app's public root) to a Markdown file providing natural-language context for AI-assisted configuration. See the [AI Guide Template](ai-guide-template.md).
|
|
661
|
+
|
|
662
|
+
```json
|
|
663
|
+
"aiGuide": "ai-guide.md"
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
#### `setup`
|
|
669
|
+
|
|
670
|
+
Drives the initial configuration wizard shown to admins when they first install the app for a collection.
|
|
671
|
+
|
|
672
|
+
| Field | Type | Description |
|
|
673
|
+
|-------|------|-------------|
|
|
674
|
+
| `description` | string | Intro text shown at the top of the setup wizard |
|
|
675
|
+
| `questions` | array | Ordered list of questions to ask the admin (see below) |
|
|
676
|
+
| `configSchema` | object | JSON-Schema-style shape of the resulting config object |
|
|
677
|
+
| `saveWith` | object | Which SDK method and scope to use when persisting answers |
|
|
678
|
+
| `contentHints` | object | Keys that AI should auto-generate based on question answers |
|
|
679
|
+
|
|
680
|
+
**`questions[]` fields:**
|
|
681
|
+
|
|
682
|
+
| Field | Type | Required | Description |
|
|
683
|
+
|-------|------|----------|-------------|
|
|
684
|
+
| `id` | string | ✅ | Key used in the saved config and in `contentHints` references |
|
|
685
|
+
| `prompt` | string | ✅ | Question text displayed to the admin |
|
|
686
|
+
| `type` | string | ✅ | Input type: `"text"`, `"number"`, `"boolean"`, `"select"`, `"multiselect"`, `"textarea"` |
|
|
687
|
+
| `required` | boolean | ❌ | Whether an answer is mandatory (default `false`) |
|
|
688
|
+
| `default` | any | ❌ | Pre-filled default value |
|
|
689
|
+
| `options` | array | ❌ | For `select`/`multiselect`: `[{ "value": "...", "label": "..." }]` |
|
|
690
|
+
|
|
691
|
+
**`saveWith` fields:**
|
|
692
|
+
|
|
693
|
+
| Field | Type | Description |
|
|
694
|
+
|-------|------|-------------|
|
|
695
|
+
| `method` | string | SDK method to call, e.g. `"appConfiguration.setConfig"` |
|
|
696
|
+
| `scope` | string | Data scope: `"collection"`, `"product"`, or `"proof"` |
|
|
697
|
+
| `admin` | boolean | Whether the save call requires admin credentials |
|
|
698
|
+
| `note` | string | Human-readable note explaining the save behaviour |
|
|
699
|
+
|
|
700
|
+
**`contentHints`:**
|
|
701
|
+
|
|
702
|
+
A map from content key to AI generation instructions. The AI setup flow uses this to pre-fill content fields after the admin answers setup questions.
|
|
703
|
+
|
|
704
|
+
```json
|
|
705
|
+
"contentHints": {
|
|
706
|
+
"welcomeMessage": {
|
|
707
|
+
"aiGenerate": true,
|
|
708
|
+
"prompt": "Write a short welcome message for a brand called {{brandName}}."
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
```
|
|
712
|
+
|
|
713
|
+
---
|
|
714
|
+
|
|
715
|
+
#### `import`
|
|
716
|
+
|
|
717
|
+
Defines a CSV bulk-import flow available in the admin UI.
|
|
718
|
+
|
|
719
|
+
| Field | Type | Description |
|
|
720
|
+
|-------|------|-------------|
|
|
721
|
+
| `description` | string | Explains what will be imported and how |
|
|
722
|
+
| `scope` | string | Data scope for the imported records |
|
|
723
|
+
| `fields` | array | Column definitions — `name`, `type`, `required`, `default`, `description` |
|
|
724
|
+
| `csvExample` | string | A sample CSV string (shown as a download template) |
|
|
725
|
+
| `saveWith` | object | SDK method used to persist each imported row (same shape as `setup.saveWith`) |
|
|
726
|
+
|
|
727
|
+
---
|
|
728
|
+
|
|
729
|
+
#### `tunable`
|
|
730
|
+
|
|
731
|
+
Post-setup display options that admins can tweak without re-running the full setup wizard.
|
|
732
|
+
|
|
733
|
+
| Field | Type | Description |
|
|
734
|
+
|-------|------|-------------|
|
|
735
|
+
| `description` | string | Explains what these settings control |
|
|
736
|
+
| `fields` | array | Tunable parameters — `name`, `description`, `type`, `options[]` |
|
|
737
|
+
|
|
738
|
+
---
|
|
739
|
+
|
|
740
|
+
#### `metrics`
|
|
741
|
+
|
|
742
|
+
Declares what interactions and KPIs the app reports. Used by the platform's analytics dashboard.
|
|
743
|
+
|
|
744
|
+
| Field | Type | Description |
|
|
745
|
+
|-------|------|-------------|
|
|
746
|
+
| `interactions` | array | Interaction event types: `{ id, description }` |
|
|
747
|
+
| `kpis` | array | Derived metrics: `{ name, compute }` — `compute` is a simple expression over interaction IDs |
|
|
748
|
+
|
|
749
|
+
---
|
|
750
|
+
|
|
751
|
+
## Widget settings schema (JSON Schema)
|
|
752
|
+
|
|
753
|
+
Each widget component's `settings` object uses **JSON Schema** to describe its configurable props, so schema-form renderers *and* AI orchestrators can auto-generate a config UI without per-widget code:
|
|
754
|
+
|
|
755
|
+
```json
|
|
756
|
+
"components": [
|
|
757
|
+
{
|
|
758
|
+
"name": "MyWidget",
|
|
759
|
+
"description": "What this widget does",
|
|
760
|
+
"sizes": ["compact", "standard", "large"],
|
|
761
|
+
"settings": {
|
|
762
|
+
"type": "object",
|
|
763
|
+
"properties": {
|
|
764
|
+
"displayMode": {
|
|
765
|
+
"type": "string", "title": "Display Mode",
|
|
766
|
+
"description": "How the widget renders",
|
|
767
|
+
"enum": ["compact", "standard", "large"],
|
|
768
|
+
"enumLabels": { "compact": "Icons only", "standard": "With names", "large": "Full cards" },
|
|
769
|
+
"default": "standard", "order": 1
|
|
770
|
+
},
|
|
771
|
+
"showImage": { "type": "boolean", "title": "Show Product Image", "default": true, "order": 2 }
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
]
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
| Field | Purpose |
|
|
779
|
+
|-------|---------|
|
|
780
|
+
| `type`, `enum` | Standard JSON Schema validation |
|
|
781
|
+
| `title` | Human-readable form label |
|
|
782
|
+
| `description` | Help text shown alongside the field |
|
|
783
|
+
| `enumLabels` | Friendly display names for enum values (`{ value → label }`) |
|
|
784
|
+
| `default` | Pre-selected value when no config exists |
|
|
785
|
+
| `order` | Field display order (lower number = higher) |
|
|
786
|
+
|
|
787
|
+
The schema serves both AI orchestrators (understand what a widget accepts, configure it conversationally) and schema-form renderers (auto-generate settings UIs).
|
|
788
|
+
|
|
789
|
+
## AI workflows the manifest enables
|
|
790
|
+
|
|
791
|
+
SmartLinks manifests are **AI-discoverable, -configurable, and -importable**: the structured manifest plus the prose `ai-guide.md` (start from [ai-guide-template.md](ai-guide-template.md)) let AI systems set up and populate apps without custom integration code. Three workflows read the manifest:
|
|
792
|
+
|
|
793
|
+
1. **Widget Builder** — reads `widgets.components[]` and each `settings` schema to embed a widget with correct props and auto-render its configuration UI.
|
|
794
|
+
2. **Setup Wizard** — reads `setup` from `app.admin.json`: walks `setup.questions[]`, validates against `setup.configSchema`, optionally auto-generates content via `SL.ai`, then saves per `setup.saveWith`.
|
|
795
|
+
3. **Data Importer** — reads `import` from `app.admin.json`: builds a CSV template from `import.fields[]`, normalises rows, and calls `import.saveWith.method` per row (multi-app imports merge fields into one CSV).
|
|
796
|
+
|
|
797
|
+
When you change your config shape, keep all three in sync: `app.manifest.json` (widget `settings`, containers, executor, linkable), `app.admin.json` (setup / import / tunable), and `ai-guide.md` (prose guidance).
|
|
798
|
+
|
|
799
|
+
This declarative model is canonical and works today. An app may **optionally** layer agent tools on top — a function that reads the declaration and returns a *context-adapted* result (e.g. "which setup questions for this collection?") — without changing the schema. That's additive and opt-in; see [agent-tools.md](agent-tools.md).
|
|
800
|
+
|
|
801
|
+
## Reading the Files at Runtime
|
|
802
|
+
|
|
803
|
+
### Manifest — available from the widgets endpoint
|
|
804
|
+
|
|
805
|
+
```typescript
|
|
806
|
+
import { appObjects } from '@proveanything/smartlinks';
|
|
807
|
+
import type { AppManifest, AppAdminConfig } from '@proveanything/smartlinks';
|
|
808
|
+
|
|
809
|
+
// The manifest arrives inline in the widgets response
|
|
810
|
+
const { apps } = await SL.collection.getWidgets(collectionId);
|
|
811
|
+
const { manifest, widget, container, admin: adminUrl } = apps[0];
|
|
812
|
+
|
|
813
|
+
// manifest.meta.name, manifest.linkable, manifest.widgets.components, …
|
|
814
|
+
```
|
|
815
|
+
|
|
816
|
+
### Admin config — fetch separately, only when needed
|
|
817
|
+
|
|
818
|
+
```typescript
|
|
819
|
+
// adminUrl is the fully-resolved URL from CollectionAppWidget.admin
|
|
820
|
+
if (adminUrl) {
|
|
821
|
+
const adminConfig: AppAdminConfig = await fetch(adminUrl).then(r => r.json());
|
|
822
|
+
// adminConfig.setup.questions, adminConfig.tunable.fields, …
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
---
|
|
827
|
+
|
|
828
|
+
## TypeScript Types
|
|
829
|
+
|
|
830
|
+
```typescript
|
|
831
|
+
import type {
|
|
832
|
+
AppManifest, // app.manifest.json
|
|
833
|
+
AppAdminConfig, // app.admin.json
|
|
834
|
+
DeepLinkEntry, // one entry in manifest.linkable or appConfig.linkable
|
|
835
|
+
AppWidgetComponent, // one entry in manifest.widgets.components
|
|
836
|
+
AppContainerComponent,
|
|
837
|
+
AppManifestExecutor, // executor block in app.manifest.json
|
|
838
|
+
AppBundle, // { js, css, source?, styles? }
|
|
839
|
+
AppManifestFiles, // { js: { umd, esm? }, css? }
|
|
840
|
+
CollectionAppWidget, // one app in the /widgets response
|
|
841
|
+
CollectionWidgetsResponse,
|
|
842
|
+
// Executor types
|
|
843
|
+
ExecutorContext, // { collectionId, appId, SL }
|
|
844
|
+
SEOInput,
|
|
845
|
+
SEOResult,
|
|
846
|
+
LLMContentInput,
|
|
847
|
+
LLMContentResult,
|
|
848
|
+
LLMContentSection,
|
|
849
|
+
} from '@proveanything/smartlinks';
|
|
850
|
+
```
|
|
851
|
+
|
|
852
|
+
All types live in `src/types/appManifest.ts`.
|