@kywi-software/mcp 0.6.4 → 0.6.6

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/AGENT-PATTERNS.md CHANGED
@@ -272,7 +272,7 @@ authored elsewhere in the admin).
272
272
  | `name` | Purpose |
273
273
  |---|---|
274
274
  | `variantContainer` | Module-level arms revealed client-side per audience — read §8 first |
275
- | `personalizationBadge` | Mount point for the "you're seeing X" transparency control |
275
+ | `personalizationBadge` | Optional inline status pill that opens the global transparency panel — not needed on ordinary pages (§8) |
276
276
  | `socialShare` | Share links for a URL/title across networks |
277
277
  | `map` | Embedded map at a lat/lng or address |
278
278
  | `cookieConsent` | Consent banner with message + privacy-policy link |
@@ -308,8 +308,12 @@ Full recipe, worked example and hazards: the **`kywi-custom-modules` skill**.
308
308
  **Design the props for the owner, not for yourself.** The props panel gives the
309
309
  owner real controls for `text`/`textarea`/`richText` (text inputs),
310
310
  `image`/`file` (media picker), `boolean` (checkbox) and `number`/`date`/`color`
311
- (native inputs); `select`, `slug`, `relationship` and `multiSelect` fall back to
312
- a plain text input, so name the allowed values in the label. A `json` prop is a
311
+ (native inputs); `select` and `multiSelect` render a real dropdown or checkbox
312
+ group when the prop declares `options` `{ value, label }` pairs, or bare
313
+ strings where the string serves as both — so declare options for every closed
314
+ choice instead of trusting the owner to type the right value. `slug` and
315
+ `relationship` have no options field and are still plain text inputs; that's
316
+ the one place to name the allowed values in the label. A `json` prop is a
313
317
  raw JSON textarea — developer territory. A "three stats" module with `stats: {
314
318
  type: 'json' }` has taken the copy away from the owner; the same module with
315
319
  `stat1Value` / `stat1Label` … as `text` props hasn't.
@@ -406,12 +410,44 @@ Four traps, each of which fails silently:
406
410
  audience arm first, so a visitor who matches an audience never enters the
407
411
  split. Don't run an experiment and an audience variant on the same container.
408
412
  4. **The client runtime needs `/kywi.js`.** Self-ID, behavioral re-evaluation
409
- and the transparency badge no-op silently unless the built
413
+ and the transparency panel no-op silently unless the built
410
414
  `@kywi-software/js` bundle is at `public/kywi.js`.
411
415
 
412
416
  Standing rule: **the default arm must be complete on its own.** It is what
413
417
  search engines, answer engines, and every opted-out visitor receive.
414
418
 
419
+ ### Transparency: automatic, not something you place
420
+
421
+ Once the client runtime is loaded, every personalized (or opted-out-with-a-
422
+ match) page grows a global transparency surface on its own — a small
423
+ collapsed pill, bottom of the page, that expands into a panel showing which
424
+ audience the page was personalized for, an audience switcher, reset-to-
425
+ automatic, and opt-out/opt-in. This is automatic and site-wide; you do not add
426
+ anything to a page to get it.
427
+
428
+ **Don't place the `personalizationBadge` module on ordinary pages.** It is a
429
+ second, optional entry point — a passive inline status pill that opens the
430
+ *same* global panel — for a spot where a deliberate, in-content link to
431
+ personalization settings makes sense (a privacy or preferences page). It
432
+ carries no opt-out controls of its own; switching audience and opting out
433
+ always happen in the one global panel, never in two places that could
434
+ disagree. Placing it on every page is redundant with the surface that's
435
+ already there automatically.
436
+
437
+ `personalization.transparencyNotice.enabled: false` (theme config) suppresses
438
+ the automatic panel from appearing on its own; the badge (or the panel's own
439
+ programmatic open) still works as a deliberate opt-in path.
440
+
441
+ ### Self-ID widget: all six display modes
442
+
443
+ The self-ID widget (Admin → Audiences) is authorable in six display modes:
444
+ `modal`, `inline`, `slide-in`, `hello_bar_top`, `hello_bar_bottom`, and
445
+ `drawer`. For `inline`, the client runtime mounts the widget into an element
446
+ matching `[data-kywi-selfid-mount]` when the page provides one; otherwise it
447
+ appends to the end of `<body>`. Give an inline placement its own mount point
448
+ when you want the widget to sit in a specific spot in the page flow rather
449
+ than wherever the runtime defaults to.
450
+
415
451
  ## 9. Editorial workflow: drafts, review, versions
416
452
 
417
453
  For any site with more than one author — or an owner who wants a safety net —
