Commit Graph

41 Commits

Author SHA1 Message Date
Fam Zheng
815477a73b feat: template examples + recent templates quick buttons
- Add TemplateExample struct and examples scanning (local dir + git repo)
- Exclude examples/ from copy_dir_recursive
- Frontend: recent templates (localStorage), template-specific example buttons
2026-03-08 08:56:40 +00:00
Fam Zheng
feb2a08d97 feat: step isolation — each step runs in independent sub-loop
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
2026-03-08 08:35:41 +00:00
Fam Zheng
47546a9d15 feat: add approve/reject buttons for wait_for_approval
- CommentSection shows explicit approve/reject buttons when waiting
- Reject aborts the workflow, approve continues with optional feedback
- Backend parses approved:/rejected: prefixes from comment content
2026-03-07 16:41:15 +00:00
Fam Zheng
938ba83f37 fix: add waiting_approval to Workflow status type 2026-03-07 16:38:26 +00:00
Fam Zheng
3500659e06 feat: add wait_for_approval tool for agent workflow pausing
Allow agent to pause execution at critical decision points and wait
for user confirmation via comments before continuing.
2026-03-07 16:37:17 +00:00
Fam Zheng
07f1f285b6 feat: multi-branch template scanning from git repo + manual template selection
- Rewrite template.rs to scan all remote branches via git commands
  (git fetch/branch -r/ls-tree/git show/git archive)
- Add manual template picker dropdown in CreateForm UI
- Remove sentence-transformers/embed.py from Dockerfile (separate container)
- Clean up Gitea API approach, use local git repo instead
- Add chat panel and sidebar layout improvements
2026-03-07 16:24:56 +00:00
Fam Zheng
cb81d7eb41 fix: update oseng symlink for repo root relocation
app-templates/oseng now points to ../../oseng/templates/oseng
since tori moved from oseng/tori to the repo root.
2026-03-04 13:51:04 +00:00
Fam Zheng
7a11c87e38 feat: add oseng app template and container entrypoint 2026-03-04 11:47:11 +00:00
Fam Zheng
1a907fe3d3 feat: add Object Storage browser UI
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.
2026-03-04 11:47:08 +00:00
Fam Zheng
69ad06ca5b improve: enhance KB search with better embedding and chunking 2026-03-04 11:47:03 +00:00
Fam Zheng
fe1370230f refactor: extract template and tools modules from agent
Split template selection and external tool management into dedicated
modules for better separation of concerns.
2026-03-04 11:47:01 +00:00
Fam Zheng
c0b681adc3 feat: add settings API with key-value store
GET/PUT endpoints for app settings backed by a settings table.
2026-03-04 11:46:58 +00:00
Fam Zheng
a3c9fbe8e5 feat: add object storage REST API
File-based object storage with GET/PUT/DELETE, directory listing,
path traversal protection, and streaming upload up to 2GB.
2026-03-04 11:46:55 +00:00
Fam Zheng
ae72e699f4 refactor: move routes under /tori/ prefix and add /api/obj mount
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.
2026-03-04 11:46:52 +00:00
84779a0527 add tests 2026-03-02 09:21:46 +00:00
728ab2e8fd Pre-install common Python packages in workspace venv and warm Docker cache
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>
2026-03-02 09:19:48 +00:00
0a8eee0285 LLM call logging, plan persistence API, quote-to-feedback UX, requirement input improvements
- 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>
2026-03-02 09:16:51 +00:00
46424cfbc4 Refactor agent runtime: state machine, feedback processing, execution log
- 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>
2026-03-02 08:54:43 +00:00
7f6dafeab6 Extract project examples to JSON file and add time-tracker example
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:24:56 +00:00
5888cc76d3 Update agent runtime design doc: remove framework comparison, add feedback/state/concurrency design
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:24:38 +00:00
ee4a5dfc95 App-templates: LLM auto-selects project template based on user requirement
- 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>
2026-03-01 21:33:40 +00:00
837977cd17 Resume incomplete workflows on server startup
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>
2026-03-01 09:02:01 +00:00
77784b3526 Fix KB sidebar not updating after save and missing URL routing for /kb
- 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>
2026-03-01 09:00:02 +00:00
40f200db4f KB multi-article support: CRUD articles, per-article indexing, sidebar KB mode
- 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>
2026-03-01 08:56:08 +00:00
3d1c910c4a Switch Docker base from alpine to debian-slim for torch compatibility
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>
2026-03-01 08:38:49 +00:00
db8f6cb500 Fix: pin Python 3.12 for torch compatibility on aarch64
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 08:34:57 +00:00
ddbe61818b Use uv venv for embedding, pre-download model in Docker build
- 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>
2026-03-01 08:33:21 +00:00
fbf636868c Switch from fastembed to Python sentence-transformers for embedding
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>
2026-03-01 08:31:31 +00:00
8483359cbc Fix: use rustls instead of native-tls for fastembed
Avoids OpenSSL dependency which fails on musl cross-compilation.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 08:17:44 +00:00
d9d3bc340c Add global knowledge base with RAG search
- 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>
2026-03-01 08:15:50 +00:00
1aa81896b5 Add project soft-delete with workspace archival
- 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>
2026-03-01 07:56:37 +00:00
2df4e12d30 Agent loop state machine refactor, unified LLM interface, and UI improvements
- 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>
2026-02-28 22:35:33 +00:00
e2d5a6a7eb Use deploy.sh for make deploy target
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 18:02:10 +00:00
ed66d9ac73 Add deployment documentation and deploy script
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:56:51 +00:00
6481c9d386 Add imagePullSecrets for registry auth
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:53:40 +00:00
85ab93798b Simplify Dockerfile to use pre-built musl binary, add Ingress
- 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>
2026-02-28 10:51:14 +00:00
eb8f5173f3 Bump Rust image to 1.86 for edition2024 support
getrandom 0.4.1 requires edition2024 which needs Cargo >= 1.85.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:48:14 +00:00
a26950c432 Add OCI ARM64 deployment setup
- deploy.sh: local-to-OCI deploy script (rsync config, docker build, kubectl apply)
- deployment.yaml: namespace, PVC, Deployment with registry image, Service
- Dockerfile: COPY config.yaml directly into image, drop openssh-client

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:47:11 +00:00
67ef516462 Switch reqwest to rustls-tls for cross-platform builds
Removes openssl dependency, enabling clean builds on ARM/musl targets.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:42:34 +00:00
7edbbee471 Tori: AI agent workflow manager - initial implementation
Rust (Axum) + Vue 3 + SQLite. Features:
- Project CRUD REST API with proper error handling
- Per-project agent loop (mpsc + broadcast channels)
- LLM-driven plan generation and replan on user feedback
- SSH command execution with status streaming
- WebSocket real-time updates to frontend
- Four-zone UI: requirement, plan (left), execution (right), comment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-28 10:36:50 +00:00
1122ab27dd Initial commit 2026-02-28 10:13:39 +00:00