Commit Graph

2588 Commits

Author SHA1 Message Date
Levi Neely 35fefefdc7 prompts: clarify background output requires agent idle state
Background process output is only injected when the agent is idle.
If the agent keeps making tool calls, the output won't arrive until
the turn ends.
2026-10-08 18:47:57 +02:00
Levi Neely cdadcd7543 gui: _ is word delimiter for double-click selection
Double-click on snake_case selects one segment. B3 path expansion still
includes _ (isfilec charset), so paths expand fully.
2026-10-08 18:07:05 +02:00
Levi Neely e669be7b81 gui: include _ in isfilec for B3 path expansion
Paths like /path/to/snake_case_file.php:82 now expand fully on B3.
2026-10-08 18:06:17 +02:00
Levi Neely 445a5232c2 gui: B3 plumbs without selecting; _ included in word chars
B3 (right-click) on a word now plumbs it directly without visually
selecting it first. Double-click word selection includes underscores,
so snake_case selects the whole identifier.
2026-10-08 18:03:21 +02:00
Levi Neely 53a085f034 gui: exclude _ from word delimiters
Double-click word selection now stops at underscores, so snake_case
identifiers select one segment at a time.
2026-10-08 18:00:05 +02:00
Levi Neely 8147b3885f gui: use TapHandler for double-click pair selection
MouseArea's onDoubleClicked doesn't fire when placed on a TextEdit with
selectByMouse:true — the TextEdit's internal mouse handling consumes the
events. TapHandler coexists with TextEdit's mouse handling and reliably
receives double-tap events.

Double-click on a bracket or quote delimiter now selects the content
between the matching pair. Quotes use parity to decide opener/closer
direction. Falls back to word selection when no delimiter is adjacent.

Works in chat blocks (mainTextEdit, textComponent) and prompt textarea.
2026-10-08 17:57:40 +02:00
Levi Neely 840723de3b gui: fix coordinate mapping for prompt textarea double-click
The MouseArea (chordArea) is a sibling of the ScrollView containing
promptInput, so mouse.x/y are relative to the parent Item, not the
TextArea. Map coordinates via mapToItem before calling positionAt.
2026-10-08 17:49:53 +02:00
Levi Neely 7cfd472193 gui: shared TextSelection.js for bracket/quote pair selection
Extract selectBracketPair, selectWordAt, and helpers into TextSelection.js
and import it in both ChatBlockDelegate.qml and ChatPane.qml. Prompt
textarea now has the same double-click behavior as chat blocks:
delimiter adjacent to cursor -> select pair content, else -> word select.

Quotes use parity to decide direction and scan document-wide, so
multi-line content between the pair is selected in full.
2026-10-08 17:47:05 +02:00
Levi Neely 794cecfa6c gui: quote-pair selection spans full document, not one line
Quote matching now scans the whole block text and computes opener/closer
parity document-wide, so content between a '' "" `` pair that spans
multiple lines is selected in full. The adjacent quote (left or right of
the cursor) sets the direction; the matching end quote is found by
scanning that way.
2026-10-08 17:42:50 +02:00
Levi Neely 4b2c14943d gui: do word select ourselves on double-click
The overlay MouseArea swallows the B1 double-click, so returning
mouse.accepted=false did not make the TextEdit perform its native
word select — a non-delimiter double-click selected nothing. Now the
handler selects the word directly via selectWordAt when no bracket or
quote pair is under the cursor, so double-click is deterministic:
delimiter -> pair select, otherwise -> word select.
2026-10-08 17:37:03 +02:00
Levi Neely 5170361e90 gui: fix chat block binding loop breaking rendering
The Item wrapper added in 1cfa424 set height: mainTextEdit.height while
the TextEdit used anchors.fill: parent, so the TextEdit height depended
on the Item height and vice versa. The resulting binding loop collapsed
the block layout into visual garbage. Size the TextEdit from
width: parent.width and let its content height drive the Item.
2026-10-08 17:33:41 +02:00
Levi Neely 86977b3ca3 gui: extend double-click pair selection to quotes
selectBracketPair now also handles '' "" `` quote pairs. Since a
quote char opens and closes with the same glyph, a quote to the right
of the cursor scans forward for its match, and a quote to the left
scans backward.
2026-10-08 17:30:34 +02:00
Levi Neely 1cfa424220 gui: bracket-pair selection on double-click
Double-clicking next to a bracket (()[]{}) selects the text between
the matching pair, including nested pairs. Falls through to the
default word-select when no bracket is adjacent.

