Commit Graph

1752 Commits

Author SHA1 Message Date
Levi Neely 063dc435c6 update kde submodule: clear active agent when killed 2026-08-03 17:51:23 +02:00
Levi Neely a6ab61cfed fix: session/idx includes sessions with zero agents
buildIndex was skipping sessions where Core != nil but Agents() was empty.
Now empty sessions appear in idx so the GUI can display them as tree nodes.
2026-08-03 17:48:47 +02:00
Levi Neely fa7abc9a99 fix: set Backend on Runtime when creating second agent in session
CreateAgent() was missing rt.Backend = be for the second agent path,
causing nil pointer dereference when /agent command accessed runtime.Backend.
2026-08-03 17:46:11 +02:00
Levi Neely 50b95f342e chore: update kde submodule (multi-agent handling fix) 2026-08-03 17:42:15 +02:00
Levi Neely e5ebf0550a test(toolsrv): add integration tests for RPC protocol
Comprehensive tests for the ollie-remote JSON-RPC 2.0 protocol:

Direct RPC dispatch tests:
- ping: liveness check returns 'pong'
- host_info: returns platform, arch, git repo status
- list_tools: empty list when no tools loaded
- set_env: environment variable injection with hook verification
- set_cwd: working directory updates
- set_allow_tools: tool restriction configuration
- is_parallel_read: parallel safety classification
- result_tier / result_tier_args: retention tier lookup
- detach: returns false when no process running
- list_detached: empty list initially
- signal_detached: error for nonexistent PID
- get_detached_output: error for nonexistent PID
- dismiss_detached: returns false for nonexistent PID
- tool call: error for unloaded tools
- invalid params: -32602 error code

Pipe-based client/server tests:
- Full roundtrip through toolsrv.Conn client
- Concurrent request handling (10 parallel pings)
- Context cancellation propagation
- Connection close detection

JSON-RPC protocol compliance:
- Table-driven tests for request/response format
- Error code verification (-32602 invalid params, -32000 server error)
2026-08-03 16:31:04 +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 b57bc003b2 chore: update kde submodule (chat rendering rewrite) 2026-08-03 16:16:51 +02:00
Levi Neely a56f9dfe73 chore: update kde submodule (syntax highlighting fix) 2026-08-03 16:07:52 +02:00
Levi Neely 6a32b3afce chore: update kde submodule (agent connection retry fix) 2026-08-03 16:03:07 +02:00
Levi Neely 2dc4098c09 fix(backend): strip tool blocks when no tools defined
Bedrock rejects requests containing toolUse/toolResult content blocks
without a corresponding toolConfig. When agents have zero tools loaded
(e.g., autoload disabled/failed), conversation history containing tool
interactions would cause 'toolConfig field must be defined' errors.

Add kiroStripToolBlocks() to remove tool-related content from messages
when len(tools) == 0, allowing requests to proceed without tool
definitions.
2026-08-03 15:58:29 +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 7189a9fc24 scripts: add 'o write' subcommand 2026-08-03 12:48:08 +02:00
Levi Neely 81e47c8513 fs: add error logging to Kill when session not found in map
Helps trace zombie sessions — if Kill is called with a key that
doesn't match the sessions map, we'll see it in the log.
2026-08-03 12:34:42 +02:00
Levi Neely 5795fe8864 kde: update submodule (fix stale stream spam) 2026-08-03 12:28:46 +02:00
Levi Neely fe2348c0cc toolsrv: add ProcessKeeper for resilient ollie-remote lifecycle
ProcessKeeper maintains a running ollie-remote process and respawns
it on failure. Multiple agents Dial() the same keeper to get
independent connections. If the process dies, the next Dial()
triggers a respawn (up to 3 attempts with backoff).

All session creation and restore paths now use ProcessKeeper.
Kill/Shutdown close the keeper (which closes the current process).
This fixes 'connection closed' errors persisting indefinitely
after ollie-remote crashes — the next tool call respawns it.
2026-08-03 12:21:54 +02:00
Levi Neely c11d513202 kde: update submodule (no-retry agent connections) 2026-08-03 11:33:46 +02:00
Levi Neely ce53f57e4c kde: update submodule (agent disconnect fix) 2026-08-03 11:31:14 +02:00
Levi Neely 256d5177d1 ollie-remote: call env.EnsureDefaults, keep OLLIE_SESSION_ID/OLLIE_UNAME current
- Load ~/.config/ollie/env and set path defaults at startup (same as olliesrv)
- Remove hard exit on missing OLLIE_SESSION_ID; accept it from inherited env
  or via set_env RPC (SSH bootstrap path)
