design

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 85 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package design is the design library of a machine: projects of a design tool kept as plain folders, listed, served to the right panel's browser by a small loopback server, checked in a headless browser, claimed board by board by the agents that edit them and saved to a private history. The folder can be shared by several runtimes (several Unix users) and is written by every agent, so everything read from it is untrusted.

Index

Constants

View Source
const (
	TemplateLockStrict = "strict"
	TemplateLockOpen   = "open"
)

The lock levels of a template board.

View Source
const (
	DeckSettingsFile = "meta/deck.json"
	DeckNotesDir     = "meta/notes"
	DeckCommentsDir  = "meta/comments"
	// DeckThemeCSS is written on every theme or font change; the boards link it.
	DeckThemeCSS     = "project/deck-theme.css"
	DeckMediaDir     = ".media"
	DeckRecDir       = ".media/rec"
	DeckExportsDir   = ".media/exports"
	DeckPublishedDir = ".media/published"
)

The deck's files under a project's folder (the project's root, beside project/ and meta/).

View Source
const (
	DeckSlidesMin  = 2
	DeckSlidesMax  = 40
	DeckMinutesMin = 1
	DeckMinutesMax = 180
)

The bounds of a deck's settings.

View Source
const (
	DeckEvSlide  = "slide"
	DeckEvStep   = "step"
	DeckEvCursor = "cursor"
	DeckEvClick  = "click"
	DeckEvLaser  = "laser"
	DeckEvPause  = "pause"
	DeckEvResume = "resume"
	DeckEvRetake = "retake"
	DeckEvASR    = "asr"
	DeckEvCam    = "cam"
)

The kinds of the lines of events.jsonl.

View Source
const (
	DeckPatchChanged = "changed"
	DeckPatchDynamic = "dynamic"
	// DeckPatchLocked: an app bound the project's elements and keeps the rest from free edits (403).
	DeckPatchLocked = "locked"
)

The codes a refused patch answers with: 409 changed (the source is not what the page saw), 422 dynamic (the element's content or style is interpolated).

View Source
const (

	// GenAttrPrompt and GenAttrJob are the attributes an element drawn by a job carries.
	GenAttrPrompt = "data-gen-prompt"
	GenAttrJob    = "data-gen-job"
	// GenAttrFrom is the picture a changed one was made from (a path of the project).
	GenAttrFrom = "data-gen-from"
)
View Source
const (
	SlotAttr       = "data-image-slot"
	SlotPromptAttr = "data-image-prompt"
)

SlotAttr marks an empty place for a picture (with an optional SlotPromptAttr, the brief it can be drawn from).

View Source
const (
	DocErrNotFound = "not_found"
	DocErrInvalid  = "invalid"
	DocErrChanged  = "changed"
	DocErrDynamic  = "dynamic"
	DocErrClaimed  = "claimed"
	DocErrLocked   = "locked"
	DocErrFailed   = "failed"
)

The codes of a refused call.

View Source
const (
	DoctorChromeMissing  = "RND-101"
	DoctorFFmpegMissing  = "RND-102"
	DoctorFFprobeMissing = "RND-103"
	DoctorBrowserStart   = "RND-201"
	DoctorFrameCapture   = "RND-202"
	DoctorFrameDecode    = "RND-203"
	DoctorFrameSize      = "RND-204"
	DoctorFrameBlank     = "RND-205"
	DoctorVideoEncode    = "RND-301"
	DoctorVideoProbe     = "RND-302"
	DoctorVideoCodec     = "RND-303"
	DoctorVideoDuration  = "RND-304"
	DoctorVideoSize      = "RND-305"
	DoctorKitVersions    = "RND-401" // a warning: the kit differs from the pinned versions
)

Codes of a failed step. They are stable: docs/render-kit.md lists them with what to do.

View Source
const (
	EngineSourceOwn    = "own"
	EngineSourceVendor = "vendor"
	// EngineSourceFile: the file a deployment names.
	EngineSourceFile = "file"
)

Where a new project's engine comes from.

View Source
const (
	// DefaultEngineTypeURL is the public address of the design artifact type, the same for every account.
	DefaultEngineTypeURL = "https://claude.ai/artifact/QKN21svewxgyPb6SYRqWnd"

	// EngineHookCreateEnv lets the hook allow the one call that makes the canvas.
	EngineHookCreateEnv = "HARNESSLY_ENGINE_HOOK_CREATE"
)
View Source
const (

	// FolderMax bounds a person's folders; FolderNameMax a name.
	FolderMax     = 200
	FolderNameMax = 60
	// SystemFile is where a project records the design system or kit it was started on (beside meta/, like the owner file).
	SystemFile = ".system.json"
)
View Source
const (
	LeasesFolder = "folder"
	LeasesCenter = "center"
)
View Source
const (
	ProjectDirname = "project"
	ArtifactFile   = "artifact.json"
)
View Source
const (
	PendingControlFor   = 10 * time.Minute
	PendingControlDelay = 1500 * time.Millisecond
)

PendingControlFor is how long a command waits for a page of its design; PendingControlDelay lets the page that came list its boards before it is told which to show.

View Source
const (
	MetaDirname      = "meta"
	MetaProjectFile  = "project.json"
	MetaPagesDirname = "pages"
	// LegacyRelease is the engine release of a project made before releases were tracked.
	LegacyRelease = "legacy"
)
View Source
const (
	// PackManifestName is the manifest, the first entry of a pack.
	PackManifestName = "sinopia-pack.json"
	// PackFormat names the format; PackSchema is the version of it this harnessly reads and writes.
	PackFormat = "sinopia-pack"
	PackSchema = 1
)
View Source
const (

	// PublicAppDir and PublicGuestDir are first segments of a public path that are not project files: the guest page's
	// bundle, and the script the boards load.
	PublicAppDir    = "_app"
	PublicGuestDir  = "__guest"
	PublicVendorDir = "__vendor"
	// PublicLibDir holds what a snapshot needs to play without the machine: the motion kit (GSAP, the screen
	// and tk scripts, the fonts) and the video runtime. The library serves them from its own build; a board of the
	// snapshot is rewritten to ask for them here, under a version, so a browser keeps each for good.
	PublicLibDir = "__lib"
	// PublicRevDir answers the revision a new pinned link should hold (see PinRevision).
	PublicRevDir = "__rev"
	// PublicShareDir answers whether a link to the project may be made: the apps' checks of the share trigger ran and
	// none blocks (200), or one does (409, ShareRefusal). The gateway asks before it makes any link, pinned or not.
	PublicShareDir = "__share"
	// PublicRevHeader and PublicPagesHeader say on an answer which version and whether a page list it served.
	PublicRevHeader   = "X-Design-Rev"
	PublicPagesHeader = "X-Design-Pages"
)
View Source
const (
	// PublicMediaDir is the first segment of a public path that is a published media file.
	PublicMediaDir = "__media"
	// PublicMediaLimit is the largest published file the public route sends.
	PublicMediaLimit = 2 << 30
)
View Source
const (
	// ReleasesFile is the mirror's list of releases at the top of the releases folder.
	ReleasesFile  = "releases.json"
	ReleaseStable = "stable"
	ReleaseBeta   = "beta"
	// EngineFile is the name boards load the engine by.
	EngineFile = "support.js"
)
View Source
const (
	Scene3DOutputsFrames = 4
	Scene3DOutputsMasks  = 4
	// Scene3DOutputsFar is the distance (metres, Blender's units) at which the depth picture is black: near is white.
	Scene3DOutputsFar     = 30.0
	Scene3DManifestFile   = "manifest.json"
	Scene3DCameraPathFile = "camera_path.json"
)
View Source
const (
	Scene3DSettingsFile = "meta/scene3d.json"
	// Scene3DCacheDir holds <hash>/model.glb, <hash>/meta.json and <hash>/frames/<key>.jpg.
	Scene3DCacheDir = ".media/scene3d"
	// DeckComment.View of a comment on a 3D scene.
	DeckCommentScene3D = "scene3d"
)
View Source
const (
	Scene3DFrameW        = 640
	Scene3DFrameH        = 360
	Scene3DFrameSamples  = 12
	Scene3DFrameTimeout  = 100  // seconds, the draft render's limit
	Scene3DFrameSlotWait = 90   // seconds a draft waits for one of the machine's slots
	Scene3DExportTimeout = 1800 // seconds, the export's limit: a scene with a thousand textures and an animated car takes minutes
	Scene3DTriBudget     = 160000
	Scene3DTexMax        = 1024
	Scene3DCacheMax      = 1 << 30 // bytes of drafts kept per scene before the oldest are dropped

)

The bounds of a 3D scene's work on the shared machine: only drafts run here, finals belong on a rented GPU.

View Source
const (
	Scene3DNone     = "none"
	Scene3DBuilding = "building"
	Scene3DReady    = "ready"
	Scene3DFailed   = "failed"
	Scene3DQueued   = "queued"
)

The statuses of the model and of a frame.

View Source
const (
	Scene3DWaiting   = "waiting"
	Scene3DExporting = "exporting"
)

The phases of a building model besides Scene3DQueued.

View Source
const (
	ShareFSSetup   = "SHR-100" // the probe could not lay out its files in the library
	ShareFSInside  = "SHR-101" // a file inside the root does not open through it
	ShareFSDotDot  = "SHR-201" // «..» leaves the root
	ShareFSRelLink = "SHR-202" // a relative symlink out of the root is followed
	ShareFSAbsLink = "SHR-203" // an absolute symlink out of the root is followed
	ShareFSDirLink = "SHR-204" // a symlinked directory out of the root is followed
	ShareFSSwap    = "SHR-301" // an open handle reads what was swapped in after it was opened
)

Codes of a failed guarantee. They are stable: docs/design-sharing.md lists them.

View Source
const (
	TimelineMaxAgeMs     = 6 * 60 * 60 * 1000
	TimelineMaxEvents    = 20000
	TimelineMaxFileBytes = 4 << 20
)

Limits of what is kept per design. The file is rewritten without its oldest part when it outgrows the byte limit; events older than the age limit are dropped at the same time.

View Source
const (
	LimitTitle         = 120
	LimitBoardPath     = 512
	LimitBoards        = 400
	LimitUploadBytes   = 300 * 1024 * 1024
	LimitUnpackedBytes = 1024 * 1024 * 1024
	LimitEntries       = 20000
)
View Source
const (
	VideoOverlaysMax    = 24
	VideoOverlayTextMax = 200
	VideoOverlayMinSize = 0.02
	VideoOverlayMinMs   = 100
)

The bounds of an overlay.

View Source
const (
	VideoSettingsFile = "meta/video.json"
	// VideoScenesDir holds <pageId>.json (VideoSceneMeta), one per scene that has anything set.
	VideoScenesDir = "meta/scenes"
	// VideoCacheDir is the render cache: scenes/<key>.mp4, frames/<key>.jpg, renders/<slug>/<hash>.mp4.
	VideoCacheDir        = ".media/video"
	VideoSceneClipsDir   = ".media/video/scenes"
	VideoFramesDir       = ".media/video/frames"
	VideoRendersDir      = ".media/video/renders"
	VideoChaptersFile    = DeckPublishedDir + "/chapters.json"
	VideoPublishedFile   = DeckPublishedDir + "/video.json"
	VideoRuntimeVersion  = 4
	VideoRendersKept     = 3
	VideoCacheMaxBytes   = 2 << 30
	VideoRenderTabs      = 2
	VideoRenderTimeout   = 40 * time.Minute
	VideoDraftCRF        = 28
	VideoFinalCRF        = 16
	VideoFrameJPEGQ      = 92
	VideoLoadPerCPUPause = 1.5
)

The video's files under a project's folder, beside the deck's (deck_types.go).

View Source
const (
	VideoFPS             = 30
	VideoSecondsMin      = 15
	VideoSecondsMax      = 300
	VideoSceneDurMin     = 1000
	VideoSceneDurMax     = 60000
	VideoTransitionMsMax = 2000
	// VideoAutoMin is the shortest automatic scene; VideoMomentTail and VideoEndHold follow the last moment's end.
	VideoAutoMin    = 3000
	VideoMomentTail = 600
	VideoEndHold    = 1500
	// VideoWordsPerSecond is how fast a viewer reads a scene's text (meta/notes).
	VideoWordsPerSecond = 2.5
)

The bounds of a video's settings and scenes (D2, D5).

View Source
const (
	VideoBuildInFade = "fade"
	VideoBuildInRise = "rise"
	VideoBuildInPop  = "pop"
)

The build-ins a block may take (data-build-in), applied by video-runtime.js as a pure function of time (D4).

View Source
const (
	// Static lint of the board's scripts.
	VideoCheckTimer   = "timer"          // setTimeout, setInterval
	VideoCheckRaf     = "raf"            // the board's own requestAnimationFrame loop
	VideoCheckUnbound = "motion-unbound" // GSAP on the board outside tkVideo.motion
	VideoCheckRandom  = "random"         // Math.random
	VideoCheckClock   = "clock"          // Date.now, new Date(
	// Times.
	VideoCheckPastEnd = "past-end" // a data-tk-at past the scene's duration
	// In Chrome, at the scene's end, per enabled format.
	VideoCheckOverflow  = "overflow"        // text overflows its box
	VideoCheckOffscreen = "offscreen"       // a block outside the viewport
	VideoCheckSmallText = "small-text"      // a font under 28 px at 1080 width (9:16)
	VideoCheckUnstable  = "unstable"        // the same t captured twice gives different frames
	VideoCheckOverlap   = "motion-overlap"  // two tweens on one property of one target at one time
	VideoCheckMotionEnd = "motion-past-end" // the motion runs past the scene's end
	VideoCheckExternal  = "external"        // the board reaches outside the project and the kit
	VideoCheckAsset     = "asset"           // a file of the board did not load
	VideoCheckScript    = "script"          // a script of the board threw
	VideoCheckEngine    = "engine"          // an engine of the board failed
)

The codes of a check's findings.

View Source
const (
	VideoZoomsMax    = 40
	VideoZoomMin     = 1.05
	VideoZoomMax     = 4
	VideoZoomMinMs   = 300
	VideoZoomEaseMax = 2000
	VideoZoomEase    = 700
	VideoZoomDefault = 1.7
)

The bounds of a zoom.

View Source
const AccessFile = "design-access.json"
View Source
const ClaimsDirname = ".claims"
View Source
const CodeProfileFile = "sinopia.export.json"

CodeProfileFile is the export profile in the application's repository.

View Source
const DeckCommentSite = "site"

DeckCommentSite is the View of a site board's comment.

View Source
const DeckCommentVideo = "video"

DeckCommentVideo is DeckComment.View for a comment on a moment or a stretch of a video.

View Source
const DeckGuestPrefix = "g-"

DeckGuestPrefix starts the id of a guest comment in a resolve: g-<gatewayId>.

View Source
const DeckPdfAutoFile = ".media/pdf-auto"

DeckPdfAutoFile marks a deck whose PDF is kept for guests; it holds the runtime that keeps it.

View Source
const DefaultCanvasKey = "harnessly"

DefaultCanvasKey is where canvas.json carries this runtime's own data when the deployment names no other key.

View Source
const DemoFolderID = "f-0000e0a1"

DemoFolderID is the demo folder's id, the same for everyone (it was the "Examples" folder first: same id, so the libraries that already have it keep one folder, not two).

View Source
const (

	// DocNodesMax bounds what one call lists.
	DocNodesMax = 4000
)
View Source
const EngineDirname = "design-engine"

EngineDirname is the engine's folder in the runtime's data dir.

View Source
const FromHTMLMax = 200 << 10

FromHTMLMax is how long a mockup of a chat's feed may be to become a board.

View Source
const FullClipsHeader = "X-Tk-Full-Clips"

FullClipsHeader marks a request of the final render: it gets a recording itself, not its light copy.

View Source
const (
	GuideFile = "CLAUDE.md"
)
View Source
const KitNone = "none"

KitNone is the answer «no kit» of the one question a project asks.

View Source
const LibraryRootFile = "design-library-root"

LibraryRootFile names, in the data folder, the library the runtime serves: the hook runs in an agent's pane, which knows the data folder and nothing else, and needs the root to see a search that starts at or above it.

View Source
const MaxPptxBytes = 50 << 20

MaxPptxBytes caps a company template.

View Source
const OwnerFile = ".owner.json"
View Source
const PageDeviceIDs = "fill overview ipse ip14 ip15 ipair ip16 s24 s24u flip fold px9 duo bare ipad ipad9 tabs9 lap fhd"

PageDeviceIDs are the opening device presets offered by the site viewer and the agent CLI.

View Source
const ReadyProbeEnv = "RUNTIME_DESIGN_READY_PROBE"

ReadyProbeEnv turns the engine's readiness in the API into the doctor's verdict. Off (the default), Ready stays true as before, and Chrome/Ffmpeg only say the programs are there.

View Source
const RecordMask = "••••••••"

RecordMask is what the log shows instead of a secret or a password field's text.

View Source
const (
	// RecordsDir is where a project keeps its recordings, beside the boards that load them.
	RecordsDir = "records"
)
View Source
const (
	Scene3DClipMaxFrames = 24
)
View Source
const ServerPortFile = "design-port"

ServerPortFile is where the library server keeps the port it listened on, in the data directory.

View Source
const ShareBlocked = "share_blocked"

ShareBlocked is the code of a refused link.

View Source
const ShareFSHint = "Guest links need a runtime whose filesystem keeps lookups beneath a folder and open handles stable: " +
	"run the runtime on Linux directly, in a VM, or in a container with the default runc or crun runtime. " +
	"Sandboxes that emulate the kernel (gVisor runsc) do not pass this check; see docs/design-sharing.md."

ShareFSHint is what the owner is told to do.

View Source
const ShareRefusedHeader = "X-Design-Share-Refused"

ShareRefusedHeader marks a guest read refused by the probe, so the hub tells it from a machine that is down.

View Source
const ShareUnsafeRuntime = "share_unsafe_runtime"

ShareUnsafeRuntime is the code of a link or a guest read refused because the probe failed.

View Source
const (

	// SiteAgentHandle is the @ that calls the agent.
	SiteAgentHandle = "harnessly"
)
View Source
const SitePropsFile = "props.json"

SitePropsFile is the project's shared settings, under meta/.

View Source
const (
	SupportJSName = "support.js"
)
View Source
const TemplateDirname = ".template"
View Source
const (
	ThumbDirname = ".thumbs"
)
View Source
const UnrecordedClosed = "closed"

UnrecordedClosed is the snapshot's word for «a project without a row is closed».

View Source
const VideoSceneMetaV = 2

VideoSceneMetaV is the current version of a scene's meta file.

Variables

View Source
var BoardActions = map[string]bool{"rename": true, "move": true, "duplicate": true, "remove": true, "title": true}
View Source
var CLIExportFormats = map[string]DeckExportFormat{"html": DeckExportHTML, "zip": DeckExportZip, "bundle": DeckExportBundle}

CLIExportFormats are the formats an agent asks for: one page as HTML, the project/ folder, the whole project.

DeckExportFormats is every format, in the order of the «Ещё» menu's items.

DeckExportOfBoard are the formats that can be made of one board (Board in DeckExportRun).

View Source
var DeckFonts = map[string]string{
	"inter": "Inter, system-ui, sans-serif",
	"golos": `"Golos Text", Inter, sans-serif`,
	"serif": `Georgia, "PT Serif", serif`,
}

DeckFonts are the font ids of a deck and the CSS stack each stands for.

DeckTones is every DeckTone, in the order the settings show them.

View Source
var DemoProjects = []string{"relay-site", "relay-deck", "relay-video", "relay-ds"}

DemoProjects are the onboarding projects every library starts with (cmd/runtime/demo). Each person finds them in one folder, "Demo", made the first time their layout is read with any of them in the library (and again, when the person asks for the demo back, for the projects that come back). A person who moves them out, renames the folder or deletes it does not get it back on its own: what they do with it after is theirs.

View Source
var ErrGone = errors.New("design: the project is gone")

ErrGone: the project of the library is not there.

View Source
var ErrMockupEmpty = errors.New("empty mockup")

ErrMockupEmpty: the mockup has nothing to make a board of.

View Source
var ErrNotPptx = errors.New("not a pptx")

ErrNotPptx: the bytes are not a PowerPoint file with a theme.

View Source
var ErrPublishEmpty = errors.New("nothing to publish")

ErrPublishEmpty: nothing of the project is left to publish.

View Source
var ErrStaleAccess = errors.New("stale access snapshot")

ErrStaleAccess: the snapshot is older than the one held; an out-of-order relay must not roll the roles back.

View Source
var KitToolNames = []string{"kit_list", "kit_index", "kit_component", "kit_search", "kit_tokens", "kit_templates", "kit_template", "kit_check"}

KitToolNames are the tools of the set, in the order tools/list gives them.

View Source
var PublicFileLimit int64 = 32 << 20

PublicFileLimit is the largest file the public route sends. A variable only so that a test of the limit does not push 32 MB of HTML through the page's expansion under -race.

View Source
var SiteReactions = []string{"👍", "❤️", "🎉", "👀", "✅", "🤔"}

SiteReactions is the emojis a comment may get: a fixed set, so a reaction is never free text.

VideoBuildIns is every build-in.

VideoFormats is every VideoFormat, in the order the page shows them.

View Source
var VideoGuideTopics = [...]string{"basics", "director", "motion", "characters", "engines", "overlays", "check", "record"}

VideoGuideTopics are the topics in the order a newcomer needs them.

View Source
var VideoOverlayAnchors = []VideoOverlayAnchor{"left", "center", "right"}

VideoOverlayAnchors is every anchor.

View Source
var VideoOverlayEnters = []VideoOverlayEnter{"fade", "rise", "pop", "typewriter", "mask", "words", "scramble"}

VideoOverlayEnters is every way in.

VideoOverlayKinds is every kind, in the order the page offers them.

View Source
var VideoOverlayLeaves = []VideoOverlayLeave{"none", "fade", "fall", "shrink"}

VideoOverlayLeaves is every way out.

View Source
var VideoOverlayThemes = []VideoOverlayTheme{"auto", "accent", "dark", "light"}

VideoOverlayThemes is every theme.

VideoTransitionKinds is every VideoTransitionKind.

Functions

func AgentBlockMessage

func AgentBlockMessage(a *Artifact, blocks string) string

AgentBlockMessage is the picked-element comments of a board, pasted as they are below the line naming the design.

func AgentMessage

func AgentMessage(a *Artifact, txt string) string

AgentMessage is one line for another agent's terminal naming the design and its files.

func AllowedKitRegistryHosts

func AllowedKitRegistryHosts() map[string]bool

AllowedKitRegistryHosts are the registry hosts a connect request may name.

func ArtifactDocument

func ArtifactDocument(m *ProjectModel, current *jsvalue.Object) []byte

ArtifactDocument is artifact.json built from the model over what the file holds now.

func BlankBoardHTML added in v0.16.5

func BlankBoardHTML(html string) bool

BlankBoardHTML is blankBoard on the board's text.

func BoardFromHTML

func BoardFromHTML(src string) []byte

BoardFromHTML makes a board of an ```html answer of the chat, the way the chat showed it: the page's styles and links go to <helmet>, its body's content into <main class="board"> (the body's own class and style with it), on the chat frame's base. The HTML is not trusted: it is read as a browser reads it and cut as a template's board is (scripts, handlers, addresses that run, frames), the engine's tags become plain boxes, and {{ }} in its text is not a substitution. Its scripts did not run in the chat and do not run on the board; making it live is the agent's work.

func BoardHref

func BoardHref(id, boardPath string) string

BoardHref is where a board lives on the library server: the path encoded per segment, the query as written.

func BoardKeyOf

func BoardKeyOf(b Board) string

BoardKeyOf is what a board is called in a claim: its file without the suffix, or the title of a wrapper's page.

func BoardOfPath

func BoardOfPath(rel string) (project, board string, ok bool)

BoardOfPath: <project>/project/<Board>.dc.html is that board of that project.

func BoardTitleOf

func BoardTitleOf(file string) string

func CLIHistoryNeedsKeeper

func CLIHistoryNeedsKeeper(r *http.Request) bool

CLIHistoryNeedsKeeper: an agent's restore with its session names the chat it speaks from, which the tab keeper knows. The body is read and put back for the handler.

func CanvasDocument

func CanvasDocument(m *ProjectModel, current *jsvalue.Object, key string) []byte

CanvasDocument is canvas.json built from the model over what the file holds now (nil when there is none).

func ChatsOf added in v0.15.40

func ChatsOf(links map[string][]string, transcriptOf map[string]string, lastActivity map[string]int64) map[string][]string

ChatsOf are, by design, the conversations whose transcripts worked on it (links, from Designs; transcriptOf maps a conversation to its transcript), the latest activity first.

func CheckEngine added in v0.16.86

func CheckEngine(ctx context.Context, o FetchOptions) (string, error)

CheckEngine is the type's current release. It reads the release's name only, so it needs no canvas and saves nothing.

func ClaimFileName

func ClaimFileName(board string) string

ClaimFileName is readable, cut to a safe length, and told apart from similar names by a hash of the exact key.

func CleanBoardKey

func CleanBoardKey(v any) (string, error)

CleanBoardKey is a board key an agent or a person typed: one line, and no way to be a path.

func CleanBrief

func CleanBrief(v any) (string, error)

CleanBrief is the person's brief for a new project: controls gone, trimmed, at most wire.DesignBriefMax characters. A dictated or pasted brief runs long, so the bound is wide; a longer text goes with the brief as a file.

func CleanTemplateBoard added in v0.16.154

func CleanTemplateBoard(src []byte) ([]byte, error)

CleanTemplateBoard is a template's board as it may land on someone else's project. The board is read the way a browser reads it (html.Parse: raw-text and foreign-content rules included), the tree is cut by an allowlist and written again, so what is checked is what the browser will see, not a token stream that reads differently.

  • elements that run or redirect go with their content: script (except the board engine), base, meta http-equiv, object, embed, applet, noscript, noembed, noframes, xmp, plaintext, math, and in svg: script, style, foreignObject, animate, set, animateTransform, animateMotion;
  • attributes: on*, srcdoc, and every address attribute (href, src, xlink:href, action, formaction, poster, data, values, to, from, by, ...) whose value runs (javascript:, vbscript:, file:, data: other than a picture).

The engine <script src="./support.js"> stays as exactly that node. base is always cut, so the relative address cannot be pointed elsewhere. The result is written again until it reads back as itself; a board that does not settle is refused.

func CleanText

func CleanText(v any, max int) (string, bool)

CleanText is a line of text from a shared file or an agent: one line, no controls, no direction tricks, cut to max; "" when nothing is left (null in the old runtime).

func ContentType

func ContentType(ext string) string

ContentType of a served extension; "" for one a design does not need.

func ContinuePrompt

func ContinuePrompt(a *Artifact, task string) string

ContinuePrompt is the dialog's first message: what the person asked, or to introduce the design and wait.

func DeckFFmpeg added in v0.16.5

func DeckFFmpeg() string

DeckFFmpeg is the ffmpeg the montage runs: RUNTIME_DESIGN_FFMPEG, else the one on PATH; "" when there is none.

func DeckNotesSeconds added in v0.16.5

func DeckNotesSeconds(words int) int

DeckNotesSeconds is how long a slide's notes take to say: max(10, round(words / 2.2 / 5) * 5). The page counts the same way (deck/notes-len.ts).

func DeckThemeCSSOf added in v0.16.5

func DeckThemeCSSOf(s DeckSettings) string

DeckThemeCSS is the stylesheet the boards link: the theme's variables and the font, sorted so the same settings give the same bytes.

func DeckWords added in v0.16.5

func DeckWords(text string) int

DeckWords counts the words of notes the way the page does (deck/notes-len.ts): runs of anything but white space.

func DefaultEngineDir added in v0.16.5

func DefaultEngineDir(dataDir string) string

DefaultEngineDir is where the engine of a runtime with this data dir is kept ("" without a data dir).

func DenyAnswer added in v0.16.15

func DenyAnswer(reason string) []byte

DenyAnswer is the hook's refusal of a tool call, with the words for the agent.

func DialogMessage added in v0.16.5

func DialogMessage(a *Artifact, words, task, rules string) string

DialogMessage is a design dialog's first message: the person's words as the chat shows them, and under them, in the design's <attached> block (internal/attach) that the page folds into the design's chip, everything the agent is told besides — the head of ContinuePrompt, the project's task, and rules for an agent that takes no instruction files. The transcript keeps the whole text, so the chat shows only the words after a reload too.

func DocStatus added in v0.16.86

func DocStatus(err error) int

DocStatus maps a Document API refusal to an HTTP status for a route.

func DoctorFFprobe added in v0.16.154

func DoctorFFprobe() string

DoctorFFprobe is the ffprobe the doctor reads the clip with: RUNTIME_DESIGN_FFPROBE, else the one next to ffmpeg, else PATH.

func EncodeURIComponent

func EncodeURIComponent(s string) string

EncodeURIComponent is JavaScript's encodeURIComponent.

func EngineHook added in v0.16.5

func EngineHook(input []byte, create bool) []byte

EngineHook is the PreToolUse hook of the fetch's sessions: the Artifact tool may read and list; the one publish that makes the canvas (a type_url and nothing else) only when create is set; anything else is denied. It answers the hook's JSON.

func Field

func Field(body *jsvalue.Object, k string) any

Field is a body field; nil when absent (undefined) or null.

func Fields

func Fields(body any) *jsvalue.Object

Fields is the body as an object: destructuring a string or null finds no fields.

func FileVersion

func FileVersion(st os.FileInfo) string

FileVersion is a file's version in an address: time and size in base 36.

func FindHeadlessShell added in v0.16.86

func FindHeadlessShell() string

FindHeadlessShell is the chrome-headless-shell this machine has: RUNTIME_DESIGN_HEADLESS_SHELL, else on PATH, else in the folders such a browser is installed to (~/.cache/chrome-headless-shell, puppeteer's and playwright's caches, /opt).

func GuardCLI

func GuardCLI() string

GuardCLI is the command name agents are told to run: RUNTIME_CLI_NAME when the deployment names one.

func GuardCanvas

func GuardCanvas(in GuardInput, cli string) (deny bool, reason string)

GuardCanvas says whether a tool call writes the built canvas.json of a design project, and the words for the agent.

func GuardHook added in v0.15.40

func GuardHook(raw []byte, cli string, env GuardEnv) []byte

GuardHook is GuardHookAnswer with the access check: a call that reads a project the person has no role in, or writes one they may only view, is refused with the words for the agent. With no snapshot, or one that does not enforce, the check is skipped (an old gateway, a machine that never got one); with one, an input the hook cannot read is refused, never let through.

func GuardHookAnswer

func GuardHookAnswer(raw []byte, cli string) []byte

GuardHookAnswer is the hook's answer to Claude Code: a refusal with its reason, or nothing. It knows nothing of who may open which project; GuardHook does.

func Has

func Has(body *jsvalue.Object, k string) bool

Has is whether a body field is present (not undefined), null included.

func HostAllowed

func HostAllowed(host string, port int) bool

HostAllowed: a DNS-rebinding page must not read the library through the loopback, only the names the proxy and a person use.

func IsAgentEntry

func IsAgentEntry(e os.DirEntry) bool

IsAgentEntry is what an agent could take as its own instructions or settings when it works in the folder: every hidden entry, every link and the instruction files read by name.

func IsBoardEditError

func IsBoardEditError(err error) bool

IsBoardEditError tells a refusal from a failure.

func IsBoardFile

func IsBoardFile(file string) bool

func IsClaimLive

func IsClaimLive(hb, now int64) bool

IsClaimLive: fresh by its heartbeat; a heartbeat from the future is no heartbeat.

func IsHistoryPath

func IsHistoryPath(rel string) bool

IsHistoryPath is whether a change at this path (relative to the root) is something the history keeps.

func IsHistoryRefusal

func IsHistoryRefusal(err error) bool

IsHistoryRefusal: a refusal the routes answer with 409.

func IsKitFontID

func IsKitFontID(id string) bool

IsKitFontID is whether id has the form of a kit font's address (not whether the kit is installed).

func IsLibraryID

func IsLibraryID(v string) bool

IsLibraryID: an artifact is addressed by its folder name in the library.

func IsPageError

func IsPageError(err error) bool

IsPageError tells a refusal from a failure.

func IsPageID

func IsPageID(v string) bool

IsPageID: a page id is a ULID in Crockford's base32, upper case.

func IsReleaseError

func IsReleaseError(err error) bool

IsReleaseError: the refusal is the person's to read.

func IsReleaseID

func IsReleaseID(v string) bool

IsReleaseID: a release is named by its folder in the mirror.

func IsTemplateFile

func IsTemplateFile(name string) bool

IsTemplateFile: the copy-me page of a new project is a pattern for agents, not a board.

func LineOfText

func LineOfText(source, txt string) int

LineOfText is the 1-based line of the first occurrence of an element's text in a board's source: the whole text first, then its start; 0 when the text is not in the file.

func MockupKey

func MockupKey(conv, src string) string

MockupKey names a mockup by its source: the same HTML of the same chat is the same board.

func NewPageID

func NewPageID() string

NewPageID is a fresh ULID of now. IDs made in the same millisecond still sort in the order they were made: the random part of the next one is the previous one plus one.

func NewestStable

func NewestStable(list []Release) string

NewestStable is the newest stable release, "" when there is none.

func NormalizeOrigin

func NormalizeOrigin(v string) string

NormalizeOrigin is an origin as a browser sends it (scheme://host[:port], lower case, no path or trailing slash); "" for anything that is not one.

func OneLineSafe

func OneLineSafe(s string) string

OneLineSafe is the same for a value that must stay on one line.

func OwnerLine

func OwnerLine(o ClaimOwner) string

OwnerLine is a claim's holder as a snapshot's Editor trailer names it.

func ParseBoardPath

func ParseBoardPath(raw any) string

ParseBoardPath is a path under project/ to an html page, with an optional query; "" when it is not one.

func ParseDocNodeID added in v0.16.86

func ParseDocNodeID(id string) (page string, tpl int, ok bool)

ParseDocNodeID reads "<page id>:<tpl>".

func ParsePagePath

func ParsePagePath(pagePath string) (ref, file string, ok bool)

ParsePagePath is the artifact and the file a page of the library server shows: /a/<ref>/p/<path>.

func ParseSpan added in v0.16.5

func ParseSpan(s string) (time.Duration, error)

ParseSpan reads a length of time: `30s`, `2m`, or plain seconds.

func ParseUnzipListing

func ParseUnzipListing(listing string) (bytes, entries int64, ok bool)

ParseUnzipListing is the total unpacked bytes and entries from `unzip -l`'s last line; ok false when it is not a listing unzip could make.

func ParseWhen added in v0.16.5

func ParseWhen(s string, now time.Time, loc *time.Location) (time.Time, error)

ParseWhen reads a time given as RFC3339, as a clock time of today (`14:03:22` or `14:03`, taken for yesterday when that would be in the future), as a time before now (`-90s`, `-2m`, `-1h`) or as `now`.

func PersonIn added in v0.16.154

func PersonIn(ctx context.Context) string

PersonIn is the person WithPerson put in ctx, or "" (then the runtime's own person stands for them).

func PhoneTargets

func PhoneTargets(subs []push.Subscription, sender string) []push.Subscription

PhoneTargets are the sender's other devices that said they are phones, else those that said nothing.

func PublishOrigin added in v0.16.15

func PublishOrigin(project string) string

PublishOrigin is what a site made from the project is marked with, so that only the project can publish onto it.

func PushMessage

func PushMessage(req PushRequest, tagPrefix string) push.Message

PushMessage is the notification of a board sent to a phone.

func Query

func Query(r *http.Request, k string) (string, bool)

Query is req.query[k] when it is one string; "" for an absent or repeated key.

func QueryString

func QueryString(r *http.Request, k string) string

QueryString is the design routes' queryString: the value when it is one string, else "".

func RegisterDeckExporter added in v0.16.5

func RegisterDeckExporter(f DeckExportFormat, e DeckExporter)

RegisterDeckExporter adds the exporter of a format; the parts register theirs from init.

func RenderMoment added in v0.16.5

func RenderMoment(m Moment, loc *time.Location) string

RenderMoment summarizes the window of a Moment: where the person was, what they did last, and what the page suffered around that time.

func RenderTimeline added in v0.16.5

func RenderTimeline(events []TimelineEvent, loc *time.Location, maxLines int) string

RenderTimeline is one line per event, with the page named when it changes and runs of scrolling merged into one line. At most maxLines lines are written (0: no limit); the rest is counted.

func ResolveBoardKey

func ResolveBoardKey(a *Artifact, name any) (string, error)

ResolveBoardKey is the board a person or an agent named: by its page id, its title, its file, or its file without the suffix; the key is the page id when the board has one. A name no board has is kept, an agent claims the board it is about to create.

func RootOf

func RootOf(cfg Config) string

RootOf is the library folder a configuration names, without starting a library (nothing is read or written but the workspace's config).

func ScopePath

func ScopePath(project string, file *string) (string, error)

ScopePath is the path a scope names in the repository: a project, or one board file of it.

func SetScene3DBuilders

func SetScene3DBuilders(f func() *builders.Client)

SetScene3DBuilders is how the runtime gives the 3D scene its pool of builders.

func SetScene3DGenerator

func SetScene3DGenerator(g Scene3DGenerator)

SetScene3DGenerator is how the runtime gives the 3D scene its video generator.

func SlugifyArtifactID

func SlugifyArtifactID(name string, taken map[string]bool) string

SlugifyArtifactID is an id from a file or project name: transliterated, lower case, dashes; -2, -3… when taken.

func SnapshotMessage

func SnapshotMessage(paths, editors []string, runtime, subject string) (string, string)

SnapshotMessage is the words of a snapshot: which boards changed, who held them and the runtime that saved it.

func StoreRevID

func StoreRevID(rev int64) string

StoreRevID is the version id of a store revision (storerev.ID).

func StoreRevOf

func StoreRevOf(id string) (int64, bool)

StoreRevOf reads a version id made by StoreRevID: the store's revision, false for a version of git.

func StripControlChars

func StripControlChars(s string) string

StripControlChars is text bound for a terminal prompt: ESC stays visible as ␛, other controls go, tabs and newlines stay.

func ThumbSize

func ThumbSize(boardPath string, w, h int) (width, height int, mobile bool)

ThumbSize is the size a board's gallery picture is drawn at: its own (w, h) when the project says it, a phone for a page built for one, a desktop otherwise.

func ULID

func ULID(ms int64, entropy [10]byte) string

ULID is the 26-character id of a time in ms and 80 bits of entropy.

func ValidSelector added in v0.16.86

func ValidSelector(s string) error

ValidSelector says whether the Document API reads a selector.

func ValidateDeckSettings added in v0.16.5

func ValidateDeckSettings(s DeckSettings) error

ValidateDeckSettings checks a whole settings value against the bounds of deck_types.go.

func ValidateScene3DSettings

func ValidateScene3DSettings(s Scene3DSettings) error

ValidateScene3DSettings checks the paths: Root is an absolute folder, Blend a .blend inside it, Script a file inside it.

func ValidateVideoOverlay added in v0.16.86

func ValidateVideoOverlay(o VideoOverlay) error

ValidateVideoOverlay checks one overlay against the contract's bounds.

func ValidateVideoOverlays added in v0.16.86

func ValidateVideoOverlays(list []VideoOverlay) error

ValidateVideoOverlays checks a scene's list: each overlay, unique ids, at most VideoOverlaysMax.

func ValidateVideoSceneMeta added in v0.16.42

func ValidateVideoSceneMeta(m VideoSceneMeta) error

ValidateVideoSceneMeta checks a scene's meta against the contract's bounds.

func ValidateVideoScreen

func ValidateVideoScreen(s *VideoScreen) error

ValidateVideoScreen checks the zooms: each in bounds, ids unique, and no two at the same time (one camera).

func ValidateVideoSettings added in v0.16.42

func ValidateVideoSettings(s VideoSettings) error

ValidateVideoSettings checks a video's settings against the contract's bounds.

func ValidateVideoZoom

func ValidateVideoZoom(z VideoZoom) error

ValidateVideoZoom checks one zoom against the bounds.

func VideoAutoDur added in v0.16.42

func VideoAutoDur(lastMomentEnd int64, words int) int64

VideoAutoDur is a scene's automatic duration (D5): clamp(round100(max(3000, lastMomentEnd + 600 + 1500, words / 2.5 × 1000)), 1000, 60000). Durations are computed only in Go; the page lays out what it is given.

func VideoGuide added in v0.16.86

func VideoGuide(topic, cli string) (string, bool)

VideoGuide is a topic's text with the command's name put in; false when there is no such topic.

func VideoOverlayClashes added in v0.16.86

func VideoOverlayClashes(list []VideoOverlay, id string) []string

VideoOverlayClashes names the overlays that stand on the one with this id at the same time: boxes that cross by more than a fifth of the smaller one while both are on screen. A highlight is an area, not a text, and is left out. It is a warning for whoever placed the overlay, not a refusal.

func VideoPublishedName added in v0.16.42

func VideoPublishedName(f VideoFormat) string

VideoPublishedName is the published MP4 of a format under DeckPublishedDir: video.mp4 for 16:9 (the name guests of a deck already read), video-9x16.mp4 for 9:16.

func WarmKitCards

func WarmKitCards(dir string)

WarmKitCards reads the cards of the folder once, so the first home after a start does not wait for them.

func WhoOf

func WhoOf(e HistoryEntry) string

WhoOf is «who» for a person: the snapshot's editors, else that nobody held the board.

func WithPerson added in v0.16.154

func WithPerson(ctx context.Context, person string) context.Context

WithPerson carries the address of the person who made a request into the work it starts (the v2 services take a context, not the request): their own section of the access snapshot decides what they may see.

func WordsAbove added in v0.16.5

func WordsAbove() string

WordsAbove stands for the person's words in a task the agent reads under them: DialogMessage keeps the words out of the block, so they are said once and the chat shows them as typed.

Types

type API

type API struct {
	L *Library
	// Session: the request carries a page session. CLIToken: it carries the runtime's cli-token.
	Session, CLIToken func(*http.Request) bool
	// Person is the address of the person whose page session made the request ("" when unknown: no session, a
	// session that names no address, the machine agent's own). The owner of what they make.
	Person func(*http.Request) string
	// MachineAgent: the request is the machine agent's own (the access snapshot is taken from nobody else).
	MachineAgent func(*http.Request) bool
	// APIRefusal is the dispatcher's answer to a caller with neither; refused false for anyone else.
	APIRefusal func(*http.Request) (status int, body any, h http.Header, refused bool)
	// UploadFile is the file of a finished chunked upload by its id (nil while none is wired): a kit file too big for one
	// request arrives that way.
	UploadFile func(id string) (path string, ok bool)
	// OpenPane asks the right pane of the chat a tmux session belongs to (and the panes of the chats it was delegated
	// by) to show a design, on a board ("" for the one it shows): as `open design` does, kept with the chat,
	// behind with a dot. False when the session is no chat's or the pane cannot be asked. Nil while the core does not run.
	OpenPane func(session, ref, board string) bool
	// TellChat puts a comment that calls @harnessly into the chat conv, as a message of the person who wrote
	// it (not the owner's own words); from names them, about says where it was written. Nil while the core does not run.
	TellChat func(ctx context.Context, conv, from, about, text string) error
	// PlatformAPI prefixes the platform's routes.
	PlatformAPI string
	// Launch starts an agent conversation (nil while the core does not run).
	Launch func(LaunchRequest) LaunchResult
	// Terminal reaches an agent's terminal (nil while the core does not run).
	Terminal Terminal
	// Push sends a board to the person's phones: the statuses of the push services, nothing when there was no device.
	Push func(PushRequest) []int
	// AppBase is the platform pages' mount point (a pushed board's link).
	AppBase string
	// OneShot is one tool-less, session-less call of the agent's model (a deck's dictation tidied into notes); nil
	// while none is wired, and the tidy route then answers 503.
	OneShot func(ctx context.Context, prompt string) (string, error)
	// Images draws pictures for a design (nil while none is wired: the image route then answers 503).
	Images *imagegen.Service
	// PublicToken checks the tokens of the public read (design-public).
	PublicToken PublicConfig
	// ShareGate runs the apps' checks of the share trigger before a link to a project is made; it answers the refusal
	// when one blocks, nil to let the link be made (and while no apps are wired).
	ShareGate func(ctx context.Context, project string) *ShareRefusal
	// GuestApp is the built web page (web/dist): the guest page of a link without sign-in is served from it.
	GuestApp fs.FS

	Log func(level, msg string, err error)
	// contains filtered or unexported fields
}

API answers the library's routes as the previous runtime's dispatcher and handlers did.

func (*API) Boards

func (a *API) Boards(r *http.Request) Answer

Boards is POST {artifact, action, path?, title?, delta?}: a board renamed, moved, duplicated or removed, or the design renamed; the boards as they are now.

func (*API) CLICheck

func (a *API) CLICheck(r *http.Request, body *jsvalue.Object, artifact string) Answer

CLICheck is the check part of POST /api/cli/design {artifact, boards?, wait?}: 202 with the report as an agent reads it, or with wait the finished report (polled every second, at most ten minutes).

func (*API) CLIClaims

func (a *API) CLIClaims(r *http.Request) Answer

CLIClaims is the agents' board claims: GET ?project= who holds what; POST {action:'claim', session, project, board} takes a board for the chat owning the tmux session, {action:'release', session, project?, board?} lets go.

func (*API) CLIDesign

func (a *API) CLIDesign(r *http.Request) Answer

CLIDesign is the library for agents: GET lists the designs, ?logs= what a person's preview logged, ?state= what it shows; POST {artifact, control} drives the open preview, POST {artifact, boards?, wait?} checks boards.

func (*API) CLIExport

func (a *API) CLIExport(r *http.Request) Answer

CLIExport is POST {project, page?, format} (start; answers the job) and GET ?project=&job= (the job; when it is done, the path of the file with its human name).

func (*API) CLIGuard

func (a *API) CLIGuard(r *http.Request) (body any, refused *Answer)

CLIGuard is a CLI route's check: open to the dispatcher, the handler wants the cli-token.

func (*API) CLIHistory

func (a *API) CLIHistory(r *http.Request) Answer

CLIHistory is the history for agents: GET ?project=&board=&n= lists versions, POST { action: 'restore', project, board, at, session? } puts a board back as it was.

func (*API) CLINotes added in v0.16.5

func (a *API) CLINotes(r *http.Request) Answer

CLINotes is the agents' notes command of a deck: GET ?project=&page= answers {project, slides: DeckSlide} (one slide when page is given: an id, file or title); POST {project, page, text} sets a slide's notes.

func (*API) CLIPages

func (a *API) CLIPages(r *http.Request) Answer

CLIPages is the agents' page commands of a project with meta/: GET ?project= lists the pages; POST {action:'create', project, title, file?, route?, variantOf?, w?, h?, expand?}, {action:'new', title, page?, session?} makes a project of the person's with its first page, {action:'rename', project, page, title?, file?}, {action:'device', project, page, device} and {action:'remove', project, page} change them. A page is named by its id, file or title.

func (*API) CLIScene3D

func (a *API) CLIScene3D(r *http.Request) Answer

CLIScene3D is GET ?project=&what=state|comments[&open=1] (view): {project, state: Scene3DState} or {project, comments}.

func (*API) CLIScene3DAdd

func (a *API) CLIScene3DAdd(r *http.Request) Answer

CLIScene3DAdd is POST {title?, root, blend | file, script?, project?} (edit): the 3D scene document over a blender-lab project folder of this machine, a new one or (the same .blend) the one it already has; {id, title, existed}. file is a .blend from elsewhere, copied into the project; project is a project the person's brief already made. The settings are only written here, on the machine: a page cannot point at a path.

func (*API) CLIScene3DFrame

func (a *API) CLIScene3DFrame(r *http.Request) Answer

CLIScene3DFrame is POST {project, cam, frame, wait?: seconds} (view): the draft frame; with wait it holds until the frame is ready (or failed) and answers {frame, path} with the cached JPEG's absolute path for the agent to open.

func (*API) CLISiteComments

func (a *API) CLISiteComments(r *http.Request) Answer

CLISiteComments is the agent's: GET ?project=&board=&open=1 (view): {project, comments}; POST {project, id, text} (comment): the agent's reply in the thread id; PATCH {project, id, resolved} (comment): the thread resolved or open.

func (*API) CLISiteProps

func (a *API) CLISiteProps(r *http.Request) Answer

CLISiteProps is the agent's: GET ?project= (view): {project, props: SiteProps}; POST {project, board, values} (edit): the values put over the board's others (a null value goes back to the board's own), {project, props} after.

func (*API) CLIVideo added in v0.16.42

func (a *API) CLIVideo(r *http.Request) Answer

CLIVideo is GET ?project=&what=state|comments[&open=1] (view): {project, state: VideoState} or {project, comments: DeckComment} (open: only the unresolved ones).

func (*API) CLIVideoCheck added in v0.16.42

func (a *API) CLIVideoCheck(r *http.Request) Answer

CLIVideoCheck is POST {project, page?, format?} (view): {issues: VideoCheckIssue}.

func (*API) CLIVideoFrame added in v0.16.42

func (a *API) CLIVideoFrame(r *http.Request) Answer

CLIVideoFrame is GET ?project&page&at[&format&strip=a:b:step&draft&sheet=1] (view): {frames: [{t, path}]}, absolute paths of the cached JPEGs for the agent to open. format is the video's first format when not given; strip is a stretch in ms (from a to b, every step), instead of at.

func (*API) CLIVideoOverlay added in v0.16.86

func (a *API) CLIVideoOverlay(r *http.Request) Answer

CLIVideoOverlay is POST {project, page, action, id?, force?, ...fields} (edit; ls: view): {project, ...the answer}. The edit is the agent's.

func (*API) CLIVideoRender added in v0.16.42

func (a *API) CLIVideoRender(r *http.Request) Answer

CLIVideoRender is POST {project, format, page?, draft} (edit) and GET ?project&id (view): as VideoRender, the plain VideoRenderJob. page is a scene's id, file or title.

func (*API) CLIVideoScene added in v0.16.42

func (a *API) CLIVideoScene(r *http.Request) Answer

CLIVideoScene is POST {project, page: id|file|title, dur?: ms|null, transition?: {kind, ms}|null} (edit): {project, scene: VideoScene}.

func (*API) CLIVideoScreen

func (a *API) CLIVideoScreen(r *http.Request) Answer

CLIVideoScreen is POST {project, page, action, ...} (edit; ls: view): {project, ...the answer}. The edit is the agent's.

func (*API) Check

func (a *API) Check(r *http.Request) Answer

Check is GET ?artifact= (the last check, filling while it runs) and POST {artifact, boards?} (start one).

func (*API) ClaimProject added in v0.15.40

func (a *API) ClaimProject(r *http.Request) Answer

ClaimProject is POST {project}: take ownership of an ownerless project.

func (*API) Continue

func (a *API) Continue(r *http.Request, resolveCwd func(string, []string) (string, error)) Answer

Continue is POST {artifact, prompt?}: a new agent conversation in the design's folder.

func (*API) Create

func (a *API) Create(r *http.Request, resolveCwd func(string, []string) (string, error)) Answer

Create is POST {title, brief}: the library's template copied to a new project and an agent conversation started in it with the brief; a project made whose conversation did not start is an error that still names the project.

func (*API) Deck added in v0.16.5

func (a *API) Deck(r *http.Request) Answer

Deck is GET ?artifact= (view): the DeckState.

func (*API) DeckComments added in v0.16.5

func (a *API) DeckComments(r *http.Request) Answer

DeckComments is POST {artifact, page, x, y, label, text} (comment): the DeckComment; and PATCH {artifact, id, resolved} (comment): the DeckComment, or {id, resolved} for a guest comment's id g-<n>.

func (*API) DeckExport added in v0.16.5

func (a *API) DeckExport(r *http.Request) Answer

DeckExport is POST {artifact, format, rec?, publish?} (view; publish needs edit): the new DeckExportJob; and GET ?artifact=&job= (view): the job.

func (*API) DeckExportFile added in v0.16.5

func (a *API) DeckExportFile(w http.ResponseWriter, r *http.Request)

DeckExportFile is GET ?artifact=&job= (view): the finished file as an attachment named after the deck's title.

func (*API) DeckNotes added in v0.16.5

func (a *API) DeckNotes(r *http.Request) Answer

DeckNotes is PUT {artifact, page, text} (edit): {slide: DeckSlide}; removes the page's .raw.md.

func (*API) DeckPatch added in v0.16.5

func (a *API) DeckPatch(r *http.Request) Answer

DeckPatch is POST DeckPatchRequest (edit): 200 {rev} ({rev, was} for an image: the element's new fingerprint); 409 {code: DeckPatchChanged}; 422 {code: DeckPatchDynamic}.

func (*API) DeckPdf added in v0.16.5

func (a *API) DeckPdf(r *http.Request) Answer

DeckPdf is POST {artifact, auto} (edit): starts or stops keeping the deck's PDF for guests; answers {published} at once, the build runs in the background.

func (*API) DeckPptxStyle added in v0.16.5

func (a *API) DeckPptxStyle(w http.ResponseWriter, r *http.Request)

DeckPptxStyle is POST with a .pptx body of at most 50 MB (edit of any project; used before the deck exists): the DeckPptxStyle read from ppt/theme/theme1.xml and the count of slideLayouts. x-design-filename (URI-encoded) names it.

func (*API) DeckRec added in v0.16.5

func (a *API) DeckRec(r *http.Request) Answer

DeckRec is GET ?artifact=&rec= (view): the DeckRecording; and POST {artifact, camera, mime} (edit): {rec} with the new recording's id.

func (*API) DeckRecChunk added in v0.16.5

func (a *API) DeckRecChunk(w http.ResponseWriter, r *http.Request)

DeckRecChunk is POST ?artifact=&rec=&seq= with webm bytes (edit): 204, the same seq again changes nothing, a seq out of order answers 409 {next}.

func (*API) DeckRecEdit added in v0.16.5

func (a *API) DeckRecEdit(r *http.Request) Answer

DeckRecEdit is PUT {artifact, rec, edit: DeckEdit} (edit): the DeckRecording.

func (*API) DeckRecEvents added in v0.16.5

func (a *API) DeckRecEvents(r *http.Request) Answer

DeckRecEvents is POST {artifact, rec, lines: DeckEvent} (edit): 204.

func (*API) DeckRecFinish added in v0.16.5

func (a *API) DeckRecFinish(r *http.Request) Answer

DeckRecFinish is POST {artifact, rec, durationMs} (edit): the DeckRecording; the transcript is built behind it.

func (*API) DeckRecMedia added in v0.16.5

func (a *API) DeckRecMedia(w http.ResponseWriter, r *http.Request)

DeckRecMedia is GET ?artifact=&rec= with Range (view): av.webm through http.ServeContent.

func (*API) DeckSettings added in v0.16.5

func (a *API) DeckSettings(r *http.Request) Answer

DeckSettings is PUT {artifact, settings: part of DeckSettings} (edit): {settings}; rewrites DeckThemeCSS.

func (*API) DeckSlide

func (a *API) DeckSlide(r *http.Request) Answer

DeckSlide is POST {artifact, layout} (edit): a new slide that starts as the layout of an installed kit (<kit>[@version]/<theme>/<layout>); the theme's folder is put into the project. Answers {page}.

func (*API) DeckTidy added in v0.16.5

func (a *API) DeckTidy(r *http.Request) Answer

DeckTidy is POST {artifact, page: string|null, raw, lang} (edit): {slides: DeckTidied}. One call of a.OneShot; page null is the whole deck, which the model splits by slide. Writes the .md and the .raw.md of each slide.

func (*API) DeleteProject added in v0.16.15

func (a *API) DeleteProject(r *http.Request) Answer

DeleteProject is POST {project}: the project goes to the trash. Only its owner may.

func (*API) DesignImage added in v0.16.86

func (a *API) DesignImage(r *http.Request) Answer

func (*API) DesignImageFile added in v0.16.86

func (a *API) DesignImageFile(w http.ResponseWriter, r *http.Request)

DesignImageFile is GET ?artifact=&file= — a picture a job drew into the project (assets/<job>-<n>.png), for the thumbnails of the choice. ?file= serves only a job's own file names, from the project's assets folder; ?path= any picture the project holds (the original of a change), by its path in the project, links followed and confined to it.

func (*API) EngineStatus added in v0.16.5

func (a *API) EngineStatus(r *http.Request) Answer

EngineStatus is GET what this machine has for the design tool: the engine, the browser, ffmpeg, and the command that fetches the engine.

func (*API) FolderDelete

func (a *API) FolderDelete(r *http.Request) Answer

FolderDelete is POST {id, projects: "keep"|"trash"}: the folder goes. "keep" lays its projects at the top; "trash" sends those the person owns to the trash first (the rest are laid at the top, they are not theirs to delete).

func (*API) FolderMove

func (a *API) FolderMove(r *http.Request) Answer

FolderMove is POST {projects: [id], folder}: projects laid in a folder ("" is the top).

func (*API) FolderSave

func (a *API) FolderSave(r *http.Request) Answer

FolderSave is POST {id?, name, parent?}: a folder made or renamed.

func (*API) Guard

func (a *API) Guard(r *http.Request, methods ...string) (body *jsvalue.Object, refused *Answer)

Guard is the design routes' check: the dispatcher's session-or-token, then a page session, the allowed methods and a JSON body for anything but GET. The body is read in between, as the dispatcher read it before the handler ran.

func (*API) GuestToken added in v0.16.154

func (a *API) GuestToken(r *http.Request) Answer

GuestToken is POST design/guest-token {project, rev?, pin?, pages?} of the platform's API, for the machine agent only: a short token for the public read of one project, which the hub carries to fetch a share link's guest view.

func (*API) History

func (a *API) History(r *http.Request) Answer

History is GET ?artifact=&board= (the latest versions of a board) and POST { artifact, board, revision } (put the board back as it was at that version, 204).

func (*API) Import

func (a *API) Import(r *http.Request) Answer

Import is POST with a zip export as the body (x-design-filename, URI-encoded, names it): a new library project. The route is open at the dispatcher and reads its own body.

func (*API) KitAdopt

func (a *API) KitAdopt(r *http.Request) Answer

KitAdopt is POST design/kits/adopt {kit, dryRun}: the projects that carry a copy of the kit's themes move onto the kit's versions (AdoptKitCopies), only those the person may edit; dryRun reports and changes nothing.

func (*API) KitCanvas

func (a *API) KitCanvas(r *http.Request) Answer

KitCanvas is GET ?kit=&version=&theme= (a session): the theme's canvas with its atlases. Without a version, the newest; without a theme, the first.

func (*API) KitCanvasList

func (a *API) KitCanvasList(r *http.Request) Answer

KitCanvasList is GET (a session): {kits: KitCard}.

func (*API) KitDraftAction

func (a *API) KitDraftAction(r *http.Request) Answer

KitDraftAction is POST design/kits/draft {kit, action: start | discard}.

func (*API) KitExport

func (a *API) KitExport(w http.ResponseWriter, r *http.Request)

KitExport is GET ?id=&version= (a session): the kit as one file. A kit with license-restricted files is refused with 409 {error, restricted:[...]} until ?acceptRestricted=1 confirms; ?withSources=1 adds the sources.

func (*API) KitFile

func (a *API) KitFile(w http.ResponseWriter, r *http.Request)

KitFile is GET ?kit=&version=&path= (a session): a file of an installed version, or with &theme=&prep=<name> a prepared file of its theme. A version never changes, so the answer is kept for good.

func (*API) KitFontsList

func (a *API) KitFontsList(r *http.Request) Answer

KitFontsList is GET (a session): {fonts: KitFont}, the fonts of the installed kits a deck can take.

func (*API) KitImport

func (a *API) KitImport(w http.ResponseWriter, r *http.Request)

KitImport is POST (a session) with the kit file as the body, or with ?upload=<id> naming a finished chunked upload (the way a big file comes; the upload is deleted once the kit is installed or refused for good): ?dryRun=1 checks and installs nothing, ?asId= and ?asVersion= install under another name. Answers {id, version, installed, unchanged, manifest, warnings}; 409 {error, conflict:{added,changed,removed}} when the version is installed with other content; 422 for a file that does not check out.

func (*API) KitLayoutsList

func (a *API) KitLayoutsList(r *http.Request) Answer

KitLayoutsList is GET (a session): {layouts: designkit.Layout}, the slide layouts of the installed kits.

func (*API) KitLinkRoute

func (a *API) KitLinkRoute(r *http.Request) Answer

KitLinkRoute is GET ?artifact= (a session, view): {link: KitLink | null}, the kit the project is built on.

func (*API) KitProject

func (a *API) KitProject(r *http.Request) Answer

KitProject is POST {kit, version, theme, template} (a session): the template as a project of boards, one page per layout in the template's order. The same template of the same version opens the project made for it before, while it is there. Answers {id, title}.

func (*API) KitPublish

func (a *API) KitPublish(r *http.Request) Answer

KitPublish is POST design/kits/publish {kit, part, notes}.

func (*API) KitSettingsRoute

func (a *API) KitSettingsRoute(r *http.Request) Answer

KitSettingsRoute is POST design/kits/settings {kit, readOnly}: the kit's maker makes it for viewing only, or not.

func (*API) KitUsage

func (a *API) KitUsage(r *http.Request) Answer

KitUsage is GET ?kit= (a session): {projects: KitLink}, the projects on the kit.

func (*API) KitVersionsState

func (a *API) KitVersionsState(r *http.Request) Answer

KitVersionsState is GET design/kits/state?kit=.

func (*API) Layout

func (a *API) Layout(r *http.Request) Answer

Layout is POST {}: the person's folders, where their projects lie and the design system each was built on.

func (*API) Leases added in v0.16.15

func (a *API) Leases(r *http.Request) Answer

Leases is the web UI's side of the board leases, the library of this runtime answering for whichever backend it uses (the design center, or the library's .claims folder).

GET  ?project=      {mode, leases: LeaseView[]}  the live leases (of a project, or of the projects the person may see)
POST {action: "take"|"release"|"force"|"ask", project, board}
  take     the person edits the board in the page (client: the page's id): take or renew the lease, call on every edit;
           409 {error, holder} when another chat or person holds it
  release  let go of the person's own lease; 409 {code: "turn_running"} while that chat's agent works
  force    take the person's own lease off at once ("Снять — это зависло"); the chat is told on its next edit
  ask      ask the other person to release (they see it in LeaseView.requests); 200 {ok: true}

A lease of another person is never taken by these calls; 403 {code: "not_yours"} when force/release name one.

func (*API) Library

func (a *API) Library(r *http.Request) Answer

Library is GET the machine's design library: the projects with the agents working on them, their checks and claims, and the port of the library server, started here on first use; ?lite=1 gives only the port.

func (*API) Locate

func (a *API) Locate(r *http.Request) Answer

Locate is POST {path, text}: the file and line of an element picked on a library page.

func (*API) Message

func (a *API) Message(r *http.Request) Answer

Message is POST {tabId, artifact, text, blocks?}: the text goes into that agent conversation, prefixed with the design and its folder, typed the way a person types it; picked-element comments (blocks) are pasted whole.

func (*API) PackExport

func (a *API) PackExport(w http.ResponseWriter, r *http.Request)

PackExport is GET ?project=<id>&project=<id>… or ?all=1, with &kit=<id>[@version] for kits on their own (a session): the pack as one file. Kits with license-restricted files are refused with 409 {error, restricted:[…]} until ?acceptRestricted=1 confirms.

func (*API) PackImport

func (a *API) PackImport(w http.ResponseWriter, r *http.Request)

PackImport is POST (a session) with the pack as the body, or with ?upload=<id> naming a finished chunked upload (the way a big file comes; the upload is deleted once the pack is installed or refused for good): ?dryRun=1 reports what would be added and changes nothing. Answers the PackImportResult; 409 {error, conflict:[{id,version,status,diff}]} when a kit version is installed with other content; 422 for a file that is not a pack, is damaged, or comes from a newer format.

func (*API) PageLog added in v0.15.40

func (a *API) PageLog(r *http.Request) Answer

PageLog is GET ?artifact=: what the open pages of the design logged (errors, rejections, long tasks, slow loads), for the site's DevTools; the same record an agent reads with `design logs`.

func (*API) PersonOf added in v0.16.123

func (a *API) PersonOf(r *http.Request) string

PersonOf is the address of the person who made the request, or "" (then the runtime's own person stands for them).

func (*API) PostAccess added in v0.15.40

func (a *API) PostAccess(r *http.Request) Answer

Access route: the gateway's snapshot, relayed by the machine agent. Nobody else may post it.

func (*API) ProjectKitRoute

func (a *API) ProjectKitRoute(r *http.Request) Answer

ProjectKitRoute is GET / POST design/project/kit.

func (*API) ProjectVersionDiff

func (a *API) ProjectVersionDiff(r *http.Request) Answer

ProjectVersionDiff is GET design/project/versions/diff?artifact=&revision=.

func (*API) ProjectVersionRename

func (a *API) ProjectVersionRename(r *http.Request) Answer

ProjectVersionRename is POST design/project/versions/rename {artifact, revision, name}; an empty name unnames it.

func (*API) ProjectVersionRestore

func (a *API) ProjectVersionRestore(r *http.Request) Answer

ProjectVersionRestore is POST design/project/versions/restore {artifact, revision}.

func (*API) ProjectVersionsRoute

func (a *API) ProjectVersionsRoute(r *http.Request) Answer

ProjectVersionsRoute is GET / POST design/project/versions.

func (*API) Public added in v0.15.40

func (a *API) Public(w http.ResponseWriter, r *http.Request)

Public answers GET design-public/<project>[/<path>] of the platform's API: the board list of the project, or one file of its folder, for a request carrying a good token of the project and nothing else.

func (*API) PublicMatch added in v0.15.40

func (a *API) PublicMatch(r *http.Request) bool

PublicMatch: the request is for design-public of the platform's API.

func (*API) Publish added in v0.16.15

func (a *API) Publish(r *http.Request) Answer

Publish is POST <platform>/design/publish {project, name, access, pages?, revision?}: the project's pages (as they were at revision, when one is named) go to the machine's hub as the next version of the site `name` and the answer is the site's address.

func (*API) Published added in v0.16.123

func (a *API) Published(r *http.Request) Answer

Published is GET <platform>/design/published?project=: the site made from the project, as the machine's hub keeps it, so that «Поделиться» shows its address after a reload. `site` is null when there is none, or no hub with sites.

func (*API) Releases

func (a *API) Releases(r *http.Request) Answer

Releases is the board format's releases on this machine. GET ?artifact= lists them with the project's own; POST {artifact, release} moves a project to a stable release, POST {newProjects: release|null} sets the release new projects start on (null: the newest stable one). Nothing moves a project but an explicit call.

func (*API) Scene3D

func (a *API) Scene3D(r *http.Request) Answer

Scene3D is GET ?artifact= (view): the Scene3DState.

func (*API) Scene3DBuild

func (a *API) Scene3DBuild(r *http.Request) Answer

Scene3DBuild is POST {artifact} (edit): builds the model again after a failure; {model: Scene3DModel}.

func (*API) Scene3DClip

func (a *API) Scene3DClip(r *http.Request) Answer

Scene3DClip is POST {artifact, cam, start, end, step?, retry?} (comment): asks for a draft animation of a camera over frames start..end taking every step-th (drawn small, one frame at a time); answers the Scene3DClip, ready from the cache or going.

func (*API) Scene3DClipFile

func (a *API) Scene3DClipFile(w http.ResponseWriter, r *http.Request)

Scene3DClipFile is GET ?artifact&key (view, body route): a ready clip's MP4.

func (*API) Scene3DComments

func (a *API) Scene3DComments(r *http.Request) Answer

Scene3DComments is POST {artifact, text, label?, object?, p?, cam?, frame, render?, shot?} (comment): the DeckComment of a pin; and PATCH {artifact, id, resolved} as the deck's (comment).

func (*API) Scene3DFinal

func (a *API) Scene3DFinal(r *http.Request) Answer

Scene3DFinal is POST {artifact, action: "plan", cam, start, end} | {artifact, action: "start", plan, confirm: true} (edit): the plan of a final render on a rented GPU with its estimate (nothing rented), or the render of a plan the person confirmed.

func (*API) Scene3DFixImage

func (a *API) Scene3DFixImage(w http.ResponseWriter, r *http.Request)

Scene3DFix is GET ?artifact&id&which=before|after (view, body route): the frame a pin was closed with, as image/jpeg.

func (*API) Scene3DFrame

func (a *API) Scene3DFrame(r *http.Request) Answer

Scene3DFrame is POST {artifact, cam: {n}|{pos, target, fov}, frame, retry?} (comment): asks for the draft frame "as it will be" and answers its Scene3DFrame at once: ready from the cache, or queued/building to ask for again.

func (*API) Scene3DFrameImage

func (a *API) Scene3DFrameImage(w http.ResponseWriter, r *http.Request)

Scene3DFrameImage is GET ?artifact&key (view, body route): a draft frame as image/jpeg. A key is its content's address.

func (*API) Scene3DGenerate

func (a *API) Scene3DGenerate(r *http.Request) Answer

Scene3DGenerate is POST {artifact, action: "estimate"|"start", outputs, model, prompt, seconds, source, confirm?} (edit): the generator's price of the generation, or its start by a person who confirmed the price. Money is spent only by "start".

func (*API) Scene3DModel

func (a *API) Scene3DModel(w http.ResponseWriter, r *http.Request)

Scene3DModel is GET ?artifact[&h=hash] (view, body route): the model as a binary glTF. By hash it never changes, so the browser keeps it.

func (*API) Scene3DOutputFileRoute

func (a *API) Scene3DOutputFileRoute(w http.ResponseWriter, r *http.Request)

Scene3DOutputFileRoute is GET ?artifact&key&name (view, body route): a file of a set of outputs (a picture, the manifest).

func (*API) Scene3DOutputsRoute

func (a *API) Scene3DOutputsRoute(r *http.Request) Answer

Scene3DOutputsRoute is POST {artifact, cam, frames?, passes?, masks?, retry?} (comment): makes the outputs of a camera at a few frames for a generator (docs/scene3d-outputs.md); answers the Scene3DOutputs, ready from the cache or going.

func (*API) Scene3DShot

func (a *API) Scene3DShot(w http.ResponseWriter, r *http.Request)

Scene3DShot is GET ?artifact&id (view, body route): the viewport picture of a pin as image/jpeg.

func (*API) Scene3DToVideo

func (a *API) Scene3DToVideo(r *http.Request) Answer

Scene3DToVideo is POST {artifact, clip, video?} (edit): the clip as a new scene of a video document (a new document when video is empty); {video, scene, page, folder, origin, new}.

func (*API) Scene3DView

func (a *API) Scene3DView(r *http.Request) Answer

Scene3DView is POST {artifact, object, pin, cam, frame, playing, acked} (view): {cmds: Scene3DViewCmd}.

func (*API) Send

func (a *API) Send(r *http.Request) Answer

Send is POST {artifact, board, title?, deviceId?}: a push to the person's other devices that opens the board alone in the window; {sent} is the number of devices the push services accepted it for.

func (*API) ServeSnapshot

func (a *API) ServeSnapshot(w http.ResponseWriter, r *http.Request, project string, segments []string, rev string, pages []string)

ServeSnapshot answers a public read of a project from the library as it is, with no token: the hub's own read of a store revision it put into a folder and judged itself (the link, its pages; HRN-881). A pinned read says its version in rev, as the runtime's answer to a pinned token does; pages nil opens every board.

func (*API) Shot

func (a *API) Shot(w http.ResponseWriter, r *http.Request)

Shot is GET ?artifact=&file= — a screenshot of a design's check: the cover of a card and the report's thumbnails.

func (*API) SiteCommentAgent

func (a *API) SiteCommentAgent(r *http.Request) Answer

SiteCommentAgent is POST {artifact, id, chat} (comment): the comment id, which calls @harnessly, goes to the agent of the chat. The person's own machine is asked, from the page the chat shows the board in: {sent: true}.

func (*API) SiteComments

func (a *API) SiteComments(r *http.Request) Answer

SiteComments is GET ?artifact=&board= (view): {comments}; POST {artifact, board, x, y, block, label, text, parent, mentions: [{name, email}], agent} (comment): the SiteComment; PATCH {artifact, id, resolved | react} (comment): the SiteComment.

func (*API) SitePages

func (a *API) SitePages(r *http.Request) Answer

SitePages is the people's side of the page commands («Макет» → «Страницы»): POST {artifact, action, page?, title?} with action create (title), duplicate (page, title?: a variant of it, as `design page create --variant-of`), rename (page, title), device (page, device id, empty to clear), design-device (device id for every page that names none, empty to clear) or remove (page); GET ?artifact= (view) is {defaultDevice} of the design. A page is named by its file, id or title, as in the agents' commands (CLIPages); the answer is {ok, page}. Whoever may edit the project may do it; the machine does it, not the hub (a removed page goes to the library's trash).

func (*API) SiteProps

func (a *API) SiteProps(r *http.Request) Answer

SiteProps is GET ?artifact= (view): the SiteProps; PUT {artifact, board, values} (comment): the board's values put whole ({} goes back to the board's own), the SiteProps after.

func (*API) SiteShotRoute

func (a *API) SiteShotRoute(r *http.Request) Answer

SiteShotRoute is POST {artifact, board, w, h, y, scale?} (view): the PNG of the board's visible part.

func (*API) StartProjectDialog

func (a *API) StartProjectDialog(id, words, task string, resolveCwd func(requested string, roots []string) (string, error)) DialogResult

StartProjectDialog starts a new agent conversation in a project's folder, working the way the design tool does: it edits the design in place and publishes nothing. words are the person's (what the chat shows), task what the agent is told besides (see DialogMessage). resolveCwd is the launcher's check of the folder.

func (*API) StorePush

func (a *API) StorePush(r *http.Request) Answer

StorePush is POST {project} (a session, view): {ok: true} once the push has started; 404 for a project the person cannot see, 409 where the library is not synced with a store.

func (*API) Thumb

func (a *API) Thumb(w http.ResponseWriter, r *http.Request)

Thumb is GET ?artifact=&board=&v=[&all=1][&fresh=1] — the gallery picture of a board. An edited board answers at once with its earlier picture, not to be kept, while the new one is drawn; all draws the project's other pictures ahead; 404 when there is none yet or at all. In the shadow (a writer that cannot flush) nothing is drawn: only a picture already there is served.

func (*API) TrashList

func (a *API) TrashList(r *http.Request) Answer

TrashList is POST {}: the person's projects in the trash.

func (*API) TrashPurge

func (a *API) TrashPurge(r *http.Request) Answer

TrashPurge is POST {project}: the project is erased for good.

func (*API) TrashRestore

func (a *API) TrashRestore(r *http.Request) Answer

TrashRestore is POST {project}: the project is back in the library.

func (*API) Video added in v0.16.42

func (a *API) Video(r *http.Request) Answer

Video is GET ?artifact= (view): the VideoState.

func (*API) VideoComments added in v0.16.42

func (a *API) VideoComments(r *http.Request) Answer

VideoComments is POST {artifact, page, t0, t1|null, format, x|null, y|null, block, label, text} (comment): the DeckComment with view "video"; and PATCH as DeckComments' (comment).

func (*API) VideoFile added in v0.16.42

func (a *API) VideoFile(w http.ResponseWriter, r *http.Request)

VideoFile is GET ?artifact&format (view, body route): the published MP4 of the format, as an attachment. With &job=<id> it is the finished job's file instead (a draft, or one scene).

func (*API) VideoFrame added in v0.16.42

func (a *API) VideoFrame(w http.ResponseWriter, r *http.Request)

VideoFrame is GET ?artifact&page&at&format[&draft] (view, body route): the scene's frame at `at` ms as image/jpeg.

func (*API) VideoOverlay added in v0.16.86

func (a *API) VideoOverlay(r *http.Request) Answer

VideoOverlay is POST {artifact, page, action, id?, ...fields} (edit): the VideoOverlayAnswer. The edit is a person's.

func (*API) VideoRender added in v0.16.42

func (a *API) VideoRender(r *http.Request) Answer

VideoRender is POST {artifact, format, page?, draft} (edit): the VideoRenderJob; and GET ?artifact&id (view): the job.

func (*API) VideoScene added in v0.16.42

func (a *API) VideoScene(r *http.Request) Answer

VideoScene is PUT {artifact, page, dur: ms|null, transition: {kind, ms}|null} (edit): {scene: VideoScene}. A key left out stays as it is.

func (*API) VideoScreen

func (a *API) VideoScreen(r *http.Request) Answer

VideoScreen is POST {artifact, page, action, ...} (edit): the VideoScreenAnswer. The edit is a person's.

func (*API) VideoSettings added in v0.16.42

func (a *API) VideoSettings(r *http.Request) Answer

VideoSettings is PUT {artifact, settings: {formats?, subs?, seconds?}} (edit): {settings: VideoSettings}.

func (*API) VideoView added in v0.16.86

func (a *API) VideoView(r *http.Request) Answer

VideoView is POST {artifact, t, playing, format, touchedAgo, acked} (view): {cmds}. The page calls it while the player is on screen.

type AccessSnapshot added in v0.15.40

type AccessSnapshot struct {
	Enforce  bool                      `json:"enforce"`
	At       time.Time                 `json:"at"`
	Projects map[string]Grant          `json:"projects"`
	Team     map[string]string         `json:"team"`
	People   map[string]PersonSnapshot `json:"people,omitempty"`
	// Unrecorded "closed": a project with no row in the snapshot is closed to everyone but the machine's own person
	// (the hub's HUB_DESIGN_UNRECORDED=closed); "" keeps it open, as before.
	Unrecorded string `json:"unrecorded,omitempty"`
}

AccessSnapshot is the wire body of design.access without its op: the person's roles by project and the team level of every project the gateway knows. People is the same for each other person who may open the machine (a hub's machine is shared by its space): their address, lower-cased, to their own roles and team levels. Absent, the machine has one person and the top level is theirs.

func (AccessSnapshot) Validate added in v0.15.40

func (s AccessSnapshot) Validate() error

Validate refuses a snapshot the runtime must not act on: no time (an empty or garbled body decodes to the zero snapshot, which would switch enforcement off), unknown roles or levels, foreign ids, oversized text or tables.

type AdoptReport

type AdoptReport struct {
	Kit      string           `json:"kit"`
	Latest   string           `json:"latest"`
	Projects []AdoptedProject `json:"projects"`
}

AdoptReport is what an adoption did (or, dry, would do).

type AdoptedProject

type AdoptedProject struct {
	Project string   `json:"project"`
	Mounts  []string `json:"mounts"`
	// Version is the kit's version the copy matches; "" when none does.
	Version string `json:"version"`
	// Moved: the copy's kit files went to the trash and the project is pinned.
	Moved bool `json:"moved"`
	// Kit is how many files of the copy are the version's; Own how many are the project's own and stay.
	Kit int `json:"kit"`
	Own int `json:"own"`
	// Differs are files the copy has with other bytes than the newest version; the project is left as it is.
	Differs []string `json:"differs,omitempty"`
	Trash   string   `json:"trash,omitempty"`
}

AdoptedProject is one project the adoption looked at.

type Agent

type Agent struct {
	TabID       string   `json:"tabId"`
	Title       string   `json:"title"`
	Workspace   *string  `json:"workspace"`
	State       string   `json:"state"`
	LastEventAt *float64 `json:"lastEventAt"`
	Self        bool     `json:"self"`
}

Agent is an agent conversation whose transcript touched the artifact's files.

type AgentBoard

type AgentBoard struct {
	Title  string      `json:"title"`
	Path   string      `json:"path"`
	Status string      `json:"status"`
	Shots  []AgentShot `json:"shots"`
}

type AgentReport

type AgentReport struct {
	Artifact string       `json:"artifact"`
	Finished bool         `json:"finished"`
	Failure  *string      `json:"failure"`
	Boards   []AgentBoard `json:"boards"`
	// Sources are the findings about pages written as modules (pages/<name>.tsx): a board that is not current.
	Sources []PageSourceProblem `json:"sources"`
}

AgentReport is what /api/cli/design answers about a check.

type AgentShot

type AgentShot = CheckShot

AgentShot is a shot as an agent reads it: the screenshot as a file it can open.

type Answer

type Answer struct {
	Status int
	Body   any
	Header http.Header
}

Answer is a route's answer: status, value (JSON, gate.Raw, or nil for no body) and headers.

func Empty

func Empty(status int, h http.Header) Answer

Empty is res.status(n).end().

func JSON

func JSON(r *http.Request, status int, v any, h http.Header) Answer

JSON is res.json: the exact bytes with their ETag, 304 when the caller holds them.

func ReadBody

func ReadBody(r *http.Request) (body any, refused *Answer)

ReadBody parses a request body as the dispatcher did: JSON (an empty body is {}), a form as an object, anything else as text; refused is the dispatcher's plain-text answer to a body too large or not JSON.

func (Answer) Split

func (a Answer) Split() (int, any, http.Header)

type Artifact

type Artifact struct {
	ID          string        `json:"id"`
	Title       string        `json:"title"`
	Source      *string       `json:"source"`
	UpdatedAt   int64         `json:"updatedAt"`
	Boards      []Board       `json:"boards"`
	HasSupport  bool          `json:"hasSupport"`
	ProjectPath string        `json:"projectPath"`
	Cover       *string       `json:"cover"`
	Check       *CheckSummary `json:"check"`
	Agents      []Agent       `json:"agents"`
	Claims      []ClaimView   `json:"claims"`
	// Release is the board format's release the project is on; absent when releases are not used.
	Release *ProjectRelease `json:"release,omitempty"`
}

Artifact is a project of the library.

type ArtifactMeta

type ArtifactMeta struct {
	Title, Source *string
	Boards        []Board
}

ArtifactMeta is what artifact.json knows, read leniently.

func ParseArtifactFile

func ParseArtifactFile(raw any) ArtifactMeta

type Board

type Board struct {
	DefaultDevice string `json:"defaultDevice,omitempty"`
	ID            string `json:"id,omitempty"`
	Title         string `json:"title"`
	Path          string `json:"path"`
	W             *int   `json:"w"`
	H             *int   `json:"h"`
}

Board is a board of an artifact; Path is under project/, with the query the page needs. ID is the permanent id of its page in a project with meta/; "" for a board no page names.

func DetectBoards

func DetectBoards(sources []boardSource) []Board

DetectBoards: wrapper boards become their pages, the rest stay as they are; the overview board goes first, the rest by name.

func InnerPageBoard

func InnerPageBoard(title, source string) *Board

InnerPageBoard is the page a wrapper board shows in a nested frame (the element picker does not follow into it), so the board is listed as the page itself; nil for any other board.

func MergeBoards

func MergeBoards(project string, listed []Board) []Board

MergeBoards is what artifact.json lists, in its order and only while each page is there, plus every other board file at the root of project/ that no listed board names by path or title and that is not a wrapper.

type BoardComparer

type BoardComparer interface {
	Compare(boardFile string, original, built []byte) (pixels int, err error)
	Close()
}

BoardComparer draws the board file as it is and as the given bytes, in the project's folder.

type BoardEdit

type BoardEdit struct {
	Action string
	Path   *string
	Title  *string
	Delta  *float64
}

BoardEdit is one change; Title and Delta are nil when the request had none of the right type.

type BoardEditError

type BoardEditError struct{ Msg string }

BoardEditError is a refusal worded for the person.

func (*BoardEditError) Error

func (e *BoardEditError) Error() string

type BoardMigration

type BoardMigration struct {
	Board string `json:"board"`
	// Status: migrated, would-migrate (dry run), kept (not translatable), differs (the page draws differently),
	// unstable (the board itself draws differently each time), already (built from a page), rolled-back, changed
	// (the page was edited after the migration; --force rolls back anyway), error.
	Status string   `json:"status"`
	Reason string   `json:"reason,omitempty"`
	Files  []string `json:"files,omitempty"`
	// Pixels differ between the board and its page, when Status is differs.
	Pixels int `json:"pixels,omitempty"`
}

BoardMigration is what happened to one board.

type BoardModule

type BoardModule struct {
	Page, Fixtures, Frame string
	// HasProps: the board has props, and Fixtures holds their defaults.
	HasProps bool
}

BoardModule is a board turned into a page module: the files' contents, by their project-relative paths.

func TranslateBoard

func TranslateBoard(name, src string, tidy bool) (*BoardModule, error)

TranslateBoard turns a board file into a page module. tidy writes whitespace between elements as {" "}, as a person would; without it the whitespace is kept as it was written (for a board whose text keeps its spaces).

type BoardSnapshot

type BoardSnapshot struct {
	ID      string `json:"id"`
	At      int64  `json:"at"`
	Who     string `json:"who"`
	Current bool   `json:"current"`
}

BoardSnapshot is a saved state of a board as the panel lists it.

type BoardTweaks

type BoardTweaks struct {
	Variants []string `json:"variants"`
	Themes   bool     `json:"themes"`
}

BoardTweaks are the tweaks a board declares in data-props of its script: screen variants and the theme switch.

func ParseBoardTweaks

func ParseBoardTweaks(source string) *BoardTweaks

type BoardWrite added in v0.16.15

type BoardWrite struct{ Project, File string }

BoardWrite is a board file a tool call writes: the project it is in and the file's name.

func BoardWrites added in v0.16.15

func BoardWrites(in GuardInput) []BoardWrite

BoardWrites are the boards (*.dc.html under a project's project/ folder) a writing tool call touches. The hook of an agent takes (or renews) the lease on each before the write goes on.

type CLIHistory

type CLIHistory struct {
	Unsaved bool             `json:"unsaved"`
	Lines   []CLIHistoryLine `json:"lines"`
}

CLIHistory is GET /api/cli/design/history.

type CLIHistoryLine

type CLIHistoryLine struct {
	ID      string  `json:"id"`
	ShortID string  `json:"shortId"`
	At      int64   `json:"at"`
	Who     string  `json:"who"`
	Subject string  `json:"subject"`
	Runtime *string `json:"runtime"`
}

CLIHistoryLine is a version as `design history` prints it.

type CLIRestored

type CLIRestored struct {
	Board, Revision string
	Saved           bool
}

CLIRestored is what an agent's restore answers.

type Caller

type Caller struct{ TabID, ChatTitle, WorkspaceID string }

Caller is the chat a command was typed in.

type CanvasBoard

type CanvasBoard struct {
	File, Title string
	X, Y, W, H  float64
}

CanvasBoard is where a board sits on the canvas of a project's canvas.json.

func ParseCanvasJSON

func ParseCanvasJSON(raw any) ([]CanvasBoard, *string)

ParseCanvasJSON reads canvas.json (parsed by jsvalue, so keys keep JavaScript's order) leniently: a broken entry is dropped, not fatal.

type Chat

type Chat struct {
	TabID, PanelType, State, AgentSummary, TabName, WorkspaceID, Session, Transcript string
	LastEventAt                                                                      float64
}

Chat is a tab of this runtime as the tab keeper has it.

func (Chat) Title

func (c Chat) Title() string

Title is what a chat is called: its summary, its tab's name, or "Agent".

type ChatLinks struct {
	// contains filtered or unexported fields
}

ChatLinks is the index of the designs the transcripts worked on.

func NewChatLinks(lib *Library, file string) *ChatLinks

NewChatLinks is the index of the library's designs, kept in file ("" keeps it in memory only).

func (*ChatLinks) Backfill added in v0.15.40

func (c *ChatLinks) Backfill(paths []string)

Backfill puts the transcripts on Run's list, to be read behind.

func (*ChatLinks) Designs added in v0.15.40

func (c *ChatLinks) Designs(paths []string) map[string][]string

Designs are, for each transcript, the designs it worked on (which still exist is the caller's to check), in the order it first touched them. What a transcript wrote since the last look is read now when it is short; a long growth is left to Run, and the answer is what the index knew so far.

func (*ChatLinks) Run added in v0.15.40

func (c *ChatLinks) Run(ctx context.Context)

Run reads the transcripts left for it, one at a time and slowly, and keeps the index on disk; until ctx ends.

func (*ChatLinks) Save added in v0.15.40

func (c *ChatLinks) Save() error

Save writes the index when it changed.

type ChatView

type ChatView struct{ State, Title string }

ChatView is what the runtime knows of a chat.

type CheckBoard

type CheckBoard struct {
	Title  string      `json:"title"`
	Path   string      `json:"path"`
	Status string      `json:"status"`
	Shots  []CheckShot `json:"shots"`
}

type CheckReport

type CheckReport struct {
	Artifact   string       `json:"artifact"`
	StartedAt  int64        `json:"startedAt"`
	FinishedAt *int64       `json:"finishedAt"`
	Done       int          `json:"done"`
	Total      int          `json:"total"`
	Boards     []CheckBoard `json:"boards"`
	Cover      *string      `json:"cover"`
	Failure    *string      `json:"failure"`
}

CheckReport is a design's check, filling while it runs.

type CheckShot

type CheckShot struct {
	View           string   `json:"view"`
	Status         string   `json:"status"`
	Screenshot     *string  `json:"screenshot"`
	Errors         []string `json:"errors"`
	FailedRequests []string `json:"failedRequests"`
	Ms             int64    `json:"ms"`
}

CheckShot is one view of a board.

type CheckSummary

type CheckSummary struct {
	FinishedAt *int64  `json:"finishedAt"`
	Done       int     `json:"done"`
	Total      int     `json:"total"`
	Broken     int     `json:"broken"`
	Warnings   int     `json:"warnings"`
	Failure    *string `json:"failure"`
}

CheckSummary is the last check of a design as a card shows it.

type Claim

type Claim struct {
	Project, Board   string
	Owner            ClaimOwner
	Since, Heartbeat int64
	// LastEdit and TurnRunning come from a lease of the design center (a folder claim has neither).
	LastEdit    int64
	TurnRunning bool
}

func ParseClaim

func ParseClaim(raw any) (Claim, bool)

ParseClaim reads a claim file's document; ok false when it is not a claim.

type ClaimError

type ClaimError struct{ Msg string }

ClaimError is a refusal worded for the person or the agent: the API returns it as is.

func (*ClaimError) Error

func (e *ClaimError) Error() string

type ClaimLine

type ClaimLine struct {
	Project   string `json:"project"`
	Board     string `json:"board"`
	Page      string `json:"page,omitempty"`
	Person    string `json:"person"`
	Runtime   string `json:"runtime"`
	ChatTitle string `json:"chatTitle"`
	Since     int64  `json:"since"`
}

ClaimLine is a claim as `who` prints it.

type ClaimOutcome

type ClaimOutcome struct {
	// Claim names the board as people know it; Page is the page id it is held under ("" for a board without one).
	Claim     Claim
	Page      string
	Refreshed bool
	Holder    *Claim
	Message   string
	// Lost: the chat held this board before and the lease is not the one it had (it was taken off, or ran out): the
	// lease is taken again, but the chat has to read the file anew before it writes.
	Lost bool
	// Offline: the design center did not answer; the edit goes on without a lease.
	Offline bool
	// Notice: this chat's earlier edit of the board lost to another version by revision; told once.
	Notice *SyncNotice
}

ClaimOutcome is a claim taken, or the holder and the words for the agent.

type ClaimOwner

type ClaimOwner struct {
	User, Runtime, TabID, ChatTitle string
	// Machine is the machine the chat runs on, as the design center knows it; a folder claim has none.
	Machine string
}

type ClaimResult

type ClaimResult struct {
	Claim     Claim
	Refreshed bool
	Held      *Claim
}

ClaimResult is a claim taken (Held nil) or refused with its holder.

type ClaimView

type ClaimView struct {
	Board     string `json:"board"`
	Page      string `json:"page,omitempty"`
	Person    string `json:"person"`
	TabID     string `json:"tabId"`
	ChatTitle string `json:"chatTitle"`
	Since     int64  `json:"since"`
	Local     bool   `json:"local"`
	Inferred  bool   `json:"inferred"`
}

ClaimView is a claim on a board as the panel shows it.

type CodeExport

type CodeExport struct {
	Project     string                    `json:"project"`
	Kit         string                    `json:"kit"`
	Version     string                    `json:"version"`
	Target      string                    `json:"target"`
	DryRun      bool                      `json:"dryRun"`
	Strict      []designkit.StrictFinding `json:"strict,omitempty"`
	Pages       []CodePage                `json:"pages"`
	Files       []CodeFile                `json:"files"`
	NotExported []CodeSkip                `json:"notExported,omitempty"`
	Conflicts   int                       `json:"conflicts"`
	Changed     int                       `json:"changed"`
}

CodeExport is the report of an export.

type CodeFile

type CodeFile struct {
	Path    string `json:"path"`
	Status  string `json:"status"`
	Reason  string `json:"reason,omitempty"`
	Added   int    `json:"added,omitempty"`
	Removed int    `json:"removed,omitempty"`
}

CodeFile is one file of an export and what happened to it: written, unchanged, created (a container), kept (a container that is there), conflict.

type CodePage

type CodePage struct {
	Name  string `json:"name"`
	ID    string `json:"id,omitempty"`
	Route string `json:"route,omitempty"`
	View  string `json:"view"`
}

CodePage is a page of the export.

type CodeProfile

type CodeProfile struct {
	V int `json:"v"`
	// Root is the folder (relative to the repository) the views, fixtures and local components go to.
	Root string `json:"root"`
	// Router: "react-router" (a route table), "next-app" (app/<route>/page.tsx) or "none".
	Router string `json:"router"`
	// Routes: for react-router the route table's file (default <root>/routes.tsx); for next-app the app folder
	// (default app).
	Routes string `json:"routes,omitempty"`
	// Stories: write a Storybook story per page from its fixtures. Tests: "vitest" writes a test per view.
	Stories bool   `json:"stories,omitempty"`
	Tests   string `json:"tests,omitempty"`
}

CodeProfile is sinopia.export.json.

func ReadCodeProfile

func ReadCodeProfile(target string) (CodeProfile, error)

ReadCodeProfile reads and checks a repository's export profile.

type CodeSkip

type CodeSkip struct {
	File   string `json:"file"`
	Reason string `json:"reason"`
}

CodeSkip is a board that was not exported, and why.

type Config

type Config struct {
	// Offline starts the browser with no network but this machine: for a page of code nobody here wrote (a kit from a
	// package an HTTP request named). Everything but loopback goes to a proxy that is not there.
	Offline bool
	DataDir string
	// Passive is a library a hub reads or edits for a moment: no keepers, no history, no PDF builds.
	Passive bool
	// ShareProbe stands in for ProbeShareFS (a test of a runtime that fails it); it runs on every call, uncached.
	ShareProbe func(dir string) ShareFSReport
	// AgentTokenHeader carries the token of agent.json to the machine agent's loopback routes.
	AgentTokenHeader string
	// ConfigFile is the runtime's config (the owner's address).
	ConfigFile string
	// Leases chooses where the leases on boards are kept: the library's .claims folder (default) or the design center.
	Leases LeaseConfig
	// LibraryDir is an explicit library folder; WorkspaceDir (or the workspace root of WorkspaceConfig) holds
	// design-artifacts otherwise; the data dir is the last resort.
	LibraryDir, WorkspaceDir, AltWorkspaceDir, WorkspaceConfig string
	// HistoryDir holds the private history repositories (the data dir when empty).
	HistoryDir string
	// KitsDir holds the UI kits installed by version, served at /kit/<id>/<version>/ (design-kits in the data dir
	// when empty).
	KitsDir string
	// KitOrigins are the origins, besides the library server's own loopback ones, that may read kit files from a page
	// (fonts and stylesheets are CORS requests): the platform hosts that show boards, as `https://host[:port]`.
	// Empty: only the loopback origins.
	KitOrigins []string
	// ReleasesDir is a design-upstream mirror: the releases of the board format a project can be pinned to (none when
	// empty).
	ReleasesDir string
	// Port is the library server's preferred loopback port.
	Port int
	// Chrome is the headless browser a check drives; the usual places are looked at when empty.
	Chrome string
	// PlatformAPI prefixes the platform's routes (a check's screenshot address).
	PlatformAPI string
	// ClaudeProjects and CodexSessions are the folders whose transcripts may be read.
	ClaudeProjects, CodexSessions string
	// OwnerEmail is the owner when the runtime's config names none.
	OwnerEmail string
	// CanvasKey is the key of project/canvas.json under which the runtime keeps its own data (DefaultCanvasKey when empty).
	CanvasKey string
	// EngineFile is the board engine (support.js) a new project gets; the copy shipped with the runtime when empty.
	EngineFile string
	Texts      Texts
	// Log hears what goes wrong in the background.
	Log func(level, msg string, err error)
}

Config is what the deployment names.

type Control

type Control struct {
	Board string          `json:"board,omitempty"`
	View  string          `json:"view,omitempty"`
	Panel string          `json:"panel,omitempty"`
	Props *jsvalue.Object `json:"props,omitempty"`
}

Control is a command for the open pages of a design.

func ParseControl

func ParseControl(raw any) *Control

ParseControl keeps only the known fields of the known shapes of an agent's command; nil when nothing is left.

type CreateError

type CreateError struct {
	Msg      string
	Conflict bool
}

CreateError is a refusal worded for the person; Conflict when the id is taken.

func (*CreateError) Error

func (e *CreateError) Error() string

type CreatedProject

type CreatedProject struct{ ID, Title, Dir string }

CreatedProject is a new project of the library.

type DeckChapter added in v0.16.5

type DeckChapter struct {
	Page  string `json:"page"`
	Title string `json:"title"`
	T     int64  `json:"t"`
}

DeckChapter is a slide's start in the published video (.media/published/chapters.json); T is ms.

type DeckComment added in v0.16.5

type DeckComment struct {
	ID   string `json:"id"`
	Page string `json:"page"`
	// X and Y are percents of the slide's width and height (0..100).
	X float64 `json:"x"`
	Y float64 `json:"y"`
	// Label is the block under the point ("Заголовок"), "" when none.
	Label      string     `json:"label"`
	Text       string     `json:"text"`
	By         DeckPerson `json:"by"`
	At         string     `json:"at"`
	Resolved   bool       `json:"resolved"`
	ResolvedBy *string    `json:"resolvedBy"`
	ResolvedAt *string    `json:"resolvedAt"`
	// A video's comment on a moment or a stretch; all absent on a deck's comment. View is DeckCommentVideo.
	// T0 and T1 are ms from the start of the scene (Page); T1 absent: a moment. Format is the format it was made in,
	// Block the data-block it points at ("" none), Frame the cached frame's path under the project (".media/video/
	// frames/<key>.jpg", "" none). X and Y stay the point on the frame; 0 when the comment has none.
	View   string      `json:"view,omitempty"`
	T0     *int64      `json:"t0,omitempty"`
	T1     *int64      `json:"t1,omitempty"`
	Format VideoFormat `json:"format,omitempty"`
	Block  string      `json:"block,omitempty"`
	Frame  string      `json:"frame,omitempty"`
	// A 3D scene's pin (View DeckCommentScene3D): the object, the point, the camera and the frame it sits at.
	// X, Y and Page stay empty.
	Scene *Scene3DAnchor `json:"scene,omitempty"`
	// A site board's comment (View DeckCommentSite): Board is the board's path, X the point's percent of the page's
	// width and Y its CSS pixels from the page's top, Block the data-block it points at ("" a point only). Parent is the thread's first comment for a reply
	// ("" the first one); Reactions the people (by address, else name) of each emoji; Mentions the people it calls by @;
	// Agent that it calls @harnessly.
	Board     string              `json:"board,omitempty"`
	Parent    string              `json:"parent,omitempty"`
	Reactions map[string][]string `json:"reactions,omitempty"`
	Mentions  []DeckPerson        `json:"mentions,omitempty"`
	Agent     bool                `json:"agent,omitempty"`
	// ByAgent: the agent wrote it (a reply of `harnessly design comments reply`).
	ByAgent bool `json:"byAgent,omitempty"`
	// Drawing is what the person drew over the board with the thread's first comment, in the page's pixels.
	Drawing *SiteDrawing `json:"drawing,omitempty"`
}

DeckComment is meta/comments/<ULID>.json: a team comment pinned to a point of a slide.

type DeckCommentSpec added in v0.16.5

type DeckCommentSpec struct {
	Page  string
	X, Y  float64
	Label string
	Text  string
	// A video's comment: T0 set makes it one. T0 and T1 are ms from the scene's start (T1 nil: a moment),
	// Format the one it was made in, Block the data-block it points at.
	T0, T1 *int64
	Format VideoFormat
	Block  string
	// A 3D scene's pin: set, the comment is one (AddScene3DComment), Page, X and Y are not used.
	Scene *Scene3DAnchor
}

DeckCommentSpec is a new comment's content.

type DeckEdit added in v0.16.5

type DeckEdit struct {
	Cut    bool     `json:"cut"`
	Subs   bool     `json:"subs"`
	Kept   []string `json:"kept"`
	Cursor string   `json:"cursor"`
	Cam    string   `json:"cam"`
}

DeckEdit is .media/rec/<recId>/edit.json: the montage. Kept are "<segment>.<part>" indexes the person kept although the cut would drop them. Cursor is "smooth" or "off"; Cam is the camera circle's corner: "br", "bl", "tr", "tl" or "off".

func DefaultDeckEdit added in v0.16.5

func DefaultDeckEdit() DeckEdit

DefaultDeckEdit is the montage of a new recording: cut and subtitles on, as the done dialog shows them.

type DeckError added in v0.16.5

type DeckError struct {
	Status int
	Msg    string
}

DeckError is a refusal a deck route words for the person.

func (*DeckError) Error added in v0.16.5

func (e *DeckError) Error() string

type DeckEvent added in v0.16.5

type DeckEvent struct {
	T    int64    `json:"t"`
	K    string   `json:"k"`
	Page string   `json:"page,omitempty"`
	I    *int     `json:"i,omitempty"`
	N    *int     `json:"n,omitempty"`
	X    *float64 `json:"x,omitempty"`
	Y    *float64 `json:"y,omitempty"`
	R    *float64 `json:"r,omitempty"`
	On   *bool    `json:"on,omitempty"`
	T0   *int64   `json:"t0,omitempty"`
	Text string   `json:"text,omitempty"`
}

DeckEvent is a line of .media/rec/<recId>/events.jsonl; T is ms from the recording's start. Which fields a line has depends on K: slide {page,i}, step {n}, cursor and click {x,y} in board pixels, laser {on}, retake {page}, asr {t0,text} (a final; t0 is the time of its first partial), cam {x,y,r}.

type DeckExportFormat added in v0.16.5

type DeckExportFormat string

DeckExportFormat is a file a deck can be exported to.

const (
	DeckExportPDF  DeckExportFormat = "pdf"
	DeckExportPNG  DeckExportFormat = "png"
	DeckExportPPTX DeckExportFormat = "pptx"
	DeckExportHTML DeckExportFormat = "html"
	DeckExportMP4  DeckExportFormat = "mp4"
	// DeckExportZip is the project/ folder; DeckExportBundle the whole project (deckzip.go).
	DeckExportZip    DeckExportFormat = "zip"
	DeckExportBundle DeckExportFormat = "bundle"
)

func DeckExportersRegistered added in v0.16.5

func DeckExportersRegistered() []DeckExportFormat

DeckExportersRegistered are the formats that have an exporter, in DeckExportFormats' order.

type DeckExportJob added in v0.16.5

type DeckExportJob struct {
	ID       string           `json:"id"`
	Format   DeckExportFormat `json:"format"`
	Board    string           `json:"board,omitempty"`
	State    DeckJobState     `json:"state"`
	Progress float64          `json:"progress"`
	File     *string          `json:"file"`
	Error    *string          `json:"error"`
	At       string           `json:"at"`
}

DeckExportJob is an export job (kept in memory, keyed <artifact>/<id>), the answer of POST and GET /design/deck/export. File is the file's name once done; Error is the reason, worded for the person, once failed.

type DeckExportRun added in v0.16.5

type DeckExportRun struct {
	L        *Library
	Artifact string
	Rec      string
	Board    string
	Out      string
	Progress func(float64)
}

DeckExportRun is what an exporter is given: the project, the recording (mp4 only), the one board to export ("" for all; its id or its path, DeckExportOfBoard), the file to write and where to report progress (0..1).

type DeckExporter added in v0.16.5

type DeckExporter struct {
	Needs []string
	Ext   string
	Run   func(ctx context.Context, run DeckExportRun) error
}

DeckExporter writes one export. Needs names what it runs ("chrome", "ffmpeg"): a machine without it fails the job at once with a worded reason.

func DeckExporterOf added in v0.16.5

func DeckExporterOf(f DeckExportFormat) (DeckExporter, bool)

DeckExporterOf is the exporter of a format; false when none is registered.

type DeckGuestResolution added in v0.16.5

type DeckGuestResolution struct {
	Resolved bool   `json:"resolved"`
	By       string `json:"by"`
	At       string `json:"at"`
}

DeckGuestResolution is meta/comments/g-<gatewayId>.json: a guest comment (kept by the gateway) marked resolved here.

type DeckInit added in v0.16.5

type DeckInit struct {
	Minutes int
	Slides  *int
	Tone    DeckTone
	Script  bool
	// Source, Layouts and Vars come from a company template (POST /design/deck/pptx-style); Source "" when none.
	Source  string
	Layouts int
	Vars    map[string]string
}

DeckInit is what a new deck is made with (the create dialog's settings).

type DeckJobState added in v0.16.5

type DeckJobState string

DeckJobState is where an export job is.

const (
	DeckJobQueued  DeckJobState = "queued"
	DeckJobRunning DeckJobState = "running"
	DeckJobDone    DeckJobState = "done"
	DeckJobFailed  DeckJobState = "failed"
)

type DeckPart added in v0.16.5

type DeckPart struct {
	Text string       `json:"text"`
	Cut  bool         `json:"cut"`
	Kind DeckPartKind `json:"kind"`
	T0   int64        `json:"t0"`
	T1   int64        `json:"t1"`
}

DeckPart is a piece of a segment: words, a filler or a pause. Cut is whether the montage drops it.

type DeckPartKind added in v0.16.5

type DeckPartKind string

DeckPartKind is what a part of a transcript segment is.

const (
	DeckPartWord   DeckPartKind = "word"
	DeckPartFiller DeckPartKind = "filler"
	DeckPartPause  DeckPartKind = "pause"
)

type DeckPatchOp added in v0.16.5

type DeckPatchOp string

DeckPatchOp is what a hand edit of a board does.

const (
	DeckPatchText  DeckPatchOp = "text"
	DeckPatchStyle DeckPatchOp = "style"
	DeckPatchMove  DeckPatchOp = "move"
	DeckPatchReset DeckPatchOp = "reset"
	// DeckPatchImage puts a drawn picture into an element (see DeckPatchRequest.Src).
	DeckPatchImage DeckPatchOp = "image"
)

type DeckPatchRequest added in v0.16.5

type DeckPatchRequest struct {
	Artifact string `json:"artifact"`
	Page     string `json:"page"`
	// File names a board of the project (at its root) instead of a deck page: a canvas board has no page of its own.
	File  string             `json:"file,omitempty"`
	Tpl   int                `json:"tpl"`
	Op    DeckPatchOp        `json:"op"`
	Was   *string            `json:"was,omitempty"`
	HTML  *string            `json:"html,omitempty"`
	Style map[string]*string `json:"style,omitempty"`
	X     *float64           `json:"x,omitempty"`
	Y     *float64           `json:"y,omitempty"`
	Unit  string             `json:"unit,omitempty"`
	// image: Src is the picture's path in the project (assets/<name>-<n>.png). An img gets it as its src, any other
	// element as a covering background-image. Prompt and Job are remembered on the element (data-gen-prompt,
	// data-gen-job); Was is the element's fingerprint, as for style.
	Src    string `json:"src,omitempty"`
	Prompt string `json:"prompt,omitempty"`
	Job    string `json:"job,omitempty"`
	// From is the picture the job changed (a change of a picture, not a new one): the element remembers it as
	// data-gen-from. A Src that is not a job's own picture (the original put back) comes with no Job and no Prompt:
	// the element then forgets what it was drawn from.
	From string `json:"from,omitempty"`
}

DeckPatchRequest is the body of POST /design/deck/patch. Tpl is the element's data-dc-tpl (preorder index of the template's start tags). text: Was is the element's inner HTML as the page saw it, HTML the new one (b strong i em u s br and text only); Style, when set, goes on the same element in the same write. style: Style sets (a value) or removes (null) CSS properties of the style attribute. move: X and Y in board pixels become `translate` (in cqw of the board's width; in px when Unit is "px", which the board asks for a block inside its own size container). reset: removes translate. For style, move and reset Was is the element's fingerprint as the board gave it (`was` of tk:deck-hover, -select, -drag): its source tag, style attribute and words; the edit lands on that element or is refused as changed.

