@nextblock-cms/cortex 0.18.8 → 0.19.2

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/index.cjs.js CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("./lib/ai-block-generation.cjs.js"),T=require("./lib/ai-client.cjs.js"),t=require("./lib/ai-config.cjs.js"),A=require("./lib/ai-cortex-widget-builder.cjs.js"),u=require("./lib/ai-global-agent-custom-block-tools.cjs.js"),S=require("./lib/ai-global-agent-db-tools.cjs.js"),o=require("./lib/ai-global-agent-site-tools.cjs.js"),e=require("./lib/ai-global-agent-tools.cjs.js"),E=require("./lib/ai-key-crypto.cjs.js"),I=require("./lib/ai-key-verification.cjs.js"),O=require("./lib/ai-model-catalog.cjs.js"),r=require("./lib/ai-model-registry.cjs.js"),_=require("./lib/ai-seo-metadata.cjs.js"),l=require("./lib/ai-vision.cjs.js"),C=require("./lib/block-content-schemas.cjs.js"),m=require("./lib/cortex-widget-registry.cjs.js"),n=require("./lib/cortex-widget-schema.cjs.js"),i=require("./lib/mcp-server.cjs.js"),a=require("./lib/mcp-tokens.cjs.js"),c=require("./lib/mcp-tool-registry.cjs.js"),s=require("./lib/site-brief.cjs.js");require("./lib/zod-config.cjs.js");const d=require("zod");exports.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT=R.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT;exports.generateEditorBlocksRequestSchema=R.generateEditorBlocksRequestSchema;exports.generateEditorHtmlFragment=R.generateEditorHtmlFragment;exports.validateGeneratedEditorHtmlFragment=R.validateGeneratedEditorHtmlFragment;exports.createCortexAiOpenRouterClient=T.createCortexAiOpenRouterClient;exports.createCortexAiOpenRouterProvider=T.createCortexAiOpenRouterProvider;exports.generateCortexAiText=T.generateCortexAiText;exports.getStoredCortexAiModelSelection=T.getStoredCortexAiModelSelection;exports.resolveCortexAiOpenRouterCredential=T.resolveCortexAiOpenRouterCredential;exports.CORTEX_AI_AGENT_SETTINGS_BOUNDS=t.CORTEX_AI_AGENT_SETTINGS_BOUNDS;exports.CORTEX_AI_AGENT_SETTINGS_DEFAULTS=t.CORTEX_AI_AGENT_SETTINGS_DEFAULTS;exports.CORTEX_AI_AGENT_SETTINGS_KEY=t.CORTEX_AI_AGENT_SETTINGS_KEY;exports.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY=t.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY;exports.CORTEX_AI_OPENROUTER_SETTING_KEY=t.CORTEX_AI_OPENROUTER_SETTING_KEY;exports.CORTEX_AI_PACKAGE_ID=t.CORTEX_AI_PACKAGE_ID;exports.CORTEX_AI_PACKAGE_NAME=t.CORTEX_AI_PACKAGE_NAME;exports.CORTEX_AI_PEXELS_SETTING_KEY=t.CORTEX_AI_PEXELS_SETTING_KEY;exports.CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY=t.CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY;exports.CORTEX_AI_UNSPLASH_SETTING_KEY=t.CORTEX_AI_UNSPLASH_SETTING_KEY;exports.decryptStoredOpenRouterApiKey=t.decryptStoredOpenRouterApiKey;exports.encryptStoredOpenRouterApiKey=t.encryptStoredOpenRouterApiKey;exports.getCortexAiEnvConfig=t.getCortexAiEnvConfig;exports.getEnvOpenRouterKeyStatus=t.getEnvOpenRouterKeyStatus;exports.getOpenRouterEnvApiKey=t.getOpenRouterEnvApiKey;exports.getPexelsEnvApiKey=t.getPexelsEnvApiKey;exports.getStoredOpenRouterKeyStatus=t.getStoredOpenRouterKeyStatus;exports.getUnsplashEnvApiKey=t.getUnsplashEnvApiKey;exports.normalizeCortexAiAgentSettings=t.normalizeCortexAiAgentSettings;exports.resolveCortexAiAgentSettings=t.resolveCortexAiAgentSettings;exports.generateCortexWidgetDefinition=A.generateCortexWidgetDefinition;exports.createCortexCustomBlockTools=u.createCortexCustomBlockTools;exports.createCustomBlockInputSchema=u.createCustomBlockInputSchema;exports.deleteCustomBlockInputSchema=u.deleteCustomBlockInputSchema;exports.executeCreateCustomBlock=u.executeCreateCustomBlock;exports.executeDeleteCustomBlock=u.executeDeleteCustomBlock;exports.executeListCustomBlocks=u.executeListCustomBlocks;exports.executeUpdateCustomBlock=u.executeUpdateCustomBlock;exports.listCustomBlocksInputSchema=u.listCustomBlocksInputSchema;exports.updateCustomBlockInputSchema=u.updateCustomBlockInputSchema;exports.createCortexDatabaseAgentTools=S.createCortexDatabaseAgentTools;exports.describeDatabaseSchemaInputSchema=S.describeDatabaseSchemaInputSchema;exports.executeDatabaseActionPlan=S.executeDatabaseActionPlan;exports.executeDatabaseActionPlanInputSchema=S.executeDatabaseActionPlanInputSchema;exports.executeDatabaseMutation=S.executeDatabaseMutation;exports.executeDatabaseMutationInputSchema=S.executeDatabaseMutationInputSchema;exports.executeDescribeDatabaseSchema=S.executeDescribeDatabaseSchema;exports.executeReadDatabaseRecords=S.executeReadDatabaseRecords;exports.readDatabaseRecordsInputSchema=S.readDatabaseRecordsInputSchema;exports.NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS=o.NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS;exports.NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS=o.NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS;exports.createCortexSiteTools=o.createCortexSiteTools;exports.executeFinishSiteBuild=o.executeFinishSiteBuild;exports.executeGetSiteOverview=o.executeGetSiteOverview;exports.executeResetSiteContent=o.executeResetSiteContent;exports.executeSaveSiteBrief=o.executeSaveSiteBrief;exports.executeStartSiteBuild=o.executeStartSiteBuild;exports.executeUpdateSiteIdentity=o.executeUpdateSiteIdentity;exports.finishSiteBuildInputSchema=o.finishSiteBuildInputSchema;exports.formatCortexSiteOverviewForPrompt=o.formatCortexSiteOverviewForPrompt;exports.getSiteOverviewInputSchema=o.getSiteOverviewInputSchema;exports.readCortexBuildSession=o.readCortexBuildSession;exports.readCortexSiteBrief=o.readCortexSiteBrief;exports.resetSiteContentInputSchema=o.resetSiteContentInputSchema;exports.resolveCortexBuildSession=o.resolveCortexBuildSession;exports.saveSiteBriefInputSchema=o.saveSiteBriefInputSchema;exports.startSiteBuildInputSchema=o.startSiteBuildInputSchema;exports.updateSiteIdentityInputSchema=o.updateSiteIdentityInputSchema;exports.buildVisibleContactIntroActionPlan=e.buildVisibleContactIntroActionPlan;exports.cortexAiPageContextSchema=e.cortexAiPageContextSchema;exports.createCmsPageInputSchema=e.createCmsPageInputSchema;exports.createCmsPostInputSchema=e.createCmsPostInputSchema;exports.createCmsProductInputSchema=e.createCmsProductInputSchema;exports.createCortexGlobalAgentTools=e.createCortexGlobalAgentTools;exports.deleteCmsItemInputSchema=e.deleteCmsItemInputSchema;exports.executeCmsActionPlan=e.executeCmsActionPlan;exports.executeCmsActionPlanInputSchema=e.executeCmsActionPlanInputSchema;exports.executeCreateCmsPage=e.executeCreateCmsPage;exports.executeCreateCmsPost=e.executeCreateCmsPost;exports.executeCreateCmsProduct=e.executeCreateCmsProduct;exports.executeDeleteCmsItem=e.executeDeleteCmsItem;exports.executeFetchEcommerceStats=e.executeFetchEcommerceStats;exports.executeFetchUrlContent=e.executeFetchUrlContent;exports.executeInsertContentBlock=e.executeInsertContentBlock;exports.executeManageProductVariants=e.executeManageProductVariants;exports.executePrepareDeleteCmsItem=e.executePrepareDeleteCmsItem;exports.executePublishContentDraft=e.executePublishContentDraft;exports.executeReadCurrentCmsItem=e.executeReadCurrentCmsItem;exports.executeRewritePageDraft=e.executeRewritePageDraft;exports.executeSearchDocumentation=e.executeSearchDocumentation;exports.executeSearchDocumentationWithTimeout=e.executeSearchDocumentationWithTimeout;exports.executeSearchStockPhotos=e.executeSearchStockPhotos;exports.executeSetContentImages=e.executeSetContentImages;exports.executeTranslateContentBulk=e.executeTranslateContentBulk;exports.executeTranslatePage=e.executeTranslatePage;exports.executeUpdateCmsItemField=e.executeUpdateCmsItemField;exports.executeUpdateContentBlock=e.executeUpdateContentBlock;exports.executeUpdateCurrentCmsFields=e.executeUpdateCurrentCmsFields;exports.executeUpdateFooter=e.executeUpdateFooter;exports.executeUpdateNavigationBar=e.executeUpdateNavigationBar;exports.executeUpdateSectionColumnBlock=e.executeUpdateSectionColumnBlock;exports.fetchEcommerceStatsInputSchema=e.fetchEcommerceStatsInputSchema;exports.fetchUrlContentInputSchema=e.fetchUrlContentInputSchema;exports.insertContentBlockInputSchema=e.insertContentBlockInputSchema;exports.isBlockedFetchHost=e.isBlockedFetchHost;exports.manageProductVariantsInputSchema=e.manageProductVariantsInputSchema;exports.maybeTriggerStockPhotoDownloads=e.maybeTriggerStockPhotoDownloads;exports.navigationItemInputSchema=e.navigationItemInputSchema;exports.prepareDeleteCmsItemInputSchema=e.prepareDeleteCmsItemInputSchema;exports.publishContentDraftInputSchema=e.publishContentDraftInputSchema;exports.readCurrentCmsItemInputSchema=e.readCurrentCmsItemInputSchema;exports.resolveCortexAiStockPhotoProvider=e.resolveCortexAiStockPhotoProvider;exports.resolveCortexAiStockPhotoProviders=e.resolveCortexAiStockPhotoProviders;exports.rewritePageDraftInputSchema=e.rewritePageDraftInputSchema;exports.searchDocumentationInputSchema=e.searchDocumentationInputSchema;exports.searchStockPhotosInputSchema=e.searchStockPhotosInputSchema;exports.setContentImagesInputSchema=e.setContentImagesInputSchema;exports.translateContentBulkInputSchema=e.translateContentBulkInputSchema;exports.translatePageInputSchema=e.translatePageInputSchema;exports.updateCmsItemFieldInputSchema=e.updateCmsItemFieldInputSchema;exports.updateContentBlockInputSchema=e.updateContentBlockInputSchema;exports.updateCurrentCmsFieldsInputSchema=e.updateCurrentCmsFieldsInputSchema;exports.updateFooterInputSchema=e.updateFooterInputSchema;exports.updateNavigationBarInputSchema=e.updateNavigationBarInputSchema;exports.updateSectionColumnBlockInputSchema=e.updateSectionColumnBlockInputSchema;exports.CORTEX_AI_KEY_ALGORITHM=E.CORTEX_AI_KEY_ALGORITHM;exports.CORTEX_AI_KEY_ENVELOPE_VERSION=E.CORTEX_AI_KEY_ENVELOPE_VERSION;exports.decryptOpenRouterApiKey=E.decryptOpenRouterApiKey;exports.encryptOpenRouterApiKey=E.encryptOpenRouterApiKey;exports.getMaskedOpenRouterKey=E.getMaskedOpenRouterKey;exports.getOpenRouterKeyEnvelopeStatus=E.getOpenRouterKeyEnvelopeStatus;exports.verifyOpenRouterApiKey=I.verifyOpenRouterApiKey;exports.verifyPexelsApiKey=I.verifyPexelsApiKey;exports.verifyUnsplashAccessKey=I.verifyUnsplashAccessKey;exports.listCortexAiCompatibleOpenRouterModels=O.listCortexAiCompatibleOpenRouterModels;exports.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY=r.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY;exports.CORTEX_AI_MODEL_REGISTRY=r.CORTEX_AI_MODEL_REGISTRY;exports.CORTEX_AI_OPENROUTER_BASE_URL=r.CORTEX_AI_OPENROUTER_BASE_URL;exports.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL=r.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL;exports.CORTEX_AI_REQUIRED_MODEL_PARAMETERS=r.CORTEX_AI_REQUIRED_MODEL_PARAMETERS;exports.CortexAiRoutingError=r.CortexAiRoutingError;exports.buildCortexAiModelFallbackChain=r.buildCortexAiModelFallbackChain;exports.buildCortexAiRoutingPolicy=r.buildCortexAiRoutingPolicy;exports.createCortexAiStoredModelSelection=r.createCortexAiStoredModelSelection;exports.filterCortexAiCompatibleOpenRouterModels=r.filterCortexAiCompatibleOpenRouterModels;exports.getHttpStatusCode=r.getHttpStatusCode;exports.getOpenRouterErrorStatus=r.getOpenRouterErrorStatus;exports.isCortexAiFreeModelId=r.isCortexAiFreeModelId;exports.isOpenRouterRateLimitError=r.isOpenRouterRateLimitError;exports.isOpenRouterRecoverableRoutingError=r.isOpenRouterRecoverableRoutingError;exports.omitUnsupportedCortexAiModelOptions=r.omitUnsupportedCortexAiModelOptions;exports.runWithCortexAiModelFallback=r.runWithCortexAiModelFallback;exports.safeParseCortexAiModelSelection=r.safeParseCortexAiModelSelection;exports.summarizeCortexAiRoutingError=r.summarizeCortexAiRoutingError;exports.CORTEX_AI_SEO_METADATA_CONTENT_BUDGET=_.CORTEX_AI_SEO_METADATA_CONTENT_BUDGET;exports.CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS=_.CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS;exports.cortexAiSeoMetadataOutputSchema=_.cortexAiSeoMetadataOutputSchema;exports.extractJsonObject=_.extractJsonObject;exports.generateCortexAiSeoMetadata=_.generateCortexAiSeoMetadata;exports.truncateOnWordBoundary=_.truncateOnWordBoundary;exports.CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH=l.CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH;exports.CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY=l.CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY;exports.buildCortexAiVisionRoutingPolicy=l.buildCortexAiVisionRoutingPolicy;exports.generateCortexAiAltText=l.generateCortexAiAltText;exports.isKnownVisionCapableCortexAiModelId=l.isKnownVisionCapableCortexAiModelId;exports.normalizeGeneratedAltText=l.normalizeGeneratedAltText;exports.availableCortexAiBlockTypes=C.availableCortexAiBlockTypes;exports.cortexAiBlockTypeSchema=C.cortexAiBlockTypeSchema;exports.customBlockSlugPatternSchema=C.customBlockSlugPatternSchema;exports.fallbackBlockSchemas=C.fallbackBlockSchemas;exports.isValidBlockType=C.isValidBlockType;exports.loadCustomBlockDefinitions=C.loadCustomBlockDefinitions;exports.readCustomBlockFields=C.readCustomBlockFields;exports.sectionBlockFallbackSchema=C.sectionBlockFallbackSchema;exports.validateCortexBlockContent=C.validateCortexBlockContent;exports.validateCustomBlockInstanceContent=C.validateCustomBlockInstanceContent;exports.CORTEX_WIDGET_DEFINITION_SELECT=m.CORTEX_WIDGET_DEFINITION_SELECT;exports.CortexWidgetRegistryInsertError=m.CortexWidgetRegistryInsertError;exports.buildCortexWidgetDefinitionInsertPayload=m.buildCortexWidgetDefinitionInsertPayload;exports.insertCortexWidgetDefinition=m.insertCortexWidgetDefinition;exports.CORTEX_WIDGET_ALLOWED_RELATION_TABLES=n.CORTEX_WIDGET_ALLOWED_RELATION_TABLES;exports.buildCortexProfileCardVerificationDefinition=n.buildCortexProfileCardVerificationDefinition;exports.buildCortexWidgetBuilderPrompt=n.buildCortexWidgetBuilderPrompt;exports.buildCortexWidgetBuilderSystemPrompt=n.buildCortexWidgetBuilderSystemPrompt;exports.cortexWidgetBuildRequestSchema=n.cortexWidgetBuildRequestSchema;exports.cortexWidgetDbRelationFieldSchema=n.cortexWidgetDbRelationFieldSchema;exports.cortexWidgetDefinitionSchema=n.cortexWidgetDefinitionSchema;exports.cortexWidgetFieldSchema=n.cortexWidgetFieldSchema;exports.cortexWidgetImageR2FieldSchema=n.cortexWidgetImageR2FieldSchema;exports.cortexWidgetLayoutNodeSchema=n.cortexWidgetLayoutNodeSchema;exports.cortexWidgetRichTextFieldSchema=n.cortexWidgetRichTextFieldSchema;exports.cortexWidgetTextFieldSchema=n.cortexWidgetTextFieldSchema;exports.validateCortexWidgetDefinitionOutput=n.validateCortexWidgetDefinitionOutput;exports.CORTEX_MCP_DEFAULT_PROTOCOL_VERSION=i.CORTEX_MCP_DEFAULT_PROTOCOL_VERSION;exports.CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION=i.CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION;exports.CORTEX_MCP_MODERN_PROTOCOL_VERSION=i.CORTEX_MCP_MODERN_PROTOCOL_VERSION;exports.CORTEX_MCP_SERVER_NAME=i.CORTEX_MCP_SERVER_NAME;exports.CORTEX_MCP_SERVER_TITLE=i.CORTEX_MCP_SERVER_TITLE;exports.CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS=i.CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS;exports.JSON_RPC_INTERNAL_ERROR=i.JSON_RPC_INTERNAL_ERROR;exports.JSON_RPC_INVALID_PARAMS=i.JSON_RPC_INVALID_PARAMS;exports.JSON_RPC_INVALID_REQUEST=i.JSON_RPC_INVALID_REQUEST;exports.JSON_RPC_METHOD_NOT_FOUND=i.JSON_RPC_METHOD_NOT_FOUND;exports.JSON_RPC_PARSE_ERROR=i.JSON_RPC_PARSE_ERROR;exports.handleCortexMcpMessage=i.handleCortexMcpMessage;exports.isJsonRpcNotification=i.isJsonRpcNotification;exports.isModernEraMessage=i.isModernEraMessage;exports.CORTEX_AI_MCP_SCOPES=a.CORTEX_AI_MCP_SCOPES;exports.CORTEX_AI_MCP_SETTINGS_DEFAULTS=a.CORTEX_AI_MCP_SETTINGS_DEFAULTS;exports.CORTEX_AI_MCP_SETTINGS_KEY=a.CORTEX_AI_MCP_SETTINGS_KEY;exports.CORTEX_AI_MCP_TOKENS_TABLE=a.CORTEX_AI_MCP_TOKENS_TABLE;exports.CORTEX_AI_MCP_TOKEN_PREFIX=a.CORTEX_AI_MCP_TOKEN_PREFIX;exports.hashCortexAiMcpToken=a.hashCortexAiMcpToken;exports.isLocalhostHost=a.isLocalhostHost;exports.mintCortexAiMcpToken=a.mintCortexAiMcpToken;exports.normalizeCortexAiMcpSettings=a.normalizeCortexAiMcpSettings;exports.parseBearerToken=a.parseBearerToken;exports.resolveCortexAiMcpSettings=a.resolveCortexAiMcpSettings;exports.shouldTrustLocalMcpRequest=a.shouldTrustLocalMcpRequest;exports.touchCortexAiMcpToken=a.touchCortexAiMcpToken;exports.verifyCortexAiMcpToken=a.verifyCortexAiMcpToken;exports.CORTEX_MCP_PROMPTS=c.CORTEX_MCP_PROMPTS;exports.CORTEX_MCP_RESOURCES=c.CORTEX_MCP_RESOURCES;exports.CORTEX_MCP_TOOL_ALIASES=c.CORTEX_MCP_TOOL_ALIASES;exports.CORTEX_MCP_TOOL_KINDS=c.CORTEX_MCP_TOOL_KINDS;exports.CortexMcpForbiddenToolError=c.CortexMcpForbiddenToolError;exports.CortexMcpUnknownToolError=c.CortexMcpUnknownToolError;exports.assertCortexMcpToolCoverage=c.assertCortexMcpToolCoverage;exports.buildCortexMcpToolDefinitions=c.buildCortexMcpToolDefinitions;exports.callCortexMcpTool=c.callCortexMcpTool;exports.cortexMcpScopesAllow=c.cortexMcpScopesAllow;exports.getCortexMcpPrompt=c.getCortexMcpPrompt;exports.getCortexMcpToolKind=c.getCortexMcpToolKind;exports.readCortexMcpResource=c.readCortexMcpResource;exports.resolveCortexMcpToolName=c.resolveCortexMcpToolName;exports.CORTEX_AI_BUILD_SESSION_SETTING_KEY=s.CORTEX_AI_BUILD_SESSION_SETTING_KEY;exports.CORTEX_AI_SITE_BRIEF_SETTING_KEY=s.CORTEX_AI_SITE_BRIEF_SETTING_KEY;exports.cortexBuildSessionSchema=s.cortexBuildSessionSchema;exports.cortexSiteBriefInputSchema=s.cortexSiteBriefInputSchema;exports.cortexSiteBriefSchema=s.cortexSiteBriefSchema;exports.formatCortexSiteBriefForPrompt=s.formatCortexSiteBriefForPrompt;exports.isCortexBuildSessionUsable=s.isCortexBuildSessionUsable;exports.isCortexSiteBriefComplete=s.isCortexSiteBriefComplete;exports.safeParseCortexSiteBrief=s.safeParseCortexSiteBrief;Object.defineProperty(exports,"z",{enumerable:!0,get:()=>d.z});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("./lib/ai-block-generation.cjs.js"),T=require("./lib/ai-client.cjs.js"),t=require("./lib/ai-config.cjs.js"),I=require("./lib/ai-cortex-widget-builder.cjs.js"),u=require("./lib/ai-global-agent-custom-block-tools.cjs.js"),S=require("./lib/ai-global-agent-db-tools.cjs.js"),o=require("./lib/ai-global-agent-site-tools.cjs.js"),e=require("./lib/ai-global-agent-tools.cjs.js"),_=require("./lib/ai-key-crypto.cjs.js"),m=require("./lib/ai-key-verification.cjs.js"),O=require("./lib/ai-model-catalog.cjs.js"),r=require("./lib/ai-model-registry.cjs.js"),s=require("./lib/ai-seo-metadata.cjs.js"),l=require("./lib/ai-vision.cjs.js"),C=require("./lib/block-content-schemas.cjs.js"),A=require("./lib/cortex-widget-registry.cjs.js"),n=require("./lib/cortex-widget-schema.cjs.js"),a=require("./lib/mcp-server.cjs.js"),i=require("./lib/mcp-tokens.cjs.js"),c=require("./lib/mcp-tool-registry.cjs.js"),E=require("./lib/site-brief.cjs.js");require("./lib/zod-config.cjs.js");const d=require("zod");exports.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT=R.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT;exports.generateEditorBlocksRequestSchema=R.generateEditorBlocksRequestSchema;exports.generateEditorHtmlFragment=R.generateEditorHtmlFragment;exports.validateGeneratedEditorHtmlFragment=R.validateGeneratedEditorHtmlFragment;exports.createCortexAiOpenRouterClient=T.createCortexAiOpenRouterClient;exports.createCortexAiOpenRouterProvider=T.createCortexAiOpenRouterProvider;exports.generateCortexAiText=T.generateCortexAiText;exports.getStoredCortexAiModelSelection=T.getStoredCortexAiModelSelection;exports.resolveCortexAiOpenRouterCredential=T.resolveCortexAiOpenRouterCredential;exports.CORTEX_AI_AGENT_SETTINGS_BOUNDS=t.CORTEX_AI_AGENT_SETTINGS_BOUNDS;exports.CORTEX_AI_AGENT_SETTINGS_DEFAULTS=t.CORTEX_AI_AGENT_SETTINGS_DEFAULTS;exports.CORTEX_AI_AGENT_SETTINGS_KEY=t.CORTEX_AI_AGENT_SETTINGS_KEY;exports.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY=t.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY;exports.CORTEX_AI_OPENROUTER_SETTING_KEY=t.CORTEX_AI_OPENROUTER_SETTING_KEY;exports.CORTEX_AI_PACKAGE_ID=t.CORTEX_AI_PACKAGE_ID;exports.CORTEX_AI_PACKAGE_NAME=t.CORTEX_AI_PACKAGE_NAME;exports.CORTEX_AI_PEXELS_SETTING_KEY=t.CORTEX_AI_PEXELS_SETTING_KEY;exports.CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY=t.CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY;exports.CORTEX_AI_UNSPLASH_SETTING_KEY=t.CORTEX_AI_UNSPLASH_SETTING_KEY;exports.decryptStoredOpenRouterApiKey=t.decryptStoredOpenRouterApiKey;exports.encryptStoredOpenRouterApiKey=t.encryptStoredOpenRouterApiKey;exports.getCortexAiEnvConfig=t.getCortexAiEnvConfig;exports.getEnvOpenRouterKeyStatus=t.getEnvOpenRouterKeyStatus;exports.getOpenRouterEnvApiKey=t.getOpenRouterEnvApiKey;exports.getPexelsEnvApiKey=t.getPexelsEnvApiKey;exports.getStoredOpenRouterKeyStatus=t.getStoredOpenRouterKeyStatus;exports.getUnsplashEnvApiKey=t.getUnsplashEnvApiKey;exports.normalizeCortexAiAgentSettings=t.normalizeCortexAiAgentSettings;exports.resolveCortexAiAgentSettings=t.resolveCortexAiAgentSettings;exports.generateCortexWidgetDefinition=I.generateCortexWidgetDefinition;exports.createCortexCustomBlockTools=u.createCortexCustomBlockTools;exports.createCustomBlockInputSchema=u.createCustomBlockInputSchema;exports.deleteCustomBlockInputSchema=u.deleteCustomBlockInputSchema;exports.executeCreateCustomBlock=u.executeCreateCustomBlock;exports.executeDeleteCustomBlock=u.executeDeleteCustomBlock;exports.executeListCustomBlocks=u.executeListCustomBlocks;exports.executeUpdateCustomBlock=u.executeUpdateCustomBlock;exports.listCustomBlocksInputSchema=u.listCustomBlocksInputSchema;exports.updateCustomBlockInputSchema=u.updateCustomBlockInputSchema;exports.createCortexDatabaseAgentTools=S.createCortexDatabaseAgentTools;exports.describeDatabaseSchemaInputSchema=S.describeDatabaseSchemaInputSchema;exports.executeDatabaseActionPlan=S.executeDatabaseActionPlan;exports.executeDatabaseActionPlanInputSchema=S.executeDatabaseActionPlanInputSchema;exports.executeDatabaseMutation=S.executeDatabaseMutation;exports.executeDatabaseMutationInputSchema=S.executeDatabaseMutationInputSchema;exports.executeDescribeDatabaseSchema=S.executeDescribeDatabaseSchema;exports.executeReadDatabaseRecords=S.executeReadDatabaseRecords;exports.readDatabaseRecordsInputSchema=S.readDatabaseRecordsInputSchema;exports.NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS=o.NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS;exports.NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS=o.NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS;exports.createCortexSiteTools=o.createCortexSiteTools;exports.executeFinishSiteBuild=o.executeFinishSiteBuild;exports.executeGetSiteOverview=o.executeGetSiteOverview;exports.executeResetSiteContent=o.executeResetSiteContent;exports.executeSaveSiteBrief=o.executeSaveSiteBrief;exports.executeStartSiteBuild=o.executeStartSiteBuild;exports.executeUpdateSiteIdentity=o.executeUpdateSiteIdentity;exports.finishSiteBuildInputSchema=o.finishSiteBuildInputSchema;exports.formatCortexSiteOverviewForPrompt=o.formatCortexSiteOverviewForPrompt;exports.getSiteOverviewInputSchema=o.getSiteOverviewInputSchema;exports.readCortexBuildSession=o.readCortexBuildSession;exports.readCortexSiteBrief=o.readCortexSiteBrief;exports.resetSiteContentInputSchema=o.resetSiteContentInputSchema;exports.resolveCortexBuildSession=o.resolveCortexBuildSession;exports.saveSiteBriefInputSchema=o.saveSiteBriefInputSchema;exports.startSiteBuildInputSchema=o.startSiteBuildInputSchema;exports.updateSiteIdentityInputSchema=o.updateSiteIdentityInputSchema;exports.buildVisibleContactIntroActionPlan=e.buildVisibleContactIntroActionPlan;exports.cortexAiPageContextSchema=e.cortexAiPageContextSchema;exports.createCmsPageInputSchema=e.createCmsPageInputSchema;exports.createCmsPostInputSchema=e.createCmsPostInputSchema;exports.createCmsProductInputSchema=e.createCmsProductInputSchema;exports.createCortexGlobalAgentTools=e.createCortexGlobalAgentTools;exports.deleteCmsItemInputSchema=e.deleteCmsItemInputSchema;exports.executeCmsActionPlan=e.executeCmsActionPlan;exports.executeCmsActionPlanInputSchema=e.executeCmsActionPlanInputSchema;exports.executeCreateCmsPage=e.executeCreateCmsPage;exports.executeCreateCmsPost=e.executeCreateCmsPost;exports.executeCreateCmsProduct=e.executeCreateCmsProduct;exports.executeDeleteCmsItem=e.executeDeleteCmsItem;exports.executeFetchEcommerceStats=e.executeFetchEcommerceStats;exports.executeFetchUrlContent=e.executeFetchUrlContent;exports.executeInsertContentBlock=e.executeInsertContentBlock;exports.executeManageProductVariants=e.executeManageProductVariants;exports.executePrepareDeleteCmsItem=e.executePrepareDeleteCmsItem;exports.executePublishContentDraft=e.executePublishContentDraft;exports.executeReadCurrentCmsItem=e.executeReadCurrentCmsItem;exports.executeRewritePageDraft=e.executeRewritePageDraft;exports.executeSearchDocumentation=e.executeSearchDocumentation;exports.executeSearchDocumentationWithTimeout=e.executeSearchDocumentationWithTimeout;exports.executeSearchStockPhotos=e.executeSearchStockPhotos;exports.executeSetContentImages=e.executeSetContentImages;exports.executeTranslateContentBulk=e.executeTranslateContentBulk;exports.executeTranslatePage=e.executeTranslatePage;exports.executeUpdateCmsItemField=e.executeUpdateCmsItemField;exports.executeUpdateContentBlock=e.executeUpdateContentBlock;exports.executeUpdateCurrentCmsFields=e.executeUpdateCurrentCmsFields;exports.executeUpdateFooter=e.executeUpdateFooter;exports.executeUpdateNavigationBar=e.executeUpdateNavigationBar;exports.executeUpdateSectionColumnBlock=e.executeUpdateSectionColumnBlock;exports.fetchEcommerceStatsInputSchema=e.fetchEcommerceStatsInputSchema;exports.fetchUrlContentInputSchema=e.fetchUrlContentInputSchema;exports.insertContentBlockInputSchema=e.insertContentBlockInputSchema;exports.isBlockedFetchHost=e.isBlockedFetchHost;exports.manageProductVariantsInputSchema=e.manageProductVariantsInputSchema;exports.maybeTriggerStockPhotoDownloads=e.maybeTriggerStockPhotoDownloads;exports.navigationItemInputSchema=e.navigationItemInputSchema;exports.prepareDeleteCmsItemInputSchema=e.prepareDeleteCmsItemInputSchema;exports.publishContentDraftInputSchema=e.publishContentDraftInputSchema;exports.readCurrentCmsItemInputSchema=e.readCurrentCmsItemInputSchema;exports.resolveCortexAiStockPhotoProvider=e.resolveCortexAiStockPhotoProvider;exports.resolveCortexAiStockPhotoProviders=e.resolveCortexAiStockPhotoProviders;exports.rewritePageDraftInputSchema=e.rewritePageDraftInputSchema;exports.searchDocumentationInputSchema=e.searchDocumentationInputSchema;exports.searchStockPhotosInputSchema=e.searchStockPhotosInputSchema;exports.setContentImagesInputSchema=e.setContentImagesInputSchema;exports.translateContentBulkInputSchema=e.translateContentBulkInputSchema;exports.translatePageInputSchema=e.translatePageInputSchema;exports.updateCmsItemFieldInputSchema=e.updateCmsItemFieldInputSchema;exports.updateContentBlockInputSchema=e.updateContentBlockInputSchema;exports.updateCurrentCmsFieldsInputSchema=e.updateCurrentCmsFieldsInputSchema;exports.updateFooterInputSchema=e.updateFooterInputSchema;exports.updateNavigationBarInputSchema=e.updateNavigationBarInputSchema;exports.updateSectionColumnBlockInputSchema=e.updateSectionColumnBlockInputSchema;exports.CORTEX_AI_KEY_ALGORITHM=_.CORTEX_AI_KEY_ALGORITHM;exports.CORTEX_AI_KEY_ENVELOPE_VERSION=_.CORTEX_AI_KEY_ENVELOPE_VERSION;exports.decryptOpenRouterApiKey=_.decryptOpenRouterApiKey;exports.encryptOpenRouterApiKey=_.encryptOpenRouterApiKey;exports.getMaskedOpenRouterKey=_.getMaskedOpenRouterKey;exports.getOpenRouterKeyEnvelopeStatus=_.getOpenRouterKeyEnvelopeStatus;exports.verifyOpenRouterApiKey=m.verifyOpenRouterApiKey;exports.verifyPexelsApiKey=m.verifyPexelsApiKey;exports.verifyUnsplashAccessKey=m.verifyUnsplashAccessKey;exports.listCortexAiCompatibleOpenRouterModels=O.listCortexAiCompatibleOpenRouterModels;exports.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY=r.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY;exports.CORTEX_AI_MODEL_REGISTRY=r.CORTEX_AI_MODEL_REGISTRY;exports.CORTEX_AI_OPENROUTER_BASE_URL=r.CORTEX_AI_OPENROUTER_BASE_URL;exports.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL=r.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL;exports.CORTEX_AI_REQUIRED_MODEL_PARAMETERS=r.CORTEX_AI_REQUIRED_MODEL_PARAMETERS;exports.CortexAiRoutingError=r.CortexAiRoutingError;exports.buildCortexAiModelFallbackChain=r.buildCortexAiModelFallbackChain;exports.buildCortexAiRoutingPolicy=r.buildCortexAiRoutingPolicy;exports.createCortexAiStoredModelSelection=r.createCortexAiStoredModelSelection;exports.filterCortexAiCompatibleOpenRouterModels=r.filterCortexAiCompatibleOpenRouterModels;exports.getHttpStatusCode=r.getHttpStatusCode;exports.getOpenRouterErrorStatus=r.getOpenRouterErrorStatus;exports.isCortexAiFreeModelId=r.isCortexAiFreeModelId;exports.isOpenRouterRateLimitError=r.isOpenRouterRateLimitError;exports.isOpenRouterRecoverableRoutingError=r.isOpenRouterRecoverableRoutingError;exports.omitUnsupportedCortexAiModelOptions=r.omitUnsupportedCortexAiModelOptions;exports.runWithCortexAiModelFallback=r.runWithCortexAiModelFallback;exports.safeParseCortexAiModelSelection=r.safeParseCortexAiModelSelection;exports.summarizeCortexAiRoutingError=r.summarizeCortexAiRoutingError;exports.CORTEX_AI_SEO_METADATA_CONTENT_BUDGET=s.CORTEX_AI_SEO_METADATA_CONTENT_BUDGET;exports.CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS=s.CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS;exports.cortexAiSeoMetadataOutputSchema=s.cortexAiSeoMetadataOutputSchema;exports.extractJsonObject=s.extractJsonObject;exports.generateCortexAiSeoMetadata=s.generateCortexAiSeoMetadata;exports.truncateOnWordBoundary=s.truncateOnWordBoundary;exports.CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH=l.CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH;exports.CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY=l.CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY;exports.buildCortexAiVisionRoutingPolicy=l.buildCortexAiVisionRoutingPolicy;exports.generateCortexAiAltText=l.generateCortexAiAltText;exports.isKnownVisionCapableCortexAiModelId=l.isKnownVisionCapableCortexAiModelId;exports.normalizeGeneratedAltText=l.normalizeGeneratedAltText;exports.availableCortexAiBlockTypes=C.availableCortexAiBlockTypes;exports.cortexAiBlockTypeSchema=C.cortexAiBlockTypeSchema;exports.customBlockSlugPatternSchema=C.customBlockSlugPatternSchema;exports.fallbackBlockSchemas=C.fallbackBlockSchemas;exports.isValidBlockType=C.isValidBlockType;exports.loadCustomBlockDefinitions=C.loadCustomBlockDefinitions;exports.readCustomBlockFields=C.readCustomBlockFields;exports.sectionBlockFallbackSchema=C.sectionBlockFallbackSchema;exports.validateCortexBlockContent=C.validateCortexBlockContent;exports.validateCustomBlockInstanceContent=C.validateCustomBlockInstanceContent;exports.CORTEX_WIDGET_DEFINITION_SELECT=A.CORTEX_WIDGET_DEFINITION_SELECT;exports.CortexWidgetRegistryInsertError=A.CortexWidgetRegistryInsertError;exports.buildCortexWidgetDefinitionInsertPayload=A.buildCortexWidgetDefinitionInsertPayload;exports.insertCortexWidgetDefinition=A.insertCortexWidgetDefinition;exports.CORTEX_WIDGET_ALLOWED_RELATION_TABLES=n.CORTEX_WIDGET_ALLOWED_RELATION_TABLES;exports.buildCortexProfileCardVerificationDefinition=n.buildCortexProfileCardVerificationDefinition;exports.buildCortexWidgetBuilderPrompt=n.buildCortexWidgetBuilderPrompt;exports.buildCortexWidgetBuilderSystemPrompt=n.buildCortexWidgetBuilderSystemPrompt;exports.cortexWidgetBuildRequestSchema=n.cortexWidgetBuildRequestSchema;exports.cortexWidgetDbRelationFieldSchema=n.cortexWidgetDbRelationFieldSchema;exports.cortexWidgetDefinitionSchema=n.cortexWidgetDefinitionSchema;exports.cortexWidgetFieldSchema=n.cortexWidgetFieldSchema;exports.cortexWidgetImageR2FieldSchema=n.cortexWidgetImageR2FieldSchema;exports.cortexWidgetLayoutNodeSchema=n.cortexWidgetLayoutNodeSchema;exports.cortexWidgetRichTextFieldSchema=n.cortexWidgetRichTextFieldSchema;exports.cortexWidgetTextFieldSchema=n.cortexWidgetTextFieldSchema;exports.validateCortexWidgetDefinitionOutput=n.validateCortexWidgetDefinitionOutput;exports.CORTEX_MCP_DEFAULT_PROTOCOL_VERSION=a.CORTEX_MCP_DEFAULT_PROTOCOL_VERSION;exports.CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION=a.CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION;exports.CORTEX_MCP_MODERN_PROTOCOL_VERSION=a.CORTEX_MCP_MODERN_PROTOCOL_VERSION;exports.CORTEX_MCP_SERVER_NAME=a.CORTEX_MCP_SERVER_NAME;exports.CORTEX_MCP_SERVER_TITLE=a.CORTEX_MCP_SERVER_TITLE;exports.CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS=a.CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS;exports.JSON_RPC_INTERNAL_ERROR=a.JSON_RPC_INTERNAL_ERROR;exports.JSON_RPC_INVALID_PARAMS=a.JSON_RPC_INVALID_PARAMS;exports.JSON_RPC_INVALID_REQUEST=a.JSON_RPC_INVALID_REQUEST;exports.JSON_RPC_METHOD_NOT_FOUND=a.JSON_RPC_METHOD_NOT_FOUND;exports.JSON_RPC_PARSE_ERROR=a.JSON_RPC_PARSE_ERROR;exports.handleCortexMcpMessage=a.handleCortexMcpMessage;exports.isJsonRpcNotification=a.isJsonRpcNotification;exports.isModernEraMessage=a.isModernEraMessage;exports.CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH=i.CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH;exports.CORTEX_AI_MCP_ENV_TOKEN_VAR=i.CORTEX_AI_MCP_ENV_TOKEN_VAR;exports.CORTEX_AI_MCP_SCOPES=i.CORTEX_AI_MCP_SCOPES;exports.CORTEX_AI_MCP_SETTINGS_DEFAULTS=i.CORTEX_AI_MCP_SETTINGS_DEFAULTS;exports.CORTEX_AI_MCP_SETTINGS_KEY=i.CORTEX_AI_MCP_SETTINGS_KEY;exports.CORTEX_AI_MCP_TOKENS_TABLE=i.CORTEX_AI_MCP_TOKENS_TABLE;exports.CORTEX_AI_MCP_TOKEN_PREFIX=i.CORTEX_AI_MCP_TOKEN_PREFIX;exports.hashCortexAiMcpToken=i.hashCortexAiMcpToken;exports.isLocalhostHost=i.isLocalhostHost;exports.matchesCortexAiMcpEnvToken=i.matchesCortexAiMcpEnvToken;exports.mintCortexAiMcpToken=i.mintCortexAiMcpToken;exports.normalizeCortexAiMcpSettings=i.normalizeCortexAiMcpSettings;exports.parseBearerToken=i.parseBearerToken;exports.readCortexAiMcpEnvToken=i.readCortexAiMcpEnvToken;exports.resolveCortexAiMcpSettings=i.resolveCortexAiMcpSettings;exports.shouldTrustLocalMcpRequest=i.shouldTrustLocalMcpRequest;exports.touchCortexAiMcpToken=i.touchCortexAiMcpToken;exports.verifyCortexAiMcpToken=i.verifyCortexAiMcpToken;exports.CORTEX_MCP_PROMPTS=c.CORTEX_MCP_PROMPTS;exports.CORTEX_MCP_RESOURCES=c.CORTEX_MCP_RESOURCES;exports.CORTEX_MCP_TOOL_ALIASES=c.CORTEX_MCP_TOOL_ALIASES;exports.CORTEX_MCP_TOOL_KINDS=c.CORTEX_MCP_TOOL_KINDS;exports.CortexMcpForbiddenToolError=c.CortexMcpForbiddenToolError;exports.CortexMcpUnknownToolError=c.CortexMcpUnknownToolError;exports.assertCortexMcpToolCoverage=c.assertCortexMcpToolCoverage;exports.buildCortexMcpToolDefinitions=c.buildCortexMcpToolDefinitions;exports.callCortexMcpTool=c.callCortexMcpTool;exports.cortexMcpScopesAllow=c.cortexMcpScopesAllow;exports.getCortexMcpPrompt=c.getCortexMcpPrompt;exports.getCortexMcpToolKind=c.getCortexMcpToolKind;exports.readCortexMcpResource=c.readCortexMcpResource;exports.resolveCortexMcpToolName=c.resolveCortexMcpToolName;exports.CORTEX_AI_BUILD_SESSION_SETTING_KEY=E.CORTEX_AI_BUILD_SESSION_SETTING_KEY;exports.CORTEX_AI_SITE_BRIEF_SETTING_KEY=E.CORTEX_AI_SITE_BRIEF_SETTING_KEY;exports.cortexBuildSessionSchema=E.cortexBuildSessionSchema;exports.cortexSiteBriefInputSchema=E.cortexSiteBriefInputSchema;exports.cortexSiteBriefSchema=E.cortexSiteBriefSchema;exports.formatCortexSiteBriefForPrompt=E.formatCortexSiteBriefForPrompt;exports.isCortexBuildSessionUsable=E.isCortexBuildSessionUsable;exports.isCortexSiteBriefComplete=E.isCortexSiteBriefComplete;exports.safeParseCortexSiteBrief=E.safeParseCortexSiteBrief;Object.defineProperty(exports,"z",{enumerable:!0,get:()=>d.z});
package/index.es.js CHANGED
@@ -1,43 +1,45 @@
1
1
  import { INLINE_HTML_ASSISTANT_SYSTEM_PROMPT as r, generateEditorBlocksRequestSchema as a, generateEditorHtmlFragment as i, validateGeneratedEditorHtmlFragment as c } from "./lib/ai-block-generation.es.js";
2
- import { createCortexAiOpenRouterClient as C, createCortexAiOpenRouterProvider as S, generateCortexAiText as E, getStoredCortexAiModelSelection as u, resolveCortexAiOpenRouterCredential as _ } from "./lib/ai-client.es.js";
3
- import { CORTEX_AI_AGENT_SETTINGS_BOUNDS as l, CORTEX_AI_AGENT_SETTINGS_DEFAULTS as m, CORTEX_AI_AGENT_SETTINGS_KEY as T, CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY as p, CORTEX_AI_OPENROUTER_SETTING_KEY as x, CORTEX_AI_PACKAGE_ID as R, CORTEX_AI_PACKAGE_NAME as I, CORTEX_AI_PEXELS_SETTING_KEY as A, CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY as O, CORTEX_AI_UNSPLASH_SETTING_KEY as d, decryptStoredOpenRouterApiKey as h, encryptStoredOpenRouterApiKey as P, getCortexAiEnvConfig as M, getEnvOpenRouterKeyStatus as g, getOpenRouterEnvApiKey as N, getPexelsEnvApiKey as B, getStoredOpenRouterKeyStatus as D, getUnsplashEnvApiKey as f, normalizeCortexAiAgentSettings as L, resolveCortexAiAgentSettings as X } from "./lib/ai-config.es.js";
4
- import { generateCortexWidgetDefinition as b } from "./lib/ai-cortex-widget-builder.es.js";
5
- import { createCortexCustomBlockTools as F, createCustomBlockInputSchema as K, deleteCustomBlockInputSchema as U, executeCreateCustomBlock as y, executeDeleteCustomBlock as G, executeListCustomBlocks as W, executeUpdateCustomBlock as V, listCustomBlocksInputSchema as Y, updateCustomBlockInputSchema as H } from "./lib/ai-global-agent-custom-block-tools.es.js";
2
+ import { createCortexAiOpenRouterClient as C, createCortexAiOpenRouterProvider as E, generateCortexAiText as _, getStoredCortexAiModelSelection as S, resolveCortexAiOpenRouterCredential as u } from "./lib/ai-client.es.js";
3
+ import { CORTEX_AI_AGENT_SETTINGS_BOUNDS as l, CORTEX_AI_AGENT_SETTINGS_DEFAULTS as T, CORTEX_AI_AGENT_SETTINGS_KEY as m, CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY as p, CORTEX_AI_OPENROUTER_SETTING_KEY as x, CORTEX_AI_PACKAGE_ID as R, CORTEX_AI_PACKAGE_NAME as I, CORTEX_AI_PEXELS_SETTING_KEY as A, CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY as O, CORTEX_AI_UNSPLASH_SETTING_KEY as d, decryptStoredOpenRouterApiKey as P, encryptStoredOpenRouterApiKey as h, getCortexAiEnvConfig as M, getEnvOpenRouterKeyStatus as N, getOpenRouterEnvApiKey as g, getPexelsEnvApiKey as B, getStoredOpenRouterKeyStatus as D, getUnsplashEnvApiKey as f, normalizeCortexAiAgentSettings as L, resolveCortexAiAgentSettings as X } from "./lib/ai-config.es.js";
4
+ import { generateCortexWidgetDefinition as v } from "./lib/ai-cortex-widget-builder.es.js";
5
+ import { createCortexCustomBlockTools as b, createCustomBlockInputSchema as F, deleteCustomBlockInputSchema as U, executeCreateCustomBlock as y, executeDeleteCustomBlock as G, executeListCustomBlocks as V, executeUpdateCustomBlock as W, listCustomBlocksInputSchema as Y, updateCustomBlockInputSchema as H } from "./lib/ai-global-agent-custom-block-tools.es.js";
6
6
  import { createCortexDatabaseAgentTools as J, describeDatabaseSchemaInputSchema as z, executeDatabaseActionPlan as q, executeDatabaseActionPlanInputSchema as Q, executeDatabaseMutation as j, executeDatabaseMutationInputSchema as Z, executeDescribeDatabaseSchema as $, executeReadDatabaseRecords as ee, readDatabaseRecordsInputSchema as te } from "./lib/ai-global-agent-db-tools.es.js";
