Commit Graph

22 Commits

Author SHA1 Message Date
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 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 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 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 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 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 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 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 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 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 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 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 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 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 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