webcake-landing-mcp 1.13.7 → 1.15.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.
@@ -1,4 +1,4 @@
1
- {"meta":{"generated_from":"landing_page_backend router + controllers (static)","backend":"feat/ai-muse-key-guard@fe58d4a9d","operations":487,"undescribed":4},"ops":[
1
+ {"meta":{"generated_from":"landing_page_backend router + controllers (static)","backend":"feat/ai-muse-key-guard@fe58d4a9d","operations":488,"undescribed":4},"ops":[
2
2
  {"id":"get:/api/assets/asset","method":"GET","base":"builder","path":"/api/assets/asset","handler":"AssetsController.get_asset_by_name","pipelines":["org_check"],"params":{"id":null}},
3
3
  {"id":"get:/api/assets/asset_link","method":"GET","base":"builder","path":"/api/assets/asset_link","handler":"AssetsController.get_asset_by_link","pipelines":["org_check"],"params":{"link":null},"required":["link"]},
4
4
  {"id":"post:/api/assets/change_folder","method":"POST","base":"builder","path":"/api/assets/change_folder","handler":"AssetsController.change_folder","pipelines":["org_check"],"params":{"assetID":null,"folderID":null}},
@@ -293,6 +293,7 @@
293
293
  {"id":"post:/api/v1/pages/intergrations/move_all_to_org","method":"POST","base":"api","path":"/api/v1/pages/intergrations/move_all_to_org","handler":"IntergrationsController.move_all_to_org","pipelines":["org_check","team_check"],"params":{"ids":null}},
294
294
  {"id":"get:/api/v1/pages/intergrations/plugin_pancake","method":"GET","base":"api","path":"/api/v1/pages/intergrations/plugin_pancake","handler":"IntergrationsController.get_intergrations_by_plugin_pancake","pipelines":["org_check","team_check"]},
295
295
  {"id":"post:/api/v1/pages/intergrations/update_intergration","method":"POST","base":"api","path":"/api/v1/pages/intergrations/update_intergration","handler":"IntergrationsController.update_intergration","pipelines":["org_check","team_check"],"params":{"attrs":null,"ids":null}},
296
+ {"id":"get:/api/v1/pages/options","method":"GET","base":"api","path":"/api/v1/pages/options","handler":"PageController.page_options","pipelines":["org_check","team_check"],"params":{"creator_id":null,"end_time":null,"filter":null,"last_editor_id":null,"limit":null,"option_tag_active":null,"order_type":null,"organization_permissions":null,"organization_role":null,"sort_by":null,"spec_org":null,"start_time":null,"tag_ids":null,"term":null}},
296
297
  {"id":"get:/api/v1/pages/page/:page_id","method":"GET","base":"api","path":"/api/v1/pages/page/:page_id","handler":"PageController.get_page_by_id","pipelines":["org_check","team_check","page_right"],"perm":"page view"},
297
298
  {"id":"get:/api/v1/pages/page/:page_id/affiliate/affiliate_payouts","method":"GET","base":"api","path":"/api/v1/pages/page/:page_id/affiliate/affiliate_payouts","handler":"AffiliateController.get_affiliate_payouts","pipelines":["org_check","team_check","page_right"],"perm":"page view"},
298
299
  {"id":"get:/api/v1/pages/page/:page_id/affiliate/affiliate_products","method":"GET","base":"api","path":"/api/v1/pages/page/:page_id/affiliate/affiliate_products","handler":"AffiliateController.get_affiliate_products","pipelines":["org_check","team_check","page_right"],"perm":"page view"},
@@ -1,4 +1,18 @@
1
1
  [
2
+ {
3
+ "v": "1.15.0",
4
+ "d": "23/11/2026",
5
+ "type": "Added",
6
+ "en": "api_find/api_get/api_call's route catalog now includes get:/api/v1/pages/options, a slim, filterable page list endpoint on the Webcake backend.",
7
+ "vi": "Danh mục route của api_find/api_get/api_call nay có thêm get:/api/v1/pages/options, một endpoint lấy danh sách trang dạng gọn, lọc được, trên…"
8
+ },
9
+ {
10
+ "v": "1.14.0",
11
+ "d": "23/11/2026",
12
+ "type": "Added",
13
+ "en": "ingest_html and ingest_url with intent:'clone' now measure a page that is not an absolute-canvas export in a real browser, the same way clone_page…",
14
+ "vi": "ingest_html và ingest_url với intent:'clone' nay đo trang không phải export dạng canvas tuyệt đối bằng một trình duyệt thật, giống cách clone_page…"
15
+ },
2
16
  {
3
17
  "v": "1.13.7",
4
18
  "d": "22/11/2026",
@@ -26,19 +40,5 @@
26
40
  "type": "Changed",
27
41
  "en": "All read-only tools (get_generation_guide, list_elements, get_element, get_page_schema, new_element, new_page_skeleton, validate_page,…",
28
42
  "vi": "Tất cả tool chỉ-đọc (get_generation_guide, list_elements, get_element, get_page_schema, new_element, new_page_skeleton, validate_page,…"
29
- },
30
- {
31
- "v": "1.13.3",
32
- "d": "20/11/2026",
33
- "type": "Fixed",
34
- "en": "settings.thumbnail/settings.favicon no longer end up as a 404 sNaN resize URL after an MCP save followed by an editor publish: rehosting now skips…",
35
- "vi": "settings.thumbnail/settings.favicon không còn bị thành URL resize sNaN lỗi 404 sau khi lưu qua MCP rồi publish lại từ editor: bước rehost nay bỏ qua…"
36
- },
37
- {
38
- "v": "1.13.2",
39
- "d": "20/11/2026",
40
- "type": "Added",
41
- "en": "A new live-comment element (livestream-style scrolling comment feed above a fake input) is now in the catalog, with full docs in…",
42
- "vi": "Danh mục có thêm element live-comment (luồng bình luận kiểu livestream cuộn lên trên một ô input giả), kèm tài liệu đầy đủ trong…"
43
43
  }
44
44
  ]
@@ -17,6 +17,7 @@
17
17
  */
18
18
  import { createPageSource } from "./page.js";
19
19
  import { ANIMATABLE_TYPES, ANIMATION_NAMES, CANVAS } from "./vocab.js";
20
+ import { fieldSpec } from "./elements/form.js";
20
21
  const MOBILE_W = CANVAS.mobileWidth;
21
22
  const DESKTOP_W = CANVAS.desktopWidth;
22
23
  // ─── small helpers ────────────────────────────────────────────────────────────
@@ -223,6 +224,11 @@ function mapEvents(ctx, e) {
223
224
  out.push({ id, type: "click", action: "open_link", target: ev.action, targetURL: "_blank" });
224
225
  else if (ev.type === "phone")
225
226
  out.push({ id, type: "click", action: "open_link", target: `tel:${ev.action}` });
227
+ // accordion trigger: the renderer collapses the panel on load (unless showCollapse) and shifts what is below
228
+ else if (ev.type === "collapse")
229
+ out.push({ id, type: "click", action: "collapse", target: idOf(ev.action), ...(ev.show ? { showCollapse: true } : {}) });
230
+ else if (ev.type === "tab")
231
+ out.push({ id, type: "click", action: "change_tab", target: idOf(ev.action), moveTo: "index", tabIndex: ev.index ?? 0 });
226
232
  else
227
233
  ctx.notes.push(`${e.id}: unsupported event type '${ev.type}' skipped`);
228
234
  }
@@ -294,16 +300,6 @@ function applySticky(ctx, node, e) {
294
300
  setBothConfigs(node, cfg);
295
301
  ctx.notes.push(`${e.id}: position:fixed → pinned as a sticky '${pos}' element (was floating ${e.sticky ?? "bottom_right"}).`);
296
302
  }
297
- const FIELD_NAME_MAP = {
298
- name: "full_name",
299
- fullname: "full_name",
300
- full_name: "full_name",
301
- phone: "phone_number",
302
- tel: "phone_number",
303
- phone_number: "phone_number",
304
- email: "email",
305
- address: "address",
306
- };
307
303
  // ─── element conversion ──────────────────────────────────────────────────────
308
304
  function convertChildren(ctx, e, sectionH) {
309
305
  return (e.children ?? []).map((c) => convertElement(ctx, c, sectionH)).filter(Boolean);
@@ -315,6 +311,8 @@ function convertElement(ctx, e, sectionH) {
315
311
  applySticky(ctx, node, e);
316
312
  if (node && (e.hover || e.transition))
317
313
  ctx.css.push(hoverCss(node, e.hover, e.transition));
314
+ if (node && e.keyframes)
315
+ ctx.css.push(keyframesCss(ctx, node, e.keyframes));
318
316
  return node;
319
317
  }
320
318
  const ICON_CDN = /^https:\/\/(cdnjs\.cloudflare\.com|cdn\.jsdelivr\.net|unpkg\.com|fonts\.googleapis\.com|use\.fontawesome\.com|maxcdn\.bootstrapcdn\.com|stackpath\.bootstrapcdn\.com|code\.ionicframework\.com|unicons\.iconscout\.com|cdn\.lineicons\.com|site-assets\.fontawesome\.com)\//;
@@ -353,6 +351,16 @@ function hoverCss(node, hover, transition) {
353
351
  css += `${id}:hover${inner}{${paint.join(";")}}`;
354
352
  return css;
355
353
  }
354
+ /**
355
+ * A source animation the native set cannot express (loop, float, pulse…): the page's own @keyframes
356
+ * (once per name) + the animation on #w-<id>. Raw CSS goes into <style>: nothing that could close it.
357
+ */
358
+ function keyframesCss(ctx, node, kf) {
359
+ if (/[<\\]/.test(kf.css) || /[<>{}\\;]/.test(kf.animation))
360
+ return "";
361
+ const defs = ctx.css.some((c) => c.includes(kf.css)) ? "" : kf.css; // each @keyframes once
362
+ return `${defs}#w-${node.id}{animation:${kf.animation}}`;
363
+ }
356
364
  function convertElementInner(ctx, e, sectionH) {
357
365
  const t = e.type;
358
366
  const style = e.style ?? {};
@@ -416,7 +424,8 @@ function convertElementInner(ctx, e, sectionH) {
416
424
  id: uniqueId(ctx, e.id),
417
425
  type: "image-block",
418
426
  responsive: responsiveOf(ctx, e.box, mapStyles(style, "image-block"), sectionH),
419
- specials: { src: e.src ?? "", imageCompression: true },
427
+ // an svg (incl. a multi-colour inline svg captured as data:image/svg+xml) stays vector
428
+ specials: { src: e.src ?? "", imageCompression: !/^data:image\/svg|\.svg(\?|#|$)/i.test(e.src ?? "") },
420
429
  };
421
430
  if (e.crop) {
422
431
  const crop = {};
@@ -532,23 +541,18 @@ function convertElementInner(ctx, e, sectionH) {
532
541
  node.specials.redirect_url = redirect;
533
542
  node.specials.target_url = "_self";
534
543
  }
535
- // Inputs/buttons must be DIRECT children of the form to submit.
544
+ // Inputs/buttons must be DIRECT children of the form to submit. Each control becomes the field
545
+ // type that renders it (select keeps its options, radio/checkbox their choices, textarea…).
546
+ const taken = new Set();
536
547
  for (const c of e.children ?? []) {
537
548
  if (c.type === "form_item") {
538
- const rawName = c.input?.name ?? `input_${idOf(c.id)}`;
539
- const fieldName = FIELD_NAME_MAP[rawName.toLowerCase()] ?? rawName;
540
- const child = {
549
+ const spec = fieldSpec(c.input ?? {}, taken);
550
+ node.children.push({
541
551
  id: uniqueId(ctx, c.id),
542
- type: "input",
552
+ type: spec.type,
543
553
  responsive: responsiveOf(ctx, c.box, mapStyles(c.style, "rectangle"), sectionH),
544
- specials: {
545
- field_name: fieldName,
546
- field_placeholder: c.input?.placeholder ?? "",
547
- field_type: fieldName === "phone_number" ? "phone" : c.input?.input_type === "email" ? "email" : "text",
548
- ...(c.input?.required ? { required: true } : {}),
549
- },
550
- };
551
- node.children.push(child);
554
+ specials: spec.specials,
555
+ });
552
556
  }
553
557
  else {
554
558
  const conv = convertElement(ctx, c, sectionH);
@@ -636,10 +640,13 @@ function convertElementInner(ctx, e, sectionH) {
636
640
  const mshow = m ? Math.max(1, Math.round(m.width / msw)) : show;
637
641
  node.responsive.desktop.styles.width = show * sw;
638
642
  node.responsive.mobile.styles.width = mshow * msw;
639
- const base = { showNavigation: !!e.config?.["nav"], autoplayMode: "repeat", delayTimeMs: 5000, infinity: true };
643
+ // a tab set: one panel at a time, switched only by its tab buttons (change_tab)
644
+ const base = e.config?.["tabs"]
645
+ ? { showNavigation: false, autoplayMode: "off", infinity: false, transition: "none" }
646
+ : { showNavigation: !!e.config?.["nav"], autoplayMode: "repeat", delayTimeMs: 5000, infinity: true };
640
647
  node.responsive.desktop.config = { ...(node.responsive.desktop.config ?? {}), ...base, slideWidth: sw, slideToShow: show };
641
648
  node.responsive.mobile.config = { ...(node.responsive.mobile.config ?? {}), ...base, slideWidth: msw, slideToShow: mshow };
642
- ctx.notes.push(`${e.id}: slider → native carousel (${slides.length} slides, ${show} visible on desktop, ${mshow} on mobile)`);
649
+ ctx.notes.push(`${e.id}: ${e.config?.["tabs"] ? "tab set" : "slider"} → native carousel (${slides.length} slides, ${show} visible on desktop, ${mshow} on mobile)`);
643
650
  return node;
644
651
  }
645
652
  if (t === "carousel" || t === "gallery") {
@@ -818,7 +825,7 @@ export function canvasToPageSource(canvas, meta = {}) {
818
825
  const css = ctx.css.filter(Boolean).join("\n");
819
826
  if (css) {
820
827
  source.settings.extra_css = css;
821
- ctx.notes.push(`hover effects of ${ctx.css.filter(Boolean).length} element(s) → settings.extra_css (scoped to #w-<id>)`);
828
+ ctx.notes.push(`hover / animation effects of ${ctx.css.filter(Boolean).length} element(s) → settings.extra_css (scoped to #w-<id>)`);
822
829
  }
823
830
  // icon-font stylesheets only from the public CDNs that serve them (a cloned page must not get an
824
831
  // arbitrary third-party stylesheet on the user's domain)
@@ -417,9 +417,88 @@ const SYSTEM_FIELD_ALIASES = {
417
417
  so_luong: "quantity", soluong: "quantity", qty: "quantity",
418
418
  ma_giam_gia: "coupon", voucher: "coupon",
419
419
  };
420
+ /** lowercase, accents stripped, non-alphanumerics → `_` ("Số điện thoại" → "so_dien_thoai"). */
421
+ function slugField(s) {
422
+ return s.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/đ/gi, "d")
423
+ .toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
424
+ }
420
425
  /** The system column a non-canonical field_name was clearly meant to be, else undefined. */
421
426
  export function systemFieldAlias(fieldName) {
422
- const slug = fieldName.normalize("NFD").replace(/[̀-ͯ]/g, "").replace(/đ/gi, "d")
423
- .toLowerCase().replace(/[^a-z0-9]+/g, "_").replace(/^_+|_+$/g, "");
424
- return SYSTEM_FIELD_ALIASES[slug];
427
+ return SYSTEM_FIELD_ALIASES[slugField(fieldName)];
428
+ }
429
+ /**
430
+ * Map one source form control onto the Webcake field element that renders AND submits it:
431
+ * select → select ({id,name} options + field_placeholder), multi-select / checkbox → checkbox-group,
432
+ * radio → radio, textarea → textarea, date/time → input-datetime, file → input-file, else input
433
+ * (field_type email/phone/number/text). field_name = the system column when the name, label or
434
+ * placeholder clearly means one (name/"Họ và tên" → full_name, tel/"Số điện thoại" → phone_number),
435
+ * else the slugged name/label; `taken` (one Set per form) keeps names unique.
436
+ */
437
+ export function fieldSpec(f, taken) {
438
+ const kind = (f.input_type || "text").toLowerCase();
439
+ const options = (f.options ?? []).map((o) => o.trim()).filter(Boolean)
440
+ .map((name, i) => ({ id: `opt${i + 1}`, name }));
441
+ const type = kind === "select" ? (f.multiple ? "checkbox-group" : "select")
442
+ : kind === "checkbox" ? "checkbox-group"
443
+ : kind === "radio" ? "radio"
444
+ : kind === "textarea" ? "textarea"
445
+ : /^(date|time|datetime-local|month|week)$/.test(kind) ? "input-datetime"
446
+ : kind === "file" ? "input-file"
447
+ : "input";
448
+ // system columns only for free-text fields (a <select name="name"> is not the customer's name)
449
+ const cands = [f.name, f.label, f.placeholder].filter((s) => !!s && !!s.trim());
450
+ let fieldName;
451
+ if (type === "input" || type === "textarea") {
452
+ for (const c of cands) {
453
+ const sys = SYSTEM_FIELD_NAMES.has(c) ? c : systemFieldAlias(c);
454
+ if (sys && !sys.includes("/") && !taken.has(sys)) {
455
+ fieldName = sys;
456
+ break;
457
+ }
458
+ }
459
+ if (!fieldName && kind === "email" && !taken.has("email"))
460
+ fieldName = "email";
461
+ if (!fieldName && kind === "tel" && !taken.has("phone_number"))
462
+ fieldName = "phone_number";
463
+ }
464
+ if (!fieldName) {
465
+ const base = cands.map(slugField).find((s) => s && s.length <= 40) || type.replace(/-/g, "_");
466
+ fieldName = base;
467
+ for (let n = 2; taken.has(fieldName); n++)
468
+ fieldName = `${base}_${n}`;
469
+ }
470
+ taken.add(fieldName);
471
+ const prompt = f.placeholder || f.label || "";
472
+ const specials = { field_name: fieldName };
473
+ if (f.required)
474
+ specials.required = true;
475
+ if (type === "input") {
476
+ specials.field_placeholder = prompt;
477
+ specials.field_type =
478
+ fieldName === "phone_number" || kind === "tel" ? "phone"
479
+ : fieldName === "email" || kind === "email" ? "email"
480
+ : kind === "number" || kind === "range" ? "number"
481
+ : "text";
482
+ }
483
+ else if (type === "textarea" || type === "input-file") {
484
+ specials.field_placeholder = prompt;
485
+ }
486
+ else if (type === "input-datetime") {
487
+ specials.field_placeholder = prompt;
488
+ specials.datetime_type = kind === "time" || kind === "datetime-local" ? kind : "date";
489
+ }
490
+ else if (type === "select") {
491
+ specials.field_placeholder = prompt || "Chọn...";
492
+ specials.default_value = "default-none";
493
+ specials.options = options;
494
+ }
495
+ else {
496
+ // radio / checkbox-group: a lone checkbox ("Tôi đồng ý…") is a one-option group; the runtime
497
+ // splits these DOM ids on "-", so option names carry an en dash instead of a hyphen
498
+ const opts = options.length ? options : [{ id: "opt1", name: f.label || f.placeholder || "Đồng ý" }];
499
+ specials.options = opts.map((o) => ({ ...o, name: o.name.replace(/-/g, "–") }));
500
+ if (type === "radio")
501
+ specials.default_value = "none";
502
+ }
503
+ return { type, specials };
425
504
  }
@@ -106,7 +106,7 @@ SECTION BUILD HINTS (apply to whichever sections the chosen archetype uses)
106
106
  - FEATURES / BENEFITS — a row of equal cards (icon + title + text) or a 2-column list. Center the row with the ROW math; on mobile shrink to one canvas width or stack. ICONS: do NOT use keyboard emoji (🎯💼📱✅⭐) as feature icons — instead use a small rectangle (e.g. 48×48px) with per-breakpoint config.svgMask set to a raw SVG string and styles.background set to the brand accent color; write a simple inline SVG path per icon (e.g. a checkmark, star, or arrow). Emoji are acceptable only inline within sentences, never as standalone card icons.
107
107
  - PRODUCT / OFFER — image beside name + price + benefit list + CTA (swap sides per balance). Price and CTA stand out.
108
108
  - SOCIAL PROOF — testimonial cards, a logo strip, or a row of stat counters (auto-number + label). Center the row.
109
- - FORM / CTA — center the form box; stack inputs vertically with comfortable spacing; each input needs a unique specials.field_name (canonical: full_name, phone_number, email, address, quantity); prominent submit button.
109
+ - FORM / CTA — center the form box; stack inputs vertically with comfortable spacing; each input needs a unique specials.field_name (canonical: full_name, phone_number, email, address, quantity); prominent submit button. EVERY field the user (or the reference) asks for gets the DEDICATED type that renders and submits it — never an input standing in for something else: pick one of a few → radio; pick several / a consent tick → checkbox-group (a lone checkbox = one option); pick from a list → select (options [{id,name}] + field_placeholder); message/notes → textarea; date/time → input-datetime; file → input-file; province/district/ward → address; quantity → quantity_input. Choices go in specials.options as {id,name} (never {label,value}); no hyphens in radio/checkbox ids or option ids. A visible field label is a text-block placed above its field (inputs have no label of their own; put the hint in field_placeholder). Fields AND the submit button are DIRECT children of the form (the build makes only such a button submit); size the form box so every child fits inside it on BOTH breakpoints. From ingest_html/ingest_url, each form_fields[] item carries \`webcake\` = { type, specials } (field type, canonical field_name, options, placeholder, required) — use it as that child's type + specials verbatim, keep every field (none dropped, none merged), and keep the order.
110
110
  - FOOTER — name + real contact lines, usually centered on a dark band. Only real data the user provided.
111
111
  - TAG/BADGE "PILL" recipe — a rounded rectangle (borderRadius "13px", the pill bg color) BEHIND a text-block (zIndex 2, styles.backgroundTxt for the box fill if needed, textAlign center). NEVER put the pill color in styles.background on the text-block — ANY styles.background on a text-block paints the TEXT FILL (the renderer emits -webkit-text-fill-color:transparent and forces background-clip:text itself), so it colors the glyphs, not a box. borderRadius is emitted on the inner text tag while backgroundTxt paints the outer box, so the box fill is NOT rounded — the rounded shape must come from a rectangle behind the text.
112
112
  - COMPLEX COMPOSITE VISUAL (phone/chat mockup, mini dashboard, browser-window frame, inbox/notification list, ticket-style card) → ONE html-box with inline-styled HTML (root div: width:100%;height:100%;box-sizing:border-box;overflow:hidden; flex/grid allowed inside; content must fit styles.height or it overflows silently) instead of dozens of tiny elements. Never use html-box for primary copy, CTAs, form fields, or any element that events must target — it is an opaque blob in the editor.
@@ -26,7 +26,7 @@ RULES (follow for every request):
26
26
  A wrong element type is the most common error → { op:'update', id:'<element id>', type:'<allowed type>' } (run list_elements if unsure). Drafts expire in ~2 h.
27
27
  - DRY-RUN CACHE: create_page, update_page, and add_section dry_run=true all cache the validated payload and return a draft_id. Re-run the same tool with { draft_id, dry_run:false } — no need to re-send the source.
28
28
  - ORGANIZATION FIRST — the org is REQUIRED for the API and must be settled in INTAKE, before any image or build work. Call list_organizations at the START (part of the same first batch as your intake questions). Exactly ONE org → it is auto-selected everywhere, no need to ask. MULTIPLE orgs → show them and ask the user which to use (is_default is the suggested default) as one of your intake questions, then pass that SAME organization_id to create_page AND to upload_images. Both refuse to guess: they return ok:false with reason:"organization_required" and the org list. Pass organization_id:"personal" only when the user explicitly wants no org. Endpoints are owner-scoped (only the account's own pages). WHY IT MUST COME FIRST: the org decides WHICH media collection the page's images are filed into, so an image uploaded before the org is settled has no collection to go into — do NOT call search_images/upload_images or start building until the org is known. One org, chosen once, used for the page and every image on it.
29
- - REFERENCE INPUT — if the user provides a layout reference, USE it as the layout anchor (don't ignore it, don't re-invent from scratch). Three input modes: (1) IMAGE/screenshot attached in chat → analyze it natively (no tool call): identify section flow (hero/features/form/cta/footer), heading hierarchy, dominant colors, font feel, then map sections to Webcake elements using role→element hints (hero → section with background image/overlay + heading + paragraph + button; features → group blocks with icon/title/text; stats bar → group with heading+text per stat; pricing → group with text list + button; footer → section with text + links). When the reference contains a composite widget (phone/device mockup, chat thread, mini dashboard, browser frame) → rebuild it as ONE html-box (clone its HTML with all styles inlined), not as element soup. (2) HTML string → call ingest_html(html, detail:'full') to get the richer AST when cloning; use detail:'compact' (default) for a layout-only reference. (3) URL → call ingest_url(url, detail:'full') for the same richer AST. (4) GOOGLE STITCH design (when a Stitch MCP is connected and the user points at a Stitch screen/project) → bridge the two MCPs: call the Stitch tool get_screen, take the returned htmlCode.downloadUrl, and pass THAT url to ingest_url(detail:'full') (or fetch the HTML and use ingest_html) — Stitch output is a Tailwind-CDN page, so the AST comes back with a token-named palette + design_tokens (the real spacing/radii/type-scale) + gradients (Tailwind gradient utilities reconstructed as linear-gradient(...) with resolved color stops — apply them as the element's background, e.g. on CTA/hero) + per-section hover_effects (the interactions Stitch packs in: scale/image-zoom/lift/underline/color-change — REPRODUCE them via Webcake hover events: change_color (change_color_type text/background/border) for color/underline, the button's hovered* specials or animation_hover for scale/lift/zoom — don't ship a static page); LOCK the design system from those tokens, reuse the page's image URLs (they auto-host on save — Stitch's googleusercontent images included), then create_page. ABSOLUTE-CANVAS builder exports (LadiPage-family / Webcake-published HTML) are AUTO-DETECTED by ingest_html/ingest_url and converted DETERMINISTICALLY into a ready-to-save source (folded into the response as source + clone_notes + clone_notice, the per-element geometry summarized to canvas_summary) — a faithful 1:1 clone on the matching 420/960 canvas: pass that source STRAIGHT to create_page (dry_run:true first to validate, then dry_run:false) instead of hand-rebuilding; its images auto-host on save (no upload_images), and clone_notes lists the few lossy approximations (fixed/floating elements, svg-less shapes, skipped social-proof toasts) to patch_page afterward. The AST classifies sections by role and lists headings/subheadings/ctas/images/form_fields plus brand hints (colors/fonts), a token-named palette + design_tokens (for Tailwind-CDN pages like Google Stitch, lifted from the page's tailwind.config: palette names every color token e.g. primary→#a43b38, and design_tokens carries the resolved spacing grid + corner radii + TYPE SCALE e.g. display-lg→48px — rebuild sizing/spacing/color FROM these tokens, not by guessing), background_images from stylesheets, gradients (incl. reconstructed Tailwind gradient backgrounds), per-section hover_effects (reproduce them — via hover events, or the custom-CSS escape hatch below), and in full mode: per-section blocks (cards/tiles/steps with title/body/image/cta) and li lists — use it for LAYOUT + HIERARCHY, then generate FRESH content tailored to the user's brand (don't 1:1 copy text). IMAGES FROM THE REFERENCE ARE THE USER'S ASSETS — for BOTH intents (adapt AND clone), put every real image URL found in the AST (images, background_images, og_image, canvas src/background) straight into the corresponding slot's specials.src / url(...) background / gallery link; the save AUTO-HOSTS it to the Webcake CDN, so you do NOT need to call upload_images first — just carry the URL through un-altered (never drop it, never swap it for a search_images stock photo or a placeholder). Call search_images ONLY for slots that have no source image in the reference. intent='clone' only when the user explicitly asks to mirror the original; default intent='adapt' (adapt rewrites TEXT, not the imagery). The reference workflow PRESERVES craft rules above (centering, page margin, premium spacing, real images) — apply them on top of the reference layout, don't bypass them.
29
+ - REFERENCE INPUT — if the user provides a layout reference, USE it as the layout anchor (don't ignore it, don't re-invent from scratch). Three input modes: (1) IMAGE/screenshot attached in chat → analyze it natively (no tool call): identify section flow (hero/features/form/cta/footer), heading hierarchy, dominant colors, font feel, then map sections to Webcake elements using role→element hints (hero → section with background image/overlay + heading + paragraph + button; features → group blocks with icon/title/text; stats bar → group with heading+text per stat; pricing → group with text list + button; footer → section with text + links). When the reference contains a composite widget (phone/device mockup, chat thread, mini dashboard, browser frame) → rebuild it as ONE html-box (clone its HTML with all styles inlined), not as element soup. (2) HTML string → call ingest_html(html, detail:'full') to get the richer AST when cloning; use detail:'compact' (default) for a layout-only reference. (3) URL → call ingest_url(url, detail:'full') for the same richer AST. When the user wants a FAITHFUL COPY of an HTML/URL (not an adaptation), pass intent:'clone' (HTML saved from a site: also base_url = its original URL): with a browser on the host the page is MEASURED and the result is a ready draft_id (mode:'browser_clone' — forms, accordions, tabs, popups, sliders and animations already native) → create_page({ draft_id, dry_run:false }); never hand-rebuild a page that came back as a draft. Without a browser the AST comes back with a warning — rebuild from it, copying each form_fields[].webcake as the form's child. (4) GOOGLE STITCH design (when a Stitch MCP is connected and the user points at a Stitch screen/project) → bridge the two MCPs: call the Stitch tool get_screen, take the returned htmlCode.downloadUrl, and pass THAT url to ingest_url(detail:'full') (or fetch the HTML and use ingest_html) — Stitch output is a Tailwind-CDN page, so the AST comes back with a token-named palette + design_tokens (the real spacing/radii/type-scale) + gradients (Tailwind gradient utilities reconstructed as linear-gradient(...) with resolved color stops — apply them as the element's background, e.g. on CTA/hero) + per-section hover_effects (the interactions Stitch packs in: scale/image-zoom/lift/underline/color-change — REPRODUCE them via Webcake hover events: change_color (change_color_type text/background/border) for color/underline, the button's hovered* specials or animation_hover for scale/lift/zoom — don't ship a static page); LOCK the design system from those tokens, reuse the page's image URLs (they auto-host on save — Stitch's googleusercontent images included), then create_page. ABSOLUTE-CANVAS builder exports (LadiPage-family / Webcake-published HTML) are AUTO-DETECTED by ingest_html/ingest_url and converted DETERMINISTICALLY into a ready-to-save source (folded into the response as source + clone_notes + clone_notice, the per-element geometry summarized to canvas_summary) — a faithful 1:1 clone on the matching 420/960 canvas: pass that source STRAIGHT to create_page (dry_run:true first to validate, then dry_run:false) instead of hand-rebuilding; its images auto-host on save (no upload_images), and clone_notes lists the few lossy approximations (fixed/floating elements, svg-less shapes, skipped social-proof toasts) to patch_page afterward. The AST classifies sections by role and lists headings/subheadings/ctas/images/form_fields plus brand hints (colors/fonts), a token-named palette + design_tokens (for Tailwind-CDN pages like Google Stitch, lifted from the page's tailwind.config: palette names every color token e.g. primary→#a43b38, and design_tokens carries the resolved spacing grid + corner radii + TYPE SCALE e.g. display-lg→48px — rebuild sizing/spacing/color FROM these tokens, not by guessing), background_images from stylesheets, gradients (incl. reconstructed Tailwind gradient backgrounds), per-section hover_effects (reproduce them — via hover events, or the custom-CSS escape hatch below), and in full mode: per-section blocks (cards/tiles/steps with title/body/image/cta) and li lists — use it for LAYOUT + HIERARCHY, then generate FRESH content tailored to the user's brand (don't 1:1 copy text). IMAGES FROM THE REFERENCE ARE THE USER'S ASSETS — for BOTH intents (adapt AND clone), put every real image URL found in the AST (images, background_images, og_image, canvas src/background) straight into the corresponding slot's specials.src / url(...) background / gallery link; the save AUTO-HOSTS it to the Webcake CDN, so you do NOT need to call upload_images first — just carry the URL through un-altered (never drop it, never swap it for a search_images stock photo or a placeholder). Call search_images ONLY for slots that have no source image in the reference. intent='clone' only when the user explicitly asks to mirror the original; default intent='adapt' (adapt rewrites TEXT, not the imagery). The reference workflow PRESERVES craft rules above (centering, page margin, premium spacing, real images) — apply them on top of the reference layout, don't bypass them.
30
30
 
31
31
  MODEL (essentials):
32
32
  - Top-level: { page:[sections], popup:[popups], dynamic_pages:[], settings:{}, options:{mobileOnly,versionID}, cartConfigs:{isActive:false}, svariations:[] }. Popups are a SEPARATE top-level array, NOT inside page; currency lives in settings.currency (not options). Leave dynamic_pages/svariations as [] for a static page, but keep them on edit round-trips.
@@ -712,6 +712,10 @@ export function validatePage(input) {
712
712
  if (type === "form" && !hasField(node)) {
713
713
  warnings.push(`[EMPTY_RENDER] ${path} (form): has no input fields — nothing to fill in or submit. Add fields (input with field_name full_name / phone_number, …) and a button.`);
714
714
  }
715
+ else if (type === "form" && !(node.children ?? []).some((c) => c?.type === "button")) {
716
+ // the build emits the hidden <button type=submit> only inside a button whose parent is the form
717
+ warnings.push(`${path} (form): no button among its direct children — the form can never be submitted. Add a button as a DIRECT child of the form (inside a group/rectangle it does not submit).`);
718
+ }
715
719
  if (OPTION_NAME_FIELDS.has(type) && type !== "select" && !(Array.isArray(node.specials?.options) && node.specials.options.length)) {
716
720
  warnings.push(`[EMPTY_RENDER] ${path} (${type}): specials.options is empty — no choices render. Add [{ id, name }, …].`);
717
721
  }