Commit Graph

49 Commits

Author SHA1 Message Date
Levi Neely bb1454f85a fix: ollie_ghost compile — stripPrefixEcho signature and forward declarations 2026-08-07 08:59:03 +02:00
Levi Neely 08ec46027e kate: replace ollie-9p complete with generate for code completions
- Build the completion prompt inline (mirrors agent/complete.go prompt)
- Call ollie-9p rdwr generate instead of ollie-9p rdwr complete
- Pass backend/model as JSON fields in the generate request
- StripCompletionNoise and stripPrefixEcho moved into C++ helpers
2026-08-07 07:37:42 +02:00
Levi Neely ab8aa8d719 kate: add 'Start Session' context action
Available without text selection. Ensures a kate session/agent exists
(reuses existing or creates new), sets cwd to the current project
directory, and updates the status bar.
2026-08-06 16:58:02 +02:00
Levi Neely 05fa829ec1 kate: ESC dismisses ghost completion 2026-08-06 16:55:47 +02:00
Levi Neely c1160a468a ghost: add tinted background to multi-line overlay
The overlay now draws a semi-opaque background (editor base color
tinted slightly toward highlight) so continuation lines are clearly
distinguished from the underlying document text. Re-enabled the
multi-line overlay since it's now visually distinct from real content.

- Background at 92% opacity with subtle highlight tint
- Ghost text at 60% opacity (up from 40%)
- Small padding around overlay content
2026-08-06 16:54:02 +02:00
Levi Neely e4c831df89 kate: add config page with 'Automatic completion' toggle
Adds a Settings → Configure Kate → Plugins → Ollie config page with a
checkbox to enable/disable automatic ghost text completion. The setting
persists via KConfig and is applied when the ghost provider is created.
2026-08-06 16:52:16 +02:00
Levi Neely 1df0daf9de kate: reuse single agent, write cwd on project change
Instead of one-agent-per-project-directory, reuse the first agent in
the kate session. When the project changes, write the new directory
to the agent's ctl file (cwd command). Simpler model — one kate
session, one agent, cwd follows the active project.
2026-08-06 16:50:49 +02:00
Levi Neely 48a5250194 kate: add 'Send verbatim' context action
Sends selected text wrapped in a code fence with the appropriate language
(derived from Kate's highlighting mode). Useful for pasting code snippets
directly to the agent without any surrounding prompt text.
2026-08-06 14:56:13 +02:00
Levi Neely 2a6441cd53 kate: add connection state tracking and auto-recovery
Adds a heartbeat timer (5s interval) that pings the 9P server with a
cheap read. If the server goes down, the status bar turns red showing
'disconnected'. When it comes back, the plugin reconnects and
re-selects the agent for the current project.

Status bar now shows connection state:
- Red '✗ disconnected' — server unreachable
- Gray '○ no agent' — connected but no agent selected
- Green '● kate/ID' — connected with active agent
2026-08-06 14:09:33 +02:00
Levi Neely d90a2e6f27 ghost: fix completion overlapping existing document text
- Don't show inline ghost note when cursor is mid-line (text exists
  after cursor) — the ghost would visually conflict with real content
- Only show multi-line overlay when cursor is near EOF, so continuation
  lines don't paint on top of existing document lines
- Tab-accept still works regardless of visual display
2026-08-06 13:49:22 +02:00
Levi Neely 7aad74dafe kate: simplify plugin — remove chat panel, keep context actions + ghost text
Strip the plugin down to its core value:
- Context menu actions (explain, fix, refactor, document, test, review diff)
- Ghost text completion (unchanged)
- Git++ review diff integration
- Auto agent-per-project matching (silent, no UI)
- Status bar indicator showing current agent

Removed:
- Chat panel (side panel UI, streaming, renderer)
- Inline annotations
- Emoji processing
- Config page (use env vars: OLLIE_COMPLETE_BACKEND, etc)
- Apply code blocks
- libkateprivate/diff viewer integration

