Commit Graph

155 Commits

Author SHA1 Message Date
qzl 5599477e2a docs: add agent architecture simplification design 2026-03-04 10:47:37 +08:00
qzl 80cbb3512f refactor: 切换到 litellm,删除未使用的代码
- 添加 litellm 依赖,统一 LLM 调用层
- 新增 litellm_client.py 支持多厂商
- 更新 llm_catalog.yaml 添加 litellm_model 映射
- 删除旧的 cost_tracker.py (litellm 内置 cost 追踪)
- 删除未使用的 multimodal.py 和 storage_adapter.py
- 删除空文件 crewai/__init__.py, tools/__init__.py
- 更新测试以适配新代码
2026-03-03 17:52:34 +08:00
qzl a4f684466c chore: 清理opencode技能文件、旧设计文档并更新配置文档 2026-03-03 17:29:01 +08:00
qzl 30a4a1af5d fix(agent): polish interrupt-resume flow for merge readiness 2026-03-03 17:26:04 +08:00
qzl 7be8669144 refactor(agent): extract magic numbers to constants 2026-03-03 16:28:12 +08:00
qzl 9aefb76c9e fix(agent): address CRITICAL/HIGH security and validation issues
- Fix SSE JSON injection: use json.dumps for safe serialization
- Add tool validation to dispatcher with allowlist
- Add field validation to tool_registry with proper error handling
- Add run_id consistency check (409 on mismatch)
- Add RunAgentInput constraints: min_length, extra=forbid
- Fix crewai_flow: use Field(default_factory), prefix unused params
2026-03-03 16:25:43 +08:00
qzl ff85c1ab08 test(agent): update tool registry test to match security policy 2026-03-03 16:02:32 +08:00
qzl f7df9d679f fix(agent): enforce tool security checks and audit logging 2026-03-03 16:01:04 +08:00
qzl 6a4c98bb63 feat(agent): close interrupt resume tool result loop 2026-03-03 16:00:11 +08:00
qzl 5bac134506 feat(agent): add sse run/resume endpoints with auth 2026-03-03 15:55:38 +08:00
qzl c76d4d415f fix(agent): serialize crewai flow stages and remove nested asyncio.run 2026-03-03 15:49:03 +08:00
qzl 3a64410641 feat(agent): add interrupt-aware tool dispatcher 2026-03-03 15:44:41 +08:00
qzl dedd23fdf9 fix(agent): enforce idempotent resume transition 2026-03-03 15:43:10 +08:00
qzl cff1436bc6 feat(agent): persist pending tool call in session snapshot 2026-03-03 15:39:56 +08:00
qzl e03923e593 feat(agent): add tool registry domain validation 2026-03-03 15:30:53 +08:00
qzl 17e6de177c refactor(agent): align chat schema with full run agent input 2026-03-03 15:29:46 +08:00
qzl 5e169251fe refactor(apps): simplify API layer by removing redundant wrapper classes
- Remove ApiClientWrapper and MockApiClientWrapper
- Simplify IApiClient interface
- Update dependency injection configuration
- Optimize calendar service and AG-UI chat models
2026-03-03 10:12:46 +08:00
qzl 9b9b8fcbdd Merge branch 'feature/calendar-create-event' into dev
# Conflicts:
#	apps/lib/features/calendar/ui/screens/calendar_event_detail_screen.dart
2026-03-02 17:29:21 +08:00
qzl 6fb527eb7b fix: 修复日历事件详情页布局问题并添加底部输入框
- 修复 Row 中 Flexible 在无界宽度约束下的布局崩溃问题
- 用 Expanded 包裹内层 Row 提供有界宽度约束
- 添加底部输入框组件(+按钮、输入框、麦克风图标)
- 实现事件详情页动态数据展示
- 添加编辑和删除事件功能
- 添加事件不存在时的错误页面
2026-03-02 17:28:21 +08:00
qzl ca1ce3d84a docs: 添加 ag-ui 和 crewai 项目 skills 及更新文档 2026-03-02 17:02:09 +08:00
qzl 6fdbc34526 docs(backlog): update TRIGGER-001 and TOKEN-001 status to resolved 2026-03-02 16:49:45 +08:00
qzl 05f972e98a refactor(apps): migrate hardcoded colors to AppColors tokens
- Replace Color(0xFFF8FAFC) with AppColors.surfaceSecondary (11 uses)
- Replace Color(0xFFF8FAFF) with AppColors.surfaceTertiary (9 uses)
- Replace Color(0xFFE2E8F0) with AppColors.borderSecondary (5 uses)
- Replace Color(0xFFDCE5F4) with AppColors.borderTertiary (5 uses)
- Replace Color(0xFFCFE1FB) with AppColors.borderQuaternary (5 uses)
- Replace Color(0xFFF59E0B) with AppColors.warning (4 uses)
- Replace Color(0xFFEAF3FF) with AppColors.surfaceInfo (4 uses)
- Replace Color(0xFF10B981) with AppColors.success (4 uses)
- Replace Color(0xFFEF4444) with AppColors.error (3 uses)
- Replace Color(0xFFF3F7FF) with AppColors.surfaceInfoLight (3 uses)

