Merge remote-tracking branch 'origin/codex/unified-creation-flow-phase1'

# Conflicts:
#	server-rs/crates/api-server/src/wooden_fish.rs
This commit is contained in:
kdletters
2026-06-01 15:22:58 +08:00
86 changed files with 4944 additions and 967 deletions

View File

@@ -13,6 +13,35 @@ export type CreationEntryTypeConfig = {
categoryLabel: string;
categorySortOrder: number;
updatedAtMicros: number;
unifiedCreationSpec?: UnifiedCreationSpec | null;
};
export type UnifiedCreationField = {
id: string;
kind: 'text' | 'select' | 'image' | 'audio';
label: string;
required: boolean;
};
export type UnifiedCreationSpec = {
playId: 'puzzle' | 'match3d' | 'jump-hop' | 'wooden-fish';
title: string;
workspaceStage:
| 'puzzle-agent-workspace'
| 'match3d-agent-workspace'
| 'jump-hop-workspace'
| 'wooden-fish-workspace';
generationStage:
| 'puzzle-generating'
| 'match3d-generating'
| 'jump-hop-generating'
| 'wooden-fish-generating';
resultStage:
| 'puzzle-result'
| 'match3d-result'
| 'jump-hop-result'
| 'wooden-fish-result';
fields: UnifiedCreationField[];
};
export type CreationEntryConfig = {

View File

@@ -467,6 +467,24 @@ function clampProgress(value: number) {
return Math.max(0, Math.min(100, Math.round(value)));
}
export function resolveMiniGameDraftGenerationStartedAtMs(
startedAt: string | number | null | undefined,
fallbackMs = Date.now(),
) {
if (typeof startedAt === 'number' && Number.isFinite(startedAt)) {
return startedAt;
}
if (typeof startedAt === 'string') {
const parsed = Date.parse(startedAt);
if (Number.isFinite(parsed)) {
return parsed;
}
}
return fallbackMs;
}
function getStepDefinitions(kind: MiniGameDraftGenerationKind) {
if (kind === 'puzzle') {
return buildPuzzleSteps(createMiniGameDraftGenerationState('puzzle'));
@@ -542,6 +560,7 @@ function buildMiniGameProgressSteps(
export function createMiniGameDraftGenerationState(
kind: MiniGameDraftGenerationKind,
startedAtMs = Date.now(),
): MiniGameDraftGenerationState {
return {
kind,
@@ -559,7 +578,7 @@ export function createMiniGameDraftGenerationState(
: kind === 'wooden-fish'
? 'wooden-fish-draft'
: 'compile',
startedAtMs: Date.now(),
startedAtMs,
completedAssetCount: 0,
totalAssetCount: 0,
error: null,