3109 LOC → 1192 LOC. Use the KDE GUI app tiled alongside Kate for chat.
2026-08-06 13:39:30 +02:00
Levi Neely ce36dcde52 Update KDE README and remove D-Bus dependencies
- Rewrite README.md with accurate 9P-based architecture
- Remove all D-Bus dependencies:
  - Update dolphin/ollie-ask to use ollie-9p rdwr generate
  - Update kate/ollie_ghost.cpp to use ollie-9p rdwr complete
  - Remove QDBusInterface from ollie_ghost.h
  - Fix OllieGhostProvider constructor in ollie_kate.cpp
  - Remove D-Bus comments from gui/main.cpp and kate/ollie_kate.cpp
  - Remove QtDBus from CMakeLists.txt (KF5 and KF6)
  - Delete D-Bus test scripts test-e2e.sh and test-peers.sh
- Clarify no system tray component exists
- Update build/install instructions with just commands
2026-08-05 18:53:30 +02:00
Levi Neely 73e262ffaf kate: fix agent selection, block rendering, project change detection
- newAgent() is idempotent: selects existing agent by cwd if one exists
- Use rdwr() to get new agent ID from server instead of ls() ordering
- selectAgentForProject() returns bool for caller branching
- Connect to Kate project plugin projectChanged signal
- Update chat block parser to [[[type]]] / [[[end]]] format
- Guard pluginViewCreated for KF5 < 5.78
2026-08-05 17:51:27 +02:00
Levi Neely 2267c57b54 fix: kate plugin and krunner compilation 2026-08-01 15:07:50 +02:00
Levi Neely f5ccaf13bd kate: start chat/state streams on session switch
switchToSession() was loading the log but never starting the
streaming processes. New output from the agent was never delivered.
Now: stopStreams → load log → startChatStream + startStateStream.
2026-07-31 20:33:19 +02:00
Levi Neely 1ceeeeb39c kate: complete 9P conversion, remove all D-Bus dependencies
Replace all 28+ D-Bus call sites with 9P operations via plan9port's
9p command. Chat streaming via persistent QProcess reading the chat
file. State updates via statewait process restart loop.

Ghost text provider disabled (needs separate 9P port).

The entire KDE submodule is now D-Bus-free for server communication.
D-Bus is only used internally by KDE frameworks (KRunner plugin loading,
KStatusNotifierItem, etc.) — not for ollie protocol.
2026-07-31 20:25:04 +02:00
Levi Neely e89b723627 kill D-Bus: krunner+tray use 9P, remove plasmoid+tray, disable kate
- KRunner: rewritten to use plan9port 9p command for all operations
  (list sessions, kill, one-shot generate). No D-Bus dependency.

- Tray: removed. Was a thin D-Bus status wrapper, not useful enough
  to justify maintaining.

- Plasmoid: removed. GUI is standalone now.

- Kate: temporarily disabled in CMake. Header partially converted to
  9P (D-Bus includes removed, QProcess/9P helpers declared). Full
  conversion is next.

- All ninepBin() helpers use $PLAN9/bin/9p (not hardcoded path).

- CMake: removed Qt5::DBus, KF5::Notifications, KF5::Plasma deps.
  Only remaining link deps: Qt5::Core, Qt5::Widgets, Qt5::Quick,
  Qt5::QuickControls2, KF5::Runner.
