@plitzi/sdk-mcp 0.38.24 → 0.39.1

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 (59) hide show
  1. package/CHANGELOG.md +170 -1
  2. package/dist/createServer.js +1 -0
  3. package/dist/modules/mcp/catalogs/index.d.ts +1 -1
  4. package/dist/modules/mcp/catalogs/index.js +2 -2
  5. package/dist/modules/mcp/catalogs/pluginCatalog.js +5 -1
  6. package/dist/modules/mcp/handler.d.ts +3 -1
  7. package/dist/modules/mcp/handler.js +32 -2
  8. package/dist/modules/mcp/helpers/guide/index.d.ts +3 -0
  9. package/dist/modules/mcp/helpers/guide/index.js +19 -0
  10. package/dist/modules/mcp/helpers/{guide.d.ts → guide/instructions.d.ts} +0 -1
  11. package/dist/modules/mcp/helpers/guide/instructions.js +106 -0
  12. package/dist/modules/mcp/helpers/guide/logic.d.ts +2 -0
  13. package/dist/modules/mcp/helpers/guide/logic.js +166 -0
  14. package/dist/modules/mcp/helpers/guide/practice.d.ts +2 -0
  15. package/dist/modules/mcp/helpers/guide/practice.js +123 -0
  16. package/dist/modules/mcp/helpers/guide/reference.d.ts +2 -0
  17. package/dist/modules/mcp/helpers/guide/reference.js +250 -0
  18. package/dist/modules/mcp/helpers/guide/server.d.ts +2 -0
  19. package/dist/modules/mcp/helpers/guide/server.js +252 -0
  20. package/dist/modules/mcp/helpers/guide/structure.d.ts +2 -0
  21. package/dist/modules/mcp/helpers/guide/structure.js +189 -0
  22. package/dist/modules/mcp/helpers/guide/styling.d.ts +2 -0
  23. package/dist/modules/mcp/helpers/guide/styling.js +118 -0
  24. package/dist/modules/mcp/helpers/guide/values.d.ts +2 -0
  25. package/dist/modules/mcp/helpers/guide/values.js +6 -0
  26. package/dist/modules/mcp/helpers/space.d.ts +5 -2
  27. package/dist/modules/mcp/helpers/space.js +5 -4
  28. package/dist/modules/mcp/resources/core.js +1 -1
  29. package/dist/modules/mcp/resources/index.d.ts +1 -1
  30. package/dist/modules/mcp/resources/primer.d.ts +0 -11
  31. package/dist/modules/mcp/resources/primer.js +46 -1
  32. package/dist/modules/mcp/resources/register.js +1 -1
  33. package/dist/modules/mcp/server.js +17 -8
  34. package/dist/modules/mcp/tools/apply/index.d.ts +20 -0
  35. package/dist/modules/mcp/tools/index.js +2 -0
  36. package/dist/modules/mcp/tools/operations/actions/document.d.ts +3 -0
  37. package/dist/modules/mcp/tools/operations/actions/document.js +5 -2
  38. package/dist/modules/mcp/tools/operations/actions/index.d.ts +6 -0
  39. package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +3 -0
  40. package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +3 -0
  41. package/dist/modules/mcp/tools/operations/index.d.ts +68 -0
  42. package/dist/modules/mcp/tools/operations/schema/operations.d.ts +14 -0
  43. package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.d.ts +14 -0
  44. package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +26 -1
  45. package/dist/modules/mcp/tools/render.d.ts +14 -0
  46. package/dist/modules/mcp/tools/renderWidget.d.ts +14 -0
  47. package/dist/modules/mcp/tools/shared/lintDraft.js +5 -0
  48. package/dist/modules/mcp/tools/shared/tool.d.ts +6 -0
  49. package/dist/modules/mcp/tools/shared/validator/connectors.js +0 -1
  50. package/dist/modules/mcp/tools/shared/validator/css.js +6 -1
  51. package/dist/modules/mcp/tools/shared/validator/index.js +12 -1
  52. package/dist/modules/mcp/tools/test.d.ts +23 -0
  53. package/dist/modules/mcp/tools/test.js +85 -0
  54. package/dist/modules/mcp/types/aiSchema.d.ts +4 -0
  55. package/dist/modules/mcp/types/previewTypes.d.ts +3 -2
  56. package/dist/modules/mcp/types/toolTypes.d.ts +5 -0
  57. package/dist/preview/createPreview.js +4 -2
  58. package/package.json +8 -8
  59. package/dist/modules/mcp/helpers/guide.js +0 -1139
@@ -251,7 +251,9 @@ export declare const documentOperation: z.ZodDiscriminatedUnion<readonly [z.ZodO
251
251
  sessionStorage: "sessionStorage";
252
252
  }>>;
253
253
  transientState: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
+ keptState: z.ZodOptional<z.ZodArray<z.ZodString>>;
254
255
  paintedState: z.ZodOptional<z.ZodArray<z.ZodString>>;
256
+ browserState: z.ZodOptional<z.ZodArray<z.ZodString>>;
255
257
  userProvider: z.ZodOptional<z.ZodString>;
