init with react+axum+spacetimedb
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-26 18:06:23 +08:00
commit cbc27bad4a
20199 changed files with 883714 additions and 0 deletions

226
src/services/aiTypes.ts Normal file
View File

@@ -0,0 +1,226 @@
import type {
ActorNarrativeProfile,
ActState,
AnimationState,
AuthorialConstraintPack,
CampaignPack,
CampaignState,
CampEvent,
ChapterState,
Character,
CharacterConversationStyle,
CharacterGender,
CompanionArcState,
CompanionReactionRecord,
CompanionResolution,
CompanionStanceProfile,
CompanionState,
ConsequenceRecord,
CustomWorldNpc,
CustomWorldProfile,
EquipmentLoadout,
FacingDirection,
FactionTensionState,
GoalStackState,
InventoryItem,
JourneyBeat,
KnowledgeFact,
NarrativeQaReport,
NpcAnswerMode,
NpcDisclosureStage,
NpcWarmthStage,
PlayerStyleProfile,
PlayerProgressionState,
QuestStatus,
ReleaseGateReport,
ScenarioPack,
SceneNarrativeDirective,
SetpieceDirective,
SimulationRunResult,
StoryMoment,
StoryOption,
VisibilitySlice,
WorldMutation,
WorldType,
} from '../types';
import type { ConversationPressure, ConversationSituation } from '../types';
export interface StoryRequestOptions {
availableOptions?: StoryOption[];
optionCatalog?: StoryOption[];
}
export interface TextStreamOptions {
onUpdate?: (text: string) => void;
signal?: AbortSignal;
}
export interface CustomWorldSceneImageRequest {
profile: {
id: string;
name: string;
subtitle: string;
summary: string;
tone: string;
playerGoal: string;
settingText: string;
};
landmark: {
id: string;
name: string;
description: string;
};
userPrompt?: string;
prompt?: string;
negativePrompt?: string;
size?: string;
referenceImageSrc?: string;
}
export interface CustomWorldSceneImageResult {
imageSrc: string;
assetId: string;
model: string;
size: string;
taskId: string;
prompt: string;
actualPrompt?: string;
}
export interface StoryGenerationContext {
playerHp: number;
playerMaxHp: number;
playerMana: number;
playerMaxMana: number;
inBattle: boolean;
playerX: number;
playerFacing: FacingDirection;
playerAnimation: AnimationState;
skillCooldowns: Record<string, number>;
sceneId?: string | null;
sceneName?: string | null;
sceneDescription?: string | null;
pendingSceneEncounter?: boolean;
lastFunctionId?: string | null;
observeSignsRequested?: boolean;
lastObserveSignsReport?: string | null;
recentActionResult?: string | null;
encounterKind?: string | null;
encounterName?: string | null;
encounterDescription?: string | null;
encounterContext?: string | null;
encounterId?: string | null;
encounterCharacterId?: string | null;
encounterGender?: CharacterGender | null;
encounterAffinity?: number | null;
encounterAffinityText?: string | null;
encounterStanceProfile?: CompanionStanceProfile | null;
encounterConversationStyle?: CharacterConversationStyle | null;
encounterDisclosureStage?: NpcDisclosureStage | null;
encounterWarmthStage?: NpcWarmthStage | null;
encounterAnswerMode?: NpcAnswerMode | null;
encounterAllowedTopics?: string[] | null;
encounterBlockedTopics?: string[] | null;
isFirstMeaningfulContact?: boolean;
firstContactRelationStance?:
| 'guarded'
| 'neutral'
| 'cooperative'
| 'bonded'
| null;
conversationSituation?: ConversationSituation | null;
conversationPressure?: ConversationPressure | null;
recentSharedEvent?: string | null;
talkPriority?: string | null;
encounterRelationshipSummary?: string | null;
encounterCustomProfile?: Partial<
Pick<
CustomWorldNpc,
| 'title'
| 'description'
| 'backstory'
| 'personality'
| 'motivation'
| 'combatStyle'
| 'relationshipHooks'
| 'tags'
| 'backstoryReveal'
| 'skills'
| 'initialItems'
| 'imageSrc'
| 'visual'
| 'narrativeProfile'
>
> | null;
visibilitySlice?: VisibilitySlice | null;
sceneNarrativeDirective?: SceneNarrativeDirective | null;
campaignState?: CampaignState | null;
actState?: ActState | null;
chapterState?: ChapterState | null;
journeyBeat?: JourneyBeat | null;
goalStack?: GoalStackState | null;
currentCampEvent?: CampEvent | null;
setpieceDirective?: SetpieceDirective | null;
encounterNarrativeProfile?: ActorNarrativeProfile | null;
knowledgeFacts?: KnowledgeFact[] | null;
activeThreadIds?: string[] | null;
companionArcStates?: CompanionArcState[] | null;
companionResolutions?: CompanionResolution[] | null;
consequenceLedger?: ConsequenceRecord[] | null;
authorialConstraintPack?: AuthorialConstraintPack | null;
activeScenarioPack?: ScenarioPack | null;
activeCampaignPack?: CampaignPack | null;
playerStyleProfile?: PlayerStyleProfile | null;
recentCompanionReactions?: CompanionReactionRecord[] | null;
recentCarrierEchoes?: string[] | null;
recentWorldMutations?: WorldMutation[] | null;
recentFactionTensionStates?: FactionTensionState[] | null;
recentChronicleSummary?: string | null;
narrativeQaReport?: NarrativeQaReport | null;
releaseGateReport?: ReleaseGateReport | null;
simulationRunResults?: SimulationRunResult[] | null;
branchBudgetPressure?: string | null;
partyRelationshipNotes?: string | null;
customWorldProfile?: CustomWorldProfile | null;
openingCampBackground?: string | null;
openingCampDialogue?: string | null;
}
export interface QuestSummarySnapshot {
id: string;
title: string;
status: QuestStatus;
issuerNpcId: string;
}
export interface QuestGenerationContext {
worldType: WorldType | null;
customWorldProfile?: CustomWorldProfile | null;
actState?: ActState | null;
currentSceneId?: string | null;
currentSceneName?: string | null;
currentSceneDescription?: string | null;
issuerNpcId?: string | null;
issuerNpcName?: string | null;
issuerNpcContext?: string | null;
issuerAffinity?: number | null;
issuerNarrativeProfile?: ActorNarrativeProfile | null;
issuerDisclosureStage?: NpcDisclosureStage | null;
issuerWarmthStage?: NpcWarmthStage | null;
activeThreadIds?: string[] | null;
encounterKind?: 'npc' | 'treasure' | 'none' | null;
currentSceneHostileNpcIds?: string[];
currentSceneTreasureHintCount?: number;
recentStoryMoments: StoryMoment[];
playerCharacter?: Character | null;
playerProgression?: PlayerProgressionState | null;
playerHp?: number;
playerMaxHp?: number;
playerMana?: number;
playerMaxMana?: number;
playerInventory?: InventoryItem[];
playerEquipment?: EquipmentLoadout | null;
activeCompanions?: CompanionState[];
rosterCompanions?: CompanionState[];
currentQuestSummary?: QuestSummarySnapshot[];
}