// @generated by crates/nana-contracts; do not edit.

export type ResourceId = string;

export type ResourceKind = "character" | "world_book" | "persona" | "plot_module" | "item_spec";

export type ResourceRef = { id: ResourceId, kind: ResourceKind, revision: string, content_hash: string, };

export type ResourceHeader = { id: ResourceId, kind: ResourceKind, schema_version: number, revision: string, content_hash: string, dependencies: Array<ResourceRef>, };

export type CharacterStyle = { speech: string, mannerisms: Array<string>, forbidden_player_assumptions: Array<string>, };

export type CharacterJudgmentRule = { tags: Array<string>, meaning: string, relationship_effects: Array<RelationshipAdjustment>, };

export type SkillValue = { skill: string, value: number, };

export type CharacterCard = { header: ResourceHeader, name: string, identity: string, personality: Array<string>, values: Array<string>, boundaries: Array<string>, style: CharacterStyle, initial_relationship: RelationshipAxes, judgment_rules: Array<CharacterJudgmentRule>, skills: Array<SkillValue>, default_expression: string, };

export type WorldBookEntry = { id: string, title: string, content: string, keywords: Array<string>, tags: Array<string>, required_flags: Array<string>, };

export type WorldBook = { header: ResourceHeader, name: string, entries: Array<WorldBookEntry>, };

export type Persona = { header: ResourceHeader, name: string, identity: string, traits: Array<string>, skills: Array<SkillValue>, initial_items: Array<ResourceId>, };

export type PlotPressure = { id: string, description: string, clock_id: string | null, clock_delta: number | null, };

export type PlotOutcome = { id: string, description: string, effects: Array<StateOp>, };

export type PlotEvent = { id: string, title: string, tags: Array<string>, situation: Array<string>, required_flags: Array<string>, pressures: Array<PlotPressure>, outcomes: Array<PlotOutcome>, };

export type PlotModule = { header: ResourceHeader, name: string, opening_event: string, events: Array<PlotEvent>, };

export type ItemMechanics = { usable: boolean, grants_tags: Array<string>, check_modifier: number | null, };

export type ItemSpec = { header: ResourceHeader, name: string, description: string, tags: Array<string>, lore_refs: Array<string>, mechanics: ItemMechanics, hidden_facts: Array<string>, };

export type ResourceBundle = { id: string, schema_version: number, revision: string, display_name: string, entry_character: ResourceId, entry_persona: ResourceId, entry_plot_module: ResourceId | null, characters: Array<CharacterCard>, world_books: Array<WorldBook>, personas: Array<Persona>, plot_modules: Array<PlotModule>, item_specs: Array<ItemSpec>, };

export type RelationshipAxes = { affinity: number, trust: number, hope: number, respect: number, intimacy: number, attachment: number, };

export type RelationshipAdjustment = { dimension: RelationshipDimension, delta: number, cause: string, judgment_rule: string | null, };

export type RelationshipDimension = "affinity" | "trust" | "hope" | "respect" | "intimacy" | "attachment";

export type RelationshipBand = "distant" | "guarded" | "warming" | "close" | "bonded";

export type RelationshipView = { affinity: RelationshipBand, trust: RelationshipBand, hope: RelationshipBand, respect: RelationshipBand, intimacy: RelationshipBand, attachment: RelationshipBand, updatedAtNode: string | null, };

export type PromiseStatus = "proposed" | "accepted" | "fulfilled" | "broken" | "released" | "impossible";

export type PromiseWeight = "minor" | "major";

export type Promise = { id: string, promiser: string, promisee: string, content: string, status: PromiseStatus, weight: PromiseWeight, created_at: string, accepted_at: string | null, resolved_at: string | null, };

export type RelationshipState = { id: string, tag: string, description: string, source_node: string, active: boolean, };

export type KnowledgeCertainty = "suspected" | "reported" | "confirmed";

export type KnowledgeRecord = { id: string, observer: string, subject: string | null, fact: string, certainty: KnowledgeCertainty, source: string, learned_at: string, last_verified_at: string | null, };

export type ItemPlacement = "bag" | "worn" | "hand" | "scene" | "hidden";

export type AcquisitionMode = "initial" | "found" | "given" | "borrowed" | "stolen" | "returned";

export type ItemAcquisition = { mode: AcquisitionMode, from: string | null, at_node: string, };

export type ItemInstance = { id: string, spec_ref: ResourceId, owner: string, holder: string, placement: ItemPlacement, quantity: number, condition: string, state_tags: Array<string>, acquisition: ItemAcquisition, };

export type CheckDifficulty = "regular" | "hard" | "extreme";

export type CheckResult = "critical_success" | "extreme_success" | "hard_success" | "success" | "failure" | "fumble";

export type CheckRecord = { id: string, action_id: string, actor: string, skill: string, target: number, difficulty: CheckDifficulty, bonus_dice: number, roll: number, result: CheckResult, pushed_from: string | null, node_id: string, };

