Skip to main content

feagi_api/v1/
burst_engine_dtos.rs

1// Copyright 2025 Neuraville Inc.
2// Licensed under the Apache License, Version 2.0
3
4//! Burst Engine API DTOs
5//!
6//! Request/response types for FCL, Fire Queue, and burst engine control
7
8use serde::{Deserialize, Serialize};
9use std::collections::HashMap;
10use utoipa::ToSchema;
11
12/// Fire Candidate List (FCL) response
13#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
14pub struct FCLResponse {
15    /// Current timestep
16    pub timestep: u64,
17
18    /// Total neurons in FCL
19    pub total_neurons: usize,
20
21    /// Global FCL (all neuron IDs across areas)
22    pub global_fcl: Vec<u64>,
23
24    /// FCL organized by cortical area
25    pub cortical_areas: HashMap<String, Vec<u64>>,
26
27    /// Default fire ledger window size
28    pub default_window_size: u32,
29
30    /// Number of cortical areas with active neurons
31    pub active_cortical_count: usize,
32}
33
34/// Fire Queue response
35#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
36pub struct FireQueueResponse {
37    /// Current timestep
38    pub timestep: u64,
39
40    /// Total neurons that fired
41    pub total_fired: usize,
42
43    /// Fired neurons organized by cortical area
44    pub cortical_areas: HashMap<String, Vec<u64>>,
45}
46
47/// FCL status response
48#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
49pub struct FCLStatusResponse {
50    pub available: bool,
51    #[serde(skip_serializing_if = "Option::is_none")]
52    pub error: Option<String>,
53}
54
55/// Fire Ledger window configuration response
56#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
57pub struct FireLedgerConfigResponse {
58    pub default_window_size: u32,
59    pub areas: HashMap<String, u32>,
60    pub total_configured_areas: usize,
61}
62
63/// Burst engine statistics
64#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
65pub struct BurstEngineStats {
66    pub burst_count: u64,
67    pub frequency_hz: f64,
68    pub active: bool,
69    pub paused: bool,
70}
71
72/// Burst engine status
73#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
74pub struct BurstEngineStatus {
75    pub active: bool,
76    pub paused: bool,
77    pub burst_count: u64,
78    pub frequency_hz: f64,
79}
80
81/// Burst engine control request
82#[derive(Debug, Clone, Serialize, Deserialize, ToSchema)]
83pub struct BurstEngineControlRequest {
84    /// Action to perform: "start", "pause", "stop", "resume"
85    pub action: String,
86}