Also: B3-click on word now highlights it before plumbing.
2026-10-08 17:23:16 +02:00
Levi Neely 36e8b0abd3 gui: fix B2/B3 mouse handling in editable TextEdit
Handle events in onPressed instead of onClicked so they work
with editable text. Remove propagateComposedEvents since we
want to intercept middle/right clicks completely.
2026-10-08 16:23:12 +02:00
Levi Neely b119668965 gui: B3-click on word expands to file path (acme-style)
RMB on text without selection now expands to the word at cursor using
acme's isfilec character set: alphanumeric + . - + / : @

This matches acme behavior for clicking on file paths like foo.go:42
2026-10-08 16:20:29 +02:00
Levi Neely 5bf29198ff gui: pass session cwd as plumb wdir for relative path resolution
Plumb messages now include the current session's cwd as wdir.
Added sessionCwd() helper to ChatPane and ChatBlockDelegate.
Updated plumber.plumb() to accept optional wdir parameter.
2026-10-08 15:44:39 +02:00
Levi Neely 5add387cc8 gui: suppress RMB context menus in prompt and chat blocks
B3 (right-click) now only plumbs selection when available — no fallback
context menu. Mouse chording (B1+B2 cut, B1+B3 paste) still works.
Removed contextMenuComponent and promptContextMenu entirely.
2026-10-08 15:40:31 +02:00
Levi Neely fa58b0f033 gui: make chat block text editable for scratchpad use
Remove readOnly from TextEdit components in ChatBlockDelegate.
Users can now edit text in-place — changes are local only, not persisted.
2026-10-08 15:35:37 +02:00
Levi Neely 9618c79232 gui: native 9P plumb client with edit receiver and mouse chording
Replace QProcess plumb binary shell-out with proper 9P2000 plumb client:
- ninep.h/cpp: minimal 9P2000 protocol client for plan9port plumber
- plumbmsg.h/cpp: plumb message pack/unpack wire codec
- plumber.h/cpp: full plumb client with:
  - socketPath() resolving $NAMESPACE/plumb or display fallback
  - send()/sendTo() write packed messages to send port via 9P
  - PlumbReader thread blocks on edit port, emits edit(file,addr,wdir)
  - startReader() starts the receive loop
  - available() checks plumb socket existence

Add Acme-style mouse chording to ChatBlockDelegate.qml:
- B1+B2 = cut (snarf)
- B1+B3 = paste
- Context menu now includes Cut/Paste with chord hints

Legacy plumb()/plumbTo() methods preserved as aliases to send()/sendTo().
2026-10-08 15:34:29 +02:00
Levi Neely 4774cb9fe9 gui: convert ProcManager to separate Window, sync to active session
- Convert from Dialog to Window (not modal, separate window)
- Title shows current session name
- Syncs to activeSessionId/activeAgentId changes in main window
- Header shows which session is being displayed
- Double-click row to view output
- Sort processes by PID descending (newest first)
- Clear selection when session changes
2026-10-08 14:57:25 +02:00
Levi Neely 491f5ff2ae gui: add 'Open Workdir' context menu for sessions and agents
- Add openDirectory() method using QDesktopServices::openUrl
- Session context menu: opens session cwd
- Agent context menu: opens agent's effective cwd
2026-10-08 13:38:29 +02:00
Levi Neely af21dfa770 kde: remove KF5 .protocol file, use KF6 JSON metadata
The ollie.protocol file was being installed to kservices5/, which is
the KF5 mechanism. KF6 KIO workers embed protocol metadata in the
plugin's JSON file (ollie.json), which we already have.

