@plitzi/sdk-mcp 0.38.7 → 0.38.8

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 (66) hide show
  1. package/CHANGELOG.md +192 -0
  2. package/README.md +9 -9
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +2 -3
  5. package/dist/modules/mcp/helpers/guide.js +37 -21
  6. package/dist/modules/mcp/index.d.ts +2 -2
  7. package/dist/modules/mcp/server.d.ts +4 -4
  8. package/dist/modules/mcp/server.js +10 -5
  9. package/dist/modules/mcp/tests/cheapMistakes.test.d.ts +1 -0
  10. package/dist/modules/mcp/tests/helpers.d.ts +9 -2
  11. package/dist/modules/mcp/tests/intents.test.d.ts +1 -0
  12. package/dist/modules/mcp/tests/look.test.d.ts +1 -0
  13. package/dist/modules/mcp/tools/apply/index.d.ts +64 -50
  14. package/dist/modules/mcp/tools/apply/index.js +70 -20
  15. package/dist/modules/mcp/tools/describeOperation.d.ts +11 -0
  16. package/dist/modules/mcp/tools/describeOperation.js +40 -0
  17. package/dist/modules/mcp/tools/describeOperation.test.d.ts +1 -0
  18. package/dist/modules/mcp/tools/index.d.ts +1 -6
  19. package/dist/modules/mcp/tools/index.js +12 -9
  20. package/dist/modules/mcp/tools/intents.d.ts +5 -0
  21. package/dist/modules/mcp/tools/intents.js +201 -0
  22. package/dist/modules/mcp/tools/look.d.ts +17 -0
  23. package/dist/modules/mcp/tools/look.js +32 -0
  24. package/dist/modules/mcp/tools/operations/closed.d.ts +7 -0
  25. package/dist/modules/mcp/tools/operations/closed.js +29 -0
  26. package/dist/modules/mcp/tools/operations/index.d.ts +229 -180
  27. package/dist/modules/mcp/tools/operations/index.js +72 -51
  28. package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +1 -1
  29. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +1 -1
  30. package/dist/modules/mcp/tools/operations/schema/operations.d.ts +2 -2
  31. package/dist/modules/mcp/tools/operations/schema/shared.d.ts +2 -2
  32. package/dist/modules/mcp/tools/operations/schema/shared.js +7 -6
  33. package/dist/modules/mcp/tools/operations/schemaIds.js +4 -4
  34. package/dist/modules/mcp/tools/render.d.ts +40 -40
  35. package/dist/modules/mcp/tools/render.js +5 -1
  36. package/dist/modules/mcp/tools/shared/draftBatch.d.ts +3 -2
  37. package/dist/modules/mcp/tools/shared/draftBatch.js +16 -5
  38. package/dist/modules/mcp/tools/shared/effects.d.ts +2 -0
  39. package/dist/modules/mcp/tools/shared/effects.js +155 -0
  40. package/dist/modules/mcp/tools/shared/effects.test.d.ts +1 -0
  41. package/dist/modules/mcp/tools/shared/look.d.ts +32 -0
  42. package/dist/modules/mcp/tools/shared/look.js +128 -0
  43. package/dist/modules/mcp/tools/shared/normalizeOperations.d.ts +6 -0
  44. package/dist/modules/mcp/tools/shared/normalizeOperations.js +37 -0
  45. package/dist/modules/mcp/tools/shared/repeats.d.ts +13 -0
  46. package/dist/modules/mcp/tools/shared/repeats.js +38 -0
  47. package/dist/modules/mcp/tools/shared/tool.d.ts +9 -6
  48. package/dist/modules/mcp/tools/shared/tool.js +2 -1
  49. package/dist/modules/mcp/tools/shared/validator/context.d.ts +0 -1
  50. package/dist/modules/mcp/tools/shared/validator/elements.js +0 -1
  51. package/dist/modules/mcp/tools/shared/validator/index.js +25 -2
  52. package/dist/modules/mcp/types/screenshotTypes.d.ts +3 -3
  53. package/dist/modules/mcp/types/toolTypes.d.ts +2 -4
  54. package/dist/options.d.ts +4 -5
  55. package/dist/preview/createPreview.js +9 -18
  56. package/package.json +7 -7
  57. package/skills/plitzi-render/SKILL.md +8 -184
  58. package/skills/plitzi-render/reference/good-call.md +88 -0
  59. package/skills/plitzi-render/reference/interactive.md +64 -0
  60. package/skills/plitzi-render/reference/looks.md +29 -0
  61. package/dist/modules/mcp/tools/preview.d.ts +0 -1423
  62. package/dist/modules/mcp/tools/preview.js +0 -37
  63. package/dist/modules/mcp/tools/screenshot.d.ts +0 -1708
  64. package/dist/modules/mcp/tools/screenshot.js +0 -127
  65. package/dist/modules/mcp/tools/validate.d.ts +0 -1699
  66. package/dist/modules/mcp/tools/validate.js +0 -32
@@ -15,7 +15,7 @@ export declare const applyShape: {
15
15
  after: "after";
16
16
  inside: "inside";
17
17
  }>>;
18
- }, z.core.$strip>, z.ZodObject<{
18
+ }, z.core.$strict>, z.ZodObject<{
19
19
  type: z.ZodLiteral<"repeatElement">;
20
20
  pageRef: z.ZodString;
21
21
  ref: z.ZodString;
@@ -33,7 +33,7 @@ export declare const applyShape: {
33
33
  }>>;
34
34
  template: z.ZodType<import('../operations/schema').TemplateElement, unknown, z.core.$ZodTypeInternals<import('../operations/schema').TemplateElement, unknown>>;
35
35
  items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
36
- }, z.core.$strip>, z.ZodObject<{
36
+ }, z.core.$strict>, z.ZodObject<{
37
37
  type: z.ZodLiteral<"patchElement">;
38
38
  pageRef: z.ZodString;
39
39
  ref: z.ZodString;
@@ -58,11 +58,11 @@ export declare const applyShape: {
58
58
  anchor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
59
  motion: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
60
60
  quiet: z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodString>>>;
61
- }, z.core.$strip>, z.ZodObject<{
61
+ }, z.core.$strict>, z.ZodObject<{
62
62
  type: z.ZodLiteral<"deleteElement">;
63
63
  pageRef: z.ZodString;
64
64
  ref: z.ZodString;
65
- }, z.core.$strip>, z.ZodObject<{
65
+ }, z.core.$strict>, z.ZodObject<{
66
66
  type: z.ZodLiteral<"moveElement">;
67
67
  pageRef: z.ZodString;
68
68
  ref: z.ZodString;
@@ -72,7 +72,7 @@ export declare const applyShape: {
72
72
  after: "after";
73
73
  inside: "inside";
74
74
  }>;
75
- }, z.core.$strip>, z.ZodObject<{
75
+ }, z.core.$strict>, z.ZodObject<{
76
76
  type: z.ZodLiteral<"upsertPage">;
77
77
  ref: z.ZodString;
78
78
  label: z.ZodOptional<z.ZodString>;
@@ -83,10 +83,10 @@ export declare const applyShape: {
83
83
  layoutContainer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
84
84
  enabled: z.ZodOptional<z.ZodBoolean>;
85
85
  flag: z.ZodOptional<z.ZodNullable<z.ZodString>>;
86
- }, z.core.$strip>, z.ZodObject<{
86
+ }, z.core.$strict>, z.ZodObject<{
87
87
  type: z.ZodLiteral<"deletePage">;
88
88
  ref: z.ZodString;
89
- }, z.core.$strip>, z.ZodObject<{
89
+ }, z.core.$strict>, z.ZodObject<{
90
90
  type: z.ZodLiteral<"upsertLayout">;
91
91
  ref: z.ZodString;
92
92
  label: z.ZodOptional<z.ZodString>;
@@ -102,19 +102,19 @@ export declare const applyShape: {
102
102
  address: "address";
103
103
  figure: "figure";
104
104
  }>>;
105
- }, z.core.$strip>, z.ZodObject<{
105
+ }, z.core.$strict>, z.ZodObject<{
106
106
  type: z.ZodLiteral<"deleteLayout">;
107
107
  ref: z.ZodString;
108
- }, z.core.$strip>, z.ZodObject<{
108
+ }, z.core.$strict>, z.ZodObject<{
109
109
  type: z.ZodLiteral<"upsertFolder">;
110
110
  ref: z.ZodString;
111
111
  name: z.ZodOptional<z.ZodString>;
112
112
  slug: z.ZodOptional<z.ZodString>;
113
113
  parentId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
114
- }, z.core.$strip>, z.ZodObject<{
114
+ }, z.core.$strict>, z.ZodObject<{
115
115
  type: z.ZodLiteral<"deleteFolder">;
116
116
  ref: z.ZodString;
117
- }, z.core.$strip>, z.ZodObject<{
117
+ }, z.core.$strict>, z.ZodObject<{
118
118
  type: z.ZodLiteral<"upsertVariable">;
119
119
  name: z.ZodString;
120
120
  variableType: z.ZodString;
@@ -124,10 +124,10 @@ export declare const applyShape: {
124
124
  when: z.ZodUnknown;
125
125
  value: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>;
126
126
  }, z.core.$strip>>>;
127
- }, z.core.$strip>, z.ZodObject<{
127
+ }, z.core.$strict>, z.ZodObject<{
128
128
  type: z.ZodLiteral<"deleteVariable">;
129
129
  name: z.ZodString;
130
- }, z.core.$strip>, z.ZodObject<{
130
+ }, z.core.$strict>, z.ZodObject<{
131
131
  type: z.ZodLiteral<"upsertFlag">;
132
132
  name: z.ZodString;
133
133
  description: z.ZodOptional<z.ZodString>;
@@ -136,10 +136,10 @@ export declare const applyShape: {
136
136
  when: z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>;
137
137
  value: z.ZodBoolean;
138
138
  }, z.core.$strip>>>;
139
- }, z.core.$strip>, z.ZodObject<{
139
+ }, z.core.$strict>, z.ZodObject<{
140
140
  type: z.ZodLiteral<"deleteFlag">;
141
141
  name: z.ZodString;
142
- }, z.core.$strip>, z.ZodObject<{
142
+ }, z.core.$strict>, z.ZodObject<{
143
143
  type: z.ZodLiteral<"upsertBinding">;
144
144
  pageRef: z.ZodString;
145
145
  ref: z.ZodString;
@@ -159,8 +159,8 @@ export declare const applyShape: {
159
159
  }, z.core.$strip>>>;
160
160
  when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
161
161
  enabled: z.ZodOptional<z.ZodBoolean>;
162
- }, z.core.$strip>;
163
- }, z.core.$strip>, z.ZodObject<{
162
+ }, z.core.$strict>;
163
+ }, z.core.$strict>, z.ZodObject<{
164
164
  type: z.ZodLiteral<"patchBinding">;
165
165
  pageRef: z.ZodString;
166
166
  ref: z.ZodString;
@@ -179,7 +179,7 @@ export declare const applyShape: {
179
179
  }, z.core.$strip>>>;
180
180
  when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
181
181
  enabled: z.ZodOptional<z.ZodBoolean>;
182
- }, z.core.$strip>, z.ZodObject<{
182
+ }, z.core.$strict>, z.ZodObject<{
183
183
  type: z.ZodLiteral<"deleteBinding">;
184
184
  pageRef: z.ZodString;
185
185
  ref: z.ZodString;
@@ -190,7 +190,7 @@ export declare const applyShape: {
190
190
  }>;
191
191
  to: z.ZodString;
192
192
  id: z.ZodOptional<z.ZodString>;
193
- }, z.core.$strip>, z.ZodObject<{
193
+ }, z.core.$strict>, z.ZodObject<{
194
194
  type: z.ZodLiteral<"upsertInteractionFlow">;
195
195
  pageRef: z.ZodString;
196
196
  ref: z.ZodString;
@@ -216,8 +216,8 @@ export declare const applyShape: {
216
216
  }>>;
217
217
  elementId: z.ZodOptional<z.ZodString>;
218
218
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
219
- }, z.core.$strip>>;
220
- }, z.core.$strip>, z.ZodObject<{
219
+ }, z.core.$strict>>;
220
+ }, z.core.$strict>, z.ZodObject<{
221
221
  type: z.ZodLiteral<"patchInteractionNode">;
222
222
  pageRef: z.ZodString;
223
223
  ref: z.ZodString;
@@ -235,13 +235,13 @@ export declare const applyShape: {
235
235
  }>>;
236
236
  elementId: z.ZodOptional<z.ZodString>;
237
237
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
238
- }, z.core.$strip>, z.ZodObject<{
238
+ }, z.core.$strict>, z.ZodObject<{
239
239
  type: z.ZodLiteral<"deleteInteraction">;
240
240
  pageRef: z.ZodString;
241
241
  ref: z.ZodString;
242
242
  flowId: z.ZodOptional<z.ZodString>;
243
243
  nodeId: z.ZodOptional<z.ZodString>;
244
- }, z.core.$strip>, z.ZodObject<{
244
+ }, z.core.$strict>, z.ZodObject<{
245
245
  type: z.ZodLiteral<"patchSettings">;
246
246
  customCss: z.ZodOptional<z.ZodString>;
247
247
  notifications: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodString>>>;
@@ -289,7 +289,7 @@ export declare const applyShape: {
289
289
  }>>;
290
290
  presence: z.ZodOptional<z.ZodBoolean>;
291
291
  }, z.core.$strip>>>>;