Files migrated:
- settings_screen.dart (7 colors migrated)
- contacts_screen.dart (3 colors migrated)
- calendar_event_detail_screen.dart (10 colors migrated)
- features_screen.dart (3 colors migrated)
- toast_type_config.dart (3 colors migrated)
- memory_screen.dart (4 colors migrated)
- account_screen.dart (3 colors migrated)
- add_contact_screen.dart (2 colors migrated)

Total: 37 hardcoded colors replaced with design tokens

Verification:
- flutter analyze: passed
- flutter test: passed
2026-03-02 16:34:33 +08:00
qzl 51ca78a37a feat(tokens): add semantic color tokens for high-frequency colors
Add design tokens for frequently used hardcoded colors:
- Surface colors: surfaceSecondary (11 uses), surfaceTertiary (9 uses), surfaceInfo (4 uses), surfaceInfoLight (3 uses)
- Border colors: borderSecondary (5 uses), borderTertiary (5 uses), borderQuaternary (5 uses)
- Status colors: success (4 uses), warning (4 uses), error (3 uses)
- Text colors: textSecondary (4 uses)

These tokens will enable migration of hardcoded Color() values in pages.
2026-03-02 16:22:25 +08:00
qzl 971ba30032 test: add unit tests for load_user_agent_catalog function
- test_user_agent_catalog_file_exists_and_has_required_fields: verifies catalog file exists with correct structure
- test_load_user_agent_catalog_raises_on_invalid_structure: verifies invalid YAML is properly rejected
2026-03-02 16:05:30 +08:00
qzl 4afc67b7a8 feat: extend init_data to load and sync user_agent_catalog
- Add UserAgentCatalogSeed and UserAgentCatalogYaml Pydantic models
- Add load_user_agent_catalog function to load from YAML
- Add _upsert_user_agent_catalog helper for upsert logic
- Add initialize_user_agent_catalog function for initialization
- Refactor initialize_data to call initialize_llm_catalog and initialize_user_agent_catalog
- Fix UserAgentCatalog.llm_id type from str to uuid.UUID
2026-03-02 15:58:13 +08:00
qzl fb8f4fdeeb fix(migration): allow multiple agents per user (one per agent_type)
- Drop single-column UNIQUE constraint on user_agents.user_id
- Add composite UNIQUE constraint on (user_id, agent_type)
- Enables trigger to insert 3 agents per user (INTENT_RECOGNITION, TASK_EXECUTION, RESULT_REPORTING)
- Maintain reversible downgrade path
2026-03-02 15:51:04 +08:00
qzl 27b09ce9c0 feat(migration): add user_agent_catalog table and update trigger 2026-03-02 15:36:25 +08:00
qzl 97626ec2c4 feat(models): add UserAgentCatalog model 2026-03-02 15:31:20 +08:00
qzl 06e9a25f57 feat(config): add user_agent_catalog.yaml with default agent configs 2026-03-02 15:27:24 +08:00
qzl bc40bc36c2 docs: add bug fix implementation plan 2026-03-02 15:19:22 +08:00
qzl 3528697302 docs: add bug fix design for TRIGGER-001 and TOKEN-001 2026-03-02 15:15:51 +08:00
qzl e161ca22c4 refactor(chat): 重构聊天模块并集成历史消息加载功能
- 删除冗余的 chat_history_repository 和 home_mock_data
- 简化 ag_ui_event fromJson 使用工厂映射表
- 提取 ChatBloc 事件处理方法,添加 loadHistory/loadMoreHistory
- HomeScreen 集成 ChatBloc 实现历史消息加载和下拉刷新
- 更新 AGENTS.md 文档约束
2026-03-02 15:05:10 +08:00
qzl 6b32990986 refactor: 重构 config 目录结构,按领域分类静态配置 2026-03-02 14:40:45 +08:00
qzl 87b8727ca4 docs: 添加 AG-UI 协议规则约束到 apps/AGENTS.md 2026-03-02 11:17:20 +08:00
qzl 99d540a18d refactor: 重命名 agent_chat 模块为 agent 2026-03-02 11:13:20 +08:00
qzl 2ac56e5084 docs: 整理 runtime 系列文档,修正 API 端点名称 2026-03-02 10:55:46 +08:00
qzl c3192a2431 feat(chat): add ChatBubble widget and mock data for home screen
- Add ChatBubble reusable widget for chat messages
- Add HomeMockData for chat list mock data
- Add HomeScreen widget tests
- Add AG-UI chat design and implementation plan docs
- Add friendship design docs
- Ignore backend/logs directory
2026-02-28 14:47:33 +08:00
qzl 534efd182b feat(chat): implement AG-UI protocol AI chat feature
- Add AG-UI event models with wire protocol mapping
- Implement ToolRegistry with create_calendar_event tool
- Create AiDecisionEngine for intent matching
- Add AgUiService with mock event stream support
- Implement ChatBloc for state management
- Create UiSchemaRenderer with design tokens
- Integrate ChatBloc into HomeScreen
- Add ChatHistoryRepository with shared_preferences
- Add comprehensive unit tests (97 tests)
- Fix ChatBloc event callback initialization
2026-02-28 14:44:16 +08:00
qzl d37677c533 fix(chat): fix ChatBloc event callback and test reliability
- Fix onEvent callback initialization in ChatBloc constructor
- Add MockAgUiService to isolate test from mock API behavior
- Remove unnecessary non-null assertions in tests
2026-02-28 14:41:21 +08:00
qzl 92781ddbbe test(chat): add comprehensive unit tests 2026-02-28 13:49:51 +08:00
qzl dd90f48c6f feat(chat): integrate ChatBloc into HomeScreen 2026-02-28 13:43:22 +08:00
qzl f82a8072a2 feat(chat): add ChatHistoryRepository with shared_preferences 2026-02-28 13:41:58 +08:00
qzl e1973a9868 feat(chat): add ChatBloc for state management 2026-02-28 13:40:46 +08:00
qzl d12f846cc0 feat(chat): add UiSchemaRenderer with design tokens 2026-02-28 13:38:58 +08:00
qzl 1fd33c57a7 feat(chat): add AgUiService with mock event stream 2026-02-28 13:38:26 +08:00
qzl 7e0e6457d7 feat(chat): add AiDecisionEngine with force trigger support 2026-02-28 13:36:59 +08:00
qzl f0ae3b31e2 feat(chat): add ToolRegistry with validation 2026-02-28 13:36:30 +08:00
qzl bc7bfa0692 feat(chat): add ChatListItem models in chat feature 2026-02-28 13:36:08 +08:00
qzl e20b5e0b4f feat(chat): add AG-UI event models with wire protocol mapping 2026-02-28 13:34:55 +08:00
qzl 4044b50cf9 feat(chat): add ToolResult and UiCard models 2026-02-28 13:33:08 +08:00