@nextblock-cms/cortex 0.18.6 → 0.18.7
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/lib/ai-global-agent-site-tools.cjs.js +3 -3
- package/lib/ai-global-agent-site-tools.d.ts +12 -0
- package/lib/ai-global-agent-site-tools.es.js +520 -480
- package/lib/ai-global-agent-tools.cjs.js +2 -2
- package/lib/ai-global-agent-tools.es.js +1572 -1566
- package/lib/block-content-schemas.cjs.js +1 -1
- package/lib/block-content-schemas.d.ts +90 -0
- package/lib/block-content-schemas.es.js +44 -29
- package/lib/mcp-server.cjs.js +1 -1
- package/lib/mcp-server.es.js +61 -60
- package/lib/mcp-tool-registry.cjs.js +4 -4
- package/lib/mcp-tool-registry.es.js +30 -29
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import { createCortexGlobalAgentTools as f } from "./ai-global-agent-tools.es.js
|
|
|
2
2
|
import { availableCortexAiBlockTypes as y } from "./block-content-schemas.es.js";
|
|
3
3
|
import "./zod-config.es.js";
|
|
4
4
|
import { z as w } from "zod";
|
|
5
|
-
const
|
|
5
|
+
const n = {
|
|
6
6
|
create_cms_page: "write",
|
|
7
7
|
create_cms_post: "write",
|
|
8
8
|
create_cms_product: "write",
|
|
@@ -81,11 +81,11 @@ const o = {
|
|
|
81
81
|
}
|
|
82
82
|
};
|
|
83
83
|
function _(e) {
|
|
84
|
-
return e in u ? u[e].canonical : e in
|
|
84
|
+
return e in u ? u[e].canonical : e in n ? e : null;
|
|
85
85
|
}
|
|
86
86
|
function k(e) {
|
|
87
87
|
const t = _(e);
|
|
88
|
-
return t ?
|
|
88
|
+
return t ? n[t] : null;
|
|
89
89
|
}
|
|
90
90
|
function d(e, t) {
|
|
91
91
|
const a = k(t);
|
|
@@ -115,7 +115,7 @@ function s(e) {
|
|
|
115
115
|
return f(e);
|
|
116
116
|
}
|
|
117
117
|
function M(e) {
|
|
118
|
-
const t = Object.keys(s(e)), a = Object.keys(
|
|
118
|
+
const t = Object.keys(s(e)), a = Object.keys(n);
|
|
119
119
|
return {
|
|
120
120
|
missingFromRegistry: a.filter((r) => !t.includes(r)),
|
|
121
121
|
unclassified: t.filter((r) => !a.includes(r))
|
|
@@ -123,28 +123,28 @@ function M(e) {
|
|
|
123
123
|
}
|
|
124
124
|
function N(e) {
|
|
125
125
|
const t = s(e.context), a = [];
|
|
126
|
-
for (const [r,
|
|
127
|
-
!(r in
|
|
128
|
-
description:
|
|
129
|
-
inputSchema: h(
|
|
126
|
+
for (const [r, o] of Object.entries(t))
|
|
127
|
+
!(r in n) || !d(e.scopes, r) || a.push({
|
|
128
|
+
description: o.description ?? `Cortex AI ${p(r)} tool.`,
|
|
129
|
+
inputSchema: h(o.inputSchema),
|
|
130
130
|
name: r,
|
|
131
131
|
title: p(r)
|
|
132
132
|
});
|
|
133
|
-
for (const [r,
|
|
134
|
-
const i = t[
|
|
133
|
+
for (const [r, o] of Object.entries(u)) {
|
|
134
|
+
const i = t[o.canonical];
|
|
135
135
|
!i || !d(e.scopes, r) || a.push({
|
|
136
|
-
description:
|
|
136
|
+
description: o.description,
|
|
137
137
|
inputSchema: h(i.inputSchema),
|
|
138
138
|
name: r,
|
|
139
|
-
title:
|
|
139
|
+
title: o.title
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
return a.sort((r,
|
|
142
|
+
return a.sort((r, o) => r.name.localeCompare(o.name));
|
|
143
143
|
}
|
|
144
144
|
function g(e, t) {
|
|
145
145
|
return { content: [{ text: e, type: "text" }], isError: t };
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function v(e) {
|
|
148
148
|
return e.issues.map((t) => `${t.path.length > 0 ? t.path.join(".") : "(root)"}: ${t.message}`).join("; ");
|
|
149
149
|
}
|
|
150
150
|
class m extends Error {
|
|
@@ -152,7 +152,7 @@ class m extends Error {
|
|
|
152
152
|
super(`Unknown tool: ${t}`), this.name = "CortexMcpUnknownToolError";
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
class
|
|
155
|
+
class x extends Error {
|
|
156
156
|
constructor(t) {
|
|
157
157
|
super(
|
|
158
158
|
`Tool "${t}" requires the "write" scope. This MCP token is read-only — mint a read+write token in CMS Settings → Cortex AI.`
|
|
@@ -164,21 +164,21 @@ async function O(e) {
|
|
|
164
164
|
if (!t)
|
|
165
165
|
throw new m(e.name);
|
|
166
166
|
if (!d(e.scopes, e.name))
|
|
167
|
-
throw new
|
|
167
|
+
throw new x(e.name);
|
|
168
168
|
const r = s(e.context)[t];
|
|
169
169
|
if (!r || typeof r.execute != "function")
|
|
170
170
|
throw new m(e.name);
|
|
171
|
-
const
|
|
171
|
+
const o = e.args && typeof e.args == "object" ? e.args : {};
|
|
172
172
|
if (r.inputSchema && typeof r.inputSchema.safeParse == "function") {
|
|
173
|
-
const i = r.inputSchema.safeParse(
|
|
173
|
+
const i = r.inputSchema.safeParse(o);
|
|
174
174
|
if (!i.success)
|
|
175
175
|
return g(
|
|
176
|
-
`Invalid arguments for "${e.name}": ${
|
|
176
|
+
`Invalid arguments for "${e.name}": ${v(i.error)}`,
|
|
177
177
|
!0
|
|
178
178
|
);
|
|
179
179
|
}
|
|
180
180
|
try {
|
|
181
|
-
const i = await r.execute(
|
|
181
|
+
const i = await r.execute(o), c = JSON.stringify(i ?? { success: !0 }, null, 2), l = i && typeof i == "object" && !Array.isArray(i) ? i : null, b = l?.success === !1;
|
|
182
182
|
return {
|
|
183
183
|
content: [{ text: c, type: "text" }],
|
|
184
184
|
isError: b,
|
|
@@ -212,7 +212,7 @@ const A = [
|
|
|
212
212
|
uri: "cortex://schema/custom-blocks"
|
|
213
213
|
}
|
|
214
214
|
];
|
|
215
|
-
async function
|
|
215
|
+
async function E(e) {
|
|
216
216
|
const t = s(e.context);
|
|
217
217
|
if (e.uri === "cortex://schema/database") {
|
|
218
218
|
const a = await t.describe_database_schema?.execute?.({ includeReadOnly: !0 });
|
|
@@ -288,9 +288,10 @@ ${e.brief}` : "A site brief may already be saved (get_site_overview returns it u
|
|
|
288
288
|
"Process:",
|
|
289
289
|
"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.",
|
|
290
290
|
"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.",
|
|
291
|
-
'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.',
|
|
291
|
+
'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.',
|
|
292
292
|
"4. Call finish_site_build with a summary, then report every page with its URL.",
|
|
293
|
-
"Write real copy from the brief, never placeholders. Every page must exist in every active language."
|
|
293
|
+
"Write real copy from the brief, never placeholders. Every page must exist in every active language.",
|
|
294
|
+
"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."
|
|
294
295
|
].join(`
|
|
295
296
|
`),
|
|
296
297
|
"build-page": (e) => [
|
|
@@ -300,7 +301,7 @@ ${e.brief}` : "A site brief may already be saved (get_site_overview returns it u
|
|
|
300
301
|
"",
|
|
301
302
|
"Process:",
|
|
302
303
|
"1. Call get_database_schema and read_current_cms_item (or read_database_records on `pages`) to ground yourself in what exists.",
|
|
303
|
-
'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.',
|
|
304
|
+
'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.',
|
|
304
305
|
"3. Call search_stock_media for real photography; copy each photo's attribution fields onto the image block.",
|
|
305
306
|
"4. Write the result with generate_jsonb_layout. It stages a Live Draft — tell the user to preview and publish it."
|
|
306
307
|
].join(`
|
|
@@ -321,7 +322,7 @@ ${e.brief}` : "A site brief may already be saved (get_site_overview returns it u
|
|
|
321
322
|
].join(`
|
|
322
323
|
`)
|
|
323
324
|
};
|
|
324
|
-
function
|
|
325
|
+
function P(e) {
|
|
325
326
|
const t = C.find((r) => r.name === e.name), a = S[e.name];
|
|
326
327
|
return !t || !a ? null : {
|
|
327
328
|
description: t.description,
|
|
@@ -334,15 +335,15 @@ export {
|
|
|
334
335
|
C as CORTEX_MCP_PROMPTS,
|
|
335
336
|
A as CORTEX_MCP_RESOURCES,
|
|
336
337
|
u as CORTEX_MCP_TOOL_ALIASES,
|
|
337
|
-
|
|
338
|
-
|
|
338
|
+
n as CORTEX_MCP_TOOL_KINDS,
|
|
339
|
+
x as CortexMcpForbiddenToolError,
|
|
339
340
|
m as CortexMcpUnknownToolError,
|
|
340
341
|
M as assertCortexMcpToolCoverage,
|
|
341
342
|
N as buildCortexMcpToolDefinitions,
|
|
342
343
|
O as callCortexMcpTool,
|
|
343
344
|
d as cortexMcpScopesAllow,
|
|
344
|
-
|
|
345
|
+
P as getCortexMcpPrompt,
|
|
345
346
|
k as getCortexMcpToolKind,
|
|
346
|
-
|
|
347
|
+
E as readCortexMcpResource,
|
|
347
348
|
_ as resolveCortexMcpToolName
|
|
348
349
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextblock-cms/cortex",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.7",
|
|
4
4
|
"license": "AGPL-3.0-or-later",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -28,9 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@ai-sdk/openai-compatible": "^2.0.42",
|
|
31
|
-
"@nextblock-cms/db": "^0.18.
|
|
32
|
-
"@nextblock-cms/ecommerce": "npm:@nextblock-cms/ecom@^0.18.
|
|
33
|
-
"@nextblock-cms/utils": "^0.18.
|
|
31
|
+
"@nextblock-cms/db": "^0.18.7",
|
|
32
|
+
"@nextblock-cms/ecommerce": "npm:@nextblock-cms/ecom@^0.18.7",
|
|
33
|
+
"@nextblock-cms/utils": "^0.18.7",
|
|
34
34
|
"ai": "^6.0.170",
|
|
35
35
|
"zod": "^4.3.6"
|
|
36
36
|
},
|