@syntrologie/runtime-sdk 2.8.0-canary.13 → 2.8.0-canary.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CAPABILITIES.md +321 -173
  2. package/README.md +3 -0
  3. package/dist/SmartCanvasApp.d.ts +4 -1
  4. package/dist/SmartCanvasElementLit.d.ts +166 -0
  5. package/dist/actions/schema.d.ts +783 -783
  6. package/dist/actions/schema.js +3 -3
  7. package/dist/actions/types.d.ts +9 -3
  8. package/dist/actions/validation-core.d.ts +24 -0
  9. package/dist/actions/validation-rules.d.ts +74 -0
  10. package/dist/actions/validation.d.ts +5 -11
  11. package/dist/anchor/AnchorResolver.d.ts +1 -0
  12. package/dist/api-lit.d.ts +84 -0
  13. package/dist/api.d.ts +3 -0
  14. package/dist/apps/builtinRuntimeModules-lit.d.ts +20 -0
  15. package/dist/bootstrap-init.d.ts +35 -0
  16. package/dist/bootstrap-runtime.d.ts +7 -0
  17. package/dist/bootstrap-types.d.ts +100 -0
  18. package/dist/bootstrap.d.ts +19 -83
  19. package/dist/chunk-2IQ2PTLJ.js +871 -0
  20. package/dist/chunk-2IQ2PTLJ.js.map +7 -0
  21. package/dist/chunk-4HXPGXUC.js +226 -0
  22. package/dist/chunk-4HXPGXUC.js.map +7 -0
  23. package/dist/{chunk-37TTQRH5.js → chunk-GX7BBYX6.js} +4 -4
  24. package/dist/chunk-GX7BBYX6.js.map +7 -0
  25. package/dist/{chunk-G4PH7C7H.js → chunk-SC5B3YCG.js} +2702 -1442
  26. package/dist/chunk-SC5B3YCG.js.map +7 -0
  27. package/dist/{chunk-NBFQGKSV.js → chunk-XVRDKBYF.js} +4 -4
  28. package/dist/{chunk-NBFQGKSV.js.map → chunk-XVRDKBYF.js.map} +2 -2
  29. package/dist/components/ShadowCanvasOverlay.d.ts +1 -2
  30. package/dist/components/SyntroCanvasOverlay.d.ts +100 -0
  31. package/dist/components/SyntroDrawer.d.ts +110 -0
  32. package/dist/components/SyntroLauncher.d.ts +105 -0
  33. package/dist/components/SyntroTileCard.d.ts +74 -0
  34. package/dist/components/SyntroTileWheel.d.ts +51 -0
  35. package/dist/config/schema.d.ts +147 -136
  36. package/dist/config/schema.js +2 -2
  37. package/dist/controllers/DecisionController.d.ts +48 -0
  38. package/dist/controllers/NotificationsController.d.ts +59 -0
  39. package/dist/controllers/RuntimeController.d.ts +52 -0
  40. package/dist/controllers/RuntimeEventsController.d.ts +42 -0
  41. package/dist/controllers/ThemeController.d.ts +110 -0
  42. package/dist/controllers/index.d.ts +13 -0
  43. package/dist/decisions/schema.d.ts +47 -47
  44. package/dist/decisions/schema.js +1 -1
  45. package/dist/decisions/types.d.ts +4 -0
  46. package/dist/editorLoader.d.ts +5 -0
  47. package/dist/events/EventBus.d.ts +27 -1
  48. package/dist/events/history.d.ts +9 -0
  49. package/dist/events/index.d.ts +3 -0
  50. package/dist/events/types.d.ts +24 -0
  51. package/dist/events/validation.d.ts +7 -0
  52. package/dist/fetchers/experimentsFetcher.d.ts +3 -3
  53. package/dist/fetchers/mergeConfigs.d.ts +7 -7
  54. package/dist/index-lit.d.ts +40 -0
  55. package/dist/index.d.ts +1 -2
  56. package/dist/index.js +2435 -2022
  57. package/dist/index.js.map +4 -4
  58. package/dist/interop/LitInReact.d.ts +27 -0
  59. package/dist/interop/ReactInLit.d.ts +42 -0
  60. package/dist/interop/index.d.ts +7 -0
  61. package/dist/metrics/sessionMetrics.d.ts +4 -0
  62. package/dist/notifications/SyntroToastStack.d.ts +43 -0
  63. package/dist/overlays/runtime/overlay/overlay-runner.d.ts +4 -0
  64. package/dist/overlays/runtime/overlay/overlay-state.d.ts +21 -0
  65. package/dist/overlays/types.d.ts +3 -1
  66. package/dist/platform/PlatformAdapter.d.ts +46 -0
  67. package/dist/platform/ShopifyAdapter.d.ts +36 -0
  68. package/dist/platform/ShopifyAnchorResolver.d.ts +31 -0
  69. package/dist/platform/ShopifyAntiFlicker.d.ts +21 -0
  70. package/dist/platform/ShopifyPixelBridge.d.ts +37 -0
  71. package/dist/platform/detect.d.ts +9 -0
  72. package/dist/platform/index.d.ts +10 -0
  73. package/dist/platform/shopify-cookie-contract.d.ts +39 -0
  74. package/dist/react-compat.d.ts +114 -0
  75. package/dist/react.js +7 -4
  76. package/dist/react.js.map +2 -2
  77. package/dist/shopify-pixel-entry.d.ts +68 -0
  78. package/dist/shopify-pixel.js +77 -0
  79. package/dist/shopify-pixel.js.map +7 -0
  80. package/dist/shopify-pixel.min.js +2 -0
  81. package/dist/shopify-pixel.min.js.map +7 -0
  82. package/dist/smart-canvas.esm.js +858 -258
  83. package/dist/smart-canvas.esm.js.map +4 -4
  84. package/dist/smart-canvas.js +28024 -36411
  85. package/dist/smart-canvas.js.map +4 -4
  86. package/dist/smart-canvas.min.js +857 -258
  87. package/dist/smart-canvas.min.js.map +4 -4
  88. package/dist/telemetry/InterventionTracker.d.ts +23 -0
  89. package/dist/telemetry/adapters/posthog.d.ts +5 -10
  90. package/dist/telemetry/index.d.ts +1 -0
  91. package/dist/test/setup.d.ts +1 -0
  92. package/dist/theme/index.js +30 -0
  93. package/dist/theme/index.js.map +7 -0
  94. package/dist/token.d.ts +2 -0
  95. package/dist/version.d.ts +1 -1
  96. package/package.json +32 -29
  97. package/schema/canvas-config.schema.json +2345 -11394
  98. package/scripts/syntroReactPlugin.mjs +3 -0
  99. package/scripts/validate-config.mjs +42 -0
  100. package/dist/chunk-37TTQRH5.js.map +0 -7
  101. package/dist/chunk-G4PH7C7H.js.map +0 -7
  102. package/dist/chunk-Q77NT67W.js +0 -203
  103. package/dist/chunk-Q77NT67W.js.map +0 -7
  104. package/dist/replayMirror-QZ3GQ527.js +0 -32
  105. package/dist/replayMirror-QZ3GQ527.js.map +0 -7
  106. package/dist/telemetry/replayMirror.d.ts +0 -7
