@plitzi/sdk-mcp 0.38.4 → 0.38.5

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 (77) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +38 -12
  3. package/dist/createServer.d.ts +1 -1
  4. package/dist/createServer.js +1 -1
  5. package/dist/index.d.ts +3 -4
  6. package/dist/index.js +1 -4
  7. package/dist/modules/mcp/apps/render/styles.d.ts +4 -8
  8. package/dist/modules/mcp/apps/render/styles.js +16 -47
  9. package/dist/modules/mcp/apps/render/view/index.tsx +1 -1
  10. package/dist/modules/mcp/catalogs/index.js +2 -2
  11. package/dist/modules/mcp/catalogs/pluginCatalog.js +2 -2
  12. package/dist/modules/mcp/e2e/mcpEndpoint.d.ts +2 -1
  13. package/dist/modules/mcp/handler.d.ts +2 -2
  14. package/dist/modules/mcp/helpers/callToolResult.d.ts +2 -0
  15. package/dist/modules/mcp/helpers/callToolResult.js +4 -0
  16. package/dist/modules/mcp/helpers/guide.js +27 -4
  17. package/dist/modules/mcp/helpers/index.d.ts +1 -1
  18. package/dist/modules/mcp/helpers/space.d.ts +4 -1
  19. package/dist/modules/mcp/helpers/space.js +1 -0
  20. package/dist/modules/mcp/helpers/uris.d.ts +2 -0
  21. package/dist/modules/mcp/helpers/uris.js +3 -1
  22. package/dist/modules/mcp/index.d.ts +1 -1
  23. package/dist/modules/mcp/resources/connectors.d.ts +1 -1
  24. package/dist/modules/mcp/resources/core.js +2 -2
  25. package/dist/modules/mcp/resources/data.d.ts +8 -0
  26. package/dist/modules/mcp/resources/data.js +46 -0
  27. package/dist/modules/mcp/resources/primer.js +3 -3
  28. package/dist/modules/mcp/resources/register.js +12 -2
  29. package/dist/modules/mcp/resources/renderGuide.js +6 -6
  30. package/dist/modules/mcp/resources/router.js +3 -1
  31. package/dist/modules/mcp/resources/schema.js +1 -1
  32. package/dist/modules/mcp/server.d.ts +3 -3
  33. package/dist/modules/mcp/server.js +12 -8
  34. package/dist/modules/mcp/tools/apply/dispatch.js +9 -1
  35. package/dist/modules/mcp/tools/apply/index.d.ts +11 -2
  36. package/dist/modules/mcp/tools/apply/index.js +27 -1
  37. package/dist/modules/mcp/tools/index.d.ts +2 -2
  38. package/dist/modules/mcp/tools/index.js +2 -2
  39. package/dist/modules/mcp/tools/operations/connectors/index.d.ts +2 -2
  40. package/dist/modules/mcp/tools/operations/connectors/manifest.d.ts +1 -1
  41. package/dist/modules/mcp/tools/operations/connectors/patchConnector.d.ts +1 -1
  42. package/dist/modules/mcp/tools/operations/connectors/upsertConnector.d.ts +1 -1
  43. package/dist/modules/mcp/tools/operations/data/data.test.d.ts +1 -0
  44. package/dist/modules/mcp/tools/operations/data/index.d.ts +32 -0
  45. package/dist/modules/mcp/tools/operations/data/index.js +54 -0
  46. package/dist/modules/mcp/tools/operations/index.d.ts +26 -4
  47. package/dist/modules/mcp/tools/operations/index.js +4 -1
  48. package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +1 -0
  49. package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +1 -0
  50. package/dist/modules/mcp/tools/operations/schema/operations.d.ts +2 -0
  51. package/dist/modules/mcp/tools/operations/schema/shared.d.ts +1 -0
  52. package/dist/modules/mcp/tools/operations/schema/shared.js +2 -5
  53. package/dist/modules/mcp/tools/operations/schema/translator.js +1 -1
  54. package/dist/modules/mcp/tools/operations/schema/write.js +1 -1
  55. package/dist/modules/mcp/tools/operations/schemaIds.js +1 -2
  56. package/dist/modules/mcp/tools/operations/style/write.js +1 -1
  57. package/dist/modules/mcp/tools/preview.d.ts +2 -0
  58. package/dist/modules/mcp/tools/render.d.ts +2 -0
  59. package/dist/modules/mcp/tools/screenshot.d.ts +11 -2
  60. package/dist/modules/mcp/tools/shared/newSuggestions.d.ts +2 -2
  61. package/dist/modules/mcp/tools/shared/newSuggestions.js +10 -5
  62. package/dist/modules/mcp/tools/shared/newSuggestions.test.d.ts +1 -0
  63. package/dist/modules/mcp/tools/shared/tool.d.ts +7 -6
  64. package/dist/modules/mcp/tools/shared/validator/index.js +2 -2
  65. package/dist/modules/mcp/tools/tryFunction.js +1 -1
  66. package/dist/modules/mcp/tools/validate.d.ts +11 -2
  67. package/dist/modules/mcp/types/appTypes.d.ts +2 -2
  68. package/dist/modules/mcp/types/toolTypes.d.ts +5 -1
  69. package/package.json +7 -9
  70. package/dist/modules/ai/AIEngine.d.ts +0 -20
  71. package/dist/modules/ai/AIEngine.js +0 -120
  72. package/dist/modules/ai/index.d.ts +0 -4
  73. package/dist/modules/ai/toolkit.d.ts +0 -17
  74. package/dist/modules/ai/toolkit.js +0 -59
  75. package/dist/modules/mcp/helpers/agentPrompt.d.ts +0 -4
  76. package/dist/modules/mcp/helpers/agentPrompt.js +0 -123
  77. /package/dist/modules/{ai/toolkit.test.d.ts → mcp/helpers/callToolResult.test.d.ts} +0 -0
@@ -1,4 +1,4 @@
1
- import { functionFileUri, functionsUri } from "../../helpers/uris.js";
1
+ import { dataFileUri, dataUri, functionFileUri, functionsUri } from "../../helpers/uris.js";
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";
@@ -23,6 +23,15 @@ var functionsErrors = (saved, env) => "problems" in saved ? saved.problems.map((
23
23
  message: saved.refusal.error,
24
24
  hint: `Read ${functionsUri(env)} again and redo the change on the current files`
25
25
  }];
26
+ var dataErrors = (saved, env) => "problems" in saved ? saved.problems.map((problem) => ({
27
+ path: `data/${problem.file}`,
28
+ message: problem.message,
29
+ hint: `Fix it with upsertDataFile, or deleteDataFile; read ${dataFileUri(env, problem.file)} for the file`
30
+ })) : [{
31
+ path: "data",
32
+ message: saved.refusal.error,
33
+ hint: `Read ${dataUri(env)} again and redo the change on the current files`
34
+ }];
26
35
  var apply = async (input, space, persisters) => {
27
36
  const env = input.environment ?? "main";
28
37
  const conflicts = detectConflicts(space, env, input.expectedResourceVersions);
@@ -85,6 +94,23 @@ var apply = async (input, space, persisters) => {
85
94
  };
86
95
  } else persisted = false;
87
96
  }