type DeckPerson added in v0.16.5

type DeckPerson struct {
	Name  string `json:"name"`
	Email string `json:"email"`
}

DeckPerson is who wrote or resolved something.

type DeckPptxFonts added in v0.16.5

type DeckPptxFonts struct {
	Head string `json:"head"`
	Body string `json:"body"`
}

DeckPptxFonts are a template's heading and body fonts.

type DeckPptxStyle added in v0.16.5

type DeckPptxStyle struct {
	Name    string            `json:"name"`
	Colors  []string          `json:"colors"`
	Fonts   DeckPptxFonts     `json:"fonts"`
	Layouts int               `json:"layouts"`
	Vars    map[string]string `json:"vars"`
}

DeckPptxStyle is the answer of POST /design/deck/pptx-style: what a company template gives a new deck.

func ReadPptxStyle added in v0.16.5

func ReadPptxStyle(data []byte, name string) (DeckPptxStyle, error)

ReadPptxStyle reads a template's look. name is the file's name as the person attached it.

type DeckPublished added in v0.16.5

type DeckPublished struct {
	Video       bool    `json:"video"`
	PDF         bool    `json:"pdf"`
	PDFAuto     bool    `json:"pdfAuto"`
	PDFBuilding bool    `json:"pdfBuilding"`
	PDFAt       *string `json:"pdfAt"`
	PDFError    *string `json:"pdfError"`
}

