{
  "id": "daily-digest",
  "name": "Daily Digest",
  "category": "automation",
  "tags": [
    "digest",
    "automation",
    "daily",
    "summary",
    "morning",
    "briefing"
  ],
  "description": "Compile a 7AM digest: weather, calendar, unread email count, top news, BTC price. Asks the agent to phrase it conversationally and shows the result.",
  "triggers": [
    "daily digest",
    "morning briefing",
    "daily summary",
    "morning report",
    "daily report",
    "digest"
  ],
  "defaultSize": {
    "w": 5,
    "h": 5
  },
  "source": "function DailyDigest() {\n  const [city, setCity] = React.useState('REPLACE_WITH_CITY');\n  const [text, setText] = React.useState('');\n  const [loading, setLoading] = React.useState(false);\n  const [autoTime, setAutoTime] = React.useState('07:00');\n  const compile = async () => {\n    setLoading(true);\n    try {\n      const r = await titan.api.call('/api/message', { content: `Compile my daily briefing for ${new Date().toLocaleDateString()}.\\n\\nInclude: weather in ${city}, today's calendar, unread email count, top 3 news headlines, BTC + ETH price. Tone: warm, concise, like a good morning text from a thoughtful assistant. Plain text only, no markdown.` });\n      setText(r?.body?.content || r?.content || r?.body?.text || r?.text || JSON.stringify(r));\n    } catch (e) { setText('Error: ' + (e?.message||e)); }\n    finally { setLoading(false); }\n  };\n  React.useEffect(() => {\n    const check = () => {\n      const now = new Date();\n      const hh = String(now.getHours()).padStart(2,'0');\n      const mm = String(now.getMinutes()).padStart(2,'0');\n      if (`${hh}:${mm}` === autoTime) compile();\n    };\n    const id = setInterval(check, 60000);\n    return () => clearInterval(id);\n  }, [autoTime, city]);\n  return (\n    <div style={{padding:14,fontFamily:'system-ui',height:'100%',display:'flex',flexDirection:'column',gap:10}}>\n      <div style={{display:'flex',gap:6}}>\n        <input value={city} onChange={e=>setCity(e.target.value)} placeholder=\"City\" style={{flex:1,padding:'6px 10px',border:'1px solid #ccc',borderRadius:6,fontSize:13}}/>\n        <input type=\"time\" value={autoTime} onChange={e=>setAutoTime(e.target.value)} style={{padding:'6px 10px',border:'1px solid #ccc',borderRadius:6,fontSize:13}}/>\n        <button onClick={compile} disabled={loading} style={{padding:'6px 14px',border:'none',borderRadius:6,background:'#007AFF',color:'#fff',cursor:loading?'wait':'pointer',fontWeight:600}}>{loading?'Compiling\u2026':'Run Now'}</button>\n      </div>\n      <div style={{fontSize:11,color:'#888'}}>Auto-runs at {autoTime} local. Manual run anytime.</div>\n      <div style={{flex:1,overflow:'auto',padding:14,background:'linear-gradient(135deg,#FFF7E6,#FFE4D4)',borderRadius:12,fontSize:14,lineHeight:1.6,whiteSpace:'pre-wrap'}}>\n        {loading ? '\u2728 Composing your briefing\u2026' : (text || `Tap Run Now to generate your morning briefing.`)}\n      </div>\n    </div>\n  );\n}\nrender(<DailyDigest/>);",
  "placeholders": [
    {
      "name": "REPLACE_WITH_CITY",
      "description": "City for weather",
      "default": "San Francisco"
    }
  ]
}