292
- }, z.core.$strip>, z.ZodObject<{
292
+ }, z.core.$strict>, z.ZodObject<{
293
293
  type: z.ZodLiteral<"upsertComponent">;
294
294
  ref: z.ZodString;
295
295
  label: z.ZodOptional<z.ZodString>;
@@ -297,10 +297,10 @@ export declare const applyShape: {
297
297
  slots: z.ZodOptional<z.ZodArray<z.ZodString>>;
298
298
  fromRef: z.ZodOptional<z.ZodString>;
299
299
  instanceRef: z.ZodOptional<z.ZodString>;
300
- }, z.core.$strip>, z.ZodObject<{
300
+ }, z.core.$strict>, z.ZodObject<{
301
301
  type: z.ZodLiteral<"deleteComponent">;
302
302
  ref: z.ZodString;
303
- }, z.core.$strip>, z.ZodObject<{
303
+ }, z.core.$strict>, z.ZodObject<{
304
304
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
305
305
  tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
306
306
  mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
@@ -451,7 +451,7 @@ export declare const applyShape: {
451
451
  }, z.core.$strip>>>;
452
452
  type: z.ZodLiteral<"upsertDefinition">;
453
453
  ref: z.ZodString;
454
- }, z.core.$strip>, z.ZodObject<{
454
+ }, z.core.$strict>, z.ZodObject<{
455
455
  type: z.ZodLiteral<"upsertDefinitions">;
456
456
  definitions: z.ZodRecord<z.ZodString, z.ZodObject<{
457
457
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
@@ -603,7 +603,7 @@ export declare const applyShape: {
603
603
  }, z.core.$strip>>>;
604
604
  }, z.core.$strip>>>;
605
605
  }, z.core.$strip>>;
606
- }, z.core.$strip>, z.ZodObject<{
606
+ }, z.core.$strict>, z.ZodObject<{
607
607
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
608
608
  tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
609
609
  mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
@@ -754,10 +754,10 @@ export declare const applyShape: {
754
754
  }, z.core.$strip>>>;
755
755
  type: z.ZodLiteral<"patchDefinition">;
756
756
  ref: z.ZodString;
757
- }, z.core.$strip>, z.ZodObject<{
757
+ }, z.core.$strict>, z.ZodObject<{
758
758
  type: z.ZodLiteral<"deleteDefinition">;
759
759
  ref: z.ZodString;
760
- }, z.core.$strip>, z.ZodObject<{
760
+ }, z.core.$strict>, z.ZodObject<{
761
761
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
762
762
  tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
763
763
  mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
@@ -908,7 +908,7 @@ export declare const applyShape: {
908
908
  }, z.core.$strip>>>;
909
909
  type: z.ZodLiteral<"upsertGlobalStyle">;
910
910
  componentType: z.ZodString;
911
- }, z.core.$strip>, z.ZodObject<{
911
+ }, z.core.$strict>, z.ZodObject<{
912
912
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
913
913
  tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
914
914
  mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
@@ -1059,10 +1059,10 @@ export declare const applyShape: {
1059
1059
  }, z.core.$strip>>>;
1060
1060
  type: z.ZodLiteral<"patchGlobalStyle">;
1061
1061
  componentType: z.ZodString;
1062
- }, z.core.$strip>, z.ZodObject<{
1062
+ }, z.core.$strict>, z.ZodObject<{
1063
1063
  type: z.ZodLiteral<"deleteGlobalStyle">;
1064
1064
  componentType: z.ZodString;
1065
- }, z.core.$strip>, z.ZodObject<{
1065
+ }, z.core.$strict>, z.ZodObject<{
1066
1066
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
1067
1067
  tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
1068
1068
  mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>>;
@@ -1213,7 +1213,7 @@ export declare const applyShape: {
1213
1213
  }, z.core.$strip>>>;
1214
1214
  type: z.ZodLiteral<"upsertIdStyle">;
1215
1215
  targetId: z.ZodString;
1216
- }, z.core.$strip>, z.ZodObject<{
1216
+ }, z.core.$strict>, z.ZodObject<{
1217
1217
  desktop: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
1218
1218
  tablet: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
1219
1219
  mobile: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodNull]>>>;
@@ -1364,10 +1364,10 @@ export declare const applyShape: {
1364
1364
  }, z.core.$strip>>>;
1365
1365
  type: z.ZodLiteral<"patchIdStyle">;
1366
1366
  targetId: z.ZodString;
1367
- }, z.core.$strip>, z.ZodObject<{
1367
+ }, z.core.$strict>, z.ZodObject<{
1368
1368
  type: z.ZodLiteral<"deleteIdStyle">;
1369
1369
  targetId: z.ZodString;
1370
- }, z.core.$strip>, z.ZodObject<{
1370
+ }, z.core.$strict>, z.ZodObject<{
1371
1371
  type: z.ZodLiteral<"upsertStyleVariable">;
1372
1372
  category: z.ZodEnum<{
1373
1373
  color: "color";
@@ -1381,7 +1381,7 @@ export declare const applyShape: {
1381
1381
  dark: z.ZodOptional<z.ZodString>;
1382
1382
  default: z.ZodOptional<z.ZodString>;
1383
1383
  }, z.core.$strip>]>;
1384
- }, z.core.$strip>, z.ZodObject<{
1384
+ }, z.core.$strict>, z.ZodObject<{
1385
1385
  type: z.ZodLiteral<"deleteStyleVariable">;
1386
1386
  category: z.ZodEnum<{
1387
1387
  color: "color";
@@ -1390,7 +1390,7 @@ export declare const applyShape: {
1390
1390
  custom: "custom";
1391
1391
  }>;
1392
1392
  name: z.ZodString;
1393
- }, z.core.$strip>, z.ZodObject<{
1393
+ }, z.core.$strict>, z.ZodObject<{
1394
1394
  type: z.ZodLiteral<"upsertFont">;
1395
1395
  family: z.ZodString;
1396
1396
  source: z.ZodEnum<{
@@ -1419,10 +1419,10 @@ export declare const applyShape: {
1419
1419
  url: z.ZodOptional<z.ZodString>;
1420
1420
  path: z.ZodOptional<z.ZodString>;
1421
1421
  }, z.core.$strip>>>;
1422
- }, z.core.$strip>, z.ZodObject<{
1422
+ }, z.core.$strict>, z.ZodObject<{
1423
1423
  type: z.ZodLiteral<"deleteFont">;
1424
1424
  family: z.ZodString;
1425
- }, z.core.$strip>, z.ZodObject<{
1425
+ }, z.core.$strict>, z.ZodObject<{
1426
1426
  type: z.ZodLiteral<"upsertConnector">;
1427
1427
  ref: z.ZodString;
1428
1428
  name: z.ZodString;
@@ -1510,7 +1510,7 @@ export declare const applyShape: {
1510
1510
  }, z.core.$strip>>;
1511
1511
  }, z.core.$strip>>>;
1512
1512
  }, z.core.$strip>;
1513
- }, z.core.$strip>, z.ZodObject<{
1513
+ }, z.core.$strict>, z.ZodObject<{
1514
1514
  type: z.ZodLiteral<"patchConnector">;
1515
1515
  ref: z.ZodString;
1516
1516
  name: z.ZodOptional<z.ZodString>;
@@ -1598,10 +1598,10 @@ export declare const applyShape: {
1598
1598
  }, z.core.$strip>>;
1599
1599
  }, z.core.$strip>>>>;
1600
1600
  }, z.core.$strip>>;
1601
- }, z.core.$strip>, z.ZodObject<{
1601
+ }, z.core.$strict>, z.ZodObject<{
1602
1602
  type: z.ZodLiteral<"deleteConnector">;
1603
1603
  ref: z.ZodString;
1604
- }, z.core.$strip>, z.ZodObject<{
1604
+ }, z.core.$strict>, z.ZodObject<{
1605
1605
  type: z.ZodLiteral<"upsertAction">;
1606
1606
  ref: z.ZodString;
1607
1607
  name: z.ZodString;
@@ -1640,7 +1640,7 @@ export declare const applyShape: {
1640
1640
  maxNodes: z.ZodOptional<z.ZodNumber>;
1641
1641
  maxRequests: z.ZodOptional<z.ZodNumber>;
1642
1642
  }, z.core.$strip>>;
1643
- }, z.core.$strip>, z.ZodObject<{
1643
+ }, z.core.$strict>, z.ZodObject<{
1644
1644
  type: z.ZodLiteral<"patchAction">;
1645
1645
  ref: z.ZodString;
1646
1646
  name: z.ZodOptional<z.ZodString>;
@@ -1679,24 +1679,38 @@ export declare const applyShape: {
1679
1679
  maxNodes: z.ZodOptional<z.ZodNumber>;
1680
1680
  maxRequests: z.ZodOptional<z.ZodNumber>;
1681
1681
  }, z.core.$strip>>;
1682
- }, z.core.$strip>, z.ZodObject<{
1682
+ }, z.core.$strict>, z.ZodObject<{
1683
1683
  type: z.ZodLiteral<"deleteAction">;
1684
1684
  ref: z.ZodString;
1685
- }, z.core.$strip>, z.ZodObject<{
1685
+ }, z.core.$strict>, z.ZodObject<{
1686
1686
  type: z.ZodLiteral<"upsertFunctionFile">;
1687
1687
  path: z.ZodString;
1688
1688
  content: z.ZodString;
1689
- }, z.core.$strip>, z.ZodObject<{
1689
+ }, z.core.$strict>, z.ZodObject<{
1690
1690
  type: z.ZodLiteral<"deleteFunctionFile">;
1691
1691
  path: z.ZodString;
1692
- }, z.core.$strip>, z.ZodObject<{
1692
+ }, z.core.$strict>, z.ZodObject<{
1693
1693
  type: z.ZodLiteral<"upsertDataFile">;
1694
1694
  path: z.ZodString;
1695
1695
  content: z.ZodString;
1696
- }, z.core.$strip>, z.ZodObject<{
1696
+ }, z.core.$strict>, z.ZodObject<{
1697
1697
  type: z.ZodLiteral<"deleteDataFile">;
1698
1698
  path: z.ZodString;
1699
- }, z.core.$strip>], "type">>;
1699
+ }, z.core.$strict>], "type">>;
1700
+ look: z.ZodOptional<z.ZodEnum<{
1701
+ image: "image";
1702
+ accessibility: "accessibility";
1703
+ html: "html";
1704
+ both: "both";
1705
+ }>>;
1706
+ pageRef: z.ZodOptional<z.ZodString>;
1707
+ viewport: z.ZodOptional<z.ZodEnum<{
1708
+ desktop: "desktop";
1709
+ mobile: "mobile";
1710
+ both: "both";
1711
+ }>>;
1712
+ fullPage: z.ZodOptional<z.ZodBoolean>;
1700
1713
  };
1714
+ export declare const NOTHING_CHANGED = "Nothing changed: every operation left the space as it was.";
1701
1715
  export declare const apply: (input: ApplyInput, space: Space, persisters?: Persisters) => Promise<WriteResponse>;
1702
1716
  export declare const applyTool: import('..').ToolDef;
@@ -2,7 +2,10 @@ import { dataFileUri, dataUri, functionFileUri, functionsUri } from "../../helpe
2
2
  import { changedResources, conflictMessage, detectConflicts, resolvedElements } from "./writeResult.js";
3
3
  import { environment, operations } from "../operations/index.js";
4
4
  import { draftBatch } from "../shared/draftBatch.js";
5
- import { defineTool } from "../shared/tool.js";
5
+ import { effectsOf } from "../shared/effects.js";
6
+ import { fullPage, lookAt, pageRef, viewport } from "../shared/look.js";
7
+ import { AGAIN, REPEATED, batchKey, forgetRefused, noteRefused, timesRefused } from "../shared/repeats.js";
8
+ import { defineTool, imageResult } from "../shared/tool.js";
6
9
  import { z } from "zod";
