diff --git a/CHANGELOG.md b/CHANGELOG.md index 3af995f3c..88f6ad9e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -119,12 +119,12 @@ First Clawdis release post rebrand. This is a semver-major because we dropped le - Heartbeat alerts now honor `responsePrefix`. - Command failures return user-friendly messages. - Test session isolation to avoid touching real `sessions.json`. -- IPC reuse for `clawdis send/heartbeat` prevents Signal/WhatsApp session corruption. +- (Removed in 2.0.0) IPC reuse for `clawdis send/heartbeat` prevents Signal/WhatsApp session corruption. - Web send respects media kind (image/audio/video/document) with correct limits. ### Changes -- IPC gateway socket at `~/.clawdis/ipc/gateway.sock` with automatic CLI fallback. -- Batched inbound messages with timestamps; typing indicator after IPC sends. +- (Removed in 2.0.0) IPC gateway socket at `~/.clawdis/ipc/gateway.sock` with automatic CLI fallback. +- Batched inbound messages with timestamps; typing indicator after sends. - Watchdog restarts WhatsApp after long inactivity; heartbeat logging includes minutes since last message. - Early `allowFrom` filtering before decryption. - Same-phone mode with echo detection and optional `inbound.samePhoneMarker`. diff --git a/apps/macos/Sources/Clawdis/DebugActions.swift b/apps/macos/Sources/Clawdis/DebugActions.swift index 0ba08aa30..0f3ace993 100644 --- a/apps/macos/Sources/Clawdis/DebugActions.swift +++ b/apps/macos/Sources/Clawdis/DebugActions.swift @@ -128,17 +128,17 @@ enum DebugActions { await HealthStore.shared.refresh(onDemand: true) } - static func sendTestHeartbeat() async -> Result { + static func sendTestHeartbeat() async -> Result { do { _ = await AgentRPC.shared.setHeartbeatsEnabled(true) - try await ControlChannel.shared.configure() + await ControlChannel.shared.configure() let data = try await ControlChannel.shared.request(method: "last-heartbeat") if let evt = try? JSONDecoder().decode(ControlHeartbeatEvent.self, from: data) { return .success(evt) } return .success(nil) } catch { - return .failure(error.localizedDescription) + return .failure(error) } } @@ -149,7 +149,7 @@ enum DebugActions { static func toggleVerboseLoggingMain() async -> Bool { let newValue = !self.verboseLoggingEnabledMain UserDefaults.standard.set(newValue, forKey: self.verboseDefaultsKey) - try? await ControlChannel.shared.request( + _ = try? await ControlChannel.shared.request( method: "system-event", params: ["text": AnyHashable("verbose-main:\(newValue ? "on" : "off")")]) return newValue diff --git a/apps/macos/Sources/Clawdis/HealthStore.swift b/apps/macos/Sources/Clawdis/HealthStore.swift index ad08571cf..94bd0bb21 100644 --- a/apps/macos/Sources/Clawdis/HealthStore.swift +++ b/apps/macos/Sources/Clawdis/HealthStore.swift @@ -4,11 +4,6 @@ import OSLog import SwiftUI struct HealthSnapshot: Codable, Sendable { - struct Ipc: Codable, Sendable { - let exists: Bool? - let path: String? - } - struct Web: Codable, Sendable { struct Connect: Codable, Sendable { let ok: Bool @@ -37,7 +32,6 @@ struct HealthSnapshot: Codable, Sendable { let ts: Double let durationMs: Double let web: Web - let ipc: Ipc? let heartbeatSeconds: Int? let sessions: Sessions } diff --git a/apps/macos/Sources/Clawdis/InstancesStore.swift b/apps/macos/Sources/Clawdis/InstancesStore.swift index dee1b8969..d73873557 100644 --- a/apps/macos/Sources/Clawdis/InstancesStore.swift +++ b/apps/macos/Sources/Clawdis/InstancesStore.swift @@ -261,7 +261,7 @@ final class InstancesStore: ObservableObject { lastInputSeconds: nil, mode: "health", reason: "health probe", - text: "Health ok · linked=\(snap.web.linked) · ipc.exists=\(snap.ipc.exists)", + text: "Health ok · linked=\(snap.web.linked)", ts: snap.ts) if !self.instances.contains(where: { $0.id == entry.id }) { self.instances.insert(entry, at: 0) diff --git a/apps/macos/Sources/Clawdis/WebChatWindow.swift b/apps/macos/Sources/Clawdis/WebChatWindow.swift index f6905815b..24015ca9d 100644 --- a/apps/macos/Sources/Clawdis/WebChatWindow.swift +++ b/apps/macos/Sources/Clawdis/WebChatWindow.swift @@ -244,6 +244,10 @@ final class WebChatManager { static let shared = WebChatManager() private var controller: WebChatWindowController? + func preferredSessionKey() -> String { + WorkActivityStore.shared.current?.sessionKey ?? "main" + } + func show(sessionKey: String) { if self.controller == nil { self.controller = WebChatWindowController(sessionKey: sessionKey) diff --git a/apps/macos/Tests/ClawdisIPCTests/HealthDecodeTests.swift b/apps/macos/Tests/ClawdisIPCTests/HealthDecodeTests.swift index bd68add44..a802d9e82 100644 --- a/apps/macos/Tests/ClawdisIPCTests/HealthDecodeTests.swift +++ b/apps/macos/Tests/ClawdisIPCTests/HealthDecodeTests.swift @@ -14,7 +14,6 @@ import Testing #expect(snap?.web.linked == true) #expect(snap?.sessions.count == 1) - #expect(snap?.ipc.exists == true) } @Test func decodesWithLeadingNoise() async throws { diff --git a/docs/health.md b/docs/health.md index 7676aab53..4ca7a6897 100644 --- a/docs/health.md +++ b/docs/health.md @@ -17,7 +17,6 @@ Short guide to verify the WhatsApp Web / Baileys stack without guessing. ## Deep diagnostics - Creds on disk: `ls -l ~/.clawdis/credentials/creds.json` (mtime should be recent). - Session store: `ls -l ~/.clawdis/sessions.json` (path can be overridden in config). Count and recent recipients are surfaced via `status`. -- IPC socket (if gateway is running): `ls -l ~/.clawdis/clawdis.sock`. - Relink flow: `pnpm clawdis logout && pnpm clawdis login --provider web --verbose` when status codes 409–515 or `loggedOut` appear in logs. ## When something fails @@ -26,4 +25,4 @@ Short guide to verify the WhatsApp Web / Baileys stack without guessing. - No inbound messages → confirm linked phone is online and sender is allowed; use `pnpm clawdis heartbeat --all --verbose` to test each known recipient. ## Dedicated "health" command -`pnpm clawdis health --json` runs a connect-only probe (no sends) and reports: linked creds, auth age, Baileys connect result/status code, session-store summary, IPC presence, and a probe duration. It exits non-zero if not linked or if the connect fails/timeouts. Use `--timeout ` to override the 10s default. +`pnpm clawdis health --json` runs a connect-only probe (no sends) and reports: linked creds, auth age, Baileys connect result/status code, session-store summary, and a probe duration. It exits non-zero if not linked or if the connect fails/timeouts. Use `--timeout ` to override the 10s default. diff --git a/docs/surface.md b/docs/surface.md index d5401b2ce..264ab3477 100644 --- a/docs/surface.md +++ b/docs/surface.md @@ -15,5 +15,5 @@ Goal: make replies deterministic per channel while keeping one shared context fo - **WebChat:** Always attaches to `main`, loads the full Tau transcript so desktop reflects cross-surface history, and writes new turns back to the same session. - **Implementation hints:** - Set `Surface` in each ingress (WhatsApp gateway, WebChat bridge, future Telegram). - - Keep routing deterministic: originate → same surface. Use IPC/web senders accordingly. + - Keep routing deterministic: originate → same surface. Use the gateway WebSocket for sends; avoid side channels. - Do not let the agent emit “send to X” decisions; keep that policy in the host code.