Remove:
- kio/ollie.protocol file
- CMake install rule for .protocol file

Manual cleanup needed: sudo rm -rf /usr/local/share/kservices5/
2026-10-08 12:24:48 +02:00
Levi Neely 01360b961d gui: add process manager dialog
- Add procStarted signal to Ollie9pClient for proc.start events
- Add listProcs(), procTerm(), procKill(), procOutput() methods
- Create ProcManagerDialog.qml showing background processes for
  the active session/agent with status, runtime, commands
- Add 'Procs' button to action toolbar to open the dialog
- Auto-refresh every 2 seconds when dialog is visible
- Support terminate, kill, and view output actions
2026-10-08 12:14:02 +02:00
Levi Neely 414dae05f8 dispatch: include no-wait instruction in system-proc-background
Every background process emission now includes:
'Do NOT sleep, poll, or wait. Continue with other work —
output will be injected automatically when available.'
2026-10-08 11:21:40 +02:00
Levi Neely 8da78f4deb prompts: never sleep/poll/wait for background processes
Add explicit instruction that models must not use sleep, loops,
or any blocking mechanism to wait for background process output.
The system injects updates automatically.
2026-10-08 11:13:54 +02:00
Levi Neely 1548af81af kate: find GitWidget's button bar and insert Ollie button there
The GitWidget delays initialization until showEvent. Find the
QHBoxLayout containing QToolButtons (the button bar) and insert
our button there, next to Commit/Push/Pull buttons.
2026-10-08 10:40:04 +02:00
Levi Neely b745170898 kate: add Ollie button to git tool view instead of context menu
The GitWidget creates local QMenu objects that can't be intercepted.
Instead, add a QToolButton with dropdown menu to the git tool view:

- Review Staged Changes
- Review Unstaged Changes
- Explain Selected Files

This approach doesn't require Kate source modification.
2026-10-08 10:36:27 +02:00
Levi Neely c3782dd3b7 kate: fix git widget integration via ChildAdded event filter
The previous approach using QMetaObject::invokeMethod on gitWidget()
failed because that method isn't Q_INVOKABLE. The new approach:

- Find git tool view by object name or 'git' in name
- Install event filter to catch QEvent::ChildAdded
- When a QMenu child is added, connect to aboutToShow
- Add Ollie actions to the menu before it's shown

Also add retry timer for setupProjectGitWidget since the plugin
view may not exist at construction time.
2026-10-08 10:34:06 +02:00
Levi Neely a546b8721a kate: integrate with project plugin git widget and diff viewer
- setupProjectGitWidget(): Hook into kateprojectplugin's GitWidget
  via gitWidget() method, install event filter on tree view
- addOllieActionsToGitContextMenu(): Add 'Review Staged Changes' and
  'Ask About Selection' to the git widget's context menu
