ollie/doc/architecture-kde.md

84 lines
3.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# KDE Integration
The `kde/` directory contains optional KDE/Qt clients for Ollie. They are 9P clients, not part of the Ollie agent runtime. Every component reaches `olliesrv` through the shared 9P boundary, using either the native `libollie9p` client library or the `ollie-9p` command. They do not use D-Bus, FUSE, or a parallel session store.
## Components
| Component | Description |
|---|---|
| `ollie-gui` | Qt/QML desktop application for sessions, agents, chat, prompts, and controls. It runs outside Plasma with Qt6 and falls back to Qt Quick Basic styling. |
| KRunner plugin | Starts one-shot generation and exposes session-oriented actions. |
| Kate plugin | Provides editor integration and ghost-text assistance through 9P. |
| KIO worker | Exposes Ollie through the `ollie://` protocol. |
| Dolphin actions | Shell helpers for asking Ollie about selected files or the current directory. |
| Plasma environment script | Exports the Ollie 9P namespace for desktop clients. |
The KDE clients do not embed provider selection, prompt assembly, tool execution, or agent-loop logic. Those remain in `olliesrv`; the clients read and write the namespace described in [`architecture-9p.md`](architecture-9p.md).
## GUI
`ollie-gui` displays active sessions and agents, streams chat, submits prompts, and exposes common controls:
- Session tree with agent state indicators.
- Chat rendering for assistant, tool, reasoning, and markdown-block output.
- 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.
## Build and installation
Prerequisites are a running Ollie installation, a C++17 compiler, CMake, Qt, KDE Frameworks, and the native 9P client library installed under `~/.local`.
Build the KDE integration from the repository root:
```sh
make kde
```
Build and install it:
```sh
make
```
The KDE build is delegated to `kde/CMakeLists.txt` and targets KF6/Qt6.
Install targets include:
- `ollie-gui` under `~/.local/bin`.
- Qt/KDE plugins for KRunner, Kate, and KIO.
- The `ollie://` KIO protocol definition.
- Dolphin service-menu actions and helper scripts.
- Plasma environment setup under `~/.config/plasma-workspace/env`.
Restart or refresh Plasma/KDE service caches after installation when required.
## Architecture
```text
┌──────────────┐ libollie9p / ollie-9p ┌──────────────┐
│ KDE clients │ ────────────────────────────▶ │ olliesrv │
│ Qt/QML/KF │ authenticated 9P │ agent + 9P │
└──────────────┘ └──────────────┘
```
The GUI uses native client code for streaming and session operations. Other integrations may invoke `ollie-9p` or plan9port’s `9p` client. All use the same namespace, file operations, blocking reads, and control semantics.
## Source map
| Area | Location |
|---|---|
| Build and install | `Makefile`, `kde/CMakeLists.txt` |
| Qt/QML GUI | `kde/gui/` |
| Native 9P client | `kde/lib9p/`, `kde/gui/lib9pclient.*` |
| KRunner | `kde/krunner/` |
| Kate | `kde/kate/` |
| KIO | `kde/kio/` |
| Dolphin actions | `kde/dolphin/` |
| Plasma environment | `kde/99-ollie.sh` |
For the public protocol and namespace, see [`architecture-9p.md`](architecture-9p.md). For the core agent runtime, see [`architecture-core.md`](architecture-core.md).