heyhank 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/assets/{AgentsPage-B-AAmsMK.js → AgentsPage-DqjDAcIw.js} +1 -1
  2. package/dist/assets/{AssistantPage-BV1Mfwdt.js → AssistantPage-C50CQFSB.js} +1 -1
  3. package/dist/assets/{BusinessPage-tLpNEz19.js → BusinessPage-AY70tf1k.js} +1 -1
  4. package/dist/assets/{CronManager-B-K_n3Jg.js → CronManager-Dt7LLuRr.js} +1 -1
  5. package/dist/assets/{HelpPage-Bhf_j6Xr.js → HelpPage-tlGx7fQF.js} +1 -1
  6. package/dist/assets/{IntegrationsPage-DAMjs9tM.js → IntegrationsPage-B4XOuHXu.js} +1 -1
  7. package/dist/assets/{JarvisHUD-C_TGXCCn.js → JarvisHUD-BDvuRd0I.js} +1 -1
  8. package/dist/assets/{MediaPage-C48HTTrt.js → MediaPage-CofV9Rd-.js} +1 -1
  9. package/dist/assets/{MemoryPage-JkC-qtgp.js → MemoryPage-Cj7FeqmJ.js} +1 -1
  10. package/dist/assets/{PlatformDashboard-AUo7tNnE.js → PlatformDashboard-B9kXAlH1.js} +1 -1
  11. package/dist/assets/{Playground-AzNMsRBL.js → Playground-Cka-pRkP.js} +1 -1
  12. package/dist/assets/{ProcessPanel-DpE_2sX3.js → ProcessPanel-BqhQgfYj.js} +1 -1
  13. package/dist/assets/{PromptsPage-C2RQOs6p.js → PromptsPage-VveKc9uX.js} +1 -1
  14. package/dist/assets/RunsPage-DXVEk0AZ.js +1 -0
  15. package/dist/assets/{SandboxManager-jHvYjwfh.js → SandboxManager-DACcwfDF.js} +1 -1
  16. package/dist/assets/{SettingsPage-BBJax6gt.js → SettingsPage-jfuQh8Tu.js} +1 -1
  17. package/dist/assets/{SkillsMarketplace-IjmjfdjD.js → SkillsMarketplace-DrigiApe.js} +1 -1
  18. package/dist/assets/{SocialMediaPage-DoPZHhr2.js → SocialMediaPage-DOh3IPe8.js} +1 -1
  19. package/dist/assets/{TailscalePage-DDEY7ckO.js → TailscalePage-DLhJWATT.js} +1 -1
  20. package/dist/assets/{TelephonyPage-OPNBZYKt.js → TelephonyPage-9C4C3_ot.js} +1 -1
  21. package/dist/assets/{TerminalPage-BjMbHHW3.js → TerminalPage-ChX-8Wu7.js} +1 -1
  22. package/dist/assets/index-C6Q5UQHD.js +229 -0
  23. package/dist/assets/index-ZxGXgiV3.css +32 -0
  24. package/dist/assets/sw-register-BBYuk-kw.js +1 -0
  25. package/dist/assets/workbox-window.prod.es5-BBnX5xw4.js +2 -0
  26. package/dist/index.html +2 -2
  27. package/dist/sw.js +1 -1
  28. package/dist/{workbox-d2a0910a.js → workbox-080c8b91.js} +1 -1
  29. package/package.json +1 -1
  30. package/server/agent-executor.ts +65 -0
  31. package/server/execution-store.ts +54 -1
  32. package/server/routes/agent-routes.ts +42 -0
  33. package/dist/assets/RunsPage-B9UOyO79.js +0 -1
  34. package/dist/assets/index-BgYM4wXw.js +0 -205
  35. package/dist/assets/index-BkjSoVgn.css +0 -32
  36. package/dist/assets/sw-register-C7NOHtIu.js +0 -1
  37. package/dist/assets/workbox-window.prod.es5-BIl4cyR9.js +0 -2
