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
@@ -8,23 +8,22 @@ import (
|
||||
"git.yeij.top/AskaEth/Cyrene_v2/internal/runtime/orchestration/audit"
|
||||
)
|
||||
|
||||
// AuditMode selects how a sub-agent context is shaped for the subagent_ask
|
||||
// upstream WS route. It mirrors the audit.ContextAuditor surface (Full/Tail/
|
||||
// Keyword) so the gateway can request exactly the window the client asks for.
|
||||
// AuditMode 选择子代理上下文为 subagent_ask 上游 WS 路由裁剪成什么形状。它与
|
||||
// audit.ContextAuditor 的表面(Full/Tail/Keyword)一一对应,使网关能按客户端所请求
|
||||
// 的窗口精确取用。
|
||||
type AuditMode string
|
||||
|
||||
const (
|
||||
// AuditFull returns the entire conversation context.
|
||||
// AuditFull 返回整段会话上下文。
|
||||
AuditFull AuditMode = "full"
|
||||
// AuditTail returns the last n messages of the context.
|
||||
// AuditTail 返回上下文最后 n 条消息。
|
||||
AuditTail AuditMode = "tail"
|
||||
// AuditKeyword returns the window around the first keyword match.
|
||||
// AuditKeyword 返回首个关键词命中处附近的窗口。
|
||||
AuditKeyword AuditMode = "keyword"
|
||||
)
|
||||
|
||||
// AuditResult is the read-only result of auditing a sub-agent's conversation
|
||||
// context. Messages carries the selected window; Line and Match are populated for
|
||||
// a keyword query. It is the wire payload for a ws.subagent_event reply.
|
||||
// AuditResult 是审计一个子代理会话上下文的只读结果。Messages 承载被选中的窗口;
|
||||
// Line 与 Match 仅在关键词查询时填充。它是 ws.subagent_event 应答的线上载荷。
|
||||
type AuditResult struct {
|
||||
AgentID string `json:"agentId"`
|
||||
Status Status `json:"status"`
|
||||
@@ -35,12 +34,11 @@ type AuditResult struct {
|
||||
Match string `json:"match,omitempty"`
|
||||
}
|
||||
|
||||
// AuditContext returns a read-only view of sub-agent id's conversation context
|
||||
// for the subagent_ask WS route. mode selects the window: AuditFull returns the
|
||||
// whole context, AuditTail returns the last n messages, AuditKeyword returns the
|
||||
// window around the first query hit. It wraps ErrAgentNotFound for an unknown id
|
||||
// and audit.ErrQueryEmpty for a blank keyword query, both with %w so callers can
|
||||
// classify with errors.Is.
|
||||
// AuditContext 返回子代理 id 的会话上下文只读视图,供 subagent_ask WS 路由使用。
|
||||
// mode 选择窗口:AuditFull 返回整段上下文,AuditTail 返回最后 n 条消息,
|
||||
// AuditKeyword 返回首个 query 命中处附近的窗口。未知 id 包装 ErrAgentNotFound,
|
||||
// 关键词查询为空则包装 audit.ErrQueryEmpty,两者都以 %w 包装,便于调用方用
|
||||
// errors.Is 归类。
|
||||
func (s *Scheduler) AuditContext(ctx context.Context, id string, mode AuditMode, n int, query string) (*AuditResult, error) {
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, fmt.Errorf("orchestration: audit %q: %w", id, err)
|
||||
@@ -77,9 +75,8 @@ func (s *Scheduler) AuditContext(ctx context.Context, id string, mode AuditMode,
|
||||
return res, nil
|
||||
}
|
||||
|
||||
// messageText concatenates the text parts of one message. It mirrors the audit
|
||||
// subpackage's own helper so the result payload can surface a human-readable
|
||||
// match without exporting a cross-package text extractor.
|
||||
// messageText 拼接一条消息的各个文本分段。它与 audit 子包自己的同名辅助函数保持一致,
|
||||
// 使结果载荷能给出人类可读的命中文本,而无需导出跨包的文本提取器。
|
||||
func messageText(m model.Message) string {
|
||||
var text string
|
||||
for _, c := range m.Content {
|
||||
|
||||
Reference in new issue
Block a user