97
+ if (outcome.changedData && draft.data) {
98
+ if (persisters?.saveData) {
99
+ const saved = await persisters.saveData(draft.data.files, space.data?.version ?? "");
100
+ if (!saved.ok) return {
101
+ applied: false,
102
+ persisted: false,
103
+ summary: {
104
+ created: 0,
105
+ updated: 0,
106
+ deleted: 0
107
+ },
108
+ changed: [],
109
+ errors: dataErrors(saved, env),
110
+ 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
+ };
112
+ } else persisted = false;
113
+ }
88
114
  if (outcome.changedSchema) {
89
115
  if (persisters?.schema) await persisters.schema(draft.schema);
90
116
  else persisted = false;
@@ -9,8 +9,8 @@ export { screenshotShape } from './screenshot';
9
9
  export { applyOperations } from './apply/dispatch';
10
10
  export { validateOperations } from './shared/validator';
11
11
  export { operation } from './operations';
12
- /** The MCP tool registry — the single source both hosts (the standalone server and the in-process AI bridge)
13
- * register from. Adding a tool is: create its file with a ToolDef descriptor and append it here. */
12
+ /** The MCP tool registry — the single source the server registers from. Adding a tool is: create its file with a
13
+ * ToolDef descriptor and append it here. */
14
14
  export declare const tools: ToolDef[];
15
15
  export type { ToolContext, ToolDef } from './shared/tool';
16
16
  export type { OpResult } from '../helpers';
@@ -10,8 +10,8 @@ import { search, searchShape, searchTool } from "./search.js";
10
10
  import { tryFunctionTool } from "./tryFunction.js";
11
11
  import { validate, validateShape, validateTool } from "./validate.js";
12
12
  //#region src/modules/mcp/tools/index.ts
13
- /** The MCP tool registry — the single source both hosts (the standalone server and the in-process AI bridge)
14
- * register from. Adding a tool is: create its file with a ToolDef descriptor and append it here. */
13
+ /** The MCP tool registry — the single source the server registers from. Adding a tool is: create its file with a
14
+ * ToolDef descriptor and append it here. */
15
15
  var tools = [
16
16
  applyTool,
17
17
  validateTool,
@@ -31,11 +31,11 @@ export declare const connectorOps: {
31
31
  file: "file";
32
32
  text: "text";
33
33
  color: "color";
34
+ image: "image";
34
35
  switch: "switch";
35
36
  email: "email";
36
37
  date: "date";
37
38
  richText: "richText";
38
- image: "image";
39
39
  multiImage: "multiImage";
40
40
  video: "video";
41
41
  link: "link";
@@ -120,11 +120,11 @@ export declare const connectorOps: {
120
120
  file: "file";
121
121
  text: "text";
122
122
  color: "color";
123
+ image: "image";
123
124
  switch: "switch";
124
125
  email: "email";
125
126
  date: "date";
126
127
  richText: "richText";
127
- image: "image";
128
128
  multiImage: "multiImage";
129
129
  video: "video";
130
130
  link: "link";
@@ -73,11 +73,11 @@ export declare const connectorConnection: z.ZodObject<{
73
73
  file: "file";
74
74
  text: "text";
75
75
  color: "color";
76
+ image: "image";
76
77
  switch: "switch";
77
78
  email: "email";
78
79
  date: "date";
79
80
  richText: "richText";
80
- image: "image";
81
81
  multiImage: "multiImage";
82
82
  video: "video";
83
83
  link: "link";
@@ -29,11 +29,11 @@ export declare const patchConnectorOp: z.ZodObject<{
29
29
  file: "file";
30
30
  text: "text";
31
31
  color: "color";
32
+ image: "image";
32
33
  switch: "switch";
33
34
  email: "email";
34
35
  date: "date";
35
36
  richText: "richText";
36
- image: "image";
37
37
  multiImage: "multiImage";
38
38
  video: "video";
39
39
  link: "link";
@@ -30,11 +30,11 @@ export declare const upsertConnectorOp: z.ZodObject<{
30
30
  file: "file";
31
31
  text: "text";
32
32
  color: "color";
33
+ image: "image";
33
34
  switch: "switch";
34
35
  email: "email";
35
36
  date: "date";
36
37
  richText: "richText";
37
- image: "image";
38
38
  multiImage: "multiImage";
39
39
  video: "video";
40
40
  link: "link";
@@ -0,0 +1,32 @@
1
+ import { z } from 'zod';
2
+ import { OpResult, Space } from '../../../helpers';
3
+ import { Env } from '../../../types';
4
+ export declare const upsertDataFileOp: z.ZodObject<{
5
+ type: z.ZodLiteral<"upsertDataFile">;
6
+ path: z.ZodString;
7
+ content: z.ZodString;
8
+ }, z.core.$strip>;
9
+ export declare const deleteDataFileOp: z.ZodObject<{
10
+ type: z.ZodLiteral<"deleteDataFile">;
11
+ path: z.ZodString;
12
+ }, z.core.$strip>;
13
+ export type UpsertDataFile = z.infer<typeof upsertDataFileOp>;
14
+ export type DeleteDataFile = z.infer<typeof deleteDataFileOp>;
15
+ /**
16
+ * The data is one store of files, saved whole: an op edits the draft's copy, and the batch saves the files it leaves —
17
+ * checked by the platform then (each path, the weight), which answers by file. A file that is not JSON is refused here,
18
+ * where it is written: it is what makes it data.
19
+ */
20
+ export declare const upsertDataFile: (space: Space, env: Env, op: UpsertDataFile) => OpResult;
21
+ export declare const deleteDataFile: (space: Space, env: Env, op: DeleteDataFile) => OpResult;
22
+ export declare const dataOps: {
23
+ upsertDataFile: z.ZodObject<{
24
+ type: z.ZodLiteral<"upsertDataFile">;
25
+ path: z.ZodString;
26
+ content: z.ZodString;
27
+ }, z.core.$strip>;
28
+ deleteDataFile: z.ZodObject<{
29
+ type: z.ZodLiteral<"deleteDataFile">;
30
+ path: z.ZodString;
31
+ }, z.core.$strip>;
32
+ };
@@ -0,0 +1,54 @@
1
+ import { dataFileUri, dataUri } from "../../../helpers/uris.js";
2
+ import { empty, fail } from "../../../helpers/opResult.js";
3
+ import { z } from "zod";
4
+ //#region src/modules/mcp/tools/operations/data/index.ts
5
+ var upsertDataFileOp = z.object({
6
+ type: z.literal("upsertDataFile"),
7
+ path: z.string().describe("e.g. \"products.json\" — read as query \"/data/<path>\""),
8
+ content: z.string().describe("The whole file, as JSON text")
9
+ }).describe("Write one file of the space’s data (JSON its server providers read), whole.");
10
+ var deleteDataFileOp = z.object({
11
+ type: z.literal("deleteDataFile"),
12
+ path: z.string()
13
+ }).describe("Remove one file of the space’s data.");
14
+ var unavailable = () => fail("type", "This deployment keeps no space data", "Read the data through a connector or a server action instead");
15
+ /**
16
+ * The data is one store of files, saved whole: an op edits the draft's copy, and the batch saves the files it leaves —
17
+ * checked by the platform then (each path, the weight), which answers by file. A file that is not JSON is refused here,
18
+ * where it is written: it is what makes it data.
19
+ */
20
+ var upsertDataFile = (space, env, op) => {
21
+ if (!space.data) return unavailable();
22
+ try {
23
+ JSON.parse(op.content);
24
+ } catch (error) {
25
+ return fail("content", `"${op.path}" is not JSON: ${error instanceof Error ? error.message : String(error)}`, "Write the whole file as JSON text — an object or a list");
26
+ }
27
+ const exists = Object.hasOwn(space.data.files, op.path);
28
+ space.data.files = {
29
+ ...space.data.files,
30
+ [op.path]: op.content
31
+ };
32
+ return {
33
+ ...empty(),
34
+ ...exists ? { updated: 1 } : { created: 1 },
35
+ staleResources: [dataUri(env), dataFileUri(env, op.path)]
36
+ };
37
+ };
38
+ var deleteDataFile = (space, env, op) => {
39
+ if (!space.data) return unavailable();
40
+ if (!Object.hasOwn(space.data.files, op.path)) return fail("path", `The data has no file "${op.path}"`, `Read ${dataUri(env)} for the files it has`, Object.keys(space.data.files));
41
+ const { [op.path]: _removed, ...files } = space.data.files;
42
+ space.data.files = files;
43
+ return {
44
+ ...empty(),
45
+ deleted: 1,
46
+ staleResources: [dataUri(env), dataFileUri(env, op.path)]
47
+ };
48
+ };
49
+ var dataOps = {
50
+ upsertDataFile: upsertDataFileOp,
51
+ deleteDataFile: deleteDataFileOp
52
+ };
53
+ //#endregion
54
+ export { dataOps, deleteDataFile, deleteDataFileOp, upsertDataFile, upsertDataFileOp };
@@ -208,6 +208,7 @@ export declare const documentOperation: z.ZodDiscriminatedUnion<readonly [z.ZodO
208
208
  skip: "skip";
209
209
  parallel: "parallel";
210
210
  queue: "queue";
211
+ latest: "latest";
211
212
  }>>;
212
213
  elementId: z.ZodOptional<z.ZodString>;
213
214
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -226,6 +227,7 @@ export declare const documentOperation: z.ZodDiscriminatedUnion<readonly [z.ZodO
226
227
  skip: "skip";
227
228
  parallel: "parallel";
228
229
  queue: "queue";
230
+ latest: "latest";
229
231
  }>>;
230
232
  elementId: z.ZodOptional<z.ZodString>;
231
233
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -994,6 +996,7 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
994
996
  skip: "skip";
995
997
  parallel: "parallel";
996
998
  queue: "queue";
999
+ latest: "latest";
997
1000
  }>>;
998
1001
  elementId: z.ZodOptional<z.ZodString>;
999
1002
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1012,6 +1015,7 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
1012
1015
  skip: "skip";
1013
1016
  parallel: "parallel";
1014
1017
  queue: "queue";
1018
+ latest: "latest";
1015
1019
  }>>;
1016
1020
  elementId: z.ZodOptional<z.ZodString>;
1017
1021
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1600,11 +1604,11 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
1600
1604
  file: "file";
1601
1605
  text: "text";
1602
1606
  color: "color";
1607
+ image: "image";
1603
1608
  switch: "switch";
1604
1609
  email: "email";
1605
1610
  date: "date";
1606
1611
  richText: "richText";
1607
- image: "image";
1608
1612
  multiImage: "multiImage";
1609
1613
  video: "video";
1610
1614
  link: "link";
@@ -1688,11 +1692,11 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
1688
1692
  file: "file";
1689
1693
  text: "text";
1690
1694
  color: "color";
1695
+ image: "image";
1691
1696
  switch: "switch";
1692
1697
  email: "email";
1693
1698
  date: "date";
1694
1699
  richText: "richText";
1695
- image: "image";
1696
1700
  multiImage: "multiImage";
1697
1701
  video: "video";
1698
1702
  link: "link";
@@ -1839,6 +1843,13 @@ export declare const operation: z.ZodDiscriminatedUnion<[z.ZodObject<{
1839
1843
  }, z.core.$strip>, z.ZodObject<{
1840
1844
  type: z.ZodLiteral<"deleteFunctionFile">;
1841
1845
  path: z.ZodString;
1846
+ }, z.core.$strip>, z.ZodObject<{
1847
+ type: z.ZodLiteral<"upsertDataFile">;
1848
+ path: z.ZodString;
1849
+ content: z.ZodString;
1850
+ }, z.core.$strip>, z.ZodObject<{
1851
+ type: z.ZodLiteral<"deleteDataFile">;
1852
+ path: z.ZodString;
1842
1853
  }, z.core.$strip>], "type">;
1843
1854
  export type Operation = z.infer<typeof operation>;
1844
1855
  export type OperationType = Operation['type'];
@@ -2052,6 +2063,7 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
2052
2063
  skip: "skip";
2053
2064
  parallel: "parallel";
2054
2065
  queue: "queue";
2066
+ latest: "latest";
2055
2067
  }>>;
2056
2068
  elementId: z.ZodOptional<z.ZodString>;
2057
2069
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -2070,6 +2082,7 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
2070
2082
  skip: "skip";
2071
2083
  parallel: "parallel";
2072
2084
  queue: "queue";
2085
+ latest: "latest";
2073
2086
  }>>;
2074
2087
  elementId: z.ZodOptional<z.ZodString>;
2075
2088
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -2658,11 +2671,11 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
2658
2671
  file: "file";
2659
2672
  text: "text";
2660
2673
  color: "color";
2674
+ image: "image";
2661
2675
  switch: "switch";
2662
2676
  email: "email";
2663
2677
  date: "date";
2664
2678
  richText: "richText";
2665
- image: "image";
2666
2679
  multiImage: "multiImage";
2667
2680
  video: "video";
2668
2681
  link: "link";
@@ -2746,11 +2759,11 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
2746
2759
  file: "file";
2747
2760
  text: "text";
2748
2761
  color: "color";
2762
+ image: "image";
2749
2763
  switch: "switch";
2750
2764
  email: "email";
2751
2765
  date: "date";
2752
2766
  richText: "richText";
2753
- image: "image";
2754
2767
  multiImage: "multiImage";
2755
2768
  video: "video";
2756
2769
  link: "link";
@@ -2897,6 +2910,13 @@ export declare const operations: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject
2897
2910
  }, z.core.$strip>, z.ZodObject<{
2898
2911
  type: z.ZodLiteral<"deleteFunctionFile">;
2899
2912
  path: z.ZodString;
2913
+ }, z.core.$strip>, z.ZodObject<{
2914
+ type: z.ZodLiteral<"upsertDataFile">;
2915
+ path: z.ZodString;
2916
+ content: z.ZodString;
2917
+ }, z.core.$strip>, z.ZodObject<{
2918
+ type: z.ZodLiteral<"deleteDataFile">;
2919
+ path: z.ZodString;
2900
2920
  }, z.core.$strip>], "type">>;
2901
2921
  export declare const documentOperations: z.ZodArray<z.ZodDiscriminatedUnion<readonly [z.ZodObject<{
2902
2922
  type: z.ZodLiteral<"upsertElement">;
@@ -3105,6 +3125,7 @@ export declare const documentOperations: z.ZodArray<z.ZodDiscriminatedUnion<read
3105
3125
  skip: "skip";
3106
3126
  parallel: "parallel";
3107
3127
  queue: "queue";
3128
+ latest: "latest";
3108
3129
  }>>;
3109
3130
  elementId: z.ZodOptional<z.ZodString>;
3110
3131
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -3123,6 +3144,7 @@ export declare const documentOperations: z.ZodArray<z.ZodDiscriminatedUnion<read
3123
3144
  skip: "skip";
3124
3145
  parallel: "parallel";
3125
3146
  queue: "queue";
3147
+ latest: "latest";
3126
3148
  }>>;
3127
3149
  elementId: z.ZodOptional<z.ZodString>;
3128
3150
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -1,5 +1,6 @@
1
1
  import { actionOps } from "./actions/index.js";
2
2
  import { connectorOps } from "./connectors/index.js";
3
+ import { dataOps } from "./data/index.js";
3
4
  import { functionOps } from "./functions/index.js";
4
5
  import { elementOps } from "./schema/operations.js";
5
6
  import { registerSharedSchemaIds } from "./schemaIds.js";
@@ -57,7 +58,9 @@ var operation = z.discriminatedUnion("type", [
57
58
  actionOps.patchAction,
58
59
  actionOps.deleteAction,
59
60
  functionOps.upsertFunctionFile,
60
- functionOps.deleteFunctionFile
61
+ functionOps.deleteFunctionFile,
62
+ dataOps.upsertDataFile,
63
+ dataOps.deleteDataFile
61
64
  ]);
62
65
  var STYLE_OP_TYPES = new Set(Object.keys(styleOps));
63
66
  var isStyleOp = (type) => STYLE_OP_TYPES.has(type);
@@ -15,6 +15,7 @@ export declare const patchInteractionNodeOp: z.ZodObject<{
15
15
  skip: "skip";
16
16
  parallel: "parallel";
17
17
  queue: "queue";
18
+ latest: "latest";
18
19
  }>>;
19
20
  elementId: z.ZodOptional<z.ZodString>;
20
21
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -23,6 +23,7 @@ export declare const upsertInteractionFlowOp: z.ZodObject<{
23
23
  skip: "skip";
24
24
  parallel: "parallel";
25
25
  queue: "queue";
26
+ latest: "latest";
26
27
  }>>;
27
28
  elementId: z.ZodOptional<z.ZodString>;
28
29
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -224,6 +224,7 @@ export declare const elementOps: {
224
224
  skip: "skip";
225
225
  parallel: "parallel";
226
226
  queue: "queue";
227
+ latest: "latest";
227
228
  }>>;
228
229
  elementId: import('zod').ZodOptional<import('zod').ZodString>;
229
230
  preview: import('zod').ZodOptional<import('zod').ZodRecord<import('zod').ZodString, import('zod').ZodUnknown>>;
@@ -243,6 +244,7 @@ export declare const elementOps: {
243
244
  skip: "skip";
244
245
  parallel: "parallel";
245
246
  queue: "queue";
247
+ latest: "latest";
246
248
  }>>;
247
249
  elementId: import('zod').ZodOptional<import('zod').ZodString>;
248
250
  preview: import('zod').ZodOptional<import('zod').ZodRecord<import('zod').ZodString, import('zod').ZodUnknown>>;
@@ -128,6 +128,7 @@ export declare const interactionNode: z.ZodObject<{
128
128
  skip: "skip";
129
129
  parallel: "parallel";
130
130
  queue: "queue";
131
+ latest: "latest";
131
132
  }>>;
132
133
  elementId: z.ZodOptional<z.ZodString>;
133
134
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -3,6 +3,7 @@ import { z } from "zod";
3
3
  import { FLAG_GATE_PATTERN } from "@plitzi/sdk-shared/flags";
4
4
  import { ANCHOR_PATTERN } from "@plitzi/sdk-shared/schema/anchor";
5
5
  import { motionProblems } from "@plitzi/sdk-shared/schema/motion";
6
+ import { WHILE_RUNNING_MODES } from "@plitzi/sdk-shared/types/SchemaTypes";
6
7
  //#region src/modules/mcp/tools/operations/schema/shared.ts
7
8
  var combinator = z.enum(["and", "or"]);
8
9
  var operator = z.enum([
@@ -156,11 +157,7 @@ var interactionNode = z.object({
156
157
  params: z.record(z.string(), z.unknown()).optional(),
157
158
  enabled: z.boolean().optional(),
158
159
  when: ruleGroup.optional().describe("QueryBuilder RuleGroup gating this step (validated structurally)"),
159
- whileRunning: z.enum([
160
- "skip",
161
- "parallel",
162
- "queue"
163
- ]).optional().describe("Trigger only: a refiring while this flow runs"),
160
+ whileRunning: z.enum(WHILE_RUNNING_MODES).optional().describe("Trigger only: a refiring while this flow runs"),
164
161
  elementId: z.string().optional().describe("Element whose callback this step invokes, by name; defaults to this element"),
165
162
  preview: z.record(z.string(), z.unknown()).optional()
166
163
  });
@@ -2,8 +2,8 @@ import { computeVersion } from "../../../helpers/computeVersion.js";
2
2
  import { descendantCount, elementById, getLayoutElements, getPageElements, nameOf, orderedChildren, pageFoldersOf, pageRefOfElement, pagesUsingLayout, slugRouteParams, spaceIndex, strOr } from "../../../helpers/space.js";
3
3
  import { bindingsToAI, flowsFromInteractions } from "../../../helpers/interactions.js";
4
4
  import { definitionToAI, globalStylesForType, idStyleToAI } from "../style/translator.js";
5
- import { flagSpecOf, splitNotificationsCss } from "@plitzi/sdk-authoring";
6
5
  import { descendants } from "@plitzi/sdk-schema/helpers/elementTree";
6
+ import { flagSpecOf, splitNotificationsCss } from "@plitzi/sdk-authoring";
7
7
  //#region src/modules/mcp/tools/operations/schema/translator.ts
8
8
  var splitClasses = (value) => value ? value.split(/\s+/).filter(Boolean) : [];
9
9
  var propsOf = (el) => {
@@ -1,8 +1,8 @@
1
1
  import { findRootByRef, indexAddElement, resolveRef } from "../../../helpers/space.js";
2
2
  import { folderUri, foldersUri, layoutsUri, pageUri, pagesUri, schemaVarsUri, settingsUri } from "../../../helpers/uris.js";
3
3
  import { fail } from "../../../helpers/opResult.js";
4
- import { flagGateOf } from "@plitzi/sdk-authoring";
5
4
  import { documentIds } from "@plitzi/sdk-schema/helpers/components";
5
+ import { flagGateOf } from "@plitzi/sdk-authoring";
6
6
  import { isMotion } from "@plitzi/sdk-shared/schema/motion";
7
7
  import { elementIdConflict, isValidElementId } from "@plitzi/sdk-schema/helpers/elementId";
8
8
  import FlatMap from "@plitzi/sdk-schema/helpers/FlatMap";
@@ -19,8 +19,7 @@ import { z } from "zod";
19
19
  * because the `definitions` entry and the ref cost more than the single copy they replace (measured, and reverted).
20
20
  *
21
21
  * The ids are the names the MODEL reads in the refs, so they are written for it: `Element`, not `ElementInput`.
22
- * This runs once, at module load of the op vocabulary, so every conversion path benefits — the MCP tools list and
23
- * the co-worker's own tool-schema converter alike. */
22
+ * This runs once, at module load of the op vocabulary, so every conversion path benefits. */
24
23
  var SHARED_SCHEMAS = [
25
24
  [elementInput, "Element"],
26
25
  [elementFlag, "ElementFlag"],
@@ -1,5 +1,5 @@
1
- import { expandShorthand, expandShorthandPatch } from "../../../catalogs/index.js";
2
1
  import { defUri, defsUri, globalUri, globalsUri, idUri, idsUri, styleVarUri, styleVarsUri } from "../../../helpers/uris.js";
2
+ import { expandShorthand, expandShorthandPatch } from "../../../catalogs/index.js";
3
3
  import { fail } from "../../../helpers/opResult.js";
4
4
  import processSelector from "@plitzi/sdk-style/helpers/processSelector";
5
5
  //#region src/modules/mcp/tools/operations/style/write.ts
@@ -208,6 +208,7 @@ export declare const previewShape: {
208
208
  skip: "skip";
209
209
  parallel: "parallel";
210
210
  queue: "queue";
211
+ latest: "latest";
211
212
  }>>;
212
213
  elementId: z.ZodOptional<z.ZodString>;
213
214
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -226,6 +227,7 @@ export declare const previewShape: {
226
227
  skip: "skip";
227
228
  parallel: "parallel";
228
229
  queue: "queue";
230
+ latest: "latest";
229
231
  }>>;
230
232
  elementId: z.ZodOptional<z.ZodString>;
231
233
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -210,6 +210,7 @@ export declare const renderShape: {
210
210
  skip: "skip";
211
211
  parallel: "parallel";
212
212
  queue: "queue";
213
+ latest: "latest";
213
214
  }>>;
214
215
  elementId: z.ZodOptional<z.ZodString>;
215
216
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -228,6 +229,7 @@ export declare const renderShape: {
228
229
  skip: "skip";
229
230
  parallel: "parallel";
230
231
  queue: "queue";
232
+ latest: "latest";
231
233
  }>>;
232
234
  elementId: z.ZodOptional<z.ZodString>;
233
235
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -208,6 +208,7 @@ export declare const screenshotShape: {
208
208
  skip: "skip";
209
209
  parallel: "parallel";
210
210
  queue: "queue";
211
+ latest: "latest";
211
212
  }>>;
212
213
  elementId: z.ZodOptional<z.ZodString>;
213
214
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -226,6 +227,7 @@ export declare const screenshotShape: {
226
227
  skip: "skip";
227
228
  parallel: "parallel";
228
229
  queue: "queue";
230
+ latest: "latest";
229
231
  }>>;
230
232
  elementId: z.ZodOptional<z.ZodString>;
231
233
  preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -814,11 +816,11 @@ export declare const screenshotShape: {
814
816
  file: "file";
815
817
  text: "text";
816
818
  color: "color";
819
+ image: "image";
817
820
  switch: "switch";
818
821
  email: "email";
819
822
  date: "date";
820
823
  richText: "richText";
821
- image: "image";
822
824
  multiImage: "multiImage";
823
825
  video: "video";
824
826
  link: "link";
@@ -902,11 +904,11 @@ export declare const screenshotShape: {
902
904
  file: "file";
903
905
  text: "text";
904
906
  color: "color";
907
+ image: "image";
905
908
  switch: "switch";
906
909
  email: "email";
907
910
  date: "date";
908
911
  richText: "richText";
909
- image: "image";
910
912
  multiImage: "multiImage";
911
913
  video: "video";
912
914
  link: "link";
@@ -1053,6 +1055,13 @@ export declare const screenshotShape: {
1053
1055
  }, z.core.$strip>, z.ZodObject<{
1054
1056
  type: z.ZodLiteral<"deleteFunctionFile">;
1055
1057
  path: z.ZodString;
1058
+ }, z.core.$strip>, z.ZodObject<{
1059
+ type: z.ZodLiteral<"upsertDataFile">;
1060
+ path: z.ZodString;
1061
+ content: z.ZodString;
1062
+ }, z.core.$strip>, z.ZodObject<{
1063
+ type: z.ZodLiteral<"deleteDataFile">;
1064
+ path: z.ZodString;
1056
1065
  }, z.core.$strip>], "type">>>;
1057
1066
  viewport: z.ZodOptional<z.ZodEnum<{
1058
1067
  desktop: "desktop";
@@ -1,7 +1,7 @@
1
1
  import { Space } from '../../helpers';
2
2
  /**
3
3
  * The shorter ways to the same page a batch opened up — a header the agent just copied onto a third page, a button it
4
- * gave a text child — and none the space already had: those were said when they appeared, and saying them on every
5
- * batch would bury the new ones. Not problems: nothing here blocks anything.
4
+ * gave a text child, a class it left nothing wearing — and none the space already had: those were said when they
5
+ * appeared, and saying them on every batch would bury the new ones. Not problems: nothing here blocks anything.
6
6
  */
7
7
  export declare const newSuggestions: (before: Space, after: Space) => string[];
@@ -1,20 +1,25 @@
1
1
  import { suggestSpace } from "@plitzi/sdk-authoring";
2
2
  //#region src/modules/mcp/tools/shared/newSuggestions.ts
3
- var keyOf = ({ code, elementIds }) => `${code}|${[...elementIds].sort().join(",")}`;
3
+ /**
4
+ * What a suggestion is about, one key each: its elements together, or — for one about declarations, which names many
5
+ * at once — each class, token or component on its own, so the one a batch just left unused is new beside the ones the
6
+ * space already had.
7
+ */
8
+ var keysOf = ({ code, elementIds, subjects }) => subjects?.length ? subjects.map((subject) => `${code}|${subject}`) : [`${code}|${[...elementIds].sort().join(",")}`];
4
9
  /**
5
10
  * The shorter ways to the same page a batch opened up — a header the agent just copied onto a third page, a button it
6
- * gave a text child — and none the space already had: those were said when they appeared, and saying them on every
7
- * batch would bury the new ones. Not problems: nothing here blocks anything.
11
+ * gave a text child, a class it left nothing wearing — and none the space already had: those were said when they
12
+ * appeared, and saying them on every batch would bury the new ones. Not problems: nothing here blocks anything.
8
13
  */
9
14
  var newSuggestions = (before, after) => {
10
15
  const had = new Set(suggestSpace({
11
16
  schema: before.schema,
12
17
  style: before.style
13
- }).map(keyOf));
18
+ }).flatMap(keysOf));
14
19
  return suggestSpace({
15
20
  schema: after.schema,
16
21
  style: after.style
17
- }).filter((suggestion) => !had.has(keyOf(suggestion))).map(({ code, message, saves }) => `[${code}] ${message}${saves > 0 ? ` (saves ${String(saves)} element${saves === 1 ? "" : "s"})` : ""}`);
22
+ }).filter((suggestion) => keysOf(suggestion).some((key) => !had.has(key))).map(({ code, message, saves }) => `[${code}] ${message}${saves > 0 ? ` (saves ${String(saves)} element${saves === 1 ? "" : "s"})` : ""}`);
18
23
  };
19
24
  //#endregion
20
25
  export { newSuggestions };