Commit Graph

413 Commits

Author SHA1 Message Date
Levi Neely 6a6016c5e0 use toolsrv.Dial for local server construction 2026-07-29 23:29:23 +02:00
Levi Neely b2462c6a06 replace toolsrv.Decl with inline closure over New() 2026-07-29 23:23:51 +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 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 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 5ecbd481ed gitignore: add test binaries 2026-07-29 21:58:14 +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 f142601f5f remove test binary, add to gitignore 2026-07-29 21:49:24 +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 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 f7e084106c prompts: rewrite session_9p.md for agent/{aid} sublevel
Documents the new filesystem structure:
- session/{sid}/plan, env (session-level)
- session/{sid}/agent/{aid}/* (agent-level)
- Removed peer operations (deferred for redesign)
- All operations use ollie-9p CLI
2026-07-29 20:51:16 +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 3833ba2860 ollie-9p: rename 'remove' command to 'rm'
Standard name. Updated prompt and usage accordingly.
2026-07-29 20:36:32 +02:00
Levi Neely 216a774477 prompts: rewrite session_9p.md to use ollie-9p CLI
Replace all raw filesystem operations (echo > file, cat file, exec fd<>)
with ollie-9p commands (read, write, rdwr, create, remove).
Remove /home/lkn/mnt/ollie prefix — ollie-9p handles server discovery.
2026-07-29 20:35:49 +02:00
Levi Neely 47c4890037 update prompts and scripts path: s/ → session/ 2026-07-29 20:34:42 +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 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 0b9f345930 README: add ollie-9p client section, fix stale pkg/ paths 2026-07-29 18:14:41 +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
Levi Neely c19c8d0cb5 prompts/docs: replace execute_code with shell
- system_prompt.md: update output protocol reference
- README.md: update flag descriptions and example output
2026-07-29 14:44:18 +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
Levi Neely 0a9392e5fd system_prompt: add tool-first principle — prefer dedicated tools over shell 2026-07-29 09:48:23 +02:00
lkn bc9c8d5336 add Sandbox & Elevation section to system prompt with max-3-retry rule 2026-07-29 00:44:17 +02:00
lkn f1cbda64c7 add skills and autonomous loading behavior to system prompt 2026-07-29 00:17:58 +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 c221426af4 remove root-level /tools from 9P filesystem listing and dead toolsResult field 2026-07-29 00:01:06 +02:00
lkn 6b57fe1f77 move Tool Registry from session_9p.md to system_prompt.md (decoupled from 9P) 2026-07-28 23:27:32 +02:00
lkn 7bcaf7422c update session_9p.md: use tool_list/tool_load/tool_active instead of ollie-9p 2026-07-28 23:26:30 +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 faaaf0f014 remove SYSTEM_PROMPT_QWEN.md and all references 2026-07-28 22:42:45 +02:00