继续收敛策划工作区与交付解析错误
保留计划合同 serde 与工作区读写失败正文 避免目录枚举和文本搜索把权限错误当成空结果
This commit is contained in:
@@ -499,7 +499,7 @@ pub(crate) fn list_design_workspace_files(
|
||||
Ok(entries) => entries
|
||||
.collect::<Result<Vec<_>, _>>()
|
||||
.map_err(|error| format!("读取工作区失败:{error}"))?,
|
||||
Err(_) => continue,
|
||||
Err(error) => return Err(format!("读取工作区目录失败:{error}")),
|
||||
};
|
||||
entries.sort_by_key(|entry| entry.file_name());
|
||||
for entry in entries {
|
||||
@@ -881,9 +881,12 @@ fn search_design_text(
|
||||
return Ok(());
|
||||
}
|
||||
if path.is_file() {
|
||||
let Ok(text) = fs::read_to_string(path) else {
|
||||
return Ok(());
|
||||
};
|
||||
let text = fs::read_to_string(path).map_err(|error| {
|
||||
format!(
|
||||
"搜索工作区文件失败:{}:{error}",
|
||||
design_tool_location(root, path)
|
||||
)
|
||||
})?;
|
||||
let display = design_tool_location(root, path);
|
||||
for (index, line) in text.lines().enumerate() {
|
||||
if line.contains(query) {
|
||||
|
||||
@@ -39,7 +39,7 @@ pub(super) async fn update_plan(
|
||||
input: &Value,
|
||||
) -> Result<Value, String> {
|
||||
let mut plan: DirectPlanInput = serde_json::from_value(input.clone())
|
||||
.map_err(|_| "direct-plan-invalid: 计划只接受explanation与plan(step,status)")?;
|
||||
.map_err(|error| format!("direct-plan-invalid: 计划参数解析失败:{error}"))?;
|
||||
if plan.plan.is_empty() || plan.plan.len() > 32 {
|
||||
return Err("direct-plan-invalid: 计划需包含1到32步".into());
|
||||
}
|
||||
@@ -177,7 +177,8 @@ struct FrozenContract {
|
||||
}
|
||||
|
||||
fn normalized_contract(input: &Value, new_web_game: bool) -> Result<FrozenContract, String> {
|
||||
let mut input: ContractInput = serde_json::from_value(input.clone()).map_err(|_| "delivery-contract-invalid: 只接受 scope、changeKind 和明确类型的 requirements,不接受通过声明")?;
|
||||
let mut input: ContractInput = serde_json::from_value(input.clone())
|
||||
.map_err(|error| format!("delivery-contract-invalid: 合同参数解析失败:{error}"))?;
|
||||
input.scope = input.scope.trim().to_string();
|
||||
if input.scope.is_empty()
|
||||
|| input.scope.chars().count() > 1200
|
||||
|
||||
@@ -80,3 +80,4 @@ DirectProject 回合失败在确认不是客户端内部不可归类故障时,
|
||||
- 项目权限策略读取还有两条调用方会在 IPC 异常时直接返回 `false`;现把脱敏后的读取错误同时写入工作台状态和项目聊天错误,不再把“未获权限”与“策略读取失败”混为一谈。
|
||||
- 策划 Agent 的 Tauri 事件订阅失败原先只放行回合等待、没有任何用户提示;现把订阅 IPC 正文写入项目聊天错误出口,避免只收到不完整的最终态。
|
||||
- 专业 Agent 历史回读与项目清单同步的后台 Promise 失败原先只返回 `failed` 或静默结束;现把具体读取/同步正文写入项目聊天错误出口。
|
||||
- Direct 交付计划/合同 JSON 解析、策划工作区目录枚举与文本搜索还有 `map_err(|_|)` / `Err(_)` 丢细节;现保留 serde、目录和文件读取正文,安全路径边界仍单独拒绝。
|
||||
|
||||
Reference in New Issue
Block a user