Commit Graph

6 Commits

Author SHA1 Message Date
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 bd30678ea0 mgr: KillSession uses context cancellation, not direct Interrupt
Session death propagates via context (SIGKILL semantics).
User interrupt (Ctrl-C) is a separate signal via agent.Interrupt().
2026-07-29 22:28:55 +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 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