7
10
  import { generateCache } from "@plitzi/sdk-style/StyleHelper";
8
11
  //#region src/modules/mcp/tools/apply/index.ts
@@ -10,8 +13,18 @@ var applyShape = {
10
13
  environment,
11
14
  dryRun: z.boolean().optional().describe("Validate and apply in memory only, WITHOUT persisting. Returns the same result (changed versions + full element detail) so you can inspect the outcome and decide on more changes before committing for real."),
12
15
  expectedResourceVersions: z.record(z.string(), z.string()).optional().describe("Resource URI → the stateVersion you read; guards against concurrent edits"),
13
- operations
16
+ operations,
17
+ look: z.enum([
18
+ "html",
19
+ "image",
20
+ "accessibility",
21
+ "both"
22
+ ]).optional().describe("Also render the page: with dryRun, as the batch would leave it (nothing saved); without, as it was saved. \"html\" the markup, \"image\" a PNG, \"accessibility\" the outline a screen reader reads (text, far cheaper than an image), \"both\" image and outline. Check, look and then save with the same operations — written once."),
23
+ pageRef,
24
+ viewport,
25
+ fullPage
14
26
  };
27
+ var NOTHING_CHANGED = "Nothing changed: every operation left the space as it was.";
15
28
  var noWarnings = (warnings) => warnings.length > 0 ? warnings : void 0;
16
29
  /** Why the platform did not save the functions, as the batch's errors: each problem where it is, or the refusal. */
17
30
  var functionsErrors = (saved, env) => "problems" in saved ? saved.problems.map((problem) => ({
@@ -62,7 +75,9 @@ var apply = async (input, space, persisters) => {
62
75
  errors: result.errors,
63
76
  warnings: noWarnings(result.warnings)
64
77
  };
65
- const { draft, outcome, warnings, suggestions } = result;
78
+ const { draft, outcome, suggestions } = result;
79
+ const effects = effectsOf(space, draft);
80
+ const warnings = effects.length > 0 ? result.warnings : [NOTHING_CHANGED, ...result.warnings];
66
81
  if (input.dryRun) return {
67
82
  applied: false,
68
83
  dryRun: true,
@@ -71,12 +86,13 @@ var apply = async (input, space, persisters) => {
71
86
  updated: outcome.updated,
72
87
  deleted: outcome.deleted
73
88
  },
89
+ effects,
74
90
  changed: changedResources(draft, env, outcome.staleResources),
75
91
  elements: resolvedElements(draft, env, outcome.elementRefs),
76
92
  warnings: noWarnings(warnings),
77
93
  suggestions: noWarnings(suggestions)
78
94
  };
79
- let persisted = true;
95
+ const unsaved = [];
80
96
  if (outcome.changedFunctions && draft.functions) {
81
97
  if (persisters?.saveFunctions) {
82
98
  const saved = await persisters.saveFunctions(draft.functions.files, space.functions?.version ?? "");
@@ -92,7 +108,7 @@ var apply = async (input, space, persisters) => {
92
108
  errors: functionsErrors(saved, env),
93
109
  warnings: noWarnings(warnings)
94
110
  };
95
- } else persisted = false;
111
+ } else unsaved.push("the functions");
96
112
  }
97
113
  if (outcome.changedData && draft.data) {
98
114
  if (persisters?.saveData) {
@@ -109,56 +125,90 @@ var apply = async (input, space, persisters) => {
109
125
  errors: dataErrors(saved, env),
110
126
  warnings: noWarnings([...outcome.changedFunctions && persisters.saveFunctions ? ["The functions of this batch were saved; the data was not — apply the data again once fixed"] : [], ...warnings])
111
127
  };
112
- } else persisted = false;
128
+ } else unsaved.push("the data");
113
129
  }
114
130
  if (outcome.changedSchema) {
115
131
  if (persisters?.schema) await persisters.schema(draft.schema);
116
- else persisted = false;
132
+ else unsaved.push("the schema");
117
133
  }
118
134
  if (outcome.changedStyle) {
119
135
  if (persisters?.style) {
120
136
  draft.style.cache = generateCache(draft.style);
121
137
  await persisters.style(draft.style);
122
- } else persisted = false;
138
+ } else unsaved.push("the style");
123
139
  }
124
140
  for (const id of outcome.changedConnectors) {
125
141
  const entry = draft.connectors.find((item) => item.id === id);
126
142
  if (entry && persisters?.saveConnector) await persisters.saveConnector(entry);
127
- else persisted = false;
143
+ else unsaved.push(`connector ${id}`);
128
144
  }
129
145
  for (const id of outcome.deletedConnectors) if (persisters?.deleteConnector) await persisters.deleteConnector(id);
130
- else persisted = false;
146
+ else unsaved.push(`the removal of connector ${id}`);
131
147
  for (const id of outcome.changedActions) {
132
148
  const entry = draft.actions.find((item) => item.id === id);
133
149
  if (entry && persisters?.saveAction) await persisters.saveAction(entry);
134
- else persisted = false;
150
+ else unsaved.push(`action ${id}`);
135
151
  }
