Files
dao-os-docs/zh/concepts/core_architecture.html
2025-06-12 01:46:45 +00:00

255 lines
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE HTML>
<html lang="en" class="light sidebar-visible" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>核心架构 - 大道 (Dao OS) 文档</title>
<!-- Custom HTML head -->
<meta name="description" content="大道Dao OS官方文档你的赛博生命操作系统。">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="icon" href="../favicon.svg">
<link rel="shortcut icon" href="../favicon.png">
<link rel="stylesheet" href="../css/variables.css">
<link rel="stylesheet" href="../css/general.css">
<link rel="stylesheet" href="../css/chrome.css">
<link rel="stylesheet" href="../css/print.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="../FontAwesome/css/font-awesome.css">
<link rel="stylesheet" href="../fonts/fonts.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" id="highlight-css" href="../highlight.css">
<link rel="stylesheet" id="tomorrow-night-css" href="../tomorrow-night.css">
<link rel="stylesheet" id="ayu-highlight-css" href="../ayu-highlight.css">
<!-- Custom theme stylesheets -->
<!-- Provide site root and default themes to javascript -->
<script>
const path_to_root = "../";
const default_light_theme = "light";
const default_dark_theme = "navy";
</script>
<!-- Start loading toc.js asap -->
<script src="../toc.js"></script>
</head>
<body>
<div id="mdbook-help-container">
<div id="mdbook-help-popup">
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
<div>
<p>Press <kbd></kbd> or <kbd></kbd> to navigate between chapters</p>
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
<p>Press <kbd>?</kbd> to show this help</p>
<p>Press <kbd>Esc</kbd> to hide this help</p>
</div>
</div>
</div>
<div id="body-container">
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
let theme = localStorage.getItem('mdbook-theme');
let sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
let theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
const html = document.documentElement;
html.classList.remove('light')
html.classList.add(theme);
html.classList.add("js");
</script>
<input type="checkbox" id="sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
let sidebar = null;
const sidebar_toggle = document.getElementById("sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
}
sidebar_toggle.checked = sidebar === 'visible';
html.classList.remove('sidebar-visible');
html.classList.add("sidebar-" + sidebar);
</script>
<nav id="sidebar" class="sidebar" aria-label="Table of contents">
<!-- populated by js -->
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
<noscript>
<iframe class="sidebar-iframe-outer" src="../toc.html"></iframe>
</noscript>
<div id="sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<div id="page-wrapper" class="page-wrapper">
<div class="page">
<div id="menu-bar-hover-placeholder"></div>
<div id="menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="sidebar-toggle" class="icon-button" for="sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="sidebar">
<i class="fa fa-bars"></i>
</label>
<button id="theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="theme-list">
<i class="fa fa-paint-brush"></i>
</button>
<ul id="theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="default_theme">Auto</button></li>
<li role="none"><button role="menuitem" class="theme" id="light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="ayu">Ayu</button></li>
</ul>
<button id="search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="searchbar">
<i class="fa fa-search"></i>
</button>
</div>
<h1 class="menu-title">大道 (Dao OS) 文档</h1>
<div class="right-buttons">
<a href="../print.html" title="Print this book" aria-label="Print this book">
<i id="print-button" class="fa fa-print"></i>
</a>
<a href="https://nest.doylee.cn/Dao-OS/dao-os-docs" title="Git repository" aria-label="Git repository">
<i id="git-repository-button" class="fa fa-github"></i>
</a>
</div>
</div>
<div id="search-wrapper" class="hidden">
<form id="searchbar-outer" class="searchbar-outer">
<input type="search" id="searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="searchresults-outer" aria-describedby="searchresults-header">
</form>
<div id="searchresults-outer" class="searchresults-outer hidden">
<div id="searchresults-header" class="searchresults-header"></div>
<ul id="searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="content" class="content">
<main>
<h1 id="核心架构"><a class="header" href="#核心架构">核心架构</a></h1>
<p>大道 (Dao OS) 的架构,并非一个传统的、单体的操作系统。它是一个为实现主权、韧性和可扩展性而设计的、去中心化的分层范式。要理解它,必须理解它的三个基本实体:元单元、化身、以及道器。</p>
<h2 id="1-元单元-meta-unit可移植的灵魂代码"><a class="header" href="#1-元单元-meta-unit可移植的灵魂代码">1. <code>元单元 (Meta Unit)</code>:可移植的“灵魂代码”</a></h2>
<p><code>元单元</code>(以下简称为<code></code>)是用户数字存在的概念核心,但它本身不是一个运行中的程序。</p>
<ul>
<li><strong>其本质</strong>: <code></code>是一个<strong>可移植的库或制品 (Library/Artifact)</strong>,例如一个 <code>.wasm</code><code>.so</code><code>.dll</code> 文件。它包含了用户完整的、端到端加密的“第二大脑”所有数据、核心服务API身份、P2P网络、AI基础设施以及管理它们的逻辑。</li>
<li><strong>其角色</strong>: 它是被动的、统一的、唯一的“事实来源”,定义了用户的核心数据与能力。就像 Java 的字节码 (<code>.class</code> 文件)一样,它定义了“能做什么”,但它自己不“做”。它是等待被激活的“精密机器”。</li>
</ul>
<h2 id="2-化身-avatar元的运行时环境"><a class="header" href="#2-化身-avatar元的运行时环境">2. <code>化身 (Avatar)</code><code></code>的“运行时环境”</a></h2>
<p><code>化身</code>是赋予<code></code>生命的“能动”实体。</p>
<ul>
<li><strong>其本质</strong>: <code>化身</code>是任何一个<strong>可执行的程序或进程</strong>,其核心职责是加载、承载并执行一个<code></code>的实例。它是激活“机器”的“能源”。</li>
<li><strong>其角色</strong>: <code>化身</code>扮演着连接抽象的<code></code>与具体的宿主平台iOS、Windows、浏览器、命令行之间的关键<strong>桥梁</strong>。它为<code></code>提供访问系统资源CPU、内存、存储、网络的通道。在 Java 的比喻中,<code>化身</code>就是 <strong>JVM (Java虚拟机)</strong></li>
<li><strong>大道网络</strong>: 用户所有正在运行的<code>化身</code>都会组成一个私有的P2P网络以保持其内嵌的<code></code>实例时刻无缝同步。</li>
</ul>
<h2 id="3-道器-dao-implement生态系统中的软件"><a class="header" href="#3-道器-dao-implement生态系统中的软件">3. <code>道器 (Dao Implement)</code>:生态系统中的软件</a></h2>
<p>“道器”是为所有与“大道”生态集成、并扩展其能力的第三方软件所设定的通用术语。它们是用户实际交互的应用和服务。一个<code>道器</code>通过集成<code></code>而成为一个<code>化身</code></p>
<p>一个<code>道器</code>并非单一类型,而是根据其设计,由不同类型的组件构成。</p>
<ul>
<li><strong><code>器 (Facet Component)</code></strong>: 这是一个<code>道器</code>中,拥有<strong>用户界面</strong>的部分。它是<code></code>这台机器的“控制面板”,负责向用户呈现信息和捕获用户输入。</li>
<li><strong><code>核 (Core Component)</code></strong>: 这是一个<code>道器</code>中,<strong>无界面、负责后台逻辑</strong>的部分。它作为一个服务运行,提供特定的能力来增强<code></code>或被其他<code>道器</code>调用。它是机器的“外挂工具”。</li>
</ul>
<h3 id="架构的自由"><a class="header" href="#架构的自由">架构的自由</a></h3>
<p>开发者在构建他的<code>道器</code>时,拥有完全的架构自由:</p>
<ul>
<li>他可以创建一个<strong>单体式独立应用</strong>,这个应用本身就是一个<code>化身</code>,将<code></code>库、一个<code></code>(用于逻辑)和一个<code></code>用于UI打包在一个可执行文件中。</li>
<li>他可以创建一个<strong>分布式应用</strong>,让一个<code></code>在一个设备上,与另一个设备上的<code></code>进行通信。</li>
<li>他可以只创建一个纯粹的**<code></code>**(一个“扩展”),仅仅为用户的整个“大道”提供一种新的后台能力。</li>
<li>他也可以只创建一个纯粹的**<code></code>**,它没有任何自定义的后端逻辑(<code></code>),其界面直接调用<code></code>本身提供的核心服务(如“第二大脑”)来构建一个简单的工具应用。</li>
</ul>
<p>这套架构确保了“大道”不仅是一个平台,更是一个真正开放的、可组合的、去中心化的生态系统。</p>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<a rel="prev" href="../philosophy/principles.html" class="mobile-nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="../concepts/ai_system.html" class="mobile-nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
<a rel="prev" href="../philosophy/principles.html" class="nav-chapters previous" title="Previous chapter" aria-label="Previous chapter" aria-keyshortcuts="Left">
<i class="fa fa-angle-left"></i>
</a>
<a rel="next prefetch" href="../concepts/ai_system.html" class="nav-chapters next" title="Next chapter" aria-label="Next chapter" aria-keyshortcuts="Right">
<i class="fa fa-angle-right"></i>
</a>
</nav>
</div>
<script>
window.playground_copyable = true;
</script>
<script src="../elasticlunr.min.js"></script>
<script src="../mark.min.js"></script>
<script src="../searcher.js"></script>
<script src="../clipboard.min.js"></script>
<script src="../highlight.js"></script>
<script src="../book.js"></script>
<!-- Custom JS scripts -->
</div>
</body>
</html>