sketch: Introduce versions for sketch state
diff --git a/loop/server/loophttp.go b/loop/server/loophttp.go
index fa253e0..5047782 100644
--- a/loop/server/loophttp.go
+++ b/loop/server/loophttp.go
@@ -51,6 +51,9 @@
 }
 
 type State struct {
+	// null or 1: "old"
+	// 2: supports SSE for message updates
+	StateVersion         int                           `json:"state_version"`
 	MessageCount         int                           `json:"message_count"`
 	TotalUsage           *conversation.CumulativeUsage `json:"total_usage,omitempty"`
 	InitialCommit        string                        `json:"initial_commit"`
@@ -1059,6 +1062,7 @@
 	totalUsage := s.agent.TotalUsage()
 
 	return State{
+		StateVersion:         2,
 		MessageCount:         serverMessageCount,
 		TotalUsage:           &totalUsage,
 		Hostname:             s.hostname,
diff --git a/webui/src/fixtures/dummy.ts b/webui/src/fixtures/dummy.ts
index f18acf7..39148cd 100644
--- a/webui/src/fixtures/dummy.ts
+++ b/webui/src/fixtures/dummy.ts
@@ -343,6 +343,7 @@
 ];
 
 export const initialState: State = {
+  state_version: 2,
   message_count: initialMessages.length,
   total_usage: {
     start_time: "2025-04-24T10:32:00.679057+01:00",
diff --git a/webui/src/types.ts b/webui/src/types.ts
index 78a73b0..e7f7dbc 100644
--- a/webui/src/types.ts
+++ b/webui/src/types.ts
@@ -61,6 +61,7 @@
 }
 
 export interface State {
+	state_version: number;
 	message_count: number;
 	total_usage?: CumulativeUsage | null;
 	initial_commit: string;
diff --git a/webui/src/web-components/sketch-app-shell.ts b/webui/src/web-components/sketch-app-shell.ts
index c9553b4..0b58a10 100644
--- a/webui/src/web-components/sketch-app-shell.ts
+++ b/webui/src/web-components/sketch-app-shell.ts
@@ -331,6 +331,7 @@
 
   @property({ attribute: false })
   containerState: State = {
+    state_version: 2,
     title: "",
     os: "",
     message_count: 0,
diff --git a/webui/src/web-components/sketch-container-status.test.ts b/webui/src/web-components/sketch-container-status.test.ts
index f8dc685..d3c2a32 100644
--- a/webui/src/web-components/sketch-container-status.test.ts
+++ b/webui/src/web-components/sketch-container-status.test.ts
@@ -4,6 +4,7 @@
 
 // Mock complete state for testing
 const mockCompleteState: State = {
+  state_version: 2,
   hostname: "test-host",
   working_dir: "/test/dir",
   initial_commit: "abcdef1234567890",
@@ -78,6 +79,7 @@
 
 test("renders with partial state data", async ({ mount }) => {
   const partialState: Partial<State> = {
+    state_version: 2,
     hostname: "partial-host",
     message_count: 10,
     os: "linux",