An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: Format Go code with gofmt
Daniel32b3009d9158
diff --git a/kernel/cli/cmd/block.go b/kernel/cli/cmd/block.goindex 069df372b9..a82e2a04d5 100644--- a/kernel/cli/cmd/block.go+++ b/kernel/cli/cmd/block.go@@ -355,7 +355,7 @@ var blockUpdateCmd = &cobra.Command{},}- var blockDeleteCmd = &cobra.Command{+var blockDeleteCmd = &cobra.Command{Use: "delete --id <id>",Short: "Delete block",RunE: func(cmd *cobra.Command, args []string) error {diff --git a/kernel/cli/cmd/document.go b/kernel/cli/cmd/document.goindex 13b892dc5f..e7c006db6a 100644--- a/kernel/cli/cmd/document.go+++ b/kernel/cli/cmd/document.go@@ -370,5 +370,3 @@ func init() {documentCmd.AddCommand(documentInfoCmd)documentCmd.AddCommand(documentSearchCmd)}--diff --git a/kernel/conf/box.go b/kernel/conf/box.goindex 84c90a8ec0..5e20d88a55 100644--- a/kernel/conf/box.go+++ b/kernel/conf/box.go@@ -20,19 +20,19 @@ import "github.com/siyuan-note/siyuan/kernel/util"// BoxConf 维护 .siyuan/conf.json 笔记本配置。type BoxConf struct {- Name string `json:"name"` // 笔记本名称- Sort int `json:"sort"` // 排序字段- Icon string `json:"icon"` // 图标- Closed bool `json:"closed"` // 是否处于关闭状态- RefCreateSaveBox string `json:"refCreateSaveBox"` // 块引时新建文档存储笔记本- RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径- DocCreateSaveBox string `json:"docCreateSaveBox"` // 新建文档存储笔记本- DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径- DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径- DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径- SortMode int `json:"sortMode"` // 排序方式- Encrypted bool `json:"encrypted"` // 是否为加密笔记本- BoxCrypt *BoxEncryption `json:"boxCrypt"` // 笔记本加密参数,仅 Encrypted=true 时有值+ Name string `json:"name"` // 笔记本名称+ Sort int `json:"sort"` // 排序字段+ Icon string `json:"icon"` // 图标+ Closed bool `json:"closed"` // 是否处于关闭状态+ RefCreateSaveBox string `json:"refCreateSaveBox"` // 块引时新建文档存储笔记本+ RefCreateSavePath string `json:"refCreateSavePath"` // 块引时新建文档存储路径+ DocCreateSaveBox string `json:"docCreateSaveBox"` // 新建文档存储笔记本+ DocCreateSavePath string `json:"docCreateSavePath"` // 新建文档存储路径+ DailyNoteSavePath string `json:"dailyNoteSavePath"` // 新建日记存储路径+ DailyNoteTemplatePath string `json:"dailyNoteTemplatePath"` // 新建日记使用的模板路径+ SortMode int `json:"sortMode"` // 排序方式+ Encrypted bool `json:"encrypted"` // 是否为加密笔记本+ BoxCrypt *BoxEncryption `json:"boxCrypt"` // 笔记本加密参数,仅 Encrypted=true 时有值}// BoxEncryption 维护单个加密笔记本的密钥包络参数。WrappedDEK 是用全局 KEK 加密后的 DEK,本身可落盘。diff --git a/kernel/mcp/tools/database.go b/kernel/mcp/tools/database.goindex 545f030e04..ec50a6a210 100644--- a/kernel/mcp/tools/database.go+++ b/kernel/mcp/tools/database.go@@ -32,28 +32,28 @@ var DatabaseTool = &Tool{InputSchema: ToolSchema{Type: "object",Properties: map[string]Property{- "action": {Type: "string", Description: "Operation", Enum: []string{"search", "get", "render", "keys", "key_add", "key_remove", "item_add", "item_remove", "item_update", "unused", "clean"}},- "keyword": {Type: "string", Description: "Search keyword (for search)"},- "id": {Type: "string", Description: "Attribute view ID (for get, render, keys, key_add, key_remove, item_add, item_remove, item_update, clean)"},- "viewID": {Type: "string", Description: "View ID (for render, item_add)"},- "query": {Type: "string", Description: "Filter query (for render)"},- "page": {Type: "number", Description: "Page number (default 1)"},- "pageSize": {Type: "number", Description: "Results per page (default 50)"},- "name": {Type: "string", Description: "Key name (for key_add)"},- "type": {Type: "string", Description: "Key type: block/text/number/date/select/mSelect/url/email/phone/mAsset/template/created/updated/checkbox/relation/rollup/lineNumber (for key_add)"},- "icon": {Type: "string", Description: "Key icon (for key_add, optional)"},- "prev": {Type: "string", Description: "Previous key ID for ordering (for key_add, optional)"},- "keyID": {Type: "string", Description: "Key ID (for key_remove, item_update)"},+ "action": {Type: "string", Description: "Operation", Enum: []string{"search", "get", "render", "keys", "key_add", "key_remove", "item_add", "item_remove", "item_update", "unused", "clean"}},+ "keyword": {Type: "string", Description: "Search keyword (for search)"},+ "id": {Type: "string", Description: "Attribute view ID (for get, render, keys, key_add, key_remove, item_add, item_remove, item_update, clean)"},+ "viewID": {Type: "string", Description: "View ID (for render, item_add)"},+ "query": {Type: "string", Description: "Filter query (for render)"},+ "page": {Type: "number", Description: "Page number (default 1)"},+ "pageSize": {Type: "number", Description: "Results per page (default 50)"},+ "name": {Type: "string", Description: "Key name (for key_add)"},+ "type": {Type: "string", Description: "Key type: block/text/number/date/select/mSelect/url/email/phone/mAsset/template/created/updated/checkbox/relation/rollup/lineNumber (for key_add)"},+ "icon": {Type: "string", Description: "Key icon (for key_add, optional)"},+ "prev": {Type: "string", Description: "Previous key ID for ordering (for key_add, optional)"},+ "keyID": {Type: "string", Description: "Key ID (for key_remove, item_update)"},"removeRelationDest": {Type: "boolean", Description: "Also remove related data in linked databases (for key_remove, optional)"},- "blockID": {Type: "string", Description: "Block ID to bind (for item_add, optional)"},- "content": {Type: "string", Description: "Block column text content (for item_add, optional)"},- "groupID": {Type: "string", Description: "Group ID for positioning (for item_add, optional)"},- "previousID": {Type: "string", Description: "Previous item ID for positioning (for item_add, optional)"},- "detached": {Type: "boolean", Description: "Create detached row (for item_add, optional)"},+ "blockID": {Type: "string", Description: "Block ID to bind (for item_add, optional)"},+ "content": {Type: "string", Description: "Block column text content (for item_add, optional)"},+ "groupID": {Type: "string", Description: "Group ID for positioning (for item_add, optional)"},+ "previousID": {Type: "string", Description: "Previous item ID for positioning (for item_add, optional)"},+ "detached": {Type: "boolean", Description: "Create detached row (for item_add, optional)"},"ignoreDefaultFill": {Type: "boolean", Description: "Skip filling default values (for item_add, optional)"},- "itemID": {Type: "string", Description: "Item ID (for item_update)"},- "itemIDs": {Type: "string", Description: "Comma-separated item IDs (for item_remove)"},- "value": {Type: "string", Description: "JSON value for the cell (for item_update)"},+ "itemID": {Type: "string", Description: "Item ID (for item_update)"},+ "itemIDs": {Type: "string", Description: "Comma-separated item IDs (for item_remove)"},+ "value": {Type: "string", Description: "JSON value for the cell (for item_update)"},},Required: []string{"action"},},diff --git a/kernel/mcp/tools/frontend.go b/kernel/mcp/tools/frontend.goindex e3c1ca3ed6..9afcb3fd96 100644--- a/kernel/mcp/tools/frontend.go+++ b/kernel/mcp/tools/frontend.go@@ -22,7 +22,7 @@ package tools// browser over SSE and blocks until the browser responds. The stub exists only so that// convertMCPToolsToOpenAI() lists this tool for the LLM.var FrontendTool = &Tool{- Name: "frontend",+ Name: "frontend",Description: "Frontend/UI actions in the SiYuan editor (run in the browser; may change what the user sees). Actions: open_setting(query?), focus_block(id), open_document(id), open_search(query?). Plugins may register more — see <plugin_actions> and invoke by full name (e.g. plugin__myplugin__myaction).",InputSchema: ToolSchema{Type: "object",diff --git a/kernel/util/clipboard.go b/kernel/util/clipboard.goindex c065cb9ff1..d0aa906a77 100644--- a/kernel/util/clipboard.go+++ b/kernel/util/clipboard.go@@ -14,7 +14,7 @@// You should have received a copy of the GNU Affero General Public License// along with this program. If not, see <https://www.gnu.org/licenses/>.-//go:build !windows && !darwin || ios+//go:build (!windows && !darwin) || iospackage utildiff --git a/kernel/util/crypt.go b/kernel/util/crypt.goindex 1f76142b28..8f15e8df84 100644--- a/kernel/util/crypt.go+++ b/kernel/util/crypt.go@@ -82,4 +82,4 @@ func SHA256Hash(data []byte) string {hash := sha256.New()hash.Write(data)return hex.EncodeToString(hash.Sum(nil))-}\ No newline at end of file+}diff --git a/kernel/util/skill_test.go b/kernel/util/skill_test.goindex 7f9c73e70f..8a7efd7233 100644--- a/kernel/util/skill_test.go+++ b/kernel/util/skill_test.go@@ -215,10 +215,10 @@ func TestNormalizeSkillURL(t *testing.T) {// 含点(域名)、含冒号、带 scheme 的都不应走简写分支。func TestNormalizeSkillURLOwnerRepoBoundary(t *testing.T) {bad := []string{- "example.com", // 不是 owner/repo- "a/b/c", // 多于一个斜杠- "https://foo/bar", // 含 scheme(应走 URL 分支,但属于合法 URL 不报错)- "/abs/path", // 绝对路径+ "example.com", // 不是 owner/repo+ "a/b/c", // 多于一个斜杠+ "https://foo/bar", // 含 scheme(应走 URL 分支,但属于合法 URL 不报错)+ "/abs/path", // 绝对路径}for _, in := range bad {// 这些输入要么报错,要么走 URL 分支;只要不 panic、不误判为 codeload 即可diff --git a/kernel/util/websearch.go b/kernel/util/websearch.goindex 8a341a2dab..f2296890b1 100644--- a/kernel/util/websearch.go+++ b/kernel/util/websearch.go@@ -28,15 +28,15 @@ import ()const (- defaultExaURL = "https://mcp.exa.ai/mcp"- maxWebSearchChars = 50000+ defaultExaURL = "https://mcp.exa.ai/mcp"+ maxWebSearchChars = 50000)type mcpRequest struct {- JSONRPC string `json:"jsonrpc"`- ID int `json:"id"`- Method string `json:"method"`- Params mcpParams `json:"params"`+ JSONRPC string `json:"jsonrpc"`+ ID int `json:"id"`+ Method string `json:"method"`+ Params mcpParams `json:"params"`}type mcpParams struct {