Previously, current_step_chat_history was cleared unconditionally on
resume, causing the agent to lose context and re-run the step from
scratch after approval. Now only clear when advancing to a new step.
When a user approves a wait_for_approval step, resume execution from that
step instead of calling process_feedback which may trigger revise_plan
and restart from step 1. Also check state snapshot for WaitingApproval
steps to handle pod restart scenarios where DB status may already be
'executing' but state still has the waiting step.
Templates can now include a `setup` file that runs in the workdir
before agent execution starts. Used for workspace initialization
like pulling tool binaries or installing dependencies.
ExternalToolManager.discover() now accepts template root dir, detects
pyproject.toml and runs `uv sync` to create a venv. Tool invocation and
schema discovery inject the venv PATH/VIRTUAL_ENV so template tools can
import declared dependencies without manual installation.
- Add Artifact type to Step (name, path, artifact_type, description)
- step_done tool accepts optional artifacts parameter
- Save artifacts to step_artifacts DB table
- Display artifacts in frontend PlanSection (tag style)
- Show artifacts in step context for sub-agents and coordinator
- Add LLM client retry with exponential backoff
- New WsMessage::ActivityUpdate for live status broadcasting
- Shows current activity at bottom of log: LLM calls, tool execution, user approval
- Activity bar with spinner, auto-clears on workflow completion
- Status badge with pulse animation in log header
Main loop becomes a coordinator that reviews step summaries and may
revise the plan. Each step gets its own chat history and scratchpad,
preventing context pollution across steps.
- Add run_step_loop with 50-iteration limit and isolated context
- Replace advance_step with step_done (sub-loop only)
- Add coordinator review after each step completion
- Add scratchpad 8K capacity check
- Add 33 unit tests for state, tools, and message building
Full-screen file browser with breadcrumb navigation, directory listing,
file upload/download/delete. Accessible via Settings → Object Storage.
Also adds settings menu with app title editing and KB/obj mode switching.
Routes now live at /tori/api, /ws/tori, and static files at /tori/.
Root / redirects to /tori/. Object storage mounted at /api/obj.
Dev proxy updated accordingly.
Install httpx, fastapi, uvicorn, requests, flask, pydantic, numpy, pandas,
matplotlib, pillow, jinja2, pyyaml and more on workspace creation. Also
pre-warm uv cache in Dockerfile so first project setup is near-instant.
uv's global cache (~/.cache/uv/) is shared across all project venvs.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add llm_call_log table and per-call timing/token tracking in agent loop
- New GET /workflows/{id}/plan endpoint to restore plan from snapshots on page load
- New GET /workflows/{id}/llm-calls endpoint + WS LlmCallLog broadcast
- Parse Usage from LLM API response (prompt_tokens, completion_tokens)
- Detailed mode toggle in execution log showing LLM call cards with phase/tokens/latency
- Quote-to-feedback: hover quote buttons on plan steps and log entries, multi-quote chips in comment input
- Requirement input: larger textarea, multi-line display with pre-wrap and scroll
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add state.rs with AgentState/Step/StepStatus/AgentPhase as single source of truth
- Extract prompts to markdown files loaded via include_str!
- Replace plan_steps table with execution_log + agent_state_snapshots
- Implement user feedback processing with docker-build-cache plan diff:
load snapshot → LLM revise_plan → diff (title, description) → invalidate from first mismatch → resume
- run_agent_loop accepts optional initial_state for mid-execution resume
- Broadcast plan step status (done/running/pending) to frontend on step transitions
- Rewrite frontend types/components to match new API (ExecutionLogEntry, PlanStepInfo with status)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add webapp template (FastAPI + SQLite) with INSTRUCTIONS.md and setup.sh
- select_template() scans templates, asks LLM to match; apply_template() copies to workspace
- ensure_workspace() runs setup.sh if present, otherwise falls back to default venv
- INSTRUCTIONS.md injected into planning and execution prompts
- Fix pre-existing clippy warning in kb.rs (filter_map → map)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Query workflows with status pending/planning/executing after restart
and re-submit them to the agent manager for continuation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Emit updated_at from KbEditor, re-sort article list after save
- Push /kb to history when entering KB mode
- Handle /kb path in parseUrl and popstate for proper navigation
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Replace singleton kb_content table with kb_articles (id, title, content)
- Add article_id to kb_chunks for per-article chunk tracking
- Auto-migrate old kb_content data on startup
- KbManager: index/delete per article, search across all with article_title
- API: full CRUD on /kb/articles, keep GET /kb for agent tool
- Agent: kb_search shows article labels, kb_read concatenates all articles
- Frontend: Sidebar KB mode with article list, KbEditor for single article
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
torch/sentence-transformers only provide manylinux (glibc) wheels,
not musl. The musl-compiled tori binary is statically linked and
runs fine on glibc systems.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Use /app/venv with uv instead of system python/pip
- Pre-download all-MiniLM-L6-v2 model during Docker build
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
ort (ONNX Runtime) has no prebuilt binaries for aarch64-musl.
Use a Python subprocess with sentence-transformers instead:
- scripts/embed.py: reads JSON stdin, outputs embeddings
- kb.rs: calls Python script via tokio subprocess
- Dockerfile: install python3 + sentence-transformers
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- KB module: fastembed (AllMiniLML6V2) for CPU embedding, SQLite for
vector storage with brute-force cosine similarity search
- Chunking by ## headings, embeddings stored as BLOB in kb_chunks table
- API: GET/PUT /api/kb for full-text read/write with auto re-indexing
- Agent tools: kb_search (top-5 semantic search) and kb_read (full text)
available in both planning and execution phases
- Frontend: Settings menu in sidebar footer, KB editor as independent
view with markdown textarea and save button
- Also: extract shared db_err/ApiResult to api/mod.rs, add context
management design doc
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Add delete button (×) to sidebar project list, shown on hover
- Soft-delete: mark projects as deleted in DB instead of hard delete
- Move workspace files to /app/data/deleted/ folder on deletion
- Filter deleted projects from list query
- Auto-select next project after deleting current one
- Also includes agent prompt improvements for reverse proxy paths
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Rewrite agent loop as Planning→Executing(N)→Completed state machine with
per-step context isolation to prevent token explosion
- Split tools and prompts by phase (planning vs execution)
- Add advance_step/save_memo tools for step transitions and cross-step memory
- Unify LLM interface: remove duplicate types, single chat_with_tools path
- Add UTF-8 safe truncation (truncate_str) to prevent panics on Chinese text
- Extract CreateForm component, add auto-scroll to execution log
- Add report generation with app access URL, non-blocking title generation
- Add timer system, file serving, app proxy, exec module
- Update Dockerfile with uv, deployment config
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Dockerfile: drop Rust build stage, COPY static musl binary directly
- Add traefik Ingress for tori.oci.euphon.net with LE cert
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>