惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

爱范儿
爱范儿
MyScale Blog
MyScale Blog
Recent Announcements
Recent Announcements
N
Netflix TechBlog - Medium
GbyAI
GbyAI
Vercel News
Vercel News
The GitHub Blog
The GitHub Blog
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Visual Studio Blog
Martin Fowler
Martin Fowler
腾讯CDC
大猫的无限游戏
大猫的无限游戏
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
J
Java Code Geeks
WordPress大学
WordPress大学
P
Proofpoint News Feed
雷峰网
雷峰网
酷 壳 – CoolShell
酷 壳 – CoolShell
有赞技术团队
有赞技术团队
人人都是产品经理
人人都是产品经理
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Y
Y Combinator Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
feat: add native mac dashboard window · openclaw/openclaw...
steipete · 2026-05-17 · via Recent Commits to openclaw:main

@@ -0,0 +1,120 @@

1+

import AppKit

2+

import Foundation

3+

import OpenClawKit

4+

import OSLog

5+6+

private let dashboardManagerLogger = Logger(subsystem: "ai.openclaw", category: "DashboardManager")

7+8+

@MainActor

9+

final class DashboardManager {

10+

static let shared = DashboardManager()

11+12+

private var controller: DashboardWindowController?

13+14+

private init() {}

15+16+

@discardableResult

17+

func showConfiguredWindowIfPossible() -> Bool {

18+

let mode = AppStateStore.shared.connectionMode

19+

guard let config = self.immediateDashboardConfig(mode: mode),

20+

let url = try? GatewayEndpointStore.dashboardURL(

21+

for: config,

22+

mode: mode,

23+

authToken: config.token)

24+

else {

25+

return false

26+

}

27+

let auth = DashboardWindowAuth(

28+

gatewayUrl: Self.websocketURLString(for: url),

29+

token: config.token,

30+

password: config.password?.trimmingCharacters(in: .whitespacesAndNewlines).nonEmpty)

31+

guard auth.hasCredential else {

32+

return false

33+

}

34+

if let controller {

35+

controller.show(url: url, auth: auth)

36+

} else {

37+

let controller = DashboardWindowController(url: url, auth: auth)

38+

self.controller = controller

39+

controller.show(url: url, auth: auth)

40+

}

41+

Task { _ = try? await ControlChannel.shared.health(timeout: 3) }

42+

return true

43+

}

44+45+

func show() async throws {

46+

let mode = AppStateStore.shared.connectionMode

47+

dashboardManagerLogger.info("dashboard show requested mode=\(String(describing: mode), privacy: .public)")

48+

let config = try await self.dashboardConfig(mode: mode)

49+

dashboardManagerLogger.info("dashboard config url=\(config.url.absoluteString, privacy: .public)")

50+

let token = await GatewayConnection.shared.controlUiAutoAuthToken(config: config)

51+

let url = try GatewayEndpointStore.dashboardURL(for: config, mode: mode, authToken: token)

52+

let auth = DashboardWindowAuth(

53+

gatewayUrl: Self.websocketURLString(for: url),

54+

token: token,

55+

password: config.password?.trimmingCharacters(in: .whitespacesAndNewlines).nonEmpty)

56+57+

if let controller {

58+

dashboardManagerLogger.info("dashboard reuse window url=\(url.absoluteString, privacy: .public)")

59+

controller.show(url: url, auth: auth)

60+

return

61+

}

62+63+

dashboardManagerLogger.info("dashboard create window url=\(url.absoluteString, privacy: .public)")

64+

let controller = DashboardWindowController(url: url, auth: auth)

65+

self.controller = controller

66+

controller.show(url: url, auth: auth)

67+68+

// Refresh the cached hello payload without blocking window creation.

69+

Task { _ = try? await ControlChannel.shared.health(timeout: 3) }

70+

}

71+72+

func close() {

73+

self.controller?.closeDashboard()

74+

}

75+76+

private static func websocketURLString(for dashboardURL: URL) -> String {

77+

guard var components = URLComponents(url: dashboardURL, resolvingAgainstBaseURL: false) else {

78+

return dashboardURL.absoluteString

79+

}

80+

switch components.scheme?.lowercased() {

81+

case "https":

82+

components.scheme = "wss"

83+

default:

84+

components.scheme = "ws"

85+

}

86+

components.queryItems = nil

87+

components.fragment = nil

88+

return components.url?.absoluteString ?? dashboardURL.absoluteString

89+

}

90+91+

private func dashboardConfig(mode: AppState.ConnectionMode) async throws -> GatewayConnection.Config {

92+

if let config = self.immediateDashboardConfig(mode: mode) {

93+

return config

94+

}

95+96+

return try await Task.detached(priority: .userInitiated) {

97+

await GatewayEndpointStore.shared.refresh()

98+

return try await GatewayEndpointStore.shared.requireConfig()

99+

}.value

100+

}

101+102+

private func immediateDashboardConfig(mode: AppState.ConnectionMode) -> GatewayConnection.Config? {

103+

let root = OpenClawConfigFile.loadDict()

104+

if mode == .remote,

105+

GatewayRemoteConfig.resolveTransport(root: root) == .direct,

106+

let url = GatewayRemoteConfig.resolveGatewayUrl(root: root)

107+

{

108+

return (

109+

url,

110+

GatewayRemoteConfig.resolveTokenString(root: root),

111+

GatewayRemoteConfig.resolvePasswordString(root: root))

112+

}

113+114+

if mode == .local {

115+

return GatewayEndpointStore.localConfig()

116+

}

117+118+

return nil

119+

}

120+

}