docs: 将仓库代码注释统一为中文
CI / docs-check (push) Canceled after 0s
CI / backend-test (push) Canceled after 0s
CI / service-test (push) Canceled after 0s
CI / frontend-test (push) Canceled after 0s
CI / rust-core (push) Canceled after 0s
CI / docs-check (pull_request) Canceled after 0s
CI / backend-test (pull_request) Canceled after 0s
CI / service-test (pull_request) Canceled after 0s
CI / frontend-test (pull_request) Canceled after 0s
CI / rust-core (pull_request) Canceled after 0s

This commit is contained in:
2026-09-10 00:40:56 +08:00
parent 51c592841d
commit d703ab64e3
249 changed files with 707 additions and 900 deletions
+3 -4
View File
@@ -1,4 +1,4 @@
"""Serialize and batch durable Trace writes off the asyncio event loop."""
"""在 asyncio 事件循环之外串行、批量写入持久化 Trace。"""
import asyncio
from contextvars import copy_context
@@ -14,7 +14,7 @@ class AsyncTraceWriter:
await self.queue.put((operation, args, future))
if self.worker is None or self.worker.done():
self.worker = asyncio.create_task(self._drain())
# Cancellation must not let an older snapshot commit after cancellation.
# 取消不得让较旧的快照在取消后提交。
cancelled = False
while not future.done():
try:
@@ -32,8 +32,7 @@ class AsyncTraceWriter:
try:
work = asyncio.get_running_loop().run_in_executor(
None, copy_context().run, self.repository.write_batch, [(op, args) for op, args, _ in batch])
# asyncio.run/shutdown may cancel every Task simultaneously. The
# executor Future survives; finish it and release all waiters.
# asyncio.run/shutdown 可能同时取消所有 Task;执行器 Future 仍会继续,因此应等待其完成并唤醒所有等待者。
while not work.done():
try:
await asyncio.shield(work)
+1 -1
View File
@@ -1,4 +1,4 @@
"""Markdown authoring tools. Composition is pure; persistence uses note permissions/CAS."""
"""Markdown 编写工具;内容组合不产生副作用,持久化操作遵循笔记权限与 CAS"""
import hashlib
import re
from typing import Literal
+1 -1
View File
@@ -138,7 +138,7 @@ class AgentRuntime:
skill_config=skill_config,
allowed_tools=allowed_tools,
)
# Reserve capacity before yielding to concurrent creators.
# 在让渡给并发创建者之前保留容量。
self._records[run.run_id] = record
try:
cancelled = await self._writer.submit('create', run.model_copy(deep=True), request.model_copy(deep=True), self._config_snapshot(record))
+2 -7
View File
@@ -1,9 +1,4 @@
"""Agent tools backed by existing OpenNexus application services.
The tools in this module stay inside the same validation, permission and audit
pipeline as the original note tools. Plugin authoring is deliberately limited
to the host's declarative handlers: it cannot write or launch arbitrary code.
"""
"""基于现有 OpenNexus 应用服务的 Agent 工具。本模块中的工具沿用原笔记工具的验证、权限与审计流程。Plugin 编写仅限 Host 提供的声明式处理器,不能写入或启动任意代码。"""
from __future__ import annotations
@@ -184,7 +179,7 @@ def _register(registry: ToolRegistry, name: str, description: str, model: type[B
def register_service_tools(registry: ToolRegistry, plugins) -> None:
"""Register tools that need the completed Plugin runtime or the current registry."""
"""注册需要完整的Plugin运行时或当前注册表的工具。"""
async def rename_note(arguments: NoteRenameArguments, _: ToolExecutionContext) -> dict:
return (await note_service.rename_note(arguments.note_id, file_name=arguments.file_name)).model_dump(mode="json")