mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-10-27 17:03:49 +08:00
审查模型改为接收版本化 JSON:任务描述/目标/操作约束、工作目录、Worker 意图、当前轮输入,以及按 tool_use_id 配对的近期工具执行记录;末尾是完整的 tool_name 与 arguments。 - 任务约束每次审查从数据库重新读取;读取失败或约束超预算转人工。 - 历史只保留唯一配对的执行事实,排除 Agent 自述、未完成请求与平台拒绝反馈。 - 裁决改为 JSON decision(allow/ask/deny) + comment,三种结果均须说明实际操作、成功后果与命中规则。 - 所有模型裁决(含自动放行)保存实际模型输入与 SHA-256 指纹,详情页可展开。 - 对话审批卡片支持展开完整请求、模型输入、裁决与执行结果。 - 修复父目录 lockfile 导致的 Turbopack 根目录误判。 官方默认拦截规则、工具范围与优先级不变。
29 lines
942 B
Go
29 lines
942 B
Go
package agent
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/Autumn-27/artex/db"
|
|
"github.com/Autumn-27/artex/intercept"
|
|
)
|
|
|
|
// Keep operator constraints separate from worker plans and discovered assets.
|
|
// The reader runs for each review so mid-run constraint edits are visible.
|
|
func withTaskReviewContext(ctx context.Context, taskID int64, ts *db.ExplorationStore, workDir string, intent *db.Node) context.Context {
|
|
intentText := ""
|
|
if intent != nil {
|
|
intentText = string(intent.Payload)
|
|
}
|
|
var load func(context.Context) (*intercept.ReviewTask, error)
|
|
if ts != nil {
|
|
load = func(ctx context.Context) (*intercept.ReviewTask, error) {
|
|
description, goal, constraints, err := ts.OperationReviewContext(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &intercept.ReviewTask{TaskID: taskID, Description: description, Goal: goal, Constraints: constraints}, nil
|
|
}
|
|
}
|
|
return intercept.WithReviewContext(ctx, workDir, intentText, load)
|
|
}
|