feat(agent): 云端 Agent 运行时 - 完善 Pi 桥接、上下文压力与临时故障重试

This commit is contained in:
ddcat666 committed 2026-10-04 02:20:30 +08:00
1 parent 0030f4da9b
commit 76ca0fd247
32 files changed
+1663 -1485

No files matched your search

@@ -108,26 +108,6 @@ func (s *Service) attachCloudAgentLessons(canonical *canonicalAgentRequest, user
}
}
// cloudAgentRecordMemorySegment 把系统提示里已经存在的个人记忆块登记为分段。
// 记忆块是在策略编译之后拼接的,编译器录不到它;不登记就会让"系统提示分段"合计
// 小于 system 桶,读数看起来像少算了一截。
func cloudAgentRecordMemorySegment(policy *cloudAgentPolicySnapshot, system string) {
if policy == nil {
return
}
index := strings.Index(system, cloudAgentLessonBlockMarker)
if index < 0 {
for i := range policy.SystemSegments {
if policy.SystemSegments[i].Key == "memory" {
policy.SystemSegments = append(policy.SystemSegments[:i], policy.SystemSegments[i+1:]...)
break
}
}
return
}
cloudAgentRecordSystemSegment(policy, "memory", "个人记忆", system[index:])
}
func cloudAgentRememberLesson(repo *repository.Repository, userID string, state *cloudAgentRuntime, call cloudAgentCall) (any, error) {
if state == nil {
return nil, BadAuthRequest("当前运行状态无效")