2026-07-31 20:16:25 +02:00
Levi Neely f00ed7738d kate: fix crash in onSessionKilled
QTextDocument::setHtml was called while the document was still
tearing down from clear(). Defer refreshSessions to the next
event loop iteration with QTimer::singleShot(0, ...).
2026-07-31 16:34:33 +02:00
Levi Neely 75b9a5ffb1 kate: fix segfault in clearAnnotations on document close
MovingRanges are owned by the document. When the document is destroyed,
it deletes its ranges. If clearAnnotations is called after the document
is gone (e.g., view changed), qDeleteAll double-frees. Track the owning
document with QPointer and only delete ranges if it's still alive.
2026-07-30 17:05:56 +02:00
Levi Neely fad8baaa1b kate: windowed chat rendering for long conversations
Only render the last 40 blocks eagerly. Earlier messages are
lazy-loaded in chunks of 20 as the user scrolls up. This fixes
the progressive slowdown that occurred during long sessions where
the full HTML re-render on every ChatUpdated signal became O(n)
on the entire conversation history.
2026-07-24 14:45:19 +02:00
Levi Neely 62663aff4e add 6th arg (remote) to all CreateSession D-Bus calls 2026-07-24 11:58:09 +02:00
Levi Neely d223911191 kate: add "Review Diff" context menu via gitplusplus extension
Register an action with the gitplusplus plugin (kate-worktree) that
appears in the Git++ tree view context menu. When triggered, it reads
the computed diff from the gitplusplus lastDiff property and submits
it to the active ollie session for review.

Also adds a "Review Diff" entry to the standard KTextEditor context
menu when the document has Diff highlighting mode (fallback path).
2026-07-23 14:52:51 +02:00
Levi Neely 5ab7a46f4d Move Ask File and Explain to editor context menu 2026-07-23 14:30:15 +02:00
Levi Neely 1afedfca7d dbus: pass systemPrompt arg to CreateSession calls 2026-07-21 14:28:20 +02:00
Levi Neely d707dd3a56 kf5: fix build error and sync features with KF6
- kate: use KTextEditor::MovingInterface for newMovingRange() on KF5
- gui: rewrite main-kf5.qml with tiling panes, session graph, per-pane
  chat model, drag-to-swap, sloppy focus (matching KF6 ChatPane.qml)
2026-07-17 09:41:33 +02:00
Levi Neely 8e3418c4fe kate: navigate to applied line range after Apply 2026-07-16 21:54:07 +02:00
Levi Neely 0fa5522673 kate: apply button uses line ranges from fence metadata
Code fences with /path:start-end on the fence line get parsed.
Apply replaces that line range in the target file.
Fallback: insert at cursor or replace selection.
agent-copilot.md instructs model to produce ranged fences.
2026-07-16 21:41:31 +02:00
Levi Neely 0599fbceb7 kate: fix diff/apply URL scheme (use path not host to avoid QUrl IPv4 normalization) 2026-07-16 21:19:40 +02:00
Levi Neely 84b3123461 kate: fix context menu (use contextMenuAboutToShow signal, deduplicate actions)
Makefile: fix BUILD_DIR, install kate plugin to kf6/ path
prompts: clarify tools-elevate does NOT run as root
2026-07-16 21:07:39 +02:00
Levi Neely abec12e09f kate: editor integration — context menu, apply button, inline annotations
Context menu: right-click selection shows Fix/Refactor/Add tests/Document
actions that submit the selection with file+line context to the agent.

Apply button: code blocks in assistant messages get a clickable Apply
button that inserts the code into the target file (detected from
preceding prose) or the active document.

Inline annotations: file:line references in agent output are highlighted
with MovingRanges in the active editor view.
2026-07-16 20:44:46 +02:00
Levi Neely 378ea83de7 kate: add kill session button in upper right 2026-07-16 14:50:47 +02:00
Levi Neely e2d02152e4 kate: fix chat scroll not pinning to bottom
setHtml() resets the document layout. sb->setValue(sb->maximum()) was
reading a stale maximum before relayout completed. Use moveCursor(End)
+ ensureCursorVisible() which forces layout and scrolls reliably.

