build

package
v0.7.36 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 9, 2026 License: MIT, MIT Imports: 35 Imported by: 0

Documentation

Overview

Package build runs the Report Designer: it stages what the person gave it (the design to start from without its images, the design's own images and theirs, each re-encoded from its pixels by pkg/reportdesign, their reference images, and the text of the web pages they named, read by AI Review first), runs the built-in over them (pkg/runner/localrun), and collects what it wrote: a design document, or a custom cover for a design. The result is held to the core's rules before anything keeps it, and it carries only images the person gave or the design already had: the model's document never brings an image of its own. The CLI writes the result to the run's output folder and, when asked, adds it to the account's library as a new design.

Index

Constants

View Source
const (
	// MaxBriefBytes caps the brief.
	MaxBriefBytes = 4 << 10
	// MaxReferences caps a Design run's reference images.
	MaxReferences = 4
	// MaxURLs caps a Design run's web addresses.
	MaxURLs = 2
)

The limits of one run's inputs.

View Source
const MaxDocumentBytes = docpages.MaxDocumentBytes

MaxDocumentBytes caps the document.

Variables

View Source
var ErrNoDesign = errors.New("the Report Designer wrote no design")

ErrNoDesign is a run that wrote no design or cover: the model's failure, never the person's.

Functions

func DocumentKind added in v0.7.26

func DocumentKind(name string, b []byte) (docpages.Kind, error)

DocumentKind is the kind a document's own bytes say it is: a PDF by its header, a Word document by its archive's signature and its .docx name. Anything else is refused before the run.

Types

type Document added in v0.7.26

type Document struct {
	// Name is its file name, shown to the model and in the receipt.
	Name string
	Data []byte
}

Document is the one document a Design run builds its design around: a PDF or a Word document, as the person gave it.

type Job

type Job string

Job is which of the Report Designer's two jobs a run is.

const (
	// Design writes a whole design document from a brief.
	Design Job = "design"
	// Cover writes a custom cover page for a design.
	Cover Job = "cover"
)

type Options

type Options struct {
	Job Job
	// Brief is what the person wants; required.
	Brief string
	// From is the design to start from (Design, optional) or the design
	// the cover is for (Cover, required), with its images.
	From *reportdesign.Design
	// the place of From's.
	Logo []byte
	// Images are a Design run's reference images, or the images a Cover
	// run's cover may draw beside From's own cover images, as uploaded.
	Images [][]byte
	// URLs are a Design run's web addresses (voicebuild.ParseURLs), read by
	// AI Review before the run: they take Review and Web.
	URLs []*sources.Source
	// Document is the one document a Design run builds its design
	// around, a PDF or a Word document; it goes through the decode step as
	// any input does.
	Document *Document
	Review   webscan.Scanner
	// Web is the web tools' configuration with the same scanner, for a page
	// whose text is drawn by scripts.
	Web *engine.WebRun

	Home       string
	Policy     *policy.Policy
	PolicySHA  string
	PolicyFile *policy.File
	Build      string
	// OutDir receives the run's reports and receipts, and the result under
	// design/.
	OutDir  string
	Budgets *spec.Budgets
	RunID   string
	Stderr  io.Writer
	OnUsage func(receipt.Usage)
	Credits *inference.Client
}

Options configure one run.

type Result

type Result struct {
	Envelope *receipt.Envelope
	// Design is the design the run made, with its images, valid by the
	// core's rules: never anyone's default until the person makes it so.
	Design reportdesign.Design
	// Looked is what the Designer says of its own work: that it saw its
	// renders. It is the model's word, never checked; false when it said it
	// could not read images, or wrote no notes.
	Looked bool
	// Thumbnail says a Cover run's cover carries the image of its last
	// render; false when the last render was not of the cover kept.
	Thumbnail bool
	// Previews is how many renders the run made.
	Previews int
	// Dir is the folder the result was written to: design/ under OutDir.
	Dir string
	// DocumentPages is how many images of the document the run looked
	// at; LogoFromDocument says the design's logo is a crop of it,
	// CoverImageFromDocument that its cover image is a picture of it, and
	// CoverFromDocument that a Design run wrote a custom cover modelled on
	// it, drawing CoverPicturesFromDocument pictures of it.
	DocumentPages             int
	LogoFromDocument          bool
	CoverImageFromDocument    bool
	CoverFromDocument         bool
	CoverPicturesFromDocument int
	// Pages are the web addresses given, and what became of each.
	Pages []*voicebuild.Page
}

Result is what a run made.

func Run

func Run(ctx context.Context, d dockerx.Client, o Options) (*Result, error)

Run runs the Report Designer for o.Job and returns what it made.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL