Commit Graph

82 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 b9e1831167 fix session.All/Get to use rootState.sessions map
All() and Get() were looking at root.Children() (mounted child trees)
but sessions are stored in rootState.sessions. They were never mounted
as children, so All() always returned empty — breaking D-Bus ListSessions
and WatchExisting, causing the KDE GUI to see no restored sessions.
2026-07-30 00:29:28 +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 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 4359f354af session: rename Store → Tree (openStore→openSessionTree, openAgentStore→openAgentTree)
'Store' was a legacy name. These are file trees.
2026-07-29 20:58:03 +02:00
Levi Neely 1ce845e83f session: follow PersistedSession → PersistedAgent rename 2026-07-29 20:57:15 +02:00
Levi Neely c07aef6bb9 session: enforce agent/session split in file trees
- NewSessionTree now only serves plan + env (session-level)
- NewAgentTree serves all 21 agent-level files
- Tests updated to use agent tree for agent files
- Removed kill/rename/save from ctl (session ops via rm/mv)
- TestSessionManagerOpenStore tests session-level file (plan)
2026-07-29 20:56:09 +02:00
Levi Neely 2a3798ae39 session: add agent/{aid} sublevel routing
The 9P namespace now supports:
  session/{sid}/plan, env           (session-level)
  session/{sid}/agent/{aid}/*       (agent-level files)
  session/{sid}/agent/{aid}/proc/*  (agent detached processes)

Routing updated in stat, openEntry, and Readdir.
Existing flat access ({sid}/{file}) preserved for backward compat.
Tests pass unchanged.
2026-07-29 20:49:59 +02:00
Levi Neely 44a6dda695 session: split FileList into SessionFileList + AgentFileList
Prepare for agent/{aid} sublevel:
- SessionFileList: plan, env (session-level)
- AgentFileList: 21 agent-level files (prompt, state, cfg, etc.)
- NewAgentTree builder for agent file tree
- FileList kept as combined for backward compat

No routing changes yet — existing flat layout still works.
2026-07-29 20:47:04 +02:00
Levi Neely 47c4890037 update prompts and scripts path: s/ → session/ 2026-07-29 20:34:42 +02:00
Levi Neely f75dbc33a7 session: follow Config.Uname → Config.AgentID rename 2026-07-29 20:28:19 +02:00
Levi Neely 19939cc074 session: split session.go into focused files
Break the 1522-line monolith into logical modules:
- session.go (201) — Session struct + basic methods
- manager.go (535) — Manager lifecycle, peers, stat/open
- persist.go (347) — save/restore, shutdown
- create.go (297) — CreateSession, renameSession
- format.go (94) — FormatEvent, LoadAgentConfig
- complete.go (103) — code completion

No behavioral changes. All tests pass.
2026-07-29 20:03:27 +02:00
Levi Neely 3d2172d93a session: eliminate Core interface, use concrete *agent.Session
- Delete session/core.go (the consumer-defined interface)
- Change Session.Core field from interface to *agent.Session
- Change NewSession and ManagerConfig.NewCore to use concrete type
- Rewrite all tests to use real sessions with backend.Noop

The 9p layer now depends directly on the concrete type from
ollie/session. No more interface indirection. Tests exercise
real session behavior instead of stub methods.
2026-07-29 20:00:47 +02:00
Levi Neely cf894920fa session: define Core interface at consumer, use concrete *session.Session
Core interface defined in 9p/session/core.go lists the methods
the 9P layer needs. The real *session.Session satisfies it implicitly.
Test stubs continue to work via interface satisfaction.
2026-07-29 19:25:27 +02:00
Levi Neely 50f4a06d2e update for session API renames: Core→Session, NewAgentCore→New, etc. 2026-07-29 19:17:08 +02:00
Levi Neely d46cd21bdf update imports: ollie/agent → ollie/session (aliased as agent) 2026-07-29 19:13:33 +02:00
Levi Neely 731810ae28 update for agent.Session → agent.History rename 2026-07-29 18:21:39 +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 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
Levi Neely 2d4ce13272 dbus: emit ConfigChanged on agent switch, fix agent default override
- Add agent watcher goroutine that emits ConfigChanged(session, key, value)
  D-Bus signal when the per-session agent name changes
- Add ConfigChanged to introspection XML
- Fix CreateSession: only apply OLLIE_DEFAULT_AGENT when no agent arg was
  explicitly provided. Previously, passing agent=default would trigger the
  env override, making it impossible to select a specific agent from the GUI.
2026-07-29 11:04:01 +02:00
Levi Neely f0942e81ba session: wire registries via Options instead of post-hoc
Pass WithToolRegistry/WithSkillsRegistry into execute.Decl() so every
Server the factory creates has registries set. Removes fragile post-
construction wiring that only applied to the first dispatcher instance.
2026-07-29 10:50:26 +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 d5ed0a545f remove allowExecutors from config, execute server, and agent JSONs 2026-07-28 22:39:15 +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
lkn ecbe8067f2 add reactions file to 9P session tree 2026-07-27 19:59:50 +02:00
lkn 57053c4e48 add reactions file to 9P session tree 2026-07-27 19:52:49 +02:00
lkn 8c7dba5cf7 9P/D-Bus ReactTo and assistant:id headers 2026-07-27 19:12:12 +02:00
Levi Neely d95313d682 add react file and reaction semantics in system prompt
New 9P file s/{id}/react: write an emoji to record a reaction to the
most recent assistant response. The reaction is passive feedback —
no model turn is triggered.

The system prompt now documents how agents should interpret emoji
reactions (positive/negative/confused) and silently adjust behavior.
2026-07-27 15:26:14 +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 cafe38292f session: remove auto-mount on session creation
Agents now use the 9p client binary directly instead of FUSE mounts.
Remove startMount() calls and OLLIE= env var from session env.
Mounts remain available for human use but are no longer auto-started.
2026-07-27 11:41:42 +02:00
Levi Neely e40d266206 session: parallelize session restoration on startup
Load persisted session JSONs sequentially (fast disk reads),
then fan out restoreSession calls in parallel. Each session
restoration involves backend init, prompt resolution, and
potentially SSH connections for remote sessions.
2026-07-27 11:13:36 +02:00
lkn 76807dd879 sort D-Bus ListModels results 2026-07-26 19:01:19 +02:00
lkn 1a545be58f restore active sessions from data directory 2026-07-26 12:10:11 +02:00
lkn c7c8fd1b8b session: inject operational model into restore path
Restored sessions were calling BuildRuntime without baseLayers,
so the 9P/D-Bus operational model never appeared in the system prompt.
Now computes sysPrompt, opModel, envBlock and passes them as BaseLayers.
2026-07-21 14:40:46 +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 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 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 b050ef4ab7 9p: replay last 20 messages into chat log on session restore 2026-07-19 00:10:05 +02:00
Levi Neely f630c644e1 complete: use backend.Generate instead of copilot session 2026-07-18 23:34:24 +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 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