精简动作审查输入并支持审批来源定位 (#125)

* fix: 精简审查背景并区分人工消息与调度输入

* fix: 模型审查仅提交当前调用与选定背景

* feat: 审批来源定位原会话并移除 Worker 审查背景
This commit is contained in:
RuoJi6 authored and GitHub committed 2026-09-15 23:51:37 +08:00
1 parent 0d6fa880b8
commit 04d25eb133
30 files changed
+1143 -465

No files matched your search

-18
View File
@@ -1,28 +1,10 @@
package db
import (
"context"
"encoding/json"
"fmt"
"time"
)
// OperationReviewContext takes one database snapshot of the task's original
// description/goal and registered constraints. Discovered task_scope assets are
// deliberately excluded: discovery does not grant authorization.
func (s *ExplorationStore) OperationReviewContext(ctx context.Context) (description, goal string, constraints []Constraint, err error) {
var raw []byte
err = s.db.QueryRowContext(ctx, `SELECT COALESCE(e.description,''), e.goal,
COALESCE((SELECT jsonb_agg(jsonb_build_object(
'id', c.id, 'kind', c.kind, 'text', c.text, 'origin', COALESCE(c.origin,''), 'created_at', c.created_at
) ORDER BY c.id) FROM task_constraints c WHERE c.exploration_id=e.id), '[]'::jsonb)
FROM explorations e WHERE e.id=$1`, s.expID).Scan(&description, &goal, &raw)
if err == nil {
err = json.Unmarshal(raw, &constraints)
}
return
}
// Constraint is one operator-authored operation constraint for a task: kind=allow
// (permitted operations) or kind=deny (forbidden operations), free-text. Stored in
// task_constraints, keyed by exploration_id (cascades with the exploration).