docs(comments): 注释中文化 · internal/runtime/orchestration(29 文件,纯替换)
- 只翻注释/文档字符串:剥离注释后代码行逐字节不变(机械校验只剩允许的行尾注释形态) - 裁决编号与 design 节号(02.4.3 / 11.4.2 / design/05 §9 等)逐字保留 - 复核:go build 绿;orchestration 及其子包(audit/comm)测试绿;gofmt 干净
This commit is contained in:
1 parent
fe90f64a56
commit
eb1828ee7a
29 files changed
+751
-949
No files matched your search
@@ -7,60 +7,58 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/loop"
|
||||
)
|
||||
|
||||
// SubAgentResult is a point-in-time snapshot of a SubAgent. It is used both as
|
||||
// the per-sub-agent entry in MergedResult and as the return value of
|
||||
// (*SubAgent).Snapshot for monitoring.
|
||||
// SubAgentResult 是 SubAgent 在某一时刻的快照。它既用作 MergedResult 中每个子代理的
|
||||
// 条目,也用作 (*SubAgent).Snapshot 供监控使用的返回值。
|
||||
type SubAgentResult struct {
|
||||
// ID is the sub-agent id.
|
||||
// ID 是子代理 id。
|
||||
ID string
|
||||
// Goal is the sub-agent's objective.
|
||||
// Goal 是子代理的目标。
|
||||
Goal string
|
||||
// RoleID is the bound role/persona.
|
||||
// RoleID 是绑定的角色/persona。
|
||||
RoleID string
|
||||
// PersonaID is the target role the sub-agent runs as (blank = the spawning
|
||||
// turn's role), whose instructions and memory scope its run used (design/22 §8-2).
|
||||
// PersonaID 是子代理运行时充当的目标角色(空 = 派发回合的角色),其指令与记忆
|
||||
// 作用域为本次运行所用(design/22 §8-2)。
|
||||
PersonaID string
|
||||
// Mode is the bound behavior mode.
|
||||
// Mode 是绑定的行为模式。
|
||||
Mode string
|
||||
// AttachInfo is the supplied attachment text.
|
||||
// AttachInfo 是随派发提供的附加文本。
|
||||
AttachInfo string
|
||||
// Status is the terminal (or current) status.
|
||||
// Status 是终结态(或当前状态)。
|
||||
Status Status
|
||||
// Summary is the execution summary written on finalization.
|
||||
// Summary 是收尾时写入的执行摘要。
|
||||
Summary string
|
||||
// Text is the loop result text on a successful run.
|
||||
// Text 是运行成功时的循环结果文本。
|
||||
Text string
|
||||
// Steps is the number of loop steps executed on a successful run.
|
||||
// Steps 是运行成功时执行的循环步数。
|
||||
Steps int
|
||||
// Err is the error that ended a failed/aborted run (nil on success).
|
||||
// Err 是结束失败/中止运行的那个错误(成功时为 nil)。
|
||||
Err error
|
||||
// StartedAt is when the sub-agent began running.
|
||||
// StartedAt 是子代理开始运行的时间。
|
||||
StartedAt time.Time
|
||||
// FinishedAt is when the sub-agent finalized.
|
||||
// FinishedAt 是子代理收尾的时间。
|
||||
FinishedAt time.Time
|
||||
}
|
||||
|
||||
// MergedResult aggregates the outcomes of every spawned sub-agent, produced by
|
||||
// (*Scheduler).Join.
|
||||
// MergedResult 聚合每个已派发子代理的结果,由 (*Scheduler).Join 产出。
|
||||
type MergedResult struct {
|
||||
// Agents holds one entry per spawned sub-agent, in spawn order.
|
||||
// Agents 持有每个已派发子代理的一个条目,按派发顺序排列。
|
||||
Agents []SubAgentResult
|
||||
// Total is the number of spawned sub-agents.
|
||||
// Total 是已派发子代理的数量。
|
||||
Total int
|
||||
// Succeeded is how many sub-agents finished with StatusDone.
|
||||
// Succeeded 是以 StatusDone 结束的子代理数量。
|
||||
Succeeded int
|
||||
// Failed is how many sub-agents finished with StatusFailed.
|
||||
// Failed 是以 StatusFailed 结束的子代理数量。
|
||||
Failed int
|
||||
// Aborted is how many sub-agents finished with StatusAborted.
|
||||
// Aborted 是以 StatusAborted 结束的子代理数量。
|
||||
Aborted int
|
||||
// Summary is a one-line aggregate summary of all sub-agents.
|
||||
// Summary 是全部子代理的单行聚合摘要。
|
||||
Summary string
|
||||
}
|
||||
|
||||
// summaryTextMax caps how many runes of the result text appear in a summary.
|
||||
// summaryTextMax 限制摘要中出现的结论文本字符数上限。
|
||||
const summaryTextMax = 80
|
||||
|
||||
// doneSummary builds the execution summary written when a sub-agent succeeds.
|
||||
// doneSummary 构建子代理成功时写入的执行摘要。
|
||||
func doneSummary(res *loop.Result) string {
|
||||
if res == nil {
|
||||
return "完成"
|
||||
@@ -72,7 +70,7 @@ func doneSummary(res *loop.Result) string {
|
||||
return fmt.Sprintf("完成 (步骤=%d): %s", res.Steps, text)
|
||||
}
|
||||
|
||||
// failedSummary builds the summary written when a sub-agent fails.
|
||||
// failedSummary 构建子代理失败时写入的摘要。
|
||||
func failedSummary(err error) string {
|
||||
if err == nil {
|
||||
return "失败"
|
||||
@@ -80,12 +78,12 @@ func failedSummary(err error) string {
|
||||
return "失败: " + err.Error()
|
||||
}
|
||||
|
||||
// canceledSummary builds the summary written when a sub-agent is aborted.
|
||||
// canceledSummary 构建子代理被中止时写入的摘要。
|
||||
func canceledSummary() string {
|
||||
return "中止: 已取消"
|
||||
}
|
||||
|
||||
// timeoutSummary builds the summary written when a sub-agent times out.
|
||||
// timeoutSummary 构建子代理超时写入的摘要。
|
||||
func timeoutSummary(d time.Duration) string {
|
||||
return fmt.Sprintf("中止: 超时 (%s)", d)
|
||||
}
|
||||
@@ -99,7 +97,7 @@ func timeoutSummaryFor(d time.Duration) string {
|
||||
return timeoutSummary(d)
|
||||
}
|
||||
|
||||
// summarizeMerged produces the one-line aggregate summary of a merged result.
|
||||
// summarizeMerged 产出合并结果的单行聚合摘要。
|
||||
func summarizeMerged(r *MergedResult) string {
|
||||
return fmt.Sprintf("子代理汇总: 共 %d 个, %d 成功, %d 失败, %d 中止",
|
||||
r.Total, r.Succeeded, r.Failed, r.Aborted)
|
||||
|
||||
Reference in new issue
Block a user