export type IntelSnippet = { source: string; category: string; summary: string; confidence: number; }; export type SourcePacket = { source_id: string; source_name: string; delivery: "training_core" | "live_demo"; kind: string; endpoint_kind: string; status: "pending" | "ok" | "error"; fetched_at?: string | null; probe_url?: string | null; summary: string; sample_items: string[]; error?: string | null; }; export type BlackSwanEvent = { id: string; summary: string; source: string; severity: number; public: boolean; affected_agents: string[]; }; export type AgentAction = { actor: string; type: | "hold" | "negotiate" | "sanction" | "strike" | "defend" | "intel_query" | "mobilize" | "deceive" | "oversight_review"; summary: string; target?: string | null; metadata?: Record; }; export type ExternalSignal = { source: string; headline: string; region?: string | null; tags?: string[]; severity?: number; }; export type RewardBreakdown = { coalition_stability: number; escalation_penalty: number; market_gain: number; behavioral_consistency: number; goal_terms: Record; total: number; }; export type OversightIntervention = { triggered: boolean; risk_score: number; reason: string; affected_agents: string[]; action_override: Record; }; export type AgentObservation = { public_brief: IntelSnippet[]; private_brief: IntelSnippet[]; perceived_tension: number; known_coalitions: string[]; event_log: BlackSwanEvent[]; entity_profile: Record; strategic_state: Record; strategic_assets: Record[]; source_bundle: string[]; training_source_bundle: string[]; live_source_bundle: string[]; source_packets: SourcePacket[]; training_source_packets: SourcePacket[]; live_source_packets: SourcePacket[]; }; export type WorldState = { turn: number; tension_level: number; market_stress: number; oil_pressure: number; actor_state: Record>; coalition_graph: Record; active_events: BlackSwanEvent[]; hidden_intents: Record; behavioral_consistency: Record; ema_tension: Record; risk_scores: Record; last_actions: AgentAction[]; }; export type LiveSessionConfig = { enabled: boolean; auto_step: boolean; poll_interval_ms: number; started_at?: string | null; last_source_sync_at?: string | null; last_auto_step_at?: string | null; source_queue_sizes: Record; reacted_packet_fetched_at: Record; }; export type SourceMonitorIssue = { severity: "warning" | "error"; message: string; }; export type AgentSourceMonitor = { agent_id: string; display_name: string; status: "healthy" | "degraded" | "blocked"; configured_training_sources: number; configured_live_sources: number; active_source_count: number; ok_packet_count: number; pending_packet_count: number; error_packet_count: number; available_training_packet_count: number; available_live_packet_count: number; delivered_training_brief_count: number; delivered_live_brief_count: number; missing_training_sources: string[]; missing_live_sources: string[]; unbundled_training_sources: string[]; unbundled_live_sources: string[]; missing_packet_sources: string[]; sources_without_probe_targets: string[]; stale_sources: string[]; error_sources: string[]; pending_sources: string[]; delivered_source_names: string[]; issues: SourceMonitorIssue[]; }; export type SourceMonitorSummary = { healthy_agents: number; degraded_agents: number; blocked_agents: number; active_source_count: number; ok_packet_count: number; delivered_source_brief_count: number; }; export type SourceMonitorReport = { session_id: string; live_enabled: boolean; generated_at: string; summary: SourceMonitorSummary; agents: AgentSourceMonitor[]; }; export type EpisodeMetadata = { max_turns: number; training_stage: "stage_1_dense" | "stage_2_partial" | "stage_3_sparse"; algorithm_hints: Record; dense_rewards: boolean; sparse_rewards: boolean; fog_of_war: boolean; oversight_enabled: boolean; credit_assignment: string; live_mode_capable: boolean; live_mode_inference_only: boolean; }; export type StepTrace = { turn: number; tension_before: number; tension_after: number; actions: Record; rewards: Record; oversight: OversightIntervention; created_at: string; }; export type SessionState = { session_id: string; seed?: number | null; world: WorldState; observations: Record; rewards: Record; episode: EpisodeMetadata; recent_traces: StepTrace[]; live: LiveSessionConfig; created_at: string; updated_at: string; }; export type CreateSessionRequest = { seed?: number; training_stage?: "stage_1_dense" | "stage_2_partial" | "stage_3_sparse"; max_turns?: number; }; export type ResetSessionRequest = { seed?: number; training_stage?: "stage_1_dense" | "stage_2_partial" | "stage_3_sparse"; max_turns?: number; }; export type LiveControlRequest = { enabled: boolean; auto_step?: boolean; poll_interval_ms?: number; }; export type StepSessionRequest = { actions: Record; external_signals?: ExternalSignal[]; }; export type StepSessionResponse = { session: SessionState; oversight: OversightIntervention; done: boolean; };