@plitzi/sdk-mcp 0.33.1 → 0.34.0

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 (187) hide show
  1. package/CHANGELOG.md +73 -0
  2. package/dist/index.d.ts +2 -2
  3. package/dist/index.js +3 -2
  4. package/dist/modules/mcp/catalogs/index.d.ts +2 -7
  5. package/dist/modules/mcp/catalogs/index.js +4 -0
  6. package/dist/modules/mcp/catalogs/observed.d.ts +1 -1
  7. package/dist/modules/mcp/catalogs/observed.js +2 -5
  8. package/dist/modules/mcp/catalogs/pluginCatalog.d.ts +17 -0
  9. package/dist/modules/mcp/catalogs/pluginCatalog.js +91 -0
  10. package/dist/modules/mcp/catalogs/registry.js +2 -3
  11. package/dist/modules/mcp/helpers/agentPrompt.js +9 -9
  12. package/dist/modules/mcp/helpers/guide.d.ts +2 -2
  13. package/dist/modules/mcp/helpers/guide.js +117 -50
  14. package/dist/modules/mcp/helpers/interactions.d.ts +5 -1
  15. package/dist/modules/mcp/helpers/interactions.js +15 -6
  16. package/dist/modules/mcp/helpers/space.d.ts +45 -28
  17. package/dist/modules/mcp/helpers/space.js +87 -87
  18. package/dist/modules/mcp/helpers/uris.d.ts +9 -0
  19. package/dist/modules/mcp/helpers/uris.js +10 -1
  20. package/dist/modules/mcp/index.d.ts +2 -0
  21. package/dist/modules/mcp/localScreenshotClient.d.ts +51 -0
  22. package/dist/modules/mcp/localScreenshotClient.js +106 -0
  23. package/dist/modules/mcp/proxy/rewrite.js +15 -1
  24. package/dist/modules/mcp/resources/actions.d.ts +25 -0
  25. package/dist/modules/mcp/resources/actions.js +54 -0
  26. package/dist/modules/mcp/resources/canonical.d.ts +1 -1
  27. package/dist/modules/mcp/resources/canonical.js +1 -1
  28. package/dist/modules/mcp/resources/connectors.d.ts +1 -1
  29. package/dist/modules/mcp/resources/core.js +1 -1
  30. package/dist/modules/mcp/resources/index.d.ts +1 -0
  31. package/dist/modules/mcp/resources/primer.d.ts +8 -1
  32. package/dist/modules/mcp/resources/primer.js +139 -15
  33. package/dist/modules/mcp/resources/register.js +24 -4
  34. package/dist/modules/mcp/resources/renderGuide.js +66 -14
  35. package/dist/modules/mcp/resources/router.js +3 -1
  36. package/dist/modules/mcp/resources/schema.js +6 -5
  37. package/dist/modules/mcp/resources/style.d.ts +2 -1
  38. package/dist/modules/mcp/resources/style.js +10 -3
  39. package/dist/modules/mcp/screenshotClient.js +3 -2
  40. package/dist/modules/mcp/server.js +12 -6
  41. package/dist/modules/mcp/tests/agentRoundtrip.test.d.ts +1 -0
  42. package/dist/modules/mcp/tests/layouts.test.d.ts +1 -0
  43. package/dist/modules/mcp/tools/apply/dispatch.js +30 -1
  44. package/dist/modules/mcp/tools/apply/index.d.ts +149 -15
  45. package/dist/modules/mcp/tools/apply/index.js +12 -2
  46. package/dist/modules/mcp/tools/operations/actions/actions.test.d.ts +1 -0
  47. package/dist/modules/mcp/tools/operations/actions/deleteAction.d.ts +9 -0
  48. package/dist/modules/mcp/tools/operations/actions/deleteAction.js +20 -0
  49. package/dist/modules/mcp/tools/operations/actions/document.d.ts +69 -0
  50. package/dist/modules/mcp/tools/operations/actions/document.js +73 -0
  51. package/dist/modules/mcp/tools/operations/actions/index.d.ts +90 -0
  52. package/dist/modules/mcp/tools/operations/actions/index.js +12 -0
  53. package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +45 -0
  54. package/dist/modules/mcp/tools/operations/actions/patchAction.js +71 -0
  55. package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +47 -0
  56. package/dist/modules/mcp/tools/operations/actions/upsertAction.js +83 -0
  57. package/dist/modules/mcp/tools/operations/connectors/index.d.ts +10 -10
  58. package/dist/modules/mcp/tools/operations/connectors/manifest.d.ts +5 -5
  59. package/dist/modules/mcp/tools/operations/connectors/patchConnector.d.ts +5 -5
  60. package/dist/modules/mcp/tools/operations/connectors/upsertConnector.d.ts +5 -5
  61. package/dist/modules/mcp/tools/operations/index.d.ts +415 -40
  62. package/dist/modules/mcp/tools/operations/index.js +11 -2
  63. package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +2 -2
  64. package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +1 -1
  65. package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +2 -2
  66. package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +1 -1
  67. package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +4 -4
  68. package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +5 -5
  69. package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +6 -6
  70. package/dist/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +1 -1
  71. package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +11 -12
  72. package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +1 -1
  73. package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +4 -4
  74. package/dist/modules/mcp/tools/operations/schema/index.d.ts +2 -0
  75. package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +2 -2
  76. package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +1 -1
  77. package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +2 -2
  78. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +1 -1
  79. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +4 -4
  80. package/dist/modules/mcp/tools/operations/schema/operations.d.ts +28 -5
  81. package/dist/modules/mcp/tools/operations/schema/operations.js +4 -0
  82. package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.d.ts +9 -0
  83. package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.js +33 -0
  84. package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +1 -1
  85. package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.d.ts +22 -0
  86. package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.js +61 -0
  87. package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +2 -0
  88. package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +53 -18
  89. package/dist/modules/mcp/tools/operations/schema/shared.d.ts +5 -1
  90. package/dist/modules/mcp/tools/operations/schema/shared.js +2 -2
  91. package/dist/modules/mcp/tools/operations/schema/translator.d.ts +2 -1
  92. package/dist/modules/mcp/tools/operations/schema/translator.js +21 -9
  93. package/dist/modules/mcp/tools/operations/schema/write.d.ts +9 -22
  94. package/dist/modules/mcp/tools/operations/schema/write.js +23 -43
  95. package/dist/modules/mcp/tools/operations/schemaIds.js +7 -1
  96. package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.d.ts +9 -0
  97. package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.js +21 -0
  98. package/dist/modules/mcp/tools/operations/style/fonts/fonts.test.d.ts +1 -0
  99. package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.d.ts +35 -0
  100. package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.js +66 -0
  101. package/dist/modules/mcp/tools/operations/style/index.d.ts +2 -0
  102. package/dist/modules/mcp/tools/operations/style/operations.d.ts +34 -0
  103. package/dist/modules/mcp/tools/operations/style/operations.js +5 -1
  104. package/dist/modules/mcp/tools/operations/style/translator.d.ts +13 -1
  105. package/dist/modules/mcp/tools/operations/style/translator.js +18 -1
  106. package/dist/modules/mcp/tools/operations/style/write.js +1 -1
  107. package/dist/modules/mcp/tools/preview.d.ts +58 -5
  108. package/dist/modules/mcp/tools/preview.js +1 -1
  109. package/dist/modules/mcp/tools/render.d.ts +61 -5
  110. package/dist/modules/mcp/tools/render.js +10 -3
  111. package/dist/modules/mcp/tools/screenshot.d.ts +151 -16
  112. package/dist/modules/mcp/tools/screenshot.js +22 -13
  113. package/dist/modules/mcp/tools/search.js +3 -3
  114. package/dist/modules/mcp/tools/shared/interactionReport.d.ts +7 -0
  115. package/dist/modules/mcp/tools/shared/interactionReport.js +48 -0
  116. package/dist/modules/mcp/tools/shared/validator/audit.js +4 -4
  117. package/dist/modules/mcp/tools/shared/validator/batch.d.ts +1 -0
  118. package/dist/modules/mcp/tools/shared/validator/batch.js +11 -2
  119. package/dist/modules/mcp/tools/shared/validator/bindings.js +6 -6
  120. package/dist/modules/mcp/tools/shared/validator/connectors.js +1 -1
  121. package/dist/modules/mcp/tools/shared/validator/context.d.ts +3 -0
  122. package/dist/modules/mcp/tools/shared/validator/css.js +1 -1
  123. package/dist/modules/mcp/tools/shared/validator/index.js +29 -9
  124. package/dist/modules/mcp/tools/shared/validator/interactions.js +41 -7
  125. package/dist/modules/mcp/tools/shared/validator/refs.js +4 -4
  126. package/dist/modules/mcp/tools/validate.d.ts +149 -15
  127. package/dist/modules/mcp/types/aiSchema.d.ts +33 -4
  128. package/dist/modules/mcp/types/previewTypes.d.ts +19 -0
  129. package/dist/modules/mcp/types/screenshotTypes.d.ts +1 -0
  130. package/dist/modules/mcp/types/toolTypes.d.ts +6 -1
  131. package/dist/pipeline.js +1 -1
  132. package/dist/preview/createPreview.d.ts +4 -2
  133. package/dist/preview/createPreview.js +16 -6
  134. package/dist/server.d.ts +3 -0
  135. package/dist/server.js +3 -1
  136. package/dist/stages/preview.js +20 -1
  137. package/dist/tests/httpRequest.d.ts +2 -0
  138. package/package.json +20 -16
  139. package/skills/plitzi-render/SKILL.md +84 -11
  140. package/dist/modules/mcp/catalogs/builtinCallbacks.d.ts +0 -19
  141. package/dist/modules/mcp/catalogs/builtinCallbacks.js +0 -139
  142. package/dist/modules/mcp/catalogs/builtinComponents.d.ts +0 -4
  143. package/dist/modules/mcp/catalogs/builtinComponents.js +0 -165
  144. package/dist/modules/mcp/catalogs/builtinElementCallbacks.d.ts +0 -17
  145. package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +0 -50
  146. package/dist/modules/mcp/catalogs/builtinTransformers.d.ts +0 -28
  147. package/dist/modules/mcp/catalogs/builtinTransformers.js +0 -148
  148. package/dist/modules/mcp/catalogs/builtinUtilities.d.ts +0 -15
  149. package/dist/modules/mcp/catalogs/builtinUtilities.js +0 -90
  150. package/dist/modules/mcp/catalogs/cssCatalog/border.d.ts +0 -4
  151. package/dist/modules/mcp/catalogs/cssCatalog/border.js +0 -30
  152. package/dist/modules/mcp/catalogs/cssCatalog/box.d.ts +0 -4
  153. package/dist/modules/mcp/catalogs/cssCatalog/box.js +0 -31
  154. package/dist/modules/mcp/catalogs/cssCatalog/helpers.d.ts +0 -34
  155. package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +0 -185
  156. package/dist/modules/mcp/catalogs/cssCatalog/index.d.ts +0 -18
  157. package/dist/modules/mcp/catalogs/cssCatalog/index.js +0 -131
  158. package/dist/modules/mcp/catalogs/cssCatalog/layout.d.ts +0 -9
  159. package/dist/modules/mcp/catalogs/cssCatalog/layout.js +0 -99
  160. package/dist/modules/mcp/catalogs/cssCatalog/visual.d.ts +0 -8
  161. package/dist/modules/mcp/catalogs/cssCatalog/visual.js +0 -147
  162. package/dist/modules/mcp/catalogs/paramSpec.d.ts +0 -39
  163. package/dist/modules/mcp/catalogs/paramSpec.js +0 -69
  164. package/dist/modules/oauth/authorize.d.ts +0 -7
  165. package/dist/modules/oauth/authorize.js +0 -177
  166. package/dist/modules/oauth/challenge.d.ts +0 -11
  167. package/dist/modules/oauth/challenge.js +0 -33
  168. package/dist/modules/oauth/consentPage.d.ts +0 -7
  169. package/dist/modules/oauth/consentPage.js +0 -118
  170. package/dist/modules/oauth/metadata.d.ts +0 -40
  171. package/dist/modules/oauth/metadata.js +0 -69
  172. package/dist/modules/oauth/params.d.ts +0 -5
  173. package/dist/modules/oauth/params.js +0 -5
  174. package/dist/modules/oauth/pkce.d.ts +0 -6
  175. package/dist/modules/oauth/pkce.js +0 -15
  176. package/dist/modules/oauth/records.d.ts +0 -71
  177. package/dist/modules/oauth/records.js +0 -46
  178. package/dist/modules/oauth/register.d.ts +0 -5
  179. package/dist/modules/oauth/register.js +0 -55
  180. package/dist/modules/oauth/respond.d.ts +0 -13
  181. package/dist/modules/oauth/respond.js +0 -44
  182. package/dist/modules/oauth/token.d.ts +0 -5
  183. package/dist/modules/oauth/token.js +0 -100
  184. package/dist/stages/oauth.d.ts +0 -19
  185. package/dist/stages/oauth.js +0 -114
  186. /package/dist/modules/mcp/catalogs/{builtinTransformers.test.d.ts → pluginCatalog.test.d.ts} +0 -0
  187. /package/dist/modules/mcp/{catalogs/cssCatalog/cssCatalog.test.d.ts → localScreenshotClient.test.d.ts} +0 -0
