@vectoriox/iox-ui 5.204.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/design-core/index.d.ts +9 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs +11 -1
- package/fesm2022/vectoriox-iox-ui-design-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs +165 -36
- package/fesm2022/vectoriox-iox-ui-generation-core.mjs.map +1 -1
- package/fesm2022/vectoriox-iox-ui.mjs +145 -82
- package/fesm2022/vectoriox-iox-ui.mjs.map +1 -1
- package/generation-core/index.d.ts +59 -15
- package/index.d.ts +44 -3
- package/package.json +1 -1
- package/src/design-core/node-links.ts +12 -0
- package/src/generation-core/ai-run.ts +31 -0
- package/src/generation-core/critic-calibration.ts +11 -8
- package/src/generation-core/critic-prompt.ts +24 -3
- package/src/generation-core/critic-rubric.generated.ts +4 -4
- package/src/generation-core/critic-sheet.ts +73 -6
- package/src/generation-core/critic.ts +27 -13
- package/src/generation-core/designer-brief.ts +4 -3
- package/src/generation-core/designer-estimate.ts +3 -3
|
@@ -48,6 +48,21 @@ export const CRITIC_LEVEL_RULE = 'Score the LEVEL, never the likeness. Ask "is t
|
|
|
48
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
49
|
+ 'precision, its restraint, its finish — not a design to copy.';
|
|
50
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
|
+
|
|
51
66
|
const WIDTH_WORDS: Readonly<Record<CaptureWidth, string>> = { [CaptureWidth.Laptop]: 'Laptop 1440', [CaptureWidth.Phone]: 'Phone 390' };
|
|
52
67
|
const VIEW_WORDS: Readonly<Record<CaptureView, string>> = {
|
|
53
68
|
[CaptureView.First]: 'the first screen',
|
|
@@ -63,6 +78,8 @@ const VIEW_WORDS: Readonly<Record<CaptureView, string>> = {
|
|
|
63
78
|
[CaptureView.Footer]: 'the footer',
|
|
64
79
|
[CaptureView.Full]: 'the whole page, scaled down',
|
|
65
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';
|
|
66
83
|
const where = (width: CaptureWidth, view: CaptureView) => `${WIDTH_WORDS[width]} · ${VIEW_WORDS[view]}`;
|
|
67
84
|
|
|
68
85
|
/** The rubric as the critic reads it: each dimension with what it compares, then the headline and the polish rule. */
|
|
@@ -87,6 +104,7 @@ export function criticSystem(): CriticPromptPart[] {
|
|
|
87
104
|
},
|
|
88
105
|
{ text: CRITIC_LEVEL_RULE },
|
|
89
106
|
{ text: criticRubricText() },
|
|
107
|
+
{ text: `${CRITIC_STILL_RULE}\n${CRITIC_BUG_RULE}` },
|
|
90
108
|
{
|
|
91
109
|
text: [
|
|
92
110
|
'EVIDENCE: one line per dimension, read off the sheet as a position, a size or a colour — "<reference> sets the hero at '
|
|
@@ -129,13 +147,16 @@ export function criticRoundContent(input: CriticRoundInput, sheet: CritiqueSheet
|
|
|
129
147
|
out.push(text(`THE REFERENCE'S CARD (its level, in words and numbers — not a design to copy):\n${input.referenceCard}`));
|
|
130
148
|
if (layout === CriticSheetLayout.Cached) {
|
|
131
149
|
out.push(text(`THE REFERENCE, ${input.reference}, view by view:`));
|
|
132
|
-
for (const p of sheet.pairs) out.push(text(`${where(p.width, p.view)} — the reference:`), shot(p.reference));
|
|
150
|
+
for (const p of sheet.pairs) if (p.reference) out.push(text(`${where(p.width, p.view)} — the reference:`), shot(p.reference));
|
|
133
151
|
out[out.length - 1] = { ...out[out.length - 1], cache: true };
|
|
134
152
|
out.push(page, text('OUR PAGE, the same views:'));
|
|
135
|
-
for (const p of sheet.pairs) out.push(text(`${where(p.width, p.view)} — ours:`), shot(p.ours));
|
|
153
|
+
for (const p of sheet.pairs) out.push(text(`${where(p.width, p.view)} — ${p.reference ? 'ours' : OURS_ALONE_WORDS}:`), shot(p.ours));
|
|
136
154
|
} else {
|
|
137
155
|
out.unshift(page);
|
|
138
|
-
for (const p of sheet.pairs)
|
|
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
|
+
}
|
|
139
160
|
}
|
|
140
161
|
sheet.crops.forEach((c, i) => {
|
|
141
162
|
const head = `Crop ${i + 1}, ${c.why} (${where(c.width, c.view)}, ×${c.zoom})`;
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
/* eslint-disable */
|
|
4
4
|
|
|
5
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: "
|
|
6
|
+
export const CRITIC_RUBRIC_SOURCE = { file: 'team/reference-score.md', section: '§2', hash: "8cd817ffacc8" } as const;
|
|
7
7
|
|
|
8
8
|
/** The eight dimensions in the rubric's order: the key the critic answers under, the name, what is compared. */
|
|
9
9
|
export const CRITIC_RUBRIC_DIMENSIONS: ReadonlyArray<{ readonly n: number; readonly key: string; readonly name: string; readonly compares: string }> = [
|
|
10
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
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
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
|
|
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
14
|
{ n: 5, key: "header", name: "Header", compares: "shape, behaviour on scroll, menu (shelves, full screen), how it sits on the opening picture" },
|
|
15
15
|
{ n: 6, key: "footer", name: "Footer", compares: "layout, richness (newsletter, social, facts), ground, legal row" },
|
|
16
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. Each bug −1. Any bug a visitor would call broken caps the whole score at 5. Every bug becomes a GitHub issue" },
|
|
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
18
|
];
|
|
19
19
|
|
|
20
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.";
|
|
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
22
|
|
|
23
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
24
|
export const CRITIC_RUBRIC_POLISH = { bugPenalty: 1, brokenCap: 5 } as const;
|
|
@@ -91,14 +91,19 @@ export function visionImageTokens(w: number, h: number): number {
|
|
|
91
91
|
return Math.min(Math.ceil(w / VISION_TOKEN_TILE) * Math.ceil(h / VISION_TOKEN_TILE), VISION_TOKEN_CAP);
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
/**
|
|
94
|
+
/** One view on the sheet: the reference's and ours. A Scene stop may be OURS ALONE (`reference` absent): a reference is not
|
|
95
|
+
* an IOX site, so its capture has no Scene stills, and without ours the critic judged motion from a whole-page view where a
|
|
96
|
+
* Scene is a blank runway (AD3 calibration; the lead, 2026-12-01). */
|
|
95
97
|
export interface SheetPair {
|
|
96
98
|
width: CaptureWidth;
|
|
97
99
|
view: CaptureView;
|
|
98
|
-
reference
|
|
100
|
+
reference?: CaptureShot;
|
|
99
101
|
ours: CaptureShot;
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
/** The views the sheet shows of ours even when the reference has none: the Scene stops, where motion is judged. */
|
|
105
|
+
export const OURS_ALONE_VIEWS: ReadonlyArray<CaptureView> = [CaptureView.Scene25, CaptureView.Scene50, CaptureView.Scene90];
|
|
106
|
+
|
|
102
107
|
/** A zoomed crop: the box on a shot, how much it is enlarged, and why it was chosen. `reference` crops the same place on
|
|
103
108
|
* the reference's shot, for a side by side (a flagged defect of ours has none). */
|
|
104
109
|
export interface SheetCrop {
|
|
@@ -115,6 +120,8 @@ export interface CritiqueSheet {
|
|
|
115
120
|
crops: SheetCrop[];
|
|
116
121
|
/** The views one side has and the other has not (`phone/footer: no reference shot`). */
|
|
117
122
|
missing: string[];
|
|
123
|
+
/** What left the sheet to keep it inside `CRITIC_SHEET_MAX_IMAGES` (`phone/first`, `crop: the phone footer`), in order. */
|
|
124
|
+
dropped: string[];
|
|
118
125
|
/** The image tokens the sheet costs a vision model (pairs, then each crop at its zoom). */
|
|
119
126
|
imageTokens: number;
|
|
120
127
|
/** Of those, the reference's views — the share read from the cache from round 2 (`CriticSheetLayout.Cached`). */
|
|
@@ -158,11 +165,69 @@ function zoomOf(box: CaptureBox): number {
|
|
|
158
165
|
}
|
|
159
166
|
|
|
160
167
|
/**
|
|
161
|
-
* The
|
|
168
|
+
* The most pictures one sheet sends (the lead, 2026-12-01, after AD3's first live call): the Claude API holds every picture
|
|
169
|
+
* of a request with more than 20 to 2000 px a side, which leaves a full-page overview ≈ 290 px wide. At ≤ 20 a picture may
|
|
170
|
+
* be 8000 px a side, so the full page stays readable.
|
|
171
|
+
*/
|
|
172
|
+
export const CRITIC_SHEET_MAX_IMAGES = 20;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The order views leave a sheet that is over the limit: first the phone views the sheet already shows another way — the
|
|
176
|
+
* opening and the footer (the phone crops enlarge them), then the rest of the phone's screens, which the laptop's views
|
|
177
|
+
* and the phone's full page cover — then the menu open, phone and laptop. The full pages and the laptop's own screens stay.
|
|
178
|
+
*/
|
|
179
|
+
export const CRITIC_SHEET_DROP_ORDER: ReadonlyArray<readonly [CaptureWidth, CaptureView]> = [
|
|
180
|
+
...[CaptureView.First, CaptureView.Footer, CaptureView.HeaderScrolled, CaptureView.Down1, CaptureView.Down2, CaptureView.List,
|
|
181
|
+
CaptureView.Scene25, CaptureView.Scene50, CaptureView.Scene90, CaptureView.Reduced].map(v => [CaptureWidth.Phone, v] as const),
|
|
182
|
+
[CaptureWidth.Phone, CaptureView.HeaderOpen],
|
|
183
|
+
[CaptureWidth.Laptop, CaptureView.HeaderOpen],
|
|
184
|
+
// the laptop Scene's ends; its middle (50 %) stays as long as any crop beyond the fewest can go
|
|
185
|
+
[CaptureWidth.Laptop, CaptureView.Scene25],
|
|
186
|
+
[CaptureWidth.Laptop, CaptureView.Scene90],
|
|
187
|
+
];
|
|
188
|
+
|
|
189
|
+
/** The pairs no sheet drops, however full: the laptop's opening and both full pages. */
|
|
190
|
+
const SHEET_KEEPS: ReadonlyArray<readonly [CaptureWidth, CaptureView]> = [
|
|
191
|
+
[CaptureWidth.Laptop, CaptureView.First], [CaptureWidth.Laptop, CaptureView.Full], [CaptureWidth.Phone, CaptureView.Full],
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
/** The pictures a sheet sends: ours of every pair and crop, and the reference's where it has one. */
|
|
195
|
+
export function sheetImageCount(sheet: Pick<CritiqueSheet, 'pairs' | 'crops'>): number {
|
|
196
|
+
return sheet.pairs.reduce((n, p) => n + (p.reference ? 2 : 1), 0) + sheet.crops.reduce((n, c) => n + (c.reference ? 2 : 1), 0);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Bring a sheet to at most `max` pictures: the views in `CRITIC_SHEET_DROP_ORDER`, one at a time; then the crops from the
|
|
201
|
+
* last down to the fewest (`CRITIC_CROPS.min`); then, only if still over, the remaining pairs from the last, never the
|
|
202
|
+
* opening or a full page. Every step is recorded in `dropped`.
|
|
203
|
+
*/
|
|
204
|
+
function fitSheet(pairs: SheetPair[], crops: SheetCrop[], max: number): string[] {
|
|
205
|
+
const dropped: string[] = [];
|
|
206
|
+
const over = () => sheetImageCount({ pairs, crops }) > max;
|
|
207
|
+
const dropPair = (width: CaptureWidth, view: CaptureView) => {
|
|
208
|
+
const i = pairs.findIndex(p => p.width === width && p.view === view);
|
|
209
|
+
if (i < 0) return;
|
|
210
|
+
pairs.splice(i, 1);
|
|
211
|
+
dropped.push(`${width}/${view}`);
|
|
212
|
+
};
|
|
213
|
+
for (const [width, view] of CRITIC_SHEET_DROP_ORDER) {
|
|
214
|
+
if (!over()) return dropped;
|
|
215
|
+
dropPair(width, view);
|
|
216
|
+
}
|
|
217
|
+
while (over() && crops.length > CRITIC_CROPS.min) dropped.push(`crop: ${crops.pop()!.why}`);
|
|
218
|
+
const kept = (p: SheetPair) => SHEET_KEEPS.some(([w, v]) => p.width === w && p.view === v);
|
|
219
|
+
for (let i = pairs.length - 1; i >= 0 && over(); i--) if (!kept(pairs[i])) dropPair(pairs[i].width, pairs[i].view);
|
|
220
|
+
return dropped;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The sheet for one page against one reference: every view both sides have, laptop first, in `CAPTURE_VIEW_ORDER` — and
|
|
225
|
+
* ours alone at a Scene stop the reference lacks (`OURS_ALONE_VIEWS`); then
|
|
162
226
|
* the crops — ours' flagged boxes first (distinct findings, at most `CRITIC_FLAGGED_CROPS`), then the recipes on both
|
|
163
227
|
* sides, up to the most (the recipes alone give the fewest). The header recipe uses the measured header box when ours has one.
|
|
228
|
+
* Then the sheet is brought to `maxImages` pictures (`CRITIC_SHEET_MAX_IMAGES`; `fitSheet`'s order).
|
|
164
229
|
*/
|
|
165
|
-
export function planCritiqueSheet(ours: CaptureSet, reference: CaptureSet): CritiqueSheet {
|
|
230
|
+
export function planCritiqueSheet(ours: CaptureSet, reference: CaptureSet, maxImages: number = CRITIC_SHEET_MAX_IMAGES): CritiqueSheet {
|
|
166
231
|
const pairs: SheetPair[] = [];
|
|
167
232
|
const missing: string[] = [];
|
|
168
233
|
for (const width of Object.values(CaptureWidth)) {
|
|
@@ -170,6 +235,7 @@ export function planCritiqueSheet(ours: CaptureSet, reference: CaptureSet): Crit
|
|
|
170
235
|
const o = shotOf(ours, width, view);
|
|
171
236
|
const r = shotOf(reference, width, view);
|
|
172
237
|
if (o && r) pairs.push({ width, view, reference: r, ours: o });
|
|
238
|
+
else if (o && OURS_ALONE_VIEWS.includes(view)) pairs.push({ width, view, ours: o });
|
|
173
239
|
else if (o || r) missing.push(`${width}/${view}: no ${o ? 'reference' : 'page'} shot`);
|
|
174
240
|
}
|
|
175
241
|
}
|
|
@@ -195,9 +261,10 @@ export function planCritiqueSheet(ours: CaptureSet, reference: CaptureSet): Crit
|
|
|
195
261
|
: fraction(o, recipe.box));
|
|
196
262
|
crops.push({ width: recipe.width, view: recipe.view, why: recipe.why, ours: { ref: o.ref, box }, reference: { ref: r.ref, box: clip(r, fraction(r, recipe.box)) }, zoom: zoomOf(box) });
|
|
197
263
|
}
|
|
198
|
-
const
|
|
264
|
+
const dropped = fitSheet(pairs, crops, maxImages);
|
|
265
|
+
const referenceImageTokens = pairs.reduce((n, p) => n + (p.reference ? visionImageTokens(p.reference.w, p.reference.h) : 0), 0);
|
|
199
266
|
const pairTokens = referenceImageTokens + pairs.reduce((n, p) => n + visionImageTokens(p.ours.w, p.ours.h), 0);
|
|
200
267
|
const cropTokens = crops.reduce((n, c) => n + visionImageTokens(c.ours.box.w * c.zoom, c.ours.box.h * c.zoom)
|
|
201
268
|
+ (c.reference ? visionImageTokens(c.reference.box.w * c.zoom, c.reference.box.h * c.zoom) : 0), 0);
|
|
202
|
-
return { pairs, crops, missing, imageTokens: pairTokens + cropTokens, referenceImageTokens };
|
|
269
|
+
return { pairs, crops, missing, dropped, imageTokens: pairTokens + cropTokens, referenceImageTokens };
|
|
203
270
|
}
|
|
@@ -75,12 +75,10 @@ export enum CriticIssueCode {
|
|
|
75
75
|
Shape = 'shape',
|
|
76
76
|
/** A score outside 0–10 or not in half points. */
|
|
77
77
|
Range = 'range',
|
|
78
|
-
/** Evidence that is not one line read off the sheet
|
|
78
|
+
/** Evidence that is not one line read off the sheet: no number where the rubric measures in numbers, else not ours. */
|
|
79
79
|
Evidence = 'evidence',
|
|
80
80
|
/** Not 1–3 changes, or none aimed at the lowest score. */
|
|
81
81
|
Changes = 'changes',
|
|
82
|
-
/** A polish score above what its bugs leave. */
|
|
83
|
-
Polish = 'polish',
|
|
84
82
|
/** A brief that asks for resemblance (AD-D18): the reference's name, "copy", "look like". */
|
|
85
83
|
Likeness = 'likeness',
|
|
86
84
|
}
|
|
@@ -93,7 +91,13 @@ export interface CriticContext {
|
|
|
93
91
|
|
|
94
92
|
/** A measurement: a number (a size, a position, a share) or a hex colour. */
|
|
95
93
|
const MEASURED = /\d/;
|
|
96
|
-
|
|
94
|
+
/** The comparison named: the line says what OURS does (the critic answers in English, as its instructions are). */
|
|
95
|
+
const COMPARED = /\bours?\b/i;
|
|
96
|
+
/** The dimensions the rubric measures in numbers (their row says "Numbers: …"): their evidence must hold one. The rest —
|
|
97
|
+
* the header, the footer, motion, polish — are read as behaviour; a line naming ours (or a number) is evidence. */
|
|
98
|
+
const MEASURED_DIMENSIONS: ReadonlySet<string> = new Set(CRITIC_RUBRIC_DIMENSIONS.filter(d => /\bNumbers:/.test(d.compares)).map(d => d.key));
|
|
99
|
+
/** Asking for likeness. "copy" alone is text (the hero copy, body copy) — only copying a thing is likeness. */
|
|
100
|
+
const LIKENESS_WORDS = /\b(cop(?:y|ies|ying) (?:it|its|them|their|the|this|that)\b|mimic|replicate|imitate|clone|look(?:s|ing)? like|same as|just like)/i;
|
|
97
101
|
const MIN_NAME_PART = 4;
|
|
98
102
|
|
|
99
103
|
/** The words of a reference's name a brief may not say (`graya-institute` → graya, institute). */
|
|
@@ -115,7 +119,8 @@ export function criticAnswerIssues(answer: unknown, ctx: CriticContext): CriticI
|
|
|
115
119
|
const v = s['score'];
|
|
116
120
|
if (v < CRITIC_SCORE.min || v > CRITIC_SCORE.max || !Number.isInteger(v / CRITIC_SCORE.step)) say(CriticIssueCode.Range, `${path}.score`, `0–10 in half points, not ${v}`);
|
|
117
121
|
const evidence = s['evidence'].trim();
|
|
118
|
-
|
|
122
|
+
const read = MEASURED.test(evidence) || (!MEASURED_DIMENSIONS.has(d) && COMPARED.test(evidence));
|
|
123
|
+
if (!evidence || /\n/.test(evidence) || !read) {
|
|
119
124
|
say(CriticIssueCode.Evidence, `${path}.evidence`, 'one line read off the sheet — a position, a size or a colour, the reference\'s and ours');
|
|
120
125
|
}
|
|
121
126
|
}
|
|
@@ -123,9 +128,6 @@ export function criticAnswerIssues(answer: unknown, ctx: CriticContext): CriticI
|
|
|
123
128
|
bugs.forEach((b, i) => {
|
|
124
129
|
if (!isPlainObject(b) || typeof b['what'] !== 'string' || typeof b['broken'] !== 'boolean') say(CriticIssueCode.Shape, `bugs[${i}]`, 'a bug is { what, broken }');
|
|
125
130
|
});
|
|
126
|
-
const polish = (scores[CriticDimension.Polish] as { score?: unknown } | undefined)?.score;
|
|
127
|
-
const allowed = CRITIC_SCORE.max - CRITIC_RUBRIC_POLISH.bugPenalty * bugs.length;
|
|
128
|
-
if (typeof polish === 'number' && polish > allowed) say(CriticIssueCode.Polish, `scores.${CriticDimension.Polish}.score`, `${bugs.length} bug(s) leave at most ${allowed}`);
|
|
129
131
|
const changes = answer['changes'] as unknown[];
|
|
130
132
|
if (changes.length < CRITIC_CHANGES.min || changes.length > CRITIC_CHANGES.max) say(CriticIssueCode.Changes, 'changes', `${CRITIC_CHANGES.min}–${CRITIC_CHANGES.max} changes, not ${changes.length}`);
|
|
131
133
|
const names = nameParts(ctx.reference);
|
|
@@ -143,16 +145,28 @@ export function criticAnswerIssues(answer: unknown, ctx: CriticContext): CriticI
|
|
|
143
145
|
});
|
|
144
146
|
if (out.length) return out;
|
|
145
147
|
const lowest = lowestDimensions(answer as unknown as CriticAnswer);
|
|
146
|
-
|
|
148
|
+
// Every bug travels to the revise step on its own line (`roundBrief`), so a listed bug is a change aimed at polish.
|
|
149
|
+
const aimed = new Set((changes as CriticChange[]).map(c => c.dimension));
|
|
150
|
+
if (bugs.length) aimed.add(CriticDimension.Polish);
|
|
151
|
+
if (!lowest.some(d => aimed.has(d))) {
|
|
147
152
|
say(CriticIssueCode.Changes, 'changes', `no change is aimed at the lowest score (${lowest.join(', ')})`);
|
|
148
153
|
}
|
|
149
154
|
return out;
|
|
150
155
|
}
|
|
151
156
|
|
|
152
|
-
/** The dimensions holding the lowest score (ties together). */
|
|
157
|
+
/** The dimensions holding the lowest score (ties together), polish as the rubric's arithmetic leaves it. */
|
|
153
158
|
export function lowestDimensions(answer: CriticAnswer): CriticDimension[] {
|
|
154
|
-
const
|
|
155
|
-
|
|
159
|
+
const score = (d: CriticDimension) => (d === CriticDimension.Polish ? polishOf(answer) : answer.scores[d].score);
|
|
160
|
+
const low = Math.min(...CRITIC_DIMENSIONS.map(score));
|
|
161
|
+
return CRITIC_DIMENSIONS.filter(d => score(d) === low);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/** Polish by the rubric's arithmetic: the critic's score, never above what its bugs leave (each costs
|
|
165
|
+
* `CRITIC_RUBRIC_POLISH.bugPenalty`), never below 0. The model's count is not refused for a slip of arithmetic — the
|
|
166
|
+
* file does the sum (AD3 calibration: 6 of 48 answers were refused for a polish above it). */
|
|
167
|
+
export function polishOf(answer: CriticAnswer): number {
|
|
168
|
+
const allowed = CRITIC_SCORE.max - CRITIC_RUBRIC_POLISH.bugPenalty * answer.bugs.length;
|
|
169
|
+
return Math.max(CRITIC_SCORE.min, Math.min(answer.scores[CriticDimension.Polish].score, allowed));
|
|
156
170
|
}
|
|
157
171
|
|
|
158
172
|
export interface CriticVerdict {
|
|
@@ -171,5 +185,5 @@ export function criticVerdict(answer: CriticAnswer): CriticVerdict {
|
|
|
171
185
|
const designMean = CRITIC_DESIGN_DIMENSIONS.reduce((sum, d) => sum + answer.scores[d].score, 0) / CRITIC_DESIGN_DIMENSIONS.length;
|
|
172
186
|
const broken = answer.bugs.filter(b => b.broken).length;
|
|
173
187
|
const capped = broken > 0 && designMean > CRITIC_RUBRIC_POLISH.brokenCap;
|
|
174
|
-
return { designMean, polish: answer
|
|
188
|
+
return { designMean, polish: polishOf(answer), broken, headline: capped ? CRITIC_RUBRIC_POLISH.brokenCap : designMean, capped };
|
|
175
189
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { CriticAnswer, CriticDimension, lowestDimensions, polishOf } from './critic';
|
|
2
2
|
import { FreedomIssue, FreedomIssueCode } from './structure-fingerprint';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -72,8 +72,9 @@ export function roundBrief(input: RoundBriefInput): RoundBrief {
|
|
|
72
72
|
const score = critique.scores[c.dimension as CriticDimension]?.score;
|
|
73
73
|
lines.push(`${i + 1}. [${c.dimension}${typeof score === 'number' ? ` ${score}` : ''}] ${c.brief}`);
|
|
74
74
|
});
|
|
75
|
-
const lowest =
|
|
76
|
-
|
|
75
|
+
const lowest = lowestDimensions(critique)[0];
|
|
76
|
+
const lowScore = lowest === CriticDimension.Polish ? polishOf(critique) : critique.scores[lowest].score;
|
|
77
|
+
lines.push(`Lowest: ${lowest} ${lowScore} — ${critique.scores[lowest].evidence}`);
|
|
77
78
|
for (const bug of critique.bugs.filter(b => !b.broken)) lines.push(`Bug: ${bug.what}`);
|
|
78
79
|
lines.push('Every round:');
|
|
79
80
|
for (const r of DESIGNER_ROUND_RULES) lines.push(`- ${r.rule}`);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AiKeyMode, AiTokenCounts, costUsd, creditsOfUsd } from './ai-run';
|
|
1
|
+
import { AI_STEP_TYPICAL_TOKENS, AiKeyMode, AiStep, AiTokenCounts, costUsd, creditsOfUsd } from './ai-run';
|
|
2
2
|
import { DESIGNER_ROUND_CAPS, DesignerPageRole } from './designer-stop';
|
|
3
3
|
import { outwardCredits, QuoteRoute } from './start-quote';
|
|
4
4
|
|
|
@@ -20,8 +20,8 @@ import { outwardCredits, QuoteRoute } from './start-quote';
|
|
|
20
20
|
|
|
21
21
|
/** §6b: one critique (≈ 20 pictures, the reference's cached) and one revise (the page as compact ops), per round. */
|
|
22
22
|
export const DESIGNER_ROUND_TOKENS: Readonly<{ critique: AiTokenCounts; revise: AiTokenCounts }> = {
|
|
23
|
-
critique:
|
|
24
|
-
revise:
|
|
23
|
+
critique: AI_STEP_TYPICAL_TOKENS[AiStep.DesignCritique],
|
|
24
|
+
revise: AI_STEP_TYPICAL_TOKENS[AiStep.DesignRevise],
|
|
25
25
|
};
|
|
26
26
|
/** §6c: the rounds a page takes at today's proof rates, with the batch A/B fixes and the seeded lessons. */
|
|
27
27
|
export const DESIGNER_ROUNDS_EXPECTED: Readonly<Record<DesignerPageRole, number>> = {
|