Add GUI agent mode: the model acts via a universal shell_exec tool
- agent:🐚 native shell_exec (bash -lc, cwd, timeout, 64 KiB output cap)
behind a ShellRunner seam — base/host mode now; an isolated Docker-MCP runner
plugs in later without touching the loop. OpenAI function declaration included.
- agent::run_loop: bounded model<->tool orchestration, generic over the model
step so it is unit-testable without the engine. Persists the full trajectory
(assistant tool-call turns + role:tool results + final answer) and emits
tool_call / tool_result / final / error progress events.
- api::sessions: POST .../chat with agent:true drives the loop and streams the
events as SSE; the GUI shows commands + output inline (observability, no gate).
- store: messages gains tool_call_id; an idempotent migration adds the column to
pre-existing databases (CREATE TABLE IF NOT EXISTS does not alter them).
- web: robot agent toggle, tool-call/output blocks, history rendering of tool
turns; inline favicon to silence the favicon 404.
Validated LIVE on engine 0.1.67: the model called shell_exec('uname -a'), the
host executed it, and the model reported the output; trajectory persisted; GUI
verified by browser (toggle, tool block, output, final answer). 106 tests +
2 ignored green, clippy/fmt clean. Isolated mode (user-provided Docker container)
is the next step.
This commit is contained in:
1 parent
e29878bb3d
commit
8979201139
10 files changed
+994
-43
No files matched your search
@@ -138,6 +138,21 @@ details.thinking .reasoning {
|
||||
}
|
||||
.usage { color: var(--muted); font-size: 0.72rem; margin-top: 6px; }
|
||||
|
||||
/* ---- Agent tool blocks ---- */
|
||||
.msg.tool .bubble {
|
||||
background: var(--panel-2); border: 1px solid var(--border);
|
||||
border-radius: var(--radius); padding: 10px 14px; width: 100%;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
}
|
||||
.tool-cmd { display: block; white-space: pre-wrap; word-wrap: break-word; font-size: 0.9rem; }
|
||||
.tool-out {
|
||||
margin: 8px 0 0; max-height: 300px; overflow: auto;
|
||||
white-space: pre-wrap; word-wrap: break-word; color: var(--muted);
|
||||
font-size: 0.82rem; background: var(--bg); border-radius: 8px; padding: 8px;
|
||||
}
|
||||
.tool-out:empty { display: none; }
|
||||
#agent-toggle.active { background: var(--accent); border-color: var(--accent); color: #fff; }
|
||||
|
||||
/* ---- Composer ---- */
|
||||
#composer {
|
||||
display: flex; gap: 8px; align-items: flex-end;
|
||||
|
||||
Reference in new issue
Block a user