Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.
Rust acpagent-client-protocolai-agentsai-assistantclaudeclaude-codecodexcoding-agentscursorgeminigemini-cligrok-bot-alternativeiosiphonelinuxmacosmcpopen-sourcerustself-hosted
feat: sync primary session to macOS, APNs push logging, simplify PremiumManager
libokaiefad3121017f
diff --git a/Codync-iOS/App/AppDelegate.swift b/Codync-iOS/App/AppDelegate.swiftindex 6800eff2..5b63721f 100644--- a/Codync-iOS/App/AppDelegate.swift+++ b/Codync-iOS/App/AppDelegate.swift@@ -84,6 +84,12 @@ final class AppDelegate: NSObject, UIApplicationDelegate {_ application: UIApplication,didReceiveRemoteNotification userInfo: [AnyHashable: Any]) async -> UIBackgroundFetchResult {+ // Pro users rely on APNs Worker push — skip silent push to isolate testing+ if PremiumManager.shared.isPro {+ logger.info("CloudKit silent push skipped (Pro uses APNs Worker)")+ return .noData+ }+let notification = CKNotification(fromRemoteNotificationDictionary: userInfo)let subID = notification?.subscriptionIDguard subID == "session-zone-changes" || subID == "session-changes" else {diff --git a/Codync-iOS/Services/PremiumManager.swift b/Codync-iOS/Services/PremiumManager.swiftindex 8edc0c55..0c29f012 100644--- a/Codync-iOS/Services/PremiumManager.swift+++ b/Codync-iOS/Services/PremiumManager.swift@@ -12,31 +12,16 @@ final class PremiumManager {fileprivate(set) var isPro = falseprivate(set) var isLoaded = false- #if DEBUG- /// When true, isPro is forced on and RevenueCat status is ignored- fileprivate let debugForcesPro = true- #else- fileprivate let debugForcesPro = false- #endif-private init() {}func configure() {Purchases.logLevel = .warnPurchases.configure(withAPIKey: "REVENUECAT_API_KEY_REDACTED")Purchases.shared.delegate = RCPurchasesDelegate.shared- Task {- await refreshStatus()- }+ Task { await refreshStatus() }}func refreshStatus() async {- if debugForcesPro {- isPro = true- isLoaded = true- logger.info("Premium status: Pro (debug forced)")- return- }do {let info = try await Purchases.shared.customerInfo()isPro = info.entitlements["Codync Pro"]?.isActive == true@@ -49,7 +34,6 @@ final class PremiumManager {}func restorePurchases() async throws {- if debugForcesPro { return }let info = try await Purchases.shared.restorePurchases()isPro = info.entitlements["Codync Pro"]?.isActive == truelogger.info("Restored purchases: \(self.isPro ? "Pro" : "Free")")@@ -64,9 +48,7 @@ private final class RCPurchasesDelegate: NSObject, RevenueCat.PurchasesDelegate,nonisolated func purchases(_ purchases: Purchases, receivedUpdated customerInfo: CustomerInfo) {let isPro = customerInfo.entitlements["Codync Pro"]?.isActive == trueTask { @MainActor in- if !PremiumManager.shared.debugForcesPro {- PremiumManager.shared.isPro = isPro- }+ PremiumManager.shared.isPro = isPrologger.info("Customer info updated: \(isPro ? "Pro" : "Free")")}}diff --git a/Codync-macOS/Services/APNsPushService.swift b/Codync-macOS/Services/APNsPushService.swiftindex 1de30504..b9a67f35 100644--- a/Codync-macOS/Services/APNsPushService.swift+++ b/Codync-macOS/Services/APNsPushService.swift@@ -127,7 +127,7 @@ final class APNsPushService {private func post(payload: [String: Any], label: String) async {guard let body = try? JSONSerialization.data(withJSONObject: payload) else {- logger.error("Failed to serialize payload for \(label)")+ Self.log("APNs FAIL serialize \(label)")return}@@ -141,17 +141,26 @@ final class APNsPushService {let (data, response) = try await URLSession.shared.data(for: request)if let http = response as? HTTPURLResponse {if http.statusCode == 200 {- logger.debug("Worker OK for \(label)")+ Self.log("APNs → \(label) ✓")} else {let reason = String(data: data, encoding: .utf8) ?? ""- logger.warning("Worker \(http.statusCode) for \(label): \(reason)")+ Self.log("APNs → \(label) ✗ \(http.statusCode): \(reason)")}}} catch {- logger.error("Worker POST failed for \(label): \(error.localizedDescription)")+ Self.log("APNs → \(label) ✗ \(error.localizedDescription)")}}+ private static func log(_ msg: String) {+ let url = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".codync/sync.log")+ let fmt = DateFormatter()+ fmt.dateFormat = "HH:mm:ss"+ let line = "[\(fmt.string(from: Date()))] \(msg)\n"+ if let h = try? FileHandle(forWritingTo: url) { h.seekToEndOfFile(); h.write(line.data(using: .utf8)!); try? h.close() }+ else { try? line.write(to: url, atomically: false, encoding: .utf8) }+ }+// MARK: - Content Stateprivate static func buildContentState(from session: SessionState) -> [String: Any] {diff --git a/Codync-macOS/Services/CloudKitSync.swift b/Codync-macOS/Services/CloudKitSync.swiftindex 6279f4e6..73793978 100644--- a/Codync-macOS/Services/CloudKitSync.swift+++ b/Codync-macOS/Services/CloudKitSync.swift@@ -117,11 +117,16 @@ final class CloudKitSync {for session in toSave {await APNsPushService.shared.sendUpdate(session: session)}- // Overall mode: send all active sessions+ // Overall mode: send all active sessions with user's primary selectionlet allActive = sessions.filter { $0.status != .completed }+ let primary = await CloudKitManager.shared.fetchPrimarySession()+ let primaryId = primary.sessionId+ ?? allActive.first(where: { $0.status == .working })?.sessionId+ // Sync primary to macOS panel sorting+ stateManager.primarySessionId = primaryIdawait APNsPushService.shared.sendOverallUpdate(sessions: allActive,- primarySessionId: allActive.first(where: { $0.status == .working })?.sessionId+ primarySessionId: primaryId)}} catch let error as CKError where error.code == .quotaExceeded || error.code == .requestRateLimited {diff --git a/Codync-macOS/Services/SessionStateManager.swift b/Codync-macOS/Services/SessionStateManager.swiftindex b3f29707..5263d161 100644--- a/Codync-macOS/Services/SessionStateManager.swift+++ b/Codync-macOS/Services/SessionStateManager.swift@@ -8,6 +8,7 @@ private let logger = Logger(subsystem: "com.pokai.Codync", category: "StateManag@MainActorfinal class SessionStateManager: ObservableObject {@Published var sessions: [SessionState] = []+ @Published var primarySessionId: String?private let scanner: SessionScannerlet transcriptWatcher = TranscriptWatcher()@@ -125,8 +126,11 @@ final class SessionStateManager: ObservableObject {}}- // Sort: working first, then by most recent activity+ // Sort: primary first, then working, then by most recent activity+ let pid = primarySessionIdlet newSessions = updated.sorted { a, b in+ if a.sessionId == pid { return true }+ if b.sessionId == pid { return false }let aWeight = a.status == .working ? 0 : a.status == .needsInput ? 1 : 2let bWeight = b.status == .working ? 0 : b.status == .needsInput ? 1 : 2if aWeight != bWeight { return aWeight < bWeight }diff --git a/Codync-macOS/Views/SessionListView.swift b/Codync-macOS/Views/SessionListView.swiftindex 340a2a98..03754c15 100644--- a/Codync-macOS/Views/SessionListView.swift+++ b/Codync-macOS/Views/SessionListView.swift@@ -65,7 +65,11 @@ struct SessionListView: View {ScrollView(.vertical, showsIndicators: false) {VStack(spacing: 2) {ForEach(displayedSessions) { session in- SessionRowView(session: session) {+ SessionRowView(+ session: session,+ isPrimary: stateManager.primarySessionId != nil+ && session.sessionId == stateManager.primarySessionId+ ) {withAnimation(.easeInOut(duration: 0.2)) { selectedSession = session }}}diff --git a/Codync-macOS/Views/SessionRowView.swift b/Codync-macOS/Views/SessionRowView.swiftindex ffb7dcb7..caa4737a 100644--- a/Codync-macOS/Views/SessionRowView.swift+++ b/Codync-macOS/Views/SessionRowView.swift@@ -3,6 +3,7 @@ import CodyncSharedstruct SessionRowView: View {let session: SessionState+ var isPrimary: Bool = falselet onSelect: () -> Void@Environment(\.theme) private var theme@State private var isHovered = false@@ -55,6 +56,7 @@ struct SessionRowView: View {RoundedRectangle(cornerRadius: 5, style: .continuous).fill(isPressed ? theme.pressedBackground: isHovered ? theme.hoverBackground+ : isPrimary ? theme.primaryText.opacity(0.06): Color.clear)).scaleEffect(isPressed ? 0.98 : 1.0)