Files
dstalk/README.md
XiuChengWu 8faa02c3d5 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>
2026-05-31 16:58:25 +08:00

5.0 KiB

dstalk

AI 编程 CLI —— 基于 DeepSeek V4, 兼容 OpenAI / Anthropic API

官网: dstalk.top


这是什么?

dstalk 是一款 AI 编程助手命令行工具, 通过调用大模型在终端里完成代码编写、重构、调试和文件操作。

核心设计为 插件化 CDLL + 多前端解耦:

┌───────────────────────────────────────────────────────────┐
│                    前端层 (Frontends)                       │
│  ┌──────────────────┐      ┌──────────────────────────┐   │
│  │  dstalk_cli      │      │  dstalk_gui               │   │
│  │  ANSI 终端 UI    │      │  SDL3 图形化 UI            │   │
│  └────────┬─────────┘      └─────────────┬─────────────┘   │
│           └──────────────┬───────────────┘                 │
│                          │ C ABI                           │
└──────────────────────────┼─────────────────────────────────┘
                           │
┌──────────────────────────▼─────────────────────────────────┐
│           核心层 (dstalk_core.dll) — 插件宿主               │
│  ┌──────────────────────────────────────────────────────┐  │
│  │  Host: 插件加载 · 服务注册 · 事件总线 · 配置管理       │  │
│  └──────────────────────────────────────────────────────┘  │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐  │
│  │  openai  │ │ anthropic│ │ network  │ │    lsp       │  │
│  │ (ai)     │ │ (ai)     │ │ (http)   │ │   客户端     │  │
│  └──────────┘ └──────────┘ └──────────┘ └──────────────┘  │
│  ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────┐  │
│  │ session  │ │ context  │ │ file_io  │ │    tools     │  │
│  └──────────┘ └──────────┘ └──────────┘ └──────────────┘  │
└─────────────────────────────────────────────────────────────┘
  • dstalk_core —— C11/C++20 插件化宿主 DLL, 负责插件加载、服务注册、事件总线、配置管理
  • dstalk_cli —— 命令行前端, ANSI 终端 UI
  • dstalk_gui —— 图形化前端, SDL3 跨平台窗口
  • plugins_base/、plugins_middle/、plugins_upper/ —— 9 个功能插件按三层架构分布, 编译为独立 DLL, 通过 C ABI 动态注册服务

核心与界面完全解耦, 可编写自己的前端或把 AI 能力嵌入到现有工具中。


支持的 AI 模型

提供商 模型 插件
OpenAI-compatible gpt-4o ai_openai
Anthropic claude-opus-4 ai_anthropic
OpenAI 兼容 GPT 系列 ai_openai

通过 config.tomlai.provider 一键切换。


快速开始

平台 安装工具链 编译 运行
Windows cd tools && setup.bat build.bat build\bin\dstalk_cli.exe
Mac / Linux cd tools && bash setup.sh bash build.sh build/bin/dstalk_cli
# 3. 创建 config.toml    # 见教程: docs/tutorial/quick-start.md
# 4. 运行 (路径见上表)
# 5. 输入自然语言        # "帮我写一个 C 程序"

详细 5 步教程 (含 config.toml 模板与对话示例): docs/tutorial/quick-start.md


文档

文档 说明
教程: 快速入门 5 步上手, 从安装到第一个对话
参考: CLI 命令 完整命令速查表
文档导航 全部文档索引与未来计划

许可证

GNU General Public License v3. Copyright (c) 2026 dstalk contributors.


dstalk.top | GitHub