DeckPublished says what guests may read: .media/published/video.mp4 and deck.pdf. PDFAuto: the PDF is kept up to date for guests (deckpdfauto.go); PDFBuilding: a newer one is being built or is about to be; PDFAt: when the published one was built from (RFC 3339), null without one; PDFError: why the last build failed, null when it did not.

type DeckRecMeta added in v0.16.5

type DeckRecMeta struct {
	ID         string       `json:"id"`
	StartedAt  string       `json:"startedAt"`
	DurationMs int64        `json:"durationMs"`
	Camera     bool         `json:"camera"`
	Mime       string       `json:"mime"`
	Slides     []string     `json:"slides"`
	Takes      []DeckTake   `json:"takes"`
	State      DeckRecState `json:"state"`
}

DeckRecMeta is .media/rec/<recId>/rec.json.

type DeckRecState added in v0.16.5

type DeckRecState string

DeckRecState is where a recording is.

const (
	DeckRecRecording DeckRecState = "recording"
	DeckRecDone      DeckRecState = "done"
	DeckRecFailed    DeckRecState = "failed"
)

type DeckRecording added in v0.16.5

type DeckRecording struct {
	Summary  DeckRecMeta   `json:"summary"`
	Segments []DeckSegment `json:"segments"`
	Edit     DeckEdit      `json:"edit"`
	CutMs    int64         `json:"cutMs"`
	Retaken  []int         `json:"retaken"`
}