136
152
  for (const id of outcome.deletedActions) if (persisters?.deleteAction) await persisters.deleteAction(id);
137
- else persisted = false;
153
+ else unsaved.push(`the removal of action ${id}`);
138
154
  return {
139
155
  applied: true,
140
- persisted,
156
+ persisted: unsaved.length === 0,
141
157
  summary: {
142
158
  created: outcome.created,
143
159
  updated: outcome.updated,
144
160
  deleted: outcome.deleted
145
161
  },
162
+ effects,
146
163
  changed: changedResources(draft, env, outcome.staleResources),
147
164
  elements: resolvedElements(draft, env, outcome.elementRefs),
148
- warnings: noWarnings(warnings),
165
+ warnings: noWarnings([...unsaved.length > 0 ? [`NOT saved: ${unsaved.join(", ")} — this server has no store to save it in`] : [], ...warnings]),
149
166
  suggestions: noWarnings(suggestions)
150
167
  };
151
168
  };
152
169
  var applyTool = defineTool({
153
170
  name: "plitzi_apply",
154
171
  title: "Apply",
155
- description: "Validate, apply and persist a batch of operations atomically. Returns the changed resources and their new versions, plus the full detail of every element it created or updated. Pass dryRun to apply in memory only (inspect the outcome without committing). Rejects the whole batch on any error or version conflict — INCLUDING a pre-existing malformation in any resource the batch touches (fix it in the same batch to unblock the save).",
172
+ description: "Validate, apply and persist a batch of operations atomically. Returns `effects` (what it changed, read off the space), the changed resources’ new versions and each created or updated element’s detail. Pass dryRun to apply in memory only (inspect the outcome without committing), and `look` to see the page as the batch leaves it. Rejects the whole batch on any error or version conflict — INCLUDING a pre-existing malformation in any resource the batch touches (fix it in the same batch to unblock the save).",
156
173
  inputShape: applyShape,
174
+ carriesOperations: true,
157
175
  access: "write",
158
- run: (input, ctx) => apply({
159
- ...input,
160
- environment: ctx.env
161
- }, ctx.space, ctx.persisters)
176
+ run: async (input, ctx) => {
177
+ const key = batchKey(`${String(ctx.spaceId ?? "")}:${ctx.env}`, input.operations);
178
+ const before = timesRefused(key);
179
+ if (before >= 2) return REPEATED;
180
+ const result = await apply({
181
+ ...input,
182
+ environment: ctx.env
183
+ }, ctx.space, ctx.persisters);
184
+ if (result.errors?.length) {
185
+ noteRefused(key);
186
+ return before === 1 ? {
187
+ ...result,
188
+ again: AGAIN
189
+ } : result;
190
+ }
191
+ forgetRefused(key);
192
+ if (!input.look || !result.applied && !result.dryRun) return result;
193
+ const look = await lookAt(ctx, {
194
+ pageRef: input.pageRef,
195
+ operations: result.dryRun ? input.operations : void 0,
196
+ view: input.look,
197
+ viewport: input.viewport,
198
+ fullPage: input.fullPage
199
+ });
200
+ if ("refused" in look) return {
201
+ ...result,
202
+ look: look.refused
203
+ };
204
+ return look.images.length > 0 ? imageResult(look.images, {
205
+ ...result,
206
+ look: look.meta
207
+ }) : {
208
+ ...result,
209
+ look: look.meta
210
+ };
211
+ }
162
212
  });
163
213
  //#endregion
164
- export { apply, applyShape, applyTool };
214
+ export { NOTHING_CHANGED, apply, applyShape, applyTool };
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ export declare const describeOperationShape: {
3
+ type: z.ZodOptional<z.ZodString>;
4
+ };
5
+ /**
6
+ * One operation's schema, by its type — the low level asked for one piece at a time, so a connection does not have to
7
+ * load all of it to write one operation. A type that does not exist is answered with the closed list and the nearest
8
+ * name: an agent that guessed is told what there is, never left to guess again.
9
+ */
10
+ export declare const describeOperation: (type: string | undefined) => Record<string, unknown>;
11
+ export declare const describeOperationTool: import('.').ToolDef;
@@ -0,0 +1,40 @@
1
+ import { OPERATIONS_BY_TYPE } from "./operations/index.js";
2
+ import { defineTool } from "./shared/tool.js";
3
+ import { closest } from "@plitzi/sdk-authoring";
4
+ import { z } from "zod";
5
+ //#region src/modules/mcp/tools/describeOperation.ts
6
+ var describeOperationShape = { type: z.string().optional().describe("The operation type, as in a batch: \"upsertElement\", \"patchDefinition\"… Left out, every type is listed.") };
7
+ /**
8
+ * One operation's schema, by its type — the low level asked for one piece at a time, so a connection does not have to
9
+ * load all of it to write one operation. A type that does not exist is answered with the closed list and the nearest
10
+ * name: an agent that guessed is told what there is, never left to guess again.
11
+ */
12
+ var describeOperation = (type) => {
13
+ const types = [...OPERATIONS_BY_TYPE.keys()];
14
+ if (type === void 0) return { types };
15
+ const schema = OPERATIONS_BY_TYPE.get(type);
16
+ if (!schema) {
17
+ const nearest = closest(type, types);
18
+ return {
19
+ error: "UNKNOWN_OPERATION",
20
+ message: `There is no "${type}" operation${nearest ? ` — did you mean "${nearest}"?` : ""}`,
21
+ ...nearest ? { describe: { type: nearest } } : {},
22
+ types
23
+ };
24
+ }
25
+ return {
26
+ type,
27
+ schema: z.toJSONSchema(schema)
28
+ };
29
+ };
30
+ var describeOperationTool = defineTool({
31
+ name: "plitzi_describe_operation",
32
+ title: "Describe an operation",
33
+ description: "The schema of one operation plitzi_apply or plitzi_render takes, by its type: every field, which are required, what each means. Without a type, every operation type there is.",
34
+ inputShape: describeOperationShape,
35
+ access: "read",
36
+ spaceless: true,
37
+ run: (input) => describeOperation(input.type)
38
+ });
39
+ //#endregion
40
+ export { describeOperation, describeOperationShape, describeOperationTool };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,12 +1,7 @@
1
1
  import { ToolDef } from './shared/tool';
2
2
  export { apply, applyShape } from './apply';
3
- export { validate, validateShape } from './validate';
4
3
  export { search, searchShape } from './search';
5
4
  export { read, readShape } from './read';
6
- export { previewShape } from './preview';
7
- export { render, renderShape } from './render';
8
- export { screenshotShape } from './screenshot';
9
- export { applyOperations } from './apply/dispatch';
10
5
  export { validateOperations } from './shared/validator';
11
6
  export { operation } from './operations';
12
7
  /** The MCP tool registry — the single source the server registers from. Adding a tool is: create its file with a
@@ -15,4 +10,4 @@ export declare const tools: ToolDef[];
15
10
  export type { ToolContext, ToolDef } from './shared/tool';
16
11
  export type { OpResult } from '../helpers';
17
12
  export type { DefinitionSlotInput, DefinitionSlotPatch, ElementInput, Operation, OperationType } from './operations';
18
- export type { ApplyInput, ChangedResource, Conflict, Persisters, WriteElement, WriteResponse, ValidateInput, ValidationResult, MutationOutcome, SearchHit, SearchInput, SearchResponse, SearchPageHit, ReadInput, ReadResponse, ReadHit } from '../types';
13
+ export type { ApplyInput, ChangedResource, Conflict, Persisters, WriteElement, WriteResponse, ValidationResult, MutationOutcome, SearchHit, SearchInput, SearchResponse, SearchPageHit, ReadInput, ReadResponse, ReadHit } from '../types';
@@ -1,26 +1,29 @@
1
1
  import { operation } from "./operations/index.js";
2
- import { validateOperations } from "./shared/validator/index.js";
3
- import { applyOperations } from "./apply/dispatch.js";
2
+ import "./shared/validator/index.js";
4
3
  import { apply, applyShape, applyTool } from "./apply/index.js";
5
- import { previewTool } from "./preview.js";
4
+ import { describeOperationTool } from "./describeOperation.js";
5
+ import { addPageTool, bindAttributeTool, placeComponentTool, setAttributesTool, setClassesTool } from "./intents.js";
6
+ import { lookTool } from "./look.js";
6
7
  import { read, readShape, readTool } from "./read.js";
7
8
  import { renderTool } from "./render.js";
8
- import { screenshotTool } from "./screenshot.js";
9
9
  import { search, searchShape, searchTool } from "./search.js";
10
10
  import { tryFunctionTool } from "./tryFunction.js";
11
- import { validate, validateShape, validateTool } from "./validate.js";
12
11
  //#region src/modules/mcp/tools/index.ts
13
12
  /** The MCP tool registry — the single source the server registers from. Adding a tool is: create its file with a
14
13
  * ToolDef descriptor and append it here. */
15
14
  var tools = [
16
15
  applyTool,
17
- validateTool,
16
+ setAttributesTool,
17
+ setClassesTool,
18
+ bindAttributeTool,
19
+ placeComponentTool,
20
+ addPageTool,
18
21
  searchTool,
22
+ describeOperationTool,
19
23
  readTool,
20
24
  renderTool,
21
- previewTool,
22
- screenshotTool,
25
+ lookTool,
23
26
  tryFunctionTool
24
27
  ];
25
28
  //#endregion
26
- export { apply, applyOperations, applyShape, operation, read, readShape, search, searchShape, tools, validate, validateOperations, validateShape };
29
+ export { apply, applyShape, operation, read, readShape, search, searchShape, tools };
@@ -0,0 +1,5 @@
1
+ export declare const setAttributesTool: import('.').ToolDef;
2
+ export declare const setClassesTool: import('.').ToolDef;
3
+ export declare const bindAttributeTool: import('.').ToolDef;
4
+ export declare const placeComponentTool: import('.').ToolDef;
5
+ export declare const addPageTool: import('.').ToolDef;