Files
Fishing2/Packages/cn.tuanjie.codely.bridge/CHANGELOG.md
2026-03-09 17:50:20 +08:00

513 lines
21 KiB
Markdown

# Changelog
All notable changes to Codely Bridge will be documented in this file.
## [1.0.23] - 2026-02-25
### Changed
- **UI**
- Codely bridge 页面改版
## [1.0.22] - 2026-02-11
### Enhanced
- **ExecuteCSharpScript**
- Added Unity.InputSystem assembly support for C# script execution
- Scripts can now access Input System types and APIs when the package is installed
## [1.0.21] - 2026-02-06
### Changed
- **Batch Operations Refactoring**
- Split generic `batch` action into two distinct operations: `create_batch` for write-only deterministic sequences and `edit_batch` for search-then-write edits
- Added `HandleCreateBatch` method for write-only deterministic batch operations
- Added `HandleEditBatch` method for search-then-write batch operations with captureAs support
- Improved code clarity and prevented mixed read/write batch states
- Maintained parity with TypeScript client schema
- Added backward compatibility aliases for snake_case to camelCase parameters
- Updated ValidActions list to include new batch operation types
- Updated writeActions array to include new batch operations for state validation
### Enhanced
- **ManageAsset**
- Enhanced batch operation handling with clearer separation of concerns
- Improved parameter naming consistency with backward compatibility support
- **ManageGameObject**
- Enhanced batch operation handling with clearer separation of concerns
- Improved parameter naming consistency with backward compatibility support
### Test Coverage
- Updated `unity_asset_full_coverage.md` to reflect new batch operations
- Updated `unity_gameobject_full_coverage.md` to reflect new batch operations
- Updated `unity_workflow_full_coverage.md` with refined batch operation workflows
- Updated `Tests/Coverage/README.md` documentation
## [1.0.20] - 2026-02-05
### Fixed
- **TCP Port Management on macOS**
- Disabled ReuseAddress socket option on macOS in PortManager.cs
## [1.0.19] - 2026-02-04
### Fixed
- **TCP Port Management on macOS**
- Disabled ReuseAddress socket option on macOS to prevent multiple Unity instances from listening on the same port
- Ensures proper port exclusivity across Unity Editor instances
## [1.0.18] - 2026-02-04
### Fixed
- **TCP Connection Reliability**
- Add LingerState to test listener to send RST on close (same as actual listener)
- Increase immediate retry attempts from 3 to 5
- Increase retry sleep time from 75ms to 150ms
- Extend wait time on Windows from 100ms to 500ms to allow TCP port full release
## [1.0.17] - 2026-02-03
### Fixed
- **Revert IPV6 Loopback Support**
## [1.0.16] - 2026-02-03
### Added
- **C# Script Execution**
- New `ExecuteCSharpScript` tool for executing arbitrary C# code at runtime using Microsoft.CodeAnalysis.CSharp.Scripting (Roslyn compiler services)
- Captures and returns Unity console logs during script execution
- Supports custom using directives and assembly references
- Enables dynamic C# code execution without requiring editor restart or recompilation
- Added bundled Roslyn assemblies: `Codely.Microsoft.CodeAnalysis.dll`, `Codely.Microsoft.CodeAnalysis.CSharp.dll`, `Codely.Microsoft.CodeAnalysis.Scripting.dll`, `Codely.Microsoft.CodeAnalysis.CSharp.Scripting.dll`
- Added supporting assemblies: `Codely.System.Collections.Immutable.dll`, `Codely.System.Reflection.Metadata.dll`, `Codely.System.Runtime.CompilerServices.Unsafe.dll`
### Fixed
- **UnityTcpBridge**
- Reverted accidental handshake string change that broke package functionality (changed from incorrect 'WELCOME UNITY-TCP 1 FRAMING=1' back to correct 'WELCOME Codely-Bridge 1 FRAMING=1')
- **Add IPV6 Loopback Support**
### Changed
- **Branding & Menu Structure**
- Renamed "Unity TCP" to "Codely Bridge" across logging and port management
- Simplified menu structure: removed redundant menu items and kept only "Window/Codely Bridge/Control Window"
- Updated menu organization for better user experience
- **CI/CD**
- Updated register_version job rules in CI pipeline
## [1.0.15] - 2026-01-29
### Changed
- **ManageScreenshot**
- Simplified screenshot API: removed redundant `capture_game_view` action; its behavior is now covered by the unified `capture` action
- `capture` action now consistently uses GameView reflection to capture what the user sees in both edit and play modes
- Removed redundant `FlipTextureVertically` call and related comments for clearer, more maintainable code
- **Package Publishing**
- Updated `.npmignore` to include `Tests/` directory in the published npm package so consumers can run and extend the test suite
### Fixed
- **Screenshot Capture**
- Fixed vertical flip of textures captured from RenderTexture so screenshots match on-screen orientation
### Test Coverage
- Updated `unity_screenshot_full_coverage.md` and `Tests/Coverage/README.md` to reflect the simplified screenshot API and current test structure
## [1.0.14] - 2026-01-22
### Changed
- **Dependency Management**
- Swapped to bundled `Codely.Newtonsoft.Json.dll` in `Plugins/` directory instead of external `Newtonsoft.Json` package
- Removed external `Newtonsoft.Json` dependency from `package.json`
- Updated all code references to use bundled Newtonsoft.Json assembly
- **Architecture**
- Moved runtime implementation code from `Runtime/` to `Editor/` scope to align with Unity usage patterns
### Added
- **Package Publishing**
- Added `.npmignore` file to exclude unwanted files from npm publication
- Excludes CI/CD configuration, build artifacts, Git metadata, IDE files, and test directories
- Ensures only essential code and documentation are published to npm registry
- **CI/CD Pipeline**
- Added automated npm pack and TOS (Tencent Object Storage) upload steps to deployment pipelines
- Added backup version (1.0.0) upload for both staging and production environments
- Improved deployment reliability with fallback version availability
## [1.0.13] - 2026-01-20
### Fixed
- **Test Assembly Dependencies**
- Fixed missing `Newtonsoft.Json.dll` reference in `UnityTcp.Editor.Tests.asmdef`
- Added `com.unity.ext.nunit` package dependency to `package.json` for proper NUnit framework support
- Ensures test assembly can properly reference required dependencies for compilation
## [1.0.12] - 2026-01-19
### Added
- **ManageGameObject**
- Added `list_children` action for listing GameObject children with configurable depth
- Support for three result modes: `auto` (default), `inline`, and `file`
- Automatic fallback to file output when hierarchy exceeds `maxInlineItems` threshold (default: 200)
- Depth-limited traversal with `depth` parameter (default: 1 for direct children)
- `includeInactive` parameter to control whether inactive GameObjects are included
- Iterative tree building to avoid stack overflow on deep hierarchies
- JSON streaming to file for large results to prevent memory issues
- New helper methods: `CountDescendantsUpToDepth`, `BuildChildrenTreeIterative`, `WriteChildrenTreeIterative`
### Enhanced
- **ManageScene**
- Improved large scene hierarchy handling (>500 GameObjects)
- Returns shallow root-only tree with hints instead of error when scene is too large
- Changed `CountGameObjectsRecursive` to use iterative traversal (stack-based) to avoid stack overflow on deep hierarchies
- Better user guidance for drilling down into large hierarchies incrementally
- **Coverage Tools**
- Added `CodelyUnityCoverageTools` class for E2E test utilities
- New `codely.generate_large_hierarchy` custom tool for quickly generating test hierarchies
- Configurable generation parameters: root name, child/grandchild prefixes, and counts
### Test Coverage
- Added `unity_large_hierarchy_e2e_coverage.md` with 152 lines of E2E test scenarios for large hierarchy handling
- Updated `unity_gameobject_full_coverage.md` with `list_children` action coverage
- Updated `unity_scene_full_coverage.md` with improved large scene handling coverage
## [1.0.11] - 2026-01-13
### Added
- **Tuanjie Editor Scene File Support**
- Added support for `.scene` file extension used by Tuanjie Editor
- Implemented extension-aware scene path handling in `ManageScene`
- Support both `.unity` (Unity Editor) and `.scene` (Tuanjie Editor) extensions based on editor type
### Enhanced
- **UnityStateDirtyHook**
- Added `.scene` extension detection for scene file change tracking
- Ensures proper state tracking for both Unity and Tuanjie editor scene files
- **Documentation**
- Improved documentation for scene file extension handling
## [1.0.10] - 2026-01-12
### Fixed
- **ManageGameObject**
- Updated default behavior for `searchInactive` parameter from `false` to `true`
- Ensures inactive GameObjects are included in search results unless explicitly specified otherwise
- **UnityEngineObjectConverter**
- Added support for `{"find":"...", "method":"..."}` reference format in object deserialization
- Fixed deserialization errors when encountering find instruction format used by MCP tools for dynamic GameObject lookups
- Implemented delegate pattern to call `ManageGameObject.FindObjectByInstruction` from Runtime assembly without direct Editor assembly reference
## [1.0.9] - 2026-01-05
### Changed
- **Unity Project Metadata**
- Updated Unity project metadata GUIDs across all .meta files
- Refreshed GUIDs in Editor, Runtime, and Tests directories
## [1.0.8] - 2025-12-16
### Enhanced
- **Compilation Tracking**
- Improved compilation error/warning count tracking with nullable integers
- Changed `CompilationHelper.GetCompilationErrors()` and `GetCompilationWarnings()` to return `int?` instead of `int`
- Updated `GetCompilationSummary()` to only include known values in result (removes misleading default 0 values)
- Enhanced compilation result handling in `ManageEditor` to properly process nullable values
- Improved type handling for compilation result payloads (supports both dictionary and anonymous object formats)
- Added clarifying comments explaining why returning 0 for unknown counts is problematic
- Better distinction between "0 errors/warnings" (validated) vs "unknown count" (not yet validated)
## [1.0.7] - 2025-12-15
### Changed
- **Package Renaming**
- Renamed package from `com.unity.codely` to `cn.tuanjie.codely.bridge`
- Updated all internal references and documentation to reflect new package name
- **Branding Update**
- Renamed all menu item paths and labels in the Unity Editor
## [1.0.6] - 2025-12-10
### Added
- **Compilation Pipeline**
- New `pipeline_kind: "compile"` field for structured hints to downstream tools
- `requires_console_validation: true` flag to guide compilation validation
- Comprehensive integration test documentation for compilation pipeline policy
- Enhanced play mode state synchronization with `playMode` field in responses
### Enhanced
- **StateComposer**
- Simplified state reporting to focus on essential information (compiling vs idle)
- Minimized state complexity with clear documentation directing users to specific diagnostic tools
- **ManageAsset**
- Improved `AssetExists` method with ghost asset detection
- New `BuildAssetNotFoundResponse` for better error messaging about desync issues
- Enhanced asset validation and error handling
- **Test Coverage**
- Added `unity_compile_pipeline_integration.md` with 152 lines of comprehensive test scenarios
- Updated `unity_editor_full_coverage.md` with compilation pipeline requirements
## [1.0.5] - 2025-12-04
### Added
- **Test Coverage**
- Added comprehensive test coverage for `ExecuteCustomTool` functionality
- UI Toolkit tools test coverage documentation and validation
### Enhanced
- **ManageUIToolkit**
- Enhanced `link_uss_to_uxml` action with GUID support
- Added `ResolveAssetPath` helper method for flexible path/GUID resolution
- Improved parameter validation for mixed path/GUID usage
- **ManageShader**
- Enhanced `ensure_material_shader_for_srp` action with `material_guid` parameter support
- Improved parameter handling for material identification via path or GUID
- Better error messages for missing material parameters
- **CodelyUnityValidationTools**
- Added nested field path support in `validate_response`
- Support for dot-notation field paths (e.g., "state.project.srp", "project.srp")
- Automatic recursive field search when direct path fails
- Enhanced field validation with path tracking and debugging
- **ManageBake**
- Refactored NavMesh operations to use runtime reflection
- Improved AI Navigation package detection and type resolution
- Better compatibility with optional AI Navigation package installation
- Enhanced error handling for missing package scenarios
## [1.0.4] - 2025-12-03
### Added
- **Validation Tools Framework**
- New `CodelyUnityValidationTools`: 15+ validation helpers for automated testing
- `codely.validate_play_mode`: Validate current editor PlayMode state
- `codely.validate_active_tool`: Validate current active editor tool
- `codely.validate_not_compiling`: Ensure editor is not compiling
- `codely.validate_tag_and_layer_exist`: Verify Tag/Layer existence
- `codely.validate_window_open`: Check editor window state
- `codely.validate_console_contains`: Validate console messages with filter
- `codely.validate_console_count`: Verify console message counts
- `codely.validate_active_scene`: Validate active scene properties
- `codely.validate_scene_dirty`: Check scene dirty state
- `codely.validate_hierarchy_root_count`: Verify hierarchy root object count
- `codely.validate_gameobject_exists`: Check GameObject existence
- `codely.validate_response`: Generic response validation
- **Compilation Pipeline**
- `CompilationHelper`: New helper class for compilation status checking and error tracking
- `start_compilation_pipeline` action in ManageEditor for standardized compile workflow
- Block compilation during play mode to prevent editor errors
- **Test Coverage Documentation**
- Complete test coverage specs for all Unity tools
- `unity_editor_full_coverage.md`: 24 actions coverage
- `unity_console_full_coverage.md`: Console operations coverage
- `unity_scene_full_coverage.md`: Scene management coverage
- `unity_gameobject_full_coverage.md`: GameObject operations coverage
- `unity_asset_full_coverage.md`: Asset management coverage
- `unity_script_full_coverage.md`: Script management coverage
- `unity_shader_full_coverage.md`: Shader operations coverage
- `unity_package_full_coverage.md`: Package manager coverage
- `unity_menu_full_coverage.md`: Menu execution coverage
### Enhanced
- **State Management**
- State delta tracking added to async operation responses
- Client state revision validation for all write operations
- Enhanced console state tracking with `since_token` filtering
- **ManageEditor**
- Idempotent `ensure_tag` and `ensure_layer` operations
- Extended with compilation pipeline integration
- **ManageAsset**
- Enhanced robustness with better error handling
- **ManageGameObject**
- Improved serialization with `GameObjectSerializer` enhancements
- **ReadConsole**
- Enhanced filtering with `since_token` support for incremental reads
- **ExecuteCustomTool**
- Improved tool registry with better parameter validation
### Fixed
- Improved Unity version compatibility across various tools
## [1.0.3] - 2025-12-01
### Added
- **State Management System**
- `AsyncOperationTracker`: Comprehensive async operation management with progress tracking and cancellation support
- `StateComposer`: Full Unity state composition including scene, project, packages, and shaders
- `UnityStateDirtyHook`: Automatic tracking of Unity Editor state changes (hierarchy, project, selection, console)
- `WriteGuard`: Thread-safe write operation protection with main thread enforcement
- New `get_current_state` endpoint for retrieving complete Unity state snapshots
- **New Unity Tools**
- `ManageBake`: Light baking controls (start, cancel, clear, status queries)
- `ManagePackage`: Package manager operations with version pinning support (package@version syntax)
- `ManageUIToolkit`: UI Toolkit template instantiation with automatic USS/C# generation
- **Custom Tool Execution Framework**
- `ExecuteCustomTool`: Reflection-based tool discovery and execution via `[CustomTool]` attribute
- Automatic tool registry with parameter validation and error handling
- Support for custom tools without modifying CommandRegistry
- **Enhanced Existing Tools**
- `ManageEditor`: Extended with state-aware operations and full state retrieval
- `ManageGameObject`: Added find, query, parent/child operations, and component management
- `ManageAsset`: New asset import, export, and metadata operations
- `ManageScene`: Enhanced with scene creation and multi-scene management
- `ManageShader`: Expanded with shader compilation, variant queries, and global property management
- `ReadConsole`: Added scope-based console clearing and entry filtering
### Enhanced
- **Response Helpers**: New state-aware methods (`SuccessWithDelta`, `SuccessWithState`, `Conflict`) for better change tracking
- **CompilationHelper**: Improved compilation workflow handling with better async integration
- **Test Coverage**: Added unit tests for `AsyncOperationTracker`, `StateComposer`, and `WriteGuard`
## [1.0.2] - 2025-11-11
### Fixed
- **Unity Version Compatibility**: Added conditional compilation in `ManageGameObject.cs`
- Uses `FindObjectsByType` with `FindObjectsInactive` enum for Unity 2022.2+
- Falls back to `FindObjectsOfType` for Unity 2021.3 and earlier
- Resolves CS0246 error: `FindObjectsInactive` type not found on Unity 2021
- Maintains backward compatibility across Unity versions
## [1.0.1] - 2025-11-07
### Fixed
- 🐛 **Fixed build compilation error**
- Corrected assembly definition configuration for `UnityTcp.Editor.asmdef`
- Changed from platform exclusion list to explicit Editor platform inclusion
- Ensures Editor assembly only compiles in Unity Editor, not in game builds
- Resolves compilation errors during game packaging for all platforms
## [1.0.0] - 2024-12-19
### Major Refactoring
- 🔄 **Complete removal of MCP (Model Context Protocol) logic**
- Removed all MCP-specific components, tools, and protocol handling
- Eliminated MCP server integration and HTTP server components
- Removed MCP client models, configuration systems, and UI windows
### New TCP-Focused Architecture
- 🚀 **Pure TCP Socket Implementation**
- New `UnityTcpBridge` class for TCP server management
- Basic echo server implementation as starting point
- Async/await patterns for non-blocking operations
- Multi-client connection support with proper resource management
### Core TCP Features
- **Port Management**
- Automatic port discovery and allocation
- Project-specific port persistence
- Smart port conflict resolution
- Cross-platform compatibility
- **Connection Handling**
- TCP listener with automatic client acceptance
- Configurable socket options (keep-alive, timeouts)
- Graceful connection cleanup on shutdown
- Unity lifecycle integration (assembly reload, editor quit)
### Updated Components
- **Renamed Assemblies**: `UnityTcp.*``UnityTcp.*`
- **Updated Namespaces**: All classes moved to `UnityTcp.Editor.*` namespace
- **Simplified Helpers**: Kept only TCP-relevant utilities (PortManager, TcpLog)
- **Package Rebranding**: Updated from "Unity MCP" to "Unity TCP Bridge"
### Removed Components
- All MCP protocol handling and message processing
- MCP tool implementations (ManageScript, ManageAsset, etc.)
- MCP UI windows and editor integrations
- HTTP server and MCP server management
- Telemetry and MCP-specific logging
- Configuration builders and MCP client models
### Technical Details
- **Architecture**: Direct TCP socket server with customizable protocol handling
- **Performance**: Lightweight implementation focused on TCP networking
- **Compatibility**: Unity 2021.3+ with Newtonsoft.Json dependency
- **Protocol**: Basic TCP with welcome handshake (easily customizable)
### Migration Guide
This is a breaking change that removes all MCP functionality:
1. **Previous MCP Users**: This package no longer provides MCP integration
2. **TCP Socket Users**: Replace any `UnityTcpBridge` references with `UnityTcpBridge`
3. **Custom Protocols**: Implement your protocol logic in `HandleClientAsync` method
4. **Port Management**: Use `PortManager` for dynamic port allocation needs
### Development Notes
- Codebase reduced by ~80% by removing MCP complexity
- Focus shifted to providing a clean TCP socket foundation
- Easy to extend for custom networking protocols
- Maintains Unity Editor integration for automatic lifecycle management
## Previous Versions
Previous versions (1.x.x) included MCP (Model Context Protocol) integration which has been completely removed in this version.