Merge remote-tracking branch 'origin/master' into codex/wooden-fish-template

This commit is contained in:
2026-05-22 04:00:52 +08:00
121 changed files with 10876 additions and 3477 deletions

View File

@@ -1630,10 +1630,23 @@ function parseDraftGenerationStartedAtMs(value: string | null | undefined) {
function createMiniGameDraftGenerationStateFromStartedAt(
kind: MiniGameDraftGenerationKind,
startedAtMs: number,
metadata?: MiniGameDraftGenerationState['metadata'],
): MiniGameDraftGenerationState {
return {
...createMiniGameDraftGenerationState(kind),
startedAtMs,
...(metadata ? { metadata } : {}),
};
}
function createPuzzleDraftGenerationStateFromPayload(
payload: CreatePuzzleAgentSessionRequest | null | undefined,
): MiniGameDraftGenerationState {
return {
...createMiniGameDraftGenerationState('puzzle'),
metadata: {
puzzleAiRedraw: payload?.aiRedraw ?? true,
},
};
}
@@ -3305,6 +3318,7 @@ export function PlatformEntryFlowShellImpl({
const enterWorldCoordinator = useRpgCreationEnterWorld({
isAgentDraftResultView: sessionController.isAgentDraftResultView,
activeAgentSessionId: sessionController.activeAgentSessionId,
currentAgentSessionStage: sessionController.agentSession?.stage ?? null,
generatedCustomWorldProfile: sessionController.generatedCustomWorldProfile,
handleCustomWorldSelect,
syncAgentDraftResultProfile:
@@ -4591,7 +4605,9 @@ export function PlatformEntryFlowShellImpl({
markPendingDraftGenerating('puzzle', session.sessionId);
selectionStageRef.current = 'puzzle-generating';
setSelectionStage('puzzle-generating');
const nextGenerationState = createMiniGameDraftGenerationState('puzzle');
const nextGenerationState = createPuzzleDraftGenerationStateFromPayload(
formPayload ?? buildPuzzleFormPayloadFromSession(session),
);
setPuzzleGenerationState(nextGenerationState);
setPuzzleBackgroundCompileTasks((current) => ({
...current,
@@ -4607,14 +4623,14 @@ export function PlatformEntryFlowShellImpl({
if (payload.action !== 'compile_puzzle_draft') {
return;
}
const generationState =
puzzleBackgroundCompileTasks[session.sessionId]?.generationState ??
puzzleGenerationState ??
createMiniGameDraftGenerationState('puzzle');
const formPayload =
buildPuzzleFormPayloadFromAction(payload) ??
puzzleBackgroundCompileTasks[session.sessionId]?.payload ??
buildPuzzleFormPayloadFromSession(session);
const generationState =
puzzleBackgroundCompileTasks[session.sessionId]?.generationState ??
puzzleGenerationState ??
createPuzzleDraftGenerationStateFromPayload(formPayload);
const recovered = await recoverCompletedPuzzleDraftGeneration({
sessionId: session.sessionId,
payload: formPayload,
@@ -5109,7 +5125,7 @@ export function PlatformEntryFlowShellImpl({
return;
}
const generationState = createMiniGameDraftGenerationState('puzzle');
const generationState = createPuzzleDraftGenerationStateFromPayload(payload);
setPuzzleBackgroundCompileTasks((current) => ({
...current,
[nextSession.sessionId]: {
@@ -7948,7 +7964,10 @@ export function PlatformEntryFlowShellImpl({
);
const startPuzzleTestRunFromDraft = useCallback(
async (draft: PuzzleResultDraft) => {
async (
draft: PuzzleResultDraft,
options: { levelId?: string | null } = {},
) => {
if (isPuzzleBusy) {
return false;
}
@@ -7977,7 +7996,7 @@ export function PlatformEntryFlowShellImpl({
coverAssetId: draft.coverAssetId,
levels: draft.levels ?? [],
});
const run = startLocalPuzzleRun(item);
const run = startLocalPuzzleRun(item, options.levelId ?? null);
setSelectedPuzzleDetail(item);
setPuzzleRun(run);
setPuzzleRuntimeAuthMode('default');
@@ -9765,6 +9784,11 @@ export function PlatformEntryFlowShellImpl({
createMiniGameDraftGenerationStateFromStartedAt(
'puzzle',
parseDraftGenerationStartedAtMs(item.updatedAt),
{
puzzleAiRedraw:
buildPuzzleFormPayloadFromSession(latestSession).aiRedraw ??
true,
},
),
);
enterCreateTab();