Commit Graph

2654 Commits

Author SHA1 Message Date
Levi Neely f2f1f80e4e gui: integrate bypass requests into chat UI
Server changes:
- Session tracks pending bypass request and exposes methods
- New 9P files: session/{sid}/bypass (read/write), bypasswait (blocking)
- Publish bypass.request events for GUI listeners

GUI changes:
- Handle bypass.request events from eventwait
- Show inline amber banner with command and cwd
- Approve/Deny buttons resolve via 9P

Desktop notifications still work in parallel for non-GUI usage.
2026-10-06 11:44:15 +02:00
Levi Neely 79738a4a39 gui: reduce stopWorker wait from 200ms to 10ms
The fid close should immediately unblock reads. Don't wait long.
2026-10-06 11:38:28 +02:00
Levi Neely 65014395b7 gui: fix slow agent switching by closing fid on stop
When switching agents, the old state/chat streams would block until
data arrived (up to 500ms for statewait, indefinitely for chat).

Now requestStop() closes the fid from the calling thread, which
unblocks the worker's blocking read immediately. This makes agent
switching instant instead of waiting for the read timeout.
2026-10-06 11:36:30 +02:00
Levi Neely 0c30ec71d2 server: reduce statewait timeout from 5s to 500ms
When reading statewait with the same state value, the server now waits
500ms instead of 5 seconds before returning. This makes state polling
much more responsive.
2026-10-06 11:32:31 +02:00
Levi Neely 3655b16b4b gui: fix QThread crash in Lib9pStreamer::onWorkerFinished
QThread::~QThread() aborts if the thread is still running. The previous
code called delete unconditionally after a 100ms wait timeout. Now we
follow the same pattern as stopWorker(): check if wait() succeeded,
and if not, abandon the thread safely via deleteLater.
2026-10-06 11:29:26 +02:00
Levi Neely 3838078394 gui: fix compact button to send /compact command 2026-10-06 11:24:05 +02:00
Levi Neely 1dcc9638df gui: replace NativeStreamer with Lib9pStreamer
Switch streaming reads (chat, state, events) from subprocess-based
ollie-9p to native lib9p via worker threads. This eliminates:
- Process spawn/teardown overhead
- Subprocess failure modes
- Signal handling complexity

Lib9pStreamer uses QThread workers with blocking reads. On stop,
workers are given 200ms to exit cleanly, then abandoned (they'll
exit when the read completes or connection closes).

Also: make KRunner/Kate/KIO plugins optional in CMakeLists.txt
to fix build when KF6Runner etc aren't installed. Added
QT_DEFAULT_MAJOR_VERSION=6 to fix Qt6 detection with CMake 4.x.
2026-10-06 11:16:53 +02:00
Levi Neely c9c26d3a3d fix bypass+background hang: signal started immediately
Background procs with bypass were hanging because the caller blocked on
<-startedCh waiting for the process to start, but bypass.Submit blocks
until approval. Now we signal started immediately when entering bypass
path (with Process: nil), so the agent sees the proc ID right away.

Also handle term/kill when proc.proc is nil — cancel the context to stop
the operation (e.g., abort a pending bypass request).
2026-10-06 11:00:23 +02:00
Levi Neely 7ac1b6faf5 fix bypass+background: wire streamOut through bypass path
executeBypassDirect was missing the streamOut parameter, so background
processes running via bypass never had their output written to the proc
buffer. Now both bypass and sandboxed paths receive the streaming writer.
2026-10-06 10:53:06 +02:00
Levi Neely cd76864f19 fix agent profile selection from GUI
Two bugs:
1. GUI sends 'agent=<profile>' but server only recognized 'profile='
   - Added 'agent' as alias for 'profile' in parseAgentNewRequest

2. Model dropdown showed cost columns appended to model names
   - /models format: backend<tab>model[<tab>in<tab>out...]
   - Parser took everything after first tab as model name
   - Now stops at second tab to extract just the model name
2026-10-06 10:42:35 +02:00
Levi Neely 65e26f4a69 codeintel: fix codebase_overview to accept string or int for offset/limit
LLMs sometimes send integer parameters as strings (e.g. "20" instead of 20).
Add flexInt type that unmarshals from either JSON int or string.
2026-10-02 09:32:36 +02:00
Levi Neely f85612a4da session: pause all sessions on shutdown, fix agent config loading
Shutdown changes:
- Shutdown() now calls PauseAll() before closing sessions
- PauseAll() interrupts agents then pauses each session
- Sessions persist their state, allowing resume on next startup