@@ -1,5 +1,5 @@
1
1
  import { AIDefinition, AIGlobalStyle, AIIdStyle, AIStyleVariable } from '../../../types';
2
- import { Style, StyleItem } from '@plitzi/sdk-shared';
2
+ import { SpaceFont, Style, StyleItem } from '@plitzi/sdk-shared';
3
3
  export declare const isClassDefinition: (item: StyleItem) => boolean;
4
4
  export declare const definitionRefs: (style: Style) => string[];
5
5
  export declare const definitionToAI: (style: Style, ref: string) => AIDefinition | undefined;
@@ -10,3 +10,15 @@ export declare const globalStyleTypes: (style: Style) => string[];
10
10
  export declare const idStyleIds: (style: Style) => string[];
11
11
  export declare const idStyleToAI: (style: Style, targetId: string) => AIIdStyle | undefined;
12
12
  export declare const styleVariablesToAI: (style: Style) => Record<string, AIStyleVariable[]>;
13
+ /**
14
+ * What the space loads, and what it asks for without loading.
15
+ *
16
+ * The second half is the point. A `font-family` names a family and nothing else in Plitzi fetches one, so a rule
17
+ * naming a family that is not declared renders in a fallback and says nothing about it — the single failure this
18
+ * whole manifest exists to make visible. Reported beside the declarations so an agent reading the resource sees
19
+ * the gap without having to compare two lists itself.
20
+ */
21
+ export declare const fontsToAI: (style: Style) => {
22
+ declared: SpaceFont[];
23
+ namedButNotDeclared: string[];
24
+ };
@@ -1,3 +1,4 @@
1
+ import { SYSTEM_FONTS, familiesInCss } from "@plitzi/sdk-shared/style";
1
2
  //#region src/modules/mcp/tools/operations/style/translator.ts
