feat: Phase 1+2 架构进化 — 连续思考链/主动消息决策/情感状态机/离线自主思考 (86文件)
Phase 1 (基础设施): - ThinkChain 思考链连续性 + 差异化思考提示词 (persistent) - AutonomousToolPolicy 工具安全策略 (safe/unsafe/conditional) - MessageScheduler 自适应消息节奏 (Idle/Available/Busy) - SessionEnrichmentStore 渐进式上下文丰富 (5层) - ConversationBus 事件总线 + ResponseCache (dedup) - pkg/logger 统一日志 + 所有 handler 替换 fmt.Printf - NPE 守卫/链路优化/数据库表修复/Go workspace Phase 2 (人格交互): - EmotionState/EmotionTracker 情感状态机 (5种心情, 情绪衰减) - ProactiveGuard 主动消息多维决策 (静默时段/紧急度/频率/校验) - Gateway↔ai-core 在线状态感知链路 (presence notification) - 离线思考频率控制 + 重连问候 + 离线消息排队 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -47,6 +47,7 @@ type SubSessionResult struct {
|
||||
ToolCalls []ToolCallRecord `json:"tool_calls"` // 工具调用记录
|
||||
Memories []MemorySnippet `json:"memories"` // 检索到的记忆片段
|
||||
Confidence float64 `json:"confidence"` // 置信度 0-1
|
||||
Progress float64 `json:"progress"` // 执行进度 0.0 ~ 1.0
|
||||
Error string `json:"error,omitempty"`
|
||||
Metadata map[string]any `json:"metadata"` // 类型特定的元数据
|
||||
}
|
||||
@@ -101,22 +102,44 @@ type MultiMessageItem struct {
|
||||
|
||||
// StreamEvent 流式事件
|
||||
type StreamEvent struct {
|
||||
Type StreamEventType `json:"type"` // delta, segments, done, error, review
|
||||
Delta string `json:"delta,omitempty"` // 逐 token delta
|
||||
Segments []Segment `json:"segments,omitempty"` // 断句片段
|
||||
ReviewMessages []ReviewMessage `json:"review_messages,omitempty"` // 审查后的带类型消息
|
||||
Error error `json:"-"` // 内部错误
|
||||
Type StreamEventType `json:"type"` // delta, segments, done, error, review, thinking, tool_progress, system_info
|
||||
Delta string `json:"delta,omitempty"` // 逐 token delta
|
||||
Segments []Segment `json:"segments,omitempty"` // 断句片段
|
||||
ReviewMessages []ReviewMessage `json:"review_messages,omitempty"` // 审查后的带类型消息
|
||||
ThinkingContent string `json:"thinking_content,omitempty"` // 思考内容
|
||||
ToolProgress *ToolProgressInfo `json:"tool_progress,omitempty"` // 工具进度
|
||||
SystemInfo *SystemInfoPayload `json:"system_info,omitempty"` // 系统信息
|
||||
ProtocolVersion int `json:"protocol_version,omitempty"` // 协议版本
|
||||
Error error `json:"-"` // 内部错误
|
||||
}
|
||||
|
||||
// ToolProgressInfo 工具执行进度
|
||||
type ToolProgressInfo struct {
|
||||
ToolName string `json:"tool_name"`
|
||||
Status string `json:"status"` // started, running, completed, failed
|
||||
Progress float64 `json:"progress"`
|
||||
Message string `json:"message"`
|
||||
}
|
||||
|
||||
// SystemInfoPayload 系统信息负载
|
||||
type SystemInfoPayload struct {
|
||||
Level string `json:"level"` // info, warning, error
|
||||
Message string `json:"message"`
|
||||
Action string `json:"action,omitempty"`
|
||||
}
|
||||
|
||||
// StreamEventType 流式事件类型
|
||||
type StreamEventType string
|
||||
|
||||
const (
|
||||
StreamDelta StreamEventType = "delta"
|
||||
StreamSegments StreamEventType = "segments"
|
||||
StreamDone StreamEventType = "done"
|
||||
StreamError StreamEventType = "error"
|
||||
StreamReview StreamEventType = "review" // 审查后的带类型消息
|
||||
StreamDelta StreamEventType = "delta"
|
||||
StreamSegments StreamEventType = "segments"
|
||||
StreamDone StreamEventType = "done"
|
||||
StreamError StreamEventType = "error"
|
||||
StreamReview StreamEventType = "review" // 审查后的带类型消息
|
||||
StreamThinking StreamEventType = "thinking" // 思考内容
|
||||
StreamToolProgress StreamEventType = "tool_progress" // 工具执行进度
|
||||
StreamSystemInfo StreamEventType = "system_info" // 系统通知
|
||||
)
|
||||
|
||||
// ReviewMessageType 审查消息类型
|
||||
@@ -131,6 +154,7 @@ const (
|
||||
type ReviewMessage struct {
|
||||
Type ReviewMessageType `json:"type"`
|
||||
Content string `json:"content"`
|
||||
DelayMs int `json:"delay_ms,omitempty"` // ms to wait before sending (0 = immediate)
|
||||
}
|
||||
|
||||
// Segment 语音片段
|
||||
|
||||
Reference in New Issue
Block a user