# place.hud.chatDefs

> What the chat's methods and its event stream hold: a chat, its messages, the steps a model took and the tiles it drew.

- Kind: defs
- Authority: hud.place
- Lexicon: 1
- Published by [lexicons.hud.place](https://lexicon.garden/identity/did:plc:3tzbz4pml36u4mkresb6pdhv), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.chatDefs)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.chatDefs/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:3tzbz4pml36u4mkresb6pdhv/place.hud.chatDefs/analytics)

## #artifact (`place.hud.chatDefs#artifact`)

Type: object

Something the chat made, kept with it in versions: an app (a frame app not yet published, or published from the chat), or a view (a tile the model named).

### Properties

- `key` (string, required): The model's name for it, unique in the chat: 1 to 40 of a-z, 0-9 and -.
  - Constraints: minLength: 1, maxLength: 40
- `kind` (string, required)
  - Constraints: maxLength: 32, knownValues: app | view
- `latest` (integer, required): Its newest version.
  - Constraints: minimum: 1
- `name` (string, required): An app's name, a view's title, as its latest version has it.
  - Constraints: maxLength: 2000, maxGraphemes: 200
- `published` (ref)
  - Reference: `#published`
- `versions` (array, required): The versions kept, oldest first: at most 10, the oldest dropped first, never a published one.
  - `items` (ref)
    - Reference: `#artifactVersion`

## #artifactEvent (`place.hud.chatDefs#artifactEvent`)

Type: object

The answer made a version of an artifact (made, with the artifact as it is now), or tried to and was refused (made with problems).

### Properties

- `artifact` (ref)
  - Reference: `#artifact`
- `made` (ref, required)
  - Reference: `#artifactRef`
- `turn` (integer, required)
  - Constraints: minimum: 1

## #artifactRef (`place.hud.chatDefs#artifactRef`)

Type: object

A version of an artifact a turn made, or a version it tried to make and was refused: its problems, and no version.

### Properties

- `key` (string, required)
  - Constraints: minLength: 1, maxLength: 40
- `problems` (array): Why the version was refused, each problem in a line.
  - Constraints: maxLength: 50
  - `items` (ref)
    - Reference: `#problem`
- `version` (integer): The version made.
  - Constraints: minimum: 1

## #artifactVersion (`place.hud.chatDefs#artifactVersion`)

Type: object

A version of an artifact. An app's document is read with get_app_source, and drawn at /a/chat/<chat>/<key>/<version>; a view's is its tile.

### Properties

- `createdAt` (string · datetime, required)
- `edits` (integer): With how edits, how many.
  - Constraints: minimum: 1
- `how` (string, required): whole: given whole; edits: the version before it, changed by edits.
  - Constraints: maxLength: 32, knownValues: whole | edits
- `name` (string): An app's name.
  - Constraints: maxLength: 640, maxGraphemes: 64
- `origins` (array): The origins an app loads pictures and audio from; left out where it names none.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `place.hud.app#origin`
- `reads` (array): The public collections an app reads beyond its entries; left out where it names none.
  - Constraints: maxLength: 16
  - `items` (ref)
    - Reference: `place.hud.app#collection`
- `summary` (string): An app's summary.
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `tile` (ref): A view's tile.
  - Reference: `#tile`
- `turn` (integer): The chat's turn that made it, where a turn did.
  - Constraints: minimum: 1
- `version` (integer, required)
  - Constraints: minimum: 1
- `writes` (array): The collections an app writes beyond its entries; left out where it names none.
  - Constraints: maxLength: 8
  - `items` (ref)
    - Reference: `place.hud.app#collection`

## #chatSummary (`place.hud.chatDefs#chatSummary`)

Type: object

A chat, as the list of a person's chats shows it.

### Properties

- `chat` (string, required): The chat's id: 12 hex digits.
  - Constraints: minLength: 12, maxLength: 12
- `title` (string, required): Its first message, cut short.
  - Constraints: maxLength: 2000, maxGraphemes: 200
- `updatedAt` (string · datetime, required): When its last message was written.

## #chatView (`place.hud.chatDefs#chatView`)

Type: object

A chat whole: every message, oldest first.

### Properties

- `artifacts` (array): What the chat made, apps and views, oldest first, each with its versions.
  - `items` (ref)
    - Reference: `#artifact`
- `chat` (string, required)
  - Constraints: minLength: 12, maxLength: 12
- `messages` (array, required)
  - `items` (ref)
    - Reference: `#message`
- `running` (boolean, required): Whether the model is answering its last message now: its progress comes on getChatEvents.
- `storage` (ref)
  - Reference: `#storage`
- `title` (string, required)
  - Constraints: maxLength: 2000, maxGraphemes: 200

## #doneEvent (`place.hud.chatDefs#doneEvent`)

Type: object

The answer is done, or ended early (error): the chat holds it whole now.

### Properties

- `error` (string)
  - Constraints: maxLength: 2000
- `turn` (integer, required)
  - Constraints: minimum: 1

## #message (`place.hud.chatDefs#message`)

Type: object

A message: the person's, or the model's answer to the one before.

### Properties

- `artifacts` (array): The versions of the chat's artifacts the model's answer made, or tried to make and was refused, in order: an app's drawn as a card in the conversation.
  - `items` (ref)
    - Reference: `#artifactRef`
- `createdAt` (string · datetime)
- `error` (string): Why the model's answer ended before it was done, in a line.
  - Constraints: maxLength: 2000
- `role` (string, required)
  - Constraints: maxLength: 32, knownValues: person | model
- `steps` (array, required): The tool calls the model made for its answer, in order: none for a person's.
  - `items` (ref)
    - Reference: `#step`
- `text` (string, required): What was written, as plain text with Markdown's emphasis, links and lists.
  - Constraints: maxLength: 10000
- `tiles` (array, required): What its answer draws, in order: none for a person's.
  - `items` (ref)
    - Reference: `#tile`
- `turn` (integer, required): The exchange it belongs to: a person's message and the answer after it share one.
  - Constraints: minimum: 1

## #problem (`place.hud.chatDefs#problem`)

Type: object

A problem with what the model gave, in a line.

### Properties

- `message` (string, required)
  - Constraints: maxLength: 2000

## #published (`place.hud.chatDefs#published`)

Type: object

Where an app artifact was published from the chat (place.hud.publishChatArtifact): its place.hud.app record and its page.

### Properties

- `cid` (string · cid, required)
- `uri` (string · at-uri, required)
- `url` (string · uri, required): The app's page, /a/<handle>/<rkey> on this server.
- `version` (integer, required): The version published last.
  - Constraints: minimum: 1

## #step (`place.hud.chatDefs#step`)

Type: object

A tool call the model made.

### Properties

- `arguments` (unknown): What it was called with, an object.
- `call` (string, required): The call's id, the same on each event about it.
  - Constraints: maxLength: 64
- `ms` (integer): How long it took, once done or failed.
  - Constraints: minimum: 0
- `status` (string, required)
  - Constraints: maxLength: 32, knownValues: running | done | failed
- `summary` (string): The tool's own short summary of its answer, or why it failed.
  - Constraints: maxLength: 2000
- `tool` (string, required): The tool, by its MCP name.
  - Constraints: maxLength: 64

## #stepEvent (`place.hud.chatDefs#stepEvent`)

Type: object

A step began, or ended: the step as it is now, replacing the one of its id.

### Properties

- `step` (ref, required)
  - Reference: `#step`
- `turn` (integer, required)
  - Constraints: minimum: 1

## #storage (`place.hud.chatDefs#storage`)

Type: object

Where the chat is kept: in a space of the person's own on their PDS (space, its uri), or in this server's files (file, and why).

### Properties

- `kind` (string, required)
  - Constraints: maxLength: 32, knownValues: space | file
- `reason` (string): Why it is in this server's files, in a line.
  - Constraints: maxLength: 2000
- `uri` (string): The space, at:space/<did>/place.hud.chat/<chat>.
  - Constraints: maxLength: 2000

## #textEvent (`place.hud.chatDefs#textEvent`)

Type: object

More of the model's answer's words, to add to what came before.

### Properties

- `text` (string, required)
  - Constraints: maxLength: 10000
- `turn` (integer, required)
  - Constraints: minimum: 1

## #tile (`place.hud.chatDefs#tile`)

Type: object

What an answer draws: a read tool and its arguments, as a canvas's tile names them. The page calls the tool (callTool) to draw it, so it always draws what is there now.

### Properties

- `arguments` (unknown, required): The tool's arguments, an object; at most 64 KiB as JSON.
- `artifact` (string): The key of the view artifact it is a version of, where the model named one: drawing the same key again is its next version.
  - Constraints: maxLength: 40
- `step` (string, required): The call of the step that drew it.
  - Constraints: maxLength: 64
- `title` (string): What the model calls what it draws.
  - Constraints: maxLength: 2000, maxGraphemes: 200
- `tool` (string, required)
  - Constraints: maxLength: 64, knownValues: describe_repo | describe_app | list_records | get_record | query | open_app

## #tileEvent (`place.hud.chatDefs#tileEvent`)

Type: object

The answer draws another tile.

### Properties

- `tile` (ref, required)
  - Reference: `#tile`
- `turn` (integer, required)
  - Constraints: minimum: 1

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "artifact": {
      "description": "Something the chat made, kept with it in versions: an app (a frame app not yet published, or published from the chat), or a view (a tile the model named).",
      "properties": {
        "key": {
          "description": "The model's name for it, unique in the chat: 1 to 40 of a-z, 0-9 and -.",
          "maxLength": 40,
          "minLength": 1,
          "type": "string"
        },
        "kind": {
          "knownValues": [
            "app",
            "view"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "latest": {
          "description": "Its newest version.",
          "minimum": 1,
          "type": "integer"
        },
        "name": {
          "description": "An app's name, a view's title, as its latest version has it.",
          "maxGraphemes": 200,
          "maxLength": 2000,
          "type": "string"
        },
        "published": {
          "ref": "#published",
          "type": "ref"
        },
        "versions": {
          "description": "The versions kept, oldest first: at most 10, the oldest dropped first, never a published one.",
          "items": {
            "ref": "#artifactVersion",
            "type": "ref"
          },
          "type": "array"
        }
      },
      "required": [
        "key",
        "kind",
        "name",
        "latest",
        "versions"
      ],
      "type": "object"
    },
    "artifactEvent": {
      "description": "The answer made a version of an artifact (made, with the artifact as it is now), or tried to and was refused (made with problems).",
      "properties": {
        "artifact": {
          "ref": "#artifact",
          "type": "ref"
        },
        "made": {
          "ref": "#artifactRef",
          "type": "ref"
        },
        "turn": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "turn",
        "made"
      ],
      "type": "object"
    },
    "artifactRef": {
      "description": "A version of an artifact a turn made, or a version it tried to make and was refused: its problems, and no version.",
      "properties": {
        "key": {
          "maxLength": 40,
          "minLength": 1,
          "type": "string"
        },
        "problems": {
          "description": "Why the version was refused, each problem in a line.",
          "items": {
            "ref": "#problem",
            "type": "ref"
          },
          "maxLength": 50,
          "type": "array"
        },
        "version": {
          "description": "The version made.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "key"
      ],
      "type": "object"
    },
    "artifactVersion": {
      "description": "A version of an artifact. An app's document is read with get_app_source, and drawn at /a/chat/<chat>/<key>/<version>; a view's is its tile.",
      "properties": {
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "edits": {
          "description": "With how edits, how many.",
          "minimum": 1,
          "type": "integer"
        },
        "how": {
          "description": "whole: given whole; edits: the version before it, changed by edits.",
          "knownValues": [
            "whole",
            "edits"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "name": {
          "description": "An app's name.",
          "maxGraphemes": 64,
          "maxLength": 640,
          "type": "string"
        },
        "origins": {
          "description": "The origins an app loads pictures and audio from; left out where it names none.",
          "items": {
            "ref": "place.hud.app#origin",
            "type": "ref"
          },
          "maxLength": 8,
          "type": "array"
        },
        "reads": {
          "description": "The public collections an app reads beyond its entries; left out where it names none.",
          "items": {
            "ref": "place.hud.app#collection",
            "type": "ref"
          },
          "maxLength": 16,
          "type": "array"
        },
        "summary": {
          "description": "An app's summary.",
          "maxGraphemes": 300,
          "maxLength": 3000,
          "type": "string"
        },
        "tile": {
          "description": "A view's tile.",
          "ref": "#tile",
          "type": "ref"
        },
        "turn": {
          "description": "The chat's turn that made it, where a turn did.",
          "minimum": 1,
          "type": "integer"
        },
        "version": {
          "minimum": 1,
          "type": "integer"
        },
        "writes": {
          "description": "The collections an app writes beyond its entries; left out where it names none.",
          "items": {
            "ref": "place.hud.app#collection",
            "type": "ref"
          },
          "maxLength": 8,
          "type": "array"
        }
      },
      "required": [
        "version",
        "createdAt",
        "how"
      ],
      "type": "object"
    },
    "chatSummary": {
      "description": "A chat, as the list of a person's chats shows it.",
      "properties": {
        "chat": {
          "description": "The chat's id: 12 hex digits.",
          "maxLength": 12,
          "minLength": 12,
          "type": "string"
        },
        "title": {
          "description": "Its first message, cut short.",
          "maxGraphemes": 200,
          "maxLength": 2000,
          "type": "string"
        },
        "updatedAt": {
          "description": "When its last message was written.",
          "format": "datetime",
          "type": "string"
        }
      },
      "required": [
        "chat",
        "title",
        "updatedAt"
      ],
      "type": "object"
    },
    "chatView": {
      "description": "A chat whole: every message, oldest first.",
      "properties": {
        "artifacts": {
          "description": "What the chat made, apps and views, oldest first, each with its versions.",
          "items": {
            "ref": "#artifact",
            "type": "ref"
          },
          "type": "array"
        },
        "chat": {
          "maxLength": 12,
          "minLength": 12,
          "type": "string"
        },
        "messages": {
          "items": {
            "ref": "#message",
            "type": "ref"
          },
          "type": "array"
        },
        "running": {
          "description": "Whether the model is answering its last message now: its progress comes on getChatEvents.",
          "type": "boolean"
        },
        "storage": {
          "ref": "#storage",
          "type": "ref"
        },
        "title": {
          "maxGraphemes": 200,
          "maxLength": 2000,
          "type": "string"
        }
      },
      "required": [
        "chat",
        "title",
        "messages",
        "running"
      ],
      "type": "object"
    },
    "doneEvent": {
      "description": "The answer is done, or ended early (error): the chat holds it whole now.",
      "properties": {
        "error": {
          "maxLength": 2000,
          "type": "string"
        },
        "turn": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "turn"
      ],
      "type": "object"
    },
    "message": {
      "description": "A message: the person's, or the model's answer to the one before.",
      "properties": {
        "artifacts": {
          "description": "The versions of the chat's artifacts the model's answer made, or tried to make and was refused, in order: an app's drawn as a card in the conversation.",
          "items": {
            "ref": "#artifactRef",
            "type": "ref"
          },
          "type": "array"
        },
        "createdAt": {
          "format": "datetime",
          "type": "string"
        },
        "error": {
          "description": "Why the model's answer ended before it was done, in a line.",
          "maxLength": 2000,
          "type": "string"
        },
        "role": {
          "knownValues": [
            "person",
            "model"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "steps": {
          "description": "The tool calls the model made for its answer, in order: none for a person's.",
          "items": {
            "ref": "#step",
            "type": "ref"
          },
          "type": "array"
        },
        "text": {
          "description": "What was written, as plain text with Markdown's emphasis, links and lists.",
          "maxLength": 10000,
          "type": "string"
        },
        "tiles": {
          "description": "What its answer draws, in order: none for a person's.",
          "items": {
            "ref": "#tile",
            "type": "ref"
          },
          "type": "array"
        },
        "turn": {
          "description": "The exchange it belongs to: a person's message and the answer after it share one.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "turn",
        "role",
        "text",
        "steps",
        "tiles"
      ],
      "type": "object"
    },
    "problem": {
      "description": "A problem with what the model gave, in a line.",
      "properties": {
        "message": {
          "maxLength": 2000,
          "type": "string"
        }
      },
      "required": [
        "message"
      ],
      "type": "object"
    },
    "published": {
      "description": "Where an app artifact was published from the chat (place.hud.publishChatArtifact): its place.hud.app record and its page.",
      "properties": {
        "cid": {
          "format": "cid",
          "type": "string"
        },
        "uri": {
          "format": "at-uri",
          "type": "string"
        },
        "url": {
          "description": "The app's page, /a/<handle>/<rkey> on this server.",
          "format": "uri",
          "type": "string"
        },
        "version": {
          "description": "The version published last.",
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "uri",
        "cid",
        "url",
        "version"
      ],
      "type": "object"
    },
    "step": {
      "description": "A tool call the model made.",
      "properties": {
        "arguments": {
          "description": "What it was called with, an object.",
          "type": "unknown"
        },
        "call": {
          "description": "The call's id, the same on each event about it.",
          "maxLength": 64,
          "type": "string"
        },
        "ms": {
          "description": "How long it took, once done or failed.",
          "minimum": 0,
          "type": "integer"
        },
        "status": {
          "knownValues": [
            "running",
            "done",
            "failed"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "summary": {
          "description": "The tool's own short summary of its answer, or why it failed.",
          "maxLength": 2000,
          "type": "string"
        },
        "tool": {
          "description": "The tool, by its MCP name.",
          "maxLength": 64,
          "type": "string"
        }
      },
      "required": [
        "call",
        "tool",
        "status"
      ],
      "type": "object"
    },
    "stepEvent": {
      "description": "A step began, or ended: the step as it is now, replacing the one of its id.",
      "properties": {
        "step": {
          "ref": "#step",
          "type": "ref"
        },
        "turn": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "turn",
        "step"
      ],
      "type": "object"
    },
    "storage": {
      "description": "Where the chat is kept: in a space of the person's own on their PDS (space, its uri), or in this server's files (file, and why).",
      "properties": {
        "kind": {
          "knownValues": [
            "space",
            "file"
          ],
          "maxLength": 32,
          "type": "string"
        },
        "reason": {
          "description": "Why it is in this server's files, in a line.",
          "maxLength": 2000,
          "type": "string"
        },
        "uri": {
          "description": "The space, at:space/<did>/place.hud.chat/<chat>.",
          "maxLength": 2000,
          "type": "string"
        }
      },
      "required": [
        "kind"
      ],
      "type": "object"
    },
    "textEvent": {
      "description": "More of the model's answer's words, to add to what came before.",
      "properties": {
        "text": {
          "maxLength": 10000,
          "type": "string"
        },
        "turn": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "turn",
        "text"
      ],
      "type": "object"
    },
    "tile": {
      "description": "What an answer draws: a read tool and its arguments, as a canvas's tile names them. The page calls the tool (callTool) to draw it, so it always draws what is there now.",
      "properties": {
        "arguments": {
          "description": "The tool's arguments, an object; at most 64 KiB as JSON.",
          "type": "unknown"
        },
        "artifact": {
          "description": "The key of the view artifact it is a version of, where the model named one: drawing the same key again is its next version.",
          "maxLength": 40,
          "type": "string"
        },
        "step": {
          "description": "The call of the step that drew it.",
          "maxLength": 64,
          "type": "string"
        },
        "title": {
          "description": "What the model calls what it draws.",
          "maxGraphemes": 200,
          "maxLength": 2000,
          "type": "string"
        },
        "tool": {
          "knownValues": [
            "describe_repo",
            "describe_app",
            "list_records",
            "get_record",
            "query",
            "open_app"
          ],
          "maxLength": 64,
          "type": "string"
        }
      },
      "required": [
        "step",
        "tool",
        "arguments"
      ],
      "type": "object"
    },
    "tileEvent": {
      "description": "The answer draws another tile.",
      "properties": {
        "tile": {
          "ref": "#tile",
          "type": "ref"
        },
        "turn": {
          "minimum": 1,
          "type": "integer"
        }
      },
      "required": [
        "turn",
        "tile"
      ],
      "type": "object"
    }
  },
  "description": "What the chat's methods and its event stream hold: a chat, its messages, the steps a model took and the tiles it drew.",
  "id": "place.hud.chatDefs",
  "lexicon": 1
}
```