256
258
  tokenStorage: z.ZodOptional<z.ZodEnum<{
257
259
  "": "";
@@ -274,6 +276,18 @@ export declare const documentOperation: z.ZodDiscriminatedUnion<readonly [z.ZodO
274
276
  strict: "strict";
275
277
  }>>;
276
278
  sessionRevalidateSeconds: z.ZodOptional<z.ZodNumber>;
279
+ siteName: z.ZodOptional<z.ZodString>;
280
+ language: z.ZodOptional<z.ZodString>;
281
+ favicon: z.ZodOptional<z.ZodString>;
282
+ shareImage: z.ZodOptional<z.ZodString>;
283
+ themeColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
284
+ light: z.ZodOptional<z.ZodString>;
285
+ dark: z.ZodOptional<z.ZodString>;
286
+ }, z.core.$strip>]>>;
287
+ robotsTxt: z.ZodOptional<z.ZodString>;
288
+ blockAiCrawlers: z.ZodOptional<z.ZodBoolean>;
289
+ viewTransitions: z.ZodOptional<z.ZodBoolean>;
290
+ withheldPage: z.ZodOptional<z.ZodString>;
277
291
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
278
292
  access: z.ZodObject<{
279
293
  mode: z.ZodEnum<{
@@ -1677,7 +1691,9 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
1677
1691
  sessionStorage: "sessionStorage";
1678
1692
  }>>;
1679
1693
  transientState: z.ZodOptional<z.ZodArray<z.ZodString>>;
1694
+ keptState: z.ZodOptional<z.ZodArray<z.ZodString>>;
1680
1695
  paintedState: z.ZodOptional<z.ZodArray<z.ZodString>>;
1696
+ browserState: z.ZodOptional<z.ZodArray<z.ZodString>>;
1681
1697
  userProvider: z.ZodOptional<z.ZodString>;
1682
1698
  tokenStorage: z.ZodOptional<z.ZodEnum<{
1683
1699
  "": "";
@@ -1700,6 +1716,18 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
1700
1716
  strict: "strict";
1701
1717
  }>>;
1702
1718
  sessionRevalidateSeconds: z.ZodOptional<z.ZodNumber>;
1719
+ siteName: z.ZodOptional<z.ZodString>;
1720
+ language: z.ZodOptional<z.ZodString>;
1721
+ favicon: z.ZodOptional<z.ZodString>;
1722
+ shareImage: z.ZodOptional<z.ZodString>;
1723
+ themeColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
1724
+ light: z.ZodOptional<z.ZodString>;
1725
+ dark: z.ZodOptional<z.ZodString>;
1726
+ }, z.core.$strip>]>>;
1727
+ robotsTxt: z.ZodOptional<z.ZodString>;
1728
+ blockAiCrawlers: z.ZodOptional<z.ZodBoolean>;
1729
+ viewTransitions: z.ZodOptional<z.ZodBoolean>;
1730
+ withheldPage: z.ZodOptional<z.ZodString>;
1703
1731
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
1704
1732
  access: z.ZodObject<{
1705
1733
  mode: z.ZodEnum<{
@@ -3048,6 +3076,9 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
3048
3076
  required: z.ZodOptional<z.ZodBoolean>;
3049
3077
  defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
3050
3078
  label: z.ZodOptional<z.ZodString>;
3079
+ maxLength: z.ZodOptional<z.ZodNumber>;
3080
+ min: z.ZodOptional<z.ZodNumber>;
3081
+ max: z.ZodOptional<z.ZodNumber>;
3051
3082
  }, z.core.$strip>>>;
3052
3083
  nodes: z.ZodArray<z.ZodObject<{
3053
3084
  id: z.ZodString;
@@ -3087,6 +3118,9 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
3087
3118
  required: z.ZodOptional<z.ZodBoolean>;
3088
3119
  defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
3089
3120
  label: z.ZodOptional<z.ZodString>;
3121
+ maxLength: z.ZodOptional<z.ZodNumber>;
3122
+ min: z.ZodOptional<z.ZodNumber>;
3123
+ max: z.ZodOptional<z.ZodNumber>;
3090
3124
  }, z.core.$strip>>>>;
3091
3125
  nodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
3092
3126
  id: z.ZodString;
@@ -3382,7 +3416,9 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
3382
3416
  sessionStorage: "sessionStorage";
3383
3417
  }>>;
3384
3418
  transientState: z.ZodOptional<z.ZodArray<z.ZodString>>;
3419
+ keptState: z.ZodOptional<z.ZodArray<z.ZodString>>;
3385
3420
  paintedState: z.ZodOptional<z.ZodArray<z.ZodString>>;
3421
+ browserState: z.ZodOptional<z.ZodArray<z.ZodString>>;
3386
3422
  userProvider: z.ZodOptional<z.ZodString>;
3387
3423
  tokenStorage: z.ZodOptional<z.ZodEnum<{
3388
3424
  "": "";
@@ -3405,6 +3441,18 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
3405
3441
  strict: "strict";
3406
3442
  }>>;
3407
3443
  sessionRevalidateSeconds: z.ZodOptional<z.ZodNumber>;