7
- import { NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS as re, NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS as ae, createCortexSiteTools as ie, executeFinishSiteBuild as ce, executeGetSiteOverview as ne, executeResetSiteContent as Ce, executeSaveSiteBrief as Se, executeStartSiteBuild as Ee, executeUpdateSiteIdentity as ue, finishSiteBuildInputSchema as _e, formatCortexSiteOverviewForPrompt as se, getSiteOverviewInputSchema as le, readCortexBuildSession as me, readCortexSiteBrief as Te, resetSiteContentInputSchema as pe, resolveCortexBuildSession as xe, saveSiteBriefInputSchema as Re, startSiteBuildInputSchema as Ie, updateSiteIdentityInputSchema as Ae } from "./lib/ai-global-agent-site-tools.es.js";
8
- import { buildVisibleContactIntroActionPlan as de, cortexAiPageContextSchema as he, createCmsPageInputSchema as Pe, createCmsPostInputSchema as Me, createCmsProductInputSchema as ge, createCortexGlobalAgentTools as Ne, deleteCmsItemInputSchema as Be, executeCmsActionPlan as De, executeCmsActionPlanInputSchema as fe, executeCreateCmsPage as Le, executeCreateCmsPost as Xe, executeCreateCmsProduct as ke, executeDeleteCmsItem as be, executeFetchEcommerceStats as ve, executeFetchUrlContent as Fe, executeInsertContentBlock as Ke, executeManageProductVariants as Ue, executePrepareDeleteCmsItem as ye, executePublishContentDraft as Ge, executeReadCurrentCmsItem as We, executeRewritePageDraft as Ve, executeSearchDocumentation as Ye, executeSearchDocumentationWithTimeout as He, executeSearchStockPhotos as we, executeSetContentImages as Je, executeTranslateContentBulk as ze, executeTranslatePage as qe, executeUpdateCmsItemField as Qe, executeUpdateContentBlock as je, executeUpdateCurrentCmsFields as Ze, executeUpdateFooter as $e, executeUpdateNavigationBar as et, executeUpdateSectionColumnBlock as tt, fetchEcommerceStatsInputSchema as ot, fetchUrlContentInputSchema as rt, insertContentBlockInputSchema as at, isBlockedFetchHost as it, manageProductVariantsInputSchema as ct, maybeTriggerStockPhotoDownloads as nt, navigationItemInputSchema as Ct, prepareDeleteCmsItemInputSchema as St, publishContentDraftInputSchema as Et, readCurrentCmsItemInputSchema as ut, resolveCortexAiStockPhotoProvider as _t, resolveCortexAiStockPhotoProviders as st, rewritePageDraftInputSchema as lt, searchDocumentationInputSchema as mt, searchStockPhotosInputSchema as Tt, setContentImagesInputSchema as pt, translateContentBulkInputSchema as xt, translatePageInputSchema as Rt, updateCmsItemFieldInputSchema as It, updateContentBlockInputSchema as At, updateCurrentCmsFieldsInputSchema as Ot, updateFooterInputSchema as dt, updateNavigationBarInputSchema as ht, updateSectionColumnBlockInputSchema as Pt } from "./lib/ai-global-agent-tools.es.js";
9
- import { CORTEX_AI_KEY_ALGORITHM as gt, CORTEX_AI_KEY_ENVELOPE_VERSION as Nt, decryptOpenRouterApiKey as Bt, encryptOpenRouterApiKey as Dt, getMaskedOpenRouterKey as ft, getOpenRouterKeyEnvelopeStatus as Lt } from "./lib/ai-key-crypto.es.js";
10
- import { verifyOpenRouterApiKey as kt, verifyPexelsApiKey as bt, verifyUnsplashAccessKey as vt } from "./lib/ai-key-verification.es.js";
11
- import { listCortexAiCompatibleOpenRouterModels as Kt } from "./lib/ai-model-catalog.es.js";
12
- import { CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY as yt, CORTEX_AI_MODEL_REGISTRY as Gt, CORTEX_AI_OPENROUTER_BASE_URL as Wt, CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL as Vt, CORTEX_AI_REQUIRED_MODEL_PARAMETERS as Yt, CortexAiRoutingError as Ht, buildCortexAiModelFallbackChain as wt, buildCortexAiRoutingPolicy as Jt, createCortexAiStoredModelSelection as zt, filterCortexAiCompatibleOpenRouterModels as qt, getHttpStatusCode as Qt, getOpenRouterErrorStatus as jt, isCortexAiFreeModelId as Zt, isOpenRouterRateLimitError as $t, isOpenRouterRecoverableRoutingError as eo, omitUnsupportedCortexAiModelOptions as to, runWithCortexAiModelFallback as oo, safeParseCortexAiModelSelection as ro, summarizeCortexAiRoutingError as ao } from "./lib/ai-model-registry.es.js";
13
- import { CORTEX_AI_SEO_METADATA_CONTENT_BUDGET as co, CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS as no, cortexAiSeoMetadataOutputSchema as Co, extractJsonObject as So, generateCortexAiSeoMetadata as Eo, truncateOnWordBoundary as uo } from "./lib/ai-seo-metadata.es.js";
14
- import { CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH as so, CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY as lo, buildCortexAiVisionRoutingPolicy as mo, generateCortexAiAltText as To, isKnownVisionCapableCortexAiModelId as po, normalizeGeneratedAltText as xo } from "./lib/ai-vision.es.js";
15
- import { availableCortexAiBlockTypes as Io, cortexAiBlockTypeSchema as Ao, customBlockSlugPatternSchema as Oo, fallbackBlockSchemas as ho, isValidBlockType as Po, loadCustomBlockDefinitions as Mo, readCustomBlockFields as go, sectionBlockFallbackSchema as No, validateCortexBlockContent as Bo, validateCustomBlockInstanceContent as Do } from "./lib/block-content-schemas.es.js";
16
- import { CORTEX_WIDGET_DEFINITION_SELECT as Lo, CortexWidgetRegistryInsertError as Xo, buildCortexWidgetDefinitionInsertPayload as ko, insertCortexWidgetDefinition as bo } from "./lib/cortex-widget-registry.es.js";
17
- import { CORTEX_WIDGET_ALLOWED_RELATION_TABLES as Fo, buildCortexProfileCardVerificationDefinition as Ko, buildCortexWidgetBuilderPrompt as Uo, buildCortexWidgetBuilderSystemPrompt as yo, cortexWidgetBuildRequestSchema as Go, cortexWidgetDbRelationFieldSchema as Wo, cortexWidgetDefinitionSchema as Vo, cortexWidgetFieldSchema as Yo, cortexWidgetImageR2FieldSchema as Ho, cortexWidgetLayoutNodeSchema as wo, cortexWidgetRichTextFieldSchema as Jo, cortexWidgetTextFieldSchema as zo, validateCortexWidgetDefinitionOutput as qo } from "./lib/cortex-widget-schema.es.js";
18
- import { CORTEX_MCP_DEFAULT_PROTOCOL_VERSION as jo, CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION as Zo, CORTEX_MCP_MODERN_PROTOCOL_VERSION as $o, CORTEX_MCP_SERVER_NAME as er, CORTEX_MCP_SERVER_TITLE as tr, CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS as or, JSON_RPC_INTERNAL_ERROR as rr, JSON_RPC_INVALID_PARAMS as ar, JSON_RPC_INVALID_REQUEST as ir, JSON_RPC_METHOD_NOT_FOUND as cr, JSON_RPC_PARSE_ERROR as nr, handleCortexMcpMessage as Cr, isJsonRpcNotification as Sr, isModernEraMessage as Er } from "./lib/mcp-server.es.js";
19
- import { CORTEX_AI_MCP_SCOPES as _r, CORTEX_AI_MCP_SETTINGS_DEFAULTS as sr, CORTEX_AI_MCP_SETTINGS_KEY as lr, CORTEX_AI_MCP_TOKENS_TABLE as mr, CORTEX_AI_MCP_TOKEN_PREFIX as Tr, hashCortexAiMcpToken as pr, isLocalhostHost as xr, mintCortexAiMcpToken as Rr, normalizeCortexAiMcpSettings as Ir, parseBearerToken as Ar, resolveCortexAiMcpSettings as Or, shouldTrustLocalMcpRequest as dr, touchCortexAiMcpToken as hr, verifyCortexAiMcpToken as Pr } from "./lib/mcp-tokens.es.js";
20
- import { CORTEX_MCP_PROMPTS as gr, CORTEX_MCP_RESOURCES as Nr, CORTEX_MCP_TOOL_ALIASES as Br, CORTEX_MCP_TOOL_KINDS as Dr, CortexMcpForbiddenToolError as fr, CortexMcpUnknownToolError as Lr, assertCortexMcpToolCoverage as Xr, buildCortexMcpToolDefinitions as kr, callCortexMcpTool as br, cortexMcpScopesAllow as vr, getCortexMcpPrompt as Fr, getCortexMcpToolKind as Kr, readCortexMcpResource as Ur, resolveCortexMcpToolName as yr } from "./lib/mcp-tool-registry.es.js";
21
- import { CORTEX_AI_BUILD_SESSION_SETTING_KEY as Wr, CORTEX_AI_SITE_BRIEF_SETTING_KEY as Vr, cortexBuildSessionSchema as Yr, cortexSiteBriefInputSchema as Hr, cortexSiteBriefSchema as wr, formatCortexSiteBriefForPrompt as Jr, isCortexBuildSessionUsable as zr, isCortexSiteBriefComplete as qr, safeParseCortexSiteBrief as Qr } from "./lib/site-brief.es.js";
7
+ import { NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS as re, NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS as ae, createCortexSiteTools as ie, executeFinishSiteBuild as ce, executeGetSiteOverview as ne, executeResetSiteContent as Ce, executeSaveSiteBrief as Ee, executeStartSiteBuild as _e, executeUpdateSiteIdentity as Se, finishSiteBuildInputSchema as ue, formatCortexSiteOverviewForPrompt as se, getSiteOverviewInputSchema as le, readCortexBuildSession as Te, readCortexSiteBrief as me, resetSiteContentInputSchema as pe, resolveCortexBuildSession as xe, saveSiteBriefInputSchema as Re, startSiteBuildInputSchema as Ie, updateSiteIdentityInputSchema as Ae } from "./lib/ai-global-agent-site-tools.es.js";
8
+ import { buildVisibleContactIntroActionPlan as de, cortexAiPageContextSchema as Pe, createCmsPageInputSchema as he, createCmsPostInputSchema as Me, createCmsProductInputSchema as Ne, createCortexGlobalAgentTools as ge, deleteCmsItemInputSchema as Be, executeCmsActionPlan as De, executeCmsActionPlanInputSchema as fe, executeCreateCmsPage as Le, executeCreateCmsPost as Xe, executeCreateCmsProduct as ke, executeDeleteCmsItem as ve, executeFetchEcommerceStats as Ke, executeFetchUrlContent as be, executeInsertContentBlock as Fe, executeManageProductVariants as Ue, executePrepareDeleteCmsItem as ye, executePublishContentDraft as Ge, executeReadCurrentCmsItem as Ve, executeRewritePageDraft as We, executeSearchDocumentation as Ye, executeSearchDocumentationWithTimeout as He, executeSearchStockPhotos as we, executeSetContentImages as Je, executeTranslateContentBulk as ze, executeTranslatePage as qe, executeUpdateCmsItemField as Qe, executeUpdateContentBlock as je, executeUpdateCurrentCmsFields as Ze, executeUpdateFooter as $e, executeUpdateNavigationBar as et, executeUpdateSectionColumnBlock as tt, fetchEcommerceStatsInputSchema as ot, fetchUrlContentInputSchema as rt, insertContentBlockInputSchema as at, isBlockedFetchHost as it, manageProductVariantsInputSchema as ct, maybeTriggerStockPhotoDownloads as nt, navigationItemInputSchema as Ct, prepareDeleteCmsItemInputSchema as Et, publishContentDraftInputSchema as _t, readCurrentCmsItemInputSchema as St, resolveCortexAiStockPhotoProvider as ut, resolveCortexAiStockPhotoProviders as st, rewritePageDraftInputSchema as lt, searchDocumentationInputSchema as Tt, searchStockPhotosInputSchema as mt, setContentImagesInputSchema as pt, translateContentBulkInputSchema as xt, translatePageInputSchema as Rt, updateCmsItemFieldInputSchema as It, updateContentBlockInputSchema as At, updateCurrentCmsFieldsInputSchema as Ot, updateFooterInputSchema as dt, updateNavigationBarInputSchema as Pt, updateSectionColumnBlockInputSchema as ht } from "./lib/ai-global-agent-tools.es.js";
9
+ import { CORTEX_AI_KEY_ALGORITHM as Nt, CORTEX_AI_KEY_ENVELOPE_VERSION as gt, decryptOpenRouterApiKey as Bt, encryptOpenRouterApiKey as Dt, getMaskedOpenRouterKey as ft, getOpenRouterKeyEnvelopeStatus as Lt } from "./lib/ai-key-crypto.es.js";
10
+ import { verifyOpenRouterApiKey as kt, verifyPexelsApiKey as vt, verifyUnsplashAccessKey as Kt } from "./lib/ai-key-verification.es.js";
11
+ import { listCortexAiCompatibleOpenRouterModels as Ft } from "./lib/ai-model-catalog.es.js";
12
+ import { CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY as yt, CORTEX_AI_MODEL_REGISTRY as Gt, CORTEX_AI_OPENROUTER_BASE_URL as Vt, CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL as Wt, CORTEX_AI_REQUIRED_MODEL_PARAMETERS as Yt, CortexAiRoutingError as Ht, buildCortexAiModelFallbackChain as wt, buildCortexAiRoutingPolicy as Jt, createCortexAiStoredModelSelection as zt, filterCortexAiCompatibleOpenRouterModels as qt, getHttpStatusCode as Qt, getOpenRouterErrorStatus as jt, isCortexAiFreeModelId as Zt, isOpenRouterRateLimitError as $t, isOpenRouterRecoverableRoutingError as eo, omitUnsupportedCortexAiModelOptions as to, runWithCortexAiModelFallback as oo, safeParseCortexAiModelSelection as ro, summarizeCortexAiRoutingError as ao } from "./lib/ai-model-registry.es.js";
13
+ import { CORTEX_AI_SEO_METADATA_CONTENT_BUDGET as co, CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS as no, cortexAiSeoMetadataOutputSchema as Co, extractJsonObject as Eo, generateCortexAiSeoMetadata as _o, truncateOnWordBoundary as So } from "./lib/ai-seo-metadata.es.js";
14
+ import { CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH as so, CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY as lo, buildCortexAiVisionRoutingPolicy as To, generateCortexAiAltText as mo, isKnownVisionCapableCortexAiModelId as po, normalizeGeneratedAltText as xo } from "./lib/ai-vision.es.js";
15
+ import { availableCortexAiBlockTypes as Io, cortexAiBlockTypeSchema as Ao, customBlockSlugPatternSchema as Oo, fallbackBlockSchemas as Po, isValidBlockType as ho, loadCustomBlockDefinitions as Mo, readCustomBlockFields as No, sectionBlockFallbackSchema as go, validateCortexBlockContent as Bo, validateCustomBlockInstanceContent as Do } from "./lib/block-content-schemas.es.js";
16
+ import { CORTEX_WIDGET_DEFINITION_SELECT as Lo, CortexWidgetRegistryInsertError as Xo, buildCortexWidgetDefinitionInsertPayload as ko, insertCortexWidgetDefinition as vo } from "./lib/cortex-widget-registry.es.js";
17
+ import { CORTEX_WIDGET_ALLOWED_RELATION_TABLES as bo, buildCortexProfileCardVerificationDefinition as Fo, buildCortexWidgetBuilderPrompt as Uo, buildCortexWidgetBuilderSystemPrompt as yo, cortexWidgetBuildRequestSchema as Go, cortexWidgetDbRelationFieldSchema as Vo, cortexWidgetDefinitionSchema as Wo, cortexWidgetFieldSchema as Yo, cortexWidgetImageR2FieldSchema as Ho, cortexWidgetLayoutNodeSchema as wo, cortexWidgetRichTextFieldSchema as Jo, cortexWidgetTextFieldSchema as zo, validateCortexWidgetDefinitionOutput as qo } from "./lib/cortex-widget-schema.es.js";
18
+ import { CORTEX_MCP_DEFAULT_PROTOCOL_VERSION as jo, CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION as Zo, CORTEX_MCP_MODERN_PROTOCOL_VERSION as $o, CORTEX_MCP_SERVER_NAME as er, CORTEX_MCP_SERVER_TITLE as tr, CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS as or, JSON_RPC_INTERNAL_ERROR as rr, JSON_RPC_INVALID_PARAMS as ar, JSON_RPC_INVALID_REQUEST as ir, JSON_RPC_METHOD_NOT_FOUND as cr, JSON_RPC_PARSE_ERROR as nr, handleCortexMcpMessage as Cr, isJsonRpcNotification as Er, isModernEraMessage as _r } from "./lib/mcp-server.es.js";
19
+ import { CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH as ur, CORTEX_AI_MCP_ENV_TOKEN_VAR as sr, CORTEX_AI_MCP_SCOPES as lr, CORTEX_AI_MCP_SETTINGS_DEFAULTS as Tr, CORTEX_AI_MCP_SETTINGS_KEY as mr, CORTEX_AI_MCP_TOKENS_TABLE as pr, CORTEX_AI_MCP_TOKEN_PREFIX as xr, hashCortexAiMcpToken as Rr, isLocalhostHost as Ir, matchesCortexAiMcpEnvToken as Ar, mintCortexAiMcpToken as Or, normalizeCortexAiMcpSettings as dr, parseBearerToken as Pr, readCortexAiMcpEnvToken as hr, resolveCortexAiMcpSettings as Mr, shouldTrustLocalMcpRequest as Nr, touchCortexAiMcpToken as gr, verifyCortexAiMcpToken as Br } from "./lib/mcp-tokens.es.js";
20
+ import { CORTEX_MCP_PROMPTS as fr, CORTEX_MCP_RESOURCES as Lr, CORTEX_MCP_TOOL_ALIASES as Xr, CORTEX_MCP_TOOL_KINDS as kr, CortexMcpForbiddenToolError as vr, CortexMcpUnknownToolError as Kr, assertCortexMcpToolCoverage as br, buildCortexMcpToolDefinitions as Fr, callCortexMcpTool as Ur, cortexMcpScopesAllow as yr, getCortexMcpPrompt as Gr, getCortexMcpToolKind as Vr, readCortexMcpResource as Wr, resolveCortexMcpToolName as Yr } from "./lib/mcp-tool-registry.es.js";
21
+ import { CORTEX_AI_BUILD_SESSION_SETTING_KEY as wr, CORTEX_AI_SITE_BRIEF_SETTING_KEY as Jr, cortexBuildSessionSchema as zr, cortexSiteBriefInputSchema as qr, cortexSiteBriefSchema as Qr, formatCortexSiteBriefForPrompt as jr, isCortexBuildSessionUsable as Zr, isCortexSiteBriefComplete as $r, safeParseCortexSiteBrief as ea } from "./lib/site-brief.es.js";
22
22
  import "./lib/zod-config.es.js";