@@ -14,6 +14,15 @@ export interface ModuleTypeProp {
14
14
  type: string;
15
15
  label: string;
16
16
  default?: unknown;
17
+ /**
18
+ * The values a `select` / `multiSelect` prop accepts, always normalized to
19
+ * `{ value, label }`. Present only when the module declares them; absent means
20
+ * the prop is free-form.
21
+ */
22
+ options?: Array<{
23
+ value: string;
24
+ label: string;
25
+ }>;
17
26
  }
18
27
  export interface ModuleTypeSummary {
19
28
  name: string;
@@ -1 +1 @@
1
- {"version":3,"file":"module-types.d.ts","sourceRoot":"","sources":["../src/module-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAIxE;;;;;;;;;;GAUG;AAIH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAeD,sDAAsD;AACtD,wBAAgB,uBAAuB,IAAI,iBAAiB,EAAE,CAE7D;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,IAAI,kBAAkB,EAAE,CAQhE;AAWD,wBAAgB,qBAAqB,IAAI;IACvC,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC1C,CAIA;AAQD,8DAA8D;AAC9D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAM/D"}
1
+ {"version":3,"file":"module-types.d.ts","sourceRoot":"","sources":["../src/module-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AAIxE;;;;;;;;;;GAUG;AAIH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAClD;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;CACtC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAA;IAChB,OAAO,EAAE,iBAAiB,EAAE,CAAA;CAC7B;AAkBD,sDAAsD;AACtD,wBAAgB,uBAAuB,IAAI,iBAAiB,EAAE,CAE7D;AAED,qFAAqF;AACrF,wBAAgB,yBAAyB,IAAI,kBAAkB,EAAE,CAQhE;AAWD,wBAAgB,qBAAqB,IAAI;IACvC,OAAO,EAAE,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAC1C,CAIA;AAQD,8DAA8D;AAC9D,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAM/D"}
@@ -1,13 +1,16 @@
1
- import { BUILT_IN_MODULES } from '@kywi-software/core';
1
+ import { BUILT_IN_MODULES, normalizeModulePropOptions } from '@kywi-software/core';
2
2
  import { textResult } from './shared.js';
3
3
  // ─── Pure builders (testable, always derived from BUILT_IN_MODULES) ──────────
4
4
  function summarizeModule(mod) {
5
5
  const props = {};
6
6
  for (const [propName, def] of Object.entries(mod.props ?? {})) {
7
- props[propName] =
8
- def.defaultValue !== undefined
9
- ? { type: def.type, label: def.label, default: def.defaultValue }
10
- : { type: def.type, label: def.label };
7
+ const options = normalizeModulePropOptions(def.options);
8
+ props[propName] = {
9
+ type: def.type,
10
+ label: def.label,
11
+ ...(def.defaultValue !== undefined ? { default: def.defaultValue } : {}),
12
+ ...(options.length > 0 ? { options } : {}),
13
+ };
11
14
  }
12
15
  return { name: mod.name, label: mod.label, category: mod.category ?? 'Other', props };
13
16
  }
@@ -1 +1 @@
1
- {"version":3,"file":"module-types.js","sourceRoot":"","sources":["../src/module-types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAkCxC,gFAAgF;AAEhF,SAAS,eAAe,CAAC,GAAsC;IAC7D,MAAM,KAAK,GAAmC,EAAE,CAAA;IAChD,KAAK,MAAM,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;QAC9D,KAAK,CAAC,QAAQ,CAAC;YACb,GAAG,CAAC,YAAY,KAAK,SAAS;gBAC5B,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,YAAY,EAAE;gBACjE,CAAC,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAA;IAC5C,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,IAAI,OAAO,EAAE,KAAK,EAAE,CAAA;AACvF,CAAC;AAED,sDAAsD;AACtD,MAAM,UAAU,uBAAuB;IACrC,OAAO,gBAAgB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;AAC9C,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,yBAAyB;IACvC,MAAM,MAAM,GAAG,IAAI,GAA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AAK,IAAI,EAAE,CAAC,qBAAqB,EAAE,CACpC,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kywi-software/mcp",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Model Context Protocol servers for Kywi CMS — a site server (content/nav/media over the REST API) and a developer server (kywi.config.ts scaffolding and mutation).",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -47,8 +47,8 @@
47
47
  "dependencies": {
48
48
  "@modelcontextprotocol/sdk": "^1.12.0",
49
49
  "zod": "^3.25.0",
50
- "@kywi-software/core": "0.6.4",
51
- "@kywi-software/sdk": "0.6.4"
50
+ "@kywi-software/core": "0.6.6",
51
+ "@kywi-software/sdk": "0.6.6"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^20.0.0",