AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
fix(demo): persist architecture auto layout
tianma-if207372c2092f
diff --git a/apps/api/src/demo-seed-data.test.mjs b/apps/api/src/demo-seed-data.test.mjsindex 0045f8d2..766b6e11 100644--- a/apps/api/src/demo-seed-data.test.mjs+++ b/apps/api/src/demo-seed-data.test.mjs@@ -1,5 +1,6 @@import { describe, expect, test } from "bun:test";import { parseDiagramDocument } from "@edgeever/shared";+import { computeDiagramLayoutResult } from "../../../packages/shared/src/diagram-layout.ts";import {decodeDemoAttachment,DEMO_SEED_ATTACHMENT_RESOURCES,@@ -72,6 +73,20 @@ describe("demo seed catalog", () => {}});+ test("persists the architecture examples in their automatic layout", () => {+ for (const memoId of ["memo_demo_architecture", "memo_demo_architecture_en"]) {+ const memo = DEMO_SEED_MEMOS.find((candidate) => candidate.id === memoId);+ const diagram = parseDiagramDocument(memo?.markdown);+ expect(diagram).toMatchObject({ kind: "architecture" });+ if (!diagram) continue;++ const layout = computeDiagramLayoutResult(diagram);+ for (const node of diagram.nodes) {+ expect({ x: node.x, y: node.y, width: node.width, height: node.height }).toEqual(layout.nodes[node.id]);+ }+ }+ });+test("keeps every seeded resource decodable and owned by a seeded memo", () => {const memoIds = new Set(DEMO_SEED_MEMOS.map((memo) => memo.id));const resourceIds = new Set();diff --git a/apps/api/src/demo-seed-data.ts b/apps/api/src/demo-seed-data.tsindex f59bd4c6..5c30dd7a 100644--- a/apps/api/src/demo-seed-data.ts+++ b/apps/api/src/demo-seed-data.ts@@ -22,30 +22,30 @@ export const DEMO_ARCHITECTURE_DIAGRAM_ZH: DiagramDocument = {schemaVersion: 2,kind: "architecture",nodes: [- { id: "boundary-clients", label: "全端体验层", x: 40, y: 40, width: 1120, height: 220, shape: "boundary" },- { id: "boundary-platform", label: "可移植应用平台 · Cloudflare Workers / Docker 共用业务核心", x: 40, y: 300, width: 1120, height: 220, shape: "boundary" },- { id: "boundary-data", label: "数据与文件层 · 可替换基础设施适配器", x: 40, y: 560, width: 690, height: 210, shape: "boundary" },- { id: "boundary-ecosystem", label: "AI 与自动化生态", x: 770, y: 560, width: 390, height: 210, shape: "boundary" },-- { id: "client-web", label: "Web / PWA\n离线优先", x: 68, y: 86, width: 180, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },- { id: "client-desktop", label: "macOS / Windows\n桌面端", x: 284, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },- { id: "client-ios", label: "iOS\nSwiftUI 原生端", x: 500, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },- { id: "client-android", label: "Android\nExpo 原生端", x: 716, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },- { id: "client-clipper", label: "浏览器剪藏\nChrome / Edge", x: 932, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },- { id: "client-sync", label: "全端共享同步通道", x: 490, y: 184, width: 200, height: 48, shape: "service", resourceIcon: "apiClient", parentId: "boundary-clients" },-- { id: "platform-api", label: "统一 API 入口\n认证 · 限流 · 路由", x: 490, y: 338, width: 200, height: 64, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },- { id: "platform-core", label: "共享业务核心\nHono · 领域服务", x: 490, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },- { id: "platform-sync", label: "同步与修订引擎\n离线队列 · 冲突控制", x: 220, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },- { id: "platform-mcp", label: "原生 MCP 端点\n智能体读写工具", x: 760, y: 430, width: 190, height: 64, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },- { id: "platform-model", label: "端侧模型网关\nBYOK 隐私直连", x: 980, y: 430, width: 170, height: 64, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },-- { id: "data-search", label: "搜索与语义索引\n全文 · 向量", x: 76, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },- { id: "data-sql", label: "D1 / SQLite\n笔记 · 标签 · 修订", x: 292, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },- { id: "data-objects", label: "R2 / S3\n图片与附件", x: 508, y: 632, width: 186, height: 76, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },-- { id: "ecosystem-agents", label: "Claude / Cursor\n自动化智能体", x: 796, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },- { id: "ecosystem-models", label: "OpenAI / Gemini\n兼容模型服务", x: 974, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },+ { id: "boundary-clients", label: "全端体验层", x: 32, y: 32, width: 260, height: 694, shape: "boundary" },+ { id: "boundary-platform", label: "可移植应用平台 · Cloudflare Workers / Docker 共用业务核心", x: 380, y: 179, width: 732, height: 400, shape: "boundary" },+ { id: "boundary-data", label: "数据与文件层 · 可替换基础设施适配器", x: 1200, y: 390, width: 260, height: 380, shape: "boundary" },+ { id: "boundary-ecosystem", label: "AI 与自动化生态", x: 1200, y: 62, width: 260, height: 272, shape: "boundary" },++ { id: "client-web", label: "Web / PWA\n离线优先", x: 68, y: 88, width: 156, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },+ { id: "client-desktop", label: "macOS / Windows\n桌面端", x: 68, y: 192, width: 156, height: 70, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },+ { id: "client-ios", label: "iOS\nSwiftUI 原生端", x: 68, y: 302, width: 156, height: 70, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },+ { id: "client-android", label: "Android\nExpo 原生端", x: 68, y: 412, width: 156, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },+ { id: "client-clipper", label: "浏览器剪藏\nChrome / Edge", x: 68, y: 516, width: 156, height: 70, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },+ { id: "client-sync", label: "全端共享同步通道", x: 68, y: 626, width: 156, height: 64, shape: "service", resourceIcon: "apiClient", parentId: "boundary-clients" },++ { id: "platform-api", label: "统一 API 入口\n认证 · 限流 · 路由", x: 416, y: 363, width: 156, height: 70, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },+ { id: "platform-core", label: "共享业务核心\nHono · 领域服务", x: 668, y: 304, width: 156, height: 70, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },+ { id: "platform-sync", label: "同步与修订引擎\n离线队列 · 冲突控制", x: 920, y: 295, width: 156, height: 88, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },+ { id: "platform-mcp", label: "原生 MCP 端点\n智能体读写工具", x: 416, y: 235, width: 156, height: 88, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },+ { id: "platform-model", label: "端侧模型网关\nBYOK 隐私直连", x: 416, y: 473, width: 156, height: 70, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },++ { id: "data-search", label: "搜索与语义索引\n全文 · 向量", x: 1239, y: 446, width: 150, height: 72, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },+ { id: "data-sql", label: "D1 / SQLite\n笔记 · 标签 · 修订", x: 1239, y: 558, width: 150, height: 72, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },+ { id: "data-objects", label: "R2 / S3\n图片与附件", x: 1236, y: 670, width: 156, height: 64, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },++ { id: "ecosystem-agents", label: "Claude / Cursor\n自动化智能体", x: 1236, y: 118, width: 156, height: 70, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },+ { id: "ecosystem-models", label: "OpenAI / Gemini\n兼容模型服务", x: 1236, y: 228, width: 156, height: 70, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },],edges: [{ id: "edge-clients-api", source: "client-sync", target: "platform-api", label: "HTTPS / 同步游标", kind: "request" },@@ -64,30 +64,30 @@ export const DEMO_ARCHITECTURE_DIAGRAM_EN: DiagramDocument = {schemaVersion: 2,kind: "architecture",nodes: [- { id: "boundary-clients", label: "Cross-Platform Experience", x: 40, y: 40, width: 1120, height: 220, shape: "boundary" },- { id: "boundary-platform", label: "Portable Application Platform · Shared Core on Cloudflare Workers or Docker", x: 40, y: 300, width: 1120, height: 220, shape: "boundary" },- { id: "boundary-data", label: "Data & Files · Replaceable Infrastructure Adapters", x: 40, y: 560, width: 690, height: 210, shape: "boundary" },- { id: "boundary-ecosystem", label: "AI & Automation Ecosystem", x: 770, y: 560, width: 390, height: 210, shape: "boundary" },-- { id: "client-web", label: "Web / PWA\nOffline First", x: 68, y: 86, width: 180, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },- { id: "client-desktop", label: "macOS / Windows\nDesktop", x: 284, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },- { id: "client-ios", label: "iOS\nNative SwiftUI", x: 500, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },- { id: "client-android", label: "Android\nNative Expo", x: 716, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },- { id: "client-clipper", label: "Web Clipper\nChrome / Edge", x: 932, y: 86, width: 180, height: 64, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },- { id: "client-sync", label: "Shared Cross-Client Sync", x: 490, y: 184, width: 200, height: 48, shape: "service", resourceIcon: "apiClient", parentId: "boundary-clients" },-- { id: "platform-api", label: "Unified API Entry\nAuth · Limits · Routing", x: 490, y: 338, width: 200, height: 64, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },- { id: "platform-core", label: "Shared Business Core\nHono · Domain Services", x: 490, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },- { id: "platform-sync", label: "Sync & Revision Engine\nOffline Queue · Conflicts", x: 220, y: 430, width: 200, height: 64, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },- { id: "platform-mcp", label: "Native MCP Endpoint\nAgent Read/Write Tools", x: 760, y: 430, width: 190, height: 64, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },- { id: "platform-model", label: "Client Model Gateway\nPrivate BYOK", x: 980, y: 430, width: 170, height: 64, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },-- { id: "data-search", label: "Search & Semantic Index\nFull Text · Vectors", x: 76, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },- { id: "data-sql", label: "D1 / SQLite\nNotes · Tags · Revisions", x: 292, y: 632, width: 186, height: 76, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },- { id: "data-objects", label: "R2 / S3\nImages & Attachments", x: 508, y: 632, width: 186, height: 76, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },-- { id: "ecosystem-agents", label: "Claude / Cursor\nAutomation Agents", x: 796, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },- { id: "ecosystem-models", label: "OpenAI / Gemini\nCompatible Models", x: 974, y: 632, width: 170, height: 76, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },+ { id: "boundary-clients", label: "Cross-Platform Experience", x: 32, y: 43, width: 260, height: 694, shape: "boundary" },+ { id: "boundary-platform", label: "Portable Application Platform · Shared Core on Cloudflare Workers or Docker", x: 380, y: 181, width: 732, height: 418, shape: "boundary" },+ { id: "boundary-data", label: "Data & Files · Replaceable Infrastructure Adapters", x: 1200, y: 396, width: 260, height: 436, shape: "boundary" },+ { id: "boundary-ecosystem", label: "AI & Automation Ecosystem", x: 1200, y: 32, width: 260, height: 308, shape: "boundary" },++ { id: "client-web", label: "Web / PWA\nOffline First", x: 68, y: 99, width: 156, height: 64, shape: "frontend", resourceIcon: "webApp", parentId: "boundary-clients" },+ { id: "client-desktop", label: "macOS / Windows\nDesktop", x: 68, y: 203, width: 156, height: 70, shape: "client", resourceIcon: "client", parentId: "boundary-clients" },+ { id: "client-ios", label: "iOS\nNative SwiftUI", x: 68, y: 313, width: 156, height: 70, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },+ { id: "client-android", label: "Android\nNative Expo", x: 68, y: 423, width: 156, height: 64, shape: "client", resourceIcon: "mobileApp", parentId: "boundary-clients" },+ { id: "client-clipper", label: "Web Clipper\nChrome / Edge", x: 68, y: 527, width: 156, height: 70, shape: "client", resourceIcon: "website", parentId: "boundary-clients" },+ { id: "client-sync", label: "Shared Cross-Client Sync", x: 68, y: 637, width: 156, height: 64, shape: "service", resourceIcon: "apiClient", parentId: "boundary-clients" },++ { id: "platform-api", label: "Unified API Entry\nAuth · Limits · Routing", x: 416, y: 365, width: 156, height: 88, shape: "service", resourceIcon: "apiGateway", parentId: "boundary-platform" },+ { id: "platform-core", label: "Shared Business Core\nHono · Domain Services", x: 668, y: 301, width: 156, height: 88, shape: "service", resourceIcon: "service", parentId: "boundary-platform" },+ { id: "platform-sync", label: "Sync & Revision Engine\nOffline Queue · Conflicts", x: 920, y: 301, width: 156, height: 88, shape: "service", resourceIcon: "streamProcessing", parentId: "boundary-platform" },+ { id: "platform-mcp", label: "Native MCP Endpoint\nAgent Read/Write Tools", x: 416, y: 237, width: 156, height: 88, shape: "service", resourceIcon: "mcpServer", parentId: "boundary-platform" },+ { id: "platform-model", label: "Client Model Gateway\nPrivate BYOK", x: 416, y: 493, width: 156, height: 70, shape: "service", resourceIcon: "modelGateway", parentId: "boundary-platform" },++ { id: "data-search", label: "Search & Semantic Index\nFull Text · Vectors", x: 1239, y: 452, width: 150, height: 106, shape: "database", resourceIcon: "vectorDatabase", parentId: "boundary-data" },+ { id: "data-sql", label: "D1 / SQLite\nNotes · Tags · Revisions", x: 1239, y: 598, width: 150, height: 88, shape: "database", resourceIcon: "relationalDatabase", parentId: "boundary-data" },+ { id: "data-objects", label: "R2 / S3\nImages & Attachments", x: 1236, y: 726, width: 156, height: 70, shape: "storage", resourceIcon: "objectStorage", parentId: "boundary-data" },++ { id: "ecosystem-agents", label: "Claude / Cursor\nAutomation Agents", x: 1236, y: 88, width: 156, height: 88, shape: "external", resourceIcon: "aiAgent", parentId: "boundary-ecosystem" },+ { id: "ecosystem-models", label: "OpenAI / Gemini\nCompatible Models", x: 1236, y: 216, width: 156, height: 88, shape: "external", resourceIcon: "largeLanguageModel", parentId: "boundary-ecosystem" },],edges: [{ id: "edge-clients-api", source: "client-sync", target: "platform-api", label: "HTTPS / Sync Cursor", kind: "request" },