1use kernel::{
16 Address, ApprovalItem, Autonomy, ClusterKey, FileChange, GitOid, Restoration, Ruling, Seq,
17 TimeMs,
18};
19use serde::{Deserialize, Serialize};
20
21use crate::command::HaltScope;
22use crate::guide::GuideProgress;
23use crate::preference::PreferencesAnswer;
24
25mod agents;
26mod automation;
27mod building;
28mod commits;
29mod config;
30mod cost;
31mod cost_of;
32mod devices;
33mod doctor;
34mod document;
35mod document_bytes;
36mod document_versions;
37mod endpoints;
38mod evidence;
39mod find;
40mod git_status;
41mod github;
42mod history;
43mod hunks;
44mod identity;
45mod known_hosts;
46mod listing;
47mod mcp_health;
48mod metrics;
49mod model_facts;
50mod model_figures;
51mod note;
52mod prefix;
53mod preview;
54mod proposals;
55mod range;
56mod release;
57mod rounds;
58mod run_summary;
59mod scanning;
60mod sessions;
61mod skills;
62mod thinking;
63mod toolkits;
64mod usage;
65
66pub use agents::{
67 AgentCatalogAnswer, AgentLine, AgentOffer, AgentSource, AuthMethod, CatalogSnapshot, LoginKind,
68 LoginState, PinState,
69};
70pub use automation::{AutomationAnswer, Cadence, ScheduledJob, WatchedSource};
71pub use building::{ArchiveLine, BlockedLine, BuildingAnswer, BuildingDoc};
72pub use building::{BuildingProgress, PlanRow, PursuitLine};
73pub use commits::{CommitAnswer, CommitAt, CommitsAnswer};
74pub use config::{
75 ConfigAnswer, ConfigLayer, SecondDomain, SettledEffort, SettledSearch, SettledSecond,
76 SupplierAccounts, TuningDefaults,
77};
78pub use cost::{CostAnswer, Renewals, UnpricedCalls};
79pub use cost_of::{CostOfAnswer, RUN_COSTS_MAX, RunCostsAnswer};
80pub use devices::{DeviceId, DeviceLine, DevicesAnswer};
81pub use doctor::{DoctorAbsence, DoctorAnswer, DoctorCore, DoctorFault, DoctorInstall, DoctorItem};
82pub use doctor::{DoctorCoverage, DoctorCustody, DoctorCustodyLifetime, DoctorCustodyStore};
83pub use doctor::{DoctorGuarantee, DoctorGuaranteeAxis, DoctorSandbox, DoctorSandboxArm};
84pub use doctor::{DoctorNeed, DoctorState, DoctorTier, DoctorVerdict, DoctorVersion};
85pub use doctor::{DoctorNewest, DoctorPack, DoctorUnread, DoctorUpstream};
86pub use doctor::{DoctorSandboxMissing, SandboxArm};
87pub use document::{Coverage, DocumentAnswer, DocumentBody, DocumentState, HeldDocument};
88pub use document_bytes::{BYTES_WINDOW_MAX, BytesAnswer, ExportAnswer};
89pub use document_versions::{DocumentVersion, VERSIONS_MAX, VersionSource, VersionsAnswer};
90pub use endpoints::{AccountStatus, ChosenSummary, EndpointSummary, EndpointsAnswer, KeyState};
91pub use evidence::{EvidenceAnswer, EvidenceItem, EvidenceKind, Picture};
92pub use find::{FIND_MAX, FIND_WALK_MAX, FindAnswer, Walked};
93pub use git_status::{Drift, GitStatusAnswer};
94pub use github::{GithubLoginAnswer, GithubReading};
95pub use history::{HistoryAnswer, HistoryRangeAnswer};
96pub use hunks::{HunksAnswer, PatchLine, Withheld};
97pub use identity::{IdentityAnswer, StatedIdentity};
98pub use known_hosts::{KnownFace, KnownHost, KnownHostsAnswer};
99pub use listing::{Entry, EntryKind, ListingAnswer};
100pub use mcp_health::{McpHealthAnswer, McpServerHealth, McpState, McpToolLine};
101pub use metrics::MetricsAnswer;
102pub use model_facts::ModelFactsSummary;
103pub use model_figures::{
104 CeilingLine, FigureFrom, FiguresAsked, FiguresLine, ModelFiguresAnswer, WindowLine,
105};
106pub use note::{HandbackNote, Note, ReplyEnd, ReplyEnded, Speaker};
107pub use prefix::{ContentAnswer, PrefixAnswer, PrefixSegment, PrefixSlot, PrefixSource};
108pub use preview::PreviewAnswer;
109pub use proposals::{OfferedCard, OpenProposalsAnswer, ProposalCard, ProposalsAnswer};
110pub use range::RangeAnswer;
111pub use release::{InstallChannel, Registry, RegistryNewest, RegistryReading};
112pub use release::{ReleaseAnswer, ReleaseLine, UpdateHint};
113pub use rounds::{
114 Call, Closing, FrozenNames, Opening, Outcome, Output, RoundsAnswer, Timing, Turn, Used,
115};
116pub use run_summary::{RunSummary, Waiting};
117pub use scanning::{DoctorDrive, DoctorExclusion, DoctorScanning, DoctorUntold};
118pub use sessions::{SESSION_PREVIEW_MAX, SESSIONS_MAX, SessionLine, SessionStart, SessionsAnswer};
119pub use skills::{SkillLine, SkillShelf, SkillsAnswer};
120pub use thinking::{EffortWord, OfferSource, Switch, ThinkingOffer};
121pub use toolkits::{Standing, ToolkitLine, ToolkitsAnswer};
122pub use usage::VersionAuthor;
123pub use usage::{
124 DayCount, ExportFormat, HeldSkill, McpServerUsage, McpToolUsage, McpUsageAnswer, McpUse,
125};
126pub use usage::{ShellCalls, ShellsAnswer, UsageExportAnswer, UsageKind, UseOutcome};
127pub use usage::{SkillAudit, SkillUsageAnswer, SkillUsageLine, SkillUse, SkillVersion};
128
129#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
135#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
136pub struct ChangesAnswer {
137 pub base: GitOid,
138 pub head: Option<GitOid>,
140 pub files: Vec<FileChange>,
141}
142
143pub const HISTORY_MAX: u32 = 500;
148
149#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
150#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
151pub struct CityAnswer {
152 pub runs: Vec<RunSummary>,
155 pub active: u64,
156 pub frozen: u64,
157 pub buildings: Vec<BuildingProgress>,
159 pub pursuits: Vec<PursuitLine>,
161 pub halted: Vec<HaltScope>,
171 pub proved: Option<Seq>,
175}
176
177#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
186#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
187pub struct ApprovalsAnswer {
188 pub items: Vec<ApprovalItem>,
189}
190
191#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
199#[serde(rename_all = "snake_case")]
200#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
201pub enum Answer {
202 History(Box<HistoryAnswer>),
203 HistoryRange(Box<HistoryRangeAnswer>),
204 Sessions(SessionsAnswer),
205 Changes(ChangesAnswer),
206 Commit(Box<CommitAnswer>),
207 City(CityAnswer),
208 Run(Option<Box<RunSummary>>),
209 Approvals(ApprovalsAnswer),
210 Cost(Box<CostAnswer>),
211 Endpoints(EndpointsAnswer),
212 KnownHosts(KnownHostsAnswer),
213 AgentCatalog(Box<AgentCatalogAnswer>),
214 AgentSpec(Box<AgentOffer>),
216 Devices(Box<DevicesAnswer>),
217 Building(Box<BuildingAnswer>),
218 Inbox(InboxAnswer),
219 Discards(DiscardAnswer),
220 Registry(RegistryAnswer),
221 Archive(ArchiveAnswer),
222 Metrics(Box<MetricsAnswer>),
223 Governance(GovernanceAnswer),
224 Hunks(Box<HunksAnswer>),
225 Rounds(Box<RoundsAnswer>),
226 Evidence(EvidenceAnswer),
227 CostOf(CostOfAnswer),
228 RunCosts(RunCostsAnswer),
229 Listing(ListingAnswer),
230 Find(FindAnswer),
231 Document(Box<DocumentAnswer>),
232 Proposals(Box<ProposalsAnswer>),
233 OpenProposals(OpenProposalsAnswer),
234 Range(Box<RangeAnswer>),
235 Versions(Box<VersionsAnswer>),
236 Bytes(Box<BytesAnswer>),
237 Export(Box<ExportAnswer>),
238 Preview(Box<PreviewAnswer>),
239 Reply(Box<documents::Laid>),
242 Commits(CommitsAnswer),
243 Doctor(Box<DoctorAnswer>),
244 Upstream(Box<DoctorUpstream>),
245 Prefix(Box<PrefixAnswer>),
246 Content(Box<ContentAnswer>),
247 Skills(Box<SkillsAnswer>),
248 GitStatus(Box<GitStatusAnswer>),
249 McpHealth(Box<McpHealthAnswer>),
250 SkillUsage(Box<SkillUsageAnswer>),
251 McpUsage(Box<McpUsageAnswer>),
252 UsageExport(Box<UsageExportAnswer>),
253 Shells(Box<ShellsAnswer>),
254 Toolkits(Box<ToolkitsAnswer>),
255 Release(Box<ReleaseAnswer>),
256 Preferences(Box<PreferencesAnswer>),
257 Config(Box<ConfigAnswer>),
258 Identity(Box<IdentityAnswer>),
259 Automation(Box<AutomationAnswer>),
260 GithubLogin(GithubLoginAnswer),
261 Guide(GuideProgress),
262 Privacy(Box<crate::PrivacyAnswer>),
263 ModelFigures(ModelFiguresAnswer),
265 Unavailable {
269 query: String,
270 #[serde(default, skip_serializing_if = "Option::is_none")]
271 reason: Option<String>,
272 },
273}
274
275#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
283#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
284pub struct GovernanceAnswer {
285 pub autonomy: Autonomy,
286 pub decided: Vec<Decision>,
294}
295
296#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
298#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
299pub struct Decision {
300 pub item: String,
302 pub verdict: Ruling,
303 pub cluster: ClusterKey,
306 pub at: TimeMs,
307}
308
309#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
316#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
317pub struct InboxAnswer {
318 pub addr: Address,
319 pub waiting: Vec<SignalLine>,
320}
321
322#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
323#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
324pub struct SignalLine {
325 pub id: String,
326 pub kind: String,
327 pub from: String,
328 pub at: TimeMs,
329 #[serde(default)]
332 pub first_line: Option<String>,
333}
334
335#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
341#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
342pub struct DiscardAnswer {
343 pub rows: Vec<DiscardLine>,
344}
345
346#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
347#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
348pub struct DiscardLine {
349 pub path: String,
350 pub restoration: Option<Restoration>,
361 pub at: TimeMs,
362 pub restored: bool,
363}
364
365#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
367#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
368pub struct RegistryAnswer {
369 pub assets: Vec<RegistryLine>,
370}
371
372#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
373#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
374pub struct RegistryLine {
375 pub addr: Address,
376 pub kind: String,
377 pub subject: String,
378 pub at: TimeMs,
379}
380
381#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
385#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
386pub struct ArchiveAnswer {
387 pub needle: String,
388 pub hits: Vec<ArchiveHit>,
389}
390
391#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
392#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
393pub struct ArchiveHit {
394 pub building: Address,
395 pub kind: String,
396 pub day: u64,
397 pub subject: String,
398}