chore: drop gateway ipc remnants

This commit is contained in:
Peter Steinberger
2025-12-09 20:21:41 +00:00
parent 131864b940
commit a76d00a08e
8 changed files with 14 additions and 18 deletions

View File

@@ -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`.

View File

@@ -128,17 +128,17 @@ enum DebugActions {
await HealthStore.shared.refresh(onDemand: true)
}
static func sendTestHeartbeat() async -> Result<ControlHeartbeatEvent?, String> {
static func sendTestHeartbeat() async -> Result<ControlHeartbeatEvent?, Error> {
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

View File

@@ -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
}

View File

@@ -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)

View File

@@ -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)

View File

@@ -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 {

View File

@@ -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 409515 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 <ms>` 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 <ms>` to override the 10s default.

View File

@@ -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.