Commit Graph

420 Commits

Author SHA1 Message Date
Levi Neely cad8a18950 add -no9p flag for D-Bus only mode
olliesrv now supports three operating modes:
  +9p +dbus (default): full 9P server with embedded D-Bus adapter
  +9p -dbus (-nodbus): pure 9P server, no desktop integration
  -9p +dbus (-no9p): D-Bus only, no filesystem interface

The -no9p flag gates all 9P listener setup (unix + tcp), the 9P
server instance, and per-session FUSE mounts. D-Bus becomes mandatory
in this mode (errors if session bus is unavailable). -no9p and -nodbus
are mutually exclusive.

This replaces the need for the archived standalone ollied daemon.
2026-07-21 11:40:02 +02:00
Levi Neely 21b0cf1543 9p: fix stat Length=0 for session files breaking 9pfuse reads 2026-07-20 13:36:44 +02:00
Levi Neely c4e1950f8c remote: restore sessions with remote= reconnect to remote host 2026-07-19 21:53:01 +02:00
Levi Neely 208db7ba68 streaming: handle tool streaming via empty-content start signal 2026-07-19 21:36:55 +02:00
Levi Neely 4b24b33377 streaming: tool as first-class streaming role in chat log 2026-07-19 21:25:58 +02:00
Levi Neely bba14ddcde session: pass PromptEnvExtra to AgentCoreConfig 2026-07-19 20:37:37 +02:00
Levi Neely 03a29b0877 session: pass PromptEnv to all BuildRuntime calls
Both restore and create paths now include PRIME_* env vars.
Remote path uses HostInfo; local path uses PromptEnv(cwd).
2026-07-19 20:26:52 +02:00
Levi Neely 28232fd833 remote sessions: eager dial, pass host info to prompt resolution
Dial the remote eagerly during session creation so HostInfo is available
for BuildRuntime. Pass PRIME_PLATFORM and PRIME_IS_GIT_REPO as env vars
so the system prompt reflects the remote host, not the local machine.
2026-07-19 20:17:32 +02:00
Levi Neely b95bab0ef8 fix: start FUSE mount for remote sessions
Remote sessions had no local mount because WithMount9P hooks into the
local execute.Server which does not exist for remote sessions. Start
the mount directly and tear it down on kill/shutdown.
2026-07-19 19:43:19 +02:00
Levi Neely fce23afd28 session: store remote target, expose in cfg read
The remote= field is now visible when reading s/{id}/cfg,
and stored on the Session struct for future persistence.
2026-07-19 19:10:02 +02:00
Levi Neely 4f8e0c2768 session: wire remote= config for split-brain execution
When creating a session with remote=user@host, the session manager
uses remote.Decl() instead of execute.Decl() for the tool dispatcher.
This forwards all tool calls over SSH to an ollie-remote process on
the target host.