Agent loading fix:
- LoadConfig returns (*AgentConfig, error) instead of *AgentConfig
- Parse errors are no longer silently discarded
- Callers handle nil config gracefully (no nil pointer dereferences)
2026-10-01 13:34:33 +02:00
Levi Neely c1888d31fe agent: increase tool result hard limit from 32KB to 128KB 2026-10-01 09:23:38 +02:00
Ollie Agent 3f9f4753ef session: make session/new get-or-create
CreateEmpty now returns (session, created, error): if a session with the
given name already exists it is returned untouched instead of erroring,
and only a freshly created session receives the provided cwd/workflow/
variant. The o script no longer suppresses errors from session/new, so
real failures surface while re-creating an existing session stays a
no-op success.
2026-09-29 23:01:44 +02:00
Ollie Agent 72239fe3d5 kde: remove KF5/Qt5 support, build KF6/Qt6 only
Drop the OLLIE_KF5 CMake option and the entire Qt5/KF5 build branch;
delete KF5-only assets (99-ollie-kf5.sh, ollie-actions-kf5.desktop);
collapse all QT_VERSION_MAJOR and KTEXTEDITOR_VERSION_MAJOR conditionals
to the KF6 path in the KRunner, Kate, KIO, and GUI sources; update
Makefile, README, and docs. Verified: KF6 configure + full build of
ollie-gui, krunner_ollie, ollie_kate, kio_ollie.
2026-09-29 16:44:12 +02:00
Levi Neely 50b02b7a1e sandbox: skip sockets and FIFOs in Landlock rules
Landlock cannot add rules for sockets (S_IFSOCK) or FIFOs (S_IFIFO).
Previously, attempting to add a path like /run/user/1000/wayland-0
would fail with EINVAL.

Now these special file types are detected and skipped gracefully.
2026-09-25 16:33:39 +02:00
Levi Neely f88b5fcc32 kiro: only set additionalModelRequestFields for supported models
The field is rejected by models that don't support thinking/reasoning
configuration. Check model name before setting the field; 'auto' and
unknown models skip it to avoid ValidationException errors.
2026-09-21 14:40:30 +02:00
Levi Neely 48bd852594 kde/gui: add Yes/No to templates menu 2026-09-21 14:20:07 +02:00
Ollie Agent 6b745aaad1 AGENTS.md: document experimental/unstable stability policy
Ollie is experimental and unstable; optimize for a clean minimal
codebase over preserving behavior. No backward-compatibility shims,
deprecation aliases, or legacy fallbacks — change things fully and
delete the old form. Standing preference, applied without asking, so
agent behavior doesn't need per-task course correction.
2026-09-07 13:56:55 +02:00
Ollie Agent 42cae9ee2e human-friendliness: self-describing ctl, structured errors, status, overview
Make the namespace explain itself instead of requiring prior knowledge.

- ctl is self-describing: reading it (empty write) or writing 'help'
  returns the valid verbs with one-line descriptions; an unknown verb
  errors with the valid list. Refactor dispatch to an ordered []ctlCmd
  carrying descriptions; drop the undocumented '.' alias and the
  drift-prone hardcoded help verb. Keep 'i' (drop 'inject') for fast
  injects. o's ctl usage now reads the live listing.
- Errors carry severity + remediation. backend.ClassifyError maps the
  typed errors to transient/config/fatal with a one-line fix; the error
  event renders [[[error:<severity>]]] and a 'remediation:' line so a
  human knows whether to wait or intervene.
- Add a human status file: 'thinking · 12s', 'calling shell · 3s',
  'idle' — distinct from the machine-facing raw state. Wire the TUI bar
  to it.
- Bare 'o' shows an overview of running sessions/agents with status, so
  you don't need to know any names to get oriented.

Tests: dispatch help/unknown/routing, ClassifyError severity table.
2026-09-07 13:55:45 +02:00
Ollie Agent f3933e21e7 backend: make reasoningEffort the primary knob with documented thresholds
reasoningEffort (low|medium|high) is now the single human-facing control
for model deliberation. Backends that speak a discrete level (OpenAI,
OpenRouter, Copilot, Gemini, Kiro) send it verbatim; Anthropic, which
needs a numeric budget, translates via documented thresholds
(low=4096, medium=8192, high=16384). thinkingBudget remains an advanced
explicit override that wins when set.

- Add EffortLow/Medium/High, threshold consts, ValidReasoningEffort,
  EffortThinkingBudget, and GenerationParams.ResolvedThinkingBudget.
