Skip to content

Commit 3fa253a

Browse files
feat(macos): use the signed-in person's saved session pins
* fix: use your sidebar pins when listing and organizing chats * test: verify private pins survive stale sidebar edits without exposing drafts * fix: keep native pin order private and warm roster reads profile-scoped * fix: reconcile native histories and subscriber events with the pin owner * fix: negotiate native pin ownership and preserve legacy undo * fix: negotiate integration pins and align descriptions, archive guards and pin order * fix: keep historical session message envelopes byte compatible * fix: retain legacy owner-first rows and read-only Mac pin order * fix(android): retain saved order in personal pin sections * style(android): align session pin changes with Kotlin lint * fix: keep personal pins within display and retention authority * fix: reconcile legacy and requester-scoped pin views across clients * fix(native): wait for Gateway snooze expiry before refreshing personal pins * fix(clients): keep personal pin actions and wake projections in sync * fix(android): refresh off-window pin searches without changing the roster * fix(android): keep active drawer and archived threads independently visible * test: account for requester pin boundary regressions * fix(sessions): refresh pinned roster windows and preserve stale drop targets * fix(sessions): guard new pin placement and refresh expiring roster windows * test(gateway): assert shared pin omission on serialized session changes * fix: keep personal session pins consistent across clock and sharing changes * fix(web): keep sidebar and table pins on the same Gateway deadline * fix(sessions): preserve local roster windows and recover a failed pin wake * fix(ui): keep the held session window deadline across pagination * fix(sessions): keep native Restore distinct from personal Archive Undo * fix: keep native Archive available without a personal profile * fix: tell Mac users when a pin reorder target has disappeared * fix: confirm a private pin did not change while archiving * fix: restore the last confirmed Mac pin order after a conflict * fix: explain how to make room when a personal pin does not fit * fix(android): refresh a retained selected thread’s personal pin * fix(gateway): omit legacy pin timestamps from personal-client patch receipts * fix(android): show the roster while a selected pin is being read * fix(android): place the retained selection at its actual cursor rank * fix(mac): preserve group edits and confirmed pin reorders * fix(mac): preserve personal pin rank in the Threads sheet * fix(sessions): use the requesting person's saved pin order across tools and clients OpenClaw-Publication: 3fc99fa1-075c-81fb-ad0b-1b1dfcb59c7e * refactor(sessions): split personal Archive and Undo out of pin parity Restore the base lifecycle engine, native Archive/Restore path and Mac Undo suite. Preserve requester pin ordering, compatibility and private patch receipts. Keep the shared and personal assertions in the router permission regression. The unchanged Mac Undo payload is not equivalent on a personal-pin connection. The signed comparison catches this compatibility boundary; keep the candidate in draft. * Publish openclaw/brisk-lobster OpenClaw-Publication: 170e80fa-4c8b-86f0-925f-774552adb696 * Bind explicit Mac Archive Undo to the committed shared-pin occurrence * fix(sessions): gate native pin edits and archive undo on current authority * fix(sessions): preserve admitted archive settlement and disable legacy Mac pin actions * fix(sessions): invalidate cached pin selection when the clock rewinds * fix(sessions): keep Archive usable and offer guarded checkout recovery * fix(mac): name each archive recovery action in its native menu * fix(sessions): distinguish recovery targets and freeze negotiated support * fix(sessions): preserve subscriber pins and explain uncertain Restore outcomes * fix(macos): avoid advising a repeat before Restore status is known * fix(macos): report unconfirmed Restore across connection retirement * fix(macos): distinguish unsent restores and verify personal pin ownership * fix(sessions): settle admitted archives and align native pin controls * fix(native): wake snoozed threads before adding a personal pin * fix(macos): use the roster clock for pin actions and drops * fix(native): unpin saved sleeping threads without waking them * refactor(sessions): split native apps and Archive Undo out of requester pins * fix(sessions): wake uncovered sidebar pins and isolate stale batch targets * feat(macos): use the signed-in person's saved session pins Adopt requester personal session pins in the shared Apple chat UI and the macOS app, and add the Gateway Archive Undo marker the Mac needs. - macOS negotiates personal-session-pins, reads and reorders the signed-in profile's saved layout, and shows legacy pins read-only on older Gateways. - Dropping an unpinned thread onto a saved pin inserts it with one guarded layout write, matching the web sidebar's layout writer. - Archive on a negotiated SQLite connection can return a private, one-hour, connection-bound archiveUndoToken; Undo recreates a shared pin only when that Archive cleared one. Agent schema v45 adds the session row marker. - iOS keeps its existing behavior; Mac-only paths are gated. * feat(macos): use the signed-in person's saved session pins OpenClaw-Publication: e2011178-d9b2-4f72-b36b-5ca71a738898 * Publish openclaw/macos-session-pins OpenClaw-Publication: 681a7ed4-c1ee-4a34-93f2-0f87d2d26336 * test(state): pin the v45 SQLite reader floor to v44 * Publish openclaw/macos-session-pins OpenClaw-Publication: 139d9b6b-e4cb-4bbe-a15c-e441b38b9873 * fix(sessions): align Archive Undo with main's migration tests, lint and import graph * fix(sessions): keep Archive Undo within main's import, line-cap and test-line budgets * Publish openclaw/macos-session-pins OpenClaw-Publication: 02c4d53b-1dd8-4324-98a1-e0f78ac0bb0e * fix(sessions): keep the PostgreSQL v44 reader floor test and iOS comment style aligned * Publish openclaw/macos-session-pins OpenClaw-Publication: ea910aa7-55e2-43a4-b481-c806b48e7148 * fix(macos): keep the personal pin error internal to the chat UI * Publish openclaw/macos-session-pins OpenClaw-Publication: 4d6bb999-13a6-4f6e-91d5-a1a93e7e400c * refactor(sessions): ask the session store for Archive Undo identity and keep marker SQL in entry-write queries * fix(macos): keep pin edits after a lost refresh and explain read-only pins * Publish openclaw/macos-session-pins OpenClaw-Publication: b95b553f-1071-4f41-bfc1-6a02d218e8d2
1 parent 9959708 commit 3fa253a