DeckRecording is the answer of GET and PUT /design/deck/rec and of POST /design/deck/rec/finish. Segments are empty while the transcript is being built (Summary.State "recording" or the build not done yet). CutMs is how much the montage takes out; Retaken are the 1-based numbers of the slides that were taken again.

type DeckRecordingInfo added in v0.16.5

type DeckRecordingInfo struct {
	ID         string       `json:"id"`
	At         string       `json:"at"`
	DurationMs int64        `json:"durationMs"`
	State      DeckRecState `json:"state"`
	Retaken    []int        `json:"retaken"`
}

DeckRecordingInfo is a recording in the deck's state.

type DeckResolved added in v0.16.5

type DeckResolved struct {
	ID       string `json:"id"`
	Resolved bool   `json:"resolved"`
}

DeckResolved is the answer of a resolve of a guest comment.

type DeckSegment added in v0.16.5

type DeckSegment struct {
	T0    int64      `json:"t0"`
	T1    int64      `json:"t1"`
	Page  string     `json:"page"`
	Parts []DeckPart `json:"parts"`
}

DeckSegment is one recognised phrase of a recording, on the slide it was said on. Times are ms from the start.

type DeckSettings added in v0.16.5

type DeckSettings struct {
	V int `json:"v"`
	// Minutes 0: the length does not matter, the agent decides; otherwise DeckMinutesMin..DeckMinutesMax.
	Minutes int `json:"minutes"`
	// Slides nil: the agent picks the count ("Сам подберёт"); otherwise DeckSlidesMin..DeckSlidesMax.
	Slides *int       `json:"slides"`
	Tone   DeckTone   `json:"tone"`
	Script bool       `json:"script"`
	Style  *DeckStyle `json:"style"`
	Theme  string     `json:"theme"`
	Font   string     `json:"font"`
	// Picked: the theme and font were chosen (in «Стиль», by the agent's PUT or from a company template). A deck's boards
	// link deck-theme.css from the start; a video's scenes carry their own look until one is chosen, so «Стиль» marks
	// nothing for a video that is not Picked.
	Picked bool `json:"picked,omitempty"`
	// Themes are the deck's own themes; absent: the built-in ones (DefaultDeckThemes).
	Themes []DeckTheme `json:"themes,omitempty"`
}

DeckSettings is meta/deck.json: written by the runtime, read by the agent and the page. V is 1.

func BuildDeckSettings added in v0.16.5

func BuildDeckSettings(in DeckInit) DeckSettings

BuildDeckSettings are the settings of a new deck. A template's variables make a theme of their own on top of the built-in company theme's, and the deck starts on it.

func DefaultDeckSettings added in v0.16.5

func DefaultDeckSettings() DeckSettings

DefaultDeckSettings are the settings of a deck nobody has set yet.

type DeckSlide added in v0.16.5

type DeckSlide struct {
	// ID is the page's id (meta/pages/<id>.json), the key of its notes and comments.
	ID    string `json:"id"`
	Path  string `json:"path"`
	Title string `json:"title"`
	W     int    `json:"w"`
	H     int    `json:"h"`
	Notes string `json:"notes"`
	// Voice: the notes came from a dictation (meta/notes/<id>.raw.md is there).
	Voice   bool `json:"voice"`
	Seconds int  `json:"seconds"`
	// Version moves with the board file (its mtime and size): the page keys the slide's picture on it, so a picture
	// drawn while the board was empty is not kept once the agent writes it.
	Version string `json:"version"`
	// Blank: the board has nothing on it yet (the template's empty <main class="board">) — the agent has made the page
	// but not drawn the slide.
	Blank bool `json:"blank"`
}

DeckSlide is a slide as the deck answers it: the board's page with its notes.

type DeckState added in v0.16.5

type DeckState struct {
	Rev           int64               `json:"rev"`
	Settings      DeckSettings        `json:"settings"`
	Chrome        bool                `json:"chrome"`
	Ffmpeg        bool                `json:"ffmpeg"`
	Slides        []DeckSlide         `json:"slides"`
	Comments      []DeckComment       `json:"comments"`
	GuestResolved []string            `json:"guestResolved"`
	Recordings    []DeckRecordingInfo `json:"recordings"`
	Published     DeckPublished       `json:"published"`
}

DeckState is the answer of GET /design/deck. Rev is the newest mtime (ms) of the deck's files: the page polls every 3 s while visible and right after its own writes, and redraws when it moved. Chrome and Ffmpeg say whether the exports that need them can run on this machine.

type DeckStyle added in v0.16.5

type DeckStyle struct {
	// Source is the template's file name as the person attached it; "" when there was none.
	Source string `json:"source"`
	// System is the design system the deck is built on; nil for none.
	System *string `json:"system"`
	// Layouts is how many slide layouts the template has.
	Layouts int `json:"layouts"`
}

DeckStyle is where a deck's look came from: a company template (.pptx) read at create, or a design system.

type DeckTake added in v0.16.5

type DeckTake struct {
	Page    string `json:"page"`
	N       int    `json:"n"`
	StartMs int64  `json:"startMs"`
	EndMs   int64  `json:"endMs"`
}

DeckTake is one take of a slide in a recording; a retake adds one, the last take of a slide wins.

type DeckTheme added in v0.16.5

type DeckTheme struct {
	ID   string            `json:"id"`
	Name string            `json:"name"`
	Vars map[string]string `json:"vars"`
}

DeckTheme is a named set of the --deck-* CSS variables.

func DeckThemesOf added in v0.16.5

func DeckThemesOf(s DeckSettings) []DeckTheme

DeckThemesOf are the themes a deck offers: its own when it has any, else the built-in ones.

func DefaultDeckThemes added in v0.16.5

func DefaultDeckThemes() []DeckTheme

DefaultDeckThemes are the built-in themes: Компания, Фиолет and Лес.

type DeckTidied added in v0.16.5

type DeckTidied struct {
	ID      string `json:"id"`
	Notes   string `json:"notes"`
	Seconds int    `json:"seconds"`
	Voice   bool   `json:"voice"`
}

DeckTidied is a slide's notes made from a dictation, in the answer of POST /design/deck/tidy.

type DeckTone added in v0.16.5

type DeckTone string

DeckTone is how the speaker's notes are written.

const (
	DeckToneTalk  DeckTone = "talk"
	DeckToneBiz   DeckTone = "biz"
	DeckToneShort DeckTone = "short"
)

type DeckTranscript added in v0.16.5

type DeckTranscript struct {
	Segments []DeckSegment `json:"segments"`
}

DeckTranscript is .media/rec/<recId>/transcript.json.

type DerivedWrite

type DerivedWrite struct {
	Path    string `json:"path"`
	Changed bool   `json:"changed"`
	// contains filtered or unexported fields
}

DerivedWrite is one file the model produces and whether it differs from the file on disk.

type DesignState

type DesignState struct {
	At    int64 `json:"at"`
	State any   `json:"state"`
}

DesignState is what a page last said it shows.

type DialogResult

type DialogResult struct {
	TabID  string
	Status int
	Error  string
}

DialogResult is the conversation started, or the status and the words for the person.

type DocActor added in v0.16.86

type DocActor struct {
	Subject string
	Tab     string
}

DocActor is who writes: the name the history keeps, and the chat tab whose claims do not stop the write.

type DocError added in v0.16.86

type DocError struct {
	Code string
	Msg  string
}

DocError is a refusal of the Document API; Code is one of the DocErr words.

func (*DocError) Error added in v0.16.86

func (e *DocError) Error() string

type DocField added in v0.16.86

type DocField struct {
	Field string `json:"field"`
	Value string `json:"value"`
	// Attr is the attribute the field sets (data-hl-attr); "" when it sets the element's words.
	Attr  string   `json:"attr,omitempty"`
	Nodes []string `json:"nodes"`
}

DocField is a binding: the field's name, its value now and the elements it is on.

type DocNode added in v0.16.86

type DocNode struct {
	// ID is "<page id>:<tpl>".
	ID          string `json:"id"`
	Page        string `json:"page"`
	PageTitle   string `json:"pageTitle,omitempty"`
	Tpl         int    `json:"tpl"`
	Fingerprint string `json:"fp"`
	// Selector finds the element in the board as the browser shows it.
	Selector string `json:"selector"`
	Tag      string `json:"tag"`
	// Field is the element's data-hl-field, the binding an app edits it through.
	Field string            `json:"field,omitempty"`
	Attrs map[string]string `json:"attrs,omitempty"`
	// Text is the element's words, clipped; Own the words that are its own (not a block child's), for checks.
	Text string `json:"text,omitempty"`
	Own  string `json:"own,omitempty"`
	// Words counts the words of Own before it is clipped (what a maxWords rule counts), so a panel need not count a clipped text.
	Words int    `json:"words,omitempty"`
	Style string `json:"style,omitempty"`
	// Editable: the element's words are plain static text a setText can change.
	Editable bool `json:"editable,omitempty"`
	// BoardW is the page's width in px (0 unknown), for units that follow it.
	BoardW int `json:"boardW,omitempty"`
}

DocNode is an element of a board as the Document API shows it.

func (DocNode) String added in v0.16.86

func (n DocNode) String() string

String keeps a node readable in a log.

type DocOp added in v0.16.86

type DocOp struct {
	// Op is setText, setStyle, setAttr, insert, remove or setField.
	Op   string `json:"op"`
	Node string `json:"node,omitempty"`
	// FP is the fingerprint the caller saw the node with.
	FP    string `json:"fp,omitempty"`
	Field string `json:"field,omitempty"`
	Name  string `json:"name,omitempty"`
	// Value is a text, a number or a switch (setText, setAttr, setField); null removes an attribute.
	Value any `json:"value,omitempty"`
	// Style is the properties to put in (a nil value takes one out).
	Style map[string]*string `json:"style,omitempty"`
	// Position is before, after, start or end (insert).
	Position string `json:"position,omitempty"`
	HTML     string `json:"html,omitempty"`
}

DocOp is one change of a patch.

type DocPageRef added in v0.16.86

type DocPageRef struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	File  string `json:"file"`
	W     *int   `json:"w"`
	H     *int   `json:"h"`
}

DocPageRef is a page as the Document API lists it.

type DocPatched added in v0.16.86

type DocPatched struct {
	Rev   int64    `json:"rev"`
	Pages []string `json:"pages"`
	Edits int      `json:"edits"`
}

DocPatched is what a patch did.

type DocTemplate added in v0.16.154

type DocTemplate struct {
	App     string
	ID      string
	Version string
	// Lock is TemplateLockStrict or TemplateLockOpen.
	Lock string
}

DocTemplate is the template a board is made from: the app, the template, and how it locks the board.

type DoctorReport added in v0.16.154

type DoctorReport struct {
	OK    bool         `json:"ok"`
	At    time.Time    `json:"at"`
	Ms    int64        `json:"ms"`
	Kit   int          `json:"kit"` // the pinned kit's revision this doctor knows
	Steps []DoctorStep `json:"steps"`
}

DoctorReport is the result of RenderDoctor.

func (DoctorReport) Err added in v0.16.154

func (r DoctorReport) Err() error

DoctorError is nil for an OK report.

func (DoctorReport) FailedStep added in v0.16.154

func (r DoctorReport) FailedStep() *DoctorStep

FailedStep is the first step that failed, nil when the report is OK.

type DoctorStep added in v0.16.154

type DoctorStep struct {
	// ID names the step; Code is set on a failure (and on the warning of the versions step).
	ID   string `json:"id"`
	Name string `json:"name"`
	OK   bool   `json:"ok"`
	// Warn: the step passed but says something worth reading; it never fails the report.
	Warn bool `json:"warn,omitempty"`
	// Skipped: an earlier step failed, so this one could not run.
	Skipped bool   `json:"skipped,omitempty"`
	Code    string `json:"code,omitempty"`
	Detail  string `json:"detail,omitempty"`
	Hint    string `json:"hint,omitempty"`
	Ms      int64  `json:"ms"`
}

DoctorStep is one line of the report.

type DrawnThumb

type DrawnThumb struct {
	Board string
	File  string
	Name  string
}

DrawnThumb is the newest picture a board has on this machine: Name is its file's name, which changes with each drawing.

type EngineStatus added in v0.16.5

type EngineStatus struct {
	// Ready: a new project gets an engine. Always true unless RUNTIME_DESIGN_READY_PROBE=1 (then: the render doctor passed); older panels read it.
	Ready bool `json:"ready"`
	// Source is where a new project's engine comes from: EngineSourceOwn or EngineSourceVendor.
	Source string `json:"source"`
	// Release is the vendor's release new projects start on, null on our own engine.
	Release *string `json:"release"`
	// Chrome: a headless browser for checks, pictures and deck exports; Ffmpeg: video exports and recordings.
	Chrome bool `json:"chrome"`
	Ffmpeg bool `json:"ffmpeg"`
	// Render is the render doctor's cached result: set only when RUNTIME_DESIGN_READY_PROBE=1, and then Ready follows it.
	Render *RenderHealth `json:"render,omitempty"`
	// Fetch is the command that fetches the vendor's engine with the owner's account (optional), "" where it cannot work.
	Fetch string `json:"fetch"`
}

EngineStatus is what the panel needs to tell the person which engine new designs get and what else the machine has.

type ExportDownload

type ExportDownload struct {
	Path, Name, Type, Disposition string
}

ExportDownload is a finished export as it is handed over: its file, its name after the deck's title, its type and the Content-Disposition of the download. The hub's render worker hands an export over the same way.

type FetchOptions added in v0.16.5

type FetchOptions struct {
	// Dir is the engine folder (DefaultEngineDir of the data dir).
	Dir string
	// Claude is the Claude Code binary ("claude" on PATH when empty); Model its model ("haiku" when empty).
	Claude, Model string
	// TypeURL is the artifact type (DefaultEngineTypeURL when empty); Canvas a canvas of it to read from (the remembered
	// one, else a new one made on the account, when empty).
	TypeURL, Canvas string
	// Hook is the command the session's PreToolUse hook runs (`<cli> design engine hook`).
	Hook string
	// Budget caps one session's spend in USD ("0.50" when empty).
	Budget string
	// Log hears the steps.
	Log func(string)
	// contains filtered or unexported fields
}

FetchOptions say how to fetch.

type FetchResult added in v0.16.5

type FetchResult struct {
	Release string `json:"release"`
	New     bool   `json:"new"`
	Engine  string `json:"engine"`
	Files   int    `json:"files"`
}

FetchResult is what was fetched.

func FetchEngine added in v0.16.5

func FetchEngine(ctx context.Context, o FetchOptions) (FetchResult, error)

FetchEngine fetches the type's current release into the engine folder, unless it is there already.

type Folder

type Folder struct {
	ID     string `json:"id"`
	Name   string `json:"name"`
	Parent string `json:"parent"`
}

Folder is a folder of the library. Parent is "" for a top one; a folder inside another cannot hold a folder (one level).

type FolderError

type FolderError struct {
	Msg    string
	Status int
}

FolderError is a refusal to lay out, with the status to answer.

func (*FolderError) Error

func (e *FolderError) Error() string

type Grant added in v0.15.40

type Grant struct {
	Role      string     `json:"role"`
	Owner     string     `json:"owner"`
	OwnerName string     `json:"ownerName"`
	Until     *time.Time `json:"until"`
}

Grant is the person's own role in one project, already folded from the gateway's tables.

type GuardEnv added in v0.15.40

type GuardEnv struct {
	DataDir string
	// LibraryDir is the design library when the hook knows it: a search that starts at it or above it reads every
	// project below.
	LibraryDir string
	Now        time.Time
}

GuardEnv is what the hook needs beyond its input to judge access: the runtime's data folder (the snapshot of the gateway is there) and the time. Empty DataDir: no snapshot, so everything is allowed as before.

type GuardInput

type GuardInput struct {
	ToolName  string `json:"tool_name"`
	ToolInput struct {
		FilePath     string `json:"file_path"`
		NotebookPath string `json:"notebook_path"`
		Path         string `json:"path"`
		Pattern      string `json:"pattern"`
		Command      string `json:"command"`
	} `json:"tool_input"`
	Cwd string `json:"cwd"`
}

GuardInput is the part of a PreToolUse hook's input the guard reads.

type HistoryEntry

type HistoryEntry struct {
	ID, Subject string
	At          int64
	Editors     []string
	// Runtime is nil when the snapshot names none.
	Runtime *string
}

HistoryEntry is one snapshot touching a scope.

func ParseLog

func ParseLog(out string) []HistoryEntry

ParseLog reads the records of the log format readHistory asks for.

type HistoryError

type HistoryError struct{ Msg string }

HistoryError is a refusal worded for the person or the agent: the API returns it as is.

func (*HistoryError) Error

func (e *HistoryError) Error() string

type Identity

type Identity struct {
	Runtime, Person, PersonID string
	// Shared: the library is the store's, synced between machines, so a Unix user names no one there.
	Shared bool
}

Identity tells the runtimes of a shared folder apart (Runtime, the Unix user) and names the person behind it. PersonID is the stable key of that person across machines: the owner's whole address, lower case (the local part alone repeats across tenants); empty when the runtime knows no address (the Unix name is no person: self-hosted machines share one).

type ImportError

type ImportError struct {
	Msg      string
	Conflict bool
}

ImportError is a refusal worded for the person; Conflict when the id is taken (the caller may pick another).

func (*ImportError) Error

func (e *ImportError) Error() string

type ImportOptions

type ImportOptions struct {
	Source, ID string
	Title      *string
	SourceName *string
	Force      bool
}

ImportOptions name an import: Source is a zip or a project folder; SourceName is recorded as where it came from.

type ImportResult

type ImportResult struct {
	ID, Title, Dir string
	Boards         int
	Dropped        []string
}

ImportResult is the project put into the library.

type KitBoardUse

type KitBoardUse struct {
	Path  string   `json:"path"`
	Title string   `json:"title"`
	Nodes []string `json:"nodes"`
}

KitBoardUse is a board of a project and the kit's nodes it uses.

type KitCard

type KitCard struct {
	ID       string                  `json:"id"`
	Title    string                  `json:"title"`
	Version  string                  `json:"version"`
	Versions []string                `json:"versions"`
	Themes   []designkit.CanvasTheme `json:"themes"`
	// Cover is a picture of the kit: the first template's cover in its first theme (a path in the version), "" when
	// none.
	Cover      string `json:"cover"`
	CoverTheme string `json:"coverTheme"`
	Layouts    int    `json:"layouts"`
	Assets     int    `json:"assets"`
	// ThemeCards is a card per theme (a kit of several brands shows each on the shelf), in the kit's order.
	ThemeCards []KitThemeCard `json:"themeCards"`
}

KitCard is an installed kit with a canvas as the library lists it.

func CachedKitCards

func CachedKitCards(dir string) []KitCard

CachedKitCards is KitCards of the folder, kept while the folder looks the same (see the top of the file).

func KitCards

func KitCards(dir string) []KitCard

KitCards lists the installed kits that have a canvas, newest version of each.

type KitDraftState

type KitDraftState struct {
	Project      string             `json:"project"`
	Base         string             `json:"base"`
	CreatedAt    int64              `json:"createdAt"`
	Changes      []designkit.Change `json:"changes"`
	ChangedCount int                `json:"changedCount"`
}

KitDraftState is a kit's draft as the screen shows it.

type KitError

type KitError struct {
	Msg    string
	Status int
}

KitError is a refusal of a kit operation worded for the person.

func (*KitError) Error

func (e *KitError) Error() string

type KitFont

type KitFont struct {
	// ID is the address a deck stores: kit:<kit>:<version>:<font>.
	ID         string        `json:"id"`
	Family     string        `json:"family"`
	Kit        string        `json:"kit"`
	Version    string        `json:"version"`
	Restricted bool          `json:"restricted"`
	Faces      []KitFontFace `json:"faces"`
}

KitFont is a font a kit offers to decks.

type KitFontFace

type KitFontFace struct {
	Weight int    `json:"weight"`
	Style  string `json:"style,omitempty"`
	File   string `json:"file"`
}

KitFontFace is one weight of a kit font: a file inside the kit.

type KitLink struct {
	Project string        `json:"project"`
	Title   string        `json:"title"`
	Kit     string        `json:"kit"`
	KitName string        `json:"kitTitle"`
	Theme   string        `json:"theme"`
	Version string        `json:"version"`
	Latest  string        `json:"latest"`
	Boards  []KitBoardUse `json:"boards"`
	// Nodes names every node the boards use, with its picture (a path in the version) where it has one.
	Nodes map[string]KitNodeInfo `json:"nodes"`
}

