use kernel::{
Address, ApprovalItem, Autonomy, ClusterKey, EventKind, FileChange, GitOid, Restoration,
Ruling, RunId, Seq, TimeMs,
};
use serde::{Deserialize, Serialize};
use crate::command::HaltScope;
use crate::guide::GuideProgress;
use crate::preference::PreferencesAnswer;
mod automation;
mod building;
mod commits;
mod config;
mod cost;
mod cost_of;
mod doctor;
mod document;
mod document_bytes;
mod document_versions;
mod endpoints;
mod evidence;
mod find;
mod git_status;
mod github;
mod harnesses;
mod history;
mod hunks;
mod identity;
mod known_hosts;
mod listing;
mod mcp_health;
mod metrics;
mod model_facts;
mod prefix;
mod preview;
mod proposals;
mod range;
mod release;
mod rounds;
mod sessions;
mod skills;
mod toolkits;
pub use automation::{AutomationAnswer, Cadence, ScheduledJob, WatchedSource};
pub use building::{ArchiveLine, BlockedLine, BuildingAnswer, BuildingDoc};
pub use building::{BuildingProgress, PlanRow, PursuitLine};
pub use commits::{CommitAnswer, CommitAt, CommitsAnswer};
pub use config::{
ConfigAnswer, ConfigLayer, SecondDomain, SettledEffort, SettledSecond, TuningDefaults,
};
pub use cost::{CostAnswer, UnpricedCalls};
pub use cost_of::{CostOfAnswer, RUN_COSTS_MAX, RunCostsAnswer};
pub use doctor::DoctorSandboxMissing;
pub use doctor::{DoctorAbsence, DoctorAnswer, DoctorCore, DoctorFault, DoctorInstall, DoctorItem};
pub use doctor::{DoctorCoverage, DoctorCustody, DoctorCustodyLifetime, DoctorCustodyStore};
pub use doctor::{DoctorGuarantee, DoctorGuaranteeAxis, DoctorSandbox, DoctorSandboxArm};
pub use doctor::{DoctorNeed, DoctorState, DoctorTier, DoctorVerdict, DoctorVersion};
pub use doctor::{DoctorNewest, DoctorPack, DoctorUnread, DoctorUpstream};
pub use document::{Coverage, DocumentAnswer, DocumentBody, DocumentState, HeldDocument};
pub use document_bytes::{BYTES_WINDOW_MAX, BytesAnswer, ExportAnswer};
pub use document_versions::{DocumentVersion, VERSIONS_MAX, VersionSource, VersionsAnswer};
pub use endpoints::{ChosenSummary, EndpointSummary, EndpointsAnswer};
pub use evidence::{EvidenceAnswer, EvidenceItem, EvidenceKind, Picture};
pub use find::{FIND_MAX, FIND_WALK_MAX, FindAnswer, Walked};
pub use git_status::{Drift, GitStatusAnswer};
pub use github::{GithubLoginAnswer, GithubReading};
pub use harnesses::{HarnessLine, HarnessesAnswer};
pub use history::{HistoryAnswer, HistoryRangeAnswer};
pub use hunks::{HunksAnswer, PatchLine, Withheld};
pub use identity::{IdentityAnswer, StatedIdentity};
pub use known_hosts::{KnownFace, KnownHost, KnownHostsAnswer};
pub use listing::{Entry, EntryKind, ListingAnswer};
pub use mcp_health::{McpHealthAnswer, McpServerHealth, McpState, McpToolLine};
pub use metrics::MetricsAnswer;
pub use model_facts::ModelFactsSummary;
pub use prefix::{ContentAnswer, PrefixAnswer, PrefixSegment, PrefixSlot, PrefixSource};
pub use preview::PreviewAnswer;
pub use proposals::{OfferedCard, OpenProposalsAnswer, ProposalCard, ProposalsAnswer};
pub use range::RangeAnswer;
pub use release::{ReleaseAnswer, ReleaseLine};
pub use rounds::{
Call, Closing, FrozenNames, Note, Opening, Outcome, Output, RoundsAnswer, Timing, Turn, Used,
};
pub use sessions::{SESSIONS_MAX, SessionLine, SessionStart, SessionsAnswer};
pub use skills::{SkillLine, SkillShelf, SkillsAnswer};
pub use toolkits::{Standing, ToolkitLine, ToolkitsAnswer};
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ChangesAnswer {
pub base: GitOid,
pub head: Option<GitOid>,
pub files: Vec<FileChange>,
}
pub const HISTORY_MAX: u32 = 500;
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct RunSummary {
pub run: RunId,
pub who: String,
pub frozen: bool,
pub last_seq: Seq,
pub last_kind: EventKind,
pub addr: Option<Address>,
pub started: Option<TimeMs>,
pub completion: Option<String>,
pub pr: Option<String>,
pub ask: Option<String>,
pub task: Option<String>,
pub goal: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct CityAnswer {
pub runs: Vec<RunSummary>,
pub active: u64,
pub frozen: u64,
pub buildings: Vec<BuildingProgress>,
pub pursuits: Vec<PursuitLine>,
pub halted: Vec<HaltScope>,
pub proved: Option<Seq>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ApprovalsAnswer {
pub items: Vec<ApprovalItem>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub enum Answer {
History(Box<HistoryAnswer>),
HistoryRange(Box<HistoryRangeAnswer>),
Sessions(SessionsAnswer),
Changes(ChangesAnswer),
Commit(Box<CommitAnswer>),
City(CityAnswer),
Run(Option<RunSummary>),
Approvals(ApprovalsAnswer),
Cost(Box<CostAnswer>),
Endpoints(EndpointsAnswer),
KnownHosts(KnownHostsAnswer),
Harnesses(HarnessesAnswer),
Building(Box<BuildingAnswer>),
Inbox(InboxAnswer),
Discards(DiscardAnswer),
Registry(RegistryAnswer),
Archive(ArchiveAnswer),
Metrics(Box<MetricsAnswer>),
Governance(GovernanceAnswer),
Hunks(Box<HunksAnswer>),
Rounds(Box<RoundsAnswer>),
Evidence(EvidenceAnswer),
CostOf(CostOfAnswer),
RunCosts(RunCostsAnswer),
Listing(ListingAnswer),
Find(FindAnswer),
Document(Box<DocumentAnswer>),
Proposals(Box<ProposalsAnswer>),
OpenProposals(OpenProposalsAnswer),
Range(Box<RangeAnswer>),
Versions(Box<VersionsAnswer>),
Bytes(Box<BytesAnswer>),
Export(Box<ExportAnswer>),
Preview(Box<PreviewAnswer>),
Reply(Box<documents::Laid>),
Commits(CommitsAnswer),
Doctor(Box<DoctorAnswer>),
Upstream(Box<DoctorUpstream>),
Prefix(Box<PrefixAnswer>),
Content(Box<ContentAnswer>),
Skills(Box<SkillsAnswer>),
GitStatus(Box<GitStatusAnswer>),
McpHealth(Box<McpHealthAnswer>),
Toolkits(Box<ToolkitsAnswer>),
Release(Box<ReleaseAnswer>),
Preferences(Box<PreferencesAnswer>),
Config(Box<ConfigAnswer>),
Identity(Box<IdentityAnswer>),
Automation(Box<AutomationAnswer>),
GithubLogin(GithubLoginAnswer),
Guide(GuideProgress),
Unavailable {
query: String,
},
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct GovernanceAnswer {
pub autonomy: Autonomy,
pub decided: Vec<Decision>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct Decision {
pub item: String,
pub verdict: Ruling,
pub cluster: ClusterKey,
pub at: TimeMs,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct InboxAnswer {
pub addr: Address,
pub waiting: Vec<SignalLine>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct SignalLine {
pub id: String,
pub kind: String,
pub from: String,
pub at: TimeMs,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DiscardAnswer {
pub rows: Vec<DiscardLine>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct DiscardLine {
pub path: String,
pub restoration: Option<Restoration>,
pub at: TimeMs,
pub restored: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct RegistryAnswer {
pub assets: Vec<RegistryLine>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct RegistryLine {
pub addr: Address,
pub kind: String,
pub subject: String,
pub at: TimeMs,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ArchiveAnswer {
pub needle: String,
pub hits: Vec<ArchiveHit>,
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
pub struct ArchiveHit {
pub building: Address,
pub kind: String,
pub day: u64,
pub subject: String,
}