Commit Graph

83 Commits

Author SHA1 Message Date
Levi Neely bc5f45854e scripts/o: tui reads filtered log instead of log.raw 2026-10-09 18:57:44 +02:00
Levi Neely 57c40d541e Migrate chat log to JSONL format
Server changes:
- format/block.go: Block struct with JSONL marshaling, RenderBlock for text
- Deleted format/event.go, format.go, format_test.go (old delimiter format)
- agent/chat.go: Dual logs (rawLog JSONL + textLog rendered text)
- agent/chatlog.go: Streaming via flushPartial/closeBlock, skip internal events
- fs/spec.go: New files log.raw (JSONL), log (text), block (ID lookup)
- Removed chat/chat.raw/chat.search from namespace

GUI changes:
- chatblockmodel: JSONL parsing via QJsonDocument, removed regex state machine
- ollie9pclient: Read from log.raw for replay, removed old streaming code
- Added Context type to block enum, filter context/state/usage from display

Docs updated: AGENTS.md, system_prompt.md, architecture-*.md, scripts/o
2026-10-09 18:52:40 +02:00
Levi Neely 8793202ef5 o: fix bypass agent filter to use agent ID instead of name
OLLIE_UNAME in bypass requests is the agent ID, not name.
Look up agent ID from idx before filtering.
2026-10-09 13:05:38 +02:00
Levi Neely 9fb150b6fe o: add !a !d !b shortcuts in prompt for bypass management
!a or !approve - approve first pending bypass for this agent
!d or !deny    - deny first pending bypass for this agent
!b or !bypass  - list pending bypass requests for this agent
2026-10-09 13:02:39 +02:00
Levi Neely 859bb4910f o: filter bypass/approve/deny by agent when agent context is set
o session/agent bypass   - shows only that agent's requests
o session/agent approve  - approves first request from that agent
o session/agent deny     - denies first request from that agent
o session bypass         - shows all requests (unchanged)
2026-10-09 13:01:36 +02:00
Levi Neely 2c8b301a59 o: handle expired bypass requests gracefully in approve/deny 2026-10-09 12:58:26 +02:00
Levi Neely 1663d2d212 o: fix approve/deny to handle array of pending requests 2026-10-09 12:56:34 +02:00
Levi Neely 995db45444 o: fix bypass command to handle array of pending requests 2026-10-09 12:54:39 +02:00
Levi Neely b5138fd55e o: fix tui event subscription - use IDs not names
Event topics use session/agent IDs, not names. Look up IDs from
the idx files before subscribing to state events.
2026-10-09 12:47:29 +02:00
Levi Neely f490d4eef2 o: add delays before tmux send-keys
Shell needs time to initialize before receiving commands.
2026-10-09 12:38:12 +02:00
Levi Neely 8c7a3bf83b o: simplify tui commands - remove grep filters
The shell escaping for grep patterns was complex and fragile.
Removed the cosmetic filters for [[[...]]] and backticks.
2026-10-09 12:35:33 +02:00
Levi Neely 9f69654d0c o: use slash separator in tui spawned commands
Slash is primary separator. Agent names may contain colons but
session names don't contain slashes, so slash is unambiguous.
2026-10-09 12:30:08 +02:00
Levi Neely 1d688d9944 o: sanitize agent name for tmux session too
Agent names like src:ollie need colon replaced with dash.
2026-10-09 12:29:14 +02:00
Levi Neely 9b063a24ce o: fix context parsing - slash is primary separator
Agent names may contain colons (e.g., src:ollie), so slash must
be the primary separator. Colon separator is only for the rare
case where session names contain slashes.

default/src:ollie now correctly parses as:
  session = default
  agent = src:ollie
2026-10-09 12:28:02 +02:00
Levi Neely aa939b0f84 o: fix tmux session targeting in tui command
Remove = prefix from tmux -t arguments - it doesn't work with
pane specifiers (:0.1). Also changed -g to -t for mouse option.
2026-10-09 12:24:35 +02:00
Levi Neely c30c75cea9 o: fix tui with session names containing slashes
- Sanitize tmux session name (replace / and : with -)
- Include agent name in tmux session for uniqueness
- Quote context arg in spawned o commands
- Use colon separator for robustness
2026-10-09 12:23:08 +02:00
Levi Neely e1d01716f3 o: support colon separator and quoted names in context arg
- session:agent works as alternative to session/agent
- Colon takes precedence (allows slashes in session names)
- Quoted arguments with spaces now work: o "my session:agent" prompt
- Removed set -- $* which broke quoted arguments
- Updated help with examples
2026-10-09 12:21:20 +02:00
Levi Neely d8b24ae26d o: add bypass command to inspect pending request
o sess bypass - shows id, agent, cwd, cmd without resolving