Usage: printf "cwd=/path\nremote=user@host\n" > \$OLLIE/s/new
2026-07-19 18:57:26 +02:00
Levi Neely eaa32cd94d dbus: emit SessionCreated for restored sessions in WatchExisting
During startup, session.NewManager restores sessions and fires the
OnSessionCreated callback, but dbusAdapter is still nil at that point
so SessionCreated signals were never emitted. WatchExisting runs after
the adapter is live — emit SessionCreated there so GUI clients learn
about pre-existing sessions reliably.
2026-07-19 14:16:10 +02:00
Levi Neely 8fa630f65c share active-sessions dir with dbus backend
Both backends now use ~/.local/share/ollie/sessions/active since
they are mutually exclusive.
2026-07-19 13:27:46 +02:00
Levi Neely 29b08a87ad remove Makefile and mkfile (consolidated into root justfile) 2026-07-19 13:02:47 +02:00
Levi Neely ebc82f338b remove tools/ — now at repo root 2026-07-19 12:37:15 +02:00
Levi Neely f9a2e3249d move prompts/ and skills/ to parent repo
Prompts and skills are shared across frontends (9p, kde, dbus),
so they belong at the repo root rather than duplicated per frontend.
2026-07-19 12:07:18 +02:00
Levi Neely 0b236374c0 9p: fix prompt file permission for FUSE (0466 -> 0666) 2026-07-19 00:20:41 +02:00
Levi Neely b050ef4ab7 9p: replay last 20 messages into chat log on session restore 2026-07-19 00:10:05 +02:00
Levi Neely 3c29fb28bb autostart: run ollie-remount after 3s delay 2026-07-18 23:38:37 +02:00
Levi Neely e53cdc565c add xdg autostart desktop file for olliesrv 2026-07-18 23:37:41 +02:00
Levi Neely f630c644e1 complete: use backend.Generate instead of copilot session 2026-07-18 23:34:24 +02:00
Levi Neely b410133759 readme: document generate, route, complete endpoints (net/dns pattern) 2026-07-18 22:56:11 +02:00
Levi Neely 120a971a0b readme: use relative URLs 2026-07-18 22:41:34 +02:00
Levi Neely fea481e928 readme: move httpgw docs to httpgw/README.md 2026-07-18 22:39:34 +02:00
Levi Neely da611d3ef2 dbus: add Complete and missing session methods; readme: add -nodbus flag 2026-07-18 22:36:24 +02:00
Levi Neely 8e4c1accaa readme: document root-level endpoints (complete, generate, route, ctl, agents) 2026-07-18 22:25:26 +02:00
Levi Neely 53df31fe7e readme: remove sales pitch, keep facts 2026-07-18 22:13:57 +02:00
Levi Neely 39d14eae16 9p: -tcp implies -nodbus for remote deployments 2026-07-18 21:42:52 +02:00
Levi Neely aeb933a3c2 9p: add -nodbus flag for headless/container deployments
When running on a remote server or in a container without a D-Bus
session bus, pass -nodbus to skip the adapter entirely. Pure 9P
still works.
2026-07-18 21:40:37 +02:00
Levi Neely f065429d24 9p: add embedded D-Bus protocol adapter
Expose org.ollie.SessionManager on the session bus directly from olliesrv.
The adapter emits StateChanged, ChatUpdated, SessionCreated, SessionKilled,
SessionRenamed, ProcessDetached, and ProcessExited signals. All KDE frontends
work without ollied.

Fixes:
- ListSessions: use Manager.List() instead of broken Readdir("")
- RenameSession: delegate to Manager.RenameSession()
- WatchExisting: start signal watchers for sessions restored at startup
- Introspection XML: declare all methods and signals
2026-07-18 21:36:07 +02:00
Levi Neely 6a9ea19abe 9p: /route output uses spaces, no newlines 2026-07-18 17:15:59 +02:00
Levi Neely d33fae7946 9p: fix readDNS to consume result on read (return EOF on second read)
Previous implementation returned data forever, causing cat to loop.
Now clears the buffer after first read so subsequent reads get EOF.
2026-07-18 17:14:44 +02:00
Levi Neely ece6c19fa6 9p: fix /net/dns read pattern — ignore offset for write-then-read
Shell fd position advances after write, so the subsequent read
arrives with offset=N (write length). readDNS always serves from
offset 0, fixing empty reads from exec 3<>file; echo >&3; cat <&3.
2026-07-18 17:13:01 +02:00
Levi Neely a01891621d 9p: rebuild with fixed route classifier 2026-07-18 17:05:48 +02:00
Levi Neely f1f7afafe1 9p: delegate /generate and /route to core backend package 2026-07-18 16:59:29 +02:00
Levi Neely 6d0be8295e remove tier routing: drop route/cascade/escalate tools and prompts
/route now uses LLM-based capability classification with
OLLIE_ROUTE_MODEL_FAST and OLLIE_ROUTE_MODEL_POWER env vars.
OLLIE_TIER_* env vars are no longer used.
2026-07-18 16:55:19 +02:00
Levi Neely 61d6b0da92 9p: /route uses LLM classification for task complexity
Write a task description to /route; a cheap local model (OLLIE_ROUTE_BACKEND/
OLLIE_ROUTE_MODEL, defaults to ollama/qwen3:8b) classifies it as worker or
expert. The resolved backend+model for that tier is returned on read.

Explicit tier still supported via JSON {"tier":"expert"} to skip classification.
2026-07-18 16:47:40 +02:00
Levi Neely 9fbdbbe642 9p: add /generate and /route files (net/dns pattern)
/generate: write a prompt (plain text or JSON with backend/model/system),
read back a one-shot LLM completion. Stateless, no session needed.

