feat(core): 14 个公开枚举标记 #[non_exhaustive]

为 v0.2.0-rc.1 API 稳定性收尾。覆盖:
- P0 核心 IR: Message / ContentBlock / ContentBlockType / StreamEvent / HookEvent
- P0 Error: AgentError / LlmError / ToolError / MemoryError / PromptError
- P1 其他: MemoryStrategy / StepStatus / ToolChoice / ResponseFormat

明确不加的: 内部 wire-format (OpenaiChatMessage 等) /
语义已收敛 (Role/ServiceTier 等) / 使用面窄 (Permission 等)。

示例侧的 3 处 Message exhaustive match (prompt_composer /
conversation_memory_demo) 补全 `_` 通配分支,零行为变化。

验收: cargo build + clippy -D warnings + test --all-targets 全绿 (200 passed)
This commit is contained in:
徐涛
2026-07-05 19:47:03 +08:00
parent b8f4fe0fe3
commit 6e1182e64c
14 changed files with 17 additions and 0 deletions
+1
View File
@@ -29,6 +29,7 @@ fn message_text(msg: &Message) -> &str {
.next()
.unwrap_or(""),
Message::UserImage { .. } => "[image]",
_ => "",
}
}
+2
View File
@@ -27,6 +27,7 @@ fn message_text(msg: &Message) -> String {
})
.collect(),
Message::UserImage { .. } => "[image]".into(),
_ => String::new(),
}
}
@@ -90,6 +91,7 @@ fn main() {
Message::User { .. } | Message::UserImage { .. } => "user",
Message::Assistant { .. } => "assistant",
Message::ToolResult { .. } => "tool",
_ => "unknown",
};
println!("[{i}] {role}: {}", message_text(m));
}