Commit graph

12 commits

Author SHA1 Message Date
Kent Overstreet
2ab4fd1c92 Trim unused deps
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-05 06:06:38 -04:00
Kent Overstreet
7b75296457 Update reqwest
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-05 06:02:25 -04:00
Kent Overstreet
3f79bba27a Update json5
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-05 06:01:24 -04:00
Kent Overstreet
7123c9166d channels: add socat daemon for generic stream channels
consciousness-channel-socat listens on a unix socket for incoming
connections, turning each into a bidirectional text channel. Also
supports outbound connections via the open RPC (tcp: or unix:).

Two sockets:
  socat.sock        — capnp RPC (channel protocol)
  socat.stream.sock — data (incoming connections become channels)

No config file needed. The simplest possible channel daemon.

Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-05 01:18:47 -04:00
Kent Overstreet
2a84fb325d channels: find_daemon path walking, consistent pane_id, auto-start
find_daemon() replaces daemon_sock() — walks the dot-delimited channel
path from most-specific to least looking for a daemon socket, and
auto-starts via the supervisor if none is found. All channel tools
(recv, send, open, close) use the same resolution path.

Fix tmux daemon to use pane_id consistently for both pipe-pane and
send-keys (send-keys -t <label> doesn't work, needs the %N pane id).
Store label→pane_id mapping in State instead of bare label vec.

Gracefully handle missing tmux.json5 — start with empty pane list
since panes are added dynamically via the open RPC.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-04 19:22:49 -04:00
ProofOfConcept
e8e9386856 channels: add open/close RPCs for dynamic pane management
Add open/close to the channel capnp schema. The tmux daemon implements
open by finding a pane by name (pane title or window name) and
attaching pipe-pane; close detaches and removes from state.

Tool handlers channel_open and channel_close added to the tool
registry.

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-04 19:22:49 -04:00
ProofOfConcept
1ef137fb3a channels: add tmux pane channel daemon
Standalone daemon that streams tmux pane output via pipe-pane
(no polling). Each configured pane becomes a channel "tmux.<label>"
accessible through the standard channel.capnp protocol.

- pipe-pane streams PTY output directly to FIFOs
- Async readers push new lines into ChannelLogs
- send works via tmux send-keys
- Cleanup disconnects pipe-pane on daemon exit

Config: ~/.consciousness/channels/tmux.json5
Socket: ~/.consciousness/channels/tmux.sock

Co-Authored-By: Proof of Concept <poc@bcachefs.org>
2026-04-04 18:19:21 -04:00
ProofOfConcept
53a2dbac37 fix unread count: sent messages don't count as unread
Track outgoing messages separately (own counter) so they appear
in the log but don't inflate unread counts. Reset on recv.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-03 20:42:36 -04:00
ProofOfConcept
7d1637a2f0 irc: create channel log entries on JOIN
Channels now appear in list() immediately after joining,
not only after the first message arrives.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-03 20:09:06 -04:00
ProofOfConcept
c19f26f4fa telegram daemon: per-channel logs with shared ChannelLog
Same treatment as IRC daemon — replace single ring buffer with
BTreeMap<String, ChannelLog>. list() returns all channels with
per-channel unread counts. Sent messages tracked too.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-03 20:04:08 -04:00
ProofOfConcept
e604659e3a per-channel message logs with shared ChannelLog type
Move ChannelLog to src/thalamus/channel_log.rs — shared by all
channel daemon implementations. Each channel/PM gets its own
log with consumed/unread tracking.

IRC daemon: channels tracked via BTreeMap<String, ChannelLog>.
list() returns all channels (joined + PMs) with per-channel
unread counts. Sent messages stored in logs too.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-03 20:01:32 -04:00
ProofOfConcept
ad5f69abb8 channel architecture: wire protocol, daemons, supervisor
Design and implement the channel system for external communications:

- schema/channel.capnp: wire protocol for channel daemons
  (recv with all_new/min_count, send, subscribe, list)
- channels/irc/: standalone IRC daemon crate (consciousness-channel-irc)
- channels/telegram/: standalone Telegram daemon crate
  (consciousness-channel-telegram)
- src/thalamus/channels.rs: client connecting to daemon sockets
- src/thalamus/supervisor.rs: daemon lifecycle with file locking
  for multi-instance safety

Channel daemons listen on ~/.consciousness/channels/*.sock,
configs in *.json5, supervisor discovers and starts them.
IRC/Telegram modules removed from thalamus core — they're
now independent daemons that survive consciousness restarts.

Also: delete standalone tui.rs (moved to consciousness F4/F5),
fix build warnings, add F5 thalamus screen with channel status.

Co-Developed-By: Kent Overstreet <kent.overstreet@linux.dev>
2026-04-03 18:46:41 -04:00