@plitzi/sdk-mcp 0.39.1 → 0.39.3
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 +27 -0
- package/README.md +5 -1
- package/dist/createServer.d.ts +3 -2
- package/dist/createServer.js +3 -13
- package/dist/index.js +8 -8
- package/dist/modules/mcp/accessibilityOutline.js +1 -2
- package/dist/modules/mcp/apps/index.js +3 -4
- package/dist/modules/mcp/apps/render/index.js +3 -7
- package/dist/modules/mcp/apps/render/styles.js +2 -3
- package/dist/modules/mcp/apps/shared/assets.d.ts +6 -0
- package/dist/modules/mcp/apps/shared/assets.js +15 -4
- package/dist/modules/mcp/apps/shared/bundle.js +3 -4
- package/dist/modules/mcp/apps/shared/index.d.ts +1 -1
- package/dist/modules/mcp/apps/shared/page.js +3 -5
- package/dist/modules/mcp/apps/shared/registerApp.js +1 -2
- package/dist/modules/mcp/apps/shared/resolve.js +1 -2
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +1 -2
- package/dist/modules/mcp/catalogs/observed.js +1 -2
- package/dist/modules/mcp/catalogs/pluginCatalog.d.ts +1 -1
- package/dist/modules/mcp/catalogs/pluginCatalog.js +1 -2
- package/dist/modules/mcp/catalogs/registry.d.ts +2 -1
- package/dist/modules/mcp/catalogs/registry.js +1 -2
- package/dist/modules/mcp/handler.d.ts +1 -1
- package/dist/modules/mcp/handler.js +1 -2
- package/dist/modules/mcp/helpers/callToolResult.js +1 -2
- package/dist/modules/mcp/helpers/components.js +1 -2
- package/dist/modules/mcp/helpers/computeVersion.js +1 -2
- package/dist/modules/mcp/helpers/guide/index.js +1 -2
- package/dist/modules/mcp/helpers/guide/instructions.js +1 -2
- package/dist/modules/mcp/helpers/guide/logic.js +1 -2
- package/dist/modules/mcp/helpers/guide/practice.js +4 -4
- package/dist/modules/mcp/helpers/guide/reference.js +1 -2
- package/dist/modules/mcp/helpers/guide/server.d.ts +1 -1
- package/dist/modules/mcp/helpers/guide/server.js +3 -4
- package/dist/modules/mcp/helpers/guide/structure.js +1 -2
- package/dist/modules/mcp/helpers/guide/styling.js +1 -2
- package/dist/modules/mcp/helpers/guide/values.js +1 -2
- package/dist/modules/mcp/helpers/interactions.js +1 -2
- package/dist/modules/mcp/helpers/log.d.ts +1 -1
- package/dist/modules/mcp/helpers/log.js +2 -3
- package/dist/modules/mcp/helpers/opResult.js +1 -2
- package/dist/modules/mcp/helpers/space.d.ts +2 -1
- package/dist/modules/mcp/helpers/space.js +1 -2
- package/dist/modules/mcp/helpers/uris.js +1 -2
- package/dist/modules/mcp/localScreenshotClient.js +9 -6
- package/dist/modules/mcp/previewClient.js +1 -2
- package/dist/modules/mcp/proxy/config.d.ts +1 -1
- package/dist/modules/mcp/proxy/config.js +2 -3
- package/dist/modules/mcp/proxy/fetch.js +1 -2
- package/dist/modules/mcp/proxy/grant.js +1 -2
- package/dist/modules/mcp/proxy/guard.js +2 -3
- package/dist/modules/mcp/proxy/handler.d.ts +1 -1
- package/dist/modules/mcp/proxy/handler.js +2 -3
- package/dist/modules/mcp/proxy/payload.js +1 -2
- package/dist/modules/mcp/proxy/rewrite.js +1 -2
- package/dist/modules/mcp/proxy/sign.js +1 -2
- package/dist/modules/mcp/proxy/types.js +1 -2
- package/dist/modules/mcp/resources/actions.js +2 -3
- package/dist/modules/mcp/resources/canonical.js +1 -2
- package/dist/modules/mcp/resources/connectors.js +2 -3
- package/dist/modules/mcp/resources/core.js +4 -5
- package/dist/modules/mcp/resources/data.js +1 -2
- package/dist/modules/mcp/resources/envelope.js +1 -2
- package/dist/modules/mcp/resources/explain.js +1 -2
- package/dist/modules/mcp/resources/functions.js +1 -2
- package/dist/modules/mcp/resources/primer.js +7 -8
- package/dist/modules/mcp/resources/register.d.ts +1 -1
- package/dist/modules/mcp/resources/register.js +6 -7
- package/dist/modules/mcp/resources/renderGuide.js +2 -3
- package/dist/modules/mcp/resources/router.js +3 -4
- package/dist/modules/mcp/resources/schema.js +3 -4
- package/dist/modules/mcp/resources/style.js +2 -3
- package/dist/modules/mcp/screenshotClient.js +6 -5
- package/dist/modules/mcp/server.d.ts +1 -1
- package/dist/modules/mcp/server.js +4 -5
- package/dist/modules/mcp/tools/activity.js +1 -2
- package/dist/modules/mcp/tools/apply/dispatch.js +4 -5
- package/dist/modules/mcp/tools/apply/index.d.ts +4 -0
- package/dist/modules/mcp/tools/apply/index.js +3 -4
- package/dist/modules/mcp/tools/apply/writeResult.js +1 -2
- package/dist/modules/mcp/tools/describeOperation.js +2 -3
- package/dist/modules/mcp/tools/index.js +1 -2
- package/dist/modules/mcp/tools/intents.js +3 -4
- package/dist/modules/mcp/tools/look.js +2 -3
- package/dist/modules/mcp/tools/operations/actions/deleteAction.js +2 -3
- package/dist/modules/mcp/tools/operations/actions/document.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/actions/document.js +4 -3
- package/dist/modules/mcp/tools/operations/actions/index.d.ts +4 -0
- package/dist/modules/mcp/tools/operations/actions/index.js +1 -2
- package/dist/modules/mcp/tools/operations/actions/patchAction.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/actions/patchAction.js +3 -4
- package/dist/modules/mcp/tools/operations/actions/upsertAction.d.ts +2 -0
- package/dist/modules/mcp/tools/operations/actions/upsertAction.js +3 -4
- package/dist/modules/mcp/tools/operations/closed.js +1 -2
- package/dist/modules/mcp/tools/operations/connectors/deleteConnector.js +2 -3
- package/dist/modules/mcp/tools/operations/connectors/index.js +1 -2
- package/dist/modules/mcp/tools/operations/connectors/manifest.js +1 -2
- package/dist/modules/mcp/tools/operations/connectors/patchConnector.js +3 -4
- package/dist/modules/mcp/tools/operations/connectors/upsertConnector.js +3 -4
- package/dist/modules/mcp/tools/operations/data/index.js +1 -2
- package/dist/modules/mcp/tools/operations/functions/index.js +2 -3
- package/dist/modules/mcp/tools/operations/index.d.ts +8 -0
- package/dist/modules/mcp/tools/operations/index.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/components/deleteComponent.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/components/upsertComponent.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/flags/deleteFlag.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/flags/upsertFlag.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/operations.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/pages/deleteLayout.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/pages/upsertLayout.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +3 -4
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/shared.js +1 -2
- package/dist/modules/mcp/tools/operations/schema/translator.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/schema/write.js +3 -4
- package/dist/modules/mcp/tools/operations/schemaIds.js +1 -2
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +1 -2
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +2 -3
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +1 -2
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +1 -2
- package/dist/modules/mcp/tools/operations/style/fonts/deleteFont.js +2 -3
- package/dist/modules/mcp/tools/operations/style/fonts/upsertFont.js +2 -3
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +2 -3
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +2 -3
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +1 -2
- package/dist/modules/mcp/tools/operations/style/operations.js +1 -2
- package/dist/modules/mcp/tools/operations/style/shared.js +1 -2
- package/dist/modules/mcp/tools/operations/style/translator.js +1 -2
- package/dist/modules/mcp/tools/operations/style/validate.js +1 -2
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +2 -3
- package/dist/modules/mcp/tools/operations/style/write.js +2 -3
- package/dist/modules/mcp/tools/read.js +2 -3
- package/dist/modules/mcp/tools/render.js +3 -4
- package/dist/modules/mcp/tools/renderWidget.js +2 -3
- package/dist/modules/mcp/tools/search.js +2 -3
- package/dist/modules/mcp/tools/shared/draftBatch.js +2 -3
- package/dist/modules/mcp/tools/shared/effects.js +1 -2
- package/dist/modules/mcp/tools/shared/expandOperations.js +1 -2
- package/dist/modules/mcp/tools/shared/interactionReport.js +1 -2
- package/dist/modules/mcp/tools/shared/lintDraft.js +1 -2
- package/dist/modules/mcp/tools/shared/look.js +1 -2
- package/dist/modules/mcp/tools/shared/newSuggestions.js +1 -2
- package/dist/modules/mcp/tools/shared/normalizeOperations.js +1 -2
- package/dist/modules/mcp/tools/shared/repeats.js +1 -2
- package/dist/modules/mcp/tools/shared/tool.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/batch.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/bindings.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/connectors.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/context.js +1 -2
- package/dist/modules/mcp/tools/shared/validator/css.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/elements.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/index.js +8 -9
- package/dist/modules/mcp/tools/shared/validator/interactions.js +2 -3
- package/dist/modules/mcp/tools/shared/validator/refs.js +1 -2
- package/dist/modules/mcp/tools/test.js +1 -2
- package/dist/modules/mcp/tools/tryFunction.js +1 -2
- package/dist/modules/mcp/types/screenshotTypes.d.ts +8 -0
- package/dist/options.d.ts +1 -1
- package/dist/pipeline.d.ts +2 -1
- package/dist/pipeline.js +4 -3
- package/dist/preview/createPreview.d.ts +1 -1
- package/dist/preview/createPreview.js +1 -2
- package/dist/preview.d.ts +7 -0
- package/dist/preview.js +1 -0
- package/dist/render.js +1 -1
- package/dist/server.js +3 -3
- package/dist/stages/mcp.d.ts +1 -1
- package/dist/stages/mcp.js +2 -3
- package/dist/stages/preview.d.ts +2 -1
- package/dist/stages/preview.js +3 -4
- package/dist/stages/proxy.d.ts +1 -1
- package/dist/stages/proxy.js +2 -3
- package/package.json +23 -16
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { findRootByRef, indexAddElement, resolveRef } from "../../../helpers/space.js";
|
|
2
|
-
import { folderUri, foldersUri, layoutsUri, pageUri, pagesUri, schemaVarsUri, settingsUri } from "../../../helpers/uris.js";
|
|
3
1
|
import { fail } from "../../../helpers/opResult.js";
|
|
2
|
+
import { folderUri, foldersUri, layoutsUri, pageUri, pagesUri, schemaVarsUri, settingsUri } from "../../../helpers/uris.js";
|
|
3
|
+
import { findRootByRef, indexAddElement, resolveRef } from "../../../helpers/space.js";
|
|
4
4
|
import { FlatMap, documentIds, elementIdConflict, isValidElementId } from "@plitzi/sdk-schema";
|
|
5
5
|
import { flagGateOf } from "@plitzi/sdk-authoring";
|
|
6
6
|
import { isMotion } from "@plitzi/sdk-shared/schema";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/schema/write.ts
|
|
8
8
|
var ID_REF_HINT = "Start with a letter, then letters, numbers, hyphens and underscores (e.g. \"hero-cta\" or \"food_item\"). The name IS the element id, which the runtime embeds in source names like `apiContainer_<id>.field` and in interaction targets — a dot would split those paths (an underscore is fine: the FIRST `_` separates the type from the id, and element types carry none, so extra underscores are unambiguous).";
|
|
9
9
|
var TAKEN_HINT = "A name must be unique across the space — pick a different one, or address the existing element by this name.";
|
|
10
10
|
/** Every name in an element input tree (the element plus its nested children) — each becomes an element's id. */
|
|
@@ -94,5 +94,4 @@ var resolveElement = (space, env, pageRef, ref) => {
|
|
|
94
94
|
if (!el || el.id === page.id) return { error: fail("ref", `Element "${ref}" not found in page "${pageRef}"`, "Name an element this page holds") };
|
|
95
95
|
return { el };
|
|
96
96
|
};
|
|
97
|
-
//#endregion
|
|
98
97
|
export { DROP_POSITION, ID_REF_HINT, collectInputRefs, createElement, folderUri, foldersUri, guardNewRef, layoutsUri, pageUri, pagesUri, resolveElement, resolveTargetRef, schemaVarsUri, settingsUri, writeInitialState };
|
|
@@ -3,7 +3,7 @@ import { connectorConnection, readEndpoint, writeEndpoint } from "./connectors/m
|
|
|
3
3
|
import { bindingInput, elementAnchor, elementFlag, elementInput, elementMotion, elementQuiet, initialStateInput, interactionNode, position, ruleGroup, styleRefs, styleVariantInput } from "./schema/shared.js";
|
|
4
4
|
import { ancestors, ancestorsPatch, conditions, conditionsPatch, cssMap, cssPatchMap, definitionSlot, definitionSlotPatch, displayModeCss, displayModeCssPatch, pseudos, pseudosPatch, themeValue, variantPart, variantPartPatch } from "./style/shared.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
6
|
+
// src/modules/mcp/tools/operations/schemaIds.ts
|
|
7
7
|
/** The op union is the tool input of plitzi_apply (and of plitzi_render where apply is not listed), and every host
|
|
8
8
|
* reads it as JSON Schema on tools/list — on EVERY request of every conversation the server is connected to. It
|
|
9
9
|
* measured ~25k tokens a copy, which dwarfs anything a widget payload ever costs; one copy per connection is what
|
|
@@ -71,5 +71,4 @@ var claimSchemaId = (schema, id) => {
|
|
|
71
71
|
var registerSharedSchemaIds = () => {
|
|
72
72
|
for (const [schema, id] of SHARED_SCHEMAS) if (z.globalRegistry.get(schema)?.id === void 0) claimSchemaId(schema, id);
|
|
73
73
|
};
|
|
74
|
-
//#endregion
|
|
75
74
|
export { claimSchemaId, registerSharedSchemaIds };
|
|
@@ -2,7 +2,7 @@ import { defUri, defsUri } from "../../../../helpers/uris.js";
|
|
|
2
2
|
import { empty } from "../../../../helpers/opResult.js";
|
|
3
3
|
import { MODES, guardKind } from "../write.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/style/definitions/deleteDefinition.ts
|
|
6
6
|
var deleteDefinitionOp = z.object({
|
|
7
7
|
type: z.literal("deleteDefinition"),
|
|
8
8
|
ref: z.string().describe("Class ref of the definition to delete")
|
|
@@ -17,5 +17,4 @@ var deleteDefinition = (space, env, op) => {
|
|
|
17
17
|
staleResources: [defUri(env, op.ref), defsUri(env)]
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { deleteDefinition, deleteDefinitionOp };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defUri, defsUri } from "../../../../helpers/uris.js";
|
|
2
2
|
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { definitionToAI } from "../translator.js";
|
|
4
3
|
import { patchCssShape } from "../shared.js";
|
|
4
|
+
import { definitionToAI } from "../translator.js";
|
|
5
5
|
import { guardKind, mergePatch, writeStyleItem } from "../write.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/style/definitions/patchDefinition.ts
|
|
8
8
|
var patchDefinitionOp = z.object({
|
|
9
9
|
type: z.literal("patchDefinition"),
|
|
10
10
|
ref: z.string().describe("Existing class ref to patch"),
|
|
@@ -25,5 +25,4 @@ var patchDefinition = (space, env, op) => {
|
|
|
25
25
|
staleResources: [defUri(env, ref), defsUri(env)]
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { patchDefinition, patchDefinitionOp };
|
|
@@ -3,7 +3,7 @@ import { empty } from "../../../../helpers/opResult.js";
|
|
|
3
3
|
import { upsertCssShape } from "../shared.js";
|
|
4
4
|
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
6
|
+
// src/modules/mcp/tools/operations/style/definitions/upsertDefinition.ts
|
|
7
7
|
var upsertDefinitionOp = z.object({
|
|
8
8
|
type: z.literal("upsertDefinition"),
|
|
9
9
|
ref: z.string().describe("Class name you choose (kebab-case), or an existing class ref to fully replace"),
|
|
@@ -21,5 +21,4 @@ var upsertDefinition = (space, env, op) => {
|
|
|
21
21
|
staleResources: [defUri(env, ref), defsUri(env)]
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { upsertDefinition, upsertDefinitionOp };
|
|
@@ -3,7 +3,7 @@ import { empty } from "../../../../helpers/opResult.js";
|
|
|
3
3
|
import { upsertCssShape } from "../shared.js";
|
|
4
4
|
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
6
|
+
// src/modules/mcp/tools/operations/style/definitions/upsertDefinitions.ts
|
|
7
7
|
var definitionBody = z.object(upsertCssShape);
|
|
8
8
|
var upsertDefinitionsOp = z.object({
|
|
9
9
|
type: z.literal("upsertDefinitions"),
|
|
@@ -43,5 +43,4 @@ var upsertDefinitions = (space, env, op) => {
|
|
|
43
43
|
errors
|
|
44
44
|
} : result;
|
|
45
45
|
};
|
|
46
|
-
//#endregion
|
|
47
46
|
export { upsertDefinitions, upsertDefinitionsOp };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { fontUri, fontsUri } from "../../../../helpers/uris.js";
|
|
2
1
|
import { empty } from "../../../../helpers/opResult.js";
|
|
2
|
+
import { fontUri, fontsUri } from "../../../../helpers/uris.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/operations/style/fonts/deleteFont.ts
|
|
5
5
|
var deleteFontOp = z.object({
|
|
6
6
|
type: z.literal("deleteFont"),
|
|
7
7
|
family: z.string()
|
|
@@ -17,5 +17,4 @@ var deleteFont = (space, env, op) => {
|
|
|
17
17
|
staleResources: [fontUri(env, op.family), fontsUri(env)]
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { deleteFont, deleteFontOp };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { fontUri, fontsUri } from "../../../../helpers/uris.js";
|
|
2
1
|
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
2
|
+
import { fontUri, fontsUri } from "../../../../helpers/uris.js";
|
|
3
3
|
import { FontValidationError, parseSpaceFont } from "@plitzi/sdk-shared/style";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/style/fonts/upsertFont.ts
|
|
6
6
|
/**
|
|
7
7
|
* What an AGENT can say about a font, which is less than a manifest entry can hold.
|
|
8
8
|
*
|
|
@@ -62,5 +62,4 @@ var upsertFont = (space, env, op) => {
|
|
|
62
62
|
staleResources: [fontUri(env, font.family), fontsUri(env)]
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
|
-
//#endregion
|
|
66
65
|
export { upsertFont, upsertFontOp };
|
|
@@ -2,7 +2,7 @@ import { globalUri, globalsUri } from "../../../../helpers/uris.js";
|
|
|
2
2
|
import { empty } from "../../../../helpers/opResult.js";
|
|
3
3
|
import { MODES, guardKind } from "../write.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.ts
|
|
6
6
|
var deleteGlobalStyleOp = z.object({
|
|
7
7
|
type: z.literal("deleteGlobalStyle"),
|
|
8
8
|
componentType: z.string().describe("Element type whose site-wide style to remove")
|
|
@@ -17,5 +17,4 @@ var deleteGlobalStyle = (space, env, op) => {
|
|
|
17
17
|
staleResources: [globalUri(env, op.componentType), globalsUri(env)]
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { deleteGlobalStyle, deleteGlobalStyleOp };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { globalUri, globalsUri } from "../../../../helpers/uris.js";
|
|
2
2
|
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { globalStyleToAI } from "../translator.js";
|
|
4
3
|
import { patchCssShape } from "../shared.js";
|
|
4
|
+
import { globalStyleToAI } from "../translator.js";
|
|
5
5
|
import { guardKind, mergePatch, writeStyleItem } from "../write.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.ts
|
|
8
8
|
var patchGlobalStyleOp = z.object({
|
|
9
9
|
type: z.literal("patchGlobalStyle"),
|
|
10
10
|
componentType: z.string().describe("Element type whose global style to merge into; affects ALL of that type"),
|
|
@@ -25,5 +25,4 @@ var patchGlobalStyle = (space, env, op) => {
|
|
|
25
25
|
staleResources: [globalUri(env, componentType), globalsUri(env)]
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { patchGlobalStyle, patchGlobalStyleOp };
|
|
@@ -3,7 +3,7 @@ import { empty } from "../../../../helpers/opResult.js";
|
|
|
3
3
|
import { upsertCssShape } from "../shared.js";
|
|
4
4
|
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
6
|
+
// src/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.ts
|
|
7
7
|
var upsertGlobalStyleOp = z.object({
|
|
8
8
|
type: z.literal("upsertGlobalStyle"),
|
|
9
9
|
componentType: z.string().describe("Element type to style site-wide (e.g. \"button\"); affects ALL of that type"),
|
|
@@ -21,5 +21,4 @@ var upsertGlobalStyle = (space, env, op) => {
|
|
|
21
21
|
staleResources: [globalUri(env, componentType), globalsUri(env)]
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { upsertGlobalStyle, upsertGlobalStyleOp };
|
|
@@ -2,7 +2,7 @@ import { idUri, idsUri } from "../../../../helpers/uris.js";
|
|
|
2
2
|
import { empty } from "../../../../helpers/opResult.js";
|
|
3
3
|
import { MODES, guardKind } from "../write.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.ts
|
|
6
6
|
var deleteIdStyleOp = z.object({
|
|
7
7
|
type: z.literal("deleteIdStyle"),
|
|
8
8
|
targetId: z.string().describe("DOM id whose id rule to remove (without the # prefix)")
|
|
@@ -17,5 +17,4 @@ var deleteIdStyle = (space, env, op) => {
|
|
|
17
17
|
staleResources: [idUri(env, op.targetId), idsUri(env)]
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { deleteIdStyle, deleteIdStyleOp };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { idUri, idsUri } from "../../../../helpers/uris.js";
|
|
2
2
|
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { idStyleToAI } from "../translator.js";
|
|
4
3
|
import { patchCssShape } from "../shared.js";
|
|
4
|
+
import { idStyleToAI } from "../translator.js";
|
|
5
5
|
import { guardKind, mergePatch, writeStyleItem } from "../write.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/style/idStyles/patchIdStyle.ts
|
|
8
8
|
var patchIdStyleOp = z.object({
|
|
9
9
|
type: z.literal("patchIdStyle"),
|
|
10
10
|
targetId: z.string().describe("DOM id whose id rule to merge into (without the # prefix)"),
|
|
@@ -25,5 +25,4 @@ var patchIdStyle = (space, env, op) => {
|
|
|
25
25
|
staleResources: [idUri(env, targetId), idsUri(env)]
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { patchIdStyle, patchIdStyleOp };
|
|
@@ -3,7 +3,7 @@ import { empty } from "../../../../helpers/opResult.js";
|
|
|
3
3
|
import { upsertCssShape } from "../shared.js";
|
|
4
4
|
import { guardKind, writeStyleItem } from "../write.js";
|
|
5
5
|
import { z } from "zod";
|
|
6
|
-
|
|
6
|
+
// src/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.ts
|
|
7
7
|
var upsertIdStyleOp = z.object({
|
|
8
8
|
type: z.literal("upsertIdStyle"),
|
|
9
9
|
targetId: z.string().describe("DOM id of the element to style (without the # prefix); matches its `id` attribute"),
|
|
@@ -21,5 +21,4 @@ var upsertIdStyle = (space, env, op) => {
|
|
|
21
21
|
staleResources: [idUri(env, targetId), idsUri(env)]
|
|
22
22
|
};
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { upsertIdStyle, upsertIdStyleOp };
|
|
@@ -12,7 +12,7 @@ import { patchIdStyleOp } from "./idStyles/patchIdStyle.js";
|
|
|
12
12
|
import { upsertIdStyleOp } from "./idStyles/upsertIdStyle.js";
|
|
13
13
|
import { deleteStyleVariableOp } from "./variables/deleteStyleVariable.js";
|
|
14
14
|
import { upsertStyleVariableOp } from "./variables/upsertStyleVariable.js";
|
|
15
|
-
|
|
15
|
+
// src/modules/mcp/tools/operations/style/operations.ts
|
|
16
16
|
var styleOps = {
|
|
17
17
|
upsertDefinition: upsertDefinitionOp,
|
|
18
18
|
upsertDefinitions: upsertDefinitionsOp,
|
|
@@ -29,5 +29,4 @@ var styleOps = {
|
|
|
29
29
|
upsertFont: upsertFontOp,
|
|
30
30
|
deleteFont: deleteFontOp
|
|
31
31
|
};
|
|
32
|
-
//#endregion
|
|
33
32
|
export { styleOps };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/operations/style/shared.ts
|
|
3
3
|
var cssMap = z.record(z.string(), z.union([z.string(), z.number()])).describe("Plain kebab-case CSS. Shorthands are welcome — `border: 1px solid red`, `padding: 8px 16px`, `font: bold 16px/1.5 Arial`, `transition: opacity 200ms ease` — and are stored as their longhands so a breakpoint/state/variant can override each property on its own. Use var(--name) for style tokens and {{name}} for schema vars.");
|
|
4
4
|
var displayModeCss = z.object({
|
|
5
5
|
desktop: cssMap.optional(),
|
|
@@ -88,5 +88,4 @@ var patchCssShape = {
|
|
|
88
88
|
conditions: conditionsPatch.optional(),
|
|
89
89
|
slots: z.record(z.string(), definitionSlotPatch).optional()
|
|
90
90
|
};
|
|
91
|
-
//#endregion
|
|
92
91
|
export { ancestorCondition, ancestorConditionPatch, ancestors, ancestorsPatch, conditions, conditionsPatch, cssMap, cssPatchMap, definitionSlot, definitionSlotPatch, displayModeCss, displayModeCssPatch, patchCssShape, pseudoPart, pseudoPartPatch, pseudos, pseudosPatch, styleCategory, themeValue, upsertCssShape, variantPart, variantPartPatch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SYSTEM_FONTS, familiesInCss } from "@plitzi/sdk-shared/style";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/operations/style/translator.ts
|
|
3
3
|
var DISPLAY_MODES = [
|
|
4
4
|
"desktop",
|
|
5
5
|
"tablet",
|
|
@@ -143,5 +143,4 @@ var fontsToAI = (style) => {
|
|
|
143
143
|
namedButNotDeclared: familiesInCss(style.cache).filter((family) => !known.has(family.toLowerCase()))
|
|
144
144
|
};
|
|
145
145
|
};
|
|
146
|
-
//#endregion
|
|
147
146
|
export { definitionRefs, definitionToAI, definitionVariantNames, fontsToAI, globalStyleToAI, globalStyleTypes, globalStylesForType, idStyleIds, idStyleToAI, isClassDefinition, styleVariablesToAI };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { expandShorthand } from "../../../catalogs/index.js";
|
|
2
2
|
import { fail } from "../../../helpers/opResult.js";
|
|
3
3
|
import { CONTENT_PSEUDOS, GENERATED_PSEUDOS, PSEUDO_PROPERTIES, STYLE_MOTION_CONDITIONS, STYLE_PSEUDOS, canonicalCondition, isContentValue, isStylePseudo, pseudoHonours } from "@plitzi/sdk-shared/style";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/operations/style/validate.ts
|
|
5
5
|
var MODES = [
|
|
6
6
|
"desktop",
|
|
7
7
|
"tablet",
|
|
@@ -58,5 +58,4 @@ var styleInputProblem = (base, slots) => {
|
|
|
58
58
|
}
|
|
59
59
|
return null;
|
|
60
60
|
};
|
|
61
|
-
//#endregion
|
|
62
61
|
export { styleInputProblem };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { styleVarUri, styleVarsUri } from "../../../../helpers/uris.js";
|
|
2
1
|
import { empty } from "../../../../helpers/opResult.js";
|
|
3
2
|
import { styleCategory } from "../shared.js";
|
|
3
|
+
import { styleVarUri, styleVarsUri } from "../../../../helpers/uris.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/style/variables/deleteStyleVariable.ts
|
|
6
6
|
var deleteStyleVariableOp = z.object({
|
|
7
7
|
type: z.literal("deleteStyleVariable"),
|
|
8
8
|
category: styleCategory,
|
|
@@ -17,5 +17,4 @@ var deleteStyleVariable = (space, env, op) => {
|
|
|
17
17
|
staleResources: [styleVarUri(env, op.category), styleVarsUri(env)]
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
//#endregion
|
|
21
20
|
export { deleteStyleVariable, deleteStyleVariableOp };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { styleVarUri, styleVarsUri } from "../../../../helpers/uris.js";
|
|
2
1
|
import { empty } from "../../../../helpers/opResult.js";
|
|
3
2
|
import { styleCategory, themeValue } from "../shared.js";
|
|
3
|
+
import { styleVarUri, styleVarsUri } from "../../../../helpers/uris.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/style/variables/upsertStyleVariable.ts
|
|
6
6
|
var upsertStyleVariableOp = z.object({
|
|
7
7
|
type: z.literal("upsertStyleVariable"),
|
|
8
8
|
category: styleCategory,
|
|
@@ -18,5 +18,4 @@ var upsertStyleVariable = (space, env, op) => {
|
|
|
18
18
|
staleResources: [styleVarUri(env, op.category), styleVarsUri(env)]
|
|
19
19
|
};
|
|
20
20
|
};
|
|
21
|
-
//#endregion
|
|
22
21
|
export { upsertStyleVariable, upsertStyleVariableOp };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { defUri, defsUri, globalUri, globalsUri, idUri, idsUri, styleVarUri, styleVarsUri } from "../../../helpers/uris.js";
|
|
2
|
+
import { styleInputProblem } from "./validate.js";
|
|
2
3
|
import { expandShorthand, expandShorthandPatch } from "../../../catalogs/index.js";
|
|
3
4
|
import { fail } from "../../../helpers/opResult.js";
|
|
4
|
-
import { styleInputProblem } from "./validate.js";
|
|
5
5
|
import { canonicalCondition, isStylePseudo } from "@plitzi/sdk-shared/style";
|
|
6
6
|
import { processSelector } from "@plitzi/sdk-style/helpers";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/style/write.ts
|
|
8
8
|
var MODES = [
|
|
9
9
|
"desktop",
|
|
10
10
|
"tablet",
|
|
@@ -216,5 +216,4 @@ var mergePatch = (existing, basePatch, slotsPatch) => {
|
|
|
216
216
|
slots: Object.keys(slots).length > 0 ? slots : void 0
|
|
217
217
|
};
|
|
218
218
|
};
|
|
219
|
-
//#endregion
|
|
220
219
|
export { MODES, defUri, defsUri, globalUri, globalsUri, guardKind, idUri, idsUri, mergePatch, styleVarUri, styleVarsUri, writeStyleItem };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { noSpaceErrorCode, unauthorizedSpaceMessage } from "../helpers/space.js";
|
|
2
|
-
import { resourceErrorMessage } from "../resources/canonical.js";
|
|
3
2
|
import { RENDER_GUIDE_URI, RENDER_TYPES_URI } from "../resources/renderGuide.js";
|
|
4
3
|
import { readPublicResource, readResource } from "../resources/router.js";
|
|
4
|
+
import { resourceErrorMessage } from "../resources/canonical.js";
|
|
5
5
|
import { defineTool } from "./shared/tool.js";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/read.ts
|
|
8
8
|
var readShape = { uris: z.array(z.string()).min(1).max(50).describe("Resource URIs to read in one batch (max 50). Use the ready-made uris from search / write responses.") };
|
|
9
9
|
var read = (input, space, env) => {
|
|
10
10
|
return { results: input.uris.map((uri) => {
|
|
@@ -47,5 +47,4 @@ var readTool = defineTool({
|
|
|
47
47
|
run: (input, ctx) => read(input, ctx.space, ctx.env),
|
|
48
48
|
runPublic: readPublic
|
|
49
49
|
});
|
|
50
|
-
//#endregion
|
|
51
50
|
export { read, readPublic, readShape, readTool };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { compactDocumentOperations } from "./operations/index.js";
|
|
2
|
+
import { render, renderWidgetShape } from "./renderWidget.js";
|
|
1
3
|
import { iconFontCss } from "../apps/render/styles.js";
|
|
2
4
|
import { RENDER_APP_URI } from "../apps/render/index.js";
|
|
3
5
|
import { defineTool } from "./shared/tool.js";
|
|
4
|
-
import { compactDocumentOperations } from "./operations/index.js";
|
|
5
|
-
import { render, renderWidgetShape } from "./renderWidget.js";
|
|
6
6
|
import { randomUUID } from "node:crypto";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
|
|
8
|
+
// src/modules/mcp/tools/render.ts
|
|
9
9
|
var renderShape = {
|
|
10
10
|
...renderWidgetShape,
|
|
11
11
|
patch: z.boolean().optional().describe("Set true to CHANGE a widget you already rendered instead of rebuilding it: send its `renderId` and ONLY the operations that differ (patchDefinition, patchElement, deleteElement, a new repeatElement…). The widget merges them into the batch it was built from and reports back what it applied. The refs it already has (card-1, blk-2-3) are the ones to address. If that widget cannot be recovered — a surface that renders none, a host that keeps no storage — the answer says so and you re-send the whole batch."),
|
|
@@ -103,5 +103,4 @@ var renderTool = defineTool({
|
|
|
103
103
|
ui: { resourceUri: RENDER_APP_URI },
|
|
104
104
|
run: (input, ctx) => input.patch === true ? toPatchResult(input.operations, input.renderId) : toRenderResult(render(input, { proxy: ctx.proxy }), input.renderId ?? newRenderId())
|
|
105
105
|
});
|
|
106
|
-
//#endregion
|
|
107
106
|
export { renderShape, renderTool };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { documentOperations } from "./operations/index.js";
|
|
1
2
|
import { emptySpace } from "../helpers/space.js";
|
|
2
3
|
import { proxifyResources } from "../proxy/rewrite.js";
|
|
3
|
-
import { documentOperations } from "./operations/index.js";
|
|
4
4
|
import { draftBatch } from "./shared/draftBatch.js";
|
|
5
5
|
import { interactionReport } from "./shared/interactionReport.js";
|
|
6
6
|
import { generateCache } from "@plitzi/sdk-style";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/renderWidget.ts
|
|
8
8
|
/**
|
|
9
9
|
* A widget built from an agent's operations, with no space and no backend: the engine behind `plitzi_render`, apart
|
|
10
10
|
* from the MCP tool — so a project's own agent can draw the same widgets in its own pages (`@plitzi/sdk-mcp/render`).
|
|
@@ -63,5 +63,4 @@ var render = (input, options = {}) => {
|
|
|
63
63
|
warnings: noWarnings(warnings)
|
|
64
64
|
};
|
|
65
65
|
};
|
|
66
|
-
//#endregion
|
|
67
66
|
export { HOST_PAGE_REF, render, renderWidgetShape };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { computeVersion } from "../helpers/computeVersion.js";
|
|
2
|
-
import { getPageElements, isPageElement, nameOf, pageRefOfElement } from "../helpers/space.js";
|
|
3
2
|
import { elementUri, pageUri } from "../helpers/uris.js";
|
|
3
|
+
import { getPageElements, isPageElement, nameOf, pageRefOfElement } from "../helpers/space.js";
|
|
4
4
|
import { definitionRefs, definitionToAI } from "./operations/style/translator.js";
|
|
5
5
|
import { elementView, pageSkeletonToAI } from "./operations/schema/translator.js";
|
|
6
6
|
import { defineTool } from "./shared/tool.js";
|
|
7
7
|
import { z } from "zod";
|
|
8
|
-
|
|
8
|
+
// src/modules/mcp/tools/search.ts
|
|
9
9
|
var searchShape = {
|
|
10
10
|
query: z.string().describe("Case-insensitive match on label, type and attribute values"),
|
|
11
11
|
filters: z.object({
|
|
@@ -111,5 +111,4 @@ var searchTool = defineTool({
|
|
|
111
111
|
access: "read",
|
|
112
112
|
run: (input, ctx) => search(input, ctx.space, ctx.env)
|
|
113
113
|
});
|
|
114
|
-
//#endregion
|
|
115
114
|
export { search, searchShape, searchTool };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { cloneSpace } from "../../helpers/space.js";
|
|
2
1
|
import { expandOperations } from "./expandOperations.js";
|
|
3
2
|
import { fixTouched, lintDraft } from "./lintDraft.js";
|
|
4
3
|
import { newSuggestions } from "./newSuggestions.js";
|
|
5
4
|
import { normalizeOperations } from "./normalizeOperations.js";
|
|
6
5
|
import { validateOperations } from "./validator/index.js";
|
|
6
|
+
import { cloneSpace } from "../../helpers/space.js";
|
|
7
7
|
import { applyOperations } from "../apply/dispatch.js";
|
|
8
|
-
|
|
8
|
+
// src/modules/mcp/tools/shared/draftBatch.ts
|
|
9
9
|
/**
|
|
10
10
|
* A batch run on a copy of the space and read back — the one way every tool that takes operations handles them, so
|
|
11
11
|
* a `dryRun` answers exactly what `plitzi_apply` would save, and `plitzi_render` holds a widget to the same rules.
|
|
@@ -67,5 +67,4 @@ var draftBatch = (space, env, operations, mode = "space") => {
|
|
|
67
67
|
suggestions: newSuggestions(prepared.space, draft)
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
//#endregion
|
|
71
70
|
export { draftBatch };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { canonicalJson, isRecord } from "@plitzi/sdk-shared/helpers";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/effects.ts
|
|
3
3
|
/**
|
|
4
4
|
* What a write did to the space, read off the documents before and after it — never off what was asked. An agent
|
|
5
5
|
* that is told only what it asked for cannot see the element a shared class also restyled, the child a move took with
|
|
@@ -150,5 +150,4 @@ var effectsOf = (before, after) => {
|
|
|
150
150
|
differences("data", before.data, after.data, out);
|
|
151
151
|
return out.length > LIMIT ? [...out.slice(0, LIMIT), `… and ${String(out.length - LIMIT)} more changes: read the resources listed in \`changed\``] : out;
|
|
152
152
|
};
|
|
153
|
-
//#endregion
|
|
154
153
|
export { effectsOf };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { expandRepeat } from "../operations/schema/elements/repeatElement.js";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/expandOperations.ts
|
|
3
3
|
/** Rewrites the sugar ops into the vocabulary the rest of the pipeline knows, BEFORE validation — today that is
|
|
4
4
|
* `repeatElement`, which stands for the `upsertElement` its template + rows expand to. Everything downstream
|
|
5
5
|
* (validator, dispatch, audit, versions) therefore stays unaware of it, and a row that renders a bad element is
|
|
@@ -40,5 +40,4 @@ var expandOperations = (ops) => {
|
|
|
40
40
|
errors
|
|
41
41
|
};
|
|
42
42
|
};
|
|
43
|
-
//#endregion
|
|
44
43
|
export { expandOperations };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { flowsFromInteractions } from "../../helpers/interactions.js";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/interactionReport.ts
|
|
3
3
|
var TRIGGER = "trigger";
|
|
4
4
|
var stepLabel = (step) => {
|
|
5
5
|
if (step.nodeType !== "callback") return step.action;
|
|
@@ -44,5 +44,4 @@ var interactionReport = (space) => {
|
|
|
44
44
|
warnings: nestingWarnings(space)
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
//#endregion
|
|
48
47
|
export { interactionReport };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { findElementByRef, findPageByRef } from "../../helpers/space.js";
|
|
2
2
|
import { styleWithoutTag, validateSchema } from "@plitzi/sdk-schema";
|
|
3
3
|
import { authoringCodeEntry, elementSourceTypes, fixSpace, lintSpace } from "@plitzi/sdk-authoring";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/shared/lintDraft.ts
|
|
5
5
|
/** The elements a batch touches, by the ref each op names — what the lint of the result is held to. */
|
|
6
6
|
var touchedRefs = (ops) => {
|
|
7
7
|
const refs = /* @__PURE__ */ new Set();
|
|
@@ -155,5 +155,4 @@ var lintDraft = (draft, ops, before) => {
|
|
|
155
155
|
warnings
|
|
156
156
|
};
|
|
157
157
|
};
|
|
158
|
-
//#endregion
|
|
159
158
|
export { fixTouched, lintDraft };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { unnamedControls } from "../../accessibilityOutline.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
3
|
+
// src/modules/mcp/tools/shared/look.ts
|
|
4
4
|
/**
|
|
5
5
|
* How a page looks — as HTML, as a picture, or as a screen reader and a browser agent read it — rendered from the saved
|
|
6
6
|
* space or from a batch that was never saved.
|
|
@@ -124,5 +124,4 @@ var lookAt = async (ctx, request) => {
|
|
|
124
124
|
images: request.view === "accessibility" ? [] : shot.images
|
|
125
125
|
};
|
|
126
126
|
};
|
|
127
|
-
//#endregion
|
|
128
127
|
export { fullPage, lookAt, pageRef, viewport };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { suggestSpace } from "@plitzi/sdk-authoring";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/newSuggestions.ts
|
|
3
3
|
/**
|
|
4
4
|
* What a suggestion is about, one key each: its elements together, or — for one about declarations, which names many
|
|
5
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
|
|
@@ -21,5 +21,4 @@ var newSuggestions = (before, after) => {
|
|
|
21
21
|
style: after.style
|
|
22
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"})` : ""}`);
|
|
23
23
|
};
|
|
24
|
-
//#endregion
|
|
25
24
|
export { newSuggestions };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { buildTypeRegistry } from "../../catalogs/registry.js";
|
|
2
2
|
import { elementTypeNames } from "../../catalogs/index.js";
|
|
3
|
-
|
|
3
|
+
// src/modules/mcp/tools/shared/normalizeOperations.ts
|
|
4
4
|
/**
|
|
5
5
|
* What a batch wrote that has one reading, read that way and said: an element type spelt with other capitals
|
|
6
6
|
* (`Heading`) is the type the catalog spells (`heading`). A guess between two names is never made here — a name with a
|
|
@@ -33,5 +33,4 @@ var normalizeOperations = (space, operations) => {
|
|
|
33
33
|
notes
|
|
34
34
|
};
|
|
35
35
|
};
|
|
36
|
-
//#endregion
|
|
37
36
|
export { normalizeOperations };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/repeats.ts
|
|
3
3
|
/**
|
|
4
4
|
* The same batch refused again — an agent going round in circles, which a model is not trusted to notice. Counted per
|
|
5
5
|
* process, as a hint and never a lock: a call that lands on another worker only loses the hint.
|
|
@@ -34,5 +34,4 @@ var REPEATED = {
|
|
|
34
34
|
error: "REPEATED_BATCH",
|
|
35
35
|
message: "This exact batch was refused twice, and was not run again. Change what the errors named, or ask the person."
|
|
36
36
|
};
|
|
37
|
-
//#endregion
|
|
38
37
|
export { AGAIN, REPEATED, batchKey, forgetRefused, noteRefused, timesRefused };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/tool.ts
|
|
3
3
|
/** Build the MCP CallToolResult for an image-returning tool: a text meta block followed by one image block per
|
|
4
4
|
* PNG, so a vision-capable agent (or MCP client) sees the render directly. */
|
|
5
5
|
var imageResult = (images, meta) => ({ content: [{
|
|
@@ -31,5 +31,4 @@ var defineTool = (spec) => {
|
|
|
31
31
|
...runPublic ? { executePublic: (args, env) => runPublic(parse(args), env) } : {}
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
//#endregion
|
|
35
34
|
export { defineTool, imageResult };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { slugRouteParams } from "../../../helpers/space.js";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/validator/batch.ts
|
|
3
3
|
var batchDeclaredVars = (ops) => {
|
|
4
4
|
const names = [];
|
|
5
5
|
for (const op of ops) if (op.type === "upsertVariable") names.push(op.name);
|
|
@@ -44,5 +44,4 @@ var batchDeclaredElements = (ops) => {
|
|
|
44
44
|
for (const op of ops) if (op.type === "upsertElement") walk(op.element);
|
|
45
45
|
return refs;
|
|
46
46
|
};
|
|
47
|
-
//#endregion
|
|
48
47
|
export { batchDeclaredElements, batchDeclaredFolders, batchDeclaredPages, batchDeclaredVariants, batchDeclaredVars };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { warnOnce } from "./context.js";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/shared/validator/bindings.ts
|
|
3
3
|
var checkBindingTarget = (ref, category, to, path, ctx) => {
|
|
4
4
|
if (category !== "attributes" && category !== "initialState") return;
|
|
5
5
|
const type = ctx.elementType(ref);
|
|
@@ -7,5 +7,4 @@ var checkBindingTarget = (ref, category, to, path, ctx) => {
|
|
|
7
7
|
if (!targets || targets.size === 0 || targets.has(to)) return;
|
|
8
8
|
warnOnce(ctx, `Binding target "${to}" at ${path} is not among the "${category}" targets the type "${type}" declares (${[...targets].sort().join(", ")}). Verify against plitzi://data-sources; it may still be valid.`);
|
|
9
9
|
};
|
|
10
|
-
//#endregion
|
|
11
10
|
export { checkBindingTarget };
|