docs(runtime): internal/runtime/loop 44 个文件注释改中文(逐行 1:1,代码零字节改动)

主人 2026-10-03 拍板「注释一律中文」;本模块按长期分批协议(一个模块一次派工)执行。
注释行数 1329 → 1329 逐行 1:1(含中文 33 → 1304);行尾注释 5 条一并译。
校验:机械校验(非注释改动行)= 空;独立 Go AST 程序(剥注释复渲)证明 44/44 文件代码全等;
全树 go test ./... 58 包 ok / 0 FAIL;交叉编译绿。
gofmt:capacity_loop_test.go / flow.go 改动前即未格式化,按铁律保留原样未动。
This commit is contained in:
AskaEth committed 2026-10-03 22:28:21 +08:00
1 parent 355f81d04a
commit 91e8d7a029
44 files changed
+1315 -1315

No files matched your search

+11 -11
View File
@@ -6,12 +6,12 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/trace"
)
// span starts a named span of the given kind when a Tracer is configured, else
// returns a nil no-op span. The returned context carries the span as the current
// one so nested spans chain as children. When a FlowPublisher is configured the
// span's flow owner (the branch parent for a sub-agent Run, else the Run's own
// session, both threaded via ctx) is stamped as a prop and a running placeholder
// node is published immediately, so the flow graph shows work in flight.
// span 在配置了 Tracer 时启动一个给定 kind 的具名 span,否则
// 返回 nil 空操作 span。返回的 context 把该 span 作为当前 span 携带,
// 使嵌套 span 作为子节点串链。配置了 FlowPublisher 时,
// span 的 flow owner(子代理 Run 取分支父级,否则取 Run 自身的
// session,两者都经 ctx 传递)会被打为 prop,并立即发布一个
// 运行中的占位节点,使 flow 图能显示在途工作。
func (l *Loop) span(ctx context.Context, name string, kind trace.SpanKind) (context.Context, *trace.Span) {
if l.tracer == nil {
return ctx, nil
@@ -26,9 +26,9 @@ func (l *Loop) span(ctx context.Context, name string, kind trace.SpanKind) (cont
return sctx, sp
}
// finishSpan closes a span with the given status, ignoring a nil span. After the
// span closes (immutable) the finished record is folded into the flow graph and
// published, flipping the node to its final status.
// finishSpan 以给定状态关闭 span,忽略 nil span。span 关闭
// (不可变)后,完成记录被并入 flow 图并
// 发布,把该节点翻转为最终状态。
func (l *Loop) finishSpan(sp *trace.Span, status trace.SpanStatus) {
if sp == nil {
return
@@ -41,8 +41,8 @@ func (l *Loop) finishSpan(sp *trace.Span, status trace.SpanStatus) {
}
}
// spanProp attaches a structured property to a span, ignoring a nil span and any
// mutation-after-close error.
// spanProp 给 span 附加一个结构化属性,忽略 nil span 以及
// 关闭后变更所返回的错误。
func (l *Loop) spanProp(sp *trace.Span, key string, value any) {
if sp == nil {
return