@nextblock-cms/cortex 0.18.6 → 0.18.8

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./zod-config.cjs.js");const t=require("zod"),u=["text","heading","image","button","posts_grid","video_embed","section","form","testimonial","product_grid","featured_product","cart","checkout","product_details"],z=t.z.enum(u),d=t.z.object({direction:t.z.string().optional(),stops:t.z.array(t.z.object({color:t.z.string(),position:t.z.number()})),type:t.z.enum(["linear","radial"])}),y=t.z.object({gradient:d.optional(),image:t.z.object({alt_text:t.z.string().optional(),blur_data_url:t.z.string().optional(),external_url:t.z.string().optional(),height:t.z.number().optional(),media_id:t.z.string().optional(),object_key:t.z.string().optional(),overlay:t.z.object({gradient:d,type:t.z.literal("gradient")}).optional(),position:t.z.enum(["center","top","bottom","left","right"]),quality:t.z.number().nullable().optional(),size:t.z.enum(["cover","contain"]),width:t.z.number().optional()}).optional(),min_height:t.z.string().optional(),solid_color:t.z.string().optional(),theme:t.z.enum(["primary","secondary","muted","accent","destructive"]).optional(),type:t.z.enum(["none","theme","solid","gradient","image"])}),g=t.z.string().regex(/^[a-z][a-z0-9-]*$/),h=t.z.object({block_type:t.z.union([z,g]),content:t.z.record(t.z.string(),t.z.any()),temp_id:t.z.string().optional()}),p=t.z.object({background:y,column_blocks:t.z.array(t.z.array(h)),column_gap:t.z.enum(["none","sm","md","lg","xl"]),container_type:t.z.enum(["full-width","container","container-sm","container-lg","container-xl"]),padding:t.z.object({bottom:t.z.enum(["none","sm","md","lg","xl"]),top:t.z.enum(["none","sm","md","lg","xl"])}),responsive_columns:t.z.object({desktop:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(3),t.z.literal(4)]),mobile:t.z.union([t.z.literal(1),t.z.literal(2)]),tablet:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(3)])}),vertical_alignment:t.z.enum(["start","center","end","stretch"]).optional()}),b={button:t.z.object({position:t.z.enum(["left","center","right"]).optional(),size:t.z.enum(["default","sm","lg","full"]).optional(),text:t.z.string(),url:t.z.string(),variant:t.z.enum(["default","outline","secondary","ghost","link"]).optional()}),cart:t.z.object({}),checkout:t.z.object({}),featured_product:t.z.object({imagePosition:t.z.enum(["left","right"]).default("left"),productId:t.z.string().min(1),showBackground:t.z.boolean().default(!1)}),form:t.z.object({fields:t.z.array(t.z.object({field_type:t.z.enum(["text","email","textarea","select","radio","checkbox"]),is_required:t.z.boolean(),label:t.z.string(),options:t.z.array(t.z.object({label:t.z.string(),value:t.z.string()})).optional(),placeholder:t.z.string().optional(),temp_id:t.z.string()})),form_key:t.z.string().optional(),recipient_email:t.z.string().email().optional(),submit_button_text:t.z.string(),success_message:t.z.string()}),heading:t.z.object({level:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(3),t.z.literal(4),t.z.literal(5),t.z.literal(6)]),textAlign:t.z.enum(["left","center","right","justify"]).optional(),textColor:t.z.union([t.z.enum(["foreground","primary","secondary","accent","muted","destructive","background"]),t.z.string().regex(/^(#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i,"Must be a hex, rgb(a) or hsl(a) colour")]).optional().describe("Prefer a theme token so the heading adapts to dark mode; use a CSS colour only when the brand requires an exact value"),text_content:t.z.string()}),image:t.z.object({alt_text:t.z.string().optional(),caption:t.z.string().optional(),external_url:t.z.string().nullable().optional(),height:t.z.number().nullable().optional(),media_id:t.z.string().nullable().optional(),object_key:t.z.string().nullable().optional(),width:t.z.number().nullable().optional()}),posts_grid:t.z.object({columns:t.z.number().min(1).max(6),postsPerPage:t.z.number().min(1).max(50),showPagination:t.z.boolean(),title:t.z.string().optional()}),product_details:t.z.object({}),product_grid:t.z.object({categoryId:t.z.string().optional(),categoryIds:t.z.array(t.z.string()).max(20).optional(),limit:t.z.number().min(0).max(48).default(6),productIds:t.z.array(t.z.string()).max(24).optional(),showPagination:t.z.boolean().default(!1),title:t.z.string().optional(),type:t.z.enum(["latest","category","manual"]).default("latest")}),section:p,testimonial:t.z.object({author_name:t.z.string().min(1),author_title:t.z.string().optional(),image_url:t.z.string().url().optional().or(t.z.literal("")),quote:t.z.string().min(1)}),text:t.z.object({html_content:t.z.string()}),video_embed:t.z.object({autoplay:t.z.boolean().optional(),controls:t.z.boolean().optional(),title:t.z.string().optional(),url:t.z.string()})};function k(o){return u.includes(o)}function _(o){return typeof o?.validateBlockContent=="function"?o.validateBlockContent:null}function j(o,n,r){const l=_(r);if(l)return l(o,n);const i=b[o].safeParse(n);return i.success?{errors:[],isValid:!0,warnings:[]}:{errors:i.error.issues.map(s=>{const e=s.path.join(".");return e?`${e}: ${s.message}`:s.message}),isValid:!1,warnings:[]}}function f(o){return Array.isArray(o.fields)?o.fields.filter(n=>!!n&&typeof n=="object"&&typeof n.key=="string"&&typeof n.type=="string"):[]}function x(o){return o==null||typeof o=="string"&&o.trim()===""||Array.isArray(o)&&o.length===0}function B(o,n){if(!n||typeof n!="object"||Array.isArray(n))return{errors:["content must be a JSON object of { field_key: value } pairs."],isValid:!1,warnings:[]};const r=f(o),l=new Set(r.map(e=>e.key)),i=[],s=[];for(const e of Object.keys(n))l.has(e)||i.push(`Unknown field "${e}" for custom block "${o.slug}". Known fields: ${[...l].join(", ")||"(none)"}.`);for(const e of r){const a=n[e.key];if(x(a)){e.required&&i.push(`Field "${e.key}" is required.`);continue}if(e.type==="text"||e.type==="rich-text"){if(typeof a!="string"){i.push(`Field "${e.key}" must be a string${e.type==="rich-text"?" of HTML":""}.`);continue}typeof e.max_length=="number"&&a.length>e.max_length&&i.push(`Field "${e.key}" exceeds its ${e.max_length}-character limit.`),typeof e.min_length=="number"&&a.length<e.min_length&&i.push(`Field "${e.key}" is shorter than its ${e.min_length}-character minimum.`);continue}if(e.type==="image_r2"){const c=a;(typeof a!="object"||Array.isArray(a)||typeof c.object_key!="string"||typeof c.url!="string")&&i.push(`Field "${e.key}" must be an uploaded image object with object_key and url (upload it with upload_media first) or null.`);continue}if(e.type==="db_relation"){const c=m=>typeof m=="string"||typeof m=="number";e.multiple?(!Array.isArray(a)||!a.every(c))&&i.push(`Field "${e.key}" must be an array of related record ids.`):c(a)||i.push(`Field "${e.key}" must be a single related record id.`);continue}s.push(`Field "${e.key}" has an unrecognised type "${String(e.type)}"; it was not validated.`)}return{errors:i,isValid:i.length===0,warnings:s}}async function C(o){const{data:n,error:r}=await o.from("custom_block_definitions").select("slug, name, fields");if(r)throw new Error(`Could not read the custom block definitions: ${typeof r=="object"&&r&&"message"in r?String(r.message):String(r)}`);return(Array.isArray(n)?n:[]).filter(l=>!!l&&typeof l.slug=="string")}exports.availableCortexAiBlockTypes=u;exports.cortexAiBlockTypeSchema=z;exports.customBlockSlugPatternSchema=g;exports.fallbackBlockSchemas=b;exports.isValidBlockType=k;exports.loadCustomBlockDefinitions=C;exports.readCustomBlockFields=f;exports.sectionBlockFallbackSchema=p;exports.validateCortexBlockContent=j;exports.validateCustomBlockInstanceContent=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});require("./zod-config.cjs.js");const t=require("zod"),u=["text","heading","image","button","posts_grid","video_embed","section","form","testimonial","product_grid","featured_product","cart","checkout","product_details"],z=t.z.enum(u),d=t.z.object({direction:t.z.string().optional(),stops:t.z.array(t.z.object({color:t.z.string(),position:t.z.number()})),type:t.z.enum(["linear","radial"])}),g=t.z.object({gradient:d.optional(),image:t.z.object({alt_text:t.z.string().optional(),blur_data_url:t.z.string().optional(),external_url:t.z.string().optional(),height:t.z.number().optional(),media_id:t.z.string().optional(),object_key:t.z.string().optional(),overlay:t.z.object({gradient:d,type:t.z.literal("gradient")}).optional(),position:t.z.enum(["center","top","bottom","left","right"]),quality:t.z.number().nullable().optional(),size:t.z.enum(["cover","contain"]),width:t.z.number().optional()}).optional(),min_height:t.z.string().optional(),solid_color:t.z.string().optional(),theme:t.z.enum(["primary","secondary","muted","accent","destructive"]).optional(),type:t.z.enum(["none","theme","solid","gradient","image"])}),p=t.z.string().regex(/^[a-z][a-z0-9-]*$/),b=t.z.object({block_type:t.z.union([z,p]),content:t.z.record(t.z.string(),t.z.any()),temp_id:t.z.string().optional()}),k=t.z.object({background:g,column_blocks:t.z.array(t.z.array(b))}),y=t.z.object({autoplay:t.z.boolean().optional(),background:g,column_blocks:t.z.array(t.z.array(b)),column_gap:t.z.enum(["none","sm","md","lg","xl"]),container_type:t.z.enum(["full-width","container","container-sm","container-lg","container-xl"]),is_hero:t.z.boolean().optional(),padding:t.z.object({bottom:t.z.enum(["none","sm","md","lg","xl"]),top:t.z.enum(["none","sm","md","lg","xl"])}),responsive_columns:t.z.object({desktop:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(3),t.z.literal(4)]),mobile:t.z.union([t.z.literal(1),t.z.literal(2)]),tablet:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(3)])}),slider:t.z.boolean().optional(),slides:t.z.array(k).optional(),timeframe:t.z.number().optional(),vertical_alignment:t.z.enum(["start","center","end","stretch"]).optional()}),f={button:t.z.object({position:t.z.enum(["left","center","right"]).optional(),size:t.z.enum(["default","sm","lg","full"]).optional(),text:t.z.string(),url:t.z.string(),variant:t.z.enum(["default","outline","secondary","ghost","link"]).optional()}),cart:t.z.object({}),checkout:t.z.object({}),featured_product:t.z.object({imagePosition:t.z.enum(["left","right"]).default("left"),productId:t.z.string().min(1),showBackground:t.z.boolean().default(!1)}),form:t.z.object({fields:t.z.array(t.z.object({field_type:t.z.enum(["text","email","textarea","select","radio","checkbox"]),is_required:t.z.boolean(),label:t.z.string(),options:t.z.array(t.z.object({label:t.z.string(),value:t.z.string()})).optional(),placeholder:t.z.string().optional(),temp_id:t.z.string()})),form_key:t.z.string().optional(),recipient_email:t.z.string().email().optional(),submit_button_text:t.z.string(),success_message:t.z.string()}),heading:t.z.object({level:t.z.union([t.z.literal(1),t.z.literal(2),t.z.literal(3),t.z.literal(4),t.z.literal(5),t.z.literal(6)]),textAlign:t.z.enum(["left","center","right","justify"]).optional(),textColor:t.z.union([t.z.enum(["foreground","primary","secondary","accent","muted","destructive","background"]),t.z.string().regex(/^(#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i,"Must be a hex, rgb(a) or hsl(a) colour")]).optional().describe("Prefer a theme token so the heading adapts to dark mode; use a CSS colour only when the brand requires an exact value"),text_content:t.z.string()}),image:t.z.object({alt_text:t.z.string().optional(),caption:t.z.string().optional(),external_url:t.z.string().nullable().optional(),height:t.z.number().nullable().optional(),media_id:t.z.string().nullable().optional(),object_key:t.z.string().nullable().optional(),width:t.z.number().nullable().optional()}),posts_grid:t.z.object({columns:t.z.number().min(1).max(6),postsPerPage:t.z.number().min(1).max(50),showPagination:t.z.boolean(),title:t.z.string().optional()}),product_details:t.z.object({}),product_grid:t.z.object({categoryId:t.z.string().optional(),categoryIds:t.z.array(t.z.string()).max(20).optional(),limit:t.z.number().min(0).max(48).default(6),productIds:t.z.array(t.z.string()).max(24).optional(),showPagination:t.z.boolean().default(!1),title:t.z.string().optional(),type:t.z.enum(["latest","category","manual"]).default("latest")}),section:y,testimonial:t.z.object({author_name:t.z.string().min(1),author_title:t.z.string().optional(),image_url:t.z.string().url().optional().or(t.z.literal("")),quote:t.z.string().min(1)}),text:t.z.object({html_content:t.z.string()}),video_embed:t.z.object({autoplay:t.z.boolean().optional(),controls:t.z.boolean().optional(),title:t.z.string().optional(),url:t.z.string()})};function _(o){return u.includes(o)}function j(o){return typeof o?.validateBlockContent=="function"?o.validateBlockContent:null}function x(o,n,a){const l=j(a);if(l)return l(o,n);const i=f[o].safeParse(n);return i.success?{errors:[],isValid:!0,warnings:[]}:{errors:i.error.issues.map(s=>{const e=s.path.join(".");return e?`${e}: ${s.message}`:s.message}),isValid:!1,warnings:[]}}function h(o){return Array.isArray(o.fields)?o.fields.filter(n=>!!n&&typeof n=="object"&&typeof n.key=="string"&&typeof n.type=="string"):[]}function B(o){return o==null||typeof o=="string"&&o.trim()===""||Array.isArray(o)&&o.length===0}function S(o,n){if(!n||typeof n!="object"||Array.isArray(n))return{errors:["content must be a JSON object of { field_key: value } pairs."],isValid:!1,warnings:[]};const a=h(o),l=new Set(a.map(e=>e.key)),i=[],s=[];for(const e of Object.keys(n))l.has(e)||i.push(`Unknown field "${e}" for custom block "${o.slug}". Known fields: ${[...l].join(", ")||"(none)"}.`);for(const e of a){const r=n[e.key];if(B(r)){e.required&&i.push(`Field "${e.key}" is required.`);continue}if(e.type==="text"||e.type==="rich-text"){if(typeof r!="string"){i.push(`Field "${e.key}" must be a string${e.type==="rich-text"?" of HTML":""}.`);continue}typeof e.max_length=="number"&&r.length>e.max_length&&i.push(`Field "${e.key}" exceeds its ${e.max_length}-character limit.`),typeof e.min_length=="number"&&r.length<e.min_length&&i.push(`Field "${e.key}" is shorter than its ${e.min_length}-character minimum.`);continue}if(e.type==="image_r2"){const c=r;(typeof r!="object"||Array.isArray(r)||typeof c.object_key!="string"||typeof c.url!="string")&&i.push(`Field "${e.key}" must be an uploaded image object with object_key and url (upload it with upload_media first) or null.`);continue}if(e.type==="db_relation"){const c=m=>typeof m=="string"||typeof m=="number";e.multiple?(!Array.isArray(r)||!r.every(c))&&i.push(`Field "${e.key}" must be an array of related record ids.`):c(r)||i.push(`Field "${e.key}" must be a single related record id.`);continue}s.push(`Field "${e.key}" has an unrecognised type "${String(e.type)}"; it was not validated.`)}return{errors:i,isValid:i.length===0,warnings:s}}async function C(o){const{data:n,error:a}=await o.from("custom_block_definitions").select("slug, name, fields");if(a)throw new Error(`Could not read the custom block definitions: ${typeof a=="object"&&a&&"message"in a?String(a.message):String(a)}`);return(Array.isArray(n)?n:[]).filter(l=>!!l&&typeof l.slug=="string")}exports.availableCortexAiBlockTypes=u;exports.cortexAiBlockTypeSchema=z;exports.customBlockSlugPatternSchema=p;exports.fallbackBlockSchemas=f;exports.isValidBlockType=_;exports.loadCustomBlockDefinitions=C;exports.readCustomBlockFields=h;exports.sectionBlockFallbackSchema=y;exports.validateCortexBlockContent=x;exports.validateCustomBlockInstanceContent=S;
@@ -47,6 +47,7 @@ export declare const cortexAiBlockTypeSchema: z.ZodEnum<{
47
47
  }>;