- Anthropic: derive budget from effort, grow max_tokens above the budget
  (Anthropic requires budget < max_tokens), and force temperature=1 when
  thinking is enabled (both are Anthropic requirements).
- Validate reasoningEffort at config load so typos fail loudly instead
  of silently no-opping.
- theo: drop explicit thinkingBudget/inflated maxTokens; reasoningEffort
  high now implies the 16384 budget.
- Document thresholds and per-backend behavior in data/agents/README.md;
  fix stale autoLoad/maxSteps references.
- Add unit tests for the mapping and Anthropic thinking behavior.
2026-09-07 13:34:58 +02:00
Ollie Agent a9fe03eb71 agents: raise theo reasoning to high with thinking budget
Theo is a security auditor reasoning about injection, TOCTOU races,
crypto misuse, and confused-deputy problems — adversarial edge-case work
that needs deep deliberation, not the low effort it was set to. Bump to
reasoningEffort=high and add thinkingBudget=16384 so depth carries over
to Anthropic extended thinking. Raise maxTokens to 24576 so it stays
above the thinking budget (Anthropic requires budget < max_tokens).
2026-09-07 13:28:45 +02:00
Ollie Agent 6c7e5864c4 agents: set reasoningEffort per profile; rename thinkingBudget tag
Reasoning effort is part of an agent's behavior definition, so set it
on all 14 profiles keyed to role (planning/review high, general medium,
lightweight assist low). Also rename the ThinkingBudget json tag from
the confusing bare "reasoning" to "thinkingBudget", distinct from the
reasoningEffort string knob. No config migration needed — no profile or
backends.conf used the old "reasoning" key.
2026-09-07 13:27:33 +02:00
Ollie Agent 9395a0e07b config: rename agent autoLoad field to tools
The autoLoad name implied an automatic tool-loading path that no longer
exists; tools now come only from agent config plus the /tool_load ctl
command. Rename the AgentConfig.AutoLoad field (json autoLoad) to Tools
(json tools), rename LoadAutoLoadTools to LoadTools, and update all 14
agent JSON profiles and the tool-not-loaded error message.
2026-09-07 13:23:17 +02:00
Ollie Agent eff0880737 backend: test that no tools loaded omits tools field
Regression guard for tool-free model compatibility: an agent with an
empty tool set must produce requests with no "tools"/"tool_choice"
field. Covers OpenAI, OpenRouter, Ollama, and Anthropic.
2026-09-07 13:19:35 +02:00
Ollie Agent 86db9c797b agents: autoload all memory tools 2026-09-05 11:58:12 +02:00
Ollie Agent 2e30b0ddab fs: show OpenRouter cache pricing for selected models 2026-09-05 11:56:04 +02:00
Ollie Agent 3ca84487c5 toolsrv: neutralize repo-controlled core.fsmonitor in tool env
GitSpawn class (Sep 2026): a repo's .git/config can set core.fsmonitor to
a command that executes on any git index refresh, silently and as the
user. Ollie never spawns git in its own plumbing (repo detection is
os.Stat), but model-run git inside a malicious repo would fire it.

- exec: force core.fsmonitor=false via GIT_CONFIG_* in sandboxed tool env
- turn: wrap repo AGENTS.md in <context> markers (untrusted data,
  filtered by KDE chat rendering)
- AGENTS.md: document the no-git-in-plumbing invariant (lesson 16)
2026-09-05 11:42:38 +02:00
Levi Neely 989aa0400d o: fix tmux session name handling for dots
Session names like 'r7.20' caused 'duplicate session' errors because
tmux interprets dots as window.pane separators.

Fix: Use '=' prefix for exact match in all tmux -t arguments.
From tmux(1): 'If the session name is prefixed with an =, only an
exact match is accepted.'
2026-09-04 15:35:21 +02:00
Levi Neely b25b99be4d kde/gui: add Acme-style mouse chording to prompt input
Implement proper Plan 9/Acme mouse chording in the input area:
- B1 = select (TextArea default)
- B2 = execute selection as prompt
- B3 = plumb selection or context menu
- B1+B2 = cut (chord while selecting)
- B1+B3 = paste (chord while selecting)

Uses MouseArea overlay that detects when B1 is held while B2/B3
is pressed to trigger chord actions. Context menu items now show
the chord shortcuts (Cut B1+B2, Paste B1+B3).

