Skip to content

Latest commit

 

History

History
44 lines (32 loc) · 1.51 KB

File metadata and controls

44 lines (32 loc) · 1.51 KB

DeepSeek Code Architecture

High-level modules

  • src/core: shared types + config loading
  • src/provider: DeepSeek API adapter
  • src/agent: agent orchestration + streaming loop
  • src/tool: built-in local tools (Read/Edit/Bash/etc.)
  • src/tui: terminal UI (Ink), command picker, status panels

Execution flow

  1. src/index.tsx loads config and starts the Ink app.
  2. App.tsx manages runtime state (model, agent, thinking).
  3. On submit, agentManager.createAgent() creates an Agent.
  4. Agent.run() streams events:
    • text deltas
    • thinking deltas
    • tool call start/result
    • finish/error
  5. App consumes events and updates TUI.

Provider flow

  1. ProviderConfig is built from mutable runtime state.
  2. createModel(config) creates an AI SDK LanguageModel via DeepSeek's OpenAI-compatible endpoint.
  3. The adapter handles authentication and request formatting.

This keeps provider-specific code out of the agent and UI.

MCP flow (current)

  1. Config parser loads mcpServers from .deepseek-code.json.
  2. App tracks MCP server enabled/disabled state.
  3. /mcp commands expose status and toggling.

Protocol-level MCP tool execution is planned, not fully wired yet.

Why this structure scales

  • Provider is adapter-driven (currently DeepSeek only).
  • UI commands are centralized in App.tsx.
  • Tooling layer is independent from provider layer.
  • MCP can be added as a new integration layer without touching provider adapters.