Files
strata-ctl/web/index.html
T
adm 8979201139 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.
2026-11-25 02:06:45 +01:00

59 lines
2.2 KiB
HTML

<!DOCTYPE html>
<html lang="it">
<head>
<meta charset="utf-8" />
<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>
<div id="app">
<!-- Session drawer (off-canvas on mobile, sidebar on wide screens) -->
<aside id="drawer" aria-label="Sessioni">
<div class="drawer-head">
<span class="brand">strata&#8209;ctl</span>
<button id="new-session" class="btn primary" title="Nuova conversazione">+ Nuova</button>
</div>
<ul id="session-list"></ul>
<div class="drawer-foot">
<button id="show-stats" class="btn ghost">Statistiche</button>
</div>
</aside>
<div id="splitter" role="separator" aria-orientation="vertical" aria-label="Ridimensiona l'elenco delle discussioni" aria-valuemin="200" aria-valuemax="480" aria-valuenow="280" tabindex="0"></div>
<div id="scrim" hidden></div>
<!-- Main column -->
<main id="main">
<header id="topbar">
<button id="menu" class="btn icon" aria-label="Apri sessioni">&#9776;</button>
<div class="title-wrap">
<span id="session-title">Conversazione</span>
<span id="model-name" class="muted"></span>
</div>
<button id="delete-session" class="btn icon danger" aria-label="Elimina sessione">&#128465;</button>
</header>
<section id="transcript" aria-live="polite"></section>
<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>
</div>
<!-- Stats modal -->
<div id="stats-modal" hidden>
<div class="modal-card">
<h2>Statistiche</h2>
<dl id="stats-body"></dl>
<button id="close-stats" class="btn">Chiudi</button>
</div>
</div>
<script type="module" src="/assets/app.js"></script>
</body>
</html>