mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-18 03:27:08 +00:00
- Copy a session citation from the list (native parity with the web reference text) and open the paired session list via hapicompanion://sessions. - Load hub-wide custom Claude models in New Session with machine-catalog fallback, and show the transcript-resolved model in chat chrome. - Render synthetic Claude API failures as error events instead of leaking the <synthetic> model or zero usage into the context meter. - Refresh the session list returning from chat, request the list from Home, and update the home widget surfaces. via [HAPI](https://hapi.run) Co-Authored-By: HAPI <noreply@hapi.run> Co-Authored-By: Claude Code <noreply@anthropic.com>
41 lines
1.3 KiB
Swift
41 lines
1.3 KiB
Swift
import Observation
|
|
import SwiftUI
|
|
|
|
/// In-memory navigation for one hub's iPad workspace. Window geometry never
|
|
/// owns selection: filtering, collapsing and reopening the sidebar must not
|
|
/// discard the selected chat or its nested file/process navigation.
|
|
@MainActor @Observable
|
|
final class SessionNavigationState {
|
|
private(set) var selectedSessionId: String?
|
|
var detailPath = NavigationPath()
|
|
var columnVisibility: NavigationSplitViewVisibility = .all
|
|
var preferredCompactColumn: NavigationSplitViewColumn = .sidebar
|
|
|
|
func open(_ sessionId: String) {
|
|
if selectedSessionId != sessionId {
|
|
detailPath = NavigationPath()
|
|
selectedSessionId = sessionId
|
|
}
|
|
// Also works for notifications/new sessions not yet in the list.
|
|
preferredCompactColumn = .detail
|
|
}
|
|
|
|
func showList() {
|
|
detailPath = NavigationPath()
|
|
selectedSessionId = nil
|
|
preferredCompactColumn = .sidebar
|
|
}
|
|
|
|
func supersede(_ sessionId: String, with replacement: String) {
|
|
guard selectedSessionId == sessionId else { return }
|
|
open(replacement)
|
|
}
|
|
|
|
func remove(_ sessionId: String) {
|
|
guard selectedSessionId == sessionId else { return }
|
|
detailPath = NavigationPath()
|
|
selectedSessionId = nil
|
|
preferredCompactColumn = .sidebar
|
|
}
|
|
}
|