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:
adm committed 2026-11-25 02:06:45 +01:00
1 parent e29878bb3d
commit 8979201139
10 files changed
+994 -43

No files matched your search

+2
View File
@@ -5,6 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<meta name="color-scheme" content="dark light" />
<title>strata-ctl</title>
<link rel="icon" href="data:," />
<link rel="stylesheet" href="/assets/app.css" />
</head>
<body>
@@ -38,6 +39,7 @@
<footer id="composer">
<textarea id="input" rows="1" placeholder="Scrivi un messaggio…" autocomplete="off"></textarea>
<button id="agent-toggle" class="btn ghost" aria-pressed="false" title="Modalità agent: il modello usa shell_exec sull'host">&#129302;</button>
<button id="send" class="btn primary" aria-label="Invia">&#10148;</button>
</footer>
</main>