W17: extract ai_common shared module + fix anthropic data race + brace bugs
- New plugins_upper/ai_common/ static library: shared PluginConfig, ToolCallAccum, StreamContext, secure_zero, extract_host_port, serialize_tool_calls, free_chat_result - Refactored openai/anthropic plugins to use dstalk_ai:: namespace from ai_common - Fixed anthropic g_config raw pointer → std::atomic (data race) - Added SSE parse error counter with threshold abort (kMaxSseParseErrors=5) - Fixed missing closing brace in both plugins' error-body catch block - Updated test targets: ai_common include path + link, using namespace dstalk_ai - plugin_loader_test: added stub_unreg + service_registry.cpp for unregister_service - Includes pre-existing uncommitted changes from prior waves Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,27 +1,27 @@
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
|
||||
# ============================================================
|
||||
# plugin-lsp — LSP (Language Server Protocol) 服务
|
||||
# plugin_lsp — LSP (Language Server Protocol) 服务
|
||||
# 自行管理子进程,无外部服务依赖
|
||||
# ============================================================
|
||||
|
||||
add_library(plugin-lsp SHARED
|
||||
add_library(plugin_lsp SHARED
|
||||
src/lsp_plugin.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(plugin-lsp PRIVATE dstalk)
|
||||
target_link_libraries(plugin_lsp PRIVATE dstalk)
|
||||
|
||||
# Boost.JSON 用于 JSON-RPC 消息构建/解析
|
||||
find_package(Boost REQUIRED CONFIG)
|
||||
target_link_libraries(plugin-lsp PRIVATE boost::boost dstalk_boost_config)
|
||||
target_link_libraries(plugin_lsp PRIVATE boost::boost dstalk_boost_config)
|
||||
|
||||
# POSIX 平台需要 pthread (用于 std::thread)
|
||||
if(NOT WIN32)
|
||||
find_package(Threads REQUIRED)
|
||||
target_link_libraries(plugin-lsp PRIVATE Threads::Threads)
|
||||
target_link_libraries(plugin_lsp PRIVATE Threads::Threads)
|
||||
endif()
|
||||
|
||||
set_target_properties(plugin-lsp PROPERTIES
|
||||
set_target_properties(plugin_lsp PROPERTIES
|
||||
PREFIX ""
|
||||
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/plugins"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright (c) 2026 dstalk contributors. GPLv3.
|
||||
*/
|
||||
|
||||
// plugin-lsp — LSP (Language Server Protocol) 服务 / LSP (Language Server Protocol) service
|
||||
// plugin_lsp — LSP (Language Server Protocol) 服务 / LSP (Language Server Protocol) service
|
||||
//
|
||||
// 自行管理语言服务器子进程,使用 JSON-RPC 2.0 over stdio 通信 / Self-manages language server subprocess, communicates via JSON-RPC 2.0 over stdio.
|
||||
// 无外部服务依赖(不依赖 http/config 等其他插件) / No external service dependencies (does not depend on http/config or other plugins).
|
||||
|
||||
Reference in New Issue
Block a user