Canvix — Free & open-source graphic design tool. A community-built Canva alternative with a drag-and-drop editor, templates, shapes, text, images & one-click export. Works on desktop, tablet & mobile.
TypeScript canva-alternativecanvasdesigndesign-tooldrag-and-dropeditorgraphic-designkonvanextjsopen-sourcereactself-hostedtemplatestypescript
fix(v0.33.1): the live-repro convergence — the focal-size default and the unmet-message math
Ashiq Hussain Mir031e6e4cc87d
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 1f96121..2307b62 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -3,6 +3,25 @@All notable changes to Canvix will be documented in this file.The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).+### Fixed — v0.33.1: the live-repro convergence — the focal-size default and the unmet-message math++The v0.33.0 live reproduction (49 steps · 36 actions, brief validated+with a real photo focal, honest audit disclosure) exposed two+convergence defects, both fixed:++- **The illustration default size was fixed at 420px** — 8.1% of a+ 1240×1754 poster, under the feature contract's ≥10% focal+ threshold, and the model churned six attempts trying to satisfy a+ size it was never told. add_illustration now defaults to the+ page-adaptive focal size (max(420, ceil(√(10% of the page)))).+- **The illustration unmet message carried no math.** It now names+ the exact minimum (e.g. "at least 467×467px, 10% of 1240×1754")+ and the resize path (add_illustration defaults to it, or+ update_elements {width, height}).++Harness: +2 regression tests (the adaptive default on square vs+poster canvases; the unmet-message math + resize path) — 1,779/1,779.+### feat(v0.33.0): the design-quality architecture — server-resolved assets, the visual-feature contract, asset-visibility audit, the native effects surfaceOne brief, one review ("a program that places elements atdiff --git a/src/lib/agent/brief.ts b/src/lib/agent/brief.tsindex fff59a0..a27a187 100644--- a/src/lib/agent/brief.ts+++ b/src/lib/agent/brief.ts@@ -505,9 +505,21 @@ export function validateBrief(let features: BriefValidationResult['checked']['features']if (brief.requiredFeatures?.length && state.elements?.length) {features = validateFeatures(brief.requiredFeatures, state.elements, state.width, state.height)- for (const f of features) {- if (!f.found) unmet.push(`Required element missing: ${f.label} — build it from NATIVE elements (rect panels, semi-transparent fills, borders, text).`)- }+ brief.requiredFeatures.forEach((f, i) => {+ if (features?.[i]?.found) return+ // v0.33.1 · the live repro finding: the model churned six+ // attempts against the illustration threshold without ever+ // being told the exact size. The unmet message now carries the+ // page-specific math and the resize path.+ if (f.kind === 'illustration') {+ const min = Math.ceil(Math.sqrt(0.1 * state.width * state.height))+ unmet.push(+ `Required element missing: a dominant illustration — an image/illustration/photo element of at least ${min}×${min}px (10% of ${state.width}×${state.height}). Add one with add_illustration (it defaults to the focal size), or enlarge an existing image with update_elements {width, height} ≥ ${min}.`,+ )+ return+ }+ unmet.push(`Required element missing: ${f.label} — build it from NATIVE elements (rect panels, semi-transparent fills, borders, text).`)+ })}let dimensions: BriefValidationResult['checked']['dimensions']if (brief.dimensions && brief.dimensions.tier === 'mandatory') {diff --git a/src/lib/agent/harness.test.ts b/src/lib/agent/harness.test.tsindex 0a0dfc3..94391ca 100644--- a/src/lib/agent/harness.test.ts+++ b/src/lib/agent/harness.test.ts@@ -3189,3 +3189,33 @@ describe('v0.33 · the full-circle honesty: a run cannot claim stickers it neverexpect(String(result.verification)).toContain('Brief contract validated')})})++describe('v0.33.1 · the live-repro convergence fixes', () => {+ it('the illustration default size is page-adaptive: ≥10% focal size on tall canvases', () => {+ // square 1080: the classic default already clears the threshold+ // (√(10% of 1080²) = 342 < 420)+ const square = AGENT_TOOL_MAP.get('add_illustration')!.sanitize({ query: 'rocket launch' }, ctx)+ expect(square.ok).toBe(true)+ if (square.ok) expect((square.actions[0] as { size?: number }).size).toBe(420)+ // a 1240×1754 poster: 420px was 8.1% of the page and the run churned+ // six attempts against the feature gate — the default is now ≥466+ const tall = AGENT_TOOL_MAP.get('add_illustration')!.sanitize(+ { query: 'rocket launch' },+ { ...ctx, width: 1240, height: 1754 },+ )+ expect(tall.ok).toBe(true)+ if (tall.ok) expect((tall.actions[0] as { size?: number }).size).toBeGreaterThanOrEqual(466)+ })++ it('the illustration unmet message names the exact px math and the resize path', async () => {+ const { extractBrief, validateBrief } = await import('./brief')+ const brief = extractBrief('a poster with a central technology illustration')+ const r = validateBrief(brief, {+ texts: [], colors: [], width: 1240, height: 1754,+ elements: [{ type: 'image', x: 0, y: 0, width: 300, height: 300 }],+ })+ expect(r.satisfied).toBe(false)+ expect(r.unmet.some((u) => u.includes('467×467'))).toBe(true)+ expect(r.unmet.some((u) => u.includes('update_elements'))).toBe(true)+ })+})diff --git a/src/lib/agent/tools.ts b/src/lib/agent/tools.tsindex 582cdc1..168bdaf 100644--- a/src/lib/agent/tools.ts+++ b/src/lib/agent/tools.ts@@ -1021,6 +1021,12 @@ export const AGENT_TOOLS: AgentTool[] = [const x = num(args, 'x')const y = num(args, 'y')const size = num(args, 'size')+ // v0.33.1 · the live repro finding: the fixed 420px default put+ // the illustration at 8.1% of a 1240×1754 poster — under the+ // feature contract's ≥10% focal threshold, and the run churned+ // six attempts trying to satisfy a size it was never told. The+ // default is now page-adaptive: at least the ≥10% focal size.+ const defaultSize = clamp(Math.max(420, Math.ceil(Math.sqrt(0.1 * ctx.width * ctx.height))), 60, 800)return {ok: true,actions: [@@ -1030,10 +1036,10 @@ export const AGENT_TOOLS: AgentTool[] = [name: hit.name,...(x !== null ? { x: clamp(x, -ctx.width, ctx.width) } : {}),...(y !== null ? { y: clamp(y, -ctx.height, ctx.height) } : {}),- ...(size !== null ? { size: clamp(size, 60, 800) } : {}),+ ...(size !== null ? { size: clamp(size, 60, 800) } : { size: defaultSize }),},],- observation: `Illustration "${hit.name}" (${hit.pack} pack) added${size !== null ? ` at ${Math.round(clamp(size, 60, 800))}px` : ''}.`,+ observation: `Illustration "${hit.name}" (${hit.pack} pack) added${size !== null ? ` at ${Math.round(clamp(size, 60, 800))}px` : ` at ${defaultSize}px (≥10% focal size for this page)`}.`,}},},