From 618c69e766ec603635ef30d25f29d36af2b697b4 Mon Sep 17 00:00:00 2001 From: Suzumiya Date: Thu, 1 Oct 2026 20:10:46 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4AGC=E5=8F=91=E5=B8=83?= =?UTF-8?q?=E5=85=A5=E5=8F=A3=E5=89=8D=E7=AB=AF=E7=81=B0=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 让DirectProject工作台始终展示发布按钮,保留Tauri、项目原型和服务端校验 删除原生发布灰度查询命令及配置白名单 更新发布入口与Rust facade定向测试 --- .../scripts/check-config.mjs | 1 - .../src-tauri/src/desktop.rs | 1 - .../src/game_distribution_publish.rs | 20 ------------------ apps/ai-game-creator-shell/src/App.tsx | 21 +------------------ .../src/services/gameDistributionPublish.ts | 13 ------------ .../tests/gameDistributionPublish.test.ts | 13 +----------- .../tests/gamePublishFeedback.test.tsx | 17 --------------- 7 files changed, 2 insertions(+), 84 deletions(-) diff --git a/apps/ai-game-creator-shell/scripts/check-config.mjs b/apps/ai-game-creator-shell/scripts/check-config.mjs index 1b964573f..7998f7139 100644 --- a/apps/ai-game-creator-shell/scripts/check-config.mjs +++ b/apps/ai-game-creator-shell/scripts/check-config.mjs @@ -133,7 +133,6 @@ const allowedUncalledTauriCommands = [ 'generate_game_distribution_cover', 'prepare_local_project_game_package', 'read_game_cover_generation_price', - 'read_game_publish_availability', 'suggest_game_distribution_publish_metadata', 'upload_local_project_game_package', // 账户与钱包由 Rust typed command 持有 origin/Bearer/envelope;命令名在 `accountHost.ts` diff --git a/apps/ai-game-creator-shell/src-tauri/src/desktop.rs b/apps/ai-game-creator-shell/src-tauri/src/desktop.rs index 29268e088..d687dd189 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/desktop.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/desktop.rs @@ -647,7 +647,6 @@ pub(super) fn run() { login_client_with_password, login_client_with_phone_code, logout_client_session, - read_game_publish_availability, suggest_game_distribution_publish_metadata, read_game_cover_generation_price, generate_game_distribution_cover, diff --git a/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs b/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs index 8073ec019..dc0417d65 100644 --- a/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs +++ b/apps/ai-game-creator-shell/src-tauri/src/game_distribution_publish.rs @@ -360,26 +360,6 @@ async fn resolve_cover_queue( Err("生成游戏封面超时,请稍后重试".to_string()) } -#[tauri::command] -pub(crate) async fn read_game_publish_availability() -> Result { - let snapshot = require_platform_session()?; - let client = build_client()?; - let value = request_json( - &client, - &snapshot, - Method::GET, - &["api", "runtime", "frontend-config"], - None, - None, - "读取发布灰度配置失败", - ) - .await?; - Ok(value - .get("gameDistributionPublishEnabled") - .and_then(Value::as_bool) - .unwrap_or(false)) -} - #[tauri::command] pub(crate) async fn suggest_game_distribution_publish_metadata( name: String, diff --git a/apps/ai-game-creator-shell/src/App.tsx b/apps/ai-game-creator-shell/src/App.tsx index 538b7ba14..9a363678d 100644 --- a/apps/ai-game-creator-shell/src/App.tsx +++ b/apps/ai-game-creator-shell/src/App.tsx @@ -90,7 +90,6 @@ import { type ResourceReferenceInsertEventDetail, } from './features/project-workspace/resourceReferences'; import { RuntimeConfigDialog } from './features/runtime-config/RuntimeConfigDialog'; -import { readGamePublishAvailability } from './services/gameDistributionPublish'; import { setAgcPluginProjectPath, startAvailableAgcEditorPlugins, @@ -343,8 +342,6 @@ export function App({ const [publishBlockedMessage, setPublishBlockedMessage] = useState< string | null >(null); - // 发布灰度:只有命中的账号才把「发布到游戏广场」入口交给聊天头;读取失败按不开放处理。 - const [gamePublishAllowed, setGamePublishAllowed] = useState(false); const [projectChatError, setProjectChatError] = useState(''); const designReplyAnimation = useDesignReplyAnimation(); const [designAgentStatus, setDesignAgentStatus] = useState(''); @@ -888,20 +885,6 @@ export function App({ } } - useEffect(() => { - let cancelled = false; - void readGamePublishAvailability() - .then((allowed) => { - if (!cancelled) setGamePublishAllowed(allowed); - }) - .catch(() => { - if (!cancelled) setGamePublishAllowed(false); - }); - return () => { - cancelled = true; - }; - }, [localProject?.projectPath]); - /** * 导出试玩包并打开发布面板。 * @@ -1973,9 +1956,7 @@ export function App({ ensureConversationReadAllowed={ensureDirectHistoryReadAllowed} ensureConversationWriteAllowed={ensureDirectTurnWriteAllowed} initialTurn={initialDirectTurn} - onRequestGamePublish={ - gamePublishAllowed ? requestGamePublish : undefined - } + onRequestGamePublish={requestGamePublish} onCancelConfirmation={cancelUiCommandConfirmation} onConfirmConfirmation={confirmUiCommand} pendingConfirmation={pendingUiConfirmation} diff --git a/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts b/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts index d9e98ab70..5a81a1700 100644 --- a/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts +++ b/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts @@ -38,19 +38,6 @@ function requireNativeInvoke(invoke?: TauriInvoke) { return resolved; } -/** - * 读取当前账号的游戏发布灰度。 - * - * 与网页端共用 `/api/runtime/frontend-config`:后端未配置 `game-distribution:publish` - * 时对已登录作者默认开放,运营收紧后只有白名单/灰度命中的作者返回 `true`。读取失败按 - * “不开放入口”处理——写入口本身还会再拦一次,AGC 面板不作为唯一把关点。 - */ -export async function readGamePublishAvailability( - invoke?: TauriInvoke, -): Promise { - return requireNativeInvoke(invoke)('read_game_publish_availability'); -} - export type GameDistributionPublishResult = { gameId: string; versionId: string; diff --git a/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts b/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts index ebfbcbf38..d6c4e518e 100644 --- a/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts +++ b/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts @@ -7,10 +7,8 @@ import { generateGameDistributionCover, publishLocalProjectGame, readGameCoverGenerationPrice, - readGamePublishAvailability, suggestGameDistributionPublishMetadata, } from '../src/services/gameDistributionPublish'; - const MANIFEST = { projectId: 'local-proj-1', name: '星轨防线', @@ -164,9 +162,8 @@ describe('Rust 发布 facade', () => { expect(invoke).not.toHaveBeenCalled(); }); - test('发布灰度、资料建议和价格均通过 native command', async () => { + test('资料建议和价格均通过 native command', async () => { const { invoke, calls } = installNativeInvoke((command) => { - if (command === 'read_game_publish_availability') return true; if (command === 'suggest_game_distribution_publish_metadata') { return { summary: '驾驶炮台守住轨道城', category: '策略' }; } @@ -174,7 +171,6 @@ describe('Rust 发布 facade', () => { throw new Error(`未预期的命令:${command}`); }); - await expect(readGamePublishAvailability(invoke)).resolves.toBe(true); await expect( suggestGameDistributionPublishMetadata( { @@ -194,7 +190,6 @@ describe('Rust 发布 facade', () => { ).resolves.toBe(5); expect(calls).toEqual([ - { command: 'read_game_publish_availability', args: undefined }, { command: 'suggest_game_distribution_publish_metadata', args: { @@ -253,10 +248,4 @@ describe('Rust 发布 facade', () => { }, ]); }); - - test('缺少 native 宿主时发布网络 facade 失败关闭', async () => { - await expect(readGamePublishAvailability()).rejects.toThrow( - '需要在 Tauri App 内执行发布操作', - ); - }); }); diff --git a/apps/ai-game-creator-shell/tests/gamePublishFeedback.test.tsx b/apps/ai-game-creator-shell/tests/gamePublishFeedback.test.tsx index 786c790a7..9d089f751 100644 --- a/apps/ai-game-creator-shell/tests/gamePublishFeedback.test.tsx +++ b/apps/ai-game-creator-shell/tests/gamePublishFeedback.test.tsx @@ -29,21 +29,6 @@ import { resolveDeclarations, } from './styleCascade'; -const readGamePublishAvailabilityMock = vi.hoisted(() => - vi.fn(async () => true), -); - -vi.mock('../src/services/gameDistributionPublish', async (importOriginal) => { - const actual = - await importOriginal< - typeof import('../src/services/gameDistributionPublish') - >(); - return { - ...actual, - readGamePublishAvailability: readGamePublishAvailabilityMock, - }; -}); - const PROJECT_PATH = '/tmp/game-publish-feedback-project'; const PROJECT_ID = 'game-publish-feedback-project'; @@ -131,8 +116,6 @@ async function clickPublish() { beforeEach(() => { window.history.pushState({}, '', '/'); - readGamePublishAvailabilityMock.mockReset(); - readGamePublishAvailabilityMock.mockResolvedValue(true); }); function createExportPackageResult() {