- Wire OnEnvSet to propagate OLLIE_SESSION_ID into tool registry and process
  env when it arrives dynamically; same for OLLIE_UNAME
2026-08-03 11:27:04 +02:00
Levi Neely 8bb4246cde prompts: document tool discovery in session-9p.md
- Global catalog: read /tools
- Loaded tools: read agent/tools
- Load a tool: write tool name to agent/tools
- Added tools to agent directory file table
2026-08-03 11:26:37 +02:00
Levi Neely 8aff88d0a1 ollie-remote: use OLLIE_SESSION_ID for elevate broker identity
ollie-remote was sending 'agent-<pid>' as the session identity to the
elevate broker, which never matches any real session. Now reads
OLLIE_SESSION_ID from inherited environment (set by the parent
olliesrv process) so the broker can validate the session exists.
2026-08-03 11:06:17 +02:00
Levi Neely 45f76c3e01 fs: fix elevate broker session lookup by immutable ID
Lookup() was keyed only by display name, but the elevate broker
passes OLLIE_SESSION_ID (the immutable UUID). Added fallback to
search by sess.id when the name-based lookup misses.

This fixes 'elevate-broker: denied (session not found)' for all
elevated commands.
2026-08-03 11:01:01 +02:00
Levi Neely 40fcae493e kde: update submodule (kate plugin disabled) 2026-08-03 10:59:07 +02:00
Levi Neely d71e3eb8e4 fs: set agent dir UID to agent ID, GID to 'agent'
Agent directories now have proper ownership: UID is the agent's
immutable 12-char hex identity, GID is 'agent'. Consistent with
session directories which use UID(s.Uname()).
2026-08-03 10:56:20 +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
Levi Neely 0a24326c7e update kde submodule: remove dead createSession 2026-08-03 10:43:16 +02:00
Levi Neely 9af47864ac update kde submodule: error handling in new agent dialog 2026-08-03 10:41:38 +02:00
Levi Neely 911733bd8a fs: add agent-level kill, remove activeAgentID from session
Add 'kill' command to agent ctl (removes agent from session).
Add Session.RemoveAgent() method.
Remove activeAgentID field, Agent(), SetActiveAgent, and dead
WaitChange — 'active agent' is a GUI concept, not a server one.
All callers updated to iterate Agents() or use FindAgent(id).
2026-08-03 10:37:29 +02:00
Levi Neely 3f1e8bfd8b toolsrv: use ToolsPath() for local ollie-remote bootstrap
Remove hardcoded ~/.config/ollie/tools path and XXX hack.
Local ollie-remote now inherits OLLIE_TOOLS_PATH from the environment
via os.Environ(), same as remote bootstrap sets it explicitly.

ToolsPath() reads OLLIE_TOOLS_PATH with fallback to ~/.config/ollie/tools.
Tools added to the directory are picked up immediately on next
tool_load — no restart needed.

Removed dead appendEnvVar helper.
2026-08-03 10:17:58 +02:00
Levi Neely 8f09aa2060 scripts: enable readline in prompt REPL (read -e)
Supports C-a, C-e, C-u, C-k, M-b, M-f, arrow keys, etc.
Sent prompts and slash commands are added to readline history
so up-arrow recalls previous inputs.
2026-08-03 10:09:32 +02:00
Levi Neely 62cfc06a88 scripts: rename blkread → readloop 2026-08-03 10:07:54 +02:00
Levi Neely e726599f84 scripts: add 'o blkread' — blocking read loop for statewait et al 2026-08-03 10:07:10 +02:00
Levi Neely 9c75c1b9aa scripts: fix tui shell cwd to $HOME (fixes .bashrc not found) 2026-08-03 10:04:56 +02:00
Levi Neely d693bd8071 scripts: add 'o tui exit' to kill tmux session 2026-08-03 10:03:47 +02:00
Levi Neely 89c2c41679 doc: update architecture diagram frontend label to 'o' 2026-08-03 10:00:11 +02:00
Levi Neely d8cca00fd0 doc: add o CLI and o tui documentation to USAGE.md 2026-08-03 09:58:42 +02:00
Levi Neely 30621d2ed9 scripts: add 'o kill', slash commands in prompt REPL
o kill: kills the active session.

