Commit Graph

1894 Commits

Author SHA1 Message Date
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
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 97c8bcbb62 fs/spec.go: move GID("agent") to root node, let children inherit
- Removed 19 redundant GID("agent") calls from leaf nodes and subdirectories
- Root DirNode now sets GID once; all descendants inherit via fsedsl resolver
2026-08-07 07:19:24 +02:00
Ollie Agent 06b287b8f2 remove hooks blocks and beads/freeloader refs from all agent JSON configs
- Remove "hooks" blocks from all 8 agent JSON files (copilot, default, driver, explorer, librarian, navigator, taskmanager, theo)
- Remove beads shell one-liner from prompt arrays in default.json and driver.json
- Hooks mechanism is dead code; these empty blocks are just noise
2026-08-07 07:15:04 +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
Ollie Agent e93affe2e2 pull.sh 2026-08-06 18:08:24 +02:00
Levi Neely 3344a93278 bump kde 2026-08-06 16:16:28 +02:00
Levi Neely 54c6bc3ed2 update kde submodule pointer; whitespace cleanup in data/scripts/o 2026-08-06 14:06:14 +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
Levi Neely 44592065d8 fix: respect agent-provided timeout and sandbox params in callPromotedTool
callPromotedTool was hardcoding timeout=30 and sandbox="default" for all
promoted tool executions, ignoring the timeout and sandbox parameters
provided by the agent in tool call args. Extract these from the JSON args
map (same pattern as elevated) and pass them through to the execution
functions.
2026-08-06 11:17:10 +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 b703dcf79c Prefix binary entries with / in .gitignore for consistency 2026-08-05 19:49:10 +02:00
Ollie Agent c72d1c76f5 Remove tracked binaries from repo, add to .gitignore 2026-08-05 19:48:44 +02:00
Ollie Agent 4ebcdf24b9 Remove dead data/tools/route (replaced by 9P /route file) 2026-08-05 19:45:58 +02:00
Ollie Agent 30dbe69d59 Remove OLLIE_TIER_* from env.sample 2026-08-05 19:45:45 +02:00
Ollie Agent 244f328a43 Remove dead OLLIE_ENABLED_BACKENDS from docs 2026-08-05 19:45:13 +02:00
Ollie Agent 0c7213a6a3 Remove OLLIE_ELEVATE_SOCKET from README env table 2026-08-05 19:44:16 +02:00
Ollie Agent 1372a6b55b Remove OLLIE_ELEVATE_SOCKET from config: derived from XDG_RUNTIME_DIR convention
- Removed from env.go managed list and defaults map
- main.go and shell.go derive path from XDG_RUNTIME_DIR directly
- main.go sets OLLIE_ELEVATE_SOCKET in process env for subprocesses
2026-08-05 19:43:52 +02:00
Ollie Agent 38efa3c985 Remove stale data/prompts/system_prompt.md (not embedded, not installed) 2026-08-05 19:41:52 +02:00
Ollie Agent 5584a24efb Remove tool_active/skill_active references from system prompts and core.md 2026-08-05 19:40:21 +02:00