backend-infra-engineer: Post v0.3.9-hotfix7 snapshot (build cleanup)
This commit is contained in:
@@ -1,4 +1,108 @@
|
||||
set(_YAZE_NEEDS_AGENT FALSE)
|
||||
|
||||
# Agent library is not compatible with Emscripten/WASM due to dependencies on:
|
||||
# - OpenSSL for HTTPS support
|
||||
# - Threading libraries that aren't fully compatible with WASM
|
||||
# - Network libraries that require native sockets
|
||||
# However, we can provide browser-based AI services using the Fetch API
|
||||
if(EMSCRIPTEN)
|
||||
# Create a minimal browser-based AI service library for WASM
|
||||
set(YAZE_BROWSER_AI_SOURCES
|
||||
cli/service/ai/browser_ai_service.cc
|
||||
cli/service/ai/ai_service.cc
|
||||
cli/service/ai/common.h
|
||||
cli/wasm_terminal_bridge.cc # Web terminal integration
|
||||
|
||||
# Minimal command infrastructure for WASM
|
||||
cli/flags.cc # Define flags for handlers
|
||||
cli/service/command_registry.cc
|
||||
cli/service/resources/command_handler.cc
|
||||
cli/service/resources/command_context.cc
|
||||
cli/service/resources/resource_catalog.cc
|
||||
cli/service/resources/resource_context_builder.cc
|
||||
|
||||
# Browser specific implementations
|
||||
cli/service/ai/service_factory_browser.cc
|
||||
cli/handlers/agent/browser_agent.cc
|
||||
cli/handlers/command_handlers_browser.cc
|
||||
|
||||
# Basic handlers that don't require native dependencies
|
||||
cli/handlers/game/dungeon_commands.cc
|
||||
cli/handlers/game/overworld_commands.cc
|
||||
cli/handlers/game/overworld_inspect.cc
|
||||
cli/handlers/graphics/gfx.cc
|
||||
cli/handlers/rom/rom_commands.cc
|
||||
cli/handlers/rom/mock_rom.cc
|
||||
cli/handlers/tools/resource_commands.cc
|
||||
cli/handlers/tools/test_helpers_commands.cc
|
||||
|
||||
# Explicitly supported handlers
|
||||
cli/handlers/graphics/hex_commands.cc
|
||||
cli/handlers/graphics/palette_commands.cc
|
||||
cli/handlers/agent/todo_commands.cc
|
||||
cli/service/agent/todo_manager.cc
|
||||
|
||||
# Proposal and Sandbox support (needed by yaze_editor)
|
||||
cli/service/planning/proposal_registry.cc
|
||||
cli/service/planning/tile16_proposal_generator.cc
|
||||
cli/service/rom/rom_sandbox_manager.cc
|
||||
# Core Agent Service (Critical for WASM Agent API)
|
||||
cli/service/agent/conversational_agent_service.cc
|
||||
cli/service/agent/tool_dispatcher.cc
|
||||
cli/service/agent/tool_registry.cc
|
||||
cli/service/agent/learned_knowledge_service.cc
|
||||
cli/service/agent/agent_pretraining.cc
|
||||
cli/service/agent/proposal_executor.cc
|
||||
|
||||
# Additional Handlers required by ToolDispatcher
|
||||
cli/handlers/game/message_commands.cc
|
||||
cli/handlers/game/dialogue_commands.cc
|
||||
cli/handlers/tools/gui_commands.cc
|
||||
cli/handlers/game/music_commands.cc
|
||||
cli/handlers/graphics/sprite_commands.cc
|
||||
cli/service/agent/tools/filesystem_tool.cc
|
||||
cli/service/agent/tools/memory_inspector_tool.cc
|
||||
cli/service/agent/tools/visual_analysis_tool.cc
|
||||
cli/service/agent/tools/code_gen_tool.cc
|
||||
cli/service/agent/tools/project_tool.cc
|
||||
cli/service/agent/tools/build_tool.cc
|
||||
cli/service/agent/tools/rom_diff_tool.cc
|
||||
cli/service/agent/tools/validation_tool.cc
|
||||
)
|
||||
|
||||
add_library(yaze_agent STATIC ${YAZE_BROWSER_AI_SOURCES})
|
||||
|
||||
target_link_libraries(yaze_agent PUBLIC
|
||||
yaze_common
|
||||
yaze_util
|
||||
yaze_app_core_lib # For Rom class and core functionality
|
||||
yaze_zelda3 # For game-specific structures
|
||||
${ABSL_TARGETS}
|
||||
)
|
||||
|
||||
# Link with the network abstraction layer for HTTP client
|
||||
if(TARGET yaze_net)
|
||||
target_link_libraries(yaze_agent PUBLIC yaze_net)
|
||||
endif()
|
||||
|
||||
# Add JSON support for API communication
|
||||
if(YAZE_ENABLE_JSON)
|
||||
target_include_directories(yaze_agent PUBLIC ${CMAKE_SOURCE_DIR}/ext/json/include)
|
||||
target_link_libraries(yaze_agent PUBLIC nlohmann_json::nlohmann_json)
|
||||
target_compile_definitions(yaze_agent PUBLIC YAZE_WITH_JSON)
|
||||
endif()
|
||||
|
||||
target_include_directories(yaze_agent PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
${CMAKE_SOURCE_DIR}/incl
|
||||
)
|
||||
|
||||
set_target_properties(yaze_agent PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
message(STATUS "yaze_agent configured for WASM with browser-based AI services")
|
||||
return()
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AGENT_CLI AND (YAZE_BUILD_CLI OR YAZE_BUILD_Z3ED))
|
||||
set(_YAZE_NEEDS_AGENT TRUE)
|
||||
endif()
|
||||
@@ -28,7 +132,6 @@ set(YAZE_AGENT_CORE_SOURCES
|
||||
cli/handlers/agent/todo_commands.cc
|
||||
cli/handlers/command_handlers.cc
|
||||
cli/handlers/game/dialogue_commands.cc
|
||||
cli/handlers/game/dungeon.cc
|
||||
cli/handlers/game/dungeon_commands.cc
|
||||
cli/handlers/game/message.cc
|
||||
cli/handlers/game/message_commands.cc
|
||||
@@ -45,8 +148,19 @@ set(YAZE_AGENT_CORE_SOURCES
|
||||
cli/handlers/rom/mock_rom.cc
|
||||
cli/handlers/rom/project_commands.cc
|
||||
cli/handlers/rom/rom_commands.cc
|
||||
cli/handlers/tools/dungeon_doctor_commands.cc
|
||||
cli/handlers/tools/gui_commands.cc
|
||||
cli/handlers/tools/overworld_doctor_commands.cc
|
||||
cli/handlers/tools/overworld_validate_commands.cc
|
||||
cli/handlers/tools/resource_commands.cc
|
||||
cli/handlers/tools/rom_compare_commands.cc
|
||||
cli/handlers/tools/rom_doctor_commands.cc
|
||||
cli/handlers/tools/message_doctor_commands.cc
|
||||
cli/handlers/tools/sprite_doctor_commands.cc
|
||||
cli/handlers/tools/graphics_doctor_commands.cc
|
||||
cli/handlers/tools/test_cli_commands.cc
|
||||
cli/handlers/tools/test_helpers_commands.cc
|
||||
cli/handlers/tools/hex_inspector_commands.cc
|
||||
cli/service/agent/conversational_agent_service.cc
|
||||
cli/service/agent/dev_assist_agent.cc
|
||||
cli/service/agent/enhanced_tui.cc
|
||||
@@ -55,9 +169,16 @@ set(YAZE_AGENT_CORE_SOURCES
|
||||
cli/service/agent/simple_chat_session.cc
|
||||
cli/service/agent/todo_manager.cc
|
||||
cli/service/agent/tool_dispatcher.cc
|
||||
cli/service/agent/tool_registration.cc
|
||||
cli/service/agent/tool_registry.cc
|
||||
cli/service/agent/tools/build_tool.cc
|
||||
cli/service/agent/tools/code_gen_tool.cc
|
||||
cli/service/agent/tools/filesystem_tool.cc
|
||||
cli/service/agent/tools/memory_inspector_tool.cc
|
||||
cli/service/agent/tools/project_tool.cc
|
||||
cli/service/agent/tools/rom_diff_tool.cc
|
||||
cli/service/agent/tools/validation_tool.cc
|
||||
cli/service/agent/tools/visual_analysis_tool.cc
|
||||
cli/service/agent/disassembler_65816.cc
|
||||
cli/service/agent/rom_debug_agent.cc
|
||||
cli/service/agent/vim_mode.cc
|
||||
@@ -81,9 +202,9 @@ set(YAZE_AGENT_CORE_SOURCES
|
||||
cli/service/api/http_server.cc
|
||||
cli/service/api/api_handlers.cc
|
||||
|
||||
# Advanced features
|
||||
# CommandHandler-based implementations
|
||||
# ROM commands
|
||||
app/editor/agent/agent_chat.cc # New unified chat component
|
||||
app/editor/agent/agent_editor.cc
|
||||
app/editor/agent/panels/agent_editor_panels.cc
|
||||
)
|
||||
|
||||
# AI runtime sources
|
||||
@@ -94,6 +215,7 @@ if(YAZE_ENABLE_AI_RUNTIME)
|
||||
cli/service/ai/ai_action_parser.cc
|
||||
cli/service/ai/ai_gui_controller.cc
|
||||
cli/service/ai/ollama_ai_service.cc
|
||||
cli/service/ai/local_gemini_cli_service.cc
|
||||
cli/service/ai/prompt_builder.cc
|
||||
cli/service/ai/service_factory.cc
|
||||
cli/service/ai/vision_action_refiner.cc
|
||||
@@ -113,12 +235,17 @@ if(YAZE_ENABLE_REMOTE_AUTOMATION)
|
||||
cli/service/agent/emulator_service_impl.cc
|
||||
cli/handlers/tools/emulator_commands.cc
|
||||
cli/service/gui/gui_automation_client.cc
|
||||
cli/service/gui/canvas_automation_client.cc
|
||||
cli/service/planning/tile16_proposal_generator.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME AND YAZE_ENABLE_JSON)
|
||||
list(APPEND YAZE_AGENT_SOURCES cli/service/ai/gemini_ai_service.cc)
|
||||
list(APPEND YAZE_AGENT_SOURCES
|
||||
cli/service/ai/gemini_ai_service.cc
|
||||
cli/service/ai/openai_ai_service.cc
|
||||
cli/service/ai/anthropic_ai_service.cc
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(yaze_agent STATIC ${YAZE_AGENT_SOURCES})
|
||||
@@ -132,17 +259,44 @@ set(_yaze_agent_link_targets
|
||||
yaze_zelda3
|
||||
yaze_emulator
|
||||
${ABSL_TARGETS}
|
||||
ftxui::screen
|
||||
ftxui::dom
|
||||
ftxui::component
|
||||
)
|
||||
|
||||
# Only include ftxui targets if CLI is being built
|
||||
# ftxui is not available in WASM/Emscripten builds
|
||||
if(YAZE_BUILD_CLI AND NOT EMSCRIPTEN)
|
||||
list(APPEND _yaze_agent_link_targets
|
||||
ftxui::screen
|
||||
ftxui::dom
|
||||
ftxui::component
|
||||
)
|
||||
endif()
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME)
|
||||
list(APPEND _yaze_agent_link_targets yaml-cpp)
|
||||
# Prefer the consolidated yaml target so include paths propagate consistently
|
||||
if(DEFINED YAZE_YAML_TARGETS AND NOT "${YAZE_YAML_TARGETS}" STREQUAL "")
|
||||
list(APPEND _yaze_agent_link_targets ${YAZE_YAML_TARGETS})
|
||||
else()
|
||||
# Fallback in case dependency setup changes
|
||||
list(APPEND _yaze_agent_link_targets yaml-cpp)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
target_link_libraries(yaze_agent PUBLIC ${_yaze_agent_link_targets})
|
||||
|
||||
# Ensure yaml-cpp include paths propagate even when using system packages
|
||||
if(YAZE_ENABLE_AI_RUNTIME)
|
||||
set(_yaml_targets_to_check ${YAZE_YAML_TARGETS} yaml-cpp yaml-cpp::yaml-cpp)
|
||||
foreach(_yaml_target IN LISTS _yaml_targets_to_check)
|
||||
if(TARGET ${_yaml_target})
|
||||
get_target_property(_yaml_inc ${_yaml_target} INTERFACE_INCLUDE_DIRECTORIES)
|
||||
if(_yaml_inc)
|
||||
target_include_directories(yaze_agent PUBLIC ${_yaml_inc})
|
||||
break()
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
target_include_directories(yaze_agent
|
||||
PUBLIC
|
||||
${CMAKE_SOURCE_DIR}/src
|
||||
@@ -150,6 +304,7 @@ target_include_directories(yaze_agent
|
||||
${CMAKE_SOURCE_DIR}/ext/httplib
|
||||
${CMAKE_SOURCE_DIR}/src/lib
|
||||
${CMAKE_SOURCE_DIR}/src/cli/handlers
|
||||
${CMAKE_BINARY_DIR}/gens
|
||||
)
|
||||
|
||||
if(YAZE_ENABLE_AI_RUNTIME AND YAZE_ENABLE_JSON)
|
||||
@@ -205,11 +360,26 @@ if(YAZE_ENABLE_REMOTE_AUTOMATION)
|
||||
# Link to consolidated gRPC support library
|
||||
target_link_libraries(yaze_agent PUBLIC yaze_grpc_support)
|
||||
|
||||
# Ensure proto files are generated before yaze_agent compiles
|
||||
# yaze_proto_gen is an OBJECT library that generates the proto headers
|
||||
# This breaks the dependency cycle by separating proto generation from yaze_grpc_support
|
||||
if(TARGET yaze_proto_gen)
|
||||
add_dependencies(yaze_agent yaze_proto_gen)
|
||||
target_include_directories(yaze_agent PUBLIC ${CMAKE_BINARY_DIR}/gens)
|
||||
endif()
|
||||
|
||||
# Note: YAZE_WITH_GRPC is defined globally via add_compile_definitions in options.cmake
|
||||
# This ensures #ifdef YAZE_WITH_GRPC works in all translation units
|
||||
message(STATUS "✓ gRPC GUI automation enabled for yaze_agent")
|
||||
endif()
|
||||
|
||||
# Add OpenCV support for advanced visual analysis
|
||||
if(YAZE_ENABLE_OPENCV AND OpenCV_FOUND)
|
||||
target_link_libraries(yaze_agent PUBLIC ${OpenCV_LIBS})
|
||||
target_include_directories(yaze_agent PUBLIC ${OpenCV_INCLUDE_DIRS})
|
||||
message(STATUS "✓ OpenCV visual analysis enabled for yaze_agent")
|
||||
endif()
|
||||
|
||||
# NOTE: yaze_agent should NOT link to yaze_test_support to avoid circular dependency.
|
||||
# The circular force-load chain (yaze_test_support -> yaze_agent -> yaze_test_support)
|
||||
# causes SIGSEGV during static initialization due to duplicate symbols and SIOF.
|
||||
|
||||
Reference in New Issue
Block a user