@plitzi/sdk-server 0.32.24 → 0.33.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 +22 -0
- package/README.md +326 -162
- package/dist/adapters/authAdapters.d.ts +21 -0
- package/dist/adapters/authAdapters.js +12 -0
- package/dist/adapters/jsonAdapters.d.ts +15 -0
- package/dist/adapters/jsonAdapters.js +9 -4
- package/dist/core/auth/api.d.ts +148 -0
- package/dist/core/auth/api.js +286 -0
- package/dist/core/auth/authorize.d.ts +96 -0
- package/dist/core/auth/authorize.js +92 -0
- package/dist/core/auth/createAuth.d.ts +165 -0
- package/dist/core/auth/createAuth.js +105 -0
- package/dist/core/auth/credentials.d.ts +29 -0
- package/dist/core/auth/credentials.js +48 -0
- package/dist/core/auth/domains.d.ts +41 -0
- package/dist/core/auth/domains.js +78 -0
- package/dist/core/auth/identity.d.ts +108 -0
- package/dist/core/auth/identity.js +164 -0
- package/dist/core/auth/oauth/client.d.ts +5 -0
- package/dist/core/auth/oauth/client.js +47 -0
- package/dist/core/auth/oauth/index.d.ts +78 -0
- package/dist/core/auth/oauth/index.js +113 -0
- package/dist/core/auth/oauth/providers/github.d.ts +2 -0
- package/dist/core/auth/oauth/providers/github.js +48 -0
- package/dist/core/auth/oauth/providers/google.d.ts +2 -0
- package/dist/core/auth/oauth/providers/google.js +30 -0
- package/dist/core/auth/oauth/state.d.ts +23 -0
- package/dist/core/auth/oauth/state.js +55 -0
- package/dist/core/auth/oauth/types.d.ts +51 -0
- package/dist/core/auth/oauth/types.js +13 -0
- package/dist/core/auth/routes.d.ts +50 -0
- package/dist/core/auth/routes.js +129 -0
- package/dist/core/auth/session.d.ts +128 -0
- package/dist/core/auth/session.js +165 -0
- package/dist/core/auth/spaceTokens.d.ts +137 -0
- package/dist/core/auth/spaceTokens.js +212 -0
- package/dist/core/auth/tokens.d.ts +151 -0
- package/dist/core/auth/tokens.js +221 -0
- package/dist/core/createServer.d.ts +29 -0
- package/dist/core/createServer.js +28 -14
- package/dist/core/handlers/authMiddleware.d.ts +27 -0
- package/dist/core/handlers/authMiddleware.js +38 -0
- package/dist/core/handlers/authRouteHandlers.d.ts +46 -0
- package/dist/core/handlers/authRouteHandlers.js +75 -0
- package/dist/core/handlers/types.d.ts +37 -0
- package/dist/{src/core → core}/http/dispatcher.d.ts +2 -2
- package/dist/core/http/dispatcher.js +8 -6
- package/dist/core/http/navigation.d.ts +11 -0
- package/dist/core/http/navigation.js +16 -0
- package/dist/core/http/securityHeaders.js +6 -4
- package/dist/core/http/stages/authApi.d.ts +17 -0
- package/dist/core/http/stages/authApi.js +66 -0
- package/dist/core/http/stages/authRoutes.js +40 -11
- package/dist/core/http/stages/exchangeRoute.d.ts +15 -0
- package/dist/core/http/stages/exchangeRoute.js +67 -0
- package/dist/core/http/stages/health.d.ts +11 -0
- package/dist/core/http/stages/health.js +25 -3
- package/dist/core/http/stages/middlewares.d.ts +2 -0
- package/dist/core/http/stages/static.d.ts +13 -0
- package/dist/core/http/stages/static.js +21 -6
- package/dist/core/http/types.d.ts +35 -0
- package/dist/{modules/mcp/constants.js → core/previewToken.js} +1 -1
- package/dist/core/sdkAssets.d.ts +16 -0
- package/dist/core/sdkAssets.js +46 -0
- package/dist/core/server/baseServer.js +40 -5
- package/dist/core/server/pageServer.d.ts +7 -0
- package/dist/core/server/pageServer.js +13 -17
- package/dist/core/services/action.d.ts +9 -0
- package/dist/core/services/action.js +21 -0
- package/dist/core/services/registry.d.ts +3 -0
- package/dist/core/services/registry.js +9 -19
- package/dist/{src/core → core}/services/resolve.d.ts +1 -0
- package/dist/core/services/resolve.js +6 -4
- package/dist/core/services/rsc.js +3 -2
- package/dist/core/staticFiles.js +1 -1
- package/dist/{src/core → core}/transports.d.ts +3 -0
- package/dist/core/transports.js +7 -6
- package/dist/handlers.d.ts +58 -0
- package/dist/handlers.js +3 -0
- package/dist/{src/helpers → helpers}/buildResponseHelpers.d.ts +2 -1
- package/dist/helpers/buildResponseHelpers.js +13 -4
- package/dist/helpers/buildServerInfo.d.ts +3 -0
- package/dist/helpers/buildServerInfo.js +25 -3
- package/dist/{src/helpers → helpers}/cache/keys.d.ts +5 -1
- package/dist/helpers/cache/keys.js +1 -1
- package/dist/helpers/compress.d.ts +18 -0
- package/dist/helpers/compress.js +47 -11
- package/dist/helpers/offlineDataLoader.d.ts +11 -0
- package/dist/helpers/offlineDataLoader.js +15 -0
- package/dist/helpers/resolveDebugMode.d.ts +10 -0
- package/dist/helpers/resolveDebugMode.js +13 -0
- package/dist/index.d.ts +16 -2
- package/dist/index.js +9 -20
- package/dist/kernel.d.ts +41 -0
- package/dist/kernel.js +22 -0
- package/dist/middlewares/spaceDeployment.d.ts +2 -0
- package/dist/middlewares/spaceDeployment.js +2 -1
- package/dist/modules/actions/handler.d.ts +11 -0
- package/dist/modules/actions/handler.js +77 -0
- package/dist/modules/connectors/engine.d.ts +42 -0
- package/dist/modules/connectors/engine.js +221 -0
- package/dist/modules/connectors/getByPath.d.ts +8 -0
- package/dist/modules/connectors/getByPath.js +21 -0
- package/dist/modules/connectors/index.d.ts +7 -0
- package/dist/modules/connectors/projection.d.ts +18 -0
- package/dist/modules/connectors/projection.js +108 -0
- package/dist/modules/connectors/resolver.d.ts +18 -0
- package/dist/modules/connectors/resolver.js +68 -0
- package/dist/modules/connectors/types.d.ts +19 -0
- package/dist/{src/modules → modules}/rsc/handler.d.ts +2 -2
- package/dist/modules/rsc/handler.js +54 -2
- package/dist/modules/rsc/resolveRscData.d.ts +35 -0
- package/dist/modules/rsc/resolveRscData.js +74 -0
- package/dist/{src/modules → modules}/ssr/Component.d.ts +4 -1
- package/dist/modules/ssr/Component.js +10 -3
- package/dist/modules/ssr/buildBody.d.ts +9 -0
- package/dist/modules/ssr/handler.d.ts +4 -0
- package/dist/modules/ssr/handler.js +18 -1
- package/dist/{src/modules → modules}/ssr/loadPluginComponents.d.ts +5 -2
- package/dist/modules/ssr/loadPluginComponents.js +20 -2
- package/dist/{src/modules → modules}/ssr/prepareRender.d.ts +2 -2
- package/dist/modules/ssr/prepareRender.js +24 -7
- package/dist/modules/ssr/preview.d.ts +10 -0
- package/dist/modules/ssr/preview.js +5 -78
- package/dist/modules/ssr/registerExternalPlugins.js +1 -1
- package/dist/modules/ssr/streamBody.d.ts +5 -0
- package/dist/modules/ssr/streamBody.js +1 -1
- package/dist/modules/ssr/template.d.ts +2 -0
- package/dist/modules/ssr/template.js +1 -1
- package/dist/plugins/compile.js +1 -1
- package/dist/plugins/manager.js +12 -8
- package/dist/ssr.d.ts +15 -0
- package/dist/ssr.js +4 -0
- package/package.json +29 -25
- package/dist/.gitkeep +0 -0
- package/dist/core/server/mcpServer.js +0 -29
- package/dist/core/services/mcp.js +0 -27
- package/dist/core/services/oauth.js +0 -116
- package/dist/core/services/preview.js +0 -37
- package/dist/core/services/proxy.js +0 -12
- package/dist/mcp.d.ts +0 -2
- package/dist/mcp.js +0 -7
- package/dist/modules/ai/AIEngine.js +0 -120
- package/dist/modules/ai/toolkit.js +0 -59
- package/dist/modules/mcp/apps/example/view/index.tsx +0 -70
- package/dist/modules/mcp/apps/index.js +0 -16
- package/dist/modules/mcp/apps/render/index.js +0 -17
- package/dist/modules/mcp/apps/render/styles.js +0 -54
- package/dist/modules/mcp/apps/render/view/heldBatch.ts +0 -107
- package/dist/modules/mcp/apps/render/view/index.tsx +0 -314
- package/dist/modules/mcp/apps/render/view/streamProgress.ts +0 -137
- package/dist/modules/mcp/apps/shared/assets.js +0 -10
- package/dist/modules/mcp/apps/shared/bundle.js +0 -23
- package/dist/modules/mcp/apps/shared/page.js +0 -34
- package/dist/modules/mcp/apps/shared/registerApp.js +0 -43
- package/dist/modules/mcp/apps/shared/resolve.js +0 -5
- package/dist/modules/mcp/apps/shared/shell.ejs +0 -59
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +0 -23
- package/dist/modules/mcp/catalogs/builtinCallbacks.js +0 -204
- package/dist/modules/mcp/catalogs/builtinComponents.js +0 -170
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +0 -50
- package/dist/modules/mcp/catalogs/builtinTransformers.js +0 -148
- package/dist/modules/mcp/catalogs/builtinUtilities.js +0 -90
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +0 -30
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +0 -31
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +0 -185
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +0 -131
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +0 -98
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +0 -144
- package/dist/modules/mcp/catalogs/observed.js +0 -90
- package/dist/modules/mcp/catalogs/paramSpec.js +0 -69
- package/dist/modules/mcp/catalogs/registry.js +0 -89
- package/dist/modules/mcp/handler.js +0 -83
- package/dist/modules/mcp/helpers/agentPrompt.js +0 -104
- package/dist/modules/mcp/helpers/computeVersion.js +0 -16
- package/dist/modules/mcp/helpers/guide.js +0 -467
- package/dist/modules/mcp/helpers/interactions.js +0 -123
- package/dist/modules/mcp/helpers/log.js +0 -64
- package/dist/modules/mcp/helpers/opResult.js +0 -18
- package/dist/modules/mcp/helpers/space.js +0 -300
- package/dist/modules/mcp/helpers/uris.js +0 -44
- package/dist/modules/mcp/previewClient.js +0 -31
- package/dist/modules/mcp/proxy/config.js +0 -46
- package/dist/modules/mcp/proxy/fetch.js +0 -91
- package/dist/modules/mcp/proxy/grant.js +0 -65
- package/dist/modules/mcp/proxy/guard.js +0 -38
- package/dist/modules/mcp/proxy/handler.js +0 -68
- package/dist/modules/mcp/proxy/rewrite.js +0 -72
- package/dist/modules/mcp/proxy/sign.js +0 -15
- package/dist/modules/mcp/proxy/types.js +0 -9
- package/dist/modules/mcp/resources/canonical.js +0 -30
- package/dist/modules/mcp/resources/core.js +0 -18
- package/dist/modules/mcp/resources/envelope.js +0 -14
- package/dist/modules/mcp/resources/primer.js +0 -31
- package/dist/modules/mcp/resources/register.js +0 -190
- package/dist/modules/mcp/resources/renderGuide.js +0 -451
- package/dist/modules/mcp/resources/router.js +0 -37
- package/dist/modules/mcp/resources/schema.js +0 -43
- package/dist/modules/mcp/resources/style.js +0 -34
- package/dist/modules/mcp/screenshotClient.js +0 -47
- package/dist/modules/mcp/server.js +0 -113
- package/dist/modules/mcp/tools/apply/dispatch.js +0 -105
- package/dist/modules/mcp/tools/apply/index.js +0 -150
- package/dist/modules/mcp/tools/apply/writeResult.js +0 -37
- package/dist/modules/mcp/tools/index.js +0 -24
- package/dist/modules/mcp/tools/operations/index.js +0 -45
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +0 -32
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +0 -36
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +0 -47
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +0 -29
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +0 -41
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +0 -58
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +0 -148
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +0 -65
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +0 -30
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +0 -49
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +0 -52
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +0 -47
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +0 -44
- package/dist/modules/mcp/tools/operations/schema/operations.js +0 -41
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +0 -25
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +0 -75
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +0 -45
- package/dist/modules/mcp/tools/operations/schema/shared.js +0 -122
- package/dist/modules/mcp/tools/operations/schema/translator.js +0 -215
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +0 -18
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +0 -42
- package/dist/modules/mcp/tools/operations/schema/write.js +0 -109
- package/dist/modules/mcp/tools/operations/schemaIds.js +0 -54
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +0 -21
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +0 -28
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +0 -24
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +0 -40
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +0 -21
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +0 -28
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +0 -24
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +0 -21
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +0 -28
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +0 -24
- package/dist/modules/mcp/tools/operations/style/operations.js +0 -29
- package/dist/modules/mcp/tools/operations/style/shared.js +0 -59
- package/dist/modules/mcp/tools/operations/style/translator.js +0 -101
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +0 -21
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +0 -22
- package/dist/modules/mcp/tools/operations/style/write.js +0 -108
- package/dist/modules/mcp/tools/preview.js +0 -37
- package/dist/modules/mcp/tools/read.js +0 -51
- package/dist/modules/mcp/tools/render.js +0 -184
- package/dist/modules/mcp/tools/screenshot.js +0 -83
- package/dist/modules/mcp/tools/search.js +0 -115
- package/dist/modules/mcp/tools/shared/expandOperations.js +0 -44
- package/dist/modules/mcp/tools/shared/tool.js +0 -33
- package/dist/modules/mcp/tools/shared/validator/audit.js +0 -124
- package/dist/modules/mcp/tools/shared/validator/batch.js +0 -39
- package/dist/modules/mcp/tools/shared/validator/bindings.js +0 -70
- package/dist/modules/mcp/tools/shared/validator/context.js +0 -35
- package/dist/modules/mcp/tools/shared/validator/css.js +0 -39
- package/dist/modules/mcp/tools/shared/validator/elements.js +0 -68
- package/dist/modules/mcp/tools/shared/validator/index.js +0 -246
- package/dist/modules/mcp/tools/shared/validator/interactions.js +0 -103
- package/dist/modules/mcp/tools/shared/validator/refs.js +0 -28
- package/dist/modules/mcp/tools/validate.js +0 -47
- package/dist/modules/oauth/authorize.js +0 -177
- package/dist/modules/oauth/challenge.js +0 -33
- package/dist/modules/oauth/consentPage.js +0 -118
- package/dist/modules/oauth/metadata.js +0 -69
- package/dist/modules/oauth/params.js +0 -5
- package/dist/modules/oauth/pkce.js +0 -15
- package/dist/modules/oauth/records.js +0 -46
- package/dist/modules/oauth/register.js +0 -55
- package/dist/modules/oauth/respond.js +0 -44
- package/dist/modules/oauth/token.js +0 -100
- package/dist/public/.gitkeep +0 -0
- package/dist/src/adapters/jsonAdapters.d.ts +0 -7
- package/dist/src/core/createServer.d.ts +0 -14
- package/dist/src/core/http/stages/health.d.ts +0 -2
- package/dist/src/core/http/stages/middlewares.d.ts +0 -2
- package/dist/src/core/http/stages/static.d.ts +0 -5
- package/dist/src/core/http/types.d.ts +0 -22
- package/dist/src/core/server/mcpServer.d.ts +0 -2
- package/dist/src/core/server/pageServer.d.ts +0 -10
- package/dist/src/core/services/mcp.d.ts +0 -3
- package/dist/src/core/services/oauth.d.ts +0 -18
- package/dist/src/core/services/preview.d.ts +0 -2
- package/dist/src/core/services/proxy.d.ts +0 -2
- package/dist/src/core/services/registry.d.ts +0 -4
- package/dist/src/helpers/buildServerInfo.d.ts +0 -2
- package/dist/src/helpers/compress.d.ts +0 -3
- package/dist/src/index.d.ts +0 -15
- package/dist/src/mcp.d.ts +0 -14
- package/dist/src/middlewares/spaceDeployment.d.ts +0 -2
- package/dist/src/modules/ai/AIEngine.d.ts +0 -20
- package/dist/src/modules/ai/index.d.ts +0 -4
- package/dist/src/modules/ai/toolkit.d.ts +0 -17
- package/dist/src/modules/mcp/apps/example/index.d.ts +0 -8
- package/dist/src/modules/mcp/apps/index.d.ts +0 -11
- package/dist/src/modules/mcp/apps/render/index.d.ts +0 -4
- package/dist/src/modules/mcp/apps/render/styles.d.ts +0 -10
- package/dist/src/modules/mcp/apps/shared/assets.d.ts +0 -10
- package/dist/src/modules/mcp/apps/shared/bundle.d.ts +0 -4
- package/dist/src/modules/mcp/apps/shared/index.d.ts +0 -3
- package/dist/src/modules/mcp/apps/shared/page.d.ts +0 -2
- package/dist/src/modules/mcp/apps/shared/registerApp.d.ts +0 -5
- package/dist/src/modules/mcp/apps/shared/resolve.d.ts +0 -1
- package/dist/src/modules/mcp/apps/shared/zodEnglishOnly.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/builtinCallbacks.d.ts +0 -23
- package/dist/src/modules/mcp/catalogs/builtinComponents.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/builtinElementCallbacks.d.ts +0 -20
- package/dist/src/modules/mcp/catalogs/builtinTransformers.d.ts +0 -28
- package/dist/src/modules/mcp/catalogs/builtinUtilities.d.ts +0 -18
- package/dist/src/modules/mcp/catalogs/cssCatalog/border.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/cssCatalog/box.d.ts +0 -4
- package/dist/src/modules/mcp/catalogs/cssCatalog/helpers.d.ts +0 -34
- package/dist/src/modules/mcp/catalogs/cssCatalog/index.d.ts +0 -19
- package/dist/src/modules/mcp/catalogs/cssCatalog/layout.d.ts +0 -9
- package/dist/src/modules/mcp/catalogs/cssCatalog/visual.d.ts +0 -8
- package/dist/src/modules/mcp/catalogs/index.d.ts +0 -9
- package/dist/src/modules/mcp/catalogs/observed.d.ts +0 -48
- package/dist/src/modules/mcp/catalogs/paramSpec.d.ts +0 -42
- package/dist/src/modules/mcp/catalogs/registry.d.ts +0 -35
- package/dist/src/modules/mcp/e2e/index.d.ts +0 -6
- package/dist/src/modules/mcp/e2e/mcpEndpoint.d.ts +0 -27
- package/dist/src/modules/mcp/e2e/postMessageChannel.d.ts +0 -22
- package/dist/src/modules/mcp/e2e/renderingHost.d.ts +0 -34
- package/dist/src/modules/mcp/handler.d.ts +0 -22
- package/dist/src/modules/mcp/helpers/agentPrompt.d.ts +0 -4
- package/dist/src/modules/mcp/helpers/computeVersion.d.ts +0 -1
- package/dist/src/modules/mcp/helpers/guide.d.ts +0 -4
- package/dist/src/modules/mcp/helpers/index.d.ts +0 -8
- package/dist/src/modules/mcp/helpers/interactions.d.ts +0 -30
- package/dist/src/modules/mcp/helpers/log.d.ts +0 -8
- package/dist/src/modules/mcp/helpers/opResult.d.ts +0 -13
- package/dist/src/modules/mcp/helpers/space.d.ts +0 -115
- package/dist/src/modules/mcp/helpers/uris.d.ts +0 -28
- package/dist/src/modules/mcp/index.d.ts +0 -13
- package/dist/src/modules/mcp/previewClient.d.ts +0 -13
- package/dist/src/modules/mcp/proxy/config.d.ts +0 -17
- package/dist/src/modules/mcp/proxy/fetch.d.ts +0 -18
- package/dist/src/modules/mcp/proxy/grant.d.ts +0 -23
- package/dist/src/modules/mcp/proxy/guard.d.ts +0 -6
- package/dist/src/modules/mcp/proxy/handler.d.ts +0 -8
- package/dist/src/modules/mcp/proxy/index.d.ts +0 -7
- package/dist/src/modules/mcp/proxy/rewrite.d.ts +0 -13
- package/dist/src/modules/mcp/proxy/sign.d.ts +0 -6
- package/dist/src/modules/mcp/proxy/types.d.ts +0 -45
- package/dist/src/modules/mcp/resources/canonical.d.ts +0 -6
- package/dist/src/modules/mcp/resources/core.d.ts +0 -5
- package/dist/src/modules/mcp/resources/envelope.d.ts +0 -10
- package/dist/src/modules/mcp/resources/index.d.ts +0 -8
- package/dist/src/modules/mcp/resources/primer.d.ts +0 -7
- package/dist/src/modules/mcp/resources/register.d.ts +0 -10
- package/dist/src/modules/mcp/resources/renderGuide.d.ts +0 -10
- package/dist/src/modules/mcp/resources/router.d.ts +0 -10
- package/dist/src/modules/mcp/resources/schema.d.ts +0 -5
- package/dist/src/modules/mcp/resources/style.d.ts +0 -5
- package/dist/src/modules/mcp/screenshotClient.d.ts +0 -13
- package/dist/src/modules/mcp/server.d.ts +0 -31
- package/dist/src/modules/mcp/tests/helpers.d.ts +0 -13
- package/dist/src/modules/mcp/tools/apply/dispatch.d.ts +0 -6
- package/dist/src/modules/mcp/tools/apply/index.d.ts +0 -470
- package/dist/src/modules/mcp/tools/apply/writeResult.d.ts +0 -8
- package/dist/src/modules/mcp/tools/index.d.ts +0 -18
- package/dist/src/modules/mcp/tools/operations/index.d.ts +0 -928
- package/dist/src/modules/mcp/tools/operations/schema/bindings/deleteBinding.d.ts +0 -17
- package/dist/src/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +0 -25
- package/dist/src/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +0 -27
- package/dist/src/modules/mcp/tools/operations/schema/elements/deleteElement.d.ts +0 -10
- package/dist/src/modules/mcp/tools/operations/schema/elements/moveElement.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +0 -22
- package/dist/src/modules/mcp/tools/operations/schema/elements/repeatElement.d.ts +0 -55
- package/dist/src/modules/mcp/tools/operations/schema/elements/upsertElement.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/folders/deleteFolder.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/folders/upsertFolder.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/index.d.ts +0 -21
- package/dist/src/modules/mcp/tools/operations/schema/interactions/deleteInteraction.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +0 -18
- package/dist/src/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +0 -27
- package/dist/src/modules/mcp/tools/operations/schema/operations.d.ts +0 -229
- package/dist/src/modules/mcp/tools/operations/schema/pages/deletePage.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +0 -14
- package/dist/src/modules/mcp/tools/operations/schema/settings/patchSettings.d.ts +0 -34
- package/dist/src/modules/mcp/tools/operations/schema/shared.d.ts +0 -92
- package/dist/src/modules/mcp/tools/operations/schema/translator.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/schema/variables/deleteVariable.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/schema/variables/upsertVariable.d.ts +0 -16
- package/dist/src/modules/mcp/tools/operations/schema/write.d.ts +0 -42
- package/dist/src/modules/mcp/tools/operations/schemaIds.d.ts +0 -6
- package/dist/src/modules/mcp/tools/operations/style/definitions/deleteDefinition.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/definitions/patchDefinition.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/definitions/upsertDefinition.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/definitions/upsertDefinitions.d.ts +0 -41
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.d.ts +0 -9
- package/dist/src/modules/mcp/tools/operations/style/idStyles/patchIdStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.d.ts +0 -37
- package/dist/src/modules/mcp/tools/operations/style/index.d.ts +0 -15
- package/dist/src/modules/mcp/tools/operations/style/operations.d.ts +0 -264
- package/dist/src/modules/mcp/tools/operations/style/shared.d.ts +0 -116
- package/dist/src/modules/mcp/tools/operations/style/translator.d.ts +0 -12
- package/dist/src/modules/mcp/tools/operations/style/variables/deleteStyleVariable.d.ts +0 -15
- package/dist/src/modules/mcp/tools/operations/style/variables/upsertStyleVariable.d.ts +0 -20
- package/dist/src/modules/mcp/tools/operations/style/write.d.ts +0 -12
- package/dist/src/modules/mcp/tools/preview.d.ts +0 -465
- package/dist/src/modules/mcp/tools/read.d.ts +0 -9
- package/dist/src/modules/mcp/tools/render.d.ts +0 -499
- package/dist/src/modules/mcp/tools/render.test.d.ts +0 -1
- package/dist/src/modules/mcp/tools/screenshot.d.ts +0 -470
- package/dist/src/modules/mcp/tools/search.d.ts +0 -15
- package/dist/src/modules/mcp/tools/shared/expandOperations.d.ts +0 -13
- package/dist/src/modules/mcp/tools/shared/tool.d.ts +0 -72
- package/dist/src/modules/mcp/tools/shared/validator/audit.d.ts +0 -4
- package/dist/src/modules/mcp/tools/shared/validator/batch.d.ts +0 -5
- package/dist/src/modules/mcp/tools/shared/validator/bindings.d.ts +0 -6
- package/dist/src/modules/mcp/tools/shared/validator/context.d.ts +0 -38
- package/dist/src/modules/mcp/tools/shared/validator/css.d.ts +0 -4
- package/dist/src/modules/mcp/tools/shared/validator/elements.d.ts +0 -7
- package/dist/src/modules/mcp/tools/shared/validator/index.d.ts +0 -8
- package/dist/src/modules/mcp/tools/shared/validator/interactions.d.ts +0 -3
- package/dist/src/modules/mcp/tools/shared/validator/refs.d.ts +0 -4
- package/dist/src/modules/mcp/tools/validate.d.ts +0 -467
- package/dist/src/modules/mcp/types/aiSchema.d.ts +0 -218
- package/dist/src/modules/mcp/types/appTypes.d.ts +0 -26
- package/dist/src/modules/mcp/types/index.d.ts +0 -5
- package/dist/src/modules/mcp/types/previewTypes.d.ts +0 -25
- package/dist/src/modules/mcp/types/screenshotTypes.d.ts +0 -29
- package/dist/src/modules/mcp/types/toolTypes.d.ts +0 -138
- package/dist/src/modules/oauth/authorize.d.ts +0 -7
- package/dist/src/modules/oauth/challenge.d.ts +0 -11
- package/dist/src/modules/oauth/consentPage.d.ts +0 -7
- package/dist/src/modules/oauth/metadata.d.ts +0 -40
- package/dist/src/modules/oauth/params.d.ts +0 -5
- package/dist/src/modules/oauth/pkce.d.ts +0 -6
- package/dist/src/modules/oauth/records.d.ts +0 -71
- package/dist/src/modules/oauth/register.d.ts +0 -5
- package/dist/src/modules/oauth/respond.d.ts +0 -13
- package/dist/src/modules/oauth/token.d.ts +0 -5
- package/dist/src/modules/ssr/buildBody.d.ts +0 -9
- package/dist/src/modules/ssr/handler.d.ts +0 -4
- package/dist/src/modules/ssr/preview.d.ts +0 -16
- package/dist/src/modules/ssr/streamBody.d.ts +0 -5
- package/dist/src/modules/ssr/template.d.ts +0 -6
- package/dist/src/standalone/alias-loader.d.mts +0 -2
- package/dist/src/standalone/plugins/ClientInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/ServerInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/SharedInfo.d.ts +0 -2
- package/dist/src/standalone/plugins/styles.d.ts +0 -5
- package/dist/src/standalone/register-alias.d.mts +0 -1
- package/dist/src/standalone/server.d.ts +0 -1
- package/dist/src/standalone/stubs/react-syntax-highlighter.d.mts +0 -31
- package/skills/plitzi-render/SKILL.md +0 -174
- /package/dist/{src/core/http/dispatcher.test.d.ts → core/auth/api.test.d.ts} +0 -0
- /package/dist/{src/core/server/mcpServer.test.d.ts → core/auth/authorize.test.d.ts} +0 -0
- /package/dist/{src/modules/ai/toolkit.test.d.ts → core/auth/createAuth.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/apps/apps.test.d.ts → core/auth/domains.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/apps/render/styles.test.d.ts → core/auth/identity.test.d.ts} +0 -0
- /package/dist/{src/modules → core/auth}/oauth/oauth.test.d.ts +0 -0
- /package/dist/{src/modules/mcp/catalogs/builtinTransformers.test.d.ts → core/auth/routes.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/catalogs/cssCatalog/cssCatalog.test.d.ts → core/auth/session.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/connector.test.d.ts → core/auth/spaceTokens.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/host.test.d.ts → core/auth/tokens.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/e2e/oauthConnector.test.d.ts → core/createServer.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/helpers/log.test.d.ts → core/handlers/handlers.test.d.ts} +0 -0
- /package/dist/{src/core → core}/health.d.ts +0 -0
- /package/dist/{src/modules/mcp/mcp.bench.d.ts → core/http/dispatcher.test.d.ts} +0 -0
- /package/dist/{src/core → core}/http/securityHeaders.d.ts +0 -0
- /package/dist/{src/core → core}/http/stages/authRoutes.d.ts +0 -0
- /package/dist/{src/core → core}/http/stages/pluginAssets.d.ts +0 -0
- /package/dist/{src/core → core}/mimeTypes.d.ts +0 -0
- /package/dist/{src/modules/mcp/constants.d.ts → core/previewToken.d.ts} +0 -0
- /package/dist/{src/core → core}/requestParser.d.ts +0 -0
- /package/dist/{src/core → core}/server/baseServer.d.ts +0 -0
- /package/dist/{src/modules/mcp/proxy/endpoint.test.d.ts → core/server/baseServer.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/proxy/proxy.test.d.ts → core/services/resolve.test.d.ts} +0 -0
- /package/dist/{src/core → core}/services/rsc.d.ts +0 -0
- /package/dist/{src/core → core}/services/ssr.d.ts +0 -0
- /package/dist/{src/core → core}/staticFiles.d.ts +0 -0
- /package/dist/{src/modules/mcp/proxy/wiring.test.d.ts → helpers/buildResponseHelpers.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/cache/TtlCache.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/cacheManager.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/defaults.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/cache/index.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/apply.test.d.ts → helpers/cache/keys.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/cache/serverCaches.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/bindings.test.d.ts → helpers/compress.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/escapeJson.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/metrics.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/normalizePlugins.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/css.test.d.ts → helpers/offlineDataLoader.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/readCookie.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/interactions.test.d.ts → helpers/resolveDebugMode.test.d.ts} +0 -0
- /package/dist/{src/helpers → helpers}/runMiddlewares.d.ts +0 -0
- /package/dist/{src/helpers → helpers}/serverLog.d.ts +0 -0
- /package/dist/{src/middlewares → middlewares}/auth.d.ts +0 -0
- /package/dist/{src/middlewares → middlewares}/basicAuth.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/pages.test.d.ts → middlewares/spaceDeployment.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/reads.test.d.ts → modules/actions/handler.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/schemaIds.test.d.ts → modules/connectors/engine.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/search.test.d.ts → modules/connectors/projection.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/skill.test.d.ts → modules/connectors/resolver.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/styles.test.d.ts → modules/rsc/resolveRscData.test.d.ts} +0 -0
- /package/dist/{src/modules → modules}/ssr/applySSRResult.d.ts +0 -0
- /package/dist/{src/modules/mcp/tests/tools.test.d.ts → modules/ssr/loadPluginComponents.test.d.ts} +0 -0
- /package/dist/{src/modules/mcp/tests/validation.test.d.ts → modules/ssr/metering.test.d.ts} +0 -0
- /package/dist/{src/modules → modules}/ssr/registerExternalPlugins.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/compile.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/copy.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/detect.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/manager.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/validate.d.ts +0 -0
- /package/dist/{src/plugins → plugins}/validate.test.d.ts +0 -0
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { settingsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
//#region src/modules/mcp/tools/operations/schema/settings/patchSettings.ts
|
|
5
|
-
var userProvider = z.enum([
|
|
6
|
-
"auth0",
|
|
7
|
-
"basic",
|
|
8
|
-
"custom",
|
|
9
|
-
""
|
|
10
|
-
]);
|
|
11
|
-
var storage = z.enum([
|
|
12
|
-
"localStorage",
|
|
13
|
-
"sessionStorage",
|
|
14
|
-
""
|
|
15
|
-
]);
|
|
16
|
-
var patchSettingsOp = z.object({
|
|
17
|
-
type: z.literal("patchSettings"),
|
|
18
|
-
customCss: z.string().optional().describe("Raw global CSS for the whole space (keyframes, @font-face, resets)"),
|
|
19
|
-
keepState: z.boolean().optional().describe("Persist element state across reloads"),
|
|
20
|
-
stateStorage: z.enum(["localStorage", "sessionStorage"]).optional(),
|
|
21
|
-
userProvider: userProvider.optional().describe("Auth provider; \"\" disables authentication"),
|
|
22
|
-
auth0Domain: z.string().optional(),
|
|
23
|
-
auth0ClientId: z.string().optional(),
|
|
24
|
-
tokenStorage: storage.optional(),
|
|
25
|
-
loginUrl: z.string().optional(),
|
|
26
|
-
userUrl: z.string().optional(),
|
|
27
|
-
refreshUrl: z.string().optional(),
|
|
28
|
-
logoutUrl: z.string().optional(),
|
|
29
|
-
detailsPath: z.string().optional(),
|
|
30
|
-
tokenPath: z.string().optional(),
|
|
31
|
-
expirationTimePath: z.string().optional()
|
|
32
|
-
}).describe("Merge space-level settings: the global CSS (customCss) and the state/auth (user-provider) configuration. Only the fields you pass change; the rest are preserved. Use customCss for site-wide CSS, never to style one element (attach a definition for that).");
|
|
33
|
-
var patchSettings = (space, env, op) => {
|
|
34
|
-
const { type, ...patch } = op;
|
|
35
|
-
const next = { ...space.schema.settings };
|
|
36
|
-
for (const [key, value] of Object.entries(patch)) next[key] = value;
|
|
37
|
-
space.schema.settings = next;
|
|
38
|
-
return {
|
|
39
|
-
...empty(),
|
|
40
|
-
updated: 1,
|
|
41
|
-
staleResources: [settingsUri(env)]
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
//#endregion
|
|
45
|
-
export { patchSettings, patchSettingsOp };
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
//#region src/modules/mcp/tools/operations/schema/shared.ts
|
|
3
|
-
var combinator = z.enum(["and", "or"]);
|
|
4
|
-
var operator = z.enum([
|
|
5
|
-
"",
|
|
6
|
-
"=",
|
|
7
|
-
"!=",
|
|
8
|
-
"<",
|
|
9
|
-
">",
|
|
10
|
-
"<=",
|
|
11
|
-
">=",
|
|
12
|
-
"contains",
|
|
13
|
-
"doesNotContain",
|
|
14
|
-
"beginsWith",
|
|
15
|
-
"doesNotBeginWith",
|
|
16
|
-
"endsWith",
|
|
17
|
-
"doesNotEndWith",
|
|
18
|
-
"empty",
|
|
19
|
-
"notEmpty",
|
|
20
|
-
"in",
|
|
21
|
-
"notIn",
|
|
22
|
-
"between",
|
|
23
|
-
"notBetween"
|
|
24
|
-
]);
|
|
25
|
-
var ruleValue = z.union([
|
|
26
|
-
z.string(),
|
|
27
|
-
z.number(),
|
|
28
|
-
z.boolean(),
|
|
29
|
-
z.null(),
|
|
30
|
-
z.record(z.string(), z.unknown()),
|
|
31
|
-
z.array(z.unknown())
|
|
32
|
-
]);
|
|
33
|
-
var ruleBase = {
|
|
34
|
-
id: z.string().optional(),
|
|
35
|
-
field: z.string().describe("The data field the rule tests"),
|
|
36
|
-
operator,
|
|
37
|
-
enabled: z.boolean().optional()
|
|
38
|
-
};
|
|
39
|
-
var rule = z.union([z.object({
|
|
40
|
-
...ruleBase,
|
|
41
|
-
isBinding: z.literal(true),
|
|
42
|
-
value: z.string()
|
|
43
|
-
}), z.object({
|
|
44
|
-
...ruleBase,
|
|
45
|
-
isBinding: z.literal(false).optional(),
|
|
46
|
-
value: ruleValue
|
|
47
|
-
})]);
|
|
48
|
-
var ruleGroup = z.lazy(() => z.object({
|
|
49
|
-
id: z.string().optional(),
|
|
50
|
-
combinator,
|
|
51
|
-
rules: z.array(z.union([rule, ruleGroup])),
|
|
52
|
-
enabled: z.boolean().optional()
|
|
53
|
-
}));
|
|
54
|
-
var styleRefs = z.object({
|
|
55
|
-
base: z.array(z.string()).optional(),
|
|
56
|
-
slots: z.record(z.string(), z.array(z.string())).optional()
|
|
57
|
-
});
|
|
58
|
-
var styleVariantInput = z.record(z.string(), z.record(z.string(), z.union([z.string(), z.array(z.string())])));
|
|
59
|
-
var initialStateInput = z.object({
|
|
60
|
-
styleVariant: styleVariantInput.optional().describe("Variant each attached class uses: { className: { base|slot: variantName | [names] } }"),
|
|
61
|
-
visibility: z.boolean().optional().describe("Initial visibility of the element")
|
|
62
|
-
});
|
|
63
|
-
var elementShape = {
|
|
64
|
-
ref: z.string().describe("Semantic id you choose, or an existing element ref/id. On a new element it becomes the idRef everything addresses it by: its data source is `<type>_<ref>`, and interactions target it by this ref. Letters, digits, `-` and `_`, starting with a letter — a dot would break the `<type>_<idRef>.<field>` grammar. Unique across the space."),
|
|
65
|
-
type: z.string().describe("Type from plitzi://types"),
|
|
66
|
-
label: z.string().optional(),
|
|
67
|
-
subType: z.string().optional(),
|
|
68
|
-
props: z.record(z.string(), z.unknown()).optional().describe("Full replacement on update"),
|
|
69
|
-
style: styleRefs.optional().describe("Definition refs per slot; style the element by attaching a definition"),
|
|
70
|
-
initialState: initialStateInput.optional().describe("Applied style variant(s) and initial visibility (see plitzi://guide styling)")
|
|
71
|
-
};
|
|
72
|
-
var elementInput = z.lazy(() => z.object({
|
|
73
|
-
...elementShape,
|
|
74
|
-
children: z.array(elementInput).optional()
|
|
75
|
-
}));
|
|
76
|
-
var position = z.enum([
|
|
77
|
-
"inside",
|
|
78
|
-
"before",
|
|
79
|
-
"after"
|
|
80
|
-
]).describe("Placement relative to the anchor: \"inside\" nests it as a child (default), \"before\"/\"after\" as a sibling");
|
|
81
|
-
var scalar = z.union([
|
|
82
|
-
z.string(),
|
|
83
|
-
z.number(),
|
|
84
|
-
z.boolean()
|
|
85
|
-
]);
|
|
86
|
-
var bindingCategory = z.enum([
|
|
87
|
-
"attributes",
|
|
88
|
-
"style",
|
|
89
|
-
"initialState"
|
|
90
|
-
]).describe("What the value feeds: a prop (attributes), a style value (style), or an initialState key");
|
|
91
|
-
var bindingTransformer = z.object({
|
|
92
|
-
action: z.string().describe("Transformer action name"),
|
|
93
|
-
params: z.record(z.string(), z.string()),
|
|
94
|
-
enabled: z.boolean().optional().describe("Set false to keep the transformer in the chain but skip it at runtime (defaults to true)")
|
|
95
|
-
});
|
|
96
|
-
var bindingInput = z.object({
|
|
97
|
-
to: z.string().describe("Target field the value feeds (a prop key, style value, or initialState key)"),
|
|
98
|
-
source: z.string().describe("Data source path, e.g. \"apiContainer_x.data\" — see plitzi://data-sources"),
|
|
99
|
-
id: z.string().optional().describe("Stable binding id; generated when omitted"),
|
|
100
|
-
transformers: z.array(bindingTransformer).optional(),
|
|
101
|
-
when: ruleGroup.optional().describe("QueryBuilder RuleGroup gating the binding (validated structurally)"),
|
|
102
|
-
enabled: z.boolean().optional()
|
|
103
|
-
});
|
|
104
|
-
var interactionNodeType = z.enum([
|
|
105
|
-
"trigger",
|
|
106
|
-
"globalCallback",
|
|
107
|
-
"callback",
|
|
108
|
-
"utility"
|
|
109
|
-
]).describe("trigger starts a flow (must be first); the rest run in order after it");
|
|
110
|
-
var interactionNode = z.object({
|
|
111
|
-
id: z.string().optional().describe("Existing node id to preserve; generated when omitted"),
|
|
112
|
-
title: z.string().describe("Human label for the step"),
|
|
113
|
-
nodeType: interactionNodeType,
|
|
114
|
-
action: z.string().describe("Action name, e.g. \"onClick\", \"login\" — see plitzi://interactions"),
|
|
115
|
-
params: z.record(z.string(), z.unknown()).optional(),
|
|
116
|
-
enabled: z.boolean().optional(),
|
|
117
|
-
when: ruleGroup.optional().describe("QueryBuilder RuleGroup gating this step (validated structurally)"),
|
|
118
|
-
elementId: z.string().optional().describe("Element whose callback this step invokes; defaults to this element. Its ref or raw id — a raw id is normalised to the idRef the runtime looks callbacks up by, and a target without one is given it."),
|
|
119
|
-
preview: z.record(z.string(), z.unknown()).optional()
|
|
120
|
-
});
|
|
121
|
-
//#endregion
|
|
122
|
-
export { bindingCategory, bindingInput, elementInput, elementShape, initialStateInput, interactionNode, interactionNodeType, position, ruleGroup, scalar, styleRefs, styleVariantInput };
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import { computeVersion } from "../../../helpers/computeVersion.js";
|
|
2
|
-
import { descendantCount, descendantIds, elementById, elementRefOf, getPageElements, isPageElement, nameOf, orderedChildren, pageFoldersOf, pageRefOf, pageRefOfElement, slugRouteParams, spaceIndex, strOr } from "../../../helpers/space.js";
|
|
3
|
-
import { bindingsToAI, flowsFromInteractions } from "../../../helpers/interactions.js";
|
|
4
|
-
import { definitionToAI, globalStylesForType, idStyleToAI } from "../style/translator.js";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/schema/translator.ts
|
|
6
|
-
var splitClasses = (value) => value ? value.split(/\s+/).filter(Boolean) : [];
|
|
7
|
-
var propsOf = (el) => {
|
|
8
|
-
const { subType, ...rest } = el.attributes;
|
|
9
|
-
return Object.keys(rest).length > 0 ? rest : void 0;
|
|
10
|
-
};
|
|
11
|
-
var slotClasses = (selectors) => {
|
|
12
|
-
const slots = {};
|
|
13
|
-
for (const [slot, classes] of Object.entries(selectors)) if (slot !== "base") slots[slot] = splitClasses(classes);
|
|
14
|
-
return slots;
|
|
15
|
-
};
|
|
16
|
-
var pageSummariesToAI = (schema) => getPageElements(schema).map((page) => ({
|
|
17
|
-
ref: pageRefOf(page),
|
|
18
|
-
label: nameOf(page),
|
|
19
|
-
slug: strOr(page.attributes.slug) ?? "",
|
|
20
|
-
default: page.attributes.default === true,
|
|
21
|
-
enabled: page.attributes.enabled !== false,
|
|
22
|
-
folder: strOr(page.attributes.folder) || void 0,
|
|
23
|
-
elementCount: descendantCount(schema, page.id)
|
|
24
|
-
}));
|
|
25
|
-
var folderToAI = (folder) => ({
|
|
26
|
-
ref: folder.id,
|
|
27
|
-
name: folder.name,
|
|
28
|
-
slug: folder.slug,
|
|
29
|
-
parentId: folder.parentId
|
|
30
|
-
});
|
|
31
|
-
var foldersToAI = (schema) => pageFoldersOf(schema).map(folderToAI);
|
|
32
|
-
var folderRefToAI = (schema, ref) => {
|
|
33
|
-
const folder = pageFoldersOf(schema).find((f) => f.id === ref);
|
|
34
|
-
return folder ? folderToAI(folder) : void 0;
|
|
35
|
-
};
|
|
36
|
-
var elementView = (schema, el, style) => {
|
|
37
|
-
const cache = spaceIndex(schema).detailCache;
|
|
38
|
-
const cached = cache.get(el.id);
|
|
39
|
-
if (cached && cached.style === style) return cached;
|
|
40
|
-
const detail = elementDetailToAI(schema, el, style);
|
|
41
|
-
const view = {
|
|
42
|
-
style,
|
|
43
|
-
detail,
|
|
44
|
-
version: computeVersion(detail)
|
|
45
|
-
};
|
|
46
|
-
cache.set(el.id, view);
|
|
47
|
-
return view;
|
|
48
|
-
};
|
|
49
|
-
var skeletonNode = (schema, el, style) => {
|
|
50
|
-
const children = orderedChildren(schema, el);
|
|
51
|
-
const base = splitClasses(el.definition.styleSelectors.base);
|
|
52
|
-
const slots = slotClasses(el.definition.styleSelectors);
|
|
53
|
-
return {
|
|
54
|
-
ref: elementRefOf(el),
|
|
55
|
-
type: el.definition.type,
|
|
56
|
-
label: el.definition.label,
|
|
57
|
-
subType: strOr(el.attributes.subType),
|
|
58
|
-
stateVersion: style ? elementView(schema, el, style).version : void 0,
|
|
59
|
-
base: base.length > 0 ? base : void 0,
|
|
60
|
-
slots: Object.keys(slots).length > 0 ? slots : void 0,
|
|
61
|
-
childCount: children.length,
|
|
62
|
-
children: children.length > 0 ? children.map((child) => skeletonNode(schema, child, style)) : void 0
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
var pageSkeletonToAI = (schema, pageEl, style) => {
|
|
66
|
-
const slug = strOr(pageEl.attributes.slug) ?? "";
|
|
67
|
-
return {
|
|
68
|
-
ref: pageRefOf(pageEl),
|
|
69
|
-
label: nameOf(pageEl),
|
|
70
|
-
slug,
|
|
71
|
-
default: pageEl.attributes.default === true,
|
|
72
|
-
enabled: pageEl.attributes.enabled !== false,
|
|
73
|
-
routeParams: slugRouteParams(slug),
|
|
74
|
-
tree: orderedChildren(schema, pageEl).map((child) => skeletonNode(schema, child, style))
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
var elementClassRefs = (el) => {
|
|
78
|
-
const refs = splitClasses(el.definition.styleSelectors.base);
|
|
79
|
-
for (const classes of Object.values(slotClasses(el.definition.styleSelectors))) refs.push(...classes);
|
|
80
|
-
return refs;
|
|
81
|
-
};
|
|
82
|
-
var pageStylesToAI = (schema, style, pageEl) => {
|
|
83
|
-
const classRefs = /* @__PURE__ */ new Set();
|
|
84
|
-
const types = /* @__PURE__ */ new Set();
|
|
85
|
-
const collect = (el) => {
|
|
86
|
-
for (const ref of elementClassRefs(el)) classRefs.add(ref);
|
|
87
|
-
types.add(el.definition.type);
|
|
88
|
-
};
|
|
89
|
-
collect(pageEl);
|
|
90
|
-
for (const id of descendantIds(schema, pageEl.id)) {
|
|
91
|
-
const el = elementById(schema, id);
|
|
92
|
-
if (el) collect(el);
|
|
93
|
-
}
|
|
94
|
-
const definitions = [];
|
|
95
|
-
for (const ref of Array.from(classRefs).sort()) {
|
|
96
|
-
const def = definitionToAI(style, ref);
|
|
97
|
-
if (def) definitions.push(def);
|
|
98
|
-
}
|
|
99
|
-
const globalStyles = [];
|
|
100
|
-
const seenGlobals = /* @__PURE__ */ new Set();
|
|
101
|
-
for (const type of Array.from(types).sort()) for (const global of globalStylesForType(style, type)) if (!seenGlobals.has(global.ref)) {
|
|
102
|
-
seenGlobals.add(global.ref);
|
|
103
|
-
globalStyles.push(global);
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
ref: pageRefOf(pageEl),
|
|
107
|
-
definitions,
|
|
108
|
-
globalStyles
|
|
109
|
-
};
|
|
110
|
-
};
|
|
111
|
-
var resolveDefinitions = (style, base, slots) => {
|
|
112
|
-
const refs = new Set(base);
|
|
113
|
-
for (const classes of Object.values(slots)) for (const cls of classes) refs.add(cls);
|
|
114
|
-
const resolved = {};
|
|
115
|
-
for (const ref of refs) {
|
|
116
|
-
const def = definitionToAI(style, ref);
|
|
117
|
-
if (def) resolved[ref] = def;
|
|
118
|
-
}
|
|
119
|
-
return Object.keys(resolved).length > 0 ? resolved : void 0;
|
|
120
|
-
};
|
|
121
|
-
var variantNamesOf = (def) => {
|
|
122
|
-
const names = new Set(Object.keys(def.variants ?? {}));
|
|
123
|
-
for (const slot of Object.values(def.slots ?? {})) for (const name of Object.keys(slot.variants ?? {})) names.add(name);
|
|
124
|
-
return [...names].sort();
|
|
125
|
-
};
|
|
126
|
-
var availableVariantsFrom = (resolvedStyle) => {
|
|
127
|
-
if (!resolvedStyle) return;
|
|
128
|
-
const result = {};
|
|
129
|
-
for (const [ref, def] of Object.entries(resolvedStyle)) {
|
|
130
|
-
const names = variantNamesOf(def);
|
|
131
|
-
if (names.length > 0) result[ref] = names;
|
|
132
|
-
}
|
|
133
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
134
|
-
};
|
|
135
|
-
var initialStateToAI = (el) => {
|
|
136
|
-
const initialState = el.definition.initialState;
|
|
137
|
-
if (!initialState) return;
|
|
138
|
-
const result = {};
|
|
139
|
-
if (initialState.styleVariant) {
|
|
140
|
-
const styleVariant = {};
|
|
141
|
-
for (const [cls, selectors] of Object.entries(initialState.styleVariant)) {
|
|
142
|
-
if (!selectors) continue;
|
|
143
|
-
const bySelector = {};
|
|
144
|
-
for (const [selector, variant] of Object.entries(selectors)) if (variant !== void 0) bySelector[selector] = variant;
|
|
145
|
-
if (Object.keys(bySelector).length > 0) styleVariant[cls] = bySelector;
|
|
146
|
-
}
|
|
147
|
-
if (Object.keys(styleVariant).length > 0) result.styleVariant = styleVariant;
|
|
148
|
-
}
|
|
149
|
-
if (typeof initialState.visibility === "boolean") result.visibility = initialState.visibility;
|
|
150
|
-
return Object.keys(result).length > 0 ? result : void 0;
|
|
151
|
-
};
|
|
152
|
-
var elementDetailToAI = (schema, el, style) => {
|
|
153
|
-
const children = orderedChildren(schema, el);
|
|
154
|
-
const parent = el.definition.parentId ? schema.flat[el.definition.parentId] : void 0;
|
|
155
|
-
const base = splitClasses(el.definition.styleSelectors.base);
|
|
156
|
-
const slots = slotClasses(el.definition.styleSelectors);
|
|
157
|
-
const detail = {
|
|
158
|
-
ref: elementRefOf(el),
|
|
159
|
-
type: el.definition.type,
|
|
160
|
-
subType: strOr(el.attributes.subType),
|
|
161
|
-
label: el.definition.label,
|
|
162
|
-
pageRef: pageRefOfElement(schema, el),
|
|
163
|
-
parentRef: parent ? isPageElement(schema, parent) ? pageRefOf(parent) : elementRefOf(parent) : void 0,
|
|
164
|
-
props: propsOf(el),
|
|
165
|
-
style: {
|
|
166
|
-
base,
|
|
167
|
-
slots
|
|
168
|
-
},
|
|
169
|
-
childRefs: children.length > 0 ? children.map(elementRefOf) : void 0
|
|
170
|
-
};
|
|
171
|
-
const initialState = initialStateToAI(el);
|
|
172
|
-
if (initialState) detail.initialState = initialState;
|
|
173
|
-
const bindings = bindingsToAI(el.definition.bindings);
|
|
174
|
-
if (bindings) detail.bindings = bindings;
|
|
175
|
-
const interactions = flowsFromInteractions(el.definition.interactions);
|
|
176
|
-
if (interactions.length > 0) detail.interactions = interactions;
|
|
177
|
-
if (style) {
|
|
178
|
-
const resolvedStyle = resolveDefinitions(style, base, slots);
|
|
179
|
-
if (resolvedStyle) {
|
|
180
|
-
detail.resolvedStyle = resolvedStyle;
|
|
181
|
-
const availableVariants = availableVariantsFrom(resolvedStyle);
|
|
182
|
-
if (availableVariants) detail.availableVariants = availableVariants;
|
|
183
|
-
}
|
|
184
|
-
const globalStyles = globalStylesForType(style, el.definition.type);
|
|
185
|
-
if (globalStyles.length > 0) detail.globalStyles = globalStyles;
|
|
186
|
-
const domId = strOr(el.attributes.id);
|
|
187
|
-
if (domId) {
|
|
188
|
-
const idStyle = idStyleToAI(style, domId);
|
|
189
|
-
if (idStyle) detail.idStyle = idStyle;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
return detail;
|
|
193
|
-
};
|
|
194
|
-
var schemaVariablesToAI = (schema, includeSubValues = true) => {
|
|
195
|
-
const data = {};
|
|
196
|
-
for (const variable of schema.variables) data[variable.name] = {
|
|
197
|
-
name: variable.name,
|
|
198
|
-
reference: `{{${variable.name}}}`,
|
|
199
|
-
category: variable.category,
|
|
200
|
-
type: variable.type,
|
|
201
|
-
value: variable.value,
|
|
202
|
-
subValues: includeSubValues ? variable.subValues.map((sv) => ({
|
|
203
|
-
when: sv.when,
|
|
204
|
-
value: sv.value
|
|
205
|
-
})) : void 0
|
|
206
|
-
};
|
|
207
|
-
return data;
|
|
208
|
-
};
|
|
209
|
-
var settingsToAI = (schema) => {
|
|
210
|
-
const result = {};
|
|
211
|
-
for (const [key, value] of Object.entries(schema.settings)) result[key] = value;
|
|
212
|
-
return result;
|
|
213
|
-
};
|
|
214
|
-
//#endregion
|
|
215
|
-
export { elementDetailToAI, elementView, folderRefToAI, foldersToAI, pageSkeletonToAI, pageStylesToAI, pageSummariesToAI, schemaVariablesToAI, settingsToAI };
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { schemaVarsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
//#region src/modules/mcp/tools/operations/schema/variables/deleteVariable.ts
|
|
5
|
-
var deleteVariableOp = z.object({
|
|
6
|
-
type: z.literal("deleteVariable"),
|
|
7
|
-
name: z.string().describe("Name of the schema variable to delete")
|
|
8
|
-
}).describe("Delete a space-level schema variable by name.");
|
|
9
|
-
var deleteVariable = (space, env, op) => {
|
|
10
|
-
space.schema.variables = space.schema.variables.filter((v) => v.name !== op.name);
|
|
11
|
-
return {
|
|
12
|
-
...empty(),
|
|
13
|
-
deleted: 1,
|
|
14
|
-
staleResources: [schemaVarsUri(env)]
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
//#endregion
|
|
18
|
-
export { deleteVariable, deleteVariableOp };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { schemaVarsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { scalar } from "../shared.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/schema/variables/upsertVariable.ts
|
|
6
|
-
var upsertVariableOp = z.object({
|
|
7
|
-
type: z.literal("upsertVariable"),
|
|
8
|
-
name: z.string().describe("Variable name; referenced in content as {{name}}"),
|
|
9
|
-
variableType: z.string().describe("Runtime type (text|number|...); NOT the `type` discriminator"),
|
|
10
|
-
value: scalar,
|
|
11
|
-
category: z.string().optional(),
|
|
12
|
-
subValues: z.array(z.object({
|
|
13
|
-
when: z.unknown(),
|
|
14
|
-
value: scalar
|
|
15
|
-
})).optional()
|
|
16
|
-
}).describe("Create or update a space-level schema variable (a {{name}} value shared across the space).");
|
|
17
|
-
var upsertVariable = (space, env, op) => {
|
|
18
|
-
const variable = {
|
|
19
|
-
name: op.name,
|
|
20
|
-
category: op.category ?? "general",
|
|
21
|
-
type: op.variableType,
|
|
22
|
-
value: op.value,
|
|
23
|
-
subValues: op.subValues ?? []
|
|
24
|
-
};
|
|
25
|
-
const idx = space.schema.variables.findIndex((v) => v.name === op.name);
|
|
26
|
-
if (idx >= 0) {
|
|
27
|
-
space.schema.variables[idx] = variable;
|
|
28
|
-
return {
|
|
29
|
-
...empty(),
|
|
30
|
-
updated: 1,
|
|
31
|
-
staleResources: [schemaVarsUri(env)]
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
space.schema.variables.push(variable);
|
|
35
|
-
return {
|
|
36
|
-
...empty(),
|
|
37
|
-
created: 1,
|
|
38
|
-
staleResources: [schemaVarsUri(env)]
|
|
39
|
-
};
|
|
40
|
-
};
|
|
41
|
-
//#endregion
|
|
42
|
-
export { upsertVariable, upsertVariableOp };
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { findElementByRef, findPageByRef, generateObjectId, indexAddElement, indexReRefElement, resolveRef, spaceIndex } from "../../../helpers/space.js";
|
|
2
|
-
import { folderUri, foldersUri, pageUri, pagesUri, schemaVarsUri, settingsUri } from "../../../helpers/uris.js";
|
|
3
|
-
import { fail } from "../../../helpers/opResult.js";
|
|
4
|
-
import { isValidIdRef, makeIdRef } from "@plitzi/sdk-schema/helpers/idRef";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/schema/write.ts
|
|
6
|
-
var ID_REF_HINT = "Start with a letter, then letters, numbers, hyphens and underscores (e.g. \"hero-cta\" or \"food_item\"). The ref becomes the element idRef, which the runtime embeds in source names like `apiContainer_<idRef>.field` and in interaction targets — a dot would split those paths (an underscore is fine: the FIRST `_` separates the type from the idRef, and element types carry none, so extra underscores are unambiguous).";
|
|
7
|
-
var TAKEN_HINT = "An idRef must be unique across the space — pick a different ref, or address the existing element by this ref.";
|
|
8
|
-
/** Every ref in an element input tree (the element plus its nested children) — each becomes a new element's idRef. */
|
|
9
|
-
var collectInputRefs = (input) => [input.ref, ...(input.children ?? []).flatMap(collectInputRefs)];
|
|
10
|
-
/** Validate a ref that is about to become an element's idRef: the charset, then whether anything already answers
|
|
11
|
-
* to it. The charset rule is sdk-schema's `isValidIdRef` — never a regex restated here, so the MCP cannot drift
|
|
12
|
-
* from what the builder and the schema validator enforce.
|
|
13
|
-
*
|
|
14
|
-
* Uniqueness is checked with the ref lookups rather than `FlatMap.idRefConflict`, and deliberately so: these are
|
|
15
|
-
* a superset of it. FlatMap asks whether another element holds this idRef; the MCP must also refuse a ref that
|
|
16
|
-
* shadows a raw id or a page slug, because its handlers resolve refs through those too — calling both would just
|
|
17
|
-
* run the same rule twice. Null when the ref is usable.
|
|
18
|
-
*
|
|
19
|
-
* Enforced here, at every point a ref BECOMES an idRef — addressing an existing element by its raw id is not
|
|
20
|
-
* charset-checked, which is why the validator cannot simply tighten its own REF_RE for every ref it sees. */
|
|
21
|
-
var guardNewRef = (space, ref, field) => {
|
|
22
|
-
if (!isValidIdRef(ref)) return fail(field, `"${ref}" is not a valid idRef`, ID_REF_HINT);
|
|
23
|
-
if (findElementByRef(space.schema, ref) || findPageByRef(space.schema, ref)) return fail(field, `"${ref}" is already used by another element in this space`, TAKEN_HINT);
|
|
24
|
-
return null;
|
|
25
|
-
};
|
|
26
|
-
var removeFromParent = (space, child) => {
|
|
27
|
-
const parent = child.definition.parentId ? space.schema.flat[child.definition.parentId] : void 0;
|
|
28
|
-
if (parent?.definition.items) parent.definition.items = parent.definition.items.filter((id) => id !== child.id);
|
|
29
|
-
};
|
|
30
|
-
var placeChild = (parent, childId, index) => {
|
|
31
|
-
const items = parent.definition.items ?? (parent.definition.items = []);
|
|
32
|
-
if (index === void 0 || index < 0 || index >= items.length) items.push(childId);
|
|
33
|
-
else items.splice(index, 0, childId);
|
|
34
|
-
};
|
|
35
|
-
var writeInitialState = (el, input, merge) => {
|
|
36
|
-
const current = el.definition.initialState ?? {};
|
|
37
|
-
const next = { ...current };
|
|
38
|
-
if (input.styleVariant !== void 0) if (merge) {
|
|
39
|
-
const merged = { ...current.styleVariant };
|
|
40
|
-
for (const [cls, selectors] of Object.entries(input.styleVariant)) merged[cls] = {
|
|
41
|
-
...merged[cls],
|
|
42
|
-
...selectors
|
|
43
|
-
};
|
|
44
|
-
next.styleVariant = merged;
|
|
45
|
-
} else next.styleVariant = input.styleVariant;
|
|
46
|
-
if (input.visibility !== void 0) next.visibility = input.visibility;
|
|
47
|
-
el.definition.initialState = next;
|
|
48
|
-
};
|
|
49
|
-
var createElement = (space, page, input, parent, index) => {
|
|
50
|
-
const id = generateObjectId();
|
|
51
|
-
const { subType, ...props } = {
|
|
52
|
-
subType: input.subType,
|
|
53
|
-
...input.props
|
|
54
|
-
};
|
|
55
|
-
const styleSelectors = { base: (input.style?.base ?? []).join(" ") };
|
|
56
|
-
for (const [slot, classes] of Object.entries(input.style?.slots ?? {})) styleSelectors[slot] = classes.join(" ");
|
|
57
|
-
const el = {
|
|
58
|
-
id,
|
|
59
|
-
idRef: input.ref,
|
|
60
|
-
attributes: subType === void 0 ? props : {
|
|
61
|
-
subType,
|
|
62
|
-
...props
|
|
63
|
-
},
|
|
64
|
-
definition: {
|
|
65
|
-
rootId: page.id,
|
|
66
|
-
parentId: parent.id,
|
|
67
|
-
label: input.label ?? input.ref,
|
|
68
|
-
type: input.type,
|
|
69
|
-
items: [],
|
|
70
|
-
styleSelectors
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
space.schema.flat[id] = el;
|
|
74
|
-
placeChild(parent, id, index);
|
|
75
|
-
indexAddElement(space.schema, el, page.id);
|
|
76
|
-
if (input.initialState) writeInitialState(el, input.initialState, false);
|
|
77
|
-
for (const child of input.children ?? []) createElement(space, page, child, el, void 0);
|
|
78
|
-
};
|
|
79
|
-
/** The idRef an element is wired by, minting one when it has none. Interactions are keyed by idRef, so an element
|
|
80
|
-
* that is about to host or be targeted by a flow must have one — rather than make the agent assign it with a
|
|
81
|
-
* separate patchElement, the MCP gives it a free `<type>-<n>` ref (unique across the space) and proceeds. An
|
|
82
|
-
* element that already has an idRef keeps it. Mutates the element in place and returns the ref. */
|
|
83
|
-
var ensureIdRef = (space, el) => {
|
|
84
|
-
if (el.idRef) return el.idRef;
|
|
85
|
-
const index = spaceIndex(space.schema);
|
|
86
|
-
el.idRef = makeIdRef(el.definition.type, (candidate) => index.elementByRef.has(candidate) || index.pageByRef.has(candidate));
|
|
87
|
-
indexReRefElement(space.schema, el);
|
|
88
|
-
return el.idRef;
|
|
89
|
-
};
|
|
90
|
-
/** The key an interaction node must store to reach a target element. Every ref field also accepts a raw id, so a
|
|
91
|
-
* target given as an id is resolved to the element's idRef — the key the runtime registers callbacks under. A
|
|
92
|
-
* target that has no idRef is given one (see `ensureIdRef`), since it must be reachable to be wired to. A target
|
|
93
|
-
* that resolves to no element is left as written — it is already a ref, or a key only a plugin knows. */
|
|
94
|
-
var resolveTargetRef = (space, elementId) => {
|
|
95
|
-
const el = space.schema.flat[elementId] ?? findElementByRef(space.schema, elementId);
|
|
96
|
-
return el ? ensureIdRef(space, el) : elementId;
|
|
97
|
-
};
|
|
98
|
-
/** Resolve a non-page element within a page for the element-scoped ops (bindings, interactions). Returns the
|
|
99
|
-
* element, or a teachable OpResult when the page or element ref does not resolve — so each op reports the same
|
|
100
|
-
* errors as patchElement without repeating them. */
|
|
101
|
-
var resolveElement = (space, env, pageRef, ref) => {
|
|
102
|
-
const page = findPageByRef(space.schema, pageRef);
|
|
103
|
-
if (!page) return { error: fail("pageRef", `Page "${pageRef}" not found`, `Read plitzi://schema/${env}/pages for valid refs`) };
|
|
104
|
-
const el = resolveRef(space.schema, page, ref);
|
|
105
|
-
if (!el || el.id === page.id) return { error: fail("ref", `Element "${ref}" not found in page "${pageRef}"`, "Use an existing element ref or id") };
|
|
106
|
-
return { el };
|
|
107
|
-
};
|
|
108
|
-
//#endregion
|
|
109
|
-
export { ID_REF_HINT, collectInputRefs, createElement, ensureIdRef, folderUri, foldersUri, guardNewRef, pageUri, pagesUri, placeChild, removeFromParent, resolveElement, resolveTargetRef, schemaVarsUri, settingsUri, writeInitialState };
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { bindingInput, elementInput, initialStateInput, interactionNode, position, ruleGroup, styleRefs, styleVariantInput } from "./schema/shared.js";
|
|
2
|
-
import { cssMap, cssPatchMap, definitionSlot, definitionSlotPatch, displayModeCss, displayModeCssPatch, themeValue } from "./style/shared.js";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
//#region src/modules/mcp/tools/operations/schemaIds.ts
|
|
5
|
-
/** The op union is the tool input of plitzi_apply, plitzi_validate, plitzi_render AND plitzi_preview, and every
|
|
6
|
-
* host reads it as JSON Schema on tools/list — four copies of the same 30 operations in the model's context, on
|
|
7
|
-
* EVERY request of every conversation the server is connected to. It measured ~25k tokens PER TOOL (~100k in
|
|
8
|
-
* total), which dwarfs anything a widget payload ever costs.
|
|
9
|
-
*
|
|
10
|
-
* Most of that weight is one subschema pasted over and over: an element tree appears in upsertElement,
|
|
11
|
-
* patchElement and both repeat templates; a breakpoint CSS block in every style op; a rule group in every binding
|
|
12
|
-
* and interaction step. Zod emits a named `definitions` entry (and `$ref`s to it) for any schema carrying an `id`
|
|
13
|
-
* in the global registry, so registering the shared ones here collapses those copies — without touching the ops,
|
|
14
|
-
* the tools, or the MCP SDK, whose own converter honours the registry (it is given no options otherwise).
|
|
15
|
-
*
|
|
16
|
-
* An id only pays when the schema is REUSED: giving one to a subschema that appears once makes the listing bigger,
|
|
17
|
-
* because the `definitions` entry and the ref cost more than the single copy they replace (measured, and reverted).
|
|
18
|
-
*
|
|
19
|
-
* The ids are the names the MODEL reads in the refs, so they are written for it: `Element`, not `ElementInput`.
|
|
20
|
-
* This runs once, at module load of the op vocabulary, so every conversion path benefits — the MCP tools list and
|
|
21
|
-
* the co-worker's own tool-schema converter alike. */
|
|
22
|
-
var SHARED_SCHEMAS = [
|
|
23
|
-
[elementInput, "Element"],
|
|
24
|
-
[ruleGroup, "RuleGroup"],
|
|
25
|
-
[styleRefs, "StyleRefs"],
|
|
26
|
-
[initialStateInput, "InitialState"],
|
|
27
|
-
[styleVariantInput, "StyleVariant"],
|
|
28
|
-
[interactionNode, "InteractionNode"],
|
|
29
|
-
[bindingInput, "Binding"],
|
|
30
|
-
[position, "Position"],
|
|
31
|
-
[cssMap, "Css"],
|
|
32
|
-
[cssPatchMap, "CssPatch"],
|
|
33
|
-
[definitionSlot, "StyleSlot"],
|
|
34
|
-
[definitionSlotPatch, "StyleSlotPatch"],
|
|
35
|
-
[displayModeCss, "BreakpointCss"],
|
|
36
|
-
[displayModeCssPatch, "BreakpointCssPatch"],
|
|
37
|
-
[themeValue, "ThemeValue"]
|
|
38
|
-
];
|
|
39
|
-
var claimSchemaId = (schema, id) => {
|
|
40
|
-
const taken = z.globalRegistry._idmap.get(id);
|
|
41
|
-
if (taken !== void 0 && taken !== schema) {
|
|
42
|
-
z.globalRegistry.add(schema, { id: `Plitzi${id}` });
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
z.globalRegistry.add(schema, { id });
|
|
46
|
-
};
|
|
47
|
-
/** Idempotent: the module can be imported more than once in a test run, and a schema that already carries its id
|
|
48
|
-
* is left alone (re-adding the same one is harmless but pointless). Runs at module load, never per request — the
|
|
49
|
-
* MCP builds a server per request and this must not grow with them (pinned in the statelessness test). */
|
|
50
|
-
var registerSharedSchemaIds = () => {
|
|
51
|
-
for (const [schema, id] of SHARED_SCHEMAS) if (z.globalRegistry.get(schema)?.id === void 0) claimSchemaId(schema, id);
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
54
|
-
export { claimSchemaId, registerSharedSchemaIds };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defUri, defsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { MODES, guardKind } from "../write.js";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
//#region src/modules/mcp/tools/operations/style/definitions/deleteDefinition.ts
|
|
6
|
-
var deleteDefinitionOp = z.object({
|
|
7
|
-
type: z.literal("deleteDefinition"),
|
|
8
|
-
ref: z.string().describe("Class ref of the definition to delete")
|
|
9
|
-
}).describe("Delete a style class definition by ref (does not detach it from elements that still list it).");
|
|
10
|
-
var deleteDefinition = (space, env, op) => {
|
|
11
|
-
const guard = guardKind(space.style, op.ref, "class");
|
|
12
|
-
if (guard) return guard;
|
|
13
|
-
for (const mode of MODES) Reflect.deleteProperty(space.style.platform[mode], op.ref);
|
|
14
|
-
return {
|
|
15
|
-
...empty(),
|
|
16
|
-
deleted: 1,
|
|
17
|
-
staleResources: [defUri(env, op.ref), defsUri(env)]
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
//#endregion
|
|
21
|
-
export { deleteDefinition, deleteDefinitionOp };
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { defUri, defsUri } from "../../../../helpers/uris.js";
|
|
2
|
-
import { empty, fail } from "../../../../helpers/opResult.js";
|
|
3
|
-
import { definitionToAI } from "../translator.js";
|
|
4
|
-
import { patchCssShape } from "../shared.js";
|
|
5
|
-
import { guardKind, mergePatch, writeStyleItem } from "../write.js";
|
|
6
|
-
import { z } from "zod";
|
|
7
|
-
//#region src/modules/mcp/tools/operations/style/definitions/patchDefinition.ts
|
|
8
|
-
var patchDefinitionOp = z.object({
|
|
9
|
-
type: z.literal("patchDefinition"),
|
|
10
|
-
ref: z.string().describe("Existing class ref to patch"),
|
|
11
|
-
...patchCssShape
|
|
12
|
-
}).describe("Partially update an existing style class: the CSS you pass is merged (a null value removes that property, others are kept). Never creates — use upsertDefinition for that.");
|
|
13
|
-
var patchDefinition = (space, env, op) => {
|
|
14
|
-
const guard = guardKind(space.style, op.ref, "class");
|
|
15
|
-
if (guard) return guard;
|
|
16
|
-
const existing = definitionToAI(space.style, op.ref);
|
|
17
|
-
if (!existing) return fail("ref", `Definition "${op.ref}" not found`, "patchDefinition only updates an existing definition; use upsertDefinition to create one");
|
|
18
|
-
const { type, ref, slots: slotsPatch, ...basePatch } = op;
|
|
19
|
-
const { base, slots } = mergePatch(existing, basePatch, slotsPatch);
|
|
20
|
-
writeStyleItem(space.style, ref, base, slots, "class", void 0);
|
|
21
|
-
return {
|
|
22
|
-
...empty(),
|
|
23
|
-
updated: 1,
|
|
24
|
-
staleResources: [defUri(env, ref), defsUri(env)]
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
//#endregion
|
|
28
|
-
export { patchDefinition, patchDefinitionOp };
|