2
3
  var DISPLAY_MODES = [
3
4
  "desktop",
@@ -97,5 +98,21 @@ var styleVariablesToAI = (style) => {
97
98
  }));
98
99
  return data;
99
100
  };
101
+ /**
102
+ * What the space loads, and what it asks for without loading.
103
+ *
104
+ * The second half is the point. A `font-family` names a family and nothing else in Plitzi fetches one, so a rule
105
+ * naming a family that is not declared renders in a fallback and says nothing about it — the single failure this
106
+ * whole manifest exists to make visible. Reported beside the declarations so an agent reading the resource sees
107
+ * the gap without having to compare two lists itself.
108
+ */
109
+ var fontsToAI = (style) => {
110
+ const declared = style.fonts ?? [];
111
+ const known = new Set([...declared, ...SYSTEM_FONTS].map((font) => font.family.toLowerCase()));
112
+ return {
113
+ declared,
114
+ namedButNotDeclared: familiesInCss(style.cache).filter((family) => !known.has(family.toLowerCase()))
115
+ };
116
+ };
100
117
  //#endregion
101
- export { definitionRefs, definitionToAI, definitionVariantNames, globalStyleToAI, globalStyleTypes, globalStylesForType, idStyleIds, idStyleToAI, isClassDefinition, styleVariablesToAI };
118
+ export { definitionRefs, definitionToAI, definitionVariantNames, fontsToAI, globalStyleToAI, globalStyleTypes, globalStylesForType, idStyleIds, idStyleToAI, isClassDefinition, styleVariablesToAI };
@@ -1,4 +1,4 @@
1
- import { expandShorthand, expandShorthandPatch } from "../../../catalogs/cssCatalog/index.js";
1
+ import { expandShorthand, expandShorthandPatch } from "../../../catalogs/index.js";
2
2
  import { defUri, defsUri, globalUri, globalsUri, idUri, idsUri, styleVarUri, styleVarsUri } from "../../../helpers/uris.js";
