Wave 5 (9 parallel agents): - W1.1 atomic diag callback + DLL handle release on shutdown (lin) - W2.1 unify cross-DLL heap discipline (host->alloc/free/strdup) (chen) - W2.2 secure_zero api_key on shutdown for deepseek/anthropic (cao) - W3 CMake modernization: target-based cxx_std_20, dstalk_boost_config INTERFACE lib, root-level RUNTIME_OUTPUT_DIRECTORY (hu) - W4 GitHub Actions CI with dynamic Linux/Windows matrix (ma) - W5.1 SSE buffer_body to cut peak memory ~67% on 32K streams (zhou) - W6.1 LSP JSON-RPC frame parser hardened against header reordering (sun) - W7 smoke test: copy plugin DLLs post-build + Boost.JSON src.hpp fix for full 9-plugin load coverage (wang) - W8.1 README slimmed 398->92, Diataxis docs/ skeleton (deng) Wave 6 (6 parallel agents): - W9.1 docs/explanation: architecture + plugin-lifecycle (deng) - W9.3 log credential leak audit (0 vulns, audit trail in docs/explanation/security-logging.md) (cao) - W9.4 docs/reference/plugin-abi.md - 7-point ABI contract (lin) - W9.6 CLI /history command + status integration (zhao) - W9.8 plugin_loader fault tolerance: per-plugin failure no longer aborts dstalk_init (huang) - W9.10 host_api unit tests: tests/host_api_test.cpp, 8 cases (liu) CEO oversight (preexisting bugs fixed during Wave 5 verification): - lsp_plugin.cpp:449 forward decl mismatch (int vs void) - tools_plugin.cpp:109 missing forward decl Multi-agent collaboration framework: - agents/WORKFLOW.md: 6-stage protocol, two-tier governance, prompt template, technical constraints registry Build: cmake --build 0 error / 0 warning. Tests: 2/2 100% pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
141 lines
3.3 KiB
Markdown
141 lines
3.3 KiB
Markdown
# 快速入门
|
||
|
||
5 步上手 dstalk, 从安装工具链到完成第一个 AI 对话。
|
||
|
||
---
|
||
|
||
## 1. 安装工具链
|
||
|
||
dstalk 需要 CMake、Ninja、LLVM/Clang 和 Conan2。`setup.bat` 全自动下载安装到 `tools/` 目录。
|
||
|
||
```bash
|
||
cd tools
|
||
setup.bat
|
||
```
|
||
|
||
> **前提**: 系统需已安装 Python 3.10+。
|
||
>
|
||
> 网络不畅时, 可手动下载放入对应目录:
|
||
> - [Ninja](https://github.com/ninja-build/ninja/releases) → `tools/ninja/ninja.exe`
|
||
> - [CMake](https://cmake.org/download/) → `tools/cmake/bin/cmake.exe`
|
||
> - [LLVM](https://github.com/llvm/llvm-project/releases) → `tools/llvm/bin/clang.exe`
|
||
> - Conan2 通过 pip 安装到 `tools/.venv/Scripts/conan.exe`
|
||
|
||
---
|
||
|
||
## 2. 编译
|
||
|
||
项目根目录提供 `build.bat`, 一键完成: Conan 拉取依赖 -> CMake 配置 -> Ninja 编译。
|
||
|
||
```bash
|
||
build.bat
|
||
```
|
||
|
||
编译产物输出到 `build/` 目录。核心产物:
|
||
- `build/dstalk-core/dstalk.dll` —— 核心 DLL
|
||
- `build/dstalk-cli/dstalk-cli.exe` —— 命令行前端
|
||
- `build/plugins/*.dll` —— 功能插件
|
||
|
||
---
|
||
|
||
## 3. 创建 config.toml
|
||
|
||
在项目根目录创建 `config.toml`, 配置 AI 后端和 API Key。
|
||
|
||
```bash
|
||
# 在项目根目录手动创建 config.toml
|
||
```
|
||
|
||
**config.toml 示例:**
|
||
|
||
```toml
|
||
# 选择 AI 后端插件: ai.deepseek 或 ai.anthropic
|
||
ai.provider = "ai.deepseek"
|
||
|
||
# DeepSeek
|
||
api.base_url = "https://api.deepseek.com/v1"
|
||
api.api_key = "sk-xxxxxxxx"
|
||
api.model = "deepseek-v4-pro"
|
||
|
||
# Anthropic Claude (切换 ai.provider 为 "ai.anthropic" 即可)
|
||
# api.base_url = "https://api.anthropic.com/v1"
|
||
# api.api_key = "sk-ant-xxxxxxxx"
|
||
# api.model = "claude-opus-4-20250514"
|
||
```
|
||
|
||
> **关键**: 修改 `ai.provider` 字段即可在不同后端间切换, 无需改动代码。
|
||
>
|
||
> API Key 可从 [DeepSeek 开放平台](https://platform.deepseek.com/) 或 [Anthropic Console](https://console.anthropic.com/) 获取。
|
||
|
||
---
|
||
|
||
## 4. 运行 dstalk-cli
|
||
|
||
```bash
|
||
build/dstalk-cli/dstalk-cli.exe
|
||
```
|
||
|
||
启动后显示欢迎横幅:
|
||
|
||
```text
|
||
dstalk v0.1.0 | dstalk AI | /help 查看帮助 | /quit 退出
|
||
|
||
[deepseek-v4-pro] >
|
||
```
|
||
|
||
> 图形模式默认关闭。需要 SDL3 GUI 时, 用 `-DDSTALK_BUILD_GUI=ON` 重新配置 CMake。
|
||
|
||
---
|
||
|
||
## 5. 第一个对话
|
||
|
||
在提示符 `>` 后输入自然语言, 即可与 AI 对话。
|
||
|
||
```text
|
||
[deepseek-v4-pro] > 帮我写一个读取 CSV 并计算平均值的 C 程序
|
||
|
||
[dstalk] 正在思考...
|
||
|
||
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
|
||
int main(int argc, char *argv[]) {
|
||
if (argc < 2) {
|
||
fprintf(stderr, "用法: %s <csv文件>\n", argv[0]);
|
||
return 1;
|
||
}
|
||
FILE *fp = fopen(argv[1], "r");
|
||
if (!fp) { perror("fopen"); return 1; }
|
||
|
||
double sum = 0.0;
|
||
int count = 0;
|
||
char line[1024];
|
||
while (fgets(line, sizeof(line), fp)) {
|
||
sum += atof(line);
|
||
count++;
|
||
}
|
||
fclose(fp);
|
||
|
||
printf("平均值: %.2f (共 %d 行)\n", sum / count, count);
|
||
return 0;
|
||
}
|
||
|
||
已写入 csv_avg.c。需要我帮你编译测试吗?
|
||
|
||
[deepseek-v4-pro] > 把这段代码改成支持表头的
|
||
|
||
[dstalk] 已更新 csv_avg.c——跳过第一行表头, 增加列选择功能。
|
||
|
||
[deepseek-v4-pro] > /file show csv_avg.c
|
||
|
||
[dstalk] 已显示 csv_avg.c 内容。
|
||
```
|
||
|
||
---
|
||
|
||
## 下一步
|
||
|
||
- 查看 [CLI 命令速查表](../reference/commands.md) 了解全部命令
|
||
- 输入 `/help` 在 dstalk 内查看命令列表
|
||
- 输入 `/status` 查看当前运行状态
|