mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-17 16:12:21 -06:00
76cb418b6f
* fix(macos): let onboarding replace an auto-connected AI The AI page auto-tests the best detected candidate and connects without asking, then hides every alternative route. Add 'Choose a different AI' to the connected banner: a re-detect pass with auto-activation suppressed that ends at the picker (candidates, provider sign-in, API keys). Also disable the manual key Connect button while another test runs (submitManualKey silently dropped the tap), and isolate a test that read the machine's real resume store. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * fix(macos): surface real daemon errors past the Node banner Gateway daemon failures summarized as 'Node.js v26.5.1' because the summary takes the last non-empty line and Node fatal errors end with a version banner. Drop trailing banner lines and prefer the last error-shaped line above them; all other output keeps its last line. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * feat(macos): hand onboarding off to the dashboard custodian Native onboarding now ends once inference verifies: welcome, connection, install (when needed), AI setup. Finish opens the dashboard at /custodian?onboarding=1, where the custodian onboarding owns memory import, channels, app recommendations, and the hatch (browser-first per the onboarding redesign). The native memory-import and permissions pages leave the first-run flow; 'Set up later' keeps the native ready page. The native navigation bridge gains a validated optional search field so the handoff can request onboarding chrome; the URL fallback carries the query alongside the token fragment. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> * refactor(macos): delete the unreachable native memory-import module The dashboard handoff removed the memory-import page from every flow, leaving the module reachable only from tests. CI's dead-code scan rightly flagged the first orphans; remove the whole path (model, page, mascot wiring, tests) instead of trimming symbol by symbol. The dashboard's own memory-import surface owns the feature. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> --------- Co-authored-by: Peter Steinberger <steipete@mac-studio-sf2.local> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
112 lines
3.8 KiB
Swift
112 lines
3.8 KiB
Swift
import AppKit
|
|
import Foundation
|
|
import OSLog
|
|
|
|
let dashboardWindowLogger = Logger(subsystem: "ai.openclaw", category: "DashboardWindow")
|
|
|
|
enum DashboardWindowLayout {
|
|
static let windowSize = NSSize(width: 1240, height: 860)
|
|
static let mainBrowserMinWidth: CGFloat = 601
|
|
static let linkBrowserMinWidth: CGFloat = 320
|
|
static let windowMinSize = NSSize(
|
|
width: DashboardWindowLayout.mainBrowserMinWidth + DashboardWindowLayout.linkBrowserMinWidth + 1,
|
|
height: 620)
|
|
static let linkBrowserPreferredFraction: CGFloat = 0.5
|
|
static let linkBrowserTabBarHeight: CGFloat = 30
|
|
static let linkBrowserToolbarHeight: CGFloat = 52
|
|
static let linkBrowserToolbarWithTabsHeight: CGFloat = 78
|
|
static let linkBrowserWidthDefaultsKey = "OpenClawDashboardLinkBrowserWidth"
|
|
static let windowFrameAutosaveName = "OpenClawDashboardWindow"
|
|
|
|
static func linkBrowserWidth(
|
|
splitWidth: CGFloat,
|
|
dividerThickness: CGFloat,
|
|
persistedWidth: CGFloat?) -> CGFloat
|
|
{
|
|
let availableWidth = max(0, splitWidth - dividerThickness)
|
|
let maximumWidth = max(0, availableWidth - self.mainBrowserMinWidth)
|
|
guard maximumWidth >= self.linkBrowserMinWidth else { return maximumWidth }
|
|
let preferredWidth = if let persistedWidth, persistedWidth.isFinite, persistedWidth > 0 {
|
|
persistedWidth
|
|
} else {
|
|
availableWidth * self.linkBrowserPreferredFraction
|
|
}
|
|
return min(max(preferredWidth, self.linkBrowserMinWidth), maximumWidth)
|
|
}
|
|
|
|
static func dividerMoved(from originalPosition: CGFloat?, to finalPosition: CGFloat?) -> Bool {
|
|
guard let originalPosition, let finalPosition else { return false }
|
|
return abs(finalPosition - originalPosition) >= 0.5
|
|
}
|
|
}
|
|
|
|
/// Raw values are window event names the Control UI handles. `newSession`
|
|
/// reuses the shipped pre-web-chrome event; `commandPalette` gets a dedicated
|
|
/// toggle event because the legacy `native-open-search` contract is open-only.
|
|
enum DashboardNativeCommand: String {
|
|
case newSession = "openclaw:native-new-session"
|
|
case commandPalette = "openclaw:native-toggle-search"
|
|
|
|
/// Older gateway bundles lack the toggle listener; dispatch degrades to the
|
|
/// open-only legacy event when the primary event goes unhandled.
|
|
var legacyFallbackEventName: String? {
|
|
switch self {
|
|
case .newSession: nil
|
|
case .commandPalette: "openclaw:native-open-search"
|
|
}
|
|
}
|
|
|
|
var supersedesPendingNavigation: Bool {
|
|
self == .newSession
|
|
}
|
|
}
|
|
|
|
struct DashboardNativeNavigation: Equatable {
|
|
let path: String
|
|
var search: String?
|
|
let fallbackURL: URL
|
|
}
|
|
|
|
enum DashboardLinkTarget: String, Equatable {
|
|
case inline
|
|
case external
|
|
}
|
|
|
|
enum DashboardTargetlessNavigationAction: Equatable {
|
|
case allow
|
|
case openExternal
|
|
case cancel
|
|
}
|
|
|
|
enum DashboardNewWindowAction: Equatable {
|
|
case openTab(URL)
|
|
case openExternal(URL)
|
|
case ignore
|
|
}
|
|
|
|
struct DashboardLinkRequest: Equatable {
|
|
let url: URL
|
|
let target: DashboardLinkTarget
|
|
}
|
|
|
|
struct DashboardWindowAuth: Equatable {
|
|
var gatewayUrl: String?
|
|
var token: String?
|
|
var password: String?
|
|
|
|
var hasCredential: Bool {
|
|
self.token?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false ||
|
|
self.password?.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty == false
|
|
}
|
|
}
|
|
|
|
/// Dashboard URLs carry the auth token in the `#token=...` fragment; strip the
|
|
/// fragment before logging so credentials never land in unified logs.
|
|
func dashboardLogString(for url: URL) -> String {
|
|
guard var components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
|
|
return "<unparseable-url>"
|
|
}
|
|
components.fragment = nil
|
|
return components.url?.absoluteString ?? "<unparseable-url>"
|
|
}
|