23
- import { z as Zr } from "zod";
23
+ import { z as oa } from "zod";
24
24
  export {
25
25
  l as CORTEX_AI_AGENT_SETTINGS_BOUNDS,
26
- m as CORTEX_AI_AGENT_SETTINGS_DEFAULTS,
27
- T as CORTEX_AI_AGENT_SETTINGS_KEY,
28
- Wr as CORTEX_AI_BUILD_SESSION_SETTING_KEY,
26
+ T as CORTEX_AI_AGENT_SETTINGS_DEFAULTS,
27
+ m as CORTEX_AI_AGENT_SETTINGS_KEY,
28
+ wr as CORTEX_AI_BUILD_SESSION_SETTING_KEY,
29
29
  so as CORTEX_AI_DEFAULT_ALT_TEXT_MAX_LENGTH,
30
30
  yt as CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY,
31
- gt as CORTEX_AI_KEY_ALGORITHM,
32
- Nt as CORTEX_AI_KEY_ENVELOPE_VERSION,
33
- _r as CORTEX_AI_MCP_SCOPES,
34
- sr as CORTEX_AI_MCP_SETTINGS_DEFAULTS,
35
- lr as CORTEX_AI_MCP_SETTINGS_KEY,
36
- mr as CORTEX_AI_MCP_TOKENS_TABLE,
37
- Tr as CORTEX_AI_MCP_TOKEN_PREFIX,
31
+ Nt as CORTEX_AI_KEY_ALGORITHM,
32
+ gt as CORTEX_AI_KEY_ENVELOPE_VERSION,
33
+ ur as CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH,
34
+ sr as CORTEX_AI_MCP_ENV_TOKEN_VAR,
35
+ lr as CORTEX_AI_MCP_SCOPES,
36
+ Tr as CORTEX_AI_MCP_SETTINGS_DEFAULTS,
37
+ mr as CORTEX_AI_MCP_SETTINGS_KEY,
38
+ pr as CORTEX_AI_MCP_TOKENS_TABLE,
39
+ xr as CORTEX_AI_MCP_TOKEN_PREFIX,
38
40
  Gt as CORTEX_AI_MODEL_REGISTRY,
39
- Wt as CORTEX_AI_OPENROUTER_BASE_URL,
40
- Vt as CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL,
41
+ Vt as CORTEX_AI_OPENROUTER_BASE_URL,
42
+ Wt as CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL,
41
43
  p as CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY,
42
44
  x as CORTEX_AI_OPENROUTER_SETTING_KEY,
43
45
  R as CORTEX_AI_PACKAGE_ID,
@@ -46,25 +48,25 @@ export {
46
48
  Yt as CORTEX_AI_REQUIRED_MODEL_PARAMETERS,
47
49
  co as CORTEX_AI_SEO_METADATA_CONTENT_BUDGET,
48
50
  no as CORTEX_AI_SEO_METADATA_LENGTH_BUDGETS,
49
- Vr as CORTEX_AI_SITE_BRIEF_SETTING_KEY,
51
+ Jr as CORTEX_AI_SITE_BRIEF_SETTING_KEY,
50
52
  O as CORTEX_AI_UNSPLASH_APP_NAME_SETTING_KEY,
51
53
  d as CORTEX_AI_UNSPLASH_SETTING_KEY,
52
54
  lo as CORTEX_AI_VISION_MODEL_FALLBACK_REGISTRY,
53
55
  jo as CORTEX_MCP_DEFAULT_PROTOCOL_VERSION,
54
56
  Zo as CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION,
55
57
  $o as CORTEX_MCP_MODERN_PROTOCOL_VERSION,
56
- gr as CORTEX_MCP_PROMPTS,
57
- Nr as CORTEX_MCP_RESOURCES,
58
+ fr as CORTEX_MCP_PROMPTS,
59
+ Lr as CORTEX_MCP_RESOURCES,
58
60
  er as CORTEX_MCP_SERVER_NAME,
59
61
  tr as CORTEX_MCP_SERVER_TITLE,
60
62
  or as CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS,
61
- Br as CORTEX_MCP_TOOL_ALIASES,
62
- Dr as CORTEX_MCP_TOOL_KINDS,
63
- Fo as CORTEX_WIDGET_ALLOWED_RELATION_TABLES,
63
+ Xr as CORTEX_MCP_TOOL_ALIASES,
64
+ kr as CORTEX_MCP_TOOL_KINDS,
65
+ bo as CORTEX_WIDGET_ALLOWED_RELATION_TABLES,
64
66
  Lo as CORTEX_WIDGET_DEFINITION_SELECT,
65
67
  Ht as CortexAiRoutingError,
66
- fr as CortexMcpForbiddenToolError,
67
- Lr as CortexMcpUnknownToolError,
68
+ vr as CortexMcpForbiddenToolError,
69
+ Kr as CortexMcpUnknownToolError,
68
70
  Xo as CortexWidgetRegistryInsertError,
69
71
  r as INLINE_HTML_ASSISTANT_SYSTEM_PROMPT,
70
72
  rr as JSON_RPC_INTERNAL_ERROR,
@@ -74,52 +76,52 @@ export {
74
76
  nr as JSON_RPC_PARSE_ERROR,
75
77
  re as NEXTBLOCK_SEED_MEDIA_OBJECT_KEYS,
76
78
  ae as NEXTBLOCK_SEED_TRANSLATION_GROUP_IDS,
77
- Xr as assertCortexMcpToolCoverage,
79
+ br as assertCortexMcpToolCoverage,
78
80
  Io as availableCortexAiBlockTypes,
79
81
  wt as buildCortexAiModelFallbackChain,
80
82
  Jt as buildCortexAiRoutingPolicy,
81
- mo as buildCortexAiVisionRoutingPolicy,
82
- kr as buildCortexMcpToolDefinitions,
83
- Ko as buildCortexProfileCardVerificationDefinition,
83
+ To as buildCortexAiVisionRoutingPolicy,
84
+ Fr as buildCortexMcpToolDefinitions,
85
+ Fo as buildCortexProfileCardVerificationDefinition,
84
86
  Uo as buildCortexWidgetBuilderPrompt,
85
87
  yo as buildCortexWidgetBuilderSystemPrompt,
86
88
  ko as buildCortexWidgetDefinitionInsertPayload,
87
89
  de as buildVisibleContactIntroActionPlan,
88
- br as callCortexMcpTool,
90
+ Ur as callCortexMcpTool,
89
91
  Ao as cortexAiBlockTypeSchema,
90
- he as cortexAiPageContextSchema,
92
+ Pe as cortexAiPageContextSchema,
91
93
  Co as cortexAiSeoMetadataOutputSchema,
92
- Yr as cortexBuildSessionSchema,
93
- vr as cortexMcpScopesAllow,
94
- Hr as cortexSiteBriefInputSchema,
95
- wr as cortexSiteBriefSchema,
94
+ zr as cortexBuildSessionSchema,
95
+ yr as cortexMcpScopesAllow,
96
+ qr as cortexSiteBriefInputSchema,
97
+ Qr as cortexSiteBriefSchema,
96
98
  Go as cortexWidgetBuildRequestSchema,
97
- Wo as cortexWidgetDbRelationFieldSchema,
98
- Vo as cortexWidgetDefinitionSchema,
99
+ Vo as cortexWidgetDbRelationFieldSchema,
100
+ Wo as cortexWidgetDefinitionSchema,
99
101
  Yo as cortexWidgetFieldSchema,
100
102
  Ho as cortexWidgetImageR2FieldSchema,
101
103
  wo as cortexWidgetLayoutNodeSchema,
102
104
  Jo as cortexWidgetRichTextFieldSchema,
103
105
  zo as cortexWidgetTextFieldSchema,
104
- Pe as createCmsPageInputSchema,
106
+ he as createCmsPageInputSchema,
105
107
  Me as createCmsPostInputSchema,
106
- ge as createCmsProductInputSchema,
108
+ Ne as createCmsProductInputSchema,
107
109
  C as createCortexAiOpenRouterClient,
108
- S as createCortexAiOpenRouterProvider,
110
+ E as createCortexAiOpenRouterProvider,
109
111
  zt as createCortexAiStoredModelSelection,
110
- F as createCortexCustomBlockTools,
112
+ b as createCortexCustomBlockTools,
111
113
  J as createCortexDatabaseAgentTools,
112
- Ne as createCortexGlobalAgentTools,
114
+ ge as createCortexGlobalAgentTools,
113
115
  ie as createCortexSiteTools,
114
- K as createCustomBlockInputSchema,
116
+ F as createCustomBlockInputSchema,
115
117
  Oo as customBlockSlugPatternSchema,
116
118
  Bt as decryptOpenRouterApiKey,
117
- h as decryptStoredOpenRouterApiKey,
119
+ P as decryptStoredOpenRouterApiKey,
118
120
  Be as deleteCmsItemInputSchema,
119
121
  U as deleteCustomBlockInputSchema,
120
122
  z as describeDatabaseSchemaInputSchema,
121
123
  Dt as encryptOpenRouterApiKey,
122
- P as encryptStoredOpenRouterApiKey,
124
+ h as encryptStoredOpenRouterApiKey,
123
125
  De as executeCmsActionPlan,
124
126
  fe as executeCmsActionPlanInputSchema,
125
127
  Le as executeCreateCmsPage,
@@ -130,140 +132,142 @@ export {
130
132
  Q as executeDatabaseActionPlanInputSchema,
131
133
  j as executeDatabaseMutation,
132
134
  Z as executeDatabaseMutationInputSchema,
133
- be as executeDeleteCmsItem,
135
+ ve as executeDeleteCmsItem,
134
136
  G as executeDeleteCustomBlock,
135
137
  $ as executeDescribeDatabaseSchema,
136
- ve as executeFetchEcommerceStats,
137
- Fe as executeFetchUrlContent,
138
+ Ke as executeFetchEcommerceStats,
139
+ be as executeFetchUrlContent,
138
140
  ce as executeFinishSiteBuild,
139
141
  ne as executeGetSiteOverview,
140
- Ke as executeInsertContentBlock,
141
- W as executeListCustomBlocks,
142
+ Fe as executeInsertContentBlock,
143
+ V as executeListCustomBlocks,
142
144
  Ue as executeManageProductVariants,
143
145
  ye as executePrepareDeleteCmsItem,
144
146
  Ge as executePublishContentDraft,
145
- We as executeReadCurrentCmsItem,
147
+ Ve as executeReadCurrentCmsItem,
146
148
  ee as executeReadDatabaseRecords,
147
149
  Ce as executeResetSiteContent,
148
- Ve as executeRewritePageDraft,
149
- Se as executeSaveSiteBrief,
150
+ We as executeRewritePageDraft,
151
+ Ee as executeSaveSiteBrief,
150
152
  Ye as executeSearchDocumentation,
151
153
  He as executeSearchDocumentationWithTimeout,
152
154
  we as executeSearchStockPhotos,
153
155
  Je as executeSetContentImages,
154
- Ee as executeStartSiteBuild,
156
+ _e as executeStartSiteBuild,
155
157
  ze as executeTranslateContentBulk,
156
158
  qe as executeTranslatePage,
157
159
  Qe as executeUpdateCmsItemField,
158
160
  je as executeUpdateContentBlock,
159
161
  Ze as executeUpdateCurrentCmsFields,
160
- V as executeUpdateCustomBlock,
162
+ W as executeUpdateCustomBlock,
161
163
  $e as executeUpdateFooter,
162
164
  et as executeUpdateNavigationBar,
163
165
  tt as executeUpdateSectionColumnBlock,
164
- ue as executeUpdateSiteIdentity,
165
- So as extractJsonObject,
166
- ho as fallbackBlockSchemas,
166
+ Se as executeUpdateSiteIdentity,
167
+ Eo as extractJsonObject,
168
+ Po as fallbackBlockSchemas,
167
169
  ot as fetchEcommerceStatsInputSchema,
168
170
  rt as fetchUrlContentInputSchema,
169
171
  qt as filterCortexAiCompatibleOpenRouterModels,
170
- _e as finishSiteBuildInputSchema,
171
- Jr as formatCortexSiteBriefForPrompt,
172
+ ue as finishSiteBuildInputSchema,
173
+ jr as formatCortexSiteBriefForPrompt,
172
174
  se as formatCortexSiteOverviewForPrompt,
173
- To as generateCortexAiAltText,
174
- Eo as generateCortexAiSeoMetadata,
175
- E as generateCortexAiText,
176
- b as generateCortexWidgetDefinition,
175
+ mo as generateCortexAiAltText,
176
+ _o as generateCortexAiSeoMetadata,
177
+ _ as generateCortexAiText,
178
+ v as generateCortexWidgetDefinition,
177
179
  a as generateEditorBlocksRequestSchema,
178
180
  i as generateEditorHtmlFragment,
179
181
  M as getCortexAiEnvConfig,
180
- Fr as getCortexMcpPrompt,
181
- Kr as getCortexMcpToolKind,
182
- g as getEnvOpenRouterKeyStatus,
182
+ Gr as getCortexMcpPrompt,
183
+ Vr as getCortexMcpToolKind,
184
+ N as getEnvOpenRouterKeyStatus,
183
185
  Qt as getHttpStatusCode,
184
186
  ft as getMaskedOpenRouterKey,
185
- N as getOpenRouterEnvApiKey,
187
+ g as getOpenRouterEnvApiKey,
186
188
  jt as getOpenRouterErrorStatus,
187
189
  Lt as getOpenRouterKeyEnvelopeStatus,
188
190
  B as getPexelsEnvApiKey,
189
191
  le as getSiteOverviewInputSchema,
190
- u as getStoredCortexAiModelSelection,
192
+ S as getStoredCortexAiModelSelection,
191
193
  D as getStoredOpenRouterKeyStatus,
192
194
  f as getUnsplashEnvApiKey,
193
195
  Cr as handleCortexMcpMessage,
194
- pr as hashCortexAiMcpToken,
196
+ Rr as hashCortexAiMcpToken,
195
197
  at as insertContentBlockInputSchema,
196
- bo as insertCortexWidgetDefinition,
198
+ vo as insertCortexWidgetDefinition,
197
199
  it as isBlockedFetchHost,
198
200
  Zt as isCortexAiFreeModelId,
199
- zr as isCortexBuildSessionUsable,
200
- qr as isCortexSiteBriefComplete,
201
- Sr as isJsonRpcNotification,
201
+ Zr as isCortexBuildSessionUsable,
202
+ $r as isCortexSiteBriefComplete,
203
+ Er as isJsonRpcNotification,
202
204
  po as isKnownVisionCapableCortexAiModelId,
203
- xr as isLocalhostHost,
204
- Er as isModernEraMessage,
205
+ Ir as isLocalhostHost,
206
+ _r as isModernEraMessage,
205
207
  $t as isOpenRouterRateLimitError,
206
208
  eo as isOpenRouterRecoverableRoutingError,
207
- Po as isValidBlockType,
208
- Kt as listCortexAiCompatibleOpenRouterModels,
209
+ ho as isValidBlockType,
210
+ Ft as listCortexAiCompatibleOpenRouterModels,
209
211
  Y as listCustomBlocksInputSchema,
210
212
  Mo as loadCustomBlockDefinitions,
211
213
  ct as manageProductVariantsInputSchema,
214
+ Ar as matchesCortexAiMcpEnvToken,
212
215
  nt as maybeTriggerStockPhotoDownloads,
213
- Rr as mintCortexAiMcpToken,
216
+ Or as mintCortexAiMcpToken,
214
217
  Ct as navigationItemInputSchema,
215
218
  L as normalizeCortexAiAgentSettings,
216
- Ir as normalizeCortexAiMcpSettings,
219
+ dr as normalizeCortexAiMcpSettings,
217
220
  xo as normalizeGeneratedAltText,
218
221
  to as omitUnsupportedCortexAiModelOptions,
219
- Ar as parseBearerToken,
220
- St as prepareDeleteCmsItemInputSchema,
221
- Et as publishContentDraftInputSchema,
222
- me as readCortexBuildSession,
223
- Ur as readCortexMcpResource,
224
- Te as readCortexSiteBrief,
225
- ut as readCurrentCmsItemInputSchema,
226
- go as readCustomBlockFields,
222
+ Pr as parseBearerToken,
223
+ Et as prepareDeleteCmsItemInputSchema,
224
+ _t as publishContentDraftInputSchema,
225
+ hr as readCortexAiMcpEnvToken,
226
+ Te as readCortexBuildSession,
227
+ Wr as readCortexMcpResource,
228
+ me as readCortexSiteBrief,
229
+ St as readCurrentCmsItemInputSchema,
230
+ No as readCustomBlockFields,
227
231
  te as readDatabaseRecordsInputSchema,
228
232
  pe as resetSiteContentInputSchema,
229
233
  X as resolveCortexAiAgentSettings,
230
- Or as resolveCortexAiMcpSettings,
231
- _ as resolveCortexAiOpenRouterCredential,
232
- _t as resolveCortexAiStockPhotoProvider,
234
+ Mr as resolveCortexAiMcpSettings,
235
+ u as resolveCortexAiOpenRouterCredential,
236
+ ut as resolveCortexAiStockPhotoProvider,
233
237
  st as resolveCortexAiStockPhotoProviders,
234
238
  xe as resolveCortexBuildSession,
235
- yr as resolveCortexMcpToolName,
239
+ Yr as resolveCortexMcpToolName,
236
240
  lt as rewritePageDraftInputSchema,
237
241
  oo as runWithCortexAiModelFallback,
238
242
  ro as safeParseCortexAiModelSelection,
239
- Qr as safeParseCortexSiteBrief,
243
+ ea as safeParseCortexSiteBrief,
240
244
  Re as saveSiteBriefInputSchema,
241
- mt as searchDocumentationInputSchema,
242
- Tt as searchStockPhotosInputSchema,
243
- No as sectionBlockFallbackSchema,
245
+ Tt as searchDocumentationInputSchema,
246
+ mt as searchStockPhotosInputSchema,
247
+ go as sectionBlockFallbackSchema,
244
248
  pt as setContentImagesInputSchema,
245
- dr as shouldTrustLocalMcpRequest,
249
+ Nr as shouldTrustLocalMcpRequest,
246
250
  Ie as startSiteBuildInputSchema,
247
251
  ao as summarizeCortexAiRoutingError,
248
- hr as touchCortexAiMcpToken,
252
+ gr as touchCortexAiMcpToken,
249
253
  xt as translateContentBulkInputSchema,
250
254
  Rt as translatePageInputSchema,
251
- uo as truncateOnWordBoundary,
255
+ So as truncateOnWordBoundary,
252
256
  It as updateCmsItemFieldInputSchema,
253
257
  At as updateContentBlockInputSchema,
254
258
  Ot as updateCurrentCmsFieldsInputSchema,
255
259
  H as updateCustomBlockInputSchema,
256
260
  dt as updateFooterInputSchema,
257
- ht as updateNavigationBarInputSchema,
258
- Pt as updateSectionColumnBlockInputSchema,
261
+ Pt as updateNavigationBarInputSchema,
262
+ ht as updateSectionColumnBlockInputSchema,
259
263
  Ae as updateSiteIdentityInputSchema,
260
264
  Bo as validateCortexBlockContent,
261
265
  qo as validateCortexWidgetDefinitionOutput,
262
266
  Do as validateCustomBlockInstanceContent,
263
267
  c as validateGeneratedEditorHtmlFragment,
264
- Pr as verifyCortexAiMcpToken,
268
+ Br as verifyCortexAiMcpToken,
265
269
  kt as verifyOpenRouterApiKey,
266
- bt as verifyPexelsApiKey,
267
- vt as verifyUnsplashAccessKey,
268
- Zr as z
270
+ vt as verifyPexelsApiKey,
271
+ Kt as verifyUnsplashAccessKey,
272
+ oa as z
269
273
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("node:crypto"),p="Cortex AI MCP token utilities can only be imported from server-side code.";function l(){if(!(typeof window>"u"))throw new Error(p)}const T="cortex_ai_mcp_settings",u="mcp_access_tokens",i="nbmcp_",A=32,k=8,d=["read","write"],s={allowLocalhostWithoutToken:!0,enabled:!1};function h(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};return{allowLocalhostWithoutToken:typeof t.allowLocalhostWithoutToken=="boolean"?t.allowLocalhostWithoutToken:s.allowLocalhostWithoutToken,enabled:typeof t.enabled=="boolean"?t.enabled:s.enabled}}async function m(e){if(e)try{const{data:t}=await e.from("site_settings").select("value").eq("key",T).maybeSingle();if(t?.value)return h(t.value)}catch{}return{...s}}function a(e){return l(),c.createHash("sha256").update(e.trim(),"utf8").digest("hex")}function M(){l();const e=`${i}${c.randomBytes(A).toString("base64url")}`;return{token:e,tokenHash:a(e),tokenPrefix:e.slice(0,i.length+k)}}function O(e){const t=e?.trim();if(!t)return null;const o=/^Bearer\s+(.+)$/i.exec(t);return(o?o[1]:t).trim()||null}function y(e){const o=(Array.isArray(e)?e:[]).filter(n=>d.includes(n));return o.length>0?Array.from(new Set(o)):["read"]}async function x(e,t,o=new Date){l();const n=t?.trim();if(!n||n.length<16)return{reason:"malformed",valid:!1};const _=a(n),{data:f,error:E}=await e.from(u).select("id, name, scopes, token_prefix, created_at, created_by, expires_at, last_used_at, revoked_at").eq("token_hash",_).maybeSingle();if(E||!f)return{reason:"unknown",valid:!1};const S=Buffer.from(_,"utf8");if(!c.timingSafeEqual(S,Buffer.from(a(n),"utf8")))return{reason:"unknown",valid:!1};const r=f;return r.revoked_at?{reason:"revoked",valid:!1}:r.expires_at&&new Date(r.expires_at).getTime()<=o.getTime()?{reason:"expired",valid:!1}:{scopes:y(r.scopes),token:r,valid:!0}}async function R(e,t,o=new Date){try{await e.from(u).update({last_used_at:o.toISOString()}).eq("id",t)}catch{}}const v=new Set(["localhost","127.0.0.1","[::1]","::1","0.0.0.0"]);function C(e){const t=e?.trim().toLowerCase();if(!t)return!1;const o=t.startsWith("[")?t.replace(/\]:\d+$/,"]"):t.replace(/:\d+$/,"");return v.has(o)||o.endsWith(".localhost")}function I(e){return!e.settings.allowLocalhostWithoutToken||process.env.NODE_ENV==="production"?!1:C(e.hostHeader)}exports.CORTEX_AI_MCP_SCOPES=d;exports.CORTEX_AI_MCP_SETTINGS_DEFAULTS=s;exports.CORTEX_AI_MCP_SETTINGS_KEY=T;exports.CORTEX_AI_MCP_TOKENS_TABLE=u;exports.CORTEX_AI_MCP_TOKEN_PREFIX=i;exports.hashCortexAiMcpToken=a;exports.isLocalhostHost=C;exports.mintCortexAiMcpToken=M;exports.normalizeCortexAiMcpSettings=h;exports.parseBearerToken=O;exports.resolveCortexAiMcpSettings=m;exports.shouldTrustLocalMcpRequest=I;exports.touchCortexAiMcpToken=R;exports.verifyCortexAiMcpToken=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("node:crypto"),M="Cortex AI MCP token utilities can only be imported from server-side code.";function c(){if(!(typeof window>"u"))throw new Error(M)}const E="cortex_ai_mcp_settings",l="mcp_access_tokens",_="nbmcp_",m=32,k=8,C=["read","write"],a={allowLocalhostWithoutToken:!0,enabled:!1};function d(e){const t=e&&typeof e=="object"&&!Array.isArray(e)?e:{};return{allowLocalhostWithoutToken:typeof t.allowLocalhostWithoutToken=="boolean"?t.allowLocalhostWithoutToken:a.allowLocalhostWithoutToken,enabled:typeof t.enabled=="boolean"?t.enabled:a.enabled}}async function O(e){if(e)try{const{data:t}=await e.from("site_settings").select("value").eq("key",E).maybeSingle();if(t?.value)return d(t.value)}catch{}return{...a}}function r(e){return c(),i.createHash("sha256").update(e.trim(),"utf8").digest("hex")}function R(){c();const e=`${_}${i.randomBytes(m).toString("base64url")}`;return{token:e,tokenHash:r(e),tokenPrefix:e.slice(0,_.length+k)}}function v(e){const t=e?.trim();if(!t)return null;const o=/^Bearer\s+(.+)$/i.exec(t);return(o?o[1]:t).trim()||null}function x(e){const o=(Array.isArray(e)?e:[]).filter(n=>C.includes(n));return o.length>0?Array.from(new Set(o)):["read"]}async function I(e,t,o=new Date){c();const n=t?.trim();if(!n||n.length<16)return{reason:"malformed",valid:!1};const f=r(n),{data:T,error:p}=await e.from(l).select("id, name, scopes, token_prefix, created_at, created_by, expires_at, last_used_at, revoked_at").eq("token_hash",f).maybeSingle();if(p||!T)return{reason:"unknown",valid:!1};const S=Buffer.from(f,"utf8");if(!i.timingSafeEqual(S,Buffer.from(r(n),"utf8")))return{reason:"unknown",valid:!1};const s=T;return s.revoked_at?{reason:"revoked",valid:!1}:s.expires_at&&new Date(s.expires_at).getTime()<=o.getTime()?{reason:"expired",valid:!1}:{scopes:x(s.scopes),token:s,valid:!0}}async function N(e,t,o=new Date){try{await e.from(l).update({last_used_at:o.toISOString()}).eq("id",t)}catch{}}const y=new Set(["localhost","127.0.0.1","[::1]","::1","0.0.0.0"]);function A(e){const t=e?.trim().toLowerCase();if(!t)return!1;const o=t.startsWith("[")?t.replace(/\]:\d+$/,"]"):t.replace(/:\d+$/,"");return y.has(o)||o.endsWith(".localhost")}function P(e){return!e.settings.allowLocalhostWithoutToken||process.env.NODE_ENV==="production"?!1:A(e.hostHeader)}const h="MCP_BEARER_TOKEN",u=32;function g(e=process.env){const t=e[h]?.trim();return!t||t.length<u?null:t}function L(e,t){c();const o=e?.trim(),n=t?.trim();return!o||!n||n.length<u?!1:i.timingSafeEqual(Buffer.from(r(o),"utf8"),Buffer.from(r(n),"utf8"))}exports.CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH=u;exports.CORTEX_AI_MCP_ENV_TOKEN_VAR=h;exports.CORTEX_AI_MCP_SCOPES=C;exports.CORTEX_AI_MCP_SETTINGS_DEFAULTS=a;exports.CORTEX_AI_MCP_SETTINGS_KEY=E;exports.CORTEX_AI_MCP_TOKENS_TABLE=l;exports.CORTEX_AI_MCP_TOKEN_PREFIX=_;exports.hashCortexAiMcpToken=r;exports.isLocalhostHost=A;exports.matchesCortexAiMcpEnvToken=L;exports.mintCortexAiMcpToken=R;exports.normalizeCortexAiMcpSettings=d;exports.parseBearerToken=v;exports.readCortexAiMcpEnvToken=g;exports.resolveCortexAiMcpSettings=O;exports.shouldTrustLocalMcpRequest=P;exports.touchCortexAiMcpToken=N;exports.verifyCortexAiMcpToken=I;
@@ -92,4 +92,31 @@ export declare function shouldTrustLocalMcpRequest(params: {
92
92
  hostHeader: string | null | undefined;
93
93
  settings: CortexAiMcpSettings;
94
94
  }): boolean;
95
+ /**
96
+ * Name of the environment variable that carries an operator-provisioned MCP bearer
97
+ * token. `create-nextblock --non-interactive` generates one at scaffold time and writes
98
+ * it to the project's `.env` / `.env.local` (Docker / cloud) together with the agent
99
+ * client configs, so a coding agent can reach `/api/mcp` before any admin has opened
100
+ * the dashboard to mint a database token.
101
+ *
102
+ * Setting the variable is the opt-in: the endpoint accepts this token even while the
103
+ * database `enabled` flag is still off (the flag guards *unattended* exposure, and an
104
+ * operator who put a secret in the environment has attended to it). Everything else
105
+ * still applies — the Cortex AI license gate, the Origin check, and the scope rules.
106
+ */
107
+ export declare const CORTEX_AI_MCP_ENV_TOKEN_VAR = "MCP_BEARER_TOKEN";
108
+ /**
109
+ * Anything shorter is refused outright rather than honoured: a short value is far more
110
+ * likely to be a placeholder left in an example file than a deliberate secret.
111
+ */
112
+ export declare const CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH = 32;
113
+ /** Read the configured environment token, or null when unset, blank or too short. */
114
+ export declare function readCortexAiMcpEnvToken(env?: Record<string, string | undefined>): string | null;
115
+ /**
116
+ * Constant-time comparison of a presented bearer credential against the configured
117
+ * environment token. Both sides are hashed first so the comparison length never
118
+ * depends on the caller's input, which keeps `timingSafeEqual`'s precondition (equal
119
+ * buffer lengths) satisfied without leaking the configured token's length.
120
+ */
121
+ export declare function matchesCortexAiMcpEnvToken(presented: string | null | undefined, configured: string | null | undefined): boolean;
95
122
  export {};
@@ -1,104 +1,121 @@
1
- import { createHash as h, randomBytes as T, timingSafeEqual as p } from "node:crypto";
2
- const m = "Cortex AI MCP token utilities can only be imported from server-side code.";
3
- function i() {
1
+ import { createHash as E, timingSafeEqual as f, randomBytes as m } from "node:crypto";
2
+ const p = "Cortex AI MCP token utilities can only be imported from server-side code.";
3
+ function a() {
4
4
  if (!(typeof window > "u"))
5
- throw new Error(m);
5
+ throw new Error(p);
6
6
  }
7
- const k = "cortex_ai_mcp_settings", f = "mcp_access_tokens", u = "nbmcp_", E = 32, S = 8, A = ["read", "write"], s = {
7
+ const C = "cortex_ai_mcp_settings", _ = "mcp_access_tokens", u = "nbmcp_", A = 32, k = 8, S = ["read", "write"], i = {
8
8
  allowLocalhostWithoutToken: !0,
9
9
  enabled: !1
10
10
  };
11
- function C(e) {
11
+ function O(e) {
12
12
  const t = e && typeof e == "object" && !Array.isArray(e) ? e : {};
13
13
  return {
14
- allowLocalhostWithoutToken: typeof t.allowLocalhostWithoutToken == "boolean" ? t.allowLocalhostWithoutToken : s.allowLocalhostWithoutToken,
15
- enabled: typeof t.enabled == "boolean" ? t.enabled : s.enabled
14
+ allowLocalhostWithoutToken: typeof t.allowLocalhostWithoutToken == "boolean" ? t.allowLocalhostWithoutToken : i.allowLocalhostWithoutToken,
15
+ enabled: typeof t.enabled == "boolean" ? t.enabled : i.enabled
16
16
  };
17
17
  }
18
- async function x(e) {
18
+ async function R(e) {
19
19
  if (e)
20
20
  try {
21
- const { data: t } = await e.from("site_settings").select("value").eq("key", k).maybeSingle();
21
+ const { data: t } = await e.from("site_settings").select("value").eq("key", C).maybeSingle();
22
22
  if (t?.value)
23
- return C(t.value);
23
+ return O(t.value);
24
24
  } catch {
25
25
  }
26
- return { ...s };
26
+ return { ...i };
27
27
  }
28
- function a(e) {
29
- return i(), h("sha256").update(e.trim(), "utf8").digest("hex");
28
+ function s(e) {
29
+ return a(), E("sha256").update(e.trim(), "utf8").digest("hex");
30
30
  }
31
- function M() {
32
- i();
33
- const e = `${u}${T(E).toString(
31
+ function g() {
32
+ a();
33
+ const e = `${u}${m(A).toString(
34
34
  "base64url"
35
35
  )}`;
36
36
  return {
37
37
  token: e,
38
- tokenHash: a(e),
38
+ tokenHash: s(e),
39
39
  tokenPrefix: e.slice(
40
40
  0,
41
- u.length + S
41
+ u.length + k
42
42
  )
43
43
  };
44
44
  }
45
- function g(e) {
45
+ function N(e) {
46
46
  const t = e?.trim();
47
47
  if (!t)
48
48
  return null;
49
49
  const o = /^Bearer\s+(.+)$/i.exec(t);
50
50
  return (o ? o[1] : t).trim() || null;
51
51
  }
52
- function y(e) {
52
+ function M(e) {
53
53
  const o = (Array.isArray(e) ? e : []).filter(
54
- (n) => A.includes(n)
54
+ (n) => S.includes(n)
55
55
  );
56
56
  return o.length > 0 ? Array.from(new Set(o)) : ["read"];
57
57
  }
58
- async function L(e, t, o = /* @__PURE__ */ new Date()) {
59
- i();
58
+ async function I(e, t, o = /* @__PURE__ */ new Date()) {
59
+ a();
60
60
  const n = t?.trim();
61
61
  if (!n || n.length < 16)
62
62
  return { reason: "malformed", valid: !1 };
63
- const c = a(n), { data: l, error: _ } = await e.from(f).select("id, name, scopes, token_prefix, created_at, created_by, expires_at, last_used_at, revoked_at").eq("token_hash", c).maybeSingle();
64
- if (_ || !l)
63
+ const c = s(n), { data: l, error: h } = await e.from(_).select("id, name, scopes, token_prefix, created_at, created_by, expires_at, last_used_at, revoked_at").eq("token_hash", c).maybeSingle();
64
+ if (h || !l)
65
65
  return { reason: "unknown", valid: !1 };
66
- const d = Buffer.from(c, "utf8");
67
- if (!p(d, Buffer.from(a(n), "utf8")))
66
+ const T = Buffer.from(c, "utf8");
67
+ if (!f(T, Buffer.from(s(n), "utf8")))
68
68
  return { reason: "unknown", valid: !1 };
69
69
  const r = l;
70
- return r.revoked_at ? { reason: "revoked", valid: !1 } : r.expires_at && new Date(r.expires_at).getTime() <= o.getTime() ? { reason: "expired", valid: !1 } : { scopes: y(r.scopes), token: r, valid: !0 };
70
+ return r.revoked_at ? { reason: "revoked", valid: !1 } : r.expires_at && new Date(r.expires_at).getTime() <= o.getTime() ? { reason: "expired", valid: !1 } : { scopes: M(r.scopes), token: r, valid: !0 };
71
71
  }
72
- async function R(e, t, o = /* @__PURE__ */ new Date()) {
72
+ async function L(e, t, o = /* @__PURE__ */ new Date()) {
73
73
  try {
74
- await e.from(f).update({ last_used_at: o.toISOString() }).eq("id", t);
74
+ await e.from(_).update({ last_used_at: o.toISOString() }).eq("id", t);
75
75
  } catch {
76
76
  }
77
77
  }
78
- const w = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1", "0.0.0.0"]);
79
- function O(e) {
78
+ const v = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "[::1]", "::1", "0.0.0.0"]);
79
+ function y(e) {
80
80
  const t = e?.trim().toLowerCase();
81
81
  if (!t)
82
82
  return !1;
83
83
  const o = t.startsWith("[") ? t.replace(/\]:\d+$/, "]") : t.replace(/:\d+$/, "");
84
- return w.has(o) || o.endsWith(".localhost");
84
+ return v.has(o) || o.endsWith(".localhost");
85
+ }
86
+ function P(e) {
87
+ return !e.settings.allowLocalhostWithoutToken || process.env.NODE_ENV === "production" ? !1 : y(e.hostHeader);
85
88
  }
86
- function b(e) {
87
- return !e.settings.allowLocalhostWithoutToken || process.env.NODE_ENV === "production" ? !1 : O(e.hostHeader);
89
+ const w = "MCP_BEARER_TOKEN", d = 32;
90
+ function b(e = process.env) {
91
+ const t = e[w]?.trim();
92
+ return !t || t.length < d ? null : t;
93
+ }
94
+ function B(e, t) {
95
+ a();
96
+ const o = e?.trim(), n = t?.trim();
97
+ return !o || !n || n.length < d ? !1 : f(
98
+ Buffer.from(s(o), "utf8"),
99
+ Buffer.from(s(n), "utf8")
100
+ );
88
101
  }
89
102
  export {
90
- A as CORTEX_AI_MCP_SCOPES,
91
- s as CORTEX_AI_MCP_SETTINGS_DEFAULTS,
92
- k as CORTEX_AI_MCP_SETTINGS_KEY,
93
- f as CORTEX_AI_MCP_TOKENS_TABLE,
103
+ d as CORTEX_AI_MCP_ENV_TOKEN_MIN_LENGTH,
104
+ w as CORTEX_AI_MCP_ENV_TOKEN_VAR,
105
+ S as CORTEX_AI_MCP_SCOPES,
106
+ i as CORTEX_AI_MCP_SETTINGS_DEFAULTS,
107
+ C as CORTEX_AI_MCP_SETTINGS_KEY,
108
+ _ as CORTEX_AI_MCP_TOKENS_TABLE,
94
109
  u as CORTEX_AI_MCP_TOKEN_PREFIX,
95
- a as hashCortexAiMcpToken,
96
- O as isLocalhostHost,
97
- M as mintCortexAiMcpToken,
98
- C as normalizeCortexAiMcpSettings,
99
- g as parseBearerToken,
100
- x as resolveCortexAiMcpSettings,
101
- b as shouldTrustLocalMcpRequest,
102
- R as touchCortexAiMcpToken,
103
- L as verifyCortexAiMcpToken
110
+ s as hashCortexAiMcpToken,
111
+ y as isLocalhostHost,
112
+ B as matchesCortexAiMcpEnvToken,
113
+ g as mintCortexAiMcpToken,
114
+ O as normalizeCortexAiMcpSettings,
115
+ N as parseBearerToken,
116
+ b as readCortexAiMcpEnvToken,
117
+ R as resolveCortexAiMcpSettings,
118
+ P as shouldTrustLocalMcpRequest,
119
+ L as touchCortexAiMcpToken,
120
+ I as verifyCortexAiMcpToken
104
121
  };
@@ -1,6 +1,6 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./ai-global-agent-tools.cjs.js"),x=require("./block-content-schemas.cjs.js");require("./zod-config.cjs.js");const v=require("zod"),n={create_cms_page:"write",create_cms_post:"write",create_cms_product:"write",create_custom_block:"write",delete_cms_item:"write",delete_custom_block:"write",describe_database_schema:"read",execute_cms_action_plan:"write",execute_database_action_plan:"write",execute_database_mutation:"write",fetch_ecommerce_stats:"read",fetch_url_content:"read",finish_site_build:"write",get_site_overview:"read",insert_content_block:"write",list_custom_blocks:"read",list_media:"read",list_product_categories:"read",list_site_script_revisions:"read",list_site_scripts:"read",list_site_themes:"read",manage_language:"write",manage_product_category:"write",manage_product_variants:"write",manage_site_script:"write",manage_site_theme:"write",prepare_delete_cms_item:"read",publish_content_draft:"write",read_current_cms_item:"read",read_database_records:"read",reset_site_content:"write",revert_site_script:"write",rewrite_page_draft:"write",save_site_brief:"write",search_documentation:"read",search_stock_photos:"read",set_content_images:"write",start_site_build:"write",translate_content_bulk:"write",translate_page:"write",update_cms_item_field:"write",upload_media:"write",update_content_block:"write",update_current_cms_fields:"write",update_custom_block:"write",update_footer:"write",update_global_css:"write",update_navigation_bar:"write",update_section_column_block:"write",update_site_identity:"write"},s={generate_jsonb_layout:{canonical:"rewrite_page_draft",description:"Generate a complete, strictly-validated JSONB block layout and write it into a target page or post. Blocks are normalized and validated against the NextBlock block schema, then staged as a Live Draft on the target record — nothing goes live until an editor publishes the draft, and publishing snapshots a revision so the change is reversible. Use for whole-page builds and redesigns. Alias of `rewrite_page_draft`.",title:"Generate JSONB layout"},get_database_schema:{canonical:"describe_database_schema",description:"Return the current CMS database structure: every table Cortex AI may read or mutate, its columns, primary keys, and whether it is read-only. Pair with `list_custom_blocks` for the active data-defined block definitions and with the `cortex://schema/blocks` resource for the built-in block types. Read-only. Alias of `describe_database_schema`.",title:"Get database schema"},query_site_analytics:{canonical:"fetch_ecommerce_stats",description:"Query quantitative site analytics: revenue, order counts, order-status breakdowns, and top-selling products over a time range. Read-only. For inventory levels and post/page metrics that this report does not cover, use `read_database_records` against the `products`, `product_variants`, `posts`, or `pages` tables. Alias of `fetch_ecommerce_stats`.",title:"Query site analytics"},search_stock_media:{canonical:"search_stock_photos",description:"Search free stock media (Pexels, then Unsplash) for contextually relevant imagery, returning direct image URLs with dimensions, alt text, and photographer attribution. Drop a returned `url` straight into an image block's `external_url` or a section background. Read-only and zero cost. Requires a stock provider key in CMS Settings → Cortex AI. Alias of `search_stock_photos`.",title:"Search stock media"},update_site_navigation:{canonical:"update_navigation_bar",description:'Alter the public site navigation: header menu items and their nested child hierarchy, per locale. Use mode "append" to add links while preserving the existing menu, "update" to rename or re-point one link, and "replace" only when rebuilding the whole menu. For footer links and copyright use `update_footer`. Alias of `update_navigation_bar`.',title:"Update site navigation"}};function h(e){return e in s?s[e].canonical:e in n?e:null}function b(e){const t=h(e);return t?n[t]:null}function c(e,t){const r=b(t);return r?r==="read"?e.length>0:e.includes("write"):!1}function g(e){return e.split("_").map((r,a)=>a===0?r.charAt(0).toUpperCase()+r.slice(1):r).join(" ")}function _(e){const t={additionalProperties:!1,type:"object"};if(!e||typeof e!="object")return t;try{const r=v.z.toJSONSchema(e,{cycles:"ref",io:"input",reused:"inline",target:"draft-2020-12",unrepresentable:"any"});return delete r.$schema,r.type==="object"?r:t}catch{return t}}function l(e){return k.createCortexGlobalAgentTools(e)}function C(e){const t=Object.keys(l(e)),r=Object.keys(n);return{missingFromRegistry:r.filter(a=>!t.includes(a)),unclassified:t.filter(a=>!r.includes(a))}}function T(e){const t=l(e.context),r=[];for(const[a,i]of Object.entries(t))!(a in n)||!c(e.scopes,a)||r.push({description:i.description??`Cortex AI ${g(a)} tool.`,inputSchema:_(i.inputSchema),name:a,title:g(a)});for(const[a,i]of Object.entries(s)){const o=t[i.canonical];!o||!c(e.scopes,a)||r.push({description:i.description,inputSchema:_(o.inputSchema),name:a,title:i.title})}return r.sort((a,i)=>a.name.localeCompare(i.name))}function m(e,t){return{content:[{text:e,type:"text"}],isError:t}}function S(e){return e.issues.map(t=>`${t.path.length>0?t.path.join("."):"(root)"}: ${t.message}`).join("; ")}class p extends Error{constructor(t){super(`Unknown tool: ${t}`),this.name="CortexMcpUnknownToolError"}}class f extends Error{constructor(t){super(`Tool "${t}" requires the "write" scope. This MCP token is read-only — mint a read+write token in CMS Settings → Cortex AI.`),this.name="CortexMcpForbiddenToolError"}}async function M(e){const t=h(e.name);if(!t)throw new p(e.name);if(!c(e.scopes,e.name))throw new f(e.name);const a=l(e.context)[t];if(!a||typeof a.execute!="function")throw new p(e.name);const i=e.args&&typeof e.args=="object"?e.args:{};if(a.inputSchema&&typeof a.inputSchema.safeParse=="function"){const o=a.inputSchema.safeParse(i);if(!o.success)return m(`Invalid arguments for "${e.name}": ${S(o.error)}`,!0)}try{const o=await a.execute(i),u=JSON.stringify(o??{success:!0},null,2),d=o&&typeof o=="object"&&!Array.isArray(o)?o:null,w=d?.success===!1;return{content:[{text:u,type:"text"}],isError:w,...d?{structuredContent:d}:{}}}catch(o){const u=o instanceof Error?o.message:String(o);return m(`Tool "${e.name}" failed: ${u}`,!0)}}const R=[{description:"The CMS database structure Cortex AI can read and mutate: tables, columns, primary keys, and read-only flags.",mimeType:"application/json",name:"database-schema",title:"NextBlock database schema",uri:"cortex://schema/database"},{description:"The built-in NextBlock block types available when composing page, post, and product layouts.",mimeType:"application/json",name:"block-types",title:"NextBlock block types",uri:"cortex://schema/blocks"},{description:"Data-defined custom block definitions registered in this workspace, keyed by the slug used as a block instance `block_type`.",mimeType:"application/json",name:"custom-blocks",title:"NextBlock custom block definitions",uri:"cortex://schema/custom-blocks"}];async function O(e){const t=l(e.context);if(e.uri==="cortex://schema/database"){const r=await t.describe_database_schema?.execute?.({includeReadOnly:!0});return{mimeType:"application/json",text:JSON.stringify(r??{},null,2),uri:e.uri}}if(e.uri==="cortex://schema/blocks")return{mimeType:"application/json",text:JSON.stringify({blockTypes:x.availableCortexAiBlockTypes},null,2),uri:e.uri};if(e.uri==="cortex://schema/custom-blocks"){const r=await t.list_custom_blocks?.execute?.({});return{mimeType:"application/json",text:JSON.stringify(r??{},null,2),uri:e.uri}}return null}const y=[{arguments:[{description:'Everything known about the client and the site they want: business, audience, goals, pages (or "one landing page"), languages, brand, contact details. Leave blank to be asked.',name:"brief",required:!1}],description:"Build (or rebuild) the whole NextBlock site from a brief: remove the sample content, set the identity and theme, create and publish every page, the menus, the footer, and the translations.",name:"build-site",title:"Build the whole site"},{arguments:[{description:"What the page is for, and any brand or tone notes.",name:"brief",required:!0},{description:'Slug of the page or post to rewrite, e.g. "home".',name:"slug",required:!0}],description:"Build or redesign a NextBlock page from a brief, following the section-based layout recipe, and stage it as a reviewable Live Draft.",name:"build-page",title:"Build a NextBlock page"},{arguments:[{description:"Source URL to draw structure and copy from.",name:"url",required:!0},{description:"Slug of the page to write the result into.",name:"slug",required:!0}],description:"Read an external page and rebuild an equivalent NextBlock page from it, reusing its imagery where available.",name:"clone-from-url",title:"Rebuild a page from a URL"},{arguments:[{description:'Target language code, e.g. "fr".',name:"languageCode",required:!0},{description:"Slug of the page or post to translate.",name:"slug",required:!0}],description:"Translate an existing page or post into another language, preserving its layout and imagery.",name:"translate-content",title:"Translate a page or post"}],E={"build-site":e=>["Build the whole NextBlock site for this client.","",e.brief?.trim()?`Brief:
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./ai-global-agent-tools.cjs.js"),x=require("./block-content-schemas.cjs.js");require("./zod-config.cjs.js");const v=require("zod"),n={create_cms_page:"write",create_cms_post:"write",create_cms_product:"write",create_custom_block:"write",delete_cms_item:"write",delete_custom_block:"write",describe_database_schema:"read",execute_cms_action_plan:"write",execute_database_action_plan:"write",execute_database_mutation:"write",fetch_ecommerce_stats:"read",fetch_url_content:"read",finish_site_build:"write",get_site_overview:"read",insert_content_block:"write",list_custom_blocks:"read",list_media:"read",list_product_categories:"read",list_site_script_revisions:"read",list_site_scripts:"read",list_site_themes:"read",manage_language:"write",manage_product_category:"write",manage_product_variants:"write",manage_site_script:"write",manage_site_theme:"write",prepare_delete_cms_item:"read",publish_content_draft:"write",read_current_cms_item:"read",read_database_records:"read",reset_site_content:"write",revert_site_script:"write",rewrite_page_draft:"write",save_site_brief:"write",search_documentation:"read",search_stock_photos:"read",set_content_images:"write",start_site_build:"write",translate_content_bulk:"write",translate_page:"write",update_cms_item_field:"write",upload_media:"write",update_content_block:"write",update_current_cms_fields:"write",update_custom_block:"write",update_footer:"write",update_global_css:"write",update_navigation_bar:"write",update_section_column_block:"write",update_site_identity:"write"},s={create_page_layout:{canonical:"create_cms_page",description:'Create a new page from a slug, a title and a strictly typed block layout in one call. Every block is normalized and validated against the NextBlock block schema (built-in types from the `cortex://schema/blocks` resource, or a custom block slug from `list_custom_blocks`) before anything is written; an invalid block rejects the whole call. Pass `status: "published"` to go live immediately, or leave the default draft and publish later. To rewrite an existing page instead, use `generate_jsonb_layout`. Alias of `create_cms_page`.',title:"Create page layout"},generate_jsonb_layout:{canonical:"rewrite_page_draft",description:"Generate a complete, strictly-validated JSONB block layout and write it into a target page or post. Blocks are normalized and validated against the NextBlock block schema, then staged as a Live Draft on the target record — nothing goes live until an editor publishes the draft, and publishing snapshots a revision so the change is reversible. Use for whole-page builds and redesigns. Alias of `rewrite_page_draft`.",title:"Generate JSONB layout"},get_database_schema:{canonical:"describe_database_schema",description:"Return the current CMS database structure: every table Cortex AI may read or mutate, its columns, primary keys, and whether it is read-only. Pair with `list_custom_blocks` for the active data-defined block definitions and with the `cortex://schema/blocks` resource for the built-in block types. Read-only. Alias of `describe_database_schema`.",title:"Get database schema"},query_site_analytics:{canonical:"fetch_ecommerce_stats",description:"Query quantitative site analytics: revenue, order counts, order-status breakdowns, and top-selling products over a time range. Read-only. For inventory levels and post/page metrics that this report does not cover, use `read_database_records` against the `products`, `product_variants`, `posts`, or `pages` tables. Alias of `fetch_ecommerce_stats`.",title:"Query site analytics"},search_stock_media:{canonical:"search_stock_photos",description:"Search free stock media (Pexels, then Unsplash) for contextually relevant imagery, returning direct image URLs with dimensions, alt text, and photographer attribution. Drop a returned `url` straight into an image block's `external_url` or a section background. Read-only and zero cost. Requires a stock provider key in CMS Settings → Cortex AI. Alias of `search_stock_photos`.",title:"Search stock media"},update_site_navigation:{canonical:"update_navigation_bar",description:'Alter the public site navigation: header menu items and their nested child hierarchy, per locale. Use mode "append" to add links while preserving the existing menu, "update" to rename or re-point one link, and "replace" only when rebuilding the whole menu. For footer links and copyright use `update_footer`. Alias of `update_navigation_bar`.',title:"Update site navigation"}};function h(e){return e in s?s[e].canonical:e in n?e:null}function b(e){const t=h(e);return t?n[t]:null}function c(e,t){const a=b(t);return a?a==="read"?e.length>0:e.includes("write"):!1}function g(e){return e.split("_").map((a,r)=>r===0?a.charAt(0).toUpperCase()+a.slice(1):a).join(" ")}function _(e){const t={additionalProperties:!1,type:"object"};if(!e||typeof e!="object")return t;try{const a=v.z.toJSONSchema(e,{cycles:"ref",io:"input",reused:"inline",target:"draft-2020-12",unrepresentable:"any"});return delete a.$schema,a.type==="object"?a:t}catch{return t}}function l(e){return k.createCortexGlobalAgentTools(e)}function C(e){const t=Object.keys(l(e)),a=Object.keys(n);return{missingFromRegistry:a.filter(r=>!t.includes(r)),unclassified:t.filter(r=>!a.includes(r))}}function T(e){const t=l(e.context),a=[];for(const[r,i]of Object.entries(t))!(r in n)||!c(e.scopes,r)||a.push({description:i.description??`Cortex AI ${g(r)} tool.`,inputSchema:_(i.inputSchema),name:r,title:g(r)});for(const[r,i]of Object.entries(s)){const o=t[i.canonical];!o||!c(e.scopes,r)||a.push({description:i.description,inputSchema:_(o.inputSchema),name:r,title:i.title})}return a.sort((r,i)=>r.name.localeCompare(i.name))}function m(e,t){return{content:[{text:e,type:"text"}],isError:t}}function S(e){return e.issues.map(t=>`${t.path.length>0?t.path.join("."):"(root)"}: ${t.message}`).join("; ")}class p extends Error{constructor(t){super(`Unknown tool: ${t}`),this.name="CortexMcpUnknownToolError"}}class f extends Error{constructor(t){super(`Tool "${t}" requires the "write" scope. This MCP token is read-only — mint a read+write token in CMS Settings → Cortex AI.`),this.name="CortexMcpForbiddenToolError"}}async function M(e){const t=h(e.name);if(!t)throw new p(e.name);if(!c(e.scopes,e.name))throw new f(e.name);const r=l(e.context)[t];if(!r||typeof r.execute!="function")throw new p(e.name);const i=e.args&&typeof e.args=="object"?e.args:{};if(r.inputSchema&&typeof r.inputSchema.safeParse=="function"){const o=r.inputSchema.safeParse(i);if(!o.success)return m(`Invalid arguments for "${e.name}": ${S(o.error)}`,!0)}try{const o=await r.execute(i),u=JSON.stringify(o??{success:!0},null,2),d=o&&typeof o=="object"&&!Array.isArray(o)?o:null,w=d?.success===!1;return{content:[{text:u,type:"text"}],isError:w,...d?{structuredContent:d}:{}}}catch(o){const u=o instanceof Error?o.message:String(o);return m(`Tool "${e.name}" failed: ${u}`,!0)}}const R=[{description:"The CMS database structure Cortex AI can read and mutate: tables, columns, primary keys, and read-only flags.",mimeType:"application/json",name:"database-schema",title:"NextBlock database schema",uri:"cortex://schema/database"},{description:"The built-in NextBlock block types available when composing page, post, and product layouts.",mimeType:"application/json",name:"block-types",title:"NextBlock block types",uri:"cortex://schema/blocks"},{description:"Data-defined custom block definitions registered in this workspace, keyed by the slug used as a block instance `block_type`.",mimeType:"application/json",name:"custom-blocks",title:"NextBlock custom block definitions",uri:"cortex://schema/custom-blocks"}];async function O(e){const t=l(e.context);if(e.uri==="cortex://schema/database"){const a=await t.describe_database_schema?.execute?.({includeReadOnly:!0});return{mimeType:"application/json",text:JSON.stringify(a??{},null,2),uri:e.uri}}if(e.uri==="cortex://schema/blocks")return{mimeType:"application/json",text:JSON.stringify({blockTypes:x.availableCortexAiBlockTypes},null,2),uri:e.uri};if(e.uri==="cortex://schema/custom-blocks"){const a=await t.list_custom_blocks?.execute?.({});return{mimeType:"application/json",text:JSON.stringify(a??{},null,2),uri:e.uri}}return null}const y=[{arguments:[{description:'Everything known about the client and the site they want: business, audience, goals, pages (or "one landing page"), languages, brand, contact details. Leave blank to be asked.',name:"brief",required:!1}],description:"Build (or rebuild) the whole NextBlock site from a brief: remove the sample content, set the identity and theme, create and publish every page, the menus, the footer, and the translations.",name:"build-site",title:"Build the whole site"},{arguments:[{description:"What the page is for, and any brand or tone notes.",name:"brief",required:!0},{description:'Slug of the page or post to rewrite, e.g. "home".',name:"slug",required:!0}],description:"Build or redesign a NextBlock page from a brief, following the section-based layout recipe, and stage it as a reviewable Live Draft.",name:"build-page",title:"Build a NextBlock page"},{arguments:[{description:"Source URL to draw structure and copy from.",name:"url",required:!0},{description:"Slug of the page to write the result into.",name:"slug",required:!0}],description:"Read an external page and rebuild an equivalent NextBlock page from it, reusing its imagery where available.",name:"clone-from-url",title:"Rebuild a page from a URL"},{arguments:[{description:'Target language code, e.g. "fr".',name:"languageCode",required:!0},{description:"Slug of the page or post to translate.",name:"slug",required:!0}],description:"Translate an existing page or post into another language, preserving its layout and imagery.",name:"translate-content",title:"Translate a page or post"}],j={"build-site":e=>["Build the whole NextBlock site for this client.","",e.brief?.trim()?`Brief:
2
2
  ${e.brief}`:"A site brief may already be saved (get_site_overview returns it under `brief`): if it is, use it and skip the questions; otherwise ask, in one short numbered list, about the business and what it does, the audience and the one action visitors should take, the site shape (one landing page or which pages), the languages, brand colours and tone, contact details, and whether existing content is kept.","","Process:","1. Call get_site_overview to see what exists, the active languages, and whether the NextBlock demo content is still present. Record what you know with save_site_brief.","2. Present the plan (what is removed, every page with its sections, menus, footer, theme, languages) and call start_site_build with `summary`, `brief`, and `reset` (keepLanguages = the languages wanted) unless existing content is kept. Over MCP the host approves the call; there is no chat confirmation.",'3. Build: update_site_identity (title, description, keywords, copyright, and social_image for the share preview of pages without a feature image); manage_language as needed; manage_site_theme with the brand colours; search_stock_media for imagery when available; rewrite the empty "home" page with generate_jsonb_layout then publish_content_draft; create_cms_page (status "published") for every other page; update_site_navigation (mode "replace") and update_footer for every language; translate_content_bulk for each extra language.',"4. Call finish_site_build with a summary, then report every page with its URL.","Write real copy from the brief, never placeholders. Every page must exist in every active language.","Conventions: mark each page's opening section is_hero:true (priority image loading, centred content); slider:true with a slides array makes a rotating banner; NEVER set feature_image_id on the home page or on a page that opens with a hero section — on a page it renders a full-width title banner above the blocks — but give every post one."].join(`
3
3
  `),"build-page":e=>[`Build the NextBlock page with slug "${e.slug??"<slug>"}" from this brief:`,"",e.brief??"<brief>","","Process:","1. Call get_database_schema and read_current_cms_item (or read_database_records on `pages`) to ground yourself in what exists.",'2. Compose the page from `section` blocks: one column entry per grid track, the first section a hero (is_hero:true), alternating none / theme:"muted" / theme:"primary" backgrounds for rhythm. Use discrete heading blocks rather than <h2> inside text HTML. Do not set feature_image_id on a page that opens with a hero: on a page it renders a full-width title banner above the blocks.',"3. Call search_stock_media for real photography; copy each photo's attribution fields onto the image block.","4. Write the result with generate_jsonb_layout. It stages a Live Draft — tell the user to preview and publish it."].join(`
4
4
  `),"clone-from-url":e=>[`Rebuild the NextBlock page "${e.slug??"<slug>"}" based on ${e.url??"<url>"}.`,"","Process:","1. Call fetch_url_content on the URL first. Use its headings, text, and mainImage — never invent an image URL.","2. Map the source structure onto NextBlock `section` blocks; do not copy its markup verbatim.","3. Write the result with generate_jsonb_layout so it lands as a reviewable Live Draft."].join(`
5
5
  `),"translate-content":e=>[`Translate the page or post "${e.slug??"<slug>"}" into "${e.languageCode??"<languageCode>"}".`,"","Use the translate_page tool: it copies layout, structure, and imagery automatically and links the copy to the original translation group. Supply only the text translations — every visible string, including headings, paragraph text, button labels, image alt text, and captions. Do not rebuild the layout and do not search for new imagery."].join(`
6
- `)};function N(e){const t=y.find(a=>a.name===e.name),r=E[e.name];return!t||!r?null:{description:t.description,messages:[{content:{text:r(e.args??{}),type:"text"},role:"user"}]}}exports.CORTEX_MCP_PROMPTS=y;exports.CORTEX_MCP_RESOURCES=R;exports.CORTEX_MCP_TOOL_ALIASES=s;exports.CORTEX_MCP_TOOL_KINDS=n;exports.CortexMcpForbiddenToolError=f;exports.CortexMcpUnknownToolError=p;exports.assertCortexMcpToolCoverage=C;exports.buildCortexMcpToolDefinitions=T;exports.callCortexMcpTool=M;exports.cortexMcpScopesAllow=c;exports.getCortexMcpPrompt=N;exports.getCortexMcpToolKind=b;exports.readCortexMcpResource=O;exports.resolveCortexMcpToolName=h;
6
+ `)};function E(e){const t=y.find(r=>r.name===e.name),a=j[e.name];return!t||!a?null:{description:t.description,messages:[{content:{text:a(e.args??{}),type:"text"},role:"user"}]}}exports.CORTEX_MCP_PROMPTS=y;exports.CORTEX_MCP_RESOURCES=R;exports.CORTEX_MCP_TOOL_ALIASES=s;exports.CORTEX_MCP_TOOL_KINDS=n;exports.CortexMcpForbiddenToolError=f;exports.CortexMcpUnknownToolError=p;exports.assertCortexMcpToolCoverage=C;exports.buildCortexMcpToolDefinitions=T;exports.callCortexMcpTool=M;exports.cortexMcpScopesAllow=c;exports.getCortexMcpPrompt=E;exports.getCortexMcpToolKind=b;exports.readCortexMcpResource=O;exports.resolveCortexMcpToolName=h;
@@ -89,6 +89,11 @@ export type CortexMcpCanonicalToolName = keyof typeof CORTEX_MCP_TOOL_KINDS;
89
89
  * in-app vocabulary.
90
90
  */
91
91
  export declare const CORTEX_MCP_TOOL_ALIASES: {
92
+ readonly create_page_layout: {
93
+ readonly canonical: "create_cms_page";
94
+ readonly description: "Create a new page from a slug, a title and a strictly typed block layout in one call. Every block is normalized and validated against the NextBlock block schema (built-in types from the `cortex://schema/blocks` resource, or a custom block slug from `list_custom_blocks`) before anything is written; an invalid block rejects the whole call. Pass `status: \"published\"` to go live immediately, or leave the default draft and publish later. To rewrite an existing page instead, use `generate_jsonb_layout`. Alias of `create_cms_page`.";
95
+ readonly title: "Create page layout";
96
+ };
92
97
  readonly generate_jsonb_layout: {
93
98
  readonly canonical: "rewrite_page_draft";
94
99
  readonly description: "Generate a complete, strictly-validated JSONB block layout and write it into a target page or post. Blocks are normalized and validated against the NextBlock block schema, then staged as a Live Draft on the target record — nothing goes live until an editor publishes the draft, and publishing snapshots a revision so the change is reversible. Use for whole-page builds and redesigns. Alias of `rewrite_page_draft`.";
@@ -54,6 +54,11 @@ const n = {
54
54
  update_section_column_block: "write",
55
55
  update_site_identity: "write"
56
56
  }, u = {
57
+ create_page_layout: {
58
+ canonical: "create_cms_page",
59
+ description: 'Create a new page from a slug, a title and a strictly typed block layout in one call. Every block is normalized and validated against the NextBlock block schema (built-in types from the `cortex://schema/blocks` resource, or a custom block slug from `list_custom_blocks`) before anything is written; an invalid block rejects the whole call. Pass `status: "published"` to go live immediately, or leave the default draft and publish later. To rewrite an existing page instead, use `generate_jsonb_layout`. Alias of `create_cms_page`.',
60
+ title: "Create page layout"
61
+ },
57
62
  generate_jsonb_layout: {
58
63
  canonical: "rewrite_page_draft",
59
64
  description: "Generate a complete, strictly-validated JSONB block layout and write it into a target page or post. Blocks are normalized and validated against the NextBlock block schema, then staged as a Live Draft on the target record — nothing goes live until an editor publishes the draft, and publishing snapshots a revision so the change is reversible. Use for whole-page builds and redesigns. Alias of `rewrite_page_draft`.",
@@ -114,14 +119,14 @@ function h(e) {
114
119
  function s(e) {
115
120
  return f(e);
116
121
  }
117
- function M(e) {
122
+ function N(e) {
118
123
  const t = Object.keys(s(e)), a = Object.keys(n);
119
124
  return {
120
125
  missingFromRegistry: a.filter((r) => !t.includes(r)),
121
126
  unclassified: t.filter((r) => !a.includes(r))
122
127
  };
123
128
  }
124
- function N(e) {
129
+ function M(e) {
125
130
  const t = s(e.context), a = [];
126
131
  for (const [r, o] of Object.entries(t))
127
132
  !(r in n) || !d(e.scopes, r) || a.push({
@@ -338,8 +343,8 @@ export {
338
343
  n as CORTEX_MCP_TOOL_KINDS,
339
344
  x as CortexMcpForbiddenToolError,
340
345
  m as CortexMcpUnknownToolError,
341
- M as assertCortexMcpToolCoverage,
342
- N as buildCortexMcpToolDefinitions,
346
+ N as assertCortexMcpToolCoverage,
347
+ M as buildCortexMcpToolDefinitions,
343
348
  O as callCortexMcpTool,
344
349
  d as cortexMcpScopesAllow,
345
350
  P as getCortexMcpPrompt,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/cortex",
3
- "version": "0.18.8",
3
+ "version": "0.19.2",
4
4
  "license": "AGPL-3.0-or-later",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -28,9 +28,9 @@
28
28
  },
29
29
  "dependencies": {
30
30
  "@ai-sdk/openai-compatible": "^2.0.42",
31
- "@nextblock-cms/db": "^0.18.8",
32
- "@nextblock-cms/ecommerce": "npm:@nextblock-cms/ecom@^0.18.8",
33
- "@nextblock-cms/utils": "^0.18.8",
31
+ "@nextblock-cms/db": "^0.19.2",
32
+ "@nextblock-cms/ecommerce": "npm:@nextblock-cms/ecom@^0.19.2",
33
+ "@nextblock-cms/utils": "^0.19.2",
34
34
  "ai": "^6.0.170",
35
35
  "zod": "^4.3.6"
36
36
  },