Workflow: bypass -> review -> approve/deny
2026-10-06 14:58:22 +02:00
Levi Neely 7b6ddc1b1a o: accept optional request id for approve/deny
o sess approve [id]  - approve pending, optionally verify id
o sess deny [id]     - deny pending, optionally verify id

Shows request id in output: [42] approving: cmd
Errors if specified id doesn't match pending request.
2026-10-06 14:57:21 +02:00
Levi Neely b440622441 o: add approve/deny commands for bypass requests
Works at session or agent context (bypass is session-level).
Reads pending request from session/{s}/bypass, extracts ID,
writes '{id} approve' or '{id} deny' to resolve.
2026-10-06 14:52:07 +02:00
Levi Neely 9d0b59671c o: use filtered event stream instead of statewait loop
Subscribe to agent-specific state events via streaming rdwr pattern.
No more polling loop - single filtered subscription.
2026-10-06 12:39:25 +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 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
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 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 cd9da5ed27 quirks: reject shell calls to native tools
- Add quirks package for stupid model behavior workarounds
- ShellInvokesNativeTool blocks shell(cmd="tool_name") patterns
- Add client_9p tool: native wrapper for ollie-9p operations
- Block ollie-9p in shell — use client_9p instead
- Update all prompts to use client_9p, not shell+ollie-9p
- Clarify 9P namespace is complete (tools are NOT in 9P)
- Registry.All() lists all available tools for validation
2026-08-20 14:08:53 +02:00
Levi Neely e662d32c61 o: simplify new — only accept sname/aname syntax 2026-08-13 09:30:01 +02:00
Levi Neely 6465861908 o: accept sname/aname syntax for new command 2026-08-13 09:29:00 +02:00
Levi Neely 05770ee28b o: re-split args to handle quoted invocations from acme 2026-08-13 09:24:52 +02:00
Levi Neely 37608ab9b6 o new: ignore 'session already exists' error 2026-08-13 09:22:18 +02:00
Levi Neely bbf8176cc8 o new: use sname/aname syntax to create session+agent 2026-08-13 09:19:34 +02:00
Levi Neely 6c26f15840 o: support root-relative paths with leading /
Paths starting with / are treated as root-relative, ignoring
the current context prefix. This allows accessing root-level
files/directories even when in a session or agent context.

Example: o myproj/coding ls /bypass  # list root bypass/ dir
2026-08-10 13:47:10 +02:00
Levi Neely d621e7322a o: use session/agent slash syntax for context
Simplify context parsing:
- o <cmd>                   Root level
- o <session> <cmd>         Session level
- o <session>/<agent> <cmd> Agent level

The slash disambiguates between session and agent context,
eliminating the need for 'session' and 'agent' keywords.

Examples:
  o myproj ls               # session level
  o myproj/coding prompt    # agent level
2026-08-10 13:40:26 +02:00
Levi Neely 14a52236c8 o: hierarchical context selectors
Refactor o CLI to use explicit context selectors:
- o <cmd>                       Root level
- o session <sname> <cmd>       Session level
- o agent <sname> <aname> <cmd> Agent level

Environment variables $session and $agent can substitute for
positional args for backwards compatibility.

Update acme scripts to use new interface:
  o agent $OLLIE_SESSION $OLLIE_AGENT prompt
2026-08-10 13:37:29 +02:00
Levi Neely 46524d37dd kiro: wire session CWD through to EnvState; o: add new command
- backend: add CWD field to GenerationParams for environment state
- kiro: pass session CWD to kiroCurrentEnvState instead of hardcoded '/'
- agent/runtime: set GenParams.CWD from session cwd in BuildRuntime
- o new: create sessions and agents via 9P filesystem
- o prompt: support piped stdin for non-interactive use
2026-08-10 09:10:13 +02:00
Ollie Agent 25924d0909 fs: add /help ctl command — returns command reference 2026-08-09 03:32:21 +02:00
Ollie Agent cbfc08875b fs: unify ctl — all levels use rdwrHandler + rdwrDispatch
Root, session, and agent ctl files all share the same dispatch
mechanism: rdwrHandler map → rdwrDispatch → Request (rdwr).

