pub const WORKING: &str = "Working";
pub const WAITING_FOR_YOU: &str = "Waiting for you";
pub const WAITING_FOR_AN_ANSWER: &str = "Waiting for an answer";
pub const ASLEEP: &str = "Asleep";
pub const DONE: &str = "Done";
pub const FAILED: &str = "Failed";
pub const DECISIONS: &str = "Decisions";
pub const DECIDED: &str = "Decided";
pub const QUESTION: &str = "Question";
pub const IS_THAT_RIGHT: &str = "Is that right?";
pub const SUGGESTION: &str = "Suggestion";
pub const DO_IT: &str = "Do it";
pub const NOT_NOW: &str = "Not now";
pub const WHILE_YOU_WERE_AWAY: &str = "While you were away";
pub const WHAT_YOUR_AGENTS_DID: &str = "What your agents did";
pub const EVERY_ACTION_ON_RECORD: &str = "Every action is on record";
pub const WHAT_YOUR_AGENTS_REMEMBER: &str = "What your agents remember";
pub const YOU_SAID_THIS: &str = "You said this";
pub const A_GUESS: &str = "A guess";
pub const JUST_LOOK: &str = "Just look";
pub const SUGGEST: &str = "Suggest";
pub const ASK_FIRST: &str = "Ask first";
pub const GO_AHEAD: &str = "Go ahead";
pub const ALLOWED_WITHOUT_ASKING: &str = "Allowed without asking";
pub const EXTEND: &str = "Extend";
pub const STOP_ALLOWING: &str = "Stop allowing";
pub const QUIET_TIME: &str = "Quiet time";
pub const DAILY_SPENDING_LIMIT: &str = "Daily spending limit";
pub const AREAS: &str = "Areas";
pub const WHERE_YOU_CAN_SAY_YES_FROM: &str = "Where you can say yes from";
pub const ADD_A_PHONE_OR_APP: &str = "Add a phone or app";
pub const YOUR_AGENTS: &str = "Your agents";
pub const AGENTS_SUGGEST: &str = "Your agents suggest something. Nothing happens until you say so.";
pub const NOTICED_SOMETHING: &str = "Your agents noticed something. Is that right?";
pub const ALL_AGENTS_RESUMED: &str = "All agents resumed.";
pub const RIGHT_AWAY: &str = "right away";
pub const YOU_SUGGESTED_THIS: &str = "You suggested this.";
pub fn suggested_by(agent: Option<&str>) -> String {
match agent {
Some(agent) => format!("{agent} suggests this."),
None => format!("{YOUR_AGENTS} suggest this."),
}
}
pub fn once_you_say_yes(when: &str) -> String {
format!("Once you say yes, it runs {when}.")
}
pub fn plan_of(steps: usize) -> String {
if steps == 1 {
"Its plan has 1 step.".to_string()
} else {
format!("Its plan has {steps} steps.")
}
}
pub fn may_spend(micro_usd: u64) -> String {
format!("It may spend up to {}.", dollars(micro_usd))
}
pub fn start_driver(id: &str) -> String {
format!("Start {id} for your agents")
}
pub fn driver_starts(command: &str) -> String {
format!("It runs {command} on the computer your agents run on.")
}
pub fn asleep_until(hh_mm: &str) -> String {
format!("Asleep until {hh_mm}")
}
pub fn couldnt_answer(agent: &str) -> String {
format!("{agent} couldn't answer")
}
pub fn mode_status(mode_word: &str) -> String {
match mode_word {
JUST_LOOK => "Just looks".to_string(),
SUGGEST => "Suggests".to_string(),
ASK_FIRST => "Asks first".to_string(),
GO_AHEAD => "Goes ahead".to_string(),
other => other.to_string(),
}
}
pub const ALLOW_ONCE: &str = "Allow once";
pub const ALWAYS_ALLOW_FOR_THIS_PERSON: &str = "Always allow for this person";
pub const ALWAYS_ALLOW_FOR_THIS_FOLDER: &str = "Always allow for this folder";
pub const ALWAYS_ALLOW_FOR_THIS_COMMAND: &str = "Always allow for this command";
pub const ALWAYS_ALLOW_FOR_THIS_SITE: &str = "Always allow for this site";
pub fn always_allow_covering(
label: &str,
covers: &str,
every_session: bool,
runs_scripts: bool,
) -> String {
let scope = if every_session { "every session" } else { "this session" };
let scripts =
if runs_scripts { "; it runs project scripts, so it allows whatever they do" } else { "" };
format!("{label} ({covers}, {scope}{scripts})")
}
pub const EDIT: &str = "Edit";
pub const ANSWER: &str = "Answer";
pub const LOOK_ALIKE_ADDRESS: &str =
"This address uses look-alike characters. Check the host letter by letter before you open it.";
pub const HIDDEN_HOST_ADDRESS: &str =
"This address puts a name before an @, so the real host is the part after it.";
pub const UNENCRYPTED_ADDRESS: &str = "This address is not encrypted (http).";
pub const DENY: &str = "Deny";
pub const CONFIRM_ITS_YOU_AND_APPROVE: &str = "Confirm it's you and approve";
pub const TAKE_OVER: &str = "Take over";
pub const TAKE_OVER_DONE: &str = "Done";
pub const STOP_ALL: &str = "Stop all";
pub const RESUME_ALL: &str = "Resume all";
pub const UNDO: &str = "Undo";
pub const THATS_RIGHT: &str = "That's right";
pub const FIX_IT: &str = "Fix it";
pub const FORGET_IT: &str = "Forget it";
pub const OPEN_IN_HOME: &str = "Open in home";
pub const LOW_RISK: &str = "Low risk";
pub const MEDIUM_RISK: &str = "Medium risk";
pub const HIGH_RISK: &str = "High risk";
pub const CANT_BE_UNSENT: &str = "Can't be unsent";
pub const CANT_BE_UNDONE: &str = "Can't be undone";
pub const WAITED_THROUGH_QUIET_TIME: &str = "Waited through quiet time";
pub const ANSWERED_ELSEWHERE_UPDATES: &str =
"If you answer somewhere else first, this screen updates.";
pub const NEEDS_A_SCREEN: &str =
"This always needs you, on a screen. Voice, chat and standing permissions can't say yes to it.";
pub const APPROVE_IN_THE_HOME: &str =
"Approve it in the home app, or in a terminal on the computer your agents run on.";
pub fn since(hh_mm: &str) -> String {
format!("since {hh_mm}")
}
pub fn asked_at(hh_mm: &str) -> String {
format!("Asked at {hh_mm}")
}
pub fn also_shown(places: &[String]) -> Option<String> {
match places {
[] => None,
[one] => Some(format!("Also {one}")),
[rest @ .., last] => Some(format!("Also {} and {last}", rest.join(", "))),
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SaidWhat {
Yes,
No,
Edited,
Replied,
}
pub fn said(who: Option<&str>, what: SaidWhat, via: Option<&str>, hh_mm: &str) -> String {
let who = who.unwrap_or("You");
let what = match what {
SaidWhat::Yes => "said yes",
SaidWhat::No => "said no",
SaidWhat::Edited => "said yes with changes",
SaidWhat::Replied => "answered instead",
};
match via {
Some(via) => format!("{who} {what} {via} at {hh_mm}"),
None => format!("{who} {what} at {hh_mm}"),
}
}
pub const ENDED_WITHOUT_AN_ANSWER: &str = "Ended without an answer";
pub const IN_THE_HOME_APP: &str = "in the home app";
pub const ON_YOUR_PHONE: &str = "on your phone";
pub const IN_THE_TERMINAL: &str = "in the terminal";
pub const FROM_THE_TRAY: &str = "from the tray";
pub const BY_VOICE: &str = "by voice";
pub fn in_channel(channel: &str) -> String {
format!("in {channel}")
}
pub const ALL_AGENTS_STOPPED: &str = "All agents stopped";
pub const ALL_AGENTS_STOPPED_RESUME_IN_HOME: &str =
"All agents stopped. Use Resume all in the home app.";
pub fn spent_of(spent_micro_usd: u64, limit_micro_usd: u64) -> String {
format!("{} of {} today", dollars(spent_micro_usd), dollars(limit_micro_usd))
}
pub fn spent_today(spent_micro_usd: u64) -> String {
format!("{} today", dollars(spent_micro_usd))
}
pub fn dollars(micro_usd: u64) -> String {
let cents = micro_usd.saturating_add(5_000) / 10_000;
format!("${}.{:02}", cents / 100, cents % 100)
}
pub fn quiet_from(hh_mm: &str) -> String {
format!("Quiet from {hh_mm}")
}
pub fn quiet_until(hh_mm: &str) -> String {
format!("Quiet until {hh_mm}")
}
pub const SENT_AFTER_THIS_CARD_IS_ANSWERED: &str = "Sent after this card is answered";
pub const SENT_WHEN_YOUR_AGENT_IS_FREE: &str = "Sent when your agent is free";
pub fn allowing_in(seconds: u64) -> String {
match seconds {
1 => "Allowing once in 1 second".to_string(),
n => format!("Allowing once in {n} seconds"),
}
}
pub fn briefing_since(hh_mm: &str) -> String {
format!("Since {hh_mm}")
}
pub const YOU_DECIDED: &str = "You decided";
pub fn briefing_sentence(kind: &str, agent: &str) -> String {
match kind {
"intent" => format!("{agent} started on your message."),
"tool_call" => format!("{agent} used a tool."),
"approval" => format!("You allowed {agent} to go ahead."),
"rejection" => format!("You said no to {agent}."),
"denial" => format!("{agent} was not allowed to do something."),
"held" => format!("{agent} asked you first."),
"decided" => format!("A decision for {agent} was made."),
"rule_hit" => format!("{agent} went ahead, as you allowed without asking."),
"observation" => IS_THAT_RIGHT.to_string(),
"wake" => format!("{agent} woke up."),
"proposal" => {
format!("{agent} suggests something. Nothing happens until you say so.")
}
"spend" => format!("{agent} spent money on a model."),
"turn" => format!("{agent} finished."),
"loop_guard" => format!("{agent} stopped because it was repeating itself."),
"governance" => ALL_AGENTS_STOPPED.to_string(),
_ => format!("{agent} did something."),
}
}
pub const A_DECISION_IS_WAITING: &str = "A decision is waiting";
pub const OPEN_THE_APP_TO_SEE_IT: &str = "Open the app to see it";
pub const YOUR_PHONE: &str = "Your phone";
pub const ASKS_FOR_FACE_OR_FINGERPRINT: &str = "asks for your face or fingerprint";
pub const NEEDS_FACE_OR_FINGERPRINT: &str = "needs your face or fingerprint";
pub const DONE_ONCE: &str = "done once";
pub const WANTS_TO_RUN_THIS_COMMAND: &str = "wants to run this command.";
pub const USE_YOUR_FACE_OR_FINGERPRINT: &str = "Use your face or fingerprint";
pub const USE_YOUR_FACE_OR_FINGERPRINT_ON_THIS_COMPUTER: &str =
"Use your face or fingerprint on this computer";
pub const ALLOW_NOTIFICATIONS: &str = "Allow notifications";
pub const ADD_TO_HOME_SCREEN_FIRST: &str = "Add to Home Screen first";
pub const APPROVE_IT_IN_THE_HOME: &str = "Approve it in the home on your computer";
pub fn wants_to_run(agent: &str) -> String {
format!("{agent} {WANTS_TO_RUN_THIS_COMMAND}")
}
pub const LISTENING: &str = "Listening";
pub const SPEAKING: &str = "Speaking";
pub const SAY_ALLOW_ONCE_OR_DENY: &str = "Say \"allow once\" or \"deny\".";
pub const SAY_DENY_OR_DECIDE_ON_SCREEN: &str = "Say \"deny\", or decide on screen.";
pub const DECIDE_ON_SCREEN: &str = "Decide on screen";
pub const CANCEL: &str = "Cancel";
pub const END: &str = "End";
pub const WHAT_IT_CAN_SEE: &str = "What it can see";
pub const VOICE_PRIVACY_NOTE: &str = "By voice you can say yes once to everyday things, and no \
to anything. Serious ones need a screen to approve. We keep a note of your answer, never \
the recording.";
pub const SPOKEN_ANSWER_CANCELLED: &str = "Cancelled. It still waits for you.";
pub const CHANGED_WHILE_YOU_SPOKE: &str =
"Nothing was decided: the decision changed while you were speaking.";
pub const VOICE_CANT_APPROVE_THIS: &str = "Voice can't approve this one. Decide on screen.";
pub const STOPPING_NEEDS_THE_OPERATOR: &str =
"Stopping every agent needs the operator. Ask them, or stop from their home app.";
pub fn talking_with(agent: &str) -> String {
format!("Talking with {agent}")
}
pub fn heard(text: &str) -> String {
format!("Heard \"{text}\"")
}
pub fn wants_to(agent: &str, heading: &str) -> String {
let mut chars = heading.chars();
let heading = match chars.next() {
Some(first) => first.to_lowercase().chain(chars).collect(),
None => String::new(),
};
format!("{agent} wants to {heading}.")
}
pub fn voice_cant_approve(heading: &str, money: bool) -> String {
let why = if money { "spends money" } else { "is high risk" };
format!("\"{heading}\" {why}, so voice can't approve it.")
}
pub const NEW_AGENT: &str = "New agent";
pub const DESCRIBE_IT: &str = "Describe it";
pub const SET_IT_UP_YOURSELF: &str = "Set it up yourself";
pub const ASK_TO_SUGGEST_ONE: &str = "Ask ADK-Rust to suggest one";
pub const ADD_THIS_AGENT: &str = "Add this agent";
pub const CONFIRM_ITS_YOU_AND_ADD: &str = "Confirm it's you and add";
pub const CHANGE_IT_FIRST: &str = "Change it first";
pub const DONT_ADD: &str = "Don't add";
pub const SAVE_CHANGES: &str = "Save changes";
pub const COPY_ONE_OF_YOUR_RULES: &str = "Copy one of your rules";
pub const PAUSE: &str = "Pause";
pub const RESUME: &str = "Resume";
pub const REMOVE: &str = "Remove";
pub const KEEP: &str = "Keep";
pub const READY: &str = "Ready";
pub const PAUSED: &str = "Paused";
pub const CANT_START: &str = "Can't start";
pub const YOU_CAN_REMOVE_IT_LATER: &str = "You can remove it later";
pub const YOU_CAN_CHANGE_IT_BACK: &str = "You can change it back";
pub const ON_THIS_HOME_IT_CAN_ALSO: &str = "On this home it can also:";
pub const NOTHING_YET: &str = "Nothing yet";
pub const NO_AGENTS_OF_YOUR_OWN: &str =
"No agents of your own yet. Add one, or ask ADK-Rust to suggest one.";
pub const WHAT_SHOULD_IT_DO: &str = "What should it do?";
pub const SUGGEST_A_NEW_AGENT_FOR: &str = "Suggest a new agent for this: ";
pub fn add_an_agent_called(name: &str) -> String {
format!("Add an agent called {name}")
}
pub fn here_is_what_can_do(name: &str) -> String {
format!("Here is what {name} can do")
}
pub fn add_named(name: &str) -> String {
format!("Add {name}")
}
pub fn suggested_agent_by(agent: &str) -> String {
format!("Suggested by {agent}")
}
pub fn removed_at(name: &str, hh_mm: &str) -> String {
format!("You removed {name} at {hh_mm}")
}
pub fn is_paused(name: &str) -> String {
format!("{name} is paused")
}
pub fn asks_at_most(name: &str, mode: &str) -> String {
format!("{name} {} at most. Change it in {name}'s settings.", mode_status(mode).to_lowercase())
}
fn plural(count: u32, one: &str, many: &str) -> String {
if count == 1 { format!("1 {one}") } else { format!("{count} {many}") }
}
pub fn removing_ends(name: &str, ended: &crate::agents::EndedWork) -> String {
let mut ends = Vec::new();
if ended.decisions > 0 {
ends.push(format!("{} waiting for you", plural(ended.decisions, "decision", "decisions")));
}
if ended.routines > 0 {
ends.push(plural(ended.routines, "routine", "routines"));
}
if ended.follow_ups > 0 {
ends.push(plural(ended.follow_ups, "follow-up", "follow-ups"));
}
let ends = match ends.as_slice() {
[] => String::new(),
[one] => one.clone(),
[rest @ .., last] => format!("{} and {last}", rest.join(", ")),
};
let body = match (ended.work, ends.is_empty()) {
(0, true) => format!("Removing {name} ends nothing that is running"),
(0, false) => format!("Removing {name} ends {ends}"),
(work, true) => {
format!("Removing {name} stops {}", plural(work, "piece of work", "pieces of work"))
}
(work, false) => format!(
"Removing {name} stops {}, ends {ends}",
plural(work, "piece of work", "pieces of work")
),
};
format!("{body}. Its threads stay.")
}
pub fn was_not_added(name: &str, reason: &str) -> String {
format!("{name} wasn't added: {reason}")
}
pub fn no_more_than(suggester: &str, none: &[&str]) -> String {
match none {
[] => format!("It can do no more than {suggester}."),
[one] => format!("It can do no more than {suggester}, and has no {one}."),
[rest @ .., last] => {
format!("It can do no more than {suggester}, and has no {} or {last}.", rest.join(", "))
}
}
}
pub const REMOVED_AGENTS: &str = "Removed agents";
pub fn removed_on(day: &str) -> String {
format!("Removed on {day}")
}
pub fn was_removed(name: &str) -> String {
format!("{name} was removed. Its threads stay; nothing more runs.")
}
pub fn changed_in(name: &str, place: &str, hh_mm: &str) -> String {
format!("{name} was changed {place} at {hh_mm}")
}
pub fn agent_change(kind: &str, name: &str, place: &str) -> String {
match kind {
"proposed" => format!("{name} was suggested {place}"),
"created" => format!("You added {name} {place}"),
"paused" => format!("You paused {name} {place}"),
"resumed" => format!("You resumed {name} {place}"),
"removing" | "removed" => format!("You removed {name} {place}"),
"refused" => format!("{name} wasn't added"),
_ => format!("You changed {name} {place}"),
}
}
pub const NOT_SENT_YET: &str = "Not sent yet";
pub const EARLIER_VERSIONS: &str = "Earlier versions";
pub const SENDING: &str = "Sending…";
pub const ATTACH_IMAGES: &str = "Attach images";
pub const IMAGES_TO_SEND: &str = "Images to send";
pub const REMOVE_IMAGE: &str = "Remove image";
pub const OPEN_IMAGE: &str = "Open image";
pub const SANDBOX: &str = "Sandbox";
pub const ON_THIS_COMPUTER: &str = "On this computer";
pub const THE_AGENT_CAN_READ_ALL_OF_IT: &str = "The agent can read all of it.";
pub const TIMED_OUT: &str = "Timed out";
pub const OUT_OF_MEMORY: &str = "Out of memory";
pub const REFUSED_BY_THE_SANDBOX: &str = "Refused by the sandbox";
pub const COULD_NOT_RUN: &str = "Could not run";
pub const STOP_THE_TURN: &str = "Stop the turn";
pub const TURN_STOPPED: &str = "Stopped. Your agent waits for your next message.";
pub const SUGGESTED_REPLIES: &str = "Suggested replies";
pub const HOW_YOU_ANSWERED: &str = "How you answered this week";
pub const SENT_YOU_SAID_NO: &str = "Sent · you said no";
pub const SENT_FAILED: &str = "Sent · failed";
pub const FORM_CHANGED_SEND_AGAIN: &str =
"Couldn't send: this form changed — check it and send again";
pub const SENDING_ASKS_YOU_FIRST: &str = "Sending asks you first";
pub const SHOW_FORMS_AND_TABLES: &str =
"Show forms and tables in your threads — sending asks you first";
pub const SEND_FORMS_FROM_A_SCREEN: &str =
"A form an agent drew is sent from a screen, by the person who filled it in";
pub const SEND_FORM_WHEN_FREE: &str =
"Couldn't send: your agent is still working in this thread — send it when it's done";
pub const FORM_BEING_SENT: &str = "Couldn't send: this form is being sent already";
pub const SHOW_AS_TEXT: &str = "Show as text";
pub const SHOW_THE_DATA: &str = "Show the data";
pub const SHOW_IN_3D: &str = "Show in 3D";
pub const PAUSE_MOTION: &str = "Pause motion";
pub const PLAY_MOTION: &str = "Play motion";
pub const SHOW_BACK: &str = "Show back";
pub const SHOW_FRONT: &str = "Show front";
pub const FRONT: &str = "Front";
pub const BACK: &str = "Back";
pub const NEXT: &str = "Next";
pub const PREVIOUS: &str = "Previous";
pub const STATE_OK: &str = "OK";
pub const STATE_WARNING: &str = "Warning";
pub const STATE_CRITICAL: &str = "Critical";
pub const STATE_INFO: &str = "Info";
pub const SCENE_SHOWN_AS_TEXT: &str = "3D isn't available here, so this is shown as text";
pub fn scene_picks(field: &str) -> String {
format!("Picking one fills {field}. Nothing is sent.")
}
pub fn picked(label: &str) -> String {
format!("Picked: {label}")
}
pub fn scene_summary(
kind: &str,
names: &[&str],
counted: &str,
range: Option<(f64, f64)>,
) -> String {
let named: Vec<&str> = names.iter().copied().filter(|name| !name.trim().is_empty()).collect();
let of = match named.as_slice() {
[] => String::new(),
[one] => format!(" of {one}"),
[rest @ .., last] => format!(" of {} and {last}", rest.join(", ")),
};
match range {
Some((low, high)) => {
format!("{kind}{of}, {counted}, from {} to {}", number(low), number(high))
}
None => format!("{kind}{of}, {counted}"),
}
}
pub fn counted(count: usize, one: &str, many: &str) -> String {
if count == 1 { format!("1 {one}") } else { format!("{count} {many}") }
}
pub fn drawn_by(agent: &str, hh_mm: &str) -> String {
format!("Drawn by {agent} · {hh_mm}")
}
pub fn sending_runs(tool: &str) -> String {
format!("Sending runs {tool} and asks you first")
}
pub fn chart_summary(
kind: &str,
names: &[&str],
points: usize,
range: Option<(f64, f64)>,
) -> String {
let named: Vec<&str> = names.iter().copied().filter(|name| !name.trim().is_empty()).collect();
let of = match named.as_slice() {
[] => String::new(),
[one] => format!(" of {one}"),
[rest @ .., last] => format!(" of {} and {last}", rest.join(", ")),
};
let count = if points == 1 { "1 point".to_string() } else { format!("{points} points") };
match range {
Some((low, high)) if points > 0 => {
format!("{kind} chart{of}, {count}, from {} to {}", number(low), number(high))
}
_ => format!("{kind} chart{of}, {count}"),
}
}
fn number(value: f64) -> String {
let rounded = (value * 100.0).round() / 100.0;
if rounded.fract() == 0.0 { format!("{rounded:.0}") } else { format!("{rounded}") }
}
pub fn looked_like_a_decision(agent: &str) -> String {
format!("{agent} tried to show something that looks like a decision. It wasn't shown.")
}
pub fn cant_show_here(agent: &str) -> String {
format!("{agent} tried to show something this home can't show.")
}
pub fn asked_for_a_password(agent: &str) -> String {
format!("{agent} asked for a password in a form. Use Take over for passwords.")
}
pub fn sent_at(hh_mm: &str) -> String {
format!("Sent at {hh_mm}")
}
pub fn sent_waiting(hh_mm: &str) -> String {
format!("Sent at {hh_mm} · waiting for you")
}
pub fn sent_done(hh_mm: &str) -> String {
format!("Sent · done at {hh_mm}")
}
pub fn cant_use_here(agent: &str, tool: &str) -> String {
format!("{agent} can't use {tool} here")
}
pub fn cant_use_any_more(agent: &str, tool: &str) -> String {
format!("Not run: {agent} can't use {tool} any more")
}
pub fn changed_this_form(agent: &str, hh_mm: &str) -> String {
format!("{agent} changed this form at {hh_mm}")
}
pub fn changed_this(agent: &str, hh_mm: &str) -> String {
format!("{agent} changed this at {hh_mm}")
}
pub fn removed_this(agent: &str, hh_mm: &str) -> String {
format!("{agent} removed this at {hh_mm}")
}
pub fn earlier_version(hh_mm: &str) -> String {
format!("Earlier version · {hh_mm}")
}
pub fn show_all(count: usize) -> String {
format!("Show all {count}")
}
pub fn pressed_send_on_form(agent: &str, hh_mm: &str) -> String {
format!("You pressed Send on a form {agent} drew · {hh_mm}")
}
pub fn from_a_form(agent: &str) -> String {
format!("From a form {agent} drew")
}
pub const OPENING_THE_APP: &str = "Opening the app…";
pub const OPEN_THE_HOME_TO_SEE_THIS_APP: &str = "Open the home on this computer to see this app";
pub const APP_BLOCKED_APPROVAL_BUTTONS: &str = "This app was blocked: it shows approval buttons";
pub const APP_BLOCKED_UNDECLARED_SITES: &str =
"This app was blocked: it asks for sites it didn't declare";
pub const APP_BLOCKED_THIS_COMPUTER: &str = "This app was blocked: it asks to reach this computer";
pub const APP_BLOCKED_NOT_AN_APP: &str = "This app was blocked: it isn't an app this home can show";
pub const APP_CANT_BE_OPENED: &str = "This app can't be opened right now";
pub const APP_NEEDS_A_TOOL: &str = "This app needs a tool this home can't run yet";
pub const SEND_IT: &str = "Send it";
pub const MARKED_AS_SUGGESTED_BY_THE_APP: &str = "It will be marked as suggested by the app";
pub const OPEN: &str = "Open";
pub const SAVE: &str = "Save";
pub const APP_CALL_WAITS_FOR_YOU: &str = "Sent to the person. It runs only once they decide.";
pub const APP_CALL_SENT: &str = "Sent. It runs only if the person allows it.";
pub const APP_SERVER_DIDNT_ANSWER: &str = "The app's server didn't answer. Try again in a moment.";
pub fn app_from(app: &str) -> String {
format!("App from {app} · it can't approve anything")
}
pub fn app_in_the_terminal(app: &str) -> String {
format!("app from {app} · open it in the home")
}
pub fn app_cant_use(tool: &str) -> String {
format!("The app tried to use {tool}. Apps can't use it.")
}
pub fn app_wants_to_send(message: &str) -> String {
format!("The app wants to send: “{message}”")
}
pub fn open_site(host: &str) -> String {
format!("Open {host}?")
}
pub fn app_wants_to_save(app: &str, name: &str, bytes: usize) -> String {
let size = if bytes < 1024 {
format!("{bytes} bytes")
} else if bytes < 1024 * 1024 {
format!("{} KB", bytes.div_ceil(1024))
} else {
format!("{:.1} MB", bytes as f64 / (1024.0 * 1024.0))
};
format!("The {app} app wants to save {name} ({size})")
}
pub fn app_asked_enough(count: usize) -> String {
format!("The app already asked for {count} things. Answer those first.")
}
pub fn app_asked_at(hh_mm: &str) -> String {
format!("The app asked · {hh_mm}")
}
pub fn app_asked(app: &str, hh_mm: &str) -> String {
format!("The app from {app} asked · {hh_mm}")
}
pub fn from_the_app(app: &str) -> String {
format!("From the {app} app in this thread")
}
pub fn suggested_by_the_app(app: &str) -> String {
format!("Suggested by the {app} app")
}
pub fn commands_run(place: &crate::model::ShellPlace) -> String {
use crate::model::ShellPlace;
match place {
ShellPlace::Host => "Commands run on this computer".to_string(),
ShellPlace::Sandbox { enforcer: Some(enforcer) } => {
format!("Commands run in the sandbox ({})", enforcer_name(enforcer))
}
ShellPlace::Sandbox { enforcer: None } => "Commands run in the sandbox".to_string(),
ShellPlace::Container { image } => format!("Commands run in a container ({image})"),
ShellPlace::Remote { provider, off_host: true } => {
format!("Commands run in a remote sandbox ({provider})")
}
ShellPlace::Remote { provider, off_host: false } => {
format!("Commands run in a sandbox ({provider})")
}
ShellPlace::Degraded { reason, .. } => {
format!("The sandbox is unavailable, so commands run on this computer: {reason}")
}
}
}
fn enforcer_name(enforcer: &str) -> &str {
match enforcer {
"seatbelt" => "Seatbelt",
"bubblewrap" => "bubblewrap",
"landlock" => "Landlock",
other => other,
}
}
pub fn images_attached(count: usize) -> String {
if count == 1 { "1 image".to_string() } else { format!("{count} images") }
}
pub fn last_lines(shown: usize, total: usize) -> String {
format!("Showing the last {shown} lines of {total}.")
}
pub fn answers_line(
total: u32,
allowed_once: u32,
always_allowed: u32,
edited: u32,
denied: u32,
) -> String {
if total == 0 {
return "No answers this week.".to_string();
}
let parts: Vec<String> = [
(allowed_once, "allowed once"),
(always_allowed, "always allowed"),
(edited, "edited"),
(denied, "denied"),
]
.into_iter()
.filter(|(count, _)| *count > 0)
.map(|(count, what)| format!("{count} {what}"))
.collect();
let noun = if total == 1 { "answer" } else { "answers" };
format!("{total} {noun}: {}", parts.join(", "))
}
pub const THE_EXACT_IMAGE_THAT_WOULD_LEAVE: &str = "The exact image that would leave";
pub const THE_IMAGE_THAT_LEFT: &str = "The image that left";
pub const THE_IMAGE_THAT_WOULD_HAVE_LEFT: &str = "The image that would have left";
pub const ATTACHED_IMAGE: &str = "Attached image";
pub const ALL_OF_THE_IMAGE: &str = "100% of the image";
pub const NOTHING_COVERED: &str = "nothing covered";
pub const NOTHING_TO_SEND: &str = "Nothing to send.";
pub const EVERYTHING_IS_COVERED: &str = "Everything is covered.";
pub const IMAGE_DELETED: &str = "This image was deleted";
pub const IMAGE_DELETED_EARLY: &str =
"It was deleted before its time as evidence ran out, with what it was cut from.";
pub 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.";
pub 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.";
pub const SHOW_THE_IMAGE_IN_THE_HOME: &str =
"This screen can't show the image. Look at it in the home before you decide.";
pub const HELD_AGAIN_WITH_THE_NEW_IMAGE: &str = "held again with the new image";
pub const OPEN_THE_SOURCE_IMAGE: &str = "Open the source image";
pub fn the_images_that_would_leave(count: usize) -> String {
format!("The {count} images that would leave")
}
pub fn the_images_that_left(count: usize) -> String {
format!("The {count} images that left")
}
pub fn the_images_that_would_have_left(count: usize) -> String {
format!("The {count} images that would have left")
}
pub fn attached_images(count: usize) -> String {
format!("{count} attached images")
}
pub fn image_size(width: u32, height: u32, mime_type: &str) -> String {
let format = mime_type.strip_prefix("image/").unwrap_or(mime_type).to_ascii_uppercase();
format!("{width} × {height} {format}")
}
pub fn covered_class(class: crate::CoverClass, count: u32) -> String {
let one = count == 1;
match class {
crate::CoverClass::Face => format!("{count} face{}", if one { "" } else { "s" }),
crate::CoverClass::PersonalText => format!("{count} personal text"),
crate::CoverClass::SchemaField => {
format!("{count} field{} your schema marks personal", if one { "" } else { "s" })
}
crate::CoverClass::Marked => {
format!("{count} box{} you covered", if one { "" } else { "es" })
}
crate::CoverClass::Other => format!("{count} other region{}", if one { "" } else { "s" }),
}
}
pub fn region_tag(class: crate::CoverClass, label: &str) -> String {
match class {
crate::CoverClass::Face => match label {
"faces" | "face" => "face".to_string(),
_ => "face · whole person".to_string(),
},
crate::CoverClass::PersonalText => "personal text".to_string(),
crate::CoverClass::SchemaField => "schema field".to_string(),
crate::CoverClass::Marked => "your redaction".to_string(),
crate::CoverClass::Other => label.replace('_', " "),
}
}
pub fn region_short_tag(class: crate::CoverClass, label: &str) -> String {
match class {
crate::CoverClass::Face => "face".to_string(),
crate::CoverClass::PersonalText => "text".to_string(),
crate::CoverClass::SchemaField => "schema".to_string(),
crate::CoverClass::Marked => "yours".to_string(),
crate::CoverClass::Other => label.replace('_', " "),
}
}
pub fn in_images(which: &[usize]) -> String {
match which {
[one] => format!("in image {one}"),
[rest @ .., last] => {
let rest: Vec<String> = rest.iter().map(ToString::to_string).collect();
format!("in images {} and {last}", rest.join(", "))
}
[] => String::new(),
}
}
pub fn data_class(class: &str) -> String {
let spaced = class.replace(['_', '-'], " ");
let mut chars = spaced.chars();
match chars.next() {
Some(first) => first.to_uppercase().chain(chars).collect(),
None => String::new(),
}
}
pub fn data_class_many(class: &str, count: usize) -> String {
format!("{count} {}s", class.replace(['_', '-'], " "))
}
pub fn data_class_note(class: &str) -> Option<String> {
class.ends_with("_crop").then(|| "never the page".to_string())
}
pub fn money(micro_usd: u64) -> String {
if micro_usd >= 10_000 {
return dollars(micro_usd);
}
let hundredths = micro_usd.saturating_add(50) / 100;
format!("$0.{hundredths:04}")
}
pub fn up_to(micro_usd: u64) -> String {
format!("Up to {}", money(micro_usd))
}
pub fn up_to_if_sent(micro_usd: u64) -> String {
format!("Up to {} if sent", money(micro_usd))
}
pub fn kept_as_evidence_until(day: &str) -> String {
format!("Kept as evidence until {day}")
}
pub fn as_evidence_until(day: &str) -> String {
format!("As evidence until {day}")
}
pub fn image_deleted_on(day: &str) -> String {
format!("This image was deleted on {day}")
}
pub fn image_deleted_short(day: &str) -> String {
format!("Image deleted {day}")
}
pub fn image_deleted_step(day: &str) -> String {
format!("Image deleted on {day}")
}
pub fn evidence_kept_for(days: u32) -> String {
format!(
"Evidence is kept for {days} days. What it was, where it was going and what was covered stay on record."
)
}
pub fn nothing_to_send_purged(agent: &str) -> String {
format!(
"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."
)
}
pub fn everything_covered(provider: Option<&str>) -> String {
format!(
"{} would receive a black rectangle, so there is nothing to allow. Deny it; covering can't be undone here.",
provider.unwrap_or("The receiver")
)
}
pub const ALLOW_THIS_PLAN: &str = "Allow this plan";
pub 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.";
pub const LOOK_AT_THE_PLAN_IN_THE_HOME: &str =
"This screen can't show the whole plan. Look at it in the home before you allow it.";
pub 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.";
pub fn screen_plan_heading(steps: usize, window: &str) -> String {
format!("Run {steps} desktop actions in {window}")
}
pub fn screen_plan_chat_heading(steps: usize) -> String {
format!("Run {steps} desktop actions")
}
pub fn held_again_at(hh_mm: &str) -> String {
format!("You changed it at {hh_mm} · {HELD_AGAIN_WITH_THE_NEW_IMAGE}")
}
pub fn run_ended(minutes: i64, hh_mm: &str) -> String {
let unit = if minutes == 1 { "minute" } else { "minutes" };
format!("Waited {minutes} {unit}; the run ended at {hh_mm}")
}
pub fn stopped_waiting(agent: &str, hh_mm: &str) -> String {
format!(
"{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."
)
}
#[cfg(test)]
mod tests {
use super::*;
const ALL: &[&str] = &[
WORKING,
WAITING_FOR_YOU,
WAITING_FOR_AN_ANSWER,
ASLEEP,
DONE,
FAILED,
DECISIONS,
DECIDED,
QUESTION,
IS_THAT_RIGHT,
SUGGESTION,
DO_IT,
NOT_NOW,
WHILE_YOU_WERE_AWAY,
WHAT_YOUR_AGENTS_DID,
EVERY_ACTION_ON_RECORD,
WHAT_YOUR_AGENTS_REMEMBER,
YOU_SAID_THIS,
A_GUESS,
JUST_LOOK,
SUGGEST,
ASK_FIRST,
GO_AHEAD,
ALLOWED_WITHOUT_ASKING,
EXTEND,
STOP_ALLOWING,
QUIET_TIME,
DAILY_SPENDING_LIMIT,
AREAS,
WHERE_YOU_CAN_SAY_YES_FROM,
ADD_A_PHONE_OR_APP,
YOUR_AGENTS,
AGENTS_SUGGEST,
NOTICED_SOMETHING,
ALL_AGENTS_RESUMED,
ALLOW_ONCE,
ALWAYS_ALLOW_FOR_THIS_PERSON,
ALWAYS_ALLOW_FOR_THIS_FOLDER,
ALWAYS_ALLOW_FOR_THIS_COMMAND,
ALWAYS_ALLOW_FOR_THIS_SITE,
EDIT,
ANSWER,
LOOK_ALIKE_ADDRESS,
HIDDEN_HOST_ADDRESS,
UNENCRYPTED_ADDRESS,
DENY,
CONFIRM_ITS_YOU_AND_APPROVE,
TAKE_OVER,
TAKE_OVER_DONE,
STOP_ALL,
RESUME_ALL,
UNDO,
THATS_RIGHT,
FIX_IT,
FORGET_IT,
OPEN_IN_HOME,
LOW_RISK,
MEDIUM_RISK,
HIGH_RISK,
CANT_BE_UNSENT,
CANT_BE_UNDONE,
WAITED_THROUGH_QUIET_TIME,
ANSWERED_ELSEWHERE_UPDATES,
NEEDS_A_SCREEN,
APPROVE_IN_THE_HOME,
ENDED_WITHOUT_AN_ANSWER,
SENT_AFTER_THIS_CARD_IS_ANSWERED,
SENT_WHEN_YOUR_AGENT_IS_FREE,
YOU_SUGGESTED_THIS,
ALL_AGENTS_STOPPED,
ALL_AGENTS_STOPPED_RESUME_IN_HOME,
YOU_DECIDED,
A_DECISION_IS_WAITING,
OPEN_THE_APP_TO_SEE_IT,
YOUR_PHONE,
USE_YOUR_FACE_OR_FINGERPRINT,
USE_YOUR_FACE_OR_FINGERPRINT_ON_THIS_COMPUTER,
ALLOW_NOTIFICATIONS,
ADD_TO_HOME_SCREEN_FIRST,
APPROVE_IT_IN_THE_HOME,
LISTENING,
SPEAKING,
SAY_ALLOW_ONCE_OR_DENY,
SAY_DENY_OR_DECIDE_ON_SCREEN,
DECIDE_ON_SCREEN,
CANCEL,
END,
WHAT_IT_CAN_SEE,
VOICE_PRIVACY_NOTE,
SPOKEN_ANSWER_CANCELLED,
CHANGED_WHILE_YOU_SPOKE,
VOICE_CANT_APPROVE_THIS,
STOPPING_NEEDS_THE_OPERATOR,
APP_CALL_SENT,
APP_SERVER_DIDNT_ANSWER,
THE_EXACT_IMAGE_THAT_WOULD_LEAVE,
THE_IMAGE_THAT_LEFT,
THE_IMAGE_THAT_WOULD_HAVE_LEFT,
ATTACHED_IMAGE,
NOTHING_TO_SEND,
EVERYTHING_IS_COVERED,
IMAGE_DELETED,
IMAGE_DELETED_EARLY,
IMAGES_LEAVE_ONLY_COVERED,
LOOK_AT_THE_IMAGE_ON_A_SCREEN,
SHOW_THE_IMAGE_IN_THE_HOME,
OPEN_THE_SOURCE_IMAGE,
ALLOW_THIS_PLAN,
SCREEN_PLAN_DETAIL,
LOOK_AT_THE_PLAN_IN_THE_HOME,
STOP_ALL_CLOSED_THE_PLAN,
];
#[test]
fn every_word_is_sentence_case() {
for word in ALL {
let first = word.chars().next().unwrap();
assert!(first.is_uppercase(), "{word:?} starts lower case");
for token in word.split_whitespace() {
let letters: Vec<char> = token.chars().filter(|c| c.is_alphabetic()).collect();
assert!(
letters.len() < 2 || letters.iter().any(|c| c.is_lowercase()),
"{word:?} has an all-caps word"
);
}
}
}
#[test]
fn the_spec_terms_are_exact() {
assert_eq!(
[JUST_LOOK, SUGGEST, ASK_FIRST, GO_AHEAD],
["Just look", "Suggest", "Ask first", "Go ahead"]
);
assert_eq!(
said(None, SaidWhat::Yes, Some("in Telegram"), "07:31"),
"You said yes in Telegram at 07:31"
);
assert_eq!(
also_shown(&[ON_YOUR_PHONE.into(), in_channel("Telegram")]).unwrap(),
"Also on your phone and in Telegram"
);
assert_eq!(spent_of(1_840_000, 5_000_000), "$1.84 of $5.00 today");
}
}