Skip to main content

adk_surface/
words.rs

1//! The words every surface shows (spec 3.3 §8).
2//!
3//! Every on-screen string the engine projects comes from this module, so the web home, the
4//! terminal, chat, the phone, the tray and voice say the same thing in the same way:
5//! plain words, sentence case, the outcome named in the heading and the verb on the button,
6//! "your agents", and no internal identifiers (§8). Renderers may add technical detail on the
7//! terminal and developer panels, never in place of these words.
8//!
9//! | Concept (§8.1) | Constant |
10//! |---|---|
11//! | An agent doing work | [`WORKING`] |
12//! | An agent stopped on a decision | [`WAITING_FOR_YOU`] |
13//! | An agent idle until a wake | [`asleep_until`] |
14//! | An agent finished | [`DONE`], [`FAILED`] |
15//! | The list of pending decisions | [`DECISIONS`] |
16//! | A decision answered elsewhere | [`DECIDED`], [`said`] |
17//! | A question from the kernel | [`QUESTION`], [`IS_THAT_RIGHT`] |
18//! | Something an agent offers to do | [`SUGGESTION`], [`DO_IT`], [`NOT_NOW`] |
19//! | The overnight summary | [`WHILE_YOU_WERE_AWAY`] |
20//! | The record of actions | [`WHAT_YOUR_AGENTS_DID`], [`EVERY_ACTION_ON_RECORD`] |
21//! | Memory | [`WHAT_YOUR_AGENTS_REMEMBER`], [`YOU_SAID_THIS`], [`A_GUESS`] |
22//! | How much agents act alone | [`JUST_LOOK`], [`SUGGEST`], [`ASK_FIRST`], [`GO_AHEAD`] |
23//! | Things allowed without asking | [`ALLOWED_WITHOUT_ASKING`], [`EXTEND`], [`STOP_ALLOWING`] |
24//! | No proactive work, no notifications | [`QUIET_TIME`] |
25//! | The spending limit | [`DAILY_SPENDING_LIMIT`] |
26//! | Separate parts of a life | [`AREAS`] |
27//! | Phones and apps allowed to decide | [`WHERE_YOU_CAN_SAY_YES_FROM`], [`ADD_A_PHONE_OR_APP`] |
28//!
29//! # Example
30//!
31//! ```rust
32//! use adk_surface::words;
33//!
34//! assert_eq!(words::WAITING_FOR_YOU, "Waiting for you");
35//! assert_eq!(words::asleep_until("07:00"), "Asleep until 07:00");
36//! assert_eq!(words::ALLOW_ONCE, "Allow once");
37//! ```
38
39// ---------------------------------------------------------------------------
40// §8.1 Terms
41// ---------------------------------------------------------------------------
42
43/// An agent doing work (`RunState::Running`).
44pub const WORKING: &str = "Working";
45/// An agent stopped on a decision, and a decision waiting for an answer.
46pub const WAITING_FOR_YOU: &str = "Waiting for you";
47/// A held call waiting on an answer the person cannot give from here: it was routed to
48/// other approvers, or to no one.
49pub const WAITING_FOR_AN_ANSWER: &str = "Waiting for an answer";
50/// An agent idle with no wake time to show, such as one a stop parked.
51pub const ASLEEP: &str = "Asleep";
52/// An agent finished (`Completed`).
53pub const DONE: &str = "Done";
54/// An agent finished with an error (`Failed`).
55pub const FAILED: &str = "Failed";
56/// The list of pending decisions; always shown with a count badge.
57pub const DECISIONS: &str = "Decisions";
58/// A decision answered, here or elsewhere.
59pub const DECIDED: &str = "Decided";
60/// A question from the kernel's `/proc` observations.
61pub const QUESTION: &str = "Question";
62/// What a question asks.
63pub const IS_THAT_RIGHT: &str = "Is that right?";
64/// Something an agent offers to do.
65pub const SUGGESTION: &str = "Suggestion";
66/// Accepts a suggestion.
67pub const DO_IT: &str = "Do it";
68/// Declines a suggestion for now.
69pub const NOT_NOW: &str = "Not now";
70/// The overnight summary.
71pub const WHILE_YOU_WERE_AWAY: &str = "While you were away";
72/// The record of actions.
73pub const WHAT_YOUR_AGENTS_DID: &str = "What your agents did";
74/// The record check, when it passes.
75pub const EVERY_ACTION_ON_RECORD: &str = "Every action is on record";
76/// Memory.
77pub const WHAT_YOUR_AGENTS_REMEMBER: &str = "What your agents remember";
78/// A known fact.
79pub const YOU_SAID_THIS: &str = "You said this";
80/// An assumed fact.
81pub const A_GUESS: &str = "A guess";
82/// `HarnessMode::ReadOnly`.
83pub const JUST_LOOK: &str = "Just look";
84/// `HarnessMode::Plan`.
85pub const SUGGEST: &str = "Suggest";
86/// `HarnessMode::Ask`.
87pub const ASK_FIRST: &str = "Ask first";
88/// `HarnessMode::Auto`.
89pub const GO_AHEAD: &str = "Go ahead";
90/// Standing rules.
91pub const ALLOWED_WITHOUT_ASKING: &str = "Allowed without asking";
92/// Extends a standing rule.
93pub const EXTEND: &str = "Extend";
94/// Ends a standing rule.
95pub const STOP_ALLOWING: &str = "Stop allowing";
96/// Quiet hours.
97pub const QUIET_TIME: &str = "Quiet time";
98/// The run budget and spend ledger's daily cap.
99pub const DAILY_SPENDING_LIMIT: &str = "Daily spending limit";
100/// Partitions.
101pub const AREAS: &str = "Areas";
102/// Paired devices.
103pub const WHERE_YOU_CAN_SAY_YES_FROM: &str = "Where you can say yes from";
104/// Pairs a device.
105pub const ADD_A_PHONE_OR_APP: &str = "Add a phone or app";
106/// Who did something when no one agent did: the kernel's own work, such as a question it
107/// asks.
108pub const YOUR_AGENTS: &str = "Your agents";
109/// A suggestion in "While you were away" that names no one agent.
110pub const AGENTS_SUGGEST: &str = "Your agents suggest something. Nothing happens until you say so.";
111/// A question from the kernel in "While you were away", before its own words are known.
112pub const NOTICED_SOMETHING: &str = "Your agents noticed something. Is that right?";
113/// Everything resumed after a stop, in "While you were away".
114pub const ALL_AGENTS_RESUMED: &str = "All agents resumed.";
115/// When a suggestion with no wake of its own runs once allowed.
116pub const RIGHT_AWAY: &str = "right away";
117
118/// A suggestion the person added themselves (spec 3.3 §8.1 "Suggestion").
119pub const YOU_SUGGESTED_THIS: &str = "You suggested this.";
120
121/// Who suggests a piece of work on a suggestion's card (spec 3.3 §8.1 "Suggestion"): an
122/// agent by name, or `None` for the kernel's own work, which no one agent did.
123///
124/// # Example
125///
126/// ```rust
127/// use adk_surface::words;
128///
129/// assert_eq!(words::suggested_by(Some("Finance")), "Finance suggests this.");
130/// assert_eq!(words::suggested_by(None), "Your agents suggest this.");
131/// ```
132pub fn suggested_by(agent: Option<&str>) -> String {
133    match agent {
134        Some(agent) => format!("{agent} suggests this."),
135        None => format!("{YOUR_AGENTS} suggest this."),
136    }
137}
138
139/// When a suggestion runs once allowed: `when` is [`RIGHT_AWAY`], `"every 5 minutes"`,
140/// `"at 07:30"` and the like (spec 3.3 §8.1 "Suggestion").
141///
142/// # Example
143///
144/// ```rust
145/// assert_eq!(
146///     adk_surface::words::once_you_say_yes("every 5 minutes"),
147///     "Once you say yes, it runs every 5 minutes."
148/// );
149/// ```
150pub fn once_you_say_yes(when: &str) -> String {
151    format!("Once you say yes, it runs {when}.")
152}
153
154/// How many steps a suggestion's plan has.
155///
156/// # Example
157///
158/// ```rust
159/// assert_eq!(adk_surface::words::plan_of(3), "Its plan has 3 steps.");
160/// assert_eq!(adk_surface::words::plan_of(1), "Its plan has 1 step.");
161/// ```
162pub fn plan_of(steps: usize) -> String {
163    if steps == 1 {
164        "Its plan has 1 step.".to_string()
165    } else {
166        format!("Its plan has {steps} steps.")
167    }
168}
169
170/// The most a suggestion may spend, in micro-USD.
171///
172/// # Example
173///
174/// ```rust
175/// assert_eq!(adk_surface::words::may_spend(500_000), "It may spend up to $0.50.");
176/// ```
177pub fn may_spend(micro_usd: u64) -> String {
178    format!("It may spend up to {}.", dollars(micro_usd))
179}
180
181/// The heading of a driver mount a hosted definition asks for: what it lets agents use.
182///
183/// # Example
184///
185/// ```rust
186/// assert_eq!(adk_surface::words::start_driver("email"), "Start email for your agents");
187/// ```
188pub fn start_driver(id: &str) -> String {
189    format!("Start {id} for your agents")
190}
191
192/// What a driver mount runs, on its card.
193///
194/// # Example
195///
196/// ```rust
197/// assert_eq!(
198///     adk_surface::words::driver_starts("mcp-email"),
199///     "It runs mcp-email on the computer your agents run on."
200/// );
201/// ```
202pub fn driver_starts(command: &str) -> String {
203    format!("It runs {command} on the computer your agents run on.")
204}
205
206/// An agent asleep until a local time, `"Asleep until 07:00"`.
207///
208/// # Example
209///
210/// ```rust
211/// assert_eq!(adk_surface::words::asleep_until("07:00"), "Asleep until 07:00");
212/// ```
213pub fn asleep_until(hh_mm: &str) -> String {
214    format!("Asleep until {hh_mm}")
215}
216
217/// A turn that ended in an error, in the thread where the reply would have been:
218/// `"Claims Desk couldn't answer"`.
219///
220/// # Example
221///
222/// ```rust
223/// assert_eq!(adk_surface::words::couldnt_answer("Claims Desk"), "Claims Desk couldn't answer");
224/// ```
225pub fn couldnt_answer(agent: &str) -> String {
226    format!("{agent} couldn't answer")
227}
228
229/// How a mode reads as a status, `"Asks first"`: the third-person form the status line and
230/// a thread's header use for the §8.1 mode words.
231///
232/// # Example
233///
234/// ```rust
235/// use adk_surface::words;
236///
237/// assert_eq!(words::mode_status(words::ASK_FIRST), "Asks first");
238/// assert_eq!(words::mode_status(words::GO_AHEAD), "Goes ahead");
239/// ```
240pub fn mode_status(mode_word: &str) -> String {
241    match mode_word {
242        JUST_LOOK => "Just looks".to_string(),
243        SUGGEST => "Suggests".to_string(),
244        ASK_FIRST => "Asks first".to_string(),
245        GO_AHEAD => "Goes ahead".to_string(),
246        other => other.to_string(),
247    }
248}
249
250// ---------------------------------------------------------------------------
251// §8.2 Actions
252// ---------------------------------------------------------------------------
253
254/// Runs this one call.
255pub const ALLOW_ONCE: &str = "Allow once";
256/// Allows from now on, for this person.
257pub const ALWAYS_ALLOW_FOR_THIS_PERSON: &str = "Always allow for this person";
258/// Allows from now on, for this folder.
259pub const ALWAYS_ALLOW_FOR_THIS_FOLDER: &str = "Always allow for this folder";
260/// Allows from now on, for this command.
261pub const ALWAYS_ALLOW_FOR_THIS_COMMAND: &str = "Always allow for this command";
262/// Allows from now on, for this site.
263pub const ALWAYS_ALLOW_FOR_THIS_SITE: &str = "Always allow for this site";
264
265/// "Always allow …" completed with what the standing rule covers, so the button never
266/// promises less than the rule allows (spec 3.3 §8.2, spec 3.1 §7.5): `label` is one of the
267/// `ALWAYS_ALLOW_FOR_THIS_*` words, `covers` what the rule matches, then whether it holds in
268/// every session or this one, and — for commands that run project scripts — that it allows
269/// whatever those scripts do.
270///
271/// # Example
272///
273/// ```rust
274/// use adk_surface::words;
275///
276/// assert_eq!(
277///     words::always_allow_covering(words::ALWAYS_ALLOW_FOR_THIS_COMMAND, "git push …", true, false),
278///     "Always allow for this command (git push …, every session)"
279/// );
280/// assert_eq!(
281///     words::always_allow_covering(words::ALWAYS_ALLOW_FOR_THIS_COMMAND, "npm run …", true, true),
282///     "Always allow for this command (npm run …, every session; it runs project scripts, so it allows whatever they do)"
283/// );
284/// ```
285pub fn always_allow_covering(
286    label: &str,
287    covers: &str,
288    every_session: bool,
289    runs_scripts: bool,
290) -> String {
291    let scope = if every_session { "every session" } else { "this session" };
292    let scripts =
293        if runs_scripts { "; it runs project scripts, so it allows whatever they do" } else { "" };
294    format!("{label} ({covers}, {scope}{scripts})")
295}
296/// Changes the arguments, then allows.
297pub const EDIT: &str = "Edit";
298/// Sends the person's answer to what an MCP server asks (an elicitation form).
299pub const ANSWER: &str = "Answer";
300/// Over an elicitation address whose host has look-alike characters.
301pub const LOOK_ALIKE_ADDRESS: &str =
302    "This address uses look-alike characters. Check the host letter by letter before you open it.";
303/// Over an elicitation address that hides a name before an `@`.
304pub const HIDDEN_HOST_ADDRESS: &str =
305    "This address puts a name before an @, so the real host is the part after it.";
306/// Over an elicitation address that is not encrypted.
307pub const UNENCRYPTED_ADDRESS: &str = "This address is not encrypted (http).";
308/// Refuses.
309pub const DENY: &str = "Deny";
310/// Approves a high-risk call.
311pub const CONFIRM_ITS_YOU_AND_APPROVE: &str = "Confirm it's you and approve";
312/// Types a secret yourself.
313pub const TAKE_OVER: &str = "Take over";
314/// Ends a take-over.
315pub const TAKE_OVER_DONE: &str = "Done";
316/// Stops every agent.
317pub const STOP_ALL: &str = "Stop all";
318/// Restarts after stopping; web home only.
319pub const RESUME_ALL: &str = "Resume all";
320/// Undoes an overnight memory change.
321pub const UNDO: &str = "Undo";
322/// Confirms a guess.
323pub const THATS_RIGHT: &str = "That's right";
324/// Corrects a guess.
325pub const FIX_IT: &str = "Fix it";
326/// Forgets a guess.
327pub const FORGET_IT: &str = "Forget it";
328/// Where a surface that may not decide sends the person (spec 3.3 §5.3, §7.2).
329pub const OPEN_IN_HOME: &str = "Open in home";
330
331// ---------------------------------------------------------------------------
332// §7.1 The parts of a decision
333// ---------------------------------------------------------------------------
334
335/// A routine call.
336pub const LOW_RISK: &str = "Low risk";
337/// A call that needs a look.
338pub const MEDIUM_RISK: &str = "Medium risk";
339/// A call that needs a careful look.
340pub const HIGH_RISK: &str = "High risk";
341/// A message that, once sent, stays sent.
342pub const CANT_BE_UNSENT: &str = "Can't be unsent";
343/// Anything else that cannot be taken back.
344pub const CANT_BE_UNDONE: &str = "Can't be undone";
345/// A timeline step: the decision waited while quiet time held notifications back.
346pub const WAITED_THROUGH_QUIET_TIME: &str = "Waited through quiet time";
347/// What a screen says when it shows a decision another screen may answer first.
348pub const ANSWERED_ELSEWHERE_UPDATES: &str =
349    "If you answer somewhere else first, this screen updates.";
350/// Why a surface shows no approval for a high-risk or money call.
351pub const NEEDS_A_SCREEN: &str =
352    "This always needs you, on a screen. Voice, chat and standing permissions can't say yes to it.";
353/// Where a high-risk or money call is approved, on a screen that cannot approve it: the tray,
354/// or a terminal that is not on the kernel's own computer (spec 3.3 §7.2).
355pub const APPROVE_IN_THE_HOME: &str =
356    "Approve it in the home app, or in a terminal on the computer your agents run on.";
357
358/// How long a decision has waited, `"since 18:00"`.
359///
360/// # Example
361///
362/// ```rust
363/// assert_eq!(adk_surface::words::since("18:00"), "since 18:00");
364/// ```
365pub fn since(hh_mm: &str) -> String {
366    format!("since {hh_mm}")
367}
368
369/// The first timeline step, `"Asked at 18:00"`.
370///
371/// # Example
372///
373/// ```rust
374/// assert_eq!(adk_surface::words::asked_at("18:00"), "Asked at 18:00");
375/// ```
376pub fn asked_at(hh_mm: &str) -> String {
377    format!("Asked at {hh_mm}")
378}
379
380/// Where else a decision is shown, `"Also on your phone and in Telegram"`; `None` when it is
381/// shown nowhere else.
382///
383/// # Example
384///
385/// ```rust
386/// use adk_surface::words;
387///
388/// let places = ["on your phone".to_string(), "in Telegram".to_string()];
389/// assert_eq!(words::also_shown(&places).unwrap(), "Also on your phone and in Telegram");
390/// assert_eq!(words::also_shown(&[]), None);
391/// ```
392pub fn also_shown(places: &[String]) -> Option<String> {
393    match places {
394        [] => None,
395        [one] => Some(format!("Also {one}")),
396        [rest @ .., last] => Some(format!("Also {} and {last}", rest.join(", "))),
397    }
398}
399
400/// The answer a decision got, as [`said`] words it.
401#[derive(Debug, Clone, Copy, PartialEq, Eq)]
402pub enum SaidWhat {
403    /// Allowed the call.
404    Yes,
405    /// Refused the call.
406    No,
407    /// Allowed the call with changed arguments.
408    Edited,
409    /// Answered with a message instead of running the call.
410    Replied,
411}
412
413/// Who answered a decision, how and when, `"You said yes in Telegram at 07:31"`.
414///
415/// `who` is `None` for the person looking, `"You"`; `via` is a phrase such as
416/// `"in Telegram"` or `"on your phone"`.
417///
418/// # Example
419///
420/// ```rust
421/// use adk_surface::words::{SaidWhat, said};
422///
423/// assert_eq!(said(None, SaidWhat::Yes, Some("in Telegram"), "07:31"), "You said yes in Telegram at 07:31");
424/// assert_eq!(said(Some("ana"), SaidWhat::No, None, "07:31"), "ana said no at 07:31");
425/// ```
426pub fn said(who: Option<&str>, what: SaidWhat, via: Option<&str>, hh_mm: &str) -> String {
427    let who = who.unwrap_or("You");
428    let what = match what {
429        SaidWhat::Yes => "said yes",
430        SaidWhat::No => "said no",
431        SaidWhat::Edited => "said yes with changes",
432        SaidWhat::Replied => "answered instead",
433    };
434    match via {
435        Some(via) => format!("{who} {what} {via} at {hh_mm}"),
436        None => format!("{who} {what} at {hh_mm}"),
437    }
438}
439
440/// A decision that ended without an answer from a person: cancelled, or expired under a
441/// policy that set an expiry (spec 3.3 §7.3: decisions routed by a surface never expire).
442pub const ENDED_WITHOUT_AN_ANSWER: &str = "Ended without an answer";
443
444// ---------------------------------------------------------------------------
445// Where an answer came from (spec 3.3 §11)
446// ---------------------------------------------------------------------------
447
448/// The web home, as a place: `"in the home app"`.
449pub const IN_THE_HOME_APP: &str = "in the home app";
450/// The phone, as a place: `"on your phone"`.
451pub const ON_YOUR_PHONE: &str = "on your phone";
452/// The terminal, as a place: `"in the terminal"`.
453pub const IN_THE_TERMINAL: &str = "in the terminal";
454/// The desktop tray, as a place: `"from the tray"`.
455pub const FROM_THE_TRAY: &str = "from the tray";
456/// Voice, as a way of answering: `"by voice"`.
457pub const BY_VOICE: &str = "by voice";
458
459/// A chat channel, as a place: `"in Telegram"`.
460///
461/// # Example
462///
463/// ```rust
464/// assert_eq!(adk_surface::words::in_channel("Telegram"), "in Telegram");
465/// ```
466pub fn in_channel(channel: &str) -> String {
467    format!("in {channel}")
468}
469
470// ---------------------------------------------------------------------------
471// The status line (spec 3.3 §5.1, §6)
472// ---------------------------------------------------------------------------
473
474/// Every agent is stopped until the person resumes them from the home.
475pub const ALL_AGENTS_STOPPED: &str = "All agents stopped";
476/// What chat answers after "stop all" (spec 3.3 §5.3).
477pub const ALL_AGENTS_STOPPED_RESUME_IN_HOME: &str =
478    "All agents stopped. Use Resume all in the home app.";
479
480/// Spend against the daily limit, `"$1.84 of $5.00 today"`.
481///
482/// # Example
483///
484/// ```rust
485/// assert_eq!(adk_surface::words::spent_of(1_840_000, 5_000_000), "$1.84 of $5.00 today");
486/// ```
487pub fn spent_of(spent_micro_usd: u64, limit_micro_usd: u64) -> String {
488    format!("{} of {} today", dollars(spent_micro_usd), dollars(limit_micro_usd))
489}
490
491/// Spend with no daily limit set, `"$0.62 today"`.
492///
493/// # Example
494///
495/// ```rust
496/// assert_eq!(adk_surface::words::spent_today(620_000), "$0.62 today");
497/// ```
498pub fn spent_today(spent_micro_usd: u64) -> String {
499    format!("{} today", dollars(spent_micro_usd))
500}
501
502/// Micro-USD as dollars and cents, `"$1.84"`, rounded to the nearest cent.
503///
504/// # Example
505///
506/// ```rust
507/// assert_eq!(adk_surface::words::dollars(1_845_000), "$1.85");
508/// assert_eq!(adk_surface::words::dollars(0), "$0.00");
509/// ```
510pub fn dollars(micro_usd: u64) -> String {
511    let cents = micro_usd.saturating_add(5_000) / 10_000;
512    format!("${}.{:02}", cents / 100, cents % 100)
513}
514
515/// Quiet time ahead, `"Quiet from 22:00"`.
516///
517/// # Example
518///
519/// ```rust
520/// assert_eq!(adk_surface::words::quiet_from("22:00"), "Quiet from 22:00");
521/// ```
522pub fn quiet_from(hh_mm: &str) -> String {
523    format!("Quiet from {hh_mm}")
524}
525
526/// Quiet time now, `"Quiet until 07:00"`.
527///
528/// # Example
529///
530/// ```rust
531/// assert_eq!(adk_surface::words::quiet_until("07:00"), "Quiet until 07:00");
532/// ```
533pub fn quiet_until(hh_mm: &str) -> String {
534    format!("Quiet until {hh_mm}")
535}
536
537/// Input typed while a decision is open waits for it (spec 3.3 §5.2, §7.4 rule 2).
538pub const SENT_AFTER_THIS_CARD_IS_ANSWERED: &str = "Sent after this card is answered";
539/// Input typed while a turn runs, or behind earlier queued input, with no decision open: it
540/// is the session's next message (spec 3.3 §5.2, S-I4).
541pub const SENT_WHEN_YOUR_AGENT_IS_FREE: &str = "Sent when your agent is free";
542
543/// A spoken "allow once" inside its cancel window, `"Allowing once in 5 seconds"`
544/// (spec 3.3 §5.6).
545///
546/// # Example
547///
548/// ```rust
549/// assert_eq!(adk_surface::words::allowing_in(5), "Allowing once in 5 seconds");
550/// ```
551pub fn allowing_in(seconds: u64) -> String {
552    match seconds {
553        1 => "Allowing once in 1 second".to_string(),
554        n => format!("Allowing once in {n} seconds"),
555    }
556}
557
558// ---------------------------------------------------------------------------
559// The briefing (spec 3.3 §5.1 Today)
560// ---------------------------------------------------------------------------
561
562/// Since when the briefing counts, `"Since 22:04"`.
563///
564/// # Example
565///
566/// ```rust
567/// assert_eq!(adk_surface::words::briefing_since("22:04"), "Since 22:04");
568/// ```
569pub fn briefing_since(hh_mm: &str) -> String {
570    format!("Since {hh_mm}")
571}
572
573/// The briefing pill of a decision a person made.
574pub const YOU_DECIDED: &str = "You decided";
575
576/// Words a briefing line uses for one ledger row; `agent` is the agent's display name.
577///
578/// The ledger is content-free (spec 3.2 §7.10), so these lines say what kind of thing
579/// happened and link to its record; they never guess at content.
580///
581/// # Example
582///
583/// ```rust
584/// use adk_surface::words;
585///
586/// assert_eq!(words::briefing_sentence("held", "Finance"), "Finance asked you first.");
587/// assert_eq!(words::briefing_sentence("approval", "Finance"), "You allowed Finance to go ahead.");
588/// ```
589pub fn briefing_sentence(kind: &str, agent: &str) -> String {
590    match kind {
591        "intent" => format!("{agent} started on your message."),
592        "tool_call" => format!("{agent} used a tool."),
593        "approval" => format!("You allowed {agent} to go ahead."),
594        "rejection" => format!("You said no to {agent}."),
595        "denial" => format!("{agent} was not allowed to do something."),
596        "held" => format!("{agent} asked you first."),
597        "decided" => format!("A decision for {agent} was made."),
598        "rule_hit" => format!("{agent} went ahead, as you allowed without asking."),
599        "observation" => IS_THAT_RIGHT.to_string(),
600        "wake" => format!("{agent} woke up."),
601        "proposal" => {
602            format!("{agent} suggests something. Nothing happens until you say so.")
603        }
604        "spend" => format!("{agent} spent money on a model."),
605        "turn" => format!("{agent} finished."),
606        "loop_guard" => format!("{agent} stopped because it was repeating itself."),
607        "governance" => ALL_AGENTS_STOPPED.to_string(),
608        _ => format!("{agent} did something."),
609    }
610}
611
612// The phone (spec 3.3 §5.4, §8.2).
613
614/// The only words a wake-up shows (spec 3.3 §5.4, S-I5): the notification's title.
615pub const A_DECISION_IS_WAITING: &str = "A decision is waiting";
616/// The notification's body.
617pub const OPEN_THE_APP_TO_SEE_IT: &str = "Open the app to see it";
618/// A phone's name in "Where you can say yes from".
619pub const YOUR_PHONE: &str = "Your phone";
620/// What a phone with a passkey asks before a high-risk approval, after "Your phone · ".
621pub const ASKS_FOR_FACE_OR_FINGERPRINT: &str = "asks for your face or fingerprint";
622/// What a high-risk card needs on the phone, after its reversibility: "Can't be undone · needs
623/// your face or fingerprint".
624pub const NEEDS_FACE_OR_FINGERPRINT: &str = "needs your face or fingerprint";
625/// How an "allow once" answer reads on a decided card: "You said yes in Telegram at 07:31 ·
626/// done once".
627pub const DONE_ONCE: &str = "done once";
628/// What the decide screen says after the agent's name.
629pub const WANTS_TO_RUN_THIS_COMMAND: &str = "wants to run this command.";
630/// Sets up the phone's or the computer's passkey.
631pub const USE_YOUR_FACE_OR_FINGERPRINT: &str = "Use your face or fingerprint";
632/// Sets up the computer's passkey for the web home.
633pub const USE_YOUR_FACE_OR_FINGERPRINT_ON_THIS_COMPUTER: &str =
634    "Use your face or fingerprint on this computer";
635/// Asks the phone for permission to wake it.
636pub const ALLOW_NOTIFICATIONS: &str = "Allow notifications";
637/// What Safari on iOS shows before the app is installed: notifications and the app's own
638/// storage need the Home Screen app.
639pub const ADD_TO_HOME_SCREEN_FIRST: &str = "Add to Home Screen first";
640/// Where a high-risk call goes when this phone cannot confirm it is you.
641pub const APPROVE_IT_IN_THE_HOME: &str = "Approve it in the home on your computer";
642
643/// What the decide screen says: "Code wants to run this command."
644///
645/// # Example
646///
647/// ```rust
648/// assert_eq!(adk_surface::words::wants_to_run("Code"), "Code wants to run this command.");
649/// ```
650pub fn wants_to_run(agent: &str) -> String {
651    format!("{agent} {WANTS_TO_RUN_THIS_COMMAND}")
652}
653
654// ---------------------------------------------------------------------------
655// Voice (spec 3.3 §5.6)
656// ---------------------------------------------------------------------------
657
658/// The voice view while the model waits for the person.
659pub const LISTENING: &str = "Listening";
660/// The voice view while the model speaks.
661pub const SPEAKING: &str = "Speaking";
662/// What to say to a prompted decision voice may allow once.
663pub const SAY_ALLOW_ONCE_OR_DENY: &str = "Say \"allow once\" or \"deny\".";
664/// What to say to a prompted decision voice cannot approve.
665pub const SAY_DENY_OR_DECIDE_ON_SCREEN: &str = "Say \"deny\", or decide on screen.";
666/// Where the voice view sends a decision voice cannot approve.
667pub const DECIDE_ON_SCREEN: &str = "Decide on screen";
668/// Cancels a spoken "allow once" inside its cancel window.
669pub const CANCEL: &str = "Cancel";
670/// Ends a voice conversation.
671pub const END: &str = "End";
672/// The voice view's card of the camera and the screen.
673pub const WHAT_IT_CAN_SEE: &str = "What it can see";
674/// What voice may decide, and what is kept of it.
675pub const VOICE_PRIVACY_NOTE: &str = "By voice you can say yes once to everyday things, and no \
676     to anything. Serious ones need a screen to approve. We keep a note of your answer, never \
677     the recording.";
678/// A spoken "allow once" cancelled inside its window.
679pub const SPOKEN_ANSWER_CANCELLED: &str = "Cancelled. It still waits for you.";
680/// Nothing was decided: the prompted decision changed while the person spoke.
681pub const CHANGED_WHILE_YOU_SPOKE: &str =
682    "Nothing was decided: the decision changed while you were speaking.";
683/// A spoken approval of a call voice cannot approve.
684pub const VOICE_CANT_APPROVE_THIS: &str = "Voice can't approve this one. Decide on screen.";
685/// A spoken "stop all" from someone who may not stop every agent.
686pub const STOPPING_NEEDS_THE_OPERATOR: &str =
687    "Stopping every agent needs the operator. Ask them, or stop from their home app.";
688
689/// The voice view's header, `"Talking with Chief of staff"`.
690///
691/// # Example
692///
693/// ```rust
694/// assert_eq!(adk_surface::words::talking_with("Chief of staff"), "Talking with Chief of staff");
695/// ```
696pub fn talking_with(agent: &str) -> String {
697    format!("Talking with {agent}")
698}
699
700/// What the person said, as transcribed, `"Heard \"allow once\""`.
701///
702/// # Example
703///
704/// ```rust
705/// assert_eq!(adk_surface::words::heard("allow once"), "Heard \"allow once\"");
706/// ```
707pub fn heard(text: &str) -> String {
708    format!("Heard \"{text}\"")
709}
710
711/// A prompted decision, `"Finance wants to send the October invoice to [CLIENT]."`.
712///
713/// # Example
714///
715/// ```rust
716/// assert_eq!(
717///     adk_surface::words::wants_to("Finance", "Send the October invoice to [CLIENT]"),
718///     "Finance wants to send the October invoice to [CLIENT]."
719/// );
720/// ```
721pub fn wants_to(agent: &str, heading: &str) -> String {
722    let mut chars = heading.chars();
723    let heading = match chars.next() {
724        Some(first) => first.to_lowercase().chain(chars).collect(),
725        None => String::new(),
726    };
727    format!("{agent} wants to {heading}.")
728}
729
730/// Why voice cannot approve a decision, `"\"Publish the release\" is high risk, so voice can't
731/// approve it."`; `money` for a call that spends money.
732///
733/// # Example
734///
735/// ```rust
736/// use adk_surface::words;
737///
738/// assert_eq!(
739///     words::voice_cant_approve("Publish the release", false),
740///     "\"Publish the release\" is high risk, so voice can't approve it."
741/// );
742/// assert_eq!(
743///     words::voice_cant_approve("Pay the invoice", true),
744///     "\"Pay the invoice\" spends money, so voice can't approve it."
745/// );
746/// ```
747pub fn voice_cant_approve(heading: &str, money: bool) -> String {
748    let why = if money { "spends money" } else { "is high risk" };
749    format!("\"{heading}\" {why}, so voice can't approve it.")
750}
751
752// ---------------------------------------------------------------------------
753// §5.7 Your agents, §8.1–§8.2 rows
754// ---------------------------------------------------------------------------
755
756/// Starts adding an agent.
757pub const NEW_AGENT: &str = "New agent";
758/// Ask an agent to suggest one.
759pub const DESCRIBE_IT: &str = "Describe it";
760/// Fill in the definition.
761pub const SET_IT_UP_YOURSELF: &str = "Set it up yourself";
762/// Starts a thread with the primary agent holding the request.
763pub const ASK_TO_SUGGEST_ONE: &str = "Ask ADK-Rust to suggest one";
764/// Approves a suggested agent.
765pub const ADD_THIS_AGENT: &str = "Add this agent";
766/// Approves a high-risk suggested agent after confirming presence.
767pub const CONFIRM_ITS_YOU_AND_ADD: &str = "Confirm it's you and add";
768/// Opens the form with the suggestion.
769pub const CHANGE_IT_FIRST: &str = "Change it first";
770/// Refuses a suggested agent.
771pub const DONT_ADD: &str = "Don't add";
772/// Saves an agent's settings.
773pub const SAVE_CHANGES: &str = "Save changes";
774/// Gives an agent one of the person's rules.
775pub const COPY_ONE_OF_YOUR_RULES: &str = "Copy one of your rules";
776/// Pauses one agent.
777pub const PAUSE: &str = "Pause";
778/// Resumes one agent.
779pub const RESUME: &str = "Resume";
780/// Removes one agent, and confirms the removal.
781pub const REMOVE: &str = "Remove";
782/// Keeps the agent instead of removing it.
783pub const KEEP: &str = "Keep";
784/// An agent the person added that has not run yet.
785pub const READY: &str = "Ready";
786/// An agent paused by hand.
787pub const PAUSED: &str = "Paused";
788/// An agent the kernel cannot build.
789pub const CANT_START: &str = "Can't start";
790/// The reversibility of adding an agent.
791pub const YOU_CAN_REMOVE_IT_LATER: &str = "You can remove it later";
792/// The reversibility of a change a person can make again the other way, which a feature's
793/// card hint says (spec 3.3 §7.1).
794pub const YOU_CAN_CHANGE_IT_BACK: &str = "You can change it back";
795/// Over what the home lets every agent on it do, under "Here is what Finance can do"
796/// (spec 3.3 §5.7).
797pub const ON_THIS_HOME_IT_CAN_ALSO: &str = "On this home it can also:";
798/// What a new agent may do without asking.
799pub const NOTHING_YET: &str = "Nothing yet";
800/// The roster with no agent of the person's own.
801pub const NO_AGENTS_OF_YOUR_OWN: &str =
802    "No agents of your own yet. Add one, or ask ADK-Rust to suggest one.";
803/// The box of **Describe it**.
804pub const WHAT_SHOULD_IT_DO: &str = "What should it do?";
805/// What **Describe it** puts before the person's words in the message to the primary agent.
806pub const SUGGEST_A_NEW_AGENT_FOR: &str = "Suggest a new agent for this: ";
807
808/// The heading of the decision that adds an agent: "Add an agent called Finance".
809pub fn add_an_agent_called(name: &str) -> String {
810    format!("Add an agent called {name}")
811}
812
813/// "Here is what Finance can do".
814pub fn here_is_what_can_do(name: &str) -> String {
815    format!("Here is what {name} can do")
816}
817
818/// The button that adds an agent set up by hand: "Add Finance".
819pub fn add_named(name: &str) -> String {
820    format!("Add {name}")
821}
822
823/// How an agent came to be added: "Suggested by ADK-Rust" (spec 3.3 §8.1).
824pub fn suggested_agent_by(agent: &str) -> String {
825    format!("Suggested by {agent}")
826}
827
828/// The reason a decision ended when its agent was removed: "You removed Finance at 10:02".
829pub fn removed_at(name: &str, hh_mm: &str) -> String {
830    format!("You removed {name} at {hh_mm}")
831}
832
833/// What a message to a paused agent gets: "Finance is paused".
834pub fn is_paused(name: &str) -> String {
835    format!("{name} is paused")
836}
837
838/// The mode cap in an added agent's own thread: "Finance asks first at most. Change it in
839/// Finance's settings."
840pub fn asks_at_most(name: &str, mode: &str) -> String {
841    format!("{name} {} at most. Change it in {name}'s settings.", mode_status(mode).to_lowercase())
842}
843
844fn plural(count: u32, one: &str, many: &str) -> String {
845    if count == 1 { format!("1 {one}") } else { format!("{count} {many}") }
846}
847
848/// What removing an agent ends: "Removing Finance stops 1 piece of work, ends 2 decisions
849/// waiting for you and 1 routine. Its threads stay."
850pub fn removing_ends(name: &str, ended: &crate::agents::EndedWork) -> String {
851    let mut ends = Vec::new();
852    if ended.decisions > 0 {
853        ends.push(format!("{} waiting for you", plural(ended.decisions, "decision", "decisions")));
854    }
855    if ended.routines > 0 {
856        ends.push(plural(ended.routines, "routine", "routines"));
857    }
858    if ended.follow_ups > 0 {
859        ends.push(plural(ended.follow_ups, "follow-up", "follow-ups"));
860    }
861    let ends = match ends.as_slice() {
862        [] => String::new(),
863        [one] => one.clone(),
864        [rest @ .., last] => format!("{} and {last}", rest.join(", ")),
865    };
866    let body = match (ended.work, ends.is_empty()) {
867        (0, true) => format!("Removing {name} ends nothing that is running"),
868        (0, false) => format!("Removing {name} ends {ends}"),
869        (work, true) => {
870            format!("Removing {name} stops {}", plural(work, "piece of work", "pieces of work"))
871        }
872        (work, false) => format!(
873            "Removing {name} stops {}, ends {ends}",
874            plural(work, "piece of work", "pieces of work")
875        ),
876    };
877    format!("{body}. Its threads stay.")
878}
879
880/// A suggestion the kernel refused when it was approved: "Finance wasn't added: ADK-Rust can
881/// no longer use the web, so Finance can't either."
882pub fn was_not_added(name: &str, reason: &str) -> String {
883    format!("{name} wasn't added: {reason}")
884}
885
886/// The comparison line on a suggested agent's card: "It can do no more than ADK-Rust, and
887/// has no shell or web." `none` lists what it has none of: `files`, `shell`, `web`.
888///
889/// # Example
890///
891/// ```rust
892/// use adk_surface::words;
893///
894/// assert_eq!(words::no_more_than("ADK-Rust", &[]), "It can do no more than ADK-Rust.");
895/// assert_eq!(
896///     words::no_more_than("ADK-Rust", &["files", "shell", "web"]),
897///     "It can do no more than ADK-Rust, and has no files, shell or web."
898/// );
899/// ```
900pub fn no_more_than(suggester: &str, none: &[&str]) -> String {
901    match none {
902        [] => format!("It can do no more than {suggester}."),
903        [one] => format!("It can do no more than {suggester}, and has no {one}."),
904        [rest @ .., last] => {
905            format!("It can do no more than {suggester}, and has no {} or {last}.", rest.join(", "))
906        }
907    }
908}
909
910/// The roster's entry for the person's removed agents, whose threads stay readable.
911pub const REMOVED_AGENTS: &str = "Removed agents";
912
913/// When an agent was removed: "Removed on 25 Oct".
914pub fn removed_on(day: &str) -> String {
915    format!("Removed on {day}")
916}
917
918/// What a removed agent's thread says where the message box was: "Finance was removed. Its
919/// threads stay; nothing more runs."
920pub fn was_removed(name: &str) -> String {
921    format!("{name} was removed. Its threads stay; nothing more runs.")
922}
923
924/// A change refused because someone changed the agent first: "Finance was changed in the
925/// terminal at 10:01".
926pub fn changed_in(name: &str, place: &str, hh_mm: &str) -> String {
927    format!("{name} was changed {place} at {hh_mm}")
928}
929
930/// The record's sentence of a change: "You added Finance in the home app".
931pub fn agent_change(kind: &str, name: &str, place: &str) -> String {
932    match kind {
933        "proposed" => format!("{name} was suggested {place}"),
934        "created" => format!("You added {name} {place}"),
935        "paused" => format!("You paused {name} {place}"),
936        "resumed" => format!("You resumed {name} {place}"),
937        "removing" | "removed" => format!("You removed {name} {place}"),
938        "refused" => format!("{name} wasn't added"),
939        _ => format!("You changed {name} {place}"),
940    }
941}
942
943// ---------------------------------------------------------------------------
944// Agent-drawn UI (spec 3.3 §6.1 `genui`, §7.4 rule 5)
945// ---------------------------------------------------------------------------
946
947/// A drawn form edited and not yet sent.
948pub const NOT_SENT_YET: &str = "Not sent yet";
949/// The folded earlier versions of a drawing, before their count: "Earlier versions · 3".
950pub const EARLIER_VERSIONS: &str = "Earlier versions";
951/// A drawn form's button while its send is on the way.
952pub const SENDING: &str = "Sending…";
953/// The message box's button that picks images to send (spec 3.3 §5.1).
954pub const ATTACH_IMAGES: &str = "Attach images";
955/// The images waiting in the message box.
956pub const IMAGES_TO_SEND: &str = "Images to send";
957/// The button on an image in the message box that takes it out.
958pub const REMOVE_IMAGE: &str = "Remove image";
959/// An image of a message, opened large.
960pub const OPEN_IMAGE: &str = "Open image";
961/// A run's badge when it ran in the sandbox (spec 3.3 §5.1).
962pub const SANDBOX: &str = "Sandbox";
963/// A run's badge when it ran on this computer, with no sandbox.
964pub const ON_THIS_COMPUTER: &str = "On this computer";
965/// Under a run whose output the tool cut: the whole of it is kept for the agent.
966pub const THE_AGENT_CAN_READ_ALL_OF_IT: &str = "The agent can read all of it.";
967/// A run that ran out of time.
968pub const TIMED_OUT: &str = "Timed out";
969/// A run that ran out of memory.
970pub const OUT_OF_MEMORY: &str = "Out of memory";
971/// A run the sandbox stopped.
972pub const REFUSED_BY_THE_SANDBOX: &str = "Refused by the sandbox";
973/// A run that could not start.
974pub const COULD_NOT_RUN: &str = "Could not run";
975/// The message box's control that stops the session's running turn (spec 3.3 §5.1).
976pub const STOP_THE_TURN: &str = "Stop the turn";
977/// After a turn was stopped: the agent waits for the next message.
978pub const TURN_STOPPED: &str = "Stopped. Your agent waits for your next message.";
979/// The replies an agent suggests, under its message (spec 3.3 §5.1).
980pub const SUGGESTED_REPLIES: &str = "Suggested replies";
981/// Today's section that counts the person's answers (spec 3.3 §5.1).
982pub const HOW_YOU_ANSWERED: &str = "How you answered this week";
983/// A drawn form sent and denied.
984pub const SENT_YOU_SAID_NO: &str = "Sent · you said no";
985/// A drawn form sent, allowed, and its call failed.
986pub const SENT_FAILED: &str = "Sent · failed";
987/// A drawn form sent at a version the agent had changed since (`surface.drawn_changed`).
988pub const FORM_CHANGED_SEND_AGAIN: &str =
989    "Couldn't send: this form changed — check it and send again";
990/// Under a drawn form's buttons in the terminal and in the scrollback.
991pub const SENDING_ASKS_YOU_FIRST: &str = "Sending asks you first";
992/// What the home lets every agent on it do with `genui`, under "On this home it can also:"
993/// (spec 3.3 §5.7, wave 4 decision 14).
994pub const SHOW_FORMS_AND_TABLES: &str =
995    "Show forms and tables in your threads — sending asks you first";
996/// A drawn form sent by voice, from chat or by an agent: only a person at a screen sends one.
997pub const SEND_FORMS_FROM_A_SCREEN: &str =
998    "A form an agent drew is sent from a screen, by the person who filled it in";
999/// A drawn form sent while its thread's agent is working or input waits for it.
1000pub const SEND_FORM_WHEN_FREE: &str =
1001    "Couldn't send: your agent is still working in this thread — send it when it's done";
1002/// A drawn form sent again before its first send reached the agent.
1003pub const FORM_BEING_SENT: &str = "Couldn't send: this form is being sent already";
1004
1005/// A 3D scene's toggle: its words instead of the scene.
1006pub const SHOW_AS_TEXT: &str = "Show as text";
1007/// Opens a chart's numbers as a table, for a screen reader or a closer look.
1008pub const SHOW_THE_DATA: &str = "Show the data";
1009/// A 3D scene's toggle back from its words.
1010pub const SHOW_IN_3D: &str = "Show in 3D";
1011/// Stops a scene's motion until it is played again.
1012pub const PAUSE_MOTION: &str = "Pause motion";
1013/// Plays a scene's motion again.
1014pub const PLAY_MOTION: &str = "Play motion";
1015/// Turns a flip card to its back.
1016pub const SHOW_BACK: &str = "Show back";
1017/// Turns a flip card to its front.
1018pub const SHOW_FRONT: &str = "Show front";
1019/// A flip card's front, in the terminal.
1020pub const FRONT: &str = "Front";
1021/// A flip card's back, in the terminal.
1022pub const BACK: &str = "Back";
1023/// Brings the next item of a carousel to the front.
1024pub const NEXT: &str = "Next";
1025/// Brings the previous item of a carousel to the front.
1026pub const PREVIOUS: &str = "Previous";
1027/// A scene object in the `ok` state.
1028pub const STATE_OK: &str = "OK";
1029/// A scene object in the `warning` state.
1030pub const STATE_WARNING: &str = "Warning";
1031/// A scene object in the `critical` state.
1032pub const STATE_CRITICAL: &str = "Critical";
1033/// A scene object in the `info` state.
1034pub const STATE_INFO: &str = "Info";
1035/// Where WebGL is missing or failed: the scene is shown in words.
1036pub const SCENE_SHOWN_AS_TEXT: &str = "3D isn't available here, so this is shown as text";
1037
1038/// Under a scene whose objects can be picked: "Picking one fills Dock. Nothing is sent."
1039pub fn scene_picks(field: &str) -> String {
1040    format!("Picking one fills {field}. Nothing is sent.")
1041}
1042
1043/// Said when a scene's object is picked: "Picked: Dock 3".
1044pub fn picked(label: &str) -> String {
1045    format!("Picked: {label}")
1046}
1047
1048/// What a 3D scene shows, in one sentence for screen readers and the terminal: "3D bar chart
1049/// of Revenue, 24 bars, from 3 to 98", "3D scene of Dock 1, Dock 2 and 4 more, 12 objects".
1050pub fn scene_summary(
1051    kind: &str,
1052    names: &[&str],
1053    counted: &str,
1054    range: Option<(f64, f64)>,
1055) -> String {
1056    let named: Vec<&str> = names.iter().copied().filter(|name| !name.trim().is_empty()).collect();
1057    let of = match named.as_slice() {
1058        [] => String::new(),
1059        [one] => format!(" of {one}"),
1060        [rest @ .., last] => format!(" of {} and {last}", rest.join(", ")),
1061    };
1062    match range {
1063        Some((low, high)) => {
1064            format!("{kind}{of}, {counted}, from {} to {}", number(low), number(high))
1065        }
1066        None => format!("{kind}{of}, {counted}"),
1067    }
1068}
1069
1070/// `count` of a thing: "1 bar", "24 bars".
1071pub fn counted(count: usize, one: &str, many: &str) -> String {
1072    if count == 1 { format!("1 {one}") } else { format!("{count} {many}") }
1073}
1074
1075/// Over a drawing: "Drawn by Finance · 10:02".
1076pub fn drawn_by(agent: &str, hh_mm: &str) -> String {
1077    format!("Drawn by {agent} · {hh_mm}")
1078}
1079
1080/// Under a drawn form's button: "Sending runs send_invoice and asks you first".
1081pub fn sending_runs(tool: &str) -> String {
1082    format!("Sending runs {tool} and asks you first")
1083}
1084
1085/// What a drawn chart shows, in one sentence for screen readers and the terminal: "Line
1086/// chart of Revenue and Costs, 12 points, from 3100 to 9800".
1087pub fn chart_summary(
1088    kind: &str,
1089    names: &[&str],
1090    points: usize,
1091    range: Option<(f64, f64)>,
1092) -> String {
1093    let named: Vec<&str> = names.iter().copied().filter(|name| !name.trim().is_empty()).collect();
1094    let of = match named.as_slice() {
1095        [] => String::new(),
1096        [one] => format!(" of {one}"),
1097        [rest @ .., last] => format!(" of {} and {last}", rest.join(", ")),
1098    };
1099    let count = if points == 1 { "1 point".to_string() } else { format!("{points} points") };
1100    match range {
1101        Some((low, high)) if points > 0 => {
1102            format!("{kind} chart{of}, {count}, from {} to {}", number(low), number(high))
1103        }
1104        _ => format!("{kind} chart{of}, {count}"),
1105    }
1106}
1107
1108/// `value` as a person reads it in a chart's summary: no more than two decimals.
1109fn number(value: f64) -> String {
1110    let rounded = (value * 100.0).round() / 100.0;
1111    if rounded.fract() == 0.0 { format!("{rounded:.0}") } else { format!("{rounded}") }
1112}
1113
1114/// A drawing refused because it looks like a decision.
1115pub fn looked_like_a_decision(agent: &str) -> String {
1116    format!("{agent} tried to show something that looks like a decision. It wasn't shown.")
1117}
1118
1119/// A drawing refused because the home's catalog cannot show it.
1120pub fn cant_show_here(agent: &str) -> String {
1121    format!("{agent} tried to show something this home can't show.")
1122}
1123
1124/// A drawing refused because it asks for a password or another secret.
1125pub fn asked_for_a_password(agent: &str) -> String {
1126    format!("{agent} asked for a password in a form. Use Take over for passwords.")
1127}
1128
1129/// A drawn form sent, before its call is held: "Sent at 10:03".
1130pub fn sent_at(hh_mm: &str) -> String {
1131    format!("Sent at {hh_mm}")
1132}
1133
1134/// A drawn form sent and waiting: "Sent at 10:03 · waiting for you".
1135pub fn sent_waiting(hh_mm: &str) -> String {
1136    format!("Sent at {hh_mm} · waiting for you")
1137}
1138
1139/// A drawn form sent, allowed and run: "Sent · done at 10:04".
1140pub fn sent_done(hh_mm: &str) -> String {
1141    format!("Sent · done at {hh_mm}")
1142}
1143
1144/// A drawn form whose call the drawing agent's rules refuse: "Finance can't use send_invoice
1145/// here".
1146pub fn cant_use_here(agent: &str, tool: &str) -> String {
1147    format!("{agent} can't use {tool} here")
1148}
1149
1150/// A drawn form's call allowed, then refused when it resumed because a rule changed.
1151pub fn cant_use_any_more(agent: &str, tool: &str) -> String {
1152    format!("Not run: {agent} can't use {tool} any more")
1153}
1154
1155/// Over the newer version of a drawn form: "Finance changed this form at 10:05".
1156pub fn changed_this_form(agent: &str, hh_mm: &str) -> String {
1157    format!("{agent} changed this form at {hh_mm}")
1158}
1159
1160/// Over the newer version of a drawn card or table: "Finance changed this at 10:05".
1161pub fn changed_this(agent: &str, hh_mm: &str) -> String {
1162    format!("{agent} changed this at {hh_mm}")
1163}
1164
1165/// Where a drawing an agent removed was: "Finance removed this at 10:06".
1166pub fn removed_this(agent: &str, hh_mm: &str) -> String {
1167    format!("{agent} removed this at {hh_mm}")
1168}
1169
1170/// A collapsed older version of a drawing: "Earlier version · 10:02".
1171pub fn earlier_version(hh_mm: &str) -> String {
1172    format!("Earlier version · {hh_mm}")
1173}
1174
1175/// Under a long drawn table cut short: "Show all 42".
1176pub fn show_all(count: usize) -> String {
1177    format!("Show all {count}")
1178}
1179
1180/// The first step of a decision a drawn form asked for (spec 3.3 §7.1, wave 4 decision 12):
1181/// "You pressed Send on a form Finance drew · 10:03".
1182pub fn pressed_send_on_form(agent: &str, hh_mm: &str) -> String {
1183    format!("You pressed Send on a form {agent} drew · {hh_mm}")
1184}
1185
1186/// The detail line of a decision a drawn form asked for: "From a form Finance drew".
1187pub fn from_a_form(agent: &str) -> String {
1188    format!("From a form {agent} drew")
1189}
1190
1191// ---------------------------------------------------------------------------
1192// Apps from MCP servers (spec 3.3 §6.1 `genui-apps`)
1193// ---------------------------------------------------------------------------
1194
1195/// An app being fetched and checked before it is framed.
1196pub const OPENING_THE_APP: &str = "Opening the app…";
1197/// Where an app is not shown: the phone, a remote terminal, or a home without an apps origin.
1198pub const OPEN_THE_HOME_TO_SEE_THIS_APP: &str = "Open the home on this computer to see this app";
1199/// An app whose HTML shows a decision's words.
1200pub const APP_BLOCKED_APPROVAL_BUTTONS: &str = "This app was blocked: it shows approval buttons";
1201/// An app that loads or connects to a site it did not declare.
1202pub const APP_BLOCKED_UNDECLARED_SITES: &str =
1203    "This app was blocked: it asks for sites it didn't declare";
1204/// An app that asks to reach this computer, its network or the home.
1205pub const APP_BLOCKED_THIS_COMPUTER: &str = "This app was blocked: it asks to reach this computer";
1206/// An app whose resource is not an MCP App's HTML.
1207pub const APP_BLOCKED_NOT_AN_APP: &str = "This app was blocked: it isn't an app this home can show";
1208/// An app whose server did not answer.
1209pub const APP_CANT_BE_OPENED: &str = "This app can't be opened right now";
1210/// An app asked for a tool only an app may call (wave 4 decision 15).
1211pub const APP_NEEDS_A_TOOL: &str = "This app needs a tool this home can't run yet";
1212/// Sends what an app suggested, as the person's message.
1213pub const SEND_IT: &str = "Send it";
1214/// Under what an app suggests sending.
1215pub const MARKED_AS_SUGGESTED_BY_THE_APP: &str = "It will be marked as suggested by the app";
1216/// Opens a link an app asked to open.
1217pub const OPEN: &str = "Open";
1218/// Saves a file an app offered.
1219pub const SAVE: &str = "Save";
1220/// What an app's tool call answers the app once it is held: it ran nothing.
1221pub const APP_CALL_WAITS_FOR_YOU: &str = "Sent to the person. It runs only once they decide.";
1222/// What an app's tool call answers the app when the agent has not yet held or refused it.
1223pub const APP_CALL_SENT: &str = "Sent. It runs only if the person allows it.";
1224/// What an app's tool call answers the app when its server did not list its tools.
1225pub const APP_SERVER_DIDNT_ANSWER: &str = "The app's server didn't answer. Try again in a moment.";
1226
1227/// Over an app in a thread: "App from Weather · it can't approve anything".
1228pub fn app_from(app: &str) -> String {
1229    format!("App from {app} · it can't approve anything")
1230}
1231
1232/// An app in the terminal: "app from Weather · open it in the home".
1233pub fn app_in_the_terminal(app: &str) -> String {
1234    format!("app from {app} · open it in the home")
1235}
1236
1237/// An app asked for a tool it may not use: "The app tried to use transfer_funds. Apps can't
1238/// use it."
1239pub fn app_cant_use(tool: &str) -> String {
1240    format!("The app tried to use {tool}. Apps can't use it.")
1241}
1242
1243/// An app suggests a message: "The app wants to send: “Remind me to take an umbrella”".
1244pub fn app_wants_to_send(message: &str) -> String {
1245    format!("The app wants to send: “{message}”")
1246}
1247
1248/// An app asks to open a link: "Open example.com?"
1249pub fn open_site(host: &str) -> String {
1250    format!("Open {host}?")
1251}
1252
1253/// An app offers a file: "The Weather app wants to save forecast.csv (2 KB)".
1254pub fn app_wants_to_save(app: &str, name: &str, bytes: usize) -> String {
1255    let size = if bytes < 1024 {
1256        format!("{bytes} bytes")
1257    } else if bytes < 1024 * 1024 {
1258        format!("{} KB", bytes.div_ceil(1024))
1259    } else {
1260        format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0))
1261    };
1262    format!("The {app} app wants to save {name} ({size})")
1263}
1264
1265/// An app that already has `count` calls waiting asks for another: "The app already asked for 3
1266/// things. Answer those first."
1267pub fn app_asked_enough(count: usize) -> String {
1268    format!("The app already asked for {count} things. Answer those first.")
1269}
1270
1271/// The thread's line for a call an app asked for: "The app asked · 10:06".
1272pub fn app_asked_at(hh_mm: &str) -> String {
1273    format!("The app asked · {hh_mm}")
1274}
1275
1276/// The first step of a decision an app asked for: "The app from Weather asked · 10:06".
1277pub fn app_asked(app: &str, hh_mm: &str) -> String {
1278    format!("The app from {app} asked · {hh_mm}")
1279}
1280
1281/// The detail line of a decision an app asked for: "From the Weather app in this thread".
1282pub fn from_the_app(app: &str) -> String {
1283    format!("From the {app} app in this thread")
1284}
1285
1286/// The label of a message an app suggested and the person sent: "Suggested by the Weather
1287/// app".
1288pub fn suggested_by_the_app(app: &str) -> String {
1289    format!("Suggested by the {app} app")
1290}
1291
1292/// Where an agent's commands run (spec 3.3 §5.7): "Commands run in the sandbox (Seatbelt)".
1293pub fn commands_run(place: &crate::model::ShellPlace) -> String {
1294    use crate::model::ShellPlace;
1295    match place {
1296        ShellPlace::Host => "Commands run on this computer".to_string(),
1297        ShellPlace::Sandbox { enforcer: Some(enforcer) } => {
1298            format!("Commands run in the sandbox ({})", enforcer_name(enforcer))
1299        }
1300        ShellPlace::Sandbox { enforcer: None } => "Commands run in the sandbox".to_string(),
1301        ShellPlace::Container { image } => format!("Commands run in a container ({image})"),
1302        ShellPlace::Remote { provider, off_host: true } => {
1303            format!("Commands run in a remote sandbox ({provider})")
1304        }
1305        ShellPlace::Remote { provider, off_host: false } => {
1306            format!("Commands run in a sandbox ({provider})")
1307        }
1308        ShellPlace::Degraded { reason, .. } => {
1309            format!("The sandbox is unavailable, so commands run on this computer: {reason}")
1310        }
1311    }
1312}
1313
1314/// An OS sandbox enforcer's name as people know it.
1315fn enforcer_name(enforcer: &str) -> &str {
1316    match enforcer {
1317        "seatbelt" => "Seatbelt",
1318        "bubblewrap" => "bubblewrap",
1319        "landlock" => "Landlock",
1320        other => other,
1321    }
1322}
1323
1324/// How many images a message carries: "1 image", "3 images".
1325pub fn images_attached(count: usize) -> String {
1326    if count == 1 { "1 image".to_string() } else { format!("{count} images") }
1327}
1328
1329/// Under a run's output: "Showing the last 40 lines of 214."
1330pub fn last_lines(shown: usize, total: usize) -> String {
1331    format!("Showing the last {shown} lines of {total}.")
1332}
1333
1334/// How a person answered: "12 answers: 9 allowed once, 2 always allowed, 1 denied".
1335pub fn answers_line(
1336    total: u32,
1337    allowed_once: u32,
1338    always_allowed: u32,
1339    edited: u32,
1340    denied: u32,
1341) -> String {
1342    if total == 0 {
1343        return "No answers this week.".to_string();
1344    }
1345    let parts: Vec<String> = [
1346        (allowed_once, "allowed once"),
1347        (always_allowed, "always allowed"),
1348        (edited, "edited"),
1349        (denied, "denied"),
1350    ]
1351    .into_iter()
1352    .filter(|(count, _)| *count > 0)
1353    .map(|(count, what)| format!("{count} {what}"))
1354    .collect();
1355    let noun = if total == 1 { "answer" } else { "answers" };
1356    format!("{total} {noun}: {}", parts.join(", "))
1357}
1358
1359// ---------------------------------------------------------------------------
1360// Approve with the image (spec 3.7 §8.2; board choices S3, S4, S5, A4, A12, A13, A15, A20, A21)
1361// ---------------------------------------------------------------------------
1362
1363/// A card's single image, waiting.
1364pub const THE_EXACT_IMAGE_THAT_WOULD_LEAVE: &str = "The exact image that would leave";
1365/// A card's single image, once it left.
1366pub const THE_IMAGE_THAT_LEFT: &str = "The image that left";
1367/// A card's single image, deleted before anything was sent.
1368pub const THE_IMAGE_THAT_WOULD_HAVE_LEFT: &str = "The image that would have left";
1369/// A card's single image when no feature says it leaves: evidence the call keeps or acts on.
1370pub const ATTACHED_IMAGE: &str = "Attached image";
1371/// Every pixel of the image is covered.
1372pub const ALL_OF_THE_IMAGE: &str = "100% of the image";
1373/// An image no region covers.
1374pub const NOTHING_COVERED: &str = "nothing covered";
1375/// The lead of the notice on a card whose image is gone.
1376pub const NOTHING_TO_SEND: &str = "Nothing to send.";
1377/// The lead of the notice on a card whose image is covered in full.
1378pub const EVERYTHING_IS_COVERED: &str = "Everything is covered.";
1379/// An image deleted before its retention ran out.
1380pub const IMAGE_DELETED: &str = "This image was deleted";
1381/// Why, when the image went before its retention ran out.
1382pub const IMAGE_DELETED_EARLY: &str =
1383    "It was deleted before its time as evidence ran out, with what it was cut from.";
1384/// The fixed line under every card that holds an image (board choice A21).
1385pub const IMAGES_LEAVE_ONLY_COVERED: &str = "Images leave this computer only after faces and personal details are covered. Nothing on this card can uncover them.";
1386/// Why voice cannot say yes to sending an image (board choice A18).
1387pub const LOOK_AT_THE_IMAGE_ON_A_SCREEN: &str = "To decide, look at the image on a screen. Voice can't say yes to sending an image; \u{201c}Deny\u{201d} still works.";
1388/// Why a surface that cannot show the image sends the person to the home (board choice A17).
1389pub const SHOW_THE_IMAGE_IN_THE_HOME: &str =
1390    "This screen can't show the image. Look at it in the home before you decide.";
1391/// The old card's line once its image was changed and the call held again.
1392pub const HELD_AGAIN_WITH_THE_NEW_IMAGE: &str = "held again with the new image";
1393/// Open the image's source, for a viewer allowed to (board choice A9).
1394pub const OPEN_THE_SOURCE_IMAGE: &str = "Open the source image";
1395
1396/// "The 3 images that would leave".
1397///
1398/// # Example
1399///
1400/// ```rust
1401/// assert_eq!(adk_surface::words::the_images_that_would_leave(3), "The 3 images that would leave");
1402/// ```
1403pub fn the_images_that_would_leave(count: usize) -> String {
1404    format!("The {count} images that would leave")
1405}
1406
1407/// "The 3 images that left".
1408///
1409/// # Example
1410///
1411/// ```rust
1412/// assert_eq!(adk_surface::words::the_images_that_left(2), "The 2 images that left");
1413/// ```
1414pub fn the_images_that_left(count: usize) -> String {
1415    format!("The {count} images that left")
1416}
1417
1418/// "The 3 images that would have left".
1419///
1420/// # Example
1421///
1422/// ```rust
1423/// assert_eq!(
1424///     adk_surface::words::the_images_that_would_have_left(3),
1425///     "The 3 images that would have left"
1426/// );
1427/// ```
1428pub fn the_images_that_would_have_left(count: usize) -> String {
1429    format!("The {count} images that would have left")
1430}
1431
1432/// A card's images when no feature says they leave: "3 attached images".
1433///
1434/// # Example
1435///
1436/// ```rust
1437/// assert_eq!(adk_surface::words::attached_images(3), "3 attached images");
1438/// ```
1439pub fn attached_images(count: usize) -> String {
1440    format!("{count} attached images")
1441}
1442
1443/// An image's size and format: "1012 × 638 PNG".
1444///
1445/// # Example
1446///
1447/// ```rust
1448/// assert_eq!(adk_surface::words::image_size(1012, 638, "image/png"), "1012 × 638 PNG");
1449/// ```
1450pub fn image_size(width: u32, height: u32, mime_type: &str) -> String {
1451    let format = mime_type.strip_prefix("image/").unwrap_or(mime_type).to_ascii_uppercase();
1452    format!("{width} × {height} {format}")
1453}
1454
1455/// A class of covering, counted: "1 face", "3 personal text", "2 fields your schema marks
1456/// personal", "1 box you covered" (board choices S3, A4).
1457///
1458/// # Example
1459///
1460/// ```rust
1461/// use adk_surface::CoverClass;
1462///
1463/// assert_eq!(adk_surface::words::covered_class(CoverClass::Face, 1), "1 face");
1464/// assert_eq!(
1465///     adk_surface::words::covered_class(CoverClass::SchemaField, 2),
1466///     "2 fields your schema marks personal"
1467/// );
1468/// ```
1469pub fn covered_class(class: crate::CoverClass, count: u32) -> String {
1470    let one = count == 1;
1471    match class {
1472        crate::CoverClass::Face => format!("{count} face{}", if one { "" } else { "s" }),
1473        crate::CoverClass::PersonalText => format!("{count} personal text"),
1474        crate::CoverClass::SchemaField => {
1475            format!("{count} field{} your schema marks personal", if one { "" } else { "s" })
1476        }
1477        crate::CoverClass::Marked => {
1478            format!("{count} box{} you covered", if one { "" } else { "es" })
1479        }
1480        crate::CoverClass::Other => format!("{count} other region{}", if one { "" } else { "s" }),
1481    }
1482}
1483
1484/// A region's tag over a large picture: "face" for a face the redactor found, "face · whole
1485/// person" for a person covered whole because no face was found (spec 3.7 Q3, board choice A4),
1486/// "personal text", "schema field", "your redaction", or the feature's own label.
1487///
1488/// # Example
1489///
1490/// ```rust
1491/// use adk_surface::CoverClass;
1492///
1493/// assert_eq!(adk_surface::words::region_tag(CoverClass::Face, "faces"), "face");
1494/// assert_eq!(adk_surface::words::region_tag(CoverClass::Face, "people"), "face · whole person");
1495/// ```
1496pub fn region_tag(class: crate::CoverClass, label: &str) -> String {
1497    match class {
1498        crate::CoverClass::Face => match label {
1499            "faces" | "face" => "face".to_string(),
1500            // `person` and `people` cover the whole person; an unknown label keeps the wider tag.
1501            _ => "face · whole person".to_string(),
1502        },
1503        crate::CoverClass::PersonalText => "personal text".to_string(),
1504        crate::CoverClass::SchemaField => "schema field".to_string(),
1505        crate::CoverClass::Marked => "your redaction".to_string(),
1506        crate::CoverClass::Other => label.replace('_', " "),
1507    }
1508}
1509
1510/// A region's tag over a small picture: "face", "text", "schema".
1511///
1512/// # Example
1513///
1514/// ```rust
1515/// use adk_surface::CoverClass;
1516///
1517/// assert_eq!(adk_surface::words::region_short_tag(CoverClass::PersonalText, "personal_text"), "text");
1518/// ```
1519pub fn region_short_tag(class: crate::CoverClass, label: &str) -> String {
1520    match class {
1521        crate::CoverClass::Face => "face".to_string(),
1522        crate::CoverClass::PersonalText => "text".to_string(),
1523        crate::CoverClass::SchemaField => "schema".to_string(),
1524        crate::CoverClass::Marked => "yours".to_string(),
1525        crate::CoverClass::Other => label.replace('_', " "),
1526    }
1527}
1528
1529/// Which of several images a class was covered in: "in image 3", "in images 1 and 3".
1530///
1531/// # Example
1532///
1533/// ```rust
1534/// assert_eq!(adk_surface::words::in_images(&[3]), "in image 3");
1535/// assert_eq!(adk_surface::words::in_images(&[1, 2, 3]), "in images 1, 2 and 3");
1536/// ```
1537pub fn in_images(which: &[usize]) -> String {
1538    match which {
1539        [one] => format!("in image {one}"),
1540        [rest @ .., last] => {
1541            let rest: Vec<String> = rest.iter().map(ToString::to_string).collect();
1542            format!("in images {} and {last}", rest.join(", "))
1543        }
1544        [] => String::new(),
1545    }
1546}
1547
1548/// A data class as a person reads it: `document_crop` is "Document crop".
1549///
1550/// # Example
1551///
1552/// ```rust
1553/// assert_eq!(adk_surface::words::data_class("document_crop"), "Document crop");
1554/// ```
1555pub fn data_class(class: &str) -> String {
1556    let spaced = class.replace(['_', '-'], " ");
1557    let mut chars = spaced.chars();
1558    match chars.next() {
1559        Some(first) => first.to_uppercase().chain(chars).collect(),
1560        None => String::new(),
1561    }
1562}
1563
1564/// Several images of a data class: "3 document crops".
1565///
1566/// # Example
1567///
1568/// ```rust
1569/// assert_eq!(adk_surface::words::data_class_many("document_crop", 3), "3 document crops");
1570/// ```
1571pub fn data_class_many(class: &str, count: usize) -> String {
1572    format!("{count} {}s", class.replace(['_', '-'], " "))
1573}
1574
1575/// What qualifies crops: "never the page".
1576///
1577/// # Example
1578///
1579/// ```rust
1580/// assert_eq!(adk_surface::words::data_class_note("document_crop").as_deref(), Some("never the page"));
1581/// assert_eq!(adk_surface::words::data_class_note("photo"), None);
1582/// ```
1583pub fn data_class_note(class: &str) -> Option<String> {
1584    class.ends_with("_crop").then(|| "never the page".to_string())
1585}
1586
1587/// Micro-USD to the cent, or to a hundredth of a cent under a cent: "$0.0044", "$1.84".
1588///
1589/// # Example
1590///
1591/// ```rust
1592/// assert_eq!(adk_surface::words::money(4_400), "$0.0044");
1593/// assert_eq!(adk_surface::words::money(1_840_000), "$1.84");
1594/// ```
1595pub fn money(micro_usd: u64) -> String {
1596    if micro_usd >= 10_000 {
1597        return dollars(micro_usd);
1598    }
1599    let hundredths = micro_usd.saturating_add(50) / 100;
1600    format!("$0.{hundredths:04}")
1601}
1602
1603/// The preflight's hold: "Up to $0.0044" (board choice A20).
1604///
1605/// # Example
1606///
1607/// ```rust
1608/// assert_eq!(adk_surface::words::up_to(4_400), "Up to $0.0044");
1609/// ```
1610pub fn up_to(micro_usd: u64) -> String {
1611    format!("Up to {}", money(micro_usd))
1612}
1613
1614/// The hold of a call with nothing left to send: "Up to $0.0012 if sent".
1615///
1616/// # Example
1617///
1618/// ```rust
1619/// assert_eq!(adk_surface::words::up_to_if_sent(1_200), "Up to $0.0012 if sent");
1620/// ```
1621pub fn up_to_if_sent(micro_usd: u64) -> String {
1622    format!("Up to {} if sent", money(micro_usd))
1623}
1624
1625/// "Kept as evidence until 18 Dec" (board choice S5).
1626///
1627/// # Example
1628///
1629/// ```rust
1630/// assert_eq!(adk_surface::words::kept_as_evidence_until("18 Dec"), "Kept as evidence until 18 Dec");
1631/// ```
1632pub fn kept_as_evidence_until(day: &str) -> String {
1633    format!("Kept as evidence until {day}")
1634}
1635
1636/// "As evidence until 18 Dec", under "Kept" on a decided card.
1637///
1638/// # Example
1639///
1640/// ```rust
1641/// assert_eq!(adk_surface::words::as_evidence_until("18 Dec"), "As evidence until 18 Dec");
1642/// ```
1643pub fn as_evidence_until(day: &str) -> String {
1644    format!("As evidence until {day}")
1645}
1646
1647/// "This image was deleted on 18 Dec".
1648///
1649/// # Example
1650///
1651/// ```rust
1652/// assert_eq!(adk_surface::words::image_deleted_on("18 Dec"), "This image was deleted on 18 Dec");
1653/// ```
1654pub fn image_deleted_on(day: &str) -> String {
1655    format!("This image was deleted on {day}")
1656}
1657
1658/// "Image deleted 18 Dec", over a small picture.
1659///
1660/// # Example
1661///
1662/// ```rust
1663/// assert_eq!(adk_surface::words::image_deleted_short("18 Dec"), "Image deleted 18 Dec");
1664/// ```
1665pub fn image_deleted_short(day: &str) -> String {
1666    format!("Image deleted {day}")
1667}
1668
1669/// "Image deleted on 18 Dec", a step of how a card got here.
1670///
1671/// # Example
1672///
1673/// ```rust
1674/// assert_eq!(adk_surface::words::image_deleted_step("18 Dec"), "Image deleted on 18 Dec");
1675/// ```
1676pub fn image_deleted_step(day: &str) -> String {
1677    format!("Image deleted on {day}")
1678}
1679
1680/// Why a deleted image's facts remain (board choice A13).
1681///
1682/// # Example
1683///
1684/// ```rust
1685/// assert!(adk_surface::words::evidence_kept_for(30).starts_with("Evidence is kept for 30 days."));
1686/// ```
1687pub fn evidence_kept_for(days: u32) -> String {
1688    format!(
1689        "Evidence is kept for {days} days. What it was, where it was going and what was covered stay on record."
1690    )
1691}
1692
1693/// The notice on a card whose image is gone (board choice A13).
1694///
1695/// # Example
1696///
1697/// ```rust
1698/// assert!(adk_surface::words::nothing_to_send_purged("Document desk").ends_with("ask Document desk again if you still need the answer."));
1699/// ```
1700pub fn nothing_to_send_purged(agent: &str) -> String {
1701    format!(
1702        "The image this decision is about is gone, so it can't be allowed. Deny it, and ask {agent} again if you still need the answer."
1703    )
1704}
1705
1706/// The notice on a card whose image is covered in full (board choice A15).
1707///
1708/// # Example
1709///
1710/// ```rust
1711/// assert_eq!(
1712///     adk_surface::words::everything_covered(Some("Gemini")),
1713///     "Gemini would receive a black rectangle, so there is nothing to allow. Deny it; covering can't be undone here."
1714/// );
1715/// ```
1716pub fn everything_covered(provider: Option<&str>) -> String {
1717    format!(
1718        "{} would receive a black rectangle, so there is nothing to allow. Deny it; covering can't be undone here.",
1719        provider.unwrap_or("The receiver")
1720    )
1721}
1722
1723/// Allows every step of a screen plan, once each, in order (spec 3.7 Q8).
1724pub const ALLOW_THIS_PLAN: &str = "Allow this plan";
1725/// What one answer on a screen plan's card does (spec 3.7 Q8).
1726pub const SCREEN_PLAN_DETAIL: &str = "One answer runs every step once, in order. Each step is checked against this preview first; a step whose target moved is asked again.";
1727/// Why a surface that cannot show a whole screen plan sends the person to the home.
1728pub const LOOK_AT_THE_PLAN_IN_THE_HOME: &str =
1729    "This screen can't show the whole plan. Look at it in the home before you allow it.";
1730/// Why an open screen plan's card closed when everything was stopped (spec 3.7 Q8, V-I17).
1731pub const STOP_ALL_CLOSED_THE_PLAN: &str = "Stop all closed this screen plan before anyone answered it. Preview the actions again for a fresh card.";
1732
1733/// The heading of a screen plan's card: "Run 4 desktop actions in app.forms, window
1734/// "Customer form"" (spec 3.7 Q8).
1735///
1736/// # Example
1737///
1738/// ```rust
1739/// assert_eq!(
1740///     adk_surface::words::screen_plan_heading(4, "app.forms, window \"Customer form\""),
1741///     "Run 4 desktop actions in app.forms, window \"Customer form\""
1742/// );
1743/// ```
1744pub fn screen_plan_heading(steps: usize, window: &str) -> String {
1745    format!("Run {steps} desktop actions in {window}")
1746}
1747
1748/// The heading of a screen plan's card in chat, which names no window (S-I5): "Run 4 desktop
1749/// actions".
1750///
1751/// # Example
1752///
1753/// ```rust
1754/// assert_eq!(adk_surface::words::screen_plan_chat_heading(4), "Run 4 desktop actions");
1755/// ```
1756pub fn screen_plan_chat_heading(steps: usize) -> String {
1757    format!("Run {steps} desktop actions")
1758}
1759
1760/// The line of a decision a person changed before it ran, its call held again: "You changed
1761/// it at 10:15 · held again with the new image" (spec 3.7 V-I5).
1762///
1763/// # Example
1764///
1765/// ```rust
1766/// assert_eq!(
1767///     adk_surface::words::held_again_at("10:15"),
1768///     "You changed it at 10:15 · held again with the new image"
1769/// );
1770/// ```
1771pub fn held_again_at(hh_mm: &str) -> String {
1772    format!("You changed it at {hh_mm} · {HELD_AGAIN_WITH_THE_NEW_IMAGE}")
1773}
1774
1775/// The run that waited on a card ended: "Waited 10 minutes; the run ended at 10:24"
1776/// (board choice A12).
1777///
1778/// # Example
1779///
1780/// ```rust
1781/// assert_eq!(adk_surface::words::run_ended(10, "10:24"), "Waited 10 minutes; the run ended at 10:24");
1782/// assert_eq!(adk_surface::words::run_ended(1, "10:15"), "Waited 1 minute; the run ended at 10:15");
1783/// ```
1784pub fn run_ended(minutes: i64, hh_mm: &str) -> String {
1785    let unit = if minutes == 1 { "minute" } else { "minutes" };
1786    format!("Waited {minutes} {unit}; the run ended at {hh_mm}")
1787}
1788
1789/// The notice on a card whose run ended while it waited (board choice A12).
1790///
1791/// # Example
1792///
1793/// ```rust
1794/// assert!(adk_surface::words::stopped_waiting("Document desk", "10:24").starts_with("Document desk stopped waiting at 10:24"));
1795/// ```
1796pub fn stopped_waiting(agent: &str, hh_mm: &str) -> String {
1797    format!(
1798        "{agent} stopped waiting at {hh_mm} and finished its run without this. Your answer is kept and used when {agent} picks this thread up again."
1799    )
1800}
1801
1802#[cfg(test)]
1803mod tests {
1804    use super::*;
1805
1806    /// Every fixed word: sentence case, no all-caps labels (spec 3.3 §8).
1807    const ALL: &[&str] = &[
1808        WORKING,
1809        WAITING_FOR_YOU,
1810        WAITING_FOR_AN_ANSWER,
1811        ASLEEP,
1812        DONE,
1813        FAILED,
1814        DECISIONS,
1815        DECIDED,
1816        QUESTION,
1817        IS_THAT_RIGHT,
1818        SUGGESTION,
1819        DO_IT,
1820        NOT_NOW,
1821        WHILE_YOU_WERE_AWAY,
1822        WHAT_YOUR_AGENTS_DID,
1823        EVERY_ACTION_ON_RECORD,
1824        WHAT_YOUR_AGENTS_REMEMBER,
1825        YOU_SAID_THIS,
1826        A_GUESS,
1827        JUST_LOOK,
1828        SUGGEST,
1829        ASK_FIRST,
1830        GO_AHEAD,
1831        ALLOWED_WITHOUT_ASKING,
1832        EXTEND,
1833        STOP_ALLOWING,
1834        QUIET_TIME,
1835        DAILY_SPENDING_LIMIT,
1836        AREAS,
1837        WHERE_YOU_CAN_SAY_YES_FROM,
1838        ADD_A_PHONE_OR_APP,
1839        YOUR_AGENTS,
1840        AGENTS_SUGGEST,
1841        NOTICED_SOMETHING,
1842        ALL_AGENTS_RESUMED,
1843        ALLOW_ONCE,
1844        ALWAYS_ALLOW_FOR_THIS_PERSON,
1845        ALWAYS_ALLOW_FOR_THIS_FOLDER,
1846        ALWAYS_ALLOW_FOR_THIS_COMMAND,
1847        ALWAYS_ALLOW_FOR_THIS_SITE,
1848        EDIT,
1849        ANSWER,
1850        LOOK_ALIKE_ADDRESS,
1851        HIDDEN_HOST_ADDRESS,
1852        UNENCRYPTED_ADDRESS,
1853        DENY,
1854        CONFIRM_ITS_YOU_AND_APPROVE,
1855        TAKE_OVER,
1856        TAKE_OVER_DONE,
1857        STOP_ALL,
1858        RESUME_ALL,
1859        UNDO,
1860        THATS_RIGHT,
1861        FIX_IT,
1862        FORGET_IT,
1863        OPEN_IN_HOME,
1864        LOW_RISK,
1865        MEDIUM_RISK,
1866        HIGH_RISK,
1867        CANT_BE_UNSENT,
1868        CANT_BE_UNDONE,
1869        WAITED_THROUGH_QUIET_TIME,
1870        ANSWERED_ELSEWHERE_UPDATES,
1871        NEEDS_A_SCREEN,
1872        APPROVE_IN_THE_HOME,
1873        ENDED_WITHOUT_AN_ANSWER,
1874        SENT_AFTER_THIS_CARD_IS_ANSWERED,
1875        SENT_WHEN_YOUR_AGENT_IS_FREE,
1876        YOU_SUGGESTED_THIS,
1877        ALL_AGENTS_STOPPED,
1878        ALL_AGENTS_STOPPED_RESUME_IN_HOME,
1879        YOU_DECIDED,
1880        A_DECISION_IS_WAITING,
1881        OPEN_THE_APP_TO_SEE_IT,
1882        YOUR_PHONE,
1883        USE_YOUR_FACE_OR_FINGERPRINT,
1884        USE_YOUR_FACE_OR_FINGERPRINT_ON_THIS_COMPUTER,
1885        ALLOW_NOTIFICATIONS,
1886        ADD_TO_HOME_SCREEN_FIRST,
1887        APPROVE_IT_IN_THE_HOME,
1888        LISTENING,
1889        SPEAKING,
1890        SAY_ALLOW_ONCE_OR_DENY,
1891        SAY_DENY_OR_DECIDE_ON_SCREEN,
1892        DECIDE_ON_SCREEN,
1893        CANCEL,
1894        END,
1895        WHAT_IT_CAN_SEE,
1896        VOICE_PRIVACY_NOTE,
1897        SPOKEN_ANSWER_CANCELLED,
1898        CHANGED_WHILE_YOU_SPOKE,
1899        VOICE_CANT_APPROVE_THIS,
1900        STOPPING_NEEDS_THE_OPERATOR,
1901        APP_CALL_SENT,
1902        APP_SERVER_DIDNT_ANSWER,
1903        THE_EXACT_IMAGE_THAT_WOULD_LEAVE,
1904        THE_IMAGE_THAT_LEFT,
1905        THE_IMAGE_THAT_WOULD_HAVE_LEFT,
1906        ATTACHED_IMAGE,
1907        NOTHING_TO_SEND,
1908        EVERYTHING_IS_COVERED,
1909        IMAGE_DELETED,
1910        IMAGE_DELETED_EARLY,
1911        IMAGES_LEAVE_ONLY_COVERED,
1912        LOOK_AT_THE_IMAGE_ON_A_SCREEN,
1913        SHOW_THE_IMAGE_IN_THE_HOME,
1914        OPEN_THE_SOURCE_IMAGE,
1915        ALLOW_THIS_PLAN,
1916        SCREEN_PLAN_DETAIL,
1917        LOOK_AT_THE_PLAN_IN_THE_HOME,
1918        STOP_ALL_CLOSED_THE_PLAN,
1919    ];
1920
1921    #[test]
1922    fn every_word_is_sentence_case() {
1923        for word in ALL {
1924            let first = word.chars().next().unwrap();
1925            assert!(first.is_uppercase(), "{word:?} starts lower case");
1926            for token in word.split_whitespace() {
1927                let letters: Vec<char> = token.chars().filter(|c| c.is_alphabetic()).collect();
1928                assert!(
1929                    letters.len() < 2 || letters.iter().any(|c| c.is_lowercase()),
1930                    "{word:?} has an all-caps word"
1931                );
1932            }
1933        }
1934    }
1935
1936    #[test]
1937    fn the_spec_terms_are_exact() {
1938        assert_eq!(
1939            [JUST_LOOK, SUGGEST, ASK_FIRST, GO_AHEAD],
1940            ["Just look", "Suggest", "Ask first", "Go ahead"]
1941        );
1942        assert_eq!(
1943            said(None, SaidWhat::Yes, Some("in Telegram"), "07:31"),
1944            "You said yes in Telegram at 07:31"
1945        );
1946        assert_eq!(
1947            also_shown(&[ON_YOUR_PHONE.into(), in_channel("Telegram")]).unwrap(),
1948            "Also on your phone and in Telegram"
1949        );
1950        assert_eq!(spent_of(1_840_000, 5_000_000), "$1.84 of $5.00 today");
1951    }
1952}