6.1 KiB
6.1 KiB
Proc Window Feature Design
Overview
A dedicated window for managing background processes (tools running in background mode). Accessible via context menu on sessions/agents in the tree view.
User Flow
- Right-click session/agent → "Processes..."
- Opens ProcWindow showing all background procs for that scope
- Window tracks the active session (when main GUI switches session, proc window updates)
- Can also be "pinned" to a specific session/agent
UI Components
ProcWindow.qml
┌─────────────────────────────────────────────────────────────┐
│ Processes - {session}/{agent} [📌] [×] │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────────────────────────────────────────────────┐ │
│ │ PID │ Tool │ Status │ Runtime │ Actions │ │
│ ├─────┼───────────┼─────────┼──────────┼─────────────────┤ │
│ │ 5 │ shell │ running │ 2m 34s │ [▶] [■] [×] │ │
│ │ 3 │ web_fetch │ exited │ 45s │ [▶] [🗑] │ │
│ │ 1 │ shell │ exited │ 12s │ [▶] [🗑] │ │
│ └─────────────────────────────────────────────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ Output for PID 5 [Clear] │
├─────────────────────────────────────────────────────────────┤
│ $ npm install │
│ npm WARN deprecated... │
│ added 123 packages in 45s │
│ █ │
└─────────────────────────────────────────────────────────────┘
Actions
| Icon | Action | Description |
|---|---|---|
| ▶ | Stream | Open output stream (updates in real-time) |
| ■ | Term | Send SIGTERM (graceful stop) |
| × | Kill | Send SIGKILL (force kill) |
| 🗑 | Dismiss | Remove from list (exited procs only) |
Features
- Live refresh: Subscribe to proc events or poll
proc idx - Output streaming: Read proc output via
proc out <pid> - Session tracking: Follow active session in main GUI (optional pin)
- Multi-agent view: When opened on session, show all agents' procs
- Auto-scroll: Output pane auto-scrolls unless user scrolls up
Backend Implementation Status
✅ Phase 1: Backend (DONE)
Proc Events
session.{sid}.agent.{aid}.proc.start— emitted when background proc spawns- Payload:
{pid}\t{tool}\t{cmd}
- Payload:
session.{sid}.agent.{aid}.proc.exit— emitted when background proc exits- Payload:
{pid}\t{exit_code}\t{tool}\t{cmd}
- Payload:
Machine-Readable Proc Index
proc idxctl command returns TSV format:pid<TAB>status<TAB>exit_code<TAB>tool<TAB>cmd<TAB>start_unix<TAB>runtime_sec
- Status is
runningorexited - Exit code is
-1for running processes
Event Publishing Endpoint
event.pubfile at root namespace accepts writes:topic<TAB>payload- Used by toolsrv to publish proc.exit events back to olliesrv
🔲 Phase 2: GUI (TODO)
- Create ProcModel (C++ model for proc list)
- Create ProcWindow.qml
- Add context menu action to SessionTree.qml
- Wire up event subscription for live updates
🔲 Phase 3: Polish (TODO)
- Session tracking / pin toggle
- Output search/filter
- Keyboard shortcuts
- Copy output to clipboard
Files Modified (Phase 1)
cmd/olliesrv/internal/agent/agent.go— addedonProcStartcallbackcmd/olliesrv/internal/agent/state.go— addedSetOnProcStartcmd/olliesrv/internal/agent/dispatch.go— call callback on proc startcmd/olliesrv/internal/fs/support.go— wire callback to publish eventcmd/olliesrv/internal/fs/spec.go— addedevent.pubfile,proc idxcommandcmd/olliesrv/internal/toolclient/toolsrv.go— addedListProcsIdxcmd/toolsrv/internal/server/proc.go— addedListProcsIdxForAgentcmd/toolsrv/internal/server/server.go— addedproc/idxfilecmd/toolsrv/main.go— publish proc.exit event via event.pubdoc/event-topics.md— documented new proc events
API Reference
ctl Commands
# Human-readable proc list
echo "proc top" | ollie-9p rdwr session/$SID/agent/$AID/ctl
# Machine-readable proc index (TSV)
echo "proc idx" | ollie-9p rdwr session/$SID/agent/$AID/ctl
# Get proc output
echo "proc out 5" | ollie-9p rdwr session/$SID/agent/$AID/ctl
# Signal proc
echo "proc term 5" | ollie-9p rdwr session/$SID/agent/$AID/ctl
echo "proc kill 5" | ollie-9p rdwr session/$SID/agent/$AID/ctl
# Dismiss exited proc
echo "proc dismiss 5" | ollie-9p rdwr session/$SID/agent/$AID/ctl
Event Subscription
# All proc events for all sessions/agents
echo "session.*.agent.*.proc.>" | ollie-9p rdwrs event
# Proc events for specific session
echo "session.abc123.agent.*.proc.>" | ollie-9p rdwrs event
# Only proc.start events
echo "session.*.agent.*.proc.start" | ollie-9p rdwrs event
proc idx Output Format
pid status exit_code tool cmd start_unix runtime_sec
5 running -1 shell make test 1723456789 45.2
3 exited 0 web_fetch fetch docs 1723456700 12.5