Commit Graph
3 Commits
Author SHA1 Message Date
rune 5f39448896 Add a CLI server bind timeout and an app-wide heartbeat log
Prompted by a real incident: Confab's process silently wedged, and
was indistinguishable from "just idle" after the fact — lsof showed
the CLI socket held open, every connection was refused, and nothing
had been logged for the rest of that session. No crash, no error.

- CLIServerService: NWListener's state transitions are normally
  near-instant, but had no bound on that assumption. Now times out
  after 8s if .ready is never reached, logging clearly and clearing
  the listener slot instead of silently pretending to work forever.
- oAIApp: a 5-minute heartbeat log line, otherwise meaningless on its
  own, turns "the log's gone quiet" from an ambiguous signal into a
  plain read of roughly when a future freeze started.

Neither fixes a known root cause (none was found - no crash report,
no error, just silence), so this is diagnostics and a narrow
failsafe, not a claim the underlying freeze is resolved.
2026-08-14 11:21:46 +02:00
rune ef6265c1c5 Fix actor-isolation warning in CLIServerService's connection handler
sendAndClose is main-actor-isolated (implicit under -default-isolation
MainActor), but the Task in readRequest's Network.framework callback
runs nonisolated (DisableOutwardActorInference means it no longer
inherits the class's actor from lexical context). Calling sendAndClose
without hopping onto the actor is a hard error in Swift 6 mode.
2026-08-11 10:45:17 +02:00
rune 897bfdce10 Add local CLI access via Unix-socket server
New CLIServerService listens on a Unix domain socket
(~/Library/Application Support/oAI/cli.sock) speaking a minimal
HTTP/1.1 subset, for one-shot non-streaming shell access to a single
fixed model — e.g. an `ai "prompt"` zsh function — without opening
the app window and without going through the tool-calling loop.

Configured in Settings > MCP > CLI Access (toggle, provider, model —
deliberately independent of the chat UI's active model). JSON
request/response envelope rather than raw text so new fields (model
override, streaming, tool support) can be added later without a
breaking wire-format change.

Verified live end-to-end against a real OpenRouter request, error
paths, and clean-shutdown socket cleanup. 10 new unit tests cover
the HTTP framing/parsing logic.
2026-08-05 13:33:02 +02:00