3
3
  import { fail } from "../../../helpers/opResult.js";
4
4
  import processSelector from "@plitzi/sdk-style/helpers/processSelector";
@@ -33,7 +33,7 @@ export declare const previewShape: {
33
33
  type: z.ZodLiteral<"patchElement">;
34
34
  pageRef: z.ZodString;
35
35
  ref: z.ZodString;
36
- idRef: z.ZodOptional<z.ZodString>;
36
+ rename: z.ZodOptional<z.ZodString>;
37
37
  label: z.ZodOptional<z.ZodString>;
38
38
  subType: z.ZodOptional<z.ZodString>;
39
39
  props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -71,10 +71,31 @@ export declare const previewShape: {
71
71
  slug: z.ZodOptional<z.ZodString>;
72
72
  folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
73
  default: z.ZodOptional<z.ZodBoolean>;
74
+ layout: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
+ layoutContainer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
74
76
  enabled: z.ZodOptional<z.ZodBoolean>;
75
77
  }, z.core.$strip>, z.ZodObject<{
76
78
  type: z.ZodLiteral<"deletePage">;
77
79
  ref: z.ZodString;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ type: z.ZodLiteral<"upsertLayout">;
82
+ ref: z.ZodString;
83
+ label: z.ZodOptional<z.ZodString>;
84
+ subType: z.ZodOptional<z.ZodEnum<{
85
+ footer: "footer";
86
+ main: "main";
87
+ header: "header";
88
+ div: "div";
89
+ nav: "nav";
90
+ section: "section";
91
+ article: "article";
92
+ aside: "aside";
93
+ address: "address";
94
+ figure: "figure";
95
+ }>>;
96
+ }, z.core.$strip>, z.ZodObject<{
97
+ type: z.ZodLiteral<"deleteLayout">;
98
+ ref: z.ZodString;
78
99
  }, z.core.$strip>, z.ZodObject<{
79
100
  type: z.ZodLiteral<"upsertFolder">;
80
101
  ref: z.ZodString;
@@ -115,7 +136,7 @@ export declare const previewShape: {
115
136
  params: z.ZodRecord<z.ZodString, z.ZodString>;
116
137
  enabled: z.ZodOptional<z.ZodBoolean>;
117
138
  }, z.core.$strip>>>;
118
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
139
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
119
140
  enabled: z.ZodOptional<z.ZodBoolean>;
120
141
  }, z.core.$strip>;
121
142
  }, z.core.$strip>, z.ZodObject<{
@@ -135,7 +156,7 @@ export declare const previewShape: {
135
156
  params: z.ZodRecord<z.ZodString, z.ZodString>;
136
157
  enabled: z.ZodOptional<z.ZodBoolean>;
137
158
  }, z.core.$strip>>>;
138
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
159
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
139
160
  enabled: z.ZodOptional<z.ZodBoolean>;
140
161
  }, z.core.$strip>, z.ZodObject<{
141
162
  type: z.ZodLiteral<"deleteBinding">;
@@ -165,7 +186,7 @@ export declare const previewShape: {
165
186
  action: z.ZodString;
166
187
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
167
188
  enabled: z.ZodOptional<z.ZodBoolean>;
168
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
189
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
169
190
  elementId: z.ZodOptional<z.ZodString>;
170
191
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
171
192
  }, z.core.$strip>>;
@@ -178,7 +199,7 @@ export declare const previewShape: {
178
199
  action: z.ZodOptional<z.ZodString>;
179
200
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
180
201
  enabled: z.ZodOptional<z.ZodBoolean>;
181
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
202
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
182
203
  elementId: z.ZodOptional<z.ZodString>;
183
204
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
184
205
  }, z.core.$strip>, z.ZodObject<{
@@ -467,6 +488,38 @@ export declare const previewShape: {
467
488
  custom: "custom";
468
489
  }>;
469
490
  name: z.ZodString;
491
+ }, z.core.$strip>, z.ZodObject<{
492
+ type: z.ZodLiteral<"upsertFont">;
493
+ family: z.ZodString;
494
+ source: z.ZodEnum<{
495
+ system: "system";
496
+ hosted: "hosted";
497
+ google: "google";
498
+ remote: "remote";
499
+ }>;
500
+ fallback: z.ZodString;
501
+ weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
502
+ styles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
503
+ normal: "normal";
504
+ italic: "italic";
505
+ }>>>;
506
+ stylesheet: z.ZodOptional<z.ZodString>;
507
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
508
+ weight: z.ZodNumber;
509
+ style: z.ZodEnum<{
510
+ normal: "normal";
511
+ italic: "italic";
512
+ }>;
513
+ format: z.ZodEnum<{
514
+ woff2: "woff2";
515
+ woff: "woff";
516
+ }>;
517
+ url: z.ZodOptional<z.ZodString>;
518
+ path: z.ZodOptional<z.ZodString>;
519
+ }, z.core.$strip>>>;
520
+ }, z.core.$strip>, z.ZodObject<{
521
+ type: z.ZodLiteral<"deleteFont">;
522
+ family: z.ZodString;
470
523
  }, z.core.$strip>], "type">>>;
