1use kernel::{
17 Address, ApprovalItem, Autonomy, ClusterKey, FileChange, GitOid, Restoration, Ruling, Seq,
18 TimeMs,
19};
20use serde::{Deserialize, Serialize};
21
22use crate::command::HaltScope;
23use crate::guide::GuideProgress;
24use crate::preference::PreferencesAnswer;
25
26mod agents;
27mod automation;
28mod building;
29mod commits;
30mod config;
31mod cost;
32mod cost_of;
33mod devices;
34mod doctor;
35mod document;
36mod document_bytes;
37mod document_versions;
38mod endpoints;
39mod evidence;
40mod find;
41mod git_status;
42mod github;
43mod history;
44mod hunks;
45mod identity;
46mod known_hosts;
47mod listing;
48mod mcp_health;
49mod metrics;
50mod model_facts;
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, 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 note::{HandbackNote, Note, ReplyEnd, ReplyEnded, Speaker};
104pub use prefix::{ContentAnswer, PrefixAnswer, PrefixSegment, PrefixSlot, PrefixSource};
105pub use preview::PreviewAnswer;
106pub use proposals::{OfferedCard, OpenProposalsAnswer, ProposalCard, ProposalsAnswer};
107pub use range::RangeAnswer;
108pub use release::{InstallChannel, Registry, RegistryNewest, RegistryReading};
109pub use release::{ReleaseAnswer, ReleaseLine, UpdateHint};
110pub use rounds::{
111 Call, Closing, FrozenNames, Opening, Outcome, Output, RoundsAnswer, Timing, Turn, Used,
112};
113pub use run_summary::{RunSummary, Waiting};
114pub use scanning::{DoctorDrive, DoctorExclusion, DoctorScanning, DoctorUntold};
115pub use sessions::{SESSION_PREVIEW_MAX, SESSIONS_MAX, SessionLine, SessionStart, SessionsAnswer};
116pub use skills::{SkillLine, SkillShelf, SkillsAnswer};
117pub use thinking::{EffortWord, OfferSource, Switch, ThinkingOffer};
118pub use toolkits::{Standing, ToolkitLine, ToolkitsAnswer};
119pub use usage::VersionAuthor;
120pub use usage::{
121 DayCount, ExportFormat, HeldSkill, McpServerUsage, McpToolUsage, McpUsageAnswer, McpUse,
122};
123pub use usage::{ShellCalls, ShellsAnswer, UsageExportAnswer, UsageKind, UseOutcome};
124pub use usage::{SkillAudit, SkillUsageAnswer, SkillUsageLine, SkillUse, SkillVersion};
125
126#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
132#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
133pub struct ChangesAnswer {
134 pub base: GitOid,
135 pub head: Option<GitOid>,
137 pub files: Vec<FileChange>,
138}
139
140pub const HISTORY_MAX: u32 = 500;
145
146#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
147#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
148pub struct CityAnswer {
149 pub runs: Vec<RunSummary>,
152 pub active: u64,
153 pub frozen: u64,
154 pub buildings: Vec<BuildingProgress>,
156 pub pursuits: Vec<PursuitLine>,
158 pub halted: Vec<HaltScope>,
168 pub proved: Option<Seq>,
172}
173
174#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
183#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
184pub struct ApprovalsAnswer {
185 pub items: Vec<ApprovalItem>,
186}
187
188#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
196#[serde(rename_all = "snake_case")]
197#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
198pub enum Answer {
199 History(Box<HistoryAnswer>),
200 HistoryRange(Box<HistoryRangeAnswer>),
201 Sessions(SessionsAnswer),
202 Changes(ChangesAnswer),
203 Commit(Box<CommitAnswer>),
204 City(CityAnswer),
205 Run(Option<Box<RunSummary>>),
206 Approvals(ApprovalsAnswer),
207 Cost(Box<CostAnswer>),
208 Endpoints(EndpointsAnswer),
209 KnownHosts(KnownHostsAnswer),
210 AgentCatalog(Box<AgentCatalogAnswer>),
211 AgentSpec(Box<AgentOffer>),
213 Devices(Box<DevicesAnswer>),
214 Building(Box<BuildingAnswer>),
215 Inbox(InboxAnswer),
216 Discards(DiscardAnswer),
217 Registry(RegistryAnswer),
218 Archive(ArchiveAnswer),
219 Metrics(Box<MetricsAnswer>),
220 Governance(GovernanceAnswer),
221 Hunks(Box<HunksAnswer>),
222 Rounds(Box<RoundsAnswer>),
223 Evidence(EvidenceAnswer),
224 CostOf(CostOfAnswer),
225 RunCosts(RunCostsAnswer),
226 Listing(ListingAnswer),
227 Find(FindAnswer),
228 Document(Box<DocumentAnswer>),
229 Proposals(Box<ProposalsAnswer>),
230 OpenProposals(OpenProposalsAnswer),
231 Range(Box<RangeAnswer>),
232 Versions(Box<VersionsAnswer>),
233 Bytes(Box<BytesAnswer>),
234 Export(Box<ExportAnswer>),
235 Preview(Box<PreviewAnswer>),
236 Reply(Box<documents::Laid>),
239 Commits(CommitsAnswer),
240 Doctor(Box<DoctorAnswer>),
241 Upstream(Box<DoctorUpstream>),
242 Prefix(Box<PrefixAnswer>),
243 Content(Box<ContentAnswer>),
244 Skills(Box<SkillsAnswer>),
245 GitStatus(Box<GitStatusAnswer>),
246 McpHealth(Box<McpHealthAnswer>),
247 SkillUsage(Box<SkillUsageAnswer>),
248 McpUsage(Box<McpUsageAnswer>),
249 UsageExport(Box<UsageExportAnswer>),
250 Shells(Box<ShellsAnswer>),
251 Toolkits(Box<ToolkitsAnswer>),
252 Release(Box<ReleaseAnswer>),
253 Preferences(Box<PreferencesAnswer>),
254 Config(Box<ConfigAnswer>),
255 Identity(Box<IdentityAnswer>),
256 Automation(Box<AutomationAnswer>),
257 GithubLogin(GithubLoginAnswer),
258 Guide(GuideProgress),
259 Privacy(Box<crate::PrivacyAnswer>),
260 Unavailable {
264 query: String,
265 #[serde(default, skip_serializing_if = "Option::is_none")]
266 reason: Option<String>,
267 },
268}
269
270#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
278#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
279pub struct GovernanceAnswer {
280 pub autonomy: Autonomy,
281 pub decided: Vec<Decision>,
289}
290
291#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
293#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
294pub struct Decision {
295 pub item: String,
297 pub verdict: Ruling,
298 pub cluster: ClusterKey,
301 pub at: TimeMs,
302}
303
304#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
311#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
312pub struct InboxAnswer {
313 pub addr: Address,
314 pub waiting: Vec<SignalLine>,
315}
316
317#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
318#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
319pub struct SignalLine {
320 pub id: String,
321 pub kind: String,
322 pub from: String,
323 pub at: TimeMs,
324 #[serde(default)]
327 pub first_line: Option<String>,
328}
329
330#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
336#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
337pub struct DiscardAnswer {
338 pub rows: Vec<DiscardLine>,
339}
340
341#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
342#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
343pub struct DiscardLine {
344 pub path: String,
345 pub restoration: Option<Restoration>,
356 pub at: TimeMs,
357 pub restored: bool,
358}
359
360#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
362#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
363pub struct RegistryAnswer {
364 pub assets: Vec<RegistryLine>,
365}
366
367#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
368#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
369pub struct RegistryLine {
370 pub addr: Address,
371 pub kind: String,
372 pub subject: String,
373 pub at: TimeMs,
374}
375
376#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
380#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
381pub struct ArchiveAnswer {
382 pub needle: String,
383 pub hits: Vec<ArchiveHit>,
384}
385
386#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
387#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
388pub struct ArchiveHit {
389 pub building: Address,
390 pub kind: String,
391 pub day: u64,
392 pub subject: String,
393}