Skip to content

Architecture Overview

Dalang follows a modular, layered architecture designed for extensibility and security.

High-Level Architecture

┌─────────────────────────────────────────────────────────────┐
│                        CLI (clap)                           │
│              init │ login │ scan │ interact                 │
├─────────────────────────────────────────────────────────────┤
│                     Core Engine                             │
│  ┌──────────────┐  ┌────────────┐  ┌──────────────────┐    │
│  │ ReAct Loop   │  │ Context    │  │ Safety Filter    │    │
│  │ (Orchestrate)│  │ Memory     │  │ (Refusal Detect) │    │
│  └──────┬───────┘  └────────────┘  └──────────────────┘    │
│         │                                                   │
│    ┌────┴────────────────────────────────────────────┐      │
│    │              Tool Dispatcher                     │     │
│    │  ┌─────────┐  ┌──────────┐  ┌───────────────┐  │     │
│    │  │ os-cmd  │  │ browser-*│  │ execute_skill │  │     │
│    │  └────┬────┘  └────┬─────┘  └───────┬───────┘  │     │
│    └───────┼────────────┼────────────────┼──────────┘      │
├────────────┼────────────┼────────────────┼──────────────────┤
│  ┌─────────┴───┐ ┌──────┴──────┐ ┌──────┴──────────┐      │
│  │  Executor   │ │ CDP Browser │ │ Skills Parser   │      │
│  │  (Safe Cmd) │ │ (Chromium)  │ │ (YAML+Markdown) │      │
│  └─────────────┘ └─────────────┘ └─────────────────┘      │
├─────────────────────────────────────────────────────────────┤
│  ┌──────────────────┐  ┌────────────────────────────┐      │
│  │  LLM Provider    │  │  Auth                      │      │
│  │  (OpenAI compat) │  │  OAuth │ API Key │ Keyring │      │
│  └──────────────────┘  └────────────────────────────┘      │
└─────────────────────────────────────────────────────────────┘

Module Breakdown

ModulePathPurpose
CLIsrc/cli.rsArgument parsing with clap
Core Enginesrc/core/engine.rsReAct orchestration, tool dispatch
Context Memorysrc/core/memory.rsPersistent observation tracking
Safetysrc/core/safety.rsAI refusal detection, argument sanitization
Tool Call Parsersrc/core/tool_call.rsJSON tool call extraction from LLM output
LLM Providersrc/llm/OpenAI-compatible API abstraction
CDP Browsersrc/cdp/browser.rsChromium DevTools Protocol integration
Executorsrc/executor/mod.rsSecure OS command runner
Skills Parsersrc/skills_parser/mod.rsMarkdown frontmatter parser
Authsrc/auth/OAuth, CLI extraction, keyring persistence

Technology Stack

LayerTechnology
LanguageRust (2024 Edition)
Async RuntimeTokio
HTTP ClientReqwest
CLI FrameworkClap
Browser AutomationChromiumoxide (CDP)
Credential StorageKeyring
SerializationSerde (JSON + YAML)

Released under the MIT License.