Commit Graph

40 Commits

Author SHA1 Message Date
Levi Neely 01fbf12fc5 fix /agents reporting Length=0 in stat (FUSE never reads)
makeStat had explicit Length computation for /backends, /models, /help
but not /agents. Replace the specific cases with a generic default that
reads any root-level file via rootStore. /help keeps its os.Stat path
since the rootStore readFn reads the whole file (expensive for large help).
2026-07-30 00:20:26 +02:00
Levi Neely ac494b50b4 fix infinite recursion in session/{sid}/agent directory
pathType() only recognized 'proc' as a subdirectory under sessions.
The 'agent' hierarchy (agent/, agent/{aid}/, agent/{aid}/proc/) was
falling through to 'return "file"', causing walk() to succeed with
QTFile at any depth. 9p ls then printed the basename 'agent' forever.

Fix: increase SplitN limit to 5, add directory cases for the full
agent path hierarchy, and verify the session exists before allowing
descent into any sub-path.
2026-07-30 00:15:23 +02:00
Levi Neely fee8d1bf36 kill mgr/ package: replace Manager with session/ package functions
The session tree IS the session collection. No Manager struct —
rootState is unexported, stored in tree.Data. All CRUD exposed
as package functions (NewRoot, Lookup, Create, Kill, Rename, etc).

- mgr/ → session/ (package rename + Manager elimination)
- server.Config.SessionMgr → SessionTree (*fs.Tree)
- dbus adapter takes *fs.Tree directly
- Tests pass, build + vet clean
2026-07-30 00:02:36 +02:00
Levi Neely 279dc2a504 wire tools.Builtins() into toolsrv construction
Pass default builtin handlers when creating local tool servers.
2026-07-29 23:17:22 +02:00
Levi Neely 3a8b1ba4a5 9p: use agent.Complete directly, remove mgr/complete.go
Code completion no longer routes through the manager. Callers
invoke agent.Complete() — the one-shot ephemeral agent.
2026-07-29 22:19:22 +02:00
Levi Neely 82a7f585f2 9p: remove all peer code
Peers were removed from core but lingered in the 9P layer.
Deleted: PeerAdd, PeerRemove, PeerList, PeerSubmit (D-Bus + manager),
peer directory listing, peer file handling, peer stat, peer
creation/removal, HasPeer, peers field on Session.
2026-07-29 22:17:39 +02:00
Levi Neely aeef7ff718 9p: route all agent operations through .Agent()
Interrupt, Queue, Detach, ListDetached, SignalDetached,
GetDetachedOutput, DismissDetached, InjectSystemEvent
now go through sess.Core.Agent() directly.

Session only provides: Agent(), Bus(), Close(), SetEnv(),
CWD(), SetCWD(), SetSessionID(), WaitChange(), SaveSession().
2026-07-29 22:05:56 +02:00
Levi Neely a6a7fae7ca 9p: rename session/ → mgr/, drop agent import alias
Rename the internal olliesrv/session package to olliesrv/mgr to resolve
the naming conflict with ollie/session (the core session package).

