v0.3.3
Highlights
IllusionAgent v0.3.3 is a rebranding and stabilization release. This version completes the full migration from illusion-code to illusion-agent across all 5 layers (core build, API/user-visible strings, frontend, docs, scripts/skills/tests), introduces runtime /max-tokens control, fixes several backend crash chains (MCP McpError, Grep invalid regex, path traversal), and extracts shared logic (resolve_relative_path, run_rg_checked, MCP_TOOL_EXCEPTIONS) to eliminate tool-layer duplication.
Key Changes
- Full Brand Migration —
illusion-code→illusion-agentacross build, CLI, API, frontend, docs, scripts, skills, and tests - Runtime max-tokens — New
/max-tokensslash command with interactive selector and custom input - Crash Fixes — MCP
McpError, Grep invalid regex, path traversal attacks, and cron daemon PID file - Code Deduplication — Extracted
resolve_relative_path,run_rg_checked,MCP_TOOL_EXCEPTIONSinto shared modules
New Features
Runtime Controls
/max-tokensSlash Command — New command to set max output tokens at runtime- Interactive Selector —
/effortand/max-tokenswith no args pop up a selector, supporting custom input - AppState + QueryEngine — Added
max_tokensruntime modification support
Authentication
- Interactive env Reuse —
auth loginsupports interactive reuse of existing env and looping input for multiple models - Always New env —
auth loginalways creates new env;add modelmoved toauth add-modelcommand
MCP
- Optional
typeField — MCP configtypenow optional, defaults tostdiowhen omitted
Important Fixes
Brand Migration (illusion-code → illusion-agent)
- Layer 1 — Core build and CLI migration
- Layer 2 — API class rename (
IllusionCodeApiError→IllusionAgentApiError), docstring and user-visible string migration - Layer 3 — Frontend brand name migration
- Layer 4 — Documentation and image asset migration
- Layer 5 — Scripts, skills, and test file brand name synchronization
Crash Chains
- MCP
McpError— Explicitly catchMcpErrorinReadMcpResourceToolandMcpToolAdapterto prevent backend crashes - Grep Invalid Regex — Pre-validate regex with
re.compilebefore calling rg, preventingRipgrepErrorescape - Path Traversal — Reject
..,~-prefixed paths in all file tools viavalidate_safe_path - Cron Daemon PID — Fixed
run_cron_servenot writing PID file, causingis_scheduler_running()to always return False
Terminal UX
- Tab Switching — Multi-question tab navigation now commits current answer before switching (equivalent to pressing Enter)
- CustomInputModal — Unified
context-windowcustom input flow, fixed style and focus leak - State Loss — Fixed state loss when switching between multi-question tabs
Backend
/max-tokensEndpoint —backend_hostnow handles/max-tokensselect_requestand CLI build branch- Test Isolation — Fixed
test_max_tokens_set_numberoverwriting user'ssettings.jsonwith test values
Refactoring
Shared Logic Extraction
resolve_relative_path— 4 file tools' duplicate_resolve_pathreplaced bypaths.resolve_relative_pathrun_rg_checked—glob_toolandgrep_toolswitched to non-throwingrun_rg_checkedMCP_TOOL_EXCEPTIONS— Extracted(ValueError, McpError)constant tomcp/types.pyRipgrepNotFoundError— Added catch inrun_rg_checkedto fulfill "never raises" contract
Code Quality
- Dead Code Removal — Deleted
textual_app.pydead code and related test dependencies - Auto-fix — Applied 401 ruff safe auto-fixes for code style
- Type Safety — Refined exception handling, simplified code, improved type annotations
Documentation
- README & Introduction — Optimized slogan and project intro across 4 docs (English + Chinese)
- Main slogan: "Where fantasy meets functionality"
- Secondary: "The best of many worlds, refined into one intelligent agent"
CI/CD
- Trusted Publishers — Removed
scripts/publish.py(twine + token model), fully migrated to GitHub Actions Trusted Publishers - Lint Stability — Locked ruff version to 0.15.0 to prevent CI lint failures from new rules
Installation
pip install (Recommended)
pip install illusion-agent==0.3.3From Source
git clone https://github.com/YunTaiHua/illusion-agent.git
cd illusion-agent
pip install .Quick Start
illusion auth login # Configure API credentials
illusion # Start TUI interactive session
illusion web # Launch Web UI
illusion -p "Analyze the project structure" # Print mode (non-interactive)Documentation
中文版本
重点更新
IllusionAgent v0.3.3 是一个品牌迁移与稳定性版本。本次版本完成了 illusion-code 到 illusion-agent 的全层迁移(5 层:核心构建、API/用户可见字符串、前端、文档、脚本/skills/测试),引入了运行时 /max-tokens 控制,修复了多个后端崩溃链(MCP McpError、Grep 无效正则、路径穿越),并提取了公共逻辑(resolve_relative_path、run_rg_checked、MCP_TOOL_EXCEPTIONS)消除工具层重复代码。
关键更新
- 全层品牌迁移 —
illusion-code→illusion-agent覆盖构建、CLI、API、前端、文档、脚本、skills、测试 - 运行时 max-tokens — 新增
/max-tokens斜杠指令,支持交互式选择器和自定义输入 - 崩溃修复 — MCP
McpError、Grep 无效正则、路径穿越攻击、cron 守护进程 PID 文件 - 代码去重 — 提取
resolve_relative_path、run_rg_checked、MCP_TOOL_EXCEPTIONS至公共模块
新功能
运行时控制
/max-tokens斜杠指令 — 新增运行时设置最大输出令牌数的指令- 交互式选择器 —
/effort和/max-tokens无参数时弹出选择框,支持自定义输入 - AppState + QueryEngine — 增加
max_tokens运行时修改支持
认证
- 交互式 env 复用 —
auth login支持交互式复用已有 env 和循环输入多个 model - 始终新建 env —
auth login始终新建 env,add model改用auth add-model指令
MCP
type字段可选 — MCP 配置type现在可选,省略时默认stdio
重要修复
品牌迁移(illusion-code → illusion-agent)
- 第1层 — 核心构建与 CLI 迁移
- 第2层 — API 类名重命名(
IllusionCodeApiError→IllusionAgentApiError)、docstring 和用户可见字符串迁移 - 第3层 — 前端品牌名迁移
- 第4层 — 文档与图片资源迁移
- 第5层 — 脚本、skills 和测试文件品牌名同步
崩溃链
- MCP
McpError— 在ReadMcpResourceTool和McpToolAdapter中显式捕获McpError,防止后端崩溃 - Grep 无效正则 — 调用 rg 前用
re.compile预校验正则,防止RipgrepError逃逸 - 路径穿越 — 通过
validate_safe_path拒绝所有文件工具中包含..、~开头的路径 - Cron 守护进程 PID — 修复
run_cron_serve未写入 PID 文件导致is_scheduler_running()始终返回 False
终端 UX
- Tab 切换 — 多问题 tab 切换前先提交当前问题答案,等同于一次回车
- CustomInputModal — 统一
context-window自定义输入流程,修复样式与焦点泄漏 - 状态丢失 — 修复多问题 tab 切换时状态丢失问题
后端
/max-tokens端点 —backend_host补充/max-tokensselect_request与命令行构建分支- 测试隔离 — 修复
test_max_tokens_set_number用测试值覆盖用户settings.json的问题
重构
公共逻辑提取
resolve_relative_path— 4 个文件工具的重复_resolve_path替换为paths.resolve_relative_pathrun_rg_checked—glob_tool和grep_tool改用不抛异常的run_rg_checkedMCP_TOOL_EXCEPTIONS— 提取(ValueError, McpError)常量至mcp/types.pyRipgrepNotFoundError—run_rg_checked新增捕获,使「不抛异常」契约成立
代码质量
- 死代码清理 — 删除
textual_app.py死代码及相关测试依赖 - 自动修复 — 应用 401 项 ruff safe auto-fix 代码风格修复
- 类型安全 — 细化异常处理、简化代码、完善类型注解
文档
- README 与 introduction — 优化 4 个文档(中英文)的标语和项目简介
- 主标语:"幻想与实用,于此交融"(Where fantasy meets functionality)
- 副标语:"融合多个开源项目精华,构建统一智能代理"
CI/CD
- Trusted Publishers — 删除
scripts/publish.py(twine + token 模式),全面迁移至 GitHub Actions Trusted Publishers - Lint 稳定性 — 锁定 ruff 版本为 0.15.0 防止 CI lint 因新版规则失败
安装
pip 安装(推荐)
pip install illusion-agent==0.3.3从源码安装
git clone https://github.com/YunTaiHua/illusion-agent.git
cd illusion-agent
pip install .快速开始
illusion auth login # 配置 API 认证
illusion # 启动 TUI 交互式会话
illusion web # 启动 Web 界面
illusion -p "分析项目结构" # Print 模式(非交互)