Commit Graph

29 Commits

Author SHA1 Message Date
Ollie Agent f265fd3a9f remove stray .bak file 2026-08-04 21:16:19 +02:00
Ollie Agent 3349b610ec remove remaining Reactions references from data/prompts and history.go 2026-08-04 20:22:58 +02:00
Levi Neely fbb2a767f6 session: pause/resume persistence, restore paused sessions without spawning processes
- Skip SetupToolServer for paused sessions during restore
- Pause() and Resume() now persist state to disk
- Resume() sets up tool server from scratch for sessions restored paused
- IsConnected() returns false when paused
- Add SetPaused(), SetToolServer() methods
- ProcessKeeper.SetContext() for resume after pause
- Session index sorts active-first, paused-last
- CreateAgent accepts name= parameter
- Remove duplicate SetCwd method
2026-08-04 16:05:22 +02:00
Levi Neely 86f7c54805 refactor: rename saveSession/flushSave to save/flush, remove legacy restore
- Rename AgentCfg.SaveSession/FlushSave to Save/Flush for brevity
- Remove restoreLegacySession — all sessions now use multi-agent format
- Pass Save/Flush callbacks to agents in CreateAgent and restore paths
- Add AuditLog fallback warning in NewAgent
2026-08-04 14:38:09 +02:00
Levi Neely f348b968a2 fix: wire up event handler so chat stream receives events
After the fs/session refactor, NewEventHandler was defined but never
called. Agents created via session restore or CreateAgent had nil
output handlers, so emit() was a no-op and the chat stream stayed empty.

- Add Agent.SetOutput() to allow setting the event handler post-creation
- Wire up SetOutput(NewEventHandler(al)) in fs/newroot.go for restored sessions
- Wire up SetOutput(NewEventHandler(al)) in fs/handlers.go for new agents
- Also includes expanded UsageStats fields and TaskState persistence
2026-08-04 14:21:45 +02:00
Levi Neely 4ae1584887 refactor: move persistence to session/, support multi-agent sessions
session/persist.go:
- New multi-agent format: PersistedSession with []PersistedAgent
- PersistSession saves ALL agents, not just first
- RestoreAllSessions returns []RestoredSession with []RestoredAgent
- Backward compatible: restores legacy single-agent format

fs/persist.go:
- Thin wrapper that creates AgentLogs for each restored agent
- Delegates to session.PersistSession/RestoreAllSessions

agent/agent.go:
- Added Messages() to get conversation history
- Added Usage() to get token/cost stats

agent/history.go:
- Added RestoreHistoryFromMessages for multi-agent restore

session/session.go:
- Added Remote() getter
2026-08-04 14:02:15 +02:00
Levi Neely 4e817f5de9 replace event ring buffer with pubsub
- Use github.com/simonfxr/pubsub for topic-based event routing
- Topic format: session.{id}.{action}, agent.{id}.{action}
- Wildcard subscriptions: *, session.*, agent.*
- PublishEvent routes to exact topic + wildcards
- WaitEvent maintains backwards compatibility for eventwait
- Add agent.SetOnStateChange callback for state change events
- Extend session/idx format with paused, connected, agent list

Events now published:
- session.{id}.new/kill/pause/resume/rename
- agent.{id}.new/kill/state

This enables efficient selective subscriptions - GUI can subscribe
to specific sessions/agents instead of receiving all events.
2026-08-03 18:48:30 +02:00
Levi Neely f9becce7cc fix(agent): refresh outputFormat lookup on each turn
The OutputFormat function was set once at runtime build time and stored
in ag.runtime.OutputFormat. When tools were dynamically loaded via
tool_load, the tool definitions were refreshed but the OutputFormat
lookup still used the stale runtime version that didn't know about
newly loaded tools.

Build the outputFormats map from the fresh tool list on each turn,
just like we already do for the tool definitions. This ensures
outputFormat (e.g., 'diff' for file_edit) is available immediately
after loading a tool.
2026-08-03 16:26:08 +02:00
Levi Neely aae307046a fs: ensure tool server on agent creation, retry via keeper
ToolServer is vital infrastructure — it must never be nil. If the
initial dial fails, retry via ProcessKeeper (which respawns
ollie-remote). If still unavailable, fail agent creation with a
clear error asking the user to try again.

Reverted the nil-check band-aid in turn.go — ToolServer is now
guaranteed non-nil for any running agent.
2026-08-03 15:51:23 +02:00
Levi Neely aa84cd1c9f agent: nil-check ToolServer before ListTools in turn
Prevents nil pointer dereference when a newly created agent's
tool server connection failed to establish (keeper.Dial returned
nil, or session was restored with a dead toolsConn).
2026-08-03 15:45:57 +02:00
Levi Neely c9c76d51c0 agent: inject tool documentation + schemas into preamble
Models that ignore native tool schemas (via the API tools parameter)
now see full tool documentation in-context: usage docs, argument
definitions, examples, and the JSON schema.

