DEEPSEEK HARNESS · OFFLINE TUTORIAL
附录 · Cheat Sheet
术语、九问法、源码入口
一页纸 Cheat Sheet
DeepSeek Harness
================
哲学
----
Everything is a Plugin
Cordis
------
Plugin / Context / Service
inject / Effect / Event / Scope
Composition
-----------
Profile / Bundle / Patch / Plugin Tree
Core
----
ctx.sessions
ctx.systemPrompt
ctx.tools
ctx.agents
ctx.agentLoop
ctx.llm
Agent
-----
Inbox → Turn → Step → Prompt+History+Tools
→ LLM → Assistant → Tools → next Step? → Turn end
Session
-------
Append-only SessionEvent Log
→ Surface
→ deriveMessages()
事件域
------
SessionEvent = durable facts
agent/* = live execution
capability/* = capability policy/interception
Tool
----
pre → guards → execute → body → post → finalize → result
Seam
----
Definition + Provider + Consumer (+ Policy via events)
Persistence
-----------
SessionEvent → persistence seam → backend
Compaction
----------
Never rewrite truth
Raw log → Surface replacement → summary + recent tail
术语速查
| 术语 | 解释 |
|---|---|
| Context | 当前 scope 下的 Service Repository |
| Provider | 某个能力接口的具体实现 |
| Consumer | 只依赖接口使用能力的模块 |
| Waterfall | 可修改、包裹、短路的中间件链 |
| SessionEvent | append-only durable fact |
| Surface | 模型视角的历史投影 |
| Step | 一次模型请求 + 工具工作 |
| Turn | 围绕首输入展开的多个 Step |
| Capability Seam | Definition / Provider / Consumer 的可替换边界 |
关键源码入口
docs/architecture.zh.md
docs/cordis-primer.md
packages/core/session/
packages/core/system-prompt/
packages/core/tools/
packages/core/agent/
packages/core/agent-loop/
packages/core/scope/
packages/llm/llm/
packages/fs/
packages/session/
packages/compaction/
官方资料
环境命令
git clone https://github.com/deepseek-ai/deepseek-harness.git
cd deepseek-harness
git rev-parse HEAD
pnpm install
pnpm run build
pnpm dsh web
pnpm dsh --profile web --dump-config