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

-4
View File
@@ -494,10 +494,6 @@ func (s *Service) CreateCloudAgentRun(userID string, req CloudAgentRequest, pare
canonical.Messages = append(append([]map[string]any{}, canonical.Messages[:len(canonical.Messages)-1]...), catalog, last)
}
s.attachCloudAgentLessons(&canonical, userID, req.Prompt)
// 必须登记进 state.Policy(值拷贝):state 才是随任务持久化、被运行期读取的那份,
// 在这里改局部 policy 不会生效。登记之后压力读数的"系统提示分段"才能把 memory 摊开,
// 并与 system 桶合计对齐。
cloudAgentRecordMemorySegment(&state.Policy, canonical.SystemPrompt)
canonical.PromptCacheKey = cloudAgentPromptCacheKeyForRequest(req.CanvasID, cloudAgentPromptCacheIdentity(req, policy), canonical.SystemPrompt, canonical.Tools)
attachCloudAgentPlan(&canonical, inheritedPlan)
input := map[string]any{"mode": "text", "prompt": req.Prompt, "textHistory": history, "textOptions": map[string]any{"stream": true, "thinking": cloudAgentReasoningEnabled(policy.ReasoningMode)}, "cloudAgent": state,