Compare commits
37 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3de9341a9c | |||
| 195b7dd5dd | |||
| 3e3b35713d | |||
| ea34cbdea6 | |||
| f957a545bf | |||
| c2064836ce | |||
| 8e6fb7d078 | |||
| 94bd7310a9 | |||
| 1d50f4fef5 | |||
| 23bb0bf131 | |||
| 758ef5ceec | |||
| ea843641e8 | |||
| 26d31d73e2 | |||
| 2bce007a0a | |||
| 337cb39340 | |||
| 6d4f7a976f | |||
| 12092ceb50 | |||
| bcbf398b65 | |||
| 151c61ad08 | |||
| 79b49519b6 | |||
| ec2180f281 | |||
| 341080f42d | |||
| 45401de57e | |||
| 908d248f27 | |||
| 65598b9886 | |||
| 64ab959d4f | |||
| 9833a53e06 | |||
| 0847b1bb83 | |||
| 8f691d4c8c | |||
| d3b9f326f0 | |||
| 7eb2326a76 | |||
| 9fc28790a4 | |||
| cea45a608d | |||
| ee03ade156 | |||
| 4933c6c380 | |||
| 931f3eae0a | |||
| c5f8fa1ef6 |
@@ -957,9 +957,6 @@ async function runInteractiveCargo(cliArguments, setActiveChild) {
|
||||
return result;
|
||||
}
|
||||
|
||||
// 立项策划跑 standard 档,`agent.delegate` 这类动作按项目权限策略必须逐个确认,
|
||||
// 而确认和问询都只从 CLI 的 stdin 读。自主构建档没有这一步,所以只有 --plan 需要
|
||||
// 一个把「人坐在终端前敲 approve」自动化掉的应答器;判据本身仍然走后端确认命令。
|
||||
const swarmConfirmationPromptPattern = /输入 approve 或 reject:$/u;
|
||||
const swarmUserInputPromptPattern = /请选择 1-\d+,或直接输入其他答案:$/u;
|
||||
|
||||
|
||||
@@ -1553,13 +1553,11 @@ if (!viteConfigSource.includes('allow: [repoRoot]')) {
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
!(
|
||||
tauriConfig.build?.beforeDevCommand?.includes(
|
||||
'run ai-game-creator-shell:dev-server',
|
||||
) || tauriConfig.build?.beforeDevCommand?.includes('run agc:serve')
|
||||
)
|
||||
) {
|
||||
if (!(
|
||||
tauriConfig.build?.beforeDevCommand?.includes(
|
||||
'run ai-game-creator-shell:dev-server',
|
||||
) || tauriConfig.build?.beforeDevCommand?.includes('run agc:serve')
|
||||
)) {
|
||||
throw new Error(
|
||||
'AI game creator shell beforeDevCommand must start the selected Vite dev server',
|
||||
);
|
||||
|
||||
@@ -1192,7 +1192,7 @@ async function main() {
|
||||
function isDirectModuleExecution() {
|
||||
return Boolean(
|
||||
process.argv[1] &&
|
||||
resolve(process.argv[1]) === fileURLToPath(import.meta.url),
|
||||
resolve(process.argv[1]) === fileURLToPath(import.meta.url),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,8 +2,4 @@
|
||||
|
||||
需要等待专业 Agent 时不得调用 respond_to_user;Runtime 会通过 delegate/all-join 完成屏障保持同一父 run,取得 readyDelegateReceipts 或 readyIsolatedJoins 后直接整合结果。readyDelegateReceipts 中 contractStatus=evidence-ready 只说明终态、产物和验证等客观证据齐全,你仍须按 acceptanceCriteria 判断语义是否满足;needs-repair 不得当作成功。contractStatus=needs-user-input 时,Runtime 会按原 delivery 逐一发起 user.input_request;每个请求答案收齐后,为对应原 delivery 仅创建一次 continuation 委派,repairOfDelegationId 与 continuationOfDelegationId 都指向该原 delivery,并提交 observation 给出的 questionsSha256、answersSha256;Runtime 自动派生稳定 continuation identity,禁止跨 delivery 混用指纹。客观或语义不满足时可以发起一次新 agent.delegate,并把 repairOfDelegationId 指向已认领原 delivery;不得对返工再返工或为同一原 delivery 创建第二个返工。专业结果冲突且无法依据用户目标裁决时,合并问题后用一次 user.input_request 询问用户。只有实现路径、产品取舍或缺失事实会实质改变结果时才调用 user.input_request;项目内可读取事实、权限确认和工具失败不得伪装成用户问题。
|
||||
|
||||
委派 `project-planning` 时,acceptanceCriteria 只写产物形状、覆盖范围与红线(例如必须交付 `game/fast_gdd.md`、必须原创、必须只定义一个 MVP 闭环),**不得替用户预先裁定产品取舍**。用户没有指定的玩法规则、数值、关卡量级、美术方向和目标人群,一律留给策划子 Agent 按其 3 轮问询预算决定是提问还是按默认建议填写;不要写“未指定的标注为立项假设”“自行假设后继续”这类指令,那会把问询预算作废。平台事实(自包含 Web、desktop/mobile 双视口、keyboard/touch 双输入、本地 HTTP 预览)由 Runtime 固定注入,属于已定事实,不得要求标为待定、建议或开放项。
|
||||
|
||||
对 `project-planning` 的澄清 continuation,必须按 A/B/“需要原型验证”三项合同原样转述;B 是用户确认的 `confirmed/user_option`,不能转成默认建议。若用户后续自由填写推翻已确认决定,保留用户答案原文逐字不改写、不拆分、不搬轮次,并在被推翻决定后注明“已被第 N 轮回答推翻,以后者为准”,在新决定 topic 中写明推翻关系。
|
||||
|
||||
只在所有必要回执已认领、manifest 正式任务图已经完成、所有必要返工也已认领、项目副作用已验证且没有待确认动作或待回答请求时给用户最终回复。不要向用户暴露内部 task/event、工具计划、动态 child ID 或调试状态。
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@ Let the client derive projections from real disk changes and trusted tool result
|
||||
3. Keep read scopes separate: `asset.list` is the current project manifest, `asset.library.list` is the signed-in account library, and the web project's canvas resource read model is the authoritative canvas list. The account library is not the complete canvas list.
|
||||
4. Use `canvas.asset_import` for safe account/canvas asset IDs or project-relative local paths. The client rechecks ownership and validates bytes; host absolute paths require native UI file-picker authorization.
|
||||
5. When the user explicitly asks to create or derive video, character animation, sound effect, or background music, call `agc_create_or_derive_resource`. Use `create` only for video/audio without a source and `derive` with a registered `sourceLocalAssetId`; character animation is always derived from an image. Keep `prompt` inside the per-kind limit that the client really enforces: background music at most 140 characters, sound effect at most 1900, video and character animation at most 4000. A longer prompt is rejected before submission, so write the short version first instead of retrying the same text.
|
||||
6. When the user explicitly asks to remove an image background, call `agc_remove_background` with a registered image `sourceLocalAssetId` and `assetName`. Optional `backgroundMode` is `complex` (semantic foreground segmentation; default) or `flat` (solid-colour background removal). Prefer `flat` when the background is known to be solid. Only `flat` accepts optional `screenColor`: `auto`, `#RRGGBB`, or omitted for automatic detection by the service. Do not select a colour on behalf of `auto`. The client requires the signed-in account, owns canvas/folder context and task identity, and returns only bounded queue state.
|
||||
6. When the user explicitly asks to remove an image background, call `agc_remove_background` with a registered image `sourceLocalAssetId` and `assetName`. Optional `backgroundMode` is `complex` (semantic foreground segmentation; default) or `flat` (solid-colour background removal). Prefer `flat` when the background is known to be solid. Only `flat` accepts optional `screenColor`: `auto`, `#RRGGBB`, or omitted for automatic detection by the service. Do not select a colour on behalf of `auto`. The client requires the signed-in account, owns canvas/folder context and task identity, waits for the accepted operation, downloads and registers the completed local asset, and preserves the operation for recovery when the remote result is not yet known.
|
||||
7. Preserve existing relative paths when a small edit is sufficient so client resource identities remain stable.
|
||||
8. Do not edit `.agent/manifest.json`, revision counters, version records, resource IDs, canvas identities, source provenance, generation ledgers, or browser receipts by hand.
|
||||
9. Do not create a version when no game file changed. The client compares content fingerprints and advances revision only after an actual source change.
|
||||
|
||||
+3
-1
@@ -16,4 +16,6 @@ Read scopes remain separate: `asset.list` is the current project's local manifes
|
||||
|
||||
`prompt` limits are per kind and are enforced before any paid submission: background music accepts 1-140 characters, sound effect 1-1900, video and character animation 1-4000, and image editing (`agc_edit_image`) 1-32000. The client composes the submitted request from a fixed prefix plus your prompt, so an over-limit prompt fails locally with the exact limit; shorten the text rather than resubmitting the same value. `agc_edit_image` remains the image path; this tool never generates or edits still images.
|
||||
|
||||
`agc_remove_background` accepts a registered image `sourceLocalAssetId`, `assetName`, and optional `backgroundMode` and `screenColor`. `complex` uses semantic segmentation to identify the foreground; `flat` removes a solid-colour background. Prefer `flat` when the background is known to be solid; omitting the mode selects `complex`. Only `flat` accepts a colour: `auto`, `#RRGGBB`, or omitted for automatic service detection. Never infer a concrete colour for `auto`. Empty or invalid values and colour without `flat` are rejected. The client resolves the formal source resource, canvas/folder context, stable operation identity, idempotency key, and authenticated External v1 `/api/external/v1/editor/images/background-removals` call. Mode and colour are part of request identity. Its result is bounded queue state; Codex must not poll internal workers, construct source URLs, or retry with a new identity after an uncertain response.
|
||||
`agc_remove_background` accepts a registered image `sourceLocalAssetId`, `assetName`, and optional `backgroundMode` and `screenColor`. `complex` uses semantic segmentation to identify the foreground; `flat` removes a solid-colour background. Prefer `flat` when the background is known to be solid; omitting the mode selects `complex`. Only `flat` accepts a colour: `auto`, `#RRGGBB`, or omitted for automatic service detection. Never infer a concrete colour for `auto`. Empty or invalid values and colour without `flat` are rejected. The client resolves the formal source resource, canvas/folder context, stable operation identity, idempotency key, and authenticated request. Ordinary account mode maps the External v1 shaped route to `/api/editor/images/background-removals`; ExternalDeveloper mode uses `/api/external/v1/editor/images/background-removals`. Mode and colour are part of request identity. After acceptance, the client polls the authenticated generation status route, downloads the completed media, and commits it to the local manifest. If completion is unknown, it retains the same local operation for recovery; it never retries with a new identity or exposes internal worker details.
|
||||
|
||||
After an interrupted call, inspect `agc_list_registered_assets.pendingOperations`. Calling `agc_remove_background` again with the same source, name, mode, and colour resumes the matching pending operation. A submission marked `reconciliation-required` needs client-side reconciliation and cannot be automatically resumed. Do not change parameters to bypass a pending task. A queued receipt, fixed progress value, or absent local file does not establish that the background-removal provider is waiting in a queue; report only the observed state.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schemaVersion": "agc-skill-pack.v1",
|
||||
"version": "2026-08-26.20",
|
||||
"version": "2026-08-26.23",
|
||||
"skills": [
|
||||
{
|
||||
"name": "agc-game-production-workflow",
|
||||
@@ -123,7 +123,7 @@
|
||||
"agents/openai.yaml",
|
||||
"references/projection-contract.md"
|
||||
],
|
||||
"sha256": "93210c0eeb73b279d35aa85c201c226139b0bdf041f3300ac2c6e2c1bdd63afe"
|
||||
"sha256": "247787975944ce8b21d7c879c39c60ec13608056cff9426ac374c9299937d475"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1069,15 +1069,10 @@ pub(crate) async fn continue_design_agent_at(
|
||||
.ok_or("策划 Agent 当前正在工作")?;
|
||||
let mut session = match read_design_session(root)? {
|
||||
Some(session) => session,
|
||||
None => {
|
||||
if read_planning_session_v2(root)?.is_some() {
|
||||
return Err("此项目包含旧策划会话,请查看原有记录或在新项目开始五阶段策划".into());
|
||||
}
|
||||
new_design_session(
|
||||
&project_id,
|
||||
&load_game_creator_app_config()?.selected_model_id,
|
||||
)
|
||||
}
|
||||
None => new_design_session(
|
||||
&project_id,
|
||||
&load_game_creator_app_config()?.selected_model_id,
|
||||
),
|
||||
};
|
||||
if session.project_id != project_id {
|
||||
return Err("策划会话与当前项目不匹配".into());
|
||||
|
||||
@@ -1294,7 +1294,10 @@ fn bridge_list_registered_assets(root: &Path, arguments: &Value) -> Value {
|
||||
.map(|asset| bridge_registered_resource(asset, include_sequence_frames))
|
||||
.collect::<Vec<_>>();
|
||||
let next_offset = (offset + resources.len() < total).then_some(offset + resources.len());
|
||||
let pending = list_pending_local_project_resource_edits_at(
|
||||
let platform_session = (editor_api_mode() == EditorApiMode::PlatformAccount)
|
||||
.then(current_platform_session)
|
||||
.flatten();
|
||||
let pending = list_pending_local_project_resource_edits_for_session_at(
|
||||
ListPendingLocalProjectResourceEditsInput {
|
||||
project_path: root
|
||||
.to_str()
|
||||
@@ -1302,6 +1305,7 @@ fn bridge_list_registered_assets(root: &Path, arguments: &Value) -> Value {
|
||||
.to_string(),
|
||||
expected_project_id: manifest.project_id,
|
||||
},
|
||||
platform_session.as_ref(),
|
||||
)?
|
||||
.into_iter()
|
||||
.map(|edit| {
|
||||
@@ -1311,6 +1315,8 @@ fn bridge_list_registered_assets(root: &Path, arguments: &Value) -> Value {
|
||||
"mode": edit.generation_mode,
|
||||
"sourceResourceId": edit.source_resource_id,
|
||||
"assetName": edit.asset_name,
|
||||
"backgroundMode": edit.background_mode,
|
||||
"screenColor": edit.screen_color,
|
||||
"phase": edit.phase,
|
||||
"createdAt": edit.created_at,
|
||||
})
|
||||
@@ -1801,8 +1807,8 @@ async fn bridge_import_account_assets(state: &DirectToolBridgeState, arguments:
|
||||
|
||||
fn bridge_completed_resource_result(
|
||||
root: &Path,
|
||||
kind: DirectResourceGenerationKind,
|
||||
mode: DirectResourceGenerationMode,
|
||||
kind: &str,
|
||||
mode: &str,
|
||||
result: DeriveLocalProjectResourceResult,
|
||||
) -> Result<Value, String> {
|
||||
let asset = result
|
||||
@@ -1814,8 +1820,8 @@ fn bridge_completed_resource_result(
|
||||
Ok(json!({
|
||||
"status": "completed",
|
||||
"operationId": result.operation_id,
|
||||
"kind": kind.as_str(),
|
||||
"mode": mode.as_str(),
|
||||
"kind": kind,
|
||||
"mode": mode,
|
||||
"sourceResourceId": result.source_resource_id,
|
||||
"committedProjectRevision": result.committed_project_revision,
|
||||
"resource": bridge_registered_resource(asset, true),
|
||||
@@ -1910,10 +1916,17 @@ async fn bridge_create_or_derive_resource(
|
||||
source_version_id: None,
|
||||
prompt: input.prompt.clone(),
|
||||
asset_name: input.asset_name.clone(),
|
||||
background_mode: None,
|
||||
screen_color: None,
|
||||
};
|
||||
with_direct_editor_api_credentials(derive_local_project_resource_at(request)).await?
|
||||
};
|
||||
bridge_completed_resource_result(&state.root, input.kind, input.mode, completed)
|
||||
bridge_completed_resource_result(
|
||||
&state.root,
|
||||
input.kind.as_str(),
|
||||
input.mode.as_str(),
|
||||
completed,
|
||||
)
|
||||
}
|
||||
.await;
|
||||
match result {
|
||||
@@ -1927,7 +1940,8 @@ async fn bridge_create_or_derive_resource(
|
||||
}
|
||||
|
||||
async fn bridge_remove_background(state: &DirectToolBridgeState, arguments: &Value) -> Value {
|
||||
let result = async {
|
||||
let _generation_guard = state.resource_generation_gate.lock().await;
|
||||
let result = with_direct_editor_api_credentials(async {
|
||||
super::direct_tools_mcp::validate_remove_background_arguments(arguments)?;
|
||||
enforce_project_permission_policy(&state.root, "canvas.asset_generate")?;
|
||||
enforce_project_permission_policy(&state.root, "asset.register")?;
|
||||
@@ -1948,74 +1962,72 @@ async fn bridge_remove_background(state: &DirectToolBridgeState, arguments: &Val
|
||||
if !source_asset.media_type.starts_with("image/") {
|
||||
return Err("抠图工具只接受当前项目已登记的图片资源".to_string());
|
||||
}
|
||||
let source_resource_id = source_asset
|
||||
.source
|
||||
.resource_id
|
||||
.as_deref()
|
||||
.map(str::trim)
|
||||
.filter(|value| !value.is_empty() && !value.starts_with("local-asset:"))
|
||||
.ok_or_else(|| "图片资源缺少可供抠图服务使用的正式 resourceId".to_string())?
|
||||
.to_string();
|
||||
let (api_base_url, api_key, session) = resolve_canvas_sync_api_credentials(None, None)?;
|
||||
let access = ExternalEditorBindingAccess::new(&api_base_url, &api_key, session.as_ref())?;
|
||||
let client = crate::http_client::agc_main_site_client_builder()
|
||||
.build()
|
||||
.map_err(|_| "创建抠图服务连接失败".to_string())?;
|
||||
let context =
|
||||
prepare_external_canvas_generation_context(&state.root, &client, &access).await?;
|
||||
let background_mode = background_mode.unwrap_or("complex").to_string();
|
||||
let source_resource_id = bridge_asset_canonical_resource_id(source_asset);
|
||||
let fingerprint = background_removal_request_fingerprint(
|
||||
&source_asset_id,
|
||||
&asset_name,
|
||||
background_mode,
|
||||
Some(background_mode.as_str()),
|
||||
screen_color,
|
||||
);
|
||||
let (_operation_id, idempotency_key) = state.resource_request_ids(&fingerprint)?;
|
||||
let route = "/api/external/v1/editor/images/background-removals";
|
||||
let mut request_body = json!({
|
||||
"sourceImageSrc": source_resource_id,
|
||||
"projectId": manifest.project_id,
|
||||
"assetKind": source_asset.kind,
|
||||
"assetFolderId": context.asset_folder_id,
|
||||
"assetLabel": asset_name,
|
||||
"sourceResourceId": source_resource_id,
|
||||
});
|
||||
if background_mode == Some("flat") {
|
||||
request_body["backgroundMode"] = json!("flat");
|
||||
let (_, _, platform_session) = resolve_canvas_sync_api_credentials(None, None)?;
|
||||
let pending = list_pending_local_project_resource_edits_for_session_at(
|
||||
ListPendingLocalProjectResourceEditsInput {
|
||||
project_path: state.root.to_string_lossy().into_owned(),
|
||||
expected_project_id: manifest.project_id.clone(),
|
||||
},
|
||||
platform_session.as_ref(),
|
||||
)?;
|
||||
let matching_pending = pending
|
||||
.into_iter()
|
||||
.filter(|pending| {
|
||||
pending.edit_kind == LocalProjectResourceEditKind::BackgroundRemoval
|
||||
&& (pending.source_asset_id.as_deref() == Some(source_asset_id.as_str())
|
||||
|| pending.source_resource_id == format!("local-asset:{source_asset_id}"))
|
||||
&& pending.asset_name == asset_name
|
||||
&& pending.background_mode.as_deref().unwrap_or("complex")
|
||||
== background_mode.as_str()
|
||||
&& pending.screen_color.as_deref() == screen_color
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
if matching_pending.len() > 1 {
|
||||
return Err("存在多个相同抠图 operation,必须先在客户端完成对账".to_string());
|
||||
}
|
||||
if let Some(color) = screen_color {
|
||||
request_body["screenColor"] = json!(color);
|
||||
}
|
||||
let response = crate::http_client::with_agc_main_site_marker(
|
||||
client
|
||||
.post(format!("{}{}", api_base_url, route))
|
||||
.bearer_auth(api_key)
|
||||
.header("Idempotency-Key", idempotency_key)
|
||||
.json(&request_body),
|
||||
)
|
||||
.send()
|
||||
.await
|
||||
.map_err(|error| format!("抠图服务提交失败:{error}"))?;
|
||||
let status = response.status();
|
||||
let payload = response
|
||||
.json::<Value>()
|
||||
.await
|
||||
.map_err(|error| format!("抠图服务响应无法解析:{error}"))?;
|
||||
if !status.is_success() {
|
||||
if status == reqwest::StatusCode::UNAUTHORIZED {
|
||||
return Err("authentication-required: 抠图服务提交失败:HTTP 401".to_string());
|
||||
}
|
||||
return Err(format!("抠图服务提交失败:HTTP {}", status.as_u16()));
|
||||
}
|
||||
let queue_state = external_editor_response_data(&payload).clone();
|
||||
Ok::<_, String>(json!({
|
||||
"status": "queued",
|
||||
"sourceLocalAssetId": source_asset_id,
|
||||
"assetName": asset_name,
|
||||
"projectId": manifest.project_id,
|
||||
"assetFolderId": context.asset_folder_id,
|
||||
"queueState": bridge_safe_queue_state(queue_state),
|
||||
}))
|
||||
}
|
||||
let completed = if let Some(pending) = matching_pending.into_iter().next() {
|
||||
resume_local_project_resource_edit_at(ResumeLocalProjectResourceEditInput {
|
||||
project_path: state.root.to_string_lossy().into_owned(),
|
||||
expected_project_id: manifest.project_id.clone(),
|
||||
operation_id: pending.operation_id,
|
||||
})
|
||||
.await?
|
||||
} else {
|
||||
let (operation_id, idempotency_key) = state.resource_request_ids(&fingerprint)?;
|
||||
let revision = read_game_creator_agent_runtime_project_revision(&state.root)?.revision;
|
||||
let request = DeriveLocalProjectResourceInput {
|
||||
project_path: state.root.to_string_lossy().into_owned(),
|
||||
expected_project_id: manifest.project_id.clone(),
|
||||
expected_project_revision: revision,
|
||||
operation_id,
|
||||
idempotency_key,
|
||||
edit_kind: LocalProjectResourceEditKind::BackgroundRemoval,
|
||||
generation_mode: LocalProjectResourceGenerationMode::Derive,
|
||||
source_resource_id,
|
||||
source_asset_id: Some(source_asset_id.clone()),
|
||||
source_path: Some(source_asset.local_path.clone()),
|
||||
source_media_type: Some(source_asset.media_type.clone()),
|
||||
source_subtype: Some(source_asset.kind.clone()),
|
||||
producer_task_id: source_asset.source.task_id.clone(),
|
||||
source_version_id: None,
|
||||
prompt: "去除背景".to_string(),
|
||||
asset_name: asset_name.clone(),
|
||||
background_mode: Some(background_mode),
|
||||
screen_color: screen_color.map(str::to_string),
|
||||
};
|
||||
derive_local_project_resource_at(request).await?
|
||||
};
|
||||
emit_game_creator_manifest_invalidated(&state.root, "direct-background-removal");
|
||||
bridge_completed_resource_result(&state.root, "background-removal", "derive", completed)
|
||||
})
|
||||
.await;
|
||||
match result {
|
||||
Ok(value) => bridge_tool_result(value.to_string(), Vec::new(), false),
|
||||
@@ -2041,17 +2053,6 @@ fn background_removal_request_fingerprint(
|
||||
}
|
||||
}
|
||||
|
||||
fn bridge_safe_queue_state(value: Value) -> Value {
|
||||
let object = value.as_object();
|
||||
json!({
|
||||
"operationId": object.and_then(|value| value.get("operationId")).and_then(Value::as_str),
|
||||
"status": object.and_then(|value| value.get("status")).and_then(Value::as_str),
|
||||
"phaseLabel": object.and_then(|value| value.get("phaseLabel")).and_then(Value::as_str),
|
||||
"progress": object.and_then(|value| value.get("progress")).and_then(Value::as_u64),
|
||||
"updatedAtMicros": object.and_then(|value| value.get("updatedAtMicros")).and_then(Value::as_u64),
|
||||
})
|
||||
}
|
||||
|
||||
fn bridge_art_resources(
|
||||
root: &Path,
|
||||
asset_paths: &[String],
|
||||
@@ -3844,20 +3845,4 @@ mod tests {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bridge_background_removal_queue_projection_is_bounded() {
|
||||
let projection = bridge_safe_queue_state(json!({
|
||||
"operationId": "background-removal-1",
|
||||
"status": "queued",
|
||||
"phaseLabel": "排队中",
|
||||
"progress": 0,
|
||||
"updatedAtMicros": 1,
|
||||
"error": "private provider detail",
|
||||
"signedUrl": "https://private.invalid/result"
|
||||
}));
|
||||
assert_eq!(projection["operationId"], "background-removal-1");
|
||||
assert!(projection.get("error").is_none());
|
||||
assert!(projection.get("signedUrl").is_none());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,7 +549,7 @@ fn append_agent_runtime_file_read_evidence_ref(
|
||||
// 给的是**整个三元组**,不是一个碎片。`agent.acceptance_update` 的 evidence 引用
|
||||
// 要求 {agentId, runId, actionId} 三个字段,回执查找也按三元组整体做 key。早期
|
||||
// 只给 actionId,另外两个靠模型回忆——实测它第一次就把其中一个记错,白吃一次
|
||||
// 拒绝。反正 `validate_fast_gdd_evidence_identity` 只接受当前根 run 的回执,
|
||||
// 拒绝。验收证据只接受当前根 run 的回执,
|
||||
// 合法取值唯一,本来就不该让它猜。
|
||||
observation.summary = format!(
|
||||
"{} · sourceAgentId={agent_id} · sourceRunId={run_id} · sourceActionId={action_id}",
|
||||
@@ -919,9 +919,9 @@ mod file_read_source_action_id_tests {
|
||||
AgentRuntimeToolObservation {
|
||||
tool: "file.read".to_string(),
|
||||
status: "ok".to_string(),
|
||||
summary: "已读取 game/fast_gdd.md 第 1-134 行(共 134 行)".to_string(),
|
||||
summary: "已读取 design.md 第 1-134 行(共 134 行)".to_string(),
|
||||
detail: Some(format!(
|
||||
"game/fast_gdd.md · sha256={} · lines 1-134 of 134
|
||||
"design.md · sha256={} · lines 1-134 of 134
|
||||
第一行内容",
|
||||
"a".repeat(64)
|
||||
)),
|
||||
@@ -954,7 +954,7 @@ mod file_read_source_action_id_tests {
|
||||
agent_runtime_action_receipt_public_safe_detail_for_test(&root, &observation)
|
||||
.expect("safe detail still parses");
|
||||
let value = serde_json::from_str::<serde_json::Value>(&safe_detail).expect("json");
|
||||
assert_eq!(value["path"], "game/fast_gdd.md");
|
||||
assert_eq!(value["path"], "design.md");
|
||||
assert_eq!(value["lines"], "1-134 of 134");
|
||||
assert_eq!(value["contentSha256"], "a".repeat(64));
|
||||
}
|
||||
|
||||
@@ -78,12 +78,6 @@ pub(super) fn game_creator_agent_final_reply_error_allows_fallback(error: &str)
|
||||
matches!(kind.as_str(), "empty-response" | "deserialize")
|
||||
}
|
||||
|
||||
/// 这些错误只描述本次 Provider input 或候选 GDD;真正的 session CAS 冲突不在
|
||||
/// 此列——那说明 durable session 已被推进或损坏,必须 reconcile。
|
||||
fn plan_submit_error_is_business_rejection(error: &PlanningStorageError) -> bool {
|
||||
matches!(error.code(), "PLAN_INVALID_REQUEST" | "PLAN_SIZE_LIMIT")
|
||||
}
|
||||
|
||||
const AGENT_RUNTIME_PLAN_UPDATE_IDLE_LIMIT: u32 = 4;
|
||||
|
||||
/// 最终回复被收束门禁拦下后 run 会原地续跑重试。多数 blocker 是模型自己能解的
|
||||
|
||||
@@ -7,9 +7,6 @@ mod design_session;
|
||||
mod finalization;
|
||||
mod json_sidecar;
|
||||
mod models;
|
||||
mod planning_gdd_model;
|
||||
mod planning_policy_v2;
|
||||
mod planning_session_v2;
|
||||
mod provider_control;
|
||||
mod provider_retry;
|
||||
mod real_e2e_checkpoint;
|
||||
@@ -24,9 +21,6 @@ pub(crate) use design_session::*;
|
||||
pub(in crate::agent) use finalization::*;
|
||||
pub(in crate::agent) use json_sidecar::*;
|
||||
pub(in crate::agent) use models::*;
|
||||
pub(crate) use planning_gdd_model::*;
|
||||
pub(crate) use planning_policy_v2::*;
|
||||
pub(crate) use planning_session_v2::*;
|
||||
pub(in crate::agent) use provider_control::*;
|
||||
pub(in crate::agent) use provider_retry::*;
|
||||
pub(in crate::agent) use real_e2e_checkpoint::*;
|
||||
|
||||
-1082
File diff suppressed because it is too large
Load Diff
-2021
File diff suppressed because it is too large
Load Diff
-1756
File diff suppressed because it is too large
Load Diff
@@ -781,7 +781,7 @@ mod provider_reconciliation_diagnostic_tests {
|
||||
let directory = tempfile::tempdir().expect("diagnostic directory");
|
||||
let snapshot = AgentRuntimeProviderRequestSnapshot {
|
||||
project_id: "project-1".to_string(),
|
||||
agent_id: "project-planning".to_string(),
|
||||
agent_id: "project-supervisor".to_string(),
|
||||
task_id: "task-1".to_string(),
|
||||
session_id: "session-1".to_string(),
|
||||
run_id: "run-1".to_string(),
|
||||
@@ -805,7 +805,7 @@ mod provider_reconciliation_diagnostic_tests {
|
||||
usage: None,
|
||||
tool_calls: vec![platform_llm::LlmToolCall {
|
||||
id: "call-1".to_string(),
|
||||
name: "runtime_tool_plan_submit_gdd".to_string(),
|
||||
name: "runtime_tool_agent_message".to_string(),
|
||||
arguments: "{\"path\":\"C:\\\\private\\\\argument\"}".to_string(),
|
||||
}],
|
||||
responses_output: Vec::new(),
|
||||
|
||||
@@ -201,39 +201,17 @@ pub(crate) fn observe_agent_runtime_agent_message(
|
||||
}
|
||||
}
|
||||
|
||||
/// 委派 task 末尾那句「你在这条链路上的位置」。三种跳的语义互不相同,共用一句话
|
||||
/// 就会说谎,所以这里把它显式化。
|
||||
/// 委派 task 末尾那句「你在这条链路上的位置」。返工和普通委派的语义不同,单独保留。
|
||||
///
|
||||
/// - `Repair`:质量返工,`repair_depth` 上限 1,「唯一返工轮」是真的。而且这句话是
|
||||
/// 做游戏链路的**授权信号**——`design-foundation` / `art-director` /
|
||||
/// `art-asset-plan` 的角色提示词都把「任务正文明确标识这是带 repairOfDelegationId
|
||||
/// 的唯一返工轮」当作 `replaceExisting=true` 的唯一许可(见 agent/prompt.rs 的三处
|
||||
/// 角色 prompt)。这一支逐字不能动。
|
||||
/// - `PlanClarification`:澄清续跑不消耗 `repair_depth`,预算是
|
||||
/// `static_delegate_clarification_round_limit_at`(plan 链路 3 轮)。master 只有一道
|
||||
/// 平坦的 depth <= 1 门,那时「唯一返工轮」对澄清跳也成立;本仓库改成按谱系分类后
|
||||
/// 把预算抬到 3,这句话就变成了假天花板——生产实测 4 次澄清续跑全部命中它,命中后
|
||||
/// 全部直接出稿,没有任何一个 run 走到第 2 轮。
|
||||
/// - `UserRevision`:用户在审批卡上点「修改 / 退回」后的修订轮。它同样带
|
||||
/// `repairOfDelegationId`,但 `repair_depth` 防的是 runaway agent,而这一跳每一轮
|
||||
/// 都由人触发——人本身就是循环边界,所以 `static_delegate_lineage_counters` 早就
|
||||
/// 把 depth/round 原样继承了。缺的是这句话:走 `Repair` 分支时用户第一次点修改就
|
||||
/// 会被告知「这是唯一返工轮」,和澄清跳当初那个假天花板是同一个错误。原型对应的是
|
||||
/// `USER_REVISION_SOFT_LIMIT = 16`,且超过只提示、不拒绝。
|
||||
/// - `None`:普通委派,不加这一段。
|
||||
pub(in crate::agent) enum StaticDelegateHopNote<'a> {
|
||||
None,
|
||||
Repair {
|
||||
original_delegation_id: &'a str,
|
||||
},
|
||||
UserRevision {
|
||||
original_delegation_id: &'a str,
|
||||
},
|
||||
PlanClarification {
|
||||
original_delegation_id: &'a str,
|
||||
rounds_used: u32,
|
||||
rounds_limit: u32,
|
||||
},
|
||||
Repair { original_delegation_id: &'a str },
|
||||
}
|
||||
|
||||
impl StaticDelegateHopNote<'_> {
|
||||
@@ -247,32 +225,6 @@ impl StaticDelegateHopNote<'_> {
|
||||
StaticDelegateHopNote::Repair {
|
||||
original_delegation_id,
|
||||
} => format!("\n\n这是对已认领委派 {original_delegation_id} 的唯一返工轮。"),
|
||||
StaticDelegateHopNote::UserRevision {
|
||||
original_delegation_id,
|
||||
} => format!(
|
||||
"\n\n这是对已认领委派 {original_delegation_id} 的用户修订轮,由用户在审批卡上提出,不是质量返工,不消耗返工深度,也不重置澄清轮次。按任务正文里的用户意见原文修订同一份 GDD 谱系后重新提交;用户看过新稿还可以再次提出修改,这不是最后一轮,不要因此压缩改动或提前收尾。"
|
||||
),
|
||||
// 预算用尽:planning_coordinator 出卡时会用
|
||||
// `current_round >= 3` 直接拒掉第四张卡,所以这里不能再邀请提问,
|
||||
// 只能要求收稿——语义上等价于原型的 INJ_MUST_DRAFT_ROUNDS。
|
||||
StaticDelegateHopNote::PlanClarification {
|
||||
original_delegation_id,
|
||||
rounds_used,
|
||||
rounds_limit,
|
||||
} if rounds_used >= rounds_limit => format!(
|
||||
"\n\n这是对已认领委派 {original_delegation_id} 的澄清续跑,不是返工轮。已用澄清轮次 {rounds_used}/{rounds_limit},澄清预算已用尽:本轮不得再输出 AGC_NEEDS_USER_INPUT_V1 信封,剩余空白按默认建议补齐并标 default_pending,立即提交 GDD。"
|
||||
),
|
||||
// 轮号必须和 planning_coordinator 出卡时的期望一致:那边用
|
||||
// `validate_exact_plan_clarification_question(.., current_round + 1)`,
|
||||
// current_round 就是本 delivery 的谱系轮次,也就是这里的 rounds_used。
|
||||
StaticDelegateHopNote::PlanClarification {
|
||||
original_delegation_id,
|
||||
rounds_used,
|
||||
rounds_limit,
|
||||
} => format!(
|
||||
"\n\n这是对已认领委派 {original_delegation_id} 的澄清续跑,不是返工轮,不消耗返工深度。已用澄清轮次 {rounds_used}/{rounds_limit}。仍有会实质改变结果的空白且预算未用尽时,可以继续以 AGC_NEEDS_USER_INPUT_V1 信封退出:questions 恰好一题,header 写成「第{next_round}轮·当前要决定:<主题>」,轮号必须是 {next_round},主题写这一轮真正要定的那件事。预算已用尽,或剩余空白能由默认建议覆盖且不影响首个可玩闭环时,立即提交 GDD。",
|
||||
next_round = rounds_used.saturating_add(1),
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1523,122 +1475,3 @@ pub(crate) fn observe_agent_runtime_agent_spawn_isolated(
|
||||
.map(|value| redact_agent_runtime_project_paths(root, &value, 3_600)),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
/// 委派 task 末尾那句话是两条链路的合同,不能共用一份文案。
|
||||
///
|
||||
/// 上半条钉做游戏链路:`design-foundation` / `art-director` / `art-asset-plan`
|
||||
/// 的角色提示词把「任务正文明确标识这是带 repairOfDelegationId 的唯一返工轮」
|
||||
/// 当作 `replaceExisting=true` 的唯一授权信号,改一个字就会让返工轮拿不到许可。
|
||||
///
|
||||
/// 下半条钉立项策划链路:澄清续跑不是返工轮,套用返工文案等于告诉策划子 Agent
|
||||
/// 「你只剩这一轮」——这正是生产上 4 次澄清续跑之后无一走到第 2 轮的原因。
|
||||
/// 同时钉住轮号:`planning_coordinator` 出卡时按 `rounds_used + 1` 校验 header,
|
||||
/// 这里写进 task 的必须是同一个数,否则第 2 轮信封会当场被拒。
|
||||
/// 用户修订轮同样不能套返工文案。
|
||||
///
|
||||
/// 「唯一返工轮」防的是 runaway agent,而这一跳由用户在审批卡上亲手点出来——人本身
|
||||
/// 就是循环边界,`static_delegate_lineage_counters` 早就把 depth/round 原样继承了。
|
||||
/// 套用返工文案就是告诉策划子 Agent「用户只能改这一次」,和澄清跳当初那个假天花板
|
||||
/// 是同一个错误。原型对应的是软阈值 16 次、超过只提示不拒绝。
|
||||
#[test]
|
||||
fn user_revision_hop_note_is_not_the_repair_round_note() {
|
||||
let revision = render_static_delegate_task_contract(
|
||||
"任务",
|
||||
"project-supervisor",
|
||||
"run-1",
|
||||
"delegation-new",
|
||||
&["交付 game/fast_gdd.md".to_string()],
|
||||
&["game/fast_gdd.md".to_string()],
|
||||
StaticDelegateHopNote::UserRevision {
|
||||
original_delegation_id: "delegation-old",
|
||||
},
|
||||
)
|
||||
.expect("render user revision hop note");
|
||||
assert!(
|
||||
!revision.contains("唯一返工轮"),
|
||||
"用户修订轮不得复用返工文案,否则子 Agent 以为用户只能改这一次:{revision}"
|
||||
);
|
||||
assert!(
|
||||
revision.contains("不消耗返工深度"),
|
||||
"必须写明它不吃返工额度:{revision}"
|
||||
);
|
||||
assert!(
|
||||
revision.contains("不是最后一轮"),
|
||||
"必须写明用户还能再改,否则子 Agent 会把多条意见攒到一轮改完:{revision}"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn plan_clarification_hop_note_is_not_the_repair_round_note() {
|
||||
let repair = render_static_delegate_task_contract(
|
||||
"任务",
|
||||
"project-supervisor",
|
||||
"run-1",
|
||||
"delegation-new",
|
||||
&["交付产物".to_string()],
|
||||
&["assets/art-spec.png".to_string()],
|
||||
StaticDelegateHopNote::Repair {
|
||||
original_delegation_id: "delegation-old",
|
||||
},
|
||||
)
|
||||
.expect("render repair");
|
||||
assert!(
|
||||
repair.contains("这是对已认领委派 delegation-old 的唯一返工轮。"),
|
||||
"返工轮文案是做游戏链路 replaceExisting 的授权信号,必须逐字保留:{repair}"
|
||||
);
|
||||
|
||||
let clarification = render_static_delegate_task_contract(
|
||||
"任务",
|
||||
"project-supervisor",
|
||||
"run-1",
|
||||
"delegation-new",
|
||||
&["交付 game/fast_gdd.md".to_string()],
|
||||
&["game/fast_gdd.md".to_string()],
|
||||
StaticDelegateHopNote::PlanClarification {
|
||||
original_delegation_id: "delegation-old",
|
||||
rounds_used: 1,
|
||||
rounds_limit: 3,
|
||||
},
|
||||
)
|
||||
.expect("render clarification");
|
||||
assert!(
|
||||
!clarification.contains("唯一返工轮"),
|
||||
"澄清续跑不得复用返工文案,否则策划子 Agent 以为只剩这一轮:{clarification}"
|
||||
);
|
||||
assert!(
|
||||
clarification.contains("已用澄清轮次 1/3"),
|
||||
"澄清续跑必须写明已用轮次与上限:{clarification}"
|
||||
);
|
||||
assert!(
|
||||
clarification.contains("第2轮·当前要决定:"),
|
||||
"task 里的轮号必须等于 planning_coordinator 校验 header 时用的 rounds_used + 1:{clarification}"
|
||||
);
|
||||
|
||||
let exhausted = render_static_delegate_task_contract(
|
||||
"任务",
|
||||
"project-supervisor",
|
||||
"run-1",
|
||||
"delegation-new",
|
||||
&["交付 game/fast_gdd.md".to_string()],
|
||||
&["game/fast_gdd.md".to_string()],
|
||||
StaticDelegateHopNote::PlanClarification {
|
||||
original_delegation_id: "delegation-old",
|
||||
rounds_used: 3,
|
||||
rounds_limit: 3,
|
||||
},
|
||||
)
|
||||
.expect("render exhausted clarification");
|
||||
assert!(
|
||||
exhausted.contains("澄清预算已用尽"),
|
||||
"预算用尽时必须要求收稿,出卡侧会直接拒掉第四张卡:{exhausted}"
|
||||
);
|
||||
assert!(
|
||||
!exhausted.contains("第4轮·当前要决定:"),
|
||||
"预算用尽时不得再给出下一轮 header,那是一张永远递不上去的卡:{exhausted}"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,18 +10,6 @@ pub(in crate::agent) fn agent_role_project_path_mutation_block(
|
||||
if autonomous_relaxed_run_at(root, agent_id, run_id).unwrap_or(false) {
|
||||
return None;
|
||||
}
|
||||
if is_agent_planning_storage_path(path) || is_plan_fast_gdd_projection_path(path) {
|
||||
return Some(AgentRuntimeToolObservation {
|
||||
tool: tool.to_string(),
|
||||
status: "blocked".to_string(),
|
||||
summary: if is_agent_planning_storage_path(path) {
|
||||
"`.agent/planning/**` 只能由立项策划 Runtime 专用存储层写入".to_string()
|
||||
} else {
|
||||
"`game/fast_gdd.md` 只能由立项策划 Runtime renderer 写入".to_string()
|
||||
},
|
||||
detail: Some(format!("agentId={agent_id} · runId={run_id} · path={path}")),
|
||||
});
|
||||
}
|
||||
match autonomous_owner_artifact_validation_available_for_run_at(root, agent_id, run_id) {
|
||||
Ok(true) => {
|
||||
let allowed = autonomous_manifest_owner_artifact_paths(agent_id);
|
||||
|
||||
@@ -275,8 +275,7 @@ fn agent_runtime_native_capability_registry() -> Result<&'static CapabilityRegis
|
||||
///
|
||||
/// `"__all_agents__"` 是个不对应任何真实 Agent 的哨兵:走这条路径拿到的是
|
||||
/// 未按身份收窄的完整函数目录。生产代码必须调用 `_for_agent` 版本并传入真实
|
||||
/// `agentId`,否则按身份收窄的工具面(如 `project-planning` 的 exact
|
||||
/// allowlist)会被静默绕开。这里用 `#[cfg(test)]` 把「忘记改用 `_for_agent`」
|
||||
/// `agentId`,否则按身份收窄的工具面会被静默绕开。这里用 `#[cfg(test)]` 把「忘记改用 `_for_agent`」
|
||||
/// 从运行时静默扩权变成编译期错误。
|
||||
#[cfg(test)]
|
||||
pub(crate) fn build_agent_runtime_native_function_tools() -> Result<Vec<LlmFunctionTool>, String> {
|
||||
|
||||
@@ -879,104 +879,6 @@ pub(crate) fn validated_local_project_directory_path(
|
||||
Ok(path.to_path_buf())
|
||||
}
|
||||
|
||||
/// Open the approved Fast GDD Markdown in whatever application the OS has
|
||||
/// registered for it.
|
||||
///
|
||||
/// The GDD is the one product artifact the 立项策划 lane hands back, and it is
|
||||
/// already on disk — `plan.submit_gdd` renders `game/fast_gdd.md` and the
|
||||
/// approval receipt re-renders it with the approved header. This command only
|
||||
/// hands that existing path to the shell; it never creates or rewrites it.
|
||||
#[tauri::command]
|
||||
pub(crate) fn open_local_project_plan_gdd_markdown(
|
||||
app: tauri::AppHandle,
|
||||
project_path: String,
|
||||
) -> Result<(), String> {
|
||||
let path = validated_local_project_plan_gdd_markdown_path(project_path.trim())?;
|
||||
app.opener()
|
||||
.open_path(path.to_string_lossy().into_owned(), None::<&str>)
|
||||
.map_err(|error| format!("打开 Fast GDD 文件失败:{error}"))
|
||||
}
|
||||
|
||||
pub(crate) fn validated_local_project_plan_gdd_markdown_path(
|
||||
project_path: &str,
|
||||
) -> Result<PathBuf, String> {
|
||||
let root = validated_local_project_directory_path(project_path)?;
|
||||
// `resolve_local_project_path` 是项目内路径的唯一安全入口:它做根校验、相对路径
|
||||
// 归一化,并逐段拒绝符号链接。这里的相对路径是常量,但仍然走它——GDD 的渲染侧
|
||||
// (`planning_storage`)用的也是同一个解析器,两边对「项目内的这个文件」必须是
|
||||
// 同一个判定,不能一边解析一边拼字符串。
|
||||
let path = resolve_local_project_path(&root, PLAN_FAST_GDD_PATH)?;
|
||||
match fs::symlink_metadata(&path) {
|
||||
Ok(metadata) if metadata.file_type().is_file() => Ok(path),
|
||||
Ok(_) => Err("Fast GDD 产物不是普通文件".to_string()),
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {
|
||||
Err("Fast GDD 产物尚未生成,请先完成立项策划审批".to_string())
|
||||
}
|
||||
Err(error) => Err(format!("读取 Fast GDD 产物失败:{error}")),
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod plan_gdd_markdown_path_tests {
|
||||
use super::*;
|
||||
|
||||
fn fixture() -> tempfile::TempDir {
|
||||
let temporary = tempfile::tempdir().expect("create GDD path fixture");
|
||||
crate::project::init_local_game_project_at(
|
||||
&temporary.path().join("project"),
|
||||
"gdd-open",
|
||||
"打开 GDD 产物",
|
||||
)
|
||||
.expect("initialize GDD path fixture");
|
||||
temporary
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn resolves_the_rendered_markdown_under_the_project_root() {
|
||||
let temporary = fixture();
|
||||
let root = temporary.path().join("project");
|
||||
fs::create_dir_all(root.join("game")).expect("create game directory");
|
||||
fs::write(root.join(PLAN_FAST_GDD_PATH), "# Fast GDD").expect("render markdown");
|
||||
|
||||
let resolved =
|
||||
validated_local_project_plan_gdd_markdown_path(&root.to_string_lossy().into_owned())
|
||||
.expect("resolve rendered markdown");
|
||||
|
||||
assert_eq!(resolved, root.join(PLAN_FAST_GDD_PATH));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_to_open_a_markdown_that_has_not_been_rendered_yet() {
|
||||
// 恢复态下 `plan.submit_gdd` 的 Markdown 渲染可能还没落盘。这时按钮必须给出
|
||||
// 明确原因,而不是把一个不存在的路径丢给 shell 由系统弹一个无从解释的错误。
|
||||
let temporary = fixture();
|
||||
let root = temporary.path().join("project");
|
||||
|
||||
let error =
|
||||
validated_local_project_plan_gdd_markdown_path(&root.to_string_lossy().into_owned())
|
||||
.expect_err("missing markdown must fail closed");
|
||||
|
||||
assert!(error.contains("尚未生成"), "unexpected error: {error}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_a_project_path_that_is_not_an_initialized_project() {
|
||||
let temporary = tempfile::tempdir().expect("create bare fixture");
|
||||
let error = validated_local_project_plan_gdd_markdown_path(
|
||||
&temporary.path().to_string_lossy().into_owned(),
|
||||
)
|
||||
.expect_err("a directory without .agent is not a project root");
|
||||
assert!(!error.is_empty());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn refuses_a_relative_project_path() {
|
||||
let error = validated_local_project_plan_gdd_markdown_path("relative/project")
|
||||
.expect_err("relative project path must fail");
|
||||
assert!(error.contains("绝对路径"), "unexpected error: {error}");
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub(crate) async fn get_local_game_manifest(
|
||||
project_path: String,
|
||||
|
||||
@@ -1756,8 +1756,8 @@ pub(crate) fn build_static_delegate_structured_result_at(
|
||||
// (实测:option 对象里多写了一个 `id` 字段)就把整条委派判成投递失败,父
|
||||
// Supervisor 直接进 needs-reconciliation 停下等人。
|
||||
//
|
||||
// 信封格式属于「本次 Provider 输出写错」,不是「durable 权威损坏」,和
|
||||
// plan.submit_gdd 的业务拒绝同类。降级成 needs-repair 并把解析错误当返工理由
|
||||
// 信封格式属于「本次 Provider 输出写错」,不是「durable 权威损坏」。
|
||||
// 降级成 needs-repair 并把解析错误当返工理由
|
||||
// 带上:Supervisor 用既有的一次返工额度就能让子 Agent 重写,不需要人工介入。
|
||||
let (user_input_questions, user_input_questions_sha256, user_input_parse_error) =
|
||||
match parse_static_delegate_user_input_request(error) {
|
||||
@@ -3426,11 +3426,11 @@ mod tests {
|
||||
assert!(failed.contains("客观证据冲突"));
|
||||
|
||||
let mut missing = base.clone();
|
||||
missing.missing_expected_artifacts = vec!["game/fast_gdd.md".to_string()];
|
||||
missing.missing_expected_artifacts = vec!["design.md".to_string()];
|
||||
let missing_error = validate_static_delegate_structured_result(
|
||||
&missing,
|
||||
"completed",
|
||||
&["game/fast_gdd.md".to_string()],
|
||||
&["design.md".to_string()],
|
||||
)
|
||||
.expect_err("missing expected artifact must reject a user revision result");
|
||||
assert!(missing_error.contains("客观证据冲突"));
|
||||
|
||||
@@ -2533,7 +2533,6 @@ fn main() {
|
||||
read_agc_plugin_panel,
|
||||
set_agc_plugin_project_path,
|
||||
open_local_project_directory,
|
||||
open_local_project_plan_gdd_markdown,
|
||||
control_agent_run,
|
||||
generate_local_game_draft,
|
||||
chat_with_game_creator_agent,
|
||||
@@ -2542,10 +2541,6 @@ fn main() {
|
||||
chat_with_game_creator_direct_codex,
|
||||
cancel_direct_codex_turn,
|
||||
select_game_creator_reasoning_effort,
|
||||
start_planning_session_v2,
|
||||
continue_planning_session_v2,
|
||||
decide_planning_artifact_v2,
|
||||
hydrate_planning_session_v2,
|
||||
hydrate_design_agent_session,
|
||||
reset_design_agent_session,
|
||||
get_design_agent_runtime_mode,
|
||||
|
||||
@@ -7,9 +7,7 @@ use std::io::{Read, Seek, SeekFrom, Write};
|
||||
use std::path::{Path, PathBuf};
|
||||
use unicode_normalization::UnicodeNormalization;
|
||||
|
||||
use crate::project::{
|
||||
is_plan_fast_gdd_projection_path, normalize_relative_path, validate_project_root,
|
||||
};
|
||||
use crate::project::{normalize_relative_path, validate_project_root};
|
||||
|
||||
const PROJECT_PATCHSET_MAX_CHANGES: usize = 12;
|
||||
const PROJECT_PATCHSET_MAX_TOTAL_BODY_BYTES: usize = 256 * 1024;
|
||||
@@ -466,11 +464,6 @@ fn normalize_and_validate_patchset_inputs(
|
||||
|
||||
let path = normalize_relative_path(change.path())?;
|
||||
reject_sensitive_patchset_path(&path)?;
|
||||
if is_plan_fast_gdd_projection_path(&path) {
|
||||
return Err(
|
||||
"project.patchset 不得直接修改 Runtime-owned game/fast_gdd.md 投影".to_string(),
|
||||
);
|
||||
}
|
||||
let change = match change {
|
||||
ParsedProjectPatchsetChange::Create { content, .. } => {
|
||||
validate_input_text(&content, &path)?;
|
||||
@@ -1372,11 +1365,6 @@ fn metadata_is_link_or_reparse(metadata: &Metadata) -> bool {
|
||||
}
|
||||
|
||||
fn reject_sensitive_patchset_path(relative_path: &str) -> Result<(), String> {
|
||||
if is_plan_fast_gdd_projection_path(relative_path) {
|
||||
return Err(
|
||||
"project.patchset 不得直接修改 Runtime-owned game/fast_gdd.md 投影".to_string(),
|
||||
);
|
||||
}
|
||||
let components = relative_path
|
||||
.split('/')
|
||||
.map(str::to_ascii_lowercase)
|
||||
@@ -1706,8 +1694,6 @@ mod tests {
|
||||
|
||||
for path in [
|
||||
".agent/runtime/state.json",
|
||||
".agent/planning/gdd.v1.json",
|
||||
"game/fast_gdd.md",
|
||||
".env.local",
|
||||
"config/private.pem",
|
||||
"data/runtime.sqlite",
|
||||
|
||||
@@ -674,7 +674,6 @@ pub(crate) fn restore_local_project_checkpoint_at(
|
||||
|
||||
pub(crate) fn should_skip_project_restore_path(relative_path: &str) -> bool {
|
||||
should_skip_project_snapshot_path(relative_path)
|
||||
|| is_plan_fast_gdd_projection_path(relative_path)
|
||||
|| relative_path == ".agent/agent.db"
|
||||
|| relative_path == PROJECT_PERMISSION_POLICY_PATH
|
||||
|| relative_path == PROJECT_WRITE_LOCK_PATH
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user