feat(everything): add AI prompt plugin (Claude + Ollama)

Adds a new Everything launcher plugin triggered by '?' that sends
the query to either Claude API or a local Ollama instance and
displays the response as a selectable item.

Configure via environment variables:
  ANTHROPIC_API_KEY  enables Claude (auto-detected)
  AI_PROVIDER        "claude" or "ollama" (default: auto)
  CLAUDE_MODEL       default: claude-haiku-4-5-20251001
  OLLAMA_MODEL       default: llama3.2
  OLLAMA_HOST        default: http://localhost:11434

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-17 20:43:38 +10:00
commit 811044cf8f
5 changed files with 1461 additions and 0 deletions

52
README.md Normal file
View File

@@ -0,0 +1,52 @@
# Enlightenment AI Prompt Plugin
An AI agent prompt plugin for the [Enlightenment](https://www.enlightenment.org/) Everything launcher.
## Usage
Open the Everything launcher and type `?` followed by your question:
```
?what is the capital of France
```
The plugin shows **Asking AI...** while waiting, then updates the item with the AI response. Select the item to copy it to clipboard.
## Supported backends
- **Claude** (Anthropic API) — set `ANTHROPIC_API_KEY` in your environment
- **Ollama** (local LLM) — runs against `http://localhost:11434` by default
Backend is auto-detected: Claude is used when `ANTHROPIC_API_KEY` is set, otherwise Ollama is assumed.
## Configuration
Set these environment variables (e.g. in `~/.profile`):
| Variable | Default | Description |
|---|---|---|
| `ANTHROPIC_API_KEY` | — | Anthropic API key; enables Claude when set |
| `AI_PROVIDER` | auto | Force `"claude"` or `"ollama"` |
| `CLAUDE_MODEL` | `claude-haiku-4-5-20251001` | Claude model to use |
| `OLLAMA_MODEL` | `llama3.2` | Ollama model to use |
| `OLLAMA_HOST` | `http://localhost:11434` | Ollama server base URL |
## Applying to your Enlightenment source tree
This repo mirrors the directory structure of the Enlightenment source tree. Copy the files into `src/modules/everything/` in your Enlightenment checkout.
**Files changed:**
| File | Change |
|---|---|
| `src/modules/everything/evry_plug_ai.c` | New plugin (the main implementation) |
| `src/modules/everything/e_mod_main.h` | Added `evry_plug_ai_init/shutdown/save` declarations |
| `src/modules/everything/e_mod_main.c` | Added `evry_plug_ai_init(m)` and `evry_plug_ai_shutdown()` calls |
| `src/modules/everything/meson.build` | Added `evry_plug_ai.c` to the source list |
Then rebuild with meson/ninja.
## Requirements
- `curl` must be available in `PATH` (used to call the AI APIs)
- Enlightenment with the Everything module enabled