



























@@ -5,6 +5,7 @@ struct CommandCenterTab: View {
55@Environment(NodeAppModel.self) private var appModel
66@Environment(\.colorScheme) private var colorScheme
77@Environment(\.scenePhase) private var scenePhase
8+@State private var defaultChatSessionEntry: OpenClawChatSessionEntry?
89@State private var recentChatSessions: [OpenClawChatSessionEntry] = []
910var openChat: () -> Void
1011var openSettings: () -> Void
@@ -44,6 +45,7 @@ struct CommandCenterTab: View {
4445VStack(alignment: .leading, spacing: 10) {
4546self.header
4647self.gatewayCard
48+self.defaultChatSessionSection
4749self.pendingApprovals
4850self.recentSessions
4951self.liveActivity
@@ -152,6 +154,30 @@ struct CommandCenterTab: View {
152154.padding(.horizontal, 10)
153155}
154156157+private var defaultChatSessionSection: some View {
158+CommandPanel(padding: 0) {
159+VStack(spacing: 0) {
160+self.cardHeader(
161+ title: "Agent session",
162+ value: nil,
163+ color: OpenClawBrand.accent)
164+.padding(.horizontal, 12)
165+.padding(.top, 10)
166+.padding(.bottom, 3)
167+168+Button {
169+self.open(.chat(nil))
170+} label: {
171+CommandSessionRow(item: self.defaultChatWorkItem)
172+}
173+.buttonStyle(.plain)
174+.padding(.horizontal, 10)
175+.padding(.bottom, 10)
176+}
177+}
178+.padding(.horizontal, OpenClawProMetric.pagePadding)
179+}
180+155181private var pendingApprovals: some View {
156182self.pendingApprovalsContent
157183.padding(.horizontal, OpenClawProMetric.pagePadding)
@@ -424,6 +450,27 @@ struct CommandCenterTab: View {
424450self.colorScheme == .dark ? Color.black.opacity(0.12) : Color.black.opacity(0.022)
425451}
426452453+private var defaultChatWorkItem: WorkItem {
454+let isOpen = self.appModel.chatSessionKey == self.appModel.defaultChatSessionKey
455+return WorkItem(
456+ id: "default-chat",
457+ icon: isOpen ? "bubble.left.and.text.bubble.right.fill" : "bubble.left.fill",
458+ title: self.appModel.activeAgentName,
459+ detail: self.defaultChatActivityText,
460+ state: isOpen ? "open" : "default",
461+ trailing: "chat",
462+ color: isOpen ? OpenClawBrand.accent : OpenClawBrand.ok,
463+ progress: nil,
464+ route: .chat(nil))
465+}
466+467+private var defaultChatActivityText: String {
468+guard let updatedAt = self.defaultChatSessionEntry?.updatedAt, updatedAt > 0 else {
469+return "No recent activity"
470+}
471+return Self.relativeTimeText(forMilliseconds: updatedAt)
472+}
473+427474private var recentSessionRows: [WorkItem] {
428475self.sessionItems
429476}
@@ -485,6 +532,7 @@ struct CommandCenterTab: View {
485532let currentSessionKey = self.appModel.chatSessionKey
486533return self.recentChatSessions
487534.filter { !Self.isHiddenInternalSession($0.key) }
535+.filter { $0.key != self.appModel.defaultChatSessionKey }
488536.map { session in
489537Self.sessionWorkItem(for: session, currentSessionKey: currentSessionKey)
490538}
@@ -503,6 +551,9 @@ struct CommandCenterTab: View {
503551private func refreshRecentSessionsIfNeeded() async {
504552guard self.scenePhase == .active else { return }
505553guard self.appModel.isOperatorGatewayConnected else {
554+if self.defaultChatSessionEntry != nil {
555+self.defaultChatSessionEntry = nil
556+}
506557if !self.recentChatSessions.isEmpty {
507558self.recentChatSessions = []
508559}
@@ -512,29 +563,38 @@ struct CommandCenterTab: View {
512563do {
513564let transport = IOSGatewayChatTransport(gateway: appModel.operatorSession)
514565let response = try await transport.listSessions(limit: 20)
566+self.defaultChatSessionEntry = response.sessions.first {
567+ $0.key == self.appModel.defaultChatSessionKey
568+}
515569self.recentChatSessions = Self.sessionChoices(
516570 response.sessions,
517- currentSessionKey: self.appModel.chatSessionKey)
571+ currentSessionKey: self.appModel.chatSessionKey,
572+ defaultSessionKey: self.appModel.defaultChatSessionKey)
518573} catch {
574+self.defaultChatSessionEntry = nil
519575self.recentChatSessions = []
520576}
521577}
522578523579private static func sessionChoices(
524580 _ sessions: [OpenClawChatSessionEntry],
525- currentSessionKey: String) -> [OpenClawChatSessionEntry]
581+ currentSessionKey: String,
582+ defaultSessionKey: String) -> [OpenClawChatSessionEntry]
526583{
527584let sorted = sessions.sorted { ($0.updatedAt ?? 0) > ($1.updatedAt ?? 0) }
528585var result: [OpenClawChatSessionEntry] = []
529586var included = Set<String>()
530587531-if let current = sorted.first(where: { $0.key == currentSessionKey }) {
588+if currentSessionKey != defaultSessionKey,
589+let current = sorted.first(where: { $0.key == currentSessionKey })
590+{
532591 result.append(current)
533592 included.insert(current.key)
534593}
535594536595for session in sorted {
537596guard !included.contains(session.key) else { continue }
597+guard session.key != defaultSessionKey else { continue }
538598guard !Self.isHiddenInternalSession(session.key) else { continue }
539599 result.append(session)
540600 included.insert(session.key)
@@ -554,7 +614,7 @@ struct CommandCenterTab: View {
554614 icon: isCurrent ? "bubble.left.and.text.bubble.right.fill" : "bubble.left.fill",
555615 title: Self.sessionTitle(session),
556616 detail: Self.sessionDetail(session),
557- state: isCurrent ? "current" : "recent",
617+ state: isCurrent ? "open" : "recent",
558618 trailing: "chat",
559619 color: isCurrent ? OpenClawBrand.accent : OpenClawBrand.ok,
560620 progress: nil,
@@ -765,6 +825,7 @@ private struct CommandSessionsScreen: View {
765825private var sessionRows: [CommandCenterTab.WorkItem] {
766826self.sessions
767827.filter { !CommandCenterTab.isHiddenInternalSession($0.key) }
828+.filter { $0.key != self.appModel.defaultChatSessionKey }
768829.sorted { ($0.updatedAt ?? 0) > ($1.updatedAt ?? 0) }
769830.map {
770831CommandCenterTab.sessionWorkItem(
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。