- reviewStagedChanges(): Get staged (or unstaged) diff via git process
- askAboutGitSelection(): Ask Ollie about selected files in git view
- onWidgetAdded(): Detect DiffWidget additions by shouldClose() method
- onDiffWidgetContextMenu(): Add 'Review This Diff' to diff widget
- reviewDiffFromWidget(): Extract diff from widget and send to Ollie
2026-10-08 10:29:12 +02:00
Levi Neely ab4f0ef785 Revert "gui: remove cut/copy/paste from prompt input"
This reverts commit eb09a95a64.
2026-10-07 17:35:10 +02:00
Levi Neely eb09a95a64 gui: remove cut/copy/paste from prompt input
- Remove cut/copy/paste menu items from context menu
- Remove paste button (📋) from input row
- Remove B1+B2/B1+B3 chord handling for cut/paste
- Simplify mouse handling to just B2=exec, B3=plumb
- Standard Ctrl+X/C/V still work via TextArea defaults
2026-10-07 17:30:28 +02:00
Levi Neely c2df632744 agent/new: parse cwd parameter into CwdOverride
The cwd= parameter in agent/new payloads was not being parsed,
so scripts like ollie-session-here could not set agent cwd on
creation. Now parsed and passed to AgentParams.CwdOverride.
2026-10-07 15:32:53 +02:00
Levi Neely a899f933fb acme-ollie-ensure: always update agent cwd
Match ollie-session-here behavior: update cwd for existing agents,
not just on creation. Ensures agent cwd reflects current project root
when invoked from a different context.
2026-10-07 15:24:46 +02:00
Levi Neely f7a52088db per-agent cwd override with session-level inheritance
- Agent cwd is optional; empty = inherit session cwd (the common case)
- Session cwd is required at creation and is the inheritance root
- toolsrv maintains agentCWD map, resolved per call from agent= field
- Override set via agent cfg (cwd=...) or ctl (cwd [<dir>|-])
- Agent.SyncCwdToToolServer re-pushes on every (re)connect
- GUI NewAgentDialog shows '(inherit: <sessionCwd>)' as placeholder
- proc_test.go covers per-agent cwd isolation
- Kate and acme scripts updated for new session/agent creation flow
- AGENTS.md documents the architecture
2026-10-07 15:14:04 +02:00
Levi Neely d5efe575ce consistent agent naming: parent:prefix convention
Agent names derived from cwd using parent:prefix format:
- /home/user/src/ollie -> src:ollie
- /home/user/proj/ABC-123_feature/repo -> abc-123:repo

Updates:
- Kate plugin: one agent per project, git root fallback if no project plugin
- acme-ollie-ensure: single 'acme' session, per-project agents
- ollie-session-here: single 'default' session, per-project agents

Also fixed write -> rdwr for session/agent creation endpoints
2026-10-07 14:39:47 +02:00
Levi Neely 1c02b50add proc events, bypass shortcuts, Kate session fix
Backend:
- Add proc.start/proc.exit events for background process lifecycle
- Add proc idx ctl command for machine-readable process listing (TSV)
- Add event.pub file for external event publishing
- Add ListProcsIdx to toolclient and toolsrv
- Fix bypass commands to use Setpgid for process group isolation

GUI:
- Add configurable bypass approval shortcuts (Ctrl+Y/Ctrl+N default)
- Add Keyboard Shortcuts section to Settings dialog
- Store shortcuts in theme.conf

Kate:
- Fix 'Start Session Here' - use rdwr for session/new endpoint
2026-10-07 14:22:44 +02:00
Levi Neely b9026bb48b fix: allow group access to ctl, plan, fifo for frontend interaction
Changed from 0600 (owner only) to 0660 (owner + group):
- ctl: frontends need to send slash commands
- plan: frontends need to read/write plan
- fifo: frontends need to submit prompts via queue

The agent group includes frontends, so group permissions enable
frontend interaction while still maintaining ownership-based isolation.
2026-10-07 11:01:01 +02:00
Levi Neely d65c06f27b implement namespace-bounded capability model
Per-agent file ownership with Unix permission enforcement:
- Agent directories owned by agent ID (UID), group 'agent' (GID)
- Private files (plan, ctl, fifo): mode 0600 - owner only
- Group-readable (chat, log): mode 0440 - owner + agent group
- World-readable (state, id): mode 0444 - observable by all
- Prompt: mode 0220 - CLI and owner can write

virtfs: fix UID/GID inheritance through nested paths
- Added findChildWithInheritance() to accumulate inherited UID/GID
- Stat now correctly shows agent ID as owner for nested files

server: admin bypass for server owner
- serverAdmin variable captures the Unix user running olliesrv
- Admin bypass includes empty uname, 'admin', or server owner

Documentation updates:
- fs/doc.go: 'The Namespace IS the Security Model'
- registry/doc.go: capability-based tool access
- peer.go: capability-based peer access
- lessons-learned.md: 'Model compliance is not a security boundary'
- architecture-9p.md: per-agent file ownership section

Security evaluation:
- Added experiments/security-eval/ with NERV attack corpus adaptation
- Test scripts for Landlock sandbox validation
- RESULTS.md documenting 0% ASR on hostile operations

