Commit Graph

1913 Commits

Author SHA1 Message Date
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 8f7d21fc38 toolsrv: fire OnToolsChanged after LoadTool
The system prompt tool listing now refreshes immediately on tool_load
instead of only on file-watcher events. buildToolListing helper added
to format the listing in the same format BuildPreamble uses.

Also updates kde submodule: GUI auto-switches to newly created agent,
removes remote field from agent dialog.
2026-08-08 14:02:22 +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
Ollie Agent 57052180d3 update kde submodule 2026-08-07 18:58:46 +02:00
Levi Neely e4bf5b492b kde: update submodule 2026-08-07 18:53:40 +02:00
Levi Neely dc1211b6a7 kde: update submodule 2026-08-07 18:51:30 +02:00
Levi Neely 4f5890f8db prompts: add mandatory API documentation lookup rule
When working with any API, the agent MUST look up official docs if not
highly confident in specific methods/properties/behaviors. No guessing.
2026-08-07 18:18:45 +02:00
Levi Neely eca1a9e232 kde: update submodule 2026-08-07 18:12:31 +02:00
Levi Neely 5cb3d0e68e kde: update submodule (hybrid native/subprocess streaming) 2026-08-07 18:06:44 +02:00
Levi Neely fc17a4cca3 kde: update submodule (native 9P streaming) 2026-08-07 18:02:52 +02:00
Levi Neely 991bbef840 lib9p: add streaming API for native reads
Add ollie9p_open, ollie9p_read_fid, ollie9p_close_fid for streaming
file reads. This allows the KDE GUI to read chat/statewait/eventwait
files natively without spawning subprocesses.
2026-08-07 18:02:24 +02:00
Levi Neely 63faa3b68a kde: update submodule 2026-08-07 17:54:41 +02:00
Levi Neely 07ec63704e o prompt: drop readline for paste support
Switch from 'read -e' to plain 'read' so multi-line paste can be
captured. Readline was consuming pasted lines individually.
Increase drain timeout to 100ms.
2026-08-07 17:46:35 +02:00
Levi Neely 189ec65aae o prompt: buffer multi-line paste input
Drains additional lines within 50ms of the first line to capture
multi-line pastes in the TUI prompt.
2026-08-07 17:44:05 +02:00
Levi Neely 8397f1aa74 o: add log command, rename tail to chatstream
- Add 'o log [-n N]' to read last N lines from agent log (default 1000)
- Rename 'o tail' to 'o chatstream' for clarity
- Update TUI to show log history before streaming chat
2026-08-07 17:34:33 +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 a8be36f405 chore: update kde submodule 2026-08-07 17:17:18 +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 0d6871a974 Update kde submodule: fix QML performance 2026-08-07 15:25:24 +02:00
Levi Neely 6d0a7ae2ba Update kde submodule: fix chat rendering and scroll 2026-08-07 15:15:15 +02:00
Levi Neely fc7b4bfa17 Update kde submodule: diagram rendering 2026-08-07 14:59:28 +02:00
Levi Neely 07366841aa kde: update submodule with scrolling fixes 2026-08-07 11:20:24 +02:00
Levi Neely 063022e54f kde: update submodule 2026-08-07 11:01:17 +02:00
Levi Neely 9a3efebd14 kde: update submodule with text selection and context menus 2026-08-07 11:00:28 +02:00
Levi Neely 1ca8049fc6 kde: update submodule with auto-scroll improvements 2026-08-07 10:22:11 +02:00
Levi Neely 4dd32ce162 fs: split types.go into session_node.go and agent_log.go
- session_node.go: SessionNode wrapper with agent log management and model cache
- agent_log.go: AgentLog with event handler and replay logic
2026-08-07 10:18:24 +02:00
Levi Neely d936ec29a8 format: remove agent dependency from FormatEvent
FormatEvent now takes primitive string arguments instead of agent.Event.
This fixes the dependency direction - format/ should be a leaf package
that agent/, session/, and fs/ depend on, not the other way around.
2026-08-07 10:16:28 +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
Levi Neely 5191b048ea gitignore: add ollie-9p binary 2026-08-07 09:15:07 +02:00
Levi Neely e7185afc37 ollie-9p: stream all reads instead of buffering until EOF
cmdRead now opens the file and reads incrementally, writing each chunk
to stdout immediately. This fixes streaming for stream-mode files (chat,
statewait, eventwait) which block per-Tread until data arrives.

The previous io.ReadAll approach buffered internally and never flushed
to stdout because stream files never return EOF.

No separate 'tail' command needed — 'read' just works for both
one-shot files (server returns data then EOF) and stream files
(server blocks between chunks).
2026-08-07 09:13:25 +02:00
Levi Neely 3d9eca97b2 fix: close streaming fence before ending block on call/default events
The event handler was emitting [[[end]]] to close an assistant block
without first closing an open streaming fence (code block). This left
the log in a state where a [[[call:...]]] block appeared nested inside
an unclosed assistant block, triggering a log structure violation.

Now the call and default cases close streamingFence (like the tool case
already did) before writing the [[[end]]] marker.
2026-08-07 09:05:39 +02:00
Ollie Agent c7f1bec71c refactor: extract format package, ctl dispatcher, and log structure validator
- Extract all [[[block]]] formatting constants/helpers into format/format.go
  (EndTag, RoleDelim, ToolDelim, CallDelim, BlockHeader, ParseBlockHeader, IsEndMarker)
- Replace switch/case ctl dispatchers in fs/handlers.go with generic
  ctlDispatch() from new fs/ctl.go
- Add LogValidator state machine to AgentLog enforcing:
  - Every [[[block]]] MUST have an [[[end]]] marker
  - Blocks SHALL NOT be nested
  - Streaming line buffering across partial writes
  - Fatal failure on first violation with line-number reporting
  - UnclosedAtTeardown() for session/agent teardown checks
- Fix kde/kate ollie_ghost compile: stripPrefixEcho signature mismatch
2026-08-07 08:59:07 +02:00
Ollie Agent 7c99d101b1 namespace audit: remove prompt.prev, state, offset, context, tail
- Removed from fs/spec.go: prompt.prev, state, offset, context, tail
- Removed handlers: readAgentPromptPrev, readAgentState, readAgentOffset, readAgentContext, readAgentTail
- statewait still exists but now has an inline read handler
- 5 files out of the namespace; 18 agent-level files remaining
- Reduces each agent dir by 5 entries
2026-08-07 08:19:54 +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 40be7c1308 kde: submodule update — kate plugin now uses /generate for completions 2026-08-07 07:38:34 +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 851ced1286 lib9p: unify 9P client — ollie-9p now imports lib9p/client instead of duplicating it
- Extract shared 9P operations (Dial, Read, Write, Rdwr, Stat, Ls, Create, Remove, Mkdir, Rename, ModeString) into lib9p/client package
- lib9p/lib9p.go (C FFI layer) delegates to lib9p/client for all operations
- cmd/ollie-9p/main.go uses lib9p/client directly, eliminating ~250 lines of duplicated dial/open/write/close boilerplate
- Removed lib9p/go.mod and go.sum (no longer a separate module; lives in main module)
2026-08-07 07:30:22 +02:00