@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,30 @@
|
|
|
1
|
+
import { AIBinding, AIBindings, AIInteractionFlow, AIInteractionNodeType } from '../types';
|
|
2
|
+
import { RuleGroup } from '@plitzi/plitzi-ui/QueryBuilder';
|
|
3
|
+
import { ElementBinding, ElementDefinition, ElementInteraction } from '@plitzi/sdk-shared';
|
|
4
|
+
/** The node shape agents supply on write: same as AIInteractionNode but `id` is optional (generated when
|
|
5
|
+
* omitted). Kept structural so the tool-layer zod type assigns to it without importing the tool layer here. */
|
|
6
|
+
export interface FlowNodeInput {
|
|
7
|
+
id?: string;
|
|
8
|
+
title: string;
|
|
9
|
+
nodeType: AIInteractionNodeType;
|
|
10
|
+
action: string;
|
|
11
|
+
params?: Record<string, unknown>;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
when?: RuleGroup;
|
|
14
|
+
elementId?: string;
|
|
15
|
+
preview?: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
declare const BINDING_CATEGORIES: Array<keyof AIBindings>;
|
|
18
|
+
export declare const NULLISH_ELEMENT_IDS: Set<string>;
|
|
19
|
+
export declare const flowsFromInteractions: (interactions: Record<string, ElementInteraction> | undefined) => AIInteractionFlow[];
|
|
20
|
+
export declare const newNodeId: () => string;
|
|
21
|
+
/** Materialize an ordered list of nodes into the stored linked-node map for ONE flow: assign ids where missing,
|
|
22
|
+
* set flowId to the trigger id, and recompute beforeNode/afterNode from the order. `ownerId` is the default
|
|
23
|
+
* source element for callbacks that name none. */
|
|
24
|
+
export declare const materializeFlow: (nodes: FlowNodeInput[], ownerId: string) => {
|
|
25
|
+
flowId: string;
|
|
26
|
+
record: Record<string, ElementInteraction>;
|
|
27
|
+
};
|
|
28
|
+
export declare const bindingToAI: (binding: ElementBinding) => AIBinding;
|
|
29
|
+
export declare const bindingsToAI: (bindings: ElementDefinition["bindings"] | undefined) => AIBindings | undefined;
|
|
30
|
+
export { BINDING_CATEGORIES };
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { applyBuiltinCallback } from "../catalogs/builtinCallbacks.js";
|
|
2
|
+
import { applyElementCallback } from "../catalogs/builtinElementCallbacks.js";
|
|
3
|
+
import { applyUtility } from "../catalogs/builtinUtilities.js";
|
|
4
|
+
import { generateObjectId } from "./space.js";
|
|
5
|
+
//#region src/modules/mcp/helpers/interactions.ts
|
|
6
|
+
var BINDING_CATEGORIES = [
|
|
7
|
+
"attributes",
|
|
8
|
+
"style",
|
|
9
|
+
"initialState"
|
|
10
|
+
];
|
|
11
|
+
var NULLISH_ELEMENT_IDS = /* @__PURE__ */ new Set([
|
|
12
|
+
"undefined",
|
|
13
|
+
"null",
|
|
14
|
+
""
|
|
15
|
+
]);
|
|
16
|
+
var isNonEmptyObject = (value) => value !== void 0 && Object.keys(value).length > 0;
|
|
17
|
+
var nodeToAI = (node) => {
|
|
18
|
+
const ai = {
|
|
19
|
+
id: node.id,
|
|
20
|
+
title: node.title,
|
|
21
|
+
nodeType: node.type,
|
|
22
|
+
action: node.action
|
|
23
|
+
};
|
|
24
|
+
if (isNonEmptyObject(node.params)) ai.params = node.params;
|
|
25
|
+
if (!node.enabled) ai.enabled = false;
|
|
26
|
+
if (node.when !== void 0) ai.when = node.when;
|
|
27
|
+
if (node.elementId && node.elementId !== node.id) ai.elementId = node.elementId;
|
|
28
|
+
if (isNonEmptyObject(node.preview)) ai.preview = node.preview;
|
|
29
|
+
return ai;
|
|
30
|
+
};
|
|
31
|
+
var orderFlow = (nodes) => {
|
|
32
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
33
|
+
const head = nodes.find((n) => !n.beforeNode || !byId.has(n.beforeNode)) ?? nodes[0];
|
|
34
|
+
const ordered = [];
|
|
35
|
+
const seen = /* @__PURE__ */ new Set();
|
|
36
|
+
let current = head;
|
|
37
|
+
while (current && !seen.has(current.id)) {
|
|
38
|
+
seen.add(current.id);
|
|
39
|
+
ordered.push(current);
|
|
40
|
+
current = current.afterNode ? byId.get(current.afterNode) : void 0;
|
|
41
|
+
}
|
|
42
|
+
for (const node of nodes) if (!seen.has(node.id)) ordered.push(node);
|
|
43
|
+
return ordered;
|
|
44
|
+
};
|
|
45
|
+
var flowsFromInteractions = (interactions) => {
|
|
46
|
+
if (!interactions || Object.keys(interactions).length === 0) return [];
|
|
47
|
+
const byFlow = /* @__PURE__ */ new Map();
|
|
48
|
+
for (const node of Object.values(interactions)) {
|
|
49
|
+
const key = node.flowId || node.id;
|
|
50
|
+
const list = byFlow.get(key);
|
|
51
|
+
if (list) list.push(node);
|
|
52
|
+
else byFlow.set(key, [node]);
|
|
53
|
+
}
|
|
54
|
+
const flows = [];
|
|
55
|
+
for (const [flowId, nodes] of byFlow) flows.push({
|
|
56
|
+
flowId,
|
|
57
|
+
nodes: orderFlow(nodes).map(nodeToAI)
|
|
58
|
+
});
|
|
59
|
+
return flows;
|
|
60
|
+
};
|
|
61
|
+
var newNodeId = () => `node_${generateObjectId()}`;
|
|
62
|
+
/** Materialize an ordered list of nodes into the stored linked-node map for ONE flow: assign ids where missing,
|
|
63
|
+
* set flowId to the trigger id, and recompute beforeNode/afterNode from the order. `ownerId` is the default
|
|
64
|
+
* source element for callbacks that name none. */
|
|
65
|
+
var materializeFlow = (nodes, ownerId) => {
|
|
66
|
+
const ids = nodes.map((node) => node.id || newNodeId());
|
|
67
|
+
const flowId = ids[0];
|
|
68
|
+
const record = {};
|
|
69
|
+
nodes.forEach((node, i) => {
|
|
70
|
+
let params = node.params ?? {};
|
|
71
|
+
const supplied = NULLISH_ELEMENT_IDS.has(node.elementId ?? "") ? void 0 : node.elementId;
|
|
72
|
+
let elementId = node.nodeType === "utility" ? null : supplied ?? ownerId;
|
|
73
|
+
if (node.nodeType === "globalCallback") {
|
|
74
|
+
const builtin = applyBuiltinCallback(node.action, params);
|
|
75
|
+
if (builtin.source) {
|
|
76
|
+
elementId = builtin.source;
|
|
77
|
+
params = builtin.params;
|
|
78
|
+
}
|
|
79
|
+
} else if (node.nodeType === "callback") params = applyElementCallback(node.action, params).params;
|
|
80
|
+
else if (node.nodeType === "utility") params = applyUtility(node.action, params).params;
|
|
81
|
+
const interaction = {
|
|
82
|
+
id: ids[i],
|
|
83
|
+
title: node.title,
|
|
84
|
+
type: node.nodeType,
|
|
85
|
+
action: node.action,
|
|
86
|
+
params,
|
|
87
|
+
preview: node.preview ?? {},
|
|
88
|
+
elementId,
|
|
89
|
+
beforeNode: i > 0 ? ids[i - 1] : "",
|
|
90
|
+
afterNode: i < ids.length - 1 ? ids[i + 1] : "",
|
|
91
|
+
flowId,
|
|
92
|
+
enabled: node.enabled ?? true
|
|
93
|
+
};
|
|
94
|
+
if (node.when !== void 0) interaction.when = node.when;
|
|
95
|
+
record[ids[i]] = interaction;
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
flowId,
|
|
99
|
+
record
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
var bindingToAI = (binding) => {
|
|
103
|
+
const ai = {
|
|
104
|
+
id: binding.id,
|
|
105
|
+
to: binding.to,
|
|
106
|
+
source: binding.source
|
|
107
|
+
};
|
|
108
|
+
if (binding.transformers && binding.transformers.length > 0) ai.transformers = binding.transformers;
|
|
109
|
+
if (binding.when !== void 0) ai.when = binding.when;
|
|
110
|
+
if (binding.enabled === false) ai.enabled = false;
|
|
111
|
+
return ai;
|
|
112
|
+
};
|
|
113
|
+
var bindingsToAI = (bindings) => {
|
|
114
|
+
if (!bindings) return;
|
|
115
|
+
const result = {};
|
|
116
|
+
for (const category of BINDING_CATEGORIES) {
|
|
117
|
+
const list = bindings[category];
|
|
118
|
+
if (list && list.length > 0) result[category] = list.map(bindingToAI);
|
|
119
|
+
}
|
|
120
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
121
|
+
};
|
|
122
|
+
//#endregion
|
|
123
|
+
export { BINDING_CATEGORIES, NULLISH_ELEMENT_IDS, bindingToAI, bindingsToAI, flowsFromInteractions, materializeFlow, newNodeId };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ServerLogger } from '@plitzi/sdk-shared';
|
|
2
|
+
export interface McpLog {
|
|
3
|
+
toolCall(name: string, args: unknown, ms: number, error?: unknown): void;
|
|
4
|
+
resourceRead(uri: string, ms: number, error?: unknown): void;
|
|
5
|
+
}
|
|
6
|
+
/** Build the protocol-log sink for one MCP server. Dispatches structured events to the consumer's `logger` when
|
|
7
|
+
* provided; otherwise renders to the console when MCP_DEBUG=1; otherwise a no-op. */
|
|
8
|
+
export declare const createMcpLog: (logger?: ServerLogger) => McpLog;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { renderLogEvent } from "@plitzi/sdk-server/kernel";
|
|
2
|
+
//#region src/modules/mcp/helpers/log.ts
|
|
3
|
+
var MCP_DEBUG = process.env.MCP_DEBUG === "1";
|
|
4
|
+
var MCP_LOG_ARGS = process.env.MCP_LOG_ARGS === "1";
|
|
5
|
+
var shapeOf = (value, depth = 0) => {
|
|
6
|
+
if (value === null) return "null";
|
|
7
|
+
if (Array.isArray(value)) return `[${value.length}]`;
|
|
8
|
+
if (typeof value === "object") {
|
|
9
|
+
if (depth >= 2) return "{…}";
|
|
10
|
+
const entries = Object.entries(value);
|
|
11
|
+
const shown = entries.slice(0, 8).map(([key, item]) => `${key}:${shapeOf(item, depth + 1)}`);
|
|
12
|
+
return `{${[...shown, ...entries.length > shown.length ? ["…"] : []].join(",")}}`;
|
|
13
|
+
}
|
|
14
|
+
return typeof value;
|
|
15
|
+
};
|
|
16
|
+
var rawSummary = (value, max = 300) => {
|
|
17
|
+
let json;
|
|
18
|
+
try {
|
|
19
|
+
json = JSON.stringify(value);
|
|
20
|
+
} catch {
|
|
21
|
+
return "[unserializable]";
|
|
22
|
+
}
|
|
23
|
+
return json.length > max ? `${json.slice(0, max)}…` : json;
|
|
24
|
+
};
|
|
25
|
+
var summarize = (value) => {
|
|
26
|
+
if (value === void 0) return;
|
|
27
|
+
return MCP_LOG_ARGS ? rawSummary(value) : shapeOf(value);
|
|
28
|
+
};
|
|
29
|
+
var errorText = (error) => error instanceof Error ? error.message : String(error);
|
|
30
|
+
var noop = () => void 0;
|
|
31
|
+
var inertLog = {
|
|
32
|
+
toolCall: noop,
|
|
33
|
+
resourceRead: noop
|
|
34
|
+
};
|
|
35
|
+
/** Build the protocol-log sink for one MCP server. Dispatches structured events to the consumer's `logger` when
|
|
36
|
+
* provided; otherwise renders to the console when MCP_DEBUG=1; otherwise a no-op. */
|
|
37
|
+
var createMcpLog = (logger) => {
|
|
38
|
+
if (!logger && !MCP_DEBUG) return inertLog;
|
|
39
|
+
const emit = (event) => {
|
|
40
|
+
if (logger) logger(event);
|
|
41
|
+
else console.log(renderLogEvent(event));
|
|
42
|
+
};
|
|
43
|
+
return {
|
|
44
|
+
toolCall: (name, args, ms, error) => emit({
|
|
45
|
+
kind: "tool",
|
|
46
|
+
name,
|
|
47
|
+
durationMs: ms,
|
|
48
|
+
ok: !error,
|
|
49
|
+
...error ? { error: errorText(error) } : {},
|
|
50
|
+
...summarize(args) !== void 0 ? { argsSummary: summarize(args) } : {},
|
|
51
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
52
|
+
}),
|
|
53
|
+
resourceRead: (uri, ms, error) => emit({
|
|
54
|
+
kind: "resource",
|
|
55
|
+
name: uri,
|
|
56
|
+
durationMs: ms,
|
|
57
|
+
ok: !error,
|
|
58
|
+
...error ? { error: errorText(error) } : {},
|
|
59
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
60
|
+
})
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { createMcpLog };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ValidationError } from '../types';
|
|
2
|
+
/** The result of one mutation handler: counts, the resource URIs it invalidated, any error, and the refs of
|
|
3
|
+
* elements it created/updated (so the caller can return their full detail as context — never for deletes). */
|
|
4
|
+
export interface OpResult {
|
|
5
|
+
errors?: ValidationError[];
|
|
6
|
+
created: number;
|
|
7
|
+
updated: number;
|
|
8
|
+
deleted: number;
|
|
9
|
+
staleResources: string[];
|
|
10
|
+
elementRefs?: string[];
|
|
11
|
+
}
|
|
12
|
+
export declare const empty: () => OpResult;
|
|
13
|
+
export declare const fail: (path: string, message: string, hint: string, validValues?: unknown[]) => OpResult;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//#region src/modules/mcp/helpers/opResult.ts
|
|
2
|
+
var empty = () => ({
|
|
3
|
+
created: 0,
|
|
4
|
+
updated: 0,
|
|
5
|
+
deleted: 0,
|
|
6
|
+
staleResources: []
|
|
7
|
+
});
|
|
8
|
+
var fail = (path, message, hint, validValues) => ({
|
|
9
|
+
...empty(),
|
|
10
|
+
errors: [{
|
|
11
|
+
path,
|
|
12
|
+
message,
|
|
13
|
+
hint,
|
|
14
|
+
validValues
|
|
15
|
+
}]
|
|
16
|
+
});
|
|
17
|
+
//#endregion
|
|
18
|
+
export { empty, fail };
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { AIElementDetail } from '../types';
|
|
2
|
+
import { ComponentCatalog, ConnectorEntry, Element, PageFolder, Schema, Style } from '@plitzi/sdk-shared';
|
|
3
|
+
/** The working view the tools read and mutate: the two Plitzi schemas (elements + style), which the platform
|
|
4
|
+
* stores and persists as separate documents (Space model / Style model), plus the space's `connectors` — a third
|
|
5
|
+
* store (one row per connector) that a provider element points into by identifier. `catalog` is read-only
|
|
6
|
+
* reference data (plugin element-type semantics), not persisted — used only to enrich the plitzi://types resource. */
|
|
7
|
+
export interface Space {
|
|
8
|
+
schema: Schema;
|
|
9
|
+
style: Style;
|
|
10
|
+
connectors: ConnectorEntry[];
|
|
11
|
+
catalog?: ComponentCatalog;
|
|
12
|
+
}
|
|
13
|
+
export declare const cloneSpace: (space: Space) => Space;
|
|
14
|
+
export declare const emptySpace: () => Space;
|
|
15
|
+
/** A connector by the identifier a provider element stores in its `connector` attribute. */
|
|
16
|
+
export declare const findConnectorEntry: (space: Space, ref: string) => ConnectorEntry | undefined;
|
|
17
|
+
export declare const slugify: (value: string) => string;
|
|
18
|
+
/** A value when it is a string, otherwise undefined — for the many attributes typed as `unknown` that are strings
|
|
19
|
+
* in practice (name, slug, subType, dom id…). */
|
|
20
|
+
export declare const strOr: (value: unknown) => string | undefined;
|
|
21
|
+
/** Display name of a page or element: its `name` attribute when set, otherwise its definition label. */
|
|
22
|
+
export declare const nameOf: (el: Element) => string;
|
|
23
|
+
/** Stable, human-readable ref for a page: its idRef, then slug, then a slugified label. A page without an idRef is
|
|
24
|
+
* still addressable — unlike a data source, a page ref has meaningful fallbacks the agent can read off the tree. */
|
|
25
|
+
export declare const pageRefOf: (el: Element) => string;
|
|
26
|
+
/** Stable ref for ADDRESSING a non-page element in the tree: its idRef when present, otherwise the opaque id so an
|
|
27
|
+
* element without one is still reachable — the agent needs to name it to give it an idRef in the first place.
|
|
28
|
+
* This is not the wiring key: the runtime wires interactions and data sources by idRef only, so an element
|
|
29
|
+
* addressed here by its id alone publishes no source and takes no interactions (see `getSourceName`). */
|
|
30
|
+
export declare const elementRefOf: (el: Element) => string;
|
|
31
|
+
/** A memoized element projection: its full detail and the stateVersion (content hash) derived from it, plus the
|
|
32
|
+
* style object they were computed against (a different style ref forces a recompute). */
|
|
33
|
+
export interface ElementVersion {
|
|
34
|
+
style: Style;
|
|
35
|
+
detail: AIElementDetail;
|
|
36
|
+
version: string;
|
|
37
|
+
}
|
|
38
|
+
export interface SpaceIndex {
|
|
39
|
+
/** Ids of the page elements (schema.pages ∪ every element whose type is 'page'). */
|
|
40
|
+
pageIds: Set<string>;
|
|
41
|
+
/** The page elements, in schema.flat insertion order (what getPageElements returns). */
|
|
42
|
+
pageElements: Element[];
|
|
43
|
+
/** page ref (idRef/slug/label) AND raw page id → the page element. First writer wins on a ref collision. */
|
|
44
|
+
pageByRef: Map<string, Element>;
|
|
45
|
+
/** non-page idRef AND raw id → the element. First writer wins on a ref collision. */
|
|
46
|
+
elementByRef: Map<string, Element>;
|
|
47
|
+
/** Any element id (page root or nested descendant) → the id of the page it belongs to. */
|
|
48
|
+
pageOf: Map<string, string>;
|
|
49
|
+
/** element id → its memoized detail/version, so a page-skeleton hash, a search hit and a follow-up element read
|
|
50
|
+
* all resolve the same element once. Populated lazily by `elementView`; dropped whole on `invalidateIndex`. */
|
|
51
|
+
detailCache: Map<string, ElementVersion>;
|
|
52
|
+
}
|
|
53
|
+
/** The index for a schema, built once and memoized on the schema object. */
|
|
54
|
+
export declare const spaceIndex: (schema: Schema) => SpaceIndex;
|
|
55
|
+
/** Drop the memoized index wholesale. A correctness fallback for a mutation with no dedicated incremental updater;
|
|
56
|
+
* the next scanner rebuilds against current state. Prefer the index* helpers below, which keep a built index in
|
|
57
|
+
* step in O(1) — a large structural batch would otherwise pay an O(flat) rebuild after every op. */
|
|
58
|
+
export declare const invalidateIndex: (schema: Schema) => void;
|
|
59
|
+
/** A new non-page element was created under `pageId`. */
|
|
60
|
+
export declare const indexAddElement: (schema: Schema, el: Element, pageId: string) => void;
|
|
61
|
+
/** These non-page elements were deleted (an element and its descendants). */
|
|
62
|
+
export declare const indexRemoveElements: (schema: Schema, els: Element[]) => void;
|
|
63
|
+
/** An existing element was just given an idRef (it had none), so it becomes addressable by that ref. */
|
|
64
|
+
export declare const indexReRefElement: (schema: Schema, el: Element) => void;
|
|
65
|
+
/** A new page element was created. */
|
|
66
|
+
export declare const indexAddPage: (schema: Schema, page: Element) => void;
|
|
67
|
+
/** A page and its `descendants` (its non-page elements) were deleted. */
|
|
68
|
+
export declare const indexRemovePage: (schema: Schema, page: Element, descendants: Element[]) => void;
|
|
69
|
+
/** A page's slug/name/default changed; re-key its pageByRef entry if that changed its ref. `oldRef` is the ref
|
|
70
|
+
* computed BEFORE the attribute change. */
|
|
71
|
+
export declare const indexReRefPage: (schema: Schema, page: Element, oldRef: string) => void;
|
|
72
|
+
/** A move reparented an element within its page: the ref/page maps are unchanged, but the moved element's
|
|
73
|
+
* parentRef and both parents' childRefs did change, so their memoized detail must be dropped. */
|
|
74
|
+
export declare const indexInvalidateDetails: (schema: Schema) => void;
|
|
75
|
+
export declare const isPageElement: (schema: Schema, el: Element) => boolean;
|
|
76
|
+
export declare const getPageElements: (schema: Schema) => Element[];
|
|
77
|
+
/** Finds a page by its semantic ref (idRef/slug/…) or its raw id, so legacy schemas without an idRef still resolve. */
|
|
78
|
+
export declare const findPageByRef: (schema: Schema, pageRef: string) => Element | undefined;
|
|
79
|
+
/** Find any non-page element by its semantic ref (idRef) or raw id, across the whole space. */
|
|
80
|
+
export declare const findElementByRef: (schema: Schema, ref: string) => Element | undefined;
|
|
81
|
+
export declare const pageFoldersOf: (schema: Schema) => PageFolder[];
|
|
82
|
+
/** Resolve a folder by its id, or (for agent convenience) by an exact name or slug when that is unambiguous. */
|
|
83
|
+
export declare const findFolderByRef: (schema: Schema, ref: string) => PageFolder | undefined;
|
|
84
|
+
/** Order folders so every parent precedes its children — the invariant the schema validator enforces on
|
|
85
|
+
* pageFolders (a parentId must appear earlier in the array). Cycles (rejected upstream) are left in place. */
|
|
86
|
+
export declare const sortFolders: (folders: PageFolder[]) => PageFolder[];
|
|
87
|
+
/** Ancestor ids of a folder (following parentId), stopping on a cycle. Used to reject a parent change that would
|
|
88
|
+
* make a folder its own ancestor. */
|
|
89
|
+
export declare const folderAncestorIds: (folders: PageFolder[], startParentId: string | undefined) => string[];
|
|
90
|
+
/** Route params a page's slug binds (e.g. ":spaceId/update/*" → ["spaceId"]). These are valid {{name}}
|
|
91
|
+
* references on that page even though they are not space-level schema variables. */
|
|
92
|
+
export declare const slugRouteParams: (slug: string) => string[];
|
|
93
|
+
/** Every route param bound by any page slug in the space (union), so {{name}} validation does not false-flag a
|
|
94
|
+
* page-scoped dynamic binding. */
|
|
95
|
+
export declare const routeParamNames: (schema: Schema) => string[];
|
|
96
|
+
/** Indexed lookup that reflects the runtime reality: a flat id may be dangling (rsc placeholders, stale items). */
|
|
97
|
+
export declare const elementById: (schema: Schema, id: string) => Element | undefined;
|
|
98
|
+
export declare const descendantIds: (schema: Schema, pageRootId: string) => string[];
|
|
99
|
+
/** Resolve a ref to a concrete element within a page subtree (or the page root itself). Accepts either the
|
|
100
|
+
* semantic ref (idRef) or the raw element id, so schemas predating idRef keep working through their ids. */
|
|
101
|
+
export declare const resolveRef: (schema: Schema, page: Element, ref: string) => Element | undefined;
|
|
102
|
+
/** Ordered children of an element, honoring definition.items and skipping dangling ids. */
|
|
103
|
+
export declare const orderedChildren: (schema: Schema, el: Element) => Element[];
|
|
104
|
+
/** The page ref an element belongs to. 'unknown' when it has no page ancestor. */
|
|
105
|
+
export declare const pageRefOfElement: (schema: Schema, el: Element) => string;
|
|
106
|
+
/** Total number of descendant elements under a subtree (excluding the root). */
|
|
107
|
+
export declare const descendantCount: (schema: Schema, rootId: string) => number;
|
|
108
|
+
export declare const emptySpaceMessage = "Space data not available";
|
|
109
|
+
/** The code a space-dependent answer carries when the connection reaches no space, so both the agent and a host UI
|
|
110
|
+
* can tell "this connection cannot do that" from "the call failed". */
|
|
111
|
+
export declare const noSpaceErrorCode = "NO_SPACE_ATTACHED";
|
|
112
|
+
export declare const readOnlyGrantErrorCode = "READ_ONLY_GRANT";
|
|
113
|
+
export declare const unauthorizedSpaceMessage: string;
|
|
114
|
+
/** Raised when a space-dependent operation runs on a connection that resolves no spaceId. A type of its own so the
|
|
115
|
+
* host answers it as a STATE of the connection — a plain result the agent reads — instead of letting it surface as
|
|
116
|
+
* a failed call, which hosts render to the user as "cannot connect to this server". */
|
|
117
|
+
export declare class NoSpaceError extends Error {
|
|
118
|
+
constructor();
|
|
119
|
+
}
|
|
120
|
+
export declare const readOnlyGrantMessage: string;
|
|
121
|
+
/** Raised when a write runs under a grant that carries no write authority. Like NoSpaceError this is a STATE of
|
|
122
|
+
* the connection rather than a failed call, so the host renders it as a result the agent can act on. */
|
|
123
|
+
export declare class ReadOnlyGrantError extends Error {
|
|
124
|
+
constructor();
|
|
125
|
+
}
|
|
126
|
+
export declare const generateObjectId: () => string;
|