@vectoriox/iox-ui 5.203.0 → 5.205.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/actions-core/index.d.ts +8 -1
- package/design-core/index.d.ts +70 -2
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs +8 -1
- package/fesm2022/vectoriox-iox-ui-actions-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +131 -11
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +5294 -267
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +524 -112
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +2308 -6
- package/index.d.ts +159 -13
- package/package.json +1 -1
- package/src/actions-core/element-actions.ts +9 -0
- package/src/design-core/contrast-audit.ts +93 -11
- package/src/design-core/flavor-spec.generated.ts +19 -0
- package/src/design-core/image-alt.ts +27 -0
- package/src/design-core/node-links.ts +12 -0
- package/src/design-core/public-api.ts +1 -0
- package/src/generation-core/ai-run.ts +31 -0
- package/src/generation-core/audit-site.ts +17 -3
- package/src/generation-core/baseline-roles.ts +10 -6
- package/src/generation-core/check-free.ts +12 -2
- package/src/generation-core/check-layout.ts +3 -2
- package/src/generation-core/critic-calibration.ts +178 -0
- package/src/generation-core/critic-prompt.ts +174 -0
- package/src/generation-core/critic-rubric.generated.ts +24 -0
- package/src/generation-core/critic-sheet.ts +270 -0
- package/src/generation-core/critic.ts +189 -0
- package/src/generation-core/design-doc-index.ts +58 -0
- package/src/generation-core/design-motion.ts +247 -0
- package/src/generation-core/design-ops-check.ts +370 -0
- package/src/generation-core/design-ops-of.ts +200 -0
- package/src/generation-core/design-ops.model.ts +239 -0
- package/src/generation-core/design-ops.schema.ts +122 -0
- package/src/generation-core/design-ops.ts +361 -0
- package/src/generation-core/design-recipes.ts +58 -0
- package/src/generation-core/designer-brief.ts +82 -0
- package/src/generation-core/designer-direction.ts +248 -0
- package/src/generation-core/designer-estimate.ts +171 -0
- package/src/generation-core/designer-lessons.generated.ts +653 -0
- package/src/generation-core/designer-lessons.ts +153 -0
- package/src/generation-core/designer-stop.ts +94 -0
- package/src/generation-core/footer-mix.ts +3 -1
- package/src/generation-core/node-baselines.generated.ts +953 -10
- package/src/generation-core/public-api.ts +20 -0
- package/src/generation-core/site-spec.generated.ts +73 -11
- package/src/generation-core/social-links.ts +195 -2
- package/src/generation-core/structure-fingerprint.ts +565 -0
- package/src/generation-core/templates.ts +39 -3
- package/styles/iox-design.css +26 -1
- package/styles/iox-forms.css +22 -0
|
@@ -46,6 +46,17 @@ export enum AiStep {
|
|
|
46
46
|
AssistPicture = 'assistPicture',
|
|
47
47
|
/** AI Assist, Files box ▸ Generate: the look at a made picture — the same call as `CheckPictures`. */
|
|
48
48
|
AssistPictureReview = 'assistPictureReview',
|
|
49
|
+
/**
|
|
50
|
+
* The AI designer (ai-designer-plan AD4, Pro behind `features.designer`): the three concepts the owner picks from
|
|
51
|
+
* (§2a′, `designerConceptsSchema`) — words and a planned Home; their sketches are rendered, not asked.
|
|
52
|
+
*/
|
|
53
|
+
DesignConcepts = 'designConcepts',
|
|
54
|
+
/** The designer: the ten lines of art direction, once per site after the pick (§2a, `designerDirectionSchema`). */
|
|
55
|
+
DesignDirection = 'designDirection',
|
|
56
|
+
/** The designer: one round's builder operations on a page (§2b, §2e — `DESIGN_TOOL_SCHEMAS`). */
|
|
57
|
+
DesignRevise = 'designRevise',
|
|
58
|
+
/** The designer: one round's critique against the reference (§2d, `criticAnswerSchema`). */
|
|
59
|
+
DesignCritique = 'designCritique',
|
|
49
60
|
}
|
|
50
61
|
|
|
51
62
|
export const AI_STEPS: ReadonlyArray<AiStep> = Object.values(AiStep);
|
|
@@ -81,6 +92,10 @@ export const AI_STEP_LABELS: Readonly<Record<AiStep, string>> = {
|
|
|
81
92
|
[AiStep.AssistRead]: 'Read your photos',
|
|
82
93
|
[AiStep.AssistPicture]: 'Make a picture',
|
|
83
94
|
[AiStep.AssistPictureReview]: 'Check the picture',
|
|
95
|
+
[AiStep.DesignConcepts]: 'Sketch three directions',
|
|
96
|
+
[AiStep.DesignDirection]: 'Set the art direction',
|
|
97
|
+
[AiStep.DesignRevise]: 'Design a round',
|
|
98
|
+
[AiStep.DesignCritique]: 'Critique a round',
|
|
84
99
|
};
|
|
85
100
|
|
|
86
101
|
/** What a model must be able to do for a step to run on it. */
|
|
@@ -103,6 +118,10 @@ export const AI_STEP_NEEDS: Readonly<Record<AiStep, ReadonlyArray<AiCapability>>
|
|
|
103
118
|
[AiStep.AssistRead]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
104
119
|
[AiStep.AssistPicture]: [AiCapability.ImageOutput],
|
|
105
120
|
[AiStep.AssistPictureReview]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
121
|
+
[AiStep.DesignConcepts]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
122
|
+
[AiStep.DesignDirection]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
123
|
+
[AiStep.DesignRevise]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
124
|
+
[AiStep.DesignCritique]: [AiCapability.StructuredOutput, AiCapability.ImageInput],
|
|
106
125
|
};
|
|
107
126
|
|
|
108
127
|
/**
|
|
@@ -181,6 +200,13 @@ export const AI_STEP_TYPICAL_TOKENS: Readonly<Record<AiStep, AiTokenCounts>> = {
|
|
|
181
200
|
// Files box ▸ Generate: the very calls of the two picture steps, so the very counts.
|
|
182
201
|
[AiStep.AssistPicture]: PICTURE_TOKENS,
|
|
183
202
|
[AiStep.AssistPictureReview]: PICTURE_REVIEW_TOKENS,
|
|
203
|
+
// The designer (ai-designer-plan §6b, estimates until AD3 measures a round): a concept writes words and a planned Home
|
|
204
|
+
// (no pictures out); the direction reads the references' cards and writes ten lines; a revise reads the brief and the
|
|
205
|
+
// page as compact ops and writes ops; a critique reads ≈ 20 pictures, the reference's from the cache from round 2.
|
|
206
|
+
[AiStep.DesignConcepts]: { input: 14_000, output: 6_000, cacheWrite: 0, cacheRead: 0 },
|
|
207
|
+
[AiStep.DesignDirection]: { input: 12_000, output: 2_000, cacheWrite: 0, cacheRead: 0 },
|
|
208
|
+
[AiStep.DesignRevise]: { input: 14_000, output: 10_000, cacheWrite: 0, cacheRead: 15_000 },
|
|
209
|
+
[AiStep.DesignCritique]: { input: 35_500, output: 4_000, cacheWrite: 0, cacheRead: 35_000 },
|
|
184
210
|
};
|
|
185
211
|
|
|
186
212
|
/** Tokens by the class a provider prices them in. */
|
|
@@ -437,6 +463,11 @@ export const AI_STEP_FEATURE: Readonly<Record<AiStep, AiFeature>> = {
|
|
|
437
463
|
[AiStep.AssistRead]: AiFeature.Assist,
|
|
438
464
|
[AiStep.AssistPicture]: AiFeature.Assist,
|
|
439
465
|
[AiStep.AssistPictureReview]: AiFeature.Assist,
|
|
466
|
+
// The designer is site generation; whether a studio has it is the plan's `designer` switch (PlanFeature.Designer).
|
|
467
|
+
[AiStep.DesignConcepts]: AiFeature.SiteGeneration,
|
|
468
|
+
[AiStep.DesignDirection]: AiFeature.SiteGeneration,
|
|
469
|
+
[AiStep.DesignRevise]: AiFeature.SiteGeneration,
|
|
470
|
+
[AiStep.DesignCritique]: AiFeature.SiteGeneration,
|
|
440
471
|
};
|
|
441
472
|
|
|
442
473
|
export enum AiLimit {
|
|
@@ -2,7 +2,7 @@ import { ELEMENT_ACTION_DESCRIPTORS, POPUP_RULES, popupEnded, resolveActionAvail
|
|
|
2
2
|
import { CheckoutGateCode, CheckoutGateRefusal, labelIn } from '@vectoriox/iox-ui/commerce-core';
|
|
3
3
|
import { PopupArrive, PopupForm, popupFormOf, PopupRole, PopupTrait, ShopRole } from '@vectoriox/iox-ui/composite-core';
|
|
4
4
|
import { isNumberedPlaceholderTitle } from '@vectoriox/iox-ui/data-core';
|
|
5
|
-
import { auditDesignContrast, DesignTokenLike } from '@vectoriox/iox-ui/design-core';
|
|
5
|
+
import { auditDesignContrast, colorSchemeOf, ContrastTree, DesignTokenLike, isDecorativeImage, renderedContrastFindings } from '@vectoriox/iox-ui/design-core';
|
|
6
6
|
import { ConsentActionType } from '@vectoriox/iox-ui/composite-core';
|
|
7
7
|
import { collectFormSpec, FORM_CHANNEL_ROLE, FORM_NODE_TYPE, isChannelFilled } from '@vectoriox/iox-ui/forms-core';
|
|
8
8
|
|
|
@@ -584,6 +584,17 @@ function checkLegalPages(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyA
|
|
|
584
584
|
}
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
+
/** What the site renders, for the contrast check: every page, and the globals in the default scheme and in each scheme a
|
|
588
|
+
* page OPENS on (a header with no scheme of its own follows the page's opening). The whole site, whatever page is
|
|
589
|
+
* being published: the look is the site's. */
|
|
590
|
+
function renderedTrees(snapshot: SiteAuditSnapshot): ContrastTree[] {
|
|
591
|
+
const openings = snapshot.pages.map(p => colorSchemeOf(p.layout.find(n => !!n))).filter((s): s is string => !!s);
|
|
592
|
+
return [
|
|
593
|
+
...snapshot.pages.map(p => ({ nodes: p.layout })),
|
|
594
|
+
{ nodes: snapshot.globals, schemes: [...new Set(['default', ...openings])] },
|
|
595
|
+
];
|
|
596
|
+
}
|
|
597
|
+
|
|
587
598
|
function checkAccessibility(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: ReadonlyArray<AuditPage>): void {
|
|
588
599
|
// AW1 (AW-D14): Israel requires an accessibility statement; a Hebrew site elsewhere is expected to carry one. Block
|
|
589
600
|
// new, warn old: only a site built with the law is held (`siteBuiltWithLaw`).
|
|
@@ -591,8 +602,10 @@ function checkAccessibility(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: Readon
|
|
|
591
602
|
const why = { variant: isIsraeli(snapshot) ? 'israel' : 'hebrew' };
|
|
592
603
|
add(ctx, siteBuiltWithLaw(snapshot) ? SiteFindingCode.NoAccessibilityStatement : SiteFindingCode.AccessibilityStatementAdvised, why);
|
|
593
604
|
}
|
|
605
|
+
const rendered = renderedTrees(snapshot);
|
|
594
606
|
for (const mode of snapshot.design?.modes ?? []) {
|
|
595
|
-
|
|
607
|
+
// AD0 A6: only the pairs the site's pages render — the sweep judges every pairing the look COULD make.
|
|
608
|
+
const failing = renderedContrastFindings(auditDesignContrast(snapshot.design!.rows, mode), rendered).filter(f => !f.pass);
|
|
596
609
|
if (failing.length) add(ctx, SiteFindingCode.LowContrast, { variant: mode, count: failing.length });
|
|
597
610
|
}
|
|
598
611
|
for (const page of pages) {
|
|
@@ -615,7 +628,8 @@ function checkAccessibility(ctx: Ctx, snapshot: SiteAuditSnapshot, pages: Readon
|
|
|
615
628
|
if (!said.has(n.id)) add(ctx, SiteFindingCode.PictureMissing, { variant: 'box' }, { ...where, nodeId: n.id });
|
|
616
629
|
return;
|
|
617
630
|
}
|
|
618
|
-
|
|
631
|
+
// AD0b C9: the switch alone decides — a decorative picture renders `alt=""` in both renderers (design-core imageAlt).
|
|
632
|
+
const decorative = isDecorativeImage(n.props);
|
|
619
633
|
const bound = n.bindings.some(b => b.prop === 'alt');
|
|
620
634
|
if (!decorative && !bound && !nonEmpty(n.props['alt'])) add(ctx, SiteFindingCode.ImageWithoutAlt, null, { ...where, nodeId: n.id });
|
|
621
635
|
});
|
|
@@ -6,7 +6,7 @@ import { NEUTRAL_STYLE_PROPS, NODE_BASELINES } from './node-baselines.generated'
|
|
|
6
6
|
* one of:
|
|
7
7
|
*
|
|
8
8
|
* - **Layout** — a size or spacing that exists only so an EMPTY node dropped from the palette is visible
|
|
9
|
-
* and grabbable (a Container's 200px
|
|
9
|
+
* and grabbable (a Divider's margin; a Container's 200px and a Text's 10px padding until AD0 / AD0b). A composed node is never empty and its
|
|
10
10
|
* pattern owns its box, so the composer RELEASES these to the neutral value unless the pattern
|
|
11
11
|
* declares one: the nav bar was 200px tall and every lead line indented 10px (W1's screenshot).
|
|
12
12
|
* - **Behaviour** — what makes the type work: a button's inline-flex centring, a form's column, the 44px
|
|
@@ -34,13 +34,17 @@ export const BASELINE_ROLES: Readonly<Record<string, Readonly<Record<string, Bas
|
|
|
34
34
|
},
|
|
35
35
|
Card: { width: Behaviour, maxWidth: Layout, padding: Look, borderWidth: Look, borderColor: Look, borderRadius: Look, backgroundColor: Look },
|
|
36
36
|
// `width: 100%` (DEFAULT_WIDTH_BY_TYPE) is what lets a block fill its row — a flex child collapses without it.
|
|
37
|
-
|
|
37
|
+
// AD0b: a palette Container drops with no floor (the canvas's empty slot gives an empty box its room).
|
|
38
|
+
Container: { width: Behaviour },
|
|
38
39
|
Heading: { fontSize: Look, fontWeight: Look },
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
// AD0 B-D1: a palette Text drops content-sized (no 10px padding, no 20px min-height) — nothing left to release.
|
|
41
|
+
Text: { width: Behaviour },
|
|
42
|
+
// AD0 B-D1: a palette Image fills its column at its picture's shape (no 300px cap, no square) — nothing to release.
|
|
43
|
+
Image: { width: Behaviour },
|
|
41
44
|
Link: {},
|
|
42
|
-
LinkedContainer: {
|
|
43
|
-
|
|
45
|
+
LinkedContainer: {},
|
|
46
|
+
// AD0b: no floor; the look's body font (`var(--iox-font-body)`) instead of Poppins — its pre-design-system paint.
|
|
47
|
+
Section: { fontFamily: Look },
|
|
44
48
|
Icon: { lineHeight: Behaviour, fontSize: Behaviour, color: Look },
|
|
45
49
|
Divider: { width: Behaviour, height: Look, margin: Layout, backgroundColor: Look },
|
|
46
50
|
Spacer: { width: Behaviour, height: Behaviour },
|
|
@@ -110,6 +110,9 @@ export const FREE_STYLE_PROPS: ReadonlyArray<string> = [
|
|
|
110
110
|
'fontSize', 'fontWeight', 'lineHeight', 'letterSpacing', 'textTransform', 'textAlign', 'fontStyle',
|
|
111
111
|
'translateX', 'translateY', 'rotate', 'scaleX', 'scaleY', 'transformOrigin',
|
|
112
112
|
'clipPath', 'opacity', 'mixBlendMode', 'objectFit', 'borderWidth', 'borderStyle', 'filter', 'backdropFilter',
|
|
113
|
+
// AD0b Batch C — each a builder control both renderers compile: Line Breaks, Wrap, a picture's focus, a sideways
|
|
114
|
+
// row that snaps and where its children stop, a box's soft edges (a word — `maskFade`, never a colour).
|
|
115
|
+
'whiteSpace', 'textWrap', 'objectPosition', 'scrollSnapType', 'scrollSnapAlign', 'maskFade',
|
|
113
116
|
];
|
|
114
117
|
/** A hover changes position, scale, turn, opacity or a colour token — never layout (Emil: transform / opacity only). */
|
|
115
118
|
export const FREE_HOVER_PROPS: ReadonlyArray<string> = ['translateX', 'translateY', 'scaleX', 'scaleY', 'rotate', 'opacity', 'color', 'backgroundColor', 'borderColor', 'boxShadow'];
|
|
@@ -140,8 +143,15 @@ const columnsOf = (v: unknown) => {
|
|
|
140
143
|
};
|
|
141
144
|
const hasPhoneLayer = (n: FreeNode) => FREE_PHONE_LAYERS.some(bp => Object.keys(n.responsive?.[bp as FreeLayer] ?? {}).length > 0);
|
|
142
145
|
|
|
146
|
+
/** How `freeStyleIssues` reads a style map. */
|
|
147
|
+
export interface FreeStyleRules {
|
|
148
|
+
/** The AI designer (ai-designer-plan §2b): it writes the builder's own controls, so ANY property may be named — the
|
|
149
|
+
* type's slots refuse the rest (`assertStyleSlots`) — and every other rule holds. */
|
|
150
|
+
anyProperty?: boolean;
|
|
151
|
+
}
|
|
152
|
+
|
|
143
153
|
/** One style map against the rules: a known property, one clean value, the look's token where the look owns it. */
|
|
144
|
-
export function freeStyleIssues(style: FreeStyle | undefined, path: string, ctx: Pick<FreeJudgeContext, 'tokens'
|
|
154
|
+
export function freeStyleIssues(style: FreeStyle | undefined, path: string, ctx: Pick<FreeJudgeContext, 'tokens'>, rules: FreeStyleRules = {}): FreeIssue[] {
|
|
145
155
|
const out: FreeIssue[] = [];
|
|
146
156
|
const types = new Map(ctx.tokens.map(t => [t.name, t.type]));
|
|
147
157
|
const say = (code: FreeIssueCode, prop: string, message: string) => out.push({ code, path: `${path}.${prop}`, message });
|
|
@@ -149,7 +159,7 @@ export function freeStyleIssues(style: FreeStyle | undefined, path: string, ctx:
|
|
|
149
159
|
const v = String(raw).trim();
|
|
150
160
|
const kind = FREE_TOKEN_PROPS[prop];
|
|
151
161
|
if (PHYSICAL.test(prop)) { say(FreeIssueCode.Style, prop, 'write sides as start / end (insetInlineStart, marginInlineEnd …) — the site also runs right to left'); continue; }
|
|
152
|
-
if (!kind && !FREE_STYLE_PROPS.includes(prop)) { say(FreeIssueCode.Style, prop, 'not a style property this language has'); continue; }
|
|
162
|
+
if (!kind && !rules.anyProperty && !FREE_STYLE_PROPS.includes(prop)) { say(FreeIssueCode.Style, prop, 'not a style property this language has'); continue; }
|
|
153
163
|
if (!v || UNSAFE.test(v)) { say(FreeIssueCode.Style, prop, 'a value is one plain value — no url(), no ; { } !important'); continue; }
|
|
154
164
|
if (prop === 'textAlign' && /^(left|right)$/.test(v)) { say(FreeIssueCode.Style, prop, 'start | end | center'); continue; }
|
|
155
165
|
const win = WINDOW_WIDTH_UNIT.exec(v);
|
|
@@ -967,7 +967,8 @@ function uniqueIssues(issues: LayoutIssue[]): LayoutIssue[] {
|
|
|
967
967
|
export const LAYOUT_ENTRANCE_MAX_MS = 1200;
|
|
968
968
|
/** The scale an action starts from, where it is not 1 (iox-ui `buildInteractionKeyframes`; held equal by the spec). */
|
|
969
969
|
export const ACTION_START_SCALE: Readonly<Record<string, number>> = { scaleIn: 0.8 };
|
|
970
|
-
|
|
970
|
+
/** The triggers an entrance plays under by itself (the designer's motion check reads the same set). */
|
|
971
|
+
export const LAYOUT_ENTRANCE_TRIGGERS: ReadonlySet<string> = new Set(['viewportEnter', 'pageLoad', 'sceneLand']);
|
|
971
972
|
const EASE_IN = /(^|[\s,(])ease-in(?!-out)/;
|
|
972
973
|
const EASING_TOKEN = /^(cubic-bezier\(|linear(\(|$)|var\(--)/;
|
|
973
974
|
const TRANSITION_ALL = /(^|[\s,])all([\s,]|$)/;
|
|
@@ -990,7 +991,7 @@ export function auditLayoutMotion(nodes: ReadonlyArray<SerializedNode>): LayoutI
|
|
|
990
991
|
const easing = String(a.easing ?? '');
|
|
991
992
|
if (EASE_IN.test(easing)) add(`${ap}.easing`, 'never ease-in: it starts slow where the eye is watching');
|
|
992
993
|
else if (moves && !EASING_TOKEN.test(easing)) add(`${ap}.easing`, `"${easing}" is not an easing token — a cubic-bezier, linear or a var()`);
|
|
993
|
-
if (moves &&
|
|
994
|
+
if (moves && LAYOUT_ENTRANCE_TRIGGERS.has(String(ix.trigger)) && (a.duration ?? 0) > LAYOUT_ENTRANCE_MAX_MS) add(`${ap}.duration`, `${a.duration}ms — an entrance plays in at most ${LAYOUT_ENTRANCE_MAX_MS}ms`);
|
|
994
995
|
const start = ACTION_START_SCALE[String(a.type)];
|
|
995
996
|
if (start !== undefined && start < LIM.minScale) add(`${ap}.type`, `${a.type} starts at scale ${start} — nothing grows from under ${LIM.minScale}`);
|
|
996
997
|
}));
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { AiTokenCounts, AiTokenPrice, costUsd } from './ai-run';
|
|
2
|
+
import { CRITIC_DESIGN_DIMENSIONS, CRITIC_DIMENSIONS, CriticAnswer, criticAnswerIssues, CriticDimension, CriticIssue, CriticIssueCode, criticVerdict, polishOf } from './critic';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* THE CRITIC'S CALIBRATION (ai-designer-plan §7 AD3, R-H8, R-H22, AD-D3): the critic scores the 12 calibration pages
|
|
6
|
+
* (6 proof pages + 6 J10 generated pages) and is compared with the tester's scores of the same pages. R-H8: every page's
|
|
7
|
+
* design mean within 0.5 of the tester's, or AD4 does not start. AD-D3: if the cheaper critic lands within 0.3 of the
|
|
8
|
+
* dearer one, a round's critic switches to it. R-H22: a near-copy of a reference's structure scores no higher than a
|
|
9
|
+
* distinct page of equal craft. Cost per round from each answer's token counts (or the provider's own figure). Reads
|
|
10
|
+
* RECORDED answers only — the run that records them is the host's (iox-cms); this file never calls a model. Pure.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** R-H8: the largest difference from the tester a page may show. */
|
|
14
|
+
export const CALIBRATION_MAX_ERROR = 0.5;
|
|
15
|
+
/** AD-D3: how close the cheaper critic must stay to the dearer one for a round to switch to it. */
|
|
16
|
+
export const CRITIC_SWITCH_WITHIN = 0.3;
|
|
17
|
+
|
|
18
|
+
export enum CalibrationKind {
|
|
19
|
+
/** A page of the designer-loop proof (law, hotel). */
|
|
20
|
+
Proof = 'proof',
|
|
21
|
+
/** A page the generator built (J10). */
|
|
22
|
+
Generated = 'generated',
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/** One calibration page and the tester's scores of it (team/runs/…). */
|
|
26
|
+
export interface CalibrationPage {
|
|
27
|
+
id: string;
|
|
28
|
+
kind: CalibrationKind;
|
|
29
|
+
/** The reference it was scored against. */
|
|
30
|
+
reference: string;
|
|
31
|
+
tester: Record<CriticDimension, number>;
|
|
32
|
+
/** The tester's headline as written (a cap included). */
|
|
33
|
+
testerHeadline: number;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** One critic answer as recorded: the page, the model asked, the parsed answer, what each attempt read and wrote. */
|
|
37
|
+
export interface RecordedCritique {
|
|
38
|
+
pageId: string;
|
|
39
|
+
model: string;
|
|
40
|
+
answer: unknown;
|
|
41
|
+
attempts: ReadonlyArray<{ model: string; tokens: AiTokenCounts }>;
|
|
42
|
+
/** The provider's own figure (OpenRouter `usage.cost`), when it gave one. */
|
|
43
|
+
reportedCostUsd?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface CalibrationRow {
|
|
47
|
+
pageId: string;
|
|
48
|
+
kind: CalibrationKind;
|
|
49
|
+
issues: CriticIssue[];
|
|
50
|
+
/** The critic's and the tester's design means (dimensions 1–7), and their difference (critic − tester). */
|
|
51
|
+
criticMean: number | null;
|
|
52
|
+
testerMean: number;
|
|
53
|
+
error: number | null;
|
|
54
|
+
/** Per dimension, critic − tester (polish included). */
|
|
55
|
+
dimensionErrors: Partial<Record<CriticDimension, number>>;
|
|
56
|
+
criticHeadline: number | null;
|
|
57
|
+
testerHeadline: number;
|
|
58
|
+
/** What the answer cost; null when neither the provider nor the price table could say. */
|
|
59
|
+
costUsd: number | null;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface ModelCalibration {
|
|
63
|
+
model: string;
|
|
64
|
+
rows: CalibrationRow[];
|
|
65
|
+
/** Pages whose answer the gate refused (they count as misses). */
|
|
66
|
+
invalid: number;
|
|
67
|
+
/** Over the valid answers: the mean of |error| and the largest |error|. */
|
|
68
|
+
meanError: number | null;
|
|
69
|
+
maxError: number | null;
|
|
70
|
+
/** R-H8: every calibration page answered, valid, and within `CALIBRATION_MAX_ERROR`. */
|
|
71
|
+
passes: boolean;
|
|
72
|
+
/** Per dimension, the mean critic − tester (a critic that is always kind on Motion shows here). */
|
|
73
|
+
dimensionBias: Partial<Record<CriticDimension, number>>;
|
|
74
|
+
costPerRoundUsd: number | null;
|
|
75
|
+
totalCostUsd: number | null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** R-H22: a page that follows a reference's structure against a distinct page of equal craft. */
|
|
79
|
+
export interface LikenessProbe {
|
|
80
|
+
copy: string;
|
|
81
|
+
distinct: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export interface CalibrationReport {
|
|
85
|
+
models: ModelCalibration[];
|
|
86
|
+
/** AD-D3: the cheaper critic against the dearer, page by page (absent unless both were asked). */
|
|
87
|
+
agreement?: { dearer: string; cheaper: string; meanDifference: number | null; within: boolean };
|
|
88
|
+
/** R-H22, per model: the copy's design mean no higher than the distinct page's. The design mean, not the headline: a
|
|
89
|
+
* broken bug caps a headline at 5 whatever the page resembles, so a capped distinct page would fail the probe on
|
|
90
|
+
* polish, not on likeness (AD3 calibration: every R-H22 failure was law-services' 5.0 cap). */
|
|
91
|
+
likeness: Array<{ model: string; copy: string; distinct: string; copyMean: number | null; distinctMean: number | null; passes: boolean }>;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface CalibrationOptions {
|
|
95
|
+
/** The price of a model, per million tokens — null when unknown. */
|
|
96
|
+
priceOf: (model: string) => AiTokenPrice | null;
|
|
97
|
+
/** The dearer and the cheaper critic, for AD-D3 (`anthropic/claude-opus-5.5`, `anthropic/claude-sonnet-5.5`). */
|
|
98
|
+
compare?: { dearer: string; cheaper: string };
|
|
99
|
+
likenessProbes?: ReadonlyArray<LikenessProbe>;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const mean = (values: ReadonlyArray<number>) => (values.length ? values.reduce((a, b) => a + b, 0) / values.length : null);
|
|
103
|
+
const designMeanOf = (scores: Readonly<Record<CriticDimension, number>>) => mean(CRITIC_DESIGN_DIMENSIONS.map(d => scores[d]))!;
|
|
104
|
+
|
|
105
|
+
/** What one recorded answer cost: the provider's figure, else each attempt at its price; null when a price is missing. */
|
|
106
|
+
export function critiqueCostUsd(recorded: Pick<RecordedCritique, 'attempts' | 'reportedCostUsd'>, priceOf: CalibrationOptions['priceOf']): number | null {
|
|
107
|
+
if (recorded.reportedCostUsd !== undefined) return recorded.reportedCostUsd;
|
|
108
|
+
let total = 0;
|
|
109
|
+
for (const a of recorded.attempts) {
|
|
110
|
+
const price = priceOf(a.model);
|
|
111
|
+
if (!price) return null;
|
|
112
|
+
total += costUsd(a.tokens, price);
|
|
113
|
+
}
|
|
114
|
+
return total;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function rowOf(page: CalibrationPage, recorded: RecordedCritique | undefined, options: CalibrationOptions): CalibrationRow {
|
|
118
|
+
const testerMean = designMeanOf(page.tester);
|
|
119
|
+
const base = { pageId: page.id, kind: page.kind, testerMean, testerHeadline: page.testerHeadline };
|
|
120
|
+
if (!recorded) {
|
|
121
|
+
return { ...base, issues: [{ code: CriticIssueCode.Shape, path: '', message: 'no recorded answer' }], criticMean: null, error: null, dimensionErrors: {}, criticHeadline: null, costUsd: null };
|
|
122
|
+
}
|
|
123
|
+
const costUsd = critiqueCostUsd(recorded, options.priceOf);
|
|
124
|
+
const issues = criticAnswerIssues(recorded.answer, { reference: page.reference });
|
|
125
|
+
if (issues.length) return { ...base, issues, criticMean: null, error: null, dimensionErrors: {}, criticHeadline: null, costUsd };
|
|
126
|
+
const answer = recorded.answer as CriticAnswer;
|
|
127
|
+
const verdict = criticVerdict(answer);
|
|
128
|
+
const scoreOf = (d: CriticDimension) => (d === CriticDimension.Polish ? polishOf(answer) : answer.scores[d].score);
|
|
129
|
+
const dimensionErrors = Object.fromEntries(CRITIC_DIMENSIONS.map(d => [d, scoreOf(d) - page.tester[d]])) as Record<CriticDimension, number>;
|
|
130
|
+
return { ...base, issues, criticMean: verdict.designMean, error: verdict.designMean - testerMean, dimensionErrors, criticHeadline: verdict.headline, costUsd };
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function modelOf(model: string, pages: ReadonlyArray<CalibrationPage>, answers: ReadonlyArray<RecordedCritique>, options: CalibrationOptions): ModelCalibration {
|
|
134
|
+
const rows = pages.map(p => rowOf(p, answers.find(a => a.model === model && a.pageId === p.id), options));
|
|
135
|
+
const valid = rows.filter(r => r.error !== null);
|
|
136
|
+
const errors = valid.map(r => Math.abs(r.error!));
|
|
137
|
+
const costs = rows.map(r => r.costUsd);
|
|
138
|
+
const known = costs.every(c => c !== null);
|
|
139
|
+
const dimensionBias = Object.fromEntries(CRITIC_DIMENSIONS.map(d => [d, mean(valid.map(r => r.dimensionErrors[d]!))])
|
|
140
|
+
.filter(([, v]) => v !== null)) as Partial<Record<CriticDimension, number>>;
|
|
141
|
+
return {
|
|
142
|
+
model,
|
|
143
|
+
rows,
|
|
144
|
+
invalid: rows.length - valid.length,
|
|
145
|
+
meanError: mean(errors),
|
|
146
|
+
maxError: errors.length ? Math.max(...errors) : null,
|
|
147
|
+
passes: valid.length === rows.length && errors.every(e => e <= CALIBRATION_MAX_ERROR),
|
|
148
|
+
dimensionBias,
|
|
149
|
+
costPerRoundUsd: known ? mean(costs as number[]) : null,
|
|
150
|
+
totalCostUsd: known ? (costs as number[]).reduce((a, b) => a + b, 0) : null,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/** The calibration of every model that answered, the AD-D3 agreement and the R-H22 probes. */
|
|
155
|
+
export function calibrationReport(pages: ReadonlyArray<CalibrationPage>, answers: ReadonlyArray<RecordedCritique>, options: CalibrationOptions): CalibrationReport {
|
|
156
|
+
const models = [...new Set(answers.map(a => a.model))].map(m => modelOf(m, pages, answers, options));
|
|
157
|
+
const byModel = new Map(models.map(m => [m.model, m]));
|
|
158
|
+
let agreement: CalibrationReport['agreement'];
|
|
159
|
+
const dearer = options.compare && byModel.get(options.compare.dearer);
|
|
160
|
+
const cheaper = options.compare && byModel.get(options.compare.cheaper);
|
|
161
|
+
if (options.compare && dearer && cheaper) {
|
|
162
|
+
const differences = pages.map((p, i) => {
|
|
163
|
+
const a = dearer.rows[i].criticMean;
|
|
164
|
+
const b = cheaper.rows[i].criticMean;
|
|
165
|
+
return a === null || b === null ? null : Math.abs(a - b);
|
|
166
|
+
});
|
|
167
|
+
const both = differences.filter((d): d is number => d !== null);
|
|
168
|
+
const meanDifference = both.length === pages.length ? mean(both) : null;
|
|
169
|
+
agreement = { ...options.compare, meanDifference, within: meanDifference !== null && meanDifference <= CRITIC_SWITCH_WITHIN };
|
|
170
|
+
}
|
|
171
|
+
const likeness = models.flatMap(m => (options.likenessProbes ?? []).map(probe => {
|
|
172
|
+
const designMean = (id: string) => m.rows.find(r => r.pageId === id)?.criticMean ?? null;
|
|
173
|
+
const copyMean = designMean(probe.copy);
|
|
174
|
+
const distinctMean = designMean(probe.distinct);
|
|
175
|
+
return { model: m.model, ...probe, copyMean, distinctMean, passes: copyMean !== null && distinctMean !== null && copyMean <= distinctMean };
|
|
176
|
+
}));
|
|
177
|
+
return { models, agreement, likeness };
|
|
178
|
+
}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { CRITIC_CHANGES, CRITIC_SCORE, CriticAnswer, criticVerdict } from './critic';
|
|
2
|
+
import { CRITIC_RUBRIC_DIMENSIONS, CRITIC_RUBRIC_HEADLINE, CRITIC_RUBRIC_POLISH, CRITIC_RUBRIC_SOURCE } from './critic-rubric.generated';
|
|
3
|
+
import { CaptureBox, CaptureView, CaptureWidth, CritiqueSheet, SheetPair } from './critic-sheet';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* THE CRITIC'S PROMPT (ai-designer-plan §2d, AD3, AD-D18, R-H22): the instructions (stable — cached across rounds) and one
|
|
7
|
+
* round's turn. The rubric is the tester's own (`critic-rubric.generated.ts`, ported from `team/reference-score.md` §2),
|
|
8
|
+
* so the critic and the tester score by the same words; the level rule is said in so many words: as good as the
|
|
9
|
+
* reference, never like it. The turn carries the art direction, the reference's card, the sheet (the reference's views,
|
|
10
|
+
* then ours under the same labels, then crops), the measures, the gate's findings and the last critique. The host turns the picture items into its transport's image
|
|
11
|
+
* blocks (iox-cms: `AiContent`). Pure.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** A block of the instructions; the last stable one carries the cache mark (iox-cms `AiPromptPart`). */
|
|
15
|
+
export interface CriticPromptPart {
|
|
16
|
+
text: string;
|
|
17
|
+
cache?: boolean;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/** One item of the round's turn: words, a shot, or a zoomed crop of a shot (the host cuts and enlarges it). `cache` marks
|
|
21
|
+
* the end of the turn's stable prefix (iox-cms: the block's cache mark). */
|
|
22
|
+
export enum CriticContentKind {
|
|
23
|
+
Text = 'text',
|
|
24
|
+
Image = 'image',
|
|
25
|
+
Crop = 'crop',
|
|
26
|
+
}
|
|
27
|
+
export type CriticContent =
|
|
28
|
+
| { kind: CriticContentKind.Text; text: string; cache?: boolean }
|
|
29
|
+
| { kind: CriticContentKind.Image; ref: string; w: number; h: number; cache?: boolean }
|
|
30
|
+
| { kind: CriticContentKind.Crop; ref: string; box: CaptureBox; zoom: number; cache?: boolean };
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* How the sheet's pairs are laid out in the turn.
|
|
34
|
+
* - `Cached` (the default): the reference's shots first, every view labelled, ending in the cache mark; then ours under
|
|
35
|
+
* the same labels. The reference does not change between rounds, so from round 2 it is read from the cache (§6b
|
|
36
|
+
* prices it at the cache-hit rate) — a prefix only caches if nothing that changes comes before it.
|
|
37
|
+
* - `Paired`: each view reference then ours, side by side in the turn; nothing after the instructions caches.
|
|
38
|
+
* AD3 calibrates the layout AD4 will run, so the default is the cached one.
|
|
39
|
+
*/
|
|
40
|
+
export enum CriticSheetLayout {
|
|
41
|
+
Cached = 'cached',
|
|
42
|
+
Paired = 'paired',
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** AD-D18, in the words the critic reads. */
|
|
46
|
+
export const CRITIC_LEVEL_RULE = 'Score the LEVEL, never the likeness. Ask "is this page as good as the reference?", never "does it look '
|
|
47
|
+
+ 'like it?". Resemblance earns nothing: a page that borrows the reference\'s arrangement scores no higher than a different page made '
|
|
48
|
+
+ 'with the same care, and a page unlike the reference can score 10. The reference and its card show the standard to reach — its '
|
|
49
|
+
+ 'precision, its restraint, its finish — not a design to copy.';
|
|
50
|
+
|
|
51
|
+
/** What a still sheet cannot show (AD3 calibration: a third of the critic's bugs, and every 5.0 cap on a proof page, were
|
|
52
|
+
* a Scene's scroll runway or an unplayed reveal on the whole-page view, or a menu caught mid-fade). */
|
|
53
|
+
export const CRITIC_STILL_RULE = 'THE SHOTS ARE STILL. The whole-page view is taken in one frame: a Scene pins its picture while '
|
|
54
|
+
+ 'the visitor scrolls through a tall runway, and a reveal waits for the visitor to reach it — on that view both show as a tall '
|
|
55
|
+
+ 'empty band. That band is not a bug and not a fault of composition: judge the Scene and the reveals under motion, from the '
|
|
56
|
+
+ 'Scene views when the sheet has them. A band is a bug only when a screen-sized view, taken while scrolling like a visitor (the '
|
|
57
|
+
+ 'first screen, the header after scrolling, the footer, a list), shows it empty too. Likewise a view that shows two states at '
|
|
58
|
+
+ 'once (a menu half over the page, a logo drawn twice) was caught mid-transition: say so under motion, never mark it broken.';
|
|
59
|
+
|
|
60
|
+
/** What a bug is, so one fault is scored once (AD3 calibration: the critic listed ≈ 3× the tester's bugs). */
|
|
61
|
+
export const CRITIC_BUG_RULE = 'A BUG is a fault in the build a visitor would notice: words over words, a cut-off line, an empty '
|
|
62
|
+
+ 'frame where a picture belongs, a dead button, a contrast fail, placeholder text. A design choice — spacing, rhythm, an '
|
|
63
|
+
+ 'off palette, a weak picture — is not a bug: it is scored in its own dimension, once. Never list one fault twice, and never '
|
|
64
|
+
+ 'list it as a bug AND lower a design dimension for it.';
|
|
65
|
+
|
|
66
|
+
const WIDTH_WORDS: Readonly<Record<CaptureWidth, string>> = { [CaptureWidth.Laptop]: 'Laptop 1440', [CaptureWidth.Phone]: 'Phone 390' };
|
|
67
|
+
const VIEW_WORDS: Readonly<Record<CaptureView, string>> = {
|
|
68
|
+
[CaptureView.First]: 'the first screen',
|
|
69
|
+
[CaptureView.HeaderOpen]: 'the menu open',
|
|
70
|
+
[CaptureView.HeaderScrolled]: 'the header after scrolling down and up',
|
|
71
|
+
[CaptureView.Down1]: 'one screen down',
|
|
72
|
+
[CaptureView.Down2]: '2.2 screens down',
|
|
73
|
+
[CaptureView.List]: 'a list',
|
|
74
|
+
[CaptureView.Scene25]: 'the Scene at 25%',
|
|
75
|
+
[CaptureView.Scene50]: 'the Scene at 50%',
|
|
76
|
+
[CaptureView.Scene90]: 'the Scene at 90%',
|
|
77
|
+
[CaptureView.Reduced]: 'reduced motion',
|
|
78
|
+
[CaptureView.Footer]: 'the footer',
|
|
79
|
+
[CaptureView.Full]: 'the whole page, scaled down',
|
|
80
|
+
};
|
|
81
|
+
/** The label of a view the reference has no shot of (a Scene stop): ours is judged for motion on its own. */
|
|
82
|
+
export const OURS_ALONE_WORDS = 'ours alone (the reference has no such view) — judge our motion: the Scene as the visitor scrolls';
|
|
83
|
+
const where = (width: CaptureWidth, view: CaptureView) => `${WIDTH_WORDS[width]} · ${VIEW_WORDS[view]}`;
|
|
84
|
+
|
|
85
|
+
/** The rubric as the critic reads it: each dimension with what it compares, then the headline and the polish rule. */
|
|
86
|
+
export function criticRubricText(): string {
|
|
87
|
+
return [
|
|
88
|
+
`THE RUBRIC (${CRITIC_RUBRIC_SOURCE.file} ${CRITIC_RUBRIC_SOURCE.section}). Score each dimension ${CRITIC_SCORE.min}–${CRITIC_SCORE.max} in half points:`,
|
|
89
|
+
...CRITIC_RUBRIC_DIMENSIONS.map(d => `${d.n}. ${d.name} ("${d.key}") — compare: ${d.compares}`),
|
|
90
|
+
CRITIC_RUBRIC_HEADLINE,
|
|
91
|
+
`Polish: list every bug you see; each costs ${CRITIC_RUBRIC_POLISH.bugPenalty}. Mark "broken" any a visitor would call broken (a link to `
|
|
92
|
+
+ `"page not found", words over words, a cut-off line, a dead button): one broken bug caps the page at ${CRITIC_RUBRIC_POLISH.brokenCap}. `
|
|
93
|
+
+ 'The headline is computed from your scores; do not write it.',
|
|
94
|
+
].join('\n');
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The instructions, stable across rounds and pages (the cache mark is on the last part). */
|
|
98
|
+
export function criticSystem(): CriticPromptPart[] {
|
|
99
|
+
return [
|
|
100
|
+
{
|
|
101
|
+
text: 'You are the critic of an AI designer\'s round. You look at one page of a website — screenshots of OUR page beside the '
|
|
102
|
+
+ 'REFERENCE site the owner admires, view by view, then zoomed crops — and you score our page by the rubric below, the one '
|
|
103
|
+
+ 'IOX\'s tester scores by. You judge what is on the screenshots, nothing else.',
|
|
104
|
+
},
|
|
105
|
+
{ text: CRITIC_LEVEL_RULE },
|
|
106
|
+
{ text: criticRubricText() },
|
|
107
|
+
{ text: `${CRITIC_STILL_RULE}\n${CRITIC_BUG_RULE}` },
|
|
108
|
+
{
|
|
109
|
+
text: [
|
|
110
|
+
'EVIDENCE: one line per dimension, read off the sheet as a position, a size or a colour — "<reference> sets the hero at '
|
|
111
|
+
+ '≈ 100px on paper #FFFFFC; ours sets it at 64px on #F3F0EA". A line with no measurement is refused.',
|
|
112
|
+
`CHANGES: ${CRITIC_CHANGES.min}–${CRITIC_CHANGES.max}, the ones that move the LOWEST score most, at least one aimed at it. Write `
|
|
113
|
+
+ 'each as a brief for the designer, in our own terms (what to change, where, by how much). Never name the reference in a '
|
|
114
|
+
+ 'brief, and never ask to copy it or make it look like it.',
|
|
115
|
+
'Answer with the critique object only.',
|
|
116
|
+
].join('\n'),
|
|
117
|
+
cache: true,
|
|
118
|
+
},
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export interface CriticRoundInput {
|
|
123
|
+
/** The page (`law-home`) and its language. */
|
|
124
|
+
page: string;
|
|
125
|
+
locale: string;
|
|
126
|
+
/** The reference's name (`graya-institute`) and its card (team/reference-cards/<name>.md). */
|
|
127
|
+
reference: string;
|
|
128
|
+
referenceCard: string;
|
|
129
|
+
/** The art direction the round works to (AD4); absent in calibration. */
|
|
130
|
+
artDirection?: string;
|
|
131
|
+
/** The measures, one line each (AD2's; the tester's metrics today). */
|
|
132
|
+
measures?: ReadonlyArray<string>;
|
|
133
|
+
/** The gate's findings, one line each. */
|
|
134
|
+
gateFindings?: ReadonlyArray<string>;
|
|
135
|
+
/** The last round's critique, when there was one. */
|
|
136
|
+
lastCritique?: CriticAnswer;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** One round's turn: the stable part (art direction, card, the reference's shots — cached), then the page, ours, the
|
|
140
|
+
* crops, the measures, the gate's findings, the last critique. */
|
|
141
|
+
export function criticRoundContent(input: CriticRoundInput, sheet: CritiqueSheet, layout = CriticSheetLayout.Cached): CriticContent[] {
|
|
142
|
+
const text = (t: string): CriticContent => ({ kind: CriticContentKind.Text, text: t });
|
|
143
|
+
const shot = (s: SheetPair['ours']): CriticContent => ({ kind: CriticContentKind.Image, ref: s.ref, w: s.w, h: s.h });
|
|
144
|
+
const page = text(`OUR PAGE: ${input.page} (${input.locale}). THE REFERENCE: ${input.reference}.`);
|
|
145
|
+
const out: CriticContent[] = [];
|
|
146
|
+
if (input.artDirection) out.push(text(`THE ART DIRECTION:\n${input.artDirection}`));
|
|
147
|
+
out.push(text(`THE REFERENCE'S CARD (its level, in words and numbers — not a design to copy):\n${input.referenceCard}`));
|
|
148
|
+
if (layout === CriticSheetLayout.Cached) {
|
|
149
|
+
out.push(text(`THE REFERENCE, ${input.reference}, view by view:`));
|
|
150
|
+
for (const p of sheet.pairs) if (p.reference) out.push(text(`${where(p.width, p.view)} — the reference:`), shot(p.reference));
|
|
151
|
+
out[out.length - 1] = { ...out[out.length - 1], cache: true };
|
|
152
|
+
out.push(page, text('OUR PAGE, the same views:'));
|
|
153
|
+
for (const p of sheet.pairs) out.push(text(`${where(p.width, p.view)} — ${p.reference ? 'ours' : OURS_ALONE_WORDS}:`), shot(p.ours));
|
|
154
|
+
} else {
|
|
155
|
+
out.unshift(page);
|
|
156
|
+
for (const p of sheet.pairs) {
|
|
157
|
+
if (p.reference) out.push(text(`${where(p.width, p.view)} — the reference:`), shot(p.reference));
|
|
158
|
+
out.push(text(`${where(p.width, p.view)} — ${p.reference ? 'ours' : OURS_ALONE_WORDS}:`), shot(p.ours));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
sheet.crops.forEach((c, i) => {
|
|
162
|
+
const head = `Crop ${i + 1}, ${c.why} (${where(c.width, c.view)}, ×${c.zoom})`;
|
|
163
|
+
if (c.reference) out.push(text(`${head} — the reference:`), { kind: CriticContentKind.Crop, ref: c.reference.ref, box: c.reference.box, zoom: c.zoom });
|
|
164
|
+
out.push(text(`${head} — ours:`), { kind: CriticContentKind.Crop, ref: c.ours.ref, box: c.ours.box, zoom: c.zoom });
|
|
165
|
+
});
|
|
166
|
+
if (input.measures?.length) out.push(text(`THE MEASURES (ours):\n${input.measures.join('\n')}`));
|
|
167
|
+
if (input.gateFindings?.length) out.push(text(`THE GATE'S FINDINGS:\n${input.gateFindings.join('\n')}`));
|
|
168
|
+
if (input.lastCritique) {
|
|
169
|
+
const v = criticVerdict(input.lastCritique);
|
|
170
|
+
out.push(text(`THE LAST ROUND'S CRITIQUE (headline ${v.headline.toFixed(1)}), to see what moved:\n${JSON.stringify(input.lastCritique)}`));
|
|
171
|
+
}
|
|
172
|
+
out.push(text('Score our page.'));
|
|
173
|
+
return out;
|
|
174
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// GENERATED from iox-ai-guidance team/reference-score.md §2 by scripts/gen-critic-rubric.mjs — do not edit;
|
|
2
|
+
// re-run npm run gen:critic-rubric. The tester's rubric, ported for the AI designer's critic (ai-designer-plan §2d).
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
/** Where the rubric came from, and a hash of its section (a changed rubric is a new hash). */
|
|
6
|
+
export const CRITIC_RUBRIC_SOURCE = { file: 'team/reference-score.md', section: '§2', hash: "8cd817ffacc8" } as const;
|
|
7
|
+
|
|
8
|
+
/** The eight dimensions in the rubric's order: the key the critic answers under, the name, what is compared. */
|
|
9
|
+
export const CRITIC_RUBRIC_DIMENSIONS: ReadonlyArray<{ readonly n: number; readonly key: string; readonly name: string; readonly compares: string }> = [
|
|
10
|
+
{ n: 1, key: "colour", name: "Colour", compares: "ground colour, how much accent and where, dark bands vs grey-black, palette harmony. Numbers: dominant colours, ΔE to the nearest target palette, contrast" },
|
|
11
|
+
{ n: 2, key: "type", name: "Type", compares: "the display face's character, hero size ÷ body size, weights, tracking, uppercase use. Numbers: hero px, ratio, families" },
|
|
12
|
+
{ n: 3, key: "composition", name: "Composition", compares: "column width, whitespace rhythm, asymmetry and overlap, section variety (two sections in a row on one skeleton = a fault). Numbers: content width, section padding, distinct skeletons per page" },
|
|
13
|
+
{ n: 4, key: "imagery", name: "Imagery", compares: "share of the screen that is picture, full-bleed use, crops, on-subject (an empty picture frame is a Polish bug, not scored here again). Numbers: picture area % per screen" },
|
|
14
|
+
{ n: 5, key: "header", name: "Header", compares: "shape, behaviour on scroll, menu (shelves, full screen), how it sits on the opening picture" },
|
|
15
|
+
{ n: 6, key: "footer", name: "Footer", compares: "layout, richness (newsletter, social, facts), ground, legal row" },
|
|
16
|
+
{ n: 7, key: "motion", name: "Motion & feel", compares: "scroll scenes, reveals, hover, page transitions, smoothness on the phone" },
|
|
17
|
+
{ n: 8, key: "polish", name: "Polish (UI bugs)", compares: "overlaps, clipped text, misalignment, broken 390 layout, contrast fails, placeholder text, empty boxes. A bug is a fault in the build, counted here once and never again in 1–7; a design choice (spacing, rhythm, palette) is scored in its own dimension, not here. A still capture's blank Scene runway, an unplayed reveal or a menu caught mid-fade is not a bug. Each bug −1. Any bug a visitor would call broken caps the whole score at 5. Every bug becomes a GitHub issue" },
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
/** The headline rule, in the rubric's words. */
|
|
21
|
+
export const CRITIC_RUBRIC_HEADLINE = "Headline = the mean of 1–7, capped by 8. Every score has one sentence of evidence: \"hotelaurelia does X; ours does Y\", with the two crops side by side. The scale: 9–10 the reference's own level (a target reference scores 8–10, §3.1); 8 it stands beside the reference; 6 a careful template; 5 competent and plain; 3 unfinished.";
|
|
22
|
+
|
|
23
|
+
/** The polish row's numbers: what each bug costs, and the cap a bug a visitor would call broken puts on the page. */
|
|
24
|
+
export const CRITIC_RUBRIC_POLISH = { bugPenalty: 1, brokenCap: 5 } as const;
|