发布命令删掉已失效的 package_relative_path 形参

- Rust 命令与 stage_publish_package 去掉该形参,整包固定读 .export/taonier.zip
- 前端服务类型、invoke 载荷与 useTaonierTab 调用同步删除
- 更新单测与 live 测试,去掉对已忽略形参的断言
This commit is contained in:
2026-10-07 11:34:54 +08:00
parent 12d4e8477a
commit aa946a9304
5 changed files with 5 additions and 35 deletions
@@ -1206,7 +1206,6 @@ fn multipart_image_part(
fn stage_publish_package(
app_data_dir: &Path,
project_path: &str,
_package_relative_path: &str,
) -> Result<StagedGamePackage, String> {
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<String>,
version_number: Option<u64>,
@@ -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
@@ -225,7 +225,6 @@ function toCreateGameRequest(
export async function publishLocalProjectGame(args: {
invoke: TauriInvoke;
projectPath: string;
packageRelativePath: string;
manifest: GameCreationAppManifest;
metadata?: Partial<GameDistributionPublishMetadata>;
/**
@@ -260,9 +259,8 @@ export async function publishLocalProjectGame(args: {
idempotencyKey?: string;
}): Promise<GameDistributionPublishResult> {
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<GameDistributionPublishResult>(
'publish_local_project_game',
{
projectPath,
packageRelativePath,
metadata: gameMetadata,
...(gameId ? { gameId } : {}),
versionNumber,
@@ -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」合成。
@@ -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<typeof publishLocalProjectGame>[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,
@@ -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,