An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:memo: Update AGENTS.md
Danieleb019fc729f4
diff --git a/AGENTS.md b/AGENTS.mdindex 4dc6823ddd..1d24b55426 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -3,7 +3,6 @@SiYuan repository guide. Module path `github.com/siyuan-note/siyuan`, license AGPL-3.0.**Architecture:** Go kernel (`kernel/`) + TypeScript frontend (`app/`), plus a separate `export` bundle (global `Protyle`, entry `src/protyle/method.ts`) for rendering rich content in exported HTML / PDF preview. Read versions from `kernel/go.mod`, `app/package.json`, `kernel/util/working.go`.----## 1. Required toolchain@@ -17,8 +16,7 @@ SiYuan repository guide. Module path `github.com/siyuan-note/siyuan`, license AG## 2. Related repositories (navigation)-SiYuan spans several repos. This repo (`siyuan`) holds the kernel + Electron/web-frontend; the others are separate projects with their own tooling.+SiYuan spans several repos. This repo (`siyuan`) holds the kernel + Electron/web frontend; the others are separate projects with their own tooling.| Repo | Role / what to know ||---|---|@@ -36,26 +34,14 @@ frontend; the others are separate projects with their own tooling.| `go-sqlite3` / `pdfcpu` | Maintainer's forks, pulled in via permanent `replace` in `kernel/go.mod` (keep those) || `epub` / `clipboard` / `go-humanize` / `vitess-sqlparser` / `dataparser` / `encryption` | Smaller Go libraries (export / clipboard / formatting / SQL parse / data parse / crypto) |-All Go libraries above are dependencies in `kernel/go.mod`. GitHub org: `siyuan-note/*`-for the `siyuan-` apps and most libs; `88250/*` for lute, gulu, and the forks.+All Go libraries above are dependencies in `kernel/go.mod`. GitHub org: `siyuan-note/*` for the `siyuan-` apps and most libs; `88250/*` for lute, gulu, and the forks (go-sqlite3 / pdfcpu).### Cross-repo notes-- **Editing any Go dependency (Lute / dejavu / gulu / eventbus / riff / filelock /- httpclient / logging / go-sqlite3 / pdfcpu / epub / …):** these are imported by the- kernel as Go modules (`kernel/go.mod`). To test a local change, add a temporary- `replace` in `kernel/go.mod` pointing at your local checkout — but **never commit that- `replace`**; it breaks builds for everyone else. (`go-sqlite3` and `pdfcpu` already have- permanent `replace` directives pointing at the maintainer's forks — keep those.)-- **Rebuilding `lute.min.js`:** it's the JS build of the Go `lute` project — generated- upstream and checked into `app/stage/protyle/js/lute/`. Don't edit it here; change- `lute`, rebuild, and copy the artifact in.-- **Mobile apps (`siyuan-android` / `siyuan-ios` / `siyuan-harmony`):** each is a- separate native app that wraps the kernel built from this repo. For how to build,- vendor the kernel binding, and wire everything up, **read each project's own README**- — the toolchains and steps differ per platform and aren't documented here.-- **`siyuan-chrome`:** independent TypeScript project; it only interacts with a running- SiYuan instance through the public HTTP API documented in `API.md`.+- **Editing any Go dependency (Lute / dejavu / gulu / eventbus / riff / filelock / httpclient / logging / go-sqlite3 / pdfcpu / epub / …):** these are imported by the kernel as Go modules (`kernel/go.mod`). To test a local change, add a temporary `replace` in `kernel/go.mod` pointing at your local checkout — but **never commit that `replace`**; it breaks builds for everyone else.+- **Rebuilding `lute.min.js`:** it's the JS build of the Go `lute` project — generated upstream and checked into `app/stage/protyle/js/lute/`. Don't edit it here; change `lute`, rebuild, and copy the artifact in.+- **Mobile apps (`siyuan-android` / `siyuan-ios` / `siyuan-harmony`):** each is a separate native app that wraps the kernel built from this repo. For how to build, vendor the kernel binding, and wire everything up, **read each project's own README** — the toolchains and steps differ per platform and aren't documented here.+- **`siyuan-chrome`:** independent TypeScript project; it only interacts with a running SiYuan instance through the public HTTP API documented in `API.md`.---@@ -79,7 +65,7 @@ Top level (repo root):|---|---|| `main.go` (`//go:build !mobile`) | Desktop entry point → `cli/cmd` || `cli/cmd/` | Cobra CLI subcommands (`serve`, `notebook`, `block`, `search`, `sql`, `export`, `repo`, `sync`, …) |-| `model/` | **Core domain** (~70 files): blocks/trees, transactions, notebooks, indexing, search, attribute views, export, history, sync, SRS flashcards, AI/embedding, CalDAV/CardDAV, auth middleware |+| `model/` | **Core domain** (~70 files): blocks/trees, transactions, indexing, search, attribute views, export, history, sync, flashcards, AI, CalDAV/CardDAV, auth || `treenode/` | In-memory tree over the Lute AST + `blocktree.db` (`BlockTree{ID,RootID,ParentID,BoxID,Path,HPath,Type,...}`) || `av/` | **Attribute View** (database) engine: values, filters, sorts, layouts (table/kanban/gallery) || `sql/` | **Embedded SQLite** (`siyuan.db`, `history.db`, `asset_content.db`) + FTS5; async index queues |@@ -89,7 +75,7 @@ Top level (repo root):| `server/` | Gin server bootstrap (`serve.go`): middleware, TLS/cmux, WebDAV/CalDAV/CardDAV, WebSocket, MCP || `api/` | HTTP route registration (`router.go::ServeAPI`, ~400 endpoints) + per-area handlers || `conf/` | Configuration structs |-| `util/` | Cross-cutting: `working.go` (workspace, `Boot()`), `lute.go`, `i18n.go`/`lang.go`, `websocket.go` (melody push), `result.go` (API envelope), etc. |+| `util/` | Cross-cutting: `working.go` (workspace, `Boot()`), `lute.go`, `i18n.go`, `websocket.go` (melody push), `result.go` (API envelope) || `plugin/` | Plugin subsystem (kernel side) || `mcp/` | MCP (Model Context Protocol) server || `agent/` | AI agent runtime |@@ -101,19 +87,13 @@ Top level (repo root):|---|---|| `index.ts` | Main `App` class — boots SPA, opens main WebSocket, handles WS push events || `window/` | Detached Electron window variant |-| `protyle/` | **The block editor** — `wysiwyg/`, `toolbar/`, `gutter/`, `breadcrumb/`, `header/`, `hint/`, `scroll/`, `undo/`, `upload/`, `preview/`, `render/` (incl. `render/av/`) |+| `protyle/` | **The block editor** — `wysiwyg/`, `toolbar/`, `gutter/`, `breadcrumb/`, `hint/`, `scroll/`, `undo/`, `preview/`, `render/` (incl. `render/av/`) || `editor/`, `layout/`, `menus/`, `dialog/`, `config/`, `mobile/`, `ai/`, `sync/`, `history/`, `search/`, `card/` | Feature modules || `util/fetch.ts` | `fetchGet`/`fetchPost` — all kernel calls || `layout/Model.ts` | WebSocket client all UI binds to || `constants.ts` | Global constants (version, IDs, storage keys) |-Four webpack configs each emit a separate bundle to `app/stage/build/{app,desktop,mobile,export}/`.-The kernel's `serveAppearance` picks which bundle to serve based on User-Agent. The `export`-bundle is different from the other three: it is not an app UI — it is a client-side library-(global `Protyle`, entry `src/protyle/method.ts`) exposing renderers for code highlighting,-math (KaTeX), and diagrams (Mermaid/flowchart/graphviz/…). It is loaded by the HTML pages-assembled during export (`app/src/protyle/export/index.ts`) — the desktop PDF preview window-and standalone exported HTML files — so rich content renders outside the editor.+Four webpack configs each emit a separate bundle to `app/stage/build/{app,desktop,mobile,export}/`. The kernel's `serveAppearance` picks which bundle to serve based on User-Agent. The `export` bundle is different from the other three: it is not an app UI — it is a client-side library (global `Protyle`, entry `src/protyle/method.ts`) exposing renderers for code highlighting, math (KaTeX), and diagrams (Mermaid/flowchart/graphviz/…). It is loaded by the HTML pages assembled during export (`app/src/protyle/export/index.ts`) — the desktop PDF preview window and standalone exported HTML files — so rich content renders outside the editor.---