Skip to content

Architecture Layers

YarCraSy edited this page Jul 8, 2026 · 2 revisions

Previous page: Dependency Rules

Layers

src/adapters

Contains shared types and stable contracts:

  • chat.ts: chat messages, request/response types, streaming chunks, and system prompt helpers.
  • config.ts: AppConfig, defaults, and DeepSeek-only configuration types.
  • message.ts: webview-handler contract.
  • models.ts: DeepSeek models and reasoning options.

This layer must not depend on React, VS Code, or HTTP.

src/core

Contains pure tool logic:

  • tool registry.
  • execution and validation.
  • danger analysis.
  • ToolWorkspace interface for workspace access without importing vscode.

Main rule: core must not import vscode.

src/deepseekApi

Contains DeepSeek integration:

  • DeepSeek provider.
  • chat/FIM requests.
  • SSE streaming.
  • tool-call requests and parsing.
  • API types and errors.

It should not contain UI logic or direct VS Code manipulation.

src/infrastructure

Contains technical persistence:

  • SettingsManager: global extension settings.
  • SecretsManager: API key in SecretStorage.
  • HistoryManager: conversations in globalState.

src/vscodeApi

Contains concrete VS Code adapters:

  • activation and commands.
  • WebviewProvider.
  • DropZoneProvider.
  • message handlers.
  • filesystem/workspace/terminal implementation for tools.

src/ui/chat

Contains the React webview:

  • Chat, History, and Settings views.
  • messaging hooks.
  • rendering for streaming, tool results, and confirmations.
  • Vite build to dist/webview.

Next page: Runtime Flow

Clone this wiki locally