Also: fix session list state updates destroying delegates (rename fix)
already included in previous commit.
2026-07-16 14:45:26 +02:00
Levi Neely 2929bb6b04 kde: visual enhancements, emoji completion, scroll/layout fixes
ollie-gui:
- Structured chat blocks (user/assistant bubbles, tool/call with left borders)
- Tool/call blocks always visible (not collapsible), whitespace preserved
- User interrupt blocks (amber warning style)
- Copy buttons on bubbles (32x32, hover-visible)
- Emoji completion with popup selector + quick emoticons
- Backend/model display in header bar
- Session state updates on switch
- Scroll flicker fix (debounced, guarded)
- Null guards on delegate block properties
- Binding loop fixes

Kate plugin:
- Diff viewer integration via Kate DiffWidget (libkateprivate)
- Diff mode config (unified/side-by-side/raw)
- Emoji processing in prompt input (quick emoticons + :shortcode:)
- Increased chat font size
- Scroll position preservation

Dbus client:
- activeModel/activeBackend properties from GetConfig
2026-07-16 11:19:22 +02:00
Levi Neely d3c8aece38 kate: extract chat_renderer, simplify kate plugin 2026-07-16 08:57:55 +02:00
Levi Neely 6642ab014b multi-line prompt input across all front-ends
Replace single-line TextField/QLineEdit with multi-line TextArea/QPlainTextEdit.
Enter sends, Shift+Enter and Ctrl+J insert newlines. Max height capped so the
input area does not take over the panel.
2026-07-16 06:19:14 +02:00
Levi Neely fcc3cd2313 kate stop button, sorted sessions, scroll pinning, install fix
- Kate: add always-visible stop button next to prompt input
- All front-ends: sort sessions alphabetically by ID
- All front-ends: only auto-scroll chat if at bottom, show
  floating go-to-bottom button when scrolled away
- CMakeLists: set KDE_INSTALL_PLUGINDIR to QT6_INSTALL_PLUGINS
  so plugins install to lib64/qt6/plugins/ (where Kate looks)
2026-07-16 06:03:15 +02:00
Levi Neely d5e27f1c82 fix kate crash 2026-07-15 17:55:14 +02:00
Levi Neely 455d9c9190 kate: fix use-after-free crash in setupGhostProvider
m_ghost was parented to the view, so Qt parent-child cleanup could
destroy it when a view was replaced. The raw pointer remained non-null,
causing a double-free on the next viewChanged signal.

Fix by using QPointer<OllieGhostProvider> which auto-nulls on destroy.

Also replace qobject_cast with dynamic_cast for KF5 KTextEditor
interfaces to avoid crashes when qt_metacast accesses uninitialized
KateViewConfig during early view activation.
2026-07-15 11:06:20 +02:00
Levi Neely 5d18806ad6 kate: add KF5 preprocessor guards for InlineNote and completion APIs
KF5's KTextEditor uses interface classes (InlineNoteInterface,
CodeCompletionInterface, ConfigInterface) accessed via qobject_cast,
whereas KF6 puts these methods directly on View. Wrap the differences
with #if KTEXTEDITOR_VERSION_MAJOR >= 6 so both build paths compile.

Fixes:
- inlineNotes() return type: QVector<int> (KF5) vs QList<int> (KF6)
- paintInlineNote() signature: 2 params (KF5) vs 3 params (KF6)
- register/unregisterInlineNoteProvider via InlineNoteInterface
- isCompletionActive via CodeCompletionInterface
- configValue via ConfigInterface
2026-07-15 09:59:56 +02:00
Levi Neely 1552fce126 kate: fix crash on document close (dangling overlay pointer)
The GhostOverlay is parented to the view widget and gets destroyed by
Qt child cleanup before ~OllieGhostProvider runs. Stop calling
hideOverlay() in destructor, connect destroyed() signal to null the
pointer.
2026-07-14 14:58:40 +02:00
Levi Neely 18402a2be7 kate: config page improvements, status bar dedup, default backend/model
- Add Default Backend / Default Model config for chat sessions
  (overrides OLLIE_BACKEND / OLLIE_MODEL env vars)