This implements the NERV thesis: 'An agent can only access resources
explicitly bound into its namespace.' Enforcement is structural via
file permissions, not behavioral via model compliance.
2026-10-06 17:41:27 +02:00
Levi Neely 91f295dc2d gui: add activeSessionPaused property for reactive paused state
The isSessionPaused() Q_INVOKABLE didn't trigger QML binding
re-evaluation on pause/resume. New property with proper signal
makes ChatPane bindings reactive.

- activeSessionPaused property tracks active session's paused state
- Updated on refreshSessions() and switchAgent()
- ChatPane.qml uses property instead of function call
2026-10-06 15:23:44 +02:00
Levi Neely 4be78447fa gui: restart agent streams on session resume
When resuming the active session, restart chat stream so user
can continue working without switching agents.
2026-10-06 15:20:50 +02:00
Levi Neely 7cbaaed014 gui: gray state indicator when session is paused
Session paused state overrides agent state for the indicator.
Reacts to sessionsChanged signal for pause/resume updates.
2026-10-06 15:16:57 +02:00
Levi Neely 0744d9227a doc: update for bypass coordination and state indicators
evolution.md: add Phase 39, update timeline and size snapshot
event-topics.md: bypass events are per-agent, add resolved event
architecture-kde.md: document state dot and bypass indicator
usage.md: add bypass, approve, deny commands
2026-10-06 15:15:16 +02:00
Levi Neely af772e5e8b gui: use relative geometry for state indicator
Size and margins scale with row height:
- height: 30% of row height
- width: same as height (circular)
- left margin: 15% of row height
- right margin: 25% of row height
2026-10-06 15:13:01 +02:00
Levi Neely 8c207a0f3a gui: add right margin to state indicator dot 2026-10-06 15:12:00 +02:00
Levi Neely 64559de661 gui: add agent state indicator dot to session tree
Small colored dot to the right of agent name shows execution state:
- Green: idle
- Blue: thinking
- Orange: calling tool
- Gray: paused

Updates reactively via agentStateChanged event signal.
2026-10-06 15:10:12 +02:00
Levi Neely d8b24ae26d o: add bypass command to inspect pending request
o sess bypass - shows id, agent, cwd, cmd without resolving

Workflow: bypass -> review -> approve/deny
2026-10-06 14:58:22 +02:00
Levi Neely 7b6ddc1b1a o: accept optional request id for approve/deny
o sess approve [id]  - approve pending, optionally verify id
o sess deny [id]     - deny pending, optionally verify id

Shows request id in output: [42] approving: cmd
Errors if specified id doesn't match pending request.
2026-10-06 14:57:21 +02:00
Levi Neely b25e5e2fc6 bypass: emit resolved event for cross-client coordination
Server emits session.{sid}.agent.{aid}.bypass.resolved with id and
action (approved/denied) when a bypass is resolved by any client.

GUI handles bypass.resolved events to clear the banner and pending
count when CLI or another client resolves a bypass request.

This allows CLI 'o sess approve' to clear the GUI banner automatically.
2026-10-06 14:54:55 +02:00
Levi Neely b440622441 o: add approve/deny commands for bypass requests
Works at session or agent context (bypass is session-level).
Reads pending request from session/{s}/bypass, extracts ID,
writes '{id} approve' or '{id} deny' to resolve.
2026-10-06 14:52:07 +02:00
Levi Neely 150ca5dfdd gui: add pending bypass indicator to agent tree
Track multiple concurrent pending bypasses per agent in C++ backend:
- Add m_pendingBypasses QHash<QString,QSet<QString>> keyed by session:agent
- Add pendingBypassCount(sessionId, agentId) Q_INVOKABLE
- Add pendingBypassCountChanged(sessionId, agentId) signal
- Update resolveBypass to take agentId and remove from tracking set

SessionTree.qml: show ⚠ indicator left of agent name when the agent
has pending bypass requests. Uses Connections to refresh on signal.

ChatPane.qml: pass agentId to resolveBypass calls.
2026-10-06 14:47:55 +02:00