@nextblock-cms/cortex 0.17.7 → 0.17.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.
- package/index.cjs.js +1 -1
- package/index.d.ts +3 -0
- package/index.es.js +237 -199
- package/lib/ai-global-agent-db-tools.cjs.js +1 -1
- package/lib/ai-global-agent-db-tools.d.ts +7 -0
- package/lib/ai-global-agent-db-tools.es.js +309 -192
- package/lib/ai-global-agent-site-tools.cjs.js +2 -0
- package/lib/ai-global-agent-site-tools.d.ts +1153 -0
- package/lib/ai-global-agent-site-tools.es.js +712 -0
- package/lib/ai-global-agent-theming-tools.cjs.js +2 -2
- package/lib/ai-global-agent-theming-tools.d.ts +18 -0
- package/lib/ai-global-agent-theming-tools.es.js +1 -0
- package/lib/ai-global-agent-tools.cjs.js +2 -2
- package/lib/ai-global-agent-tools.es.js +1826 -1925
- package/lib/block-content-schemas.cjs.js +1 -0
- package/lib/block-content-schemas.d.ts +216 -0
- package/lib/block-content-schemas.es.js +246 -0
- package/lib/mcp-tool-registry.cjs.js +4 -2
- package/lib/mcp-tool-registry.d.ts +15 -0
- package/lib/mcp-tool-registry.es.js +103 -70
- package/lib/site-brief.cjs.js +2 -0
- package/lib/site-brief.d.ts +159 -0
- package/lib/site-brief.es.js +109 -0
- package/package.json +4 -4
- package/lib/ai-global-agent-tools.d.ts +0 -4374
|
@@ -0,0 +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;
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import { z } from './zod-config';
|
|
2
|
+
/**
|
|
3
|
+
* The block vocabulary Cortex AI can write, and the schemas that guard it.
|
|
4
|
+
*
|
|
5
|
+
* Two validators exist for the same JSONB, on purpose:
|
|
6
|
+
*
|
|
7
|
+
* 1. The app's own `validateBlockContent` (apps/nextblock/lib/blocks/blockRegistry.ts)
|
|
8
|
+
* holds the authoritative Zod schemas. Both the dashboard chat route and the MCP
|
|
9
|
+
* route inject it into the tool context, so every block Cortex writes through a
|
|
10
|
+
* typed tool is checked against the exact schema the editor and renderer use.
|
|
11
|
+
* 2. `fallbackBlockSchemas` below mirrors those schemas for the cases where the app
|
|
12
|
+
* is not around: unit tests, the CLI verifier, a future headless runner. libs/*
|
|
13
|
+
* cannot import from the app, so the mirror is restated here; keep it in sync
|
|
14
|
+
* when a block type gains a field.
|
|
15
|
+
*
|
|
16
|
+
* This module is deliberately free of tool-execution concerns so that the generic
|
|
17
|
+
* database tools (`execute_database_mutation` on `blocks`) can reuse the same
|
|
18
|
+
* validation the typed content tools apply, instead of writing unvalidated JSONB.
|
|
19
|
+
*/
|
|
20
|
+
export declare const availableCortexAiBlockTypes: readonly ["text", "heading", "image", "button", "posts_grid", "video_embed", "section", "form", "testimonial", "product_grid", "featured_product", "cart", "checkout", "product_details"];
|
|
21
|
+
export type BlockType = (typeof availableCortexAiBlockTypes)[number];
|
|
22
|
+
export type BlockValidationResult = {
|
|
23
|
+
errors: string[];
|
|
24
|
+
isValid: boolean;
|
|
25
|
+
warnings: string[];
|
|
26
|
+
};
|
|
27
|
+
export type BlockContentValidator = (blockType: BlockType, content: Record<string, any>) => BlockValidationResult;
|
|
28
|
+
/** The slice of a tool context the validators care about. */
|
|
29
|
+
export type BlockValidationContext = {
|
|
30
|
+
validateBlockContent?: BlockContentValidator;
|
|
31
|
+
};
|
|
32
|
+
export declare const cortexAiBlockTypeSchema: z.ZodEnum<{
|
|
33
|
+
text: "text";
|
|
34
|
+
section: "section";
|
|
35
|
+
heading: "heading";
|
|
36
|
+
image: "image";
|
|
37
|
+
button: "button";
|
|
38
|
+
posts_grid: "posts_grid";
|
|
39
|
+
video_embed: "video_embed";
|
|
40
|
+
form: "form";
|
|
41
|
+
testimonial: "testimonial";
|
|
42
|
+
product_grid: "product_grid";
|
|
43
|
+
featured_product: "featured_product";
|
|
44
|
+
cart: "cart";
|
|
45
|
+
checkout: "checkout";
|
|
46
|
+
product_details: "product_details";
|
|
47
|
+
}>;
|
|
48
|
+
export declare const customBlockSlugPatternSchema: z.ZodString;
|
|
49
|
+
export declare const sectionBlockFallbackSchema: z.ZodObject<{
|
|
50
|
+
background: z.ZodObject<{
|
|
51
|
+
gradient: z.ZodOptional<z.ZodObject<{
|
|
52
|
+
direction: z.ZodOptional<z.ZodString>;
|
|
53
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
54
|
+
color: z.ZodString;
|
|
55
|
+
position: z.ZodNumber;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
type: z.ZodEnum<{
|
|
58
|
+
linear: "linear";
|
|
59
|
+
radial: "radial";
|
|
60
|
+
}>;
|
|
61
|
+
}, z.core.$strip>>;
|
|
62
|
+
image: z.ZodOptional<z.ZodObject<{
|
|
63
|
+
alt_text: z.ZodOptional<z.ZodString>;
|
|
64
|
+
blur_data_url: z.ZodOptional<z.ZodString>;
|
|
65
|
+
external_url: z.ZodOptional<z.ZodString>;
|
|
66
|
+
height: z.ZodOptional<z.ZodNumber>;
|
|
67
|
+
media_id: z.ZodOptional<z.ZodString>;
|
|
68
|
+
object_key: z.ZodOptional<z.ZodString>;
|
|
69
|
+
overlay: z.ZodOptional<z.ZodObject<{
|
|
70
|
+
gradient: z.ZodObject<{
|
|
71
|
+
direction: z.ZodOptional<z.ZodString>;
|
|
72
|
+
stops: z.ZodArray<z.ZodObject<{
|
|
73
|
+
color: z.ZodString;
|
|
74
|
+
position: z.ZodNumber;
|
|
75
|
+
}, z.core.$strip>>;
|
|
76
|
+
type: z.ZodEnum<{
|
|
77
|
+
linear: "linear";
|
|
78
|
+
radial: "radial";
|
|
79
|
+
}>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
type: z.ZodLiteral<"gradient">;
|
|
82
|
+
}, z.core.$strip>>;
|
|
83
|
+
position: z.ZodEnum<{
|
|
84
|
+
center: "center";
|
|
85
|
+
top: "top";
|
|
86
|
+
bottom: "bottom";
|
|
87
|
+
left: "left";
|
|
88
|
+
right: "right";
|
|
89
|
+
}>;
|
|
90
|
+
quality: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
91
|
+
size: z.ZodEnum<{
|
|
92
|
+
cover: "cover";
|
|
93
|
+
contain: "contain";
|
|
94
|
+
}>;
|
|
95
|
+
width: z.ZodOptional<z.ZodNumber>;
|
|
96
|
+
}, z.core.$strip>>;
|
|
97
|
+
min_height: z.ZodOptional<z.ZodString>;
|
|
98
|
+
solid_color: z.ZodOptional<z.ZodString>;
|
|
99
|
+
theme: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
primary: "primary";
|
|
101
|
+
secondary: "secondary";
|
|
102
|
+
muted: "muted";
|
|
103
|
+
accent: "accent";
|
|
104
|
+
destructive: "destructive";
|
|
105
|
+
}>>;
|
|
106
|
+
type: z.ZodEnum<{
|
|
107
|
+
none: "none";
|
|
108
|
+
image: "image";
|
|
109
|
+
gradient: "gradient";
|
|
110
|
+
theme: "theme";
|
|
111
|
+
solid: "solid";
|
|
112
|
+
}>;
|
|
113
|
+
}, z.core.$strip>;
|
|
114
|
+
column_blocks: z.ZodArray<z.ZodArray<z.ZodObject<{
|
|
115
|
+
block_type: z.ZodUnion<readonly [z.ZodEnum<{
|
|
116
|
+
text: "text";
|
|
117
|
+
section: "section";
|
|
118
|
+
heading: "heading";
|
|
119
|
+
image: "image";
|
|
120
|
+
button: "button";
|
|
121
|
+
posts_grid: "posts_grid";
|
|
122
|
+
video_embed: "video_embed";
|
|
123
|
+
form: "form";
|
|
124
|
+
testimonial: "testimonial";
|
|
125
|
+
product_grid: "product_grid";
|
|
126
|
+
featured_product: "featured_product";
|
|
127
|
+
cart: "cart";
|
|
128
|
+
checkout: "checkout";
|
|
129
|
+
product_details: "product_details";
|
|
130
|
+
}>, z.ZodString]>;
|
|
131
|
+
content: z.ZodRecord<z.ZodString, z.ZodAny>;
|
|
132
|
+
temp_id: z.ZodOptional<z.ZodString>;
|
|
133
|
+
}, z.core.$strip>>>;
|
|
134
|
+
column_gap: z.ZodEnum<{
|
|
135
|
+
none: "none";
|
|
136
|
+
sm: "sm";
|
|
137
|
+
md: "md";
|
|
138
|
+
lg: "lg";
|
|
139
|
+
xl: "xl";
|
|
140
|
+
}>;
|
|
141
|
+
container_type: z.ZodEnum<{
|
|
142
|
+
container: "container";
|
|
143
|
+
"full-width": "full-width";
|
|
144
|
+
"container-sm": "container-sm";
|
|
145
|
+
"container-lg": "container-lg";
|
|
146
|
+
"container-xl": "container-xl";
|
|
147
|
+
}>;
|
|
148
|
+
padding: z.ZodObject<{
|
|
149
|
+
bottom: z.ZodEnum<{
|
|
150
|
+
none: "none";
|
|
151
|
+
sm: "sm";
|
|
152
|
+
md: "md";
|
|
153
|
+
lg: "lg";
|
|
154
|
+
xl: "xl";
|
|
155
|
+
}>;
|
|
156
|
+
top: z.ZodEnum<{
|
|
157
|
+
none: "none";
|
|
158
|
+
sm: "sm";
|
|
159
|
+
md: "md";
|
|
160
|
+
lg: "lg";
|
|
161
|
+
xl: "xl";
|
|
162
|
+
}>;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
responsive_columns: z.ZodObject<{
|
|
165
|
+
desktop: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>, z.ZodLiteral<4>]>;
|
|
166
|
+
mobile: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>]>;
|
|
167
|
+
tablet: z.ZodUnion<readonly [z.ZodLiteral<1>, z.ZodLiteral<2>, z.ZodLiteral<3>]>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
|
+
vertical_alignment: z.ZodOptional<z.ZodEnum<{
|
|
170
|
+
start: "start";
|
|
171
|
+
center: "center";
|
|
172
|
+
end: "end";
|
|
173
|
+
stretch: "stretch";
|
|
174
|
+
}>>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
export declare const fallbackBlockSchemas: Record<BlockType, z.ZodTypeAny>;
|
|
177
|
+
export declare function isValidBlockType(blockType: string): blockType is BlockType;
|
|
178
|
+
export declare function validateCortexBlockContent(blockType: BlockType, content: Record<string, unknown>, context?: BlockValidationContext): BlockValidationResult;
|
|
179
|
+
/**
|
|
180
|
+
* A block whose `block_type` is a `custom_block_definitions.slug` rather than a
|
|
181
|
+
* built-in type. Its `content` is the flat `{ field_key: value }` map the
|
|
182
|
+
* DynamicLayoutEngine renders from the definition's `fields`.
|
|
183
|
+
*
|
|
184
|
+
* Only the pieces of the definition the validator needs; the row carries more.
|
|
185
|
+
*/
|
|
186
|
+
export type CustomBlockDefinitionLike = {
|
|
187
|
+
fields?: unknown;
|
|
188
|
+
name?: string | null;
|
|
189
|
+
slug: string;
|
|
190
|
+
};
|
|
191
|
+
type CustomBlockFieldLike = {
|
|
192
|
+
key: string;
|
|
193
|
+
max_length?: number;
|
|
194
|
+
min_length?: number;
|
|
195
|
+
multiple?: boolean;
|
|
196
|
+
required?: boolean;
|
|
197
|
+
type: 'db_relation' | 'image_r2' | 'rich-text' | 'text';
|
|
198
|
+
};
|
|
199
|
+
export declare function readCustomBlockFields(definition: CustomBlockDefinitionLike): CustomBlockFieldLike[];
|
|
200
|
+
/**
|
|
201
|
+
* Validate the `{ field_key: value }` content of a custom block instance against
|
|
202
|
+
* its definition. Mirrors what the block editor lets an author save:
|
|
203
|
+
*
|
|
204
|
+
* text / rich-text -> string (rich-text is HTML), honouring min/max length
|
|
205
|
+
* image_r2 -> null or { object_key, url, ... } as the uploader stores it
|
|
206
|
+
* db_relation -> null, an id, or an array of ids when `multiple`
|
|
207
|
+
*
|
|
208
|
+
* Unknown keys are rejected rather than stripped, so a model that guesses a field
|
|
209
|
+
* name gets an error naming the real keys instead of silently losing its copy.
|
|
210
|
+
*/
|
|
211
|
+
export declare function validateCustomBlockInstanceContent(definition: CustomBlockDefinitionLike, content: unknown): BlockValidationResult;
|
|
212
|
+
/** Load the custom block definitions a `block_type` slug may resolve to. */
|
|
213
|
+
export declare function loadCustomBlockDefinitions(supabase: {
|
|
214
|
+
from: (table: string) => any;
|
|
215
|
+
}): Promise<CustomBlockDefinitionLike[]>;
|
|
216
|
+
export {};
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import "./zod-config.es.js";
|
|
2
|
+
import { z as t } from "zod";
|
|
3
|
+
const g = [
|
|
4
|
+
"text",
|
|
5
|
+
"heading",
|
|
6
|
+
"image",
|
|
7
|
+
"button",
|
|
8
|
+
"posts_grid",
|
|
9
|
+
"video_embed",
|
|
10
|
+
"section",
|
|
11
|
+
"form",
|
|
12
|
+
"testimonial",
|
|
13
|
+
"product_grid",
|
|
14
|
+
"featured_product",
|
|
15
|
+
"cart",
|
|
16
|
+
"checkout",
|
|
17
|
+
"product_details"
|
|
18
|
+
], d = t.enum(g), m = t.object({
|
|
19
|
+
direction: t.string().optional(),
|
|
20
|
+
stops: t.array(t.object({ color: t.string(), position: t.number() })),
|
|
21
|
+
type: t.enum(["linear", "radial"])
|
|
22
|
+
}), p = t.object({
|
|
23
|
+
gradient: m.optional(),
|
|
24
|
+
image: t.object({
|
|
25
|
+
alt_text: t.string().optional(),
|
|
26
|
+
blur_data_url: t.string().optional(),
|
|
27
|
+
external_url: t.string().optional(),
|
|
28
|
+
height: t.number().optional(),
|
|
29
|
+
media_id: t.string().optional(),
|
|
30
|
+
object_key: t.string().optional(),
|
|
31
|
+
overlay: t.object({
|
|
32
|
+
gradient: m,
|
|
33
|
+
type: t.literal("gradient")
|
|
34
|
+
}).optional(),
|
|
35
|
+
position: t.enum(["center", "top", "bottom", "left", "right"]),
|
|
36
|
+
quality: t.number().nullable().optional(),
|
|
37
|
+
size: t.enum(["cover", "contain"]),
|
|
38
|
+
width: t.number().optional()
|
|
39
|
+
}).optional(),
|
|
40
|
+
min_height: t.string().optional(),
|
|
41
|
+
solid_color: t.string().optional(),
|
|
42
|
+
theme: t.enum(["primary", "secondary", "muted", "accent", "destructive"]).optional(),
|
|
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]),
|
|
46
|
+
content: t.record(t.string(), t.any()),
|
|
47
|
+
temp_id: t.string().optional()
|
|
48
|
+
}), y = t.object({
|
|
49
|
+
background: p,
|
|
50
|
+
column_blocks: t.array(t.array(f)),
|
|
51
|
+
column_gap: t.enum(["none", "sm", "md", "lg", "xl"]),
|
|
52
|
+
container_type: t.enum(["full-width", "container", "container-sm", "container-lg", "container-xl"]),
|
|
53
|
+
padding: t.object({
|
|
54
|
+
bottom: t.enum(["none", "sm", "md", "lg", "xl"]),
|
|
55
|
+
top: t.enum(["none", "sm", "md", "lg", "xl"])
|
|
56
|
+
}),
|
|
57
|
+
responsive_columns: t.object({
|
|
58
|
+
desktop: t.union([t.literal(1), t.literal(2), t.literal(3), t.literal(4)]),
|
|
59
|
+
mobile: t.union([t.literal(1), t.literal(2)]),
|
|
60
|
+
tablet: t.union([t.literal(1), t.literal(2), t.literal(3)])
|
|
61
|
+
}),
|
|
62
|
+
vertical_alignment: t.enum(["start", "center", "end", "stretch"]).optional()
|
|
63
|
+
}), h = {
|
|
64
|
+
button: t.object({
|
|
65
|
+
position: t.enum(["left", "center", "right"]).optional(),
|
|
66
|
+
size: t.enum(["default", "sm", "lg", "full"]).optional(),
|
|
67
|
+
text: t.string(),
|
|
68
|
+
url: t.string(),
|
|
69
|
+
variant: t.enum(["default", "outline", "secondary", "ghost", "link"]).optional()
|
|
70
|
+
}),
|
|
71
|
+
cart: t.object({}),
|
|
72
|
+
checkout: t.object({}),
|
|
73
|
+
featured_product: t.object({
|
|
74
|
+
imagePosition: t.enum(["left", "right"]).default("left"),
|
|
75
|
+
productId: t.string().min(1),
|
|
76
|
+
showBackground: t.boolean().default(!1)
|
|
77
|
+
}),
|
|
78
|
+
form: t.object({
|
|
79
|
+
fields: t.array(
|
|
80
|
+
t.object({
|
|
81
|
+
field_type: t.enum(["text", "email", "textarea", "select", "radio", "checkbox"]),
|
|
82
|
+
is_required: t.boolean(),
|
|
83
|
+
label: t.string(),
|
|
84
|
+
options: t.array(t.object({ label: t.string(), value: t.string() })).optional(),
|
|
85
|
+
placeholder: t.string().optional(),
|
|
86
|
+
temp_id: t.string()
|
|
87
|
+
})
|
|
88
|
+
),
|
|
89
|
+
// Opaque handle into form_endpoints, which holds the destination server-side.
|
|
90
|
+
form_key: t.string().optional(),
|
|
91
|
+
// Legacy. Migration 27 moved every address out of block content; kept optional so
|
|
92
|
+
// an older payload still validates, and stripped before the block reaches a browser.
|
|
93
|
+
recipient_email: t.string().email().optional(),
|
|
94
|
+
submit_button_text: t.string(),
|
|
95
|
+
success_message: t.string()
|
|
96
|
+
}),
|
|
97
|
+
heading: t.object({
|
|
98
|
+
level: t.union([t.literal(1), t.literal(2), t.literal(3), t.literal(4), t.literal(5), t.literal(6)]),
|
|
99
|
+
textAlign: t.enum(["left", "center", "right", "justify"]).optional(),
|
|
100
|
+
// Mirrors TextColorSchema in apps/nextblock/lib/blocks/blockRegistry.ts —
|
|
101
|
+
// a theme token, or a literal CSS colour from the block editor's picker.
|
|
102
|
+
// libs/* cannot import from the app, so the union is restated here.
|
|
103
|
+
textColor: t.union([
|
|
104
|
+
t.enum(["foreground", "primary", "secondary", "accent", "muted", "destructive", "background"]),
|
|
105
|
+
t.string().regex(
|
|
106
|
+
/^(#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})|rgba?\([^)]+\)|hsla?\([^)]+\))$/i,
|
|
107
|
+
"Must be a hex, rgb(a) or hsl(a) colour"
|
|
108
|
+
)
|
|
109
|
+
]).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"),
|
|
110
|
+
text_content: t.string()
|
|
111
|
+
}),
|
|
112
|
+
image: t.object({
|
|
113
|
+
alt_text: t.string().optional(),
|
|
114
|
+
caption: t.string().optional(),
|
|
115
|
+
external_url: t.string().nullable().optional(),
|
|
116
|
+
height: t.number().nullable().optional(),
|
|
117
|
+
media_id: t.string().nullable().optional(),
|
|
118
|
+
object_key: t.string().nullable().optional(),
|
|
119
|
+
width: t.number().nullable().optional()
|
|
120
|
+
}),
|
|
121
|
+
posts_grid: t.object({
|
|
122
|
+
columns: t.number().min(1).max(6),
|
|
123
|
+
postsPerPage: t.number().min(1).max(50),
|
|
124
|
+
showPagination: t.boolean(),
|
|
125
|
+
title: t.string().optional()
|
|
126
|
+
}),
|
|
127
|
+
product_details: t.object({}),
|
|
128
|
+
product_grid: t.object({
|
|
129
|
+
categoryId: t.string().optional(),
|
|
130
|
+
categoryIds: t.array(t.string()).max(20).optional(),
|
|
131
|
+
// 0 = unlimited (every match on one page).
|
|
132
|
+
limit: t.number().min(0).max(48).default(6),
|
|
133
|
+
productIds: t.array(t.string()).max(24).optional(),
|
|
134
|
+
showPagination: t.boolean().default(!1),
|
|
135
|
+
title: t.string().optional(),
|
|
136
|
+
type: t.enum(["latest", "category", "manual"]).default("latest")
|
|
137
|
+
}),
|
|
138
|
+
section: y,
|
|
139
|
+
testimonial: t.object({
|
|
140
|
+
author_name: t.string().min(1),
|
|
141
|
+
author_title: t.string().optional(),
|
|
142
|
+
image_url: t.string().url().optional().or(t.literal("")),
|
|
143
|
+
quote: t.string().min(1)
|
|
144
|
+
}),
|
|
145
|
+
text: t.object({
|
|
146
|
+
html_content: t.string()
|
|
147
|
+
}),
|
|
148
|
+
video_embed: t.object({
|
|
149
|
+
autoplay: t.boolean().optional(),
|
|
150
|
+
controls: t.boolean().optional(),
|
|
151
|
+
title: t.string().optional(),
|
|
152
|
+
url: t.string()
|
|
153
|
+
})
|
|
154
|
+
};
|
|
155
|
+
function $(o) {
|
|
156
|
+
return g.includes(o);
|
|
157
|
+
}
|
|
158
|
+
function _(o) {
|
|
159
|
+
return typeof o?.validateBlockContent == "function" ? o.validateBlockContent : null;
|
|
160
|
+
}
|
|
161
|
+
function v(o, n, r) {
|
|
162
|
+
const l = _(r);
|
|
163
|
+
if (l)
|
|
164
|
+
return l(o, n);
|
|
165
|
+
const i = h[o].safeParse(n);
|
|
166
|
+
return i.success ? { errors: [], isValid: !0, warnings: [] } : {
|
|
167
|
+
errors: i.error.issues.map((s) => {
|
|
168
|
+
const e = s.path.join(".");
|
|
169
|
+
return e ? `${e}: ${s.message}` : s.message;
|
|
170
|
+
}),
|
|
171
|
+
isValid: !1,
|
|
172
|
+
warnings: []
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
function k(o) {
|
|
176
|
+
return Array.isArray(o.fields) ? o.fields.filter(
|
|
177
|
+
(n) => !!n && typeof n == "object" && typeof n.key == "string" && typeof n.type == "string"
|
|
178
|
+
) : [];
|
|
179
|
+
}
|
|
180
|
+
function j(o) {
|
|
181
|
+
return o == null || typeof o == "string" && o.trim() === "" || Array.isArray(o) && o.length === 0;
|
|
182
|
+
}
|
|
183
|
+
function B(o, n) {
|
|
184
|
+
if (!n || typeof n != "object" || Array.isArray(n))
|
|
185
|
+
return {
|
|
186
|
+
errors: ["content must be a JSON object of { field_key: value } pairs."],
|
|
187
|
+
isValid: !1,
|
|
188
|
+
warnings: []
|
|
189
|
+
};
|
|
190
|
+
const r = k(o), l = new Set(r.map((e) => e.key)), i = [], s = [];
|
|
191
|
+
for (const e of Object.keys(n))
|
|
192
|
+
l.has(e) || i.push(
|
|
193
|
+
`Unknown field "${e}" for custom block "${o.slug}". Known fields: ${[...l].join(", ") || "(none)"}.`
|
|
194
|
+
);
|
|
195
|
+
for (const e of r) {
|
|
196
|
+
const a = n[e.key];
|
|
197
|
+
if (j(a)) {
|
|
198
|
+
e.required && i.push(`Field "${e.key}" is required.`);
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
if (e.type === "text" || e.type === "rich-text") {
|
|
202
|
+
if (typeof a != "string") {
|
|
203
|
+
i.push(`Field "${e.key}" must be a string${e.type === "rich-text" ? " of HTML" : ""}.`);
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
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.`);
|
|
207
|
+
continue;
|
|
208
|
+
}
|
|
209
|
+
if (e.type === "image_r2") {
|
|
210
|
+
const c = a;
|
|
211
|
+
(typeof a != "object" || Array.isArray(a) || typeof c.object_key != "string" || typeof c.url != "string") && i.push(
|
|
212
|
+
`Field "${e.key}" must be an uploaded image object with object_key and url (upload it with upload_media first) or null.`
|
|
213
|
+
);
|
|
214
|
+
continue;
|
|
215
|
+
}
|
|
216
|
+
if (e.type === "db_relation") {
|
|
217
|
+
const c = (u) => typeof u == "string" || typeof u == "number";
|
|
218
|
+
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.`);
|
|
219
|
+
continue;
|
|
220
|
+
}
|
|
221
|
+
s.push(`Field "${e.key}" has an unrecognised type "${String(e.type)}"; it was not validated.`);
|
|
222
|
+
}
|
|
223
|
+
return { errors: i, isValid: i.length === 0, warnings: s };
|
|
224
|
+
}
|
|
225
|
+
async function A(o) {
|
|
226
|
+
const { data: n, error: r } = await o.from("custom_block_definitions").select("slug, name, fields");
|
|
227
|
+
if (r)
|
|
228
|
+
throw new Error(
|
|
229
|
+
`Could not read the custom block definitions: ${typeof r == "object" && r && "message" in r ? String(r.message) : String(r)}`
|
|
230
|
+
);
|
|
231
|
+
return (Array.isArray(n) ? n : []).filter(
|
|
232
|
+
(l) => !!l && typeof l.slug == "string"
|
|
233
|
+
);
|
|
234
|
+
}
|
|
235
|
+
export {
|
|
236
|
+
g as availableCortexAiBlockTypes,
|
|
237
|
+
d as cortexAiBlockTypeSchema,
|
|
238
|
+
b as customBlockSlugPatternSchema,
|
|
239
|
+
h as fallbackBlockSchemas,
|
|
240
|
+
$ as isValidBlockType,
|
|
241
|
+
A as loadCustomBlockDefinitions,
|
|
242
|
+
k as readCustomBlockFields,
|
|
243
|
+
y as sectionBlockFallbackSchema,
|
|
244
|
+
v as validateCortexBlockContent,
|
|
245
|
+
B as validateCustomBlockInstanceContent
|
|
246
|
+
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
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"}],N={"build-site":e=>["Build the whole NextBlock site for this client.","",e.brief?.trim()?`Brief:
|
|
2
|
+
${e.brief}`:"No brief was given: first 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(`
|
|
2
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(`
|
|
3
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(`
|
|
4
|
-
`)};function j(e){const t=
|
|
6
|
+
`)};function j(e){const t=y.find(a=>a.name===e.name),r=N[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=j;exports.getCortexMcpToolKind=b;exports.readCortexMcpResource=R;exports.resolveCortexMcpToolName=h;
|
|
@@ -39,6 +39,8 @@ export declare const CORTEX_MCP_TOOL_KINDS: {
|
|
|
39
39
|
readonly execute_database_mutation: "write";
|
|
40
40
|
readonly fetch_ecommerce_stats: "read";
|
|
41
41
|
readonly fetch_url_content: "read";
|
|
42
|
+
readonly finish_site_build: "write";
|
|
43
|
+
readonly get_site_overview: "read";
|
|
42
44
|
readonly insert_content_block: "write";
|
|
43
45
|
readonly list_custom_blocks: "read";
|
|
44
46
|
readonly list_media: "read";
|
|
@@ -55,11 +57,14 @@ export declare const CORTEX_MCP_TOOL_KINDS: {
|
|
|
55
57
|
readonly publish_content_draft: "write";
|
|
56
58
|
readonly read_current_cms_item: "read";
|
|
57
59
|
readonly read_database_records: "read";
|
|
60
|
+
readonly reset_site_content: "write";
|
|
58
61
|
readonly revert_site_script: "write";
|
|
59
62
|
readonly rewrite_page_draft: "write";
|
|
63
|
+
readonly save_site_brief: "write";
|
|
60
64
|
readonly search_documentation: "read";
|
|
61
65
|
readonly search_stock_photos: "read";
|
|
62
66
|
readonly set_content_images: "write";
|
|
67
|
+
readonly start_site_build: "write";
|
|
63
68
|
readonly translate_content_bulk: "write";
|
|
64
69
|
readonly translate_page: "write";
|
|
65
70
|
readonly update_cms_item_field: "write";
|
|
@@ -71,6 +76,7 @@ export declare const CORTEX_MCP_TOOL_KINDS: {
|
|
|
71
76
|
readonly update_global_css: "write";
|
|
72
77
|
readonly update_navigation_bar: "write";
|
|
73
78
|
readonly update_section_column_block: "write";
|
|
79
|
+
readonly update_site_identity: "write";
|
|
74
80
|
};
|
|
75
81
|
export type CortexMcpCanonicalToolName = keyof typeof CORTEX_MCP_TOOL_KINDS;
|
|
76
82
|
/**
|
|
@@ -195,6 +201,15 @@ export declare function readCortexMcpResource(params: {
|
|
|
195
201
|
uri: string;
|
|
196
202
|
} | null>;
|
|
197
203
|
export declare const CORTEX_MCP_PROMPTS: readonly [{
|
|
204
|
+
readonly arguments: readonly [{
|
|
205
|
+
readonly 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.";
|
|
206
|
+
readonly name: "brief";
|
|
207
|
+
readonly required: false;
|
|
208
|
+
}];
|
|
209
|
+
readonly 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.";
|
|
210
|
+
readonly name: "build-site";
|
|
211
|
+
readonly title: "Build the whole site";
|
|
212
|
+
}, {
|
|
198
213
|
readonly arguments: readonly [{
|
|
199
214
|
readonly description: "What the page is for, and any brand or tone notes.";
|
|
200
215
|
readonly name: "brief";
|