feat: Core V2 Agent System - Unified Tool Authorization & Scene Configuration#141
Merged
feat: Core V2 Agent System - Unified Tool Authorization & Scene Configuration#141
Conversation
主要功能:
1. 场景配置Tab重构
- 按顶级设计师风格重新设计UI
- 场景文件列表展示原文件名(coding.md)
- 中文介绍作为副标题显示
- 支持场景文件编辑、创建、删除
2. 场景文件沙箱初始化
- 场景文件按Agent隔离存储
- 目录结构: {sandbox.work_dir}/.scenes/{agent_name}/
- 支持local/docker/k8s多种沙箱类型
- 动态获取沙箱工作目录
3. Core和Core_v2架构支持
- Core (v1): 在agent_chat.py中集成场景初始化
- Core_v2 (v2): 在core_v2_adapter.py中集成场景初始化
- 统一使用SceneSandboxInitializer模块
4. 场景内容自动注入
- 场景文件自动读取并注入到Agent System Prompt
- Agent能够根据场景定义调整行为
- 支持多场景绑定和自动拼接
文件清单:
- packages/derisk-core/src/derisk/agent/core_v2/scene_sandbox_initializer.py (新增)
- packages/derisk-serve/src/derisk_serve/agent/agents/chat/agent_chat.py (修改)
- packages/derisk-serve/src/derisk_serve/agent/core_v2_adapter.py (修改)
- packages/derisk-serve/src/derisk_serve/building/app/api/schema_app.py (修改)
- web/src/app/application/app/components/tab-scenes.tsx (新增)
- web/src/types/app.ts (修改)
- packages/derisk-serve/src/derisk_serve/scene/ (新增目录)
- web/src/client/api/scene/ (新增目录)
This implements a comprehensive tool authorization system with: Phase 1: Core Models - ToolMetadata, ToolParameter, AuthorizationRequirement - PermissionRule, PermissionRuleset, AuthorizationConfig - InteractionRequest, InteractionResponse protocols - AgentInfo, ToolSelectionPolicy configurations Phase 2: Tool System - ToolBase abstract class with safe execution - ToolRegistry singleton for tool management - Built-in tools: file_system, shell, network, code - Tool decorators for quick definition Phase 3: Authorization System - AuthorizationEngine with decision logic - RiskAssessor for risk evaluation - AuthorizationCache for session caching - Support for STRICT/MODERATE/PERMISSIVE/UNRESTRICTED modes Phase 4: Interaction System - InteractionGateway for async communication - Support for TEXT_INPUT, SELECTION, CONFIRMATION, etc. - WebSocket-ready architecture Phase 5: Agent Integration - AgentBase with think-decide-act loop - Integrated authorization checking - User interaction methods (ask_user, confirm, select) Phase 6: Frontend & E2E Tests - AuthorizationDialog, InteractionHandler components - VisAuthorizationCard VIS component - 57 E2E tests passing (authorization, interaction, agent execution)
- Add compression layers documentation and mapping files - Add worklog history compaction architecture docs - Add core_v2 context memory and tools/vis detail docs - Implement compaction_pipeline, history_archive, message_adapter - Add history_tools for agent core - Add VisStatusNotification component - Update react_reasoning_agent with compaction support - Add scene-aware agent examples (code_assistant, sre_diagnostic) - Update frontend components and locales
…olved config.tsx conflict (kept both VisStatusNotification and VisAuthorizationCard)
tptpp
approved these changes
Mar 5, 2026
yhjun1026
added a commit
that referenced
this pull request
Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces the Core V2 Agent System with unified tool authorization, scene configuration, and interaction management capabilities.
Changes
Major Features
Unified Tool Authorization System (Phase 1-6 complete)
Scene Configuration System (场景配置系统)
History Compaction & Scene-Aware Agent
Agent Optimizations
UI/UX Improvements
v2-chat)Type Definitions & Utilities
Commits
Files Changed
web/src/components/,web/src/hooks/,web/src/services/,web/src/types/,web/src/utils/vis/Testing
Notes