This allows importing ollie/session without an alias — the temporary
`agent "ollie/session"` scaffolding is removed. All references now
use the natural package name: session.X for core types, mgr.X for the
9P session manager.
2026-07-29 21:20:56 +02:00
Levi Neely 55fcebd032 9p: rename s/ → session/ in filesystem namespace
The top-level sessions directory is now /session/ instead of /s/.
Clearer, self-documenting namespace. The agent/{aid} sublevel
will be added in a future change.
2026-07-29 20:32:50 +02:00
Levi Neely c96982c1ec update imports for core/ restructure
ollie/pkg/X → ollie/X, execute.Registry → tools.Registry,
remote.Dial → execute.RemoteDial, config.Load → agent.Load
2026-07-29 18:10:32 +02:00
lkn c221426af4 remove root-level /tools from 9P filesystem listing and dead toolsResult field 2026-07-29 00:01:06 +02:00
lkn 7c15f9ec3b session wiring: use execute.SetToolRegistry instead of separate registry server 2026-07-28 22:08:53 +02:00
lkn 96dda6e5f0 9p: files for per-session dynamic tool loading and inspection 2026-07-28 14:12:41 +02:00
Levi Neely 238d8214a3 olliesrv: expose elevate/ and s/{id}/elevate via 9P
- /elevate/policy: read/write global policy (YAML)
- /elevate/pending/: list pending requests
- /elevate/pending/<id>: read summary, write approve/deny/persist
- /s/{id}/elevate: read/write session policy (includes global)
2026-07-27 11:03:20 +02:00
lkn 4964369025 9p: implement /tools write→read (dns pattern) for tool prompt lookup 2026-07-21 13:55:50 +02:00
lkn fe05415ebc 9p: add /tools to root directory listing 2026-07-21 13:50:59 +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 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 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 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 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 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 200cb52e29 Add model cache with async prefetch and invalidate command
- Add ModelCache that prefetches models from all backends at startup
- Cache models in memory, refresh on demand via Invalidate()
- Add global /ctl file with 'invalidate' command
- Add 'invalidate' ctl command and /invalidate slash command in sessions
- Fix filePerm to query rootStore for root-level file permissions
- Add 'models' to root directory listing
2026-05-22 10:08:11 +02:00
Levi Neely 5d952633f8 add /models endpoint to root store 2026-05-21 18:49:38 +02:00
Levi Neely 09e4f0f678 fs: centralized permission registry; FUSE mutating operations 2026-05-21 11:50:34 +02:00
Levi Neely baa7ca66e6 makeStat: delegate file modes to backing tree
Remove hardcoded permission switch in makeStat and delegate to
the underlying FileTree.Stat() instead. This makes FileList in
sessionfile.go the single source of truth for session file modes.
2026-05-20 10:42:29 +02:00
Levi Neely 57eb330d16 purge all 'store' vocabulary from code and comments 2026-05-19 18:40:33 +02:00
Levi Neely 038dc4b0bf purge Store/FileStore vocabulary: use Tree everywhere
- Manager.Store() → Manager.Tree()
- SessionFileStore → removed (use *fs.Tree)
- NewFileStore → NewSessionTree
- storeRead/storeWrite → readFile/writeFile
- storeRoutes → routes, routeStore → route
- SkillStore → SkillTree, ToolStore → ToolTree
- No more 'store' in public API
2026-05-19 18:39:02 +02:00
Levi Neely 2e0adffa75 main.go owns wiring: constructs all trees, passes Config to server
- server.New takes server.Config (no more internal construction)
- OnRename removed: wstat handles all fid rewriting directly
- WithStrict/WithYolo removed (passed via ManagerConfig)
- Default dir functions moved to main.go
- tool.go and root.go in main package (wiring)
- Server is now a pure protocol handler
2026-05-19 18:32:19 +02:00
Levi Neely 21f39c1d55 move tool.go and root.go into server/ (they're server wiring, not fs abstractions) 2026-05-19 18:21:14 +02:00
Levi Neely a9e9538015 rename to 9P vocabulary: store/ → fs/, DirStore → Tree, StoreEntry → File
- Package: store → fs
- Type: DirStore → Tree, StoreEntry → File, EntryConfig → FileConfig
- Constructor: NewDirStore → NewTree, NewFileStore → NewSynth
- Methods: ListDir → Readdir, WithListDir → WithReaddir
- Interface: Store → FileTree
- Files: dirstore.go → tree.go, filestore.go → synth.go, store.go → fs.go
- Test: store_test.go → fs_test.go
2026-05-19 18:19:37 +02:00
Levi Neely 56bcb87ff6 server/server.go: 9P server in its own package
- server.New, server.Option, server.WithStrict, server.WithYolo
- main.go is now just wiring and CLI
- Clean package boundary: server/ = protocol, session/ = lifecycle, store/ = abstraction
2026-05-19 18:12:32 +02:00