KitLink is the kit a project is built on: its theme and version ("" when the project's copy matches no installed version), the newest installed version, and the boards with the kit's nodes they use.

type KitListItem

type KitListItem struct {
	ID    string `json:"id"`
	Title string `json:"title,omitempty"`
	// Versions are the installed ones, newest first; Draft: the kit has a draft the person may read (version «draft»).
	Versions []string `json:"versions"`
	Themes   []string `json:"themes,omitempty"`
	Draft    bool     `json:"draft,omitempty"`
	// Canvas: the newest version describes a canvas the kit_* tools read; false for an older kit (boards only).
	Canvas bool `json:"canvas"`
}

KitListItem is a kit the person may read.

type KitListView

type KitListView struct {
	Schema string        `json:"schema"`
	Kits   []KitListItem `json:"kits"`
}

KitListView is the answer of kit_list.

type KitNodeInfo

type KitNodeInfo struct {
	Name string `json:"name"`
	Shot string `json:"shot,omitempty"`
}

KitNodeInfo is what a project's bar says of a kit node: its name and its picture.

type KitPin

type KitPin struct {
	ID      string `json:"id"`
	Version string `json:"version"`
	// Mounts are the names under ds/ the project takes from the kit; empty is every mount the kit offers.
	Mounts []string `json:"mounts,omitempty"`
	// Draft: the project is shown on the kit's draft for now, Version is where it goes back to.
	Draft bool `json:"draft,omitempty"`
	// Dismissed is the newer version the person chose to stay away from; it is not offered again.
	Dismissed string `json:"dismissed,omitempty"`
}

KitPin is a project's kit.

func KitPinIn

func KitPinIn(libraryDir, project string) (KitPin, bool)

KitPinIn is the kit a project of the library in libraryDir is pinned to, read from its folder without a Library (the hub's views lay out the pinned kit before they make the project's library).

type KitPinError

type KitPinError struct{ Msg string }

KitPinError is a refusal of a pin change worded for the person.

func (*KitPinError) Error

func (e *KitPinError) Error() string

type KitProbe

type KitProbe struct {
	Vars      []KitProbeVar     `json:"vars"`
	Theme     map[string]string `json:"theme,omitempty"` // the theme object the kit's provider published as CSS variables
	DarkBy    string            `json:"darkBy,omitempty"`
	Component string            `json:"component"`
	Errors    []string          `json:"errors,omitempty"`
}

KitProbe is what ProbeKit read.

func ProbeKit

func ProbeKit(folder string, opt KitProbeOptions) (*KitProbe, error)

ProbeKit reads the kit in folder; see the file's comment.

type KitProbeOptions

type KitProbeOptions struct {
	Chrome  string
	Offline bool
	KitsDir string
}

KitProbeOptions are ProbeKit's.

type KitProbeVar

type KitProbeVar struct {
	Name  string `json:"name"`
	Raw   string `json:"raw"`
	Value string `json:"value"`
	Dark  string `json:"dark,omitempty"`
}

KitProbeVar is one custom property: Raw as the page's styles declare it, Value resolved (the same when it needs no resolving), Dark its value under the dark selector when that differs.

type KitRenderItem

type KitRenderItem struct {
	Theme  string   `json:"theme"`
	Node   string   `json:"node"`
	ID     string   `json:"id,omitempty"` // the component's or the layout's id
	Status string   `json:"status"`       // ok, error (a script error or a failed request), blank (draws nothing)
	Errors []string `json:"errors,omitempty"`
	Shot   string   `json:"shot,omitempty"` // the picture written, relative to the kit folder
	Ms     int64    `json:"ms"`
}

KitRenderItem is how one component or layout rendered.

func RenderKit

func RenderKit(folder string, opt KitRenderOptions) ([]KitRenderItem, error)

RenderKit renders the kit in folder; see the file's comment.

type KitRenderOptions

type KitRenderOptions struct {
	// Shots writes the pictures and their paths into the folder.
	Shots bool
	// Only, when not empty, renders just these components and layouts (by id).
	Only map[string]bool
	// Chrome is the browser to drive; the usual places when empty.
	Chrome string
	// Offline draws with a browser that reaches nothing but this machine (a kit nobody here wrote).
	Offline bool
	// Tabs is how many pages draw at once (4 when 0).
	Tabs int
	// KitsDir is the folder of installed kits a kit that extends another finds its base in; "" for none.
	KitsDir string
}

KitRenderOptions are RenderKit's.

type KitSettingsState

type KitSettingsState struct {
	ReadOnly bool `json:"readOnly"`
	// Owner: the person made the kit, so they may turn ReadOnly on and off.
	Owner bool `json:"owner"`
}

KitSettingsState is a kit's settings as a person sees them.

type KitState

type KitState struct {
	ID string `json:"id"`
	// Settings: whether the kit is for viewing only, and whether the person asking made it (KitVersionsState).
	Settings KitSettingsState `json:"settings"`
	// MayEdit: the person may start or edit the draft now (KitVersionsState).
	MayEdit  bool                  `json:"mayEdit"`
	Latest   string                `json:"latest"`
	Versions []designkit.Published `json:"versions"`
	Draft    *KitDraftState        `json:"draft"`
	Projects []KitUse              `json:"projects"`
}

KitState is a kit with its versions, its draft and the projects on it.

type KitThemeCard

type KitThemeCard struct {
	ID      string `json:"id"`
	Title   string `json:"title"`
	Cover   string `json:"cover"`
	Layouts int    `json:"layouts"`
}

KitThemeCard is a theme of a kit on the shelf: its cover (a path in the version) and how many templates it holds.

type KitTools

type KitTools struct {
	L *Library
}

KitTools are the kit tools for one runtime. What a call may read is decided by KitVisible: an installed version is open to the runtime's person, the draft only to someone who may open the draft's project.

func (KitTools) Call

func (t KitTools) Call(ctx context.Context, name string, args *jsvalue.Object) *jsvalue.Object

func (KitTools) Has

func (t KitTools) Has(name string) bool

func (KitTools) Instructions

func (KitTools) Instructions() string

func (KitTools) Tools

func (KitTools) Tools() []any

type KitUse

type KitUse struct {
	Project string `json:"project"`
	Title   string `json:"title"`
	Version string `json:"version"`
	Draft   bool   `json:"draft"`
}

KitUse is a project on a kit.

type LaunchRequest

type LaunchRequest struct {
	Cwd         string
	CwdRoots    []string
	Prompt      string
	PromptFiles []string
}

LaunchRequest is a new agent conversation in a project's folder, as the dialog starts it.

type LaunchResult

type LaunchResult struct {
	OK     bool
	TabID  string
	Status int
	Error  string
}

LaunchResult is the conversation started (OK) or the status and the error code or text to word for the person.

type Layout

type Layout struct {
	Folders []Folder          `json:"folders"`
	Placed  map[string]string `json:"placed"`
	Systems map[string]System `json:"systems"`
}

Layout is a person's folders and where their projects lie (a project not named lies at the top).

type LeaseConfig added in v0.16.15

type LeaseConfig struct {
	Mode      string
	HubURL    string
	Token     string
	TokenFile string
	Timeout   time.Duration
}

LeaseConfig chooses where the leases are kept. Mode "folder" (or empty) is the default; "center" needs HubURL, the base of the room's API (https://host/v1 or https://host/v1/rooms/<room>), and the machine's token.

type LeaseTurnRunningError added in v0.16.15

type LeaseTurnRunningError struct{}

LeaseTurnRunningError: the holder chat's agent is working; "release" is refused, "force" is the way.

func (*LeaseTurnRunningError) Error added in v0.16.15

func (e *LeaseTurnRunningError) Error() string

type LeaseView added in v0.16.15

type LeaseView struct {
	Project string `json:"project"`
	Board   string `json:"board"`
	Page    string `json:"page,omitempty"`
	Person  string `json:"person"`
	// Mine: the holder is this person (maybe in another chat, maybe on another machine): the lease may be taken off by force.
	Mine bool `json:"mine"`
	// Local: the holder chat is a tab of this runtime ("go to the chat").
	Local       bool             `json:"local"`
	Runtime     string           `json:"runtime"`
	Machine     string           `json:"machine"`
	ChatID      string           `json:"chatId"`
	ChatTitle   string           `json:"chatTitle"`
	WorkspaceID string           `json:"workspaceId,omitempty"`
	Since       int64            `json:"since"`
	LastEdit    int64            `json:"lastEdit"`
	TurnRunning bool             `json:"turnRunning"`
	ExpiresAt   int64            `json:"expiresAt"`
	Requests    []ReleaseRequest `json:"requests"`
}

LeaseView is a lease as the web UI shows it.

type Library

type Library struct {

	// LockUnbound says whether a project's hand edits are limited to the elements an app binds (data-hl-field): set by
	// the runtime from the apps on in the project; nil when no app locks anything.
	LockUnbound func(project string) bool
	// contains filtered or unexported fields
}

Library is one runtime's view of its library: its caches, its server and its background work.

func New

func New(cfg Config) *Library

func (*Library) Access added in v0.15.40

func (l *Library) Access() (AccessSnapshot, bool)

Access is the current snapshot; false while the runtime has none.

func (*Library) AddDeckComment added in v0.16.5

func (l *Library) AddDeckComment(id string, spec DeckCommentSpec) (DeckComment, error)

AddDeckComment pins a comment to a point of a slide, in the name of the runtime's person.

func (*Library) AddScene3D

func (l *Library) AddScene3D(person string, a Scene3DAdd) (CreatedProject, bool, error)

AddScene3D makes the scene's document, or finds the one that already points at the same .blend (a rebuilt scene is the same document: no duplicates) and answers whether it was there before.

func (*Library) AddScene3DComment

func (l *Library) AddScene3DComment(id string, spec DeckCommentSpec, shot []byte) (DeckComment, error)

AddScene3DComment pins a comment on the model: the object, a point, the view and the frame; the viewport's picture (shot, a JPEG) is kept beside it.

func (*Library) AddSiteComment

func (l *Library) AddSiteComment(id string, by DeckPerson, spec SiteCommentSpec) (DeckComment, error)

AddSiteComment pins a comment to a board, or adds a reply to a thread (Parent), in the name of `by`.

func (*Library) AddVideoOverlay added in v0.16.86

func (l *Library) AddVideoOverlay(id, scene string, oid string, patch map[string]json.RawMessage, actor VideoOverlayActor) (VideoScene, string, error)

AddVideoOverlay adds an overlay to a scene. patch names its fields over the kind's defaults ("kind" is required); id, when given, must be free. The answer is the scene and the new overlay's id.

func (*Library) AddVideoZoom

func (l *Library) AddVideoZoom(id, scene, zid string, patch map[string]json.RawMessage, actor VideoOverlayActor) (VideoScene, string, error)

AddVideoZoom adds a zoom over the defaults (zoom 1.7, ease 0.7 s, the page's centre); at and out are required. The first zoom of a scene turns the board's own camera off: from then on the camera is the scene's zooms.

func (*Library) AdoptKitCopies

func (l *Library) AdoptKitCopies(kit string, dry bool, may func(project string) bool) (AdoptReport, error)

AdoptKitCopies moves the library's projects off their copies of the kit's themes onto the kit's versions. may says which projects the caller may change (nil: all); the others are left as they are and not reported.

func (*Library) AnnounceNew added in v0.15.40

func (l *Library) AnnounceNew(id string)

AnnounceNew is what a runtime does about a project it just made: the owner file (personal) and the news for the gateway, which then registers the person as the owner.

func (*Library) AnnounceNewBy added in v0.16.123

func (l *Library) AnnounceNewBy(id, person string)

AnnounceNewBy is AnnounceNew for the person who made the project (the page session's address); empty is the runtime's.

func (*Library) AppendRecChunk added in v0.16.5

func (l *Library) AppendRecChunk(id, rec string, seq int, body io.Reader) error

AppendRecChunk appends chunk number seq to av.webm. The chunks come in order from 0: the same seq again changes nothing (its bytes are read and dropped), a gap is refused with the number wanted. Whatever a failed append left behind the whole part is cut off before the next one.

func (*Library) AppendRecEvents added in v0.16.5

func (l *Library) AppendRecEvents(id, rec string, lines []DeckEvent) (int, error)

AppendRecEvents appends lines to events.jsonl; a line of no known kind or with a time outside the recording is dropped. It says how many were kept.

func (*Library) ArtifactDir

func (l *Library) ArtifactDir(id string) string

func (*Library) ArtifactVersion

func (l *Library) ArtifactVersion(ref string, maxAge time.Duration) int64

ArtifactVersion is the newest modification time in the artifact (ms). While the library's watcher runs it is kept until a change under the artifact; without the watcher it is remembered for maxAge, as the old runtime did.

func (*Library) AttachAgents

func (l *Library) AttachAgents(artifacts []*Artifact, selfTab string) error

AttachAgents puts on every artifact the agent conversations whose transcripts name its files (selfTab marks the one that asked), and as inferred claims the boards a working chat wrote lately without claiming them.

func (*Library) AttachChecks

func (l *Library) AttachChecks(artifacts []*Artifact)

AttachChecks gives each design the cover and the outcome of its last check, if it was ever checked.

func (*Library) AttachClaims

func (l *Library) AttachClaims(artifacts []*Artifact) error

AttachClaims puts on each project the live claims of its boards, of every runtime, and keeps the boards a chat of this runtime is seen editing without a claim.

func (*Library) AttachReleases

func (l *Library) AttachReleases(artifacts []*Artifact)

AttachReleases puts each project's release on the listing when releases are used.

func (*Library) AttachedLine added in v0.15.40

func (l *Library) AttachedLine(a *Artifact, rules string) string

AttachedLine is what a chat outside the design's folder reads when the person attaches the design to a message: where the project and its boards are, and the rules a design dialog works by (the file PrepareDialog wrote).

func (*Library) BackfillOwners added in v0.16.5

func (l *Library) BackfillOwners(s AccessSnapshot)

BackfillOwners adds the person to the owner files made before the owner file had a person, on the word of the gateway only: the snapshot enforces access and lists the project with this runtime's person (the whole address) as its owner, the file names no person yet, and its user is this runtime's Unix user. Reading never writes: on a self-hosted library every person shares one Unix user, so a file alone cannot say whose it is. A file of another Unix user is never touched; the write is the library's usual one (no links, a temporary file renamed over).

func (*Library) BoardFileOf

func (l *Library) BoardFileOf(project, board string) string

boardFileOf is the file of the board a claim key names; the key itself when no board has it. BoardFileOf is the file of a project's board an agent named (its key, page or title), as the page names its boards; "" when there is no such project or board.

func (*Library) BoardIsBuilt

func (l *Library) BoardIsBuilt(project, boardFile string) (source string, built bool)

BoardIsBuilt is whether the board file of the project is built from a page module, and from which.

func (*Library) BoardLockReason added in v0.16.154

func (l *Library) BoardLockReason(project, absPath string) string

BoardLockReason is why a write of the board file must be refused, "" when it may go on: the file is the board of a locked page, or the page's own file in meta/pages. The agent's hook asks it (a write by an agent is not seen as a change of content, so the file itself is closed to it; the Document API is the way).

func (*Library) BoardOfMockup

func (l *Library) BoardOfMockup(s MockupSpec, store MockupStore) (MockupBoard, error)

BoardOfMockup is the board of the mockup: the one it became before, while that board is there and the person still sees its project, else a new page of the fittest candidate the person may edit, else a page of a new project of theirs. A board made is recorded before the answer, so a second press finds it.

func (*Library) BoardOfPath

func (l *Library) BoardOfPath(p string) (ref, board string)

BoardOfPath is the design an absolute path is a page of, and the page as the design's viewer names it (its path in the project folder): a board, an .html of the project. The design's own folder (or its project/) is the design with no board (""). Any other file (a script, a style, the design system's notes) is ("", ""): it opens as the file it is, as does a path outside the library.

func (*Library) BoardThumbNow

func (l *Library) BoardThumbNow(id, boardPath string, urgent bool) (ThumbAnswer, bool)

BoardThumbNow answers without waiting; urgent is a picture a person is looking at. ok false: no such board.

func (*Library) BriefOnce

func (l *Library) BriefOnce(session, project string) string

BriefOnce is KitBrief the first time a chat session asks for a project, "" after that.

func (*Library) BuildPage

func (l *Library) BuildPage(project, name string) PageBuild

BuildPage builds the board of pages/<name>.tsx and writes it when its bytes changed. It does not touch a board file that is not built from this page.

func (*Library) BuildPages

func (l *Library) BuildPages(project, only string) []PageBuild

BuildPages builds the project's pages (one when only is set), in name order.

func (*Library) BuiltBoardReason

func (l *Library) BuiltBoardReason(project, boardFile string) string

BuiltBoardReason is why a write to the board file must be refused, "" when it may go on.

func (*Library) CallerOf

func (l *Library) CallerOf(session string) (Caller, error)

CallerOf is the chat that owns the tmux session, never one named in an argument.

func (*Library) Can added in v0.15.40

func (l *Library) Can(id string, min Role) bool

Can: the runtime's person may do what min stands for in the project.

func (*Library) CanFor added in v0.16.154

func (l *Library) CanFor(id string, min Role, person string) bool

CanFor is Can for a person by address ("" is the runtime's own).

func (*Library) ChangeSiteComment

func (l *Library) ChangeSiteComment(id, commentID string, by DeckPerson, resolved *bool, emoji string) (DeckComment, error)

ChangeSiteComment resolves or opens a thread (resolved non-nil), or turns `by`'s reaction on or off (emoji).

func (*Library) CheckDir

func (l *Library) CheckDir(ref string) string

func (*Library) CheckStrict

func (l *Library) CheckStrict(project string, only []string) (*StrictReport, error)

CheckStrict runs the strict check on a project; only, when set, names the pages (by name) and boards (by file, with or without .dc.html) to read.

func (*Library) CheckSummaryOf

func (l *Library) CheckSummaryOf(id string) *CheckSummary

CheckSummaryOf is the outcome of the project's last check, nil when it was never checked: the machine puts it into the project's record, and the hub's library shows it with the machine off.

func (*Library) ChosenNewProjectsRelease

func (l *Library) ChosenNewProjectsRelease() string

ChosenNewProjectsRelease is the library's own choice, "" when new projects follow the newest stable release.

func (*Library) ClaimBoard

func (l *Library) ClaimBoard(project, board string, owner ClaimOwner, now int64) (ClaimResult, error)

ClaimBoard takes a board for a chat: its own claim is refreshed (since stays), one held by another live chat is refused with the holder, a stale or unreadable file is cleared away first.

func (*Library) ClaimForChat

func (l *Library) ClaimForChat(session string, project, board any) (ClaimOutcome, error)

func (*Library) ClaimOnce added in v0.15.40

func (l *Library) ClaimOnce(id string, owner Owner, who Identity)

ClaimOnce: this runtime's v1 owner file stands over a project the snapshot has no row for; the gateway is told so, once for the life of the runtime, and registers the person as the owner of it. Without a snapshot nothing is sent (that gateway does not know the event).

func (*Library) ClaimOwnerless added in v0.15.40

func (l *Library) ClaimOwnerless(id string) error

ClaimOwnerless makes the person who asked the owner of a project nobody owns: it exists, has no owner file and the snapshot has no row for it. The file names the person (v2, "claimed"): a v1 file named only the Unix user, so on a shared library the runtime that clicked first owned a project another person made («harnessly»). The gateway then registers the owner on design.claim and the team keeps editing. An empty person is the runtime's.

func (*Library) ClaimOwnerlessAs added in v0.16.123

func (l *Library) ClaimOwnerlessAs(id, person string) error

ClaimOwnerlessAs is ClaimOwnerless for the person of the request.

func (*Library) ClearSticky

func (l *Library) ClearSticky(dir string) bool

ClearSticky clears the sticky bit of dir when it is a folder of this user's inside the library; true when it changed the mode. The folder is opened without following a link, so the mode read and changed is that of the very folder resolved.

func (*Library) ClearStickyTree

func (l *Library) ClearStickyTree(dir string) []string

ClearStickyTree is dir and every folder under it, links not entered; the folders changed.

func (*Library) Config

func (l *Library) Config() Config

func (*Library) ConnectKitPackage

func (l *Library) ConnectKitPackage(project, source, registry string) (*KitPin, error)

ConnectKitPackage is the button «Подключить UI-кит» for a package: the package becomes a kit (kit add), its components are drawn once (render), the kit is installed on the machine and the project is pinned to it. source is "npm:<package>[@version]" or "shadcn:<registry>"; registry is an optional private npm registry.

func (*Library) ContinueInstructions

func (l *Library) ContinueInstructions(a *Artifact) string

ContinueInstructions are the system-prompt instructions of a design dialog.

func (*Library) CoverFile

func (l *Library) CoverFile(id string) string

CoverFile is the file of a design's cover (the first shot of its last check); "" when it was never checked.

func (*Library) CreatePage

func (l *Library) CreatePage(id string, s PageSpec) (Page, error)

CreatePage adds a page: a new id, the file named after the title (or as asked), its content the project's board template, or a copy of the page it is a variant of. A file that is there and no page names is taken as it is.

func (*Library) CreateProject

func (l *Library) CreateProject(title string) (CreatedProject, error)

CreateProject makes a new project from the template under an id made from the title (the next free one).

func (*Library) CreateRec added in v0.16.5

func (l *Library) CreateRec(id string, camera bool, mime string) (DeckRecMeta, error)

CreateRec starts a recording of the deck: its pages as they are now, no chunks yet.

func (*Library) CreateScene3D

func (l *Library) CreateScene3D(title, person string, s Scene3DSettings) (CreatedProject, error)

CreateScene3D makes a new 3D scene document over a project of this machine and answers its id and title.

func (*Library) DeckExportDownload

func (l *Library) DeckExportDownload(artifact, id string) (ExportDownload, bool)

DeckExportDownload is the download of a finished job; false when there is none.

func (*Library) DeckExportJobOf added in v0.16.5

func (l *Library) DeckExportJobOf(artifact, id string) (DeckExportJob, string, bool)

DeckExportJobOf is a job by id; false when the machine does not know it (it restarted, or a day passed).

func (*Library) DeckPublishedState added in v0.16.5

func (l *Library) DeckPublishedState(id string) DeckPublished

DeckPublishedState says what is under DeckPublishedDir for guests.

func (*Library) DeckRecordings added in v0.16.5

func (l *Library) DeckRecordings(id string) []DeckRecordingInfo

DeckRecordings are the deck's recordings, newest first, for the deck's state.

func (*Library) DeckRecsRev added in v0.16.5

func (l *Library) DeckRecsRev(id string) int64

DeckRecsRev is the newest mtime (ms) of the files of the deck's recordings and of what it published, a part of the deck's rev.

func (*Library) DeckSlides added in v0.16.5

func (l *Library) DeckSlides(id string) []DeckSlide

DeckSlides are the pages of the deck whose board file is there, in order.

func (*Library) DeckState added in v0.16.5

func (l *Library) DeckState(id string) (DeckState, error)

DeckState is everything the deck page reads in one go.

func (*Library) DeleteProject added in v0.16.15

func (l *Library) DeleteProject(id string) error

DeleteProject moves a project's folder to the library's .trash/, whole: nothing is erased, and the folder can be put back by hand. The library's server, the guest links and the listing stop knowing the project at once; the gateway is told, so the project's access row and its links go too.

func (*Library) DemoSeeded

func (l *Library) DemoSeeded() bool

DemoSeeded tells whether the library already got the demo projects.

func (*Library) DesignOfPath added in v0.15.40

func (l *Library) DesignOfPath(p string) string

DesignOfPath is the design whose folder holds an absolute path (the folder itself or a file in it), "" for none.

func (*Library) DiffProject

func (l *Library) DiffProject(project, rev string) (ProjectDiff, error)

DiffProject compares a version of the project with the project as it is now (saved first).

func (*Library) DiscardKitDraft

func (l *Library) DiscardKitDraft(kit string) error

DiscardKitDraft puts the kit back to its last version: the projects on the draft go back to their versions and the draft's project goes to the library's trash, whole.

func (*Library) DocAddBoard added in v0.16.86

func (l *Library) DocAddBoard(project, title string, src []byte, tpl *DocTemplate, who DocActor, now time.Time) (Page, error)

DocAddBoard adds a page whose board is src (a board with a template, <x-dc>), as one history entry.

The board is cleaned first (CleanTemplateBoard): a template's scripts and handlers do not run on the project of whoever installs the app. tpl, when given, makes the board a locked one: the record goes into the page's meta.

func (*Library) DocContentHash

func (l *Library) DocContentHash(project string) string

DocRev is the time of the project's newest board, in ms: it changes when any board is written. DocContentHash is a sha256 of a document's pages, by their ids and contents, in the order of the model: what the document is, whatever the files' times say (a status of an app's document is pinned to it, apps/workflow.go). "" when the project has no model.

func (*Library) DocFields added in v0.16.86

func (l *Library) DocFields(project string) ([]DocField, error)

DocFields are the data bindings of the project's boards, in the order they appear.

func (*Library) DocNodeByID added in v0.16.86

func (l *Library) DocNodeByID(project, id string) (DocNode, error)

DocNodeByID is the element a node id names, as it is now.

func (*Library) DocNodes added in v0.16.86

func (l *Library) DocNodes(project, page string) ([]DocNode, error)

DocNodes lists the elements of a page (page "" is every page) in the board's order.

func (*Library) DocPages added in v0.16.86

func (l *Library) DocPages(project string) ([]Page, error)

DocPages are the project's pages in their order. A project without meta/ has no pages model to address nodes by.

func (*Library) DocPatch added in v0.16.86

func (l *Library) DocPatch(project string, ops []DocOp, who DocActor, now time.Time) (DocPatched, error)

DocPatch writes ops into the project's boards: all of them or none.

func (*Library) DocQuery added in v0.16.86

func (l *Library) DocQuery(project, selector, page string) ([]DocNode, error)

DocQuery are the elements of a page (page "" is every page) that match a selector.

func (*Library) DocRev added in v0.16.86

func (l *Library) DocRev(project string) int64

func (*Library) DrawnThumbs

func (l *Library) DrawnThumbs(id string) []DrawnThumb

DrawnThumbs are the pictures the boards of a project have now, without drawing any (what goes to the store, so the library shows its cards while this machine is off).

func (*Library) EditBoards

func (l *Library) EditBoards(id string, e BoardEdit) ([]Board, error)

EditBoards applies one change and returns the boards as they are now. Two edits of one design queue.

func (*Library) EditKitFrom

func (l *Library) EditKitFrom(project string) (designkit.Draft, error)

EditKitFrom is "Править в ките": the kit's draft (made when there is none) with the project switched onto it.

func (*Library) EmitDesignEvent added in v0.15.40

func (l *Library) EmitDesignEvent(kind, project string)

EmitDesignEvent tells the cluster, through the machine agent, that a project was made here (kind "design.created") or that this runtime's owner file stands over a project the cluster has no row for ("design.claim"). It never waits and never fails the caller: with no agent running the event is simply not sent.

func (*Library) Enforcing added in v0.15.40

func (l *Library) Enforcing() bool

Enforcing: a snapshot that restricts is held.

func (*Library) Engine added in v0.16.5

func (l *Library) Engine() EngineStatus

Engine says what this machine has for the design tool.

func (*Library) EngineFetchCommand added in v0.16.5

func (l *Library) EngineFetchCommand() string

EngineFetchCommand is the command that fetches the vendor's engine.

func (*Library) EngineFor

func (l *Library) EngineFor(id string) string

EngineFor is the engine file served as the project's support.js, "" to serve the one on disk: releases are not used, the project names no release, or the mirror does not have the one it names.

func (*Library) EnsureGuide

func (l *Library) EnsureGuide() error

EnsureGuide writes the rules next to the artifacts when they are missing or older than this runtime's.

func (*Library) EnsureServer

func (l *Library) EnsureServer() (int, error)

EnsureServer starts the library server on first use and returns its port; every caller gets the same one. The preferred port taken, a free one is used.

func (*Library) ExportCode

func (l *Library) ExportCode(project, target string, dryRun bool) (*CodeExport, error)

ExportCode turns the project's page modules into the application's code under target. With dryRun nothing is written. A strict finding or a conflict stops it before anything is written.

func (*Library) FinishRec added in v0.16.5

func (l *Library) FinishRec(id, rec string, durationMs int64) (DeckRecording, error)

FinishRec closes the recording at durationMs, fixes its takes from the events and starts the transcript behind it. Finishing a finished recording changes nothing.

func (*Library) FolderProjects

func (l *Library) FolderProjects(person, id string) ([]string, error)

FolderProjects are the projects lying in the folder and the folders under it.

func (*Library) ForAgent

func (l *Library) ForAgent(r *CheckReport) AgentReport

ForAgent is a report as an agent reads it: every board and view with its status, problems and screenshot file.

func (*Library) ForceReleaseLease added in v0.16.15

func (l *Library) ForceReleaseLease(project, board string) (*Claim, error)

ForceReleaseLease takes the lease of the person's own chat off at once ("Снять — это зависло"): the holder must be this person. The chat that held it learns on its next edit that the lease is gone.

func (*Library) Guide

func (l *Library) Guide() string

Guide is the library's rules: how to work here, then the board format, so a design needs no account to read them.

func (*Library) GuidePath

func (l *Library) GuidePath() string

func (*Library) HasMeta

func (l *Library) HasMeta(id string) bool

HasMeta: the project keeps its model in meta/ (a plain folder with a plain project.json).

func (*Library) HasPages

func (l *Library) HasPages(ref string) bool

HasPages says whether a page of the design is open now (it hears the agents' commands).

func (*Library) HistoryFailure

func (l *Library) HistoryFailure() string

HistoryFailure is why the history is not being kept, "" while it works.

func (*Library) HistoryForCLI

func (l *Library) HistoryForCLI(project any, board any, limit float64) (CLIHistory, error)

HistoryForCLI lists the versions of a project, or of one board when board is not nil.

func (*Library) HistoryForPanel

func (l *Library) HistoryForPanel(artifact, board any, limit float64) ([]BoardSnapshot, error)

HistoryForPanel lists the latest versions of a board file.

func (*Library) HistoryGitDir

func (l *Library) HistoryGitDir(root string) string

HistoryGitDir is where this runtime keeps the history of the library at root (a real path): one repository per root.

func (*Library) Identity

func (l *Library) Identity() (Identity, error)

Identity is asked on every pass of the keeper and every poll of the list; it is kept a minute.

func (*Library) IdentityOf added in v0.16.123

func (l *Library) IdentityOf(person string) (Identity, error)

IdentityOf is the runtime's identity with another person behind it: the one whose page session or chat asked. The Unix user stays the runtime's (it is what wrote the file); the name comes from the team's people list, else the local part of the address. An empty or unusable address is the runtime's own person.

func (*Library) ImportProject

func (l *Library) ImportProject(o ImportOptions) (ImportResult, error)

ImportProject puts an export of the design tool into the library under id.

func (*Library) InitDeck added in v0.16.5

func (l *Library) InitDeck(id string, in DeckInit) error

InitDeck writes the settings of a new deck.

func (*Library) InitScene3D

func (l *Library) InitScene3D(id string, s Scene3DSettings) error

InitScene3D validates and writes the settings of a new 3D scene.

func (*Library) InitVideo added in v0.16.42

func (l *Library) InitVideo(id string, in VideoInit) error

InitVideo writes the settings of a new video. The deck's files come first (InitDeck): a video is a deck folder.

func (*Library) IsDeck added in v0.16.5

func (l *Library) IsDeck(id string) bool

IsDeck: the project is a deck. Every deck keeps its settings file from the moment it is made, and the file lives in the project's folder, so every runtime of a shared library tells a deck the same way.

func (*Library) IsKitOwner

func (l *Library) IsKitOwner(kit, person string) bool

IsKitOwner is whether the person made the kit ("" is the machine's own person, who installed it).

func (*Library) IsScene3D

func (l *Library) IsScene3D(id string) bool

IsScene3D: the project is a 3D scene. It keeps meta/scene3d.json from the moment it is made.

func (*Library) IsVideo added in v0.16.42

func (l *Library) IsVideo(id string) bool

IsVideo: the project is a video. Every video keeps meta/video.json from the moment it is made, beside the deck's meta/deck.json, so every runtime of a shared library tells a video the same way. A video is a deck too (IsDeck).

func (*Library) KitAsked

func (l *Library) KitAsked(project string) string

KitAsked is the person's answer to «which kit»: a kit id, KitNone, or "" while it was not asked.

func (*Library) KitBrief

func (l *Library) KitBrief(project string) string

KitBrief is the short block an agent is handed about the project's kit: «draw only from it», how to read it and how to check the result. "" for a project without a kit. When the project has none but the machine has kits and the person was not asked yet, it is the one question to ask. Project is the library id.

func (*Library) KitCanvasFor

func (l *Library) KitCanvasFor(kit, version, theme string) (*designkit.Canvas, error)

KitCanvasFor reads the canvas of a theme of a kit version the person may read, "" version being the newest.

func (*Library) KitDraft

func (l *Library) KitDraft(kit string) (designkit.Draft, bool)

KitDraft is the kit's draft, cached by its record's time.

func (*Library) KitFonts

func (l *Library) KitFonts() []KitFont

KitFonts is the fonts of every installed kit's newest version, by kit and font.

func (*Library) KitLinkOf

func (l *Library) KitLinkOf(id string) *KitLink

KitLinkOf is the kit a project is built on, or nil.

func (*Library) KitList

func (l *Library) KitList() KitListView

KitList is the kits the person may read, as kit_list answers.

func (*Library) KitMountDirs

func (l *Library) KitMountDirs(project string) map[string]string

KitMountDirs are the folders the project's ds/<mount>/ come from, by mount: what an export or a published site adds to the project's own files. A file the project has itself wins over the kit's one at the same path.

func (*Library) KitOwner

func (l *Library) KitOwner(kit string) string

KitOwner is the email of the kit's maker: the one recorded, or the library's owner.

func (*Library) KitPinOf

func (l *Library) KitPinOf(project string) (KitPin, bool)

KitPinOf is the project's kit, read from meta/project.json; cached by the file's time and size.

func (*Library) KitReadOnly

func (l *Library) KitReadOnly(kit string) bool

KitReadOnly is whether the kit is for viewing only.

func (*Library) KitSettingsFor

func (l *Library) KitSettingsFor(kit, person string) KitSettingsState

KitSettingsFor are the kit's settings for a person.

func (*Library) KitState

func (l *Library) KitState(kit string, changes bool) (KitState, error)

KitState is the kit's versions, draft and projects; with changes, the draft's changed files are compared.

func (*Library) KitUses

func (l *Library) KitUses(kit, person string) []KitLink

KitUses are the projects (that person may see) built on a kit, with the boards that use its nodes.

func (*Library) KitVisible

func (l *Library) KitVisible(kit, version string) (string, bool)

KitVisible says which version of a kit the person may read: a version installed (and listed by the kit store, so a version that is not whole is not shown), or the draft when its project is open to the person. It is the one place the tools ask; everything they read goes through a version it returned.

func (*Library) KitsDir

func (l *Library) KitsDir() string

KitsDir is the folder the kits are installed in: RUNTIME_DESIGN_KITS_DIR, else design-kits in the data folder.

func (*Library) LayoutFor

func (l *Library) LayoutFor(person string) (Layout, error)

LayoutFor is the person's layout with the design systems of the projects they can see.

func (*Library) LeaseViews added in v0.16.15

func (l *Library) LeaseViews(project string) ([]LeaseView, error)

LeaseViews are the live leases of a project ("" for all), for the web UI.

func (*Library) LibraryProjectIDs

func (l *Library) LibraryProjectIDs() []string

LibraryProjectIDs are the projects of the library: folders with a project folder or a model.

func (*Library) ListArtifacts

func (l *Library) ListArtifacts() []*Artifact

ListArtifacts are the library's projects, newest first.

func (*Library) ListPages

func (l *Library) ListPages(id string) (PageListing, error)

func (*Library) ListingGen

func (l *Library) ListingGen(ref string) (gen uint64, ok bool)

ListingGen is a number that moves whenever the watcher sees anything change under a project's folder (or cannot tell where): what was read from the folder at one number is still so at the same number. ok is false while the folder is not watched, and then nothing read from it may be kept. Ask for it before reading, so a change during the read is not lost.

func (*Library) LiveClaims

func (l *Library) LiveClaims(project string, now int64) []Claim

LiveClaims are the live claims of a project ("" for all); the stale ones seen are removed.

func (*Library) LiveLog

func (l *Library) LiveLog(artifact string) []LiveLogEntry

func (*Library) Locate

func (l *Library) Locate(pagePath, txt string) []Match

Locate is the board file of an element picked on a library page and its line, then the library's rules.

func (*Library) MetaDir

func (l *Library) MetaDir(id string) string

func (*Library) Migrate

func (l *Library) Migrate(dryRun bool) []ProjectMigration

Migrate migrates every project of the library, in the order of their folder names.

func (*Library) MigrateProject

func (l *Library) MigrateProject(ref string, dryRun bool) ProjectMigration

MigrateProject migrates one project (see the top of the file); dryRun writes nothing.

func (*Library) MigrateToBoard

func (l *Library) MigrateToBoard(project string, opt TSXMigrateOptions) (*TSXMigration, error)

MigrateToBoard rolls a migration back: each migrated board as it was, byte for byte, its page files removed.

func (*Library) MigrateToTSX

func (l *Library) MigrateToTSX(project string, opt TSXMigrateOptions) (*TSXMigration, error)

MigrateToTSX turns the project's boards into page modules (see the top of the file).

func (*Library) MigrationModel

func (l *Library) MigrationModel(ref string) *ProjectModel

MigrationModel is the model a project without meta/ would get.

func (*Library) MockupNote

func (l *Library) MockupNote(a *Artifact, board string) string

MockupNote is what the agent of the chat reads under the person's words when the design comes with the board a mockup of the chat became (the field's chip of the press): the mockup is that board now, and the next changes go to it, not to a new ```html answer. A board that is not a page of the project says nothing.

func (*Library) MomentAt added in v0.16.5

func (l *Library) MomentAt(artifact string, at, window int64) Moment

MomentAt gathers the window [at-window, at+window] of a design.

func (*Library) MoveProjects

func (l *Library) MoveProjects(person string, ids []string, folder string) error

MoveProjects lays projects in a folder ("" is the top). Only projects the person can see are laid.

func (*Library) NewProjectPrompt

func (l *Library) NewProjectPrompt(title, brief string) string

NewProjectPrompt is the first message of the chat a new project opens.

func (*Library) NewProjectsRelease

func (l *Library) NewProjectsRelease() string

NewProjectsRelease is the release a new project starts on: the library's choice while it is stable, else the newest stable release; "" when releases are not used.

func (*Library) NoAccessFor added in v0.16.154

func (l *Library) NoAccessFor(id, person string) NoAccess

NoAccessFor is NoAccessOf as the person by address sees it ("" is the runtime's own).

func (*Library) NoAccessOf added in v0.15.40

func (l *Library) NoAccessOf(id string) NoAccess

NoAccessOf: who to ask. The snapshot has the owner of the projects the person holds or held a grant in; for others the owner file's name is all there is.

func (*Library) NoAccessText added in v0.15.40

func (l *Library) NoAccessText(id string, role Role) string

NoAccessText is the words for a person or an agent that may not do something in a project. A person who sees the project but lacks the level hears its title and whom to ask; a person with no role gets the plain words, which name neither the title nor the owner (that would tell the project is there).

func (*Library) NoPhoneError

func (l *Library) NoPhoneError() string

NoPhoneError is what the person reads when there is no phone to send to.

func (*Library) OnControl

func (l *Library) OnControl(ref string, fn func(Control)) func()

OnControl hears the commands for a design's pages until the returned func is called.

func (*Library) PackExport

func (l *Library) PackExport(ctx context.Context, opt PackExportOptions, w io.Writer) (*PackManifest, error)

PackExport writes a pack of the projects and the kits they need, and returns its manifest.

func (*Library) PackImport

func (l *Library) PackImport(src io.Reader, opt PackImportOptions) (PackImportResult, error)

PackImport reads a pack, checks it, and installs its kits and projects. It plans first and writes only when the whole pack is acceptable: a kit version installed with other content refuses the import and nothing is written.

func (*Library) PageBuildsDone

func (l *Library) PageBuildsDone() int

PageBuildsDone is how many builds ran (not served from the cache) since the library started: a test's counter.

func (*Library) PageSourceProblems

func (l *Library) PageSourceProblems(project string) []PageSourceProblem

PageSourceProblems are what the check says about the project's page modules: a source whose board is missing or not the one the source builds today, or does not build at all. Nothing is written.

func (*Library) PageSources

func (l *Library) PageSources(project string) []string

PageSources are the names of the project's pages that have a module source, sorted.

func (*Library) PagesHint

func (l *Library) PagesHint(id string) string

PagesHint tells the agent of a new project how its pages are made: the project keeps them in meta/.

func (*Library) PinRevision added in v0.16.5

func (l *Library) PinRevision() (string, error)

PinRevision saves what the owner has now as a snapshot (the history waits for the files to be quiet for a while, a link must not) and returns the revision to pin a link to.

func (*Library) PinnedRelease

func (l *Library) PinnedRelease(id string) string

PinnedRelease is the release a project with meta/ is on (legacy when its project.json names none); "" for a project without meta/, which is served its own engine.

func (*Library) PlaceDemo

func (l *Library) PlaceDemo(person string, ids []string) error

PlaceDemo lays the demo projects that came back (the person asked for them) in the demo folder: the one they have (found by id, so a rename does not lose it) or a new one when they deleted it. A project they already placed stays where it is.

func (*Library) PrepareDialog added in v0.15.40

func (l *Library) PrepareDialog(id string) (art *Artifact, file, text string, err error)

PrepareDialog readies a conversation about a project of the library started by the caller: the library's guide, and the project's instructions as a file under the data dir (the one place the launcher takes system-prompt files from). It gives the project, the instructions' file and their text. ErrGone: the project is not in the library.

func (*Library) ProjectDir

func (l *Library) ProjectDir(id string) string

func (*Library) ProjectDirOf

func (l *Library) ProjectDirOf(ref string) string

ProjectDirOf is the folder an artifact's pages are served from; "" when the ref is not one.

func (*Library) ProjectHistory

func (l *Library) ProjectHistory(project string, limit float64) (ProjectVersions, error)

ProjectHistory is the project's points (the newest first, at most limit) and its named versions.

func (*Library) ProjectKit

func (l *Library) ProjectKit(project string) ProjectKitState

ProjectKit is the project's kit, its newer version and its draft.

func (*Library) ProjectReleaseOf

func (l *Library) ProjectReleaseOf(id string, list []Release) *ProjectRelease

ProjectReleaseOf is the project's release as the panel shows it; nil when releases are not used.

func (*Library) ProjectsOnKit

func (l *Library) ProjectsOnKit(kit string) map[string]KitPin

ProjectsOnKit are the library's projects pinned to the kit, with their pins.

func (*Library) PublishKitDraft

func (l *Library) PublishKitDraft(kit, part, notes string) (designkit.Published, error)

PublishKitDraft makes the draft the kit's next version: part is patch, minor (the default) or major of the newest version; notes say what changed. The projects that were on the draft go onto the new version, and the draft goes on from it.

func (*Library) PublishSnapshot added in v0.16.15

func (l *Library) PublishSnapshot(project string, pages []string) (title string, files []sitesclient.DeployFile, err error)

PublishSnapshot reads the files of the project a site is made of. pages are the board paths chosen (nil is all of them); the result carries an index.html that opens the page, or lists the pages, when the project has none of its own.

func (*Library) PurgeProject

func (l *Library) PurgeProject(id, person string) error

PurgeProject erases the project's trashed folders for good.

func (*Library) QueueControl

func (l *Library) QueueControl(ref string, c Control)

QueueControl keeps a command for the next page of the design that opens (the pane asked to show it a moment ago).

func (*Library) ReadArtifact

func (l *Library) ReadArtifact(ref string) *Artifact

ReadArtifact is one artifact by its ref; nil when there is none. The answer is a copy the caller may change.

func (*Library) ReadCheckReport

func (l *Library) ReadCheckReport(ref string) (any, *CheckReport)

ReadCheckReport is the running check of a design, else its last saved report: the value to answer with (the saved document as it is on disk), and its shape (nil when there is none).

func (*Library) ReadDeckComments added in v0.16.5

func (l *Library) ReadDeckComments(id string) ([]DeckComment, []string)

ReadDeckComments are the team comments (oldest first) and the ids of the guest comments marked resolved.

func (*Library) ReadDeckSettings added in v0.16.5

func (l *Library) ReadDeckSettings(id string) (DeckSettings, error)

ReadDeckSettings is meta/deck.json; the defaults when there is none. A file that does not parse is an error: the settings are not guessed.

func (*Library) ReadModel

func (l *Library) ReadModel(id string) *ProjectModel

ReadModel is the project's meta/; nil when the project has none.

func (*Library) ReadOwner added in v0.15.40

func (l *Library) ReadOwner(id string) (Owner, bool)

ReadOwner is who made a project; false when the file is missing or says nothing usable.

func (*Library) ReadRecording added in v0.16.5

func (l *Library) ReadRecording(id, rec string) (DeckRecording, error)

ReadRecording is the recording as the page shows it. A finished recording whose transcript is not there yet (being built, or lost with a restart) has no segments; reading it starts the build when none is running.

func (*Library) ReadScene3DSettings

func (l *Library) ReadScene3DSettings(id string) (Scene3DSettings, error)

ReadScene3DSettings is meta/scene3d.json.

func (*Library) ReadSiteComments

func (l *Library) ReadSiteComments(id, board string, me DeckPerson) []SiteComment

ReadSiteComments are the site comments of a board ("" all boards), oldest first, as `me` sees them.

func (*Library) ReadSiteProps

func (l *Library) ReadSiteProps(id string) SiteProps

ReadSiteProps is the project's shared settings; empty when none were picked.

func (*Library) ReadSystem

func (l *Library) ReadSystem(id string) (System, bool)

ReadSystem is the design system a project was built on; false when it records none.

func (*Library) ReadVideoSceneMeta added in v0.16.42

func (l *Library) ReadVideoSceneMeta(id, page string) (VideoSceneMeta, error)

ReadVideoSceneMeta is meta/scenes/<page>.json; a scene with no file is automatic. A file that does not parse is an error: it is not guessed.

func (*Library) ReadVideoSettings added in v0.16.42

func (l *Library) ReadVideoSettings(id string) (VideoSettings, error)

ReadVideoSettings is meta/video.json. A project without the file is not a video (404); a file that does not parse is an error: the settings are not guessed.

func (*Library) ReannounceDeleted added in v0.16.15

func (l *Library) ReannounceDeleted()

ReannounceDeleted sends the delete notice again for a trashed project the gateway's snapshot still lists: the first notice can be lost (no agent, no link). The snapshot not naming the project any more is the gateway's confirmation.

func (*Library) ReannounceOwn added in v0.15.40

func (l *Library) ReannounceOwn()

ReannounceOwn tells the gateway again of the projects this runtime made (a v2 owner file that is mine) and that the snapshot has no row for: the first news can have been dropped (no agent, no link, a gateway that did not know the event yet), and without a row the person could never share the project. The gateway registers idempotently. A later snapshot still missing the row permits a bounded retry; a recorded row stops it.

func (*Library) RecordLiveLog

func (l *Library) RecordLiveLog(artifact string, kind, page, message *string) bool

RecordLiveLog keeps a page's report: the newest 200 of each design.

func (*Library) RecordState

func (l *Library) RecordState(ref string, raw *string) bool

RecordState keeps what a page says it shows (JSON of at most 4000 characters).

func (*Library) RecordTimeline added in v0.16.5

func (l *Library) RecordTimeline(artifact string, page, raw *string) int

RecordTimeline keeps the events a page sent and returns how many it took. page is the page's path, as in the log.

func (*Library) RefOf added in v0.15.40

func (l *Library) RefOf(text string) string

RefOf is the design a text names: its id, its folder or a file in it, or its title (letter case aside, when only one design has it); "" for none.

func (*Library) Refresh

func (l *Library) Refresh()

Refresh drops what the listing remembers of the folder: files were put in or taken out of it by someone other than the library (the hub bringing a project up to a new revision), and the watcher may not have said so yet.

func (*Library) ReleaseClaims

func (l *Library) ReleaseClaims(f ReleaseFilter, now int64) []Claim

ReleaseClaims frees the claims that match and returns them.

func (*Library) ReleaseForChat

func (l *Library) ReleaseForChat(session string, project, board any) ([]Claim, error)

ReleaseForChat lets go of the chat's claims: all, a project's, or one board's.

func (*Library) ReleaseOwnLease added in v0.16.15

func (l *Library) ReleaseOwnLease(project, board string) (*Claim, error)

ReleaseOwnLease lets go of the person's own lease; the chat that holds it must have no turn running (a running turn is taken off by ForceReleaseLease, which the person has to ask for).

func (*Library) Releases

func (l *Library) Releases() []Release

Releases are the usable releases, oldest first; nil when releases are not used or the list cannot be read. A release whose engine is missing, leaves the folder or does not match its checksum is left out.

func (*Library) ReleasesDir

func (l *Library) ReleasesDir() string

ReleasesDir is the mirror's folder, "" when releases are not used.

func (*Library) RemoveFolder

func (l *Library) RemoveFolder(person, id string) error

RemoveFolder takes the folder and its subfolders away; projects that lay in them go to the top. Nothing of a project is touched.

func (*Library) RemovePage

func (l *Library) RemovePage(id, ref string) (Page, error)

RemovePage moves the page's board file (unless another page shows it) and its page file to the library's .trash/.

func (*Library) RemoveVideoOverlay added in v0.16.86

func (l *Library) RemoveVideoOverlay(id, scene, oid string, actor VideoOverlayActor, force bool) (VideoScene, error)

RemoveVideoOverlay removes an overlay, by the same rule as SetVideoOverlay.

func (*Library) RemoveVideoZoom

func (l *Library) RemoveVideoZoom(id, scene, zid string, actor VideoOverlayActor, force bool) (VideoScene, error)

RemoveVideoZoom removes a zoom, by the same rule. The scene keeps its screen block (the camera stays the scene's).

func (*Library) RenamePage

func (l *Library) RenamePage(id, ref string, title, file *string) (Page, error)

RenamePage changes a page's title and, when file is given, its board file's name; the id stays, and with it the page's claims and comments.

func (*Library) RenameProjectVersion

func (l *Library) RenameProjectVersion(project, rev, name string) error

RenameProjectVersion renames a named version; an empty name takes the name away (the point stays in the history).

func (*Library) RenderDoctor added in v0.16.154

func (l *Library) RenderDoctor(ctx context.Context) DoctorReport

RenderDoctor draws a real picture and a two-second video with this machine's browser and ffmpeg and reads them back. It writes only into a temporary folder, and does not need a running library server.

func (*Library) RenderHealth added in v0.16.154

func (l *Library) RenderHealth() RenderHealth

RenderHealth is the doctor's result for the API: the cached one while it is fresh, else a new check runs behind the caller (never on the request) and the stale result, if any, is shown meanwhile.

func (*Library) ReplaceVideoZooms

func (l *Library) ReplaceVideoZooms(id, scene string, zooms []VideoZoom, actor VideoOverlayActor, force bool) (VideoScene, error)

ReplaceVideoZooms sets the whole track at once (a person taking the board's automatic zooms as a start). An agent may not drop a zoom a person edited unless force is set. Each new zoom is the actor's.

func (*Library) RequestLeaseRelease added in v0.16.15

func (l *Library) RequestLeaseRelease(project, board string) error

RequestLeaseRelease asks the person who holds the board to let go of it. Only the center can carry the ask to another machine.

func (*Library) ResetVideoScreen

func (l *Library) ResetVideoScreen(id, scene string, actor VideoOverlayActor, force bool) (VideoScene, error)

ResetVideoScreen drops the screen block: the camera is the board's own again. An agent may not drop zooms a person edited unless force is set.

func (*Library) ResolveDeckComment added in v0.16.5

func (l *Library) ResolveDeckComment(id, commentID string, resolved bool) (any, error)

ResolveDeckComment marks a comment resolved or open. A team comment answers whole; a guest comment (g-<id>, kept by the gateway) keeps only its flag here.

func (*Library) ResolveProjectFile

func (l *Library) ResolveProjectFile(ref string, segments []string) string

ResolveProjectFile is a requested file as a real path confined to the artifact's project folder, or "" when the ref is not one, the path escapes (.., a link) or the extension is not something a design needs.

func (*Library) RestoreForCLI

func (l *Library) RestoreForCLI(session string, project, board, at any) (CLIRestored, error)

RestoreForCLI is the agent's restore: the chat it speaks from (session, when given) is the actor, so a board held by that same chat can be restored by it.

func (*Library) RestoreForPanel

func (l *Library) RestoreForPanel(artifact, board, revision any) error

RestoreForPanel is the person's restore: no chat speaks for them, so a board some chat holds is left alone.

func (*Library) RestoreProject

func (l *Library) RestoreProject(id, person string) error

RestoreProject puts the project's latest trashed folder back. The gateway hears of it as of a new project of the person.

func (*Library) RestoreProjectVersion

func (l *Library) RestoreProjectVersion(project, rev, who string) (string, error)

RestoreProjectVersion puts the whole project back as it was at a version: what is there now is saved first, the version's files are checked out over the folder, files the version did not have are taken away, and the result is a snapshot of its own. A project some other live chat holds a board of is not touched.

func (*Library) RoleFor added in v0.16.154

func (l *Library) RoleFor(id, person string) Role

RoleFor is RoleOf for a person by address (a page session's): on a shared machine every person has their own part of the snapshot; "" is the runtime's own person.

func (*Library) RoleNow added in v0.15.40

func (l *Library) RoleNow(id string) Role

RoleNow is RoleOf for the runtime's own person at the runtime's clock. An identity that cannot be told matches no owner file, so the project falls to the grant and team rules.

func (*Library) RoleOf added in v0.15.40

func (l *Library) RoleOf(id string, who Identity, now time.Time) Role

RoleOf is who's role in a project at now:

  1. no snapshot, or one that does not enforce: edit (as before this existed; an old gateway never sends one);
  2. the person's own grant in the snapshot while its until is ahead of now, the stronger of it and the team level (a grant that ran out is not looked at, the next snapshot is not waited for);
  3. the project has no row in the team table and its .owner.json names this runtime: owner (so a project just made, which the gateway has not registered yet, never hides from its maker);
  4. the team level of the snapshot;
  5. a project the snapshot has no row for and whose owner file is not v2 "private": edit (what existed before) — when the snapshot keeps such projects closed, only for the machine's own person and only without an owner file naming someone else;
  6. nothing.

func (*Library) Root

func (l *Library) Root() string

Root is the one folder of all design projects.

func (*Library) SaveFolder

func (l *Library) SaveFolder(person, id, name, parent string, hasParent bool) (Folder, error)

SaveFolder makes a folder (id "") or renames one (and moves it under another top folder when parent is given).

func (*Library) SaveProjectVersion

func (l *Library) SaveProjectVersion(project, name, who string) (NamedVersion, error)

SaveProjectVersion is "Сохранить версию": the project as it is now, under a name.

func (*Library) Scene3DClipDir

func (l *Library) Scene3DClipDir(id, key string) (string, Scene3DClip, error)

Scene3DClipFile is a ready clip's folder (with clip.mp4 and the frames) for a key, in the current model's cache or any older.

func (*Library) Scene3DClipToVideo

func (l *Library) Scene3DClipToVideo(id, key, videoID string, canEdit func(video string) bool) (Scene3DVideoResult, error)

Scene3DClipToVideo puts a clip into a video document as a new scene, with its origin kept beside the frames. videoID empty: a new video document of the scene's name is made.

func (*Library) Scene3DDiscover

func (l *Library) Scene3DDiscover(root string) ([]Scene3DProject, error)

Scene3DDiscover answers the projects to choose from: the one at root when a folder is given (an absolute path), else those found around the library. A folder that holds nothing of the kind is an error in words, not an empty list.

func (*Library) Scene3DFixFile

func (l *Library) Scene3DFixFile(id, comment, which string) (string, error)

Scene3DFixFile is the picture of how a pin was fixed: which is "before" or "after".

func (*Library) Scene3DFrameFile

func (l *Library) Scene3DFrameFile(id, key string) (string, error)

Scene3DFrameFile is a cached frame's JPEG.

func (*Library) Scene3DFrameStart

func (l *Library) Scene3DFrameStart(id string, cam Scene3DCam, frame int, retry bool, builder string) (Scene3DFrame, error)

Scene3DFrameStart asks for the draft frame of a view: answered from the cache at once, else queued (one at a time, under a slot of the machine, nice, with a time limit). The same view asked again is the same key.

func (*Library) Scene3DGenEstimate

func (l *Library) Scene3DGenEstimate(ctx context.Context, id string, p Scene3DGenParams) (float64, string, error)

Scene3DGenEstimate is the generator's price of a generation. Nothing is started.

func (*Library) Scene3DModelFile

func (l *Library) Scene3DModelFile(id, h string) (string, string, error)

Scene3DModelFile is the model's .glb for the hash h ("" the current one) and its hash.

func (*Library) Scene3DModelOf

func (l *Library) Scene3DModelOf(id string) (Scene3DModel, error)

Scene3DModelOf is the model for the scene's current .blend; a missing one starts being built.

func (*Library) Scene3DOutputFile

func (l *Library) Scene3DOutputFile(id, key, name string) (string, error)

Scene3DOutputFile is a file of a set (a picture, the manifest, the camera path) by its name.

func (*Library) Scene3DOutputsFolder

func (l *Library) Scene3DOutputsFolder(id, key string) (string, Scene3DManifest, error)

Scene3DOutputsFolder is a ready set's folder, in the current model's cache or any older one.

func (*Library) Scene3DPlanFinal

func (l *Library) Scene3DPlanFinal(ctx context.Context, id string, sp Scene3DClipSpec) (Scene3DFinalPlan, error)

Scene3DPlanFinal makes the plan of a final render: the frames of a camera, one by one. Nothing is rented.

func (*Library) Scene3DRebuild

func (l *Library) Scene3DRebuild(id, builder string) (Scene3DModel, error)

Scene3DRebuild forgets a failed build and starts it again.

func (*Library) Scene3DResolve

func (l *Library) Scene3DResolve(id, commentID string, fix Scene3DFix) (DeckComment, error)

Scene3DResolve closes a pin with how it was fixed: the frames before and after and a word of the change.

func (*Library) Scene3DShotFile

func (l *Library) Scene3DShotFile(id, comment string) (string, error)

Scene3DShotFile is the viewport picture of a pin.

func (*Library) Scene3DStateOf

func (l *Library) Scene3DStateOf(id string) (Scene3DState, error)

Scene3DStateOf is everything the 3D page reads in one go.

func (*Library) SceneProjectOf

func (l *Library) SceneProjectOf(cwd string) string

SceneProjectOf is the 3D scene project a chat's folder belongs to, or "".

func (*Library) SeedDemo

func (l *Library) SeedDemo(fsys fs.FS, force bool) ([]string, error)

SeedDemo copies the demo projects of fsys (one folder per project, named by its library id) into the library and gives each the engine new projects get. A project already in the library is left as it is. Without force it runs once per library. It returns the ids it copied.

func (*Library) SendControl

func (l *Library) SendControl(ref string, c Control) int

SendControl sends a command to every open page of the design; the number of pages it reached.

func (*Library) ServerPort

func (l *Library) ServerPort() int

ServerPort is the port once the server is up, 0 before; the preview's component lookup leaves this port alone.

func (*Library) SetAccess added in v0.15.40

func (l *Library) SetAccess(s AccessSnapshot) error

SetAccess takes a snapshot as the current one and keeps it on disk (a temp file, synced, renamed over the old one). The snapshot is in force in memory even when the disk refuses; the error says the restart would lose it.

func (*Library) SetAccessOrdered added in v0.15.40

func (l *Library) SetAccessOrdered(s AccessSnapshot) error

SetAccessOrdered is SetAccess that refuses (ErrStaleAccess) a snapshot made before the one held.

func (*Library) SetDeckNotes added in v0.16.5

func (l *Library) SetDeckNotes(id, ref, text string) (DeckSlide, error)

SetDeckNotes writes a slide's notes by hand (or by the agent's command): the dictation they may have come from is dropped, the notes are no longer "из диктовки".

func (*Library) SetDeckNotesFromDictation added in v0.16.5

func (l *Library) SetDeckNotesFromDictation(id, pageID, notes, raw string) (DeckSlide, error)

SetDeckNotesFromDictation writes the notes the model made and the dictation they came from.

func (*Library) SetDeckPdfAuto added in v0.16.5

func (l *Library) SetDeckPdfAuto(id string, on bool) (DeckPublished, error)

SetDeckPdfAuto starts or stops keeping the deck's PDF for guests. Starting answers at once: the first build runs in the background. Stopping leaves the published file where it is (a link that still offers it keeps working).

func (*Library) SetDeckSettings added in v0.16.5

func (l *Library) SetDeckSettings(id string, patch map[string]json.RawMessage) (DeckSettings, error)

SetDeckSettings applies a partial settings value (the PUT) and returns what was written.

func (*Library) SetKeeper

func (l *Library) SetKeeper(tabs func() ([]Chat, bool))

SetKeeper names where the tabs come from; tabs answers ok false while the keeper does not run.

func (*Library) SetKitPin

func (l *Library) SetKitPin(project string, pin *KitPin) error

SetKitPin writes the project's kit into meta/project.json; nil takes it away. Other keys of the file stay.

func (*Library) SetKitReadOnly

func (l *Library) SetKitReadOnly(kit, person string, on bool) error

SetKitReadOnly turns the kit's viewing only on or off; only its maker may.

func (*Library) SetNewProjectsRelease

func (l *Library) SetNewProjectsRelease(release string) error

SetNewProjectsRelease pins new projects to a stable release; "" lets them follow the newest stable one.

func (*Library) SetOwner added in v0.15.40

func (l *Library) SetOwner(id string) error

SetOwner records the runtime's person as the owner of a project that has none yet; an existing record stays. A new project is personal: the file says so (v 2, "private").

func (*Library) SetOwnerAs added in v0.16.123

func (l *Library) SetOwnerAs(id, person string) error

SetOwnerAs is SetOwner for the person who made the project: the address of the page session or the chat that asked (the owner is the person who worked, not the one the machine belongs to). An empty person is the runtime's.

func (*Library) SetPageDevice

func (l *Library) SetPageDevice(id, ref, device string) (Page, error)

SetPageDevice sets the initial viewport shared by everyone opening the page.

func (*Library) SetProjectDevice

func (l *Library) SetProjectDevice(id, device string) (ProjectMeta, error)

SetProjectDevice sets the device every page of the design opens in unless the page names its own ("" clears it).

func (*Library) SetProjectRelease

func (l *Library) SetProjectRelease(id, release string) (*ProjectRelease, error)

SetProjectRelease moves a project to a stable release: the release of its meta/project.json, through the page model (which rebuilds the files made from meta/). The boards are not touched; the next load of a board gets the release's engine. A project without meta/ is refused until the library is migrated.

func (*Library) SetRelease

func (l *Library) SetRelease(id, release string) error

SetRelease sets the engine release a project with meta/ is built on, and rebuilds the files built from meta/.

func (*Library) SetSiteProps

func (l *Library) SetSiteProps(id, board string, values map[string]SitePropValue, merge bool, by string) (SiteProps, error)

SetSiteProps puts a board's values (all of them: a name left out goes back to the board's own); merge keeps the names not given. Empty values clear the board.

func (*Library) SetSystem

func (l *Library) SetSystem(id string, s System) error

SetSystem records the design system a new project is built on, once.

func (*Library) SetVideoOverlay added in v0.16.86

func (l *Library) SetVideoOverlay(id, scene, oid string, patch map[string]json.RawMessage, actor VideoOverlayActor, force bool) (VideoScene, error)

SetVideoOverlay changes an overlay. An agent may not change what a person wrote last unless force is set; whoever changes it is its author after. The answer is the scene.

func (*Library) SetVideoScene added in v0.16.42

func (l *Library) SetVideoScene(id, ref string, patch map[string]json.RawMessage) (VideoScene, error)

SetVideoScene changes a scene's duration and transition. A key of patch that is absent stays; dur null is automatic, transition null is the board's own. ref is a page's id, file or title. Answers the scene as the video now has it.

func (*Library) SetVideoSettings added in v0.16.42

func (l *Library) SetVideoSettings(id string, patch map[string]json.RawMessage) (VideoSettings, error)

SetVideoSettings applies a partial settings value (the PUT) and returns what was written.

func (*Library) SetVideoZoom

func (l *Library) SetVideoZoom(id, scene, zid string, patch map[string]json.RawMessage, actor VideoOverlayActor, force bool) (VideoScene, error)

SetVideoZoom changes a zoom; an agent may not change what a person changed last unless force is set.

func (*Library) ShareFS

func (l *Library) ShareFS() ShareFSReport

ShareFS is the probe's result for the library, run on the caller when the cached one is stale (it takes a few milliseconds and touches only its own folder).

func (*Library) SiteShot

func (l *Library) SiteShot(artifact, board string, w, h, y int, scale float64) ([]byte, error)

SiteShot is a PNG of a board opened at w×h CSS px, scrolled to y, at scale (1 or 2).

func (*Library) StartBackground

func (l *Library) StartBackground()

StartBackground starts the claim keeper and the history; again while running it only retries the history (the library folder may have appeared since).

func (*Library) StartBoardExport added in v0.16.123

func (l *Library) StartBoardExport(artifact string, format DeckExportFormat, rec, board string, publish bool) (DeckExportJob, error)

StartBoardExport is StartDeckExport of one board ("" for every board).

func (*Library) StartCheck

func (l *Library) StartCheck(ref string, only []string) *CheckReport

StartCheck starts a check of every board, or of those named (by path or title), and returns at once with the report as it fills; a check already running for the design is returned instead. Nil: no such design or board.

func (*Library) StartDeckExport added in v0.16.5

func (l *Library) StartDeckExport(artifact string, format DeckExportFormat, rec string, publish bool) (DeckExportJob, error)

StartDeckExport makes the job of a format and starts it (or joins the one already queued or running for the same project, format and recording). publish also keeps a finished PDF as the file guests may read.

func (*Library) StartKitDraft

func (l *Library) StartKitDraft(kit string) (designkit.Draft, error)

StartKitDraft is the kit's draft, made from its newest version when it has none: a library project whose folder is a copy of the version.

func (*Library) StartScene3DApply

func (l *Library) StartScene3DApply(id string, pinIDs []string) (Scene3DApplyJob, error)

StartScene3DApply starts the apply as a job and answers it at once; read it again with Scene3DApplyOf. pinIDs empty: the open pins (at most a few).

func (*Library) StartScene3DClip

func (l *Library) StartScene3DClip(id string, sp Scene3DClipSpec, retry bool) (Scene3DClip, error)

StartScene3DClip draws a draft animation: every Step-th frame of the camera, one after another through the draft queue, then assembled. Answers at once: ready from the cache, or the running clip.

func (*Library) StartScene3DFinal

func (l *Library) StartScene3DFinal(id, planID string, confirm bool) (Scene3DFinalJob, error)

StartScene3DFinal starts a render from a plan the person confirmed. confirm must be true, the plan this scene's own, not expired, and the scene unchanged since it was made.

func (*Library) StartScene3DGen

func (l *Library) StartScene3DGen(id string, p Scene3DGenParams, confirm bool) (Scene3DGeneration, error)

StartScene3DGen starts a generation. confirm must be true: it spends money.

func (*Library) StartScene3DOutputs

func (l *Library) StartScene3DOutputs(id string, sp Scene3DOutputsSpec, retry bool) (Scene3DOutputs, error)

StartScene3DOutputs makes the outputs of a camera at some frames, one job at a time through the draft queue; answers at once, ready from the cache or going.

func (*Library) StartVideoRender added in v0.16.42

func (l *Library) StartVideoRender(id string, req VideoRenderRequest) (VideoRenderJob, error)

StartVideoRender starts a render, or joins the running one asked the same (format, page, draft). A machine that lacks Chrome or ffmpeg gets a job that has failed at once, with the reason in words.

func (*Library) State

func (l *Library) State(ref string) *DesignState

State is nil before any page of the design reported.

func (*Library) StopBackground

func (l *Library) StopBackground()

func (*Library) StopModes

func (l *Library) StopModes()

func (*Library) StopPages

func (l *Library) StopPages()

StopPages ends the watch (a test's cleanup).

func (*Library) StopServer

func (l *Library) StopServer()

StopServer closes the server and stops the background work it started, waiting out a history snapshot under way (a test's cleanup: nothing may write into the folders a test is about to remove).

func (*Library) StopWatching

func (l *Library) StopWatching()

StopWatching closes the watcher (a test's cleanup).

func (*Library) StrictOn

func (l *Library) StrictOn(project string) string

StrictOn says whether the project is checked in strict mode by its own setting ("project") or its kit's ("kit").

func (*Library) Subscribe

func (l *Library) Subscribe(fn func(rel string)) (stop func(), ok bool)

Subscribe calls fn with the path (relative to the root) of every change while the watcher runs; the returned func ends it. ok is false when the root cannot be watched now (it is not there yet).

func (*Library) SweepClaims

func (l *Library) SweepClaims(now int64, runtime string, chat func(tabID string) (ChatView, bool), missing map[string]int64) SweepResult

SweepClaims is the owning runtime's pass over the claims: let go of those whose chat ended its turn or was closed, keep the others fresh, clear anyone's claim nobody refreshes any more. missing remembers, between passes, since when a claim's chat has been missing.

func (*Library) SweepDeckExports added in v0.16.5

func (l *Library) SweepDeckExports(artifact string)

SweepDeckExports deletes the files of a project's exports a day old: what a restart left behind.

func (*Library) SweepOwnClaims

func (l *Library) SweepOwnClaims(missing map[string]int64) (SweepResult, error)

SweepOwnClaims is one pass over the claims for this runtime's chats.

func (*Library) Tabs

func (l *Library) Tabs() ([]Chat, bool)

Tabs are all tabs of the keeper; ok false when it does not run.

func (*Library) TakeForPerson added in v0.16.15

func (l *Library) TakeForPerson(project, board, client string) (ClaimOutcome, error)

TakeForPerson takes (or renews) the lease on a board for the person editing it in the page, not through a chat. The page repeats the call on every edit; it is released with ReleaseOwnLease, or runs out two minutes after the last call.

func (*Library) TakeSyncNotice added in v0.16.15

func (l *Library) TakeSyncNotice(project, boardFile string) *SyncNotice

TakeSyncNotice is the oldest notice about a lost write on a board of the project, taken: it is renamed to "….json.seen", so it is told once. nil when there is none.

func (*Library) TakenArtifactIDs

func (l *Library) TakenArtifactIDs() map[string]bool

TakenArtifactIDs are the ids already in the library.

func (*Library) TemplateDir

func (l *Library) TemplateDir() string

func (*Library) TidyDeck added in v0.16.5

func (l *Library) TidyDeck(ctx context.Context, oneShot func(context.Context, string) (string, error), id, page, raw, lang string) ([]DeckTidied, error)

TidyDeck makes the notes of one slide (page = its ref) or of the whole deck (page "") from a dictation and writes them with the dictation beside them.

func (*Library) Timeline added in v0.16.5

func (l *Library) Timeline(artifact string, from, to int64) []TimelineEvent

Timeline is the events of a design between two times (ms, both ends included; to 0 means no end), oldest first and no older than the age limit.

func (*Library) TrashFor

func (l *Library) TrashFor(person string) []TrashItem

TrashFor are the person's trashed projects, the latest deleted first; one per id.

func (*Library) UnbindTemplate added in v0.16.154

func (l *Library) UnbindTemplate(project, pageRef string) error

UnbindTemplate drops the record of a board: it becomes an ordinary one. Who may do it (the app's owner) is the caller's to decide.

func (*Library) UseKitVersion

func (l *Library) UseKitVersion(project, version string, stay bool) (KitPin, error)

UseKitVersion puts the project on an installed version of its kit (off the draft); stay instead records that the person keeps the current one and the newer version is not offered again.

func (*Library) UseProjectKit

func (l *Library) UseProjectKit(project, ref string) (*KitPin, error)

UseProjectKit pins the project to the installed kit named ref (id[@version][/theme]) or records «no kit» for ref "none". It returns the pin (nil for «no kit») or the words for the person.

func (*Library) UseRevisions

func (l *Library) UseRevisions(r Revisions)

UseRevisions makes the store's revisions the library's history; nil goes back to the git history.

func (*Library) UseStorePusher

func (l *Library) UseStorePusher(p StorePusher)

UseStorePusher gives the library the way into the store; nil takes it away.

func (l *Library) VersionLink(project, rev string) string

VersionLink is the address (from the runtime's root) of a project's point of history opened read only, on its first page, as the "Версии" panel opens it; "" for a project with no page.

func (*Library) VideoCheck added in v0.16.42

func (l *Library) VideoCheck(ctx context.Context, id string, page *string, f *VideoFormat) ([]VideoCheckIssue, error)

VideoCheck checks the scene page (nil: every scene) in format f (nil: every enabled format).

func (*Library) VideoFrameFile added in v0.16.42

func (l *Library) VideoFrameFile(ctx context.Context, id, page string, f VideoFormat, draft bool, t int64) (string, error)

VideoFrameFile is the scene page's frame at t ms in f as a cached JPEG: its absolute path.

func (*Library) VideoFrameFiles added in v0.16.42

func (l *Library) VideoFrameFiles(ctx context.Context, id, page string, f VideoFormat, draft bool, times []int64) ([]string, error)

VideoFrameFiles is VideoFrameFile for several times of one scene, drawn in one visit of the board.

func (*Library) VideoOverlaysOf added in v0.16.86

func (l *Library) VideoOverlaysOf(id, scene string) ([]VideoOverlay, error)

VideoOverlaysOf is a scene's overlays, in time order.

func (*Library) VideoProjectOf added in v0.16.86

func (l *Library) VideoProjectOf(cwd string) string

VideoProjectOf is the video project a chat's folder belongs to, or "".

func (*Library) VideoRenderJobOf added in v0.16.42

func (l *Library) VideoRenderJobOf(id, job string) (VideoRenderJob, bool)

VideoRenderJobOf is the job id of the project; false when there is none.

func (*Library) VideoRenders added in v0.16.42

func (l *Library) VideoRenders(id string, s VideoSettings, scenes []VideoScene) []VideoRenderInfo

VideoRenders is the published state of each enabled format against the scenes' current keys. A key that cannot be made (a board is gone) leaves CurrentKey empty and the format stale.

func (*Library) VideoRunningJob added in v0.16.42

func (l *Library) VideoRunningJob(id string) *VideoRenderJob

VideoRunningJob is the project's queued or running render, nil when none.

func (*Library) VideoSceneKey added in v0.16.42

func (l *Library) VideoSceneKey(id string, sc VideoScene, f VideoFormat, draft bool) (string, error)

VideoSceneKey is the cache key of a scene's clip in f (sha256 of the board, deck-theme.css, the newest mtime of the project's other files, meta/scenes/<id>.json, the format, fps, draft, the engine's release and VideoRuntimeVersion).

func (*Library) VideoScenes added in v0.16.42

func (l *Library) VideoScenes(id string, s VideoSettings) ([]VideoScene, error)

VideoScenes are the pages of the video whose board file is there, in order, on the time line: each starts where the one before ends. Keys has the clip key per enabled format; a key the render could not make is left out.

func (*Library) VideoScreenOf

func (l *Library) VideoScreenOf(id, scene string) (*VideoScreen, error)

VideoScreenOf is a scene's screen block; nil: the board's own camera.

func (*Library) VideoSheetFile added in v0.16.86

func (l *Library) VideoSheetFile(ctx context.Context, id, page string, f VideoFormat) (string, error)

VideoSheetFile draws the scene page's contact sheet in f and answers its file.

func (*Library) VideoStateOf added in v0.16.42

func (l *Library) VideoStateOf(id string) (VideoState, error)

VideoStateOf is everything the video page reads in one go.

func (*Library) VisibleTo added in v0.15.40

func (l *Library) VisibleTo(arts []*Artifact) []*Artifact

VisibleTo keeps the projects the runtime's person has a role in; the owner always sees what is theirs.

func (*Library) VisibleToFor added in v0.16.154

func (l *Library) VisibleToFor(arts []*Artifact, person string) []*Artifact

VisibleToFor is VisibleTo for a person by address ("" is the runtime's own).

func (*Library) WarmThumbs

func (l *Library) WarmThumbs(id string)

WarmThumbs draws ahead the pictures a project still lacks, behind the ones being looked at.

func (*Library) WatchModes

func (l *Library) WatchModes() []string

WatchModes normalises the library and keeps watching it: a folder that appears is looked at a moment after it settles. The watch starts once; the folders the first pass changed are returned.

func (*Library) WatchPages

func (l *Library) WatchPages()

WatchPages rebuilds a project's page boards when a file under its project/ folder changes. The builds are kept by the files' versions, so a change that touches no input costs a stat of each. It starts once.

func (*Library) WhoHolds

func (l *Library) WhoHolds(project any) ([]ClaimLine, error)

func (*Library) WriteDeckSettings added in v0.16.5

func (l *Library) WriteDeckSettings(id string, s DeckSettings) error

WriteDeckSettings validates and writes meta/deck.json and, beside the boards, deck-theme.css.

func (*Library) WriteDerived

func (l *Library) WriteDerived(id string) ([]string, error)

WriteDerived rebuilds canvas.json and artifact.json of a project with meta/ and returns the files it changed.

func (*Library) WriteRecEdit added in v0.16.5

func (l *Library) WriteRecEdit(id, rec string, e DeckEdit) (DeckRecording, bool, error)

WriteRecEdit keeps the montage; false when it is not one (a corner or a cursor mode that does not exist).

func (*Library) WriteRootHint added in v0.15.40

func (l *Library) WriteRootHint()

WriteRootHint keeps the library root where the hook finds it.

func (*Library) WriteVideoSettings added in v0.16.42

func (l *Library) WriteVideoSettings(id string, s VideoSettings) error

WriteVideoSettings validates and writes meta/video.json, the formats in their fixed order.

type LiveLogEntry

type LiveLogEntry struct {
	At      int64  `json:"at"`
	Kind    string `json:"kind"`
	Page    string `json:"page"`
	Message string `json:"message"`
}

LiveLogEntry is one report of a page.

type Match

type Match struct {
	Kind string `json:"kind"`
	File string `json:"file"`
	Line int    `json:"line"`
}

Match is a place on disk an annotation points the agent to.

type MigratedPage

type MigratedPage struct {
	ID    string `json:"id"`
	Title string `json:"title"`
	File  string `json:"file"`
}

MigratedPage is a page a migration makes.

type MockupBoard

type MockupBoard struct {
	Project      string `json:"project"`
	ProjectTitle string `json:"projectTitle"`
	Page         string `json:"page"`
	File         string `json:"file"`
	Title        string `json:"title"`
	// NewProject: the project was made for this mockup.
	NewProject bool `json:"newProject,omitempty"`
	// Existing: the mockup had been made a board before; nothing was made now.
	Existing bool `json:"existing,omitempty"`
}

MockupBoard is the board a mockup became.

type MockupSpec

type MockupSpec struct {
	Conv, HTML, Title string
	// Person is the address of the person whose page asked ("" the runtime's own): a project is used only when they may
	// edit it, and a new one is theirs.
	Person     string
	Candidates []string
	// Fits says a project can take a board (not a deck or a video); nil takes any.
	Fits func(project string) bool
}

MockupSpec is what the card sends: the chat, the mockup and its title, and the projects that are the chat's, first the one fittest (the one open beside the chat, the one the chat was started from, the one its last mockup went to).

type MockupStore

type MockupStore interface {
	Mockup(key string) (MockupBoard, bool)
	SetMockup(key string, b MockupBoard) error
}

MockupStore keeps which board each mockup became, by MockupKey; the runtime keeps it in its data dir.

type Moment added in v0.16.5

type Moment struct {
	At      int64           `json:"at"`
	Window  int64           `json:"window"`
	Events  []TimelineEvent `json:"events"`
	State   []TimelineEvent `json:"state"`
	Actions []TimelineEvent `json:"actions"`
}

Moment is what the timeline holds around one time: the events of the window, the last of each kind of state before it (the page, the viewport, every tweak, the vitals) and the last actions of the person.

type NamedVersion

type NamedVersion struct {
	ID   string  `json:"id"`
	Name string  `json:"name"`
	At   int64   `json:"at"`
	Who  string  `json:"who"`
	Kit  *KitPin `json:"kit"`
}

NamedVersion is a point of the project's history with a name.

type NewProject

type NewProject struct {
	OK      bool   `json:"ok"`
	Project string `json:"project"`
	Title   string `json:"title"`
	Dir     string `json:"dir"`
	Board   string `json:"board"`
	Rules   string `json:"rules"`
	Page    Page   `json:"page"`
	Opened  bool   `json:"opened"`
	// Kit is the installed UI kit the project is pinned to (id@version/theme), when one was asked for.
	Kit string `json:"kit,omitempty"`
	// Brief is what the agent is told about the project's kit (or the one question when it has none).
	Brief string `json:"brief,omitempty"`
}

NewProject is the answer of {action:'new'}: the project made, its folder, its first page and the rules a design dialog works by, so an agent of any chat can go on drawing on the board at once.

type NoAccess added in v0.15.40

type NoAccess struct {
	Owner     string
	OwnerName string
}

NoAccess is what a refusal says about the project's owner: only a name and, when the snapshot knows it, the address.

type NotTranslatable

type NotTranslatable struct{ Reason string }

NotTranslatable says why a board stays in the old format.

func (*NotTranslatable) Error

func (e *NotTranslatable) Error() string

type Owner added in v0.15.40

type Owner struct {
	User, Name, Person string
	V                  int
	Private, Claimed   bool
}

Owner is the runtime and the person that made a project. V is the version of the file (1 before projects were personal, 2 with "private"); Private: the project is personal until the gateway says otherwise.

Person is the stable key of the person (the owner's whole address, lower case) and beats User: one person has a runtime, so a different Unix user, on every machine, and several machines share one Unix user name (a self-hosted profile runs everything as "harnessly"). A file without Person (made before the owner file had a person, or by a runtime that does not know its person's address) is compared by the Unix user as it always was.

Claimed: the file was written by «take it» over a project nobody owned (not by making it), so the gateway is told design.claim (the team keeps editing), not design.created (personal).

func (Owner) Mine added in v0.15.40

func (o Owner) Mine(id Identity) bool

Mine: the project was made by the person asking; for a file that names no person, by the runtime asking.

In a library that is the store's (Identity.Shared) every machine's runtime may run as the same Unix user, so a file without a person makes no one its owner by the user: the hub's record of the project (by the person's address) decides.

type OwnerClaimError added in v0.15.40

type OwnerClaimError struct {
	Msg    string
	Status int
}

OwnerClaimError is a refusal to take ownership, with the status to answer.

func (*OwnerClaimError) Error added in v0.15.40

func (e *OwnerClaimError) Error() string

type PackError

type PackError struct {
	Msg      string
	Conflict []PackKitResult
}

PackError is a refusal worded for the person; Conflict lists kit versions that are installed with other content.

func (*PackError) Error

func (e *PackError) Error() string

type PackExportOptions

type PackExportOptions struct {
	// Projects are project ids; All takes every project of the library.
	Projects []string
	All      bool
	// Kits are kits to pack besides the ones the projects are pinned to: "<id>" (the newest version) or "<id>@<version>".
	Kits []string
	// AcceptRestricted confirms packing kit files with a restricted license (a corporate font).
	AcceptRestricted bool
	Now              func() time.Time
}

PackExportOptions say what goes into a pack.

type PackImportOptions

type PackImportOptions struct {
	// DryRun checks and reports; nothing is written.
	DryRun bool
	// Person is who imports (a page session's address; "" is the runtime's own): an imported project is theirs, as one
	// they made, since the pack carries no .owner.json.
	Person string
}

PackImportOptions of PackImport.

type PackImportResult

type PackImportResult struct {
	Manifest *PackManifest       `json:"manifest"`
	Projects []PackProjectResult `json:"projects"`
	Kits     []PackKitResult     `json:"kits"`
	// Dropped are files the pack held that are not taken: service names, credentials, an agent's instructions.
	Dropped  []string `json:"dropped,omitempty"`
	Warnings []string `json:"warnings,omitempty"`
	DryRun   bool     `json:"dryRun"`
	// Changed is whether the library or the kits folder changed (or would).
	Changed bool `json:"changed"`
}

PackImportResult is the plan (dry run) or the outcome of an import.

type PackKit

type PackKit struct {
	ID         string                 `json:"id"`
	Version    string                 `json:"version"`
	File       string                 `json:"file"`
	Size       int64                  `json:"size"`
	SHA256     string                 `json:"sha256"`
	Requires   []designkit.Require    `json:"requires,omitempty"`
	Restricted []designkit.Restricted `json:"restricted,omitempty"`
}

PackKit is a kit of a pack: the entry kits/<id>/<version>.kit.tar.gz is the kit's export.

type PackKitRef

type PackKitRef struct {
	ID      string `json:"id"`
	Version string `json:"version"`
}

PackKitRef names a kit version.

type PackKitResult

type PackKitResult struct {
	ID      string          `json:"id"`
	Version string          `json:"version"`
	Status  string          `json:"status"` // added | unchanged | conflict
	Diff    *designkit.Diff `json:"diff,omitempty"`
}

PackKitResult is what an import does with one kit version.

type PackManifest

type PackManifest struct {
	Format     string                 `json:"format"`
	Schema     int                    `json:"schema"`
	ExportedAt string                 `json:"exportedAt"`
	Projects   []PackProject          `json:"projects"`
	Kits       []PackKit              `json:"kits"`
	Warnings   []string               `json:"warnings,omitempty"`
	Files      []designkit.ExportFile `json:"files"`
	// SHA256 is the hash of the sorted "path size sha256" lines of Files.
	SHA256 string `json:"sha256"`
}

PackManifest is sinopia-pack.json.

type PackProject

type PackProject struct {
	ID    string      `json:"id"`
	Title string      `json:"title"`
	Kit   *PackKitRef `json:"kit,omitempty"`
	Files int         `json:"files"`
	Bytes int64       `json:"bytes"`
	// SHA256 is the hash of the project's own file list (path, size, hash): one number for its content.
	SHA256 string `json:"sha256"`
}

PackProject is a project of a pack: its files are the entries projects/<id>/….

type PackProjectResult

type PackProjectResult struct {
	ID string `json:"id"`
	// As is the id it has in this library; it differs from ID when ID was taken by another project.
	As     string `json:"as"`
	Status string `json:"status"` // added | renamed | unchanged
	Files  int    `json:"files"`
	Bytes  int64  `json:"bytes"`
	// Kit is the kit version the project is pinned to.
	Kit *PackKitRef `json:"kit,omitempty"`
}

PackProjectResult is what an import does with one project.

type PackRestrictedError

type PackRestrictedError struct{ Restricted []designkit.Restricted }

PackRestrictedError: kits of the pack have license-restricted files and the export was not confirmed.

func (*PackRestrictedError) Error

func (e *PackRestrictedError) Error() string

type Page

type Page struct {
	ID            string   `json:"id"`
	Title         string   `json:"title"`
	File          string   `json:"file"`
	Route         *string  `json:"route,omitempty"`
	DefaultDevice string   `json:"defaultDevice,omitempty"`
	Widths        []int    `json:"widths,omitempty"`
	VariantOf     *string  `json:"variantOf,omitempty"`
	W             *int     `json:"w"`
	H             *int     `json:"h"`
	Expand        *string  `json:"expand,omitempty"`
	Order         *float64 `json:"order,omitempty"`
	// contains filtered or unexported fields
}

Page is meta/pages/<id>.json: File is the board under project/ (a *.dc.html, or a page with its query).

func ResolvePage

func ResolvePage(m *ProjectModel, ref string) (Page, error)

ResolvePage is the page a person or an agent named: its id, its file (with or without the suffix) or its title.

func (Page) Template added in v0.16.154

func (p Page) Template() (PageTemplate, bool)

Template is the page's record of the template it came from.

type PageBuild

type PageBuild struct {
	Page   string   `json:"page"`
	Source string   `json:"source"`
	Board  string   `json:"board"`
	Status string   `json:"status"` // built, current, error
	Error  string   `json:"error,omitempty"`
	Inputs []string `json:"inputs,omitempty"`
}

PageBuild is the outcome of building one page.

type PageError

type PageError struct {
	Msg    string
	Status int
}

PageError is a refusal worded for the person or the agent, with the HTTP status that fits it.

func (*PageError) Error

func (e *PageError) Error() string

type PageListing

type PageListing struct {
	Project      string     `json:"project"`
	Release      string     `json:"release"`
	Pages        []PageView `json:"pages"`
	Unregistered []string   `json:"unregistered"`
}

PageListing is a project's pages, and the board files of project/ no page names.

type PageSourceProblem

type PageSourceProblem struct {
	Page    string `json:"page"`
	Source  string `json:"source"`
	Message string `json:"message"`
}

PageSourceProblem is a finding of the check about a page that has a module source.

type PageSpec

type PageSpec struct {
	Title     string
	File      string
	Route     *string
	VariantOf string
	W, H      *int
	Expand    bool
	Widths    []int
	// Layout is a slide layout of an installed kit, <kit>[@version]/<theme>/<layout>: the page starts as that board and the
	// theme's folder is put into the project as ds/<theme>/. Not with VariantOf or File.
	Layout string
	// Seed is the board's content as it is (a chat's mockup, BoardFromHTML), instead of the template. Not with Layout,
	// VariantOf or File.
	Seed []byte
}

PageSpec is what a new page is asked to be; Title is required.

type PageTemplate added in v0.16.154

type PageTemplate struct {
	App     string `json:"app"`
	ID      string `json:"id"`
	Version string `json:"version,omitempty"`
	// Lock is strict (only Editable changes) or open (a starting point: everything changes).
	Lock string `json:"lock"`
	// Editable is what the person may change: data-hl-key -> data-hl-edit ("text", "slot", "props:a,b") and
	// "field:<name>" -> "field" for the elements bound with data-hl-field.
	Editable map[string]string `json:"editable,omitempty"`
	// Closed is the digest of the fold of everything else; Parts the digests per data-hl-key, to name what broke.
	Closed string            `json:"closed,omitempty"`
	Parts  map[string]string `json:"parts,omitempty"`
}

PageTemplate is the record of a board made from a template.

func NewPageTemplate added in v0.16.154

func NewPageTemplate(app, id, version, lock string, src []byte) PageTemplate

NewPageTemplate is the record for a board made from src: the editable places are those the template marks, the fold is of the rest. lock is strict or open.

func (PageTemplate) Locked added in v0.16.154

func (t PageTemplate) Locked() bool

Locked says whether the record keeps the board from free edits.

type PageView

type PageView struct {
	Page
	Present bool `json:"present"`
}

PageView is a page with whether its board file is there.

type PersonSnapshot added in v0.16.154

type PersonSnapshot struct {
	Projects map[string]Grant  `json:"projects"`
	Team     map[string]string `json:"team"`
}

PersonSnapshot is one person's part of a shared machine's snapshot.

type ProjectChange

type ProjectChange struct {
	Path string `json:"path"`
	// Kind is "added", "changed" or "removed" (from the version to now).
	Kind  string `json:"kind"`
	Board string `json:"board,omitempty"`
}

ProjectChange is one board (or other file) of the project changed between a version and now.

type ProjectDeleteError added in v0.16.15

type ProjectDeleteError struct {
	Msg    string
	Status int
}

ProjectDeleteError is a refusal to delete, with the status to answer.

func (*ProjectDeleteError) Error added in v0.16.15

func (e *ProjectDeleteError) Error() string

type ProjectDiff

type ProjectDiff struct {
	Revision string          `json:"revision"`
	Boards   []ProjectChange `json:"boards"`
	// Other counts the changed files that are not boards (pictures, styles, the model).
	Other int `json:"other"`
	// KitThen and KitNow are the kit the project was on at the version and is on now.
	KitThen *KitPin `json:"kitThen"`
	KitNow  *KitPin `json:"kitNow"`
}

ProjectDiff is a version compared with the project as it is.

type ProjectKitState

type ProjectKitState struct {
	Pin *KitPin `json:"pin"`
	// Latest is the kit's newest version.
	Latest string `json:"latest,omitempty"`
	// Update is the newest version past the pin, unless the person chose to stay away from it.
	Update *designkit.Published `json:"update"`
	// DraftProject is the kit's draft, when it has one.
	DraftProject string `json:"draftProject,omitempty"`
	// KitDraftOf: the project is itself the draft of this kit.
	KitDraftOf string `json:"kitDraftOf,omitempty"`
	// Installed are the kits installed on the machine, for «Подключить UI-кит» of a project that has none.
	Installed []string `json:"installed,omitempty"`
}

ProjectKitState is a project's kit as its header shows it.

type ProjectMeta

type ProjectMeta struct {
	Title     string
	Source    *string
	CreatedAt string
	Release   string
	Kits      []any
	Tailwind  bool
	// CanvasKey is the key of canvas.json the project's own data goes under, fixed when meta/ is made so that every
	// runtime and command builds the same file whatever its settings.
	CanvasKey string
	// DefaultDevice is the device every page opens in unless the page names its own ("" keeps the viewer's).
	DefaultDevice string
	// contains filtered or unexported fields
}

ProjectMeta is meta/project.json.

type ProjectMigration

type ProjectMigration struct {
	ID string `json:"id"`
	// Status: "migrate" (a dry run would migrate it), "migrated", "current" (meta/ was there), "skipped" (no
	// project/ folder) or "error".
	Status string         `json:"status"`
	Pages  []MigratedPage `json:"pages"`
	// Writes are the files written (or that would be), relative to the library.
	Writes []string `json:"writes"`
	Error  string   `json:"error,omitempty"`
}

ProjectMigration is what a migration did, or would do, to one project.

type ProjectModel

type ProjectModel struct {
	Meta  ProjectMeta
	Pages []Page
}

ProjectModel is a project's meta/ as read: the pages in their order.

func (*ProjectModel) Page

func (m *ProjectModel) Page(id string) (Page, bool)

Page is a page by id.

func (*ProjectModel) PageOfFile

func (m *ProjectModel) PageOfFile(file string) string

PageOfFile is the id of the page whose board is file ("" when none or no meta).

type ProjectPoint

type ProjectPoint struct {
	ID      string `json:"id"`
	At      int64  `json:"at"`
	Who     string `json:"who"`
	Agent   bool   `json:"agent"`
	Subject string `json:"subject"`
	// Name is the version's name when the person named this point.
	Name string `json:"name,omitempty"`
	// Auto: nobody was editing when the change came (no editor line) — a copy from another machine, a sync, a file put
	// in place by a tool. It is a point of the history, not somebody's edit («Изменён»).
	Auto bool `json:"auto,omitempty"`
}

ProjectPoint is one point of a project's history.

type ProjectRelease

type ProjectRelease struct {
	// Current is the project's release; a project that names none is on the engine it carries, shown as legacy.
	Current string `json:"current"`
	// Pinned: the project names its release (else its own support.js is served).
	Pinned bool `json:"pinned"`
	// Upgrade is the newest stable release after Current, null when there is none.
	Upgrade *string `json:"upgrade"`
	// Skill is the folder of the agents' rules for Current, null when the mirror has none.
	Skill *string `json:"skill"`
}

ProjectRelease is the release a project is on, as the panel shows it.

type ProjectVersions

type ProjectVersions struct {
	Points []ProjectPoint `json:"points"`
	Named  []NamedVersion `json:"named"`
	// Unsaved: the project has changes the history has not taken yet.
	Unsaved bool `json:"unsaved"`
	// CreatedAt is when the project was made, in ms, as its meta/ says (not this machine's first snapshot of it,
	// which is when the copy came here); 0 when the meta does not say.
	CreatedAt int64 `json:"createdAt,omitempty"`
}

ProjectVersions is the project's history for the "Версии" panel.

type PublicConfig added in v0.15.40

type PublicConfig struct {
	Secret   []byte
	Salt     string
	Audience string
	Header   string
	// Now is the clock (tests freeze it); nil is the real one.
	Now func() time.Time
}

PublicConfig names how the public token is checked: the pair's secret, the HKDF salt (the share salt), the audience the gateway signs the token with and the header it carries the token in.

func (PublicConfig) Sign added in v0.16.154

func (c PublicConfig) Sign(project, rev string, pin bool, pages []string) (string, int64, error)

Sign is a guest's token over one project, as the gateway signs it: the hub of a self-hosted machine has no share of the pair's secret, so the runtime signs for it (GuestToken, the machine agent only). At most one of rev, pin and pages, as check reads them.

type PushRequest

type PushRequest struct {
	Title, URL, Tag, DeviceID string
}

PushRequest is a board sent to the person's other devices.

type RecordEvent added in v0.16.86

type RecordEvent struct {
	T      int       `json:"t"`
	End    int       `json:"end,omitempty"`
	Type   string    `json:"type"`
	X      *float64  `json:"x,omitempty"`
	Y      *float64  `json:"y,omitempty"`
	BBox   []float64 `json:"bbox,omitempty"`
	On     string    `json:"on,omitempty"`
	Tag    string    `json:"tag,omitempty"`
	Label  string    `json:"label,omitempty"`
	Text   string    `json:"text,omitempty"`
	Masked bool      `json:"masked,omitempty"`
	Key    string    `json:"key,omitempty"`
	URL    string    `json:"url,omitempty"`
	Title  string    `json:"title,omitempty"`
	By     int       `json:"by,omitempty"`
}

RecordEvent is one thing that happened: open, click, hover, type, key, scroll.

type RecordLog added in v0.16.86

type RecordLog struct {
	V        int           `json:"v"`
	Name     string        `json:"name"`
	Video    string        `json:"video"`
	FPS      int           `json:"fps"`
	Frames   int           `json:"frames"`
	Dropped  int           `json:"dropped"` // frames the browser gave no picture for (the previous one stays)
	DurMs    int           `json:"durMs"`
	Width    int           `json:"width"` // the clip's pixels
	Height   int           `json:"height"`
	Viewport [2]int        `json:"viewport"`
	Scale    int           `json:"scale"`
	Theme    string        `json:"theme"`
	Events   []RecordEvent `json:"events"`
	// Cursor is [t, x, y] of every frame.
	Cursor [][3]float64 `json:"cursor"`
}

RecordLog is <name>.json: what the scene needs to draw the cursor and aim the camera. T is in ms from the clip's first frame, X and Y in CSS pixels of the page, a box is [x, y, w, h].

type RecordOptions added in v0.16.86

type RecordOptions struct {
	// Dir is the project's folder; the clip and the log go to Dir/records.
	Dir string
	// Name overrides the script's name.
	Name string
	// CRF of the clip: 0 is lossless; 8 or lower is without visible loss.
	CRF int
	// Preset of the x264: slower is smaller.
	Preset string
	// Getenv gives a secret step its value; nil: the process environment.
	Getenv func(string) string
	// Log is told what the recording is doing now.
	Log func(string)
}

RecordOptions is what a recording takes besides its script.

type RecordResult added in v0.16.86

type RecordResult struct {
	Video, LogFile string
	Frames         int
	Dropped        int
	DurMs          int
	Wall           time.Duration
	Secrets        int
}

RecordResult is what a recording made.

func Record added in v0.16.86

Record plays a script and keeps the clip and the log in opt.Dir/records.

type RecordScenario added in v0.16.86

type RecordScenario struct {
	Name     string         `yaml:"name"`
	URL      string         `yaml:"url"`      // opened first when the steps do not open anything themselves
	Viewport RecordViewport `yaml:"viewport"` // the page's size in CSS pixels
	Scale    int            `yaml:"scale"`    // device pixels per CSS pixel: 2 is twice the pixels of a 1080p video
	FPS      int            `yaml:"fps"`
	Theme    string         `yaml:"theme"` // light or dark: prefers-color-scheme of the page
	Locale   string         `yaml:"locale"`
	Steps    []RecordStep   `yaml:"steps"`
}

RecordScenario is the script of one recording, JSON or YAML (JSON is YAML).

func ParseRecordScenario added in v0.16.86

func ParseRecordScenario(raw []byte) (*RecordScenario, error)

ParseRecordScenario reads and checks a script; unknown fields are refused so a misspelt one does not pass silently.

type RecordStep added in v0.16.86

type RecordStep struct {
	Do      string `yaml:"do"`
	URL     string `yaml:"url"`
	On      string `yaml:"on"`
	Into    string `yaml:"into"`
	Text    string `yaml:"text"`
	Secret  string `yaml:"secret"` // the name of an environment variable that holds the value: never the value itself
	Key     string `yaml:"key"`
	By      int    `yaml:"by"`
	To      string `yaml:"to"`
	Ms      int    `yaml:"ms"`
	Timeout int    `yaml:"timeout"`
	Pause   *int   `yaml:"pause"`
}

RecordStep is one action. Do names it; the other fields are what the action takes.

open      url
click     on
hover     on
type      into (clicked first; omitted: the focused field), text or secret
key       key (Enter, Tab, Escape, Backspace, ArrowDown, ...)
scroll    by (CSS pixels, down is positive) or to (an element), ms
wait      ms
wait-for  on, timeout

A target is a CSS selector, or text=Words (the smallest visible element holding the words), or text=/regexp/i. Pause is the stillness after the step in ms.

type RecordViewport added in v0.16.86

type RecordViewport struct {
	Width  int `yaml:"width"`
	Height int `yaml:"height"`
}

RecordViewport is the page's size in CSS pixels.

type Release

type Release struct {
	ID     string `json:"release"`
	Date   string `json:"date"`
	Status string `json:"status"`
	// contains filtered or unexported fields
}

Release is one release a project can be on.

type ReleaseError

type ReleaseError struct{ Msg string }

ReleaseError is a refusal worded for the person.

func (*ReleaseError) Error

func (e *ReleaseError) Error() string

type ReleaseFilter

type ReleaseFilter struct {
	Runtime, TabID, Project, Board string
	AnyTab, AnyBoard               bool
}

ReleaseFilter names a runtime's own claims; empty fields match any.

type ReleaseRequest added in v0.16.15

type ReleaseRequest struct {
	By string `json:"by"`
	At int64  `json:"at"`
}

ReleaseRequest is a person asking the holder to let go of a board.

type RenderHealth added in v0.16.154

type RenderHealth struct {
	// Checking: no result yet, the first check runs in the background.
	Checking bool       `json:"checking,omitempty"`
	OK       bool       `json:"ok"`
	At       *time.Time `json:"at,omitempty"`
	// Code and Hint are the first failed step's.
	Code string `json:"code,omitempty"`
	Step string `json:"step,omitempty"`
	Hint string `json:"hint,omitempty"`
}

RenderHealth is the cached outcome of the doctor, as the engine status shows it.

type RestoreTarget

type RestoreTarget struct {
	Revision string
	Ago      time.Duration
}

RestoreTarget is a revision, or how long ago.

func ParseRestoreTarget

func ParseRestoreTarget(v string) (RestoreTarget, bool)

ParseRestoreTarget reads --at: a revision (7–40 hex digits) or 30m, 2h, 1d.

type Revision

type Revision struct {
	Rev             int64
	Path, Sha       string
	Author, Machine string
	At              int64 // ms
	Deleted         bool
}

Revision is one revision of a file in the store.

type RevisionLeases

type RevisionLeases interface {
	// TakeLease takes or refreshes the lease on key for chat: true when this machine holds it now.
	TakeLease(ctx context.Context, key, chat string) (bool, error)
}

RevisionLeases is a store that keeps short claims too: a task one machine of the space does for all, as the PDF of a deck, is done by the one that holds its lease. The lease lapses by itself when its holder stops refreshing it.

type Revisions

type Revisions interface {
	// History is the revisions of one path, newest first.
	History(ctx context.Context, path string) ([]Revision, error)
	// HistoryUnder is the newest revisions under a folder (prefix ends in "/"; "" for the whole library).
	HistoryUnder(ctx context.Context, prefix string, limit int) ([]Revision, error)
	// Snapshot is a folder as it was at a revision, without what was deleted by then.
	Snapshot(ctx context.Context, prefix string, at int64) ([]Revision, error)
	// Read is the contents of a revision by its sha256.
	Read(ctx context.Context, sha string) ([]byte, error)
}

Revisions is the store's history of the library as the runtime reaches it.

type Role added in v0.15.40

type Role string

Role is what a person may do in a project; "" is nothing, the project is not theirs to see.

const (
	RoleNone    Role = ""
	RoleView    Role = "view"
	RoleComment Role = "comment"
	RoleEdit    Role = "edit"
	RoleManage  Role = "manage"
	RoleOwner   Role = "owner"
)

func (Role) AtLeast added in v0.15.40

func (r Role) AtLeast(min Role) bool

AtLeast: the role is one of min or stronger; no role is never enough.

type Scene3DAdd

type Scene3DAdd struct {
	Title, Root, Blend, Script, Project, File string
}

Scene3DAdd is what the agent's `design scene3d add` asks: a 3D scene document over a built .blend. Project is a project the person's brief already made (the scene is written into it instead of a new one); File is a .blend that lies elsewhere (a chat's attachment): it is copied into Root/out.

type Scene3DAnchor

type Scene3DAnchor struct {
	Object string      `json:"object,omitempty"`
	P      *[3]float64 `json:"p,omitempty"`
	Cam    *Scene3DCam `json:"cam,omitempty"`
	Frame  int         `json:"frame"`
	// Shot is the viewport as the person saw it (a small JPEG kept beside the comment); Render is the key of the draft
	// frame "as it will be" taken from this view, when there was one.
	Shot   bool   `json:"shot,omitempty"`
	Render string `json:"render,omitempty"`
	// Fix is how an agent closed the pin: the frame of the pin's view before and after the scene was changed.
	Fix *Scene3DFix `json:"fix,omitempty"`
}

Scene3DAnchor is where a pin sits: the object (its name in Blender), the point on its surface, the camera it was set from and the frame of the animation.

type Scene3DApplyJob

type Scene3DApplyJob struct {
	ID      string            `json:"id"`
	Status  string            `json:"status"` // building, ready, failed
	Phase   string            `json:"phase"`
	Error   string            `json:"error,omitempty"`
	Output  string            `json:"output,omitempty"`
	Changed bool              `json:"changed"`
	Hash    string            `json:"hash,omitempty"`
	Pins    []Scene3DApplyPin `json:"pins"`
	Started string            `json:"started"`
}

Scene3DApplyJob is a build of the scene from its script and the draw of the pins' frames around it.

func Scene3DApplyOf

func Scene3DApplyOf(id string) (Scene3DApplyJob, bool)

Scene3DApplyOf is a job of the apply, by id (a copy).

type Scene3DApplyPin

type Scene3DApplyPin struct {
	ID         string `json:"id"`
	Object     string `json:"object,omitempty"`
	Text       string `json:"text"`
	BeforeKey  string `json:"beforeKey,omitempty"`
	Before     string `json:"before,omitempty"`
	AfterKey   string `json:"afterKey,omitempty"`
	After      string `json:"after,omitempty"`
	Error      string `json:"error,omitempty"`
	SameAsPrev bool   `json:"sameAsBefore,omitempty"`
}

Scene3DApplyPin is one pin's before and after: the frames' keys and their files (for the agent to open).

type Scene3DBake

type Scene3DBake struct {
	M    string      `json:"m"`
	Rows [][]float64 `json:"rows"`
}

Scene3DBake is one baked object's samples.

type Scene3DCam

type Scene3DCam struct {
	N      string     `json:"n,omitempty"`
	Pos    [3]float64 `json:"pos"`
	Target [3]float64 `json:"target"`
	Fov    float64    `json:"fov"`
}

Scene3DCam is a view of the scene: a named camera of the scene (N, then the rest is the camera as it was at the frame), or a free one given by its position, target and vertical field of view, all in Blender's axes (z up).

func Scene3DNormCam

func Scene3DNormCam(c Scene3DCam, meta *Scene3DMeta) (Scene3DCam, error)

Scene3DNormCam checks a view and rounds it, so equal views share a cache key. A named camera needs only its name.

type Scene3DCamera

type Scene3DCamera struct {
	N    string  `json:"n"`
	Lens float64 `json:"lens"`
	Fov  float64 `json:"fov"`
	Near float64 `json:"near"`
	Far  float64 `json:"far"`
	// Track is the camera's path: [frame, x, y, z, tx, ty, tz, fov] at up to 120 frames of the range, t* a point 5 m ahead
	// (Blender's axes), so the viewer shows the camera as the render has it.
	Track [][]float64 `json:"track,omitempty"`
}

Scene3DCamera is a camera of the scene. Fov is the vertical field of view in degrees at the render's aspect.

type Scene3DCameraPath

type Scene3DCameraPath struct {
	FPS     float64               `json:"fps"`
	Start   int                   `json:"start"`
	End     int                   `json:"end"`
	Camera  string                `json:"camera,omitempty"`
	Samples []Scene3DCameraSample `json:"samples"`
}

Scene3DCameraPath is camera_path.json: the camera's pose at sampled frames, Blender's axes (z up), target a point 5 m ahead.

type Scene3DCameraSample

type Scene3DCameraSample struct {
	Frame  int        `json:"frame"`
	Pos    [3]float64 `json:"pos"`
	Target [3]float64 `json:"target"`
	Fov    float64    `json:"fov"`
}

Scene3DCameraSample is the pose at one frame.

type Scene3DClip

type Scene3DClip struct {
	Key     string        `json:"key"`
	Status  string        `json:"status"` // queued, building, ready, failed
	Done    int           `json:"done"`
	Total   int           `json:"total"`
	Frames  int           `json:"frames,omitempty"`
	FPS     float64       `json:"fps,omitempty"`
	Seconds float64       `json:"seconds,omitempty"`
	Error   string        `json:"error,omitempty"`
	Origin  Scene3DOrigin `json:"origin"`
}

Scene3DClip is a clip as the page lists it.

type Scene3DClipSpec

type Scene3DClipSpec struct {
	Cam   Scene3DCam `json:"cam"`
	Start int        `json:"start"`
	End   int        `json:"end"`
	Step  int        `json:"step"`
}

Scene3DClipSpec asks for a clip: a camera of the scene (or a free view), the frames Start..End taking every Step-th.

func Scene3DClipCheck

func Scene3DClipCheck(sp Scene3DClipSpec, meta *Scene3DMeta, maxFrames int) (Scene3DClipSpec, error)

Scene3DClipCheck normalises a spec against the scene's description: a step that keeps the clip within the draft's frame cap when none is given.

type Scene3DFinalJob

type Scene3DFinalJob struct {
	ID      string `json:"id"`
	Status  string `json:"status"` // building, ready, failed
	Phase   string `json:"phase"`
	Error   string `json:"error,omitempty"`
	Clip    string `json:"clip,omitempty"` // the clip's key once ready
	Cloud   string `json:"cloud,omitempty"`
	Started string `json:"started"`
	Plan    Scene3DFinalPlan
}

Scene3DFinalJob is a final render going or done.

func Scene3DFinals

func Scene3DFinals(project string) []Scene3DFinalJob

Scene3DFinals are the final renders of this runtime (newest first).

type Scene3DFinalPlan

type Scene3DFinalPlan struct {
	ID          string           `json:"id"`
	Spec        Scene3DClipSpec  `json:"spec"`
	Frames      int              `json:"frames"`
	Seconds     float64          `json:"seconds"`
	Hours       float64          `json:"hours"`
	EstimateRub float64          `json:"estimateRub"`
	Dry         string           `json:"dry"` // the cloud script's dry run, or why there is none
	Warnings    []string         `json:"warnings"`
	Expires     string           `json:"expires"`
	Hash        string           `json:"hash"`
	Cam         Scene3DCam       `json:"cam"`
	Checks      []Scene3DWarning `json:"checks,omitempty"`
}

Scene3DFinalPlan is what a final render would do and cost, for the person to confirm.

type Scene3DFix

type Scene3DFix struct {
	Before string `json:"before,omitempty"`
	After  string `json:"after,omitempty"`
	Note   string `json:"note,omitempty"`
	At     string `json:"at"`
}

Scene3DFix is what closes a pin by a change of the scene: the draft frame of the pin's view (keys of frames, drawn from the scene before and after the change) and a word of what was changed.

type Scene3DFrame

type Scene3DFrame struct {
	Key    string      `json:"key"`
	Status string      `json:"status"`
	Cam    *Scene3DCam `json:"cam,omitempty"`
	Frame  int         `json:"frame"`
	Engine string      `json:"engine,omitempty"`
	Error  string      `json:"error,omitempty"`
	Cached bool        `json:"cached,omitempty"`
	// Where is the builder that drew it; "" is this machine.
	Where string `json:"where,omitempty"`
}

Scene3DFrame is one draft render: the key it is cached under, its state and the engine that drew it.

type Scene3DGenJob

type Scene3DGenJob struct {
	ID          string
	State       string // queued, running, done, failed, canceled
	EstimateUSD float64
	Error       string
	Videos      []Scene3DGenVideo
}

Scene3DGenJob is a generation as the generator reports it.

type Scene3DGenParams

type Scene3DGenParams struct {
	Outputs string  `json:"outputs"`
	Model   string  `json:"model"`
	Prompt  string  `json:"prompt"`
	Seconds int     `json:"seconds"`
	Source  string  `json:"source"` // beauty or clay: which pictures are the frames
	MaxUSD  float64 `json:"maxUsd"`
}

Scene3DGenParams is what the person chooses for a generation.

type Scene3DGenRequest

type Scene3DGenRequest struct {
	Model   string
	Prompt  string
	Frames  []string // absolute paths: the first is the first frame, the second (if the model takes it) the last
	Seconds int
	MaxUSD  float64
	Owner   string
	CopyTo  string
	Origin  map[string]any
	// SaveOK and FrameOK say which paths the generator may write to and read from.
	SaveOK  func(string) bool
	FrameOK func(string) bool
}

Scene3DGenRequest is what the scene gives a generator.

type Scene3DGenVideo

type Scene3DGenVideo struct {
	Path       string
	Copy       string
	OriginFile string
}

Scene3DGenVideo is a clip a generator made: its file, the copy in CopyTo and the origin file beside it.

type Scene3DGeneration

type Scene3DGeneration struct {
	ID          string  `json:"id"`
	Outputs     string  `json:"outputs"`
	Model       string  `json:"model"`
	Prompt      string  `json:"prompt"`
	State       string  `json:"state"`
	EstimateUSD float64 `json:"estimateUsd"`
	Error       string  `json:"error,omitempty"`
	Clip        string  `json:"clip,omitempty"` // the clip's key once it was taken in
	StartedAt   string  `json:"startedAt"`
}

Scene3DGeneration is one generation of a scene, as the page lists it.

type Scene3DGenerator

type Scene3DGenerator interface {
	Estimate(ctx context.Context, r Scene3DGenRequest) (usd float64, note string, err error)
	Start(r Scene3DGenRequest) (Scene3DGenJob, error)
	Get(id string) (Scene3DGenJob, bool)
}

Scene3DGenerator is a video generator the runtime provides.

type Scene3DKeyframe

type Scene3DKeyframe struct {
	Frame   int     `json:"frame"`
	Seconds float64 `json:"seconds"`
	Beauty  string  `json:"beauty,omitempty"`
	Clay    string  `json:"clay,omitempty"`
	Depth   string  `json:"depth,omitempty"`
	Normals string  `json:"normals,omitempty"`
}

Scene3DKeyframe is one key frame's pictures, file names in the outputs folder ("" for a pass not asked for).

type Scene3DManifest

type Scene3DManifest struct {
	V     int `json:"v"`
	Scene struct {
		Project string `json:"project"`
		Title   string `json:"title"`
		Hash    string `json:"hash"`
	} `json:"scene"`
	Camera     Scene3DCam        `json:"camera"`
	FPS        float64           `json:"fps"`
	Range      [2]int            `json:"range"`
	Size       [2]int            `json:"size"`
	Engine     string            `json:"engine"`
	DepthFar   float64           `json:"depthFar"`
	Passes     []string          `json:"passes"`
	CameraPath string            `json:"cameraPath"`
	Keyframes  []Scene3DKeyframe `json:"keyframes"`
	Masks      []Scene3DMask     `json:"masks"`
	CreatedAt  string            `json:"createdAt"`
	Where      string            `json:"where,omitempty"`
}

Scene3DManifest is manifest.json, the contract (version 1): everything is named relative to the manifest's own folder.

type Scene3DMarker

type Scene3DMarker struct {
	F   int    `json:"f"`
	N   string `json:"n"`
	Cam string `json:"cam,omitempty"`
}

Scene3DMarker binds a camera to a frame of the animation (a timeline marker).

type Scene3DMask

type Scene3DMask struct {
	Object string `json:"object"`
	Frame  int    `json:"frame"`
	File   string `json:"file"`
}

Scene3DMask is the mask of one object at a frame: a PNG whose alpha is the object.

type Scene3DMeta

type Scene3DMeta struct {
	Version int             `json:"version"`
	FPS     float64         `json:"fps"`
	Start   int             `json:"start"`
	End     int             `json:"end"`
	Res     [2]int          `json:"res"`
	Camera  string          `json:"camera,omitempty"` // the scene's active camera
	Objects []Scene3DObject `json:"objects"`
	Cameras []Scene3DCamera `json:"cameras"`
	Markers []Scene3DMarker `json:"markers"`
	Bounds  [6]float64      `json:"bounds"` // min xyz, max xyz in Blender's axes
	Stats   Scene3DStats    `json:"stats"`
	// Bake is what the glTF's actions do not carry (drivers, constraints, NLA): an object's local transform at sampled frames, by name.
	// m "e": [frame, location xyz, XYZ euler, scale xyz]; m "q": [frame, location, quaternion wxyz, scale]. Blender's axes.
	Bake map[string]Scene3DBake `json:"bake,omitempty"`
}

Scene3DMeta is <hash>/meta.json: what the exporter read from the .blend.

type Scene3DModel

type Scene3DModel struct {
	Status string       `json:"status"`
	Hash   string       `json:"hash,omitempty"`
	Bytes  int64        `json:"bytes,omitempty"`
	Error  string       `json:"error,omitempty"`
	Meta   *Scene3DMeta `json:"meta,omitempty"`
	// While the model builds: Phase is queued (waits for a slot of the machine), waiting (another runtime of the
	// shared library exports the same model) or exporting; Stage is the exporter's step; Started is when the build began (ms).
	Phase   string `json:"phase,omitempty"`
	Stage   string `json:"stage,omitempty"`
	Started int64  `json:"started,omitempty"`
	// Prev is the last model that was ready, shown while this one builds or after it failed.
	Prev *Scene3DModel `json:"prev,omitempty"`
}

Scene3DModel is the viewer's model as the machine has it for the scene's current .blend.

type Scene3DObject

type Scene3DObject struct {
	N      string `json:"n"`
	T      string `json:"t"` // MESH, CURVE, EMPTY, CAMERA, LIGHT, ...
	P      string `json:"p,omitempty"`
	Tris   int    `json:"tris,omitempty"`
	Hidden bool   `json:"hidden,omitempty"`
	// Vis is when the object is on: [frame, 1|0] from the first sampled frame, one entry where it changes (hide_render keyed in time).
	// The glTF carries the object whole; the viewer turns it on and off by this.
	Vis [][2]int `json:"vis,omitempty"`
}

Scene3DObject is one object of the scene as the viewer's tree shows it.

type Scene3DOrigin

type Scene3DOrigin struct {
	Project   string     `json:"project"`
	Title     string     `json:"title"`
	Hash      string     `json:"hash"`
	Cam       Scene3DCam `json:"cam"`
	Start     int        `json:"start"`
	End       int        `json:"end"`
	Step      int        `json:"step"`
	Kind      string     `json:"kind"` // draft or final
	Engine    string     `json:"engine,omitempty"`
	Where     string     `json:"where,omitempty"`
	Width     int        `json:"width"`
	Height    int        `json:"height"`
	CreatedAt string     `json:"createdAt"`
	// Outputs is the set of outputs a generated clip came from; Generator is what the generator wrote of it (its origin file).
	Outputs   string          `json:"outputs,omitempty"`
	Generator json.RawMessage `json:"generator,omitempty"`
}

Scene3DOrigin says where a clip came from: the scene, its model's hash, the camera, the frames, what drew them and where.

type Scene3DOutputs

type Scene3DOutputs struct {
	Key      string           `json:"key"`
	Status   string           `json:"status"`
	Error    string           `json:"error,omitempty"`
	Manifest *Scene3DManifest `json:"manifest,omitempty"`
}

Scene3DOutputs is one set of outputs as the page lists it.

type Scene3DOutputsSpec

type Scene3DOutputsSpec struct {
	Cam    Scene3DCam `json:"cam"`
	Frames []int      `json:"frames"`
	Passes []string   `json:"passes"`
	Masks  []string   `json:"masks"`
}

Scene3DOutputsSpec asks for the outputs of a camera at some frames.

func Scene3DOutputsCheck

func Scene3DOutputsCheck(sp Scene3DOutputsSpec, meta *Scene3DMeta) (Scene3DOutputsSpec, error)

Scene3DOutputsCheck normalises a spec: frames within the scene's range (at most a few, in order), known passes (beauty, clay, depth and normals by default), masks of objects the scene has.

type Scene3DProject

type Scene3DProject struct {
	Root    string   `json:"root"`
	Name    string   `json:"name"`
	Blends  []string `json:"blends"`  // relative to Root, the newest first
	Scripts []string `json:"scripts"` // relative to Root
}

Scene3DProject is a folder that looks like a blender-lab project: scenes of code, built .blend files.

type Scene3DSettings

type Scene3DSettings struct {
	V      int    `json:"v"`
	Root   string `json:"root"`
	Blend  string `json:"blend"`
	Script string `json:"script,omitempty"`
}

Scene3DSettings is meta/scene3d.json. Root is the blender-lab project's folder on the machine (absolute), Blend the scene's .blend under it, Script the .py that builds it (what an agent edits, stage 2) — all relative to Root.

type Scene3DState

type Scene3DState struct {
	Rev           int64               `json:"rev"`
	Title         string              `json:"title"`
	Settings      Scene3DSettings     `json:"settings"`
	Blender       bool                `json:"blender"`
	Engine        string              `json:"engine"` // what draft frames are rendered with: eevee or cycles
	Model         Scene3DModel        `json:"model"`
	Comments      []DeckComment       `json:"comments"`
	GuestResolved []string            `json:"guestResolved"`
	Frames        []Scene3DFrame      `json:"frames"`
	Clips         []Scene3DClip       `json:"clips"`
	Finals        []Scene3DFinalJob   `json:"finals"`
	Outputs       []Scene3DOutputs    `json:"outputs"`
	Gens          []Scene3DGeneration `json:"generations"`
	Generator     bool                `json:"generator"`
}

Scene3DState is the answer of GET /design/scene3d. Rev moves when anything the page shows moves; the page polls it every 3 s while visible.

type Scene3DStats

type Scene3DStats struct {
	Tris           int      `json:"tris"`
	TrisOut        int      `json:"trisOut"`
	Objects        int      `json:"objects"`
	Animated       int      `json:"animated"`
	MissingImages  []string `json:"missingImages,omitempty"`
	UnappliedScale []string `json:"unappliedScale,omitempty"`
	OffCamera      []string `json:"offCamera,omitempty"`
	// EmptyAtSave are objects the saved frame shows as nothing (hidden, scaled to zero, a curve not grown yet) that appear later: the
	// glTF is exported with them whole, and the viewer says so.
	EmptyAtSave []string `json:"emptyAtSave,omitempty"`
}

Scene3DStats is what the export measured: polygons and the scene's faults a check reports (stage 3).

type Scene3DVideoResult

type Scene3DVideoResult struct {
	Video  string        `json:"video"`
	Scene  string        `json:"scene"`
	Page   string        `json:"page"`
	Folder string        `json:"folder"` // under the video's project
	Origin Scene3DOrigin `json:"origin"`
	New    bool          `json:"new"`
}

Scene3DVideoResult is where the clip went.

type Scene3DViewCmd

type Scene3DViewCmd struct {
	Seq    int64       `json:"seq"`
	Cam    *Scene3DCam `json:"cam,omitempty"`
	Frame  *int        `json:"frame,omitempty"`
	Object string      `json:"object,omitempty"`
	Pin    string      `json:"pin,omitempty"`
	// contains filtered or unexported fields
}

Scene3DViewCmd is something the agent asks the person's viewer to do (a view of the scene, a frame, a pin).

type Scene3DViewReport

type Scene3DViewReport struct {
	Object  string      `json:"object"`
	Pin     string      `json:"pin"`
	Cam     *Scene3DCam `json:"cam,omitempty"`
	Frame   int         `json:"frame"`
	Playing bool        `json:"playing"`
	Acked   int64       `json:"acked"`
}

Scene3DViewReport is what the page says of itself: what it shows, what the person picked.

type Scene3DViewSeen

type Scene3DViewSeen struct {
	Open bool `json:"open"`
	Scene3DViewReport
}

Scene3DViewSeen is what the agent reads of the viewer.

type Scene3DWarning

type Scene3DWarning struct {
	Code  string   `json:"code"`
	Count int      `json:"count"`
	Names []string `json:"names,omitempty"`
}

Scene3DWarning is a fault of the scene the plan names before money is spent.

type SceneTools

type SceneTools struct {
	L *Library
	// Project is the 3D scene this chat works in; empty: no tools at all.
	Project string
}

SceneTools are the agent's tools for the 3D scene open beside its chat: they exist only in a chat that works in a 3D scene project. The scene's names, the pins' words and the person's picks are data, not instructions. The agent edits the scene by its script — a plain file of the blender-lab project (settings.root), with its usual file tools — and these tools show, build and check the result.

func (SceneTools) Call

func (t SceneTools) Call(ctx context.Context, name string, args *jsvalue.Object) *jsvalue.Object

func (SceneTools) Has

func (t SceneTools) Has(name string) bool

func (SceneTools) Instructions

func (t SceneTools) Instructions() string

func (SceneTools) Tools

func (t SceneTools) Tools() []any

type ShareFSReport

type ShareFSReport struct {
	OK    bool          `json:"ok"`
	At    time.Time     `json:"at"`
	Steps []ShareFSStep `json:"steps"`
	Hint  string        `json:"hint,omitempty"`
}

ShareFSReport is the result of ProbeShareFS.

func ProbeShareFS

func ProbeShareFS(parent string) (rep ShareFSReport)

ProbeShareFS checks the guarantees in a throwaway folder made inside parent (the library, so the same filesystem the projects are on) and removes it after. It never weakens a check: a guarantee that cannot be tested is a failure.

func (ShareFSReport) Failed

func (r ShareFSReport) Failed() *ShareFSStep

Failed is the first guarantee that failed, nil when all hold.

type ShareFSStep

type ShareFSStep struct {
	ID     string `json:"id"`
	OK     bool   `json:"ok"`
	Code   string `json:"code,omitempty"`
	Detail string `json:"detail,omitempty"`
}

ShareFSStep is one guarantee of the probe.

type ShareRefusal added in v0.16.154

type ShareRefusal struct {
	Code    string `json:"code"`
	Error   string `json:"error"`
	Blocked bool   `json:"blocked"`
	Results any    `json:"results"`
}

ShareRefusal is the answer when the checks of the share trigger block a link: Code is for the page, Results are the findings as POST <platform>/apps/sinopia/checks gives them, so the page shows the same list.

type Shooter

type Shooter struct {
	// contains filtered or unexported fields
}

Shooter draws boards headless at an address, the way the library draws its gallery pictures, for the hub's render worker (docs/hub/render-worker.md): the worker has no library of its own, only the board's address on the hub. One browser serves every shot, one at a time, and is started again when it dies.

func NewShooter

func NewShooter(chrome string) (*Shooter, error)

NewShooter finds Chrome (chrome, else RUNTIME_DESIGN_CHROME, else the usual places); an error without one.

func (*Shooter) Close

func (s *Shooter) Close()

Close stops the browser.

func (*Shooter) ShootPage

func (s *Shooter) ShootPage(ctx context.Context, url, boardPath string, w, h int) ([]byte, error)

ShootPage draws the board at url as a page of a guest link's snapshot: as the gallery picture, but only when the page drew cleanly (loaded, no script errors, no file failed), as the machine's own snapshot asks (Library.pinnedRaster).

func (*Shooter) ShootThumb

func (s *Shooter) ShootThumb(ctx context.Context, url, boardPath string, w, h int) ([]byte, error)

ShootThumb draws the board at url as its gallery picture (JPEG). A page with errors still gives a picture, as on the machine; one that did not draw at all is an error.

type SiteComment

type SiteComment struct {
	DeckComment
	Reactions []SiteReaction `json:"reactions"`
	// ThreadBy, on the answer to a new reply, are the people who wrote in its thread before (the first comment's author
	// first): the hub tells them of the reply (internal/hub/designaccess/site_mentions.go).
	ThreadBy []DeckPerson `json:"threadBy,omitempty"`
}

SiteComment is a site comment as answered: the stored one, its reactions told as counts and whether they are the asker's (the people's addresses stay in the file).

type SiteCommentSpec

type SiteCommentSpec struct {
	Board    string
	X, Y     float64
	Block    string
	Label    string
	Text     string
	Parent   string
	Mentions []DeckPerson
	Agent    bool
	ByAgent  bool
	// Drawing goes with a thread's first comment only; with it, the words may be left out.
	Drawing *SiteDrawing
}

SiteCommentSpec is a new site comment or reply.

type SiteDrawing

type SiteDrawing struct {
	Shapes []SiteShape `json:"shapes"`
}

SiteDrawing is the shapes of one drawing, in the order drawn.

type SitePropValue

type SitePropValue = any

SitePropValue is a setting's value: a word, a number or a switch.

type SiteProps

type SiteProps struct {
	Boards map[string]map[string]SitePropValue `json:"boards"`
	By     string                              `json:"by,omitempty"`
	At     string                              `json:"at,omitempty"`
}

SiteProps is meta/props.json: by board path, the settings picked (name → value), and who picked last and when.

type SiteReaction

type SiteReaction struct {
	Emoji string   `json:"e"`
	Count int      `json:"n"`
	Mine  bool     `json:"mine"`
	Names []string `json:"names"`
}

SiteReaction is one emoji of a comment as a person sees it.

type SiteShape

type SiteShape struct {
	Kind  string       `json:"kind"`
	Color string       `json:"color"`
	W     float64      `json:"w"`
	Pts   [][2]float64 `json:"pts"`
	Text  string       `json:"text,omitempty"`
}

SiteShape is one shape: a stroke of the pen or the marker (the points it went through), an arrow or a frame (its two ends), or a label (its point and words).

type SnapshotKind

type SnapshotKind string

SnapshotKind is what a snapshot came to.

const (
	SnapshotCommitted SnapshotKind = "committed"
	SnapshotClean     SnapshotKind = "clean"
	SnapshotBusy      SnapshotKind = "busy"
)

type StorePusher

type StorePusher interface {
	PushProject(ctx context.Context, project string) error
}

StorePusher sends a project's folder to the store now (the runtime's store link).

type StrictReport

type StrictReport struct {
	Project string `json:"project"`
	Kit     string `json:"kit"`
	Version string `json:"version"`
	// On says why strict mode applies to the project without the flag: "project", "kit" or "" (asked for).
	On       string                    `json:"on,omitempty"`
	Checked  []string                  `json:"checked"`
	Findings []designkit.StrictFinding `json:"findings"`
}

StrictReport is what the strict check found in a project.

type SweepResult

type SweepResult struct {
	Released           []Claim
	Refreshed, Cleared int
	// Own counts the claims of this runtime's chats that the pass left held.
	Own int
	// Offline: the center did not answer, so nothing is known about the claims.
	Offline bool
}

SweepResult counts what one pass did.

type SyncNotice added in v0.16.15

type SyncNotice struct {
	Kind       string `json:"kind"`
	Path       string `json:"path"`
	Kept       string `json:"kept"`
	Project    string `json:"project"`
	Board      string `json:"board"`
	Variant    string `json:"variant"`
	CurrentRev int64  `json:"current_rev"`
	By         string `json:"by"`
	ByMachine  string `json:"by_machine"`
	Machine    string `json:"machine"`
	At         string `json:"at"`
	// contains filtered or unexported fields
}

SyncNotice is a notice of the design-sync agent about a write that lost.

func (SyncNotice) Message added in v0.16.15

func (n SyncNotice) Message() string

Message is the words for the chat whose edit lost.

type System

type System struct {
	ID    string `json:"id"`
	Label string `json:"label"`
}

System is the design system or kit a project was built on.

type TSXMigrateOptions

type TSXMigrateOptions struct {
	Only   []string // board files or names; all the project's boards when empty
	DryRun bool
	Force  bool // --to board: roll back a page edited after the migration
	// Compare draws a board and its page and says how many pixels differ (-1: the board does not draw the same way
	// twice). Nil: Chrome, with the project's engine.
	Compare BoardComparer
}

TSXMigrateOptions picks the boards and how they are proven.

type TSXMigration

type TSXMigration struct {
	Project string           `json:"project"`
	To      string           `json:"to"`
	DryRun  bool             `json:"dryRun,omitempty"`
	Boards  []BoardMigration `json:"boards"`
	Done    int              `json:"done"`
	Kept    int              `json:"kept"`
}

TSXMigration is the report of a migration of one project, either way.

type Terminal

type Terminal interface {
	// AgentTab is a layout tab's tmux session and panel type; ok false when there is no such tab.
	AgentTab(tabID string) (session, panelType string, ok bool)
	// Front is whether only a shell runs in the pane, and the name of what does.
	Front(session string) (safe bool, process string)
	// Deliver types a line and Enter, or submits through the agent's editor (a long or multi-line text).
	Deliver(session, text string, viaEditor bool) error
	// NeedsEditor is whether a text must go through the editor.
	NeedsEditor(text string) bool
}

Terminal is what a message to an agent needs of the tab keeper and tmux.

type Texts

type Texts struct {
	// CLI is the command agents run (`<cli> design check …`).
	CLI string
	// Host is the platform's address people open on a phone.
	Host string
	// AppName names the platform in a dialog's instructions.
	AppName string
	// Tag names what this runtime writes into shared places: the history's author and marker, the rules file's marker,
	// a check's temporary profile.
	Tag string
	// HistoryEmail is the history's author address.
	HistoryEmail string
	// SharedDir is where the team's shared library lives on the platform's machines, named in the rules file.
	SharedDir string
	// KitGlobal, PagesGlobal and ArgsGlobal are the window globals of a project's UI kit, its page renderer and the
	// renderer's arguments.
	KitGlobal, PagesGlobal, ArgsGlobal string
	// People maps the local part of the owner's address to the name a claim shows.
	People map[string]string
}

Texts are the words of the deployment the library speaks to people and agents with.

type ThumbAnswer

type ThumbAnswer struct {
	File    string
	Current bool
	Drawing *thumbDrawing
}

ThumbAnswer is what the gallery can be given for a board right now: the picture of the board as it is (Current), else that of an earlier version, else none, and the drawing of the current one when it is not there yet.

type TimelineEvent added in v0.16.5

type TimelineEvent struct {
	T      int64
	K      string
	Page   string
	Fields map[string]any
}

TimelineEvent is one thing that happened in the design.

func (TimelineEvent) Has added in v0.16.5

func (e TimelineEvent) Has(name string) bool

func (TimelineEvent) MarshalJSON added in v0.16.5

func (e TimelineEvent) MarshalJSON() ([]byte, error)

func (TimelineEvent) Num added in v0.16.5

func (e TimelineEvent) Num(name string) float64

func (TimelineEvent) Str added in v0.16.5

func (e TimelineEvent) Str(name string) string

Str, Num and Bool read a field by name; a missing or differently typed field reads as the zero value.

func (*TimelineEvent) UnmarshalJSON added in v0.16.5

func (e *TimelineEvent) UnmarshalJSON(b []byte) error

type TrashItem

type TrashItem struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	DeletedAt int64  `json:"deletedAt"`
	// Kind is site, slides or video, told by the folder's own files.
	Kind string `json:"kind"`
}

TrashItem is a project in the trash.

type VideoBoard added in v0.16.42

type VideoBoard struct {
	Moments []VideoMoment
	// Transition is the board's own data-transition on <main>; nil when it says none.
	Transition *VideoTransition
}

VideoBoard is what a board's source says about time.

func ParseVideoBoard added in v0.16.42

func ParseVideoBoard(src string) VideoBoard

ParseVideoBoard reads a board's moments and transition. An element is a moment when it has data-tk-at or data-tk-out (written time), or else a data-step or a data-build-in (derived time). A value that is not a number is read as absent; the check (videocheck.go) is what tells the agent. Moments come out in time order, ties in document order.

type VideoCheckIssue added in v0.16.42

type VideoCheckIssue struct {
	Scene  string          `json:"scene"`
	Format *VideoFormat    `json:"format"`
	At     *int64          `json:"at"`
	Block  *string         `json:"block"`
	Code   string          `json:"code"`
	Level  VideoCheckLevel `json:"level"`
	Msg    string          `json:"msg"`
}

VideoCheckIssue is one finding of POST /api/cli/design/video/check. Format nil: the finding holds for every format (the static lint); At nil: not tied to a moment; Block nil: not tied to a data-block.

type VideoCheckLevel added in v0.16.42

type VideoCheckLevel string

VideoCheckLevel is how bad a check's finding is.

const (
	VideoCheckError VideoCheckLevel = "error"
	VideoCheckWarn  VideoCheckLevel = "warn"
)

type VideoFormat added in v0.16.42

type VideoFormat string

VideoFormat is a video's aspect: 16:9 (1920×1080) or 9:16 (1080×1920).

const (
	VideoLandscape VideoFormat = "16:9"
	VideoPortrait  VideoFormat = "9:16"
)

func (VideoFormat) Size added in v0.16.42

func (f VideoFormat) Size(draft bool) (w, h int)

Size is the frame size in pixels; a draft is half of it (960×540, 540×960).

func (VideoFormat) Slug added in v0.16.42

func (f VideoFormat) Slug() string

Slug is the format in a file or folder name: 16x9, 9x16.

func (VideoFormat) Valid added in v0.16.42

func (f VideoFormat) Valid() bool

Valid: f is one of VideoFormats.

type VideoInit added in v0.16.42

type VideoInit struct {
	Formats []VideoFormat
	Seconds *int
	Subs    bool
}

VideoInit is what a new video is made with (the create screen's settings). Formats empty: 16:9.

type VideoMoment added in v0.16.42

type VideoMoment struct {
	Block   string `json:"block"`
	Tpl     *int   `json:"tpl"`
	At      int64  `json:"at"`
	Out     *int64 `json:"out"`
	BuildIn string `json:"buildIn"`
	Derived bool   `json:"derived"`
}

VideoMoment is a timed block of a scene, read from the board's source: data-block, data-tk-at / data-tk-out (seconds from the scene's start, kept here as ms) and data-build-in. Tpl is the element's data-dc-tpl when known. Out nil: the block stays to the scene's end. Derived: the time was not written on the board but derived (from data-step).

type VideoOverlay added in v0.16.86

type VideoOverlay struct {
	ID        string             `json:"id"`
	Kind      VideoOverlayKind   `json:"kind"`
	Text      string             `json:"text"`
	At        int64              `json:"at"`
	Out       *int64             `json:"out"`
	X         float64            `json:"x"`
	Y         float64            `json:"y"`
	W         float64            `json:"w"`
	H         float64            `json:"h"`
	TX        *float64           `json:"tx,omitempty"`
	TY        *float64           `json:"ty,omitempty"`
	Portrait  *VideoOverlayPlace `json:"portrait,omitempty"`
	Anchor    VideoOverlayAnchor `json:"anchor"`
	Enter     VideoOverlayEnter  `json:"enter"`
	Leave     VideoOverlayLeave  `json:"leave"`
	Theme     VideoOverlayTheme  `json:"theme"`
	Value     *float64           `json:"value,omitempty"`
	From      float64            `json:"from,omitempty"`
	Decimals  int                `json:"decimals,omitempty"`
	Author    VideoOverlayAuthor `json:"author"`
	UpdatedAt string             `json:"updatedAt"`
}

VideoOverlay is one element of a scene's overlay layer. At and Out are ms from the scene's start (Out nil: to the scene's end). Value, From and Decimals belong to a counter, whose number is Value counted from From; Text then is the label ("{n} ₽" puts the number where {n} is, any other text follows it).

func (VideoOverlay) Place added in v0.16.86

func (o VideoOverlay) Place() VideoOverlayPlace

Place is the overlay's base (16:9) place.

type VideoOverlayActor added in v0.16.86

type VideoOverlayActor = VideoOverlayAuthor

VideoOverlayActor is who edits: the page's routes are a person (human), the CLI and the MCP tools are the agent.

type VideoOverlayAnchor added in v0.16.86

type VideoOverlayAnchor string

VideoOverlayAnchor is how the text sits in its box.

type VideoOverlayAnswer added in v0.16.86

type VideoOverlayAnswer struct {
	Scene   VideoScene     `json:"scene"`
	Overlay *VideoOverlay  `json:"overlay"`
	List    []VideoOverlay `json:"overlays"`
	// Warnings: the overlay stands on others at the same time (ids in Overlaps). The change is saved all the same.
	Overlaps []string `json:"overlaps,omitempty"`
}

VideoOverlayAnswer is what the overlay routes answer: the scene as it now is, and the overlay the call made or changed.

type VideoOverlayAuthor added in v0.16.86

type VideoOverlayAuthor string

VideoOverlayAuthor tells who wrote an overlay last: a person's edit wins over an agent's.

const (
	VideoAuthorHuman VideoOverlayAuthor = "human"
	VideoAuthorAgent VideoOverlayAuthor = "agent"
)

type VideoOverlayEnter added in v0.16.86

type VideoOverlayEnter string

VideoOverlayEnter is how an overlay comes in. The text styles (typewriter, mask, words, scramble) act on the text; on a kind that is not text (highlight, key caps) they are played as a fade.

type VideoOverlayKind added in v0.16.86

type VideoOverlayKind string

VideoOverlayKind is what an overlay is.

const (
	VideoOverlayTitle     VideoOverlayKind = "title"     // a big line or two
	VideoOverlayCaption   VideoOverlayKind = "caption"   // a lower third: a plate with an accent bar
	VideoOverlayCallout   VideoOverlayKind = "callout"   // a note with an arrow to a point of the frame
	VideoOverlayHighlight VideoOverlayKind = "highlight" // a frame around an area, the rest dimmed
	VideoOverlayKey       VideoOverlayKind = "key"       // key caps: "Ctrl + K"
	VideoOverlayCounter   VideoOverlayKind = "counter"   // a number that counts up
	VideoOverlayBadge     VideoOverlayKind = "badge"     // a sticker
)

type VideoOverlayLeave added in v0.16.86

type VideoOverlayLeave string

VideoOverlayLeave is how an overlay goes out.

type VideoOverlayPlace added in v0.16.86

type VideoOverlayPlace struct {
	X  float64  `json:"x"`
	Y  float64  `json:"y"`
	W  float64  `json:"w"`
	H  float64  `json:"h"`
	TX *float64 `json:"tx,omitempty"`
	TY *float64 `json:"ty,omitempty"`
}

VideoOverlayPlace is where an overlay stands in a format: a box in fractions of the frame and, for a callout, the point its arrow ends at.

func VideoOverlayPlaceIn added in v0.16.86

func VideoOverlayPlaceIn(o VideoOverlay, f VideoFormat) VideoOverlayPlace

VideoOverlayPlaceIn is where the overlay stands in f: 16:9 is its own place; 9:16 is its Portrait place, or the base place moved into the safe zone (a highlight is an area of the picture and is not moved).

type VideoOverlayTheme added in v0.16.86

type VideoOverlayTheme string

VideoOverlayTheme is the overlay's look, made of the board's deck variables (--deck-ink, --deck-acc, --deck-bg ...).

type VideoPublished added in v0.16.42

type VideoPublished struct {
	Formats map[VideoFormat]VideoPublishedFormat `json:"formats"`
}

VideoPublished is .media/published/video.json (D7).

type VideoPublishedFormat added in v0.16.42

type VideoPublishedFormat struct {
	Key   string `json:"key"`
	DurMs int64  `json:"durMs"`
	At    string `json:"at"`
}

VideoPublishedFormat is one format's entry of .media/published/video.json: the inputs key it was rendered from, its length and when it was published (RFC 3339).

type VideoRenderInfo added in v0.16.42

type VideoRenderInfo struct {
	Format     VideoFormat `json:"format"`
	Published  bool        `json:"published"`
	Key        *string     `json:"key"`
	CurrentKey string      `json:"currentKey"`
	Fresh      bool        `json:"fresh"`
	DurMs      *int64      `json:"durMs"`
	At         *string     `json:"at"`
}

VideoRenderInfo is what the page shows for a format's published MP4. Published: the file is there. Key, DurMs, At are the published entry's, null when there is none. CurrentKey is the key of today's inputs; Fresh: Key == CurrentKey.

type VideoRenderJob added in v0.16.42

type VideoRenderJob struct {
	ID       string       `json:"id"`
	Format   VideoFormat  `json:"format"`
	Scene    *string      `json:"scene"`
	Draft    bool         `json:"draft"`
	State    DeckJobState `json:"state"`
	Progress float64      `json:"progress"`
	File     *string      `json:"file"`
	Error    *string      `json:"error"`
	At       string       `json:"at"`
}

VideoRenderJob is a render job (kept in memory, keyed <artifact>/<id>). Progress is 0..1. File is the file's name once done; Error is the reason, worded for the person, once failed. At is when it was asked (RFC 3339).

type VideoRenderRequest added in v0.16.42

type VideoRenderRequest struct {
	Format VideoFormat `json:"format"`
	Page   *string     `json:"page"`
	Draft  bool        `json:"draft"`
}

VideoRenderRequest is the body of POST /design/video/render (and the CLI's, with project) less the artifact. Page nil: the whole video; a page renders only that scene's clip (for a look, never published). Draft: half size, crf 28, never published.

type VideoScene added in v0.16.42

type VideoScene struct {
	ID         string                 `json:"id"`
	Path       string                 `json:"path"`
	Title      string                 `json:"title"`
	Start      int64                  `json:"start"`
	Dur        int64                  `json:"dur"`
	Auto       bool                   `json:"auto"`
	Transition VideoTransition        `json:"transition"`
	Moments    []VideoMoment          `json:"moments"`
	Overlays   []VideoOverlay         `json:"overlays"`
	Screen     *VideoScreen           `json:"screen"`
	Words      int                    `json:"words"`
	Notes      string                 `json:"notes"`
	Version    string                 `json:"version"`
	Blank      bool                   `json:"blank"`
	Keys       map[VideoFormat]string `json:"keys"`
}

VideoScene is a scene as the video answers it: a board's page with its place on the time line. Start is the sum of the earlier scenes' Dur. Auto: Dur came from VideoAutoDur, not meta/scenes. Words and Notes are the scene's text (meta/notes, which are also the subtitles). Version and Blank as DeckSlide's. Keys is the scene clip's cache key per enabled format (the render's inputs; see videorender.go).

type VideoSceneMeta added in v0.16.42

type VideoSceneMeta struct {
	V          int              `json:"v"`
	Dur        *int64           `json:"dur"`
	Transition *VideoTransition `json:"transition"`
	Overlays   []VideoOverlay   `json:"overlays,omitempty"`
	Screen     *VideoScreen     `json:"screen,omitempty"`
}

VideoSceneMeta is meta/scenes/<pageId>.json. Dur nil: automatic (VideoAutoDur); Transition nil: the board's own data-transition, else none. Overlays is the scene's layer of titles, callouts and the like (video_overlays.go). Screen is the camera of the scene's recording as data (video_zooms.go); nil: the board's own camera. V is 2 since the overlays; a file of V 1 has none and is read as it is, the next write makes it V 2.

type VideoScreen

type VideoScreen struct {
	Zooms []VideoZoom `json:"zooms"`
}

VideoScreen is the camera of a scene's recording as data. An empty Zooms keeps the camera on the whole page.

type VideoScreenAnswer

type VideoScreenAnswer struct {
	Scene  *VideoScene  `json:"scene,omitempty"`
	Screen *VideoScreen `json:"screen"`
	Zoom   *VideoZoom   `json:"zoom"`
}

VideoScreenAnswer is what the zoom routes answer: the scene's screen block as it now is (nil: the board's own camera) and the zoom the call made or changed.

type VideoSettings added in v0.16.42

type VideoSettings struct {
	V       int           `json:"v"`
	Formats []VideoFormat `json:"formats"`
	FPS     int           `json:"fps"`
	Seconds *int          `json:"seconds"`
	Voice   VideoVoice    `json:"voice"`
	Subs    bool          `json:"subs"`
}

VideoSettings is meta/video.json: written by the runtime, read by the agent and the page. V is 1. Formats has one or both of VideoFormats, in that order. Seconds nil: the length does not matter; otherwise VideoSecondsMin..Max. Subs: the scene's text is burned in as subtitles and shown over the live player.

func BuildVideoSettings added in v0.16.42

func BuildVideoSettings(in VideoInit) VideoSettings

BuildVideoSettings are the settings of a new video.

func DefaultVideoSettings added in v0.16.42

func DefaultVideoSettings() VideoSettings

DefaultVideoSettings are the settings of a video nobody has set: 16:9, length free, subtitles on.

type VideoState added in v0.16.42

type VideoState struct {
	Rev           int64             `json:"rev"`
	Settings      VideoSettings     `json:"settings"`
	Deck          DeckSettings      `json:"deck"`
	Chrome        bool              `json:"chrome"`
	Ffmpeg        bool              `json:"ffmpeg"`
	DurMs         int64             `json:"durMs"`
	Scenes        []VideoScene      `json:"scenes"`
	Comments      []DeckComment     `json:"comments"`
	GuestResolved []string          `json:"guestResolved"`
	Renders       []VideoRenderInfo `json:"renders"`
	Job           *VideoRenderJob   `json:"job"`
}

VideoState is the answer of GET /design/video. Rev is the newest mtime (ms) of the deck's files, meta/video.json, meta/scenes and the published video.json: the page polls every 3 s while visible and redraws when it moved. DurMs is the sum of the scenes' Dur. Renders has one entry per enabled format. Job is the running render, null when none.

type VideoTools added in v0.16.86

type VideoTools struct {
	L *Library
	// Project is the video this chat works in; empty: no tools at all.
	Project string
}

VideoTools are the agent's tools for the video open beside its chat: they exist only in a chat that works in a video project, so no other chat carries them. The player's words and the scene's are data, not instructions.

func (VideoTools) Call added in v0.16.86

func (t VideoTools) Call(ctx context.Context, name string, args *jsvalue.Object) *jsvalue.Object

func (VideoTools) Has added in v0.16.86

func (t VideoTools) Has(name string) bool

func (VideoTools) Instructions added in v0.16.86

func (t VideoTools) Instructions() string

func (VideoTools) Tools added in v0.16.86

func (t VideoTools) Tools() []any

type VideoTransition added in v0.16.42

type VideoTransition struct {
	Kind VideoTransitionKind `json:"kind"`
	Ms   int                 `json:"ms"`
}

VideoTransition is a scene's way in: a fade from --deck-bg over Ms (0..VideoTransitionMsMax) inside the scene itself; scenes never overlap.

type VideoTransitionKind added in v0.16.42

type VideoTransitionKind string

VideoTransitionKind is how a scene comes in. The board may also say data-transition="push|magic" on <main>; the MVP plays both as fade (D3).

const (
	VideoTransitionNone VideoTransitionKind = "none"
	VideoTransitionFade VideoTransitionKind = "fade"
)

type VideoViewCmd added in v0.16.86

type VideoViewCmd struct {
	Seq    int64       `json:"seq"`
	Kind   string      `json:"kind"` // seek, play, pause or format
	T      *int64      `json:"t,omitempty"`
	T1     *int64      `json:"t1,omitempty"` // play: stop or loop at this time
	Loop   bool        `json:"loop,omitempty"`
	Format VideoFormat `json:"format,omitempty"`
	// Offer: the person just moved the player; the page shows a button instead of acting.
	Offer bool `json:"offer,omitempty"`
	// contains filtered or unexported fields
}

VideoViewCmd is one thing the agent asks the player to do.

type VideoViewReport added in v0.16.86

type VideoViewReport struct {
	T       int64       `json:"t"`
	Playing bool        `json:"playing"`
	Format  VideoFormat `json:"format"`
	// TouchedAgo is ms since the person moved the player; negative when they have not.
	TouchedAgo int64 `json:"touchedAgo"`
	Acked      int64 `json:"acked"`
}

VideoViewReport is what the page says of itself.

type VideoViewSeen added in v0.16.86

type VideoViewSeen struct {
	Open    bool        `json:"open"`
	T       int64       `json:"t"`
	Playing bool        `json:"playing"`
	Format  VideoFormat `json:"format,omitempty"`
	// Moving: the person moved the player a moment ago.
	Moving bool `json:"moving"`
}

VideoViewSeen is what the agent is told of the player.

type VideoVoice added in v0.16.42

type VideoVoice string

VideoVoice is the video's sound. The MVP has none (D10).

const VideoVoiceNone VideoVoice = "none"

type VideoZoom

type VideoZoom struct {
	ID        string             `json:"id"`
	At        int64              `json:"at"`
	Out       int64              `json:"out"`
	X         float64            `json:"x"`
	Y         float64            `json:"y"`
	Zoom      float64            `json:"zoom"`
	Ease      int64              `json:"ease"`
	Author    VideoOverlayAuthor `json:"author"`
	UpdatedAt string             `json:"updatedAt"`
}

VideoZoom is one zoom of the camera.

Source Files

Directories

Path Synopsis
Package ownengine contains the board engine shared by the runtime and its eval fixture.
Package ownengine contains the board engine shared by the runtime and its eval fixture.

Jump to

Keyboard shortcuts

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