mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
f387b774a9a84d992bb73db6b1db984f971343c3
Every live agent owns a dsh-scope context (Agent.ctx, key = the agent), minted inside the loop's composite lifecycle effect: registrations through it are agent-visible and agent-lifetime, and agent.ctx listeners hear only that agent's dispatches. The composite yields the scope's raw disposer first (identity-nested, no un-nested window), then session entry (scoped enter captures the session carrier), then registration; teardown runs stop/drain -> unregister -> detach session -> unwind scope, keeping store/registry rollback synchronous on every failure path. CreateAgentOptions.setup(agentCtx) runs after the scope is minted and the agent registered, before agent/session-start and the loop start — the slot where a creator composes the agent's scoped world (persona sections, restrict(), scoped tools); a throwing setup unwinds inside the rollback boundary. Setup registers, it never drives. agentEvents(ctx, agent) fuses the scope carrier with the injected subject argument for every agent/* dispatch (the correct dispatch is the shortest spelling); assembleContextFor(agent) pairs the agent DX field with the scope layer selector. All loop/agent/registry dispatch sites converted; agent/* event declarations carry this: Scoped<Agent>; ctx.agent is a safe root accessor defaulting undefined, shadowed by each agent context.
DeepSeek Harness
English | 中文
The DeepSeek Harness SDK is a plugin-based SDK for building agent harnesses.
Development
This monorepo is built on the Cordis framework (vendored as source under vendor/), microkernel-style: everything is a plugin.
pnpm install
pnpm run test # vitest
pnpm run demo:repl # REPL agent demo (needs DEEPSEEK_API_KEY)
pnpm run demo:acp # ACP server agent demo (needs DEEPSEEK_API_KEY)
For humans, start with the development guide for local setup, hooks, environment variables, and quality gates, then read the architecture design and documentation graph index before package work. Local context lives in packages/ and vendor/.
For agents, follow AGENTS.md.
Languages
TypeScript
97%
CSS
1.6%
Python
0.7%
JavaScript
0.6%