feat(assistant): the book designer works from a brief, with archetype covers, lively spreads and stickers

- design_book takes a brief (energy, decoration, collages, theme), a cover
  archetype and a cover lockup, and pages.overrides that give single pages of
  the plan another beat or layout. Directives written before parse as they
  did, and a design asked for none of it is composed exactly as before.
- The engine composes the seven cover archetypes from the book's own photos,
  words, theme faces and colours, lockups, shapes and stickers, varied by the
  seed: spine band, poster pop, cut-out, illustrated postcard, grid and
  badge, minimal serif and stamp collage. A title the directives give a
  display tier is held to it, and the notes say when a band, a badge or a
  stamp holds it smaller or a cover leaves a layout out.
- A lively or loud book turns two in five hero and grid spreads into
  collages, script overlays, badge grids, stamp rows or two-tone splits, the
  first of them always, turns and frames the prints of its other pages, sets
  its cover title larger and takes one or two, or three to six, stickers of
  its theme's motifs a spread, never over words, a photo's detail or the
  fold. A calm book asked for collages gets them and nothing else.
- Every turn the engine gives a print or a sticker stays within what the
  brief's energy takes, a calm book's within its theme's own, so a design is
  never judged against its own brief.
- New checks name a flat cover, a page without a lead, colours or faces off
  the theme and, for a design made with a brief, a book livelier or calmer
  than it asked, on the pages the design made and on a page revised in the
  draft. Page edits answer with the art checks too, and the assistant's
  cards name them in every language.
- list_book_assets lists the shapes, faces, lockups, themes and patterns
  beside the stickers, and the Studio's shape groups and photo frames are one
  list the assistant reads too.
- The Studio prompt gains an index of themes, archetypes and faces and JSON
  recipes of the elements to add and style for each cover and three lively
  spreads, and a turn that designs the book may preview sixteen pages, still
  three images a request; a viewer is told of none of it.
This commit is contained in:
Maurice
2026-10-23 23:14:25 +00:00
parent ff749611c6
commit 5651c11803
141 changed files with 6007 additions and 268 deletions
+6 -87
View File
@@ -1,4 +1,4 @@
import type { BookShapeId } from '@trek/shared'
import { BOOK_FRAME_SHAPES, BOOK_SHAPE_GROUPS, type BookShapeId } from '@trek/shared'
import { K, circle, polygon, r2, roundRect, scallop, star } from './shapePrimitives'
import { MORE_SHAPE_PATHS } from './shapes-more'
@@ -323,91 +323,10 @@ export function unitPath(path: string): string {
*/
export const HOLED_SHAPES = new Set<BookShapeId>(['gear', 'postmark', 'label-tab'])
export interface ShapeGroup {
/** i18n key under `journey.studio.shapeGroup`. */
id: string
shapes: BookShapeId[]
}
/**
* How the panel is divided.
*
* Grouped the way you go looking for them — "I want an arrow", "I want
* something round and soft" — rather than by how they are built. Sixty
* unlabelled tiles in one grid is a wall; six groups of ten is a menu.
* How the panel is divided and which shapes it offers as picture frames: the
* one list in @trek/shared (book-shape-catalogue.ts), which the assistant's
* asset listing reads too.
*/
export const SHAPE_GROUPS: ShapeGroup[] = [
{
id: 'basic',
shapes: ['rect', 'squircle', 'ellipse', 'capsule', 'triangle', 'triangle-down',
'diamond', 'parallelogram', 'trapezoid', 'arch', 'half-circle', 'quarter-circle'],
},
{
id: 'polygons',
shapes: ['pentagon', 'hexagon', 'hexagon-flat', 'heptagon', 'octagon'],
},
{
id: 'stars',
shapes: ['star-4', 'star-5', 'star-6', 'star-8', 'star-12', 'burst', 'seal', 'sparkle',
'star-rounded', 'star-twinkle'],
},
{
id: 'arrows',
shapes: ['arrow-right', 'arrow-left', 'arrow-up', 'arrow-down', 'arrow-both',
'chevron-right', 'chevron-left', 'arrow-bent', 'arrow-curve', 'arrow-circle', 'arrow-notched', 'arrow-thin'],
},
{
id: 'speech',
shapes: ['bubble-round', 'bubble-square', 'bubble-oval', 'bubble-think',
'bubble-shout', 'bubble-side', 'bubble-capsule'],
},
{
id: 'travel',
shapes: ['pin', 'compass', 'mountain', 'sun', 'moon', 'cloud', 'cloud-puffy',
'drop', 'wave', 'leaf', 'shield', 'ticket'],
},
{
id: 'decor',
shapes: ['heart', 'flower-5', 'flower-6', 'cross', 'plus', 'gear',
'blob-1', 'blob-2', 'blob-3', 'blob-4', 'heart-round', 'heart-pair', 'flower-8'],
},
{
id: 'banners',
shapes: ['banner-ribbon', 'banner-pennant', 'banner-bookmark', 'banner-flag',
'ribbon-ends', 'ribbon-arc', 'wavy-band', 'torn-strip'],
},
// The second shelf (shapes-more.ts).
{ id: 'arches', shapes: ['arch-tall', 'arch-pointed', 'arch-double', 'arch-half', 'arch-rainbow'] },
{
id: 'cutouts',
shapes: ['leaf-palm', 'leaf-oak', 'leaf-long', 'leaf-monstera', 'coral-1', 'coral-2', 'seaweed',
'star-organic', 'sun-cutout', 'organic-1', 'organic-2', 'organic-3'],
},
{
id: 'stamps',
shapes: ['stamp-rect', 'stamp-circle', 'postmark', 'rosette', 'scallop-circle', 'badge-shield',
'label-tab', 'ticket-stub', 'sunburst-12', 'sunburst-24'],
},
{ id: 'frames', shapes: ['frame-notched', 'frame-chamfer', 'frame-cushion'] },
{ id: 'ornaments', shapes: ['flourish-scroll', 'laurel', 'fleuron', 'corner-flourish'] },
]
/**
* The shapes offered as picture frames.
*
* A subset, and the subset is the point: a photograph cut to a speech bubble's
* tail or to a hairline is a photograph you cannot read. What is here holds an
* image at book size — broad, mostly convex, no thin limbs.
*/
export const FRAME_SHAPES: BookShapeId[] = [
'rect', 'squircle', 'ellipse', 'capsule', 'arch', 'half-circle',
'triangle', 'diamond', 'pentagon', 'hexagon', 'octagon',
'heart', 'star-5', 'star-6', 'seal', 'flower-5', 'flower-6',
'blob-1', 'blob-2', 'blob-3', 'blob-4',
'shield', 'drop', 'leaf', 'pin', 'banner-pennant', 'banner-bookmark',
// The second shelf: arches, stamps and the frames cut for photographs.
'arch-tall', 'arch-pointed', 'arch-double', 'arch-half', 'stamp-rect', 'stamp-circle',
'scallop-circle', 'badge-shield', 'ticket-stub', 'heart-round', 'star-rounded', 'flower-8',
'frame-notched', 'frame-chamfer', 'frame-cushion', 'organic-1', 'organic-2', 'organic-3',
'star-organic', 'sun-cutout', 'bubble-side', 'bubble-capsule',
]
export const SHAPE_GROUPS = BOOK_SHAPE_GROUPS
export const FRAME_SHAPES = BOOK_FRAME_SHAPES