48
48
  export declare const customBlockSlugPatternSchema: z.ZodString;
49
49
  export declare const sectionBlockFallbackSchema: z.ZodObject<{
50
+ autoplay: z.ZodOptional<z.ZodBoolean>;
50
51
  background: z.ZodObject<{
51
52
  gradient: z.ZodOptional<z.ZodObject<{
52
53
  direction: z.ZodOptional<z.ZodString>;
@@ -145,6 +146,7 @@ export declare const sectionBlockFallbackSchema: z.ZodObject<{
145
146
  "container-lg": "container-lg";
146
147
  "container-xl": "container-xl";
147
148
  }>;
149
+ is_hero: z.ZodOptional<z.ZodBoolean>;
148
150
  padding: z.ZodObject<{
149
151
  bottom: z.ZodEnum<{
150
152
  none: "none";
@@ -166,6 +168,94 @@ export declare const sectionBlockFallbackSchema: z.ZodObject<{
166
168
  mobile: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
167
169
  tablet: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
168
170
  }, z.core.$strip>;
171
+ slider: z.ZodOptional<z.ZodBoolean>;
172
+ slides: z.ZodOptional<z.ZodArray<z.ZodObject<{
173
+ background: z.ZodObject<{
174
+ gradient: z.ZodOptional<z.ZodObject<{
175
+ direction: z.ZodOptional<z.ZodString>;
176
+ stops: z.ZodArray<z.ZodObject<{
177
+ color: z.ZodString;
178
+ position: z.ZodNumber;
179
+ }, z.core.$strip>>;
180
+ type: z.ZodEnum<{
181
+ linear: "linear";
182
+ radial: "radial";
183
+ }>;
184
+ }, z.core.$strip>>;
185
+ image: z.ZodOptional<z.ZodObject<{
186
+ alt_text: z.ZodOptional<z.ZodString>;
187
+ blur_data_url: z.ZodOptional<z.ZodString>;
188
+ external_url: z.ZodOptional<z.ZodString>;
189
+ height: z.ZodOptional<z.ZodNumber>;
190
+ media_id: z.ZodOptional<z.ZodString>;
191
+ object_key: z.ZodOptional<z.ZodString>;
192
+ overlay: z.ZodOptional<z.ZodObject<{
193
+ gradient: z.ZodObject<{
194
+ direction: z.ZodOptional<z.ZodString>;
195
+ stops: z.ZodArray<z.ZodObject<{
196
+ color: z.ZodString;
197
+ position: z.ZodNumber;
198
+ }, z.core.$strip>>;
199
+ type: z.ZodEnum<{
200
+ linear: "linear";
201
+ radial: "radial";
202
+ }>;
203
+ }, z.core.$strip>;
204
+ type: z.ZodLiteral<"gradient">;
205
+ }, z.core.$strip>>;
206
+ position: z.ZodEnum<{
207
+ center: "center";
208
+ top: "top";
209
+ bottom: "bottom";
210
+ left: "left";
211
+ right: "right";
212
+ }>;
213
+ quality: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
214
+ size: z.ZodEnum<{
215
+ cover: "cover";
216
+ contain: "contain";
217
+ }>;
218
+ width: z.ZodOptional<z.ZodNumber>;
219
+ }, z.core.$strip>>;
220
+ min_height: z.ZodOptional<z.ZodString>;
221
+ solid_color: z.ZodOptional<z.ZodString>;
222
+ theme: z.ZodOptional<z.ZodEnum<{
223
+ primary: "primary";
224
+ secondary: "secondary";
225
+ muted: "muted";
226
+ accent: "accent";
227
+ destructive: "destructive";
228
+ }>>;
229
+ type: z.ZodEnum<{
230
+ none: "none";
231
+ image: "image";
232
+ gradient: "gradient";
233
+ theme: "theme";
234
+ solid: "solid";
235
+ }>;
236
+ }, z.core.$strip>;
237
+ column_blocks: z.ZodArray<z.ZodArray<z.ZodObject<{
238
+ block_type: z.ZodUnion<readonly [z.ZodEnum<{
239
+ text: "text";
240
+ section: "section";
241
+ heading: "heading";
242
+ image: "image";
243
+ button: "button";
244
+ posts_grid: "posts_grid";
245
+ video_embed: "video_embed";
246
+ form: "form";
247
+ testimonial: "testimonial";
248
+ product_grid: "product_grid";
249
+ featured_product: "featured_product";
250
+ cart: "cart";
251
+ checkout: "checkout";
252
+ product_details: "product_details";
253
+ }>, z.ZodString]>;
254
+ content: z.ZodRecord<z.ZodString, z.ZodAny>;
255
+ temp_id: z.ZodOptional<z.ZodString>;
256
+ }, z.core.$strip>>>;
257
+ }, z.core.$strip>>>;
258
+ timeframe: z.ZodOptional<z.ZodNumber>;
169
259
  vertical_alignment: z.ZodOptional<z.ZodEnum<{
170
260
  start: "start";
171
261
  center: "center";
@@ -1,6 +1,6 @@
1
1
  import "./zod-config.es.js";
2
2
  import { z as t } from "zod";
3
- const g = [
3
+ const d = [
4
4
  "text",
5
5
  "heading",
6
6
  "image",
@@ -15,11 +15,11 @@ const g = [
15
15
  "cart",
16
16
  "checkout",
17
17
  "product_details"
18
- ], d = t.enum(g), m = t.object({
18
+ ], b = t.enum(d), m = t.object({
19
19
  direction: t.string().optional(),
20
20
  stops: t.array(t.object({ color: t.string(), position: t.number() })),
21
21
  type: t.enum(["linear", "radial"])
22
- }), p = t.object({
22
+ }), g = t.object({
23
23
  gradient: m.optional(),
24
24
  image: t.object({
25
25
  alt_text: t.string().optional(),
@@ -41,15 +41,25 @@ const g = [
41
41
  solid_color: t.string().optional(),
42
42
  theme: t.enum(["primary", "secondary", "muted", "accent", "destructive"]).optional(),
43
43
  type: t.enum(["none", "theme", "solid", "gradient", "image"])
44
- }), b = t.string().regex(/^[a-z][a-z0-9-]*$/), f = t.object({
45
- block_type: t.union([d, b]),
44
+ }), f = t.string().regex(/^[a-z][a-z0-9-]*$/), p = t.object({
45
+ block_type: t.union([b, f]),
46
46
  content: t.record(t.string(), t.any()),
47
47
  temp_id: t.string().optional()
48
48
  }), y = t.object({
49
- background: p,
50
- column_blocks: t.array(t.array(f)),
49
+ background: g,
50
+ column_blocks: t.array(t.array(p))
51
+ }), h = t.object({
52
+ // Slider settings mirror the editor's "Enable Slider (Carousel layout)" panel:
53
+ // `autoplay` rotates the slides every `timeframe` SECONDS (5 when omitted).
54
+ autoplay: t.boolean().optional(),
55
+ background: g,
56
+ column_blocks: t.array(t.array(p)),
51
57
  column_gap: t.enum(["none", "sm", "md", "lg", "xl"]),
52
58
  container_type: t.enum(["full-width", "container", "container-sm", "container-lg", "container-xl"]),
59
+ // The editor's "Hero Section (Prioritized image loading)" checkbox: the section's
60
+ // background image (and the first slide's images) load with priority, and the
61
+ // normalizer centres its content vertically.
62
+ is_hero: t.boolean().optional(),
53
63
  padding: t.object({
54
64
  bottom: t.enum(["none", "sm", "md", "lg", "xl"]),
55
65
  top: t.enum(["none", "sm", "md", "lg", "xl"])
@@ -59,8 +69,13 @@ const g = [
59
69
  mobile: t.union([t.literal(1), t.literal(2)]),
60
70
  tablet: t.union([t.literal(1), t.literal(2), t.literal(3)])
61
71
  }),
72
+ // With `slider: true` and a non-empty `slides` list the renderer shows a carousel
73
+ // of those slides and ignores the top-level `column_blocks` and `background`.
74
+ slider: t.boolean().optional(),
75
+ slides: t.array(y).optional(),
76
+ timeframe: t.number().optional(),
62
77
  vertical_alignment: t.enum(["start", "center", "end", "stretch"]).optional()
63
- }), h = {
78
+ }), _ = {
64
79
  button: t.object({
65
80
  position: t.enum(["left", "center", "right"]).optional(),
66
81
  size: t.enum(["default", "sm", "lg", "full"]).optional(),
@@ -135,7 +150,7 @@ const g = [
135
150
  title: t.string().optional(),
136
151
  type: t.enum(["latest", "category", "manual"]).default("latest")
137
152
  }),
138
- section: y,
153
+ section: h,
139
154
  testimonial: t.object({
140
155
  author_name: t.string().min(1),
141
156
  author_title: t.string().optional(),
@@ -152,17 +167,17 @@ const g = [
152
167
  url: t.string()
153
168
  })
154
169
  };
155
- function $(o) {
156
- return g.includes(o);
170
+ function v(o) {
171
+ return d.includes(o);
157
172
  }
158
- function _(o) {
173
+ function k(o) {
159
174
  return typeof o?.validateBlockContent == "function" ? o.validateBlockContent : null;
160
175
  }
161
- function v(o, n, r) {
162
- const l = _(r);
176
+ function B(o, n, r) {
177
+ const l = k(r);
163
178
  if (l)
164
179
  return l(o, n);
165
- const i = h[o].safeParse(n);
180
+ const i = _[o].safeParse(n);
166
181
  return i.success ? { errors: [], isValid: !0, warnings: [] } : {
167
182
  errors: i.error.issues.map((s) => {
168
183
  const e = s.path.join(".");
@@ -172,29 +187,29 @@ function v(o, n, r) {
172
187
  warnings: []
173
188
  };
174
189
  }
175
- function k(o) {
190
+ function j(o) {
176
191
  return Array.isArray(o.fields) ? o.fields.filter(
177
192
  (n) => !!n && typeof n == "object" && typeof n.key == "string" && typeof n.type == "string"
178
193
  ) : [];
179
194
  }
180
- function j(o) {
195
+ function x(o) {
181
196
  return o == null || typeof o == "string" && o.trim() === "" || Array.isArray(o) && o.length === 0;
182
197
  }
183
- function B(o, n) {
198
+ function S(o, n) {
184
199
  if (!n || typeof n != "object" || Array.isArray(n))
185
200
  return {
186
201
  errors: ["content must be a JSON object of { field_key: value } pairs."],
187
202
  isValid: !1,
188
203
  warnings: []
189
204
  };
190
- const r = k(o), l = new Set(r.map((e) => e.key)), i = [], s = [];
205
+ const r = j(o), l = new Set(r.map((e) => e.key)), i = [], s = [];
191
206
  for (const e of Object.keys(n))
192
207
  l.has(e) || i.push(
193
208
  `Unknown field "${e}" for custom block "${o.slug}". Known fields: ${[...l].join(", ") || "(none)"}.`
194
209
  );
195
210
  for (const e of r) {
196
211
  const a = n[e.key];
197
- if (j(a)) {
212
+ if (x(a)) {
198
213
  e.required && i.push(`Field "${e.key}" is required.`);
199
214
  continue;
200
215
  }
@@ -233,14 +248,14 @@ async function A(o) {
233
248
  );
234
249
  }
235
250
  export {
236
- g as availableCortexAiBlockTypes,
237
- d as cortexAiBlockTypeSchema,
238
- b as customBlockSlugPatternSchema,
239
- h as fallbackBlockSchemas,
240
- $ as isValidBlockType,
251
+ d as availableCortexAiBlockTypes,
252
+ b as cortexAiBlockTypeSchema,
253
+ f as customBlockSlugPatternSchema,
254
+ _ as fallbackBlockSchemas,
255
+ v as isValidBlockType,
241
256
  A as loadCustomBlockDefinitions,
242
- k as readCustomBlockFields,
243
- y as sectionBlockFallbackSchema,
244
- v as validateCortexBlockContent,
245
- B as validateCustomBlockInstanceContent
257
+ j as readCustomBlockFields,
258
+ h as sectionBlockFallbackSchema,
259
+ B as validateCortexBlockContent,
260
+ S as validateCustomBlockInstanceContent
246
261
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./mcp-tool-registry.cjs.js"),P="nextblock-cortex-ai",M="NextBlock Cortex AI",N="2025-06-18",C="2025-11-25",l="2026-07-28",S=[l,C,"2025-06-18","2025-03-26","2024-11-05"],y=-32700,O=-32600,d=-32601,R=-32602,E=-32603;function u(t,e){return{body:{id:t,jsonrpc:"2.0",result:e},status:200}}function a(t,e,i,r=200,c){return{body:{error:{code:e,message:i},id:t,jsonrpc:"2.0"},status:r}}const s={body:null,status:202};function h(t){return typeof t.method=="string"&&t.id===void 0}function A(t,e){const i=t.params?._meta;if(i&&typeof i=="object"){const r=i["io.modelcontextprotocol/protocolVersion"];if(typeof r=="string"&&r>=l)return!0}return!!(e&&e>=l)}function x(t){return typeof t!="string"||!t?N:S.includes(t)?t:C}function g(t,e){const i=t.scopes.includes("write");return{capabilities:{prompts:{},resources:{},tools:{}},instructions:t.instructions??["NextBlock Cortex AI exposes this CMS through typed tools.","Call get_database_schema first when you are unsure what exists.",i?"Page builds should go through generate_jsonb_layout, which stages a reviewable Live Draft rather than publishing directly.":"This connection is READ-ONLY. Mutating tools are not available on this token."].join(" "),protocolVersion:x(e),serverInfo:{name:P,title:M,version:t.serverVersion,websiteUrl:"https://nextblock.dev"}}}async function I(t,e){if(t===null||typeof t!="object"||Array.isArray(t))return a(null,O,"Expected a single JSON-RPC message.",400);if(typeof t.method!="string")return"result"in t||"error"in t?s:a(t.id??null,O,'Missing "method".',400);const{method:i}=t,r=t.id??null,c=h(t);if(i.startsWith("notifications/"))return s;switch(i){case"initialize":return c?s:u(r,g(e,t.params?.protocolVersion));case"ping":return c?s:u(r,{});case"tools/list":return c?s:u(r,{tools:_.buildCortexMcpToolDefinitions({context:e.context,scopes:e.scopes})});case"tools/call":{if(c)return s;const n=t.params?.name;if(typeof n!="string"||!n)return a(r,R,"tools/call requires params.name.");try{const o=await _.callCortexMcpTool({args:t.params?.arguments,context:e.context,name:n,scopes:e.scopes});return u(r,o)}catch(o){return o instanceof _.CortexMcpUnknownToolError||o instanceof _.CortexMcpForbiddenToolError?a(r,R,o.message):a(r,E,o instanceof Error?o.message:"Tool execution failed.")}}case"resources/list":return c?s:u(r,{resources:_.CORTEX_MCP_RESOURCES});case"resources/templates/list":return c?s:u(r,{resourceTemplates:[]});case"resources/read":{if(c)return s;const n=t.params?.uri;if(typeof n!="string"||!n)return a(r,R,"resources/read requires params.uri.");try{const o=await _.readCortexMcpResource({context:e.context,uri:n});return o?u(r,{contents:[o]}):a(r,R,`Unknown resource: ${n}`)}catch(o){return a(r,E,o instanceof Error?o.message:"Resource read failed.")}}case"prompts/list":return c?s:u(r,{prompts:_.CORTEX_MCP_PROMPTS});case"prompts/get":{if(c)return s;const n=t.params?.name;if(typeof n!="string"||!n)return a(r,R,"prompts/get requires params.name.");const o=t.params?.arguments,p={};if(o&&typeof o=="object")for(const[m,T]of Object.entries(o))typeof T=="string"&&(p[m]=T);const f=_.getCortexMcpPrompt({args:p,name:n});return f?u(r,f):a(r,R,`Unknown prompt: ${n}`)}default:return c?s:a(r,d,`Method not found: ${i}`)}}exports.CORTEX_MCP_DEFAULT_PROTOCOL_VERSION=N;exports.CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION=C;exports.CORTEX_MCP_MODERN_PROTOCOL_VERSION=l;exports.CORTEX_MCP_SERVER_NAME=P;exports.CORTEX_MCP_SERVER_TITLE=M;exports.CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS=S;exports.JSON_RPC_INTERNAL_ERROR=E;exports.JSON_RPC_INVALID_PARAMS=R;exports.JSON_RPC_INVALID_REQUEST=O;exports.JSON_RPC_METHOD_NOT_FOUND=d;exports.JSON_RPC_PARSE_ERROR=y;exports.handleCortexMcpMessage=I;exports.isJsonRpcNotification=h;exports.isModernEraMessage=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./mcp-tool-registry.cjs.js"),P="nextblock-cortex-ai",M="NextBlock Cortex AI",N="2025-06-18",E="2025-11-25",R="2026-07-28",S=[R,E,"2025-06-18","2025-03-26","2024-11-05"],g=-32700,O=-32600,d=-32601,l=-32602,p=-32603;function u(t,o){return{body:{id:t,jsonrpc:"2.0",result:o},status:200}}function a(t,o,i,r=200,c){return{body:{error:{code:o,message:i},id:t,jsonrpc:"2.0"},status:r}}const s={body:null,status:202};function h(t){return typeof t.method=="string"&&t.id===void 0}function y(t,o){const i=t.params?._meta;if(i&&typeof i=="object"){const r=i["io.modelcontextprotocol/protocolVersion"];if(typeof r=="string"&&r>=R)return!0}return!!(o&&o>=R)}function A(t){return typeof t!="string"||!t?N:S.includes(t)?t:E}function x(t,o){const i=t.scopes.includes("write");return{capabilities:{prompts:{},resources:{},tools:{}},instructions:t.instructions??["NextBlock Cortex AI exposes this CMS through typed tools.","Call get_database_schema first when you are unsure what exists.","Conventions: a page or post feature_image_id renders as a full-width title banner above the content and is its share preview — give posts one, never the home page or a page with its own hero section (use update_site_identity social_image for the site-wide preview); mark hero sections is_hero:true; slider:true plus slides makes a carousel.",i?"Page builds should go through generate_jsonb_layout, which stages a reviewable Live Draft rather than publishing directly.":"This connection is READ-ONLY. Mutating tools are not available on this token."].join(" "),protocolVersion:A(o),serverInfo:{name:P,title:M,version:t.serverVersion,websiteUrl:"https://nextblock.dev"}}}async function b(t,o){if(t===null||typeof t!="object"||Array.isArray(t))return a(null,O,"Expected a single JSON-RPC message.",400);if(typeof t.method!="string")return"result"in t||"error"in t?s:a(t.id??null,O,'Missing "method".',400);const{method:i}=t,r=t.id??null,c=h(t);if(i.startsWith("notifications/"))return s;switch(i){case"initialize":return c?s:u(r,x(o,t.params?.protocolVersion));case"ping":return c?s:u(r,{});case"tools/list":return c?s:u(r,{tools:_.buildCortexMcpToolDefinitions({context:o.context,scopes:o.scopes})});case"tools/call":{if(c)return s;const n=t.params?.name;if(typeof n!="string"||!n)return a(r,l,"tools/call requires params.name.");try{const e=await _.callCortexMcpTool({args:t.params?.arguments,context:o.context,name:n,scopes:o.scopes});return u(r,e)}catch(e){return e instanceof _.CortexMcpUnknownToolError||e instanceof _.CortexMcpForbiddenToolError?a(r,l,e.message):a(r,p,e instanceof Error?e.message:"Tool execution failed.")}}case"resources/list":return c?s:u(r,{resources:_.CORTEX_MCP_RESOURCES});case"resources/templates/list":return c?s:u(r,{resourceTemplates:[]});case"resources/read":{if(c)return s;const n=t.params?.uri;if(typeof n!="string"||!n)return a(r,l,"resources/read requires params.uri.");try{const e=await _.readCortexMcpResource({context:o.context,uri:n});return e?u(r,{contents:[e]}):a(r,l,`Unknown resource: ${n}`)}catch(e){return a(r,p,e instanceof Error?e.message:"Resource read failed.")}}case"prompts/list":return c?s:u(r,{prompts:_.CORTEX_MCP_PROMPTS});case"prompts/get":{if(c)return s;const n=t.params?.name;if(typeof n!="string"||!n)return a(r,l,"prompts/get requires params.name.");const e=t.params?.arguments,C={};if(e&&typeof e=="object")for(const[m,T]of Object.entries(e))typeof T=="string"&&(C[m]=T);const f=_.getCortexMcpPrompt({args:C,name:n});return f?u(r,f):a(r,l,`Unknown prompt: ${n}`)}default:return c?s:a(r,d,`Method not found: ${i}`)}}exports.CORTEX_MCP_DEFAULT_PROTOCOL_VERSION=N;exports.CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION=E;exports.CORTEX_MCP_MODERN_PROTOCOL_VERSION=R;exports.CORTEX_MCP_SERVER_NAME=P;exports.CORTEX_MCP_SERVER_TITLE=M;exports.CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS=S;exports.JSON_RPC_INTERNAL_ERROR=p;exports.JSON_RPC_INVALID_PARAMS=l;exports.JSON_RPC_INVALID_REQUEST=O;exports.JSON_RPC_METHOD_NOT_FOUND=d;exports.JSON_RPC_PARSE_ERROR=g;exports.handleCortexMcpMessage=b;exports.isJsonRpcNotification=h;exports.isModernEraMessage=y;
@@ -1,18 +1,18 @@
1
- import { getCortexMcpPrompt as P, readCortexMcpResource as d, callCortexMcpTool as h, CortexMcpUnknownToolError as m, CortexMcpForbiddenToolError as M, buildCortexMcpToolDefinitions as x, CORTEX_MCP_PROMPTS as y, CORTEX_MCP_RESOURCES as N } from "./mcp-tool-registry.es.js";
2
- const S = "nextblock-cortex-ai", b = "NextBlock Cortex AI", g = "2025-06-18", O = "2025-11-25", p = "2026-07-28", A = [
1
+ import { getCortexMcpPrompt as d, readCortexMcpResource as m, callCortexMcpTool as T, CortexMcpUnknownToolError as P, CortexMcpForbiddenToolError as M, buildCortexMcpToolDefinitions as x, CORTEX_MCP_PROMPTS as g, CORTEX_MCP_RESOURCES as y } from "./mcp-tool-registry.es.js";
2
+ const N = "nextblock-cortex-ai", b = "NextBlock Cortex AI", S = "2025-06-18", O = "2025-11-25", p = "2026-07-28", w = [
3
3
  p,
4
4
  O,
5
5
  "2025-06-18",
6
6
  "2025-03-26",
7
7
  "2024-11-05"
8
- ], j = -32700, E = -32600, I = -32601, l = -32602, C = -32603;
9
- function u(t, n) {
10
- return { body: { id: t, jsonrpc: "2.0", result: n }, status: 200 };
8
+ ], k = -32700, C = -32600, A = -32601, l = -32602, E = -32603;
9
+ function u(t, o) {
10
+ return { body: { id: t, jsonrpc: "2.0", result: o }, status: 200 };
11
11
  }
12
- function a(t, n, i, r = 200, c) {
12
+ function a(t, o, i, r = 200, c) {
13
13
  return {
14
14
  body: {
15
- error: { code: n, message: i },
15
+ error: { code: o, message: i },
16
16
  id: t,
17
17
  jsonrpc: "2.0"
18
18
  },
@@ -20,22 +20,22 @@ function a(t, n, i, r = 200, c) {
20
20
  };
21
21
  }
22
22
  const s = { body: null, status: 202 };
23
- function w(t) {
23
+ function v(t) {
24
24
  return typeof t.method == "string" && t.id === void 0;
25
25
  }
26
- function v(t, n) {
26
+ function D(t, o) {
27
27
  const i = t.params?._meta;
28
28
  if (i && typeof i == "object") {
29
29
  const r = i["io.modelcontextprotocol/protocolVersion"];
30
30
  if (typeof r == "string" && r >= p)
31
31
  return !0;
32
32
  }
33
- return !!(n && n >= p);
33
+ return !!(o && o >= p);
34
34
  }
35
- function L(t) {
36
- return typeof t != "string" || !t ? g : A.includes(t) ? t : O;
35
+ function I(t) {
36
+ return typeof t != "string" || !t ? S : w.includes(t) ? t : O;
37
37
  }
38
- function V(t, n) {
38
+ function L(t, o) {
39
39
  const i = t.scopes.includes("write");
40
40
  return {
41
41
  capabilities: {
@@ -49,109 +49,110 @@ function V(t, n) {
49
49
  instructions: t.instructions ?? [
50
50
  "NextBlock Cortex AI exposes this CMS through typed tools.",
51
51
  "Call get_database_schema first when you are unsure what exists.",
52
+ "Conventions: a page or post feature_image_id renders as a full-width title banner above the content and is its share preview — give posts one, never the home page or a page with its own hero section (use update_site_identity social_image for the site-wide preview); mark hero sections is_hero:true; slider:true plus slides makes a carousel.",
52
53
  i ? "Page builds should go through generate_jsonb_layout, which stages a reviewable Live Draft rather than publishing directly." : "This connection is READ-ONLY. Mutating tools are not available on this token."
53
54
  ].join(" "),
54
- protocolVersion: L(n),
55
+ protocolVersion: I(o),
55
56
  serverInfo: {
56
- name: S,
57
+ name: N,
57
58
  title: b,
58
59
  version: t.serverVersion,
59
60
  websiteUrl: "https://nextblock.dev"
60
61
  }
61
62
  };
62
63
  }
63
- async function k(t, n) {
64
+ async function j(t, o) {
64
65
  if (t === null || typeof t != "object" || Array.isArray(t))
65
- return a(null, E, "Expected a single JSON-RPC message.", 400);
66
+ return a(null, C, "Expected a single JSON-RPC message.", 400);
66
67
  if (typeof t.method != "string")
67
- return "result" in t || "error" in t ? s : a(t.id ?? null, E, 'Missing "method".', 400);
68
- const { method: i } = t, r = t.id ?? null, c = w(t);
68
+ return "result" in t || "error" in t ? s : a(t.id ?? null, C, 'Missing "method".', 400);
69
+ const { method: i } = t, r = t.id ?? null, c = v(t);
69
70
  if (i.startsWith("notifications/"))
70
71
  return s;
71
72
  switch (i) {
72
73
  case "initialize":
73
- return c ? s : u(r, V(n, t.params?.protocolVersion));
74
+ return c ? s : u(r, L(o, t.params?.protocolVersion));
74
75
  case "ping":
75
76
  return c ? s : u(r, {});
76
77
  case "tools/list":
77
78
  return c ? s : u(r, {
78
- tools: x({ context: n.context, scopes: n.scopes })
79
+ tools: x({ context: o.context, scopes: o.scopes })
79
80
  });
80
81
  case "tools/call": {
81
82
  if (c)
82
83
  return s;
83
- const e = t.params?.name;
84
- if (typeof e != "string" || !e)
84
+ const n = t.params?.name;
85
+ if (typeof n != "string" || !n)
85
86
  return a(r, l, "tools/call requires params.name.");
86
87
  try {
87
- const o = await h({
88
+ const e = await T({
88
89
  args: t.params?.arguments,
89
- context: n.context,
90
- name: e,
91
- scopes: n.scopes
90
+ context: o.context,
91
+ name: n,
92
+ scopes: o.scopes
92
93
  });
93
- return u(r, o);
94
- } catch (o) {
95
- return o instanceof m || o instanceof M ? a(r, l, o.message) : a(
94
+ return u(r, e);
95
+ } catch (e) {
96
+ return e instanceof P || e instanceof M ? a(r, l, e.message) : a(
96
97
  r,
97
- C,
98
- o instanceof Error ? o.message : "Tool execution failed."
98
+ E,
99
+ e instanceof Error ? e.message : "Tool execution failed."
99
100
  );
100
101
  }
101
102
  }
102
103
  case "resources/list":
103
- return c ? s : u(r, { resources: N });
104
+ return c ? s : u(r, { resources: y });
104
105
  case "resources/templates/list":
105
106
  return c ? s : u(r, { resourceTemplates: [] });
106
107
  case "resources/read": {
107
108
  if (c)
108
109
  return s;
109
- const e = t.params?.uri;
110
- if (typeof e != "string" || !e)
110
+ const n = t.params?.uri;
111
+ if (typeof n != "string" || !n)
111
112
  return a(r, l, "resources/read requires params.uri.");
112
113
  try {
113
- const o = await d({ context: n.context, uri: e });
114
- return o ? u(r, { contents: [o] }) : a(r, l, `Unknown resource: ${e}`);
115
- } catch (o) {
114
+ const e = await m({ context: o.context, uri: n });
115
+ return e ? u(r, { contents: [e] }) : a(r, l, `Unknown resource: ${n}`);
116
+ } catch (e) {
116
117
  return a(
117
118
  r,
118
- C,
119
- o instanceof Error ? o.message : "Resource read failed."
119
+ E,
120
+ e instanceof Error ? e.message : "Resource read failed."
120
121
  );
121
122
  }
122
123
  }
123
124
  case "prompts/list":
124
- return c ? s : u(r, { prompts: y });
125
+ return c ? s : u(r, { prompts: g });
125
126
  case "prompts/get": {
126
127
  if (c)
127
128
  return s;
128
- const e = t.params?.name;
129
- if (typeof e != "string" || !e)
129
+ const n = t.params?.name;
130
+ if (typeof n != "string" || !n)
130
131
  return a(r, l, "prompts/get requires params.name.");
131
- const o = t.params?.arguments, f = {};
132
- if (o && typeof o == "object")
133
- for (const [T, _] of Object.entries(o))
134
- typeof _ == "string" && (f[T] = _);
135
- const R = P({ args: f, name: e });
136
- return R ? u(r, R) : a(r, l, `Unknown prompt: ${e}`);
132
+ const e = t.params?.arguments, f = {};
133
+ if (e && typeof e == "object")
134
+ for (const [h, R] of Object.entries(e))
135
+ typeof R == "string" && (f[h] = R);
136
+ const _ = d({ args: f, name: n });
137
+ return _ ? u(r, _) : a(r, l, `Unknown prompt: ${n}`);
137
138
  }
138
139
  default:
139
- return c ? s : a(r, I, `Method not found: ${i}`);
140
+ return c ? s : a(r, A, `Method not found: ${i}`);
140
141
  }
141
142
  }
142
143
  export {
143
- g as CORTEX_MCP_DEFAULT_PROTOCOL_VERSION,
144
+ S as CORTEX_MCP_DEFAULT_PROTOCOL_VERSION,
144
145
  O as CORTEX_MCP_LATEST_LEGACY_PROTOCOL_VERSION,
145
146
  p as CORTEX_MCP_MODERN_PROTOCOL_VERSION,
146
- S as CORTEX_MCP_SERVER_NAME,
147
+ N as CORTEX_MCP_SERVER_NAME,
147
148
  b as CORTEX_MCP_SERVER_TITLE,
148
- A as CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS,
149
- C as JSON_RPC_INTERNAL_ERROR,
149
+ w as CORTEX_MCP_SUPPORTED_PROTOCOL_VERSIONS,
150
+ E as JSON_RPC_INTERNAL_ERROR,
150
151
  l as JSON_RPC_INVALID_PARAMS,
151
- E as JSON_RPC_INVALID_REQUEST,
152
- I as JSON_RPC_METHOD_NOT_FOUND,
153
- j as JSON_RPC_PARSE_ERROR,
154
- k as handleCortexMcpMessage,
155
- w as isJsonRpcNotification,
156
- v as isModernEraMessage
152
+ C as JSON_RPC_INVALID_REQUEST,
153
+ A as JSON_RPC_METHOD_NOT_FOUND,
154
+ k as JSON_RPC_PARSE_ERROR,
155
+ j as handleCortexMcpMessage,
156
+ v as isJsonRpcNotification,
157
+ D as isModernEraMessage
157
158
  };
@@ -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 O=[{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 R(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"}],j={"build-site":e=>["Build the whole NextBlock site for this client.","",e.brief?.trim()?`Brief:
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; 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."].join(`
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, alternating none / theme:"muted" / theme:"primary" backgrounds for rhythm. Use discrete heading blocks rather than <h2> inside text HTML.',"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(`
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:
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
+ `),"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=j[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=O;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=R;exports.resolveCortexMcpToolName=h;
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;