Placeholder text shows the mouse action reference.
2026-09-04 14:23:58 +02:00
Levi Neely eb12627ea0 kde/gui: fix binding loop and Column anchor errors
- Remove chatPane property from delegate (was shadowing id, causing binding loop)
- Remove contentArea MouseArea from inside Column (invalid anchor)
- Simplify hovered property to use only headerArea
- Edit button now copies to clipboard instead of trying to access chatPane
2026-09-04 14:20:40 +02:00
Levi Neely 75a2da080e kde/gui: Acme-style mouse actions and one-handed workflow
Add Plan 9/Acme-inspired mouse interaction:
- B2 (middle-click): Execute selected text as prompt
- B3 (right-click): Plumb selection via plan9port, fallback to context menu

Plumber integration (plumber.h/cpp):
- Wraps plan9port's plumb command for context-aware actions
- Auto-detects plumb binary in common plan9port locations
- Graceful fallback when plumber not available

Block tag line (ChatBlockDelegate):
- Hover-visible action buttons: Copy, Retry, Continue, Edit
- Per-block-type actions (Retry for assistant/error, Edit for user)

Action toolbar (ChatPane):
- Stop, Compact, Copy Last, Templates dropdown
- Mouse-first workflow without keyboard shortcuts

Input area improvements:
- Larger touch targets (48px send button, 32px toggle)
- Clear and Paste buttons
- B2/B3 mouse actions in prompt input
- Placeholder text explains mouse actions

Context menus now include:
- Execute Selection (B2)
- Plumb Selection (B3)
- Standard Cut/Copy/Paste/Select All
2026-09-04 13:47:51 +02:00
Levi Neely 5f68871c65 kde/gui: render markdown tables in chat view
Add table rendering support to ChatBlockModel:
- isTableLine(): detect pipe-delimited table rows
- renderTable(): convert table lines to HTML <table>
- renderProse(): split prose into text/table segments
- incrementalAppend: handle table state transitions during streaming

Tables render with header row detection (before |---|---| separator)
and proper incremental updates as content streams in.
2026-09-04 13:28:06 +02:00
Levi Neely 065e399444 models: add pricing info with cache rates and static estimates
Add per-model pricing to /models output. Format:
  backend<tab>model[<tab>in<tab>out<tab>cache_read<tab>cache_write]

Pricing sources:
- Anthropic: hardcoded from official pricing, includes cache rates
- OpenRouter: parsed from API response pricing field
- Other backends: static lookup table fallback, marked with (e)

Changes:
- backend: Add ModelPricing/ModelInfo types, ModelLister interface,
  static price table (Claude, GPT, Gemini, DeepSeek), LookupStaticPricing()
- openai: Parse pricing from API, implement ModelsInfo()
- anthropic: Implement ModelsInfo() with hardcoded cache rates
- fs/cache: Use ModelsInfo when available, fall back to static lookup,
  format prices per 1M tokens with (e) suffix for estimates
- agent/cost: Use shared LookupStaticPricing instead of duplicate table
2026-09-04 13:26:48 +02:00
Levi Neely 307687542c gui: add submit button to prompt input
Add a ▶ button next to the text area for mouse-based submission.
Extract shared doSubmit() on the input RowLayout. Button uses
focusPolicy: Qt.NoFocus so it doesn't steal focus from the TextArea.
2026-08-28 13:40:14 +02:00
Levi Neely 9829498d57 gui: fix text selection in prompt box
Replace MouseArea overlay with TapHandler inside TextArea.
The MouseArea sat on top and intercepted left-button press events,
blocking click-and-drag text selection. TapHandler cooperates with
the TextArea's built-in selection handling.
2026-08-28 13:25:54 +02:00
Levi Neely 9307cc86de o: set tmux mouse option globally
Use -g instead of -t to apply mouse support to all tmux sessions.
2026-08-27 16:26:08 +02:00
Levi Neely 3a39041e26 o tui: drop tmux -CC, enable mouse support 2026-08-27 15:04:14 +02:00
Levi Neely a3dfbcefc1 o: strip ANSI escapes on dumb terminals
Detect TERM=dumb or non-tty stdout and use plain '> ' prompt
instead of bold ANSI escape sequences.
2026-08-27 14:46:18 +02:00
Levi Neely 765e8b9d05 add file-level doc comments and improve AGENTS.md navigation
Agent package files now have descriptive header comments explaining
their purpose:
- dispatch.go: tool execution, batching, conflict detection
- turn.go: turn orchestration and Submit entry point
- state.go: agent state machine and notifications
- history.go: message history and token tracking
- compact.go: context compaction and cold summarization
- cache.go: tool result caching with staleness detection
- retry.go: error tracking and transient retry logic
- runtime.go: preamble assembly and tool schema management
- text_parse.go: text-based tool call parsing
- chatlog.go: chat output formatting
- chat.go: chat log storage and streaming
- workflow.go: workflow classification for discovery
- skill_match.go: semantic skill discovery
- tool_match.go: semantic tool discovery
- commands.go: slash command interception
- feed.go: feed value storage with dedup
- fifo.go: buffered prompt queue
- peer.go: peer agent management
- subagent.go: sub-agent depth and child tracking
- cost.go: cost calculation and audit logging
- prompt_resolver.go: prompt file resolution
- local_summary.go: non-LLM text summarization
- agent_config.go: configuration types