export type ClockState = { id: string, label: string, value: number, max: number, };

export type StoryBinding = { persona: ResourceRef, characters: Array<ResourceRef>, world_books: Array<ResourceRef>, plot_modules: Array<ResourceRef>, };

export type Story = { id: string, title: string, ruleset: string, bindings: StoryBinding, root_node: string, active_branch: string, };

export type StateDelta = { ops: Array<StateOp>, };

export type StateOp = { "op": "set_world_flag", key: string, value: boolean, } | { "op": "adjust_relationship", from: string, to: string, adjustment: RelationshipAdjustment, } | { "op": "create_promise", promise: Promise, } | { "op": "update_promise", promise_id: string, status: PromiseStatus, resolved_at: string | null, } | { "op": "add_knowledge", record: KnowledgeRecord, } | { "op": "add_item", item: ItemInstance, } | { "op": "transfer_item", item_id: string, from: string, to: string, placement: ItemPlacement, mode: AcquisitionMode, } | { "op": "record_check", check: CheckRecord, } | { "op": "advance_clock", clock_id: string, delta: number, };

export type StoryNode = { id: string, story_id: string, branch_id: string, parent_id: string | null, action_id: string, user_input: string, delta: StateDelta, state_hash: string, scene: PresentationScene, character: PresentationCharacter, beats: Array<PresentationBeat>, suggestions: Array<ActionSuggestion>, can_continue: boolean, };

export type RuntimeState = { story_id: string, current_node: string, current_branch: string, world_flags: { [key in string]?: boolean }, relationships: { [key in string]?: RelationshipAxes }, relationship_states: Array<RelationshipState>, promises: Array<Promise>, knowledge: Array<KnowledgeRecord>, items: Array<ItemInstance>, clocks: Array<ClockState>, checks: Array<CheckRecord>, };

export type BeatKind = "narration" | "dialogue" | "action" | "system";

export type VisualDirective = { character: string | null, expression: string | null, pose: string | null, scene: string | null, };

export type PresentationBeat = { id: string, kind: BeatKind, speaker: string | null, text: string, visual: VisualDirective | null, };

export type ActionSuggestion = { id: string, label: string, draft: string, };

export type PresentationScene = { id: string, title: string, };

export type PresentationCharacter = { id: string, name: string, expression: string | null, pose: string | null, };

export type PresentationSnapshot = { scene: PresentationScene, character: PresentationCharacter, beats: Array<PresentationBeat>, suggestions: Array<ActionSuggestion>, can_continue: boolean, };

export type PlayerItemView = { instanceId: string, name: string, description: string, quantity: number, placement: ItemPlacement, condition: string, };

export type PlayerKnowledgeView = { id: string, title: string, summary: string, certainty: KnowledgeCertainty, };

export type PlayerPromiseView = { id: string, content: string, status: PromiseStatus, weight: PromiseWeight, };

export type HistoryNodeView = { id: string, parentId: string | null, branchId: string, label: string, isCurrent: boolean, };

export type PlayerView = { storyId: string, nodeId: string, branchId: string, sceneId: string, sceneTitle: string, characterName: string, characterExpression: string | null, characterPose: string | null, beats: Array<PresentationBeat>, suggestions: Array<ActionSuggestion>, inventory: Array<PlayerItemView>, knowledge: Array<PlayerKnowledgeView>, promises: Array<PlayerPromiseView>, relationship: RelationshipView, history: Array<HistoryNodeView>, canContinue: boolean, };

export type TurnIntent = "speak_or_act" | "continue" | "regenerate" | "push_check";

export type TurnRequest = { storyId: string, branchId: string, expectedNodeId: string, actionId: string, intent: TurnIntent, input: string, };

export type TurnResult = { committedNodeId: string, playerView: PlayerView, };

export type ForkBranchRequest = { storyId: string, currentBranchId: string, expectedCurrentNodeId: string, sourceNodeId: string, actionId: string, };

export type ForkBranchResult = { branchId: string, playerView: PlayerView, };

export type TurnFailureCode = "stale_node" | "invalid_input" | "invalid_model_output" | "provider_unavailable" | "cancelled" | "timed_out" | "internal";

export type TurnFailure = { code: TurnFailureCode, message: string, retryable: boolean, };

export type AppInfo = { name: string, version: string, contractVersion: number, };

export type DemoPackSummary = { id: string, displayName: string, revision: string, characters: number, worldBooks: number, personas: number, plotModules: number, itemSpecs: number, };

export type ValidationCode = "invalid_id" | "invalid_schema_version" | "invalid_revision" | "invalid_content_hash" | "wrong_resource_kind" | "duplicate_resource" | "missing_reference" | "invalid_relationship_value" | "invalid_skill_value";

export type ValidationIssue = { code: ValidationCode, path: string, message: string, };

export type ValidationReport = { issues: Array<ValidationIssue>, };
