Integrate role asset studio into custom world agent flow
This commit is contained in:
418
packages/shared/src/contracts/customWorldAgent.ts
Normal file
418
packages/shared/src/contracts/customWorldAgent.ts
Normal file
@@ -0,0 +1,418 @@
|
||||
export type CustomWorldWorkStatus = 'draft' | 'published';
|
||||
export type CustomWorldWorkSource = 'agent_session' | 'published_profile';
|
||||
|
||||
export interface CustomWorldWorkSummary {
|
||||
workId: string;
|
||||
sourceType: CustomWorldWorkSource;
|
||||
status: CustomWorldWorkStatus;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
summary: string;
|
||||
coverImageSrc?: string | null;
|
||||
updatedAt: string;
|
||||
publishedAt?: string | null;
|
||||
stage?: string | null;
|
||||
stageLabel?: string | null;
|
||||
playableNpcCount: number;
|
||||
landmarkCount: number;
|
||||
roleVisualReadyCount?: number;
|
||||
roleAnimationReadyCount?: number;
|
||||
roleAssetSummaryLabel?: string | null;
|
||||
sessionId?: string | null;
|
||||
profileId?: string | null;
|
||||
canResume: boolean;
|
||||
canEnterWorld: boolean;
|
||||
}
|
||||
|
||||
export interface CreatorIntentReadiness {
|
||||
isReady: boolean;
|
||||
completedKeys: string[];
|
||||
missingKeys: string[];
|
||||
}
|
||||
|
||||
export interface CustomWorldPendingClarification {
|
||||
id: string;
|
||||
label: string;
|
||||
question: string;
|
||||
targetKey:
|
||||
| 'world_hook'
|
||||
| 'player_premise'
|
||||
| 'theme_and_tone'
|
||||
| 'core_conflict'
|
||||
| 'relationship_seed'
|
||||
| 'iconic_element';
|
||||
priority: number;
|
||||
answer?: string;
|
||||
}
|
||||
|
||||
export type CustomWorldAgentStage =
|
||||
| 'collecting_intent'
|
||||
| 'clarifying'
|
||||
| 'foundation_review'
|
||||
| 'object_refining'
|
||||
| 'visual_refining'
|
||||
| 'long_tail_review'
|
||||
| 'ready_to_publish'
|
||||
| 'published'
|
||||
| 'error';
|
||||
|
||||
export type CustomWorldAgentMessageRole = 'user' | 'assistant' | 'system';
|
||||
|
||||
export type CustomWorldAgentMessageKind =
|
||||
| 'chat'
|
||||
| 'clarification'
|
||||
| 'summary'
|
||||
| 'checkpoint'
|
||||
| 'warning'
|
||||
| 'action_result';
|
||||
|
||||
export interface CustomWorldAgentMessage {
|
||||
id: string;
|
||||
role: CustomWorldAgentMessageRole;
|
||||
kind: CustomWorldAgentMessageKind;
|
||||
text: string;
|
||||
createdAt: string;
|
||||
relatedOperationId?: string | null;
|
||||
}
|
||||
|
||||
export type CustomWorldDraftCardKind =
|
||||
| 'world'
|
||||
| 'camp'
|
||||
| 'faction'
|
||||
| 'character'
|
||||
| 'landmark'
|
||||
| 'thread'
|
||||
| 'chapter'
|
||||
| 'scene_chapter'
|
||||
| 'carrier'
|
||||
| 'sidequest_seed';
|
||||
|
||||
export type CustomWorldDraftCardStatus =
|
||||
| 'suggested'
|
||||
| 'confirmed'
|
||||
| 'locked'
|
||||
| 'warning';
|
||||
|
||||
export interface CustomWorldDraftCardSummary {
|
||||
id: string;
|
||||
kind: CustomWorldDraftCardKind;
|
||||
title: string;
|
||||
subtitle: string;
|
||||
summary: string;
|
||||
status: CustomWorldDraftCardStatus;
|
||||
linkedIds: string[];
|
||||
warningCount: number;
|
||||
assetStatus?: CustomWorldRoleAssetStatus | null;
|
||||
assetStatusLabel?: string | null;
|
||||
}
|
||||
|
||||
export interface CustomWorldDraftCardDetailSection {
|
||||
id: string;
|
||||
label: string;
|
||||
value: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftFaction {
|
||||
id: string;
|
||||
name: string;
|
||||
title?: string;
|
||||
subtitle?: string;
|
||||
publicGoal: string;
|
||||
relatedConflict: string;
|
||||
tension?: string;
|
||||
playerRelation: string;
|
||||
summary: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftCharacter {
|
||||
id: string;
|
||||
name: string;
|
||||
title: string;
|
||||
role: string;
|
||||
publicIdentity: string;
|
||||
publicMask?: string;
|
||||
currentPressure: string;
|
||||
hiddenHook?: string;
|
||||
relationToPlayer: string;
|
||||
threadIds: string[];
|
||||
summary: string;
|
||||
imageSrc?: string | null;
|
||||
generatedVisualAssetId?: string | null;
|
||||
generatedAnimationSetId?: string | null;
|
||||
animationMap?: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftLandmark {
|
||||
id: string;
|
||||
name: string;
|
||||
description?: string;
|
||||
purpose: string;
|
||||
mood: string;
|
||||
importance: string;
|
||||
secret?: string;
|
||||
dangerLevel?: string;
|
||||
characterIds: string[];
|
||||
threadIds: string[];
|
||||
summary: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftThread {
|
||||
id: string;
|
||||
title: string;
|
||||
type: 'main' | 'hidden';
|
||||
conflictType?: string;
|
||||
conflict: string;
|
||||
stakes?: string;
|
||||
characterIds: string[];
|
||||
landmarkIds: string[];
|
||||
summary: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftChapter {
|
||||
id: string;
|
||||
title: string;
|
||||
openingEvent: string;
|
||||
playerGoal: string;
|
||||
characterIds: string[];
|
||||
landmarkIds: string[];
|
||||
understandingShift: string;
|
||||
summary: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftCamp {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
mood: string;
|
||||
dangerLevel?: string;
|
||||
summary: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftProfile {
|
||||
name: string;
|
||||
subtitle: string;
|
||||
summary: string;
|
||||
tone: string;
|
||||
playerGoal: string;
|
||||
majorFactions: string[];
|
||||
coreConflicts: string[];
|
||||
playableNpcs: CustomWorldFoundationDraftCharacter[];
|
||||
storyNpcs: CustomWorldFoundationDraftCharacter[];
|
||||
landmarks: CustomWorldFoundationDraftLandmark[];
|
||||
camp?: CustomWorldFoundationDraftCamp | null;
|
||||
themePack?: Record<string, unknown> | null;
|
||||
storyGraph?: Record<string, unknown> | null;
|
||||
factions: CustomWorldFoundationDraftFaction[];
|
||||
threads: CustomWorldFoundationDraftThread[];
|
||||
chapters: CustomWorldFoundationDraftChapter[];
|
||||
worldHook: string;
|
||||
playerPremise: string;
|
||||
openingSituation: string;
|
||||
iconicElements: string[];
|
||||
sourceAnchorSummary: string;
|
||||
}
|
||||
|
||||
export interface CustomWorldFoundationDraftResult {
|
||||
draftProfile: CustomWorldFoundationDraftProfile;
|
||||
draftCards: CustomWorldDraftCardSummary[];
|
||||
}
|
||||
|
||||
export interface CustomWorldDraftCardDetail {
|
||||
id: string;
|
||||
kind: CustomWorldDraftCardKind;
|
||||
title: string;
|
||||
sections: CustomWorldDraftCardDetailSection[];
|
||||
linkedIds: string[];
|
||||
locked: false;
|
||||
editable: boolean;
|
||||
editableSectionIds: string[];
|
||||
warningMessages: string[];
|
||||
assetStatus?: CustomWorldRoleAssetStatus | null;
|
||||
assetStatusLabel?: string | null;
|
||||
}
|
||||
|
||||
export interface CustomWorldSuggestedAction {
|
||||
id: string;
|
||||
type:
|
||||
| 'request_summary'
|
||||
| 'draft_foundation'
|
||||
| 'refine_focus_target'
|
||||
| 'lock_current_target'
|
||||
| 'generate_role_assets'
|
||||
| 'generate_scene_assets'
|
||||
| 'expand_long_tail'
|
||||
| 'publish_world';
|
||||
label: string;
|
||||
targetId?: string | null;
|
||||
}
|
||||
|
||||
export type CustomWorldAssetPriorityTier = 'hero' | 'featured' | 'supporting';
|
||||
|
||||
export type CustomWorldRoleAssetStatus =
|
||||
| 'missing'
|
||||
| 'visual_ready'
|
||||
| 'animations_ready'
|
||||
| 'complete';
|
||||
|
||||
export interface CustomWorldRoleAssetSummary {
|
||||
roleId: string;
|
||||
roleName: string;
|
||||
roleKind: 'playable' | 'story';
|
||||
priorityTier: CustomWorldAssetPriorityTier;
|
||||
portraitPath?: string | null;
|
||||
generatedVisualAssetId?: string | null;
|
||||
generatedAnimationSetId?: string | null;
|
||||
status: CustomWorldRoleAssetStatus;
|
||||
missingAnimations: string[];
|
||||
nextPointCost: number;
|
||||
}
|
||||
|
||||
export interface CustomWorldSceneAssetSummary {
|
||||
sceneId: string;
|
||||
sceneName: string;
|
||||
imageSrc?: string | null;
|
||||
status: 'missing' | 'ready';
|
||||
nextPointCost: number;
|
||||
}
|
||||
|
||||
export interface CustomWorldAssetCoverageSummary {
|
||||
roleAssets: CustomWorldRoleAssetSummary[];
|
||||
sceneAssets: CustomWorldSceneAssetSummary[];
|
||||
allRoleAssetsReady: boolean;
|
||||
allSceneAssetsReady: boolean;
|
||||
}
|
||||
|
||||
export interface CustomWorldAgentSessionSnapshot {
|
||||
sessionId: string;
|
||||
stage: CustomWorldAgentStage;
|
||||
focusCardId: string | null;
|
||||
creatorIntent: Record<string, unknown> | null;
|
||||
creatorIntentReadiness: CreatorIntentReadiness;
|
||||
anchorPack: Record<string, unknown> | null;
|
||||
lockState: Record<string, unknown> | null;
|
||||
draftProfile: Record<string, unknown> | null;
|
||||
messages: CustomWorldAgentMessage[];
|
||||
draftCards: CustomWorldDraftCardSummary[];
|
||||
pendingClarifications: CustomWorldPendingClarification[];
|
||||
suggestedActions: CustomWorldSuggestedAction[];
|
||||
recommendedReplies: string[];
|
||||
qualityFindings: {
|
||||
id: string;
|
||||
severity: 'info' | 'warning' | 'blocker';
|
||||
code: string;
|
||||
targetId?: string | null;
|
||||
message: string;
|
||||
}[];
|
||||
assetCoverage: CustomWorldAssetCoverageSummary;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
export type CustomWorldAgentOperationType =
|
||||
| 'process_message'
|
||||
| 'lock_cards'
|
||||
| 'unlock_cards'
|
||||
| 'regenerate_scope'
|
||||
| 'draft_foundation'
|
||||
| 'update_draft_card'
|
||||
| 'generate_characters'
|
||||
| 'generate_landmarks'
|
||||
| 'generate_role_assets'
|
||||
| 'sync_role_assets'
|
||||
| 'generate_scene_assets'
|
||||
| 'sync_scene_assets'
|
||||
| 'expand_long_tail'
|
||||
| 'publish_world'
|
||||
| 'revert_checkpoint';
|
||||
|
||||
export type CustomWorldAgentOperationStatus =
|
||||
| 'queued'
|
||||
| 'running'
|
||||
| 'completed'
|
||||
| 'failed';
|
||||
|
||||
export interface CustomWorldAgentOperationRecord {
|
||||
operationId: string;
|
||||
type: CustomWorldAgentOperationType;
|
||||
status: CustomWorldAgentOperationStatus;
|
||||
phaseLabel: string;
|
||||
phaseDetail: string;
|
||||
progress: number;
|
||||
error?: string | null;
|
||||
}
|
||||
|
||||
export interface CreateCustomWorldAgentSessionRequest {
|
||||
seedText?: string;
|
||||
}
|
||||
|
||||
export interface CreateCustomWorldAgentSessionResponse {
|
||||
session: CustomWorldAgentSessionSnapshot;
|
||||
}
|
||||
|
||||
export interface SendCustomWorldAgentMessageRequest {
|
||||
clientMessageId: string;
|
||||
text: string;
|
||||
focusCardId?: string | null;
|
||||
selectedCardIds?: string[];
|
||||
}
|
||||
|
||||
export interface SendCustomWorldAgentMessageResponse {
|
||||
operation: CustomWorldAgentOperationRecord;
|
||||
}
|
||||
|
||||
export type CustomWorldAgentActionRequest =
|
||||
| { action: 'lock_cards'; cardIds: string[] }
|
||||
| { action: 'unlock_cards'; cardIds: string[] }
|
||||
| {
|
||||
action: 'regenerate_scope';
|
||||
scope:
|
||||
| 'focus_card'
|
||||
| 'long_tail_npcs'
|
||||
| 'long_tail_landmarks'
|
||||
| 'sidequest_seeds'
|
||||
| 'role_assets'
|
||||
| 'scene_assets';
|
||||
targetCardId?: string | null;
|
||||
}
|
||||
| { action: 'draft_foundation' }
|
||||
| {
|
||||
action: 'update_draft_card';
|
||||
cardId: string;
|
||||
sections: Array<{
|
||||
sectionId: string;
|
||||
value: string;
|
||||
}>;
|
||||
}
|
||||
| {
|
||||
action: 'generate_characters';
|
||||
count: number;
|
||||
promptText?: string | null;
|
||||
anchorCardIds?: string[];
|
||||
}
|
||||
| {
|
||||
action: 'generate_landmarks';
|
||||
count: number;
|
||||
promptText?: string | null;
|
||||
anchorCardIds?: string[];
|
||||
}
|
||||
| { action: 'generate_role_assets'; roleIds: string[] }
|
||||
| {
|
||||
action: 'sync_role_assets';
|
||||
roleId: string;
|
||||
portraitPath: string;
|
||||
generatedVisualAssetId: string;
|
||||
generatedAnimationSetId?: string | null;
|
||||
animationMap?: Record<string, unknown> | null;
|
||||
}
|
||||
| { action: 'publish_world' };
|
||||
|
||||
export interface CustomWorldAgentActionResponse {
|
||||
operation: CustomWorldAgentOperationRecord;
|
||||
}
|
||||
|
||||
export interface GetCustomWorldAgentCardDetailResponse {
|
||||
card: CustomWorldDraftCardDetail;
|
||||
}
|
||||
|
||||
export interface ListCustomWorldWorksResponse {
|
||||
items: CustomWorldWorkSummary[];
|
||||
}
|
||||
@@ -114,10 +114,13 @@ export type CustomWorldSessionSummary = {
|
||||
sessionId: string;
|
||||
status: CustomWorldSessionStatus;
|
||||
questions: CustomWorldQuestion[];
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
export type CustomWorldSessionRecord = CustomWorldSessionSummary & {
|
||||
settingText: string;
|
||||
creatorIntent?: JsonObject | null;
|
||||
generationMode: CustomWorldGenerationMode;
|
||||
result?: JsonObject;
|
||||
lastError?: string;
|
||||
|
||||
Reference in New Issue
Block a user