3444
+ siteName: z.ZodOptional<z.ZodString>;
3445
+ language: z.ZodOptional<z.ZodString>;
3446
+ favicon: z.ZodOptional<z.ZodString>;
3447
+ shareImage: z.ZodOptional<z.ZodString>;
3448
+ themeColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3449
+ light: z.ZodOptional<z.ZodString>;
3450
+ dark: z.ZodOptional<z.ZodString>;
3451
+ }, z.core.$strip>]>>;
3452
+ robotsTxt: z.ZodOptional<z.ZodString>;
3453
+ blockAiCrawlers: z.ZodOptional<z.ZodBoolean>;
3454
+ viewTransitions: z.ZodOptional<z.ZodBoolean>;
3455
+ withheldPage: z.ZodOptional<z.ZodString>;
3408
3456
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
3409
3457
  access: z.ZodObject<{
3410
3458
  mode: z.ZodEnum<{
@@ -4753,6 +4801,9 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
4753
4801
  required: z.ZodOptional<z.ZodBoolean>;
4754
4802
  defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
4755
4803
  label: z.ZodOptional<z.ZodString>;
4804
+ maxLength: z.ZodOptional<z.ZodNumber>;
4805
+ min: z.ZodOptional<z.ZodNumber>;
4806
+ max: z.ZodOptional<z.ZodNumber>;
4756
4807
  }, z.core.$strip>>>;
4757
4808
  nodes: z.ZodArray<z.ZodObject<{
4758
4809
  id: z.ZodString;
@@ -4792,6 +4843,9 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
4792
4843
  required: z.ZodOptional<z.ZodBoolean>;
4793
4844
  defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
4794
4845
  label: z.ZodOptional<z.ZodString>;
4846
+ maxLength: z.ZodOptional<z.ZodNumber>;
4847
+ min: z.ZodOptional<z.ZodNumber>;
4848
+ max: z.ZodOptional<z.ZodNumber>;
4795
4849
  }, z.core.$strip>>>>;
4796
4850
  nodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
4797
4851
  id: z.ZodString;
@@ -5082,7 +5136,9 @@ export declare const documentOperations: z.ZodArray<z.ZodDiscriminatedUnion<read
5082
5136
  sessionStorage: "sessionStorage";
5083
5137
  }>>;
5084
5138
  transientState: z.ZodOptional<z.ZodArray<z.ZodString>>;
5139
+ keptState: z.ZodOptional<z.ZodArray<z.ZodString>>;
5085
5140
  paintedState: z.ZodOptional<z.ZodArray<z.ZodString>>;
5141
+ browserState: z.ZodOptional<z.ZodArray<z.ZodString>>;
5086
5142
  userProvider: z.ZodOptional<z.ZodString>;
5087
5143
  tokenStorage: z.ZodOptional<z.ZodEnum<{
5088
5144
  "": "";
@@ -5105,6 +5161,18 @@ export declare const documentOperations: z.ZodArray<z.ZodDiscriminatedUnion<read
5105
5161
  strict: "strict";
5106
5162
  }>>;
5107
5163
  sessionRevalidateSeconds: z.ZodOptional<z.ZodNumber>;
