Refactor to plugin architecture with B3 CLI UX, C2 smoke tests, C3 CI scripts
Architecture overhaul (Wave 1-4 collaborative work): - Migrated dstalk-core from monolithic api.cpp to plugin-based design with host/service_registry/event_bus/plugin_loader and topological initialization. - Split public headers into dstalk_host.h / dstalk_services.h / dstalk_lsp.h / dstalk_types.h; deleted obsolete dstalk_api.h and inlined TLS/file/net code now provided by plugins. - Added 9 plugins: deepseek, anthropic, network, session, context, tools, config, file-io, lsp; AI plugins register as "ai.<provider>" services. B3 CLI interaction enhancement: - Prompt now shows current model name (A1). - /status command prints model/base_url/api_key (sanitized: shown only as set/unset)/services readiness (A2). - SIGINT/Ctrl+C handled on POSIX (signal) and Windows (SetConsoleCtrlHandler); /quit no longer std::exit(0) but sets a quit flag so dstalk_shutdown runs exactly once via natural control flow (B1+B2). - Cross-DLL free fixed: print_file uses dstalk_free instead of std::free (B4). - --batch mode plus isatty auto-detection for piped stdin (C1). - fgets truncation detection with friendly error and stdin draining (C3). - Distinct exit codes (init/AI/service-unavailable) (C4). - /model rejects empty model name (C5). C2 smoke test extension: - 4 new test blocks: null-safety (file_io/session/tools/config), escape-boundary round-trip, tools->execute call chain, session robustness (add(nullptr), clear -> token_count == 0). C3 CI build scripts: - scripts/ci-build.sh and scripts/ci-build.bat invoke cmake configure + parallel build + ctest, suitable for GitHub Actions. Build verified: dstalk-cli compiles, smoke test passes via ctest. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,16 +1,17 @@
|
||||
# ============================================================
|
||||
# dstalk-core — 核心 DLL
|
||||
# 包含: 网络通讯 / AI接口 / 文件读写
|
||||
# dstalk-core — 核心 DLL (插件宿主)
|
||||
# 包含: 插件管理 / 服务注册 / 事件总线 / 配置存储
|
||||
# ============================================================
|
||||
|
||||
find_package(Boost REQUIRED CONFIG)
|
||||
find_package(OpenSSL REQUIRED CONFIG)
|
||||
|
||||
add_library(dstalk SHARED
|
||||
src/api.cpp
|
||||
src/file/file_io.cpp
|
||||
src/net/http_client.cpp
|
||||
src/ai/deepseek_api.cpp
|
||||
src/host.cpp
|
||||
src/config_store.cpp
|
||||
src/event_bus.cpp
|
||||
src/service_registry.cpp
|
||||
src/plugin_loader.cpp
|
||||
src/boost_json.cpp
|
||||
)
|
||||
|
||||
@@ -25,6 +26,11 @@ target_link_libraries(dstalk
|
||||
openssl::openssl
|
||||
)
|
||||
|
||||
# dlopen / dlclose / dlsym on Linux and macOS
|
||||
if(NOT WIN32)
|
||||
target_link_libraries(dstalk PRIVATE ${CMAKE_DL_LIBS})
|
||||
endif()
|
||||
|
||||
# 导出 DLL 符号宏
|
||||
target_compile_definitions(dstalk
|
||||
PRIVATE
|
||||
|
||||
Reference in New Issue
Block a user