package/CAPABILITIES.md CHANGED
@@ -54,8 +54,8 @@ Change a page header when the element is visible:
54
54
  },
55
55
  "actions": [
56
56
  {
57
- "kind": "set_text",
58
- "anchorId": "h1.hero-title",
57
+ "kind": "content:setText",
58
+ "anchorId": { "selector": "h1.hero-title", "route": "/" },
59
59
  "text": "Welcome to Our New Experience"
60
60
  }
61
61
  ]
@@ -72,6 +72,7 @@ The SDK includes the following adaptive packages, each providing specific capabi
72
72
  - [@syntrologie/adapt-content](#syntrologieadapt-content)
73
73
  - [@syntrologie/adapt-faq](#syntrologieadapt-faq)
74
74
  - [@syntrologie/adapt-gamification](#syntrologieadapt-gamification)
75
+ - [@syntrologie/adapt-mcp](#syntrologieadapt-mcp)
75
76
  - [@syntrologie/adapt-nav](#syntrologieadapt-nav)
76
77
  - [@syntrologie/adapt-overlays](#syntrologieadapt-overlays)
77
78
 
@@ -160,62 +161,73 @@ The widget reads auth credentials from the browser:
160
161
 
161
162
  DOM content modification capabilities for text, attributes, styles, HTML, and classes.
162
163
 
164
+ ## When to use
165
+
166
+ | Goal | Action |
167
+ |------|--------|
168
+ | Replace an element's text | `content:setText` |
169
+ | Change an HTML attribute (href, src, data-*) | `content:setAttr` |
170
+ | Modify inline styles (color, size, spacing) | `content:setStyle` |
171
+ | Inject new HTML before/after/inside an element | `content:insertHtml` |
172
+ | Add a CSS class (show/hide, animate) | `content:addClass` |
173
+ | Remove a CSS class | `content:removeClass` |
174
+
163
175
  ## Actions
164
176
 
165
- ### set_text
177
+ ### content:setText
166
178
 
167
179
  Replaces the text content of an element.
168
180
 
169
- | Property | Type | Required | Description |
170
- | ---------- | ------------ | -------- | ---------------- |
171
- | `kind` | `"set_text"` | Yes | Action type |
172
- | `anchorId` | string | Yes | Element selector |
173
- | `text` | string | Yes | New text content |
181
+ | Property | Type | Required | Description |
182
+ | ---------- | ------------------- | -------- | ---------------- |
183
+ | `kind` | `"content:setText"` | Yes | Action type |
184
+ | `anchorId` | object | Yes | `{ selector, route }` |
185
+ | `text` | string | Yes | New text content |
174
186
 
175
187
  ```json
176
188
  {
177
- "kind": "set_text",
178
- "anchorId": "h1.hero-title",
189
+ "kind": "content:setText",
190
+ "anchorId": { "selector": "h1.hero-title", "route": "/" },
179
191
  "text": "Start Your Free Trial Today"
180
192
  }
181
193
  ```
182
194
 
183
- ### set_attr
195
+ ### content:setAttr
184
196
 
185
197
  Sets an HTML attribute on an element.
186
198
 
187
- | Property | Type | Required | Description |
188
- | ---------- | ------------ | -------- | ---------------- |
189
- | `kind` | `"set_attr"` | Yes | Action type |
190
- | `anchorId` | string | Yes | Element selector |
191
- | `attr` | string | Yes | Attribute name |
192
- | `value` | string | Yes | Attribute value |
199
+ | Property | Type | Required | Description |
200
+ | ---------- | ------------------- | -------- | ---------------- |
201
+ | `kind` | `"content:setAttr"` | Yes | Action type |
202
+ | `anchorId` | object | Yes | `{ selector, route }` |
203
+ | `attr` | string | Yes | Attribute name |
204
+ | `value` | string | Yes | Attribute value |
193
205
 
194
206
  **Blocked attributes:** Event handlers (`onclick`, `onerror`, etc.) are not allowed.
195
207
 
196
208
  ```json
197
209
  {
198
- "kind": "set_attr",
199
- "anchorId": "#signup-form",
210
+ "kind": "content:setAttr",
211
+ "anchorId": { "selector": "#signup-form", "route": "/" },
200
212
  "attr": "data-experiment",
201
213
  "value": "signup-v2"
202
214
  }
203
215
  ```
204
216
 
205
- ### set_style
217
+ ### content:setStyle
206
218
 
207
219
  Sets inline CSS styles on an element.
208
220
 
209
- | Property | Type | Required | Description |
210
- | ---------- | ------------- | -------- | ------------------------ |
211
- | `kind` | `"set_style"` | Yes | Action type |
212
- | `anchorId` | string | Yes | Element selector |
213
- | `styles` | object | Yes | CSS property/value pairs |
221
+ | Property | Type | Required | Description |
222
+ | ---------- | -------------------- | -------- | ------------------------ |
223
+ | `kind` | `"content:setStyle"` | Yes | Action type |
224
+ | `anchorId` | object | Yes | `{ selector, route }` |
225
+ | `styles` | object | Yes | CSS property/value pairs |
214
226
 
215
227
  ```json
216
228
  {
217
- "kind": "set_style",
218
- "anchorId": ".hero-section",
229
+ "kind": "content:setStyle",
230
+ "anchorId": { "selector": ".hero-section", "route": "/" },
219
231
  "styles": {
220
232
  "background-color": "#1e40af",
221
233
  "padding": "2rem"
@@ -223,17 +235,17 @@ Sets inline CSS styles on an element.
223
235
  }
224
236
  ```
225
237
 
226
- ### insert_html
238
+ ### content:insertHtml
227
239
 
228
240
  Inserts HTML content relative to an element.
229
241
 
230
- | Property | Type | Required | Description |
231
- | ---------- | --------------- | -------- | ----------------------------------------------------------- |
232
- | `kind` | `"insert_html"` | Yes | Action type |
233
- | `anchorId` | string | Yes | Element selector |
234
- | `html` | string | Yes | HTML content (sanitized) |
235
- | `position` | string | Yes | `"before"`, `"after"`, `"prepend"`, `"append"`, `"replace"` |
236
- | `deepLink` | object | No | Makes the entire inserted element clickable to open the canvas panel and navigate to a specific tile |
242
+ | Property | Type | Required | Description |
243
+ | ---------- | --------------------- | -------- | ----------------------------------------------------------- |
244
+ | `kind` | `"content:insertHtml"` | Yes | Action type |
245
+ | `anchorId` | object | Yes | `{ selector, route }` |
246
+ | `html` | string | Yes | HTML content (sanitized) |
247
+ | `position` | string | Yes | `"before"`, `"after"`, `"prepend"`, `"append"`, `"replace"` |
248
+ | `deepLink` | object | No | Makes the entire inserted element clickable to open the canvas panel and navigate to a specific tile |
237
249
 
238
250
  **Positions:**
239
251
 
@@ -245,8 +257,8 @@ Inserts HTML content relative to an element.
245
257
 
246
258
  ```json
247
259
  {
248
- "kind": "insert_html",
249
- "anchorId": ".cta-button",
260
+ "kind": "content:insertHtml",
261
+ "anchorId": { "selector": ".cta-button", "route": "/" },
250
262
  "html": "<span class=\"badge\">NEW</span>",
251
263
  "position": "append"
252
264
  }
@@ -263,8 +275,8 @@ Use `deepLink` to make inserted content open the canvas panel and navigate to a
263
275
 
264
276
  ```json
265
277
  {
266
- "kind": "insert_html",
267
- "anchorId": "[data-id='pricing-heading']",
278
+ "kind": "content:insertHtml",
279
+ "anchorId": { "selector": "[data-id='pricing-heading']", "route": "/" },
268
280
  "html": "<button style='background: #4a90e2; color: white; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer;'>Help Me Choose</button>",
269
281
  "position": "after",
270
282
  "deepLink": { "tileId": "plan_selector_faq" }
@@ -273,38 +285,38 @@ Use `deepLink` to make inserted content open the canvas panel and navigate to a
273
285
 
274
286
  The SDK automatically handles opening the canvas, setting the cursor to pointer, and publishing a `notification.deep_link` event. The click handler is wired up and cleaned up by the SDK — no JavaScript in the HTML is needed.
275
287
 
276
- ### add_class
288
+ ### content:addClass
277
289
 
278
290
  Adds a CSS class to an element.
279
291
 
280
- | Property | Type | Required | Description |
281
- | ----------- | ------------- | -------- | ----------------- |
282
- | `kind` | `"add_class"` | Yes | Action type |
283
- | `anchorId` | string | Yes | Element selector |
284
- | `className` | string | Yes | Class name to add |
292
+ | Property | Type | Required | Description |
293
+ | ----------- | -------------------- | -------- | ----------------- |
294
+ | `kind` | `"content:addClass"` | Yes | Action type |
295
+ | `anchorId` | object | Yes | `{ selector, route }` |
296
+ | `className` | string | Yes | Class name to add |
285
297
 
286
298
  ```json
287
299
  {
288
- "kind": "add_class",
289
- "anchorId": ".pricing-card",
300
+ "kind": "content:addClass",
301
+ "anchorId": { "selector": ".pricing-card", "route": "/pricing" },
290
302
  "className": "highlighted"
291
303
  }
292
304
  ```
293
305
 
294
- ### remove_class
306
+ ### content:removeClass
295
307
 
296
308
  Removes a CSS class from an element.
297
309
 
298
- | Property | Type | Required | Description |
299
- | ----------- | ---------------- | -------- | -------------------- |
300
- | `kind` | `"remove_class"` | Yes | Action type |
301
- | `anchorId` | string | Yes | Element selector |
302
- | `className` | string | Yes | Class name to remove |
310
+ | Property | Type | Required | Description |
311
+ | ----------- | ----------------------- | -------- | -------------------- |
312
+ | `kind` | `"content:removeClass"` | Yes | Action type |
313
+ | `anchorId` | object | Yes | `{ selector, route }` |
314
+ | `className` | string | Yes | Class name to remove |
303
315
 
304
316
  ```json
305
317
  {
306
- "kind": "remove_class",
307
- "anchorId": ".pricing-card",
318
+ "kind": "content:removeClass",
319
+ "anchorId": { "selector": ".pricing-card", "route": "/pricing" },
308
320
  "className": "hidden"
309
321
  }
310
322
  ```
@@ -316,24 +328,50 @@ Removes a CSS class from an element.
316
328
 
317
329
  Collapsible Q&A accordion with actions, rich content, feedback, and personalization.
318
330
 
319
- ## Actions
331
+ ## When to use
320
332
 
321
- ### mount_faq
333
+ | Goal | Action |
334
+ |------|--------|
335
+ | Add an FAQ accordion widget | Add a **tile** in `tiles[]` with `widget: "adaptive-faq:accordion"` |
336
+ | Scroll to and expand a specific FAQ item | `faq:scroll_to` |
337
+ | Open, close, or toggle a FAQ item | `faq:toggle_item` |
338
+ | Add, remove, reorder, or replace FAQ items | `faq:update` |
339
+
340
+ ## Mounting an FAQ Widget
341
+
342
+ FAQ widgets are mounted via **tiles** (not actions). Add an entry to the `tiles[]` array in the config:
343
+
344
+ ```json
345
+ {
346
+ "tiles": [
347
+ {
348
+ "id": "my-faq",
349
+ "title": "Frequently Asked Questions",
350
+ "content": {
351
+ "type": "custom",
352
+ "component": "adaptive-faq:accordion",
353
+ "props": {
354
+ "expandBehavior": "single",
355
+ "searchable": true,
356
+ "items": [ ... ]
357
+ }
358
+ }
359
+ }
360
+ ]
361
+ }
362
+ ```
322
363
 
323
- Mounts an FAQ accordion widget to a surface slot.
364
+ ### Tile Props
324
365
 
325
366
  | Property | Type | Required | Description |
326
367
  | ----------------------- | --------------------------------- | -------- | ------------------------------------------------------------------- |
327
- | `kind` | `"mount_faq"` | Yes | Action type |
328
- | `slot` | string | Yes | Target slot (e.g., `"drawer_right"`, `"overlay_center"`) |
329
- | `config.title` | string | No | Widget title |
330
- | `config.expandBehavior` | `"single"` \| `"multiple"` | No | Whether one or many items can be open at once (default: `"single"`) |
331
- | `config.searchable` | boolean | No | Show a search/filter input (default: `false`) |
332
- | `config.theme` | `"light"` \| `"dark"` \| `"auto"` | No | Color theme (default: `"auto"`) |
333
- | `config.items` | array | Yes | FAQ items (see below) |
334
- | `config.feedback` | boolean \| FeedbackConfig | No | Enable per-item feedback widget |
335
- | `config.ordering` | OrderingStrategy | No | Item ordering strategy (default: `"static"`) |
336
- | `config.injections` | InjectionRule[] | No | Dynamic item injection rules |
368
+ | `expandBehavior` | `"single"` \| `"multiple"` | No | Whether one or many items can be open at once (default: `"single"`) |
369
+ | `searchable` | boolean | No | Show a search/filter input (default: `false`) |
370
+ | `theme` | `"light"` \| `"dark"` \| `"auto"` | No | Color theme (default: `"auto"`) |
371
+ | `items` | array | Yes | FAQ items (see below) |
372
+ | `feedback` | boolean \| FeedbackConfig | No | Enable per-item feedback widget |
373
+ | `ordering` | OrderingStrategy | No | Item ordering strategy (default: `"static"`) |
374
+ | `injections` | InjectionRule[] | No | Dynamic item injection rules |
337
375
 
338
376
  ### FAQ Item Schema
339
377
 
@@ -348,65 +386,63 @@ Each item in the `items` array:
348
386
  | `config.category` | string | No | Category for grouping items |
349
387
  | `config.priority` | number | No | Priority weight for ordering |
350
388
  | `config.answerStrategy` | AnswerStrategy | No | AI-generated answer configuration |
351
- | `showWhen` | DecisionStrategy \| null | No | Conditional visibility strategy |
389
+ | `triggerWhen` | DecisionStrategy \| null | No | Conditional visibility strategy |
390
+
391
+ **Full tile example with FAQ items:**
352
392
 
353
393
  ```json
354
394
  {
355
- "kind": "mount_faq",
356
- "slot": "drawer_right",
357
- "config": {
358
- "title": "Frequently Asked Questions",
359
- "expandBehavior": "single",
360
- "searchable": true,
361
- "theme": "auto",
362
- "feedback": {
363
- "style": "thumbs",
364
- "prompt": "Was this helpful?"
365
- },
366
- "ordering": "priority",
367
- "items": [
368
- {
369
- "kind": "faq:question",
370
- "config": {
371
- "id": "getting-started",
372
- "question": "How do I get started?",
373
- "answer": "Sign up for a free account and follow our quickstart guide.",
374
- "category": "General",
375
- "priority": 10
376
- }
377
- },
378
- {
379
- "kind": "faq:question",
380
- "config": {
381
- "id": "payment-methods",
382
- "question": "What payment methods do you accept?",
383
- "answer": "We accept all major credit cards and PayPal.",
384
- "category": "Billing",
385
- "priority": 5
386
- },
387
- "showWhen": {
388
- "type": "rules",
389
- "rules": [
395
+ "tiles": [
396
+ {
397
+ "id": "help-faq",
398
+ "title": "Frequently Asked Questions",
399
+ "content": {
400
+ "type": "custom",
401
+ "component": "adaptive-faq:accordion",
402
+ "props": {
403
+ "expandBehavior": "single",
404
+ "searchable": true,
405
+ "feedback": {
406
+ "style": "thumbs",
407
+ "prompt": "Was this helpful?"
408
+ },
409
+ "ordering": "priority",
410
+ "items": [
390
411
  {
391
- "conditions": [{ "type": "page_url", "pattern": "/pricing*" }],
392
- "value": true
412
+ "kind": "faq:question",
413
+ "config": {
414
+ "id": "getting-started",
415
+ "question": "How do I get started?",
416
+ "answer": "Sign up for a free account and follow our quickstart guide.",
417
+ "category": "General",
418
+ "priority": 10
419
+ }
420
+ },
421
+ {
422
+ "kind": "faq:question",
423
+ "config": {
424
+ "id": "payment-methods",
425
+ "question": "What payment methods do you accept?",
426
+ "answer": "We accept all major credit cards and PayPal.",
427
+ "category": "Billing",
428
+ "priority": 5
429
+ }
393
430
  }
394
- ],
395
- "default": false
431
+ ]
396
432
  }
397
433
  }
398
- ]
399
- }
434
+ }
435
+ ]
400
436
  }
401
437
  ```
402
438
 
403
- ### scroll_to_faq
439
+ ### faq:scroll_to
404
440
 
405
441
  Scrolls the viewport to a specific FAQ item and optionally expands it.
406
442
 
407
443
  | Property | Type | Required | Default | Description |
408
444
  | -------------- | ----------------- | -------- | ---------- | ------------------------------------------ |
409
- | `kind` | `"scroll_to_faq"` | Yes | | Action type |
445
+ | `kind` | `"faq:scroll_to"` | Yes | | Action type |
410
446
  | `itemId` | string | No\* | | Target item ID |
411
447
  | `itemQuestion` | string | No\* | | Target item question text (fuzzy match) |
412
448
  | `expand` | boolean | No | `true` | Whether to expand the item after scrolling |
@@ -416,20 +452,20 @@ Scrolls the viewport to a specific FAQ item and optionally expands it.
416
452
 
417
453
  ```json
418
454
  {
419
- "kind": "scroll_to_faq",
455
+ "kind": "faq:scroll_to",
420
456
  "itemId": "payment-methods",
421
457
  "expand": true,
422
458
  "behavior": "smooth"
423
459
  }
424
460
  ```
425
461
 
426
- ### toggle_faq_item
462
+ ### faq:toggle_item
427
463
 
428
464
  Opens, closes, or toggles a FAQ item's expanded state.
429
465
 
430
466
  | Property | Type | Required | Default | Description |
431
467
  | -------------- | ------------------- | -------- | ---------- | --------------------------------------- |
432
- | `kind` | `"toggle_faq_item"` | Yes | | Action type |
468
+ | `kind` | `"faq:toggle_item"` | Yes | | Action type |
433
469
  | `itemId` | string | No\* | | Target item ID |
434
470
  | `itemQuestion` | string | No\* | | Target item question text (fuzzy match) |
435
471
  | `state` | string | No | `"toggle"` | `"open"`, `"closed"`, `"toggle"` |
@@ -438,19 +474,19 @@ Opens, closes, or toggles a FAQ item's expanded state.
438
474
 
439
475
  ```json
440
476
  {
441
- "kind": "toggle_faq_item",
477
+ "kind": "faq:toggle_item",
442
478
  "itemId": "getting-started",
443
479
  "state": "open"
444
480
  }
445
481
  ```
446
482
 
447
- ### update_faq
483
+ ### faq:update
448
484
 
449
485
  Dynamically adds, removes, reorders, or replaces FAQ items at runtime.
450
486
 
451
487
  | Property | Type | Required | Description |
452
488
  | ----------- | ------------------- | -------- | ------------------------------------------------------- |
453
- | `kind` | `"update_faq"` | Yes | Action type |
489
+ | `kind` | `"faq:update"` | Yes | Action type |
454
490
  | `operation` | string | Yes | `"add"`, `"remove"`, `"reorder"`, `"replace"` |
455
491
  | `items` | FAQQuestionAction[] | No | Items to add or replace with (required for add/replace) |
456
492
  | `itemId` | string | No | Item to remove (required for remove) |
@@ -462,7 +498,7 @@ Dynamically adds, removes, reorders, or replaces FAQ items at runtime.
462
498
 
463
499
  ```json
464
500
  {
465
- "kind": "update_faq",
501
+ "kind": "faq:update",
466
502
  "operation": "add",
467
503
  "position": "append",
468
504
  "items": [
@@ -482,7 +518,7 @@ Dynamically adds, removes, reorders, or replaces FAQ items at runtime.
482
518
 
483
519
  ```json
484
520
  {
485
- "kind": "update_faq",
521
+ "kind": "faq:update",
486
522
  "operation": "remove",
487
523
  "itemId": "outdated-question"
488
524
  }
@@ -492,7 +528,7 @@ Dynamically adds, removes, reorders, or replaces FAQ items at runtime.
492
528
 
493
529
  ```json
494
530
  {
495
- "kind": "update_faq",
531
+ "kind": "faq:update",
496
532
  "operation": "reorder",
497
533
  "order": ["getting-started", "new-feature", "payment-methods"]
498
534
  }
@@ -502,7 +538,7 @@ Dynamically adds, removes, reorders, or replaces FAQ items at runtime.
502
538
 
503
539
  ```json
504
540
  {
505
- "kind": "update_faq",
541
+ "kind": "faq:update",
506
542
  "operation": "replace",
507
543
  "items": [
508
544
  {
@@ -521,12 +557,12 @@ Dynamically adds, removes, reorders, or replaces FAQ items at runtime.
521
557
 
522
558
  The FAQ widget uses a **compositional action pattern** where `faq:question` actions serve as configuration data rendered by the widget, rather than being executed by the runtime. This allows:
523
559
 
524
- - **Per-item conditional visibility** via `showWhen` strategies -- items can appear or hide based on page URL, user segment, viewport, or any DecisionStrategy condition
560
+ - **Per-item conditional visibility** via `triggerWhen` strategies -- items can appear or hide based on page URL, user segment, viewport, or any DecisionStrategy condition
525
561
  - **Category grouping** -- items with a `category` field are grouped under collapsible section headers
526
562
  - **Dynamic injection** -- `injections` rules can add items when trigger conditions are met, supporting contextual FAQ content
527
563
  - **Ordering control** -- the `ordering` strategy determines how items are sorted within categories
528
564
 
529
- Items without `showWhen` are always visible. Items without `category` appear in an ungrouped section.
565
+ Items without `triggerWhen` are always visible. Items without `category` appear in an ungrouped section.
530
566
 
531
567
  ## Rich Answer Content
532
568
 
@@ -672,17 +708,67 @@ Injection rules add contextual FAQ items when conditions are met:
672
708
 
673
709
  Gamification capabilities including badges, points, and leaderboards.
674
710
 
711
+ ## When to use
712
+
713
+ | Goal | Action |
714
+ |------|--------|
715
+ | Award a badge to a user | `gamification:awardBadge` |
716
+ | Add points to a user's score | `gamification:addPoints` |
717
+ | Mount a gamification widget (leaderboard, progress) | Add a **tile** with `component: "adaptive-gamification:leaderboard"` |
718
+
675
719
  ## Actions
676
720
 
677
- ### mount_gamification
721
+ ### gamification:awardBadge
722
+
723
+ Awards a badge to the current user.
724
+
725
+ | Property | Type | Required | Description |
726
+ | -------- | -------------------------- | -------- | ---------------- |
727
+ | `kind` | `"gamification:awardBadge"` | Yes | Action type |
728
+ | `badgeId` | string | Yes | Badge identifier |
729
+
730
+ ```json
731
+ {
732
+ "kind": "gamification:awardBadge",
733
+ "badgeId": "first-purchase"
734
+ }
735
+ ```
736
+
737
+ ### gamification:addPoints
738
+
739
+ Adds points to the current user's score.
740
+
741
+ | Property | Type | Required | Description |
742
+ | -------- | -------------------------- | -------- | ---------------- |
743
+ | `kind` | `"gamification:addPoints"` | Yes | Action type |
744
+ | `points` | number | Yes | Points to add |
745
+
746
+ ```json
747
+ {
748
+ "kind": "gamification:addPoints",
749
+ "points": 50
750
+ }
751
+ ```
752
+
753
+ ### Gamification Widget (via Tile)
678
754
 
679
- Mounts gamification UI elements.
755
+ Mount gamification UI elements (leaderboard, badge display, progress tracker) via a **tile**:
680
756
 
681
- | Property | Type | Required | Description |
682
- | -------- | ---------------------- | -------- | -------------------------- |
683
- | `kind` | `"mount_gamification"` | Yes | Action type |
684
- | `slot` | string | Yes | Target slot |
685
- | `config` | object | Yes | Gamification configuration |
757
+ ```json
758
+ {
759
+ "tiles": [
760
+ {
761
+ "id": "gamification",
762
+ "title": "Your Progress",
763
+ "content": {
764
+ "type": "custom",
765
+ "component": "adaptive-gamification:leaderboard",
766
+ "props": { ... }
767
+ }
768
+ }
769
+ ]
770
+ }
771
+ ```
686
772
 
687
773
  ### Configuration Schema
688
774
 
@@ -707,9 +793,13 @@ Mounts gamification UI elements.
707
793
 
708
794
  ```json
709
795
  {
710
- "kind": "mount_gamification",
711
- "slot": "overlay_corner_br",
712
- "config": {
796
+ "tiles": [{
797
+ "id": "gamification-widget",
798
+ "title": "Achievements",
799
+ "content": {
800
+ "type": "custom",
801
+ "component": "adaptive-gamification:leaderboard",
802
+ "props": {
713
803
  "badges": [
714
804
  {
715
805
  "id": "first-purchase",
@@ -719,18 +809,6 @@ Mounts gamification UI elements.
719
809
  "trigger": {
720
810
  "event": "purchase_completed"
721
811
  }
722
- },
723
- {
724
- "id": "explorer",
725
- "name": "Explorer",
726
- "icon": "compass",
727
- "description": "Visited 10 different pages",
728
- "trigger": {
729
- "event": "page_view",
730
- "conditions": [
731
- { "type": "session_metric", "key": "unique_pages", "operator": ">=", "threshold": 10 }
732
- ]
733
- }
734
812
  }
735
813
  ],
736
814
  "points": {
@@ -753,12 +831,79 @@ Mounts gamification UI elements.
753
831
  - **Progress tracking**: Show achievement progress to motivate users
754
832
 
755
833
 
834
+ ---
835
+
836
+ # @syntrologie/adapt-mcp
837
+
838
+ Loader adaptive for the MCP Apps protocol.
839
+
840
+ ## What it does today
841
+
842
+ Nothing observable from tile config. This adaptive is currently a pure loader:
843
+ it pulls [`@modelcontextprotocol/ext-apps`](https://www.npmjs.com/package/@modelcontextprotocol/ext-apps) into the page and exposes its `App`, `AppBridge`,
844
+ and `PostMessageTransport` classes on `window.MCPApp`. No actions, no widgets,
845
+ no surfaces.
846
+
847
+ ## Why it exists separately from `runtime-sdk`
848
+
849
+ The MCP Apps bridge adds a non-trivial amount of code and a new dep
850
+ (`@modelcontextprotocol/ext-apps`) to any page that includes it. Most Syntro
851
+ deployments don't need it — only pages that want to render interactive MCP-app
852
+ cards do. Splitting it into its own adaptive means the runtime stays lean and
853
+ the bridge code only loads when a tile references it.
854
+
855
+ This package is deliberately **not** listed in `BUNDLED_APP_IDS` in
856
+ `packages/runtime-sdk/src/apps/AppLoader.ts`, so the AppLoader treats it as a
857
+ CDN-hosted adaptive and fetches it on demand.
858
+
859
+ ## Loading
860
+
861
+ The `./cdn` entrypoint is the CDN bundle. When it runs in a browser:
862
+
863
+ 1. Imports `App`, `AppBridge`, `PostMessageTransport` from
864
+ `@modelcontextprotocol/ext-apps/app-bridge`.
865
+ 2. Assigns them to `window.MCPApp`.
866
+ 3. Calls `window.SynOS.appRegistry.register(manifest)` if the host registry is
867
+ present.
868
+
869
+ After this runs, any subsequent page code can use `window.MCPApp.App` to
870
+ construct an MCP App instance without reloading the library.
871
+
872
+ ## Capabilities (none yet)
873
+
874
+ | Kind | Available? | Notes |
875
+ |------|------------|-------|
876
+ | Actions | — | TBD once bridge requirements are defined. |
877
+ | Widgets | — | TBD. |
878
+ | Surfaces | — | TBD. |
879
+
880
+ This file gets aggregated into `runtime-sdk/CAPABILITIES.md` during build. When
881
+ actions land here, document them in the normal adaptive format (kind, description,
882
+ params schema, example config).
883
+
884
+ ## Next steps (not in this package yet)
885
+
886
+ - Canvas/host wiring: instantiate `AppBridge` per rendered MCP-app iframe.
887
+ - Action registry: map `data-action` clicks to `app.callTool(...)` invocations.
888
+ - Per-channel MCP client proxy on the canvas server.
889
+
890
+ Those live in other PRs once we lock in the full interactivity design.
891
+
892
+
756
893
  ---
757
894
 
758
895
  # @syntrologie/adapt-nav
759
896
 
760
897
  Navigation tips accordion widget with conditional item visibility and toast notifications.
761
898
 
899
+ ## When to use
900
+
901
+ | Goal | Action |
902
+ |------|--------|
903
+ | Scroll to an element on the page | `navigation:scrollTo` |
904
+ | Navigate to a different URL | `navigation:navigate` |
905
+ | Show contextual navigation tips widget | Add a **tile** with `component: "adaptive-nav:tips"` |
906
+
762
907
  ## Widget: `adaptive-nav:tips`
763
908
 
764
909
  Accordion of contextual navigation tips. Each tip has a collapsible header and expanded body with optional CTA link.
@@ -879,15 +1024,26 @@ Navigates to a URL.
879
1024
 
880
1025
  Visual overlay capabilities including highlights, tooltips, badges, pulse animations, and celebrations.
881
1026
 
1027
+ ## When to use
1028
+
1029
+ | Goal | Action |
1030
+ |------|--------|
1031
+ | Draw attention to an element (spotlight) | `overlays:highlight` |
1032
+ | Show contextual help or guidance near an element | `overlays:tooltip` |
1033
+ | Add a notification indicator (count, "NEW") | `overlays:badge` |
1034
+ | Subtle attention-grab animation | `overlays:pulse` |
1035
+ | Show a blocking or non-blocking dialog | `overlays:modal` |
1036
+ | Celebrate a user achievement | `overlays:celebrate` |
1037
+
882
1038
  ## Actions
883
1039
 
884
- ### highlight
1040
+ ### overlays:highlight
885
1041
 
886
1042
  Creates a spotlight effect around an element with a scrim overlay.
887
1043
 
888
1044
  | Property | Type | Required | Default | Description |
889
1045
  | -------------------- | ------------- | -------- | ----------- | --------------------------------------- |
890
- | `kind` | `"highlight"` | Yes | | Action type |
1046
+ | `kind` | `"overlays:highlight"` | Yes | | Action type |
891
1047
  | `anchorId` | string | Yes | | Element selector |
892
1048
  | `style.color` | string | No | `"#5b8cff"` | Ring color |
893
1049
  | `style.scrimOpacity` | number | No | `0.55` | Backdrop opacity 0-1 (set to 0 to hide) |
@@ -896,7 +1052,7 @@ Creates a spotlight effect around an element with a scrim overlay.
896
1052
 
897
1053
  ```json
898
1054
  {
899
- "kind": "highlight",
1055
+ "kind": "overlays:highlight",
900
1056
  "anchorId": "#signup-button",
901
1057
  "style": {
902
1058
  "color": "#22c55e",
@@ -905,13 +1061,13 @@ Creates a spotlight effect around an element with a scrim overlay.
905
1061
  }
906
1062
  ```
907
1063
 
908
- ### tooltip
1064
+ ### overlays:tooltip
909
1065
 
910
1066
  Shows a tooltip near an element with optional title, body, and CTA.
911
1067
 
912
1068
  | Property | Type | Required | Default | Description |
913
1069
  | -------------------- | ----------- | -------- | ------------- | -------------------------------------- |
914
- | `kind` | `"tooltip"` | Yes | | Action type |
1070
+ | `kind` | `"overlays:tooltip"` | Yes | | Action type |
915
1071
  | `anchorId` | string | Yes | | Element selector |
916
1072
  | `content.title` | string | No | | Tooltip heading |
917
1073
  | `content.body` | string | Yes | | Tooltip text |
@@ -927,14 +1083,14 @@ Shows a tooltip near an element with optional title, body, and CTA.
927
1083
 
928
1084
  ```json
929
1085
  {
930
- "kind": "tooltip",
1086
+ "kind": "overlays:tooltip",
931
1087
  "anchorId": "#pricing-toggle",
932
1088
  "content": {
933
1089
  "title": "Save 20%",
934
1090
  "body": "Switch to annual billing to save on your subscription.",
935
1091
  "cta": {
936
1092
  "label": "Switch Now",
937
- "action": { "kind": "navigate", "url": "/billing?annual=true" }
1093
+ "action": { "kind": "navigation:navigate", "url": "/billing?annual=true" }
938
1094
  }
939
1095
  },
940
1096
  "placement": "bottom",
@@ -973,45 +1129,45 @@ Use `ctaButtons` for tooltips with multiple actions. Each button has:
973
1129
  - `"faq:open:<questionId>"` — Convention for companion FAQ tooltips (see adaptive-faq CAPABILITIES for details). Publishes `action.tooltip_cta_clicked` which the FAQ widget listens for.
974
1130
  - Any other value — Publishes `action.tooltip_cta_clicked` with the `actionId` in event props for custom handling
975
1131
 
976
- ### badge
1132
+ ### overlays:badge
977
1133
 
978
1134
  Adds a small badge indicator near an element.
979
1135
 
980
1136
  | Property | Type | Required | Default | Description |
981
1137
  | ---------- | --------- | -------- | ------------- | -------------------------------------------------------------- |
982
- | `kind` | `"badge"` | Yes | | Action type |
1138
+ | `kind` | `"overlays:badge"` | Yes | | Action type |
983
1139
  | `anchorId` | string | Yes | | Element selector |
984
1140
  | `text` | string | Yes | | Badge text (e.g., "NEW", "3") |
985
1141
  | `position` | string | No | `"top-right"` | `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"` |
986
1142
 
987
1143
  ```json
988
1144
  {
989
- "kind": "badge",
1145
+ "kind": "overlays:badge",
990
1146
  "anchorId": "#inbox-icon",
991
1147
  "text": "5",
992
1148
  "position": "top-right"
993
1149
  }
994
1150
  ```
995
1151
 
996
- ### pulse
1152
+ ### overlays:pulse
997
1153
 
998
1154
  Adds a pulsing animation to draw attention.
999
1155
 
1000
1156
  | Property | Type | Required | Default | Description |
1001
1157
  | ---------- | --------- | -------- | ------- | ------------------------ |
1002
- | `kind` | `"pulse"` | Yes | | Action type |
1158
+ | `kind` | `"overlays:pulse"` | Yes | | Action type |
1003
1159
  | `anchorId` | string | Yes | | Element selector |
1004
1160
  | `duration` | number | No | `2000` | Animation duration in ms |
1005
1161
 
1006
1162
  ```json
1007
1163
  {
1008
- "kind": "pulse",
1164
+ "kind": "overlays:pulse",
1009
1165
  "anchorId": ".notification-bell",
1010
1166
  "duration": 3000
1011
1167
  }
1012
1168
  ```
1013
1169
 
1014
- ### modal
1170
+ ### overlays:modal
1015
1171
 
1016
1172
  Shows a centered modal dialog with optional CTA buttons.
1017
1173
 
@@ -1051,7 +1207,7 @@ Shows a centered modal dialog with optional CTA buttons.
1051
1207
  }
1052
1208
  ```
1053
1209
 
1054
- ### celebrate
1210
+ ### overlays:celebrate
1055
1211
 
1056
1212
  Renders a fullscreen Canvas 2D celebration effect. One action kind with a pluggable `effect` parameter supporting multiple visual presets.
1057
1213
 
@@ -1273,15 +1429,7 @@ Control when adaptives activate using `DecisionStrategy`:
1273
1429
 
1274
1430
  ### 1. Choose the Right Action Type
1275
1431
 
1276
- | Goal | Action |
1277
- |------|--------|
1278
- | Change text | `set_text` |
1279
- | Add visual indicator | `badge`, `pulse` |
1280
- | Show help text | `tooltip` |
1281
- | Draw attention | `highlight` |
1282
- | Add content | `insert_html` |
1283
- | Navigate user | `scroll_to`, `navigate` |
1284
- | Show UI panel | `mount_widget` + Surfaces |
1432
+ Each adaptive package has a "When to use" guide at the top of its capabilities section above. Refer to those for action selection guidance.
1285
1433
 
1286
1434
  ### 2. Anchor Selection
1287
1435
 
@@ -1313,8 +1461,8 @@ When `content:insertHtml` needs to open the canvas panel (e.g., a "Help Me Choos
1313
1461
 
1314
1462
  ```json
1315
1463
  {
1316
- "kind": "insert_html",
1317
- "anchorId": "[data-id='pricing-heading']",
1464
+ "kind": "content:insertHtml",
1465
+ "anchorId": { "selector": "[data-id='pricing-heading']", "route": "/" },
1318
1466
  "html": "<button style='background: #4a90e2; color: white; border: none; padding: 8px 16px; border-radius: 20px; cursor: pointer;'>Help Me Choose</button>",
1319
1467
  "position": "after",
1320
1468
  "deepLink": { "tileId": "plan_selector_faq" }
@@ -1327,4 +1475,4 @@ The `deepLink` object:
1327
1475
 
1328
1476
  The SDK automatically opens the canvas, navigates to the tile, sets cursor to pointer, and wires up click/cleanup handlers.
1329
1477
 
1330
- **NEVER use `onclick`, `window.SynOS`, or any JavaScript in `insert_html` HTML strings.** The HTML is sanitized and event handlers are stripped. Use `deepLink` instead.
1478
+ **NEVER use `onclick`, `window.SynOS`, or any JavaScript in `content:insertHtml` HTML strings.** The HTML is sanitized and event handlers are stripped. Use `deepLink` instead.