+// ViewLayout splits the view of a turn request into user messages that only
+// grow between batches. The view goes out as the same messages as in the
+// request before, while their lines give the same text, and the new lines
+// follow as one new message. So the end of the view of each earlier turn stays
+// a message end. Stable message boundaries let the model reuse the unchanged
+// view prefix from its prompt cache instead of invalidating it when new lines
+// arrive.
+//
+// The first message starts with "<chat>\n". The closing tag goes into the state
+// message after the view, so that no view message changes when lines come. The
+// layout keeps the line count and a hash of the text of each message in
+// layout.json, so it outlives a restart.
+type ViewLayout struct {
+ path string
+ Messages []ViewLayoutMessage `json:"messages"`
+}
+
+// ViewLayoutMessage is one view message: its number of lines and the hash of
+// its text.
+type ViewLayoutMessage struct {
+ Lines int `json:"lines"`
+ Hash string `json:"hash"`
+}
+