/route: write a tier name (worker/expert), read back the resolved
backend+model from OLLIE_TIER_* env vars.
2026-07-18 16:39:36 +02:00
Levi Neely 9d21601edf fix: session persistence across restart
Shutdown() was calling KillSession() which deleted the persisted
JSON files immediately after saveAllSessions() wrote them. Now
Shutdown() closes sessions directly without removing persistence
files, allowing restoreAllSessions() to find them on next start.
2026-07-18 16:28:12 +02:00
Levi Neely aa467e9b3c tools: explicit UTF-8 encoding for file_read, file_write, file_edit 2026-07-18 16:15:10 +02:00
Levi Neely d8e0b9b5ba 9p: add /complete file for stateless code completion
Follows the Plan 9 /net/dns pattern: per-fid request-response.
Write JSON request (or plain prefix), write blocks during LLM call,
read returns the completion result. Per-fid state means concurrent
clients get independent request/response pairs.

Also includes the Complete method, findOrCreateCopilot, and noise
stripping helpers in the session package.
2026-07-18 16:00:54 +02:00
Levi Neely 81ad172aa3 9p: add /agents file listing available agent configs 2026-07-18 15:27:05 +02:00
Levi Neely b13f42778a 9p: add session persistence across restarts
Sessions are saved to ~/.local/share/ollie/sessions/active-9p/ on
shutdown and restored on startup. Core auto-saves to SessionsDir
during turns. KillSession removes persisted files.

Closes the major feature gap with the D-Bus daemon.
2026-07-18 15:12:11 +02:00
Levi Neely 4ff3961dfd 9p: add proc/ directory for detached process inspection
- ls /s/{id}/proc/ lists detached PIDs
- cat /s/{id}/proc/{pid} reads ring buffer output
- rm /s/{id}/proc/{pid} dismisses the process
- echo detach > /s/{id}/ctl detaches running process
- echo "signal {pid} [TERM|KILL]" > /s/{id}/ctl signals detached process

Walk validates PID exists in detached list before succeeding.
2026-07-18 13:29:35 +02:00
Levi Neely 61240e02de 9p: add peer directory for bidirectional session communication
Implement /s/{id}/peer/ directory:
- touch /s/{id}/peer/{peer-id}: creates bidirectional peer link
- rm /s/{id}/peer/{peer-id}: removes bidirectional peer link
- ls /s/{id}/peer/: lists registered peers
- echo "prompt" > /s/{id}/peer/{peer-id}: submits prompt to peer

Peer management lives in the session Manager (core layer).
Walk validates peer existence before reporting file found.
Peer files have mode 0666 (writable).
2026-07-18 13:17:57 +02:00
Levi Neely 1db7fb9177 fix deadlock in CachedListModels: use dedicated modelsMu
content() holds sess.mu.RLock, then calls CachedListModels which
tried to acquire sess.mu.Lock for cache write — classic RLock/Lock
deadlock. Fix by giving the models cache its own mutex independent
of the session mu.
2026-07-18 12:54:38 +02:00
Levi Neely bb9b899e4e 9p: eliminate expensive API calls during readdir/stat
- Add CachedListModels() with 24h TTL to avoid repeated Models() API calls
- Cache readdir serialized bytes per-fid (rebuild only at offset=0)
- Skip all session file size computation in makeStat (report len=0)
- Short-circuit pathType() for session paths to avoid triggering Stat
- Remove e.Info() call from subdirectory readdir (unused mtime)
- Add monotonic timer to handle() for profiling 9p operations
- Add fcallTypeName() helper
- Fix stubCore for new Detach/SaveSession interface methods
- Add tools-process.md prompt

Before: ls inside a session dir took 1.38s (kiro) / 67ms (openrouter)
After: 182µs regardless of backend (7500x improvement)
2026-07-18 01:31:06 +02:00
Levi Neely 9ae36420ab strip 9P namespace to sessions only
Remove a/, p/, sk/, m/, tr/, tmp/, u/, x/, and per-session t/ from the
9P namespace. These are all files on disk that the runtime reads directly
from ~/.config/ollie/ — serving them through 9P added indirection without
value.

What remains:
- /s/ (live sessions: the dynamic state that doesn't exist on disk)
- /backends, /models, /help (synthetic root files)

This brings olliesrv's scope in line with the D-Bus daemon: session
lifecycle, prompt submission, state observation, and streaming output.
2026-07-17 23:08:29 +02:00
Levi Neely b49bbb099d docs: expand intro with Plan 9 motivation and design philosophy 2026-07-17 22:39:46 +02:00
Levi Neely b23e2ec2dd docs: add Remote Access section (9P mount, HTTP gateway, container) 2026-07-17 22:38:19 +02:00