Commit Graph

2654 Commits

Author SHA1 Message Date
Ollie Agent cd26595cb7 Fix stream chunk truncation; style TUI initial state from state file
server.go: the stream read handler truncated each chunk to the client's
requested Count and advanced waitBase, silently dropping bytes beyond
the buffer (e.g. a chat block larger than 64KB). It now caches each
stream chunk per-fid (readCache + streamBase) and pages within it by
absolute offset, fetching the next chunk only once the current one is
fully drained, preserving 9P offset semantics.

o tui: read the state file for the initial status bar and apply the same
color styling and status text the event loop uses, so the bar is correct
immediately on attach; the event stream drives subsequent updates.
2026-10-10 16:37:00 +02:00
Ollie Agent 89fbb7438a Stream assistant text incrementally to log/chat; fix stream lost-wakeup
Two fixes for the rendered text views (chat stream, log snapshot):

1. Lost wakeup: blocking stream readers captured the signal channel
   after their data check, so a write landing in that window signaled a
   now-stale channel and the reader blocked until the next event (the
   TUI's last message appeared only after the next prompt). Stream and
   BlockOnce now capture the signal channel before reading; chat.go
   swaps the channel under chatMu via signalChatLocked and RawLogStream
   captures it while holding the lock.

2. No streaming in TUI: textLog only received finalized blocks, so the
   chat text stream showed nothing until a block completed. SetPartial
   now appends the assistant partial's new suffix to textLog
   incrementally (tracking textPartialLen); AppendBlock appends only the
   trailing separator on finalization to avoid duplicating the body.
2026-10-10 16:25:14 +02:00
Ollie Agent 4e1961200a docs: update chat log docs for chat.raw stream and tool/bypass visibility
Add Phase 41 (live chat.raw stream vs log.raw snapshot) and Phase 42
(tool call / output / bypass rendering in log and chat) to evolution.md,
with the phase chart. Clarify the log/chat row descriptions in
architecture-9p.md and the chat.go role in architecture-core.md.
2026-10-10 16:08:39 +02:00
Ollie Agent 6211a6cdee Surface tool calls, output, and bypass status in log/chat views
The filtered text views (log, chat) hid call and tool blocks entirely
and had no visibility into bypass requests, which were only published as
events. RenderBlock now renders tool calls (name + args), tool output,
and bypass request/resolution notices; reasoning and context stay
hidden. SetBypassPending/ResolveBypass append bypass and bypass-resolved
blocks to the requesting agent so clients without an event stream (TUI,
o script) see pending approvals and outcomes.
2026-10-10 16:05:05 +02:00
Ollie Agent a4972cd456 Separate chat persistence from live delivery via chat.raw
Streaming partials were appended to log.raw per chunk, each carrying the
full cumulative content, so one response left dozens of partial lines
persisted. GUI clients parsing the snapshot re-rendered the growing block
once per partial (O(N^2)) and replayed all historical partials on every
reconnect, causing intermittent rendering loops.

Partials are no longer persisted: AppendBlock writes only finalized
blocks to log.raw; SetPartial broadcasts the in-flight block without
storing it. New chat.raw StreamRaw file is the authoritative live JSONL
source (finalized history replay, then live deltas); log.raw is a
finalized-only one-shot snapshot. GUI streams chat.raw, never polls
log.raw.
2026-10-10 15:57:48 +02:00
Ollie Agent e7c9a34c3b Make log.raw a one-shot read, not a stream
A Stream handler on log.raw blocks the GUI's synchronous startup read
forever, so the window never renders. Live updates come from the
separate chat and event streams.
2026-10-10 15:39:54 +02:00
Levi Neely 8ce50452a1 Fix log.raw streaming: add Stream handler back 2026-10-09 19:37:58 +02:00
Levi Neely 6cf283044e docs: add chat file to namespace documentation
- AGENTS.md: four views (log.raw, log, chat, block)
- system_prompt.md: add chat to agent file table
- architecture-9p.md: add chat to namespace table
- evolution.md: correct Phase 40 (chat not deleted)
2026-10-09 19:16:20 +02:00
Levi Neely 7867094c41 o tui: read initial state from 9P state file 2026-10-09 19:12:08 +02:00
Levi Neely f2f33e7826 Add chat file back for TUI text streaming 2026-10-09 19:09:20 +02:00
Levi Neely bc5f45854e scripts/o: tui reads filtered log instead of log.raw 2026-10-09 18:57:44 +02:00
Levi Neely c44c44dae3 doc: add Phase 40 (JSONL chat log format) to evolution.md 2026-10-09 18:53:59 +02:00
Levi Neely 57c40d541e Migrate chat log to JSONL format
Server changes:
- format/block.go: Block struct with JSONL marshaling, RenderBlock for text
- Deleted format/event.go, format.go, format_test.go (old delimiter format)
- agent/chat.go: Dual logs (rawLog JSONL + textLog rendered text)
- agent/chatlog.go: Streaming via flushPartial/closeBlock, skip internal events
- fs/spec.go: New files log.raw (JSONL), log (text), block (ID lookup)
- Removed chat/chat.raw/chat.search from namespace

GUI changes:
- chatblockmodel: JSONL parsing via QJsonDocument, removed regex state machine
- ollie9pclient: Read from log.raw for replay, removed old streaming code
- Added Context type to block enum, filter context/state/usage from display

Docs updated: AGENTS.md, system_prompt.md, architecture-*.md, scripts/o
2026-10-09 18:52:40 +02:00
Levi Neely e53d612bdb GUI: handle ollie:// plumb URLs to display chat blocks
Plumb ollie://session/agent#blockid URLs fetch the block via chat.search
and append to the chat pane. Non-persistent display for quick reference.
2026-10-09 17:08:21 +02:00
Levi Neely c186c87525 Use sha256-based deterministic block IDs
- NextBlockID now uses sha256(sessionID:agentID:counter)[:8] for deterministic,
  collision-resistant block IDs across sessions and agents
- Remove blockCounter reset on Clear() to maintain ID stability
2026-10-09 17:01:22 +02:00
Levi Neely 5f67d44e27 Add block ID tests and document chat log files
- Add unit tests for NextBlockID and ChatSearchByID in chat_test.go
- Add unit tests for ParseBlockHeader, BlockDelim, FormatEvent in format_test.go
- Add e2e test script using o CLI to verify block ID search
- Document chat log files in AGENTS.md: chat/chat.raw are blocking streams,
  use log for non-blocking reads, chat.search for block lookup
2026-10-09 17:00:37 +02:00
Levi Neely 582f7d1b91 event: emit clear event when agent is cleared
- Add onClear callback to Agent, wired via support.go
- Publish session.{sid}.agent.{aid}.clear event
- GUI listens for agentCleared signal and refreshes chat view
- Works for both GUI clear button and CLI /clear command
2026-10-09 16:31:30 +02:00
Levi Neely 1c863ce9ec gui: add Clear button next to Compact
- Clear button sends /clear command
- /clear now resets history, chat log, and block counter
- Completely fresh start without creating a new session
- Button disabled while agent is running
2026-10-09 16:28:28 +02:00
Levi Neely c8f42b2400 9p: add chat.search file for block lookup by ID
Write a block ID to chat.search, read the block content back.
Returns error if block not found.
2026-10-09 16:15:30 +02:00
Levi Neely 46aa901763 server-side block IDs for stable bookmark/plumb targets
- Add blockCounter to Agent, generating sequential hex IDs
- Include #blockId in all block headers: [[[role:name#id]]]
- GUI parses server-provided IDs from headers
- Falls back to client-generated IDs for legacy blocks without server IDs
- Block IDs are now deterministic based on chat history order
2026-10-09 16:12:26 +02:00
Levi Neely 233a5cc2e9 gui: reload full chat history when scrolling to trimmed block
When scrollToBlockId fails to find a block (trimmed from view),
reload the full chat without trimming and scroll to it.
2026-10-09 14:57:53 +02:00
Levi Neely 922b53de4a gui: reset blockIdCounter on chat reset for deterministic IDs 2026-10-09 14:56:26 +02:00
Levi Neely 2f45509af3 gui: use stable blockId instead of index for bookmarks/plumb
- Add blockId field to ChatBlock (12-char MD5 hash of counter+name)
- Bookmarks now use blockId instead of volatile list index
- Plumb URLs use blockId: ollie://session/agent#abc123def456
- Add indexForBlockId() to look up current index from stable ID
- Action buttons always visible (no hover flicker)
2026-10-09 14:53:36 +02:00
Levi Neely 483a4f0d4d gui: use font-relative sizing for bookmark buttons
- All ToolButtons now use theme.fontSize-based sizing
- Height, width, margins, and spacing scale with font
- Removed all hardcoded pixel values from bookmark UI
2026-10-09 14:10:14 +02:00
Levi Neely e5759e43d2 doc: add Plan 9 plumber integration documentation 2026-10-09 14:07:40 +02:00
Levi Neely 5ac2e67769 plumber: fix regex to allow colons in agent names, add file logging for debugging 2026-10-09 14:06:38 +02:00
Levi Neely df0b38aedf plumber: add debug logging for ollie port reader 2026-10-09 13:59:02 +02:00
Levi Neely 73e5af6ce8 plumbing: allow colons in session/agent names 2026-10-09 13:56:59 +02:00
Levi Neely ecbea0fe90 gui: integrate bookmarks with plan9 plumber
- Add ollie:// URL scheme for plumb messages
  Format: ollie://session/agent#block
- Plumber listens on 'ollie' port for navigation messages
- Bookmarks show 📋 button to copy ollie:// link
- Add data/plumbing with rules to route ollie:// URLs
- On plumb message: switch session/agent, scroll to block, raise window
2026-10-09 13:27:40 +02:00
Levi Neely 96b6406871 gui: add bookmark feature for chat blocks
- Add bookmark button (📌) on chat block hover
- Bookmarks section in left panel (SessionTree) with grouped view
- Non-persistent GUI-only state using ListModel
- Click bookmark to scroll to that block in chat
- Bookmark format: sessionName/agentName with block content preview
- Add activeSessionName/activeAgentName C++ getters for display
2026-10-09 13:21:33 +02:00
Levi Neely c8897b8251 doc: update usage.md and architecture-kde.md
- Document colon separator for session:agent
- Document agent-level bypass/approve/deny filtering
- Document !a !d !b shortcuts in prompt REPL
- Update tmux session naming to include agent
- Add Procs and Peers buttons to KDE GUI features
2026-10-09 13:09:13 +02:00
Levi Neely 8793202ef5 o: fix bypass agent filter to use agent ID instead of name
OLLIE_UNAME in bypass requests is the agent ID, not name.
Look up agent ID from idx before filtering.
2026-10-09 13:05:38 +02:00
Levi Neely 9fb150b6fe o: add !a !d !b shortcuts in prompt for bypass management
!a or !approve - approve first pending bypass for this agent
!d or !deny    - deny first pending bypass for this agent
!b or !bypass  - list pending bypass requests for this agent
2026-10-09 13:02:39 +02:00
Levi Neely 859bb4910f o: filter bypass/approve/deny by agent when agent context is set
o session/agent bypass   - shows only that agent's requests
o session/agent approve  - approves first request from that agent
o session/agent deny     - denies first request from that agent
o session bypass         - shows all requests (unchanged)
2026-10-09 13:01:36 +02:00
Levi Neely 2c8b301a59 o: handle expired bypass requests gracefully in approve/deny 2026-10-09 12:58:26 +02:00
Levi Neely 1663d2d212 o: fix approve/deny to handle array of pending requests 2026-10-09 12:56:34 +02:00
Levi Neely 995db45444 o: fix bypass command to handle array of pending requests 2026-10-09 12:54:39 +02:00
Levi Neely 780e558743 cmake: add PeerManagerWindow.qml to qt_add_resources 2026-10-09 12:52:38 +02:00
Levi Neely b5138fd55e o: fix tui event subscription - use IDs not names
Event topics use session/agent IDs, not names. Look up IDs from
the idx files before subscribing to state events.
2026-10-09 12:47:29 +02:00
Levi Neely f490d4eef2 o: add delays before tmux send-keys
Shell needs time to initialize before receiving commands.
2026-10-09 12:38:12 +02:00
Levi Neely 8c7a3bf83b o: simplify tui commands - remove grep filters
The shell escaping for grep patterns was complex and fragile.
Removed the cosmetic filters for [[[...]]] and backticks.
2026-10-09 12:35:33 +02:00
Levi Neely 9f69654d0c o: use slash separator in tui spawned commands
Slash is primary separator. Agent names may contain colons but
session names don't contain slashes, so slash is unambiguous.
2026-10-09 12:30:08 +02:00
Levi Neely 1d688d9944 o: sanitize agent name for tmux session too
Agent names like src:ollie need colon replaced with dash.
2026-10-09 12:29:14 +02:00
Levi Neely 9b063a24ce o: fix context parsing - slash is primary separator
Agent names may contain colons (e.g., src:ollie), so slash must
be the primary separator. Colon separator is only for the rare
case where session names contain slashes.

default/src:ollie now correctly parses as:
  session = default
  agent = src:ollie
2026-10-09 12:28:02 +02:00
Levi Neely aa939b0f84 o: fix tmux session targeting in tui command
Remove = prefix from tmux -t arguments - it doesn't work with
pane specifiers (:0.1). Also changed -g to -t for mouse option.
2026-10-09 12:24:35 +02:00
Levi Neely c30c75cea9 o: fix tui with session names containing slashes
- Sanitize tmux session name (replace / and : with -)
- Include agent name in tmux session for uniqueness
- Quote context arg in spawned o commands
- Use colon separator for robustness
2026-10-09 12:23:08 +02:00
Levi Neely e1d01716f3 o: support colon separator and quoted names in context arg
- session:agent works as alternative to session/agent
- Colon takes precedence (allows slashes in session names)
- Quoted arguments with spaces now work: o "my session:agent" prompt
- Removed set -- $* which broke quoted arguments
- Updated help with examples
2026-10-09 12:21:20 +02:00
Levi Neely 56f6d3c655 gui: add Peers button and peer management window
Canvas-based graph visualization of agents in current session:
- Nodes represent agents, colored by state
- Edges represent peer connections
- Drag nodes to reposition
- Click two nodes to toggle connection
- Double-click to start connecting
- Right-click for context menu
- Pan with middle mouse, zoom with scroll wheel
- Auto-layout arranges nodes in circle

9P API methods: listPeers, addPeer, removePeer, listAgentsInSession
2026-10-09 12:19:42 +02:00
Levi Neely 05dd33c1cf kate: remove git++ plugin integration
Use only Kate's built-in project git features. The reviewDiff action
now uses the active document text directly.
2026-10-09 12:13:01 +02:00
Levi Neely 83cae21957 kate: simplify diff review to git-based actions
Remove complex DiffWidget detection and context menu injection.
Add 'Review Staged Changes' and 'Review Unstaged Changes' to editor
context menu when in a git repo. Uses git diff directly.

-119 lines of code removed.
2026-10-09 12:11:44 +02:00