sketch-app-shell: nav to /messages/ on sessionEnd

Fixes https://github.com/boldsoftware/bold/issues/457
diff --git a/webui/src/web-components/sketch-app-shell-base.ts b/webui/src/web-components/sketch-app-shell-base.ts
index b6963be..7e18ca6 100644
--- a/webui/src/web-components/sketch-app-shell-base.ts
+++ b/webui/src/web-components/sketch-app-shell-base.ts
@@ -119,7 +119,7 @@
 
   private _slug: string = "";
 
-  private dataManager = new DataManager();
+  dataManager = new DataManager();
 
   @property({ attribute: false })
   containerState: State = {
@@ -727,25 +727,7 @@
 
       // After successful response, redirect to messages view
       // Extract the session ID from the URL
-      const currentUrl = window.location.href;
-      // The URL pattern should be like https://sketch.dev/s/cs71-8qa6-1124-aw79/
-      const urlParts = currentUrl.split("/");
-      let sessionId = "";
-
-      // Find the session ID in the URL (should be after /s/)
-      for (let i = 0; i < urlParts.length; i++) {
-        if (urlParts[i] === "s" && i + 1 < urlParts.length) {
-          sessionId = urlParts[i + 1];
-          break;
-        }
-      }
-
-      if (sessionId) {
-        // Create the messages URL
-        const messagesUrl = `/messages/${sessionId}`;
-        // Redirect to messages view
-        window.location.href = messagesUrl;
-      }
+      await this.navigateToMessagesArchiveView();
 
       // End request sent - connection will be closed by server
     } catch (error) {
@@ -753,6 +735,28 @@
     }
   }
 
+  async navigateToMessagesArchiveView(): Promise<void> {
+    const currentUrl = window.location.href;
+    // The URL pattern should be like https://sketch.dev/s/cs71-8qa6-1124-aw79/
+    const urlParts = currentUrl.split("/");
+    let sessionId = "";
+
+    // Find the session ID in the URL (should be after /s/)
+    for (let i = 0; i < urlParts.length; i++) {
+      if (urlParts[i] === "s" && i + 1 < urlParts.length) {
+        sessionId = urlParts[i + 1];
+        break;
+      }
+    }
+
+    if (sessionId) {
+      // Create the messages URL
+      const messagesUrl = `/messages/${sessionId}`;
+      // Redirect to messages view
+      window.location.href = messagesUrl;
+    }
+  }
+
   async _handlePushRebaseRequest(e: CustomEvent) {
     const chatInput = this.querySelector(
       "sketch-chat-input",
diff --git a/webui/src/web-components/sketch-app-shell.ts b/webui/src/web-components/sketch-app-shell.ts
index facbba2..1c12b2c 100644
--- a/webui/src/web-components/sketch-app-shell.ts
+++ b/webui/src/web-components/sketch-app-shell.ts
@@ -5,6 +5,18 @@
 
 @customElement("sketch-app-shell")
 export class SketchAppShell extends SketchAppShellBase {
+  connectedCallback(): void {
+    super.connectedCallback();
+
+    this.dataManager.addEventListener("sessionEnded", () => {
+      this.handleSessionEnded();
+    });
+  }
+
+  async handleSessionEnded() {
+    await this.navigateToMessagesArchiveView();
+  }
+
   render() {
     return html`
       <!-- Main container: flex column, full height, system font, hidden overflow-x -->