Commit Graph

59 Commits

Author SHA1 Message Date
Levi Neely 25dbc1b85c session: remove resetElevation plumbing
Rate limiting is now time-based (leaky bucket in core/elevate), so
per-turn reset hooks are no longer needed. Remove ResetElevation from
session config, files.go, root.go, and main.go.
2026-07-30 16:29:43 +02:00
Levi Neely 74f68f5045 remove skills.Discover() call (now dynamic) 2026-07-30 09:38:15 +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 d17b5df7dc context: thread daemon ctx through sessions to agents
Daemon creates a root context, cancelled on SIGTERM. Sessions derive
their context from it. Agent turns derive from session ctx. Tools
get the turn ctx.

Signal propagation:
- SIGTERM → daemonCancel() → all session ctxs cancelled → agent turns exit
- User interrupt → agent.Interrupt() (SIGINT equivalent, turn-level only)
- Session kill → sess.Cancel() → that session's agents stop

Previously sessions used context.Background() — daemon shutdown had
no automatic propagation to running agents.
2026-07-29 22:33:03 +02:00
Levi Neely e630714403 9p: update imports for agent/ package extraction
Types moved from ollie/session to ollie/agent:
AgentConfig, AgentConfigPath, AgentsDirs, BuildRuntime, Load, Event,
PersistedAgent, LoadPersistedAgent, RestoreHistory, PromptEnv,
History, Runtime, ErrInterrupted, WatchState.

ollie/session is no longer imported directly in top-level 9p/ files
or mgr/format.go and mgr/sessionfile.go (they only need agent types).

WatchAgent const inlined as string literal.
2026-07-29 21:46:00 +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 d46cd21bdf update imports: ollie/agent → ollie/session (aliased as agent) 2026-07-29 19:13:33 +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
Levi Neely acfc4854d4 elevate: wire SessionValid to verify session existence 2026-07-29 16:30:31 +02:00
Levi Neely 563c6dce2f elevate: wire turn rate limiter reset on prompt submission
Adds resetElevation callback to sessionHelper, called when a new
prompt is written (turn boundary). The Manager passes
broker.ResetTurn(sessionID) via ManagerConfig.ResetElevation.
2026-07-29 16:22:28 +02:00
lkn aa1b7d1e1c add skills registry and skill_list/skill_load/skill_active built-in dispatchers 2026-07-29 00:16:39 +02:00
lkn df199cd202 execute_code -> shell: simplify to single bash command, remove steps/parallel/detach/language 2026-07-28 23:03:35 +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 300d07b2aa remove ollie-9p-mount binary, inline FUSE into olliesrv
The mount logic is now a library package (mount/) called directly
by `olliesrv mount`. No external binary needed.

Per-session auto-mounts are gone entirely. The mount subcommand
remains for network-transparent human access to remote servers.
2026-07-27 11:51:56 +02:00
Levi Neely c59f1c57d7 olliesrv: remove SSH agent proxy startup 2026-07-27 11:06:23 +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
Levi Neely 324abd025b olliesrv: start SSH agent proxy alongside elevation broker 2026-07-27 10:49:31 +02:00
Levi Neely 8e348680dc olliesrv: wire integrated elevation broker
Start the elevation broker on $OLLIE_ELEVATE_SOCKET at daemon
startup. D-Bus notifications with approve/deny/persist actions
map back to broker.Resolve() via ActionInvoked signals.

Replaces the external superpowerd adapter.
2026-07-27 10:33:34 +02:00
lkn 1a545be58f restore active sessions from data directory 2026-07-26 12:10:11 +02:00
lkn cbd249e5f9 9p: remove daemon subcommands, simplify to foreground-only
Drop start/fgstart/stop/status subcommands. olliesrv now runs
directly in the foreground; lifecycle managed by the supervisor
(systemd, openrc, or xdg-autostart). Keep mount as a convenience
subcommand for mounting remote 9P servers via 9pfuse.

- Remove daemonize(), stopServer(), isRunning(), pid file management
- runServer() no longer takes pidPath
- Move desktop file to main repo services/xdg-autostart/
- Update README examples
2026-07-25 18:20:14 +02:00
lkn 4964369025 9p: implement /tools write→read (dns pattern) for tool prompt lookup 2026-07-21 13:55:50 +02:00
lkn 035e4db4b8 add /tools synthetic file with /net/dns pattern
Read: surface listing of all tools (name + description)
Write tool name, then read: full ollie:prompt content
Subsequent read reverts to surface listing (query cleared after use)
2026-07-21 13:36:38 +02:00
lkn 686fa5d0c8 embed layered system prompt: system + operational model + environment
The preamble is now composed as:
  system_prompt + operational_model + environment + agent_prompts

- Embed SYSTEM_PROMPT.md, session-9p.md, session-dbus.md in the binary
- Render environment block at runtime with live cwd/platform/date values
- Inject operational model based on server mode (Enable9P/EnableDBus)
- Accept system_prompt= override in session creation and D-Bus CreateSession
- Agent configs no longer need to reference system/session prompt files
2026-07-21 13:06:55 +02:00
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 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 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 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 542834b3e4 session: remove $OLLIE mount dependency
- Wire ReadPlanStep directly from sess.plan (no filesystem read)
- Add ListHandlers to ManagerConfig; passed through to AgentCoreConfig
- Hoist skillTree in main.go; populate ListHandlers for tools+skills
- Add ListHandlers to ManagerConfig
2026-06-16 12:30:42 +02:00
Levi Neely 32e8b4fc10 skip auto-mount when running with -tcp 2026-06-16 06:59:10 +02:00
Levi Neely 23dd7fc490 remove FUSE mount responsibility from olliesrv 2026-06-15 13:31:10 +02:00
Levi Neely 921d46d2e5 Update main.go 2026-06-01 09:53:08 +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 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 46b01c759d inline root.go and tool.go into main.go 2026-05-19 18:33:39 +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 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
Logan Neely 88ea073135 olliesrv: add -strict and -yolo flags
-strict: only tool steps allowed, inline code rejected.
-yolo: skip landrun sandbox for execute_code.
2026-05-07 22:27:27 +02:00
Levi Neely 6936c1c959 flatten: merge internal/p9 into package main
Removes internal/p9/ directory. store.go and server.go merged into
root server.go alongside main.go. No logic changes.
2026-04-21 16:44:02 +02:00
Levi Neely 38fbc752f2 inject log.Sink from main, remove plog global
- Server.New takes *Sink, creates tagged loggers
- BatchStore/SessionFileStore use injected loggers
- main.go creates Sink, calls sink.Flush at shutdown
2026-04-21 14:49:03 +02:00
Levi Neely 07c3e14f50 p9: InterruptAll on SIGINT/SIGTERM, inline agents/sessions dirs
- Add Server.InterruptAll() to cancel in-progress turns on all sessions
- Call InterruptAll() before Shutdown() on SIGINT/SIGTERM in main
- Remove defaultAgentsDir/defaultSessionsDir helpers; inline paths.CfgDir()
  expressions directly (OLLIE_CFG_PATH already handles relocation)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-21 12:28:36 +02:00
Levi Neely eef8ccecd9 env: use pkg/env for defaults; expose ollie/env in 9p filesystem
- Replace inline ensureEnv() with env.EnsureDefaults() from ollie/pkg/env
- Serve ollie/env as a readable file containing the daemon's full process env
- Remove extraEnv/InitialEnv session-spec mechanism (no longer needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-18 15:44:24 +02:00