Files
Genarrative/src/types/runtimeItem.ts
kdletters cbc27bad4a
Some checks failed
CI / verify (push) Has been cancelled
init with react+axum+spacetimedb
2026-04-26 18:06:23 +08:00

123 lines
3.8 KiB
TypeScript

import type {WorldType} from './core';
import type {CustomWorldProfile} from './customWorld';
import type {InventoryItem} from './items';
import type {Encounter, NpcPersistentState, ScenePresetInfo} from './scene';
import type {
ActorNarrativeProfile,
CarrierStoryFingerprint,
} from './storyEngine';
export type RuntimeItemGenerationChannel =
| 'treasure'
| 'npc_trade'
| 'npc_reward'
| 'monster_drop'
| 'quest_reward'
| 'discovery';
export type RuntimeItemOrigin = 'catalog' | 'procedural' | 'ai_compiled';
export type RuntimeItemKind = 'equipment' | 'consumable' | 'material' | 'relic' | 'quest';
export type RuntimeItemPermanence = 'permanent' | 'timed' | 'resource';
export type RuntimeNarrativeWeight = 'light' | 'medium' | 'heavy';
export type RuntimeItemPlanSlot = 'primary' | 'secondary' | 'support';
export type RuntimeRelationAnchor =
| {type: 'npc'; npcId?: string; npcName: string; roleText?: string}
| {type: 'scene'; sceneId?: string; sceneName: string}
| {type: 'landmark'; landmarkName: string}
| {type: 'monster'; monsterId?: string; monsterName: string}
| {type: 'faction'; factionName: string}
| {type: 'quest'; questId?: string; questName: string};
export interface RuntimeItemMetadata {
origin: RuntimeItemOrigin;
generationChannel: RuntimeItemGenerationChannel;
seedKey: string;
relationAnchor?: RuntimeRelationAnchor;
sourceReason: string;
recentEventHook?: string;
storyFingerprint?: CarrierStoryFingerprint | null;
}
export interface RuntimeItemGenerationContext {
worldType: WorldType | null;
customWorldProfile: CustomWorldProfile | null;
sceneId: string | null;
sceneName: string | null;
sceneDescription: string | null;
sceneTags: string[];
treasureHints: string[];
encounter: Encounter | null;
encounterNpcId: string | null;
encounterNpcName: string | null;
encounterContextText: string | null;
relatedNpcState: NpcPersistentState | null;
relatedNpcNarrativeProfile?: ActorNarrativeProfile | null;
relatedScene: Pick<ScenePresetInfo, 'id' | 'name' | 'description' | 'treasureHints'> | null;
recentStorySummary: string;
recentActions: string[];
activeThreadIds?: string[] | null;
playerCharacterId: string;
playerBuildTags: string[];
playerBuildGaps: string[];
playerEquipmentTags: string[];
generationChannel: RuntimeItemGenerationChannel;
}
export interface RuntimeItemPlan {
slot: RuntimeItemPlanSlot;
itemKind: RuntimeItemKind;
permanence: RuntimeItemPermanence;
narrativeWeight: RuntimeNarrativeWeight;
targetBuildDirection: string[];
relationAnchor: RuntimeRelationAnchor;
}
export interface RuntimeItemAiPromptInput {
worldSummary: string;
sceneSummary: string;
encounterSummary: string;
relatedNpcSummary: string;
recentStorySummary: string;
activeThreadSummary?: string;
generationChannel: RuntimeItemGenerationChannel;
playerBuildDirection: string[];
playerBuildGaps: string[];
desiredItemKind: string;
permanence: string;
}
export interface RuntimeItemAiIntent {
shortNameSeed: string;
sourcePhrase: string;
reasonToAppear: string;
relationHooks: string[];
desiredBuildTags: string[];
desiredFunctionalBias: Array<'heal' | 'mana' | 'cooldown' | 'guard' | 'damage'>;
tone: 'grim' | 'mysterious' | 'martial' | 'ritual' | 'survival';
visibleClue?: string;
witnessMark?: string;
unfinishedBusiness?: string;
hiddenHook?: string;
reactionHooks?: string[];
namingPattern?: string;
}
export interface RuntimeItemCompileBudget {
rarity: InventoryItem['rarity'];
buildTagLimit: number;
timedBuffTagLimit: number;
timedBuffDuration: number;
statBudgetTier: number;
}
export interface DirectedRuntimeReward {
primaryItem?: InventoryItem | null;
supportItems: InventoryItem[];
hp?: number;
mana?: number;
currency?: number;
storyHint?: string;
}