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 b581a3ffd..8ef8367b6 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 @@ -1206,7 +1206,6 @@ fn multipart_image_part( fn stage_publish_package( app_data_dir: &Path, project_path: &str, - _package_relative_path: &str, ) -> Result { let root = Path::new(project_path.trim()); crate::project::enforce_project_permission_policy(root, "project.export_package")?; @@ -1250,7 +1249,6 @@ fn emit_publish_progress( pub(crate) async fn publish_local_project_game( app: AppHandle, project_path: String, - package_relative_path: String, mut metadata: GameDistributionCreateGameRequest, game_id: Option, version_number: Option, @@ -1264,7 +1262,7 @@ pub(crate) async fn publish_local_project_game( .path() .app_data_dir() .map_err(|error| format!("无法读取 AGC 应用数据目录:{error}"))?; - let staged = stage_publish_package(&app_data_dir, &project_path, &package_relative_path)?; + let staged = stage_publish_package(&app_data_dir, &project_path)?; let root = Path::new(project_path.trim()); let local_project_id = metadata .local_project_id diff --git a/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts b/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts index 58ebff22c..c192adb8f 100644 --- a/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts +++ b/apps/ai-game-creator-shell/src/services/gameDistributionPublish.ts @@ -225,7 +225,6 @@ function toCreateGameRequest( export async function publishLocalProjectGame(args: { invoke: TauriInvoke; projectPath: string; - packageRelativePath: string; manifest: GameCreationAppManifest; metadata?: Partial; /** @@ -260,9 +259,8 @@ export async function publishLocalProjectGame(args: { idempotencyKey?: string; }): Promise { const projectPath = args.projectPath.trim(); - const packageRelativePath = args.packageRelativePath.trim(); - if (!projectPath || !packageRelativePath) { - throw new Error('发布需要绑定本地项目和试玩包'); + if (!projectPath) { + throw new Error('发布需要绑定本地项目'); } const metadata = normalizeMetadata(args.manifest, args.metadata); const localProjectId = args.manifest.projectId.trim(); @@ -297,12 +295,12 @@ export async function publishLocalProjectGame(args: { const gameMetadata = toCreateGameRequest(metadata, localProjectId); const rootKey = args.idempotencyKey?.trim() ?? ''; // 发布编排、认证、origin、分片续传与送审都在 Rust 完成;渲染进程只传递 - // 已归一化的资料、项目版本和本地项目相对包路径,不接触 token、base URL 或整包字节。 + // 已归一化的资料、项目版本和本地项目标识,不接触 token、base URL 或整包字节。 + // 释放包路径由宿主固定读 `.export/taonier.zip`,不再经前端形参透传。 return args.invoke( 'publish_local_project_game', { projectPath, - packageRelativePath, metadata: gameMetadata, ...(gameId ? { gameId } : {}), versionNumber, diff --git a/apps/ai-game-creator-shell/src/view/project-development/export/state/useTaonierTab.ts b/apps/ai-game-creator-shell/src/view/project-development/export/state/useTaonierTab.ts index 1325db74f..7f5151002 100644 --- a/apps/ai-game-creator-shell/src/view/project-development/export/state/useTaonierTab.ts +++ b/apps/ai-game-creator-shell/src/view/project-development/export/state/useTaonierTab.ts @@ -20,7 +20,6 @@ import { useDirectProjectManifest } from '../../chat/controller/useDirectProject import { useDirectProjectTurnStatus } from '../../chat/controller/useDirectProjectTurnStatus'; import { buildDirectChatTurns } from '../../chat/conversation/directTurnPresentation'; import type { UserContentPart } from '../../chat/generated/UserContentPart'; -import { TAONIER_ARTIFACT_RELATIVE_PATH } from './taonierInstruction'; import { buildTaonierPublishMetadata, useTaonierExport, @@ -240,8 +239,6 @@ export function useTaonierTab({ const next = await publishLocalProjectGame({ invoke, projectPath, - // 整包路径由宿主忽略;发布链路只从固定的 `.export/taonier.zip` 取字节。 - packageRelativePath: TAONIER_ARTIFACT_RELATIVE_PATH, manifest, // 媒体走 M1 的 objectKey / multipart 直传合同:文字取草稿,图片槽按「本地二进制 / // 线上 objectKey」合成。 diff --git a/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts b/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts index 8cac40e16..05aa81a89 100644 --- a/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts +++ b/apps/ai-game-creator-shell/tests/gameDistributionPublish.test.ts @@ -14,8 +14,6 @@ const MANIFEST = { goal: '守住轨道城', } as unknown as GameCreationAppManifest; -const PACKAGE_RELATIVE_PATH = '.export/taonier.zip'; - const PUBLISH_RESULT = { gameId: 'game_1', versionId: 'gamever_1', @@ -64,7 +62,6 @@ describe('Rust 发布 facade', () => { const result = await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png', @@ -80,7 +77,6 @@ describe('Rust 发布 facade', () => { expect(calls[0]?.command).toBe('publish_local_project_game'); expect(calls[0]?.args).toMatchObject({ projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, idempotencyKey: 'agc-publish-test', // 未传价格时按免费提交,保持旧调用方向后兼容。 priceMudPoints: 0, @@ -108,7 +104,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { title, summary, coverObjectKey: 'generated/cover.png' }, versionNumber: 4, @@ -127,7 +122,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, versionNumber: 4, @@ -139,7 +133,6 @@ describe('Rust 发布 facade', () => { expect(calls[0]?.args).not.toHaveProperty('idempotencyKey'); expect(calls[0]?.args).toMatchObject({ projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, metadata: { localProjectId: 'local-proj-1' }, }); }); @@ -150,7 +143,6 @@ describe('Rust 发布 facade', () => { publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: { ...MANIFEST, projectId: ' ' } as GameCreationAppManifest, metadata: { coverObjectKey: 'generated/cover.png' }, versionNumber: 4, @@ -170,7 +162,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: null }, versionNumber: 4, @@ -191,7 +182,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: null, @@ -214,7 +204,6 @@ describe('Rust 发布 facade', () => { publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png', @@ -235,7 +224,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, versionNumber: 4, @@ -251,7 +239,6 @@ describe('Rust 发布 facade', () => { const base = { invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, versionNumber: 4, @@ -312,7 +299,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, gameId: 'game_9', @@ -335,7 +321,6 @@ describe('Rust 发布 facade', () => { publishLocalProjectGame({ invoke: missingInvoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, } as unknown as Parameters[0]), @@ -370,7 +355,6 @@ describe('Rust 发布 facade', () => { await publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: withLocalHistory, metadata: { coverObjectKey: 'generated/cover.png' }, versionNumber: 7, @@ -385,7 +369,6 @@ describe('Rust 发布 facade', () => { publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, gameId: 'game_9', @@ -402,7 +385,6 @@ describe('Rust 发布 facade', () => { publishLocalProjectGame({ invoke, projectPath: '/tmp/project', - packageRelativePath: PACKAGE_RELATIVE_PATH, manifest: MANIFEST, metadata: { coverObjectKey: 'generated/cover.png' }, versionNumber, diff --git a/apps/ai-game-creator-shell/tests/gameDistributionPublishLive.test.ts b/apps/ai-game-creator-shell/tests/gameDistributionPublishLive.test.ts index fceffd24b..1e4f61a3b 100644 --- a/apps/ai-game-creator-shell/tests/gameDistributionPublishLive.test.ts +++ b/apps/ai-game-creator-shell/tests/gameDistributionPublishLive.test.ts @@ -569,7 +569,6 @@ liveTest( const first = await publishLocalProjectGame({ invoke, projectPath: '/data/dsk/Genarrative/tmp-agc-live-project', - packageRelativePath: 'dist/game.zip', manifest, metadata: { ...metadata, inputModes: [...metadata.inputModes] }, // 平台侧接下来会用的版本号由作者视图推出:这个项目刚建,平台从 1 开始派发。 @@ -629,7 +628,6 @@ liveTest( const second = await publishLocalProjectGame({ invoke, projectPath: '/data/dsk/Genarrative/tmp-agc-live-project', - packageRelativePath: 'dist/game.zip', manifest, metadata: { ...metadata, inputModes: [...metadata.inputModes] }, // 同一作品第二次发布:作者视图已有 v1 → 这次用 2。 @@ -651,7 +649,6 @@ liveTest( const updated = await publishLocalProjectGame({ invoke, projectPath: '/data/dsk/Genarrative/tmp-agc-live-project', - packageRelativePath: 'dist/game.zip', manifest, metadata: { ...metadata, inputModes: [...metadata.inputModes] }, gameId: second.gameId, @@ -675,7 +672,6 @@ liveTest( const repeated = await publishLocalProjectGame({ invoke, projectPath: '/data/dsk/Genarrative/tmp-agc-live-project', - packageRelativePath: 'dist/game.zip', manifest, metadata: { ...metadata, inputModes: [...metadata.inputModes] }, gameId: second.gameId, @@ -700,7 +696,6 @@ liveTest( const reverted = await publishLocalProjectGame({ invoke, projectPath: '/data/dsk/Genarrative/tmp-agc-live-project', - packageRelativePath: 'dist/game.zip', manifest, metadata: { ...metadata, inputModes: [...metadata.inputModes] }, gameId: second.gameId,