Commit Graph

64 Commits

Author SHA1 Message Date
Ollie Agent a4e5f7c9c5 unify commands: / == o ctl, all operations are ctl commands
The slash prefix in prompts now routes directly to the agent's ctl
file. No special-cased commands in the agent — the ctl handler is the
single command surface:

  /stop, /compact, /clear, /model X, /inject X, /agent X, /cwd X

New ctl commands:
  inject <text>  — overwrites any pending inject (replaces /i and /irw)
  agent <name>   — switch agent profile (moved from commands.go)

Agent methods added: Compact(), Clear(), SwitchProfile() — called by
the ctl handler, testable independently.

HandleCommand is now a thin trampoline: strip /, run 'o ctl <rest>'.
commands.go reduced from 155 to 50 lines.

REPL: / → o ctl, !q/!quit → exit TUI.
2026-08-09 02:40:48 +02:00
Ollie Agent 1bc438771f agent: replace 12 slash commands with ! prefix
! runs 'o' with session/agent context, giving access to the entire
namespace from any frontend (TUI, GUI, Emacs). Examples:
  !ctl compact       — compact context
  !ctl stop          — stop agent
  !read stats        — show usage/cost/ctxsz
  !read models       — list models

Kept: /i (inject mid-turn), /irw (rewrite inject), /agent (profile switch).
Removed: /backend, /models, /model, /maxsteps, /agents, /compact,
/context, /cost, /usage, /history, /clear, /sp.

Also simplified the o prompt REPL: slash commands reduced to /i and
/quit. Everything else via !<cmd>.

Dead code removed: contextDebug() in history.go.
2026-08-09 02:33:03 +02:00
Ollie Agent 49c93eab5f remove usage_log.go (write-only telemetry), clean AGENT_FILES
- Delete agent/usage_log.go — wrote JSONL to disk but nothing read it
- Remove appendUsageLog call from turn.go
- Remove dead 'offset' from AGENT_FILES tab-completion list
- TUI: grep markers+fences from o log (single read, not streaming)
2026-08-09 02:03:51 +02:00
Ollie Agent 57984dfa3f agent: replace sync.Cond with close-channel signal for WaitChange
sync.Cond is the wrong primitive for Go — it requires holding a mutex
during Wait and needs context.AfterFunc hacks to integrate with ctx
cancellation.

Replace with a simple signal channel: notifyChange() closes it and
swaps in a fresh one; WaitChange() selects on the channel and
ctx.Done(). Simpler, idiomatic, no spurious wakeups.
2026-08-09 01:08:41 +02:00
Ollie Agent 5b11e8afcb agent: embed GenerationParams in AgentConfig, remove GenParams()
Add JSON tags to backend.GenerationParams and embed it directly in
AgentConfig. The 14 duplicated sampling fields and the field-by-field
copy method disappear. Callers use cfg.GenerationParams directly.
2026-08-09 01:05:32 +02:00
Ollie Agent 5c81eefe0a remove dead code: TaskState subsystem, Verbosity, dead session fields
Remove entire TaskState machinery:
- TaskState struct, render(), taskState()/updateTaskState() on History
- inferTaskStateUpdate() — heuristic plan tracking
- Replan gate (replanGate const, roundsWithoutPlan counter)
- Stall detection (stallThreshold, stallRounds, lastAction)
- Plan reinject (planReinjectInterval, periodic re-injection)
- ReadPlanStep plumbing (AgentCfg → Agent → TurnCtx → loop)

None of this worked in practice — the model ignores the nudges,
ReadPlanStep was never wired to a non-nil value, and TaskState
fields were only populated by inferTaskStateUpdate (which depends
on ReadPlanStep being set).

Compaction now uses plain summary text in the cold zone instead
of serialized TaskState JSON.

Also remove:
- Verbosity field (declared, threaded, never read by any backend)
- DisallowTools (config field never wired to session)
- Session.listHandlers, plan, prevPrompt (never read)
- Config.Output, Config.ListHandlers, Config.ReadPlanStep (never set)

-246 net lines
2026-08-09 01:03:19 +02:00
Ollie Agent 625654fcef agent: simplify prompt resolver to file-path-only
All agent configs use the same pattern: JSON array of file paths with
env var expansion. Remove unused features:

- Shell command execution via resolveStringPrompt (the `!cmd` prefix
  path is kept as a trivial fallback but the 30s timeout/stderr
  capture/cwd probing is gone)