This is appended as a '# Tool Documentation' section in the system
prompt, below the compact '# Available Tools' listing.
2026-08-03 13:07:26 +02:00
Levi Neely 04e1bfa228 agent: persist uname separately, fix OLLIE_UNAME != OLLIE_SESSION_ID
The agent's 12-char hex uname was not persisted. On restore,
fs/persist.go incorrectly used ps.ID (session UUID) as the uname,
making OLLIE_UNAME identical to OLLIE_SESSION_ID.

Fix: add Uname field to PersistedAgent, persist ag.id in SaveFull,
restore from ps.Uname (falls back to nextUname for old files).
2026-08-03 10:55:50 +02:00
Ollie Agent 4dfa6a55d5 Revert "wrap system-user-interruption in its own fence block"
This reverts commit d5dea4446d.
2026-08-03 00:39:29 +02:00
Ollie Agent d5dea4446d wrap system-user-interruption in its own fence block 2026-08-03 00:37:55 +02:00
Ollie Agent 6509bdb5ae streaming tool blocks: always close source fence and emit [[[end]]]
When a streaming tool completes, emit a final empty-Content event so the
log handler always closes the markdown source fence. In the handler,
emit [[[end]]] directly instead of a blank line, so the GUI block parser
transitions back to BlockStart regardless of what follows.
2026-08-03 00:21:48 +02:00
Ollie Agent 53ecbe249b fix tool output format; bump kde 2026-08-02 23:48:15 +02:00
Ollie Agent d3860304af Add formatted tool output fences 2026-08-02 22:57:17 +02:00
Ollie Agent 8fc47622c8 Persist renamed sessions and profiles 2026-08-02 22:34:35 +02:00
Ollie Agent 119e673299 fix naming problems 2026-08-02 22:10:00 +02:00
Ollie Agent e25157ffcd multiplex toolsrv, wip zero-tool server 2026-08-02 19:18:39 +02:00
Ollie Agent ff17a90bbf fix: agent rename uses SetName() not Submit(/agent ...); add SetName method to agent.Agent 2026-08-01 18:12:18 +02:00
Ollie Agent 0395a4a92f agent: replace timestamp-based response IDs with UUIDv4 2026-08-01 17:22:16 +02:00
Ollie Agent 937e6aef3b update: agent loop, session persistence, 9P filesystem, server, and remote sandbox 2026-08-01 15:06:49 +02:00
Ollie Agent 04ce9d7611 fix retry block: streaming pattern instead of in-place mutation, HH:MM:ss countdown 2026-08-01 12:45:44 +02:00
Levi Neely ae59151344 toolsrv: export USER and NAMESPACE to shell environment
ollie-9p computes its namespace path from $USER and $DISPLAY via
client.Namespace(). When run inside the sandboxed shell, USER was not
guaranteed to be in the environment, producing /tmp/ns..:0/ollie.

Fix: explicitly inject USER into envExtra in SetSessionEnv (alongside
OLLIE_SESSION_ID and OLLIE_UNAME). Also export the computed NAMESPACE
to cmd.Env so ollie-9p can use it directly without recomputing.
2026-07-31 09:22:43 +02:00
Ollie Agent f37e81d8cc remove emoji reaction feature (core, dbus, KDE GUI) 2026-07-31 09:09:24 +02:00
Ollie Agent 7a69f14277 toolsrv: typed RateLimitedError, agent loop: don't count rate-limited calls as consecutive errors 2026-07-31 07:46:32 +02:00
Ollie Agent 7bbdbd1f7f agent: refresh tool definitions from server on every turn
Previously the agent loop used a frozen Tools slice from BuildRuntime.
When tool_load promoted a tool, it was added to the registry but the
runtime's Tools slice was never updated — the LLM never saw the new
tool's schema until a session rebuild.

Fix: on each turn, call ToolServer.ListTools() to get the current set
of built-in + dynamically loaded tools, then convert to backend.Tool.
This makes tool_load behave identically to a built-in: the schema is
injected into the tool definitions on the very next turn.
2026-07-30 20:37:35 +02:00
Ollie Agent 9b6ddb7df1 flatten: absorb submodules into single Go module
- Remove submodules: core, 9p, acme, httpgw, remote, el
- Keep submodules: kde, webui (separate build systems)
- Collapse core/ packages into root: agent/, backend/, detach/, elevate/,
  env/, log/, paths/, sandbox/, session/, skills/, tools/, toolsrv/
- Collapse 9p/ packages: fs/session/, mount/, dbus/, cmd/olliesrv/
- Move binaries: acme/ → cmd/Ollie/, httpgw/ → cmd/ollie-httpgw/,
  remote/ → cmd/ollie-remote/, 9p/cmd/ollie-9p/ → cmd/ollie-9p/
- Move data: agents/, prompts/, tools/, scripts/, skills/ → contrib/
- Move services/ → contrib/services/, experiments/ → doc/experiments/
- Delete .beads/, .claude/, .kiro
- Single go.mod at root (module ollie)
- Fix all import paths, merge fs/ + session/ packages
- Extract dbus/ and elevate/notify.go from 9p server package
- Update justfile for new paths and single-module build
2026-07-30 18:57:51 +02:00