AGENTS.md improvements:
- Add 'Where to Start' section with entry points by concern
- Expand Key Files table with cache, retry, text_parse, tool_match,
  skill_match, chatlog, local_summary, workflow, and proc files
2026-08-27 10:23:26 +02:00
Levi Neely 1159bd700a update AGENTS.md and architecture-core.md for agent package reorganization
AGENTS.md:
- Update Architecture section with detailed agent package file list
- Update Key Files table with new agent package files
- Add lesson 15: split by concern, not size

architecture-core.md:
- Update Package Map diagram with new files
- Add file responsibility table in Agent Loop section
- Reference compact.go in Session & Context section
2026-08-27 10:15:31 +02:00
Levi Neely c8ccc2c450 add CONTRIBUTING.md; document Agent struct fields
- CONTRIBUTING.md: development workflow, code style, testing, conventions
- agent.go: add comments to warnedContext, resultCache, chatLog, chatStart,
  chatVers, chatCond, chatSignalCh, plan
2026-08-27 10:13:24 +02:00
Levi Neely 785c27c450 extract compaction logic from history.go
compact.go (379 lines): compact(), buildCompactedHistory(), summarizeMessage(),
  flattenToolMessages(), cacheSummary(), pendingColdSummaryStats(), stripCold(),
  resolveCompactionModel()

history.go (636 → 279 lines): core History struct, message operations,
  usage tracking
2026-08-27 10:11:54 +02:00
Levi Neely 2ae41bdd29 decompose loop.go by concern
Extract from loop.go (902 → 308 lines):
- cache.go (109 lines): resultCache, cachedResult, file staleness detection
- dispatch.go (376 lines): execToolCalls, execBatch, execOne, conflict detection, background helpers
- retry.go (126 lines): errorState, trackErrors, transientWait, retryCountdown

loop.go now contains only the core loop: run(), autoCompact(), streamResponse()
2026-08-27 10:09:05 +02:00
Levi Neely 9b7de31a07 add doc.go files; decompose agent package
doc.go:
- agent, backend, session, fs, bypass, toolclient (olliesrv)
- server, sandbox, registry (toolsrv)
- protocol, metadata (toolsrv shared)
- log, util, skills

agent package decomposition:
- chat.go: chat log, streaming, plan methods
- state.go: State, Reply, WaitChange, SignalCh, emit
- peer.go: AddPeer, RemovePeer, Peers
- subagent.go: Depth, IncChildren, DecChildren, ActiveChildren
- agent.go: 881 → 638 lines (core struct, identity, backend, runtime)
2026-08-27 10:03:58 +02:00
Levi Neely fa219e06aa quirks: only reject shell calls with tools in command position
The old word-boundary check falsely triggered when tool names appeared
in arguments (e.g., git commit messages mentioning native tools).

New logic: split on shell separators and only flag when a tool is the
first token of a sub-command or a path ending with /toolname.
2026-08-26 14:00:21 +02:00
Levi Neely 89dd021a93 session: prevent duplicate sessions and agents
- CreateEmpty: atomic check-and-insert under write lock prevents TOCTOU race
- AddAgent: reject duplicate agent names, return error
- CreateAgentWithParams: propagate AddAgent error, close orphan on conflict
- persist: handle AddAgent errors during restore (log and skip)
2026-08-26 13:57:14 +02:00
Levi Neely 59c19cace9 acme-ollie-ensure: use PWD (acme sets it), tag fallback for HOME
Confirmed acme calls threadspawnd with window dir.
Added tag-based fallback when PWD is HOME (top-level window).
2026-08-24 15:29:55 +02:00
Levi Neely 53baa43203 acme-ollie-ensure: update session cwd on every invocation 2026-08-24 15:26:06 +02:00
Levi Neely 89db742a04 Redesign acme sessions: one session per project, not per agent
Model: acme-{hash} (session with project cwd) / assistant (agent)
- Git worktree aware (uses --show-toplevel)
- CWD set on session, not agent
- Agent always named 'assistant'
2026-08-24 15:23:24 +02:00