@caelo-cms/shared 0.11.0 → 0.11.1
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/dist/ai-tools.d.ts +30 -144
- package/dist/ai-tools.d.ts.map +1 -1
- package/dist/ai-tools.js +41 -141
- package/dist/ai-tools.js.map +1 -1
- package/dist/build-page.d.ts +5 -5
- package/dist/build-page.js +9 -9
- package/dist/build-page.js.map +1 -1
- package/dist/content.d.ts +13 -2
- package/dist/content.d.ts.map +1 -1
- package/dist/content.js +45 -12
- package/dist/content.js.map +1 -1
- package/dist/css-scope-scan.js +1 -1
- package/dist/escaped-line-breaks.d.ts +44 -0
- package/dist/escaped-line-breaks.d.ts.map +1 -0
- package/dist/escaped-line-breaks.js +203 -0
- package/dist/escaped-line-breaks.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/interactions.js +5 -5
- package/dist/interactions.js.map +1 -1
- package/dist/lists/default-types.d.ts +12 -0
- package/dist/lists/default-types.d.ts.map +1 -1
- package/dist/lists/default-types.js +36 -0
- package/dist/lists/default-types.js.map +1 -1
- package/dist/lists/fields.d.ts.map +1 -1
- package/dist/lists/fields.js +1 -0
- package/dist/lists/fields.js.map +1 -1
- package/dist/lists/render-data.d.ts +9 -0
- package/dist/lists/render-data.d.ts.map +1 -1
- package/dist/lists/render-deps.d.ts +4 -3
- package/dist/lists/render-deps.d.ts.map +1 -1
- package/dist/lists/render-deps.js +5 -3
- package/dist/lists/render-deps.js.map +1 -1
- package/dist/lists/resolve.d.ts +13 -0
- package/dist/lists/resolve.d.ts.map +1 -1
- package/dist/lists/resolve.js +95 -3
- package/dist/lists/resolve.js.map +1 -1
- package/dist/nested-module-render.d.ts +13 -0
- package/dist/nested-module-render.d.ts.map +1 -1
- package/dist/nested-module-render.js +34 -0
- package/dist/nested-module-render.js.map +1 -1
- package/dist/redirect-plan.d.ts +13 -0
- package/dist/redirect-plan.d.ts.map +1 -1
- package/dist/redirect-plan.js +22 -0
- package/dist/redirect-plan.js.map +1 -1
- package/dist/seo.d.ts +21 -0
- package/dist/seo.d.ts.map +1 -1
- package/dist/seo.js +32 -0
- package/dist/seo.js.map +1 -1
- package/dist/source-text-transport.d.ts +28 -2
- package/dist/source-text-transport.d.ts.map +1 -1
- package/dist/source-text-transport.js +12 -4
- package/dist/source-text-transport.js.map +1 -1
- package/dist/template-sections.d.ts.map +1 -1
- package/dist/template-sections.js +17 -4
- package/dist/template-sections.js.map +1 -1
- package/dist/version.d.ts +2 -2
- package/dist/version.js +1 -1
- package/package.json +1 -1
- package/src/__tests__/redos-hardening.test.ts +1 -0
- package/src/ai-tools-add-module-modes.test.ts +1 -1
- package/src/ai-tools.test.ts +7 -20
- package/src/ai-tools.ts +49 -153
- package/src/bug-intake.test.ts +1 -1
- package/src/build-page.ts +9 -9
- package/src/content.test.ts +26 -1
- package/src/content.ts +47 -13
- package/src/css-scope-scan.ts +1 -1
- package/src/escaped-line-breaks.ts +221 -0
- package/src/index.ts +1 -0
- package/src/interactions.ts +5 -5
- package/src/link-refs.test.ts +1 -0
- package/src/lists/default-types.ts +39 -0
- package/src/lists/fields.ts +1 -0
- package/src/lists/list-fixtures.test.ts +9 -3
- package/src/lists/render-data.ts +9 -0
- package/src/lists/render-deps.ts +6 -3
- package/src/lists/resolve.test.ts +182 -5
- package/src/lists/resolve.ts +101 -3
- package/src/nested-module-render.test.ts +39 -0
- package/src/nested-module-render.ts +35 -0
- package/src/redirect-plan.test.ts +25 -0
- package/src/redirect-plan.ts +24 -0
- package/src/seo.test.ts +58 -0
- package/src/seo.ts +49 -0
- package/src/source-text-transport.test.ts +98 -3
- package/src/source-text-transport.ts +15 -4
- package/src/template-engine-lists.test.ts +55 -0
- package/src/template-sections.ts +18 -4
- package/src/version.ts +1 -1
package/dist/ai-tools.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* silent drops in the handler.
|
|
10
10
|
*/
|
|
11
11
|
import { z } from "zod";
|
|
12
|
+
import type { SourceLanguage } from "./escaped-line-breaks.js";
|
|
12
13
|
/**
|
|
13
14
|
* An AI tool argument holding source text (html / css / js): the given
|
|
14
15
|
* string schema, with whole-value transport encodings decoded first — a
|
|
@@ -18,121 +19,13 @@ import { z } from "zod";
|
|
|
18
19
|
* is handled in one place instead of refused per tool.
|
|
19
20
|
*
|
|
20
21
|
* @param schema - the string schema (length caps, min) the decoded value must satisfy.
|
|
22
|
+
* @param language - the grammar of the value (`html`, `css`, `js`).
|
|
21
23
|
*/
|
|
22
|
-
export declare function sourceTextArg<T extends z.ZodType<string>>(schema: T): z.ZodPreprocess<T, unknown>;
|
|
24
|
+
export declare function sourceTextArg<T extends z.ZodType<string>>(schema: T, language: SourceLanguage): z.ZodPreprocess<T, unknown>;
|
|
23
25
|
export declare const positionInputSchema: z.ZodPreprocess<z.ZodUnion<readonly [z.ZodEnum<{
|
|
24
26
|
top: "top";
|
|
25
27
|
bottom: "bottom";
|
|
26
28
|
}>, z.ZodPreprocess<z.ZodNumber, unknown>]>, unknown>;
|
|
27
|
-
export declare const editModuleToolInput: z.ZodObject<{
|
|
28
|
-
moduleId: z.ZodString;
|
|
29
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
30
|
-
description: z.ZodOptional<z.ZodString>;
|
|
31
|
-
kind: z.ZodOptional<z.ZodEnum<{
|
|
32
|
-
content: "content";
|
|
33
|
-
chrome: "chrome";
|
|
34
|
-
hero: "hero";
|
|
35
|
-
cta: "cta";
|
|
36
|
-
utility: "utility";
|
|
37
|
-
}>>;
|
|
38
|
-
type: z.ZodOptional<z.ZodString>;
|
|
39
|
-
html: z.ZodOptional<z.ZodPreprocess<z.ZodString, unknown>>;
|
|
40
|
-
css: z.ZodOptional<z.ZodPreprocess<z.ZodString, unknown>>;
|
|
41
|
-
js: z.ZodOptional<z.ZodPreprocess<z.ZodString, unknown>>;
|
|
42
|
-
fields: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
43
|
-
name: z.ZodString;
|
|
44
|
-
kind: z.ZodEnum<{
|
|
45
|
-
number: "number";
|
|
46
|
-
boolean: "boolean";
|
|
47
|
-
text: "text";
|
|
48
|
-
richtext: "richtext";
|
|
49
|
-
link: "link";
|
|
50
|
-
url: "url";
|
|
51
|
-
image: "image";
|
|
52
|
-
}>;
|
|
53
|
-
label: z.ZodString;
|
|
54
|
-
default: z.ZodOptional<z.ZodUnknown>;
|
|
55
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
56
|
-
name: z.ZodString;
|
|
57
|
-
kind: z.ZodLiteral<"list">;
|
|
58
|
-
label: z.ZodString;
|
|
59
|
-
listType: z.ZodString;
|
|
60
|
-
bind: z.ZodOptional<z.ZodEnum<{
|
|
61
|
-
source: "source";
|
|
62
|
-
local: "local";
|
|
63
|
-
shared: "shared";
|
|
64
|
-
}>>;
|
|
65
|
-
list: z.ZodOptional<z.ZodString>;
|
|
66
|
-
source: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
67
|
-
kind: z.ZodLiteral<"query">;
|
|
68
|
-
editable: z.ZodArray<z.ZodEnum<{
|
|
69
|
-
page_type: "page_type";
|
|
70
|
-
terms: "terms";
|
|
71
|
-
terms_mode: "terms_mode";
|
|
72
|
-
parent: "parent";
|
|
73
|
-
exclude_current: "exclude_current";
|
|
74
|
-
order: "order";
|
|
75
|
-
limit: "limit";
|
|
76
|
-
}>>;
|
|
77
|
-
defaults: z.ZodObject<{
|
|
78
|
-
page_type: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
79
|
-
terms: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString>>>;
|
|
80
|
-
terms_mode: z.ZodOptional<z.ZodOptional<z.ZodEnum<{
|
|
81
|
-
any: "any";
|
|
82
|
-
all: "all";
|
|
83
|
-
}>>>;
|
|
84
|
-
parent: z.ZodOptional<z.ZodOptional<z.ZodString>>;
|
|
85
|
-
exclude_current: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
|
|
86
|
-
order: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
87
|
-
published_desc: "published_desc";
|
|
88
|
-
published_asc: "published_asc";
|
|
89
|
-
title_asc: "title_asc";
|
|
90
|
-
}>, z.ZodString]>>;
|
|
91
|
-
limit: z.ZodOptional<z.ZodNumber>;
|
|
92
|
-
}, z.core.$strict>;
|
|
93
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
94
|
-
kind: z.ZodLiteral<"system">;
|
|
95
|
-
name: z.ZodEnum<{
|
|
96
|
-
breadcrumbs: "breadcrumbs";
|
|
97
|
-
children: "children";
|
|
98
|
-
siblings: "siblings";
|
|
99
|
-
page_terms: "page_terms";
|
|
100
|
-
term_pages: "term_pages";
|
|
101
|
-
}>;
|
|
102
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
103
|
-
kind: z.ZodLiteral<"plugin">;
|
|
104
|
-
name: z.ZodString;
|
|
105
|
-
}, z.core.$strict>], "kind">>;
|
|
106
|
-
min: z.ZodOptional<z.ZodNumber>;
|
|
107
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
108
|
-
default: z.ZodOptional<z.ZodUnion<readonly [z.ZodArray<z.ZodType<import("./index.js").ListItemInput, unknown, z.core.$ZodTypeInternals<import("./index.js").ListItemInput, unknown>>>, z.ZodString]>>;
|
|
109
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
110
|
-
name: z.ZodString;
|
|
111
|
-
kind: z.ZodLiteral<"module">;
|
|
112
|
-
label: z.ZodString;
|
|
113
|
-
allowedModuleTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
114
|
-
}, z.core.$strict>, z.ZodObject<{
|
|
115
|
-
name: z.ZodString;
|
|
116
|
-
kind: z.ZodLiteral<"module-list">;
|
|
117
|
-
label: z.ZodString;
|
|
118
|
-
allowedModuleTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
119
|
-
min: z.ZodOptional<z.ZodNumber>;
|
|
120
|
-
max: z.ZodOptional<z.ZodNumber>;
|
|
121
|
-
}, z.core.$strict>], "kind">>>;
|
|
122
|
-
bindThemeLiterals: z.ZodOptional<z.ZodBoolean>;
|
|
123
|
-
}, z.core.$strict>;
|
|
124
|
-
/**
|
|
125
|
-
* v0.4.0 — `set_page_module_content` AI tool. Fills the content values for
|
|
126
|
-
* a module placement on a specific page. Page-bound + branch-isolated per
|
|
127
|
-
* chat until publish (unlike `edit_module` which is global + immediate).
|
|
128
|
-
*/
|
|
129
|
-
export declare const setPageModuleContentToolInput: z.ZodObject<{
|
|
130
|
-
pageId: z.ZodString;
|
|
131
|
-
blockName: z.ZodString;
|
|
132
|
-
position: z.ZodNumber;
|
|
133
|
-
contentValues: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
134
|
-
}, z.core.$strict>;
|
|
135
|
-
export type SetPageModuleContentToolInput = z.infer<typeof setPageModuleContentToolInput>;
|
|
136
29
|
export declare const siteMemoryProposeToolInput: z.ZodObject<{
|
|
137
30
|
slot: z.ZodEnum<{
|
|
138
31
|
purpose: "purpose";
|
|
@@ -360,8 +253,6 @@ export declare const forkPlacementContentToolInput: z.ZodObject<{
|
|
|
360
253
|
blockName: z.ZodString;
|
|
361
254
|
position: z.ZodNumber;
|
|
362
255
|
}, z.core.$strict>;
|
|
363
|
-
export declare const AI_TOOLS: readonly ["edit_module", "site_memory_propose", "add_module", "create_page", "update_pages_many", "delete_pages_many", "remove_module_from", "update_theme", "set_template_layout", "create_layout", "set_site_defaults", "duplicate_page", "repoint_page_template", "move_module", "reorder_module", "set_nav_menu", "add_plugin_to_page", "list_content_instances", "get_content_instance", "create_content_instance", "set_content_instance_values", "delete_content_instance", "set_placement_content", "fork_placement_content", "build_page", "create_content_instances", "set_page_module_content_many"];
|
|
364
|
-
export type AiToolName = (typeof AI_TOOLS)[number];
|
|
365
256
|
export type AddPluginToPageToolInput = z.infer<typeof addPluginToPageToolInput>;
|
|
366
257
|
export type ListContentInstancesToolInput = z.infer<typeof listContentInstancesToolInput>;
|
|
367
258
|
export type GetContentInstanceToolInput = z.infer<typeof getContentInstanceToolInput>;
|
|
@@ -415,7 +306,7 @@ export declare const CHAT_MAX_ATTACHMENTS = 4;
|
|
|
415
306
|
* `position` / `field` (#917) — plus `item` / `key` for an entry of a
|
|
416
307
|
* local list field (epic #1107) — name the placement field the text
|
|
417
308
|
* comes from when the preview marked it, so the AI can address it in
|
|
418
|
-
* `
|
|
309
|
+
* `set_page_module_content_many` without inspecting the page first.
|
|
419
310
|
* `listItem` is the `data-caelo-list-item` of the list entry the element
|
|
420
311
|
* sits in (epic #1107, `docs/lists.md` §13): the chip then names that
|
|
421
312
|
* entry — of a shared list, or of a module's own list — not just the
|
|
@@ -611,8 +502,8 @@ export declare const setSiteDefaultsToolInput: z.ZodObject<{
|
|
|
611
502
|
export declare const duplicatePageToolInput: z.ZodObject<{
|
|
612
503
|
sourcePageId: z.ZodString;
|
|
613
504
|
newSlug: z.ZodString;
|
|
614
|
-
newName: z.ZodOptional<z.ZodString>;
|
|
615
505
|
newTitle: z.ZodOptional<z.ZodString>;
|
|
506
|
+
newShortTitle: z.ZodOptional<z.ZodString>;
|
|
616
507
|
targetTemplateId: z.ZodOptional<z.ZodString>;
|
|
617
508
|
newParentPageId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
618
509
|
}, z.core.$strict>;
|
|
@@ -626,27 +517,37 @@ export declare const repointPageTemplateToolInput: z.ZodObject<{
|
|
|
626
517
|
blockName: z.ZodString;
|
|
627
518
|
}, z.core.$strict>], "kind">>;
|
|
628
519
|
}, z.core.$strict>;
|
|
520
|
+
/**
|
|
521
|
+
* `move_module` position: `top` | `bottom` | a 0-based index in the target
|
|
522
|
+
* block, plus `up` / `down` (one slot within the module's CURRENT block).
|
|
523
|
+
* Same quote-stripping + numeric-string coercion as `positionInputSchema`.
|
|
524
|
+
*/
|
|
525
|
+
export declare const movePositionInputSchema: z.ZodPreprocess<z.ZodUnion<readonly [z.ZodEnum<{
|
|
526
|
+
top: "top";
|
|
527
|
+
bottom: "bottom";
|
|
528
|
+
up: "up";
|
|
529
|
+
down: "down";
|
|
530
|
+
}>, z.ZodPreprocess<z.ZodNumber, unknown>]>, unknown>;
|
|
531
|
+
/**
|
|
532
|
+
* `move_module` — moves a placement to `toBlockName` (omitted = the block it
|
|
533
|
+
* is in now, i.e. a reorder) at `position`. `up` / `down` only make sense
|
|
534
|
+
* inside the current block; the handler refuses them with another block.
|
|
535
|
+
*/
|
|
629
536
|
export declare const moveModuleToolInput: z.ZodObject<{
|
|
630
537
|
pageId: z.ZodString;
|
|
631
538
|
moduleId: z.ZodString;
|
|
632
|
-
toBlockName: z.ZodString
|
|
539
|
+
toBlockName: z.ZodOptional<z.ZodString>;
|
|
633
540
|
position: z.ZodPreprocess<z.ZodUnion<readonly [z.ZodEnum<{
|
|
634
541
|
top: "top";
|
|
635
542
|
bottom: "bottom";
|
|
636
|
-
}>, z.ZodPreprocess<z.ZodNumber, unknown>]>, unknown>;
|
|
637
|
-
}, z.core.$strict>;
|
|
638
|
-
export declare const reorderModuleToolInput: z.ZodObject<{
|
|
639
|
-
pageId: z.ZodString;
|
|
640
|
-
moduleId: z.ZodString;
|
|
641
|
-
direction: z.ZodUnion<readonly [z.ZodEnum<{
|
|
642
543
|
up: "up";
|
|
643
544
|
down: "down";
|
|
644
|
-
}>, z.ZodNumber]>;
|
|
545
|
+
}>, z.ZodPreprocess<z.ZodNumber, unknown>]>, unknown>;
|
|
645
546
|
}, z.core.$strict>;
|
|
646
547
|
/**
|
|
647
548
|
* P7 — `find_media`. Searches the media library by alt-text /
|
|
648
549
|
* filename / mime. Each row carries the media UUID (what
|
|
649
|
-
* `set_theme_asset` / `
|
|
550
|
+
* `set_theme_asset` / `set_media_alt_many` require) plus a pre-resolved
|
|
650
551
|
* variant URL. The AI's only media-inventory surface — the `## Media`
|
|
651
552
|
* system-prompt block was removed by the context diet (#300), so every
|
|
652
553
|
* asset lookup ("an image of a sunlit office") goes through this tool.
|
|
@@ -680,7 +581,7 @@ export declare const regenerateMediaVariantsToolInput: z.ZodObject<{
|
|
|
680
581
|
}, z.core.$strict>;
|
|
681
582
|
export type RegenerateMediaVariantsToolInput = z.infer<typeof regenerateMediaVariantsToolInput>;
|
|
682
583
|
/**
|
|
683
|
-
* P7 — `
|
|
584
|
+
* P7 — one item of `set_media_alt_many`. AI may improve a11y on an existing asset
|
|
684
585
|
* without a human round-trip (e.g. when the editor uploaded an image
|
|
685
586
|
* with the default alt and the AI reads its content). Updates only
|
|
686
587
|
* the alt field on `media_assets`.
|
|
@@ -709,7 +610,7 @@ export declare const setNotFoundPageToolInput: z.ZodObject<{
|
|
|
709
610
|
}, z.core.$strict>;
|
|
710
611
|
export type SetNotFoundPageToolInput = z.infer<typeof setNotFoundPageToolInput>;
|
|
711
612
|
/**
|
|
712
|
-
* 0181 — `
|
|
613
|
+
* 0181 — one item of `set_media_source_many`. AI records an asset's provenance (source
|
|
713
614
|
* kind + origin detail) and licence when known. All fields but the
|
|
714
615
|
* assetId are optional; the op COALESCEs so omitted fields stay
|
|
715
616
|
* unchanged.
|
|
@@ -727,7 +628,7 @@ export declare const setMediaSourceToolInput: z.ZodObject<{
|
|
|
727
628
|
}, z.core.$strict>;
|
|
728
629
|
export type SetMediaSourceToolInput = z.infer<typeof setMediaSourceToolInput>;
|
|
729
630
|
/**
|
|
730
|
-
* P8 — `
|
|
631
|
+
* P8 — one item of `set_page_seo_many`. Manual / panel writes to the per-page SEO
|
|
731
632
|
* sidecar. AI calls this only on explicit user intent
|
|
732
633
|
* ("set the home meta description to ..."). Doesn't bump fingerprints
|
|
733
634
|
* (autofilled_at / optimized_at).
|
|
@@ -751,7 +652,7 @@ export declare const setPageSeoToolInput: z.ZodObject<{
|
|
|
751
652
|
}, z.core.$strict>;
|
|
752
653
|
export type SetPageSeoToolInput = z.infer<typeof setPageSeoToolInput>;
|
|
753
654
|
/**
|
|
754
|
-
* P8 —
|
|
655
|
+
* P8 — one item of `autofill_page_seo_many`.
|
|
755
656
|
* Fill-once. Refuses when the page's SEO was already autofilled. The AI
|
|
756
657
|
* calls it before a page's first Stage; staging and production builds
|
|
757
658
|
* refuse pages without a meta description (deploy/missing-seo.ts).
|
|
@@ -762,19 +663,6 @@ export declare const autofillPageSeoToolInput: z.ZodObject<{
|
|
|
762
663
|
ogImageAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
763
664
|
}, z.core.$strict>;
|
|
764
665
|
export type AutofillPageSeoToolInput = z.infer<typeof autofillPageSeoToolInput>;
|
|
765
|
-
/**
|
|
766
|
-
* P8 — `optimize_page_seo`. Explicit re-optimization. Always allowed.
|
|
767
|
-
* Takes optional context (keyword analysis / intent shifts / branding
|
|
768
|
-
* changes). The AI can call this across N pages in one chat turn —
|
|
769
|
-
* the resulting changes batch into one Publish-pill confirm.
|
|
770
|
-
*/
|
|
771
|
-
export declare const optimizePageSeoToolInput: z.ZodObject<{
|
|
772
|
-
pageId: z.ZodString;
|
|
773
|
-
metaDescription: z.ZodString;
|
|
774
|
-
ogImageAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
775
|
-
context: z.ZodOptional<z.ZodString>;
|
|
776
|
-
}, z.core.$strict>;
|
|
777
|
-
export type OptimizePageSeoToolInput = z.infer<typeof optimizePageSeoToolInput>;
|
|
778
666
|
/**
|
|
779
667
|
* P8 AI-first review pass — bulk variants. Per CLAUDE.md §11, bulk
|
|
780
668
|
* tools save round-trips when the AI knows it has N changes to make
|
|
@@ -788,7 +676,7 @@ export declare const findRedirectsToolInput: z.ZodObject<{
|
|
|
788
676
|
}, z.core.$strict>;
|
|
789
677
|
export type FindRedirectsToolInput = z.infer<typeof findRedirectsToolInput>;
|
|
790
678
|
export declare const bulkCreateRedirectsToolInput: z.ZodObject<{
|
|
791
|
-
|
|
679
|
+
items: z.ZodArray<z.ZodObject<{
|
|
792
680
|
fromPath: z.ZodString;
|
|
793
681
|
toPath: z.ZodString;
|
|
794
682
|
statusCode: z.ZodDefault<z.ZodUnion<readonly [z.ZodLiteral<301>, z.ZodLiteral<302>, z.ZodLiteral<307>, z.ZodLiteral<308>, z.ZodLiteral<410>]>>;
|
|
@@ -819,7 +707,7 @@ export declare const bulkDeleteRedirectsToolInput: z.ZodObject<{
|
|
|
819
707
|
}, z.core.$strict>;
|
|
820
708
|
export type BulkDeleteRedirectsToolInput = z.infer<typeof bulkDeleteRedirectsToolInput>;
|
|
821
709
|
export declare const bulkOptimizeSeoToolInput: z.ZodObject<{
|
|
822
|
-
|
|
710
|
+
items: z.ZodArray<z.ZodObject<{
|
|
823
711
|
pageId: z.ZodString;
|
|
824
712
|
metaDescription: z.ZodString;
|
|
825
713
|
ogImageAssetId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -827,7 +715,6 @@ export declare const bulkOptimizeSeoToolInput: z.ZodObject<{
|
|
|
827
715
|
context: z.ZodOptional<z.ZodString>;
|
|
828
716
|
}, z.core.$strict>;
|
|
829
717
|
export type BulkOptimizeSeoToolInput = z.infer<typeof bulkOptimizeSeoToolInput>;
|
|
830
|
-
export type EditModuleToolInput = z.infer<typeof editModuleToolInput>;
|
|
831
718
|
export type SiteMemoryProposeToolInput = z.infer<typeof siteMemoryProposeToolInput>;
|
|
832
719
|
export type CreateTemplateToolInput = z.infer<typeof createTemplateToolInput>;
|
|
833
720
|
export type ChatCreateSessionInput = z.infer<typeof chatCreateSessionInput>;
|
|
@@ -844,7 +731,6 @@ export type SetSiteDefaultsToolInput = z.infer<typeof setSiteDefaultsToolInput>;
|
|
|
844
731
|
export type DuplicatePageToolInput = z.infer<typeof duplicatePageToolInput>;
|
|
845
732
|
export type RepointPageTemplateToolInput = z.infer<typeof repointPageTemplateToolInput>;
|
|
846
733
|
export type MoveModuleToolInput = z.infer<typeof moveModuleToolInput>;
|
|
847
|
-
export type ReorderModuleToolInput = z.infer<typeof reorderModuleToolInput>;
|
|
848
734
|
/**
|
|
849
735
|
* P10A — `propose_skill`. AI drafts a new skill body (or revision) and
|
|
850
736
|
* queues it for Owner review. Per CLAUDE.md §2: skills augment the AI's
|
package/dist/ai-tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../src/ai-tools.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../src/ai-tools.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAaxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAqC/D;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,QAAQ,EAAE,cAAc,+BAE7F;AAED,eAAO,MAAM,mBAAmB;;;qDAS/B,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;;;;;;;;;kBAM5B,CAAC;AAEZ;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,oBAAoB,KAAK,CAAC;AACvC,eAAO,MAAM,kBAAkB;;kBAapB,CAAC;AACZ,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAEpE;;;GAGG;AACH;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyG3B,CAAC;AACL,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,k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AAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B;;;;;;;;;;kBA6BhC,CAAC;AACZ,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,8BAA8B,CAAC,CAAC;AAE5F;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B;;;kBAQ5B,CAAC;AACZ,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
package/dist/ai-tools.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* silent drops in the handler.
|
|
11
11
|
*/
|
|
12
12
|
import { z } from "zod";
|
|
13
|
-
import { contentInstanceCreateSchema, contentInstanceDeleteSchema, contentInstanceUpdateSchema, forkPlacementContentSchema,
|
|
13
|
+
import { contentInstanceCreateSchema, contentInstanceDeleteSchema, contentInstanceUpdateSchema, forkPlacementContentSchema, moduleFieldSchema, pageShortTitleSchema, pageTypeSlugSchema, setPlacementContentSchema, slugSchema, } from "./content.js";
|
|
14
14
|
import { LIST_ITEM_ATTR_RE } from "./lists/item-attr.js";
|
|
15
15
|
import { pluginPreviewSelectionSchema } from "./plugin-preview.js";
|
|
16
16
|
import { redirectTargetPathSchema } from "./redirect-target.js";
|
|
@@ -56,67 +56,15 @@ function stripSurroundingQuotes(v) {
|
|
|
56
56
|
* is handled in one place instead of refused per tool.
|
|
57
57
|
*
|
|
58
58
|
* @param schema - the string schema (length caps, min) the decoded value must satisfy.
|
|
59
|
+
* @param language - the grammar of the value (`html`, `css`, `js`).
|
|
59
60
|
*/
|
|
60
|
-
export function sourceTextArg(schema) {
|
|
61
|
-
return z.preprocess(decodeSourceTextTransport, schema);
|
|
61
|
+
export function sourceTextArg(schema, language) {
|
|
62
|
+
return z.preprocess((value) => decodeSourceTextTransport(value, language), schema);
|
|
62
63
|
}
|
|
63
64
|
export const positionInputSchema = z.preprocess(stripSurroundingQuotes, z.union([
|
|
64
65
|
z.enum(["top", "bottom"]),
|
|
65
66
|
z.preprocess((v) => (typeof v === "string" && /^\d+$/.test(v) ? Number.parseInt(v, 10) : v), z.number().int().min(0).max(1000)),
|
|
66
67
|
]));
|
|
67
|
-
export const editModuleToolInput = z
|
|
68
|
-
.object({
|
|
69
|
-
moduleId: z.string().uuid(),
|
|
70
|
-
displayName: z.string().min(1).max(128).optional(),
|
|
71
|
-
/**
|
|
72
|
-
* v0.12.0 — rewrite the module's purpose. Optional; passing it
|
|
73
|
-
* updates the `list_modules` catalog your future self will read.
|
|
74
|
-
*/
|
|
75
|
-
description: z.string().max(1000).optional(),
|
|
76
|
-
/** v0.12.0 — re-classify the module's role tag. */
|
|
77
|
-
kind: z.enum(["chrome", "hero", "content", "cta", "utility"]).optional(),
|
|
78
|
-
/**
|
|
79
|
-
* v0.12.3 (issue #106) — re-classify the module's stable `type` (the
|
|
80
|
-
* class a parent's `allowedModuleTypes` whitelist matches against,
|
|
81
|
-
* e.g. `button`). Rarely needed; usually derived from displayName at
|
|
82
|
-
* create time. Set it to make this module satisfy a parent's allowlist.
|
|
83
|
-
*/
|
|
84
|
-
type: slugSchema.optional(),
|
|
85
|
-
html: sourceTextArg(z.string().max(MODULE_HTML_MAX)).optional(),
|
|
86
|
-
css: sourceTextArg(z.string().max(MODULE_CSS_MAX)).optional(),
|
|
87
|
-
js: sourceTextArg(z.string().max(MODULE_JS_MAX)).optional(),
|
|
88
|
-
/**
|
|
89
|
-
* v0.4.0 — module field schema. Each field declares one substitution
|
|
90
|
-
* slot referenced in the module HTML as `{{name}}`. Page placements
|
|
91
|
-
* fill these via `set_page_module_content`. Optional on edits — pass
|
|
92
|
-
* to replace the declared schema.
|
|
93
|
-
*/
|
|
94
|
-
fields: z.array(moduleFieldSchema).max(64).optional(),
|
|
95
|
-
/** issue #164 slice 2 — see addModuleToolInput.bindThemeLiterals. */
|
|
96
|
-
bindThemeLiterals: z.boolean().optional(),
|
|
97
|
-
})
|
|
98
|
-
.strict()
|
|
99
|
-
// e2e-livedit run 40351690739: a call with only a (placeholder)
|
|
100
|
-
// moduleId reached the op and came back as a bare "module not found".
|
|
101
|
-
// An edit that changes nothing is refused before any lookup, with the
|
|
102
|
-
// fields that make it one.
|
|
103
|
-
.refine((v) => Object.keys(v).some((k) => k !== "moduleId" && k !== "bindThemeLiterals"), {
|
|
104
|
-
message: "edit_module changes nothing: pass what to change (html, css, js, fields, displayName, description, kind or type). list_modules shows the modules; add_module creates a new one.",
|
|
105
|
-
});
|
|
106
|
-
/**
|
|
107
|
-
* v0.4.0 — `set_page_module_content` AI tool. Fills the content values for
|
|
108
|
-
* a module placement on a specific page. Page-bound + branch-isolated per
|
|
109
|
-
* chat until publish (unlike `edit_module` which is global + immediate).
|
|
110
|
-
*/
|
|
111
|
-
export const setPageModuleContentToolInput = z
|
|
112
|
-
.object({
|
|
113
|
-
pageId: z.string().uuid(),
|
|
114
|
-
blockName: z.string().min(1).max(64),
|
|
115
|
-
position: z.number().int().nonnegative(),
|
|
116
|
-
/** Map of module field name → value. Fully replaces existing values. */
|
|
117
|
-
contentValues: z.record(z.string(), z.unknown()),
|
|
118
|
-
})
|
|
119
|
-
.strict();
|
|
120
68
|
export const siteMemoryProposeToolInput = z
|
|
121
69
|
.object({
|
|
122
70
|
slot: z.enum(["purpose", "brand-voice", "tone", "banned-phrases", "instructions", "glossary"]),
|
|
@@ -186,9 +134,9 @@ export const addModuleToolInput = z
|
|
|
186
134
|
description: z.string().max(1000).optional(),
|
|
187
135
|
kind: z.enum(["chrome", "hero", "content", "cta", "utility"]).optional(),
|
|
188
136
|
type: slugSchema.optional(),
|
|
189
|
-
html: sourceTextArg(z.string().min(1).max(50_000)).optional(),
|
|
190
|
-
css: sourceTextArg(z.string().max(50_000)).optional(),
|
|
191
|
-
js: sourceTextArg(z.string().max(50_000)).optional(),
|
|
137
|
+
html: sourceTextArg(z.string().min(1).max(50_000), "html").optional(),
|
|
138
|
+
css: sourceTextArg(z.string().max(50_000), "css").optional(),
|
|
139
|
+
js: sourceTextArg(z.string().max(50_000), "js").optional(),
|
|
192
140
|
fields: z.array(moduleFieldSchema).max(64).optional(),
|
|
193
141
|
bindThemeLiterals: z.boolean().optional(),
|
|
194
142
|
/**
|
|
@@ -201,8 +149,8 @@ export const addModuleToolInput = z
|
|
|
201
149
|
* stores the values as the minted module's `fields[].default` —
|
|
202
150
|
* which requires explicit `fields` (moduleize field names are
|
|
203
151
|
* unknowable up front) and is rejected for `moduleId` reuse (a
|
|
204
|
-
* shared module renders its stored defaults;
|
|
205
|
-
* them).
|
|
152
|
+
* shared module renders its stored defaults; update_modules_many
|
|
153
|
+
* changes them).
|
|
206
154
|
*/
|
|
207
155
|
values: z.record(z.string(), z.unknown()).optional(),
|
|
208
156
|
})
|
|
@@ -212,7 +160,7 @@ export const addModuleToolInput = z
|
|
|
212
160
|
if (input.moduleId !== undefined) {
|
|
213
161
|
ctx.addIssue({
|
|
214
162
|
code: z.ZodIssueCode.custom,
|
|
215
|
-
message: "Reusing a module on a layout renders the module's STORED field defaults — `values` has nothing to bind to. Drop `values` (the chrome shows the module as-is), or change the shared copy via
|
|
163
|
+
message: "Reusing a module on a layout renders the module's STORED field defaults — `values` has nothing to bind to. Drop `values` (the chrome shows the module as-is), or change the shared copy via update_modules_many.",
|
|
216
164
|
});
|
|
217
165
|
}
|
|
218
166
|
else if (input.fields === undefined || input.fields.length === 0) {
|
|
@@ -237,7 +185,7 @@ export const addModuleToolInput = z
|
|
|
237
185
|
// (§1A/§11), so we do NOT reject a moduleId call that also carries authoring
|
|
238
186
|
// fields. Those fields are not applied here; the tool HANDLER surfaces an
|
|
239
187
|
// INFO for any ignored field whose value DIFFERS from the module's stored
|
|
240
|
-
// one, pointing at
|
|
188
|
+
// one, pointing at update_modules_many — so a dropped change is never silent (§2).
|
|
241
189
|
if (input.moduleId !== undefined)
|
|
242
190
|
return;
|
|
243
191
|
if (input.displayName === undefined || input.html === undefined) {
|
|
@@ -318,43 +266,6 @@ export const setContentInstanceValuesToolInput = contentInstanceUpdateSchema;
|
|
|
318
266
|
export const deleteContentInstanceToolInput = contentInstanceDeleteSchema;
|
|
319
267
|
export const setPlacementContentToolInput = setPlacementContentSchema;
|
|
320
268
|
export const forkPlacementContentToolInput = forkPlacementContentSchema;
|
|
321
|
-
export const AI_TOOLS = [
|
|
322
|
-
"edit_module",
|
|
323
|
-
"site_memory_propose",
|
|
324
|
-
"add_module",
|
|
325
|
-
"create_page",
|
|
326
|
-
// audit #3 — page metadata (name/title/slug/template/status) is one tool for
|
|
327
|
-
// 1..200 pages: `update_pages_many`. The former rename_page / set_page_title
|
|
328
|
-
// / change_page_slug were single-field wrappers over the same pages.update.
|
|
329
|
-
"update_pages_many",
|
|
330
|
-
// audit #4 — one delete tool for 1..200 pages, disposition per page.
|
|
331
|
-
// The former singular delete_page folded in (n=1 is a one-item array).
|
|
332
|
-
"delete_pages_many",
|
|
333
|
-
// one remove-module tool routed by target (page|layout).
|
|
334
|
-
"remove_module_from",
|
|
335
|
-
"update_theme",
|
|
336
|
-
"set_template_layout",
|
|
337
|
-
"create_layout",
|
|
338
|
-
"set_site_defaults",
|
|
339
|
-
"duplicate_page",
|
|
340
|
-
"repoint_page_template",
|
|
341
|
-
"move_module",
|
|
342
|
-
"reorder_module",
|
|
343
|
-
"set_nav_menu",
|
|
344
|
-
"add_plugin_to_page",
|
|
345
|
-
// v0.12.0 — content_instances + placement binding
|
|
346
|
-
"list_content_instances",
|
|
347
|
-
"get_content_instance",
|
|
348
|
-
"create_content_instance",
|
|
349
|
-
"set_content_instance_values",
|
|
350
|
-
"delete_content_instance",
|
|
351
|
-
"set_placement_content",
|
|
352
|
-
"fork_placement_content",
|
|
353
|
-
// issue #299 — bulk-first build path (§11)
|
|
354
|
-
"build_page",
|
|
355
|
-
"create_content_instances",
|
|
356
|
-
"set_page_module_content_many",
|
|
357
|
-
];
|
|
358
269
|
/** Chat ops input shapes — used by the SvelteKit form actions. */
|
|
359
270
|
export const chatCreateSessionInput = z
|
|
360
271
|
.object({
|
|
@@ -415,7 +326,7 @@ export const CHAT_MAX_ATTACHMENTS = 4;
|
|
|
415
326
|
* `position` / `field` (#917) — plus `item` / `key` for an entry of a
|
|
416
327
|
* local list field (epic #1107) — name the placement field the text
|
|
417
328
|
* comes from when the preview marked it, so the AI can address it in
|
|
418
|
-
* `
|
|
329
|
+
* `set_page_module_content_many` without inspecting the page first.
|
|
419
330
|
* `listItem` is the `data-caelo-list-item` of the list entry the element
|
|
420
331
|
* sits in (epic #1107, `docs/lists.md` §13): the chip then names that
|
|
421
332
|
* entry — of a shared list, or of a module's own list — not just the
|
|
@@ -601,8 +512,8 @@ export const createTemplateToolInput = z
|
|
|
601
512
|
.object({
|
|
602
513
|
slug: slugInputSchema,
|
|
603
514
|
displayName: z.string().min(1).max(256),
|
|
604
|
-
html: sourceTextArg(z.string().min(1).max(2_000_000)),
|
|
605
|
-
css: sourceTextArg(z.string().max(2_000_000)).default(""),
|
|
515
|
+
html: sourceTextArg(z.string().min(1).max(2_000_000), "html"),
|
|
516
|
+
css: sourceTextArg(z.string().max(2_000_000), "css").default(""),
|
|
606
517
|
layoutId: z.string().uuid().optional(),
|
|
607
518
|
/** Epic #1107 — the page type (slug) this template serves; omit for the site default. */
|
|
608
519
|
pageType: pageTypeSlugSchema.optional(),
|
|
@@ -646,8 +557,8 @@ export const createLayoutToolInput = z
|
|
|
646
557
|
.object({
|
|
647
558
|
slug: slugInputSchema,
|
|
648
559
|
displayName: z.string().min(1).max(200),
|
|
649
|
-
html: sourceTextArg(z.string().min(1).max(50_000)),
|
|
650
|
-
css: sourceTextArg(z.string().max(50_000)).optional(),
|
|
560
|
+
html: sourceTextArg(z.string().min(1).max(50_000), "html"),
|
|
561
|
+
css: sourceTextArg(z.string().max(50_000), "css").optional(),
|
|
651
562
|
blocks: z
|
|
652
563
|
.array(z
|
|
653
564
|
.object({
|
|
@@ -679,8 +590,9 @@ export const duplicatePageToolInput = z
|
|
|
679
590
|
.object({
|
|
680
591
|
sourcePageId: z.string().uuid(),
|
|
681
592
|
newSlug: slugInputSchema,
|
|
682
|
-
newName: z.string().min(1).max(256).optional(),
|
|
683
593
|
newTitle: z.string().min(1).max(256).optional(),
|
|
594
|
+
/** #1142 — the copy's breadcrumb label; omitted = newTitle when given, else the source's. */
|
|
595
|
+
newShortTitle: pageShortTitleSchema.optional(),
|
|
684
596
|
targetTemplateId: z.string().uuid().optional(),
|
|
685
597
|
/** Where the copy sits: a parent page id, or null for the top level.
|
|
686
598
|
* Omitted = next to the source (same parent). */
|
|
@@ -706,30 +618,32 @@ export const repointPageTemplateToolInput = z
|
|
|
706
618
|
.default({ kind: "drop" }),
|
|
707
619
|
})
|
|
708
620
|
.strict();
|
|
621
|
+
/**
|
|
622
|
+
* `move_module` position: `top` | `bottom` | a 0-based index in the target
|
|
623
|
+
* block, plus `up` / `down` (one slot within the module's CURRENT block).
|
|
624
|
+
* Same quote-stripping + numeric-string coercion as `positionInputSchema`.
|
|
625
|
+
*/
|
|
626
|
+
export const movePositionInputSchema = z.preprocess(stripSurroundingQuotes, z.union([
|
|
627
|
+
z.enum(["top", "bottom", "up", "down"]),
|
|
628
|
+
z.preprocess((v) => (typeof v === "string" && /^\d+$/.test(v) ? Number.parseInt(v, 10) : v), z.number().int().min(0).max(1000)),
|
|
629
|
+
]));
|
|
630
|
+
/**
|
|
631
|
+
* `move_module` — moves a placement to `toBlockName` (omitted = the block it
|
|
632
|
+
* is in now, i.e. a reorder) at `position`. `up` / `down` only make sense
|
|
633
|
+
* inside the current block; the handler refuses them with another block.
|
|
634
|
+
*/
|
|
709
635
|
export const moveModuleToolInput = z
|
|
710
636
|
.object({
|
|
711
637
|
pageId: z.string().uuid(),
|
|
712
638
|
moduleId: z.string().uuid(),
|
|
713
|
-
toBlockName: z.string().min(1).max(80),
|
|
714
|
-
|
|
715
|
-
position: positionInputSchema,
|
|
716
|
-
})
|
|
717
|
-
.strict();
|
|
718
|
-
export const reorderModuleToolInput = z
|
|
719
|
-
.object({
|
|
720
|
-
pageId: z.string().uuid(),
|
|
721
|
-
moduleId: z.string().uuid(),
|
|
722
|
-
/**
|
|
723
|
-
* `up` / `down` shift one slot. An integer is an absolute 0-based
|
|
724
|
-
* target position within the same block.
|
|
725
|
-
*/
|
|
726
|
-
direction: z.union([z.enum(["up", "down"]), z.number().int().min(0).max(1000)]),
|
|
639
|
+
toBlockName: z.string().min(1).max(80).optional(),
|
|
640
|
+
position: movePositionInputSchema,
|
|
727
641
|
})
|
|
728
642
|
.strict();
|
|
729
643
|
/**
|
|
730
644
|
* P7 — `find_media`. Searches the media library by alt-text /
|
|
731
645
|
* filename / mime. Each row carries the media UUID (what
|
|
732
|
-
* `set_theme_asset` / `
|
|
646
|
+
* `set_theme_asset` / `set_media_alt_many` require) plus a pre-resolved
|
|
733
647
|
* variant URL. The AI's only media-inventory surface — the `## Media`
|
|
734
648
|
* system-prompt block was removed by the context diet (#300), so every
|
|
735
649
|
* asset lookup ("an image of a sunlit office") goes through this tool.
|
|
@@ -770,7 +684,7 @@ export const regenerateMediaVariantsToolInput = z
|
|
|
770
684
|
message: "pass either assetIds or allMissing: true (exactly one)",
|
|
771
685
|
});
|
|
772
686
|
/**
|
|
773
|
-
* P7 — `
|
|
687
|
+
* P7 — one item of `set_media_alt_many`. AI may improve a11y on an existing asset
|
|
774
688
|
* without a human round-trip (e.g. when the editor uploaded an image
|
|
775
689
|
* with the default alt and the AI reads its content). Updates only
|
|
776
690
|
* the alt field on `media_assets`.
|
|
@@ -794,7 +708,7 @@ export const setHomePageToolInput = z.object({ pageId: z.string().uuid() }).stri
|
|
|
794
708
|
*/
|
|
795
709
|
export const setNotFoundPageToolInput = z.object({ pageId: z.string().uuid().nullable() }).strict();
|
|
796
710
|
/**
|
|
797
|
-
* 0181 — `
|
|
711
|
+
* 0181 — one item of `set_media_source_many`. AI records an asset's provenance (source
|
|
798
712
|
* kind + origin detail) and licence when known. All fields but the
|
|
799
713
|
* assetId are optional; the op COALESCEs so omitted fields stay
|
|
800
714
|
* unchanged.
|
|
@@ -808,7 +722,7 @@ export const setMediaSourceToolInput = z
|
|
|
808
722
|
})
|
|
809
723
|
.strict();
|
|
810
724
|
/**
|
|
811
|
-
* P8 — `
|
|
725
|
+
* P8 — one item of `set_page_seo_many`. Manual / panel writes to the per-page SEO
|
|
812
726
|
* sidecar. AI calls this only on explicit user intent
|
|
813
727
|
* ("set the home meta description to ..."). Doesn't bump fingerprints
|
|
814
728
|
* (autofilled_at / optimized_at).
|
|
@@ -827,7 +741,7 @@ export const setPageSeoToolInput = z
|
|
|
827
741
|
})
|
|
828
742
|
.strict();
|
|
829
743
|
/**
|
|
830
|
-
* P8 —
|
|
744
|
+
* P8 — one item of `autofill_page_seo_many`.
|
|
831
745
|
* Fill-once. Refuses when the page's SEO was already autofilled. The AI
|
|
832
746
|
* calls it before a page's first Stage; staging and production builds
|
|
833
747
|
* refuse pages without a meta description (deploy/missing-seo.ts).
|
|
@@ -839,20 +753,6 @@ export const autofillPageSeoToolInput = z
|
|
|
839
753
|
ogImageAssetId: z.string().uuid().nullable().optional(),
|
|
840
754
|
})
|
|
841
755
|
.strict();
|
|
842
|
-
/**
|
|
843
|
-
* P8 — `optimize_page_seo`. Explicit re-optimization. Always allowed.
|
|
844
|
-
* Takes optional context (keyword analysis / intent shifts / branding
|
|
845
|
-
* changes). The AI can call this across N pages in one chat turn —
|
|
846
|
-
* the resulting changes batch into one Publish-pill confirm.
|
|
847
|
-
*/
|
|
848
|
-
export const optimizePageSeoToolInput = z
|
|
849
|
-
.object({
|
|
850
|
-
pageId: z.string().uuid(),
|
|
851
|
-
metaDescription: z.string().min(1).max(320),
|
|
852
|
-
ogImageAssetId: z.string().uuid().nullable().optional(),
|
|
853
|
-
context: z.string().max(4000).optional(),
|
|
854
|
-
})
|
|
855
|
-
.strict();
|
|
856
756
|
/**
|
|
857
757
|
* P8 AI-first review pass — bulk variants. Per CLAUDE.md §11, bulk
|
|
858
758
|
* tools save round-trips when the AI knows it has N changes to make
|
|
@@ -870,7 +770,7 @@ export const findRedirectsToolInput = z
|
|
|
870
770
|
.strict();
|
|
871
771
|
export const bulkCreateRedirectsToolInput = z
|
|
872
772
|
.object({
|
|
873
|
-
|
|
773
|
+
items: z
|
|
874
774
|
.array(z
|
|
875
775
|
.object({
|
|
876
776
|
fromPath: z.string().min(1).max(500),
|
|
@@ -914,7 +814,7 @@ export const bulkDeleteRedirectsToolInput = z
|
|
|
914
814
|
.strict();
|
|
915
815
|
export const bulkOptimizeSeoToolInput = z
|
|
916
816
|
.object({
|
|
917
|
-
|
|
817
|
+
items: z
|
|
918
818
|
.array(z
|
|
919
819
|
.object({
|
|
920
820
|
pageId: z.string().uuid(),
|