- Prompt directory search (PromptsDirs, resolvePromptFile)
- Shell metacharacter detection guard
- Literal-text-if-contains-newline heuristic
- IsExec flag on Prompt type (both string and array now mean the same
  thing: list of file paths)

207 + 49 → 104 + 38 lines (-114)
2026-08-09 00:51:13 +02:00
Ollie Agent 010ad83944 simplify preamble: section-based model, no string surgery
Replace the monolithic preamble string with Preamble struct — an
ordered list of named sections joined on demand. Updates are simple
Set() calls; no marker-based string splicing.

Changes:
- Delete prompts/tool_discovery.md (content already in system_prompt.md)
- Reduce prompts/ package to just the embed + ResolveSystemPrompt
- Replace buildPreamble() with direct section construction
- Replace refreshToolListing() 90-line string surgery with one Set()
- Replace SetCWD string.ReplaceAll with env section rebuild
- Remove RenamePreamble (was a no-op; session ID is a template var)
- Export EnvironmentBlock() for session setup
- All callers use PreambleString() instead of raw string field
2026-08-09 00:32:49 +02:00
Ollie Agent c1c0013f2d all: kill loadEnvFile dupe, extract text parser, tidy tests
backend:
- Delete loadEnvFile (env.EnsureDefaults at startup covers it)
- Move newFromEnv to test file (only tests use it)
- Delete dead tests (TestLoadEnvFile*, env-file override tests)
- new.go: 150→60 lines

agent:
- Extract text tool-call parser to text_parse.go (288 lines)
  parseTextToolCalls, shorthandToJSON, extractBalanced,
  parseExtraKV, extractJSONObject, relaxJSON
- loop.go: 1113→835 lines
2026-08-08 17:06:51 +02:00
Ollie Agent 5b64d62d2e agent: remove auditLog (was always derived from log)
The audit logger was never a separate destination — it was always
log.Sub("audit"), writing to the same sink with a prefix. The
fallback in NewAgent even warned 'deriving from Log' every time.

Replace ag.auditLog.Debug() calls with ag.log.Debug() directly.
Remove the field, AgentCfg.AuditLog, and all session plumbing.
2026-08-08 15:59:00 +02:00
Ollie Agent 705a7226a2 all: merge thin packages and small files
- Merge detach/ into toolsrv/detach.go (single consumer)
  Rename Process → DetachedProcess to avoid collision with spawn.go
- Merge agent/state.go into loop.go (types used only there)
- Merge agent/runtime.go into runtime.go (formerly build_runtime.go)
- Merge agent/compaction.go + models.go into history.go
- Merge agent/new.go into agent.go (constructor lives with struct)
- Rename ResultTier → MemoryTier (TierHot/Warm/Cold → MemoryHot/Warm/Cold)
- Rename build_runtime.go → runtime.go
2026-08-08 15:56:26 +02:00
Ollie Agent 8152dec075 all: delete dead code, tighten API surface
toolsrv:
- Delete WithOnClose, WithOnEnvSet, SetOnExit (dead Options)
- Delete ListDetached, ListDetachedInfo (only ListDetachedRaw used)
- Delete Execute (dead wrapper)
- Delete CWD, ToolRegistry, SessionID, InjectContent (dead accessors)
- Delete ExecuteInSandbox, ExecuteElevated (zero external callers)
- Delete Summaries, RefreshLoaded from Registry (dead)
- Delete DialSSH (alias for RemoteDial)
- Simplify Dial: takes socket string directly, kill Addr/LocalAddr/SSHAddr
- Rename Server receiver e → s
- Unexport context import (no longer needed in tools.go)

session:
- Delete SaveFuncs, AgentAt, AgentCount, NextUncheckedStep
- Delete SetDisallowTools, SaveAllSessions

env:
- Delete Set, Get, All, Format, managed (dead exports)
- Unexport LoadFile → loadFile

fs:
- Delete HandlerCtx.ToolReg, Skills, SaveFn (never read by handlers)
- Delete Config.MkdirAll, Config.SkillsRegistry (dead plumbing)
- Delete AgentLog: Plan, SetPlan, PrevPrompt, Mu, LogInfo, Remote methods
- Delete unused type aliases (NodeOption, FileTree, FileConfig, etc.)

backend:
- Delete ClosePool, PoolStats (dead), New() (dead)
- Delete kiroTokenExpiringSoon standalone func (dead)
- Unexport SharedTransport/SharedClient → sharedTransport/sharedClient

skills:
- Delete entire package (zero importers; feature works via tool scripts)

