feat: Add LSP plugin unit tests and frontend common initialization library
Some checks failed
Some checks failed
- Introduced `dstalk_lsp_plugin_test` for testing LSP plugin functionalities including `lsp_trim`, `lsp_frame_message`, and `lsp_parse_content_length`. - Created `dstalk_frontend_common` static library to encapsulate shared initialization logic for frontend components (CLI, GUI, Web). - Implemented configuration file discovery and service querying in `dstalk_frontend_init`. - Added internal headers for LSP and Anthropic plugins to facilitate unit testing. - Established a mailroom system for asynchronous message passing between stateless agents, enhancing coordination and context management.
This commit is contained in:
46
plugins_upper/anthropic/src/anthropic_internal.hpp
Normal file
46
plugins_upper/anthropic/src/anthropic_internal.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
// ============================================================================
|
||||
// anthropic_internal.hpp — 内部声明:供单元测试访问的函数与数据结构
|
||||
// ============================================================================
|
||||
// 仅在 tests 中使用;非 plugin 公共 API
|
||||
// ============================================================================
|
||||
|
||||
#ifndef ANTHROPIC_INTERNAL_HPP
|
||||
#define ANTHROPIC_INTERNAL_HPP
|
||||
|
||||
#include "dstalk/dstalk_host.h"
|
||||
#include "dstalk/dstalk_services.h"
|
||||
|
||||
#include "ai_common.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// ---- 从 dstalk_ai 命名空间导入共享类型与函数 ----
|
||||
using dstalk_ai::PluginConfig;
|
||||
using dstalk_ai::ToolCallAccum;
|
||||
using dstalk_ai::StreamContext;
|
||||
using dstalk_ai::secure_zero;
|
||||
using dstalk_ai::extract_host_port;
|
||||
|
||||
// ---- 全局变量 ----
|
||||
extern PluginConfig g_cfg;
|
||||
extern std::string g_tools_json;
|
||||
|
||||
// ---- 测试用函数声明 ----
|
||||
bool parse_sse_data(const std::string& data, std::string& token_out,
|
||||
StreamContext* ctx);
|
||||
|
||||
std::string build_request_json(const dstalk_message_t* history, int history_len,
|
||||
const std::string& user_input,
|
||||
const std::string& tools_json,
|
||||
bool stream);
|
||||
|
||||
std::string build_headers_json();
|
||||
|
||||
void my_free_result(dstalk_chat_result_t* result);
|
||||
|
||||
int my_configure(const char* provider, const char* base_url,
|
||||
const char* api_key, const char* model,
|
||||
int max_tokens, double temperature);
|
||||
|
||||
#endif // ANTHROPIC_INTERNAL_HPP
|
||||
Reference in New Issue
Block a user