Prompt REPL now supports slash commands:
  /stop, /compact, /kill, /clear, /model X, /backend X, /cwd X, /help

Slash commands are handled locally without sending to the agent.
2026-08-03 09:56:34 +02:00
Levi Neely ae556a2a3a scripts: add 'o tui' tmux layout and 'o stop' shorthand
o tui: launches a 4-pane tmux layout with:
  - chat stream (left, large)
  - statewait monitor (top-right, reactive)
  - spare shell with session/agent exported (bottom-right)
  - prompt REPL (bottom, full width)

o stop: shorthand for 'o ctl stop' to interrupt a running agent.
2026-08-03 09:55:06 +02:00
Levi Neely 338358fbf3 scripts: replace individual scripts with unified 'o' dispatcher
Single multi-call script with subcommands: read, ls, ctl, prompt,
tail, env. Replaces prompt, ollieread, sendctl, ollie-ls.

Features:
- Env var fallback chain: OLLIE_SESSION_ID → session → positional arg
- Auto-selects first session/agent when none specified
- Multi-line prompt mode (blank line sends)
- Uses immutable IDs in 9P paths (works with alias resolution)
- eval-able 'o env' for shell integration
2026-08-03 09:49:45 +02:00
Levi Neely 44f173214d fs: add Aliases to FsNodeDecl for immutable ID path resolution
Nodes in the 9P namespace can now declare alternate names (Aliases)
that resolve during Twalk but are invisible in directory listings.
Session dirs alias their immutable RunnableID(), agent dirs alias
their ID(). Clients can use session/{uuid}/agent/{uuid}/... paths
that remain valid across renames.

Changes:
- fs/fsnode.go: Add Aliases []string field, Alias() NodeOption
- fs/builder.go: findChild checks aliases via matchAlias helper
- fs/sessionfiles.go: Session dirs get Alias(s.RunnableID())
- fs/agentfiles.go: Agent dirs get Alias(a.ID())
- fs/spec.go: Add /aliases file (read-only alias→path table)
- fs/rootfiles.go: readAliases handler
- fs/lifecycle.go: buildIndex includes immutable ID in session/idx
- doc/edsl.md: Document Aliases field and behavior
- prompts: Update session/idx format documentation

The KDE GUI submodule now uses immutable IDs in all 9P paths,
fixing disconnected indicators after session rename.
2026-08-03 09:41:26 +02:00
Levi Neely f83b1f0f89 olliesrv: fix double-fire on Request files opened ORDWR
For Request-mode files (session/new, complete, generate, route), the
write handler fires immediately during Twrite. On clunk, the server
was also flushing the (empty) writeBuf to Write(), causing the handler
to fire a second time. This created duplicate sessions.

Skip the clunk-time writeBuf flush for Request-mode files since they
already handle writes inline during Twrite.
2026-08-03 09:20:49 +02:00
Levi Neely 5f1a9a6eab update kde submodule: separate session/agent creation, agent context menu 2026-08-03 09:16:11 +02:00
Levi Neely c17d1d4f7b update kde submodule: fix session kill + path resolution 2026-08-03 09:09:57 +02:00
Levi Neely a3f44bb565 AGENTS.md: add prominent warning to work in source dir, not install targets 2026-08-03 09:05:21 +02:00
Levi Neely 8e2c0a3929 update kde submodule (KF5 GUI parity) 2026-08-03 09:03:19 +02:00
Levi Neely 4094c95587 more qol utils 2026-08-03 08:57:52 +02:00
Ollie Agent 56527598d6 utils for terminal interface 2026-08-03 07:43:50 +02:00
Ollie Agent 261f987c5e move current SLOC table to end of EVOLUTION.md 2026-08-03 01:46:13 +02:00
Ollie Agent fce1e4b4fc restore old SLOC table, add current SLOC table alongside 2026-08-03 01:44:06 +02:00