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

+14 -14
View File
@@ -10,9 +10,9 @@ import (
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/model"
)
// seedL4Habit writes a canonical intent record memory (the closed-loop write-back
// format produced by capacity.RecordIntent) recording that "搞一下这个部署" is a task
// for persona-a.
// seedL4Habit 写入一条规范的 intent record 记忆(由
// capacity.RecordIntent 产出的闭环回写格式),记录 "搞一下这个部署" 是
// persona-a 的任务。
func seedL4Habit(t *testing.T, store *memory.Store) {
t.Helper()
ctx := context.Background()
@@ -26,9 +26,9 @@ func seedL4Habit(t *testing.T, store *memory.Store) {
}
}
// TestLoop_Capacity_L4_WakesOnLearnedHabit_OwnerEnv proves the L4 feed: with a
// retrieved user habit recording that the phrase is a task, an otherwise-undecided
// turn wakes in the owner-full env, and the model is advertised the awake tool set.
// TestLoop_Capacity_L4_WakesOnLearnedHabit_OwnerEnv 证明 L4 输入:在
// 检索到记录该短语是任务的用户习惯后,一个原本未决的
// turn 在 owner 全权限环境中唤醒,且模型被广告 awake 工具集。
func TestLoop_Capacity_L4_WakesOnLearnedHabit_OwnerEnv(t *testing.T) {
t.Parallel()
store := newTestMemoryStore(t)
@@ -53,15 +53,15 @@ func TestLoop_Capacity_L4_WakesOnLearnedHabit_OwnerEnv(t *testing.T) {
t.Fatal("no streaming request captured")
}
set := toolSet(ad.streamReqs[0].Tools)
// L4 read the learned habit → awake → web-search is advertised (awake set).
// L4 读到了学到的习惯 → 唤醒 → 广告出 web-search(awake 集)。
if !hasAll(set, "terminal", "file", "web-search") {
t.Fatalf("owner L4 tools = %v, want awake set incl web-search", toolNames(ad.streamReqs[0].Tools))
}
}
// TestLoop_Capacity_L4_RestrictedEnv_NoOwnerHabitRead proves the L4 isolation red
// line: in a group/stranger context the loop passes no recall, so the decider falls
// back to L1/L2 and the owner's habit memory is never used to wake the intent.
// TestLoop_Capacity_L4_RestrictedEnv_NoOwnerHabitRead 证明 L4 隔离红线:
// 在群聊/陌生人上下文中循环不传任何召回,因此判定器回退到
// L1/L2,主人的习惯记忆绝不被用来唤醒意图。
func TestLoop_Capacity_L4_RestrictedEnv_NoOwnerHabitRead(t *testing.T) {
t.Parallel()
store := newTestMemoryStore(t)
@@ -86,10 +86,10 @@ func TestLoop_Capacity_L4_RestrictedEnv_NoOwnerHabitRead(t *testing.T) {
t.Fatal("no streaming request captured")
}
set := toolSet(ad.streamReqs[0].Tools)
// Restricted env → L4 silent → the turn stays undecided, and the design/11 §3
// security gate hides every tool that is not marked AllowInGroup (terminal/file
// are unmarked). So the model sees nothing: web-search is absent (owner habit
// not read) and even the quiet-set tools are closed to a group session.
// 受限环境 → L4 静默 → 该 turn 保持未决,且 design/11 §3
// 安全门隐藏所有未标记 AllowInGroup 的工具(terminal/file
// 未标记)。因此模型什么也看不到:web-search 缺席(主人的习惯
// 未被读取),连 quiet 集工具也对群聊会话关闭。
if len(set) != 0 {
t.Fatalf("restricted tools = %v, want none (security gate closes unmarked tools)", toolNames(ad.streamReqs[0].Tools))
}