Close DDD refactor and remove generated asset proxy

This commit is contained in:
kdletters
2026-05-02 00:27:22 +08:00
parent fd08262bf0
commit 9d9913095d
605 changed files with 11811 additions and 10106 deletions

View File

@@ -70,11 +70,6 @@ export interface StartPuzzleRunRequest {
profileId: string;
}
export interface AdvanceLocalPuzzleNextLevelRequest {
run: PuzzleRunSnapshot;
sourceSessionId?: string | null;
}
export interface PuzzleRunResponse {
run: PuzzleRunSnapshot;
}

View File

@@ -6,9 +6,8 @@ import {
SERVER_RUNTIME_FUNCTION_IDS,
TASK5_RUNTIME_OPTION_SCOPES,
TASK6_RUNTIME_FUNCTION_IDS,
type RuntimeStoryActionRequest,
} from './rpgRuntimeStoryAction';
import type { RuntimeStoryStateRequest } from './rpgRuntimeStoryState';
import { type RuntimeStoryActionRequest } from './rpgRuntimeStoryState';
describe('RPG runtime shared contracts', () => {
test('拆分后的 runtime story action 契约继续导出常量与类型', () => {
@@ -40,12 +39,7 @@ describe('RPG runtime shared contracts', () => {
targetStatus: {},
};
const stateRequest: RuntimeStoryStateRequest = {
sessionId: 'runtime-session-2',
};
expect(payload.playerMessage).toBe('近况如何?');
expect(stateRequest.sessionId).toBe('runtime-session-2');
expect(QUEST_NARRATIVE_TYPES).toContain('relationship');
});
});

View File

@@ -14,26 +14,6 @@ export type RuntimeAction<
payload?: TPayload;
};
export type RuntimeActionRequest<
TAction extends RuntimeAction = RuntimeAction,
> = {
sessionId: string;
clientVersion?: number;
action: TAction;
};
export type RuntimeActionResponse<
TViewModel = JsonObject,
TPresentation = JsonObject,
TPatch = JsonObject,
> = {
sessionId: string;
serverVersion: number;
viewModel: TViewModel;
presentation: TPresentation;
patches: TPatch[];
};
export const TASK5_RUNTIME_FUNCTION_IDS = [
'story_continue_adventure',
'story_opening_camp_dialogue',

View File

@@ -3,10 +3,7 @@
* 该文件只负责 view model、presentation、patch 与 snapshot 回包结构。
*/
import type { JsonObject } from './common';
import type { SavedGameSnapshot, SavedGameSnapshotInput } from './runtime';
import type {
RuntimeActionRequest,
RuntimeActionResponse,
RuntimeStoryChoiceAction,
RuntimeStoryChoicePayload,
RuntimeStoryOptionInteraction,
@@ -206,8 +203,10 @@ export type RuntimeStoryPatch =
};
export type RuntimeStoryActionRequest =
RuntimeActionRequest<RuntimeStoryChoiceAction> & {
snapshot?: SavedGameSnapshotInput;
{
sessionId: string;
clientVersion?: number;
action: RuntimeStoryChoiceAction;
};
export type RuntimeStoryAiRequestOptions = {
@@ -224,55 +223,3 @@ export type RuntimeStoryAiRequest = {
recentActionResult?: string | null;
requestOptions?: RuntimeStoryAiRequestOptions;
};
export type RuntimeStoryStateRequest<
TSnapshotGameState = JsonObject,
TSnapshotCurrentStory = JsonObject,
> = {
sessionId: string;
clientVersion?: number;
snapshot?: SavedGameSnapshotInput<
TSnapshotGameState,
string,
TSnapshotCurrentStory
>;
};
export type RuntimeStoryBootstrapRequest<
TProfile = JsonObject,
TCharacter = JsonObject,
> = {
worldType: string;
customWorldProfile?: TProfile | null;
character: TCharacter;
runtimeMode?: 'play' | 'preview' | 'test';
disablePersistence?: boolean;
};
export type RuntimeStoryBootstrapResponse<
TSnapshotGameState = JsonObject,
TSnapshotCurrentStory = JsonObject,
> = {
sessionId: string;
serverVersion: number;
snapshot: SavedGameSnapshot<
TSnapshotGameState,
string,
TSnapshotCurrentStory
>;
};
export type RuntimeStoryActionResponse<
TSnapshotGameState = JsonObject,
TSnapshotCurrentStory = JsonObject,
> = RuntimeActionResponse<
RuntimeStoryViewModel,
RuntimeStoryPresentation,
RuntimeStoryPatch
> & {
snapshot: SavedGameSnapshot<
TSnapshotGameState,
string,
TSnapshotCurrentStory
>;
};

View File

@@ -1,4 +1,5 @@
import type { JsonObject } from './common';
import type { SavedGameSnapshotInput } from './runtime';
/**
* story session 主链共享契约。
@@ -12,12 +13,32 @@ export type BeginStorySessionRequest = {
openingSummary?: string | null;
};
export type BeginStoryRuntimeSessionRequest<
TProfile = JsonObject,
TCharacter = JsonObject,
> = {
worldType: string;
customWorldProfile?: TProfile | null;
character: TCharacter;
runtimeMode?: 'play' | 'preview' | 'test';
disablePersistence?: boolean;
};
export type ContinueStoryRequest = {
storySessionId: string;
narrativeText: string;
choiceFunctionId?: string | null;
};
export type ResolveStoryRuntimeActionRequest = {
storySessionId: string;
clientVersion?: number;
functionId: string;
actionText: string;
targetId?: string | null;
payload?: JsonObject | null;
};
export type StorySessionPayload = {
storySessionId: string;
runtimeSessionId: string;
@@ -52,6 +73,11 @@ export type StorySessionStateResponse = {
storyEvents: StoryEventPayload[];
};
export type StoryRuntimeSnapshotPayload<
TGameState = JsonObject,
TCurrentStory = JsonObject,
> = SavedGameSnapshotInput<TGameState, string, TCurrentStory>;
export type StoryRuntimeProjectionRequest = {
storySessionId: string;
clientVersion?: number;
@@ -94,6 +120,7 @@ export type StoryRuntimeProjectionResponse = {
storySession: StorySessionPayload;
storyEvents: StoryEventPayload[];
serverVersion: number;
gameState: JsonObject;
actor: StoryRuntimeActorProjection;
inventory: StoryRuntimeInventoryProjection;
options: StoryRuntimeOptionProjection[];
@@ -102,3 +129,7 @@ export type StoryRuntimeProjectionResponse = {
actionResultText?: string | null;
toast?: string | null;
};
export type StoryRuntimeMutationResponse = {
projection: StoryRuntimeProjectionResponse;
};