@plitzi/sdk-mcp 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 +15 -0
- package/README.md +175 -0
- package/dist/createServer.d.ts +11 -0
- package/dist/createServer.js +36 -0
- package/dist/createServer.test.d.ts +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.js +21 -0
- package/dist/modules/ai/AIEngine.d.ts +20 -0
- package/dist/modules/ai/AIEngine.js +120 -0
- package/dist/modules/ai/index.d.ts +4 -0
- package/dist/modules/ai/toolkit.d.ts +17 -0
- package/dist/modules/ai/toolkit.js +59 -0
- package/dist/modules/ai/toolkit.test.d.ts +1 -0
- package/dist/modules/mcp/apps/apps.test.d.ts +1 -0
- package/dist/modules/mcp/apps/example/index.d.ts +8 -0
- package/dist/modules/mcp/apps/example/view/index.tsx +70 -0
- package/dist/modules/mcp/apps/index.d.ts +11 -0
- package/dist/modules/mcp/apps/index.js +16 -0
- package/dist/modules/mcp/apps/render/index.d.ts +4 -0
- package/dist/modules/mcp/apps/render/index.js +17 -0
- package/dist/modules/mcp/apps/render/styles.d.ts +10 -0
- package/dist/modules/mcp/apps/render/styles.js +54 -0
- package/dist/modules/mcp/apps/render/styles.test.d.ts +1 -0
- package/dist/modules/mcp/apps/render/view/heldBatch.ts +107 -0
- package/dist/modules/mcp/apps/render/view/index.tsx +314 -0
- package/dist/modules/mcp/apps/render/view/streamProgress.ts +137 -0
- package/dist/modules/mcp/apps/shared/assets.d.ts +10 -0
- package/dist/modules/mcp/apps/shared/assets.js +10 -0
- package/dist/modules/mcp/apps/shared/bundle.d.ts +4 -0
- package/dist/modules/mcp/apps/shared/bundle.js +23 -0
- package/dist/modules/mcp/apps/shared/index.d.ts +3 -0
- package/dist/modules/mcp/apps/shared/page.d.ts +2 -0
- package/dist/modules/mcp/apps/shared/page.js +34 -0
- package/dist/modules/mcp/apps/shared/registerApp.d.ts +5 -0
- package/dist/modules/mcp/apps/shared/registerApp.js +43 -0
- package/dist/modules/mcp/apps/shared/resolve.d.ts +1 -0
- package/dist/modules/mcp/apps/shared/resolve.js +5 -0
- package/dist/modules/mcp/apps/shared/shell.ejs +59 -0
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.d.ts +4 -0
- package/dist/modules/mcp/apps/shared/zodEnglishOnly.js +23 -0
- package/dist/modules/mcp/catalogs/builtinCallbacks.d.ts +19 -0
- package/dist/modules/mcp/catalogs/builtinCallbacks.js +139 -0
- package/dist/modules/mcp/catalogs/builtinComponents.d.ts +4 -0
- package/dist/modules/mcp/catalogs/builtinComponents.js +165 -0
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.d.ts +17 -0
- package/dist/modules/mcp/catalogs/builtinElementCallbacks.js +50 -0
- package/dist/modules/mcp/catalogs/builtinTransformers.d.ts +28 -0
- package/dist/modules/mcp/catalogs/builtinTransformers.js +148 -0
- package/dist/modules/mcp/catalogs/builtinTransformers.test.d.ts +1 -0
- package/dist/modules/mcp/catalogs/builtinUtilities.d.ts +15 -0
- package/dist/modules/mcp/catalogs/builtinUtilities.js +90 -0
- package/dist/modules/mcp/catalogs/cssCatalog/border.d.ts +4 -0
- package/dist/modules/mcp/catalogs/cssCatalog/border.js +30 -0
- package/dist/modules/mcp/catalogs/cssCatalog/box.d.ts +4 -0
- package/dist/modules/mcp/catalogs/cssCatalog/box.js +31 -0
- package/dist/modules/mcp/catalogs/cssCatalog/cssCatalog.test.d.ts +1 -0
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.d.ts +34 -0
- package/dist/modules/mcp/catalogs/cssCatalog/helpers.js +185 -0
- package/dist/modules/mcp/catalogs/cssCatalog/index.d.ts +18 -0
- package/dist/modules/mcp/catalogs/cssCatalog/index.js +131 -0
- package/dist/modules/mcp/catalogs/cssCatalog/layout.d.ts +9 -0
- package/dist/modules/mcp/catalogs/cssCatalog/layout.js +99 -0
- package/dist/modules/mcp/catalogs/cssCatalog/visual.d.ts +8 -0
- package/dist/modules/mcp/catalogs/cssCatalog/visual.js +147 -0
- package/dist/modules/mcp/catalogs/index.d.ts +9 -0
- package/dist/modules/mcp/catalogs/observed.d.ts +46 -0
- package/dist/modules/mcp/catalogs/observed.js +90 -0
- package/dist/modules/mcp/catalogs/paramSpec.d.ts +39 -0
- package/dist/modules/mcp/catalogs/paramSpec.js +69 -0
- package/dist/modules/mcp/catalogs/registry.d.ts +35 -0
- package/dist/modules/mcp/catalogs/registry.js +89 -0
- package/dist/modules/mcp/e2e/connector.test.d.ts +1 -0
- package/dist/modules/mcp/e2e/host.test.d.ts +1 -0
- package/dist/modules/mcp/e2e/index.d.ts +6 -0
- package/dist/modules/mcp/e2e/mcpEndpoint.d.ts +27 -0
- package/dist/modules/mcp/e2e/oauthConnector.test.d.ts +1 -0
- package/dist/modules/mcp/e2e/postMessageChannel.d.ts +22 -0
- package/dist/modules/mcp/e2e/renderingHost.d.ts +39 -0
- package/dist/modules/mcp/handler.d.ts +22 -0
- package/dist/modules/mcp/handler.js +83 -0
- package/dist/modules/mcp/helpers/agentPrompt.d.ts +4 -0
- package/dist/modules/mcp/helpers/agentPrompt.js +104 -0
- package/dist/modules/mcp/helpers/computeVersion.d.ts +1 -0
- package/dist/modules/mcp/helpers/computeVersion.js +16 -0
- package/dist/modules/mcp/helpers/guide.d.ts +4 -0
- package/dist/modules/mcp/helpers/guide.js +608 -0
- package/dist/modules/mcp/helpers/index.d.ts +8 -0
- package/dist/modules/mcp/helpers/interactions.d.ts +30 -0
- package/dist/modules/mcp/helpers/interactions.js +123 -0
- package/dist/modules/mcp/helpers/log.d.ts +8 -0
- package/dist/modules/mcp/helpers/log.js +64 -0
- package/dist/modules/mcp/helpers/log.test.d.ts +1 -0
- package/dist/modules/mcp/helpers/opResult.d.ts +13 -0
- package/dist/modules/mcp/helpers/opResult.js +18 -0
- package/dist/modules/mcp/helpers/space.d.ts +126 -0
- package/dist/modules/mcp/helpers/space.js +314 -0
- package/dist/modules/mcp/helpers/uris.d.ts +33 -0
- package/dist/modules/mcp/helpers/uris.js +50 -0
- package/dist/modules/mcp/index.d.ts +13 -0
- package/dist/modules/mcp/mcp.bench.d.ts +1 -0
- package/dist/modules/mcp/previewClient.d.ts +13 -0
- package/dist/modules/mcp/previewClient.js +31 -0
- package/dist/modules/mcp/proxy/config.d.ts +20 -0
- package/dist/modules/mcp/proxy/config.js +62 -0
- package/dist/modules/mcp/proxy/endpoint.test.d.ts +1 -0
- package/dist/modules/mcp/proxy/fetch.d.ts +18 -0
- package/dist/modules/mcp/proxy/fetch.js +91 -0
- package/dist/modules/mcp/proxy/grant.d.ts +25 -0
- package/dist/modules/mcp/proxy/grant.js +67 -0
- package/dist/modules/mcp/proxy/guard.d.ts +6 -0
- package/dist/modules/mcp/proxy/guard.js +38 -0
- package/dist/modules/mcp/proxy/handler.d.ts +8 -0
- package/dist/modules/mcp/proxy/handler.js +99 -0
- package/dist/modules/mcp/proxy/index.d.ts +8 -0
- package/dist/modules/mcp/proxy/payload.d.ts +8 -0
- package/dist/modules/mcp/proxy/payload.js +29 -0
- package/dist/modules/mcp/proxy/proxy.test.d.ts +1 -0
- package/dist/modules/mcp/proxy/rewrite.d.ts +18 -0
- package/dist/modules/mcp/proxy/rewrite.js +138 -0
- package/dist/modules/mcp/proxy/sign.d.ts +6 -0
- package/dist/modules/mcp/proxy/sign.js +15 -0
- package/dist/modules/mcp/proxy/types.d.ts +45 -0
- package/dist/modules/mcp/proxy/types.js +9 -0
- package/dist/modules/mcp/proxy/wiring.test.d.ts +1 -0
- package/dist/modules/mcp/resources/canonical.d.ts +6 -0
- package/dist/modules/mcp/resources/canonical.js +30 -0
- package/dist/modules/mcp/resources/connectors.d.ts +22 -0
- package/dist/modules/mcp/resources/connectors.js +46 -0
- package/dist/modules/mcp/resources/core.d.ts +5 -0
- package/dist/modules/mcp/resources/core.js +18 -0
- package/dist/modules/mcp/resources/envelope.d.ts +10 -0
- package/dist/modules/mcp/resources/envelope.js +14 -0
- package/dist/modules/mcp/resources/index.d.ts +9 -0
- package/dist/modules/mcp/resources/primer.d.ts +7 -0
- package/dist/modules/mcp/resources/primer.js +33 -0
- package/dist/modules/mcp/resources/register.d.ts +10 -0
- package/dist/modules/mcp/resources/register.js +205 -0
- package/dist/modules/mcp/resources/renderGuide.d.ts +10 -0
- package/dist/modules/mcp/resources/renderGuide.js +451 -0
- package/dist/modules/mcp/resources/router.d.ts +10 -0
- package/dist/modules/mcp/resources/router.js +39 -0
- package/dist/modules/mcp/resources/schema.d.ts +5 -0
- package/dist/modules/mcp/resources/schema.js +43 -0
- package/dist/modules/mcp/resources/style.d.ts +5 -0
- package/dist/modules/mcp/resources/style.js +34 -0
- package/dist/modules/mcp/screenshotClient.d.ts +13 -0
- package/dist/modules/mcp/screenshotClient.js +47 -0
- package/dist/modules/mcp/server.d.ts +31 -0
- package/dist/modules/mcp/server.js +127 -0
- package/dist/modules/mcp/tests/apply.test.d.ts +1 -0
- package/dist/modules/mcp/tests/bindings.test.d.ts +1 -0
- package/dist/modules/mcp/tests/connectors.test.d.ts +1 -0
- package/dist/modules/mcp/tests/css.test.d.ts +1 -0
- package/dist/modules/mcp/tests/helpers.d.ts +13 -0
- package/dist/modules/mcp/tests/interactions.test.d.ts +1 -0
- package/dist/modules/mcp/tests/pages.test.d.ts +1 -0
- package/dist/modules/mcp/tests/reads.test.d.ts +1 -0
- package/dist/modules/mcp/tests/schemaIds.test.d.ts +1 -0
- package/dist/modules/mcp/tests/search.test.d.ts +1 -0
- package/dist/modules/mcp/tests/skill.test.d.ts +1 -0
- package/dist/modules/mcp/tests/styles.test.d.ts +1 -0
- package/dist/modules/mcp/tests/tools.test.d.ts +1 -0
- package/dist/modules/mcp/tests/validation.test.d.ts +1 -0
- package/dist/modules/mcp/tools/apply/dispatch.d.ts +6 -0
- package/dist/modules/mcp/tools/apply/dispatch.js +128 -0
- package/dist/modules/mcp/tools/apply/index.d.ts +656 -0
- package/dist/modules/mcp/tools/apply/index.js +161 -0
- package/dist/modules/mcp/tools/apply/writeResult.d.ts +8 -0
- package/dist/modules/mcp/tools/apply/writeResult.js +37 -0
- package/dist/modules/mcp/tools/index.d.ts +18 -0
- package/dist/modules/mcp/tools/index.js +24 -0
- package/dist/modules/mcp/tools/operations/connectors/deleteConnector.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/connectors/deleteConnector.js +20 -0
- package/dist/modules/mcp/tools/operations/connectors/index.d.ts +188 -0
- package/dist/modules/mcp/tools/operations/connectors/index.js +12 -0
- package/dist/modules/mcp/tools/operations/connectors/manifest.d.ts +89 -0
- package/dist/modules/mcp/tools/operations/connectors/manifest.js +70 -0
- package/dist/modules/mcp/tools/operations/connectors/patchConnector.d.ts +94 -0
- package/dist/modules/mcp/tools/operations/connectors/patchConnector.js +58 -0
- package/dist/modules/mcp/tools/operations/connectors/upsertConnector.d.ts +98 -0
- package/dist/modules/mcp/tools/operations/connectors/upsertConnector.js +64 -0
- package/dist/modules/mcp/tools/operations/index.d.ts +2235 -0
- package/dist/modules/mcp/tools/operations/index.js +55 -0
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.d.ts +17 -0
- package/dist/modules/mcp/tools/operations/schema/bindings/deleteBinding.js +32 -0
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.d.ts +25 -0
- package/dist/modules/mcp/tools/operations/schema/bindings/patchBinding.js +36 -0
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.d.ts +27 -0
- package/dist/modules/mcp/tools/operations/schema/bindings/upsertBinding.js +47 -0
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.d.ts +10 -0
- package/dist/modules/mcp/tools/operations/schema/elements/deleteElement.js +29 -0
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.d.ts +16 -0
- package/dist/modules/mcp/tools/operations/schema/elements/moveElement.js +41 -0
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.d.ts +27 -0
- package/dist/modules/mcp/tools/operations/schema/elements/patchElement.js +60 -0
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.d.ts +55 -0
- package/dist/modules/mcp/tools/operations/schema/elements/repeatElement.js +148 -0
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.d.ts +16 -0
- package/dist/modules/mcp/tools/operations/schema/elements/upsertElement.js +66 -0
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/schema/folders/deleteFolder.js +32 -0
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.d.ts +12 -0
- package/dist/modules/mcp/tools/operations/schema/folders/upsertFolder.js +49 -0
- package/dist/modules/mcp/tools/operations/schema/index.d.ts +21 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.d.ts +12 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/deleteInteraction.js +52 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.d.ts +18 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/patchInteractionNode.js +47 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.d.ts +27 -0
- package/dist/modules/mcp/tools/operations/schema/interactions/upsertInteractionFlow.js +44 -0
- package/dist/modules/mcp/tools/operations/schema/operations.d.ts +236 -0
- package/dist/modules/mcp/tools/operations/schema/operations.js +41 -0
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/schema/pages/deletePage.js +25 -0
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.d.ts +14 -0
- package/dist/modules/mcp/tools/operations/schema/pages/upsertPage.js +77 -0
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.d.ts +36 -0
- package/dist/modules/mcp/tools/operations/schema/settings/patchSettings.js +44 -0
- package/dist/modules/mcp/tools/operations/schema/shared.d.ts +106 -0
- package/dist/modules/mcp/tools/operations/schema/shared.js +131 -0
- package/dist/modules/mcp/tools/operations/schema/translator.d.ts +12 -0
- package/dist/modules/mcp/tools/operations/schema/translator.js +216 -0
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/schema/variables/deleteVariable.js +18 -0
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.d.ts +16 -0
- package/dist/modules/mcp/tools/operations/schema/variables/upsertVariable.js +42 -0
- package/dist/modules/mcp/tools/operations/schema/write.d.ts +42 -0
- package/dist/modules/mcp/tools/operations/schema/write.js +112 -0
- package/dist/modules/mcp/tools/operations/schemaIds.d.ts +6 -0
- package/dist/modules/mcp/tools/operations/schemaIds.js +58 -0
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/style/definitions/deleteDefinition.js +21 -0
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.d.ts +37 -0
- package/dist/modules/mcp/tools/operations/style/definitions/patchDefinition.js +28 -0
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.d.ts +37 -0
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinition.js +24 -0
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.d.ts +41 -0
- package/dist/modules/mcp/tools/operations/style/definitions/upsertDefinitions.js +40 -0
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/style/globalStyles/deleteGlobalStyle.js +21 -0
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.d.ts +37 -0
- package/dist/modules/mcp/tools/operations/style/globalStyles/patchGlobalStyle.js +28 -0
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.d.ts +37 -0
- package/dist/modules/mcp/tools/operations/style/globalStyles/upsertGlobalStyle.js +24 -0
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.d.ts +9 -0
- package/dist/modules/mcp/tools/operations/style/idStyles/deleteIdStyle.js +21 -0
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.d.ts +37 -0
- package/dist/modules/mcp/tools/operations/style/idStyles/patchIdStyle.js +28 -0
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.d.ts +37 -0
- package/dist/modules/mcp/tools/operations/style/idStyles/upsertIdStyle.js +24 -0
- package/dist/modules/mcp/tools/operations/style/index.d.ts +15 -0
- package/dist/modules/mcp/tools/operations/style/operations.d.ts +264 -0
- package/dist/modules/mcp/tools/operations/style/operations.js +29 -0
- package/dist/modules/mcp/tools/operations/style/shared.d.ts +116 -0
- package/dist/modules/mcp/tools/operations/style/shared.js +59 -0
- package/dist/modules/mcp/tools/operations/style/translator.d.ts +12 -0
- package/dist/modules/mcp/tools/operations/style/translator.js +101 -0
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.d.ts +15 -0
- package/dist/modules/mcp/tools/operations/style/variables/deleteStyleVariable.js +21 -0
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.d.ts +20 -0
- package/dist/modules/mcp/tools/operations/style/variables/upsertStyleVariable.js +22 -0
- package/dist/modules/mcp/tools/operations/style/write.d.ts +12 -0
- package/dist/modules/mcp/tools/operations/style/write.js +108 -0
- package/dist/modules/mcp/tools/preview.d.ts +472 -0
- package/dist/modules/mcp/tools/preview.js +37 -0
- package/dist/modules/mcp/tools/read.d.ts +9 -0
- package/dist/modules/mcp/tools/read.js +51 -0
- package/dist/modules/mcp/tools/render.d.ts +506 -0
- package/dist/modules/mcp/tools/render.js +184 -0
- package/dist/modules/mcp/tools/render.test.d.ts +1 -0
- package/dist/modules/mcp/tools/screenshot.d.ts +656 -0
- package/dist/modules/mcp/tools/screenshot.js +83 -0
- package/dist/modules/mcp/tools/search.d.ts +15 -0
- package/dist/modules/mcp/tools/search.js +115 -0
- package/dist/modules/mcp/tools/shared/expandOperations.d.ts +13 -0
- package/dist/modules/mcp/tools/shared/expandOperations.js +44 -0
- package/dist/modules/mcp/tools/shared/tool.d.ts +72 -0
- package/dist/modules/mcp/tools/shared/tool.js +33 -0
- package/dist/modules/mcp/tools/shared/validator/audit.d.ts +4 -0
- package/dist/modules/mcp/tools/shared/validator/audit.js +124 -0
- package/dist/modules/mcp/tools/shared/validator/batch.d.ts +5 -0
- package/dist/modules/mcp/tools/shared/validator/batch.js +39 -0
- package/dist/modules/mcp/tools/shared/validator/bindings.d.ts +6 -0
- package/dist/modules/mcp/tools/shared/validator/bindings.js +70 -0
- package/dist/modules/mcp/tools/shared/validator/connectors.d.ts +19 -0
- package/dist/modules/mcp/tools/shared/validator/connectors.js +76 -0
- package/dist/modules/mcp/tools/shared/validator/context.d.ts +38 -0
- package/dist/modules/mcp/tools/shared/validator/context.js +35 -0
- package/dist/modules/mcp/tools/shared/validator/css.d.ts +4 -0
- package/dist/modules/mcp/tools/shared/validator/css.js +39 -0
- package/dist/modules/mcp/tools/shared/validator/elements.d.ts +7 -0
- package/dist/modules/mcp/tools/shared/validator/elements.js +68 -0
- package/dist/modules/mcp/tools/shared/validator/index.d.ts +8 -0
- package/dist/modules/mcp/tools/shared/validator/index.js +268 -0
- package/dist/modules/mcp/tools/shared/validator/interactions.d.ts +3 -0
- package/dist/modules/mcp/tools/shared/validator/interactions.js +103 -0
- package/dist/modules/mcp/tools/shared/validator/refs.d.ts +4 -0
- package/dist/modules/mcp/tools/shared/validator/refs.js +28 -0
- package/dist/modules/mcp/tools/validate.d.ts +653 -0
- package/dist/modules/mcp/tools/validate.js +47 -0
- package/dist/modules/mcp/types/aiSchema.d.ts +226 -0
- package/dist/modules/mcp/types/appTypes.d.ts +26 -0
- package/dist/modules/mcp/types/index.d.ts +5 -0
- package/dist/modules/mcp/types/previewTypes.d.ts +25 -0
- package/dist/modules/mcp/types/screenshotTypes.d.ts +29 -0
- package/dist/modules/mcp/types/toolTypes.d.ts +145 -0
- package/dist/modules/oauth/authorize.d.ts +7 -0
- package/dist/modules/oauth/authorize.js +177 -0
- package/dist/modules/oauth/challenge.d.ts +11 -0
- package/dist/modules/oauth/challenge.js +33 -0
- package/dist/modules/oauth/consentPage.d.ts +7 -0
- package/dist/modules/oauth/consentPage.js +118 -0
- package/dist/modules/oauth/metadata.d.ts +40 -0
- package/dist/modules/oauth/metadata.js +69 -0
- package/dist/modules/oauth/oauth.test.d.ts +1 -0
- package/dist/modules/oauth/params.d.ts +5 -0
- package/dist/modules/oauth/params.js +5 -0
- package/dist/modules/oauth/pkce.d.ts +6 -0
- package/dist/modules/oauth/pkce.js +15 -0
- package/dist/modules/oauth/records.d.ts +71 -0
- package/dist/modules/oauth/records.js +46 -0
- package/dist/modules/oauth/register.d.ts +5 -0
- package/dist/modules/oauth/register.js +55 -0
- package/dist/modules/oauth/respond.d.ts +13 -0
- package/dist/modules/oauth/respond.js +44 -0
- package/dist/modules/oauth/token.d.ts +5 -0
- package/dist/modules/oauth/token.js +100 -0
- package/dist/options.d.ts +73 -0
- package/dist/packageBoundary.test.d.ts +1 -0
- package/dist/pipeline.d.ts +12 -0
- package/dist/pipeline.js +29 -0
- package/dist/pipeline.test.d.ts +1 -0
- package/dist/preview/createPreview.d.ts +10 -0
- package/dist/preview/createPreview.js +83 -0
- package/dist/server.d.ts +15 -0
- package/dist/server.js +7 -0
- package/dist/stages/mcp.d.ts +4 -0
- package/dist/stages/mcp.js +30 -0
- package/dist/stages/oauth.d.ts +19 -0
- package/dist/stages/oauth.js +114 -0
- package/dist/stages/preview.d.ts +2 -0
- package/dist/stages/preview.js +37 -0
- package/dist/stages/proxy.d.ts +3 -0
- package/dist/stages/proxy.js +14 -0
- package/dist/tests/httpRequest.d.ts +14 -0
- package/package.json +77 -0
- package/skills/plitzi-render/SKILL.md +174 -0
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { SIDES } from "./helpers.js";
|
|
2
|
+
import { expandBorder, expandBorderGroup } from "./border.js";
|
|
3
|
+
import { expandBorderRadius, expandBox, expandGap } from "./box.js";
|
|
4
|
+
import { expandColumns, expandFlex, expandFlexFlow, expandGridArea, expandGridLine, expandGridTemplate, expandOverflow, expandPlacePair } from "./layout.js";
|
|
5
|
+
import { expandAnimation, expandBackground, expandFont, expandListStyle, expandOutline, expandTextDecoration, expandTransition } from "./visual.js";
|
|
6
|
+
import styleConstants from "@plitzi/sdk-shared/style/styleConstants";
|
|
7
|
+
//#region src/modules/mcp/catalogs/cssCatalog/index.ts
|
|
8
|
+
/** Every kebab-case CSS property Plitzi's style engine understands. Values written to a definition
|
|
9
|
+
* must use these exact keys — camelCase or unknown keys are rejected by the validator. */
|
|
10
|
+
var cssProperties = Array.from(new Set(Object.values(styleConstants))).sort();
|
|
11
|
+
var cssPropertySet = new Set(cssProperties);
|
|
12
|
+
var isCssProperty = (key) => cssPropertySet.has(key);
|
|
13
|
+
var toKebab = (key) => key.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
14
|
+
/** If a camelCase key maps to a known kebab-case property, return it — used to teach the agent the correct key. */
|
|
15
|
+
var suggestCssProperty = (key) => {
|
|
16
|
+
const kebab = toKebab(key);
|
|
17
|
+
return cssPropertySet.has(kebab) ? kebab : void 0;
|
|
18
|
+
};
|
|
19
|
+
var EXPANDERS = /* @__PURE__ */ new Map([
|
|
20
|
+
["padding", expandBox],
|
|
21
|
+
["margin", expandBox],
|
|
22
|
+
["inset", expandBox],
|
|
23
|
+
["border-radius", (_key, value, out) => expandBorderRadius(value, out)],
|
|
24
|
+
["gap", (_key, value, out) => expandGap(value, out)],
|
|
25
|
+
["border-width", (key, value, out) => expandBorderGroup(key.slice(7), value, out)],
|
|
26
|
+
["border-color", (key, value, out) => expandBorderGroup(key.slice(7), value, out)],
|
|
27
|
+
["border-style", (key, value, out) => expandBorderGroup(key.slice(7), value, out)],
|
|
28
|
+
["border", expandBorder],
|
|
29
|
+
["overflow", (_key, value, out) => expandOverflow(value, out)],
|
|
30
|
+
["flex", (_key, value, out) => expandFlex(value, out)],
|
|
31
|
+
["flex-flow", (_key, value, out) => expandFlexFlow(value, out)],
|
|
32
|
+
["place-content", (_key, value, out) => expandPlacePair("place-content", value, out)],
|
|
33
|
+
["place-items", (_key, value, out) => expandPlacePair("place-items", value, out)],
|
|
34
|
+
["place-self", (_key, value, out) => expandPlacePair("place-self", value, out)],
|
|
35
|
+
["grid-row", (_key, value, out) => expandGridLine("grid-row", value, out)],
|
|
36
|
+
["grid-column", (_key, value, out) => expandGridLine("grid-column", value, out)],
|
|
37
|
+
["grid-area", (_key, value, out) => expandGridArea(value, out)],
|
|
38
|
+
["grid", (_key, value, out) => expandGridTemplate(value, out)],
|
|
39
|
+
["grid-template", (_key, value, out) => expandGridTemplate(value, out)],
|
|
40
|
+
["columns", (_key, value, out) => expandColumns(value, out)],
|
|
41
|
+
["outline", (_key, value, out) => expandOutline(value, out)],
|
|
42
|
+
["list-style", (_key, value, out) => expandListStyle(value, out)],
|
|
43
|
+
["text-decoration", (_key, value, out) => expandTextDecoration(value, out)],
|
|
44
|
+
["transition", (_key, value, out) => expandTransition(value, out)],
|
|
45
|
+
["animation", (_key, value, out) => expandAnimation(value, out)],
|
|
46
|
+
["background", (_key, value, out) => expandBackground(value, out)],
|
|
47
|
+
["font", (_key, value, out) => expandFont(value, out)]
|
|
48
|
+
]);
|
|
49
|
+
for (const side of SIDES) EXPANDERS.set(`border-${side}`, expandBorder);
|
|
50
|
+
/** Every shorthand the MCP accepts and atomizes — advertised to the agent so it knows it may write plain CSS. */
|
|
51
|
+
var cssShorthands = Array.from(EXPANDERS.keys()).sort();
|
|
52
|
+
var expandOne = (key, raw, out) => {
|
|
53
|
+
const expand = EXPANDERS.get(key);
|
|
54
|
+
if (!expand) return false;
|
|
55
|
+
const value = String(raw).trim();
|
|
56
|
+
if (value !== "") expand(key, value, out);
|
|
57
|
+
return true;
|
|
58
|
+
};
|
|
59
|
+
/** Expand supported CSS shorthands to their longhand keys. Explicit longhands in the same map win over any
|
|
60
|
+
* expansion (so `{ padding: 8, padding-left: 0 }` keeps padding-left: 0). Unrecognized keys pass through. */
|
|
61
|
+
var expandShorthand = (css) => {
|
|
62
|
+
const expanded = {};
|
|
63
|
+
const direct = {};
|
|
64
|
+
for (const [key, value] of Object.entries(css)) if (!expandOne(key, value, expanded)) direct[key] = value;
|
|
65
|
+
return {
|
|
66
|
+
...expanded,
|
|
67
|
+
...direct
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
var REMOVAL_PROBE = new Map(Object.entries({
|
|
71
|
+
padding: "0",
|
|
72
|
+
margin: "0",
|
|
73
|
+
inset: "0",
|
|
74
|
+
"border-radius": "0 0 0 0 / 0 0 0 0",
|
|
75
|
+
gap: "0 0",
|
|
76
|
+
"border-width": "0 0 0 0",
|
|
77
|
+
"border-color": "red red red red",
|
|
78
|
+
"border-style": "solid solid solid solid",
|
|
79
|
+
border: "0 solid red",
|
|
80
|
+
overflow: "visible visible",
|
|
81
|
+
flex: "0 0 auto",
|
|
82
|
+
"flex-flow": "row nowrap",
|
|
83
|
+
"place-content": "start start",
|
|
84
|
+
"place-items": "start start",
|
|
85
|
+
"place-self": "start start",
|
|
86
|
+
"grid-row": "auto / auto",
|
|
87
|
+
"grid-column": "auto / auto",
|
|
88
|
+
"grid-area": "auto / auto / auto / auto",
|
|
89
|
+
grid: "\"a\" 0 / 0",
|
|
90
|
+
"grid-template": "\"a\" 0 / 0",
|
|
91
|
+
columns: "0 0",
|
|
92
|
+
outline: "0 solid red",
|
|
93
|
+
"list-style": "disc inside url(x)",
|
|
94
|
+
"text-decoration": "underline solid red",
|
|
95
|
+
transition: "all 0s ease 0s",
|
|
96
|
+
animation: "a 0s ease 0s 1 normal forwards running",
|
|
97
|
+
background: "red url(x) no-repeat scroll 0 0 / auto padding-box border-box",
|
|
98
|
+
font: "italic small-caps bold 0px/0 a"
|
|
99
|
+
}));
|
|
100
|
+
for (const side of SIDES) REMOVAL_PROBE.set(`border-${side}`, "0 solid red");
|
|
101
|
+
/** The longhand keys a shorthand controls — what a `null` patch value has to clear. */
|
|
102
|
+
var shorthandLonghands = (key) => {
|
|
103
|
+
const probe = REMOVAL_PROBE.get(key);
|
|
104
|
+
if (probe === void 0) return;
|
|
105
|
+
const out = {};
|
|
106
|
+
expandOne(key, probe, out);
|
|
107
|
+
return Object.keys(out);
|
|
108
|
+
};
|
|
109
|
+
/** Patch flavour of {@link expandShorthand}: a `null` value removes every longhand the key controls, so
|
|
110
|
+
* `{ padding: null }` clears all four sides rather than a `padding` key that was never stored. */
|
|
111
|
+
var expandShorthandPatch = (css) => {
|
|
112
|
+
const expanded = {};
|
|
113
|
+
const direct = {};
|
|
114
|
+
for (const [key, value] of Object.entries(css)) {
|
|
115
|
+
if (value === null) {
|
|
116
|
+
const longhands = shorthandLonghands(key);
|
|
117
|
+
if (longhands) for (const longhand of longhands) expanded[longhand] = null;
|
|
118
|
+
else direct[key] = null;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
const props = {};
|
|
122
|
+
if (expandOne(key, value, props)) Object.assign(expanded, props);
|
|
123
|
+
else direct[key] = value;
|
|
124
|
+
}
|
|
125
|
+
return {
|
|
126
|
+
...expanded,
|
|
127
|
+
...direct
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
//#endregion
|
|
131
|
+
export { cssProperties, cssShorthands, expandShorthand, expandShorthandPatch, isCssProperty, shorthandLonghands, suggestCssProperty };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CssProps } from '../../types';
|
|
2
|
+
export declare const expandOverflow: (value: string, out: CssProps) => void;
|
|
3
|
+
export declare const expandFlex: (value: string, out: CssProps) => void;
|
|
4
|
+
export declare const expandFlexFlow: (value: string, out: CssProps) => void;
|
|
5
|
+
export declare const expandPlacePair: (prefix: "place-content" | "place-items" | "place-self", value: string, out: CssProps) => void;
|
|
6
|
+
export declare const expandGridLine: (key: "grid-row" | "grid-column", value: string, out: CssProps) => void;
|
|
7
|
+
export declare const expandGridArea: (value: string, out: CssProps) => void;
|
|
8
|
+
export declare const expandColumns: (value: string, out: CssProps) => void;
|
|
9
|
+
export declare const expandGridTemplate: (value: string, out: CssProps) => void;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { FLEX_DIRECTIONS, FLEX_WRAPS, LENGTH_RE, NUMBER_RE, QUOTE_RE, splitOn, splitPair, splitTokens } from "./helpers.js";
|
|
2
|
+
//#region src/modules/mcp/catalogs/cssCatalog/layout.ts
|
|
3
|
+
var expandOverflow = (value, out) => {
|
|
4
|
+
const [x, y = x] = splitTokens(value);
|
|
5
|
+
out["overflow-x"] = x;
|
|
6
|
+
out["overflow-y"] = y;
|
|
7
|
+
};
|
|
8
|
+
var FLEX_KEYWORDS = /* @__PURE__ */ new Map([
|
|
9
|
+
["none", [
|
|
10
|
+
"0",
|
|
11
|
+
"0",
|
|
12
|
+
"auto"
|
|
13
|
+
]],
|
|
14
|
+
["auto", [
|
|
15
|
+
"1",
|
|
16
|
+
"1",
|
|
17
|
+
"auto"
|
|
18
|
+
]],
|
|
19
|
+
["initial", [
|
|
20
|
+
"0",
|
|
21
|
+
"1",
|
|
22
|
+
"auto"
|
|
23
|
+
]]
|
|
24
|
+
]);
|
|
25
|
+
var writeFlex = (out, grow, shrink, basis) => {
|
|
26
|
+
out["flex-grow"] = grow;
|
|
27
|
+
out["flex-shrink"] = shrink;
|
|
28
|
+
out["flex-basis"] = basis;
|
|
29
|
+
};
|
|
30
|
+
var expandFlex = (value, out) => {
|
|
31
|
+
const tokens = splitTokens(value);
|
|
32
|
+
if (tokens.length === 1) {
|
|
33
|
+
const [only] = tokens;
|
|
34
|
+
const keyword = FLEX_KEYWORDS.get(only);
|
|
35
|
+
if (keyword) writeFlex(out, ...keyword);
|
|
36
|
+
else if (NUMBER_RE.test(only)) writeFlex(out, only, "1", "0%");
|
|
37
|
+
else writeFlex(out, "1", "1", only);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const [grow, second, third] = tokens;
|
|
41
|
+
if (!NUMBER_RE.test(grow)) return;
|
|
42
|
+
if (tokens.length === 2) {
|
|
43
|
+
if (NUMBER_RE.test(second)) writeFlex(out, grow, second, "0%");
|
|
44
|
+
else writeFlex(out, grow, "1", second);
|
|
45
|
+
} else writeFlex(out, grow, second, third);
|
|
46
|
+
};
|
|
47
|
+
var expandFlexFlow = (value, out) => {
|
|
48
|
+
for (const token of splitTokens(value)) if (FLEX_DIRECTIONS.has(token)) out["flex-direction"] = token;
|
|
49
|
+
else if (FLEX_WRAPS.has(token)) out["flex-wrap"] = token;
|
|
50
|
+
};
|
|
51
|
+
var expandPlacePair = (prefix, value, out) => {
|
|
52
|
+
const [align, justify = align] = splitTokens(value);
|
|
53
|
+
const prop = prefix.slice(6);
|
|
54
|
+
out[`align-${prop}`] = align;
|
|
55
|
+
out[`justify-${prop}`] = justify;
|
|
56
|
+
};
|
|
57
|
+
var expandGridLine = (key, value, out) => {
|
|
58
|
+
const axis = key.slice(5);
|
|
59
|
+
const [start, end = "auto"] = splitOn(value, "/");
|
|
60
|
+
out[`grid-${axis}-start`] = start;
|
|
61
|
+
out[`grid-${axis}-end`] = end;
|
|
62
|
+
};
|
|
63
|
+
var expandGridArea = (value, out) => {
|
|
64
|
+
const [rowStart, colStart = rowStart, rowEnd = colStart, colEnd = rowEnd] = splitOn(value, "/");
|
|
65
|
+
out["grid-row-start"] = rowStart;
|
|
66
|
+
out["grid-column-start"] = colStart;
|
|
67
|
+
out["grid-row-end"] = rowEnd;
|
|
68
|
+
out["grid-column-end"] = colEnd;
|
|
69
|
+
};
|
|
70
|
+
var expandColumns = (value, out) => {
|
|
71
|
+
const tokens = splitTokens(value);
|
|
72
|
+
if (tokens.length === 1) {
|
|
73
|
+
const [only] = tokens;
|
|
74
|
+
if (NUMBER_RE.test(only)) out["column-count"] = only;
|
|
75
|
+
else out["column-width"] = only;
|
|
76
|
+
} else if (tokens.length >= 2) {
|
|
77
|
+
const [first, second] = tokens;
|
|
78
|
+
const [width, count] = NUMBER_RE.test(first) ? [second, first] : [first, second];
|
|
79
|
+
out["column-width"] = width;
|
|
80
|
+
out["column-count"] = count;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var isTrackList = (tokens) => tokens.some((token) => token === "none" || token === "auto" || token === "min-content" || token === "max-content" || token.startsWith("[") || token.startsWith("minmax(") || token.startsWith("repeat(") || token.startsWith("fit-content(") || LENGTH_RE.test(token) || /^-?[\d.]+fr$/.test(token));
|
|
84
|
+
var expandGridTemplate = (value, out) => {
|
|
85
|
+
const [first, second] = splitPair(value, "/");
|
|
86
|
+
const rowTokens = splitTokens(first);
|
|
87
|
+
const areas = rowTokens.filter((token) => QUOTE_RE.test(token));
|
|
88
|
+
const sizes = rowTokens.filter((token) => !QUOTE_RE.test(token));
|
|
89
|
+
if (second !== void 0) {
|
|
90
|
+
if (second !== "") out["grid-template-columns"] = second;
|
|
91
|
+
} else if (areas.length === 0) {
|
|
92
|
+
if (isTrackList(rowTokens)) out["grid-template-columns"] = first;
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (areas.length > 0) out["grid-template-areas"] = areas.join(" ");
|
|
96
|
+
if (sizes.length > 0) out["grid-template-rows"] = sizes.join(" ");
|
|
97
|
+
};
|
|
98
|
+
//#endregion
|
|
99
|
+
export { expandColumns, expandFlex, expandFlexFlow, expandGridArea, expandGridLine, expandGridTemplate, expandOverflow, expandPlacePair };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CssProps } from '../../types';
|
|
2
|
+
export declare const expandOutline: (value: string, out: CssProps) => void;
|
|
3
|
+
export declare const expandListStyle: (value: string, out: CssProps) => void;
|
|
4
|
+
export declare const expandTextDecoration: (value: string, out: CssProps) => void;
|
|
5
|
+
export declare const expandTransition: (value: string, out: CssProps) => void;
|
|
6
|
+
export declare const expandAnimation: (value: string, out: CssProps) => void;
|
|
7
|
+
export declare const expandBackground: (value: string, out: CssProps) => void;
|
|
8
|
+
export declare const expandFont: (value: string, out: CssProps) => void;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { ANIMATION_DIRECTIONS, ANIMATION_FILL_MODES, ANIMATION_PLAY_STATES, FONT_STYLE_KEYWORDS, FONT_VARIANT_KEYWORDS, FONT_WEIGHT_KEYWORDS, LENGTH_RE, LIST_STYLE_POSITIONS, LIST_STYLE_TYPES, NUMBER_RE, TEXT_DECORATION_LINES, TEXT_DECORATION_STYLES, TIME_RE, isTimingFunction, splitOn, splitPair, splitTokens } from "./helpers.js";
|
|
2
|
+
import { classifyBorderTokens } from "./border.js";
|
|
3
|
+
//#region src/modules/mcp/catalogs/cssCatalog/visual.ts
|
|
4
|
+
var expandLayers = (value, out, expandLayer) => {
|
|
5
|
+
const layers = splitOn(value, ",");
|
|
6
|
+
if (layers.length === 1) {
|
|
7
|
+
expandLayer(layers[0], out);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
const perLayer = layers.map((layer) => {
|
|
11
|
+
const layerOut = {};
|
|
12
|
+
expandLayer(layer, layerOut);
|
|
13
|
+
return layerOut;
|
|
14
|
+
});
|
|
15
|
+
const keys = new Set(perLayer.flatMap((layer) => Object.keys(layer)));
|
|
16
|
+
for (const key of keys) out[key] = perLayer.map((layer) => String(layer[key] ?? "initial")).join(", ");
|
|
17
|
+
};
|
|
18
|
+
var expandOutline = (value, out) => {
|
|
19
|
+
for (const [kind, token] of Object.entries(classifyBorderTokens(value))) out[`outline-${kind}`] = token;
|
|
20
|
+
};
|
|
21
|
+
var expandListStyle = (value, out) => {
|
|
22
|
+
for (const token of splitTokens(value)) if (token.startsWith("url(")) out["list-style-image"] = token;
|
|
23
|
+
else if (LIST_STYLE_POSITIONS.has(token)) out["list-style-position"] = token;
|
|
24
|
+
else if (LIST_STYLE_TYPES.has(token)) out["list-style-type"] = token;
|
|
25
|
+
};
|
|
26
|
+
var expandTextDecoration = (value, out) => {
|
|
27
|
+
for (const token of splitTokens(value)) if (TEXT_DECORATION_LINES.has(token)) out["text-decoration-line"] = token;
|
|
28
|
+
else if (TEXT_DECORATION_STYLES.has(token)) out["text-decoration-style"] = token;
|
|
29
|
+
else out["text-decoration-color"] = token;
|
|
30
|
+
};
|
|
31
|
+
var expandTransitionLayer = (layer, out) => {
|
|
32
|
+
let foundDuration = false;
|
|
33
|
+
for (const token of splitTokens(layer)) if (isTimingFunction(token)) out["transition-timing-function"] = token;
|
|
34
|
+
else if (TIME_RE.test(token) || NUMBER_RE.test(token)) {
|
|
35
|
+
if (foundDuration) out["transition-delay"] = token;
|
|
36
|
+
else {
|
|
37
|
+
out["transition-duration"] = token;
|
|
38
|
+
foundDuration = true;
|
|
39
|
+
}
|
|
40
|
+
} else if (!out["transition-property"]) out["transition-property"] = token;
|
|
41
|
+
};
|
|
42
|
+
var expandTransition = (value, out) => expandLayers(value, out, expandTransitionLayer);
|
|
43
|
+
var expandAnimationLayer = (layer, out) => {
|
|
44
|
+
let foundDuration = false;
|
|
45
|
+
for (const token of splitTokens(layer)) if (isTimingFunction(token)) out["animation-timing-function"] = token;
|
|
46
|
+
else if (TIME_RE.test(token)) {
|
|
47
|
+
if (foundDuration) out["animation-delay"] = token;
|
|
48
|
+
else {
|
|
49
|
+
out["animation-duration"] = token;
|
|
50
|
+
foundDuration = true;
|
|
51
|
+
}
|
|
52
|
+
} else if (token === "infinite" || NUMBER_RE.test(token)) out["animation-iteration-count"] = token;
|
|
53
|
+
else if (ANIMATION_DIRECTIONS.has(token) && !out["animation-direction"]) out["animation-direction"] = token;
|
|
54
|
+
else if (ANIMATION_FILL_MODES.has(token) && !out["animation-fill-mode"]) out["animation-fill-mode"] = token;
|
|
55
|
+
else if (ANIMATION_PLAY_STATES.has(token) && !out["animation-play-state"]) out["animation-play-state"] = token;
|
|
56
|
+
else if (!out["animation-name"]) out["animation-name"] = token;
|
|
57
|
+
};
|
|
58
|
+
var expandAnimation = (value, out) => expandLayers(value, out, expandAnimationLayer);
|
|
59
|
+
var BACKGROUND_REPEATS = /* @__PURE__ */ new Set([
|
|
60
|
+
"repeat",
|
|
61
|
+
"no-repeat",
|
|
62
|
+
"repeat-x",
|
|
63
|
+
"repeat-y",
|
|
64
|
+
"space",
|
|
65
|
+
"round"
|
|
66
|
+
]);
|
|
67
|
+
var BACKGROUND_ATTACHMENTS = /* @__PURE__ */ new Set([
|
|
68
|
+
"scroll",
|
|
69
|
+
"fixed",
|
|
70
|
+
"local"
|
|
71
|
+
]);
|
|
72
|
+
var BACKGROUND_BOXES = /* @__PURE__ */ new Set([
|
|
73
|
+
"border-box",
|
|
74
|
+
"padding-box",
|
|
75
|
+
"content-box"
|
|
76
|
+
]);
|
|
77
|
+
var BACKGROUND_POSITIONS = /* @__PURE__ */ new Set([
|
|
78
|
+
"center",
|
|
79
|
+
"top",
|
|
80
|
+
"bottom",
|
|
81
|
+
"left",
|
|
82
|
+
"right"
|
|
83
|
+
]);
|
|
84
|
+
var isImage = (token) => token.startsWith("url(") || token.includes("-gradient(");
|
|
85
|
+
var isPosition = (token) => BACKGROUND_POSITIONS.has(token) || LENGTH_RE.test(token);
|
|
86
|
+
var isSize = (token) => token === "cover" || token === "contain" || token === "auto" || LENGTH_RE.test(token);
|
|
87
|
+
var expandBackgroundLayer = (layer, out) => {
|
|
88
|
+
const [beforeSlash, afterSlash] = splitPair(layer, "/");
|
|
89
|
+
const tokens = splitTokens(beforeSlash);
|
|
90
|
+
if (afterSlash !== void 0) {
|
|
91
|
+
let positionStart = tokens.length;
|
|
92
|
+
while (positionStart > 0 && isPosition(tokens[positionStart - 1])) positionStart -= 1;
|
|
93
|
+
const position = tokens.splice(positionStart, tokens.length - positionStart);
|
|
94
|
+
if (position.length > 0) out["background-position"] = position.join(" ");
|
|
95
|
+
const afterTokens = splitTokens(afterSlash);
|
|
96
|
+
let sizeEnd = 0;
|
|
97
|
+
while (sizeEnd < afterTokens.length && isSize(afterTokens[sizeEnd])) sizeEnd += 1;
|
|
98
|
+
if (sizeEnd > 0) out["background-size"] = afterTokens.slice(0, sizeEnd).join(" ");
|
|
99
|
+
tokens.push(...afterTokens.slice(sizeEnd));
|
|
100
|
+
}
|
|
101
|
+
const positions = [];
|
|
102
|
+
for (const token of tokens) if (isImage(token)) out["background-image"] = token;
|
|
103
|
+
else if (BACKGROUND_REPEATS.has(token)) out["background-repeat"] = token;
|
|
104
|
+
else if (token === "cover" || token === "contain") out["background-size"] = token;
|
|
105
|
+
else if (BACKGROUND_ATTACHMENTS.has(token)) out["background-attachment"] = token;
|
|
106
|
+
else if (BACKGROUND_BOXES.has(token)) {
|
|
107
|
+
if (out["background-origin"]) out["background-clip"] = token;
|
|
108
|
+
else out["background-origin"] = token;
|
|
109
|
+
} else if (isPosition(token)) positions.push(token);
|
|
110
|
+
else if (!out["background-color"]) out["background-color"] = token;
|
|
111
|
+
if (positions.length > 0) out["background-position"] = positions.join(" ");
|
|
112
|
+
};
|
|
113
|
+
var expandBackground = (value, out) => expandLayers(value, out, expandBackgroundLayer);
|
|
114
|
+
var expandFont = (value, out) => {
|
|
115
|
+
const [beforeSlash, afterSlash] = splitPair(value, "/");
|
|
116
|
+
const tokens = splitTokens(beforeSlash);
|
|
117
|
+
if (afterSlash !== void 0) {
|
|
118
|
+
const [lineHeight, ...family] = splitTokens(afterSlash);
|
|
119
|
+
out["line-height"] = lineHeight;
|
|
120
|
+
if (family.length > 0) out["font-family"] = family.join(" ");
|
|
121
|
+
}
|
|
122
|
+
const family = [];
|
|
123
|
+
let foundSize = false;
|
|
124
|
+
for (const token of tokens) {
|
|
125
|
+
if (foundSize) {
|
|
126
|
+
family.push(token);
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (token === "normal") {
|
|
130
|
+
const slot = [
|
|
131
|
+
"font-style",
|
|
132
|
+
"font-variant",
|
|
133
|
+
"font-weight"
|
|
134
|
+
].find((prop) => !out[prop]);
|
|
135
|
+
if (slot) out[slot] = token;
|
|
136
|
+
} else if (FONT_STYLE_KEYWORDS.has(token) && !out["font-style"]) out["font-style"] = token;
|
|
137
|
+
else if (FONT_VARIANT_KEYWORDS.has(token) && !out["font-variant"]) out["font-variant"] = token;
|
|
138
|
+
else if (FONT_WEIGHT_KEYWORDS.has(token) && !out["font-weight"]) out["font-weight"] = token;
|
|
139
|
+
else if (LENGTH_RE.test(token)) {
|
|
140
|
+
out["font-size"] = token;
|
|
141
|
+
foundSize = true;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
if (family.length > 0) out["font-family"] = family.join(" ");
|
|
145
|
+
};
|
|
146
|
+
//#endregion
|
|
147
|
+
export { expandAnimation, expandBackground, expandFont, expandListStyle, expandOutline, expandTextDecoration, expandTransition };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './paramSpec';
|
|
2
|
+
export * from './builtinCallbacks';
|
|
3
|
+
export * from './builtinElementCallbacks';
|
|
4
|
+
export * from './builtinUtilities';
|
|
5
|
+
export * from './builtinTransformers';
|
|
6
|
+
export * from './builtinComponents';
|
|
7
|
+
export * from './cssCatalog';
|
|
8
|
+
export * from './observed';
|
|
9
|
+
export * from './registry';
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TransformerInfo } from './builtinTransformers';
|
|
2
|
+
import { Schema } from '@plitzi/sdk-shared';
|
|
3
|
+
export interface BuiltinParamInfo {
|
|
4
|
+
name: string;
|
|
5
|
+
type: string;
|
|
6
|
+
description: string;
|
|
7
|
+
default?: string | number | boolean;
|
|
8
|
+
options?: string[];
|
|
9
|
+
conditional?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface BuiltinGlobalCallbackInfo {
|
|
12
|
+
action: string;
|
|
13
|
+
source: string;
|
|
14
|
+
title: string;
|
|
15
|
+
strictParams: boolean;
|
|
16
|
+
params: BuiltinParamInfo[];
|
|
17
|
+
}
|
|
18
|
+
export interface BuiltinActionInfo {
|
|
19
|
+
action: string;
|
|
20
|
+
title: string;
|
|
21
|
+
strictParams: boolean;
|
|
22
|
+
params: BuiltinParamInfo[];
|
|
23
|
+
}
|
|
24
|
+
export interface InteractionCatalog {
|
|
25
|
+
note: string;
|
|
26
|
+
actions: Record<string, string[]>;
|
|
27
|
+
globalCallbacksNote: string;
|
|
28
|
+
globalCallbacks: BuiltinGlobalCallbackInfo[];
|
|
29
|
+
elementCallbacksNote: string;
|
|
30
|
+
elementCallbacks: BuiltinActionInfo[];
|
|
31
|
+
utilitiesNote: string;
|
|
32
|
+
utilities: BuiltinActionInfo[];
|
|
33
|
+
flowCount: number;
|
|
34
|
+
}
|
|
35
|
+
export interface DataSourceCatalog {
|
|
36
|
+
note: string;
|
|
37
|
+
scopeNote: string;
|
|
38
|
+
sources: string[];
|
|
39
|
+
targets: Record<string, string[]>;
|
|
40
|
+
transformersNote: string;
|
|
41
|
+
transformers: TransformerInfo[];
|
|
42
|
+
}
|
|
43
|
+
export declare const buildInteractionCatalog: (schema: Schema) => InteractionCatalog;
|
|
44
|
+
export declare const buildDataSourceCatalog: (schema: Schema) => DataSourceCatalog;
|
|
45
|
+
export declare const observedInteractionActions: (schema: Schema) => Set<string>;
|
|
46
|
+
export declare const observedDataSources: (schema: Schema) => Set<string>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BUILTIN_GLOBAL_CALLBACKS } from "./builtinCallbacks.js";
|
|
2
|
+
import { BUILTIN_ELEMENT_CALLBACKS } from "./builtinElementCallbacks.js";
|
|
3
|
+
import { BUILTIN_UTILITIES } from "./builtinUtilities.js";
|
|
4
|
+
import { transformerCatalog } from "./builtinTransformers.js";
|
|
5
|
+
//#region src/modules/mcp/catalogs/observed.ts
|
|
6
|
+
var INTERACTION_NOTE = "Interaction actions observed on this space, grouped by node type. A flow is a trigger followed by ordered callbacks/utilities; write one with upsertInteractionFlow. Names not listed may still be valid plugin actions.";
|
|
7
|
+
var GLOBAL_CALLBACKS_NOTE = "Built-in global callbacks always available in every space. A globalCallback is registered on its SOURCE MODULE, so its node `elementId` is the listed `source` (e.g. \"space\" for addNotification) — NOT the element that hosts the flow. Omit `elementId` and the MCP sets the right source and fills the param defaults for you. Use ONLY the params listed under each callback (with the exact spelling shown) — for addNotification the visible text goes in `content`; there is no title/message/type param. When strictParams is true, any other key is rejected.";
|
|
8
|
+
var ELEMENT_CALLBACKS_NOTE = "Built-in `callback`-type actions every element registers on ITSELF. Unlike a globalCallback, an element callback runs against a real element, so its node `elementId` is that element (the flow host by default, or another element to act on) and its nodeType is \"callback\". `setState` here changes the element's own attribute/state (params category/key/value/revertOnFinish) — NOT the global state setState (which is a globalCallback on source \"state\" with params key/type/value). Set revertOnFinish:true for a TEMPORARY change (e.g. a \"loading…\" label): it is undone automatically when the flow finishes, so you do NOT add manual restore steps. A specific element type may register more callbacks beyond these defaults.";
|
|
9
|
+
var UTILITIES_NOTE = "Built-in `utility`-type actions (no element/source module). Use nodeType \"utility\". Use the EXACT param names — e.g. delayTime waits `time` milliseconds (not `delay`).";
|
|
10
|
+
var toParamInfo = (params) => Object.entries(params).map(([name, spec]) => ({
|
|
11
|
+
name,
|
|
12
|
+
type: spec.type,
|
|
13
|
+
description: spec.description,
|
|
14
|
+
...spec.default !== void 0 ? { default: spec.default } : {},
|
|
15
|
+
...spec.options ? { options: spec.options } : {},
|
|
16
|
+
...spec.when ? { conditional: true } : {}
|
|
17
|
+
}));
|
|
18
|
+
var builtinGlobalCallbacks = () => Object.entries(BUILTIN_GLOBAL_CALLBACKS).map(([action, { source, title, strictParams, params }]) => ({
|
|
19
|
+
action,
|
|
20
|
+
source,
|
|
21
|
+
title,
|
|
22
|
+
strictParams,
|
|
23
|
+
params: toParamInfo(params)
|
|
24
|
+
}));
|
|
25
|
+
var builtinElementCallbacks = () => Object.entries(BUILTIN_ELEMENT_CALLBACKS).map(([action, { title, strictParams, params }]) => ({
|
|
26
|
+
action,
|
|
27
|
+
title,
|
|
28
|
+
strictParams,
|
|
29
|
+
params: toParamInfo(params)
|
|
30
|
+
}));
|
|
31
|
+
var builtinUtilities = () => Object.entries(BUILTIN_UTILITIES).map(([action, { title, strictParams, params }]) => ({
|
|
32
|
+
action,
|
|
33
|
+
title,
|
|
34
|
+
strictParams,
|
|
35
|
+
params: toParamInfo(params)
|
|
36
|
+
}));
|
|
37
|
+
var DATA_SOURCE_NOTE = "Data-source paths and binding targets observed on this space. Bind a source to an element field with upsertBinding (category attributes|style|initialState). Paths not listed may still be valid. A binding may post-process its value through `transformers` (see below) and be gated by a `when` QueryBuilder guard.";
|
|
38
|
+
var DATA_SOURCE_SCOPE_NOTE = "SCOPE: an element source named `<type>_<idRef>` (e.g. `apiContainer_products`, `list_food-list`) is provided by that element to its DESCENDANTS ONLY — the provider wraps its subtree in the source’s scope, so only elements INSIDE the provider can bind to it. Binding a sibling or unrelated element to it is schema-valid but broken at runtime (the source is not in scope), and validate/apply REJECT it as an error. To consume `apiContainer_x.data`, the bound element must live under that apiContainer. Module sources (no `<type>_<idRef>` head — e.g. state/space/navigation/auth/collection) are global and bindable anywhere.";
|
|
39
|
+
var TRANSFORMERS_NOTE = "Built-in transformers that post-process a binding value before it reaches the field: `source → t₁ → t₂ → field`. Set them on a binding as `transformers: [{ action, params }]` (params are strings). The runtime resolves each by its `action` alone, so an UNKNOWN action is silently skipped (the value passes through unchanged) — use the exact action names below. Common formatting is `twigTemplate` (the value is the {{source}} token, not {{value}}).";
|
|
40
|
+
var buildInteractionCatalog = (schema) => {
|
|
41
|
+
const actions = {};
|
|
42
|
+
const flows = /* @__PURE__ */ new Set();
|
|
43
|
+
for (const el of Object.values(schema.flat)) for (const node of Object.values(el.definition.interactions ?? {})) {
|
|
44
|
+
(actions[node.type] ??= /* @__PURE__ */ new Set()).add(node.action);
|
|
45
|
+
flows.add(node.flowId || node.id);
|
|
46
|
+
}
|
|
47
|
+
const grouped = {};
|
|
48
|
+
for (const [nodeType, set] of Object.entries(actions)) grouped[nodeType] = [...set].sort();
|
|
49
|
+
return {
|
|
50
|
+
note: INTERACTION_NOTE,
|
|
51
|
+
actions: grouped,
|
|
52
|
+
globalCallbacksNote: GLOBAL_CALLBACKS_NOTE,
|
|
53
|
+
globalCallbacks: builtinGlobalCallbacks(),
|
|
54
|
+
elementCallbacksNote: ELEMENT_CALLBACKS_NOTE,
|
|
55
|
+
elementCallbacks: builtinElementCallbacks(),
|
|
56
|
+
utilitiesNote: UTILITIES_NOTE,
|
|
57
|
+
utilities: builtinUtilities(),
|
|
58
|
+
flowCount: flows.size
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
var buildDataSourceCatalog = (schema) => {
|
|
62
|
+
const sources = /* @__PURE__ */ new Set();
|
|
63
|
+
const targets = {};
|
|
64
|
+
for (const el of Object.values(schema.flat)) for (const [category, list] of Object.entries(el.definition.bindings ?? {})) for (const binding of list) {
|
|
65
|
+
sources.add(binding.source);
|
|
66
|
+
(targets[category] ??= /* @__PURE__ */ new Set()).add(binding.to);
|
|
67
|
+
}
|
|
68
|
+
const groupedTargets = {};
|
|
69
|
+
for (const [category, set] of Object.entries(targets)) groupedTargets[category] = [...set].sort();
|
|
70
|
+
return {
|
|
71
|
+
note: DATA_SOURCE_NOTE,
|
|
72
|
+
scopeNote: DATA_SOURCE_SCOPE_NOTE,
|
|
73
|
+
sources: [...sources].sort(),
|
|
74
|
+
targets: groupedTargets,
|
|
75
|
+
transformersNote: TRANSFORMERS_NOTE,
|
|
76
|
+
transformers: transformerCatalog()
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
var observedInteractionActions = (schema) => {
|
|
80
|
+
const actions = /* @__PURE__ */ new Set();
|
|
81
|
+
for (const el of Object.values(schema.flat)) for (const node of Object.values(el.definition.interactions ?? {})) actions.add(node.action);
|
|
82
|
+
return actions;
|
|
83
|
+
};
|
|
84
|
+
var observedDataSources = (schema) => {
|
|
85
|
+
const sources = /* @__PURE__ */ new Set();
|
|
86
|
+
for (const el of Object.values(schema.flat)) for (const list of Object.values(el.definition.bindings ?? {})) for (const binding of list) sources.add(binding.source);
|
|
87
|
+
return sources;
|
|
88
|
+
};
|
|
89
|
+
//#endregion
|
|
90
|
+
export { buildDataSourceCatalog, buildInteractionCatalog, observedDataSources, observedInteractionActions };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type BuiltinParamType = 'text' | 'textarea' | 'select' | 'boolean' | 'number' | 'scalar';
|
|
2
|
+
export interface BuiltinParam {
|
|
3
|
+
type: BuiltinParamType;
|
|
4
|
+
description: string;
|
|
5
|
+
default?: string | number | boolean;
|
|
6
|
+
options?: string[];
|
|
7
|
+
when?: (params: Record<string, unknown>) => boolean;
|
|
8
|
+
required?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export type ParamSpec = Record<string, BuiltinParam>;
|
|
11
|
+
/** Declared params the agent supplied that end up HIDDEN because their own `when` guard is false against the
|
|
12
|
+
* effective params — they are silently ignored (e.g. a global setState `value` with no `type`, or an
|
|
13
|
+
* addNotification `autoDismissTimeout` with autoDismiss:false). Evaluated against the effective params so a param
|
|
14
|
+
* the default fills in (e.g. category:"attribute") does not false-report a value as hidden. */
|
|
15
|
+
export declare const hiddenParams: (provided: Record<string, unknown>, effective: Record<string, unknown>, spec: ParamSpec) => string[];
|
|
16
|
+
/** Declared params marked `required` that the agent did NOT supply, and whose `when` guard holds against the
|
|
17
|
+
* effective params (so they are actually in play). Evaluated against the effective params so a required param
|
|
18
|
+
* gated by a companion (e.g. setState `value`, shown only once `category` is set) is not reported when its guard
|
|
19
|
+
* is not met. */
|
|
20
|
+
export declare const missingRequiredParams: (provided: Record<string, unknown>, effective: Record<string, unknown>, spec: ParamSpec) => string[];
|
|
21
|
+
/** A param the agent supplied whose VALUE does not match its declared type — a boolean given as the string "true",
|
|
22
|
+
* a number given as a string, a `select` value outside its options, a null placeholder left behind. `expected` is
|
|
23
|
+
* the declared type, `got` the JS typeof (or "null"), and `options` the allowed values for a `select`. */
|
|
24
|
+
export interface InvalidParam {
|
|
25
|
+
key: string;
|
|
26
|
+
expected: BuiltinParamType;
|
|
27
|
+
got: string;
|
|
28
|
+
options?: string[];
|
|
29
|
+
}
|
|
30
|
+
/** Declared params the agent supplied whose value is the WRONG type for the catalog — the check that catches a
|
|
31
|
+
* malformed node the unknown/missing/hidden checks miss (a boolean stored as a string, a select value not in its
|
|
32
|
+
* options, a leftover `null`). Only params actually in play are checked: undefined values (the param is absent) and
|
|
33
|
+
* params hidden by their own `when` guard against the effective params are skipped, so this never fires on a param
|
|
34
|
+
* that is not really used. Callers gate this to CLOSED (strict) catalogs, whose types we own authoritatively. */
|
|
35
|
+
export declare const invalidParams: (provided: Record<string, unknown>, effective: Record<string, unknown>, spec: ParamSpec) => InvalidParam[];
|
|
36
|
+
/** Reconcile supplied params to a catalog schema: drop unknown keys when the set is CLOSED (strict), then fill the
|
|
37
|
+
* builder's defaults for any declared param the agent omitted whose `when` guard holds. Mirrors what the builder
|
|
38
|
+
* stores, so the persisted node round-trips cleanly. */
|
|
39
|
+
export declare const reconcileParams: (params: Record<string, unknown>, spec: ParamSpec, strict: boolean) => Record<string, unknown>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { hasValidToken } from "@plitzi/sdk-shared/helpers/twigWrapper";
|
|
2
|
+
//#region src/modules/mcp/catalogs/paramSpec.ts
|
|
3
|
+
/** Declared params the agent supplied that end up HIDDEN because their own `when` guard is false against the
|
|
4
|
+
* effective params — they are silently ignored (e.g. a global setState `value` with no `type`, or an
|
|
5
|
+
* addNotification `autoDismissTimeout` with autoDismiss:false). Evaluated against the effective params so a param
|
|
6
|
+
* the default fills in (e.g. category:"attribute") does not false-report a value as hidden. */
|
|
7
|
+
var hiddenParams = (provided, effective, spec) => {
|
|
8
|
+
const hidden = [];
|
|
9
|
+
for (const [key, param] of Object.entries(spec)) if (param.when && provided[key] !== void 0 && !param.when(effective)) hidden.push(key);
|
|
10
|
+
return hidden;
|
|
11
|
+
};
|
|
12
|
+
/** Declared params marked `required` that the agent did NOT supply, and whose `when` guard holds against the
|
|
13
|
+
* effective params (so they are actually in play). Evaluated against the effective params so a required param
|
|
14
|
+
* gated by a companion (e.g. setState `value`, shown only once `category` is set) is not reported when its guard
|
|
15
|
+
* is not met. */
|
|
16
|
+
var missingRequiredParams = (provided, effective, spec) => {
|
|
17
|
+
const missing = [];
|
|
18
|
+
for (const [key, param] of Object.entries(spec)) if (param.required && provided[key] === void 0 && (!param.when || param.when(effective))) missing.push(key);
|
|
19
|
+
return missing;
|
|
20
|
+
};
|
|
21
|
+
var isNumeric = (value) => value.trim() !== "" && Number.isFinite(Number(value));
|
|
22
|
+
var isBindingToken = (value) => typeof value === "string" && hasValidToken(value);
|
|
23
|
+
var matchesType = (value, param) => {
|
|
24
|
+
switch (param.type) {
|
|
25
|
+
case "boolean": return typeof value === "boolean";
|
|
26
|
+
case "number": return typeof value === "number" || typeof value === "string" && isNumeric(value);
|
|
27
|
+
case "select": return typeof value === "string" && (!param.options || param.options.includes(value));
|
|
28
|
+
case "scalar": return typeof value === "string" || typeof value === "number" || typeof value === "boolean";
|
|
29
|
+
case "text":
|
|
30
|
+
case "textarea": return typeof value === "string";
|
|
31
|
+
default: return true;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
/** Declared params the agent supplied whose value is the WRONG type for the catalog — the check that catches a
|
|
35
|
+
* malformed node the unknown/missing/hidden checks miss (a boolean stored as a string, a select value not in its
|
|
36
|
+
* options, a leftover `null`). Only params actually in play are checked: undefined values (the param is absent) and
|
|
37
|
+
* params hidden by their own `when` guard against the effective params are skipped, so this never fires on a param
|
|
38
|
+
* that is not really used. Callers gate this to CLOSED (strict) catalogs, whose types we own authoritatively. */
|
|
39
|
+
var invalidParams = (provided, effective, spec) => {
|
|
40
|
+
const invalid = [];
|
|
41
|
+
for (const [key, param] of Object.entries(spec)) {
|
|
42
|
+
const value = provided[key];
|
|
43
|
+
if (value === void 0 || isBindingToken(value) || param.when && !param.when(effective)) continue;
|
|
44
|
+
if (!matchesType(value, param)) invalid.push({
|
|
45
|
+
key,
|
|
46
|
+
expected: param.type,
|
|
47
|
+
got: value === null ? "null" : typeof value,
|
|
48
|
+
...param.options ? { options: param.options } : {}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
return invalid;
|
|
52
|
+
};
|
|
53
|
+
/** Reconcile supplied params to a catalog schema: drop unknown keys when the set is CLOSED (strict), then fill the
|
|
54
|
+
* builder's defaults for any declared param the agent omitted whose `when` guard holds. Mirrors what the builder
|
|
55
|
+
* stores, so the persisted node round-trips cleanly. */
|
|
56
|
+
var reconcileParams = (params, spec, strict) => {
|
|
57
|
+
const next = {};
|
|
58
|
+
for (const [key, value] of Object.entries(params)) {
|
|
59
|
+
if (strict && !(key in spec)) continue;
|
|
60
|
+
next[key] = value;
|
|
61
|
+
}
|
|
62
|
+
for (const [key, param] of Object.entries(spec)) {
|
|
63
|
+
if (param.default === void 0 || next[key] !== void 0 || param.when && !param.when(next)) continue;
|
|
64
|
+
next[key] = param.default;
|
|
65
|
+
}
|
|
66
|
+
return next;
|
|
67
|
+
};
|
|
68
|
+
//#endregion
|
|
69
|
+
export { hiddenParams, invalidParams, missingRequiredParams, reconcileParams };
|