refactor: use a single agent model path

This commit is contained in:
wuyang
2026-07-26 18:50:51 +08:00
parent 2e8e81c790
commit d95d06233f
23 changed files with 330 additions and 454 deletions
+15 -27
View File
@@ -1,25 +1,12 @@
# Architecture
## Product modes
## Single Agent path
Chat and Work share the same authenticated user, conversation history, and
workspace, but not the same Agent loop.
Open WebUI owns authenticated users, conversation history, and rendering.
Every normal model request is delegated to the K1412 Runtime. There is no
second Chat loop and no per-conversation mode state.
| Concern | Chat | Work |
| --- | --- | --- |
| Primary purpose | Fast conversation | Multi-step deliverables |
| Loop owner | Open WebUI native loop | K1412 Agent Runtime |
| Tools | Workspace Gateway through OpenAPI | Workspace Gateway through Runtime |
| Visible history | Open WebUI | Open WebUI |
| Run events | Open WebUI | Runtime event store |
| Context and memory | Open WebUI defaults are disabled by policy | Runtime policy and store |
| Workspace files | Authenticated K1412 file browser | Same file browser and volume |
Selecting Work atomically upgrades `(user_id, chat_id)` in the Runtime store.
Subsequent Chat requests for that conversation are rejected even if a client
tries to bypass the disabled UI control.
## Work loop
## Agent loop
The first strategy is intentionally modular:
@@ -27,21 +14,22 @@ The first strategy is intentionally modular:
- `ContextPolicy` owns visible-message cleanup and compaction.
- `ToolRegistry` owns tool schemas and dispatch.
- `AgentLoop` owns iteration, safe parallel scheduling, and delegation.
- `RuntimeStore` owns modes, events, plans, and durable Work memory.
- `RuntimeStore` owns events, plans, and durable Agent memory.
- `ExecutionProvider` owns local or SSH Docker execution.
Every run records its model tier, strategy version, scheduler version, context
Every run records its model ID, strategy version, scheduler version, context
policy, model/tool events, failures, and completion. This event stream is the
foundation for replay, evaluation, and future experiment assignment.
The light, medium, and high tiers use the internal K1412 model endpoint. The
extreme tier uses DeepSeek V4 Pro with thinking enabled and maximum reasoning
effort. Provider selection and credentials remain server-side. Thinking state
is preserved across tool turns because DeepSeek requires the assistant's
`reasoning_content` to be returned with the following tool results; Work never
publishes that hidden state as its own user-facing reasoning.
Luna, Terra, and Sol are three independent Ollama models. Each advertises
boolean thinking support, but none advertises adjustable reasoning effort.
DeepSeek V4 Pro is a fourth model configured with thinking enabled and maximum
reasoning effort. Provider selection and credentials remain server-side.
Thinking state is preserved across tool turns when the provider requires the
assistant's `reasoning_content` to be returned with following tool results.
The Agent never publishes hidden reasoning as its own user-facing output.
Work completion is evidence-gated. Requests for scripts, reports, code, or
Completion is evidence-gated. Requests for scripts, reports, code, or
other concrete artifacts are not accepted as complete until a file mutation
has succeeded and a later read, diff, or command has verified the latest
mutation. Bare interactive shell commands are rejected. If the iteration