diff --git a/doc/architecture-kde.md b/doc/architecture-kde.md index 1cb9a8c..6d2aef3 100644 --- a/doc/architecture-kde.md +++ b/doc/architecture-kde.md @@ -19,14 +19,17 @@ The KDE clients do not embed provider selection, prompt assembly, tool execution `ollie-gui` displays active sessions and agents, streams chat, submits prompts, and exposes common controls: -- Session tree with agent state indicators. +- Session tree with agent indicators: + - State dot (right of name): green=idle, blue=thinking, orange=calling, gray=paused + - Bypass indicator (left of name): ⚠ when pending approval needed - Chat rendering for assistant, tool, reasoning, and markdown-block output. +- Bypass approval banner with Approve/Deny buttons. - Prompt entry with slash-command support. - Session and agent creation dialogs. - Model, backend, profile, stop, kill, compact, and help actions. - KDE Plasma palette detection with a Qt Quick Basic fallback outside Plasma. -The application communicates through 9P. It does not need a running desktop daemon beyond `olliesrv` and the 9P client/socket environment. +The application communicates through 9P and the event stream. It does not need a running desktop daemon beyond `olliesrv` and the 9P client/socket environment. ## Build and installation diff --git a/doc/event-topics.md b/doc/event-topics.md index 5aabb80..9041414 100644 --- a/doc/event-topics.md +++ b/doc/event-topics.md @@ -18,7 +18,6 @@ session.{sessionId}.agent.{agentId}.{type} | `session.{sid}.rename` | `{oldName} {newName}` | Session renamed | | `session.{sid}.pause` | — | Session paused | | `session.{sid}.resume` | — | Session resumed | -| `session.{sid}.bypass.request` | `{id}\t{cmd}\t{cwd}` | Bypass approval requested | ## Agent Events @@ -27,6 +26,8 @@ session.{sessionId}.agent.{agentId}.{type} | `session.{sid}.agent.{aid}.new` | — | Agent created | | `session.{sid}.agent.{aid}.kill` | — | Agent destroyed | | `session.{sid}.agent.{aid}.state` | `{state}` | State changed (idle, calling, thinking, paused) | +| `session.{sid}.agent.{aid}.bypass.request` | `{id}\t{cmd}\t{cwd}` | Bypass approval requested | +| `session.{sid}.agent.{aid}.bypass.resolved` | `{id}\t{action}` | Bypass resolved (approved/denied) | ## Filter Patterns @@ -46,7 +47,10 @@ echo "session.*.agent.*.state" | ollie-9p rdwrs event echo "session.abc123.>" | ollie-9p rdwrs event # Bypass requests only -echo "session.*.bypass.>" | ollie-9p rdwrs event +echo "session.*.agent.*.bypass.request" | ollie-9p rdwrs event + +# All bypass events (request + resolved) +echo "session.*.agent.*.bypass.>" | ollie-9p rdwrs event ``` ## Filter Syntax diff --git a/doc/evolution.md b/doc/evolution.md index c0dea34..db1993d 100644 --- a/doc/evolution.md +++ b/doc/evolution.md @@ -100,9 +100,10 @@ gantt One-tool bootstrap discovery :done, 2026-08-21, 1d Explicit tool loading :done, 2026-08-21, 1d Streaming rdwr + event filters :done, 2026-08-22, 1d + Bypass coordination + state UI :done, 2026-10-06, 1d ``` -## Current Size (Aug 22) +## Current Size (Oct 6) | Component | Lines | Notes | |-----------|------:|-------| @@ -2175,10 +2176,11 @@ The event stream now carries all real-time state: | `session.{sid}.rename` | oldName newName | | `session.{sid}.pause` | — | | `session.{sid}.resume` | — | -| `session.{sid}.bypass.request` | id\tcmd\tcwd | | `session.{sid}.agent.{aid}.new` | — | | `session.{sid}.agent.{aid}.kill` | — | | `session.{sid}.agent.{aid}.state` | idle\|calling\|thinking\|paused | +| `session.{sid}.agent.{aid}.bypass.request` | id\tcmd\tcwd | +| `session.{sid}.agent.{aid}.bypass.resolved` | id\tapproved/denied | ### Source changes @@ -2196,3 +2198,52 @@ fs/spec.go -35 removed feed, statewait, bypasswait files ``` Net: **-222 lines** of unused infrastructure removed. + +## Phase 39: Bypass Coordination and State Indicators (Oct 6) + +Cross-client bypass approval and real-time agent state visualization in the GUI. + +### Bypass request/resolve coordination + +The bypass system now emits events for both requests and resolutions, enabling CLI and GUI to coordinate: + +**Request event** (existing): `session.{sid}.agent.{aid}.bypass.request` with payload `id\tcmd\tcwd` + +**Resolved event** (new): `session.{sid}.agent.{aid}.bypass.resolved` with payload `id\tapproved/denied` + +The GUI tracks pending bypasses per-agent in an in-memory collection (`m_pendingBypasses` QHash), enabling support for multiple concurrent pending bypasses (e.g., from background processes). When CLI resolves a bypass, the server emits the resolved event, and the GUI clears its state automatically. + +### CLI bypass workflow + +Added three commands to the `o` CLI wrapper: + +```bash +o sess bypass # inspect pending: shows id, agent, cwd, cmd +o sess approve [id] # approve (optional id for safety) +o sess deny [id] # deny +``` + +The optional `id` argument prevents accidental approval of the wrong request when multiple bypass requests may have been issued. + +### GUI indicators + +**Pending bypass indicator** — Yellow ⚠ to the left of agent name in session tree. Visible when `pendingBypassCount > 0` for that agent. Clears automatically on resolution (by GUI buttons or CLI). + +**Agent state indicator** — Colored dot to the right of agent name showing execution state: +- 🟢 Green: idle +- 🔵 Blue: thinking +- 🟠 Orange: calling tool +- ⚪ Gray: paused + +Both indicators use relative geometry (percentages of row height) for proper scaling across font sizes and DPI settings. + +### Source changes + +```text +session/session.go +12 emit bypass.resolved event +ollie9pclient.h +8 m_pendingBypasses, pendingBypassCount, bypassResolved signal +ollie9pclient.cpp +45 handle bypass.resolved event, track pending counts +ChatPane.qml +12 onBypassResolved handler +SessionTree.qml +55 bypass indicator (⚠) and state indicator (dot) +data/scripts/o +65 bypass, approve, deny commands +``` diff --git a/doc/usage.md b/doc/usage.md index b2b00be..99a2e81 100644 --- a/doc/usage.md +++ b/doc/usage.md @@ -87,6 +87,9 @@ The slash in `/` disambiguates session-only from session+agent. | `o / new [cwd]` | agent | Create session (if needed) + agent | | `o ls` | session | List session contents | | `o ctl ` | session | Session control | +| `o bypass` | session | Show pending bypass request details | +| `o approve [id]` | session | Approve pending bypass request | +| `o deny [id]` | session | Deny pending bypass request | | `o / prompt` | agent | Interactive multi-line prompt REPL | | `o / tui` | agent | Launch tmux TUI | | `o / ctl ` | agent | Agent control (stop, compact, model, etc.) |