471
524
  };
472
525
  export declare const previewTool: import('.').ToolDef;
@@ -3,7 +3,7 @@ import { defineTool } from "./shared/tool.js";
3
3
  import { z } from "zod";
4
4
  //#region src/modules/mcp/tools/preview.ts
5
5
  var previewShape = {
6
- pageRef: z.string().optional().describe("Page ref or id to preview; defaults to the space default page"),
6
+ pageRef: z.string().optional().describe("The page to preview, by name; defaults to the space default page"),
7
7
  operations: z.array(documentOperation).max(100).optional().describe("Unsaved edits to apply to a throwaway clone before rendering, so you can preview a change WITHOUT persisting it (same op vocabulary as plitzi_apply). Omit to preview the current saved state.")
8
8
  };
9
9
  var previewTool = defineTool({
@@ -35,7 +35,7 @@ export declare const renderShape: {
35
35
  type: z.ZodLiteral<"patchElement">;
36
36
  pageRef: z.ZodString;
37
37
  ref: z.ZodString;
38
- idRef: z.ZodOptional<z.ZodString>;
38
+ rename: z.ZodOptional<z.ZodString>;
39
39
  label: z.ZodOptional<z.ZodString>;
40
40
  subType: z.ZodOptional<z.ZodString>;
41
41
  props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -73,10 +73,31 @@ export declare const renderShape: {
73
73
  slug: z.ZodOptional<z.ZodString>;
74
74
  folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
75
75
  default: z.ZodOptional<z.ZodBoolean>;
76
+ layout: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ layoutContainer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
76
78
  enabled: z.ZodOptional<z.ZodBoolean>;
77
79
  }, z.core.$strip>, z.ZodObject<{
78
80
  type: z.ZodLiteral<"deletePage">;
79
81
  ref: z.ZodString;
82
+ }, z.core.$strip>, z.ZodObject<{
83
+ type: z.ZodLiteral<"upsertLayout">;
84
+ ref: z.ZodString;
85
+ label: z.ZodOptional<z.ZodString>;
86
+ subType: z.ZodOptional<z.ZodEnum<{
87
+ footer: "footer";
88
+ main: "main";
89
+ header: "header";
90
+ div: "div";
91
+ nav: "nav";
92
+ section: "section";
93
+ article: "article";
94
+ aside: "aside";
95
+ address: "address";
96
+ figure: "figure";
97
+ }>>;
98
+ }, z.core.$strip>, z.ZodObject<{
99
+ type: z.ZodLiteral<"deleteLayout">;
100
+ ref: z.ZodString;
80
101
  }, z.core.$strip>, z.ZodObject<{
81
102
  type: z.ZodLiteral<"upsertFolder">;
82
103
  ref: z.ZodString;
@@ -117,7 +138,7 @@ export declare const renderShape: {
117
138
  params: z.ZodRecord<z.ZodString, z.ZodString>;
118
139
  enabled: z.ZodOptional<z.ZodBoolean>;
119
140
  }, z.core.$strip>>>;
120
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
141
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
121
142
  enabled: z.ZodOptional<z.ZodBoolean>;
122
143
  }, z.core.$strip>;
123
144
  }, z.core.$strip>, z.ZodObject<{
@@ -137,7 +158,7 @@ export declare const renderShape: {
137
158
  params: z.ZodRecord<z.ZodString, z.ZodString>;
138
159
  enabled: z.ZodOptional<z.ZodBoolean>;
139
160
  }, z.core.$strip>>>;
140
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
161
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
141
162
  enabled: z.ZodOptional<z.ZodBoolean>;
142
163
  }, z.core.$strip>, z.ZodObject<{
143
164
  type: z.ZodLiteral<"deleteBinding">;
@@ -167,7 +188,7 @@ export declare const renderShape: {
167
188
  action: z.ZodString;
168
189
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
169
190
  enabled: z.ZodOptional<z.ZodBoolean>;
170
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
191
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
171
192
  elementId: z.ZodOptional<z.ZodString>;
172
193
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
173
194
  }, z.core.$strip>>;
@@ -180,7 +201,7 @@ export declare const renderShape: {
180
201
  action: z.ZodOptional<z.ZodString>;
181
202
  params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
182
203
  enabled: z.ZodOptional<z.ZodBoolean>;
183
- when: z.ZodOptional<z.ZodType<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/plitzi-ui/components/QueryBuilder').RuleGroup, unknown>>>;
204
+ when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
184
205
  elementId: z.ZodOptional<z.ZodString>;
185
206
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
186
207
  }, z.core.$strip>, z.ZodObject<{
@@ -469,6 +490,38 @@ export declare const renderShape: {
469
490
  custom: "custom";
470
491
  }>;
471
492
  name: z.ZodString;
493
+ }, z.core.$strip>, z.ZodObject<{
494
+ type: z.ZodLiteral<"upsertFont">;
495
+ family: z.ZodString;
496
+ source: z.ZodEnum<{
497
+ system: "system";
498
+ hosted: "hosted";
499
+ google: "google";
500
+ remote: "remote";
501
+ }>;
502
+ fallback: z.ZodString;
503
+ weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
504
+ styles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
505
+ normal: "normal";
506
+ italic: "italic";
507
+ }>>>;
508
+ stylesheet: z.ZodOptional<z.ZodString>;
509
+ files: z.ZodOptional<z.ZodArray<z.ZodObject<{
510
+ weight: z.ZodNumber;
511
+ style: z.ZodEnum<{
512
+ normal: "normal";
513
+ italic: "italic";
514
+ }>;
515
+ format: z.ZodEnum<{
516
+ woff2: "woff2";
517
+ woff: "woff";
518
+ }>;
519
+ url: z.ZodOptional<z.ZodString>;
520
+ path: z.ZodOptional<z.ZodString>;
521
+ }, z.core.$strip>>>;
522
+ }, z.core.$strip>, z.ZodObject<{
523
+ type: z.ZodLiteral<"deleteFont">;
524
+ family: z.ZodString;
472
525
  }, z.core.$strip>], "type">>;
473
526
  patch: z.ZodOptional<z.ZodBoolean>;
474
527
  renderId: z.ZodOptional<z.ZodString>;
@@ -500,6 +553,9 @@ export type RenderResponse = {
500
553
  /** The batch this render was built from, EXPANDED (repeats already unrolled). The view keeps it so a later
501
554
  * patch has something to merge into; it is never shown to the model. */
502
555
  operations: Operation[];
556
+ /** One line per interaction flow the widget actually stored — what got wired to what. Absent when the
557
+ * widget has no flows, which is most of them. */
558
+ interactions?: string[];
503
559
  warnings?: string[];
504
560
  };
505
561
  export declare const render: (input: RenderInput, options?: RenderOptions) => RenderResponse;
@@ -8,6 +8,7 @@ import { expandOperations } from "./shared/expandOperations.js";
8
8
  import { defineTool } from "./shared/tool.js";
9
9
  import { validateOperations } from "./shared/validator/index.js";
10
10
  import { auditResources } from "./shared/validator/audit.js";
11
+ import { interactionReport } from "./shared/interactionReport.js";
11
12
  import { randomUUID } from "node:crypto";
12
13
  import { z } from "zod";
13
14
  import { validateSchema } from "@plitzi/sdk-schema/helpers/schemaValidator";
@@ -19,7 +20,6 @@ var seedSpace = () => {
19
20
  space.schema.definition.name = "Widget";
20
21
  space.schema.flat[HOST_PAGE_REF] = {
21
22
  id: HOST_PAGE_REF,
22
- idRef: HOST_PAGE_REF,
23
23
  attributes: {
24
24
  slug: "",
25
25
  name: "Render",
@@ -73,7 +73,12 @@ var render = (input, options = {}) => {
73
73
  warnings: noWarnings(validation.warnings)
74
74
  };
75
75
  const audit = auditResources(space, ops);
76
- const warnings = [...validation.warnings, ...audit.warnings];
76
+ const behaviour = interactionReport(space);
77
+ const warnings = [
78
+ ...validation.warnings,
79
+ ...audit.warnings,
80
+ ...behaviour.warnings
81
+ ];
77
82
  if (audit.errors.length > 0) return {
78
83
  rendered: false,
79
84
  errors: audit.errors,
@@ -84,6 +89,7 @@ var render = (input, options = {}) => {
84
89
  return {
85
90
  rendered: true,
86
91
  operations: ops,
92
+ ...behaviour.flows ? { interactions: behaviour.flows } : {},
87
93
  rootRef: HOST_PAGE_REF,
88
94
  elementCount: Object.keys(space.schema.flat).length - 1,
89
95
  offlineData: {
@@ -155,6 +161,7 @@ var toRenderResult = (res, renderId) => {
155
161
  renderId,
156
162
  rootRef: res.rootRef,
157
163
  elementCount: res.elementCount,
164
+ ...res.interactions ? { interactions: res.interactions } : {},
158
165
  warnings: res.warnings
159
166
  };
160
167
  return {
@@ -173,7 +180,7 @@ var toRenderResult = (res, renderId) => {
173
180
  var renderTool = defineTool({
174
181
  name: "plitzi_render",
175
182
  title: "Render widget",
176
- description: "Show the user a real, rendered UI widget instead of describing one — cards, hero sections, pricing tables, forms, menus, checklists, profiles, galleries. It runs the Plitzi SDK fully offline: no backend, account, or setup. Reach for it whenever a visual layout beats prose: the user asks you to design/build/show something, OR your answer is naturally visual (a recipe → a card, a comparison → a table, steps → a checklist). Prefer showing over telling.\n\nAuthor the widget as an ordered list of `operations` that build an element tree under the pre-seeded root page \"render\". Three rules:\n1. STRUCTURE — one upsertElement builds the whole tree: set pageRef:\"render\" and give element a nested `children` array. Each element is { ref (unique), type, subType?, props?, style?, children? }; children render in order. (To attach to something you already made, use a top-level parentRef:\"<existing ref>\" instead.)\n1b. REPEATS — the moment two siblings share a shape and differ only in data (list, steps, cards, table, timeline), do NOT copy-paste them: use repeatElement { pageRef, ref (wrapper), style, template, items }. The template is written once with {{item.field}} placeholders and rendered per row; refs come out numbered (\"step-1\", \"step-2\"…). A list INSIDE each row (days with their own steps) is the same op: give the wrapping node repeat:{ items:\"{{item.<list>}}\", template:… } and put the sub-rows in the row data.\n2. STYLE — declare ALL the classes in ONE upsertDefinitions { definitions: { \"<class>\": { desktop:{ …CSS in kebab-case… } }, … } }, then attach via the element style:{ base:[\"<class ref>\"] }. Lay containers out with flex/grid. Keep the call small: one class per look, not per property.\n2a. GRAPHICS — a logo, a sparkline, a badge, a decorative shape: draw it as an INLINE <svg> in a blockHtml element (props.content), keeping a viewBox with width/height \"100%\" so its class sizes it, and fill/stroke \"currentColor\" so it follows the host theme. Budget it: a handful of paths, drawn once and reused, never a data: URI and never a full illustration — a photo-real scene costs more than the whole widget, so use an https image, a flat colour or a gradient for that. Markup only: scripts and on* handlers are rejected.\n2b. LAYOUT — it renders in a side panel, so width is free and HEIGHT is scarce. Plain containers stack children vertically, which is the tall half-empty default to avoid: put peers (metrics, plans, options, image + text) in a wrapping row — display:flex, flex-direction:row, flex-wrap:wrap, children flex-grow:\"1\" + flex-basis:\"0%\" + min-width — or a grid with grid-template-columns:\"repeat(auto-fit, minmax(160px, 1fr))\". Keep padding 12-16px and gap 8-12px, and let the outer container fill the panel. Stack only what reads in order (heading over paragraph, forms, steps, prose). Nothing carries a minimum size, so an element with no content and no size takes none — give a spacer or a rail its own height/width — while heading/paragraph do keep the margins the browser gives them (zero them, space with the parent gap).\n2c. THEME — it is embedded in the host UI, which MAY BE DARK, so never hardcode a light palette. Take colours from the host variables with a light-dark() fallback — background-color:\"var(--color-background-secondary, light-dark(#ffffff, #1f2430))\", color:\"var(--color-text-primary, light-dark(#0f172a, #e8eaed))\", border-color:\"var(--color-border-primary, light-dark(#e2e8f0, #333a48))\" — and always set `color` wherever you set `background-color` (a brand accent states its own text colour too).\n3. CONTENT — visible copy goes in props.content (text, heading, paragraph, button); heading level is the element subType (\"h1\"..\"h6\"); image/video take props.src. Write real https URLs: everything the widget loads from outside (images, media, fonts, an apiContainer endpoint) is fetched for it by the render server, so redirects and hotlink rules are handled and there is nothing to configure. It must still point at the actual file — use a URL you have seen work, and when you have none, draw the block with a gradient or an inline SVG instead of guessing one. An unknown prop comes back as a warning naming the right one.\n\nCommon types: container, heading, paragraph, text, button, link, image, video, list, listItem, markdown (plitzi://render/types lists every built-in type with descriptions). Widgets can also be data-driven and interactive — an apiContainer fetches at runtime, upsertBinding wires data into elements, and upsertInteractionFlow makes them react to clicks (see the guide).\nREAD the resource plitzi://render/guide first — it has the element/prop table, the style model and a full worked example, and following it is the difference between a widget that renders and repeated failed calls.\nITERATING — to change a widget you already rendered, do NOT rebuild it: call again with patch:true, the `renderId` that render answered with, and ONLY the operations that differ (patchDefinition, patchElement, deleteElement…). The widget merges them and reports back what it applied; address rows by the refs you already know. Patch ONLY to modify that widget: a different subject or a different kind of widget is a fresh render, without patch — a patch is merged into the previous batch, so patching a new idea leaves you with both.\nReturns a compact summary including the renderId (the widget itself is shown to the user); on failure it returns teachable errors (path + hint) — read them and retry.",
183
+ description: "Show the user a real, rendered UI widget instead of describing one — cards, hero sections, pricing tables, forms, menus, checklists, profiles, galleries. It runs the Plitzi SDK fully offline: no backend, account, or setup. Reach for it whenever a visual layout beats prose: the user asks you to design/build/show something, OR your answer is naturally visual (a recipe → a card, a comparison → a table, steps → a checklist). Prefer showing over telling.\n\nAuthor the widget as an ordered list of `operations` that build an element tree under the pre-seeded root page \"render\". Three rules:\n1. STRUCTURE — one upsertElement builds the whole tree: set pageRef:\"render\" and give element a nested `children` array. Each element is { ref (unique), type, subType?, props?, style?, children? }; children render in order. (To attach to something you already made, use a top-level parentRef:\"<existing ref>\" instead.)\n1b. REPEATS — the moment two siblings share a shape and differ only in data (list, steps, cards, table, timeline), do NOT copy-paste them: use repeatElement { pageRef, ref (wrapper), style, template, items }. The template is written once with {{item.field}} placeholders and rendered per row; refs come out numbered (\"step-1\", \"step-2\"…). A list INSIDE each row (days with their own steps) is the same op: give the wrapping node repeat:{ items:\"{{item.<list>}}\", template:… } and put the sub-rows in the row data.\n2. STYLE — declare ALL the classes in ONE upsertDefinitions { definitions: { \"<class>\": { desktop:{ …CSS in kebab-case… } }, … } }, then attach via the element style:{ base:[\"<class ref>\"] }. Lay containers out with flex/grid. Keep the call small: one class per look, not per property.\n2a. GRAPHICS — a logo, a sparkline, a badge, a decorative shape: draw it as an INLINE <svg> in a blockHtml element (props.content), keeping a viewBox with width/height \"100%\" so its class sizes it, and fill/stroke \"currentColor\" so it follows the host theme. Budget it: a handful of paths, drawn once and reused, never a data: URI and never a full illustration — a photo-real scene costs more than the whole widget, so use an https image, a flat colour or a gradient for that. Markup only: scripts and on* handlers are rejected.\n2b. LAYOUT — it renders in a side panel, so width is free and HEIGHT is scarce. Plain containers stack children vertically, which is the tall half-empty default to avoid: put peers (metrics, plans, options, image + text) in a wrapping row — display:flex, flex-direction:row, flex-wrap:wrap, children flex-grow:\"1\" + flex-basis:\"0%\" + min-width — or a grid with grid-template-columns:\"repeat(auto-fit, minmax(160px, 1fr))\". Keep padding 12-16px and gap 8-12px, and let the outer container fill the panel. Stack only what reads in order (heading over paragraph, forms, steps, prose). Nothing carries a minimum size, so an element with no content and no size takes none — give a spacer or a rail its own height/width — while heading/paragraph do keep the margins the browser gives them (zero them, space with the parent gap).\n2c. THEME — it is embedded in the host UI, which MAY BE DARK, so never hardcode a light palette. Take colours from the host variables with a light-dark() fallback — background-color:\"var(--color-background-secondary, light-dark(#ffffff, #1f2430))\", color:\"var(--color-text-primary, light-dark(#0f172a, #e8eaed))\", border-color:\"var(--color-border-primary, light-dark(#e2e8f0, #333a48))\" — and always set `color` wherever you set `background-color` (a brand accent states its own text colour too).\n3. CONTENT — visible copy goes in props.content (text, heading, paragraph, button); heading level is the element subType (\"h1\"..\"h6\"); image/video take props.src. Write real https URLs: everything the widget loads from outside (images, media, fonts, an apiContainer endpoint) is fetched for it by the render server, so redirects and hotlink rules are handled and there is nothing to configure. It must still point at the actual file — use a URL you have seen work, and when you have none, draw the block with a gradient or an inline SVG instead of guessing one. An unknown prop comes back as a warning naming the right one.\n\nCommon types: container, heading, paragraph, text, button, link, image, video, list, listItem, markdown (plitzi://render/types lists every built-in type with descriptions). Widgets can also be data-driven and interactive — an apiContainer fetches at runtime, upsertBinding wires data into elements, and upsertInteractionFlow makes them react to clicks (see the guide).\nREAD the resource plitzi://render/guide first — it has the element/prop table, the style model and a full worked example, and following it is the difference between a widget that renders and repeated failed calls.\nITERATING — to change a widget you already rendered, do NOT rebuild it: call again with patch:true, the `renderId` that render answered with, and ONLY the operations that differ (patchDefinition, patchElement, deleteElement…). The widget merges them and reports back what it applied; address rows by the refs you already know. Patch ONLY to modify that widget: a different subject or a different kind of widget is a fresh render, without patch — a patch is merged into the previous batch, so patching a new idea leaves you with both.\nReturns a compact summary including the renderId (the widget itself is shown to the user), plus — when the widget has interaction flows — an `interactions` line per flow naming what got wired to what. That reports the WIRING, not that a click was performed: say what you connected, never that you verified it at runtime. On failure it returns teachable errors (path + hint) — read them and retry.",
177
184
  inputShape: renderShape,
178
185
  access: "read",
179
186
  spaceless: true,