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
@@ -110,6 +110,27 @@ indexes) or complemented by another DBMS for advanced analytics later, without
|
||||
touching the API or the GUI. This is the foundation for multi-session, statistics and
|
||||
advanced settings to grow on top.
|
||||
|
||||
## Agent mode
|
||||
|
||||
The GUI model can **act**, not just chat. Toggle the 🤖 button and the model runs as
|
||||
an agent with a single universal tool, **`shell_exec`** (a shell is universal: file
|
||||
ops, programs, system inspection, web via curl, git, …). A bounded server-side loop
|
||||
drives `model → shell_exec → result → model → … → final answer`, persisting the whole
|
||||
trajectory and streaming progress events (`tool_call` / `tool_result` / `final`) so
|
||||
the GUI shows every command and its output inline — **observability without a
|
||||
confirmation gate**.
|
||||
|
||||
Two operating modes are planned, separated by the *environment* rather than per-call
|
||||
approval:
|
||||
|
||||
- **Base / host mode** (implemented): `shell_exec` runs directly on the host via
|
||||
`bash -lc` (with `cwd`, a timeout and an output cap). This is a trusted machine;
|
||||
the agent has the same freedom you would give a local operator.
|
||||
- **Isolated mode** (planned): the same tool routes to a sandboxed runner — the
|
||||
team's Docker-container MCP server. The user supplies the container; provisioning
|
||||
is on them. Execution sits behind a `ShellRunner` trait, so the isolated runner
|
||||
plugs in without touching the agent loop.
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
@@ -159,17 +180,19 @@ unknown keys never break startup.
|
||||
|
||||
## Status
|
||||
|
||||
Working and tested (94 tests, plus 2 real-file tests run on demand). Text, images,
|
||||
the full client-side tool loop, the Anthropic endpoint and the web GUI (session
|
||||
context, streaming, stats) have been validated live against the real Inkling engine.
|
||||
Working and tested (106 tests, plus 2 real-file tests run on demand). Text, images,
|
||||
the full client-side tool loop, the Anthropic endpoint, the web GUI (session
|
||||
context, streaming, stats) and **agent mode** (the model using `shell_exec` on the
|
||||
host) have been validated live against the real Inkling engine.
|
||||
|
||||
Not yet implemented (honest gaps): forced `tool_choice` (`required` / named function
|
||||
returns a clear 400), multi-slot batching, logprobs / structured output, automatic
|
||||
engine restart after a crash, a full SSRF guard against DNS rebinding, and the
|
||||
OpenAI Responses native endpoint. The Anthropic adapter covers the core cases but
|
||||
not yet the `defer_loading` / `tool_addition` / `tool_reference` tool machinery, the
|
||||
thinking `budget_tokens` mapping, or prompt-cache token accounting. The GUI is
|
||||
text-chat first: images, tools and advanced settings in the GUI are still to come.
|
||||
thinking `budget_tokens` mapping, or prompt-cache token accounting. The GUI agent's
|
||||
**isolated mode** (Docker-container runner) and GUI images / advanced settings are
|
||||
still to come; base/host agent mode works.
|
||||
|
||||
## License and credits
|
||||
|
||||
|
||||
Reference in new issue
Block a user