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:
1 parent
355f81d04a
commit
91e8d7a029
44 files changed
+1315
-1315
No files matched your search
@@ -8,8 +8,8 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
|
||||
)
|
||||
|
||||
// collectStream returns an OnStream callback plus a reader for the events it saw,
|
||||
// so a test can assert the scope the loop stamped on each emitted event.
|
||||
// collectStream 返回一个 OnStream 回调,外加一个读取它所见过
|
||||
// 事件的 reader,使测试能断言循环给每个发出的事件打上的作用域。
|
||||
func collectStream() (func(model.StreamEvent), func() []model.StreamEvent) {
|
||||
var mu sync.Mutex
|
||||
var events []model.StreamEvent
|
||||
@@ -26,10 +26,10 @@ func collectStream() (func(model.StreamEvent), func() []model.StreamEvent) {
|
||||
return on, read
|
||||
}
|
||||
|
||||
// TestRun_StreamCarriesSessionAndTurn locks the A1 contract: the loop stamps the
|
||||
// session it was driven for and the turn id attached with WithTurnID on every
|
||||
// streamed event, so the WS hub can route message.delta/thinking.delta/tool_call.*
|
||||
// to the right conversation and turn (design/16 §4.2).
|
||||
// TestRun_StreamCarriesSessionAndTurn 钉住 A1 契约:循环给每个
|
||||
// 流式事件打上它被驱动的会话,以及经 WithTurnID 挂载的 turn id,
|
||||
// 使 WS hub 能把 message.delta/thinking.delta/tool_call.*
|
||||
// 路由到正确的会话与 turn(design/16 §4.2)。
|
||||
func TestRun_StreamCarriesSessionAndTurn(t *testing.T) {
|
||||
t.Parallel()
|
||||
ad := &mockAdapter{
|
||||
@@ -58,9 +58,9 @@ func TestRun_StreamCarriesSessionAndTurn(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRun_StreamWithoutTurnIDLeavesItEmpty keeps the backward-compatible default:
|
||||
// a caller that attaches no turn id still gets the session on each event, but an
|
||||
// empty TurnID — the field's zero value is the old behavior.
|
||||
// TestRun_StreamWithoutTurnIDLeavesItEmpty 保持向后兼容的默认行为:
|
||||
// 未挂载 turn id 的调用方在每个事件上仍拿到会话,但
|
||||
// TurnID 为空 —— 该字段的零值即旧行为。
|
||||
func TestRun_StreamWithoutTurnIDLeavesItEmpty(t *testing.T) {
|
||||
t.Parallel()
|
||||
ad := &mockAdapter{
|
||||
@@ -85,9 +85,9 @@ func TestRun_StreamWithoutTurnIDLeavesItEmpty(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestRun_ToolExecutionCarriesScope covers the loop's other stream emitter: the
|
||||
// tool_execution_update progress frame must be scoped too, otherwise it would be
|
||||
// the one frame a multi-session client could not route.
|
||||
// TestRun_ToolExecutionCarriesScope 覆盖循环的另一个流式发出点:
|
||||
// tool_execution_update 进度帧也必须带作用域,否则它就会成为
|
||||
// 多会话客户端唯一无法路由的帧。
|
||||
func TestRun_ToolExecutionCarriesScope(t *testing.T) {
|
||||
t.Parallel()
|
||||
ad := &mockAdapter{stream: []mgResp{
|
||||
|
||||
Reference in new issue
Block a user