"""Per-widget documentation details for library/build.py: when to offer each one, where
every block's real value comes from, the exact questions and phone actions, and edge cases."""

EXTRA = {
"smart-todo": dict(
  tags=['todo', 'to do', 'tasks', 'list', 'remind', 'forget', 'errands', 'chores', 'routine', 'daily', 'habits', 'organize', 'smart', 'intelligent', 'location', 'context'],
  knobs=["Daily routines (morning and evening)", "Work hours and which places count as work", "What the agent may do on its own after a yes (book, order, reply)", "Items per version (5 at most)"],
  when="Any user. The best first widget for someone who says \"I keep forgetting things\", \"organise my day\" or \"make me a to-do list\". It gets better the more they tell it.",
  fields={0: "Leave as `count: \"checked\"`; it counts ticks in the version on screen. Put the why of each version in its `subtitle` (\"3 only you can do\", \"Near you\").", 1: "At most 5 items for this context, most important first, short verb-first titles with the deadline or place in brackets.", 2: "Keep ids `tell` and `handle`."},
  ask_json={"question": "When is the rent due?", "kind": "choice", "options": ["This Friday", "1st of the month", "Other"], "risk": "low"},
  phone_json={"kind": "reminder", "params": {"title": "Pay rent", "due": "2026-10-30T09:00:00-04:00"}},
  edge=["The user has no saved places: put everything in the base version and the morning/evening versions; ask once if they'd like work and home set up in Droplet.ai, Settings, Places.", "Everything is done: show \"All done here\" and the next context's first item in the note.", "The user ticks something you added by mistake: remove it on the next rewrite and remember not to add it again.", "Two agents: only yours is your list; never copy another agent's items."]),
"leave-by": dict(
  tags=['commute', 'leave', 'late', 'miss', 'missing', 'on time', 'train', 'bus', 'subway', 'uber', 'ride', 'appointment', 'traffic', 'directions', 'travel time', 'map'], knobs=['Buffer before leaving (default 5 min)', 'How they get there: ride, subway, walk, drive'],
  when="The user has places to be: appointments, school runs, meetings across town. Offer it when the calendar has events with locations.",
  fields={0: "The next event's title and start time (calendar); also put \"Name · 3:00\" in the widget subtitle, which large shows instead.", 1: "`to` = leave-by time: start minus travel time minus 5 min, with the phone's UTC offset.", 2: "The event's address, geocoded (lat, lon); label = street address. Never coordinates as text.", 3: "Keep the ids `ride` and `late`."},
  ask_json={"question": "Book an Uber to Dr. Lee, $24, pickup 2:32?", "kind": "decision", "options": ["Book it", "Not now"], "risk": "medium"},
  phone_json=None,
  edge=["No upcoming event has a location: show the next one without the map and with only `late`, or say 'Nothing to leave for today' with a calendar link.", "The event is in under 10 minutes: change the countdown label to 'Leave now'.", "The user is already there (place matches): switch to the following event."]),
"approvals": dict(
  tags=['approve', 'deploy', 'human in the loop', 'permission', 'ok', 'confirm', 'release', 'production', 'agent'], knobs=['What needs approval: deploys, emails, payments, deletes', 'Show the last N actions on large'],
  when="The user runs a coding or ops agent that deploys, migrates, sends or spends. Offer it right after they say approvals should go to the phone.",
  fields={0: "The strongest evidence it's safe: tests passed / total, or the build state.", 1: "The exact action in under 35 characters: what and how big.", 2: "Keep ids `approve` and `hold`; the first label names the action ('Deploy', 'Run migration', 'Send').", 3: "The last 2-4 consequential actions with when."},
  ask_json={"question": "Charge the team card $480 for 12 seats?", "kind": "decision", "options": ["Pay $480", "Don't"], "risk": "high"},
  phone_json=None,
  edge=["Nothing pending: show the last result ('v2.4 is live') and remove the buttons until the next step.", "The plan changed after the tap (new commits): don't deploy; show the new state and ask again.", "Several actions queue up: show the first, with 'Then: 2 more' in the text."]),
"ship-status": dict(
  tags=['ci', 'build', 'tests', 'github', 'pull request', 'deploy', 'broken', 'main', 'code'], knobs=['Which repo and branch', 'Which buttons: fix, re-run, revert'],
  when="The user has a repository with CI. Offer it to developers who ask 'is main green?' or get pinged about broken builds.",
  fields={0: "`value` Passing or Failing, `trend` up when green, down when red.", 1: "The first failing test and its cause in under 35 characters, or 'All checks passed'.", 2: "Keep ids `fix`, `rerun`, `revert`; drop `revert` when green.", 3: "The last 2-3 runs: short sha + message, detail = passed or failed."},
  ask_json={"question": "Revert a41c9 on main?", "kind": "decision", "options": ["Revert it", "Keep it"], "risk": "high"},
  phone_json=None,
  edge=["Green: replace the buttons with a link button to the latest deploy.", "Flaky test (passes on re-run): say so in the text after `rerun`.", "No CI access: tell the user what you need instead of showing a stale state."]),
"inbox-zero": dict(
  tags=['email', 'inbox', 'reply', 'gmail', 'outlook', 'messages', 'drafts', 'triage'], knobs=['Which inboxes and senders count', 'Work only or everything'],
  when="The user's agent can read their email and they complain about their inbox or ask for replies.",
  fields={0: "How many threads need them (from real people, asking something).", 1: "Sender, the ask in a few words, and 'Reply ready' (keep it under 40 characters).", 2: "Keep ids `send`, `next`, `snooze`.", 3: "The other waiting threads: sender + subject, detail = how long ago."},
  ask_json={"question": "Send this reply to the landlord?", "details": "Hi Sam, we'd like to renew for 12 months at the same rent. Can you send the lease?", "kind": "decision", "options": ["Send", "Not yet"], "risk": "medium"},
  phone_json=None,
  edge=["Nothing waiting: '0' with 'Inbox clear' and no buttons.", "The draft would commit money or a date far out: use the droplet_ask above (full draft in details) instead of the one-tap send.", "The user replied from their laptop meanwhile: drop that thread on the next refresh."]),
"meeting-prep": dict(
  tags=['meeting', 'prep', 'calendar', 'notes', 'agenda', 'zoom', 'google meet', 'standup'], knobs=['How long before the meeting to switch', 'Which calendars'],
  when="The user has back-to-back meetings and an agent with calendar plus email or docs.",
  fields={0: "The next meeting's title; value = its start time.", 1: "The one decision or ask, under 35 characters.", 2: "`join` url = the real video link (https); keep id `late`.", 3: "Up to 3 prep notes, each one line."},
  ask_json={"question": "Tell the 4 attendees you're 5 min late?", "kind": "decision", "options": ["Send", "Don't"], "risk": "medium"},
  phone_json=None,
  edge=["No video link: drop the Join button.", "Back-to-back: switch to the next meeting the minute one ends.", "Private meetings (1:1 with a doctor): set `private: true` or skip them."]),
"agent-at-work": dict(
  tags=['progress', 'research', 'long task', 'status', 'report', 'running', 'job'], knobs=['What counts as a step', 'Where the result goes'],
  when="The agent is about to run something long (research, a refactor, a report) and the user will walk away.",
  fields={0: "Progress as done/total in your own units.", 1: "The most important finding so far, under 30 characters.", 2: "Keep ids `summary`, `deeper`, `stop`.", 3: "Overall progress 0-1.", 4: "Top findings so far."},
  ask_json={"question": "Dig deeper into what?", "kind": "choice", "options": ["Acme's pricing", "Bolt's free tier", "All AI add-ons"], "risk": "low"},
  phone_json=None,
  edge=["Finished: replace the progress with the result and a link button to the full report.", "Blocked: say what you need in the text and ask with droplet_ask.", "Never leave 'Working…' for hours; show the last real state."]),
"schedule-clash": dict(
  tags=['calendar', 'clash', 'conflict', 'overlap', 'meeting', 'reschedule', 'move', 'invite'], knobs=["Meetings that must never move", "Working hours"],
  when="A new invite overlaps something, or tomorrow's calendar has a clash.",
  fields={0: "How long the overlap is.", 1: "Which two things, and the fix you found.", 2: "Move names the person; Decline and Keep are the alternatives.", 3: "The two meetings."},
  ask_json={"question": "Decline the design review? 6 people are going.", "kind": "decision", "options": ["Decline", "Keep it"], "risk": "medium"},
  phone_json=None,
  edge=["No time works for both: offer the two least bad options instead.", "You can't see other people's calendars: say so, and offer to ask them."]),
"early-start": dict(
  tags=['alarm', 'morning', 'wake', 'early', 'tomorrow', 'bedtime', 'calendar'], knobs=["How long they need in the morning", "Earliest and latest alarm"],
  when="Tomorrow starts earlier than usual and Alarms is on in Phone access.",
  fields={0: "Tomorrow's first commitment.", 1: "What it is, and the alarm time you worked out.", 2: "Set names the time; the other declines.", 3: "What's ready for tomorrow."},
  ask_json=None,
  phone_json={"kind": "alarm", "params": {"time": "06:45", "label": "Board prep at 8:00"}},
  edge=["Alarms is off: ask once if they'd like it on, or offer a reminder.", "They already have an alarm early enough: show nothing."]),
"only-you": dict(
  tags=['blocked', 'stuck', 'login', 'sign in', 'agreement', 'captcha', 'human', 'handoff', 'needs you', 'waiting', '2fa'], knobs=["What the agent may do by itself", "When to remind them"],
  when="You're blocked on something only a person can do. Offer it on any long task.",
  fields={0: "Leave as count checked: it counts ticks.", 1: "Each human-only step, in plain words, in order.", 2: "Carry on resumes the work; the other waits until tomorrow."},
  ask_json=None,
  phone_json={"kind": "notify", "params": {"title": "Your agent needs you", "body": "3 things only you can do"}},
  edge=["They tick without doing it: check it really worked, then say what's still missing.", "Everything is cleared: switch back to progress at once."]),
"your-call": dict(
  tags=['decision', 'fork', 'options', 'approach', 'choose', 'pick', 'direction', 'tradeoff', 'blocked'], knobs=["How often to stop and ask", "What they'd rather you decide alone"],
  when="You've reached a decision that changes the result and is the user's to make.",
  fields={0: "Your pick, in a word or two.", 1: "The tradeoff in one line.", 2: "Two or three options, no symbols, about 10 characters each.", 3: "What each option means."},
  ask_json={"question": "Rewrite the session code? It takes about 2 days.", "kind": "decision", "options": ["Rewrite", "Patch for now"], "risk": "low"},
  phone_json=None,
  edge=["Only one sensible option: don't ask, do it and report.", "They don't answer: carry on with whatever doesn't depend on it."]),
"pr-review": dict(
  tags=['pr', 'pull request', 'review', 'merge', 'github', 'code review', 'diff'], knobs=["Which repos", "What counts as low risk", "Merge method"],
  when="The user reviews pull requests, or their agents open them.",
  fields={0: "Your honest risk call.", 1: "What changed and your verdict, in one line.", 2: "Merge, ask for changes, or move on.", 3: "The rest of the queue, with risk."},
  ask_json={"question": "Merge #220? It changes how sessions work.", "kind": "decision", "options": ["Merge", "Hold"], "risk": "high"},
  phone_json=None,
  edge=["CI is still running: say so and hold the Merge button back.", "The queue is empty: show the last merge or go back to your normal widget."]),
"incident": dict(
  tags=['incident', 'production', 'outage', 'errors', 'alert', 'on call', 'sentry', 'rollback', 'down'], knobs=["What counts as an incident", "Quiet hours, if any"],
  when="The user has something in production and you can read its errors or logs.",
  fields={0: "The number that shows how bad it is.", 1: "Where, since when, and whether rollback is safe.", 2: "Roll back, investigate or ignore.", 3: "What you found."},
  ask_json={"question": "Roll back past migration 042? New signups since 14:02 would be lost.", "kind": "decision", "options": ["Roll back", "Don't"], "risk": "high"},
  phone_json={"kind": "notify", "params": {"title": "Errors up 6x on checkout", "body": "Started with the 14:02 deploy"}},
  edge=["It clears by itself: show 'Back to normal' and what happened.", "You don't know the cause yet: say that, and take Roll back off the widget."]),
"overnight": dict(
  tags=['overnight', 'morning', 'summary', 'report', 'scheduled', 'routine', 'nightly', 'cron', 'digest'], knobs=["Which jobs to include", "What time to report"],
  when="The user runs agents or jobs on a schedule.",
  fields={0: "How many things finished.", 1: "The state in a line, and what needs them.", 2: "Show me opens what needs them; All good clears it.", 3: "What ran, with real results."},
  ask_json=None,
  phone_json=None,
  edge=["Nothing ran: say so plainly, because that may be the problem.", "Everything's fine and nothing needs them: keep it small, or show nothing."]),
"pick-a-time": dict(
  tags=['schedule', 'meeting', 'time', 'availability', 'calendar', 'invite', 'email', 'book'], knobs=["Working hours", "Focus time to protect", "Meeting length"],
  when="Someone asks to meet, by email or message.",
  fields={0: "How many times work.", 1: "Who and what it's about.", 2: "Up to three times, no symbols, about 10 characters each.", 3: "Why each time works."},
  ask_json={"question": "Send this time to someone you haven't written to before?", "kind": "decision", "options": ["Send", "Not now"], "risk": "medium"},
  phone_json={"kind": "event", "params": {"title": "Sam: contract", "start": "2026-11-03T14:00:00+03:00", "end": "2026-11-03T14:30:00+03:00"}},
  edge=["No time works: say so and offer next week.", "The other person changed their mind: clear it and go back to your normal widget."]),
"follow-up": dict(
  tags=['follow up', 'nudge', 'waiting', 'no reply', 'email', 'slack', 'chase', 'remind'], knobs=["How long to wait before nudging", "People never to nudge"],
  when="The user sends requests and things slip when people don't answer.",
  fields={0: "How long they've waited.", 1: "What was asked. The nudge is ready.", 2: "Send, wait or drop.", 3: "The exact text of the nudge."},
  ask_json={"question": "Nudge Sam a second time this week?", "kind": "decision", "options": ["Send", "Wait"], "risk": "low"},
  phone_json=None,
  edge=["They replied in the meantime: drop it and move on.", "The thread is sensitive: ask them to write it instead."]),
"spend-ok": dict(
  tags=['money', 'spend', 'purchase', 'pay', 'approve', 'credit', 'top up', 'budget', 'buy'], knobs=["Monthly limit", "Which sellers are fine"],
  when="You're about to pay for something, or a paid service you rely on runs out.",
  fields={0: "The exact amount.", 1: "What runs out, and what stops if the answer is no.", 2: "Pay names the amount.", 3: "What's been spent this month."},
  ask_json={"question": "Pay OpenAI $20 from the saved card?", "kind": "decision", "options": ["Pay $20", "Don't"], "risk": "high"},
  phone_json=None,
  edge=["Payment needs a card they haven't saved: turn this into Only you can do.", "The price changed: ask again with the new amount."]),
"bill-guard": dict(
  tags=['renewal', 'subscription', 'cancel', 'bill', 'charge', 'money', 'receipt'], knobs=["How many days before to warn", "Subscriptions to ignore"],
  when="You can read their receipts and something renews soon that looks unused.",
  fields={0: "What it'll charge.", 1: "When, and the sign you saw that it's unused.", 2: "Cancel or keep.", 3: "How cancelling works."},
  ask_json={"question": "Close the Figma team too? This can't be undone.", "kind": "decision", "options": ["Close it", "Just cancel"], "risk": "high"},
  phone_json=None,
  edge=["You can't tell whether they use it: say that.", "Cancelling needs their sign-in: turn this into Only you can do."]),
"usage-spike": dict(
  tags=['usage', 'billing', 'cost', 'cloud', 'api', 'spike', 'vercel', 'aws', 'invoice'], knobs=["What counts as unusual", "Which accounts"],
  when="The user pays for hosting, cloud or API usage and you can read it.",
  fields={0: "Today's cost.", 1: "The cause, and the fix.", 2: "Fix it, investigate, or leave it.", 3: "Where the money's going."},
  ask_json={"question": "Deploy a rate limit to /api/search?", "kind": "decision", "options": ["Deploy", "Hold"], "risk": "medium"},
  phone_json=None,
  edge=["It's real growth, not a problem: say so, it's good news.", "You can't find the cause: say what you ruled out."]),
"news-brief": dict(
  tags=['news', 'social', 'feed', 'headlines', 'rss', 'posts', 'reading', 'industry', 'competitors'], knobs=["Topics and sources", "What their work is, so you can judge what matters"],
  when="Something in their field changes what they should do, or they ask you to watch a topic.",
  fields={0: "What it touches: their app, their team, their money.", 1: "The story, and how it affects them.", 2: "What to do, a summary, or the next one.", 3: "Up to two more that are worth it."},
  ask_json=None,
  phone_json=None,
  edge=["Nothing matters today: show nothing, or go back to your normal widget.", "It's urgent for them: make it your top moment."]),
"mention-reply": dict(
  tags=['social', 'mentions', 'twitter', 'x', 'reply', 'community', 'discord', 'post', 'draft'], knobs=["Which accounts", "Their tone of voice", "Who's worth replying to"],
  when="The user has a public presence and you can read and post for them.",
  fields={0: "Why this person is worth a reply.", 1: "What they asked, and your draft.", 2: "Post or skip.", 3: "What else is waiting."},
  ask_json={"question": "This one's angry. Post the draft anyway?", "kind": "decision", "options": ["Post", "Skip"], "risk": "medium"},
  phone_json=None,
  edge=["It's a complaint: bring it to them with a draft, and don't post from a single tap.", "The draft is long: put it on the large size, and ask first on medium."]),
"gym-session": dict(
  tags=['gym', 'workout', 'sets', 'reps', 'training', 'exercise', 'fitness', 'rest timer'], knobs=['Training days', 'Rest timer length', 'Program'],
  when="The user trains with a program. Offer a version that only shows at the gym (place) or on training days.",
  fields={0: "Leave as `count: \"checked\"`.", 1: "Today's exercises with sets × reps @ weight, progressed from the last session.", 2: "Keep ids `rest` and `log`."},
  ask_json={"question": "Which days do you train?", "kind": "choice", "options": ["Mon Wed Fri", "Tue Thu Sat", "Every weekday"], "risk": "low"},
  phone_json={"kind": "timer", "params": {"seconds": 90, "label": "Rest"}},
  edge=["Rest day: a version that shows the next session instead.", "They skip an exercise: don't progress its weight next time.", "No 'timers' in the phone's can list: leave out `rest`."]),
"grocery-run": dict(
  tags=['groceries', 'shopping', 'list', 'supermarket', 'food', 'out of', 'order', 'delivery'], knobs=['Weekly usuals', 'Which store or delivery app'],
  when="The user mentions running out of things, plans meals, or shops weekly.",
  fields={0: "Leave as `count: \"checked\"`; Droplet.ai counts the ticks.", 1: "Up to 8 items, most important first; quantities in the title ('Eggs (12)').", 2: "Keep ids `order` and `add`."},
  ask_json={"question": "Order 4 items, $31.40, delivery 6-7 PM?", "kind": "decision", "options": ["Order", "Not now"], "risk": "medium"},
  phone_json=None,
  edge=["More than 8 items: put the rest in your memory and add them as items get ticked.", "Everything ticked: show 'All done' and offer `add` for next time; send the next list with reset_checklists: true.", "No grocery app access: leave out `order`."]),
"travel-day": dict(
  tags=['flight', 'airport', 'travel', 'trip', 'boarding', 'gate', 'check in', 'train'], knobs=['Airport buffer', 'Wake-up alarm'],
  when="The user has a flight or train booking in their email.",
  fields={0: "The gate (or 'TBA').", 1: "Boarding time and status in under 25 characters.", 2: "`checkin` url = the airline's check-in page; keep id `ride` with the pickup time in the label.", 3: "The plan: leave time, alarm, seat, bags."},
  ask_json={"question": "Book an Uber to JFK, $58, pickup 5:45?", "kind": "decision", "options": ["Book it", "I'll drive"], "risk": "medium"},
  phone_json={"kind": "alarm", "params": {"time": "05:00", "label": "Flight to SFO"}},
  edge=["Delay: update the times and the leave time; notify only if they asked.", "Gate change: update at once.", "After landing: switch to the hotel/next plan or clear it."]),
"day-brief": dict(
  tags=['today', 'morning', 'brief', 'schedule', 'calendar', 'sleep', 'health', 'information', 'glance', 'evening', 'tomorrow'], knobs=["What to lead with", "When the day starts and ends for them"],
  when="Any user. A strong first widget, once Calendar is on in Phone access.",
  fields={0: "The next thing that matters, as a time or number.", 1: "Your read of the day, in one sentence, with the reason.", 2: "What's left today, three rows at most."},
  ask_json=None, phone_json=None,
  edge=["An empty day: say so, it's good news.", "Health is off: leave sleep out, and don't mention it."]),
"here-now": dict(
  tags=['location', 'place', 'home', 'work', 'nearby', 'information', 'glance', 'context', 'where'], knobs=["Which places matter", "What's useful in each one"],
  when="The user has saved places, or does different things in different places.",
  fields={0: "The one number or time that matters at this place.", 1: "Why it matters, in a sentence.", 2: "What's useful here, a few rows."},
  ask_json={"question": "Which places should this change for?", "kind": "choice", "options": ["Home and work", "Add the gym", "Everywhere"], "risk": "low"},
  phone_json=None,
  edge=["No saved places: ask them to save Home and Work in Droplet.ai, Settings.", "Location is off: use the time of day versions only."]),
"smart-buttons": dict(
  tags=['buttons', 'controls', 'actions', 'shortcuts', 'dynamic', 'launcher', 'quick actions', 'join', 'control'], knobs=["What they do at each place and time", "Their Shortcut names", "Who to tell when running late"],
  when="The user keeps doing the same few things at certain times and places.",
  fields={0: "The time or number that explains the moment.", 1: "One short line on what's next.", 2: "Up to three actions. Those with a url run with no agent; the rest need your listener.", 3: "Why these buttons, right now."},
  ask_json={"question": "Tell Sam you're 10 minutes late?", "kind": "decision", "options": ["Tell Sam", "Don't"], "risk": "low"},
  phone_json={"kind": "alarm", "params": {"time": "06:45", "label": "Board prep at 8:00"}},
  edge=["You have no listener running: only use buttons with a url or a phone action.", "A button no longer applies: remove it, and don't leave it there greyed out."]),
"meeting-controls": dict(
  tags=['meeting', 'call', 'join', 'zoom', 'meet', 'recap', 'late', 'controls', 'event'], knobs=["How early to show it", "Who gets the recap"],
  when="The user has video calls or meetings often.",
  fields={0: "When it starts.", 1: "Where.", 2: "Before it: Join, I'm late, Agenda. After it: Send recap, Add tasks, Done.", 3: "What happens next."},
  ask_json={"question": "Send this recap to all 6 people?", "kind": "decision", "options": ["Send", "Just me"], "risk": "medium"},
  phone_json=None,
  edge=["No link in the event: replace Join with the room or a map.", "Back-to-back meetings: move straight on to the next one."]),
"home-scenes": dict(
  tags=['home', 'smart home', 'lights', 'scenes', 'shortcuts', 'bedtime', 'controls', 'homekit'], knobs=["Their Shortcut names", "Their morning and evening times"],
  when="The user has HomeKit or Shortcuts they run often.",
  fields={0: "The number that frames the moment.", 1: "One short line of context.", 2: "Up to three Shortcuts for this time of day, as url buttons.", 3: "What's coming up."},
  ask_json={"question": "What are your Shortcuts called?", "kind": "input", "risk": "low"},
  phone_json=None,
  edge=["No Shortcuts yet: offer to walk them through making one.", "They're away: this widget has nothing to show, so use another moment."]),
"release-room": dict(
  tags=['release', 'deploy', 'rollout', 'dashboard', 'gui', 'mini app', 'control panel', 'canary', 'project'], knobs=["The rollout steps", "Which numbers matter", "When to stop by itself"],
  when="A big job with several steps and numbers: a release, a migration, a launch.",
  fields={0: "How far along.", 1: "Whether it's safe, and the next step.", 2: "The next step, hold, or back out.", 3: "The trend of the number that matters.", 4: "The steps left."},
  ask_json={"question": "Go to 100% of users?", "kind": "decision", "options": ["Go", "Hold at 50%"], "risk": "high"},
  phone_json={"kind": "notify", "params": {"title": "v2.4: errors rising", "body": "Rollout held at 50%"}},
  edge=["The numbers go wrong: hold on your own and say so. Stopping is always safe.", "It's finished: show the result once, then remove it."]),
}