120 files changed

Lines changed: 3985 additions & 656 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎apps/.i18n/native-source.json‎

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎apps/macos/Sources/OpenClaw/GatewayConnection.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ actor GatewayConnection: Observable {
4343
nonisolated static let operatorClientCaps = [
4444
OpenClawGatewayClientCapability.agentKind,
4545
OpenClawGatewayClientCapability.inlineWidgets,
46+
OpenClawGatewayClientCapability.personalSessionPins,
4647
OpenClawGatewayClientCapability.modelSelectionPolicy,
4748
OpenClawGatewayClientCapability.ultrafast,
4849
OpenClawGatewayClientCapability.usageRefreshing,

‎apps/macos/Sources/OpenClaw/MacGatewayChatTransport+SessionActions.swift‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,12 @@ extension MacGatewayChatTransport {
9393
.sessionUnreadAckContract,
9494
ifCurrentServerLease: serverLease)
9595
let transport = self
96-
return OpenClawChatSessionMutationRouteLease(
96+
return await OpenClawChatSessionMutationRouteLease(
9797
sessionTarget: { transport.sessionTarget(for: $0) },
9898
unreadAckContract: unreadAckContract,
99+
allowPinWrites: self.connection.supportsServerCapability(
100+
.personalSessionPins,
101+
ifCurrentServerLease: serverLease) == true,
99102
receivesPatchReceipts: true,
100103
request: self.leasedRequest(serverLease))
101104
}

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatGatewayPayloadCodec.swift‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ public enum OpenClawChatGatewayPayloadCodec {
296296
acceptsArgs: entry.acceptsargs)
297297
}
298298

299+
private struct PreferencesChangedPayload: Decodable { let keys: [String] }
300+
299301
private struct MetadataChangedPayload: Decodable {
300302
let modelSelectionChanged: Bool?
301303
let modelCatalogChanged: Bool?
@@ -309,6 +311,7 @@ public enum OpenClawChatGatewayPayloadCodec {
309311
private enum EventKind: String {
310312
case tick
311313
case chatMetadataChanged = "chat.metadata.changed"
314+
case preferencesChanged = "users.prefs.changed"
312315
case configChanged = "config.changed"
313316
case sessionsChanged = "sessions.changed"
314317
case sessionReaction = "session.reaction"
@@ -343,6 +346,9 @@ public enum OpenClawChatGatewayPayloadCodec {
343346
return payload?.modelSelectionChanged == true ? .modelSelectionChanged : .chatMetadataChanged(
344347
modelCatalogChanged: payload?.modelCatalogChanged != false || payload?.authChanged == true,
345348
agentID: payload?.agentId)
349+
case .preferencesChanged:
350+
return decode(PreferencesChangedPayload.self)?.keys
351+
.contains("ui.railShortcuts") == true ? .personalPinsChanged : nil
346352
case .configChanged:
347353
return .modelSelectionChanged
348354
case .sessionsChanged:

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatGatewayRequest+Batch.swift‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@ import Foundation
33
import OpenClawProtocol
44

55
extension OpenClawChatGatewayRequests {
6-
static func sidebarPinOrder(_ entries: [String], hash: String) throws -> OpenClawChatGatewayRequest {
7-
let raw = try JSONEncoder().encode(["ui": ["prefs": ["sidebarEntries": entries]]])
8-
return .init(
9-
method: "config.patch",
10-
params: [
11-
"raw": .init(String(bytes: raw, encoding: .utf8)!), "baseHash": .init(hash),
12-
"replacePaths": .init(["ui.prefs.sidebarEntries"]), "note": .init("control-ui prefs sync"),
13-
],
14-
timeoutMs: 15000)
15-
}
16-
176
static func sidebarBatchPatch(
187
_ rows: [OpenClawChatSessionEntry], patch: [String: AnyCodable]) -> OpenClawChatGatewayRequest
198
{

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSessionManagementViews.swift‎

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,9 @@ struct ChatSessionInspectorSheet: View {
130130
@Bindable var viewModel: OpenClawChatViewModel
131131

132132
@Environment(\.dismiss) private var dismiss
133+
#if os(macOS)
134+
@Environment(\.openClawChatWindowCommands) private var windowCommands
135+
#endif
133136
@State private var legacySession: OpenClawChatSessionEntry
134137
private let target: OpenClawChatSessionTarget
135138
private let sessionID: String?
@@ -203,6 +206,11 @@ struct ChatSessionInspectorSheet: View {
203206
.disabled(self.isMutatingGroup)
204207
Toggle("Pinned", isOn: self.pinnedBinding)
205208
.font(OpenClawChatTypography.body)
209+
#if os(macOS)
210+
.disabled(self.windowCommands?.sessionMenuActions.canTogglePin(
211+
self.displayedSession,
212+
at: self.viewModel.sidebarRosterClock.gatewayDate()) != true)
213+
#endif
206214
Toggle("Archived", isOn: self.archivedBinding)
207215
.font(OpenClawChatTypography.body)
208216
.disabled(!ChatSessionSidebarModel.canArchiveSession(
@@ -304,7 +312,15 @@ struct ChatSessionInspectorSheet: View {
304312

305313
private var pinnedBinding: Binding<Bool> {
306314
Binding(
307-
get: { self.displayedSession.isPinned },
315+
get: {
316+
#if os(macOS)
317+
self.windowCommands?.sessionMenuActions.isPinnedForAction(
318+
self.displayedSession,
319+
at: self.viewModel.sidebarRosterClock.gatewayDate()) ?? self.displayedSession.isPinned
320+
#else
321+
self.displayedSession.isPinned
322+
#endif
323+
},
308324
set: { pinned in
309325
guard self.canonicalSession != nil else { return }
310326
self.displayedSession.pinned = pinned

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSessionMenuConnection.swift‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,23 @@
11
import Foundation
2+
import OpenClawKit
23
import OpenClawProtocol
34

45
@MainActor
56
public struct OpenClawSessionMenuConnection {
7+
#if os(macOS)
8+
let pinProfile = ChatSidebarPinProfile()
9+
#endif
610
public let hello: HelloOk
711
private let methods: Set<String>
812
private let scopes: Set<String>
13+
public var supportsPersonalPins: Bool {
14+
self.hello.supportsServerCapability(.personalSessionPins)
15+
}
16+
17+
var supportsArchiveUndo: Bool {
18+
self.supportsPersonalPins && self.hello.supportsServerCapability(.sessionArchiveUndo)
19+
}
20+
921
public let local: Bool
1022
public var groupDefaultsBrowser: OpenClawGroupDefaultsBrowser?
1123
public let selfProfileID: String?
@@ -81,7 +93,14 @@ public struct OpenClawSessionMenuConnection {
8193

8294
@discardableResult
8395
public func request(_ request: OpenClawChatGatewayRequest) async throws -> Data {
84-
guard self.isCurrent(), !Task.isCancelled else { throw CancellationError() }
96+
guard self.isCurrent(), !Task.isCancelled else {
97+
#if os(macOS)
98+
// Mac Restore and Undo distinguish a request that was never sent from an unconfirmed one.
99+
throw OpenClawChatTransportSendError.notDispatched
100+
#else
101+
throw CancellationError()
102+
#endif
103+
}
85104
let data = try await self.sendRequest(request)
86105
guard self.isCurrent(), !Task.isCancelled else { throw CancellationError() }
87106
return data

‎apps/shared/OpenClawKit/Sources/OpenClawChatUI/ChatSessionPatchReceipt.swift‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ public struct OpenClawChatSessionPatchReceipt: Decodable, Sendable {
44
let label: String?
55
let category: String?
66
let color: String?
7+
let pinned: Bool?
78
let pinnedAt: Double?
89
let snoozedUntil: Double?
910
let snoozedAt: Double?
@@ -21,9 +22,10 @@ public struct OpenClawChatSessionPatchReceipt: Decodable, Sendable {
2122

2223
let key: String
2324
let entry: Entry
25+
let archiveUndoToken: String?
2426
var agentID: String?
2527

26-
private enum CodingKeys: String, CodingKey { case key, entry }
28+
private enum CodingKeys: String, CodingKey { case key, entry, archiveUndoToken }
2729

2830
func matches(_ row: OpenClawChatSessionEntry) -> Bool {
2931
self.key == row.key && self.entry.sessionId == row.sessionId &&
@@ -42,8 +44,8 @@ public struct OpenClawChatSessionPatchReceipt: Decodable, Sendable {
4244
case .category: row.category = self.entry.category
4345
case .color: row.color = self.entry.color
4446
case .pinned:
45-
// ui/src/lib/sessions/session-patch-row-facts.ts:56 derives pin state from pinnedAt.
46-
row.pinned = self.entry.pinnedAt != nil
47+
// Older Gateways returned a timestamp instead of a personal pin flag.
48+
row.pinned = self.entry.pinned ?? (self.entry.pinnedAt != nil)
4749
row.pinnedAt = self.entry.pinnedAt
4850
case .archived:
4951
row.archived = self.entry.archivedAt != nil

0 commit comments

Comments
 (0)