Commit Graph

33 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 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 e04aa1c69f update for execute/ → tools/ merge
Use tools.Runner, tools.New, tools.Decl etc. Remove ollie/execute import.
2026-07-29 23:01:55 +02:00
Levi Neely 72747b887d 9p: use tools.Server directly, eliminate Dispatcher indirection
NewDispatcher factories replaced with direct server factories.
Tests use nil server (no tools needed).
2026-07-29 22:50:16 +02:00
Levi Neely e88e0a6f4c naming: use explicit context names throughout
- Session field: Ctx → SessionCtx (clarifies what ctx this is)
- Session creation: ctx → sessionCtx, cancel → sessionCancel
- Daemon ctx passed as s.cfg.Ctx (unchanged — named in ManagerConfig)
- Fixed stale ctx reference in create.go Submit call
2026-07-29 22:35:11 +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 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 50601ebf46 9p: call Agent() directly for all agent operations
Session pass-throughs are removed. All agent operations go through
sess.Core.Agent().Method() — proper encapsulation boundary.

Session-level: Bus(), Close(), SetEnv(), CWD(), SetCWD(), Interrupt(),
Queue(), InjectSystemEvent(), SetSessionID(), SaveSession().

Agent-level (via .Agent()): Submit(), State(), Reply(), BackendName(),
ModelName(), IsRunning(), CtxSz(), UsageStr(), Context(), etc.
2026-07-29 21:58:04 +02:00
Levi Neely e16e14bed7 9p: update imports for agent/ package extraction
Import ollie/agent for types that moved from ollie/session:
AgentConfig, BuildRuntime, Event, PersistedAgent, Load, etc.

Remove ollie/session imports from files that no longer need it.
Fix test helpers to provide NewDispatcher (required by Agent).
2026-07-29 21:49:15 +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 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 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 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
lkn 96dda6e5f0 9p: files for per-session dynamic tool loading and inspection 2026-07-28 14:12:41 +02:00
lkn 35cc360b08 add GetReactions D-Bus method 2026-07-27 19:47:18 +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 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
ollie 60da0bbfde token efficiency: expose compactionModel in 9p cfg, fix test stubs
- Add compactionModel= to cfg read/write
- Add CompactionModel/SetCompactionModel stubs to test stubCore
- Fix NewSessionTree calls with missing invalidateModels arg
2026-05-28 18:44:57 +02:00
Levi Neely d8bd47c545 chat log: switch from line-prefix to [role] header block format 2026-05-25 23:15:02 +02:00
Levi Neely afb531c936 session: subscribe to event bus for chat log, drop handler from Submit
- NewSession subscribes to bus "event" topic for chat log writing
- Remove makePublish/handler threading from all Submit call sites
- Adapt tests to new bus-based event delivery
2026-05-20 16:45:37 +02:00
Levi Neely fe6e2c04a8 cfg: add name field, support name= writes as rename 2026-05-20 09:59:30 +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 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 d0ce8a108e session/session.go: session logic in its own package
- session.Manager (was SessionManager)
- session.ManagerConfig (was SessionManagerConfig)
- session.Session, session.NewSession
- session.FileStore, session.NewFileStore
- session.FileMode, session.FileList
- session.FormatEvent, session.FormatParams, session.ParseParams
- server.go imports olliesrv/session
- Clean package boundary: session/ = lifecycle, store/ = abstraction
2026-05-19 18:10:36 +02:00
Levi Neely 52ad150c22 restructure: session logic out of store/, stores into store/
- session.go, sessionfile.go: moved to main package (lifecycle)
- store/tool.go, store/root.go: store constructors where they belong
- main_test.go: session tests in main package
- store/store_test.go: only store-level tests remain
- Removed: root.go, tools.go from main (moved to store/)
- Clean separation: store/ = abstraction, main = domain
2026-05-19 18:07:00 +02:00