Docs Design mockups for tasks

Design mockups for coding tasks

A design mockup is a UI reference the assistant (or a person) attaches to a
task or mission, so a coder can implement the screen without guessing. Mockarty
stores the image, the editable HTML/SVG source, and the intent (screen name,
viewport, theme, purpose, source revision) as one artefact.

You create mockups through the REST API, the assistant chat, or an MCP client;
there is no dedicated page for creating them.

What you need

  • The namespace must contain the task (issue) or mission you attach to.
  • Read access to the parent (mission:read or issue:read) to list and fetch
    a mockup; write access (mission:write or issue:write) to create or delete
    one. A principal without access to the task cannot fetch its mockups.
  • For a PNG preview, the admin node needs its local Chromium (the same browser
    Playwright UI tests use). Without it, the source is still stored and the
    response says render.status = "not_run".

Create a mockup

POST /api/v1/namespaces/{namespace}/design-mockups

{
  "parentKind": "mission",
  "parentId": "m-123",
  "screenName": "Login / dark",
  "viewport": {"name": "desktop", "width": 1440, "height": 900},
  "theme": "dark",
  "purpose": "Sign in and recover a password",
  "sourceRevision": "sha256:3f2a...",
  "format": "html",
  "source": "<!doctype html><html><body><h1>Sign in</h1></body></html>"
}
  • parentKind is mission (a whole autonomous mission) or issue (a task in
    the tracker).
  • screenName is required (1-160 characters).
  • viewport defaults to 1440x900; each side is between 1 and 4096.
  • theme is light, dark or system (default).
  • source is self-contained HTML or SVG (maximum 512 KiB). You can instead
    pass sourceMediaLinkId with an attachment that is already on the same
    parent.
  • To use an image as the reference, pass format: "png" with the image in
    sourceMediaLinkId or source, or send a base64 image in imageBase64
    (maximum 8 MiB decoded).

The image and the source are stored as attachments, with the same quota and
file checks as any other attachment. When HTML or SVG is supplied, Mockarty also
renders a PNG preview with the local browser.

A replayed identical request returns the same mockup with HTTP 200 instead of
201, so retrying a create is safe.

Air-gapped rules

Mockups must be self-contained. Mockarty rejects HTML/SVG that contains:

  • <script>, <iframe>, <object>, <embed>, <base> or <link>;
  • an external src, href, xlink:href, CSS url(http...) or @import.

Use inline <style> and data: images. This keeps a mockup from loading a CDN
asset or sending anything from the admin node.

List and read

GET /api/v1/namespaces/{namespace}/design-mockups?parentKind=mission&parentId=m-123
GET /api/v1/namespaces/{namespace}/design-mockups/library?limit=100
GET /api/v1/namespaces/{namespace}/design-mockups/{id}

The first list returns the live mockups of one parent (newest first, limit
defaults to 100, maximum 200). /library returns the live mockups of the whole
Space, which is what the mission wizard’s picker uses; a mockup whose parent you
cannot see is omitted from both lists.

A mockup response contains:

{
  "id": "...",
  "parentKind": "mission",
  "parentId": "m-123",
  "spec": {
    "screenName": "Login / dark",
    "viewport": {"name": "desktop", "width": 1440, "height": 900},
    "theme": "dark",
    "purpose": "Sign in and recover a password",
    "sourceRevision": "sha256:3f2a..."
  },
  "image": {
    "linkId": "...", "url": "/api/v1/namespaces/ns/media/.../view",
    "mime": "image/png", "sizeBytes": 15234, "sha256": "...",
    "width": 1440, "height": 900
  },
  "source": {
    "linkId": "...", "url": "/api/v1/namespaces/ns/media/.../view",
    "mime": "text/html", "sizeBytes": 240, "sha256": "..."
  },
  "render": {"status": "rendered", "reason": ""},
  "createdBy": "...",
  "createdAt": "..."
}

image is absent when render.status is not_run. source is absent only
for an image-only mockup. The URLs require the same bearer token as the API;
they are served by the normal media routes.

Coder context

GET /api/v1/namespaces/{namespace}/design-mockups/{id}/context

This is the call a coder makes. It returns the same fields plus:

  • sourceText — the HTML/SVG source inline (bounded);
  • implementationBrief — a deterministic statement of what to build;
  • contextDigest — a stable sha256: identity of the spec, media and brief.

Pass ?includeImageBase64=true to inline the preview when it is at most 1 MiB
and the client cannot fetch the image URL itself.

When render.status is "not_run", no PNG exists. Read sourceText (or fetch
source.url) and implement from the source; do not assume an image was
produced. The render.reason field explains why.

Attach a mockup to a mission

In the mission wizard, open Design reference (step 2). It lists the Space’s
existing mockups from /library. Choosing one sends only its id; the server
resolves the visibility, the typed spec, the preview and the implementation
brief, and records them in the mission under a key the caller cannot write.
When a preview is available, select the thumbnail to open the full-size image
in a new tab. The same control is available in the mission’s Evidence.

From an API client, start a mission with:

{
  "goal": "Build the new checkout screen",
  "designReference": {"mockupId": "..."}
}

POST /api/v1/missions stores the resolved reference at
mission.data.designReference, including contextDigest; the coder receives
the implementation brief together with the goal. Before you start, the wizard’s
summary names the chosen screen and its digest, and the mission card’s
Evidence section shows the reference, the same digest and a link to
/context, so “this mission was given that mockup” can be checked against the
live mockup instead of taken on trust.

Uploaded mission materials (the Documents and design materials field) are
reported the same way: GET /api/v1/missions/{id} returns materialProvenance
with one row per pinned original, the consumers the durable records name
(planning analyst, and each sub-task whose runner supplied the file), and an
explicit not_consumed — or unknown when the node cannot see the coder
record.

Delete

DELETE /api/v1/namespaces/{namespace}/design-mockups/{id}?reason=stale

Soft-deletes the mockup and both media links. The content-addressed object is
reclaimed by the normal media garbage collector. Deleting an unknown or
already-deleted mockup returns 404.

MCP tools

Agents use the same authority path:

Tool Purpose
design_mockup_create Save an HTML/SVG/image mockup against a mission or task
design_mockup_list List mockups of one parent
design_mockup_get Read spec and media references
design_mockup_context Fetch everything needed to implement the mockup
design_mockup_delete Soft-delete the mockup

The Assistant’s default toolset includes these tools, so a person
can ask it to save a mockup while working on a mission or task.

Limits and errors

Condition Status
Invalid spec / external asset / unsupported format 400
Parent task or mission not found in this namespace 404
Mockup not found (including another namespace) 404
No permission on the parent 403
Source, image or request body too large 413
Renderer unavailable The mockup is stored; render.status = "not_run" (not an error)

SDK and CLI

Design mockups are not exposed as SDK or CLI operations. This is an
interactive/agent workflow: the assistant proposes a design and a coder
consumes it over MCP. The project deliberately does not publish thin
endpoint wrappers that no repeatable customer CI workflow needs. Existing
attachment operations cover file handling.