mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-25 14:11:12 +00:00
- WebChatRoute (sessionKey + normalized agentID) replaces string tracking in WebChatManager; window/panel reuse compares the full route; session-key callbacks retain the explicit agent and guard against stale controllers - WebChatSwiftUIWindowController gains agentID; explicit selection feeds the existing MacGatewayChatTransport(defaultGlobalAgentID:)/initialActiveAgentID seams and is pinned against gateway-default refreshes - AppNavigationActions.openChat(sessionKey:agentID:) route-aware; Quick Chat's Command-Return opens the accepted route's agent conversation (global scope included), retiring the v2 tradeoff comment - tests: route reuse identity, explicit-vs-default precedence, navigation seam
54 lines
1.7 KiB
Swift
54 lines
1.7 KiB
Swift
import AppKit
|
|
|
|
@MainActor
|
|
enum AppNavigationActions {
|
|
static func openDashboard() {
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
if DashboardManager.shared.showConfiguredWindowIfPossible() {
|
|
return
|
|
}
|
|
Task { @MainActor in
|
|
if DashboardManager.shared.showConfiguredWindowIfPossible() {
|
|
return
|
|
}
|
|
do {
|
|
try await DashboardManager.shared.show()
|
|
} catch {
|
|
DashboardManager.shared.showFailure(error)
|
|
}
|
|
}
|
|
}
|
|
|
|
static func openChat(sessionKey: String? = nil, agentID: String? = nil) {
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
Task { @MainActor in
|
|
let resolvedSessionKey = if let sessionKey {
|
|
sessionKey
|
|
} else {
|
|
await WebChatManager.shared.preferredSessionKey()
|
|
}
|
|
WebChatManager.shared.show(sessionKey: resolvedSessionKey, agentID: agentID)
|
|
}
|
|
}
|
|
|
|
static func toggleCanvas() {
|
|
NSApp.activate(ignoringOtherApps: true)
|
|
Task { @MainActor in
|
|
if AppStateStore.shared.canvasPanelVisible {
|
|
CanvasManager.shared.hideAll()
|
|
} else {
|
|
let sessionKey = await GatewayConnection.shared.mainSessionKey()
|
|
_ = try? CanvasManager.shared.show(sessionKey: sessionKey, path: nil)
|
|
}
|
|
}
|
|
}
|
|
|
|
static func openSettings(tab: SettingsTab = .general) {
|
|
SettingsTabRouter.request(tab)
|
|
SettingsWindowOpener.shared.open()
|
|
DispatchQueue.main.async {
|
|
NotificationCenter.default.post(name: .openclawSelectSettingsTab, object: tab)
|
|
}
|
|
}
|
|
}
|