feat: 修复审计落差 #1/#2/#3/#6 + 管理面板移动端适配
CI / Backend (build / vet / test / cross-compile) (push) Has been cancelled
CI / Frontend (tsc + vite build) (push) Has been cancelled

#1 工具布尔标记生效(agent-106, 安全红线): loop toolSchemas/runToolCalls 加 allow-set 安全门 restrictSchemas/applyToolSecurityGate——群聊/陌生人只暴露允许工具(默认关), 被拒not_allowed软提示+AuditEvent, owner全工具不变; 身份靠 ActorEnv(非提示词)
#2 checkpoint 恢复(agent-109): run.go LoadLatest + resumableStopReason门控(只恢复in-flight工具循环,不出答案不续跑), 幂等不重放副作用, 新会话不误恢复; resume_test 4用例
#3 tool_result(agent-108, 协议层): Anthropic 原生tool_result块(tool_use_id/is_error)非user纯文本 + OpenAI tool消息补tool_call_id; Content加ToolCallID/IsError等; (loop接线层2处留待,见备注)
#6 capacity_awaken推送(agent-107): onCapacity从只Debug改推WS hub(BroadcastCapacityAwaken, sessionId定向+payload对齐前端AwakenPayload)
管理面板移动端(agent-110): AdminApp 汉堡菜单+抽屉侧栏+标题truncate防换行, RBAC守卫不受影响
全仓 build/vet/test绿 + 前端build绿; 前端无涉差异已对齐

备注: #3 loop接线层2处(assistant工具轮append历史 + Message.ToolCallID/IsError)留给后续; #4代审/#5子代理触发/#7拆文件后置(主人说后三不急)
This commit is contained in:
Aska committed 2026-09-07 13:43:18 +08:00
1 parent aedae2190b
commit 7e39153a69
24 files changed
+1286 -56

No files matched your search

+10 -2
View File
@@ -58,6 +58,12 @@ func (l *Loop) temperature() *float64 {
// (a view over the dispatcher, per design/14 §4): the model sees/invokes only
// the allowed tools, while Invoke itself stays unblocked. A nil or disabled
// decider keeps the pre-existing behavior (every tool advertised).
//
// The design/11 §3 security gate runs last over whatever the capacity view left:
// in a group/stranger environment only tools whose editable marker allows that
// environment are advertised (default closed), and the owner environment keeps
// the full set. Security is a hard red line, not a convenience hint, so it can
// only shrink the surface — it never re-admits a tool capacity excluded.
func (l *Loop) toolSchemas(ctx context.Context, messages []model.Message) []model.ToolSpec {
d := l.dispatcher()
if d == nil {
@@ -65,7 +71,7 @@ func (l *Loop) toolSchemas(ctx context.Context, messages []model.Message) []mode
}
schemas := d.ToolSchemas()
if l.capacity == nil || !l.capacity.Enabled() {
return schemas
return l.restrictSchemas(ctx, d, schemas)
}
names := make([]string, 0, len(schemas))
@@ -81,7 +87,9 @@ func (l *Loop) toolSchemas(ctx context.Context, messages []model.Message) []mode
})
acc.state = dec.State
if l.onCapacity != nil && !isMutedBroadcast(ctx) {
sessionID := loopSession(ctx)
for _, ev := range dec.Events {
ev.SessionID = sessionID
l.onCapacity(ev)
}
}
@@ -96,7 +104,7 @@ func (l *Loop) toolSchemas(ctx context.Context, messages []model.Message) []mode
out = append(out, s)
}
}
return out
return l.restrictSchemas(ctx, d, out)
}
// capacityTexts extracts the recent conversation text for the capacity decider: