@nextblock-cms/cortex 0.20.3 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.cjs.js +1 -1
- package/client.es.js +3 -7
- package/index.cjs.js +1 -1
- package/index.es.js +24 -277
- package/lib/ai-block-generation.cjs.js +3 -4
- package/lib/ai-block-generation.es.js +143 -182
- package/lib/ai-client.cjs.js +1 -1
- package/lib/ai-client.d.ts +1 -1
- package/lib/ai-client.es.js +101 -135
- package/lib/ai-config.cjs.js +1 -1
- package/lib/ai-config.es.js +89 -108
- package/lib/ai-cortex-widget-builder.cjs.js +1 -1
- package/lib/ai-cortex-widget-builder.es.js +56 -70
- package/lib/ai-global-agent-content-ops-tools.cjs.js +1 -1
- package/lib/ai-global-agent-content-ops-tools.d.ts +1943 -68
- package/lib/ai-global-agent-content-ops-tools.es.js +185 -199
- package/lib/ai-global-agent-custom-block-tools.cjs.js +1 -1
- package/lib/ai-global-agent-custom-block-tools.d.ts +2160 -95
- package/lib/ai-global-agent-custom-block-tools.es.js +226 -223
- package/lib/ai-global-agent-db-tools.cjs.js +1 -1
- package/lib/ai-global-agent-db-tools.d.ts +2708 -98
- package/lib/ai-global-agent-db-tools.es.js +1013 -986
- package/lib/ai-global-agent-ecommerce.cjs.js +1 -1
- package/lib/ai-global-agent-ecommerce.es.js +3 -7
- package/lib/ai-global-agent-site-tools.cjs.js +2 -3
- package/lib/ai-global-agent-site-tools.d.ts +10695 -500
- package/lib/ai-global-agent-site-tools.es.js +750 -757
- package/lib/ai-global-agent-theming-tools.cjs.js +1 -3
- package/lib/ai-global-agent-theming-tools.d.ts +2905 -105
- package/lib/ai-global-agent-theming-tools.es.js +326 -396
- package/lib/ai-global-agent-tools.cjs.js +2 -2
- package/lib/ai-global-agent-tools.d.ts +4 -2230
- package/lib/ai-global-agent-tools.es.js +3899 -4328
- package/lib/ai-key-crypto.cjs.js +1 -1
- package/lib/ai-key-crypto.es.js +63 -82
- package/lib/ai-key-verification.cjs.js +1 -1
- package/lib/ai-key-verification.es.js +74 -63
- package/lib/ai-model-catalog.cjs.js +1 -1
- package/lib/ai-model-catalog.es.js +18 -22
- package/lib/ai-model-registry.cjs.js +2 -2
- package/lib/ai-model-registry.es.js +246 -309
- package/lib/ai-seo-metadata.cjs.js +2 -3
- package/lib/ai-seo-metadata.es.js +143 -185
- package/lib/ai-vision.cjs.js +2 -2
- package/lib/ai-vision.d.ts +6 -6
- package/lib/ai-vision.es.js +161 -215
- package/lib/block-content-schemas.cjs.js +1 -1
- package/lib/block-content-schemas.es.js +324 -254
- package/lib/cortex-widget-registry.cjs.js +1 -1
- package/lib/cortex-widget-registry.es.js +35 -43
- package/lib/cortex-widget-schema.cjs.js +2 -3
- package/lib/cortex-widget-schema.es.js +280 -309
- package/lib/editor-document-from-html.cjs.js +1 -1
- package/lib/editor-document-from-html.es.js +334 -278
- package/lib/fetch-host-guard.cjs.js +1 -0
- package/lib/fetch-host-guard.d.ts +2 -0
- package/lib/fetch-host-guard.es.js +30 -0
- package/lib/mcp-server.cjs.js +1 -1
- package/lib/mcp-server.es.js +155 -173
- package/lib/mcp-tokens.cjs.js +1 -1
- package/lib/mcp-tokens.es.js +95 -107
- package/lib/mcp-tool-registry.cjs.js +5 -6
- package/lib/mcp-tool-registry.es.js +533 -411
- package/lib/site-brief.cjs.js +2 -2
- package/lib/site-brief.es.js +102 -108
- package/lib/vision-image-download.cjs.js +1 -0
- package/lib/vision-image-download.d.ts +43 -0
- package/lib/vision-image-download.es.js +120 -0
- package/lib/zod-config.cjs.js +1 -1
- package/lib/zod-config.es.js +5 -6
- package/package.json +8 -8
|
@@ -1,430 +1,552 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { availableCortexAiBlockTypes as
|
|
3
|
-
import "./
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
1
|
+
import { z as e } from "./zod-config.es.js";
|
|
2
|
+
import { availableCortexAiBlockTypes as t } from "./block-content-schemas.es.js";
|
|
3
|
+
import { createCortexGlobalAgentTools as n } from "./ai-global-agent-tools.es.js";
|
|
4
|
+
//#region libs/cortex/src/lib/mcp-tool-registry.ts
|
|
5
|
+
var r = {
|
|
6
|
+
create_cms_page: "write",
|
|
7
|
+
create_cms_post: "write",
|
|
8
|
+
create_cms_product: "write",
|
|
9
|
+
create_custom_block: "write",
|
|
10
|
+
delete_cms_item: "write",
|
|
11
|
+
delete_custom_block: "write",
|
|
12
|
+
describe_database_schema: "read",
|
|
13
|
+
execute_cms_action_plan: "write",
|
|
14
|
+
execute_database_action_plan: "write",
|
|
15
|
+
execute_database_mutation: "write",
|
|
16
|
+
fetch_ecommerce_stats: "read",
|
|
17
|
+
fetch_url_content: "read",
|
|
18
|
+
finish_site_build: "write",
|
|
19
|
+
get_site_overview: "read",
|
|
20
|
+
insert_content_block: "write",
|
|
21
|
+
list_custom_blocks: "read",
|
|
22
|
+
list_media: "read",
|
|
23
|
+
list_product_categories: "read",
|
|
24
|
+
list_site_script_revisions: "read",
|
|
25
|
+
list_site_scripts: "read",
|
|
26
|
+
list_site_themes: "read",
|
|
27
|
+
manage_language: "write",
|
|
28
|
+
manage_product_category: "write",
|
|
29
|
+
manage_product_variants: "write",
|
|
30
|
+
manage_site_script: "write",
|
|
31
|
+
manage_site_theme: "write",
|
|
32
|
+
prepare_delete_cms_item: "read",
|
|
33
|
+
publish_content_draft: "write",
|
|
34
|
+
read_current_cms_item: "read",
|
|
35
|
+
read_database_records: "read",
|
|
36
|
+
reset_site_content: "write",
|
|
37
|
+
revert_site_script: "write",
|
|
38
|
+
rewrite_page_draft: "write",
|
|
39
|
+
save_site_brief: "write",
|
|
40
|
+
search_documentation: "read",
|
|
41
|
+
search_stock_photos: "read",
|
|
42
|
+
set_content_images: "write",
|
|
43
|
+
start_site_build: "write",
|
|
44
|
+
translate_content_bulk: "write",
|
|
45
|
+
translate_page: "write",
|
|
46
|
+
update_cms_item_field: "write",
|
|
47
|
+
upload_media: "write",
|
|
48
|
+
update_content_block: "write",
|
|
49
|
+
update_current_cms_fields: "write",
|
|
50
|
+
update_custom_block: "write",
|
|
51
|
+
update_footer: "write",
|
|
52
|
+
update_global_css: "write",
|
|
53
|
+
update_navigation_bar: "write",
|
|
54
|
+
update_section_column_block: "write",
|
|
55
|
+
update_site_identity: "write"
|
|
56
|
+
}, i = {
|
|
57
|
+
create_cms_page: {
|
|
58
|
+
destructive: !1,
|
|
59
|
+
idempotent: !0,
|
|
60
|
+
openWorld: !0
|
|
61
|
+
},
|
|
62
|
+
create_cms_post: {
|
|
63
|
+
destructive: !1,
|
|
64
|
+
idempotent: !0,
|
|
65
|
+
openWorld: !0
|
|
66
|
+
},
|
|
67
|
+
create_cms_product: {
|
|
68
|
+
destructive: !1,
|
|
69
|
+
idempotent: !0,
|
|
70
|
+
openWorld: !0
|
|
71
|
+
},
|
|
72
|
+
create_custom_block: {
|
|
73
|
+
destructive: !1,
|
|
74
|
+
idempotent: !1,
|
|
75
|
+
openWorld: !1
|
|
76
|
+
},
|
|
77
|
+
delete_cms_item: {
|
|
78
|
+
destructive: !0,
|
|
79
|
+
idempotent: !0,
|
|
80
|
+
openWorld: !1
|
|
81
|
+
},
|
|
82
|
+
delete_custom_block: {
|
|
83
|
+
destructive: !0,
|
|
84
|
+
idempotent: !0,
|
|
85
|
+
openWorld: !1
|
|
86
|
+
},
|
|
87
|
+
execute_cms_action_plan: {
|
|
88
|
+
destructive: !0,
|
|
89
|
+
idempotent: !1,
|
|
90
|
+
openWorld: !0
|
|
91
|
+
},
|
|
92
|
+
execute_database_action_plan: {
|
|
93
|
+
destructive: !0,
|
|
94
|
+
idempotent: !1,
|
|
95
|
+
openWorld: !1
|
|
96
|
+
},
|
|
97
|
+
execute_database_mutation: {
|
|
98
|
+
destructive: !0,
|
|
99
|
+
idempotent: !1,
|
|
100
|
+
openWorld: !1
|
|
101
|
+
},
|
|
102
|
+
finish_site_build: {
|
|
103
|
+
destructive: !1,
|
|
104
|
+
idempotent: !0,
|
|
105
|
+
openWorld: !1
|
|
106
|
+
},
|
|
107
|
+
insert_content_block: {
|
|
108
|
+
destructive: !1,
|
|
109
|
+
idempotent: !1,
|
|
110
|
+
openWorld: !1
|
|
111
|
+
},
|
|
112
|
+
manage_language: {
|
|
113
|
+
destructive: !1,
|
|
114
|
+
idempotent: !0,
|
|
115
|
+
openWorld: !1
|
|
116
|
+
},
|
|
117
|
+
manage_product_category: {
|
|
118
|
+
destructive: !0,
|
|
119
|
+
idempotent: !0,
|
|
120
|
+
openWorld: !1
|
|
121
|
+
},
|
|
122
|
+
manage_product_variants: {
|
|
123
|
+
destructive: !0,
|
|
124
|
+
idempotent: !1,
|
|
125
|
+
openWorld: !1
|
|
126
|
+
},
|
|
127
|
+
manage_site_script: {
|
|
128
|
+
destructive: !0,
|
|
129
|
+
idempotent: !0,
|
|
130
|
+
openWorld: !1
|
|
131
|
+
},
|
|
132
|
+
manage_site_theme: {
|
|
133
|
+
destructive: !1,
|
|
134
|
+
idempotent: !0,
|
|
135
|
+
openWorld: !1
|
|
136
|
+
},
|
|
137
|
+
publish_content_draft: {
|
|
138
|
+
destructive: !1,
|
|
139
|
+
idempotent: !0,
|
|
140
|
+
openWorld: !1
|
|
141
|
+
},
|
|
142
|
+
reset_site_content: {
|
|
143
|
+
destructive: !0,
|
|
144
|
+
idempotent: !0,
|
|
145
|
+
openWorld: !1
|
|
146
|
+
},
|
|
147
|
+
revert_site_script: {
|
|
148
|
+
destructive: !1,
|
|
149
|
+
idempotent: !0,
|
|
150
|
+
openWorld: !1
|
|
151
|
+
},
|
|
152
|
+
rewrite_page_draft: {
|
|
153
|
+
destructive: !1,
|
|
154
|
+
idempotent: !0,
|
|
155
|
+
openWorld: !1
|
|
156
|
+
},
|
|
157
|
+
save_site_brief: {
|
|
158
|
+
destructive: !0,
|
|
159
|
+
idempotent: !0,
|
|
160
|
+
openWorld: !1
|
|
161
|
+
},
|
|
162
|
+
set_content_images: {
|
|
163
|
+
destructive: !0,
|
|
164
|
+
idempotent: !1,
|
|
165
|
+
openWorld: !0
|
|
166
|
+
},
|
|
167
|
+
start_site_build: {
|
|
168
|
+
destructive: !0,
|
|
169
|
+
idempotent: !1,
|
|
170
|
+
openWorld: !1
|
|
171
|
+
},
|
|
172
|
+
translate_content_bulk: {
|
|
173
|
+
destructive: !1,
|
|
174
|
+
idempotent: !0,
|
|
175
|
+
openWorld: !1
|
|
176
|
+
},
|
|
177
|
+
translate_page: {
|
|
178
|
+
destructive: !1,
|
|
179
|
+
idempotent: !0,
|
|
180
|
+
openWorld: !1
|
|
181
|
+
},
|
|
182
|
+
update_cms_item_field: {
|
|
183
|
+
destructive: !1,
|
|
184
|
+
idempotent: !0,
|
|
185
|
+
openWorld: !1
|
|
186
|
+
},
|
|
187
|
+
upload_media: {
|
|
188
|
+
destructive: !1,
|
|
189
|
+
idempotent: !1,
|
|
190
|
+
openWorld: !0
|
|
191
|
+
},
|
|
192
|
+
update_content_block: {
|
|
193
|
+
destructive: !1,
|
|
194
|
+
idempotent: !0,
|
|
195
|
+
openWorld: !1
|
|
196
|
+
},
|
|
197
|
+
update_current_cms_fields: {
|
|
198
|
+
destructive: !1,
|
|
199
|
+
idempotent: !0,
|
|
200
|
+
openWorld: !1
|
|
201
|
+
},
|
|
202
|
+
update_custom_block: {
|
|
203
|
+
destructive: !0,
|
|
204
|
+
idempotent: !1,
|
|
205
|
+
openWorld: !1
|
|
206
|
+
},
|
|
207
|
+
update_footer: {
|
|
208
|
+
destructive: !0,
|
|
209
|
+
idempotent: !0,
|
|
210
|
+
openWorld: !1
|
|
211
|
+
},
|
|
212
|
+
update_global_css: {
|
|
213
|
+
destructive: !0,
|
|
214
|
+
idempotent: !1,
|
|
215
|
+
openWorld: !1
|
|
216
|
+
},
|
|
217
|
+
update_navigation_bar: {
|
|
218
|
+
destructive: !0,
|
|
219
|
+
idempotent: !0,
|
|
220
|
+
openWorld: !1
|
|
221
|
+
},
|
|
222
|
+
update_section_column_block: {
|
|
223
|
+
destructive: !1,
|
|
224
|
+
idempotent: !0,
|
|
225
|
+
openWorld: !1
|
|
226
|
+
},
|
|
227
|
+
update_site_identity: {
|
|
228
|
+
destructive: !1,
|
|
229
|
+
idempotent: !0,
|
|
230
|
+
openWorld: !1
|
|
231
|
+
}
|
|
232
|
+
}, a = /* @__PURE__ */ new Set(["fetch_url_content", "search_stock_photos"]), o = {
|
|
233
|
+
create_page_layout: {
|
|
234
|
+
canonical: "create_cms_page",
|
|
235
|
+
description: "Create a new page from a slug, a title and a strictly typed block layout in one call. Every block is normalized and validated against the NextBlock block schema (built-in types from the `cortex://schema/blocks` resource, or a custom block slug from `list_custom_blocks`) before anything is written; an invalid block rejects the whole call. Pass `status: \"published\"` to go live immediately, or leave the default draft and publish later. To rewrite an existing page instead, use `generate_jsonb_layout`. Alias of `create_cms_page`.",
|
|
236
|
+
title: "Create page layout"
|
|
237
|
+
},
|
|
238
|
+
generate_jsonb_layout: {
|
|
239
|
+
canonical: "rewrite_page_draft",
|
|
240
|
+
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`.",
|
|
241
|
+
title: "Generate JSONB layout"
|
|
242
|
+
},
|
|
243
|
+
get_database_schema: {
|
|
244
|
+
canonical: "describe_database_schema",
|
|
245
|
+
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`.",
|
|
246
|
+
title: "Get database schema"
|
|
247
|
+
},
|
|
248
|
+
query_site_analytics: {
|
|
249
|
+
canonical: "fetch_ecommerce_stats",
|
|
250
|
+
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`.",
|
|
251
|
+
title: "Query site analytics"
|
|
252
|
+
},
|
|
253
|
+
search_stock_media: {
|
|
254
|
+
canonical: "search_stock_photos",
|
|
255
|
+
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`.",
|
|
256
|
+
title: "Search stock media"
|
|
257
|
+
},
|
|
258
|
+
update_site_navigation: {
|
|
259
|
+
canonical: "update_navigation_bar",
|
|
260
|
+
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`.",
|
|
261
|
+
title: "Update site navigation"
|
|
262
|
+
}
|
|
133
263
|
};
|
|
134
|
-
function
|
|
135
|
-
|
|
264
|
+
function s(e) {
|
|
265
|
+
return e in o ? o[e].canonical : e in r ? e : null;
|
|
136
266
|
}
|
|
137
|
-
function
|
|
138
|
-
|
|
139
|
-
|
|
267
|
+
function c(e) {
|
|
268
|
+
let t = s(e);
|
|
269
|
+
return t ? r[t] : null;
|
|
140
270
|
}
|
|
141
|
-
function
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
readOnlyHint: !1
|
|
158
|
-
};
|
|
271
|
+
function l(e) {
|
|
272
|
+
let t = s(e);
|
|
273
|
+
if (!t) return null;
|
|
274
|
+
if (r[t] === "read") return {
|
|
275
|
+
destructiveHint: !1,
|
|
276
|
+
idempotentHint: !0,
|
|
277
|
+
openWorldHint: a.has(t),
|
|
278
|
+
readOnlyHint: !0
|
|
279
|
+
};
|
|
280
|
+
let n = i[t];
|
|
281
|
+
return {
|
|
282
|
+
destructiveHint: n.destructive,
|
|
283
|
+
idempotentHint: n.idempotent,
|
|
284
|
+
openWorldHint: n.openWorld,
|
|
285
|
+
readOnlyHint: !1
|
|
286
|
+
};
|
|
159
287
|
}
|
|
160
288
|
function u(e, t) {
|
|
161
|
-
|
|
162
|
-
|
|
289
|
+
let n = c(t);
|
|
290
|
+
return n ? n === "read" ? e.length > 0 : e.includes("write") : !1;
|
|
163
291
|
}
|
|
164
|
-
function
|
|
165
|
-
|
|
292
|
+
function d(e) {
|
|
293
|
+
return e.split("_").map((e, t) => t === 0 ? e.charAt(0).toUpperCase() + e.slice(1) : e).join(" ");
|
|
166
294
|
}
|
|
167
|
-
function
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
295
|
+
function f(t) {
|
|
296
|
+
let n = {
|
|
297
|
+
additionalProperties: !1,
|
|
298
|
+
type: "object"
|
|
299
|
+
};
|
|
300
|
+
if (!t || typeof t != "object") return n;
|
|
301
|
+
try {
|
|
302
|
+
let r = e.toJSONSchema(t, {
|
|
303
|
+
cycles: "ref",
|
|
304
|
+
io: "input",
|
|
305
|
+
reused: "inline",
|
|
306
|
+
target: "draft-2020-12",
|
|
307
|
+
unrepresentable: "any"
|
|
308
|
+
});
|
|
309
|
+
return delete r.$schema, r.type === "object" ? r : n;
|
|
310
|
+
} catch {
|
|
311
|
+
return n;
|
|
312
|
+
}
|
|
183
313
|
}
|
|
184
|
-
function
|
|
185
|
-
|
|
314
|
+
function p(e) {
|
|
315
|
+
return n(e);
|
|
186
316
|
}
|
|
187
|
-
function
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
317
|
+
function m(e) {
|
|
318
|
+
let t = Object.keys(p(e)), n = Object.keys(r);
|
|
319
|
+
return {
|
|
320
|
+
missingFromRegistry: n.filter((e) => !t.includes(e)),
|
|
321
|
+
unclassified: t.filter((e) => !n.includes(e))
|
|
322
|
+
};
|
|
193
323
|
}
|
|
194
|
-
function
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
}
|
|
221
|
-
return a.sort((r, i) => r.name.localeCompare(i.name));
|
|
324
|
+
function h(e) {
|
|
325
|
+
let t = p(e.context), n = [];
|
|
326
|
+
for (let [i, a] of Object.entries(t)) {
|
|
327
|
+
if (!(i in r) || !u(e.scopes, i)) continue;
|
|
328
|
+
let t = l(i);
|
|
329
|
+
t && n.push({
|
|
330
|
+
annotations: t,
|
|
331
|
+
description: a.description ?? `Cortex AI ${d(i)} tool.`,
|
|
332
|
+
inputSchema: f(a.inputSchema),
|
|
333
|
+
name: i,
|
|
334
|
+
title: d(i)
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
for (let [r, i] of Object.entries(o)) {
|
|
338
|
+
let a = t[i.canonical];
|
|
339
|
+
if (!a || !u(e.scopes, r)) continue;
|
|
340
|
+
let o = l(r);
|
|
341
|
+
o && n.push({
|
|
342
|
+
annotations: o,
|
|
343
|
+
description: i.description,
|
|
344
|
+
inputSchema: f(a.inputSchema),
|
|
345
|
+
name: r,
|
|
346
|
+
title: i.title
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
return n.sort((e, t) => e.name.localeCompare(t.name));
|
|
222
350
|
}
|
|
223
351
|
function g(e, t) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
super(`Unknown tool: ${t}`), this.name = "CortexMcpUnknownToolError";
|
|
232
|
-
}
|
|
352
|
+
return {
|
|
353
|
+
content: [{
|
|
354
|
+
text: e,
|
|
355
|
+
type: "text"
|
|
356
|
+
}],
|
|
357
|
+
isError: t
|
|
358
|
+
};
|
|
233
359
|
}
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
super(
|
|
237
|
-
`Tool "${t}" requires the "write" scope. This MCP token is read-only — mint a read+write token in CMS Settings → Cortex AI.`
|
|
238
|
-
), this.name = "CortexMcpForbiddenToolError";
|
|
239
|
-
}
|
|
360
|
+
function _(e) {
|
|
361
|
+
return e.issues.map((e) => `${e.path.length > 0 ? e.path.join(".") : "(root)"}: ${e.message}`).join("; ");
|
|
240
362
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
363
|
+
var v = class extends Error {
|
|
364
|
+
constructor(e) {
|
|
365
|
+
super(`Unknown tool: ${e}`), this.name = "CortexMcpUnknownToolError";
|
|
366
|
+
}
|
|
367
|
+
}, y = class extends Error {
|
|
368
|
+
constructor(e) {
|
|
369
|
+
super(`Tool "${e}" requires the "write" scope. This MCP token is read-only — mint a read+write token in CMS Settings → Cortex AI.`), this.name = "CortexMcpForbiddenToolError";
|
|
370
|
+
}
|
|
371
|
+
};
|
|
372
|
+
async function b(e) {
|
|
373
|
+
let t = s(e.name);
|
|
374
|
+
if (!t) throw new v(e.name);
|
|
375
|
+
if (!u(e.scopes, e.name)) throw new y(e.name);
|
|
376
|
+
let n = p(e.context)[t];
|
|
377
|
+
if (!n || typeof n.execute != "function") throw new v(e.name);
|
|
378
|
+
let r = e.args && typeof e.args == "object" ? e.args : {};
|
|
379
|
+
if (n.inputSchema && typeof n.inputSchema.safeParse == "function") {
|
|
380
|
+
let t = n.inputSchema.safeParse(r);
|
|
381
|
+
if (!t.success) return g(`Invalid arguments for "${e.name}": ${_(t.error)}`, !0);
|
|
382
|
+
}
|
|
383
|
+
try {
|
|
384
|
+
let e = await n.execute(r), t = JSON.stringify(e ?? { success: !0 }, null, 2), i = e && typeof e == "object" && !Array.isArray(e) ? e : null, a = i?.success === !1;
|
|
385
|
+
return {
|
|
386
|
+
content: [{
|
|
387
|
+
text: t,
|
|
388
|
+
type: "text"
|
|
389
|
+
}],
|
|
390
|
+
isError: a,
|
|
391
|
+
...i ? { structuredContent: i } : {}
|
|
392
|
+
};
|
|
393
|
+
} catch (t) {
|
|
394
|
+
let n = t instanceof Error ? t.message : String(t);
|
|
395
|
+
return g(`Tool "${e.name}" failed: ${n}`, !0);
|
|
396
|
+
}
|
|
270
397
|
}
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
398
|
+
var x = [
|
|
399
|
+
{
|
|
400
|
+
description: "The CMS database structure Cortex AI can read and mutate: tables, columns, primary keys, and read-only flags.",
|
|
401
|
+
mimeType: "application/json",
|
|
402
|
+
name: "database-schema",
|
|
403
|
+
title: "NextBlock database schema",
|
|
404
|
+
uri: "cortex://schema/database"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
description: "The built-in NextBlock block types available when composing page, post, and product layouts.",
|
|
408
|
+
mimeType: "application/json",
|
|
409
|
+
name: "block-types",
|
|
410
|
+
title: "NextBlock block types",
|
|
411
|
+
uri: "cortex://schema/blocks"
|
|
412
|
+
},
|
|
413
|
+
{
|
|
414
|
+
description: "Data-defined custom block definitions registered in this workspace, keyed by the slug used as a block instance `block_type`.",
|
|
415
|
+
mimeType: "application/json",
|
|
416
|
+
name: "custom-blocks",
|
|
417
|
+
title: "NextBlock custom block definitions",
|
|
418
|
+
uri: "cortex://schema/custom-blocks"
|
|
419
|
+
}
|
|
293
420
|
];
|
|
294
|
-
async function
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
return null;
|
|
421
|
+
async function S(e) {
|
|
422
|
+
let n = p(e.context);
|
|
423
|
+
if (e.uri === "cortex://schema/database") {
|
|
424
|
+
let t = await n.describe_database_schema?.execute?.({ includeReadOnly: !0 });
|
|
425
|
+
return {
|
|
426
|
+
mimeType: "application/json",
|
|
427
|
+
text: JSON.stringify(t ?? {}, null, 2),
|
|
428
|
+
uri: e.uri
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
if (e.uri === "cortex://schema/blocks") return {
|
|
432
|
+
mimeType: "application/json",
|
|
433
|
+
text: JSON.stringify({ blockTypes: t }, null, 2),
|
|
434
|
+
uri: e.uri
|
|
435
|
+
};
|
|
436
|
+
if (e.uri === "cortex://schema/custom-blocks") {
|
|
437
|
+
let t = await n.list_custom_blocks?.execute?.({});
|
|
438
|
+
return {
|
|
439
|
+
mimeType: "application/json",
|
|
440
|
+
text: JSON.stringify(t ?? {}, null, 2),
|
|
441
|
+
uri: e.uri
|
|
442
|
+
};
|
|
443
|
+
}
|
|
444
|
+
return null;
|
|
319
445
|
}
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
446
|
+
var C = [
|
|
447
|
+
{
|
|
448
|
+
arguments: [{
|
|
449
|
+
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.",
|
|
450
|
+
name: "brief",
|
|
451
|
+
required: !1
|
|
452
|
+
}],
|
|
453
|
+
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.",
|
|
454
|
+
name: "build-site",
|
|
455
|
+
title: "Build the whole site"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
arguments: [{
|
|
459
|
+
description: "What the page is for, and any brand or tone notes.",
|
|
460
|
+
name: "brief",
|
|
461
|
+
required: !0
|
|
462
|
+
}, {
|
|
463
|
+
description: "Slug of the page or post to rewrite, e.g. \"home\".",
|
|
464
|
+
name: "slug",
|
|
465
|
+
required: !0
|
|
466
|
+
}],
|
|
467
|
+
description: "Build or redesign a NextBlock page from a brief, following the section-based layout recipe, and stage it as a reviewable Live Draft.",
|
|
468
|
+
name: "build-page",
|
|
469
|
+
title: "Build a NextBlock page"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
arguments: [{
|
|
473
|
+
description: "Source URL to draw structure and copy from.",
|
|
474
|
+
name: "url",
|
|
475
|
+
required: !0
|
|
476
|
+
}, {
|
|
477
|
+
description: "Slug of the page to write the result into.",
|
|
478
|
+
name: "slug",
|
|
479
|
+
required: !0
|
|
480
|
+
}],
|
|
481
|
+
description: "Read an external page and rebuild an equivalent NextBlock page from it, reusing its imagery where available.",
|
|
482
|
+
name: "clone-from-url",
|
|
483
|
+
title: "Rebuild a page from a URL"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
arguments: [{
|
|
487
|
+
description: "Target language code, e.g. \"fr\".",
|
|
488
|
+
name: "languageCode",
|
|
489
|
+
required: !0
|
|
490
|
+
}, {
|
|
491
|
+
description: "Slug of the page or post to translate.",
|
|
492
|
+
name: "slug",
|
|
493
|
+
required: !0
|
|
494
|
+
}],
|
|
495
|
+
description: "Translate an existing page or post into another language, preserving its layout and imagery.",
|
|
496
|
+
name: "translate-content",
|
|
497
|
+
title: "Translate a page or post"
|
|
498
|
+
}
|
|
499
|
+
], w = {
|
|
500
|
+
"build-site": (e) => [
|
|
501
|
+
"Build the whole NextBlock site for this client.",
|
|
502
|
+
"",
|
|
503
|
+
e.brief?.trim() ? `Brief:\n${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.",
|
|
504
|
+
"",
|
|
505
|
+
"Process:",
|
|
506
|
+
"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.",
|
|
507
|
+
"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.",
|
|
508
|
+
"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.",
|
|
509
|
+
"4. Call finish_site_build with a summary, then report every page with its URL.",
|
|
510
|
+
"Write real copy from the brief, never placeholders. Every page must exist in every active language.",
|
|
511
|
+
"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."
|
|
512
|
+
].join("\n"),
|
|
513
|
+
"build-page": (e) => [
|
|
514
|
+
`Build the NextBlock page with slug "${e.slug ?? "<slug>"}" from this brief:`,
|
|
515
|
+
"",
|
|
516
|
+
e.brief ?? "<brief>",
|
|
517
|
+
"",
|
|
518
|
+
"Process:",
|
|
519
|
+
"1. Call get_database_schema and read_current_cms_item (or read_database_records on `pages`) to ground yourself in what exists.",
|
|
520
|
+
"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.",
|
|
521
|
+
"3. Call search_stock_media for real photography; copy each photo's attribution fields onto the image block.",
|
|
522
|
+
"4. Write the result with generate_jsonb_layout. It stages a Live Draft — tell the user to preview and publish it."
|
|
523
|
+
].join("\n"),
|
|
524
|
+
"clone-from-url": (e) => [
|
|
525
|
+
`Rebuild the NextBlock page "${e.slug ?? "<slug>"}" based on ${e.url ?? "<url>"}.`,
|
|
526
|
+
"",
|
|
527
|
+
"Process:",
|
|
528
|
+
"1. Call fetch_url_content on the URL first. Use its headings, text, and mainImage — never invent an image URL.",
|
|
529
|
+
"2. Map the source structure onto NextBlock `section` blocks; do not copy its markup verbatim.",
|
|
530
|
+
"3. Write the result with generate_jsonb_layout so it lands as a reviewable Live Draft."
|
|
531
|
+
].join("\n"),
|
|
532
|
+
"translate-content": (e) => [
|
|
533
|
+
`Translate the page or post "${e.slug ?? "<slug>"}" into "${e.languageCode ?? "<languageCode>"}".`,
|
|
534
|
+
"",
|
|
535
|
+
"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."
|
|
536
|
+
].join("\n")
|
|
403
537
|
};
|
|
404
|
-
function
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
538
|
+
function T(e) {
|
|
539
|
+
let t = C.find((t) => t.name === e.name), n = w[e.name];
|
|
540
|
+
return !t || !n ? null : {
|
|
541
|
+
description: t.description,
|
|
542
|
+
messages: [{
|
|
543
|
+
content: {
|
|
544
|
+
text: n(e.args ?? {}),
|
|
545
|
+
type: "text"
|
|
546
|
+
},
|
|
547
|
+
role: "user"
|
|
548
|
+
}]
|
|
549
|
+
};
|
|
412
550
|
}
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
P as CORTEX_MCP_RESOURCES,
|
|
416
|
-
d as CORTEX_MCP_TOOL_ALIASES,
|
|
417
|
-
s as CORTEX_MCP_TOOL_KINDS,
|
|
418
|
-
k as CORTEX_MCP_WRITE_TOOL_BEHAVIOURS,
|
|
419
|
-
T as CortexMcpForbiddenToolError,
|
|
420
|
-
f as CortexMcpUnknownToolError,
|
|
421
|
-
N as assertCortexMcpToolCoverage,
|
|
422
|
-
E as buildCortexMcpToolDefinitions,
|
|
423
|
-
A as callCortexMcpTool,
|
|
424
|
-
u as cortexMcpScopesAllow,
|
|
425
|
-
U as getCortexMcpPrompt,
|
|
426
|
-
_ as getCortexMcpToolAnnotations,
|
|
427
|
-
C as getCortexMcpToolKind,
|
|
428
|
-
L as readCortexMcpResource,
|
|
429
|
-
p as resolveCortexMcpToolName
|
|
430
|
-
};
|
|
551
|
+
//#endregion
|
|
552
|
+
export { C as CORTEX_MCP_PROMPTS, x as CORTEX_MCP_RESOURCES, o as CORTEX_MCP_TOOL_ALIASES, r as CORTEX_MCP_TOOL_KINDS, i as CORTEX_MCP_WRITE_TOOL_BEHAVIOURS, y as CortexMcpForbiddenToolError, v as CortexMcpUnknownToolError, m as assertCortexMcpToolCoverage, h as buildCortexMcpToolDefinitions, b as callCortexMcpTool, u as cortexMcpScopesAllow, T as getCortexMcpPrompt, l as getCortexMcpToolAnnotations, c as getCortexMcpToolKind, S as readCortexMcpResource, s as resolveCortexMcpToolName };
|