agent:
- Delete BroadcastChange (dead duplicate of notifyChange)
- Delete HasHistory, ToolCallCount, CompactionModel, SetCompactionModel
- Unexport SetReply, BuildPreamble, DefaultPromptsDir
2026-08-08 15:51:13 +02:00
Ollie Agent 06a996e967 all: replace toolsrv.Runner interface with *toolsrv.Conn
The agent always talks to a *Conn (never a *Server directly).
Replace the Runner interface with the concrete type throughout:

- Runtime.ToolServer is now *toolsrv.Conn
- BuildRuntime takes *toolsrv.Conn
- session.Config, SessionInfra, InfraConfig use *toolsrv.Conn
- All inline type assertions in agent.go deleted — methods called
  directly on *Conn (SetEnv, SetCWD, Close, Detach, ListDetachedRaw,
  SignalDetached, GetDetachedOutput, DismissDetached, SetAllowTools,
  SetOnToolsChanged, Ping, ToolRegistryRevision)
- Added Conn.ToolRegistryRevision() that returns 0 (remote connections
  don't support revision tracking; use push-based OnToolsChanged instead)
- Deleted the Runner interface and its test
- Renamed LoadToolOnRunner → LoadToolOnConn
2026-08-08 15:10:01 +02:00
Ollie Agent 3b83b9d373 all: delete dead interfaces, kill globalRootState
- agent: delete 'state' interface (one implementation: *History). run()
  now takes *History directly.
- agent: delete 'backendNamer' interface. resolveCompactionModel takes
  backend.Backend directly.
- fs: delete Shutdown/InterruptAll/Lookup wrappers that took *Tree they
  never used. Callers (olliesrv) now call session.* directly.
- fs: delete globalRootState. sessionBindings uses ctx.Root.Data.(*RootState)
  via the HandlerCtx that was always available.
2026-08-08 14:58:47 +02:00
Ollie Agent 63c4cd6173 all: kill dead code, remove classifier system, clean up names
Dead code removed:
- agent: firstSentence, Checkpoint, WaitForChange, InitCond, cfgDir,
  execServer, SaveTo, SaveFull, saveTo, saveToFull, sanitizeMessages,
  LoadPersistedAgent, RestoreHistory, Restore, PersistedAgent type
- toolsrv: entire tier.go (MemoryTier, MemoryTierArgs, OutputFormat,
  CanParallelize on Server), same methods on Conn
- cmd/ollie-remote: can_parallelize, memory_tier, memory_tier_args RPC
  handlers
- toolsrv/rpc_integration_test: all classifier tests
- fs/lifecycle: state(root) dead helper

Renames:
- session.Session receiver: 'a' → 's' throughout
- SaveSession(path) → Save() (dead parameter removed)
- execServer() eliminated — callers use ag.runtime.ToolServer directly

The agent-package save/restore chain was entirely dead: PersistSession
in session/persist.go reads agent accessors directly and never called
SaveTo/SaveFull.
2026-08-08 14:52:10 +02:00
Ollie Agent b6694d409a agent/toolsrv: replace classifier system with ToolMeta map
The entire classifier indirection (interfaces, type assertions, RPC
methods for classification, closure wrappers in BuildRuntime) is replaced
by a simple map[string]ToolInfo on Runtime.

The .meta file is read once into ToolInfo. The loop reads fields directly:
  rt.ToolMeta[name].ReadOnly       (was: rt.CanParallelize(name))
  rt.ToolMeta[name].Tier           (was: rt.MemoryTier(name, args))
  rt.ToolMeta[name].OutputFormat   (was: rt.OutputFormat(name))
  rt.ToolMeta[name].ResetsCounter  (was: rt.ResetsCounter(name))

Removed: ParallelClassifier, MemoryTierClassifier, OutputFormatClassifier
interfaces, toolClassifier type, and all closure-wrapping in BuildRuntime.

The RPC methods on Server/Conn stay (used by ollie-remote) but the agent
no longer routes through them.
2026-08-08 14:33:23 +02:00
Ollie Agent 38b35f1ba5 toolsrv/agent: rename ClassifyTool→CanParallelize, ClassifyTier→MemoryTier
Rename throughout: Go methods, interface types, Runtime fields, wire
protocol RPCs, tests, and ollie-remote.

- IsParallelRead / ParallelClassifier → CanParallelize
- ResultTier / ResultTierArgs / TierClassifier → MemoryTier / MemoryTierArgs / MemoryTierClassifier
- Wire: is_parallel_read → can_parallelize, result_tier → memory_tier, result_tier_args → memory_tier_args
2026-08-08 14:29:41 +02:00
Ollie Agent 6e7b6e5f96 agent: TurnCtx embeds context.Context
run() signature is now run(rt *Runtime, ctx TurnCtx, state state).
The ctx parameter carries both the cancellation context and per-turn
closures — no more separate ctx + tc parameters.

emit() and retryCountdown() also take TurnCtx directly.
2026-08-08 14:23:32 +02:00
Ollie Agent 32ff54f708 agent: simplify configuration/instantiation layers
- Kill agentConfig struct. run() takes (*Runtime, TurnCtx, state) directly.
  TurnCtx holds only 7 per-turn closures; stable config reads come from Runtime.

- Lazy tool refresh: toolsNeedRefresh() checks ToolRegistryRevision() on the
  tool server. Skips ListTools IPC when registry hasn't changed. Remote Conn
  falls back to always-refetch (same as before).

- AgentConfig.GenParams() method replaces the 16-line manual field copy in
  BuildRuntime.

- Remove CfgBackend/CfgModel from Runtime. Callers read cfg.Backend/cfg.Model
  directly since they already have the AgentConfig in scope.
2026-08-08 14:19:46 +02:00
Ollie Agent ba740701e2 simplify prompt loading, some renames 2026-08-08 13:29:01 +02:00
Ollie Agent 605212e1fd Simplify preamble construction system
- Extract hardcoded tool sections into prompts.ToolSections() function
- Replace template system with simple Go code for better maintainability
- Fix refreshToolListing to preserve tool documentation and discovery sections
- Add comprehensive unit tests for prompts and agent packages
- Remove unnecessary tool_sections.md template file

The refactoring simplifies the preamble construction while maintaining
all functionality. Tool listing updates dynamically via refreshToolListing,
while tool documentation requires agent reload (full BuildPreamble call).
2026-08-08 12:27:53 +02:00
Levi Neely 7100942984 fix: correct plan path in replan-required message
Use session/$OLLIE_SESSION_ID/agent/$OLLIE_UNAME/plan instead of
outdated s/$OLLIE_SESSION_ID/plan
2026-08-07 17:21:51 +02:00
Levi Neely bb3cb01c24 fix: update plan path in replan-required message 2026-08-07 17:21:24 +02:00
Levi Neely 3c459cb370 style: use xml-like tags for all system injections in agent loop
Standardize all system messages to use xml-like tags matching the
pattern used by user interruptions:
- <system-consecutive-errors>
- <system-repeated-error>
- <system-replan-required>
- <system-stall-detected>
- <system-task-state-review>
- <system-step-budget-warning>
- <system-step-budget-stop>
2026-08-07 17:19:57 +02:00
Levi Neely 799d569654 style: use xml-like tags for step budget notices
Match the format used by user interruptions.
2026-08-07 17:15:57 +02:00
Levi Neely 6f55348d38 feat: add 50% step budget warning before exhaustion
Nudge the agent at 50% of step budget to encourage taking action
rather than looping on research. The warning explains that action
tools (file_write, file_edit, shell) reset the counter.
2026-08-07 17:14:56 +02:00
Levi Neely e84b4ffef7 feat: add resetsCounter tool property to reset step budget on active progress
Tools like file_write, file_edit, and shell now reset the agent's step
counter when called successfully. This allows the agent to continue
working without hitting the soft step-budget guardrail as long as it's
making active progress (writing files, running commands) rather than
looping on research/reading.

Changes:
- Add ResetsCounter bool to ToolInfo and MetaFile structs
- Parse resetsCounter from .meta JSON files
- Reset step counter in agent loop when ResetsCounter tool succeeds
- Add resetsCounter: true to file_write, file_edit, shell
- Reduce maxSteps from 50 to 25 (resetsCounter makes this safe)
2026-08-07 17:13:14 +02:00
Levi Neely 21e46b9895 refactor: consolidate event formatting, remove log validator
- Move FormatEvent to format/ package for reuse by both live handler
  and replay
- Move LoadConfig to agent/ package where it belongs
- Remove log validator (was noisy, not essential)
- Update replay to use FormatEvent for consistent output format
- Update kde submodule with GUI streaming fix
2026-08-07 10:11:48 +02:00
Ollie Agent 5ec208c5ea fsedsl: HandlerCtx composes context.Context — no more context.Background() in handlers
- HandlerCtx now embeds context.Context for per-operation cancellation/deadline
- Reverted fsedsl signatures back to simple (ctx Ctx) since context is embedded
- requestGenerate handler uses ctx instead of context.Background()
- cmdInject propagates its context parameter instead of using Background
2026-08-07 07:42:41 +02:00
Ollie Agent 7e29d28848 remove agent/complete.go — completions now go through /generate
- Delete agent/complete.go (110 lines) and its requestComplete handler
- Remove /complete 9P file from fs/spec.go
- Update KDE kate plugin to build the completion prompt inline and call
  ollie-9p rdwr generate instead of ollie-9p rdwr complete
- StripCompletionNoise and stripPrefixEcho moved into C++ helpers
2026-08-07 07:36:58 +02:00
Ollie Agent 84b8b03dad agent: replace hardcoded model maps with models.yaml config
- Remove defaultCompactionModels map from compaction.go
- Add agent/models.go: load ~/.config/ollie/models.yaml for all backend/model settings
- Completion (Complete()) falls back to models.yaml completion section when env vars unset
- Compaction falls back to models.yaml compaction section per-backend
- Add data/configs/models.yaml.sample as reference config
- Priority chain: agent config > OLLIE_*_MODEL env > models.yaml > session model
2026-08-07 07:24:43 +02:00
Ollie Agent d80a87eb86 clean up OLLIE_* env vars: replace with XDG conventions
- Remove all OLLIE_*_PATH vars (TOOLS_PATH, CFG_PATH, DATA_PATH, etc.)
  Use XDG_CONFIG_HOME/ollie/* and XDG_DATA_HOME/ollie/* instead
- Replace OLLIE_<TAG>_LOG per-component logging with single OLLIE_LOG={level}
- Replace OLLIE_USAGE_LOG with XDG_DATA_HOME-based path
- Replace OLLIE_OLLAMA_URL with standard OLLAMA_HOST (or omit entirely)
- Rename protocol markers: OLLIE_LISTEN_READY → ListenReady, OLLIE_9P_OPEN → Open
- Remove freeloader hooks from agent configs
- Update sandbox YAMLs to use XDG paths instead of OLLIE_*_PATH tokens
- Update shell tools to use $(dirname "$0") fallback instead of OLLIE_TOOLS_PATH
- Update docs and prompts accordingly
2026-08-07 07:11:53 +02:00
Levi Neely 7e68c18303 agent: mtime-based cache validation for read-safe tool results
Replace the blanket cache invalidation (cleared on any file_write/edit)
with per-entry staleness detection based on file mtime and size. On cache
hit, stat the file and compare against the metadata stored at cache time.
If the file changed (user edited externally, git checkout, etc), the
stale entry is discarded and the tool re-executes.

This fixes the case where a user is coding alongside the agent — external
file changes are now detected instead of serving stale cached reads.
2026-08-06 14:04:49 +02:00
Ollie Agent fc0c368e91 Good idea fairy cleanup: ~960 lines removed
Phase 1:
- agent/hooks.go (entire hooks engine, 237 lines)
- backend/noop.go (unused test backend)
- backend/oneshot.go: Route/RouteRequest/RouteResult + /route 9P file
- cmd/ollie-9p/mount/ (FUSE mount, 336 lines)
- toolsrv/schema.go (ParseToolInfo, zero callers)
- toolsrv/discover.go: ToolPrompt/ReadTool (zero callers)
- agent/commands.go: CompactionSnapshot + history.go: PreCompactionSnapshot
- data/tools/route.meta + justfile route install

Phase 2:
- detach/process.go: stripped Signal(), Cmd field, unused imports
- SignalDetached reimplemented with syscall.Kill directly

24 files changed, 19 insertions, ~980 deletions
2026-08-05 21:51:55 +02:00
Ollie Agent 2bd6d6f66a Remove OLLIE_*_PATH env vars: paths follow ~/.config/ollie/ convention
- Stripped OLLIE_TOOLS_PATH, OLLIE_AGENTS_PATH, OLLIE_SKILLS_PATH,
  OLLIE_PROMPTS_PATH, OLLIE_MEMORY_PATH, OLLIE_TMP_PATH from managed
  list and defaults in env.go
- ToolsPath(), SkillsPath(), PromptsDirs(), AgentsDirs(), ollieTmpDir()
  now derive from paths.CfgDir()/paths.DataDir() directly
- Removed shell-exec fallback from resolveExecPrompt() — only file
  resolution remains
- Cleaned up env_test.go to match reduced managed set
- Updated stale comments referencing /home/lkn/.config/ollie/tools
2026-08-05 19:37:13 +02:00
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