@@ -1 +1 @@
1
- import{r as a,b as j,j as e,B as _,E as B,H as U,I as Y,F as q}from"./index-BgYM4wXw.js";import{t as z}from"./time-ago-B6r_l9u1.js";function W(s,p,c=!0){a.useEffect(()=>{if(!c)return;function d(o){s.some(m=>m.current&&m.current.contains(o.target))||p()}return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[s,p,c])}function J(s){const p=s-Date.now();if(p<=0)return"now";const c=Math.floor(p/6e4);if(c<60)return`in ${c}m`;const d=Math.floor(c/60);return d<24?`in ${d}h`:`in ${Math.floor(d/24)}d`}function F(s,p){if(!p)return"One-time";const c=s.trim().split(/\s+/);if(c.length!==5)return s;const[d,o,g,m,x]=c;if(s==="* * * * *")return"Every minute";if(o==="*"&&g==="*"&&m==="*"&&x==="*"&&d.startsWith("*/")){const l=parseInt(d.slice(2),10);return l===1?"Every minute":`Every ${l} minutes`}if(d==="0"&&g==="*"&&m==="*"&&x==="*"){if(o==="*")return"Every hour";if(o.startsWith("*/")){const l=parseInt(o.slice(2),10);return l===1?"Every hour":`Every ${l} hours`}}if(g==="*"&&m==="*"&&d!=="*"&&o!=="*"&&!o.includes("/")&&!o.includes(",")){const l=parseInt(o,10),y=parseInt(d,10);if(!isNaN(l)&&!isNaN(y)){const u=l>=12?"PM":"AM",w=l===0?12:l>12?l-12:l,r=y.toString().padStart(2,"0"),v=`${w}:${r} ${u}`;if(x==="*")return`Every day at ${v}`;if(x==="1-5")return`Weekdays at ${v}`;if(x==="0,6")return`Weekends at ${v}`}}return s}const $={name:"",prompt:"",recurring:!0,schedule:"0 8 * * *",oneTimeDate:"",backendType:"claude",model:B("claude"),cwd:""},G=[{label:"Every hour",value:"0 * * * *"},{label:"Every day at 8am",value:"0 8 * * *"},{label:"Every 2 hours",value:"0 */2 * * *"},{label:"Weekdays at 9am",value:"0 9 * * 1-5"}];function ee({onClose:s,embedded:p=!1}){const[c,d]=a.useState([]),[o,g]=a.useState(!0),[m,x]=a.useState(""),[l,y]=a.useState(null),[u,w]=a.useState($),[r,v]=a.useState($),[h,E]=a.useState(!1),[f,S]=a.useState(!1),[k,M]=a.useState(new Set),n=a.useCallback(()=>{j.listCronJobs().then(d).catch(()=>{}).finally(()=>g(!1))},[]);a.useEffect(()=>{n();const t=setInterval(n,1e4);return()=>clearInterval(t)},[n]);async function C(){const t=r.name.trim(),i=r.prompt.trim();if(!t||!i)return;E(!0),x("");let N=r.schedule;!r.recurring&&r.oneTimeDate&&(N=new Date(r.oneTimeDate).toISOString());try{await j.createCronJob({name:t,prompt:i,schedule:N,recurring:r.recurring,backendType:r.backendType,model:r.model.trim()||void 0,cwd:r.cwd.trim()||void 0}),v($),S(!1),n()}catch(b){x(b instanceof Error?b.message:String(b))}finally{E(!1)}}function R(t){y(t.id),w({name:t.name,prompt:t.prompt,recurring:t.recurring,schedule:t.schedule,oneTimeDate:"",backendType:t.backendType,model:t.model,cwd:t.cwd}),x("")}function D(){y(null),x("")}async function L(){if(!l)return;const t=u.name.trim(),i=u.prompt.trim();if(!t||!i)return;let N=u.schedule;!u.recurring&&u.oneTimeDate&&(N=new Date(u.oneTimeDate).toISOString());try{await j.updateCronJob(l,{name:t,prompt:i,schedule:N,recurring:u.recurring,backendType:u.backendType,model:u.model.trim()||void 0,cwd:u.cwd.trim()||void 0}),y(null),x(""),n()}catch(b){x(b instanceof Error?b.message:String(b))}}async function A(t){try{await j.deleteCronJob(t),l===t&&y(null),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function I(t){try{await j.toggleCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function P(t){M(i=>new Set(i).add(t));try{await j.runCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}finally{M(i=>{const N=new Set(i);return N.delete(t),N})}}if(p)return e.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Run autonomous Claude Code or Codex sessions on a schedule."})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:()=>S(!f),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${f?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:f?e.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{className:"hidden sm:inline",children:f?"Cancel":"New Task"})]})]}),f&&e.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:r,onChange:v}),e.jsx("p",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),m&&f&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),e.jsx("div",{className:"flex items-center justify-end pt-1",children:e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:[e.jsxs("span",{children:[c.length," task",c.length!==1?"s":""]}),c.filter(t=>t.enabled).length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[c.filter(t=>t.enabled).length," active"]})]})]}),o?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-1",children:c.map(t=>l===t.id?e.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:()=>void L(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},t.id):e.jsx(K,{job:t,isRunning:k.has(t.id),onStartEdit:()=>R(t),onDelete:()=>void A(t.id),onToggle:()=>void I(t.id),onRunNow:()=>void P(t.id)},t.id))}),m&&!f&&e.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m})]})});const O=m&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),H=o?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-3",children:c.map(t=>e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1 truncate",children:t.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${t.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:t.backendType==="codex"?"Codex":"Claude"}),t.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[t.consecutiveFailures," fail",t.consecutiveFailures!==1?"s":""]}),e.jsx("button",{onClick:()=>I(t.id),className:`relative w-10 h-6 rounded-full transition-colors cursor-pointer shrink-0 ${t.enabled?"bg-cc-primary":"bg-cc-border"}`,title:t.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[3px] w-[18px] h-[18px] rounded-full bg-white transition-transform ${t.enabled?"left-[19px]":"left-[3px]"}`})}),l===t.id?e.jsx("button",{onClick:D,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>P(t.id),disabled:k.has(t.id),className:`text-xs px-2 py-1.5 min-h-[44px] cursor-pointer ${k.has(t.id)?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:text-cc-primary-hover"}`,children:k.has(t.id)?"Running...":"Run Now"}),e.jsx("button",{onClick:()=>R(t),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),e.jsx("button",{onClick:()=>A(t.id),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),l===t.id&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:L,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"}),e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm font-medium text-cc-muted hover:text-cc-fg rounded-lg transition-colors cursor-pointer",children:"Cancel"})]})]}),l!==t.id&&e.jsxs("div",{className:"px-3 py-2.5 space-y-1.5",children:[e.jsx("div",{className:"text-xs text-cc-muted truncate",title:t.prompt,children:t.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(t.schedule,t.recurring)}),t.nextRunAt!=null&&t.enabled&&e.jsxs("span",{children:["Next: ",J(t.nextRunAt)]}),t.lastRunAt!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:["Last: ",z(t.lastRunAt),t.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]}),t.totalRuns>0&&e.jsxs("span",{children:[t.totalRuns," run",t.totalRuns!==1?"s":""]}),t.cwd&&e.jsx("span",{className:"font-mono-code truncate max-w-[200px]",title:t.cwd,children:t.cwd})]})]})]},t.id))}),V=e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("button",{onClick:()=>S(!f),className:"w-full flex items-center gap-2 px-3 py-2.5 cursor-pointer hover:bg-cc-hover transition-colors",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`w-3 h-3 text-cc-muted transition-transform ${f?"rotate-90":""}`,children:e.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Scheduled Task"})]}),f&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:r,onChange:v}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})]})]}),Z=e.jsxs("div",{className:"w-full max-w-2xl max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"text-xs text-cc-muted mt-0.5",children:"Run autonomous Claude Code or Codex sessions on a schedule"})]}),s&&e.jsx("button",{onClick:s,className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[O,H,V]})]});return _.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:s,children:Z}),document.body)}function K({job:s,isRunning:p,onStartEdit:c,onDelete:d,onToggle:o,onRunNow:g}){return e.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[e.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 6v6l4 2"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:s.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${s.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:s.backendType==="codex"?"Codex":"Claude"}),s.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[s.consecutiveFailures," fail",s.consecutiveFailures!==1?"s":""]}),!s.enabled&&e.jsx("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-muted bg-cc-hover",children:"Paused"})]}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted line-clamp-1 leading-relaxed",children:s.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(s.schedule,s.recurring)}),s.nextRunAt!=null&&s.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:["Next ",J(s.nextRunAt)]})]}),s.lastRunAt!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:["Last ",z(s.lastRunAt),s.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]})]}),s.totalRuns>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[s.totalRuns," run",s.totalRuns!==1?"s":""]})]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:o,className:`relative w-9 h-5 rounded-full transition-colors cursor-pointer shrink-0 ${s.enabled?"bg-cc-primary":"bg-cc-border"}`,title:s.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[2px] w-4 h-4 rounded-full bg-white transition-transform ${s.enabled?"left-[17px]":"left-[2px]"}`})}),e.jsx("button",{onClick:g,disabled:p,className:`p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md transition-colors cursor-pointer ${p?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:bg-cc-primary/10"}`,"aria-label":"Run now",title:p?"Running...":"Run now",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M8 5v14l11-7z"})})}),e.jsx("button",{onClick:c,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),e.jsx("button",{onClick:d,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function T({form:s,onChange:p}){const c=n=>p({...s,...n}),[d,o]=a.useState(null),[g,m]=a.useState(!1),x=a.useRef(null),[l,y]=a.useState(!1),[u,w]=a.useState(!1),r=a.useRef(null),v=d||U(s.backendType),h=v.find(n=>n.value===s.model)||v[0];a.useEffect(()=>{o(null),s.backendType==="codex"&&j.getBackendModels(s.backendType).then(n=>{if(n.length>0){const C=Y(n);o(C),C.some(R=>R.value===s.model)||c({model:C[0].value})}}).catch(()=>{})},[s.backendType]),a.useEffect(()=>{s.model||c({model:B(s.backendType)})},[]);const E=a.useMemo(()=>[x],[]),f=a.useCallback(()=>m(!1),[]);W(E,f,g);const S=a.useMemo(()=>[r],[]),k=a.useCallback(()=>w(!1),[]);W(S,k,u);const M=s.cwd?s.cwd.split("/").pop()||s.cwd:"Select folder";return e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("input",{type:"text",value:s.name,onChange:n=>c({name:n.target.value}),placeholder:"Task name (e.g. Daily test suite)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("textarea",{value:s.prompt,onChange:n=>c({prompt:n.target.value}),placeholder:"Prompt for the session (e.g. Run the test suite and fix any failures)",rows:4,className:"w-full px-3 py-2.5 text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 resize-y transition-shadow",style:{minHeight:"100px"}}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c({recurring:!0}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:"Recurring"}),e.jsx("button",{onClick:()=>c({recurring:!1}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-hover text-cc-muted hover:text-cc-fg":"bg-cc-primary text-white"}`,children:"One-time"})]}),s.recurring?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.map(n=>e.jsx("button",{onClick:()=>c({schedule:n.value}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-md transition-colors cursor-pointer ${s.schedule===n.value?"bg-cc-primary/20 text-cc-primary":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:n.label},n.value))}),e.jsx("input",{type:"text",value:s.schedule,onChange:n=>c({schedule:n.target.value}),placeholder:"Cron expression (e.g. 0 8 * * *)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:F(s.schedule,!0)})]}):e.jsx("input",{type:"datetime-local",value:s.oneTimeDate,onChange:n=>c({oneTimeDate:n.target.value}),className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("div",{className:"relative",ref:r,children:[e.jsxs("button",{onClick:()=>w(!u),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs font-medium text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:s.backendType==="codex"?"Codex":"Claude Code"}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),u&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:[{value:"claude",label:"Claude Code"},{value:"codex",label:"Codex"}].map(n=>e.jsx("button",{onClick:()=>{c({backendType:n.value,model:B(n.value)}),w(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${n.value===s.backendType?"text-cc-primary font-medium":"text-cc-fg"}`,children:n.label},n.value))})]}),e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>m(!g),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:h==null?void 0:h.icon}),e.jsx("span",{children:h==null?void 0:h.label}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-52 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:v.map(n=>e.jsxs("button",{onClick:()=>{c({model:n.value}),m(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${n.value===s.model?"text-cc-primary font-medium":"text-cc-fg"}`,children:[e.jsx("span",{children:n.icon}),n.label]},n.value))})]}),e.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),e.jsx("span",{className:"max-w-[200px] truncate font-mono-code",children:M}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l&&e.jsx(q,{initialPath:s.cwd||"",onSelect:n=>c({cwd:n}),onClose:()=>y(!1)})]})]})}export{ee as CronManager};
1
+ import{r as a,b as j,j as e,B as _,E as B,H as U,I as Y,F as q}from"./index-C6Q5UQHD.js";import{t as z}from"./time-ago-B6r_l9u1.js";function W(s,p,c=!0){a.useEffect(()=>{if(!c)return;function d(o){s.some(m=>m.current&&m.current.contains(o.target))||p()}return document.addEventListener("pointerdown",d),()=>document.removeEventListener("pointerdown",d)},[s,p,c])}function J(s){const p=s-Date.now();if(p<=0)return"now";const c=Math.floor(p/6e4);if(c<60)return`in ${c}m`;const d=Math.floor(c/60);return d<24?`in ${d}h`:`in ${Math.floor(d/24)}d`}function F(s,p){if(!p)return"One-time";const c=s.trim().split(/\s+/);if(c.length!==5)return s;const[d,o,g,m,x]=c;if(s==="* * * * *")return"Every minute";if(o==="*"&&g==="*"&&m==="*"&&x==="*"&&d.startsWith("*/")){const l=parseInt(d.slice(2),10);return l===1?"Every minute":`Every ${l} minutes`}if(d==="0"&&g==="*"&&m==="*"&&x==="*"){if(o==="*")return"Every hour";if(o.startsWith("*/")){const l=parseInt(o.slice(2),10);return l===1?"Every hour":`Every ${l} hours`}}if(g==="*"&&m==="*"&&d!=="*"&&o!=="*"&&!o.includes("/")&&!o.includes(",")){const l=parseInt(o,10),y=parseInt(d,10);if(!isNaN(l)&&!isNaN(y)){const u=l>=12?"PM":"AM",w=l===0?12:l>12?l-12:l,r=y.toString().padStart(2,"0"),v=`${w}:${r} ${u}`;if(x==="*")return`Every day at ${v}`;if(x==="1-5")return`Weekdays at ${v}`;if(x==="0,6")return`Weekends at ${v}`}}return s}const $={name:"",prompt:"",recurring:!0,schedule:"0 8 * * *",oneTimeDate:"",backendType:"claude",model:B("claude"),cwd:""},G=[{label:"Every hour",value:"0 * * * *"},{label:"Every day at 8am",value:"0 8 * * *"},{label:"Every 2 hours",value:"0 */2 * * *"},{label:"Weekdays at 9am",value:"0 9 * * 1-5"}];function ee({onClose:s,embedded:p=!1}){const[c,d]=a.useState([]),[o,g]=a.useState(!0),[m,x]=a.useState(""),[l,y]=a.useState(null),[u,w]=a.useState($),[r,v]=a.useState($),[h,E]=a.useState(!1),[f,S]=a.useState(!1),[k,M]=a.useState(new Set),n=a.useCallback(()=>{j.listCronJobs().then(d).catch(()=>{}).finally(()=>g(!1))},[]);a.useEffect(()=>{n();const t=setInterval(n,1e4);return()=>clearInterval(t)},[n]);async function C(){const t=r.name.trim(),i=r.prompt.trim();if(!t||!i)return;E(!0),x("");let N=r.schedule;!r.recurring&&r.oneTimeDate&&(N=new Date(r.oneTimeDate).toISOString());try{await j.createCronJob({name:t,prompt:i,schedule:N,recurring:r.recurring,backendType:r.backendType,model:r.model.trim()||void 0,cwd:r.cwd.trim()||void 0}),v($),S(!1),n()}catch(b){x(b instanceof Error?b.message:String(b))}finally{E(!1)}}function R(t){y(t.id),w({name:t.name,prompt:t.prompt,recurring:t.recurring,schedule:t.schedule,oneTimeDate:"",backendType:t.backendType,model:t.model,cwd:t.cwd}),x("")}function D(){y(null),x("")}async function L(){if(!l)return;const t=u.name.trim(),i=u.prompt.trim();if(!t||!i)return;let N=u.schedule;!u.recurring&&u.oneTimeDate&&(N=new Date(u.oneTimeDate).toISOString());try{await j.updateCronJob(l,{name:t,prompt:i,schedule:N,recurring:u.recurring,backendType:u.backendType,model:u.model.trim()||void 0,cwd:u.cwd.trim()||void 0}),y(null),x(""),n()}catch(b){x(b instanceof Error?b.message:String(b))}}async function A(t){try{await j.deleteCronJob(t),l===t&&y(null),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function I(t){try{await j.toggleCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}}async function P(t){M(i=>new Set(i).add(t));try{await j.runCronJob(t),n()}catch(i){x(i instanceof Error?i.message:String(i))}finally{M(i=>{const N=new Set(i);return N.delete(t),N})}}if(p)return e.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto",children:e.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[e.jsx("div",{className:"flex items-start justify-between gap-3 mb-2",children:e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:"Run autonomous Claude Code or Codex sessions on a schedule."})]})}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[e.jsx("div",{className:"flex-1"}),e.jsxs("button",{onClick:()=>S(!f),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${f?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:f?e.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{className:"hidden sm:inline",children:f?"Cancel":"New Task"})]})]}),f&&e.jsxs("div",{className:"mb-6 rounded-xl bg-cc-card p-4 sm:p-5 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:r,onChange:v}),e.jsx("p",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),m&&f&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),e.jsx("div",{className:"flex items-center justify-end pt-1",children:e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})})]}),e.jsxs("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:[e.jsxs("span",{children:[c.length," task",c.length!==1?"s":""]}),c.filter(t=>t.enabled).length>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[c.filter(t=>t.enabled).length," active"]})]})]}),o?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-1",children:c.map(t=>l===t.id?e.jsxs("div",{className:"rounded-xl bg-cc-card p-4 space-y-3",style:{animation:"fadeSlideIn 150ms ease-out"},children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm rounded-lg text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Cancel"}),e.jsx("button",{onClick:()=>void L(),className:"px-4 py-2.5 min-h-[44px] text-sm rounded-lg font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Save"})]})]},t.id):e.jsx(K,{job:t,isRunning:k.has(t.id),onStartEdit:()=>R(t),onDelete:()=>void A(t.id),onToggle:()=>void I(t.id),onRunNow:()=>void P(t.id)},t.id))}),m&&!f&&e.jsx("div",{className:"mt-4 px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m})]})});const O=m&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 text-xs text-cc-error",children:m}),H=o?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"Loading scheduled tasks..."}):c.length===0?e.jsx("div",{className:"text-sm text-cc-muted text-center py-6",children:"No scheduled tasks yet."}):e.jsx("div",{className:"space-y-3",children:c.map(t=>e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("div",{className:"flex items-center gap-2 px-3 py-2.5",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg flex-1 truncate",children:t.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${t.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:t.backendType==="codex"?"Codex":"Claude"}),t.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[t.consecutiveFailures," fail",t.consecutiveFailures!==1?"s":""]}),e.jsx("button",{onClick:()=>I(t.id),className:`relative w-10 h-6 rounded-full transition-colors cursor-pointer shrink-0 ${t.enabled?"bg-cc-primary":"bg-cc-border"}`,title:t.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[3px] w-[18px] h-[18px] rounded-full bg-white transition-transform ${t.enabled?"left-[19px]":"left-[3px]"}`})}),l===t.id?e.jsx("button",{onClick:D,className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Cancel"}):e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:()=>P(t.id),disabled:k.has(t.id),className:`text-xs px-2 py-1.5 min-h-[44px] cursor-pointer ${k.has(t.id)?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:text-cc-primary-hover"}`,children:k.has(t.id)?"Running...":"Run Now"}),e.jsx("button",{onClick:()=>R(t),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-fg cursor-pointer",children:"Edit"}),e.jsx("button",{onClick:()=>A(t.id),className:"text-xs px-2 py-1.5 min-h-[44px] text-cc-muted hover:text-cc-error cursor-pointer",children:"Delete"})]})]}),l===t.id&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:u,onChange:w}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:L,className:"px-4 py-2.5 min-h-[44px] text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white rounded-lg transition-colors cursor-pointer",children:"Save"}),e.jsx("button",{onClick:D,className:"px-3 py-2.5 min-h-[44px] text-sm font-medium text-cc-muted hover:text-cc-fg rounded-lg transition-colors cursor-pointer",children:"Cancel"})]})]}),l!==t.id&&e.jsxs("div",{className:"px-3 py-2.5 space-y-1.5",children:[e.jsx("div",{className:"text-xs text-cc-muted truncate",title:t.prompt,children:t.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(t.schedule,t.recurring)}),t.nextRunAt!=null&&t.enabled&&e.jsxs("span",{children:["Next: ",J(t.nextRunAt)]}),t.lastRunAt!=null&&e.jsxs("span",{className:"flex items-center gap-1",children:["Last: ",z(t.lastRunAt),t.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]}),t.totalRuns>0&&e.jsxs("span",{children:[t.totalRuns," run",t.totalRuns!==1?"s":""]}),t.cwd&&e.jsx("span",{className:"font-mono-code truncate max-w-[200px]",title:t.cwd,children:t.cwd})]})]})]},t.id))}),V=e.jsxs("div",{className:"rounded-xl bg-cc-card overflow-hidden",children:[e.jsxs("button",{onClick:()=>S(!f),className:"w-full flex items-center gap-2 px-3 py-2.5 cursor-pointer hover:bg-cc-hover transition-colors",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:`w-3 h-3 text-cc-muted transition-transform ${f?"rotate-90":""}`,children:e.jsx("path",{d:"M6 4l4 4-4 4",strokeLinecap:"round",strokeLinejoin:"round"})}),e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:"New Scheduled Task"})]}),f&&e.jsxs("div",{className:"px-3 py-3 space-y-2.5",children:[e.jsx(T,{form:r,onChange:v}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:"Scheduled tasks run with full autonomy (bypassPermissions)"}),e.jsx("button",{onClick:C,disabled:!r.name.trim()||!r.prompt.trim()||h,className:`px-4 py-2.5 min-h-[44px] text-sm font-medium rounded-lg transition-colors ${r.name.trim()&&r.prompt.trim()&&!h?"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:h?"Creating...":"Create"})]})]}),Z=e.jsxs("div",{className:"w-full max-w-2xl max-h-[90dvh] sm:max-h-[80dvh] mx-0 sm:mx-4 flex flex-col bg-cc-bg rounded-t-[14px] sm:rounded-[14px] shadow-2xl overflow-hidden",onClick:t=>t.stopPropagation(),children:[e.jsxs("div",{className:"flex items-center justify-between px-4 sm:px-5 py-3 sm:py-4",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg",children:"Scheduled Tasks"}),e.jsx("p",{className:"text-xs text-cc-muted mt-0.5",children:"Run autonomous Claude Code or Codex sessions on a schedule"})]}),s&&e.jsx("button",{onClick:s,className:"w-8 h-8 flex items-center justify-center rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]}),e.jsxs("div",{className:"flex-1 overflow-y-auto px-3 sm:px-5 py-3 sm:py-4 pb-safe space-y-4",children:[O,H,V]})]});return _.createPortal(e.jsx("div",{className:"fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/50",onClick:s,children:Z}),document.body)}function K({job:s,isRunning:p,onStartEdit:c,onDelete:d,onToggle:o,onRunNow:g}){return e.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[e.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M12 6v6l4 2"})]})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:s.name}),e.jsx("span",{className:`text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 ${s.backendType==="codex"?"text-blue-500 bg-blue-500/10":"text-[#5BA8A0] bg-[#5BA8A0]/10"}`,children:s.backendType==="codex"?"Codex":"Claude"}),s.consecutiveFailures>0&&e.jsxs("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-error bg-cc-error/10",children:[s.consecutiveFailures," fail",s.consecutiveFailures!==1?"s":""]}),!s.enabled&&e.jsx("span",{className:"text-[9px] font-medium px-1.5 rounded-full leading-[16px] shrink-0 text-cc-muted bg-cc-hover",children:"Paused"})]}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted line-clamp-1 leading-relaxed",children:s.prompt}),e.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-0.5 mt-1 text-[11px] text-cc-muted",children:[e.jsx("span",{children:F(s.schedule,s.recurring)}),s.nextRunAt!=null&&s.enabled&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:["Next ",J(s.nextRunAt)]})]}),s.lastRunAt!=null&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{className:"flex items-center gap-0.5",children:["Last ",z(s.lastRunAt),s.consecutiveFailures===0?e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-success",children:e.jsx("path",{d:"M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2.5-2.5a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"})}):e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-2.5 h-2.5 text-cc-error",children:e.jsx("path",{d:"M4.646 4.646a.5.5 0 01.708 0L8 7.293l2.646-2.647a.5.5 0 01.708.708L8.707 8l2.647 2.646a.5.5 0 01-.708.708L8 8.707l-2.646 2.647a.5.5 0 01-.708-.708L7.293 8 4.646 5.354a.5.5 0 010-.708z"})})]})]}),s.totalRuns>0&&e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"text-cc-border",children:"·"}),e.jsxs("span",{children:[s.totalRuns," run",s.totalRuns!==1?"s":""]})]})]})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:o,className:`relative w-9 h-5 rounded-full transition-colors cursor-pointer shrink-0 ${s.enabled?"bg-cc-primary":"bg-cc-border"}`,title:s.enabled?"Disable":"Enable",children:e.jsx("span",{className:`absolute top-[2px] w-4 h-4 rounded-full bg-white transition-transform ${s.enabled?"left-[17px]":"left-[2px]"}`})}),e.jsx("button",{onClick:g,disabled:p,className:`p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md transition-colors cursor-pointer ${p?"text-cc-muted cursor-not-allowed":"text-cc-primary hover:bg-cc-primary/10"}`,"aria-label":"Run now",title:p?"Running...":"Run now",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M8 5v14l11-7z"})})}),e.jsx("button",{onClick:c,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),e.jsx("button",{onClick:d,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}function T({form:s,onChange:p}){const c=n=>p({...s,...n}),[d,o]=a.useState(null),[g,m]=a.useState(!1),x=a.useRef(null),[l,y]=a.useState(!1),[u,w]=a.useState(!1),r=a.useRef(null),v=d||U(s.backendType),h=v.find(n=>n.value===s.model)||v[0];a.useEffect(()=>{o(null),s.backendType==="codex"&&j.getBackendModels(s.backendType).then(n=>{if(n.length>0){const C=Y(n);o(C),C.some(R=>R.value===s.model)||c({model:C[0].value})}}).catch(()=>{})},[s.backendType]),a.useEffect(()=>{s.model||c({model:B(s.backendType)})},[]);const E=a.useMemo(()=>[x],[]),f=a.useCallback(()=>m(!1),[]);W(E,f,g);const S=a.useMemo(()=>[r],[]),k=a.useCallback(()=>w(!1),[]);W(S,k,u);const M=s.cwd?s.cwd.split("/").pop()||s.cwd:"Select folder";return e.jsxs("div",{className:"space-y-2.5",children:[e.jsx("input",{type:"text",value:s.name,onChange:n=>c({name:n.target.value}),placeholder:"Task name (e.g. Daily test suite)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("textarea",{value:s.prompt,onChange:n=>c({prompt:n.target.value}),placeholder:"Prompt for the session (e.g. Run the test suite and fix any failures)",rows:4,className:"w-full px-3 py-2.5 text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 resize-y transition-shadow",style:{minHeight:"100px"}}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-1.5",children:[e.jsx("button",{onClick:()=>c({recurring:!0}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:"Recurring"}),e.jsx("button",{onClick:()=>c({recurring:!1}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-lg transition-colors cursor-pointer ${s.recurring?"bg-cc-hover text-cc-muted hover:text-cc-fg":"bg-cc-primary text-white"}`,children:"One-time"})]}),s.recurring?e.jsxs("div",{className:"space-y-1.5",children:[e.jsx("div",{className:"flex flex-wrap gap-1.5",children:G.map(n=>e.jsx("button",{onClick:()=>c({schedule:n.value}),className:`px-2.5 py-2 min-h-[44px] text-xs font-medium rounded-md transition-colors cursor-pointer ${s.schedule===n.value?"bg-cc-primary/20 text-cc-primary":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:n.label},n.value))}),e.jsx("input",{type:"text",value:s.schedule,onChange:n=>c({schedule:n.target.value}),placeholder:"Cron expression (e.g. 0 8 * * *)",className:"w-full px-3 py-2.5 min-h-[44px] text-sm font-mono-code bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsx("div",{className:"text-[10px] text-cc-muted",children:F(s.schedule,!0)})]}):e.jsx("input",{type:"datetime-local",value:s.oneTimeDate,onChange:n=>c({oneTimeDate:n.target.value}),className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[e.jsxs("div",{className:"relative",ref:r,children:[e.jsxs("button",{onClick:()=>w(!u),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs font-medium text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:s.backendType==="codex"?"Codex":"Claude Code"}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),u&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-40 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:[{value:"claude",label:"Claude Code"},{value:"codex",label:"Codex"}].map(n=>e.jsx("button",{onClick:()=>{c({backendType:n.value,model:B(n.value)}),w(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer ${n.value===s.backendType?"text-cc-primary font-medium":"text-cc-fg"}`,children:n.label},n.value))})]}),e.jsxs("div",{className:"relative",ref:x,children:[e.jsxs("button",{onClick:()=>m(!g),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("span",{children:h==null?void 0:h.icon}),e.jsx("span",{children:h==null?void 0:h.label}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),g&&e.jsx("div",{className:"absolute left-0 bottom-full mb-1 w-52 bg-cc-card rounded-xl shadow-lg z-10 py-1",children:v.map(n=>e.jsxs("button",{onClick:()=>{c({model:n.value}),m(!1)},className:`w-full px-3 py-2.5 min-h-[44px] text-xs text-left hover:bg-cc-hover transition-colors cursor-pointer flex items-center gap-2 ${n.value===s.model?"text-cc-primary font-medium":"text-cc-fg"}`,children:[e.jsx("span",{children:n.icon}),n.label]},n.value))})]}),e.jsxs("button",{onClick:()=>y(!0),className:"flex items-center gap-1.5 px-2.5 py-2 min-h-[44px] text-xs text-cc-muted hover:text-cc-fg rounded-lg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60",children:e.jsx("path",{d:"M1 3.5A1.5 1.5 0 012.5 2h3.379a1.5 1.5 0 011.06.44l.622.621a.5.5 0 00.353.146H13.5A1.5 1.5 0 0115 4.707V12.5a1.5 1.5 0 01-1.5 1.5h-11A1.5 1.5 0 011 12.5v-9z"})}),e.jsx("span",{className:"max-w-[200px] truncate font-mono-code",children:M}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3 h-3 opacity-50",children:e.jsx("path",{d:"M4 6l4 4 4-4"})})]}),l&&e.jsx(q,{initialPath:s.cwd||"",onSelect:n=>c({cwd:n}),onClose:()=>y(!1)})]})]})}export{ee as CronManager};
@@ -1 +1 @@
1
- import{j as e,r as x}from"./index-BgYM4wXw.js";function t({id:s,title:a,icon:r,children:c,defaultOpen:d=!1}){const[o,h]=x.useState(d);return e.jsxs("div",{id:s,className:"border border-cc-border rounded-xl overflow-hidden",children:[e.jsxs("button",{onClick:()=>h(!o),className:"w-full flex items-center gap-3 px-5 py-4 text-left hover:bg-cc-hover/50 transition-colors",children:[e.jsx("span",{className:"text-xl shrink-0",children:r}),e.jsx("span",{className:"text-sm font-semibold text-cc-fg flex-1",children:a}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-4 h-4 text-cc-muted transition-transform ${o?"rotate-180":""}`,children:e.jsx("path",{d:"M4.22 6.22a.75.75 0 011.06 0L8 8.94l2.72-2.72a.75.75 0 111.06 1.06l-3.25 3.25a.75.75 0 01-1.06 0L4.22 7.28a.75.75 0 010-1.06z"})})]}),o&&e.jsxs("div",{className:"px-5 pb-5 text-sm text-cc-muted leading-relaxed space-y-3 border-t border-cc-border/50",children:[e.jsx("div",{className:"pt-4"}),c]})]})}function l({children:s}){return e.jsx("kbd",{className:"inline-block px-1.5 py-0.5 rounded bg-cc-card border border-cc-border text-[11px] font-mono text-cc-fg",children:s})}function i({n:s,children:a}){return e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full bg-cc-primary/20 text-cc-primary text-xs font-bold flex items-center justify-center mt-0.5",children:s}),e.jsx("div",{className:"flex-1",children:a})]})}function n({children:s}){return e.jsx("code",{className:"text-xs bg-cc-card px-1 rounded",children:s})}function m(){const s=[{id:"overview",label:"Overview"},{id:"first-steps",label:"Getting Started"},{id:"gemini-live",label:"Gemini Live"},{id:"agents",label:"Agents"},{id:"sessions",label:"Sessions & Chat"},{id:"media",label:"Media Generation"},{id:"telephony",label:"Telephony"},{id:"federation",label:"Federation"},{id:"sidebar",label:"Sidebar & Navigation"},{id:"platform",label:"Platform Dashboard"},{id:"pwa",label:"PWA & Mobile"},{id:"keyboard",label:"Keyboard Shortcuts"},{id:"tailscale",label:"Tailscale Setup"},{id:"api",label:"API Reference"}];return e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(a=>e.jsx("a",{href:`#/help?s=${a.id}`,onClick:r=>{var c;r.preventDefault(),(c=document.getElementById(a.id))==null||c.scrollIntoView({behavior:"smooth",block:"start"})},className:"px-3 py-1.5 rounded-lg bg-cc-card border border-cc-border text-xs text-cc-muted hover:text-cc-fg hover:border-cc-primary/50 transition-colors",children:a.label},a.id))})}function p(){return e.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-cc-fg",children:"HeyHank Help"}),e.jsx("p",{className:"text-sm text-cc-muted mt-1",children:"Self-hosted AI agent platform with voice assistant, telephony, media generation and multi-node federation."})]}),e.jsx(m,{}),e.jsxs(t,{id:"overview",title:"Overview",icon:"🏠",defaultOpen:!0,children:[e.jsx("p",{children:"HeyHank is your self-hosted AI agent platform. Create custom agents with any LLM backend, talk to them via Gemini Live voice, make phone calls through SIP, generate images and videos, and connect multiple HeyHank instances together."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Key Features"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 mt-1",children:[{name:"Custom Agents",desc:"Create unlimited agents",color:"text-blue-400"},{name:"Gemini Live",desc:"Voice assistant",color:"text-green-400"},{name:"Telephony",desc:"AI phone calls via SIP",color:"text-purple-400"},{name:"Media Gen",desc:"Images & videos",color:"text-pink-400"},{name:"Federation",desc:"Multi-node mesh",color:"text-yellow-400"},{name:"Multi-LLM",desc:"Claude, Gemini, Ollama",color:"text-orange-400"}].map(s=>e.jsxs("div",{className:"rounded-lg bg-cc-card p-3 border border-cc-border/50",children:[e.jsx("div",{className:`text-xs font-semibold ${s.color}`,children:s.name}),e.jsx("div",{className:"text-[11px] text-cc-muted mt-0.5",children:s.desc})]},s.name))}),e.jsxs("p",{className:"mt-2",children:[e.jsx("strong",{className:"text-cc-fg",children:"LLM Backends:"})," Claude Code CLI (Max subscription or API), Ollama (local, free), Gemini API, Codex CLI — configurable per agent."]})]}),e.jsxs(t,{id:"first-steps",title:"Getting Started",icon:"🚀",children:[e.jsx(i,{n:1,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Install"})," — ",e.jsx(n,{children:"npx heyhank"})," or ",e.jsx(n,{children:"bunx heyhank"}),". HeyHank starts on port 3100 by default."]})}),e.jsx(i,{n:2,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Log in"})," — Open the URL and enter the auth token shown in the terminal."]})}),e.jsx(i,{n:3,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Start a session"})," — Click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Session"})," in the sidebar. Choose a working directory and backend (Claude/Codex)."]})}),e.jsx(i,{n:4,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Chat"})," — Type your message and press ",e.jsx(l,{children:"Enter"}),". The agent responds with text, executes tools, and asks for permission when needed."]})}),e.jsx(i,{n:5,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Create an agent"})," — Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Agents"})," in the sidebar, click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Agent"}),". Give it a name, prompt, model, and working directory."]})}),e.jsx(i,{n:6,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Talk to Gemini"})," — Click the microphone button (bottom right) to start a voice conversation with Gemini Live. It can control your agents, make calls, and more."]})})]}),e.jsxs(t,{id:"gemini-live",title:"Gemini Live — Voice Assistant",icon:"🎙",children:[e.jsx("p",{children:"Gemini Live is your always-available voice interface. It uses Google's BidiGenerateContent API for real-time bidirectional audio streaming — you talk, it responds instantly with voice."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How to use"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click the ",e.jsx("strong",{className:"text-cc-fg",children:"microphone button"})," (floating, bottom right) to start."]}),e.jsxs("li",{children:["A draggable voice chat overlay appears. You can ",e.jsx("strong",{className:"text-cc-fg",children:"minimize"})," it (session stays alive) or ",e.jsx("strong",{className:"text-cc-fg",children:"close"})," it (ends session)."]}),e.jsx("li",{children:"Speak naturally — Gemini responds with voice in real-time."}),e.jsx("li",{children:"Drag the overlay anywhere on screen. On mobile, it stays accessible while you browse."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"What Gemini can do"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Run agents"}),' — "Start a coding agent on /my/project"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Send messages"}),' — "Tell session 3 to run the tests"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Create agents"}),' — "Create an agent called Monitor that checks server health"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Make phone calls"}),' — "Call +43 1 234 5678 and ask about the appointment" (requires SIP trunk)']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"List sessions"}),` — "What's running right now?"`]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Monitor agents"}),' — "What is the coding agent doing?"']})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Multimodal input"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Images"})," — Click the image icon to upload photos or documents for Gemini to analyze."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Camera"})," — Click the camera icon to stream your live camera feed. Gemini receives a frame every 2 seconds."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Videos"})," — Upload a video file; HeyHank extracts key frames and sends them to Gemini."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Requirements"}),e.jsxs("p",{children:["Requires a ",e.jsx(n,{children:"GEMINI_API_KEY"})," environment variable. Get one free at ",e.jsx("strong",{className:"text-cc-fg",children:"aistudio.google.com"}),"."]})]}),e.jsxs(t,{id:"agents",title:"Agents",icon:"🤖",children:[e.jsx("p",{children:"Agents are the core of HeyHank. Each agent is a configured AI session with its own name, system prompt, LLM model, working directory, and permission mode."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Create an agent"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Agents"})," in the sidebar."]}),e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Agent"}),"."]}),e.jsx("li",{children:"Configure: name, description, system prompt, model, backend, working directory."}),e.jsx("li",{children:"Optionally set triggers: cron schedule (e.g. run every hour) or webhook."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Run an agent"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"Run"})," on an agent card — starts a new session with the agent's prompt."]}),e.jsx("li",{children:"Some agents may ask for input before they start (configurable)."}),e.jsx("li",{children:'You can also ask Gemini Live: "Run the coding agent" or "Start monitor".'})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agent examples"}),e.jsx("div",{className:"space-y-1.5 mt-1",children:[{name:"Coding Agent",desc:"Develops features, fixes bugs, writes tests. Works in your project directory with full file and terminal access."},{name:"Monitoring Agent",desc:"Checks server health: CPU, RAM, disk, Docker, PM2. Runs on a cron schedule. Read-only mode recommended."},{name:"Content Agent",desc:"Creates social media posts, generates images with Imagen, produces videos with Veo."},{name:"Personal Agent",desc:"Email management, calendar, reminders. Connects via IMAP/SMTP."}].map(s=>e.jsxs("div",{className:"rounded-lg bg-cc-card p-3 border border-cc-border/50",children:[e.jsx("span",{className:"text-xs font-semibold text-cc-fg",children:s.name}),e.jsx("span",{className:"text-[11px] text-cc-muted ml-2",children:s.desc})]},s.name))}),e.jsx("p",{className:"text-[11px] mt-1",children:"These are just examples — create whatever agents you need for your workflow."})]}),e.jsxs(t,{id:"sessions",title:"Sessions & Chat",icon:"💬",children:[e.jsx("h4",{className:"font-semibold text-cc-fg",children:"Create a new session"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"+"})," in the sidebar or ",e.jsx("strong",{className:"text-cc-fg",children:"New Session"})," on the home page."]}),e.jsxs("li",{children:["Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"working directory"})," — this is where the agent operates."]}),e.jsxs("li",{children:["Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"backend"}),": Claude (recommended) or Codex."]}),e.jsxs("li",{children:["Choose the ",e.jsx("strong",{className:"text-cc-fg",children:"permission mode"}),": Accept Edits (default), Plan, Default."]}),e.jsxs("li",{children:["Optional: Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"git branch"})," as starting point."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"In the chat"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Composer"})," — Type a message, press ",e.jsx(l,{children:"Enter"})," to send."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"@-Mentions"})," — Type ",e.jsx(n,{children:"@"})," to reference files, folders or prompts."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"/Commands"})," — Type ",e.jsx(n,{children:"/"})," for available commands and skills."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Images"})," — Drag & drop or file upload in the composer."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Permission requests"})," — When the agent wants to use a tool, a yellow banner appears. Click Allow or Deny."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Streaming"})," — Responses are streamed in real time."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Session lifecycle"}),e.jsx("p",{children:"Sessions persist across page reloads and server restarts. Return to any session at any time — the full chat history is preserved."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Session tabs"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Chat"})," — The main conversation with the agent."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Diff"})," — Git changes the agent has made. Badge = changed file count."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Terminal"})," — Shell terminal within the session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Processes"})," — Running processes of the session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Editor"})," — File editor for direct editing."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Browser"})," — Embedded browser for web development."]})]})]}),e.jsxs(t,{id:"media",title:"Media Generation (Image & Video)",icon:"🎨",children:[e.jsx("p",{children:"Generate images and videos via Google AI APIs directly from agent sessions."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Image Generation (Imagen)"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Models: ",e.jsx(n,{children:"imagen-4.0-fast-generate-001"})," (fast), ",e.jsx(n,{children:"imagen-4.0-generate-001"})," (quality), ",e.jsx(n,{children:"imagen-4.0-ultra-generate-001"})]}),e.jsx("li",{children:"Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4"}),e.jsx("li",{children:"Output: PNG file, saved and accessible via URL"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Video Generation (Veo)"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Models: ",e.jsx(n,{children:"veo-3.1-fast-generate-preview"})," (fast), ",e.jsx(n,{children:"veo-3.1-generate-preview"})," (best quality)"]}),e.jsx("li",{children:"Asynchronous generation — takes 1-3 minutes for a 5-8 second video."}),e.jsx("li",{children:"Output: MP4 file"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"View media"}),e.jsxs("p",{children:["All generated media is listed at ",e.jsx(n,{children:"/api/media"})," and can be opened directly in the browser."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Requirements"}),e.jsxs("p",{children:["Requires a ",e.jsx(n,{children:"GEMINI_API_KEY"})," with access to Imagen and Veo models."]})]}),e.jsxs(t,{id:"telephony",title:"Telephony — AI Phone Calls",icon:"📞",children:[e.jsx("p",{children:"HeyHank can make and receive phone calls using Gemini Live as the voice engine. Calls go through a SIP trunk connected to FreeSWITCH, with Gemini handling the conversation."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How it works"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"FreeSWITCH"})," handles the SIP connection to the phone network."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Gemini Live"})," acts as both speech-to-text, LLM, and text-to-speech — no separate STT/TTS services needed."]}),e.jsx("li",{children:"Audio is bridged in real-time: FreeSWITCH (8kHz PCM) is resampled to Gemini (16kHz) and back."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Setup"}),e.jsx(i,{n:1,children:e.jsx("p",{children:"Get a SIP trunk from a provider (e.g. peoplefone, sipgate, easybell)."})}),e.jsx(i,{n:2,children:e.jsxs("p",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Settings → Telephony"})," and add your SIP trunk credentials."]})}),e.jsx(i,{n:3,children:e.jsx("p",{children:"Start the FreeSWITCH Docker container (included in the HeyHank package)."})}),e.jsx(i,{n:4,children:e.jsx("p",{children:"Test the connection in Settings, then make calls via the Telephony page or Gemini voice command."})}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Making calls"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Telephony page"})," — Dial a number, describe the task, and start the call."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Gemini voice"}),' — "Call +43 1 234 5678 and ask about the delivery"']}),e.jsx("li",{children:"Live transcript is displayed in real-time during the call."}),e.jsx("li",{children:"Call history with summaries is saved automatically."})]})]}),e.jsxs(t,{id:"federation",title:"Federation — Multi-Node",icon:"🌐",children:[e.jsx("p",{children:"Connect multiple HeyHank instances together in a peer-to-peer mesh. Run HeyHank on your laptop, VPS, or both — all nodes see each other's sessions and agents."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How it works"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Each HeyHank instance is a ",e.jsx("strong",{className:"text-cc-fg",children:"node"})," with a unique ID."]}),e.jsx("li",{children:"Nodes connect to each other via WebSocket with shared-secret authentication."}),e.jsx("li",{children:"Sessions and agents are synced automatically — remote sessions appear in your sidebar with a node badge."}),e.jsx("li",{children:"Gemini on any node can see and control sessions across all connected nodes."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Setup"}),e.jsx(i,{n:1,children:e.jsxs("p",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Settings → Federation"})," on both nodes."]})}),e.jsx(i,{n:2,children:e.jsx("p",{children:"Copy the connection URL from Node B."})}),e.jsx(i,{n:3,children:e.jsxs("p",{children:["On Node A, click ",e.jsx("strong",{className:"text-cc-fg",children:"Add Node"})," and paste the URL + shared secret."]})}),e.jsx(i,{n:4,children:e.jsx("p",{children:"Both nodes now see each other's sessions. Gemini can control agents across both."})}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Offline handling"}),e.jsx("p",{children:"If a node goes offline, its sessions are marked as disconnected and disappear after 60 seconds. When the node comes back, auto-reconnect restores everything."})]}),e.jsxs(t,{id:"sidebar",title:"Sidebar — Navigation",icon:"📋",children:[e.jsx("p",{children:"The sidebar is your main navigation. On mobile, open it with the hamburger icon. On desktop, it's always visible."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Upper area: Sessions"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"+ Button"})," — Start a new chat session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Session list"})," — All active sessions, grouped by project. Click to open."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Right-click / 3-dots"})," — Rename, Archive, Delete."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Archived sessions"})," — Collapsible at the bottom, can be restored."]}),e.jsx("li",{children:"Status dots: green = connected, yellow = reconnecting, red = disconnected."}),e.jsx("li",{children:"Badge = open permission requests awaiting confirmation."}),e.jsx("li",{children:"Node badge = session is from a remote federated node."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Lower area: Pages"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Workbench:"})," Prompts, Integrations, Terminal"]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Workspace:"})," Environments, Agents, Telephony, Platform, Settings, Help"]})]})]}),e.jsxs(t,{id:"platform",title:"Platform Dashboard",icon:"📊",children:[e.jsx("p",{children:"The Platform page shows the overall state of your agent system."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Kill Switch"}),e.jsx("p",{children:"Emergency stop for all agents. Red KILL button stops everything immediately."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Cost Tracking"}),e.jsx("p",{children:"Total costs, token usage (in/out), and per-session cost breakdown with model info."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"LLM Providers"}),e.jsx("p",{children:"Status of all LLM backends: Claude, Gemini, Ollama, Codex. Green = available, yellow = needs API key."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agent Messages"}),e.jsx("p",{children:"Last 20 inter-agent messages — see how agents communicate with each other."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Shared Context"}),e.jsx("p",{children:"Shared knowledge files accessible by all agents. Click to read, edit to modify."})]}),e.jsxs(t,{id:"pwa",title:"PWA & Mobile",icon:"📱",children:[e.jsx("h4",{className:"font-semibold text-cc-fg",children:"Install as app"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"iPhone/iPad:"}),' Safari → Share → "Add to Home Screen"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Android:"}),' Chrome → Menu → "Install app"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Desktop:"})," Chrome/Edge → Address bar → Install icon"]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Push Notifications"}),e.jsx("p",{children:"HeyHank can send push notifications for agent alerts and monitoring warnings. Enable on first visit when the browser asks for permission."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Mobile tips"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsx("li",{children:"The Gemini Live voice overlay is draggable and collapsible — works well on small screens."}),e.jsx("li",{children:"Use the camera icon in voice chat to stream your phone camera to Gemini."}),e.jsx("li",{children:"The PWA caches static assets for fast loading. Agent interaction requires a connection."})]})]}),e.jsx(t,{id:"keyboard",title:"Keyboard Shortcuts",icon:"⌨",children:e.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-2",children:[e.jsx(l,{children:"Enter"}),e.jsx("span",{children:"Send message"}),e.jsx(l,{children:"Shift+Enter"}),e.jsx("span",{children:"New line in composer"}),e.jsx(l,{children:"Escape"}),e.jsx("span",{children:"Deny permission request / Interrupt"}),e.jsx(l,{children:"@"}),e.jsx("span",{children:"Reference file/folder/prompt"}),e.jsx(l,{children:"/"}),e.jsx("span",{children:"Commands and skills"}),e.jsx(l,{children:"Ctrl+`"}),e.jsx("span",{children:"Open/close quick terminal"})]})}),e.jsxs(t,{id:"tailscale",title:"Tailscale Setup",icon:"🌐",children:[e.jsx("p",{children:"Tailscale Funnel gives HeyHank a public HTTPS URL without port forwarding, firewall changes, or a reverse proxy. It works by routing traffic through Tailscale's network to your machine."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"1. Install Tailscale"}),e.jsxs("p",{children:["Download from ",e.jsx("a",{href:"https://tailscale.com/download",target:"_blank",rel:"noopener",className:"text-cc-accent hover:underline",children:"tailscale.com/download"})," or install via CLI:"]}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"curl -fsSL https://tailscale.com/install.sh | sh"}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"2. Connect to your Tailnet"}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"tailscale up"}),e.jsxs("p",{className:"mt-1",children:["Follow the login URL to authenticate. Your machine will get a DNS name like ",e.jsx(n,{children:"machine.tail1234.ts.net"}),"."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"3. Enable Funnel"}),e.jsxs("p",{children:["HeyHank manages Funnel automatically. Go to ",e.jsx("strong",{children:"Settings"})," and click ",e.jsx("strong",{children:"Enable Tailscale Funnel"}),". This exposes HeyHank over HTTPS at your Tailscale DNS name."]}),e.jsx("p",{className:"mt-1",children:"You can also enable it manually:"}),e.jsxs("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:["tailscale funnel --bg ","{port}"]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"4. Linux: Operator Mode"}),e.jsx("p",{children:"If running HeyHank as a non-root user on Linux, you need to set operator mode so HeyHank can manage Funnel without sudo:"}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"sudo tailscale set --operator=$USER"}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Troubleshooting"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"DNS not propagated:"})," After enabling Funnel, DNS may take a few minutes to propagate. HeyHank will show a warning until resolution succeeds."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Operator mode needed:"})," On Linux, if you see permission errors, run ",e.jsx(n,{children:"sudo tailscale set --operator=$USER"})," and restart HeyHank."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Binary not found:"})," Ensure ",e.jsx(n,{children:"tailscale"})," is on your PATH. HeyHank checks for it automatically on startup."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Funnel not working:"})," Make sure Funnel is enabled in your Tailscale admin console under the DNS tab (Access Controls)."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-4",children:"Remote Ollama via Tailscale"}),e.jsx("p",{children:"If you run HeyHank on a VPS but Ollama on a local GPU machine, Tailscale provides a secure private connection without port forwarding or HTTPS certificates."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Setup"}),e.jsxs("ol",{className:"list-decimal pl-5 space-y-1.5",children:[e.jsxs("li",{children:["Install Tailscale on ",e.jsx("strong",{className:"text-cc-fg",children:"both"})," machines (VPS + GPU machine)"]}),e.jsxs("li",{children:["Join the same Tailnet: ",e.jsx(n,{children:"tailscale up"})," on each"]}),e.jsxs("li",{children:["On the GPU machine, ensure Ollama listens on all interfaces:",e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"OLLAMA_HOST=0.0.0.0 ollama serve"})]}),e.jsxs("li",{children:["In HeyHank Settings → Providers, set the Ollama URL to your Tailscale hostname:",e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"http://gpu-machine.tail1234.ts.net:11434"})]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Why Tailscale?"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Encrypted:"})," WireGuard encryption between all nodes — no need for HTTPS"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"No port forwarding:"})," Works behind NAT and firewalls"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Private:"})," Only your devices can reach the Ollama API"]})]})]}),e.jsxs(t,{id:"api",title:"API Reference",icon:"🔧",children:[e.jsxs("p",{children:["All endpoints are available under ",e.jsx(n,{children:"/api/"}),". Authentication via bearer token."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Sessions"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/sessions — List all sessions"}),e.jsx("p",{children:"POST /api/sessions — Create new session"}),e.jsx("p",{children:"DELETE /api/sessions/:id — Delete session"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agents"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/agents — List all agents"}),e.jsx("p",{children:"POST /api/agents — Create agent"}),e.jsx("p",{children:"PUT /api/agents/:id — Update agent"}),e.jsx("p",{children:"DELETE /api/agents/:id — Delete agent"}),e.jsx("p",{children:"POST /api/agents/:id/run — Run agent"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Media"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"POST /api/media/generate-image — Generate image"}),e.jsx("p",{children:"POST /api/media/generate-video — Generate video"}),e.jsx("p",{children:"GET /api/media — List all media"}),e.jsx("p",{children:"GET /api/media/file/:filename — Get media file"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Telephony"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"POST /api/telephony/calls — Start a call"}),e.jsx("p",{children:"GET /api/telephony/calls — Active calls"}),e.jsx("p",{children:"DELETE /api/telephony/calls/:id — End call"}),e.jsx("p",{children:"GET /api/telephony/history — Call history"}),e.jsx("p",{children:"GET/PUT /api/telephony/settings — Telephony settings"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Federation"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/federation/identity — This node's identity"}),e.jsx("p",{children:"GET /api/federation/nodes — Connected nodes"}),e.jsx("p",{children:"POST /api/federation/nodes — Add node"}),e.jsx("p",{children:"DELETE /api/federation/nodes/:id — Remove node"}),e.jsx("p",{children:"GET /api/federation/remote-sessions — Sessions from other nodes"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Platform"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/costs/summary — Cost summary"}),e.jsx("p",{children:"GET/POST /api/kill-switch — Kill switch"}),e.jsx("p",{children:"GET /api/llm/providers — LLM provider status"}),e.jsx("p",{children:"GET /api/shared-context — Shared context files"}),e.jsx("p",{children:"POST /api/llm/chat — Direct LLM call"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Gemini"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /gemini/config — Voice assistant config + active sessions"}),e.jsx("p",{children:"POST /gemini/tool-call — Execute a Gemini tool call"})]})]}),e.jsxs("div",{className:"text-center text-xs text-cc-muted pt-4 pb-8 space-y-1",children:[e.jsx("p",{children:"HeyHank — Self-hosted AI Agent Platform"}),e.jsxs("p",{children:["Bugs or feature requests?"," ",e.jsx("a",{href:"https://github.com/heyhank-app/heyhank/issues",target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:"Open an issue on GitHub"})]})]})]})})}export{p as HelpPage};
1
+ import{j as e,r as x}from"./index-C6Q5UQHD.js";function t({id:s,title:a,icon:r,children:c,defaultOpen:d=!1}){const[o,h]=x.useState(d);return e.jsxs("div",{id:s,className:"border border-cc-border rounded-xl overflow-hidden",children:[e.jsxs("button",{onClick:()=>h(!o),className:"w-full flex items-center gap-3 px-5 py-4 text-left hover:bg-cc-hover/50 transition-colors",children:[e.jsx("span",{className:"text-xl shrink-0",children:r}),e.jsx("span",{className:"text-sm font-semibold text-cc-fg flex-1",children:a}),e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:`w-4 h-4 text-cc-muted transition-transform ${o?"rotate-180":""}`,children:e.jsx("path",{d:"M4.22 6.22a.75.75 0 011.06 0L8 8.94l2.72-2.72a.75.75 0 111.06 1.06l-3.25 3.25a.75.75 0 01-1.06 0L4.22 7.28a.75.75 0 010-1.06z"})})]}),o&&e.jsxs("div",{className:"px-5 pb-5 text-sm text-cc-muted leading-relaxed space-y-3 border-t border-cc-border/50",children:[e.jsx("div",{className:"pt-4"}),c]})]})}function l({children:s}){return e.jsx("kbd",{className:"inline-block px-1.5 py-0.5 rounded bg-cc-card border border-cc-border text-[11px] font-mono text-cc-fg",children:s})}function i({n:s,children:a}){return e.jsxs("div",{className:"flex gap-3 items-start",children:[e.jsx("span",{className:"shrink-0 w-6 h-6 rounded-full bg-cc-primary/20 text-cc-primary text-xs font-bold flex items-center justify-center mt-0.5",children:s}),e.jsx("div",{className:"flex-1",children:a})]})}function n({children:s}){return e.jsx("code",{className:"text-xs bg-cc-card px-1 rounded",children:s})}function m(){const s=[{id:"overview",label:"Overview"},{id:"first-steps",label:"Getting Started"},{id:"gemini-live",label:"Gemini Live"},{id:"agents",label:"Agents"},{id:"sessions",label:"Sessions & Chat"},{id:"media",label:"Media Generation"},{id:"telephony",label:"Telephony"},{id:"federation",label:"Federation"},{id:"sidebar",label:"Sidebar & Navigation"},{id:"platform",label:"Platform Dashboard"},{id:"pwa",label:"PWA & Mobile"},{id:"keyboard",label:"Keyboard Shortcuts"},{id:"tailscale",label:"Tailscale Setup"},{id:"api",label:"API Reference"}];return e.jsx("div",{className:"flex flex-wrap gap-2",children:s.map(a=>e.jsx("a",{href:`#/help?s=${a.id}`,onClick:r=>{var c;r.preventDefault(),(c=document.getElementById(a.id))==null||c.scrollIntoView({behavior:"smooth",block:"start"})},className:"px-3 py-1.5 rounded-lg bg-cc-card border border-cc-border text-xs text-cc-muted hover:text-cc-fg hover:border-cc-primary/50 transition-colors",children:a.label},a.id))})}function p(){return e.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe space-y-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-bold text-cc-fg",children:"HeyHank Help"}),e.jsx("p",{className:"text-sm text-cc-muted mt-1",children:"Self-hosted AI agent platform with voice assistant, telephony, media generation and multi-node federation."})]}),e.jsx(m,{}),e.jsxs(t,{id:"overview",title:"Overview",icon:"🏠",defaultOpen:!0,children:[e.jsx("p",{children:"HeyHank is your self-hosted AI agent platform. Create custom agents with any LLM backend, talk to them via Gemini Live voice, make phone calls through SIP, generate images and videos, and connect multiple HeyHank instances together."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Key Features"}),e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2 mt-1",children:[{name:"Custom Agents",desc:"Create unlimited agents",color:"text-blue-400"},{name:"Gemini Live",desc:"Voice assistant",color:"text-green-400"},{name:"Telephony",desc:"AI phone calls via SIP",color:"text-purple-400"},{name:"Media Gen",desc:"Images & videos",color:"text-pink-400"},{name:"Federation",desc:"Multi-node mesh",color:"text-yellow-400"},{name:"Multi-LLM",desc:"Claude, Gemini, Ollama",color:"text-orange-400"}].map(s=>e.jsxs("div",{className:"rounded-lg bg-cc-card p-3 border border-cc-border/50",children:[e.jsx("div",{className:`text-xs font-semibold ${s.color}`,children:s.name}),e.jsx("div",{className:"text-[11px] text-cc-muted mt-0.5",children:s.desc})]},s.name))}),e.jsxs("p",{className:"mt-2",children:[e.jsx("strong",{className:"text-cc-fg",children:"LLM Backends:"})," Claude Code CLI (Max subscription or API), Ollama (local, free), Gemini API, Codex CLI — configurable per agent."]})]}),e.jsxs(t,{id:"first-steps",title:"Getting Started",icon:"🚀",children:[e.jsx(i,{n:1,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Install"})," — ",e.jsx(n,{children:"npx heyhank"})," or ",e.jsx(n,{children:"bunx heyhank"}),". HeyHank starts on port 3100 by default."]})}),e.jsx(i,{n:2,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Log in"})," — Open the URL and enter the auth token shown in the terminal."]})}),e.jsx(i,{n:3,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Start a session"})," — Click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Session"})," in the sidebar. Choose a working directory and backend (Claude/Codex)."]})}),e.jsx(i,{n:4,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Chat"})," — Type your message and press ",e.jsx(l,{children:"Enter"}),". The agent responds with text, executes tools, and asks for permission when needed."]})}),e.jsx(i,{n:5,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Create an agent"})," — Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Agents"})," in the sidebar, click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Agent"}),". Give it a name, prompt, model, and working directory."]})}),e.jsx(i,{n:6,children:e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Talk to Gemini"})," — Click the microphone button (bottom right) to start a voice conversation with Gemini Live. It can control your agents, make calls, and more."]})})]}),e.jsxs(t,{id:"gemini-live",title:"Gemini Live — Voice Assistant",icon:"🎙",children:[e.jsx("p",{children:"Gemini Live is your always-available voice interface. It uses Google's BidiGenerateContent API for real-time bidirectional audio streaming — you talk, it responds instantly with voice."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How to use"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click the ",e.jsx("strong",{className:"text-cc-fg",children:"microphone button"})," (floating, bottom right) to start."]}),e.jsxs("li",{children:["A draggable voice chat overlay appears. You can ",e.jsx("strong",{className:"text-cc-fg",children:"minimize"})," it (session stays alive) or ",e.jsx("strong",{className:"text-cc-fg",children:"close"})," it (ends session)."]}),e.jsx("li",{children:"Speak naturally — Gemini responds with voice in real-time."}),e.jsx("li",{children:"Drag the overlay anywhere on screen. On mobile, it stays accessible while you browse."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"What Gemini can do"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Run agents"}),' — "Start a coding agent on /my/project"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Send messages"}),' — "Tell session 3 to run the tests"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Create agents"}),' — "Create an agent called Monitor that checks server health"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Make phone calls"}),' — "Call +43 1 234 5678 and ask about the appointment" (requires SIP trunk)']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"List sessions"}),` — "What's running right now?"`]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Monitor agents"}),' — "What is the coding agent doing?"']})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Multimodal input"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Images"})," — Click the image icon to upload photos or documents for Gemini to analyze."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Camera"})," — Click the camera icon to stream your live camera feed. Gemini receives a frame every 2 seconds."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Videos"})," — Upload a video file; HeyHank extracts key frames and sends them to Gemini."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Requirements"}),e.jsxs("p",{children:["Requires a ",e.jsx(n,{children:"GEMINI_API_KEY"})," environment variable. Get one free at ",e.jsx("strong",{className:"text-cc-fg",children:"aistudio.google.com"}),"."]})]}),e.jsxs(t,{id:"agents",title:"Agents",icon:"🤖",children:[e.jsx("p",{children:"Agents are the core of HeyHank. Each agent is a configured AI session with its own name, system prompt, LLM model, working directory, and permission mode."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Create an agent"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Agents"})," in the sidebar."]}),e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"+ New Agent"}),"."]}),e.jsx("li",{children:"Configure: name, description, system prompt, model, backend, working directory."}),e.jsx("li",{children:"Optionally set triggers: cron schedule (e.g. run every hour) or webhook."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Run an agent"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"Run"})," on an agent card — starts a new session with the agent's prompt."]}),e.jsx("li",{children:"Some agents may ask for input before they start (configurable)."}),e.jsx("li",{children:'You can also ask Gemini Live: "Run the coding agent" or "Start monitor".'})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agent examples"}),e.jsx("div",{className:"space-y-1.5 mt-1",children:[{name:"Coding Agent",desc:"Develops features, fixes bugs, writes tests. Works in your project directory with full file and terminal access."},{name:"Monitoring Agent",desc:"Checks server health: CPU, RAM, disk, Docker, PM2. Runs on a cron schedule. Read-only mode recommended."},{name:"Content Agent",desc:"Creates social media posts, generates images with Imagen, produces videos with Veo."},{name:"Personal Agent",desc:"Email management, calendar, reminders. Connects via IMAP/SMTP."}].map(s=>e.jsxs("div",{className:"rounded-lg bg-cc-card p-3 border border-cc-border/50",children:[e.jsx("span",{className:"text-xs font-semibold text-cc-fg",children:s.name}),e.jsx("span",{className:"text-[11px] text-cc-muted ml-2",children:s.desc})]},s.name))}),e.jsx("p",{className:"text-[11px] mt-1",children:"These are just examples — create whatever agents you need for your workflow."})]}),e.jsxs(t,{id:"sessions",title:"Sessions & Chat",icon:"💬",children:[e.jsx("h4",{className:"font-semibold text-cc-fg",children:"Create a new session"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Click ",e.jsx("strong",{className:"text-cc-fg",children:"+"})," in the sidebar or ",e.jsx("strong",{className:"text-cc-fg",children:"New Session"})," on the home page."]}),e.jsxs("li",{children:["Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"working directory"})," — this is where the agent operates."]}),e.jsxs("li",{children:["Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"backend"}),": Claude (recommended) or Codex."]}),e.jsxs("li",{children:["Choose the ",e.jsx("strong",{className:"text-cc-fg",children:"permission mode"}),": Accept Edits (default), Plan, Default."]}),e.jsxs("li",{children:["Optional: Choose a ",e.jsx("strong",{className:"text-cc-fg",children:"git branch"})," as starting point."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"In the chat"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Composer"})," — Type a message, press ",e.jsx(l,{children:"Enter"})," to send."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"@-Mentions"})," — Type ",e.jsx(n,{children:"@"})," to reference files, folders or prompts."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"/Commands"})," — Type ",e.jsx(n,{children:"/"})," for available commands and skills."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Images"})," — Drag & drop or file upload in the composer."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Permission requests"})," — When the agent wants to use a tool, a yellow banner appears. Click Allow or Deny."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Streaming"})," — Responses are streamed in real time."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Session lifecycle"}),e.jsx("p",{children:"Sessions persist across page reloads and server restarts. Return to any session at any time — the full chat history is preserved."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Session tabs"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Chat"})," — The main conversation with the agent."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Diff"})," — Git changes the agent has made. Badge = changed file count."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Terminal"})," — Shell terminal within the session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Processes"})," — Running processes of the session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Editor"})," — File editor for direct editing."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Browser"})," — Embedded browser for web development."]})]})]}),e.jsxs(t,{id:"media",title:"Media Generation (Image & Video)",icon:"🎨",children:[e.jsx("p",{children:"Generate images and videos via Google AI APIs directly from agent sessions."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Image Generation (Imagen)"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Models: ",e.jsx(n,{children:"imagen-4.0-fast-generate-001"})," (fast), ",e.jsx(n,{children:"imagen-4.0-generate-001"})," (quality), ",e.jsx(n,{children:"imagen-4.0-ultra-generate-001"})]}),e.jsx("li",{children:"Aspect ratios: 1:1, 16:9, 9:16, 4:3, 3:4"}),e.jsx("li",{children:"Output: PNG file, saved and accessible via URL"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Video Generation (Veo)"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Models: ",e.jsx(n,{children:"veo-3.1-fast-generate-preview"})," (fast), ",e.jsx(n,{children:"veo-3.1-generate-preview"})," (best quality)"]}),e.jsx("li",{children:"Asynchronous generation — takes 1-3 minutes for a 5-8 second video."}),e.jsx("li",{children:"Output: MP4 file"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"View media"}),e.jsxs("p",{children:["All generated media is listed at ",e.jsx(n,{children:"/api/media"})," and can be opened directly in the browser."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Requirements"}),e.jsxs("p",{children:["Requires a ",e.jsx(n,{children:"GEMINI_API_KEY"})," with access to Imagen and Veo models."]})]}),e.jsxs(t,{id:"telephony",title:"Telephony — AI Phone Calls",icon:"📞",children:[e.jsx("p",{children:"HeyHank can make and receive phone calls using Gemini Live as the voice engine. Calls go through a SIP trunk connected to FreeSWITCH, with Gemini handling the conversation."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How it works"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"FreeSWITCH"})," handles the SIP connection to the phone network."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Gemini Live"})," acts as both speech-to-text, LLM, and text-to-speech — no separate STT/TTS services needed."]}),e.jsx("li",{children:"Audio is bridged in real-time: FreeSWITCH (8kHz PCM) is resampled to Gemini (16kHz) and back."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Setup"}),e.jsx(i,{n:1,children:e.jsx("p",{children:"Get a SIP trunk from a provider (e.g. peoplefone, sipgate, easybell)."})}),e.jsx(i,{n:2,children:e.jsxs("p",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Settings → Telephony"})," and add your SIP trunk credentials."]})}),e.jsx(i,{n:3,children:e.jsx("p",{children:"Start the FreeSWITCH Docker container (included in the HeyHank package)."})}),e.jsx(i,{n:4,children:e.jsx("p",{children:"Test the connection in Settings, then make calls via the Telephony page or Gemini voice command."})}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Making calls"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Telephony page"})," — Dial a number, describe the task, and start the call."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Gemini voice"}),' — "Call +43 1 234 5678 and ask about the delivery"']}),e.jsx("li",{children:"Live transcript is displayed in real-time during the call."}),e.jsx("li",{children:"Call history with summaries is saved automatically."})]})]}),e.jsxs(t,{id:"federation",title:"Federation — Multi-Node",icon:"🌐",children:[e.jsx("p",{children:"Connect multiple HeyHank instances together in a peer-to-peer mesh. Run HeyHank on your laptop, VPS, or both — all nodes see each other's sessions and agents."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"How it works"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:["Each HeyHank instance is a ",e.jsx("strong",{className:"text-cc-fg",children:"node"})," with a unique ID."]}),e.jsx("li",{children:"Nodes connect to each other via WebSocket with shared-secret authentication."}),e.jsx("li",{children:"Sessions and agents are synced automatically — remote sessions appear in your sidebar with a node badge."}),e.jsx("li",{children:"Gemini on any node can see and control sessions across all connected nodes."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Setup"}),e.jsx(i,{n:1,children:e.jsxs("p",{children:["Go to ",e.jsx("strong",{className:"text-cc-fg",children:"Settings → Federation"})," on both nodes."]})}),e.jsx(i,{n:2,children:e.jsx("p",{children:"Copy the connection URL from Node B."})}),e.jsx(i,{n:3,children:e.jsxs("p",{children:["On Node A, click ",e.jsx("strong",{className:"text-cc-fg",children:"Add Node"})," and paste the URL + shared secret."]})}),e.jsx(i,{n:4,children:e.jsx("p",{children:"Both nodes now see each other's sessions. Gemini can control agents across both."})}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Offline handling"}),e.jsx("p",{children:"If a node goes offline, its sessions are marked as disconnected and disappear after 60 seconds. When the node comes back, auto-reconnect restores everything."})]}),e.jsxs(t,{id:"sidebar",title:"Sidebar — Navigation",icon:"📋",children:[e.jsx("p",{children:"The sidebar is your main navigation. On mobile, open it with the hamburger icon. On desktop, it's always visible."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Upper area: Sessions"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"+ Button"})," — Start a new chat session."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Session list"})," — All active sessions, grouped by project. Click to open."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Right-click / 3-dots"})," — Rename, Archive, Delete."]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Archived sessions"})," — Collapsible at the bottom, can be restored."]}),e.jsx("li",{children:"Status dots: green = connected, yellow = reconnecting, red = disconnected."}),e.jsx("li",{children:"Badge = open permission requests awaiting confirmation."}),e.jsx("li",{children:"Node badge = session is from a remote federated node."})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Lower area: Pages"}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Workbench:"})," Prompts, Integrations, Terminal"]}),e.jsxs("p",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Workspace:"})," Environments, Agents, Telephony, Platform, Settings, Help"]})]})]}),e.jsxs(t,{id:"platform",title:"Platform Dashboard",icon:"📊",children:[e.jsx("p",{children:"The Platform page shows the overall state of your agent system."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Kill Switch"}),e.jsx("p",{children:"Emergency stop for all agents. Red KILL button stops everything immediately."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Cost Tracking"}),e.jsx("p",{children:"Total costs, token usage (in/out), and per-session cost breakdown with model info."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"LLM Providers"}),e.jsx("p",{children:"Status of all LLM backends: Claude, Gemini, Ollama, Codex. Green = available, yellow = needs API key."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agent Messages"}),e.jsx("p",{children:"Last 20 inter-agent messages — see how agents communicate with each other."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Shared Context"}),e.jsx("p",{children:"Shared knowledge files accessible by all agents. Click to read, edit to modify."})]}),e.jsxs(t,{id:"pwa",title:"PWA & Mobile",icon:"📱",children:[e.jsx("h4",{className:"font-semibold text-cc-fg",children:"Install as app"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"iPhone/iPad:"}),' Safari → Share → "Add to Home Screen"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Android:"}),' Chrome → Menu → "Install app"']}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Desktop:"})," Chrome/Edge → Address bar → Install icon"]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Push Notifications"}),e.jsx("p",{children:"HeyHank can send push notifications for agent alerts and monitoring warnings. Enable on first visit when the browser asks for permission."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Mobile tips"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsx("li",{children:"The Gemini Live voice overlay is draggable and collapsible — works well on small screens."}),e.jsx("li",{children:"Use the camera icon in voice chat to stream your phone camera to Gemini."}),e.jsx("li",{children:"The PWA caches static assets for fast loading. Agent interaction requires a connection."})]})]}),e.jsx(t,{id:"keyboard",title:"Keyboard Shortcuts",icon:"⌨",children:e.jsxs("div",{className:"grid grid-cols-[auto_1fr] gap-x-6 gap-y-2",children:[e.jsx(l,{children:"Enter"}),e.jsx("span",{children:"Send message"}),e.jsx(l,{children:"Shift+Enter"}),e.jsx("span",{children:"New line in composer"}),e.jsx(l,{children:"Escape"}),e.jsx("span",{children:"Deny permission request / Interrupt"}),e.jsx(l,{children:"@"}),e.jsx("span",{children:"Reference file/folder/prompt"}),e.jsx(l,{children:"/"}),e.jsx("span",{children:"Commands and skills"}),e.jsx(l,{children:"Ctrl+`"}),e.jsx("span",{children:"Open/close quick terminal"})]})}),e.jsxs(t,{id:"tailscale",title:"Tailscale Setup",icon:"🌐",children:[e.jsx("p",{children:"Tailscale Funnel gives HeyHank a public HTTPS URL without port forwarding, firewall changes, or a reverse proxy. It works by routing traffic through Tailscale's network to your machine."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"1. Install Tailscale"}),e.jsxs("p",{children:["Download from ",e.jsx("a",{href:"https://tailscale.com/download",target:"_blank",rel:"noopener",className:"text-cc-accent hover:underline",children:"tailscale.com/download"})," or install via CLI:"]}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"curl -fsSL https://tailscale.com/install.sh | sh"}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"2. Connect to your Tailnet"}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"tailscale up"}),e.jsxs("p",{className:"mt-1",children:["Follow the login URL to authenticate. Your machine will get a DNS name like ",e.jsx(n,{children:"machine.tail1234.ts.net"}),"."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"3. Enable Funnel"}),e.jsxs("p",{children:["HeyHank manages Funnel automatically. Go to ",e.jsx("strong",{children:"Settings"})," and click ",e.jsx("strong",{children:"Enable Tailscale Funnel"}),". This exposes HeyHank over HTTPS at your Tailscale DNS name."]}),e.jsx("p",{className:"mt-1",children:"You can also enable it manually:"}),e.jsxs("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:["tailscale funnel --bg ","{port}"]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"4. Linux: Operator Mode"}),e.jsx("p",{children:"If running HeyHank as a non-root user on Linux, you need to set operator mode so HeyHank can manage Funnel without sudo:"}),e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"sudo tailscale set --operator=$USER"}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Troubleshooting"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{children:"DNS not propagated:"})," After enabling Funnel, DNS may take a few minutes to propagate. HeyHank will show a warning until resolution succeeds."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Operator mode needed:"})," On Linux, if you see permission errors, run ",e.jsx(n,{children:"sudo tailscale set --operator=$USER"})," and restart HeyHank."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Binary not found:"})," Ensure ",e.jsx(n,{children:"tailscale"})," is on your PATH. HeyHank checks for it automatically on startup."]}),e.jsxs("li",{children:[e.jsx("strong",{children:"Funnel not working:"})," Make sure Funnel is enabled in your Tailscale admin console under the DNS tab (Access Controls)."]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-4",children:"Remote Ollama via Tailscale"}),e.jsx("p",{children:"If you run HeyHank on a VPS but Ollama on a local GPU machine, Tailscale provides a secure private connection without port forwarding or HTTPS certificates."}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Setup"}),e.jsxs("ol",{className:"list-decimal pl-5 space-y-1.5",children:[e.jsxs("li",{children:["Install Tailscale on ",e.jsx("strong",{className:"text-cc-fg",children:"both"})," machines (VPS + GPU machine)"]}),e.jsxs("li",{children:["Join the same Tailnet: ",e.jsx(n,{children:"tailscale up"})," on each"]}),e.jsxs("li",{children:["On the GPU machine, ensure Ollama listens on all interfaces:",e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"OLLAMA_HOST=0.0.0.0 ollama serve"})]}),e.jsxs("li",{children:["In HeyHank Settings → Providers, set the Ollama URL to your Tailscale hostname:",e.jsx("div",{className:"font-mono text-xs bg-cc-bg rounded p-2 mt-1",children:"http://gpu-machine.tail1234.ts.net:11434"})]})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-3",children:"Why Tailscale?"}),e.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Encrypted:"})," WireGuard encryption between all nodes — no need for HTTPS"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"No port forwarding:"})," Works behind NAT and firewalls"]}),e.jsxs("li",{children:[e.jsx("strong",{className:"text-cc-fg",children:"Private:"})," Only your devices can reach the Ollama API"]})]})]}),e.jsxs(t,{id:"api",title:"API Reference",icon:"🔧",children:[e.jsxs("p",{children:["All endpoints are available under ",e.jsx(n,{children:"/api/"}),". Authentication via bearer token."]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Sessions"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/sessions — List all sessions"}),e.jsx("p",{children:"POST /api/sessions — Create new session"}),e.jsx("p",{children:"DELETE /api/sessions/:id — Delete session"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Agents"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/agents — List all agents"}),e.jsx("p",{children:"POST /api/agents — Create agent"}),e.jsx("p",{children:"PUT /api/agents/:id — Update agent"}),e.jsx("p",{children:"DELETE /api/agents/:id — Delete agent"}),e.jsx("p",{children:"POST /api/agents/:id/run — Run agent"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Media"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"POST /api/media/generate-image — Generate image"}),e.jsx("p",{children:"POST /api/media/generate-video — Generate video"}),e.jsx("p",{children:"GET /api/media — List all media"}),e.jsx("p",{children:"GET /api/media/file/:filename — Get media file"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Telephony"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"POST /api/telephony/calls — Start a call"}),e.jsx("p",{children:"GET /api/telephony/calls — Active calls"}),e.jsx("p",{children:"DELETE /api/telephony/calls/:id — End call"}),e.jsx("p",{children:"GET /api/telephony/history — Call history"}),e.jsx("p",{children:"GET/PUT /api/telephony/settings — Telephony settings"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Federation"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/federation/identity — This node's identity"}),e.jsx("p",{children:"GET /api/federation/nodes — Connected nodes"}),e.jsx("p",{children:"POST /api/federation/nodes — Add node"}),e.jsx("p",{children:"DELETE /api/federation/nodes/:id — Remove node"}),e.jsx("p",{children:"GET /api/federation/remote-sessions — Sessions from other nodes"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Platform"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /api/costs/summary — Cost summary"}),e.jsx("p",{children:"GET/POST /api/kill-switch — Kill switch"}),e.jsx("p",{children:"GET /api/llm/providers — LLM provider status"}),e.jsx("p",{children:"GET /api/shared-context — Shared context files"}),e.jsx("p",{children:"POST /api/llm/chat — Direct LLM call"})]}),e.jsx("h4",{className:"font-semibold text-cc-fg mt-2",children:"Gemini"}),e.jsxs("div",{className:"font-mono text-xs space-y-0.5",children:[e.jsx("p",{children:"GET /gemini/config — Voice assistant config + active sessions"}),e.jsx("p",{children:"POST /gemini/tool-call — Execute a Gemini tool call"})]})]}),e.jsxs("div",{className:"text-center text-xs text-cc-muted pt-4 pb-8 space-y-1",children:[e.jsx("p",{children:"HeyHank — Self-hosted AI Agent Platform"}),e.jsxs("p",{children:["Bugs or feature requests?"," ",e.jsx("a",{href:"https://github.com/heyhank-app/heyhank/issues",target:"_blank",rel:"noopener noreferrer",className:"text-cc-primary hover:underline",children:"Open an issue on GitHub"})]})]})]})})}export{p as HelpPage};
@@ -1 +1 @@
1
- import{r as a,j as e,u as le,n as de,a as xe,b as Y}from"./index-BgYM4wXw.js";const Z={browser:"Browser",search:"Search",productivity:"Productivity",development:"Development",database:"Database",communication:"Communication",ai:"AI",other:"Other"};function me(){const[l,t]=a.useState([]),[b,C]=a.useState([]),[A,f]=a.useState(!0),[d,x]=a.useState(""),[u,h]=a.useState(!1),[j,v]=a.useState(!1),[g,y]=a.useState("all"),[o,_]=a.useState(null),[Q,M]=a.useState(null),[$,B]=a.useState(null),[k,D]=a.useState({}),[L,O]=a.useState(null),[S,T]=a.useState(""),[W,V]=a.useState(""),[N,R]=a.useState("stdio"),[E,q]=a.useState(""),[P,G]=a.useState(""),[I,H]=a.useState(""),[U,z]=a.useState(!1),X=async()=>{try{const[r,c]=await Promise.all([fetch("/api/mcp/servers").then(s=>s.ok?s.json():{servers:[]}).catch(()=>({servers:[]})),fetch("/api/mcp/catalog").then(s=>s.ok?s.json():{catalog:[]}).catch(()=>({catalog:[]}))]);t(r.servers||[]),C(c.catalog||[])}catch(r){x(r instanceof Error?r.message:String(r))}finally{f(!1)}};a.useEffect(()=>{X()},[]);const ee=async r=>{try{const c=await fetch(`/api/mcp/servers/${r}/toggle`,{method:"POST"});if(!c.ok)throw new Error("Toggle failed");const s=await c.json();t(n=>n.map(i=>i.id===r?{...i,...s}:i))}catch(c){x(c instanceof Error?c.message:String(c))}},re=async r=>{try{if(!(await fetch(`/api/mcp/servers/${r}`,{method:"DELETE"})).ok)throw new Error("Delete failed");t(s=>s.filter(n=>n.id!==r)),M(null)}catch(c){x(c instanceof Error?c.message:String(c))}},te=async r=>{var c;B(r);try{const s=await fetch("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({catalogId:r})});if(!s.ok)throw new Error("Installation failed");const n=await s.json();t(i=>[...i,n]),(c=n.requiresAuth)!=null&&c.length&&(_(n.id),h(!1))}catch(s){x(s instanceof Error?s.message:String(s))}finally{B(null)}},se=async()=>{if(S.trim()){z(!0);try{const r={name:S.trim(),description:W.trim(),type:N};N==="stdio"?(r.command=E.trim(),r.args=P.trim()?P.trim().split(/\s+/):[]):r.url=I.trim();const c=await fetch("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!c.ok)throw new Error("Installation failed");const s=await c.json();t(n=>[...n,s]),v(!1),T(""),V(""),q(""),G(""),H(""),R("stdio")}catch(r){x(r instanceof Error?r.message:String(r))}finally{z(!1)}}},ce=async r=>{const c=k[r];if(c){O(r);try{const s=await fetch(`/api/mcp/servers/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({authValues:c})});if(!s.ok)throw new Error("Save failed");const n=await s.json();t(i=>i.map(m=>m.id===r?{...m,...n}:m)),D(i=>{const m={...i};return delete m[r],m})}catch(s){x(s instanceof Error?s.message:String(s))}finally{O(null)}}},ae=r=>{var c;return((c=r.requiresAuth)==null?void 0:c.length)&&(!r.authValues||r.requiresAuth.some(s=>{var n;return!((n=r.authValues)!=null&&n[s.field])}))},ne=Array.from(new Set(b.map(r=>r.category))).sort(),F=g==="all"?b:b.filter(r=>r.category===g),oe=new Set(l.map(r=>r.name)),K=r=>r==="stdio"?"border-blue-500/30 bg-blue-500/10 text-blue-400":r==="http"?"border-purple-500/30 bg-purple-500/10 text-purple-400":"border-amber-500/30 bg-amber-500/10 text-amber-400";return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 2v6m0 8v6M4.93 4.93l4.24 4.24m5.66 5.66l4.24 4.24M2 12h6m8 0h6M4.93 19.07l4.24-4.24m5.66-5.66l4.24-4.24"})}),e.jsx("span",{children:"MCP Server"}),e.jsx(p,{active:l.some(r=>r.enabled)})]})}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Model Context Protocol"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"MCP servers give agents access to external tools (GitHub, Playwright, Slack, etc.)."}),d&&e.jsxs("div",{className:"mt-3 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:[d,e.jsx("button",{onClick:()=>x(""),className:"ml-2 underline cursor-pointer",children:"OK"})]}),e.jsx("div",{className:"mt-4 space-y-2",children:A?e.jsx("div",{className:"py-4 text-center text-xs text-cc-muted animate-pulse",children:"Loading MCP servers..."}):l.length===0?e.jsx("div",{className:"py-3 text-center text-xs text-cc-muted border border-dashed border-cc-border rounded-lg",children:"No MCP servers installed"}):l.map(r=>{var c;return e.jsxs("div",{className:"rounded-xl border border-cc-border/70 bg-cc-bg/60 overflow-hidden transition-colors hover:border-cc-border",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[e.jsx("button",{onClick:()=>_(o===r.id?null:r.id),className:"shrink-0 text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Details",children:e.jsx("svg",{className:`h-3.5 w-3.5 transition-transform ${o===r.id?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:r.name}),e.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider border ${K(r.type)}`,children:r.type}),ae(r)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] border border-amber-500/30 bg-amber-500/10 text-amber-400",children:[e.jsxs("svg",{className:"h-2.5 w-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",x2:"12",y1:"9",y2:"13"}),e.jsx("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})]}),"Credentials missing"]})]}),r.description&&e.jsx("p",{className:"text-xs text-cc-muted truncate mt-0.5",children:r.description})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>ee(r.id),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors cursor-pointer ${r.enabled?"bg-cc-success":"bg-cc-muted/30"}`,title:r.enabled?"Disable":"Enable",children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${r.enabled?"translate-x-4":"translate-x-0.5"}`})}),Q===r.id?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>re(r.id),className:"px-2 py-1 text-[10px] rounded bg-cc-error/20 text-cc-error border border-cc-error/30 hover:bg-cc-error/30 cursor-pointer",children:"Yes, delete"}),e.jsx("button",{onClick:()=>M(null),className:"px-2 py-1 text-[10px] rounded bg-cc-hover text-cc-muted border border-cc-border hover:text-cc-fg cursor-pointer",children:"No"})]}):e.jsx("button",{onClick:()=>M(r.id),className:"inline-flex h-7 w-7 items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer",title:"Delete",children:e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),o===r.id&&e.jsxs("div",{className:"border-t border-cc-border/50 bg-cc-bg/40 px-3.5 py-3 space-y-3",children:[e.jsxs("div",{className:"text-xs text-cc-muted space-y-1",children:[r.command&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"Command:"})," ",e.jsxs("code",{className:"bg-black/20 px-1.5 py-0.5 rounded text-[11px]",children:[r.command," ",(c=r.args)==null?void 0:c.join(" ")]})]}),r.url&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"URL:"})," ",e.jsx("code",{className:"bg-black/20 px-1.5 py-0.5 rounded text-[11px]",children:r.url})]}),r.assignedAgents.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"Assigned agents:"})," ",r.assignedAgents.join(", ")]})]}),r.requiresAuth&&r.requiresAuth.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-cc-fg/80",children:"Credentials"}),r.requiresAuth.map(s=>{var i,m;const n=((i=k[r.id])==null?void 0:i[s.field])??((m=r.authValues)==null?void 0:m[s.field])??"";return e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:s.label}),e.jsx("input",{type:"password",value:n,placeholder:s.helpText,onChange:ie=>D(J=>({...J,[r.id]:{...J[r.id]||{},[s.field]:ie.target.value}})),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50"})]},s.field)}),k[r.id]&&Object.keys(k[r.id]).length>0&&e.jsx("button",{onClick:()=>ce(r.id),disabled:L===r.id,className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary/20 text-cc-primary border border-cc-primary/30 hover:bg-cc-primary/30 transition-colors cursor-pointer disabled:opacity-50",children:L===r.id?"Saving...":"Save credentials"})]})]})]},r.id)})}),e.jsxs("div",{className:"mt-4 flex gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>{h(!u),v(!1)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-xs font-medium rounded-lg border border-cc-primary/30 bg-cc-primary/12 text-cc-fg hover:bg-cc-primary/20 hover:border-cc-primary/50 transition-colors cursor-pointer",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",x2:"12",y1:"5",y2:"19"}),e.jsx("line",{x1:"5",x2:"19",y1:"12",y2:"12"})]}),u?"Close catalog":"Add MCP server"]}),e.jsxs("button",{onClick:()=>{v(!j),h(!1)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),j?"Cancel":"Custom server"]})]}),j&&e.jsxs("div",{className:"mt-3 rounded-xl border border-cc-border/70 bg-cc-bg/60 p-4 space-y-3",children:[e.jsx("div",{className:"text-sm font-medium text-cc-fg",children:"Add custom MCP server"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Name *"}),e.jsx("input",{value:S,onChange:r=>T(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"e.g. my-mcp-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Type"}),e.jsxs("select",{value:N,onChange:r=>R(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg focus:outline-none focus:border-cc-primary/50 cursor-pointer",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"}),e.jsx("option",{value:"sse",children:"sse"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Description"}),e.jsx("input",{value:W,onChange:r=>V(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"What does this server do?"})]}),N==="stdio"?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Command *"}),e.jsx("input",{value:E,onChange:r=>q(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"npx / bun / python"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Arguments"}),e.jsx("input",{value:P,onChange:r=>G(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"-y @some/package"})]})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"URL *"}),e.jsx("input",{value:I,onChange:r=>H(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"https://..."})]}),e.jsx("button",{onClick:se,disabled:U||!S.trim()||(N==="stdio"?!E.trim():!I.trim()),className:"px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary/20 text-cc-primary border border-cc-primary/30 hover:bg-cc-primary/30 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:U?"Installing...":"Add server"})]}),u&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("button",{onClick:()=>y("all"),className:`px-2.5 py-1 text-[11px] rounded-lg border transition-colors cursor-pointer ${g==="all"?"border-cc-primary/40 bg-cc-primary/15 text-cc-fg":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:"All"}),ne.map(r=>e.jsx("button",{onClick:()=>y(r),className:`px-2.5 py-1 text-[11px] rounded-lg border transition-colors cursor-pointer ${g===r?"border-cc-primary/40 bg-cc-primary/15 text-cc-fg":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:Z[r]||r},r))]}),F.length===0?e.jsx("div",{className:"py-4 text-center text-xs text-cc-muted",children:"No catalog entries found."}):e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:F.map(r=>{var s;const c=oe.has(r.name);return e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-cc-border/70 bg-cc-bg/60 p-3 transition-colors hover:border-cc-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:r.name}),e.jsx("span",{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider border ${K(r.type)}`,children:r.type}),e.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] border border-cc-border bg-cc-hover/50 text-cc-muted",children:Z[r.category]||r.category})]}),e.jsx("p",{className:"text-xs text-cc-muted mt-1 line-clamp-2",children:r.description}),(s=r.requiresAuth)!=null&&s.length?e.jsx("p",{className:"text-[10px] text-amber-400 mt-1",children:"Requires credentials"}):null]}),e.jsx("button",{onClick:()=>!c&&te(r.id),disabled:c||$===r.id,className:`shrink-0 px-3 py-1.5 text-xs rounded-lg border transition-colors cursor-pointer disabled:cursor-not-allowed ${c?"border-cc-success/30 bg-cc-success/10 text-cc-success disabled:opacity-70":"border-cc-primary/30 bg-cc-primary/12 text-cc-primary hover:bg-cc-primary/25 disabled:opacity-50"}`,children:$===r.id?"...":c?"Installed":"Install"})]},r.id)})})]})]})}function p({active:l}){return l?e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Active"}):e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-muted/40","aria-label":"Not configured"})}function w({section:l}){return e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/settings",requestAnimationFrame(()=>{setTimeout(()=>{var t;(t=document.getElementById(l))==null||t.scrollIntoView({behavior:"smooth",block:"start"})},100)})},"aria-label":"Open settings",title:"Configure",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})}function ue({embedded:l=!1}){const[t,b]=a.useState(null),[C,A]=a.useState("");return a.useEffect(()=>{(async()=>{try{const[d,x,u,h,j]=await Promise.all([Y.getSettings(),Y.listAgents(),fetch("/api/email-accounts").then(o=>o.ok?o.json():[]).catch(()=>[]),fetch("/api/calendar-accounts").then(o=>o.ok?o.json():[]).catch(()=>[]),fetch("/api/mcp/plugins").then(o=>o.ok?o.json():{plugins:[]}).catch(()=>({plugins:[]}))]),v=Array.isArray(u)?u.length:0,g=Array.isArray(h)?h.length:0;let y=0;try{const o=await fetch("/api/push/status");o.ok&&(y=(await o.json()).subscriptions??0)}catch{}b({emailAccounts:v,calendarAccounts:g,geminiConfigured:!!d.geminiApiKeyConfigured,pushSubscriptions:y,claudeAuth:!!d.claudeCliAuth,codexAuth:!!d.codexCliAuth,agents:x.length,mcpPlugins:j.plugins||[]})}catch(d){A(d instanceof Error?d.message:String(d))}})()},[]),e.jsx("div",{className:`${l?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto`,children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-cc-fg",children:"Integrations"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connected services and their status."})]}),!l&&e.jsx("button",{onClick:()=>{const f=le.getState().currentSessionId;f?de(f):xe()},className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Back"})]}),C&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:C}),e.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(59,130,246,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v4a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),e.jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),e.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),e.jsx("span",{children:"Gemini Live"}),e.jsx(p,{active:(t==null?void 0:t.geminiConfigured)??!1})]}),e.jsx(w,{section:"gemini"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Voice Assistant"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Real-time voice control with Google Gemini. Controls agents, calendar, emails and todos by voice."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:t!=null&&t.geminiConfigured?"API key configured":"Not configured"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(251,146,60,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),e.jsx("span",{children:"Email"}),e.jsx(p,{active:((t==null?void 0:t.emailAccounts)??0)>0})]}),e.jsx(w,{section:"email"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"IMAP/SMTP Email"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Email accounts via IMAP/SMTP. Gemini can read, search, send and summarize emails."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.emailAccounts)??0)>0?`${t.emailAccounts} account${t.emailAccounts>1?"s":""} connected`:"No accounts"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(34,197,94,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("line",{x1:"16",x2:"16",y1:"2",y2:"6"}),e.jsx("line",{x1:"8",x2:"8",y1:"2",y2:"6"}),e.jsx("line",{x1:"3",x2:"21",y1:"10",y2:"10"})]}),e.jsx("span",{children:"Calendar"}),e.jsx(p,{active:((t==null?void 0:t.calendarAccounts)??0)>0})]}),e.jsx(w,{section:"calendar"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"CalDAV Calendar"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Google Calendar, iCloud, Outlook via CalDAV. View, create and manage events."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.calendarAccounts)??0)>0?`${t.calendarAccounts} account${t.calendarAccounts>1?"s":""} connected`:"No accounts"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(168,85,247,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),e.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),e.jsx("span",{children:"Push Notifications"}),e.jsx(p,{active:((t==null?void 0:t.pushSubscriptions)??0)>0})]}),e.jsx(w,{section:"notifications"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Agent Alerts"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Web push notifications when agents are done or need attention."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.pushSubscriptions)??0)>0?`${t.pushSubscriptions} subscription${t.pushSubscriptions>1?"s":""} active`:"Not enabled"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(234,179,8,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),e.jsx("polyline",{points:"7.5 4.21 12 6.81 16.5 4.21"}),e.jsx("polyline",{points:"7.5 19.79 7.5 14.6 3 12"}),e.jsx("polyline",{points:"21 12 16.5 14.6 16.5 19.79"}),e.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),e.jsx("line",{x1:"12",x2:"12",y1:"22.08",y2:"12"})]}),e.jsx("span",{children:"LLM Providers"}),e.jsx(p,{active:(t==null?void 0:t.claudeAuth)??!1})]}),e.jsx(w,{section:"providers"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Claude, Codex, Ollama"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"LLM backends for agent sessions. Claude Code CLI, OpenAI Codex, local Ollama."}),e.jsxs("div",{className:"mt-3 inline-flex items-center gap-3 text-xs text-cc-muted/95",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-lg border border-cc-border/80 bg-black/10 px-2.5 py-1.5 ${t!=null&&t.claudeAuth?"text-cc-success":""}`,children:["Claude ",t!=null&&t.claudeAuth?"OK":"--"]}),e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-lg border border-cc-border/80 bg-black/10 px-2.5 py-1.5 ${t!=null&&t.codexAuth?"text-cc-success":""}`,children:["Codex ",t!=null&&t.codexAuth?"OK":"--"]})]})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(236,72,153,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",x2:"9.01",y1:"9",y2:"9"}),e.jsx("line",{x1:"15",x2:"15.01",y1:"9",y2:"9"})]}),e.jsx("span",{children:"Agents"}),e.jsx(p,{active:((t==null?void 0:t.agents)??0)>0})]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/agents"},"aria-label":"Open agents",title:"Manage agents",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:e.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Agent Configuration"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Configured agents with custom system prompts, models and working directories."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.agents)??0)>0?`${t.agents} agent${t.agents>1?"s":""} configured`:"No agents"})]})]}),e.jsxs("section",{className:"sm:col-span-2 group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(16,185,129,0.10),transparent_52%)]"}),e.jsx("div",{className:"relative",children:e.jsx(me,{})})]})]})]})})}export{ue as IntegrationsPage};
1
+ import{r as a,j as e,u as le,n as de,a as xe,b as Y}from"./index-C6Q5UQHD.js";const Z={browser:"Browser",search:"Search",productivity:"Productivity",development:"Development",database:"Database",communication:"Communication",ai:"AI",other:"Other"};function me(){const[l,t]=a.useState([]),[b,C]=a.useState([]),[A,f]=a.useState(!0),[d,x]=a.useState(""),[u,h]=a.useState(!1),[j,v]=a.useState(!1),[g,y]=a.useState("all"),[o,_]=a.useState(null),[Q,M]=a.useState(null),[$,B]=a.useState(null),[k,D]=a.useState({}),[L,O]=a.useState(null),[S,T]=a.useState(""),[W,V]=a.useState(""),[N,R]=a.useState("stdio"),[E,q]=a.useState(""),[P,G]=a.useState(""),[I,H]=a.useState(""),[U,z]=a.useState(!1),X=async()=>{try{const[r,c]=await Promise.all([fetch("/api/mcp/servers").then(s=>s.ok?s.json():{servers:[]}).catch(()=>({servers:[]})),fetch("/api/mcp/catalog").then(s=>s.ok?s.json():{catalog:[]}).catch(()=>({catalog:[]}))]);t(r.servers||[]),C(c.catalog||[])}catch(r){x(r instanceof Error?r.message:String(r))}finally{f(!1)}};a.useEffect(()=>{X()},[]);const ee=async r=>{try{const c=await fetch(`/api/mcp/servers/${r}/toggle`,{method:"POST"});if(!c.ok)throw new Error("Toggle failed");const s=await c.json();t(n=>n.map(i=>i.id===r?{...i,...s}:i))}catch(c){x(c instanceof Error?c.message:String(c))}},re=async r=>{try{if(!(await fetch(`/api/mcp/servers/${r}`,{method:"DELETE"})).ok)throw new Error("Delete failed");t(s=>s.filter(n=>n.id!==r)),M(null)}catch(c){x(c instanceof Error?c.message:String(c))}},te=async r=>{var c;B(r);try{const s=await fetch("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({catalogId:r})});if(!s.ok)throw new Error("Installation failed");const n=await s.json();t(i=>[...i,n]),(c=n.requiresAuth)!=null&&c.length&&(_(n.id),h(!1))}catch(s){x(s instanceof Error?s.message:String(s))}finally{B(null)}},se=async()=>{if(S.trim()){z(!0);try{const r={name:S.trim(),description:W.trim(),type:N};N==="stdio"?(r.command=E.trim(),r.args=P.trim()?P.trim().split(/\s+/):[]):r.url=I.trim();const c=await fetch("/api/mcp/servers",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(r)});if(!c.ok)throw new Error("Installation failed");const s=await c.json();t(n=>[...n,s]),v(!1),T(""),V(""),q(""),G(""),H(""),R("stdio")}catch(r){x(r instanceof Error?r.message:String(r))}finally{z(!1)}}},ce=async r=>{const c=k[r];if(c){O(r);try{const s=await fetch(`/api/mcp/servers/${r}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({authValues:c})});if(!s.ok)throw new Error("Save failed");const n=await s.json();t(i=>i.map(m=>m.id===r?{...m,...n}:m)),D(i=>{const m={...i};return delete m[r],m})}catch(s){x(s instanceof Error?s.message:String(s))}finally{O(null)}}},ae=r=>{var c;return((c=r.requiresAuth)==null?void 0:c.length)&&(!r.authValues||r.requiresAuth.some(s=>{var n;return!((n=r.authValues)!=null&&n[s.field])}))},ne=Array.from(new Set(b.map(r=>r.category))).sort(),F=g==="all"?b:b.filter(r=>r.category===g),oe=new Set(l.map(r=>r.name)),K=r=>r==="stdio"?"border-blue-500/30 bg-blue-500/10 text-blue-400":r==="http"?"border-purple-500/30 bg-purple-500/10 text-purple-400":"border-amber-500/30 bg-amber-500/10 text-amber-400";return e.jsxs("div",{className:"relative",children:[e.jsx("div",{className:"flex items-center justify-between",children:e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:e.jsx("path",{d:"M12 2v6m0 8v6M4.93 4.93l4.24 4.24m5.66 5.66l4.24 4.24M2 12h6m8 0h6M4.93 19.07l4.24-4.24m5.66-5.66l4.24-4.24"})}),e.jsx("span",{children:"MCP Server"}),e.jsx(p,{active:l.some(r=>r.enabled)})]})}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Model Context Protocol"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"MCP servers give agents access to external tools (GitHub, Playwright, Slack, etc.)."}),d&&e.jsxs("div",{className:"mt-3 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:[d,e.jsx("button",{onClick:()=>x(""),className:"ml-2 underline cursor-pointer",children:"OK"})]}),e.jsx("div",{className:"mt-4 space-y-2",children:A?e.jsx("div",{className:"py-4 text-center text-xs text-cc-muted animate-pulse",children:"Loading MCP servers..."}):l.length===0?e.jsx("div",{className:"py-3 text-center text-xs text-cc-muted border border-dashed border-cc-border rounded-lg",children:"No MCP servers installed"}):l.map(r=>{var c;return e.jsxs("div",{className:"rounded-xl border border-cc-border/70 bg-cc-bg/60 overflow-hidden transition-colors hover:border-cc-border",children:[e.jsxs("div",{className:"flex items-center gap-3 px-3.5 py-2.5",children:[e.jsx("button",{onClick:()=>_(o===r.id?null:r.id),className:"shrink-0 text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",title:"Details",children:e.jsx("svg",{className:`h-3.5 w-3.5 transition-transform ${o===r.id?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:e.jsx("path",{d:"m9 18 6-6-6-6"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:r.name}),e.jsx("span",{className:`inline-flex items-center rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider border ${K(r.type)}`,children:r.type}),ae(r)&&e.jsxs("span",{className:"inline-flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] border border-amber-500/30 bg-amber-500/10 text-amber-400",children:[e.jsxs("svg",{className:"h-2.5 w-2.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",children:[e.jsx("path",{d:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z"}),e.jsx("line",{x1:"12",x2:"12",y1:"9",y2:"13"}),e.jsx("line",{x1:"12",x2:"12.01",y1:"17",y2:"17"})]}),"Credentials missing"]})]}),r.description&&e.jsx("p",{className:"text-xs text-cc-muted truncate mt-0.5",children:r.description})]}),e.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[e.jsx("button",{onClick:()=>ee(r.id),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors cursor-pointer ${r.enabled?"bg-cc-success":"bg-cc-muted/30"}`,title:r.enabled?"Disable":"Enable",children:e.jsx("span",{className:`inline-block h-3.5 w-3.5 rounded-full bg-white shadow transition-transform ${r.enabled?"translate-x-4":"translate-x-0.5"}`})}),Q===r.id?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("button",{onClick:()=>re(r.id),className:"px-2 py-1 text-[10px] rounded bg-cc-error/20 text-cc-error border border-cc-error/30 hover:bg-cc-error/30 cursor-pointer",children:"Yes, delete"}),e.jsx("button",{onClick:()=>M(null),className:"px-2 py-1 text-[10px] rounded bg-cc-hover text-cc-muted border border-cc-border hover:text-cc-fg cursor-pointer",children:"No"})]}):e.jsx("button",{onClick:()=>M(r.id),className:"inline-flex h-7 w-7 items-center justify-center rounded-lg text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer",title:"Delete",children:e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("polyline",{points:"3 6 5 6 21 6"}),e.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})})]})]}),o===r.id&&e.jsxs("div",{className:"border-t border-cc-border/50 bg-cc-bg/40 px-3.5 py-3 space-y-3",children:[e.jsxs("div",{className:"text-xs text-cc-muted space-y-1",children:[r.command&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"Command:"})," ",e.jsxs("code",{className:"bg-black/20 px-1.5 py-0.5 rounded text-[11px]",children:[r.command," ",(c=r.args)==null?void 0:c.join(" ")]})]}),r.url&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"URL:"})," ",e.jsx("code",{className:"bg-black/20 px-1.5 py-0.5 rounded text-[11px]",children:r.url})]}),r.assignedAgents.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-fg/70",children:"Assigned agents:"})," ",r.assignedAgents.join(", ")]})]}),r.requiresAuth&&r.requiresAuth.length>0&&e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"text-xs font-medium text-cc-fg/80",children:"Credentials"}),r.requiresAuth.map(s=>{var i,m;const n=((i=k[r.id])==null?void 0:i[s.field])??((m=r.authValues)==null?void 0:m[s.field])??"";return e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:s.label}),e.jsx("input",{type:"password",value:n,placeholder:s.helpText,onChange:ie=>D(J=>({...J,[r.id]:{...J[r.id]||{},[s.field]:ie.target.value}})),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50"})]},s.field)}),k[r.id]&&Object.keys(k[r.id]).length>0&&e.jsx("button",{onClick:()=>ce(r.id),disabled:L===r.id,className:"px-3 py-1.5 text-xs rounded-lg bg-cc-primary/20 text-cc-primary border border-cc-primary/30 hover:bg-cc-primary/30 transition-colors cursor-pointer disabled:opacity-50",children:L===r.id?"Saving...":"Save credentials"})]})]})]},r.id)})}),e.jsxs("div",{className:"mt-4 flex gap-2 flex-wrap",children:[e.jsxs("button",{onClick:()=>{h(!u),v(!1)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-xs font-medium rounded-lg border border-cc-primary/30 bg-cc-primary/12 text-cc-fg hover:bg-cc-primary/20 hover:border-cc-primary/50 transition-colors cursor-pointer",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("line",{x1:"12",x2:"12",y1:"5",y2:"19"}),e.jsx("line",{x1:"5",x2:"19",y1:"12",y2:"12"})]}),u?"Close catalog":"Add MCP server"]}),e.jsxs("button",{onClick:()=>{v(!j),h(!1)},className:"inline-flex items-center gap-1.5 px-3.5 py-2 text-xs rounded-lg border border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),j?"Cancel":"Custom server"]})]}),j&&e.jsxs("div",{className:"mt-3 rounded-xl border border-cc-border/70 bg-cc-bg/60 p-4 space-y-3",children:[e.jsx("div",{className:"text-sm font-medium text-cc-fg",children:"Add custom MCP server"}),e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Name *"}),e.jsx("input",{value:S,onChange:r=>T(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"e.g. my-mcp-server"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Type"}),e.jsxs("select",{value:N,onChange:r=>R(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg focus:outline-none focus:border-cc-primary/50 cursor-pointer",children:[e.jsx("option",{value:"stdio",children:"stdio"}),e.jsx("option",{value:"http",children:"http"}),e.jsx("option",{value:"sse",children:"sse"})]})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Description"}),e.jsx("input",{value:W,onChange:r=>V(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"What does this server do?"})]}),N==="stdio"?e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Command *"}),e.jsx("input",{value:E,onChange:r=>q(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"npx / bun / python"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"Arguments"}),e.jsx("input",{value:P,onChange:r=>G(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"-y @some/package"})]})]}):e.jsxs("div",{children:[e.jsx("label",{className:"block text-[11px] text-cc-muted mb-1",children:"URL *"}),e.jsx("input",{value:I,onChange:r=>H(r.target.value),className:"w-full rounded-lg border border-cc-border bg-cc-bg px-2.5 py-1.5 text-xs text-cc-fg placeholder:text-cc-muted/50 focus:outline-none focus:border-cc-primary/50",placeholder:"https://..."})]}),e.jsx("button",{onClick:se,disabled:U||!S.trim()||(N==="stdio"?!E.trim():!I.trim()),className:"px-4 py-2 text-xs font-medium rounded-lg bg-cc-primary/20 text-cc-primary border border-cc-primary/30 hover:bg-cc-primary/30 transition-colors cursor-pointer disabled:opacity-40 disabled:cursor-not-allowed",children:U?"Installing...":"Add server"})]}),u&&e.jsxs("div",{className:"mt-3 space-y-3",children:[e.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[e.jsx("button",{onClick:()=>y("all"),className:`px-2.5 py-1 text-[11px] rounded-lg border transition-colors cursor-pointer ${g==="all"?"border-cc-primary/40 bg-cc-primary/15 text-cc-fg":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:"All"}),ne.map(r=>e.jsx("button",{onClick:()=>y(r),className:`px-2.5 py-1 text-[11px] rounded-lg border transition-colors cursor-pointer ${g===r?"border-cc-primary/40 bg-cc-primary/15 text-cc-fg":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:Z[r]||r},r))]}),F.length===0?e.jsx("div",{className:"py-4 text-center text-xs text-cc-muted",children:"No catalog entries found."}):e.jsx("div",{className:"grid gap-2 sm:grid-cols-2",children:F.map(r=>{var s;const c=oe.has(r.name);return e.jsxs("div",{className:"flex items-start gap-3 rounded-xl border border-cc-border/70 bg-cc-bg/60 p-3 transition-colors hover:border-cc-border",children:[e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:r.name}),e.jsx("span",{className:`inline-flex rounded px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wider border ${K(r.type)}`,children:r.type}),e.jsx("span",{className:"inline-flex rounded px-1.5 py-0.5 text-[10px] border border-cc-border bg-cc-hover/50 text-cc-muted",children:Z[r.category]||r.category})]}),e.jsx("p",{className:"text-xs text-cc-muted mt-1 line-clamp-2",children:r.description}),(s=r.requiresAuth)!=null&&s.length?e.jsx("p",{className:"text-[10px] text-amber-400 mt-1",children:"Requires credentials"}):null]}),e.jsx("button",{onClick:()=>!c&&te(r.id),disabled:c||$===r.id,className:`shrink-0 px-3 py-1.5 text-xs rounded-lg border transition-colors cursor-pointer disabled:cursor-not-allowed ${c?"border-cc-success/30 bg-cc-success/10 text-cc-success disabled:opacity-70":"border-cc-primary/30 bg-cc-primary/12 text-cc-primary hover:bg-cc-primary/25 disabled:opacity-50"}`,children:$===r.id?"...":c?"Installed":"Install"})]},r.id)})})]})]})}function p({active:l}){return l?e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Active"}):e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-muted/40","aria-label":"Not configured"})}function w({section:l}){return e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/settings",requestAnimationFrame(()=>{setTimeout(()=>{var t;(t=document.getElementById(l))==null||t.scrollIntoView({behavior:"smooth",block:"start"})},100)})},"aria-label":"Open settings",title:"Configure",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})}function ue({embedded:l=!1}){const[t,b]=a.useState(null),[C,A]=a.useState("");return a.useEffect(()=>{(async()=>{try{const[d,x,u,h,j]=await Promise.all([Y.getSettings(),Y.listAgents(),fetch("/api/email-accounts").then(o=>o.ok?o.json():[]).catch(()=>[]),fetch("/api/calendar-accounts").then(o=>o.ok?o.json():[]).catch(()=>[]),fetch("/api/mcp/plugins").then(o=>o.ok?o.json():{plugins:[]}).catch(()=>({plugins:[]}))]),v=Array.isArray(u)?u.length:0,g=Array.isArray(h)?h.length:0;let y=0;try{const o=await fetch("/api/push/status");o.ok&&(y=(await o.json()).subscriptions??0)}catch{}b({emailAccounts:v,calendarAccounts:g,geminiConfigured:!!d.geminiApiKeyConfigured,pushSubscriptions:y,claudeAuth:!!d.claudeCliAuth,codexAuth:!!d.codexCliAuth,agents:x.length,mcpPlugins:j.plugins||[]})}catch(d){A(d instanceof Error?d.message:String(d))}})()},[]),e.jsx("div",{className:`${l?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto`,children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-cc-fg",children:"Integrations"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connected services and their status."})]}),!l&&e.jsx("button",{onClick:()=>{const f=le.getState().currentSessionId;f?de(f):xe()},className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm text-cc-muted hover:text-cc-fg hover:bg-cc-hover transition-colors cursor-pointer",children:"Back"})]}),C&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:C}),e.jsxs("div",{className:"grid gap-5 sm:grid-cols-2",children:[e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(59,130,246,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M12 2a3 3 0 0 0-3 3v4a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),e.jsx("path",{d:"M19 10v1a7 7 0 0 1-14 0v-1"}),e.jsx("line",{x1:"12",x2:"12",y1:"19",y2:"22"})]}),e.jsx("span",{children:"Gemini Live"}),e.jsx(p,{active:(t==null?void 0:t.geminiConfigured)??!1})]}),e.jsx(w,{section:"gemini"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Voice Assistant"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Real-time voice control with Google Gemini. Controls agents, calendar, emails and todos by voice."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:t!=null&&t.geminiConfigured?"API key configured":"Not configured"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(251,146,60,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"}),e.jsx("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"})]}),e.jsx("span",{children:"Email"}),e.jsx(p,{active:((t==null?void 0:t.emailAccounts)??0)>0})]}),e.jsx(w,{section:"email"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"IMAP/SMTP Email"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Email accounts via IMAP/SMTP. Gemini can read, search, send and summarize emails."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.emailAccounts)??0)>0?`${t.emailAccounts} account${t.emailAccounts>1?"s":""} connected`:"No accounts"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(34,197,94,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("rect",{width:"18",height:"18",x:"3",y:"4",rx:"2"}),e.jsx("line",{x1:"16",x2:"16",y1:"2",y2:"6"}),e.jsx("line",{x1:"8",x2:"8",y1:"2",y2:"6"}),e.jsx("line",{x1:"3",x2:"21",y1:"10",y2:"10"})]}),e.jsx("span",{children:"Calendar"}),e.jsx(p,{active:((t==null?void 0:t.calendarAccounts)??0)>0})]}),e.jsx(w,{section:"calendar"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"CalDAV Calendar"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Google Calendar, iCloud, Outlook via CalDAV. View, create and manage events."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.calendarAccounts)??0)>0?`${t.calendarAccounts} account${t.calendarAccounts>1?"s":""} connected`:"No accounts"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(168,85,247,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"}),e.jsx("path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0"})]}),e.jsx("span",{children:"Push Notifications"}),e.jsx(p,{active:((t==null?void 0:t.pushSubscriptions)??0)>0})]}),e.jsx(w,{section:"notifications"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Agent Alerts"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Web push notifications when agents are done or need attention."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.pushSubscriptions)??0)>0?`${t.pushSubscriptions} subscription${t.pushSubscriptions>1?"s":""} active`:"Not enabled"})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(234,179,8,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"}),e.jsx("polyline",{points:"7.5 4.21 12 6.81 16.5 4.21"}),e.jsx("polyline",{points:"7.5 19.79 7.5 14.6 3 12"}),e.jsx("polyline",{points:"21 12 16.5 14.6 16.5 19.79"}),e.jsx("polyline",{points:"3.27 6.96 12 12.01 20.73 6.96"}),e.jsx("line",{x1:"12",x2:"12",y1:"22.08",y2:"12"})]}),e.jsx("span",{children:"LLM Providers"}),e.jsx(p,{active:(t==null?void 0:t.claudeAuth)??!1})]}),e.jsx(w,{section:"providers"})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Claude, Codex, Ollama"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"LLM backends for agent sessions. Claude Code CLI, OpenAI Codex, local Ollama."}),e.jsxs("div",{className:"mt-3 inline-flex items-center gap-3 text-xs text-cc-muted/95",children:[e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-lg border border-cc-border/80 bg-black/10 px-2.5 py-1.5 ${t!=null&&t.claudeAuth?"text-cc-success":""}`,children:["Claude ",t!=null&&t.claudeAuth?"OK":"--"]}),e.jsxs("span",{className:`inline-flex items-center gap-1 rounded-lg border border-cc-border/80 bg-black/10 px-2.5 py-1.5 ${t!=null&&t.codexAuth?"text-cc-success":""}`,children:["Codex ",t!=null&&t.codexAuth?"OK":"--"]})]})]})]}),e.jsxs("section",{className:"group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(236,72,153,0.12),transparent_52%)]"}),e.jsxs("div",{className:"relative",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsxs("svg",{className:"h-3.5 w-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"12",cy:"12",r:"10"}),e.jsx("path",{d:"M8 14s1.5 2 4 2 4-2 4-2"}),e.jsx("line",{x1:"9",x2:"9.01",y1:"9",y2:"9"}),e.jsx("line",{x1:"15",x2:"15.01",y1:"9",y2:"9"})]}),e.jsx("span",{children:"Agents"}),e.jsx(p,{active:((t==null?void 0:t.agents)??0)>0})]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/agents"},"aria-label":"Open agents",title:"Manage agents",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsx("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:e.jsx("path",{d:"M5 12h14M12 5l7 7-7 7"})})})]}),e.jsx("h2",{className:"mt-4 text-lg font-semibold text-cc-fg",children:"Agent Configuration"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Configured agents with custom system prompts, models and working directories."}),e.jsx("div",{className:"mt-3 inline-flex items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:((t==null?void 0:t.agents)??0)>0?`${t.agents} agent${t.agents>1?"s":""} configured`:"No agents"})]})]}),e.jsxs("section",{className:"sm:col-span-2 group relative overflow-hidden rounded-2xl border border-cc-border/80 bg-cc-card p-5 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_12px_32px_rgba(0,0,0,0.14)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(16,185,129,0.10),transparent_52%)]"}),e.jsx("div",{className:"relative",children:e.jsx(me,{})})]})]})]})})}export{ue as IntegrationsPage};
@@ -1,4 +1,4 @@
1
- import{r as a,j as r}from"./index-BgYM4wXw.js";const M=2;function R(i){const e=Math.floor(i.byteLength/M);if(e===0)return 0;const s=new DataView(i.buffer,i.byteOffset,i.byteLength);let o=0;for(let p=0;p<e;p++){const c=s.getInt16(p*M,!0)/32768;o+=c*c}const n=Math.sqrt(o/e);return Math.min(1,n*3.2)}const P=a.forwardRef(function({onReady:e,className:s,state:o,label:n},p){const c=a.useRef(null),f=a.useRef(0),x=a.useRef(0),d=a.useRef(null),y=a.useRef(0),b=a.useRef(0),[k,m]=a.useState("idle");a.useEffect(()=>{e==null||e()},[]);function w(){const t=performance.now();t-y.current>120&&(f.current*=.92);const O=f.current,h=x.current,N=O>h?.35:.08,u=h+(O-h)*N;x.current=u;const j=c.current;j&&j.style.setProperty("--jarvis-amp",u.toFixed(3));const g=t<b.current;if(u<.01&&f.current<.01&&!g){j&&j.style.setProperty("--jarvis-amp","0"),x.current=0,d.current=null,m("idle");return}u>.05&&!g?m("speaking"):g&&m("flared"),d.current=requestAnimationFrame(w)}function v(){d.current==null&&(d.current=requestAnimationFrame(w))}a.useEffect(()=>()=>{d.current!=null&&cancelAnimationFrame(d.current)},[]),a.useImperativeHandle(p,()=>({feedPcm(t){if(t.byteLength===0)return;const l=R(t);f.current=Math.max(f.current*.6,l),y.current=performance.now(),v()},notifyEnd(){f.current*=.5,v()},interrupt(){f.current=0,x.current=0;const t=c.current;t&&t.style.setProperty("--jarvis-amp","0")},setMood(t){},playGesture(t,l=1.5){b.current=performance.now()+l*1e3,v(),m("flared")}}),[]);const A=o??(k==="flared"?"thinking":k);return r.jsxs("div",{ref:c,className:s??"absolute inset-0 flex items-center justify-center overflow-hidden","data-jarvis-state":A,style:{"--jarvis-amp":"0"},children:[r.jsx("style",{children:G}),r.jsx("div",{className:"jarvis-bg","aria-hidden":"true"}),r.jsxs("svg",{viewBox:"0 0 200 200",className:"jarvis-svg","aria-hidden":"true",children:[r.jsxs("defs",{children:[r.jsxs("radialGradient",{id:"jarvisOrb",cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:"#d8f3ff",stopOpacity:"0.95"}),r.jsx("stop",{offset:"30%",stopColor:"#3aa8ff",stopOpacity:"0.8"}),r.jsx("stop",{offset:"70%",stopColor:"#0a5ec4",stopOpacity:"0.35"}),r.jsx("stop",{offset:"100%",stopColor:"#0a5ec4",stopOpacity:"0"})]}),r.jsxs("radialGradient",{id:"jarvisCore",cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.95"}),r.jsx("stop",{offset:"45%",stopColor:"#8ad4ff",stopOpacity:"0.85"}),r.jsx("stop",{offset:"100%",stopColor:"#2b8bff",stopOpacity:"0"})]}),r.jsxs("filter",{id:"jarvisGlow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[r.jsx("feGaussianBlur",{stdDeviation:"2.2",result:"blur"}),r.jsxs("feMerge",{children:[r.jsx("feMergeNode",{in:"blur"}),r.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),r.jsxs("g",{className:"jarvis-ring-outer",transform:"translate(100 100)",children:[r.jsx("circle",{r:"94",fill:"none",stroke:"#3aa8ff",strokeOpacity:"0.25",strokeWidth:"0.5"}),r.jsx("circle",{r:"90",fill:"none",stroke:"#7fd0ff",strokeOpacity:"0.55",strokeWidth:"0.8",strokeDasharray:"1.5 5"})]}),r.jsxs("g",{className:"jarvis-ring-mid",transform:"translate(100 100)",children:[[0,90,180,270].map(t=>r.jsx("path",{d:C(0,0,72,t+8,t+82),fill:"none",stroke:"#5bbcff",strokeOpacity:"0.85",strokeWidth:"1.3",filter:"url(#jarvisGlow)"},t)),[0,90,180,270].map(t=>{const l=(t-3)*Math.PI/180;return r.jsx("line",{x1:68*Math.cos(l),y1:68*Math.sin(l),x2:78*Math.cos(l),y2:78*Math.sin(l),stroke:"#5bbcff",strokeOpacity:"0.9",strokeWidth:"1.2"},`t-${t}`)})]}),r.jsx("g",{className:"jarvis-ring-react",transform:"translate(100 100)",children:r.jsx("circle",{r:"55",fill:"none",stroke:"#7fd0ff",strokeOpacity:"0.9",strokeWidth:"1.5",filter:"url(#jarvisGlow)"})}),r.jsxs("g",{stroke:"#5bbcff",strokeOpacity:"0.4",strokeWidth:"0.7",children:[r.jsx("line",{x1:"100",y1:"38",x2:"100",y2:"50"}),r.jsx("line",{x1:"100",y1:"150",x2:"100",y2:"162"}),r.jsx("line",{x1:"38",y1:"100",x2:"50",y2:"100"}),r.jsx("line",{x1:"150",y1:"100",x2:"162",y2:"100"})]}),r.jsxs("g",{className:"jarvis-core",transform:"translate(100 100)",children:[r.jsx("circle",{r:"40",fill:"url(#jarvisOrb)"}),r.jsx("circle",{r:"22",fill:"url(#jarvisCore)"}),r.jsx("circle",{r:"3.5",fill:"#eafaff",fillOpacity:"0.95"})]}),r.jsx("g",{className:"jarvis-scan",transform:"translate(100 100)",children:r.jsx("line",{x1:"-62",y1:"0",x2:"62",y2:"0",stroke:"#7fd0ff",strokeOpacity:"0.55",strokeWidth:"0.9",filter:"url(#jarvisGlow)"})})]}),n&&r.jsxs("div",{className:"jarvis-label",children:[r.jsx("span",{className:"jarvis-dot"}),n]})]})});function C(i,e,s,o,n){const p=S(i,e,s,n),c=S(i,e,s,o),f=n-o<=180?0:1;return`M ${p.x} ${p.y} A ${s} ${s} 0 ${f} 0 ${c.x} ${c.y}`}function S(i,e,s,o){const n=o*Math.PI/180;return{x:i+s*Math.cos(n),y:e+s*Math.sin(n)}}const G=`
1
+ import{r as a,j as r}from"./index-C6Q5UQHD.js";const M=2;function R(i){const e=Math.floor(i.byteLength/M);if(e===0)return 0;const s=new DataView(i.buffer,i.byteOffset,i.byteLength);let o=0;for(let p=0;p<e;p++){const c=s.getInt16(p*M,!0)/32768;o+=c*c}const n=Math.sqrt(o/e);return Math.min(1,n*3.2)}const P=a.forwardRef(function({onReady:e,className:s,state:o,label:n},p){const c=a.useRef(null),f=a.useRef(0),x=a.useRef(0),d=a.useRef(null),y=a.useRef(0),b=a.useRef(0),[k,m]=a.useState("idle");a.useEffect(()=>{e==null||e()},[]);function w(){const t=performance.now();t-y.current>120&&(f.current*=.92);const O=f.current,h=x.current,N=O>h?.35:.08,u=h+(O-h)*N;x.current=u;const j=c.current;j&&j.style.setProperty("--jarvis-amp",u.toFixed(3));const g=t<b.current;if(u<.01&&f.current<.01&&!g){j&&j.style.setProperty("--jarvis-amp","0"),x.current=0,d.current=null,m("idle");return}u>.05&&!g?m("speaking"):g&&m("flared"),d.current=requestAnimationFrame(w)}function v(){d.current==null&&(d.current=requestAnimationFrame(w))}a.useEffect(()=>()=>{d.current!=null&&cancelAnimationFrame(d.current)},[]),a.useImperativeHandle(p,()=>({feedPcm(t){if(t.byteLength===0)return;const l=R(t);f.current=Math.max(f.current*.6,l),y.current=performance.now(),v()},notifyEnd(){f.current*=.5,v()},interrupt(){f.current=0,x.current=0;const t=c.current;t&&t.style.setProperty("--jarvis-amp","0")},setMood(t){},playGesture(t,l=1.5){b.current=performance.now()+l*1e3,v(),m("flared")}}),[]);const A=o??(k==="flared"?"thinking":k);return r.jsxs("div",{ref:c,className:s??"absolute inset-0 flex items-center justify-center overflow-hidden","data-jarvis-state":A,style:{"--jarvis-amp":"0"},children:[r.jsx("style",{children:G}),r.jsx("div",{className:"jarvis-bg","aria-hidden":"true"}),r.jsxs("svg",{viewBox:"0 0 200 200",className:"jarvis-svg","aria-hidden":"true",children:[r.jsxs("defs",{children:[r.jsxs("radialGradient",{id:"jarvisOrb",cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:"#d8f3ff",stopOpacity:"0.95"}),r.jsx("stop",{offset:"30%",stopColor:"#3aa8ff",stopOpacity:"0.8"}),r.jsx("stop",{offset:"70%",stopColor:"#0a5ec4",stopOpacity:"0.35"}),r.jsx("stop",{offset:"100%",stopColor:"#0a5ec4",stopOpacity:"0"})]}),r.jsxs("radialGradient",{id:"jarvisCore",cx:"50%",cy:"50%",r:"50%",children:[r.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.95"}),r.jsx("stop",{offset:"45%",stopColor:"#8ad4ff",stopOpacity:"0.85"}),r.jsx("stop",{offset:"100%",stopColor:"#2b8bff",stopOpacity:"0"})]}),r.jsxs("filter",{id:"jarvisGlow",x:"-50%",y:"-50%",width:"200%",height:"200%",children:[r.jsx("feGaussianBlur",{stdDeviation:"2.2",result:"blur"}),r.jsxs("feMerge",{children:[r.jsx("feMergeNode",{in:"blur"}),r.jsx("feMergeNode",{in:"SourceGraphic"})]})]})]}),r.jsxs("g",{className:"jarvis-ring-outer",transform:"translate(100 100)",children:[r.jsx("circle",{r:"94",fill:"none",stroke:"#3aa8ff",strokeOpacity:"0.25",strokeWidth:"0.5"}),r.jsx("circle",{r:"90",fill:"none",stroke:"#7fd0ff",strokeOpacity:"0.55",strokeWidth:"0.8",strokeDasharray:"1.5 5"})]}),r.jsxs("g",{className:"jarvis-ring-mid",transform:"translate(100 100)",children:[[0,90,180,270].map(t=>r.jsx("path",{d:C(0,0,72,t+8,t+82),fill:"none",stroke:"#5bbcff",strokeOpacity:"0.85",strokeWidth:"1.3",filter:"url(#jarvisGlow)"},t)),[0,90,180,270].map(t=>{const l=(t-3)*Math.PI/180;return r.jsx("line",{x1:68*Math.cos(l),y1:68*Math.sin(l),x2:78*Math.cos(l),y2:78*Math.sin(l),stroke:"#5bbcff",strokeOpacity:"0.9",strokeWidth:"1.2"},`t-${t}`)})]}),r.jsx("g",{className:"jarvis-ring-react",transform:"translate(100 100)",children:r.jsx("circle",{r:"55",fill:"none",stroke:"#7fd0ff",strokeOpacity:"0.9",strokeWidth:"1.5",filter:"url(#jarvisGlow)"})}),r.jsxs("g",{stroke:"#5bbcff",strokeOpacity:"0.4",strokeWidth:"0.7",children:[r.jsx("line",{x1:"100",y1:"38",x2:"100",y2:"50"}),r.jsx("line",{x1:"100",y1:"150",x2:"100",y2:"162"}),r.jsx("line",{x1:"38",y1:"100",x2:"50",y2:"100"}),r.jsx("line",{x1:"150",y1:"100",x2:"162",y2:"100"})]}),r.jsxs("g",{className:"jarvis-core",transform:"translate(100 100)",children:[r.jsx("circle",{r:"40",fill:"url(#jarvisOrb)"}),r.jsx("circle",{r:"22",fill:"url(#jarvisCore)"}),r.jsx("circle",{r:"3.5",fill:"#eafaff",fillOpacity:"0.95"})]}),r.jsx("g",{className:"jarvis-scan",transform:"translate(100 100)",children:r.jsx("line",{x1:"-62",y1:"0",x2:"62",y2:"0",stroke:"#7fd0ff",strokeOpacity:"0.55",strokeWidth:"0.9",filter:"url(#jarvisGlow)"})})]}),n&&r.jsxs("div",{className:"jarvis-label",children:[r.jsx("span",{className:"jarvis-dot"}),n]})]})});function C(i,e,s,o,n){const p=S(i,e,s,n),c=S(i,e,s,o),f=n-o<=180?0:1;return`M ${p.x} ${p.y} A ${s} ${s} 0 ${f} 0 ${c.x} ${c.y}`}function S(i,e,s,o){const n=o*Math.PI/180;return{x:i+s*Math.cos(n),y:e+s*Math.sin(n)}}const G=`
2
2
  [data-jarvis-state] {
3
3
  --jarvis-amp: 0;
4
4
  color: #bfe4ff;
@@ -1 +1 @@
1
- import{r as t,b as d,j as e}from"./index-BgYM4wXw.js";function m({embedded:n}){const[a,r]=t.useState([]),[c,i]=t.useState(!0);return t.useEffect(()=>{d.listMedia().then(s=>r(s.files)).catch(()=>{}).finally(()=>i(!1))},[]),e.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Media"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Images and files created by agents and Gemini Live."})]}),c?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading..."}):a.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-8 h-8 text-cc-muted/30 mx-auto mb-3",children:[e.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),e.jsx("circle",{cx:"5.5",cy:"5.5",r:"1"}),e.jsx("path",{d:"M2 11l3-3 2 2 3-4 4 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"currentColor",strokeWidth:"1",fill:"none"})]}),e.jsx("p",{className:"text-sm text-cc-muted",children:"No media files yet"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Generated images from agents and Gemini will appear here."})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:a.map((s,l)=>e.jsxs("a",{href:`/api/media/file/${encodeURIComponent(s.filename)}`,target:"_blank",rel:"noopener noreferrer",className:"group bg-cc-card border border-cc-border rounded-xl overflow-hidden hover:border-cc-primary/40 transition-colors",children:[e.jsx("img",{src:`/api/media/file/${encodeURIComponent(s.filename)}`,alt:s.filename,className:"w-full aspect-square object-cover",loading:"lazy"}),e.jsx("div",{className:"px-2.5 py-2",children:e.jsx("p",{className:"text-[11px] text-cc-muted truncate group-hover:text-cc-fg transition-colors",children:s.filename})})]},l))})]})})}export{m as MediaPage};
1
+ import{r as t,b as d,j as e}from"./index-C6Q5UQHD.js";function m({embedded:n}){const[a,r]=t.useState([]),[c,i]=t.useState(!0);return t.useEffect(()=>{d.listMedia().then(s=>r(s.files)).catch(()=>{}).finally(()=>i(!1))},[]),e.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:e.jsxs("div",{className:"max-w-4xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"mb-6",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Media"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Images and files created by agents and Gemini Live."})]}),c?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading..."}):a.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-8 h-8 text-cc-muted/30 mx-auto mb-3",children:[e.jsx("rect",{x:"2",y:"2",width:"12",height:"12",rx:"2"}),e.jsx("circle",{cx:"5.5",cy:"5.5",r:"1"}),e.jsx("path",{d:"M2 11l3-3 2 2 3-4 4 5",strokeLinecap:"round",strokeLinejoin:"round",stroke:"currentColor",strokeWidth:"1",fill:"none"})]}),e.jsx("p",{className:"text-sm text-cc-muted",children:"No media files yet"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Generated images from agents and Gemini will appear here."})]}):e.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3",children:a.map((s,l)=>e.jsxs("a",{href:`/api/media/file/${encodeURIComponent(s.filename)}`,target:"_blank",rel:"noopener noreferrer",className:"group bg-cc-card border border-cc-border rounded-xl overflow-hidden hover:border-cc-primary/40 transition-colors",children:[e.jsx("img",{src:`/api/media/file/${encodeURIComponent(s.filename)}`,alt:s.filename,className:"w-full aspect-square object-cover",loading:"lazy"}),e.jsx("div",{className:"px-2.5 py-2",children:e.jsx("p",{className:"text-[11px] text-cc-muted truncate group-hover:text-cc-fg transition-colors",children:s.filename})})]},l))})]})})}export{m as MediaPage};