Repository Public
1// Author: Simon-Pierre Boucher — contact@spboucher.ai2// File: Packages/LocalChatUI/Sources/Features/Shell/AppRouter.swift3// Description: Navigation state of one window / scene: current section, selected conversation, inspector and command palette visibility.4import Foundation5import Observation6import LocalChatCore78@MainActor @Observable9public final class AppRouter {10 public var section: AppSection = .chat11 public var conversationID: UUID?12 public var showInspector = false13 public var showPalette = false14 /// iPhone navigation path of the Chats tab.15 public var chatPath: [UUID] = []1617 public init() {}1819 public func open(conversation id: UUID) {20 section = .chat; conversationID = id21 if chatPath.last != id { chatPath = [id] }22 }23 public func open(_ section: AppSection) { self.section = section }2425 public func newChat(in app: AppModel, agent: AgentConfiguration? = nil) {26 open(conversation: app.newConversation(agent: agent).id)27 }28}29