@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,14 +1,14 @@
|
|
|
1
|
+
import { connectorSummaries } from "./connectors.js";
|
|
2
|
+
import { envelope } from "./envelope.js";
|
|
3
|
+
import { cssProperties, cssShorthands } from "../catalogs/index.js";
|
|
4
|
+
import { buildDataSourceCatalog, buildInteractionCatalog } from "../catalogs/observed.js";
|
|
5
|
+
import { buildTypeRegistry } from "../catalogs/registry.js";
|
|
1
6
|
import { componentSummariesToAI } from "../helpers/components.js";
|
|
2
7
|
import { componentsUri, connectorsUri, dataSourcesUri, defsUri, flagsUri, foldersUri, fontsUri, interactionsUri, layoutsUri, pagesUri, primerUri, schemaVarsUri, settingsUri, styleVarsUri, typesUri } from "../helpers/uris.js";
|
|
3
8
|
import { guideQuickstart } from "../helpers/guide/instructions.js";
|
|
4
|
-
import { buildDataSourceCatalog, buildInteractionCatalog } from "../catalogs/observed.js";
|
|
5
|
-
import { buildTypeRegistry } from "../catalogs/registry.js";
|
|
6
|
-
import { cssProperties, cssShorthands } from "../catalogs/index.js";
|
|
7
|
-
import { envelope } from "./envelope.js";
|
|
8
|
-
import { connectorSummaries } from "./connectors.js";
|
|
9
|
-
import { definitionRefs, fontsToAI, styleVariablesToAI } from "../tools/operations/style/translator.js";
|
|
10
9
|
import { foldersToAI, layoutSummariesToAI, pageSummariesToAI, schemaVariablesToAI, settingsToAI } from "../tools/operations/schema/translator.js";
|
|
11
|
-
|
|
10
|
+
import { definitionRefs, fontsToAI, styleVariablesToAI } from "../tools/operations/style/translator.js";
|
|
11
|
+
// src/modules/mcp/resources/primer.ts
|
|
12
12
|
/**
|
|
13
13
|
* How much of the cold-start bundle the SPACE may fill, in characters of JSON.
|
|
14
14
|
*
|
|
@@ -209,5 +209,4 @@ var readPrimerResource = (space, env, uri) => {
|
|
|
209
209
|
} } : {}
|
|
210
210
|
});
|
|
211
211
|
};
|
|
212
|
-
//#endregion
|
|
213
212
|
export { readPrimerResource };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpLog, Space } from '../helpers';
|
|
2
2
|
import { Env } from '../types';
|
|
3
3
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
4
|
-
import { SSRChangePage, SSRChangeQuery } from '@plitzi/sdk-
|
|
4
|
+
import { SSRChangePage, SSRChangeQuery } from '@plitzi/sdk-kernel/types';
|
|
5
5
|
/** Register every resource on the MCP server: fixed listings plus templated per-item reads. The space is
|
|
6
6
|
* loaded lazily via getSpace, so listing resources never touches the store — only reading one does.
|
|
7
7
|
*
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { changesUri } from "../helpers/uris.js";
|
|
2
|
-
import { guideText } from "../helpers/guide/index.js";
|
|
3
|
-
import { cssProperties, cssShorthands } from "../catalogs/index.js";
|
|
4
|
-
import { envelope, jsonContents } from "./envelope.js";
|
|
5
1
|
import { resourceErrorMessage } from "./canonical.js";
|
|
2
|
+
import { envelope, jsonContents } from "./envelope.js";
|
|
3
|
+
import { EXPLAIN_URI_TEMPLATE, explainResource } from "./explain.js";
|
|
6
4
|
import { registerRenderResources } from "./renderGuide.js";
|
|
7
5
|
import { readResource } from "./router.js";
|
|
8
|
-
import {
|
|
6
|
+
import { cssProperties, cssShorthands } from "../catalogs/index.js";
|
|
7
|
+
import { guideText } from "../helpers/guide/index.js";
|
|
8
|
+
import { changesUri } from "../helpers/uris.js";
|
|
9
9
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
10
|
-
|
|
10
|
+
// src/modules/mcp/resources/register.ts
|
|
11
11
|
/** A page an agent can read in one go: each change carries whole elements before and after. */
|
|
12
12
|
var CHANGES_PAGE = 20;
|
|
13
13
|
/** Register every resource on the MCP server: fixed listings plus templated per-item reads. The space is
|
|
@@ -288,5 +288,4 @@ var registerResources = (server, getSpace, env, log, hasSpace, readChanges) => {
|
|
|
288
288
|
mimeType: "application/json"
|
|
289
289
|
}, (uri) => emit(uri.href));
|
|
290
290
|
};
|
|
291
|
-
//#endregion
|
|
292
291
|
export { registerResources };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { elementCatalog } from "../catalogs/index.js";
|
|
2
1
|
import { envelope, jsonContents } from "./envelope.js";
|
|
2
|
+
import { elementCatalog } from "../catalogs/index.js";
|
|
3
3
|
import { ResourceTemplate } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
4
|
import { STYLE_STATES } from "@plitzi/sdk-shared/style";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/resources/renderGuide.ts
|
|
6
6
|
var RENDER_GUIDE_URI = "plitzi://render/guide";
|
|
7
7
|
var RENDER_TYPES_URI = "plitzi://render/types";
|
|
8
8
|
var RENDER_TYPE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
@@ -577,5 +577,4 @@ var registerRenderResources = (server, log) => {
|
|
|
577
577
|
return contents;
|
|
578
578
|
});
|
|
579
579
|
};
|
|
580
|
-
//#endregion
|
|
581
580
|
export { RENDER_GUIDE_URI, RENDER_TYPES_URI, readRenderResource, registerRenderResources, renderGuideCore, renderGuideText, renderGuideTopicUri, renderGuideTopics };
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { emptySpace } from "../helpers/space.js";
|
|
2
|
-
import "../helpers/uris.js";
|
|
3
1
|
import { readActionResource } from "./actions.js";
|
|
4
2
|
import { canonicalUri } from "./canonical.js";
|
|
5
3
|
import { readConnectorResource } from "./connectors.js";
|
|
@@ -10,7 +8,9 @@ import { readPrimerResource } from "./primer.js";
|
|
|
10
8
|
import { readRenderResource } from "./renderGuide.js";
|
|
11
9
|
import { readSchemaResource } from "./schema.js";
|
|
12
10
|
import { readStyleResource } from "./style.js";
|
|
13
|
-
|
|
11
|
+
import { emptySpace } from "../helpers/space.js";
|
|
12
|
+
import "../helpers/uris.js";
|
|
13
|
+
// src/modules/mcp/resources/router.ts
|
|
14
14
|
var resolvers = [
|
|
15
15
|
(space, _env, uri) => readCoreResource(space, uri),
|
|
16
16
|
(_space, _env, uri) => readRenderResource(uri),
|
|
@@ -41,5 +41,4 @@ var readPublicResource = (env, rawUri) => {
|
|
|
41
41
|
};
|
|
42
42
|
/** Current version of a resource, for optimistic-concurrency checks. Null when the URI is unknown. */
|
|
43
43
|
var resourceVersion = (space, env, uri) => readResource(space, env, uri)?.stateVersion ?? null;
|
|
44
|
-
//#endregion
|
|
45
44
|
export { readPublicResource, readResource, resourceVersion };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import { afterPrefix, componentsUri, dataSourcesUri, elementUri, flagsUri, folderUri, foldersUri, interactionsUri, layoutsUri, pageUri, pagesUri, schemaVarsUri, settingsUri } from "../helpers/uris.js";
|
|
1
2
|
import { componentSummariesToAI, componentView, findComponentByRef } from "../helpers/components.js";
|
|
2
3
|
import { findElementByRef, findRootByRef } from "../helpers/space.js";
|
|
3
|
-
import { afterPrefix, componentsUri, dataSourcesUri, elementUri, flagsUri, folderUri, foldersUri, interactionsUri, layoutsUri, pageUri, pagesUri, schemaVarsUri, settingsUri } from "../helpers/uris.js";
|
|
4
|
-
import { buildDataSourceCatalog, buildInteractionCatalog } from "../catalogs/observed.js";
|
|
5
4
|
import { envelope } from "./envelope.js";
|
|
5
|
+
import { buildDataSourceCatalog, buildInteractionCatalog } from "../catalogs/observed.js";
|
|
6
6
|
import { elementView, folderRefToAI, foldersToAI, layoutSummariesToAI, pageSkeletonToAI, pageStylesToAI, pageSummariesToAI, schemaVariablesToAI, settingsToAI } from "../tools/operations/schema/translator.js";
|
|
7
7
|
import { treeOf } from "@plitzi/sdk-schema";
|
|
8
|
-
|
|
8
|
+
// src/modules/mcp/resources/schema.ts
|
|
9
9
|
/** Element-schema reads: page listings/skeletons/styles, folders, single elements and schema variables. Returns
|
|
10
10
|
* undefined when the URI belongs to another domain, null when the shape is ours but the ref does not resolve. */
|
|
11
11
|
var readSchemaResource = (space, env, uri) => {
|
|
@@ -47,5 +47,4 @@ var readSchemaResource = (space, env, uri) => {
|
|
|
47
47
|
if (uri === interactionsUri(env)) return envelope(buildInteractionCatalog(space.schema));
|
|
48
48
|
if (uri === dataSourcesUri(env)) return envelope(buildDataSourceCatalog(space.schema));
|
|
49
49
|
};
|
|
50
|
-
//#endregion
|
|
51
50
|
export { readSchemaResource };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { afterPrefix, defUri, defsUri, fontUri, fontsUri, globalUri, globalsUri, idUri, idsUri, styleVarUri, styleVarsUri } from "../helpers/uris.js";
|
|
2
1
|
import { envelope } from "./envelope.js";
|
|
2
|
+
import { afterPrefix, defUri, defsUri, fontUri, fontsUri, globalUri, globalsUri, idUri, idsUri, styleVarUri, styleVarsUri } from "../helpers/uris.js";
|
|
3
3
|
import { definitionRefs, definitionToAI, fontsToAI, globalStyleToAI, globalStyleTypes, idStyleIds, idStyleToAI, styleVariablesToAI } from "../tools/operations/style/translator.js";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/resources/style.ts
|
|
5
5
|
/** Style-schema reads: definitions, global (per-type) styles, design-token variables by category, and the fonts
|
|
6
6
|
* the space declares. Returns
|
|
7
7
|
* undefined when the URI belongs to another domain, null when the shape is ours but the ref does not resolve. */
|
|
@@ -37,5 +37,4 @@ var readStyleResource = (space, env, uri) => {
|
|
|
37
37
|
return envelope(Object.hasOwn(byCategory, category) ? byCategory[category] : []);
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
|
-
//#endregion
|
|
41
40
|
export { readStyleResource };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { outlineOfTree } from "./accessibilityOutline.js";
|
|
2
|
-
import { PREVIEW_TOKEN_PARAM } from "@plitzi/sdk-
|
|
3
|
-
|
|
2
|
+
import { PREVIEW_TOKEN_PARAM } from "@plitzi/sdk-kernel/identity";
|
|
3
|
+
// src/modules/mcp/screenshotClient.ts
|
|
4
4
|
var composeUrl = (base, pagePath, token) => {
|
|
5
5
|
const url = new URL(pagePath, base);
|
|
6
6
|
if (token) url.searchParams.set(PREVIEW_TOKEN_PARAM, token);
|
|
@@ -24,7 +24,7 @@ var readRefusal = async (res) => {
|
|
|
24
24
|
/** Default `ScreenshotClient`: composes the navigable preview URL (renderBaseUrl + pagePath + `?__pt=token`) and
|
|
25
25
|
* POSTs it to the browser service. Any network/HTTP failure surfaces as `ok:false` so the tool can fall back to
|
|
26
26
|
* the HTML preview instead of hard-failing. */
|
|
27
|
-
var createHttpScreenshotClient = ({ serviceUrl, renderBaseUrl, fetchImpl = fetch }) => ({ async capture({ pagePath, token, viewports, fullPage, colorScheme, views = ["image"] }) {
|
|
27
|
+
var createHttpScreenshotClient = ({ serviceUrl, renderBaseUrl, fetchImpl = fetch }) => ({ async capture({ pagePath, token, viewports, fullPage, colorScheme, views = ["image"], format, quality }) {
|
|
28
28
|
const url = composeUrl(renderBaseUrl, pagePath, token);
|
|
29
29
|
let res;
|
|
30
30
|
try {
|
|
@@ -36,7 +36,9 @@ var createHttpScreenshotClient = ({ serviceUrl, renderBaseUrl, fetchImpl = fetch
|
|
|
36
36
|
viewports,
|
|
37
37
|
fullPage,
|
|
38
38
|
colorScheme,
|
|
39
|
-
views
|
|
39
|
+
views,
|
|
40
|
+
format,
|
|
41
|
+
quality
|
|
40
42
|
})
|
|
41
43
|
});
|
|
42
44
|
} catch (err) {
|
|
@@ -76,5 +78,4 @@ var createHttpScreenshotClient = ({ serviceUrl, renderBaseUrl, fetchImpl = fetch
|
|
|
76
78
|
...accessibility ? { accessibility } : {}
|
|
77
79
|
};
|
|
78
80
|
} });
|
|
79
|
-
//#endregion
|
|
80
81
|
export { createHttpScreenshotClient };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import { ResourceProxy } from './proxy';
|
|
3
3
|
import { PreviewClient, ScreenshotClient } from './types';
|
|
4
|
-
import { SSRAdapters, ServerLogger, SSRGrant } from '@plitzi/sdk-
|
|
4
|
+
import { SSRAdapters, ServerLogger, SSRGrant } from '@plitzi/sdk-kernel/types';
|
|
5
5
|
/** The MCP service is stateless: every request resolves its own `spaceId` (from the request JWT) and reads the
|
|
6
6
|
* space fresh through the adapters — schema and style are two documents, read/written independently. The spaceId
|
|
7
7
|
* is resolved once per request, up front, because it decides what this connection IS: with a space, the full
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { registerApps } from "./apps/index.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createMcpLog } from "./helpers/log.js";
|
|
3
3
|
import { NoSpaceError, ReadOnlyGrantError, emptySpace, emptySpaceMessage, noSpaceErrorCode, readOnlyGrantErrorCode } from "./helpers/space.js";
|
|
4
|
+
import { isCallToolResult } from "./helpers/callToolResult.js";
|
|
4
5
|
import { serverInstructions, widgetsOnlyInstructions } from "./helpers/guide/instructions.js";
|
|
5
|
-
import { createMcpLog } from "./helpers/log.js";
|
|
6
6
|
import { proxyForTool } from "./proxy/config.js";
|
|
7
7
|
import { registerResources } from "./resources/register.js";
|
|
8
8
|
import { tools } from "./tools/index.js";
|
|
9
9
|
import { randomUUID } from "node:crypto";
|
|
10
10
|
import { registerAppTool } from "@modelcontextprotocol/ext-apps/server";
|
|
11
11
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
12
|
-
|
|
12
|
+
// src/modules/mcp/server.ts
|
|
13
13
|
var MCP_ENV = "main";
|
|
14
14
|
var asText = (data) => ({ content: [{
|
|
15
15
|
type: "text",
|
|
@@ -81,7 +81,7 @@ var createMcpServer = async ({ adapters, getGrant, preview, screenshot, logger,
|
|
|
81
81
|
const getSpace = () => spacePromise ??= loadSpace();
|
|
82
82
|
const server = new McpServer({
|
|
83
83
|
name: "plitzi-mcp",
|
|
84
|
-
version: "0.39.
|
|
84
|
+
version: "0.39.3"
|
|
85
85
|
}, { instructions: hasSpace ? serverInstructions : widgetsOnlyInstructions });
|
|
86
86
|
const { getChanges } = adapters;
|
|
87
87
|
registerResources(server, getSpace, MCP_ENV, log, hasSpace, getChanges ? (query) => getChanges(requireSpaceId(), MCP_ENV, query) : void 0);
|
|
@@ -162,5 +162,4 @@ var createMcpServer = async ({ adapters, getGrant, preview, screenshot, logger,
|
|
|
162
162
|
}
|
|
163
163
|
return server;
|
|
164
164
|
};
|
|
165
|
-
//#endregion
|
|
166
165
|
export { createMcpServer };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineTool } from "./shared/tool.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { ACTIVITY_LIMIT_MAX, ACTIVITY_WAIT_DEFAULT_SECONDS, ACTIVITY_WAIT_MAX_SECONDS } from "@plitzi/sdk-shared/activity";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/activity.ts
|
|
5
5
|
var activityShape = {
|
|
6
6
|
after: z.string().optional().describe("The `cursor` last answered. Left out: the latest, at once"),
|
|
7
7
|
wait: z.number().min(0).max(ACTIVITY_WAIT_MAX_SECONDS).optional().describe(`Seconds to wait for something; default ${String(ACTIVITY_WAIT_DEFAULT_SECONDS)}`),
|
|
@@ -32,5 +32,4 @@ var activityTool = defineTool({
|
|
|
32
32
|
documents: false,
|
|
33
33
|
run: (input, ctx) => activity(input, ctx)
|
|
34
34
|
});
|
|
35
|
-
//#endregion
|
|
36
35
|
export { activity, activityShape, activityTool };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { componentView, findComponentByRef } from "../../helpers/components.js";
|
|
2
|
-
import { pageUri } from "../../helpers/uris.js";
|
|
3
2
|
import { fail } from "../../helpers/opResult.js";
|
|
3
|
+
import { pageUri } from "../../helpers/uris.js";
|
|
4
4
|
import { deleteAction } from "../operations/actions/deleteAction.js";
|
|
5
5
|
import { patchAction } from "../operations/actions/patchAction.js";
|
|
6
6
|
import { upsertAction } from "../operations/actions/upsertAction.js";
|
|
7
7
|
import { deleteConnector } from "../operations/connectors/deleteConnector.js";
|
|
8
8
|
import { patchConnector } from "../operations/connectors/patchConnector.js";
|
|
9
9
|
import { upsertConnector } from "../operations/connectors/upsertConnector.js";
|
|
10
|
+
import { isStyleOp } from "../operations/index.js";
|
|
10
11
|
import { deleteDataFile, upsertDataFile } from "../operations/data/index.js";
|
|
11
|
-
import { deleteFunctionFile, upsertFunctionFile } from "../operations/functions/index.js";
|
|
12
12
|
import { deleteBinding } from "../operations/schema/bindings/deleteBinding.js";
|
|
13
13
|
import { patchBinding } from "../operations/schema/bindings/patchBinding.js";
|
|
14
14
|
import { upsertBinding } from "../operations/schema/bindings/upsertBinding.js";
|
|
@@ -46,8 +46,8 @@ import { patchIdStyle } from "../operations/style/idStyles/patchIdStyle.js";
|
|
|
46
46
|
import { upsertIdStyle } from "../operations/style/idStyles/upsertIdStyle.js";
|
|
47
47
|
import { deleteStyleVariable } from "../operations/style/variables/deleteStyleVariable.js";
|
|
48
48
|
import { upsertStyleVariable } from "../operations/style/variables/upsertStyleVariable.js";
|
|
49
|
-
import {
|
|
50
|
-
|
|
49
|
+
import { deleteFunctionFile, upsertFunctionFile } from "../operations/functions/index.js";
|
|
50
|
+
// src/modules/mcp/tools/apply/dispatch.ts
|
|
51
51
|
var isRooted = (op) => "pageRef" in op;
|
|
52
52
|
/**
|
|
53
53
|
* An element op names its root with `pageRef`, and a component is one: the op runs on the component's tree as if it
|
|
@@ -198,5 +198,4 @@ var applyOperations = (space, env, ops) => {
|
|
|
198
198
|
outcome.deletedActions = Array.from(droppedActions);
|
|
199
199
|
return outcome;
|
|
200
200
|
};
|
|
201
|
-
//#endregion
|
|
202
201
|
export { applyOperations };
|
|
@@ -1664,6 +1664,8 @@ export declare const applyShape: {
|
|
|
1664
1664
|
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
1665
1665
|
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
1666
1666
|
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
1667
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
1668
|
+
maxRunBytes: z.ZodOptional<z.ZodNumber>;
|
|
1667
1669
|
}, z.core.$strip>>;
|
|
1668
1670
|
}, z.core.$strict>, z.ZodObject<{
|
|
1669
1671
|
type: z.ZodLiteral<"patchAction">;
|
|
@@ -1706,6 +1708,8 @@ export declare const applyShape: {
|
|
|
1706
1708
|
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
1707
1709
|
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
1708
1710
|
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
1711
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
1712
|
+
maxRunBytes: z.ZodOptional<z.ZodNumber>;
|
|
1709
1713
|
}, z.core.$strip>>;
|
|
1710
1714
|
}, z.core.$strict>, z.ZodObject<{
|
|
1711
1715
|
type: z.ZodLiteral<"deleteAction">;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { dataFileUri, dataUri, functionFileUri, functionsUri } from "../../helpers/uris.js";
|
|
2
|
-
import { defineTool, imageResult } from "../shared/tool.js";
|
|
3
1
|
import { changedResources, conflictMessage, detectConflicts, resolvedElements } from "./writeResult.js";
|
|
2
|
+
import { dataFileUri, dataUri, functionFileUri, functionsUri } from "../../helpers/uris.js";
|
|
4
3
|
import { environment, operations } from "../operations/index.js";
|
|
5
4
|
import { draftBatch } from "../shared/draftBatch.js";
|
|
6
5
|
import { effectsOf } from "../shared/effects.js";
|
|
7
6
|
import { fullPage, lookAt, pageRef, viewport } from "../shared/look.js";
|
|
8
7
|
import { AGAIN, REPEATED, batchKey, forgetRefused, noteRefused, timesRefused } from "../shared/repeats.js";
|
|
8
|
+
import { defineTool, imageResult } from "../shared/tool.js";
|
|
9
9
|
import { z } from "zod";
|
|
10
10
|
import { generateCache } from "@plitzi/sdk-style";
|
|
11
|
-
|
|
11
|
+
// src/modules/mcp/tools/apply/index.ts
|
|
12
12
|
var applyShape = {
|
|
13
13
|
environment,
|
|
14
14
|
dryRun: z.boolean().optional().describe("Validate and apply in memory only, WITHOUT persisting. Returns the same result (changed versions + full element detail) so you can inspect the outcome and decide on more changes before committing for real."),
|
|
@@ -210,5 +210,4 @@ var applyTool = defineTool({
|
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
212
|
});
|
|
213
|
-
//#endregion
|
|
214
213
|
export { NOTHING_CHANGED, apply, applyShape, applyTool };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { elementUri } from "../../helpers/uris.js";
|
|
2
2
|
import { readResource, resourceVersion } from "../../resources/router.js";
|
|
3
|
-
|
|
3
|
+
// src/modules/mcp/tools/apply/writeResult.ts
|
|
4
4
|
var detectConflicts = (space, env, expected) => {
|
|
5
5
|
if (!expected) return [];
|
|
6
6
|
const conflicts = [];
|
|
@@ -33,5 +33,4 @@ var resolvedElements = (space, env, refs) => {
|
|
|
33
33
|
return elements.length > 0 ? elements : void 0;
|
|
34
34
|
};
|
|
35
35
|
var conflictMessage = "Cannot apply: your data is stale. Re-read the changed resources and retry.";
|
|
36
|
-
//#endregion
|
|
37
36
|
export { changedResources, conflictMessage, detectConflicts, resolvedElements };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineTool } from "./shared/tool.js";
|
|
2
1
|
import { OPERATIONS_BY_TYPE } from "./operations/index.js";
|
|
2
|
+
import { defineTool } from "./shared/tool.js";
|
|
3
3
|
import { closest } from "@plitzi/sdk-authoring";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/describeOperation.ts
|
|
6
6
|
var describeOperationShape = { type: z.string().optional().describe("The operation type, as in a batch: \"upsertElement\", \"patchDefinition\"… Left out, every type is listed.") };
|
|
7
7
|
/**
|
|
8
8
|
* One operation's schema, by its type — the low level asked for one piece at a time, so a connection does not have to
|
|
@@ -36,5 +36,4 @@ var describeOperationTool = defineTool({
|
|
|
36
36
|
spaceless: true,
|
|
37
37
|
run: (input) => describeOperation(input.type)
|
|
38
38
|
});
|
|
39
|
-
//#endregion
|
|
40
39
|
export { describeOperation, describeOperationShape, describeOperationTool };
|
|
@@ -10,7 +10,7 @@ import { renderTool } from "./render.js";
|
|
|
10
10
|
import { search, searchShape, searchTool } from "./search.js";
|
|
11
11
|
import { testTool } from "./test.js";
|
|
12
12
|
import { tryFunctionTool } from "./tryFunction.js";
|
|
13
|
-
|
|
13
|
+
// src/modules/mcp/tools/index.ts
|
|
14
14
|
/** The MCP tool registry — the single source the server registers from. Adding a tool is: create its file with a
|
|
15
15
|
* ToolDef descriptor and append it here. */
|
|
16
16
|
var tools = [
|
|
@@ -29,5 +29,4 @@ var tools = [
|
|
|
29
29
|
testTool,
|
|
30
30
|
activityTool
|
|
31
31
|
];
|
|
32
|
-
//#endregion
|
|
33
32
|
export { apply, applyShape, operation, read, readShape, search, searchShape, tools };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { apply } from "./apply/index.js";
|
|
1
2
|
import { findElementByRef } from "../helpers/space.js";
|
|
2
|
-
import { defineTool } from "./shared/tool.js";
|
|
3
3
|
import { scalar } from "./operations/schema/shared.js";
|
|
4
|
-
import {
|
|
4
|
+
import { defineTool } from "./shared/tool.js";
|
|
5
5
|
import { closest } from "@plitzi/sdk-authoring";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/intents.ts
|
|
8
8
|
/** The element a ref names, with the page or layout it is on — or the nearest ref there is. */
|
|
9
9
|
var locate = (ctx, ref) => {
|
|
10
10
|
const element = findElementByRef(ctx.space.schema, ref);
|
|
@@ -197,5 +197,4 @@ var addPageTool = defineTool({
|
|
|
197
197
|
...input.layout ? { layout: input.layout } : {}
|
|
198
198
|
}], input.ref)
|
|
199
199
|
});
|
|
200
|
-
//#endregion
|
|
201
200
|
export { addPageTool, bindAttributeTool, placeComponentTool, setAttributesTool, setClassesTool };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { defineTool, imageResult } from "./shared/tool.js";
|
|
2
1
|
import { fullPage, lookAt, pageRef, viewport } from "./shared/look.js";
|
|
2
|
+
import { defineTool, imageResult } from "./shared/tool.js";
|
|
3
3
|
import { z } from "zod";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/look.ts
|
|
5
5
|
var lookShape = {
|
|
6
6
|
pageRef,
|
|
7
7
|
view: z.enum([
|
|
@@ -28,5 +28,4 @@ var lookTool = defineTool({
|
|
|
28
28
|
return look.images.length > 0 ? imageResult(look.images, look.meta) : look.meta;
|
|
29
29
|
}
|
|
30
30
|
});
|
|
31
|
-
//#endregion
|
|
32
31
|
export { lookShape, lookTool };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { findActionEntry } from "../../../helpers/space.js";
|
|
2
1
|
import { actionUri, actionsUri } from "../../../helpers/uris.js";
|
|
3
2
|
import { empty, fail } from "../../../helpers/opResult.js";
|
|
3
|
+
import { findActionEntry } from "../../../helpers/space.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/actions/deleteAction.ts
|
|
6
6
|
var deleteActionOp = z.object({
|
|
7
7
|
type: z.literal("deleteAction"),
|
|
8
8
|
ref: z.string().describe("Identifier of the action to remove")
|
|
@@ -16,5 +16,4 @@ var deleteAction = (space, env, op) => {
|
|
|
16
16
|
staleResources: [actionsUri(env), actionUri(env, op.ref)]
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { deleteAction, deleteActionOp };
|
|
@@ -69,4 +69,6 @@ export declare const actionLimits: z.ZodObject<{
|
|
|
69
69
|
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
70
70
|
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
71
71
|
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
72
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
maxRunBytes: z.ZodOptional<z.ZodNumber>;
|
|
72
74
|
}, z.core.$strip>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
2
|
+
// src/modules/mcp/tools/operations/actions/document.ts
|
|
3
3
|
/**
|
|
4
4
|
* The shared vocabulary of an action document, as the agent writes it.
|
|
5
5
|
*
|
|
@@ -70,7 +70,8 @@ var actionLimits = z.object({
|
|
|
70
70
|
timeoutMs: z.number().optional(),
|
|
71
71
|
streamTimeoutMs: z.number().optional(),
|
|
72
72
|
maxNodes: z.number().optional(),
|
|
73
|
-
maxRequests: z.number().optional()
|
|
73
|
+
maxRequests: z.number().optional(),
|
|
74
|
+
maxResponseBytes: z.number().optional(),
|
|
75
|
+
maxRunBytes: z.number().optional()
|
|
74
76
|
}).describe("Ceilings for one run; may only TIGHTEN what the deployment allows");
|
|
75
|
-
//#endregion
|
|
76
77
|
export { actionAccess, actionField, actionLimits, actionNode, actionTriggerParams };
|
|
@@ -44,6 +44,8 @@ export declare const actionOps: {
|
|
|
44
44
|
streamTimeoutMs: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
45
45
|
maxNodes: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
46
46
|
maxRequests: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
47
|
+
maxResponseBytes: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
48
|
+
maxRunBytes: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
47
49
|
}, import('zod/v4/core').$strip>>;
|
|
48
50
|
}, import('zod/v4/core').$strip>;
|
|
49
51
|
patchAction: import('zod').ZodObject<{
|
|
@@ -87,6 +89,8 @@ export declare const actionOps: {
|
|
|
87
89
|
streamTimeoutMs: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
88
90
|
maxNodes: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
89
91
|
maxRequests: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
92
|
+
maxResponseBytes: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
93
|
+
maxRunBytes: import('zod').ZodOptional<import('zod').ZodNumber>;
|
|
90
94
|
}, import('zod/v4/core').$strip>>;
|
|
91
95
|
}, import('zod/v4/core').$strip>;
|
|
92
96
|
deleteAction: import('zod').ZodObject<{
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { deleteAction, deleteActionOp } from "./deleteAction.js";
|
|
2
2
|
import { patchAction, patchActionOp } from "./patchAction.js";
|
|
3
3
|
import { toDocument, upsertAction, upsertActionOp } from "./upsertAction.js";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/operations/actions/index.ts
|
|
5
5
|
/** The action write vocabulary, keyed by op type — feeds the discriminated union in tools/operations.ts. */
|
|
6
6
|
var actionOps = {
|
|
7
7
|
upsertAction: upsertActionOp,
|
|
8
8
|
patchAction: patchActionOp,
|
|
9
9
|
deleteAction: deleteActionOp
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { actionOps, deleteAction, deleteActionOp, patchAction, patchActionOp, toDocument, upsertAction, upsertActionOp };
|
|
@@ -42,6 +42,8 @@ export declare const patchActionOp: z.ZodObject<{
|
|
|
42
42
|
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
43
43
|
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
44
44
|
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
45
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
maxRunBytes: z.ZodOptional<z.ZodNumber>;
|
|
45
47
|
}, z.core.$strip>>;
|
|
46
48
|
}, z.core.$strip>;
|
|
47
49
|
export type PatchAction = z.infer<typeof patchActionOp>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { actionField, actionLimits, actionNode } from "./document.js";
|
|
2
2
|
import { actionUri, actionsUri } from "../../../helpers/uris.js";
|
|
3
3
|
import { empty, fail } from "../../../helpers/opResult.js";
|
|
4
|
-
import {
|
|
4
|
+
import { findActionEntry } from "../../../helpers/space.js";
|
|
5
5
|
import { validateActionDocument } from "@plitzi/sdk-shared/actions";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/actions/patchAction.ts
|
|
8
8
|
var patchActionOp = z.object({
|
|
9
9
|
type: z.literal("patchAction"),
|
|
10
10
|
ref: z.string().describe("Identifier of the action to change"),
|
|
@@ -67,5 +67,4 @@ var patchAction = (space, env, op) => {
|
|
|
67
67
|
staleResources: [actionsUri(env), actionUri(env, op.ref)]
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
//#endregion
|
|
71
70
|
export { patchAction, patchActionOp };
|
|
@@ -43,6 +43,8 @@ export declare const upsertActionOp: z.ZodObject<{
|
|
|
43
43
|
streamTimeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
44
44
|
maxNodes: z.ZodOptional<z.ZodNumber>;
|
|
45
45
|
maxRequests: z.ZodOptional<z.ZodNumber>;
|
|
46
|
+
maxResponseBytes: z.ZodOptional<z.ZodNumber>;
|
|
47
|
+
maxRunBytes: z.ZodOptional<z.ZodNumber>;
|
|
46
48
|
}, z.core.$strip>>;
|
|
47
49
|
}, z.core.$strip>;
|
|
48
50
|
export type UpsertAction = z.infer<typeof upsertActionOp>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { actionField, actionLimits, actionNode } from "./document.js";
|
|
2
2
|
import { actionUri, actionsUri } from "../../../helpers/uris.js";
|
|
3
3
|
import { empty, fail } from "../../../helpers/opResult.js";
|
|
4
|
-
import {
|
|
4
|
+
import { findActionEntry } from "../../../helpers/space.js";
|
|
5
5
|
import { validateActionDocument } from "@plitzi/sdk-shared/actions";
|
|
6
6
|
import { z } from "zod";
|
|
7
|
-
|
|
7
|
+
// src/modules/mcp/tools/operations/actions/upsertAction.ts
|
|
8
8
|
var upsertActionOp = z.object({
|
|
9
9
|
type: z.literal("upsertAction"),
|
|
10
10
|
ref: z.string().describe("Stable identifier a `runServerAction` step stores, e.g. \"send-quote\". Never reused for another action"),
|
|
@@ -79,5 +79,4 @@ var upsertAction = (space, env, op) => {
|
|
|
79
79
|
staleResources: stale
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
|
-
//#endregion
|
|
83
82
|
export { toDocument, upsertAction, upsertActionOp };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { closest } from "@plitzi/sdk-authoring";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
3
|
+
// src/modules/mcp/tools/operations/closed.ts
|
|
4
4
|
/**
|
|
5
5
|
* Objects of the write vocabulary that refuse a field they do not have. One left out of a schema used to be dropped as
|
|
6
6
|
* the batch was read — `prop` for `props` applied nothing and answered success, the one mistake an agent cannot see.
|
|
@@ -25,5 +25,4 @@ var closed = (operation) => {
|
|
|
25
25
|
const type = typeOf(operation);
|
|
26
26
|
return closedObject(type, operation.shape, `plitzi_describe_operation { type: "${type}" }`).describe(operation.description ?? "");
|
|
27
27
|
};
|
|
28
|
-
//#endregion
|
|
29
28
|
export { closed, closedObject, typeOf };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { findConnectorEntry } from "../../../helpers/space.js";
|
|
2
1
|
import { connectorUri, connectorsUri } from "../../../helpers/uris.js";
|
|
3
2
|
import { empty, fail } from "../../../helpers/opResult.js";
|
|
3
|
+
import { findConnectorEntry } from "../../../helpers/space.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
|
-
|
|
5
|
+
// src/modules/mcp/tools/operations/connectors/deleteConnector.ts
|
|
6
6
|
var deleteConnectorOp = z.object({
|
|
7
7
|
type: z.literal("deleteConnector"),
|
|
8
8
|
ref: z.string().describe("Identifier of the connector to remove")
|
|
@@ -16,5 +16,4 @@ var deleteConnector = (space, env, op) => {
|
|
|
16
16
|
staleResources: [connectorsUri(env), connectorUri(env, op.ref)]
|
|
17
17
|
};
|
|
18
18
|
};
|
|
19
|
-
//#endregion
|
|
20
19
|
export { deleteConnector, deleteConnectorOp };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { deleteConnector, deleteConnectorOp } from "./deleteConnector.js";
|
|
2
2
|
import { patchConnector, patchConnectorOp } from "./patchConnector.js";
|
|
3
3
|
import { toManifest, upsertConnector, upsertConnectorOp } from "./upsertConnector.js";
|
|
4
|
-
|
|
4
|
+
// src/modules/mcp/tools/operations/connectors/index.ts
|
|
5
5
|
/** The connector write vocabulary, keyed by op type — feeds the discriminated union in tools/operations.ts. */
|
|
6
6
|
var connectorOps = {
|
|
7
7
|
upsertConnector: upsertConnectorOp,
|
|
8
8
|
patchConnector: patchConnectorOp,
|
|
9
9
|
deleteConnector: deleteConnectorOp
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { connectorOps, deleteConnector, deleteConnectorOp, patchConnector, patchConnectorOp, toManifest, upsertConnector, upsertConnectorOp };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CONNECTOR_HTTP_METHODS } from "@plitzi/sdk-shared/connectors";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
|
|
3
|
+
// src/modules/mcp/tools/operations/connectors/manifest.ts
|
|
4
4
|
var templated = z.record(z.string(), z.string());
|
|
5
5
|
var pagination = z.enum([
|
|
6
6
|
"offset",
|
|
@@ -66,5 +66,4 @@ var connectorConnection = z.object({
|
|
|
66
66
|
])).optional().describe("Field types published to the builder for typed bindings. The only part a browser ever sees"),
|
|
67
67
|
projection: z.literal("full").optional().describe("Send every field instead of only the bound paths. Costs payload size; only for dynamic templates")
|
|
68
68
|
}).describe("Settings that apply to every call this connector makes");
|
|
69
|
-
//#endregion
|
|
70
69
|
export { connectorConnection, readEndpoint, writeEndpoint };
|