1use kernel::{
17 Address, ApprovalItem, Autonomy, ClusterKey, EventKind, FileChange, GitOid, Restoration,
18 Ruling, RunId, Seq, TimeMs,
19};
20use serde::{Deserialize, Serialize};
21
22use crate::command::HaltScope;
23use crate::guide::GuideProgress;
24use crate::preference::PreferencesAnswer;
25
26mod automation;
27mod building;
28mod commits;
29mod config;
30mod cost;
31mod cost_of;
32mod doctor;
33mod document;
34mod document_bytes;
35mod document_versions;
36mod endpoints;
37mod evidence;
38mod find;
39mod git_status;
40mod github;
41mod harnesses;
42mod history;
43mod hunks;
44mod identity;
45mod known_hosts;
46mod listing;
47mod mcp_health;
48mod metrics;
49mod model_facts;
50mod prefix;
51mod preview;
52mod proposals;
53mod range;
54mod release;
55mod rounds;
56mod sessions;
57mod skills;
58mod toolkits;
59
60pub use automation::{AutomationAnswer, Cadence, ScheduledJob, WatchedSource};
61pub use building::{ArchiveLine, BlockedLine, BuildingAnswer, BuildingDoc};
62pub use building::{BuildingProgress, PlanRow, PursuitLine};
63pub use commits::{CommitAnswer, CommitAt, CommitsAnswer};
64pub use config::{
65 ConfigAnswer, ConfigLayer, SecondDomain, SettledEffort, SettledSecond, TuningDefaults,
66};
67pub use cost::{CostAnswer, UnpricedCalls};
68pub use cost_of::{CostOfAnswer, RUN_COSTS_MAX, RunCostsAnswer};
69pub use doctor::DoctorSandboxMissing;
70pub use doctor::{DoctorAbsence, DoctorAnswer, DoctorCore, DoctorFault, DoctorInstall, DoctorItem};
71pub use doctor::{DoctorCoverage, DoctorCustody, DoctorCustodyLifetime, DoctorCustodyStore};
72pub use doctor::{DoctorGuarantee, DoctorGuaranteeAxis, DoctorSandbox, DoctorSandboxArm};
73pub use doctor::{DoctorNeed, DoctorState, DoctorTier, DoctorVerdict, DoctorVersion};
74pub use doctor::{DoctorNewest, DoctorPack, DoctorUnread, DoctorUpstream};
75pub use document::{Coverage, DocumentAnswer, DocumentBody, DocumentState, HeldDocument};
76pub use document_bytes::{BYTES_WINDOW_MAX, BytesAnswer, ExportAnswer};
77pub use document_versions::{DocumentVersion, VERSIONS_MAX, VersionSource, VersionsAnswer};
78pub use endpoints::{ChosenSummary, EndpointSummary, EndpointsAnswer};
79pub use evidence::{EvidenceAnswer, EvidenceItem, EvidenceKind, Picture};
80pub use find::{FIND_MAX, FIND_WALK_MAX, FindAnswer, Walked};
81pub use git_status::{Drift, GitStatusAnswer};
82pub use github::{GithubLoginAnswer, GithubReading};
83pub use harnesses::{HarnessLine, HarnessesAnswer};
84pub use history::{HistoryAnswer, HistoryRangeAnswer};
85pub use hunks::{HunksAnswer, PatchLine, Withheld};
86pub use identity::{IdentityAnswer, StatedIdentity};
87pub use known_hosts::{KnownFace, KnownHost, KnownHostsAnswer};
88pub use listing::{Entry, EntryKind, ListingAnswer};
89pub use mcp_health::{McpHealthAnswer, McpServerHealth, McpState, McpToolLine};
90pub use metrics::MetricsAnswer;
91pub use model_facts::ModelFactsSummary;
92pub use prefix::{ContentAnswer, PrefixAnswer, PrefixSegment, PrefixSlot, PrefixSource};
93pub use preview::PreviewAnswer;
94pub use proposals::{OfferedCard, OpenProposalsAnswer, ProposalCard, ProposalsAnswer};
95pub use range::RangeAnswer;
96pub use release::{ReleaseAnswer, ReleaseLine};
97pub use rounds::{
98 Call, Closing, FrozenNames, Note, Opening, Outcome, Output, RoundsAnswer, Timing, Turn, Used,
99};
100pub use sessions::{SESSIONS_MAX, SessionLine, SessionStart, SessionsAnswer};
101pub use skills::{SkillLine, SkillShelf, SkillsAnswer};
102pub use toolkits::{Standing, ToolkitLine, ToolkitsAnswer};
103
104#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
110#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
111pub struct ChangesAnswer {
112 pub base: GitOid,
113 pub head: Option<GitOid>,
115 pub files: Vec<FileChange>,
116}
117
118pub const HISTORY_MAX: u32 = 500;
123
124#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
128#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
129pub struct RunSummary {
130 pub run: RunId,
131 pub who: String,
132 pub frozen: bool,
133 pub last_seq: Seq,
134 pub last_kind: EventKind,
135 pub addr: Option<Address>,
139 pub started: Option<TimeMs>,
141 pub completion: Option<String>,
144 pub pr: Option<String>,
147 pub ask: Option<String>,
150 pub task: Option<String>,
153 pub goal: Option<String>,
155}
156
157#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
158#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
159pub struct CityAnswer {
160 pub runs: Vec<RunSummary>,
163 pub active: u64,
164 pub frozen: u64,
165 pub buildings: Vec<BuildingProgress>,
167 pub pursuits: Vec<PursuitLine>,
169 pub halted: Vec<HaltScope>,
179 pub proved: Option<Seq>,
183}
184
185#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
194#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
195pub struct ApprovalsAnswer {
196 pub items: Vec<ApprovalItem>,
197}
198
199#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
207#[serde(rename_all = "snake_case")]
208#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
209pub enum Answer {
210 History(Box<HistoryAnswer>),
211 HistoryRange(Box<HistoryRangeAnswer>),
212 Sessions(SessionsAnswer),
213 Changes(ChangesAnswer),
214 Commit(Box<CommitAnswer>),
215 City(CityAnswer),
216 Run(Option<RunSummary>),
217 Approvals(ApprovalsAnswer),
218 Cost(Box<CostAnswer>),
219 Endpoints(EndpointsAnswer),
220 KnownHosts(KnownHostsAnswer),
221 Harnesses(HarnessesAnswer),
222 Building(Box<BuildingAnswer>),
223 Inbox(InboxAnswer),
224 Discards(DiscardAnswer),
225 Registry(RegistryAnswer),
226 Archive(ArchiveAnswer),
227 Metrics(Box<MetricsAnswer>),
228 Governance(GovernanceAnswer),
229 Hunks(Box<HunksAnswer>),
230 Rounds(Box<RoundsAnswer>),
231 Evidence(EvidenceAnswer),
232 CostOf(CostOfAnswer),
233 RunCosts(RunCostsAnswer),
234 Listing(ListingAnswer),
235 Find(FindAnswer),
236 Document(Box<DocumentAnswer>),
237 Proposals(Box<ProposalsAnswer>),
238 OpenProposals(OpenProposalsAnswer),
239 Range(Box<RangeAnswer>),
240 Versions(Box<VersionsAnswer>),
241 Bytes(Box<BytesAnswer>),
242 Export(Box<ExportAnswer>),
243 Preview(Box<PreviewAnswer>),
244 Reply(Box<documents::Laid>),
247 Commits(CommitsAnswer),
248 Doctor(Box<DoctorAnswer>),
249 Upstream(Box<DoctorUpstream>),
250 Prefix(Box<PrefixAnswer>),
251 Content(Box<ContentAnswer>),
252 Skills(Box<SkillsAnswer>),
253 GitStatus(Box<GitStatusAnswer>),
254 McpHealth(Box<McpHealthAnswer>),
255 Toolkits(Box<ToolkitsAnswer>),
256 Release(Box<ReleaseAnswer>),
257 Preferences(Box<PreferencesAnswer>),
258 Config(Box<ConfigAnswer>),
259 Identity(Box<IdentityAnswer>),
260 Automation(Box<AutomationAnswer>),
261 GithubLogin(GithubLoginAnswer),
262 Guide(GuideProgress),
263 Unavailable {
264 query: String,
265 },
266}
267
268#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
276#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
277pub struct GovernanceAnswer {
278 pub autonomy: Autonomy,
279 pub decided: Vec<Decision>,
287}
288
289#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
291#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
292pub struct Decision {
293 pub item: String,
295 pub verdict: Ruling,
296 pub cluster: ClusterKey,
299 pub at: TimeMs,
300}
301
302#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
309#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
310pub struct InboxAnswer {
311 pub addr: Address,
312 pub waiting: Vec<SignalLine>,
313}
314
315#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
316#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
317pub struct SignalLine {
318 pub id: String,
319 pub kind: String,
320 pub from: String,
321 pub at: TimeMs,
322}
323
324#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
330#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
331pub struct DiscardAnswer {
332 pub rows: Vec<DiscardLine>,
333}
334
335#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
336#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
337pub struct DiscardLine {
338 pub path: String,
339 pub restoration: Option<Restoration>,
350 pub at: TimeMs,
351 pub restored: bool,
352}
353
354#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
356#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
357pub struct RegistryAnswer {
358 pub assets: Vec<RegistryLine>,
359}
360
361#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
362#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
363pub struct RegistryLine {
364 pub addr: Address,
365 pub kind: String,
366 pub subject: String,
367 pub at: TimeMs,
368}
369
370#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
374#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
375pub struct ArchiveAnswer {
376 pub needle: String,
377 pub hits: Vec<ArchiveHit>,
378}
379
380#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
381#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
382pub struct ArchiveHit {
383 pub building: Address,
384 pub kind: String,
385 pub day: u64,
386 pub subject: String,
387}