@plitzi/sdk-mcp 0.33.2 → 0.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/modules/mcp/catalogs/index.d.ts +2 -7
- package/dist/modules/mcp/catalogs/index.js +4 -0
- package/dist/modules/mcp/catalogs/observed.d.ts +1 -1
- package/dist/modules/mcp/catalogs/observed.js +2 -5
- package/dist/modules/mcp/catalogs/pluginCatalog.d.ts +17 -0
- package/dist/modules/mcp/catalogs/pluginCatalog.js +91 -0
- package/dist/modules/mcp/catalogs/registry.js +2 -3
- package/dist/modules/mcp/helpers/agentPrompt.js +9 -9
- package/dist/modules/mcp/helpers/guide.d.ts +2 -2
- package/dist/modules/mcp/helpers/guide.js +117 -50
- package/dist/modules/mcp/helpers/interactions.d.ts +5 -1
- package/dist/modules/mcp/helpers/interactions.js +15 -6
- package/dist/modules/mcp/helpers/space.d.ts +45 -28
- package/dist/modules/mcp/helpers/space.js +87 -87
- package/dist/modules/mcp/helpers/uris.d.ts +9 -0
- package/dist/modules/mcp/helpers/uris.js +10 -1
- package/dist/modules/mcp/index.d.ts +2 -0
- package/dist/modules/mcp/localScreenshotClient.d.ts +51 -0
- package/dist/modules/mcp/localScreenshotClient.js +106 -0
- package/dist/modules/mcp/proxy/rewrite.js +15 -1
- package/dist/modules/mcp/resources/actions.d.ts +25 -0
- package/dist/modules/mcp/resources/actions.js +54 -0
- package/dist/modules/mcp/resources/canonical.d.ts +1 -1
- package/dist/modules/mcp/resources/canonical.js +1 -1
- package/dist/modules/mcp/resources/connectors.d.ts +1 -1
- package/dist/modules/mcp/resources/core.js +1 -1
- package/dist/modules/mcp/resources/index.d.ts +1 -0
- package/dist/modules/mcp/resources/primer.d.ts +8 -1
- package/dist/modules/mcp/resources/primer.js +139 -15
- package/dist/modules/mcp/resources/register.js +24 -4
- package/dist/modules/mcp/resources/renderGuide.js +66 -14
- package/dist/modules/mcp/resources/router.js +3 -1
- package/dist/modules/mcp/resources/schema.js +6 -5
- package/dist/modules/mcp/resources/style.d.ts +2 -1
- package/dist/modules/mcp/resources/style.js +10 -3
- package/dist/modules/mcp/screenshotClient.js +3 -2
- package/dist/modules/mcp/server.js +12 -6
- package/dist/modules/mcp/tests/agentRoundtrip.test.d.ts +1 -0
- package/dist/modules/mcp/tests/layouts.test.d.ts +1 -0
- package/dist/modules/mcp/tools/apply/dispatch.js +30 -1
- package/dist/modules/mcp/tools/apply/index.d.ts +149 -15
- package/dist/modules/mcp/tools/apply/index.js +12 -2
- package/dist/modules/mcp/tools/operations/actions/actions.test.d.ts +1 -0
- package/dist/modules/mcp/tools/operations/actions/deleteAction.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/actions/deleteAction.js +20 -0
- package/dist/modules/mcp/tools/operations/actions/document.d.ts +69 -0
- package/dist/modules/mcp/tools/operations/actions/document.js +73 -0
- package/dist/modules/mcp/tools/operations/actions/index.d.ts +90 -0
- package/dist/modules/mcp/tools/operations/actions/index.js +12 -0
- package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +45 -0
- package/dist/modules/mcp/tools/operations/actions/patchAction.js +71 -0
- package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +47 -0
- package/dist/modules/mcp/tools/operations/actions/upsertAction.js +83 -0
- package/dist/modules/mcp/tools/operations/connectors/index.d.ts +10 -10
- package/dist/modules/mcp/tools/operations/connectors/manifest.d.ts +5 -5
- package/dist/modules/mcp/tools/operations/connectors/patchConnector.d.ts +5 -5
- package/dist/modules/mcp/tools/operations/connectors/upsertConnector.d.ts +5 -5
- package/dist/modules/mcp/tools/operations/index.d.ts +415 -40
- package/dist/modules/mcp/tools/operations/index.js +11 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +2 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +1 -1
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +2 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +1 -1
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +4 -4
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +5 -5
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +6 -6
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +1 -1
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +11 -12
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +1 -1
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +4 -4
- package/dist/modules/mcp/tools/operations/schema/index.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +2 -2
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +1 -1
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +2 -2
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +1 -1
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +4 -4
- package/dist/modules/mcp/tools/operations/schema/operations.d.ts +28 -5
- package/dist/modules/mcp/tools/operations/schema/operations.js +4 -0
- package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.js +33 -0
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +1 -1
- package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.d.ts +22 -0
- package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.js +61 -0
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +53 -18
- package/dist/modules/mcp/tools/operations/schema/shared.d.ts +5 -1
- package/dist/modules/mcp/tools/operations/schema/shared.js +2 -2
- package/dist/modules/mcp/tools/operations/schema/translator.d.ts +2 -1
- package/dist/modules/mcp/tools/operations/schema/translator.js +21 -9
- package/dist/modules/mcp/tools/operations/schema/write.d.ts +9 -22
- package/dist/modules/mcp/tools/operations/schema/write.js +23 -43
- package/dist/modules/mcp/tools/operations/schemaIds.js +7 -1
- package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.js +21 -0
- package/dist/modules/mcp/tools/operations/style/fonts/fonts.test.d.ts +1 -0
- package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.d.ts +35 -0
- package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.js +66 -0
- package/dist/modules/mcp/tools/operations/style/index.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/style/operations.d.ts +34 -0
- package/dist/modules/mcp/tools/operations/style/operations.js +5 -1
- package/dist/modules/mcp/tools/operations/style/translator.d.ts +13 -1
- package/dist/modules/mcp/tools/operations/style/translator.js +18 -1
- package/dist/modules/mcp/tools/operations/style/write.js +1 -1
- package/dist/modules/mcp/tools/preview.d.ts +58 -5
- package/dist/modules/mcp/tools/preview.js +1 -1
- package/dist/modules/mcp/tools/render.d.ts +61 -5
- package/dist/modules/mcp/tools/render.js +10 -3
- package/dist/modules/mcp/tools/screenshot.d.ts +151 -16
- package/dist/modules/mcp/tools/screenshot.js +22 -13
- package/dist/modules/mcp/tools/search.js +3 -3
- package/dist/modules/mcp/tools/shared/interactionReport.d.ts +7 -0
- package/dist/modules/mcp/tools/shared/interactionReport.js +48 -0
- package/dist/modules/mcp/tools/shared/validator/audit.js +4 -4
- package/dist/modules/mcp/tools/shared/validator/batch.d.ts +1 -0
- package/dist/modules/mcp/tools/shared/validator/batch.js +11 -2
- package/dist/modules/mcp/tools/shared/validator/bindings.js +6 -6
- package/dist/modules/mcp/tools/shared/validator/connectors.js +1 -1
- package/dist/modules/mcp/tools/shared/validator/context.d.ts +3 -0
- package/dist/modules/mcp/tools/shared/validator/css.js +1 -1
- package/dist/modules/mcp/tools/shared/validator/index.js +29 -9
- package/dist/modules/mcp/tools/shared/validator/interactions.js +41 -7
- package/dist/modules/mcp/tools/shared/validator/refs.js +4 -4
- package/dist/modules/mcp/tools/validate.d.ts +149 -15
- package/dist/modules/mcp/types/aiSchema.d.ts +33 -4
- package/dist/modules/mcp/types/previewTypes.d.ts +19 -0
- package/dist/modules/mcp/types/screenshotTypes.d.ts +1 -0
- package/dist/modules/mcp/types/toolTypes.d.ts +6 -1
- package/dist/pipeline.js +1 -1
- package/dist/preview/createPreview.d.ts +4 -2
- package/dist/preview/createPreview.js +16 -6
- package/dist/server.d.ts +3 -0
- package/dist/server.js +3 -1
- package/dist/stages/preview.js +20 -1
- package/dist/tests/httpRequest.d.ts +2 -0
- package/package.json +20 -16
- package/skills/plitzi-render/SKILL.md +84 -11
- package/dist/modules/mcp/catalogs/builtinCallbacks.d.ts +0 -19
- package/dist/modules/mcp/catalogs/builtinCallbacks.js +0 -139
- package/dist/modules/mcp/catalogs/builtinComponents.d.ts +0 -4
- package/dist/modules/mcp/catalogs/builtinComponents.js +0 -165
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.d.ts +0 -17
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +0 -50
- package/dist/modules/mcp/catalogs/builtinTransformers.d.ts +0 -28
- package/dist/modules/mcp/catalogs/builtinTransformers.js +0 -148
- package/dist/modules/mcp/catalogs/builtinUtilities.d.ts +0 -15
- package/dist/modules/mcp/catalogs/builtinUtilities.js +0 -90
- package/dist/modules/mcp/catalogs/cssCatalog/border.d.ts +0 -4
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +0 -30
- package/dist/modules/mcp/catalogs/cssCatalog/box.d.ts +0 -4
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +0 -31
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.d.ts +0 -34
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +0 -185
- package/dist/modules/mcp/catalogs/cssCatalog/index.d.ts +0 -18
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +0 -131
- package/dist/modules/mcp/catalogs/cssCatalog/layout.d.ts +0 -9
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +0 -99
- package/dist/modules/mcp/catalogs/cssCatalog/visual.d.ts +0 -8
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +0 -147
- package/dist/modules/mcp/catalogs/paramSpec.d.ts +0 -39
- package/dist/modules/mcp/catalogs/paramSpec.js +0 -69
- package/dist/modules/oauth/authorize.d.ts +0 -7
- package/dist/modules/oauth/authorize.js +0 -177
- package/dist/modules/oauth/challenge.d.ts +0 -11
- package/dist/modules/oauth/challenge.js +0 -33
- package/dist/modules/oauth/consentPage.d.ts +0 -7
- package/dist/modules/oauth/consentPage.js +0 -118
- package/dist/modules/oauth/metadata.d.ts +0 -40
- package/dist/modules/oauth/metadata.js +0 -69
- package/dist/modules/oauth/params.d.ts +0 -5
- package/dist/modules/oauth/params.js +0 -5
- package/dist/modules/oauth/pkce.d.ts +0 -6
- package/dist/modules/oauth/pkce.js +0 -15
- package/dist/modules/oauth/records.d.ts +0 -71
- package/dist/modules/oauth/records.js +0 -46
- package/dist/modules/oauth/register.d.ts +0 -5
- package/dist/modules/oauth/register.js +0 -55
- package/dist/modules/oauth/respond.d.ts +0 -13
- package/dist/modules/oauth/respond.js +0 -44
- package/dist/modules/oauth/token.d.ts +0 -5
- package/dist/modules/oauth/token.js +0 -100
- package/dist/stages/oauth.d.ts +0 -19
- package/dist/stages/oauth.js +0 -114
- /package/dist/modules/mcp/catalogs/{builtinTransformers.test.d.ts → pluginCatalog.test.d.ts} +0 -0
- /package/dist/modules/mcp/{catalogs/cssCatalog/cssCatalog.test.d.ts → localScreenshotClient.test.d.ts} +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { fail } from "../../helpers/opResult.js";
|
|
2
|
+
import { deleteAction } from "../operations/actions/deleteAction.js";
|
|
3
|
+
import { patchAction } from "../operations/actions/patchAction.js";
|
|
4
|
+
import { upsertAction } from "../operations/actions/upsertAction.js";
|
|
2
5
|
import { deleteConnector } from "../operations/connectors/deleteConnector.js";
|
|
3
6
|
import { patchConnector } from "../operations/connectors/patchConnector.js";
|
|
4
7
|
import { upsertConnector } from "../operations/connectors/upsertConnector.js";
|
|
@@ -14,7 +17,9 @@ import { upsertFolder } from "../operations/schema/folders/upsertFolder.js";
|
|
|
14
17
|
import { deleteInteraction } from "../operations/schema/interactions/deleteInteraction.js";
|
|
15
18
|
import { patchInteractionNode } from "../operations/schema/interactions/patchInteractionNode.js";
|
|
16
19
|
import { upsertInteractionFlow } from "../operations/schema/interactions/upsertInteractionFlow.js";
|
|
20
|
+
import { deleteLayout } from "../operations/schema/pages/deleteLayout.js";
|
|
17
21
|
import { deletePage } from "../operations/schema/pages/deletePage.js";
|
|
22
|
+
import { upsertLayout } from "../operations/schema/pages/upsertLayout.js";
|
|
18
23
|
import { upsertPage } from "../operations/schema/pages/upsertPage.js";
|
|
19
24
|
import { patchSettings } from "../operations/schema/settings/patchSettings.js";
|
|
20
25
|
import { deleteVariable } from "../operations/schema/variables/deleteVariable.js";
|
|
@@ -23,6 +28,8 @@ import { deleteDefinition } from "../operations/style/definitions/deleteDefiniti
|
|
|
23
28
|
import { patchDefinition } from "../operations/style/definitions/patchDefinition.js";
|
|
24
29
|
import { upsertDefinition } from "../operations/style/definitions/upsertDefinition.js";
|
|
25
30
|
import { upsertDefinitions } from "../operations/style/definitions/upsertDefinitions.js";
|
|
31
|
+
import { deleteFont } from "../operations/style/fonts/deleteFont.js";
|
|
32
|
+
import { upsertFont } from "../operations/style/fonts/upsertFont.js";
|
|
26
33
|
import { deleteGlobalStyle } from "../operations/style/globalStyles/deleteGlobalStyle.js";
|
|
27
34
|
import { patchGlobalStyle } from "../operations/style/globalStyles/patchGlobalStyle.js";
|
|
28
35
|
import { upsertGlobalStyle } from "../operations/style/globalStyles/upsertGlobalStyle.js";
|
|
@@ -41,6 +48,8 @@ var executeOp = (space, env, op) => {
|
|
|
41
48
|
case "moveElement": return moveElement(space, env, op);
|
|
42
49
|
case "upsertPage": return upsertPage(space, env, op);
|
|
43
50
|
case "deletePage": return deletePage(space, env, op);
|
|
51
|
+
case "upsertLayout": return upsertLayout(space, env, op);
|
|
52
|
+
case "deleteLayout": return deleteLayout(space, env, op);
|
|
44
53
|
case "upsertFolder": return upsertFolder(space, env, op);
|
|
45
54
|
case "deleteFolder": return deleteFolder(space, env, op);
|
|
46
55
|
case "upsertVariable": return upsertVariable(space, env, op);
|
|
@@ -64,9 +73,14 @@ var executeOp = (space, env, op) => {
|
|
|
64
73
|
case "deleteIdStyle": return deleteIdStyle(space, env, op);
|
|
65
74
|
case "upsertStyleVariable": return upsertStyleVariable(space, env, op);
|
|
66
75
|
case "deleteStyleVariable": return deleteStyleVariable(space, env, op);
|
|
76
|
+
case "upsertFont": return upsertFont(space, env, op);
|
|
77
|
+
case "deleteFont": return deleteFont(space, env, op);
|
|
67
78
|
case "upsertConnector": return upsertConnector(space, env, op);
|
|
68
79
|
case "patchConnector": return patchConnector(space, env, op);
|
|
69
80
|
case "deleteConnector": return deleteConnector(space, env, op);
|
|
81
|
+
case "upsertAction": return upsertAction(space, env, op);
|
|
82
|
+
case "patchAction": return patchAction(space, env, op);
|
|
83
|
+
case "deleteAction": return deleteAction(space, env, op);
|
|
70
84
|
default: return fail("type", `Unknown operation "${op.type}"`, "See the Operation union");
|
|
71
85
|
}
|
|
72
86
|
};
|
|
@@ -83,12 +97,16 @@ var applyOperations = (space, env, ops) => {
|
|
|
83
97
|
changedSchema: false,
|
|
84
98
|
changedStyle: false,
|
|
85
99
|
changedConnectors: [],
|
|
86
|
-
deletedConnectors: []
|
|
100
|
+
deletedConnectors: [],
|
|
101
|
+
changedActions: [],
|
|
102
|
+
deletedActions: []
|
|
87
103
|
};
|
|
88
104
|
const stale = /* @__PURE__ */ new Set();
|
|
89
105
|
const elements = /* @__PURE__ */ new Set();
|
|
90
106
|
const savedConnectors = /* @__PURE__ */ new Set();
|
|
91
107
|
const droppedConnectors = /* @__PURE__ */ new Set();
|
|
108
|
+
const savedActions = /* @__PURE__ */ new Set();
|
|
109
|
+
const droppedActions = /* @__PURE__ */ new Set();
|
|
92
110
|
for (let i = 0; i < ops.length; i++) {
|
|
93
111
|
const op = ops[i];
|
|
94
112
|
const result = executeOp(space, env, op);
|
|
@@ -109,6 +127,15 @@ var applyOperations = (space, env, ops) => {
|
|
|
109
127
|
savedConnectors.delete(op.ref);
|
|
110
128
|
droppedConnectors.add(op.ref);
|
|
111
129
|
break;
|
|
130
|
+
case "upsertAction":
|
|
131
|
+
case "patchAction":
|
|
132
|
+
droppedActions.delete(op.ref);
|
|
133
|
+
savedActions.add(op.ref);
|
|
134
|
+
break;
|
|
135
|
+
case "deleteAction":
|
|
136
|
+
savedActions.delete(op.ref);
|
|
137
|
+
droppedActions.add(op.ref);
|
|
138
|
+
break;
|
|
112
139
|
default: if (isStyleOp(op.type)) outcome.changedStyle = true;
|
|
113
140
|
else outcome.changedSchema = true;
|
|
114
141
|
}
|
|
@@ -122,6 +149,8 @@ var applyOperations = (space, env, ops) => {
|
|
|
122
149
|
outcome.elementRefs = Array.from(elements);
|
|
123
150
|
outcome.changedConnectors = Array.from(savedConnectors);
|
|
124
151
|
outcome.deletedConnectors = Array.from(droppedConnectors);
|
|
152
|
+
outcome.changedActions = Array.from(savedActions);
|
|
153
|
+
outcome.deletedActions = Array.from(droppedActions);
|
|
125
154
|
return outcome;
|
|
126
155
|
};
|
|
127
156
|
//#endregion
|
|
@@ -37,7 +37,7 @@ export declare const applyShape: {
|
|
|
37
37
|
type: z.ZodLiteral<"patchElement">;
|
|
38
38
|
pageRef: z.ZodString;
|
|
39
39
|
ref: z.ZodString;
|
|
40
|
-
|
|
40
|
+
rename: z.ZodOptional<z.ZodString>;
|
|
41
41
|
label: z.ZodOptional<z.ZodString>;
|
|
42
42
|
subType: z.ZodOptional<z.ZodString>;
|
|
43
43
|
props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
@@ -75,10 +75,31 @@ export declare const applyShape: {
|
|
|
75
75
|
slug: z.ZodOptional<z.ZodString>;
|
|
76
76
|
folder: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
77
77
|
default: z.ZodOptional<z.ZodBoolean>;
|
|
78
|
+
layout: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
79
|
+
layoutContainer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
78
80
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
79
81
|
}, z.core.$strip>, z.ZodObject<{
|
|
80
82
|
type: z.ZodLiteral<"deletePage">;
|
|
81
83
|
ref: z.ZodString;
|
|
84
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"upsertLayout">;
|
|
86
|
+
ref: z.ZodString;
|
|
87
|
+
label: z.ZodOptional<z.ZodString>;
|
|
88
|
+
subType: z.ZodOptional<z.ZodEnum<{
|
|
89
|
+
footer: "footer";
|
|
90
|
+
main: "main";
|
|
91
|
+
header: "header";
|
|
92
|
+
div: "div";
|
|
93
|
+
nav: "nav";
|
|
94
|
+
section: "section";
|
|
95
|
+
article: "article";
|
|
96
|
+
aside: "aside";
|
|
97
|
+
address: "address";
|
|
98
|
+
figure: "figure";
|
|
99
|
+
}>>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
type: z.ZodLiteral<"deleteLayout">;
|
|
102
|
+
ref: z.ZodString;
|
|
82
103
|
}, z.core.$strip>, z.ZodObject<{
|
|
83
104
|
type: z.ZodLiteral<"upsertFolder">;
|
|
84
105
|
ref: z.ZodString;
|
|
@@ -119,7 +140,7 @@ export declare const applyShape: {
|
|
|
119
140
|
params: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
120
141
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
121
142
|
}, z.core.$strip>>>;
|
|
122
|
-
when: z.ZodOptional<z.ZodType<import('@plitzi/
|
|
143
|
+
when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
|
|
123
144
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
124
145
|
}, z.core.$strip>;
|
|
125
146
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -139,7 +160,7 @@ export declare const applyShape: {
|
|
|
139
160
|
params: z.ZodRecord<z.ZodString, z.ZodString>;
|
|
140
161
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
141
162
|
}, z.core.$strip>>>;
|
|
142
|
-
when: z.ZodOptional<z.ZodType<import('@plitzi/
|
|
163
|
+
when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
|
|
143
164
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
144
165
|
}, z.core.$strip>, z.ZodObject<{
|
|
145
166
|
type: z.ZodLiteral<"deleteBinding">;
|
|
@@ -169,7 +190,7 @@ export declare const applyShape: {
|
|
|
169
190
|
action: z.ZodString;
|
|
170
191
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
171
192
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
172
|
-
when: z.ZodOptional<z.ZodType<import('@plitzi/
|
|
193
|
+
when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
|
|
173
194
|
elementId: z.ZodOptional<z.ZodString>;
|
|
174
195
|
preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
175
196
|
}, z.core.$strip>>;
|
|
@@ -182,7 +203,7 @@ export declare const applyShape: {
|
|
|
182
203
|
action: z.ZodOptional<z.ZodString>;
|
|
183
204
|
params: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
184
205
|
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
185
|
-
when: z.ZodOptional<z.ZodType<import('@plitzi/
|
|
206
|
+
when: z.ZodOptional<z.ZodType<import('@plitzi/sdk-shared').RuleGroup, unknown, z.core.$ZodTypeInternals<import('@plitzi/sdk-shared').RuleGroup, unknown>>>;
|
|
186
207
|
elementId: z.ZodOptional<z.ZodString>;
|
|
187
208
|
preview: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
188
209
|
}, z.core.$strip>, z.ZodObject<{
|
|
@@ -471,6 +492,38 @@ export declare const applyShape: {
|
|
|
471
492
|
custom: "custom";
|
|
472
493
|
}>;
|
|
473
494
|
name: z.ZodString;
|
|
495
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
496
|
+
type: z.ZodLiteral<"upsertFont">;
|
|
497
|
+
family: z.ZodString;
|
|
498
|
+
source: z.ZodEnum<{
|
|
499
|
+
system: "system";
|
|
500
|
+
hosted: "hosted";
|
|
501
|
+
google: "google";
|
|
502
|
+
remote: "remote";
|
|
503
|
+
}>;
|
|
504
|
+
fallback: z.ZodString;
|
|
505
|
+
weights: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
|
|
506
|
+
styles: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
507
|
+
normal: "normal";
|
|
508
|
+
italic: "italic";
|
|
509
|
+
}>>>;
|
|
510
|
+
stylesheet: z.ZodOptional<z.ZodString>;
|
|
511
|
+
files: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
512
|
+
weight: z.ZodNumber;
|
|
513
|
+
style: z.ZodEnum<{
|
|
514
|
+
normal: "normal";
|
|
515
|
+
italic: "italic";
|
|
516
|
+
}>;
|
|
517
|
+
format: z.ZodEnum<{
|
|
518
|
+
woff2: "woff2";
|
|
519
|
+
woff: "woff";
|
|
520
|
+
}>;
|
|
521
|
+
url: z.ZodOptional<z.ZodString>;
|
|
522
|
+
path: z.ZodOptional<z.ZodString>;
|
|
523
|
+
}, z.core.$strip>>>;
|
|
524
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
525
|
+
type: z.ZodLiteral<"deleteFont">;
|
|
526
|
+
family: z.ZodString;
|
|
474
527
|
}, z.core.$strip>, z.ZodObject<{
|
|
475
528
|
type: z.ZodLiteral<"upsertConnector">;
|
|
476
529
|
ref: z.ZodString;
|
|
@@ -489,8 +542,8 @@ export declare const applyShape: {
|
|
|
489
542
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
490
543
|
pagination: z.ZodOptional<z.ZodEnum<{
|
|
491
544
|
page: "page";
|
|
492
|
-
cursor: "cursor";
|
|
493
545
|
offset: "offset";
|
|
546
|
+
cursor: "cursor";
|
|
494
547
|
}>>;
|
|
495
548
|
operators: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
496
549
|
mediaBaseUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -499,14 +552,14 @@ export declare const applyShape: {
|
|
|
499
552
|
file: "file";
|
|
500
553
|
text: "text";
|
|
501
554
|
color: "color";
|
|
502
|
-
link: "link";
|
|
503
|
-
image: "image";
|
|
504
|
-
video: "video";
|
|
505
555
|
switch: "switch";
|
|
506
556
|
email: "email";
|
|
507
557
|
date: "date";
|
|
508
558
|
richText: "richText";
|
|
559
|
+
image: "image";
|
|
509
560
|
multiImage: "multiImage";
|
|
561
|
+
video: "video";
|
|
562
|
+
link: "link";
|
|
510
563
|
phone: "phone";
|
|
511
564
|
option: "option";
|
|
512
565
|
}>>>;
|
|
@@ -533,8 +586,8 @@ export declare const applyShape: {
|
|
|
533
586
|
body: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
534
587
|
pagination: z.ZodOptional<z.ZodEnum<{
|
|
535
588
|
page: "page";
|
|
536
|
-
cursor: "cursor";
|
|
537
589
|
offset: "offset";
|
|
590
|
+
cursor: "cursor";
|
|
538
591
|
}>>;
|
|
539
592
|
}, z.core.$strip>>;
|
|
540
593
|
write: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
@@ -577,8 +630,8 @@ export declare const applyShape: {
|
|
|
577
630
|
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
578
631
|
pagination: z.ZodOptional<z.ZodEnum<{
|
|
579
632
|
page: "page";
|
|
580
|
-
cursor: "cursor";
|
|
581
633
|
offset: "offset";
|
|
634
|
+
cursor: "cursor";
|
|
582
635
|
}>>;
|
|
583
636
|
operators: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
584
637
|
mediaBaseUrl: z.ZodOptional<z.ZodString>;
|
|
@@ -587,14 +640,14 @@ export declare const applyShape: {
|
|
|
587
640
|
file: "file";
|
|
588
641
|
text: "text";
|
|
589
642
|
color: "color";
|
|
590
|
-
link: "link";
|
|
591
|
-
image: "image";
|
|
592
|
-
video: "video";
|
|
593
643
|
switch: "switch";
|
|
594
644
|
email: "email";
|
|
595
645
|
date: "date";
|
|
596
646
|
richText: "richText";
|
|
647
|
+
image: "image";
|
|
597
648
|
multiImage: "multiImage";
|
|
649
|
+
video: "video";
|
|
650
|
+
link: "link";
|
|
598
651
|
phone: "phone";
|
|
599
652
|
option: "option";
|
|
600
653
|
}>>>;
|
|
@@ -621,8 +674,8 @@ export declare const applyShape: {
|
|
|
621
674
|
body: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
622
675
|
pagination: z.ZodOptional<z.ZodEnum<{
|
|
623
676
|
page: "page";
|
|
624
|
-
cursor: "cursor";
|
|
625
677
|
offset: "offset";
|
|
678
|
+
cursor: "cursor";
|
|
626
679
|
}>>;
|
|
627
680
|
}, z.core.$strip>>>>;
|
|
628
681
|
write: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
@@ -650,6 +703,87 @@ export declare const applyShape: {
|
|
|
650
703
|
}, z.core.$strip>, z.ZodObject<{
|
|
651
704
|
type: z.ZodLiteral<"deleteConnector">;
|
|
652
705
|
ref: z.ZodString;
|
|
706
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
707
|
+
type: z.ZodLiteral<"upsertAction">;
|
|
708
|
+
ref: z.ZodString;
|
|
709
|
+
name: z.ZodString;
|
|
710
|
+
description: z.ZodOptional<z.ZodString>;
|
|
711
|
+
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
712
|
+
type: z.ZodEnum<{
|
|
713
|
+
number: "number";
|
|
714
|
+
boolean: "boolean";
|
|
715
|
+
file: "file";
|
|
716
|
+
json: "json";
|
|
717
|
+
text: "text";
|
|
718
|
+
date: "date";
|
|
719
|
+
}>;
|
|
720
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
721
|
+
defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
722
|
+
label: z.ZodOptional<z.ZodString>;
|
|
723
|
+
}, z.core.$strip>>>;
|
|
724
|
+
nodes: z.ZodArray<z.ZodObject<{
|
|
725
|
+
id: z.ZodString;
|
|
726
|
+
title: z.ZodString;
|
|
727
|
+
type: z.ZodEnum<{
|
|
728
|
+
trigger: "trigger";
|
|
729
|
+
task: "task";
|
|
730
|
+
}>;
|
|
731
|
+
action: z.ZodString;
|
|
732
|
+
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
733
|
+
afterNode: z.ZodDefault<z.ZodString>;
|
|
734
|
+
beforeNode: z.ZodDefault<z.ZodString>;
|
|
735
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
736
|
+
when: z.ZodOptional<z.ZodUnknown>;
|
|
737
|
+
remove: z.ZodOptional<z.ZodBoolean>;
|
|
738
|
+
}, z.core.$strip>>;
|
|
739
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
740
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
741
|
+
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
742
|
+
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
743
|
+
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
744
|
+
}, z.core.$strip>>;
|
|
745
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
746
|
+
type: z.ZodLiteral<"patchAction">;
|
|
747
|
+
ref: z.ZodString;
|
|
748
|
+
name: z.ZodOptional<z.ZodString>;
|
|
749
|
+
description: z.ZodOptional<z.ZodString>;
|
|
750
|
+
output: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNullable<z.ZodObject<{
|
|
751
|
+
type: z.ZodEnum<{
|
|
752
|
+
number: "number";
|
|
753
|
+
boolean: "boolean";
|
|
754
|
+
file: "file";
|
|
755
|
+
json: "json";
|
|
756
|
+
text: "text";
|
|
757
|
+
date: "date";
|
|
758
|
+
}>;
|
|
759
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
760
|
+
defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
761
|
+
label: z.ZodOptional<z.ZodString>;
|
|
762
|
+
}, z.core.$strip>>>>;
|
|
763
|
+
nodes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
764
|
+
id: z.ZodString;
|
|
765
|
+
title: z.ZodString;
|
|
766
|
+
type: z.ZodEnum<{
|
|
767
|
+
trigger: "trigger";
|
|
768
|
+
task: "task";
|
|
769
|
+
}>;
|
|
770
|
+
action: z.ZodString;
|
|
771
|
+
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
772
|
+
afterNode: z.ZodDefault<z.ZodString>;
|
|
773
|
+
beforeNode: z.ZodDefault<z.ZodString>;
|
|
774
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
775
|
+
when: z.ZodOptional<z.ZodUnknown>;
|
|
776
|
+
remove: z.ZodOptional<z.ZodBoolean>;
|
|
777
|
+
}, z.core.$strip>>>;
|
|
778
|
+
limits: z.ZodOptional<z.ZodObject<{
|
|
779
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
780
|
+
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
781
|
+
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
782
|
+
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
783
|
+
}, z.core.$strip>>;
|
|
784
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
785
|
+
type: z.ZodLiteral<"deleteAction">;
|
|
786
|
+
ref: z.ZodString;
|
|
653
787
|
}, z.core.$strip>], "type">>;
|
|
654
788
|
};
|
|
655
789
|
export declare const apply: (input: ApplyInput, space: Space, persisters?: Persisters) => Promise<WriteResponse>;
|
|
@@ -8,6 +8,7 @@ import { validateOperations } from "../shared/validator/index.js";
|
|
|
8
8
|
import { auditResources } from "../shared/validator/audit.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { validateSchema } from "@plitzi/sdk-schema/helpers/schemaValidator";
|
|
11
|
+
import { generateCache } from "@plitzi/sdk-style/StyleHelper";
|
|
11
12
|
//#region src/modules/mcp/tools/apply/index.ts
|
|
12
13
|
var applyShape = {
|
|
13
14
|
environment,
|
|
@@ -123,8 +124,10 @@ var apply = async (input, space, persisters) => {
|
|
|
123
124
|
else persisted = false;
|
|
124
125
|
}
|
|
125
126
|
if (outcome.changedStyle) {
|
|
126
|
-
if (persisters?.style)
|
|
127
|
-
|
|
127
|
+
if (persisters?.style) {
|
|
128
|
+
draft.style.cache = generateCache(draft.style);
|
|
129
|
+
await persisters.style(draft.style);
|
|
130
|
+
} else persisted = false;
|
|
128
131
|
}
|
|
129
132
|
for (const id of outcome.changedConnectors) {
|
|
130
133
|
const entry = draft.connectors.find((item) => item.id === id);
|
|
@@ -133,6 +136,13 @@ var apply = async (input, space, persisters) => {
|
|
|
133
136
|
}
|
|
134
137
|
for (const id of outcome.deletedConnectors) if (persisters?.deleteConnector) await persisters.deleteConnector(id);
|
|
135
138
|
else persisted = false;
|
|
139
|
+
for (const id of outcome.changedActions) {
|
|
140
|
+
const entry = draft.actions.find((item) => item.id === id);
|
|
141
|
+
if (entry && persisters?.saveAction) await persisters.saveAction(entry);
|
|
142
|
+
else persisted = false;
|
|
143
|
+
}
|
|
144
|
+
for (const id of outcome.deletedActions) if (persisters?.deleteAction) await persisters.deleteAction(id);
|
|
145
|
+
else persisted = false;
|
|
136
146
|
return {
|
|
137
147
|
applied: true,
|
|
138
148
|
persisted,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { OpResult, Space } from '../../../helpers';
|
|
3
|
+
import { Env } from '../../../types';
|
|
4
|
+
export declare const deleteActionOp: z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"deleteAction">;
|
|
6
|
+
ref: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
export type DeleteAction = z.infer<typeof deleteActionOp>;
|
|
9
|
+
export declare const deleteAction: (space: Space, env: Env, op: DeleteAction) => OpResult;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { findActionEntry } from "../../../helpers/space.js";
|
|
2
|
+
import { actionUri, actionsUri } from "../../../helpers/uris.js";
|
|
3
|
+
import { empty, fail } from "../../../helpers/opResult.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
//#region src/modules/mcp/tools/operations/actions/deleteAction.ts
|
|
6
|
+
var deleteActionOp = z.object({
|
|
7
|
+
type: z.literal("deleteAction"),
|
|
8
|
+
ref: z.string().describe("Identifier of the action to remove")
|
|
9
|
+
}).describe("Remove a server action. Destructive and not undoable: every step that runs it stops working, on published pages included, and a webhook pointing at it starts failing. Confirm with the user first.");
|
|
10
|
+
var deleteAction = (space, env, op) => {
|
|
11
|
+
if (!findActionEntry(space, op.ref)) return fail("ref", `Action "${op.ref}" does not exist`, `Read ${actionsUri(env)} for the actions this space has`, space.actions.map((item) => item.id));
|
|
12
|
+
space.actions = space.actions.filter((item) => item.id !== op.ref);
|
|
13
|
+
return {
|
|
14
|
+
...empty(),
|
|
15
|
+
deleted: 1,
|
|
16
|
+
staleResources: [actionsUri(env), actionUri(env, op.ref)]
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
//#endregion
|
|
20
|
+
export { deleteAction, deleteActionOp };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* The shared vocabulary of an action document, as the agent writes it.
|
|
4
|
+
*
|
|
5
|
+
* A mirror of `ActionDocument` rather than a looser bag: what the agent sends is what the server stores and the
|
|
6
|
+
* runner executes, so a field it cannot express is a field it cannot author. Every shape here is registered in
|
|
7
|
+
* schemaIds.ts — they appear in two ops each, and an inlined copy is paid for in every request of every
|
|
8
|
+
* conversation, so the prose is kept as short as it can be while still saying what a choice DOES.
|
|
9
|
+
*/
|
|
10
|
+
export declare const actionAccess: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
+
mode: z.ZodLiteral<"public">;
|
|
12
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
13
|
+
mode: z.ZodLiteral<"session">;
|
|
14
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
15
|
+
mode: z.ZodLiteral<"role">;
|
|
16
|
+
permissions: z.ZodArray<z.ZodString>;
|
|
17
|
+
}, z.core.$strip>], "mode">;
|
|
18
|
+
export declare const actionTriggerParams: z.ZodObject<{
|
|
19
|
+
access: z.ZodOptional<z.ZodEnum<{
|
|
20
|
+
public: "public";
|
|
21
|
+
session: "session";
|
|
22
|
+
role: "role";
|
|
23
|
+
}>>;
|
|
24
|
+
permissions: z.ZodOptional<z.ZodString>;
|
|
25
|
+
input: z.ZodOptional<z.ZodString>;
|
|
26
|
+
signatureCredential: z.ZodOptional<z.ZodString>;
|
|
27
|
+
signatureHeader: z.ZodOptional<z.ZodString>;
|
|
28
|
+
signatureAlgorithm: z.ZodOptional<z.ZodString>;
|
|
29
|
+
signatureSecretField: z.ZodOptional<z.ZodString>;
|
|
30
|
+
signatureTimestampHeader: z.ZodOptional<z.ZodString>;
|
|
31
|
+
signatureToleranceSeconds: z.ZodOptional<z.ZodString>;
|
|
32
|
+
cron: z.ZodOptional<z.ZodString>;
|
|
33
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
34
|
+
name: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export declare const actionField: z.ZodObject<{
|
|
37
|
+
type: z.ZodEnum<{
|
|
38
|
+
number: "number";
|
|
39
|
+
boolean: "boolean";
|
|
40
|
+
file: "file";
|
|
41
|
+
json: "json";
|
|
42
|
+
text: "text";
|
|
43
|
+
date: "date";
|
|
44
|
+
}>;
|
|
45
|
+
required: z.ZodOptional<z.ZodBoolean>;
|
|
46
|
+
defaultValue: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean]>>;
|
|
47
|
+
label: z.ZodOptional<z.ZodString>;
|
|
48
|
+
}, z.core.$strip>;
|
|
49
|
+
export declare const actionNode: z.ZodObject<{
|
|
50
|
+
id: z.ZodString;
|
|
51
|
+
title: z.ZodString;
|
|
52
|
+
type: z.ZodEnum<{
|
|
53
|
+
trigger: "trigger";
|
|
54
|
+
task: "task";
|
|
55
|
+
}>;
|
|
56
|
+
action: z.ZodString;
|
|
57
|
+
params: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
58
|
+
afterNode: z.ZodDefault<z.ZodString>;
|
|
59
|
+
beforeNode: z.ZodDefault<z.ZodString>;
|
|
60
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
61
|
+
when: z.ZodOptional<z.ZodUnknown>;
|
|
62
|
+
remove: z.ZodOptional<z.ZodBoolean>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
|
+
export declare const actionLimits: z.ZodObject<{
|
|
65
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
68
|
+
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
69
|
+
}, z.core.$strip>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
//#region src/modules/mcp/tools/operations/actions/document.ts
|
|
3
|
+
/**
|
|
4
|
+
* The shared vocabulary of an action document, as the agent writes it.
|
|
5
|
+
*
|
|
6
|
+
* A mirror of `ActionDocument` rather than a looser bag: what the agent sends is what the server stores and the
|
|
7
|
+
* runner executes, so a field it cannot express is a field it cannot author. Every shape here is registered in
|
|
8
|
+
* schemaIds.ts — they appear in two ops each, and an inlined copy is paid for in every request of every
|
|
9
|
+
* conversation, so the prose is kept as short as it can be while still saying what a choice DOES.
|
|
10
|
+
*/
|
|
11
|
+
var actionAccess = z.discriminatedUnion("mode", [
|
|
12
|
+
z.object({ mode: z.literal("public") }).describe("Anyone, signed out included. What a webhook needs"),
|
|
13
|
+
z.object({ mode: z.literal("session") }).describe("Any visitor with a session"),
|
|
14
|
+
z.object({
|
|
15
|
+
mode: z.literal("role"),
|
|
16
|
+
permissions: z.array(z.string()).min(1)
|
|
17
|
+
}).describe("Holding all of these")
|
|
18
|
+
]).describe("Who may start a run through THIS way in. No default: an unstated rule is a lock-out or a hole");
|
|
19
|
+
var actionTriggerParams = z.object({
|
|
20
|
+
access: z.enum([
|
|
21
|
+
"public",
|
|
22
|
+
"session",
|
|
23
|
+
"role"
|
|
24
|
+
]).optional().describe("Who may start a run THIS way. Required for every kind but schedule, which has no caller"),
|
|
25
|
+
permissions: z.string().optional().describe("Comma separated; only for access \"role\""),
|
|
26
|
+
input: z.string().optional().describe("JSON map of ActionField by name: what a caller may send this way. Undeclared keys are DROPPED"),
|
|
27
|
+
signatureCredential: z.string().optional().describe("webhook only: the credential holding the signing secret. NAMING it is what turns verification on; without it anyone who learns the URL can start a run"),
|
|
28
|
+
signatureHeader: z.string().optional().describe("webhook: defaults to x-signature"),
|
|
29
|
+
signatureAlgorithm: z.string().optional().describe("webhook: sha256 (default) or sha1"),
|
|
30
|
+
signatureSecretField: z.string().optional().describe("webhook: key of the credential; defaults to secret"),
|
|
31
|
+
signatureTimestampHeader: z.string().optional().describe("webhook: for a sender that signs <timestamp>.<body>"),
|
|
32
|
+
signatureToleranceSeconds: z.string().optional().describe("webhook: needs the timestamp header to mean anything"),
|
|
33
|
+
cron: z.string().optional().describe("schedule only: minute hour day-of-month month day-of-week, UTC"),
|
|
34
|
+
timezone: z.string().optional(),
|
|
35
|
+
name: z.string().optional().describe("custom only: the name the deployment mounts it under")
|
|
36
|
+
}).describe("What a TRIGGER step carries. Flat and stringy, as every step param is");
|
|
37
|
+
var actionField = z.object({
|
|
38
|
+
type: z.enum([
|
|
39
|
+
"text",
|
|
40
|
+
"number",
|
|
41
|
+
"boolean",
|
|
42
|
+
"date",
|
|
43
|
+
"json",
|
|
44
|
+
"file"
|
|
45
|
+
]),
|
|
46
|
+
required: z.boolean().optional(),
|
|
47
|
+
defaultValue: z.union([
|
|
48
|
+
z.string(),
|
|
49
|
+
z.number(),
|
|
50
|
+
z.boolean()
|
|
51
|
+
]).optional(),
|
|
52
|
+
label: z.string().optional()
|
|
53
|
+
}).describe("One typed value");
|
|
54
|
+
var actionNode = z.object({
|
|
55
|
+
id: z.string(),
|
|
56
|
+
title: z.string(),
|
|
57
|
+
type: z.enum(["trigger", "task"]).describe("A trigger heads a chain; the rest are tasks"),
|
|
58
|
+
action: z.string().describe("A trigger names its KIND — call | webhook | schedule | render | custom — and one action may have several, one per kind, each heading its own chain. A task names \"<namespace>.<action>\" from plitzi://actions/{env}/tasks. A browser step (setState, navigate) cannot run here"),
|
|
59
|
+
params: z.record(z.string(), z.unknown()).default({}).describe("A task: that task's params. A trigger: ActionTriggerParams — access, input, signature*, cron"),
|
|
60
|
+
afterNode: z.string().default("").describe("Id of the next step; empty ends the chain"),
|
|
61
|
+
beforeNode: z.string().default(""),
|
|
62
|
+
enabled: z.boolean().default(true).describe("On a trigger: whether that way in is open. No trigger open, no run"),
|
|
63
|
+
when: z.unknown().optional().describe("Rule group; the step is skipped when it does not match"),
|
|
64
|
+
remove: z.boolean().optional().describe("patchAction only: drop this step")
|
|
65
|
+
}).describe("One step of the flow");
|
|
66
|
+
var actionLimits = z.object({
|
|
67
|
+
timeoutMs: z.number().optional(),
|
|
68
|
+
streamTimeoutMs: z.number().optional(),
|
|
69
|
+
maxNodes: z.number().optional(),
|
|
70
|
+
maxRequests: z.number().optional()
|
|
71
|
+
}).describe("Ceilings for one run; may only TIGHTEN what the deployment allows");
|
|
72
|
+
//#endregion
|
|
73
|
+
export { actionAccess, actionField, actionLimits, actionNode, actionTriggerParams };
|