- Pass configured backend/model to CreateSession D-Bus call
- Move "Completion enabled on startup" checkbox below text fields
- Deduplicate status bar indicator when multiple views exist
- Make install target depend on build
- Remove Escape-to-dismiss (conflicts with Kate popups)
2026-07-14 14:53:13 +02:00
Levi Neely b67e82dca0 kate: fix ghost text provider, add multi-line overlay and config
- Fix parent not passed to InlineNoteProvider causing provider recreation
  on every viewChanged signal (killed debounce timer, no completions fired)
- Add view() accessor, use it in setupGhostProvider check
- Null-check focusProxy() to prevent crash during early viewChanged
- Multi-line completions: first line as inline note, continuation lines
  rendered via GhostOverlay floating widget
- Guard event filter and signal handlers against active completion popups
- Add suggestion cycling (Meta+O,N / Meta+O,P) with history
- Add Meta+O,C to toggle completions on/off with status bar indicator
- Add Meta+O,D to dismiss current suggestion
- Add Meta+O,Tab to manually trigger a completion
- Add config page for completion backend and model override
- Pass backend/model config via D-Bus Complete context parameter
2026-07-14 13:24:03 +02:00
Levi Neely 16e8fc7a75 feat: ghost-text code completion via InlineNoteProvider
Adds OllieGhostProvider that renders AI completions as translucent
gray text after the cursor. Uses the new Complete D-Bus method with
500ms debounce. Tab accepts, Escape dismisses, any edit clears.
Works on both KF5 and KF6 builds.
2026-07-14 12:30:18 +02:00
Levi Neely c3155f53d8 use system font sizes instead of hardcoded pixel values
Plasmoid uses Kirigami.Theme.defaultFont/smallFont. Kate and KRunner
use QApplication::font(). All components now respect KDE font settings.
2026-07-06 13:40:40 +02:00
Levi Neely 12e6dbccdb kate/krunner/tray: add session rename, pick session, CMakeLists-active
- Kate: add Pick and Rename buttons, extract projectBaseDir helper
- KRunner: session matching improvements
- Tray: session display updates
- Add CMakeLists-active.txt for KF5 build reference
2026-07-06 13:19:05 +02:00
Levi Neely a1f2c22cbf plasmoid: add cwd label and status indicator, show full session IDs
- Add activeCwd property to OllieDBusClient (fetched via GetConfig)
- Add colored status dot to compact and full representations
- Show session cwd path in the header label
- Remove .substring(0,14) / .left(12) / .left(14) truncations
  from plasmoid, kate plugin, tray, and daemon notifications
2026-07-06 10:02:08 +02:00
Levi Neely 2795747d02 Add KF5/Qt5 support for Plasma 5.27
- CMakeLists-kf5.txt: side-by-side build config for KF5/Qt5
- #if QT_VERSION_MAJOR guards in krunner, kate, plasmoid sources
- Namespace alias (Plasma:: for KF5, KRunner:: for KF6)
- Manual QQmlExtensionPlugin for Qt5 (qmlplugin.cpp + qmldir)
- Plasma 5 compatible metadata-kf5.json and main-kf5.qml
- Makefile: kf5, kf5-install, kf5-uninstall targets

Build with 'make kf5', install with 'make kf5-install'.
2026-07-06 09:18:04 +02:00
Levi Neely f9e902a2ad graceful shutdown and error handling
- Daemon: async-signal-safe SIGTERM/SIGINT via socketpair
- Tray: survives daemon restart, watches for service appear/disappear
- KRunner: skips matches if daemon unreachable
- Kate: shows error message if daemon not running or session creation fails
2026-07-06 00:24:11 +02:00
Levi Neely 22771d3c8d phase 7c: Kate plugin
- Side panel (right dock) with live chat view, streaming via ChatUpdated
- Prompt input at bottom, enter to send
- Context actions: 'Ask File' (describe current file), 'Explain' (explain selection)
- Auto-creates session in current file's directory
- Adopts existing sessions on load
2026-07-06 00:05:51 +02:00