d2254d1e8c
## 概要 - 抽取通用 `agent-runtime-orchestration` crate,承接多 Agent DAG 的构图校验、ready/wave、下游闭包和全量/返工选择。 - 保留 `platform-agent` 的游戏领域任务与语义路由,避免把 Runtime、Provider、ToolHost 和持久化职责下沉到公共编排层。 - 增加 `GraphProposal` / `TaskProposal` / `GraphEdge` / `GraphLimits`,允许宿主在执行中安全应用 LLM 提出的新增节点和边。 - 扩图采用候选图原子校验:未知 Agent/端点、重复边、自依赖、环及节点/边/深度/扇出预算都会拒绝,失败时原图保持不变;新增节点默认为 `Pending`。 ## 验证 - `npm run agent-runtime-orchestration:check`(15 项通过) - `cargo test --manifest-path server-rs/crates/platform-agent/Cargo.toml`(19 项通过) - `npm run agc:skill-pack:check` - `npm run check:encoding` - `git diff --check` 前端 typecheck 本轮未执行:当前工作树未安装 `node_modules/tsc`,命令会报 `tsc is not recognized`。 Reviewed-on: http://192.168.35.82/git/GenarrativeAI/Genarrative/pulls/207
65 lines
1.5 KiB
Rust
65 lines
1.5 KiB
Rust
use std::fmt;
|
|
|
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
|
pub enum OrchestrationErrorKind {
|
|
InvalidInput,
|
|
InvalidLimits,
|
|
EmptyProposal,
|
|
DuplicateTask,
|
|
DuplicateDependency,
|
|
DuplicateEdge,
|
|
UnknownDependency,
|
|
SelfDependency,
|
|
Cycle,
|
|
UnknownAgent,
|
|
UnknownTask,
|
|
ExistingTaskMutation,
|
|
NodeBudgetExceeded,
|
|
EdgeBudgetExceeded,
|
|
DepthBudgetExceeded,
|
|
FanOutBudgetExceeded,
|
|
ConflictingTaskSet,
|
|
UnsatisfiedDependency,
|
|
}
|
|
|
|
#[allow(non_upper_case_globals)]
|
|
impl OrchestrationErrorKind {
|
|
/// Compatibility alias for callers that describe the node budget as a
|
|
/// task budget.
|
|
pub const TaskBudgetExceeded: Self = Self::NodeBudgetExceeded;
|
|
|
|
/// Compatibility alias for callers that use the shorter fan-out spelling.
|
|
pub const FanoutBudgetExceeded: Self = Self::FanOutBudgetExceeded;
|
|
}
|
|
|
|
#[derive(Clone, Debug, Eq, PartialEq)]
|
|
pub struct OrchestrationError {
|
|
kind: OrchestrationErrorKind,
|
|
detail: String,
|
|
}
|
|
|
|
impl OrchestrationError {
|
|
pub(crate) fn new(kind: OrchestrationErrorKind, detail: impl Into<String>) -> Self {
|
|
Self {
|
|
kind,
|
|
detail: detail.into(),
|
|
}
|
|
}
|
|
|
|
pub fn kind(&self) -> OrchestrationErrorKind {
|
|
self.kind
|
|
}
|
|
|
|
pub fn detail(&self) -> &str {
|
|
&self.detail
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for OrchestrationError {
|
|
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
formatter.write_str(&self.detail)
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for OrchestrationError {}
|