5164
+ siteName: z.ZodOptional<z.ZodString>;
5165
+ language: z.ZodOptional<z.ZodString>;
5166
+ favicon: z.ZodOptional<z.ZodString>;
5167
+ shareImage: z.ZodOptional<z.ZodString>;
5168
+ themeColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
5169
+ light: z.ZodOptional<z.ZodString>;
5170
+ dark: z.ZodOptional<z.ZodString>;
5171
+ }, z.core.$strip>]>>;
5172
+ robotsTxt: z.ZodOptional<z.ZodString>;
5173
+ blockAiCrawlers: z.ZodOptional<z.ZodBoolean>;
5174
+ viewTransitions: z.ZodOptional<z.ZodBoolean>;
5175
+ withheldPage: z.ZodOptional<z.ZodString>;
5108
5176
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
5109
5177
  access: z.ZodObject<{
5110
5178
  mode: z.ZodEnum<{
@@ -270,7 +270,9 @@ export declare const elementOps: {
270
270
  sessionStorage: "sessionStorage";
271
271
  }>>;
272
272
  transientState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
273
+ keptState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
273
274
  paintedState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
275
+ browserState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
274
276
  userProvider: import('zod').ZodOptional<import('zod').ZodString>;
275
277
  tokenStorage: import('zod').ZodOptional<import('zod').ZodEnum<{
276
278
  "": "";
@@ -293,6 +295,18 @@ export declare const elementOps: {
293
295
  strict: "strict";
294
296
  }>>;
295
297
  sessionRevalidateSeconds: import('zod').ZodOptional<import('zod').ZodNumber>;
298
+ siteName: import('zod').ZodOptional<import('zod').ZodString>;
299
+ language: import('zod').ZodOptional<import('zod').ZodString>;
300
+ favicon: import('zod').ZodOptional<import('zod').ZodString>;
301
+ shareImage: import('zod').ZodOptional<import('zod').ZodString>;
302
+ themeColor: import('zod').ZodOptional<import('zod').ZodUnion<readonly [import('zod').ZodString, import('zod').ZodObject<{
303
+ light: import('zod').ZodOptional<import('zod').ZodString>;
304
+ dark: import('zod').ZodOptional<import('zod').ZodString>;
305
+ }, import('zod/v4/core').$strip>]>>;
306
+ robotsTxt: import('zod').ZodOptional<import('zod').ZodString>;
307
+ blockAiCrawlers: import('zod').ZodOptional<import('zod').ZodBoolean>;
308
+ viewTransitions: import('zod').ZodOptional<import('zod').ZodBoolean>;
309
+ withheldPage: import('zod').ZodOptional<import('zod').ZodString>;
296
310
  channels: import('zod').ZodOptional<import('zod').ZodRecord<import('zod').ZodString, import('zod').ZodNullable<import('zod').ZodObject<{
297
311
  access: import('zod').ZodObject<{
298
312
  mode: import('zod').ZodEnum<{
@@ -11,7 +11,9 @@ export declare const patchSettingsOp: z.ZodObject<{
11
11
  sessionStorage: "sessionStorage";
12
12
  }>>;
13
13
  transientState: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
+ keptState: z.ZodOptional<z.ZodArray<z.ZodString>>;
14
15
  paintedState: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
+ browserState: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
17
  userProvider: z.ZodOptional<z.ZodString>;
16
18
  tokenStorage: z.ZodOptional<z.ZodEnum<{
17
19
  "": "";
@@ -34,6 +36,18 @@ export declare const patchSettingsOp: z.ZodObject<{
34
36
  strict: "strict";
35
37
  }>>;
36
38
  sessionRevalidateSeconds: z.ZodOptional<z.ZodNumber>;
39
+ siteName: z.ZodOptional<z.ZodString>;
40
+ language: z.ZodOptional<z.ZodString>;
41
+ favicon: z.ZodOptional<z.ZodString>;
42
+ shareImage: z.ZodOptional<z.ZodString>;
43
+ themeColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
44
+ light: z.ZodOptional<z.ZodString>;
45
+ dark: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$strip>]>>;
47
+ robotsTxt: z.ZodOptional<z.ZodString>;
48
+ blockAiCrawlers: z.ZodOptional<z.ZodBoolean>;
49
+ viewTransitions: z.ZodOptional<z.ZodBoolean>;
50
+ withheldPage: z.ZodOptional<z.ZodString>;
37
51
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
38
52
  access: z.ZodObject<{
39
53
  mode: z.ZodEnum<{
@@ -2,6 +2,7 @@ import { settingsUri } from "../../../../helpers/uris.js";
2
2
  import { empty, fail } from "../../../../helpers/opResult.js";
3
3
  import { NOTIFICATIONS_FIELDS, splitNotificationsCss, withNotificationsCss } from "@plitzi/sdk-authoring";
4
4
  import { z } from "zod";
5
+ import { spaceIdentity, spaceIdentityProblems, withheldPageOf } from "@plitzi/sdk-shared/schema";
5
6
  import { channelProblems } from "@plitzi/sdk-shared/realtime";
6
7
  //#region src/modules/mcp/tools/operations/schema/settings/patchSettings.ts
7
8
  var userProvider = z.string();
@@ -34,7 +35,9 @@ var patchSettingsOp = z.object({
34
35
  keepState: z.boolean().optional().describe("Keep runtime state (setState keys) across reloads"),
35
36
  stateStorage: z.enum(["localStorage", "sessionStorage"]).optional(),
36
37
  transientState: z.array(z.string()).optional().describe("Top-level state keys never kept"),
38
+ keptState: z.array(z.string()).optional().describe("The only top-level state keys kept (not with transientState)"),
37
39
  paintedState: z.array(z.string()).optional().describe("Kept keys the first paint shows"),
40
+ browserState: z.array(z.string()).optional().describe("Kept keys that are the browser’s, not the account’s: no change of account takes them (the cookie consent)"),
38
41
  userProvider: userProvider.optional().describe("Auth provider: \"basic\" for an HTTP+JSON backend, a registered name, or \"\" to disable auth"),
39
42
  tokenStorage: storage.optional(),
40
43
  loginUrl: z.string().optional(),
@@ -50,8 +53,20 @@ var patchSettingsOp = z.object({
50
53
  sessionExchangeUrl: z.string().optional().describe("Where to hand a browser-obtained credential so the server issues its own session (client-side IdPs)"),
51
54
  sessionGate: z.enum(["optimistic", "strict"]).optional().describe("Render from the stored session and confirm behind it (default), or wait for the confirmation"),
52
55
  sessionRevalidateSeconds: z.number().optional(),
56
+ siteName: z.string().optional().describe("Shown beside each title in a link card"),
57
+ language: z.string().optional().describe("\"en\", \"es-MX\""),
58
+ favicon: z.string().optional().describe("\"/favicon.svg\" or https://…"),
59
+ shareImage: z.string().optional().describe("A link card's picture when its page has none: \"/og.png\""),
60
+ themeColor: z.union([z.string(), z.object({
61
+ light: z.string().optional(),
62
+ dark: z.string().optional()
63
+ })]).optional(),
64
+ robotsTxt: z.string().optional(),
65
+ blockAiCrawlers: z.boolean().optional().describe("robots.txt bars AI-training crawlers"),
66
+ viewTransitions: z.boolean().optional(),
67
+ withheldPage: z.string().optional().describe("Page id drawn for a withheld page (its 401/403); \"\" = Plitzi's words"),
53
68
  channels: z.record(z.string(), channel.nullable()).optional().describe("Realtime channels by topic pattern (`board:{id}`); null removes one. See the guide")
54
- }).describe("Merge space-level settings — global CSS, notifications, kept state, auth, realtime channels. Only the fields sent change. customCss is for site-wide CSS, never to style one element (attach a definition for that).");
69
+ }).describe("Merge space-level settings — global CSS, notifications, kept state, auth, realtime channels, the site's identity and robots.txt. Only the fields sent change. customCss is for site-wide CSS, never to style one element (attach a definition for that).");
55
70
  /** The space's channels with the patch merged in, pattern by pattern — `null` takes one out. */
56
71
  var mergeChannels = (current, patch) => {
57
72
  const merged = {
@@ -81,6 +96,11 @@ var patchSettings = (space, env, op) => {
81
96
  const [problem] = declaration === null ? [] : channelProblems(pattern, declaration);
82
97
  if (problem) return fail(`channels["${pattern}"]`, `Channel "${pattern}": ${problem}.`, "Fix the pattern or declaration and send it again");
83
98
  }
99
+ const [identityProblem] = spaceIdentityProblems(spaceIdentity({
100
+ ...space.schema.settings,
101
+ ...patch
102
+ }));
103
+ if (identityProblem) return fail("settings", identityProblem, "Fix the field and send it again");
84
104
  const next = { ...space.schema.settings };
85
105
  for (const [key, value] of Object.entries(patch)) next[key] = value;
86
106
  if (channels) next.channels = mergeChannels(space.schema.settings.channels, channels);
@@ -92,6 +112,11 @@ var patchSettings = (space, env, op) => {
92
112
  return fail("notifications", error instanceof Error ? error.message : String(error), "Write one CSS value per field — a colour, a length or a token like var(--card)");
93
113
  }
94
114
  }
115
+ if (next.withheldPage === "") delete next.withheldPage;
116
+ else if (next.withheldPage !== void 0 && withheldPageOf({
117
+ ...space.schema,
118
+ settings: next
119
+ }) === void 0) return fail("withheldPage", `withheldPage "${next.withheldPage}" is no page of the space, or one with an access of its own — withheld from the visitor it is drawn for.`, "Name the id of a page every visitor may see, or \"\" for the platform's words");
95
120
  space.schema.settings = next;
96
121
  return {
97
122
  ...empty(),
@@ -253,7 +253,9 @@ export declare const renderShape: {
253
253
  sessionStorage: "sessionStorage";
254
254
  }>>;
255
255
  transientState: z.ZodOptional<z.ZodArray<z.ZodString>>;
256
+ keptState: z.ZodOptional<z.ZodArray<z.ZodString>>;
256
257
  paintedState: z.ZodOptional<z.ZodArray<z.ZodString>>;
258
+ browserState: z.ZodOptional<z.ZodArray<z.ZodString>>;
257
259
  userProvider: z.ZodOptional<z.ZodString>;
258
260
  tokenStorage: z.ZodOptional<z.ZodEnum<{
259
261
  "": "";
@@ -276,6 +278,18 @@ export declare const renderShape: {
276
278
  strict: "strict";
277
279
  }>>;
278
280
  sessionRevalidateSeconds: z.ZodOptional<z.ZodNumber>;
281
+ siteName: z.ZodOptional<z.ZodString>;
282
+ language: z.ZodOptional<z.ZodString>;
283
+ favicon: z.ZodOptional<z.ZodString>;
284
+ shareImage: z.ZodOptional<z.ZodString>;
285
+ themeColor: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
286
+ light: z.ZodOptional<z.ZodString>;
287
+ dark: z.ZodOptional<z.ZodString>;
288
+ }, z.core.$strip>]>>;
289
+ robotsTxt: z.ZodOptional<z.ZodString>;
290
+ blockAiCrawlers: z.ZodOptional<z.ZodBoolean>;
291
+ viewTransitions: z.ZodOptional<z.ZodBoolean>;
292
+ withheldPage: z.ZodOptional<z.ZodString>;
279
293
  channels: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
280
294
  access: z.ZodObject<{
281
295
  mode: z.ZodEnum<{
@@ -258,7 +258,9 @@ export declare const renderWidgetShape: {
258
258
  sessionStorage: "sessionStorage";
259
259
  }>>;
260
260
  transientState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
261
+ keptState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
261
262
  paintedState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
263
+ browserState: import('zod').ZodOptional<import('zod').ZodArray<import('zod').ZodString>>;
262
264
  userProvider: import('zod').ZodOptional<import('zod').ZodString>;
263
265
  tokenStorage: import('zod').ZodOptional<import('zod').ZodEnum<{
264
266
  "": "";
@@ -281,6 +283,18 @@ export declare const renderWidgetShape: {
281
283
  strict: "strict";
282
284
  }>>;
283
285
  sessionRevalidateSeconds: import('zod').ZodOptional<import('zod').ZodNumber>;
286
+ siteName: import('zod').ZodOptional<import('zod').ZodString>;
287
+ language: import('zod').ZodOptional<import('zod').ZodString>;
288
+ favicon: import('zod').ZodOptional<import('zod').ZodString>;
289
+ shareImage: import('zod').ZodOptional<import('zod').ZodString>;
290
+ themeColor: import('zod').ZodOptional<import('zod').ZodUnion<readonly [import('zod').ZodString, import('zod').ZodObject<{
291
+ light: import('zod').ZodOptional<import('zod').ZodString>;
292
+ dark: import('zod').ZodOptional<import('zod').ZodString>;
293
+ }, import('zod/v4/core').$strip>]>>;
294
+ robotsTxt: import('zod').ZodOptional<import('zod').ZodString>;
295
+ blockAiCrawlers: import('zod').ZodOptional<import('zod').ZodBoolean>;
296
+ viewTransitions: import('zod').ZodOptional<import('zod').ZodBoolean>;
297
+ withheldPage: import('zod').ZodOptional<import('zod').ZodString>;
284
298
  channels: import('zod').ZodOptional<import('zod').ZodRecord<import('zod').ZodString, import('zod').ZodNullable<import('zod').ZodObject<{
285
299
  access: import('zod').ZodObject<{
286
300
  mode: import('zod').ZodEnum<{
@@ -140,6 +140,11 @@ var lintDraft = (draft, ops, before) => {
140
140
  const line = [said(issue), fixOf(issue)].filter(Boolean).join(" ");
141
141
  return preExisting(issue) ? `Pre-existing issue in element "${issue.elementId ?? ""}": ${line}` : line;
142
142
  });
143
+ const testsNow = all.filter((issue) => issue.code === "test-unreadable");
144
+ if (testsNow.length > 0) {
145
+ const testsBefore = new Set(before ? readingOf(before).all.filter((issue) => issue.code === "test-unreadable").map((issue) => issue.message) : []);
146
+ for (const issue of testsNow.filter((each) => !testsBefore.has(each.message))) warnings.push(`This change leaves a test of the space unreadable — a snapshot waits until it is fixed: ${issue.message}`);
147
+ }
143
148
  for (const id of touched) {
144
149
  const tagless = styleWithoutTag(draft.schema.flat[id], draft.style);
145
150
  if (tagless) warnings.push(`element "${id}" ${tagless}`);
@@ -24,6 +24,12 @@ export interface ToolContext {
24
24
  /** Runs one task of the space's functions in the sandbox, for the person behind the connection — when the host
25
25
  * wired it. Only plitzi_try_function uses it. */
26
26
  tryFunction?: (task: string, params: Record<string, unknown>) => Promise<ActionRunReport>;
27
+ /** Plays the space's e2e tests on its draft, when the host wired it. Only plitzi_test uses it. */
28
+ runE2eTests?: (ids: readonly string[]) => Promise<{
29
+ results: unknown[];
30
+ } | {
31
+ notRun: string;
32
+ }>;
27
33
  /** What happened on the space after a cursor, waited for — when the host wired it. Only plitzi_activity uses it. */
28
34
  activity?: (query: SpaceActivityQuery) => Promise<SpaceActivityPage>;
29
35
  }
@@ -45,7 +45,6 @@ var checkProviderElement = (space, ctx, ref, runtime, props, batchConnectors, ba
45
45
  if (runtime === "server") warnOnce(ctx, `"${ref}" at ${base} renders on the server but names no connector, so it resolves to no data. Set its \`connector\` prop to one the space has (read plitzi://connectors).`);
46
46
  return;
47
47
  }
48
- if (runtime !== "server") warnOnce(ctx, `"${ref}" at ${base} names connector "${connectorId}" but is not server-rendered, so the connector is IGNORED and the element fetches its own \`query\` from the browser instead. Set runtime: "server" on it.`);
49
48
  const entry = findConnectorEntry(space, connectorId);
50
49
  if (!entry) {
51
50
  if (!batchConnectors.has(connectorId)) warnOnce(ctx, `Connector "${connectorId}" at ${base} is not configured in this space, so "${ref}" resolves to no data. Read plitzi://connectors, or create it with upsertConnector.`);
@@ -1,10 +1,15 @@
1
- import { expandShorthand, isCssProperty, suggestCssProperty } from "../../../catalogs/index.js";
1
+ import { ambiguousShorthands, expandShorthand, isCssProperty, suggestCssProperty } from "../../../catalogs/index.js";
2
2
  import { checkStyleVarRefs, checkVarRefs } from "./context.js";
3
3
  //#region src/modules/mcp/tools/shared/validator/css.ts
4
4
  var checkCss = (css, path, ctx) => {
5
5
  if (!css) return;
6
6
  const declared = {};
7
7
  for (const [key, value] of Object.entries(css)) if (value !== null) declared[key] = value;
8
+ for (const ambiguous of ambiguousShorthands(declared)) ctx.errors.push({
9
+ path: `${path}.${ambiguous.property}`,
10
+ message: `"${ambiguous.property}: ${ambiguous.value}" cannot be expanded: what the variable holds decides which longhand it is`,
11
+ hint: `Name the longhand it is: ${ambiguous.fix}`
12
+ });
8
13
  for (const [key, value] of Object.entries(expandShorthand(declared))) {
9
14
  if (!isCssProperty(key)) {
10
15
  const suggestion = suggestCssProperty(key);
@@ -287,7 +287,11 @@ var validateOperations = (space, ops, mode = "space") => {
287
287
  checkRef(op.ref, `${base}.ref`, ctx);
288
288
  break;
289
289
  case "patchSettings":
290
- ["transientState", "paintedState"].forEach((setting) => {
290
+ [
291
+ "transientState",
292
+ "paintedState",
293
+ "browserState"
294
+ ].forEach((setting) => {
291
295
  (op[setting] ?? []).forEach((key, index) => {
292
296
  if (key.trim() === "" || key.includes(".")) ctx.errors.push({
293
297
  path: `${base}.${setting}[${index}]`,
@@ -303,6 +307,13 @@ var validateOperations = (space, ops, mode = "space") => {
303
307
  hint: "A painted key is kept so the server can draw with it; a transient one never is — remove it from one"
304
308
  });
305
309
  });
310
+ (op.browserState ?? []).forEach((key, index) => {
311
+ if (op.transientState?.includes(key)) ctx.errors.push({
312
+ path: `${base}.browserState[${index}]`,
313
+ message: `"${key}" is in both browserState and transientState`,
314
+ hint: "A key of the browser’s is a kept one that no change of account takes away; a transient one is never kept — remove it from one"
315
+ });
316
+ });
306
317
  break;
307
318
  case "deleteInteraction":
308
319
  checkRef(op.ref, `${base}.ref`, ctx);
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { ToolContext } from './shared/tool';
3
+ export declare const testShape: {
4
+ action: z.ZodEnum<{
5
+ set: "set";
6
+ list: "list";
7
+ run: "run";
8
+ }>;
9
+ tests: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
10
+ ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
11
+ tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ };
13
+ /**
14
+ * The space's own tests, kept in its document: read, saved whole, or run — the unit tests here, the e2e ones
15
+ * on the draft where the deployment plays them. What a snapshot and a publish hold the space to.
16
+ */
17
+ export declare const test: (input: {
18
+ action: "list" | "set" | "run";
19
+ tests?: Record<string, unknown>;
20
+ ids?: string[];
21
+ tags?: string[];
22
+ }, ctx: ToolContext) => Promise<unknown>;
23
+ export declare const testTool: import('.').ToolDef;
@@ -0,0 +1,85 @@
1
+ import { defineTool } from "./shared/tool.js";
2
+ import { e2eTestProblems, journeyStartWarnings, readSpaceTests, runUnitTests, testAccountWarnings, unitTestProblems } from "@plitzi/sdk-authoring";
3
+ import { z } from "zod";
4
+ //#region src/modules/mcp/tools/test.ts
5
+ var testShape = {
6
+ action: z.enum([
7
+ "list",
8
+ "set",
9
+ "run"
10
+ ]).describe("list: the tests and how the unit ones stand · set: save them whole · run: the unit tests, then the e2e"),
11
+ tests: z.record(z.string(), z.unknown()).optional().describe("With set: `{ unit, e2e, accounts }`, every test of the space — what is left out is removed"),
12
+ ids: z.array(z.string()).optional().describe("With run: the tests to run, by id; all when none"),
13
+ tags: z.array(z.string()).optional().describe("With run: only journeys with one of these tags")
14
+ };
15
+ /** The tests and how they stand against the document: those written wrong, every unit test run. */
16
+ var standing = (schema) => {
17
+ const report = runUnitTests(schema);
18
+ return {
19
+ tests: {
20
+ unit: schema.tests?.unit ?? [],
21
+ e2e: schema.tests?.e2e ?? [],
22
+ ...schema.tests?.accounts ? { accounts: schema.tests.accounts } : {}
23
+ },
24
+ problems: [...unitTestProblems(schema), ...e2eTestProblems(schema)],
25
+ warnings: [...testAccountWarnings(schema), ...journeyStartWarnings(schema)],
26
+ unit: {
27
+ passed: report.passed,
28
+ failed: report.failed,
29
+ failing: report.results.filter((result) => !result.ok)
30
+ }
31
+ };
32
+ };
33
+ /**
34
+ * The space's own tests, kept in its document: read, saved whole, or run — the unit tests here, the e2e ones
35
+ * on the draft where the deployment plays them. What a snapshot and a publish hold the space to.
36
+ */
37
+ var test = async (input, ctx) => {
38
+ const { schema } = ctx.space;
39
+ if (input.action === "list") return standing(schema);
40
+ if (input.action === "set") {
41
+ const read = readSpaceTests(input.tests);
42
+ if ("problems" in read) return {
43
+ saved: false,
44
+ problems: read.problems
45
+ };
46
+ if (!ctx.persisters.tests) return {
47
+ saved: false,
48
+ problems: ["This connection cannot write the space"]
49
+ };
50
+ const next = {
51
+ ...schema,
52
+ tests: read.tests
53
+ };
54
+ await ctx.persisters.tests(next);
55
+ return {
56
+ saved: true,
57
+ ...standing(next)
58
+ };
59
+ }
60
+ const ids = input.ids ?? [];
61
+ const tags = input.tags ?? [];
62
+ const named = (id) => ids.length === 0 || ids.includes(id);
63
+ const chosen = tags.length > 0 ? [] : (schema.tests?.unit ?? []).filter((each) => named(each.id));
64
+ const unit = runUnitTests(schema, chosen);
65
+ const e2e = (schema.tests?.e2e ?? []).filter((each) => named(each.id) && (tags.length === 0 || (each.tags ?? []).some((tag) => tags.includes(tag))));
66
+ const played = e2e.length === 0 ? { results: [] } : ctx.runE2eTests ? await ctx.runE2eTests(e2e.map((each) => each.id)) : { notRun: "this deployment plays no e2e tests" };
67
+ return {
68
+ unit: {
69
+ passed: unit.passed,
70
+ failed: unit.failed,
71
+ failing: unit.results.filter((result) => !result.ok)
72
+ },
73
+ e2e: played
74
+ };
75
+ };
76
+ var testTool = defineTool({
77
+ name: "plitzi_test",
78
+ title: "Space tests",
79
+ description: "The space’s own tests, kept in its document: list them and how they stand, save them whole (`unit`: an element resolved for a state; `e2e`: a visitor’s steps on a page), or run them. A snapshot and a publish wait for them.",
80
+ inputShape: testShape,
81
+ access: "write",
82
+ run: (input, ctx) => test(input, ctx)
83
+ });
84
+ //#endregion
85
+ export { test, testShape, testTool };
@@ -280,8 +280,12 @@ export interface AISettings {
280
280
  stateStorage?: 'localStorage' | 'sessionStorage';
281
281
  /** Top-level state keys never kept, even with `keepState` on. */
282
282
  transientState?: string[];
283
+ /** The only top-level state keys kept, with `keepState` on — the other way round from `transientState`. */
284
+ keptState?: string[];
283
285
  /** Kept keys the first paint shows, kept in a cookie too so the server renders with them. Small values only. */
284
286
  paintedState?: string[];
287
+ /** Kept keys that are the browser's rather than the account's, which no change of account takes away. */
288
+ browserState?: string[];
285
289
  /** `basic` covers any HTTP+JSON backend by configuration; anything else is a name someone registered. */
286
290
  userProvider?: 'basic' | 'custom' | '' | (string & {});
287
291
  tokenStorage?: 'localStorage' | 'sessionStorage' | '';
@@ -26,9 +26,10 @@ export type PreviewRequestBody = {
26
26
  * `once` — the default — is the capture path: the browser opens the URL, the render happens, the token is spent.
27
27
  * `session` is somebody iterating: the URL keeps working until it expires, the draft follows them from page to
28
28
  * page, and their refreshes are neither billed nor cached. Ask for a session only when a person is going to look
29
- * at it, and end it with `DELETE` when they stop.
29
+ * at it, and end it with `DELETE` when they stop. `tests` is a session a test runner plays: the same, and its pages
30
+ * carry the space's state bridge (`window.__plitzi`) with no panel or badge, so a journey sets and reads the state.
30
31
  */
31
- mode?: 'once' | 'session';
32
+ mode?: 'once' | 'session' | 'tests';
32
33
  };
33
34
  export type PreviewResult = {
34
35
  ok: true;
@@ -16,6 +16,11 @@ export interface Persisters {
16
16
  saveFunctions?: (files: Record<string, string>, base: string) => Promise<FunctionsSaveResult>;
17
17
  /** Saves the data's files whole, against the version the batch read; answers what is wrong by file. */
18
18
  saveData?: (files: Record<string, string>, base: string) => Promise<DataSaveResult>;
19
+ /**
20
+ * Saves the document with its tests changed and nothing else — for a grant that may test (`canTest`) though it may
21
+ * not write: a tester's agent.
22
+ */
23
+ tests?: (schema: Schema) => Promise<void>;
19
24
  }
20
25
  export interface Conflict {
21
26
  resourceUri: string;
@@ -61,7 +61,8 @@ var createPreview = async (body, config, renderFn, pluginManager, caches) => {
61
61
  const pagePath = resolvePagePath(draftOffline.schema, body.pageRef);
62
62
  let html;
63
63
  if (body.includeHtml !== false) ({body: html} = await buildBody(syntheticRequest(pagePath), config, body.spaceId, env, revision, renderFn, pluginManager, caches.offlineData, void 0, draftOffline));
64
- const reusable = body.mode === "session";
64
+ const reusable = body.mode === "session" || body.mode === "tests";
65
+ const inspected = body.mode === "tests";
65
66
  const ttlMs = reusable ? config.preview?.sessionTtlMs ?? 9e5 : config.preview?.ttlMs ?? 6e4;
66
67
  let token;
67
68
  if (config.draftStore) {
@@ -69,7 +70,8 @@ var createPreview = async (body, config, renderFn, pluginManager, caches) => {
69
70
  await config.draftStore.put(token, draftOffline, {
70
71
  ttlMs,
71
72
  reusable,
72
- spaceId: body.spaceId
73
+ spaceId: body.spaceId,
74
+ ...inspected ? { inspected } : {}
73
75
  });
74
76
  }
75
77
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plitzi/sdk-mcp",
3
- "version": "0.38.24",
3
+ "version": "0.39.1",
4
4
  "license": "AGPL-3.0",
5
5
  "files": [
6
6
  "dist",
@@ -35,18 +35,18 @@
35
35
  },
36
36
  "type": "module",
37
37
  "engines": {
38
- "node": ">=22.18"
38
+ "node": "^24.22.1 || >=26.12.1"
39
39
  },
40
40
  "sideEffects": false,
41
41
  "dependencies": {
42
42
  "@modelcontextprotocol/ext-apps": "^1.7.5",
43
43
  "@modelcontextprotocol/sdk": "^1.32.1",
44
- "@plitzi/plitzi-sdk": "0.38.24",
45
- "@plitzi/sdk-authoring": "0.38.24",
46
- "@plitzi/sdk-schema": "0.38.24",
47
- "@plitzi/sdk-server": "0.38.24",
48
- "@plitzi/sdk-shared": "0.38.24",
49
- "@plitzi/sdk-style": "0.38.24",
44
+ "@plitzi/plitzi-sdk": "0.39.1",
45
+ "@plitzi/sdk-authoring": "0.39.1",
46
+ "@plitzi/sdk-schema": "0.39.1",
47
+ "@plitzi/sdk-server": "0.39.1",
48
+ "@plitzi/sdk-shared": "0.39.1",
49
+ "@plitzi/sdk-style": "0.39.1",
50
50
  "ejs": "^7.0.2",
51
51
  "esbuild": "^0.28.2",
52
52
  "zod": "^4.6.7"