- ctlHandler/ctlDispatch (write-only) removed
- Root and session ctl upgraded to Request (rdwr), return 'ok'
- systemprompt moved to agent ctl command
- nopRead removed (dead)
2026-08-09 02:58:09 +02:00
Ollie Agent 993d5a812a fs: move tools to ctl commands, remove tools file
/tools        — lists loaded tools
/tool_load X  — loads a tool by name

System prompt updated to instruct the agent to use ctl for tool
management instead of writing to a tools file.
2026-08-09 02:52:06 +02:00
Ollie Agent 94088ccc94 fs: move cwd to ctl command, remove cwd file
/cwd returns current directory, /cwd X changes it (with stat check).
One fewer file in the agent namespace.
2026-08-09 02:48:50 +02:00
Ollie Agent 2561e01574 fs: move per-agent models to ctl command, remove models file
/models now lists available models for the agent's backend via ctl.
One fewer file in the agent namespace. The root-level models file
(all backends) remains unchanged.
2026-08-09 02:47:26 +02:00
Ollie Agent c05f4d1ef0 fs: agent ctl becomes rdwr (request-response)
The ctl file is now a Request handler: write a command, read the
response. Commands with no args return current state:

  /model        → prints current model
  /agent        → prints current profile
  /cwd          → prints working directory
  /name         → prints agent name
  /model X      → switches model, returns new model
  /compact      → compacts, returns 'ok'

o ctl now uses 'ollie-9p rdwr' to get the response.
This enables /model (no args) to show the current model from
any frontend.
2026-08-09 02:44:21 +02:00
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 c7aea0db59 rename elevate→bypass throughout
The sandbox escape mechanism is a bypass, not privilege elevation.
The old name caused the agent to confuse it with sudo.

- elevate/ → bypass/ (package, types, tests)
- elevate_notify.go → bypass_notify.go
- Namespace: /elevate → /bypass, session/*/elevate → session/*/bypass
- Tool arg: "elevated" → "bypass"
- Env: OLLIE_ELEVATE_SOCKET → OLLIE_BYPASS_SOCKET
- File: elevate-policy.yaml → bypass-policy.yaml
- All docs, prompts, and scripts updated
2026-08-09 02:22:39 +02:00
Ollie Agent d1907adfae o script: audit cleanup
- Merge readloop into read -l (loop mode)
- Remove chatstream command (TUI uses 'o read chat' directly)
- Rework ctl: o ctl <cmd> [session] [agent] — dispatches to
  session ctl for kill/pause/resume, agent ctl for the rest
- Add trap EXIT to kill background statewait loop (fixes zombie)
- Remove -1 compatibility flag from generate
- Remove no-op bracketed paste bind from prompt REPL
- Fix /i help text: 'inject prompt (mid-turn or queued)'
- Update all help text to reflect current commands
2026-08-09 02:15:48 +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 72db6d900d fs: namespace cleanup — merge and remove dead files
- fifo.in + fifo.out → single fifo (write enqueues, read dequeues)
- cost + usage + ctxsz → single stats (key=value lines)
- Remove connection (no consumers, heartbeat handles it)
- Remove dead prevPrompt field and write (prompt.prev gone from spec)
- Clean AGENT_FILES: remove state, context, tail (all already absent
  from spec, were only in the tab-completion list)
2026-08-09 01:57:41 +02:00
Ollie Agent 744f775eb5 fs: split chat into chat (filtered text) and chat.raw (full markup)
chat — strips [[[...]]] markers and source fences at the byte level.
Partial lines pass through immediately for true streaming. Terminals
and text editors use this.

chat.raw — full block-structured stream with markers and fences.
GUIs that parse blocks (KDE, web) use this.

The TUI no longer pipes through grep (which was line-buffering and
killing char-by-char streaming since Aug 4).

The stripMarkers state machine processes each chunk from the server:
- Complete lines starting with [[[ and ending with ]]] → dropped
- Fence lines (```...) → dropped (open toggles in-fence state)
- Partial lines (no trailing \n) → always emitted immediately
- Everything else → passed through
2026-08-09 01:43:39 +02:00