@hellcoder/companion 0.117.0 → 0.118.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.
- package/dist/assets/{AgentsPage-DJIGGU86.js → AgentsPage-DkcwIsY1.js} +1 -1
- package/dist/assets/{CronManager-D7aAMVgs.js → CronManager-BrGSjzJz.js} +1 -1
- package/dist/assets/{DashboardPage-Bporj7Vr.js → DashboardPage-B2q0O3yD.js} +1 -1
- package/dist/assets/{IntegrationsPage-BSY0-fsO.js → IntegrationsPage-CRfvSp68.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-Cl5dP05g.js → LinearOAuthSettingsPage-DgzYg2kb.js} +1 -1
- package/dist/assets/{LinearSettingsPage-dwMpnpxL.js → LinearSettingsPage-BTQJFAj4.js} +1 -1
- package/dist/assets/{MagicUIDashboard-Bpa4AupX.js → MagicUIDashboard-BegKqU3e.js} +1 -1
- package/dist/assets/{MagicUIView-BoHMBELi.js → MagicUIView-D23itGQ5.js} +1 -1
- package/dist/assets/{Playground-By2aXWQF.js → Playground-BJAQWThl.js} +14 -6
- package/dist/assets/{PromptsPage-DVv0Qn3d.js → PromptsPage-BKEK_e8P.js} +1 -1
- package/dist/assets/{RunsPage-bu3TZ6ai.js → RunsPage-Biakia-J.js} +1 -1
- package/dist/assets/{SandboxManager-CDjGbD5N.js → SandboxManager-BZfEkHsb.js} +1 -1
- package/dist/assets/{SettingsPage-D0v_BZTU.js → SettingsPage-BwZoML1s.js} +1 -1
- package/dist/assets/{TailscalePage-B8SJQpMF.js → TailscalePage-B6eauJ__.js} +1 -1
- package/dist/assets/index-DB85gIpd.css +1 -0
- package/dist/assets/index-n6Tt3UFW.js +140 -0
- package/dist/assets/{sw-register-CvyRJNug.js → sw-register-fN5inCkx.js} +1 -1
- package/dist/index.html +2 -2
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/dist/assets/index-BqOdTpct.css +0 -1
- package/dist/assets/index-DqIZ_Ol5.js +0 -140
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e,a as r,j as t,i as d}from"./index-
|
|
1
|
+
import{r as e,a as r,j as t,i as d}from"./index-n6Tt3UFW.js";function V({embedded:x=!1}){const c=d(),[m,l]=e.useState([]),[f,a]=e.useState(!0),[S,g]=e.useState(""),[h,p]=e.useState(!1),[b,N]=e.useState(!1),[w,E]=e.useState(null),[n,o]=e.useState(null),s=e.useRef(null),[I,j]=e.useState(""),[v,A]=e.useState(""),[C,D]=e.useState(null),[R,k]=e.useState(""),[y,B]=e.useState(""),[O,T]=e.useState(null),[_,L]=e.useState(null);e.useRef({});const[M,P]=e.useState(""),i=e.useCallback(()=>{r.listSandboxes().then(l).catch(()=>{}).finally(()=>a(!1))},[]);return e.useEffect(()=>{{a(!1);return}},[i,c]),e.useEffect(()=>{if(!n||n.status!=="pulling"){s.current&&(clearInterval(s.current),s.current=null);return}return s.current||(s.current=setInterval(()=>{r.getImageStatus("the-companion:latest").then(u=>o(u)).catch(()=>{})},2e3)),()=>{s.current&&(clearInterval(s.current),s.current=null)}},[n]),t.jsx("div",{className:"h-full bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto overflow-x-hidden",children:t.jsxs("div",{className:"max-w-2xl mx-auto px-4 sm:px-6 py-6 sm:py-10 pb-safe",children:[t.jsx("h1",{className:"text-lg font-semibold mb-3",children:"Sandboxes"}),t.jsxs("div",{className:"rounded-xl bg-cc-card p-4 text-sm text-cc-muted leading-relaxed",children:[t.jsxs("p",{className:"mb-2",children:["Sandbox / container support is ",t.jsx("strong",{className:"text-cc-fg",children:"disabled"})," in this build."]}),t.jsxs("p",{className:"mb-2",children:["It relied on the upstream"," ",t.jsx("code",{className:"text-[12px] font-mono-code text-cc-fg",children:"the-companion"})," Docker image, which is no longer maintained — so the fork no longer pulls or runs it."]}),t.jsxs("p",{children:["To re-enable (e.g. with your own image), build the frontend with"," ",t.jsx("code",{className:"text-[12px] font-mono-code text-cc-fg",children:"VITE_SANDBOX_ENABLED=true"})," ","and run the server with"," ",t.jsx("code",{className:"text-[12px] font-mono-code text-cc-fg",children:"COMPANION_SANDBOX_ENABLED=1"}),"."]})]})]})})}export{V as SandboxManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as s,u as o,g as Tt,a as n,j as e,n as It,b as Pt,s as Mt}from"./index-DqIZ_Ol5.js";const ge=[{id:"general",label:"General"},{id:"webhooks",label:"Webhooks"},{id:"authentication",label:"Authentication"},{id:"notifications",label:"Notifications"},{id:"providers",label:"Providers"},{id:"anthropic",label:"Anthropic"},{id:"ai-validation",label:"AI Validation"},{id:"dashboard",label:"Dashboard"},{id:"magic-ui",label:"Magic UI"},{id:"updates",label:"Updates"},{id:"telemetry",label:"Telemetry"},{id:"environments",label:"Environments"}];function Dt({embedded:fe=!1}){const[p,ve]=s.useState(""),[ye,je]=s.useState("claude-sonnet-4-6"),[d,we]=s.useState(!1),[C,ot]=s.useState(!0),[f,S]=s.useState(!1),[Ne,v]=s.useState(""),[ke,y]=s.useState(!1),it=o(t=>t.darkMode),rt=o(t=>t.toggleDarkMode),Ce=o(t=>t.diffBase),lt=o(t=>t.setDiffBase),dt=o(t=>t.density),ut=o(t=>t.toggleDensity),xt=o(t=>t.notificationSound),pt=o(t=>t.toggleNotificationSound),Se=o(t=>t.notificationDesktop),Ae=o(t=>t.setNotificationDesktop),i=o(t=>t.updateInfo),O=o(t=>t.setUpdateInfo),mt=o(t=>t.setUpdateOverlayActive),ht=typeof Notification<"u",[x,j]=s.useState("stable"),[A,L]=s.useState(!1),[U,V]=s.useState(!0),[E,K]=s.useState(!0),[T,$]=s.useState(!0),[I,F]=s.useState("stdio"),[Ue,H]=s.useState("loopback"),[B,Ee]=s.useState(!1),[Q,Te]=s.useState(!1),[Ie,w]=s.useState(""),[Pe,P]=s.useState(""),[Me,bt]=s.useState(Tt()),[M,W]=s.useState(!1),[_,G]=s.useState(!0),[q,Y]=s.useState(!1),[z,J]=s.useState(!1),[Re,X]=s.useState("claude-haiku-4-5"),[De,Z]=s.useState(3),[Oe,ee]=s.useState(30),[te,se]=s.useState(!1),[Le,ae]=s.useState("claude-haiku-4-5"),[m,gt]=s.useState(!0),[R,ne]=s.useState(""),[Ve,Ke]=s.useState("general"),[ft,$e]=s.useState(!1),[ce,Fe]=s.useState(!1),[N,h]=s.useState(null),[b,He]=s.useState(""),[oe,Be]=s.useState(!1),[g,Qe]=s.useState(""),[ie,We]=s.useState(!1),[re,_e]=s.useState(!1),[vt,le]=s.useState(!1),[Ge,qe]=s.useState(""),[yt,Ye]=s.useState(!1),[jt,ze]=s.useState(!1),[k,Je]=s.useState(null),[de,Xe]=s.useState(!1),[u,Ze]=s.useState(null),[D,wt]=s.useState(0),[ue,et]=s.useState(!1),[xe,tt]=s.useState(!1),[Nt,st]=s.useState(!1),at=s.useRef(null),pe=s.useRef({});s.useEffect(()=>{const t=at.current;if(!t)return;const a=new IntersectionObserver(c=>{var ct;let l=null;for(const be of c)be.isIntersecting&&(!l||be.boundingClientRect.top<l.boundingClientRect.top)&&(l=be);(ct=l==null?void 0:l.target)!=null&&ct.id&&Ke(l.target.id)},{root:t,rootMargin:"-10% 0px -70% 0px",threshold:0});for(const c of ge){const l=pe.current[c.id];l&&a.observe(l)}return()=>a.disconnect()},[C]);const nt=s.useCallback(t=>{Ke(t);const a=pe.current[t];a&&a.scrollIntoView({behavior:"smooth",block:"start"})},[]);s.useEffect(()=>{n.getSettings().then(t=>{we(t.anthropicApiKeyConfigured),Be(t.claudeCodeOAuthTokenConfigured),We(t.openaiApiKeyConfigured),je(t.anthropicModel||"claude-sonnet-4-6"),typeof t.aiValidationEnabled=="boolean"&&W(t.aiValidationEnabled),typeof t.aiValidationAutoApprove=="boolean"&&G(t.aiValidationAutoApprove),typeof t.aiValidationAutoDeny=="boolean"&&Y(t.aiValidationAutoDeny),typeof t.dashboardEnabled=="boolean"&&J(t.dashboardEnabled),typeof t.dashboardModel=="string"&&t.dashboardModel&&X(t.dashboardModel),typeof t.dashboardRunHour=="number"&&Z(t.dashboardRunHour),typeof t.dashboardMaxSessionsPerRun=="number"&&ee(t.dashboardMaxSessionsPerRun),typeof t.magicUiEnabled=="boolean"&&se(t.magicUiEnabled),typeof t.magicUiModel=="string"&&t.magicUiModel&&ae(t.magicUiModel),typeof t.claudeCliAvailable=="boolean"&>(t.claudeCliAvailable),(t.updateChannel==="stable"||t.updateChannel==="prerelease")&&j(t.updateChannel),typeof t.dockerAutoUpdate=="boolean"&&L(t.dockerAutoUpdate),typeof t.proactiveKeepaliveEnabled=="boolean"&&V(t.proactiveKeepaliveEnabled),typeof t.wedgeKillEnabled=="boolean"&&K(t.wedgeKillEnabled),typeof t.silenceProbeEnabled=="boolean"&&$(t.silenceProbeEnabled),(t.claudeTransport==="sdk"||t.claudeTransport==="stdio")&&F(t.claudeTransport),(t.cliBridgeMode==="loopback"||t.cliBridgeMode==="jsonHandoff")&&H(t.cliBridgeMode),typeof t.publicUrl=="string"&&(ne(t.publicUrl),o.getState().setPublicUrl(t.publicUrl))}).catch(t=>v(t instanceof Error?t.message:String(t))).finally(()=>ot(!1)),n.getAuthToken().then(t=>Je(t.token)).catch(()=>{})},[]);async function kt(t){t.preventDefault(),S(!0),v(""),y(!1);try{const a=p.trim(),c={anthropicModel:ye.trim()||"claude-sonnet-4-6"};a&&(c.anthropicApiKey=a);const l=await n.updateSettings(c);we(l.anthropicApiKeyConfigured),ve(""),y(!0),setTimeout(()=>y(!1),1800)}catch(a){v(a instanceof Error?a.message:String(a))}finally{S(!1)}}async function me(t){const a=t==="aiValidationEnabled"?M:t==="aiValidationAutoApprove"?_:q,c=!a;t==="aiValidationEnabled"?W(c):t==="aiValidationAutoApprove"?G(c):Y(c);try{await n.updateSettings({[t]:c})}catch{t==="aiValidationEnabled"?W(a):t==="aiValidationAutoApprove"?G(a):Y(a)}}async function Ct(){const t=z;J(!t);try{await n.updateSettings({dashboardEnabled:!t})}catch{J(t)}}async function St(){const t=te;se(!t);try{const a=await n.updateSettings({magicUiEnabled:!t});o.getState().setMagicUiAvailable(!!a.magicUiEnabled&&!!a.claudeCliAvailable)}catch{se(t)}}async function At(t,a){try{await n.updateSettings({magicUiModel:t})}catch{a()}}async function he(t,a){try{await n.updateSettings(t)}catch{a()}}async function Ut(){Ee(!0),w(""),P("");try{const t=await n.forceCheckForUpdate();O(t),t.updateAvailable&&t.latestVersion?w(`Update v${t.latestVersion} is available.`):w("You are up to date.")}catch(t){P(t instanceof Error?t.message:String(t))}finally{Ee(!1)}}async function Et(){Te(!0),w(""),P("");try{localStorage.setItem("companion_docker_prompt_pending","1");const t=await n.triggerUpdate();w(t.message),mt(!0)}catch(t){localStorage.removeItem("companion_docker_prompt_pending"),P(t instanceof Error?t.message:String(t)),Te(!1)}}const r=s.useCallback(t=>a=>{pe.current[t]=a},[]);return e.jsxs("div",{className:`${fe?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased flex flex-col`,children:[e.jsx("div",{className:"shrink-0 max-w-5xl w-full mx-auto px-4 sm:px-8 pt-6 sm:pt-10",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:"Settings"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Configure API access, notifications, appearance, and workspace defaults."})]}),!fe&&e.jsx("button",{onClick:()=>{const t=o.getState().currentSessionId;t?It(t):Pt()},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"})]})}),e.jsx("div",{className:"sm:hidden shrink-0 border-b border-cc-border",children:e.jsx("nav",{className:"flex gap-1 px-4 py-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","aria-label":"Settings categories",children:ge.map(t=>e.jsx("button",{type:"button",onClick:()=>nt(t.id),className:`shrink-0 px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${Ve===t.id?"text-cc-primary bg-cc-primary/8":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:t.label},t.id))})}),e.jsxs("div",{className:"flex-1 min-h-0 flex max-w-5xl w-full mx-auto",children:[e.jsx("nav",{className:"hidden sm:flex flex-col gap-0.5 w-44 shrink-0 pt-2 pr-6 pl-8 sticky top-0 self-start","aria-label":"Settings categories",children:ge.map(t=>e.jsx("button",{type:"button",onClick:()=>nt(t.id),className:`text-left px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${Ve===t.id?"text-cc-primary bg-cc-primary/8":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:t.label},t.id))}),e.jsx("div",{ref:at,className:"flex-1 min-w-0 overflow-y-auto px-4 sm:px-8 sm:pl-0 pb-safe",children:e.jsxs("div",{className:"space-y-10 py-4 sm:py-2",children:[e.jsxs("section",{id:"general",ref:r("general"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"General"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:rt,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Theme"}),e.jsx("span",{className:"text-xs text-cc-muted",children:it?"Dark":"Light"})]}),e.jsxs("button",{type:"button",onClick:ut,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Message density"}),e.jsx("span",{className:"text-xs text-cc-muted",children:dt==="compact"?"Compact":"Standard"})]}),e.jsx("p",{className:"text-xs text-cc-muted px-1",children:"Standard shows commands, diffs and tool output inline. Compact collapses each of them to a single line you can expand on demand, and hides empty thinking steps. This setting is stored in this browser only."}),e.jsxs("button",{type:"button",onClick:()=>lt(Ce==="last-commit"?"default-branch":"last-commit"),className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Diff compare against"}),e.jsx("span",{className:"text-xs text-cc-muted",children:Ce==="last-commit"?"Last commit (HEAD)":"Default branch"})]}),e.jsx("p",{className:"text-xs text-cc-muted px-1",children:"Last commit shows only uncommitted changes. Default branch shows all changes since diverging from main."}),e.jsx("div",{className:"pt-3 border-t border-cc-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Claude Code bridge mode"}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted",children:'How the Companion hands the bridge URL to the spawned Claude Code CLI. Loopback is the default fix for Claude Code v1.2.1+ which rejects the literal "localhost". JSON handoff is the more robust just-every/code-style approach: writes a temp descriptor with a one-shot token and passes its path via CLAUDE_BRIDGE_CONFIG.'})]}),e.jsxs("select",{"aria-label":"CLI bridge mode",value:Ue,onChange:async t=>{const a=t.target.value==="jsonHandoff"?"jsonHandoff":"loopback",c=Ue;H(a);try{await n.updateSettings({cliBridgeMode:a})}catch{H(c)}},className:"ml-3 px-2 py-1.5 text-xs bg-cc-bg rounded-lg border border-cc-border text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary",children:[e.jsx("option",{value:"loopback",children:"Loopback (default)"}),e.jsx("option",{value:"jsonHandoff",children:"JSON handoff (experimental)"})]})]})}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":U,"aria-label":"Proactive keepalive relaunch",onClick:async()=>{const t=!U,a=U;V(t);try{await n.updateSettings({proactiveKeepaliveEnabled:t})}catch{V(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Proactive keepalive relaunch"}),e.jsx("span",{className:"text-xs text-cc-muted",children:U?"On":"Off"})]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted px-1",children:"When on (default), a CLI process that exits unexpectedly with no browser attached is automatically relaunched to keep long-running sessions (agents, cron) alive. Turn off to experiment with letting dead sessions stay dead."})]}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":E,"aria-label":"Kill wedged CLI processes",onClick:async()=>{const t=!E,a=E;K(t);try{await n.updateSettings({wedgeKillEnabled:t})}catch{K(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Kill wedged CLI processes"}),e.jsx("span",{className:"text-xs text-cc-muted",children:E?"On":"Off"})]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted px-1",children:"When on (default), a CLI whose output stream closes but which does not exit is treated as wedged and killed so the session can recover. This was built for older CLI behaviour, and every process sampled since has turned out to be healthy — usually one supervising a background command. Turn off to test whether the wedge still happens at all: sessions still relaunch, but processes are left to exit on their own instead of being terminated."})]}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":T,"aria-label":"Probe silent CLI processes",onClick:async()=>{const t=!T,a=T;$(t);try{await n.updateSettings({silenceProbeEnabled:t})}catch{$(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Probe silent CLI processes"}),e.jsx("span",{className:"text-xs text-cc-muted",children:T?"On":"Off"})]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted px-1",children:"When on (default), a CLI that stops responding while its output stream stays open is sent a liveness probe after ~2 minutes of silence. If it does not answer within a further minute the session is relaunched and the in-flight turn replayed. Without this such a session hangs indefinitely showing “Still working…” with no error, because nothing ever closes the stream for companion to notice."})]}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":I==="sdk","aria-label":"Use Agent SDK transport (experimental)",onClick:async()=>{const t=I==="sdk"?"stdio":"sdk",a=I;F(t);try{await n.updateSettings({claudeTransport:t})}catch{F(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Use Agent SDK transport (experimental)"}),e.jsx("span",{className:"text-xs text-cc-muted",children:I==="sdk"?"SDK":"stdio"})]}),e.jsxs("p",{className:"mt-1 text-xs text-cc-muted px-1",children:["Claude Code only — Codex sessions are unaffected. When on, new and reconnected Claude sessions run through Anthropic’s official Agent SDK instead of companion’s own stdio bridge: same ",e.jsx("code",{children:"claude"})," binary, same subscription login and usage windows, but the protocol layer is maintained upstream. Applies at launch time, so flip it and hit Reconnect on a session to migrate it (history is preserved via resume). Containerized sessions always use the stdio bridge."]})]})]})]}),e.jsxs("section",{id:"webhooks",ref:r("webhooks"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Webhooks"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"The public URL is used for webhook URLs that external services (Linear, GitHub) send events to. Set this to the externally-reachable address of your Companion instance."}),e.jsxs("p",{className:"text-xs text-cc-muted",children:["Tip:"," ",e.jsx("a",{href:"#/integrations/tailscale",className:"text-cc-primary hover:underline",children:"Use the Tailscale integration"})," ","to get an HTTPS URL automatically."]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-cc-fg mb-1.5",htmlFor:"public-url",children:"Public URL"}),e.jsx("input",{id:"public-url",type:"url","aria-label":"Public URL",value:R,onChange:t=>ne(t.target.value),placeholder:"https://your-domain.example.com",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary font-mono-code"}),e.jsx("p",{className:"mt-1.5 text-[10px] text-cc-muted",children:R?`Using: ${R}`:`Fallback: ${typeof window<"u"?window.location.origin:"http://localhost:3456"}`})]}),e.jsx("button",{type:"button",onClick:async()=>{S(!0),v("");try{const t=await n.updateSettings({publicUrl:R.trim()});ne(t.publicUrl),o.getState().setPublicUrl(t.publicUrl),y(!0),setTimeout(()=>y(!1),1800)}catch(t){v(t instanceof Error?t.message:String(t))}finally{S(!1)}},disabled:f,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-primary text-white hover:opacity-90 transition-opacity disabled:opacity-50 cursor-pointer",children:f?"Saving...":ke?"Saved!":"Save Public URL"})]})]}),e.jsxs("section",{id:"authentication",ref:r("authentication"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Authentication"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Use the auth token or QR code to connect additional devices (e.g. mobile over Tailscale)."}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",children:"Auth Token"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg font-mono-code select-all break-all flex items-center",children:k?de?k:"••••••••••••••••":e.jsx("span",{className:"text-cc-muted",children:"Loading..."})}),e.jsx("button",{type:"button",onClick:()=>Xe(t=>!t),className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",title:de?"Hide token":"Show token",children:de?"Hide":"Show"}),e.jsx("button",{type:"button",onClick:()=>{k&&navigator.clipboard.writeText(k).then(()=>{st(!0),setTimeout(()=>st(!1),1500)})},disabled:!k,className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:"Copy token to clipboard",children:Nt?"Copied":"Copy"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",children:"Mobile Login QR"}),u&&u.length>0?e.jsxs("div",{className:"space-y-3",children:[u.length>1&&e.jsx("div",{className:"flex gap-1",children:u.map((t,a)=>e.jsx("button",{type:"button",onClick:()=>wt(a),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer ${a===D?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:t.label},t.label))}),e.jsx("div",{className:"inline-block rounded-lg bg-white p-2",children:e.jsx("img",{src:u[D].qrDataUrl,alt:`QR code for ${u[D].label} login`,className:"w-48 h-48"})}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-bg text-sm font-mono-code text-cc-fg break-all select-all",children:u[D].url}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Scan with your phone's camera app — it will open the URL and auto-authenticate."})]}):u&&u.length===0?e.jsx("p",{className:"text-xs text-cc-muted",children:"No remote addresses detected (LAN or Tailscale). Connect to a network to generate a QR code."}):e.jsx("button",{type:"button",onClick:async()=>{et(!0);try{const t=await n.getAuthQr();Ze(t.qrCodes)}catch{}finally{et(!1)}},disabled:ue,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${ue?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:ue?"Generating...":"Show QR Code"})]}),e.jsxs("div",{className:"pt-2",children:[e.jsx("button",{type:"button",onClick:async()=>{if(confirm("Regenerate auth token? All existing sessions on other devices will be signed out.")){tt(!0);try{const t=await n.regenerateAuthToken();Je(t.token),Xe(!0),Ze(null)}catch{}finally{tt(!1)}}},disabled:xe,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${xe?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:xe?"Regenerating...":"Regenerate Token"}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"Creates a new token. All other signed-in devices will need to re-authenticate."})]})]})]}),e.jsxs("section",{id:"notifications",ref:r("notifications"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Notifications"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:pt,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Sound"}),e.jsx("span",{className:"text-xs text-cc-muted",children:xt?"On":"Off"})]}),ht&&e.jsxs("button",{type:"button",onClick:async()=>{if(Se)Ae(!1);else{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted")return;Ae(!0)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Desktop Alerts"}),e.jsx("span",{className:"text-xs text-cc-muted",children:Se?"On":"Off"})]})]})]}),e.jsxs("section",{id:"providers",ref:r("providers"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Providers"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Configure authentication tokens for Claude Code and Codex. These are injected into sessions automatically."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium",htmlFor:"claude-code-token",children:"Claude Code OAuth Token"}),e.jsxs("p",{className:"text-xs text-cc-muted",children:["Run ",e.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"claude setup-token"})," in your terminal, then paste the token here."]}),e.jsx("input",{id:"claude-code-token",type:"password",value:oe&&!yt&&!b?"••••••••••••••••":b,onChange:t=>He(t.target.value),onFocus:()=>Ye(!0),onBlur:()=>Ye(!1),placeholder:oe?"Enter a new token to replace":"Paste token from claude setup-token",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("p",{className:"text-xs text-cc-muted",children:oe?"Claude Code token configured":"Claude Code token not configured"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium",htmlFor:"openai-api-key",children:"OpenAI API Key (Codex)"}),e.jsxs("p",{className:"text-xs text-cc-muted",children:["Used to authenticate Codex sessions. You can also use ",e.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"codex --login"})," for device-based auth."]}),e.jsx("input",{id:"openai-api-key",type:"password",value:ie&&!jt&&!g?"••••••••••••••••":g,onChange:t=>Qe(t.target.value),onFocus:()=>ze(!0),onBlur:()=>ze(!1),placeholder:ie?"Enter a new key to replace":"sk-...",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("p",{className:"text-xs text-cc-muted",children:ie?"OpenAI key configured":"OpenAI key not configured"})]}),Ge&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:Ge}),vt&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Provider settings saved."}),e.jsx("button",{type:"button",disabled:re||!b.trim()&&!g.trim(),onClick:async()=>{_e(!0),qe(""),le(!1);try{const t={};b.trim()&&(t.claudeCodeOAuthToken=b.trim()),g.trim()&&(t.openaiApiKey=g.trim());const a=await n.updateSettings(t);Be(a.claudeCodeOAuthTokenConfigured),We(a.openaiApiKeyConfigured),He(""),Qe(""),le(!0),setTimeout(()=>le(!1),1800)}catch(t){qe(t instanceof Error?t.message:String(t))}finally{_e(!1)}},className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${re||!b.trim()&&!g.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:re?"Saving...":"Save Provider Settings"})]})]}),e.jsxs("section",{id:"anthropic",ref:r("anthropic"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Anthropic"}),e.jsxs("form",{onSubmit:kt,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"anthropic-key",children:"Anthropic API Key"}),e.jsx("input",{id:"anthropic-key",type:"password",value:d&&!ft&&!p?"••••••••••••••••":p,onChange:t=>{ve(t.target.value),h(null)},onFocus:()=>$e(!0),onBlur:()=>$e(!1),placeholder:d?"Enter a new key to replace":"sk-ant-api03-...",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("p",{className:"mt-1.5 text-xs text-cc-muted",children:"Auto-renaming is disabled until this key is configured."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"anthropic-model",children:"Anthropic Model"}),e.jsx("input",{id:"anthropic-model",type:"text",value:ye,onChange:t=>je(t.target.value),placeholder:"claude-sonnet-4-6",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"})]}),Ne&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:Ne}),ke&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Settings saved."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-cc-muted",children:C?"Loading...":d?"Anthropic key configured":"Anthropic key not configured"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",disabled:ce||!p.trim(),onClick:async()=>{Fe(!0),h(null);try{const t=await n.verifyAnthropicKey(p.trim());h(t),setTimeout(()=>h(null),5e3)}catch(t){h({valid:!1,error:t instanceof Error?t.message:String(t)}),setTimeout(()=>h(null),5e3)}finally{Fe(!1)}},className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${ce||!p.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:ce?"Verifying...":"Verify"}),e.jsx("button",{type:"submit",disabled:f||C,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${f||C?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:f?"Saving...":"Save"})]})]}),N&&e.jsx("div",{className:`px-3 py-2 rounded-lg text-xs ${N.valid?"bg-cc-success/10 border border-cc-success/20 text-cc-success":"bg-cc-error/10 border border-cc-error/20 text-cc-error"}`,children:N.valid?"API key is valid.":`Invalid API key${N.error?`: ${N.error}`:"."}`})]})]}),e.jsxs("section",{id:"ai-validation",ref:r("ai-validation"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"AI Validation"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"When enabled, an AI model evaluates tool calls before they execute. Safe operations are auto-approved, dangerous ones are blocked, and uncertain cases are shown to you with a recommendation. Requires an Anthropic API key. These settings serve as defaults for new sessions. Each session can override AI validation independently via the shield icon in the session header."}),e.jsxs("button",{type:"button",onClick:()=>me("aiValidationEnabled"),disabled:!d,className:`w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg transition-colors ${d?"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed opacity-60"}`,children:[e.jsx("span",{className:"text-sm",children:"AI Validation Mode"}),e.jsx("span",{className:`text-xs font-medium ${M&&d?"text-cc-success":"text-cc-muted"}`,children:M&&d?"On":"Off"})]}),!d&&e.jsx("p",{className:"text-[11px] text-cc-warning",children:"Configure an Anthropic API key above to enable AI validation."}),M&&d&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>me("aiValidationAutoApprove"),className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm",children:"Auto-approve safe tools"}),e.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5",children:"Automatically allow read-only tools and benign commands"})]}),e.jsx("span",{className:`text-xs font-medium ${_?"text-cc-success":"text-cc-muted"}`,children:_?"On":"Off"})]}),e.jsxs("button",{type:"button",onClick:()=>me("aiValidationAutoDeny"),className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm",children:"Auto-deny dangerous tools"}),e.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5",children:"Automatically block destructive commands like rm -rf"})]}),e.jsx("span",{className:`text-xs font-medium ${q?"text-cc-success":"text-cc-muted"}`,children:q?"On":"Off"})]})]})]})]}),e.jsxs("section",{id:"dashboard",ref:r("dashboard"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Project Dashboard"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed",children:["A nightly job summarizes every session with recent activity so the"," ",e.jsx("a",{href:"#/dashboard",className:"underline hover:no-underline",children:"dashboard"})," ",'can show where each project stands. It runs through the Claude Code CLI with the same login your normal sessions use — no separate API key needed. This is opt-in because it spends tokens every night. You can always refresh manually with "Update now" on the dashboard, even when the nightly run is off.']}),e.jsxs("button",{type:"button",onClick:Ct,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:[e.jsx("span",{className:"text-sm",children:"Nightly dashboard updates"}),e.jsx("span",{className:`text-xs font-medium ${z?"text-cc-success":"text-cc-muted"}`,children:z?"On":"Off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"dashboard-model",children:"Summarization model"}),e.jsxs("select",{id:"dashboard-model",value:Re,onChange:t=>{const a=Re;X(t.target.value),he({dashboardModel:t.target.value},()=>X(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",children:[e.jsx("option",{value:"claude-haiku-4-5",children:"Claude Haiku 4.5 — cheapest, recommended"}),e.jsx("option",{value:"claude-sonnet-4-6",children:"Claude Sonnet 4.6"}),e.jsx("option",{value:"claude-sonnet-5",children:"Claude Sonnet 5"})]}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"Summarize-and-classify doesn't need an expensive model — Haiku keeps the nightly cost low."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"dashboard-run-hour",children:"Run at"}),e.jsx("select",{id:"dashboard-run-hour",value:De,onChange:t=>{const a=De,c=Number(t.target.value);Z(c),he({dashboardRunHour:c},()=>Z(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",children:Array.from({length:24},(t,a)=>e.jsxs("option",{value:a,children:[String(a).padStart(2,"0"),":00"]},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"dashboard-max-sessions",children:"Max sessions per run"}),e.jsx("select",{id:"dashboard-max-sessions",value:Oe,onChange:t=>{const a=Oe,c=Number(t.target.value);ee(c),he({dashboardMaxSessionsPerRun:c},()=>ee(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",children:[10,20,30,50,100,200].map(t=>e.jsx("option",{value:t,children:t},t))})]})]})]})]}),e.jsxs("section",{id:"magic-ui",ref:r("magic-ui"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Magic UI"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed",children:["An experimental session view: a cheap watcher model follows the session and paints a live, full-width dashboard — condensed progress, charts, open points, and decisions — instead of the classic chat column. Turning this on only makes the view"," ",e.jsx("em",{children:"available"}),"; each user still enables it per session from the top bar, and the watcher only runs for sessions that opted in. Uses the Claude Code CLI login — no separate API key."]}),!m&&e.jsx("p",{className:"text-xs text-cc-warning",children:"Requires the Claude Code CLI login — no Claude CLI was found on this server, so Magic UI stays unavailable."}),e.jsxs("button",{type:"button",onClick:St,disabled:!m,className:`w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover text-cc-fg transition-colors ${m?"hover:bg-cc-active cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[e.jsx("span",{className:"text-sm",children:"Magic UI available to users"}),e.jsx("span",{className:`text-xs font-medium ${te&&m?"text-cc-success":"text-cc-muted"}`,children:te&&m?"On":"Off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"magic-ui-model",children:"Watcher model"}),e.jsxs("select",{id:"magic-ui-model",value:Le,disabled:!m,onChange:t=>{const a=Le;ae(t.target.value),At(t.target.value,()=>ae(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow disabled:opacity-50",children:[e.jsx("option",{value:"claude-haiku-4-5",children:"Claude Haiku 4.5 — cheapest, recommended"}),e.jsx("option",{value:"claude-sonnet-4-6",children:"Claude Sonnet 4.6"}),e.jsx("option",{value:"claude-sonnet-5",children:"Claude Sonnet 5"})]}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"The watcher runs many small turns per session — Haiku keeps it fast and cheap."})]})]})]}),e.jsxs("section",{id:"updates",ref:r("updates"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Updates"}),e.jsxs("div",{className:"space-y-3",children:[i?e.jsxs("p",{className:"text-xs text-cc-muted",children:["Current version: v",i.currentVersion,i.latestVersion?` • Latest: v${i.latestVersion}`:"",i.channel==="prerelease"?" (prerelease)":""]}):e.jsx("p",{className:"text-xs text-cc-muted",children:"Version information not loaded yet."}),e.jsxs("div",{children:[e.jsx("span",{id:"update-channel-label",className:"block text-sm font-medium mb-1.5",children:"Update Channel"}),e.jsxs("div",{className:"flex gap-1",role:"radiogroup","aria-labelledby":"update-channel-label",children:[e.jsx("button",{type:"button",role:"radio","aria-checked":x==="stable",onClick:async()=>{if(x!=="stable"){j("stable");try{await n.updateSettings({updateChannel:"stable"})}catch{j("prerelease");return}try{const t=await n.forceCheckForUpdate();O(t)}catch{}}},className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${x==="stable"?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-active"}`,children:"Stable"}),e.jsx("button",{type:"button",role:"radio","aria-checked":x==="prerelease",onClick:async()=>{if(x!=="prerelease"){j("prerelease");try{await n.updateSettings({updateChannel:"prerelease"})}catch{j("stable");return}try{const t=await n.forceCheckForUpdate();O(t)}catch{}}},className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${x==="prerelease"?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-active"}`,children:"Prerelease"})]}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:x==="prerelease"?"Tracking prerelease channel. You will receive preview builds from the latest main branch.":"Tracking stable channel. You will only receive versioned releases."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Auto-update Docker image"}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted",children:"Automatically re-pull the sandbox Docker image when updating The Companion"})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":A,onClick:async()=>{const t=!A;L(t);try{await n.updateSettings({dockerAutoUpdate:t})}catch{L(!t)}},className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${A?"bg-cc-primary":"bg-cc-hover"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform transition-transform ${A?"translate-x-5":"translate-x-0"}`})})]}),Pe&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:Pe}),Ie&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:Ie}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:Ut,disabled:B,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${B?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:B?"Checking...":"Check for updates"}),i!=null&&i.isServiceMode?e.jsx("button",{type:"button",onClick:Et,disabled:Q||i.updateInProgress||!i.updateAvailable,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${Q||i.updateInProgress||!i.updateAvailable?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:Q||i.updateInProgress?"Updating...":"Update & Restart"}):e.jsxs("p",{className:"text-xs text-cc-muted self-center",children:["Install service mode with ",e.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," to enable one-click updates."]})]})]})]}),e.jsxs("section",{id:"telemetry",ref:r("telemetry"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Telemetry"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Anonymous product analytics and crash reports via PostHog to improve reliability."}),e.jsxs("button",{type:"button",onClick:()=>{const t=!Me;Mt(t),bt(t)},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Usage analytics and errors"}),e.jsx("span",{className:"text-xs text-cc-muted",children:Me?"On":"Off"})]}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Browser Do Not Track is respected automatically."})]})]}),e.jsxs("section",{id:"environments",ref:r("environments"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Environments"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Manage reusable environment profiles used when creating sessions."}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/environments"},className:"px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Open Environments Page"})]})]})]})})]})]})}export{Dt as SettingsPage};
|
|
1
|
+
import{r as s,u as o,g as Tt,a as n,j as e,n as It,b as Pt,s as Mt}from"./index-n6Tt3UFW.js";const ge=[{id:"general",label:"General"},{id:"webhooks",label:"Webhooks"},{id:"authentication",label:"Authentication"},{id:"notifications",label:"Notifications"},{id:"providers",label:"Providers"},{id:"anthropic",label:"Anthropic"},{id:"ai-validation",label:"AI Validation"},{id:"dashboard",label:"Dashboard"},{id:"magic-ui",label:"Magic UI"},{id:"updates",label:"Updates"},{id:"telemetry",label:"Telemetry"},{id:"environments",label:"Environments"}];function Dt({embedded:fe=!1}){const[p,ve]=s.useState(""),[ye,je]=s.useState("claude-sonnet-4-6"),[d,we]=s.useState(!1),[C,ot]=s.useState(!0),[f,S]=s.useState(!1),[Ne,v]=s.useState(""),[ke,y]=s.useState(!1),it=o(t=>t.darkMode),rt=o(t=>t.toggleDarkMode),Ce=o(t=>t.diffBase),lt=o(t=>t.setDiffBase),dt=o(t=>t.density),ut=o(t=>t.toggleDensity),xt=o(t=>t.notificationSound),pt=o(t=>t.toggleNotificationSound),Se=o(t=>t.notificationDesktop),Ae=o(t=>t.setNotificationDesktop),i=o(t=>t.updateInfo),O=o(t=>t.setUpdateInfo),mt=o(t=>t.setUpdateOverlayActive),ht=typeof Notification<"u",[x,j]=s.useState("stable"),[A,L]=s.useState(!1),[U,V]=s.useState(!0),[E,K]=s.useState(!0),[T,$]=s.useState(!0),[I,F]=s.useState("stdio"),[Ue,H]=s.useState("loopback"),[B,Ee]=s.useState(!1),[Q,Te]=s.useState(!1),[Ie,w]=s.useState(""),[Pe,P]=s.useState(""),[Me,bt]=s.useState(Tt()),[M,W]=s.useState(!1),[_,G]=s.useState(!0),[q,Y]=s.useState(!1),[z,J]=s.useState(!1),[Re,X]=s.useState("claude-haiku-4-5"),[De,Z]=s.useState(3),[Oe,ee]=s.useState(30),[te,se]=s.useState(!1),[Le,ae]=s.useState("claude-haiku-4-5"),[m,gt]=s.useState(!0),[R,ne]=s.useState(""),[Ve,Ke]=s.useState("general"),[ft,$e]=s.useState(!1),[ce,Fe]=s.useState(!1),[N,h]=s.useState(null),[b,He]=s.useState(""),[oe,Be]=s.useState(!1),[g,Qe]=s.useState(""),[ie,We]=s.useState(!1),[re,_e]=s.useState(!1),[vt,le]=s.useState(!1),[Ge,qe]=s.useState(""),[yt,Ye]=s.useState(!1),[jt,ze]=s.useState(!1),[k,Je]=s.useState(null),[de,Xe]=s.useState(!1),[u,Ze]=s.useState(null),[D,wt]=s.useState(0),[ue,et]=s.useState(!1),[xe,tt]=s.useState(!1),[Nt,st]=s.useState(!1),at=s.useRef(null),pe=s.useRef({});s.useEffect(()=>{const t=at.current;if(!t)return;const a=new IntersectionObserver(c=>{var ct;let l=null;for(const be of c)be.isIntersecting&&(!l||be.boundingClientRect.top<l.boundingClientRect.top)&&(l=be);(ct=l==null?void 0:l.target)!=null&&ct.id&&Ke(l.target.id)},{root:t,rootMargin:"-10% 0px -70% 0px",threshold:0});for(const c of ge){const l=pe.current[c.id];l&&a.observe(l)}return()=>a.disconnect()},[C]);const nt=s.useCallback(t=>{Ke(t);const a=pe.current[t];a&&a.scrollIntoView({behavior:"smooth",block:"start"})},[]);s.useEffect(()=>{n.getSettings().then(t=>{we(t.anthropicApiKeyConfigured),Be(t.claudeCodeOAuthTokenConfigured),We(t.openaiApiKeyConfigured),je(t.anthropicModel||"claude-sonnet-4-6"),typeof t.aiValidationEnabled=="boolean"&&W(t.aiValidationEnabled),typeof t.aiValidationAutoApprove=="boolean"&&G(t.aiValidationAutoApprove),typeof t.aiValidationAutoDeny=="boolean"&&Y(t.aiValidationAutoDeny),typeof t.dashboardEnabled=="boolean"&&J(t.dashboardEnabled),typeof t.dashboardModel=="string"&&t.dashboardModel&&X(t.dashboardModel),typeof t.dashboardRunHour=="number"&&Z(t.dashboardRunHour),typeof t.dashboardMaxSessionsPerRun=="number"&&ee(t.dashboardMaxSessionsPerRun),typeof t.magicUiEnabled=="boolean"&&se(t.magicUiEnabled),typeof t.magicUiModel=="string"&&t.magicUiModel&&ae(t.magicUiModel),typeof t.claudeCliAvailable=="boolean"&>(t.claudeCliAvailable),(t.updateChannel==="stable"||t.updateChannel==="prerelease")&&j(t.updateChannel),typeof t.dockerAutoUpdate=="boolean"&&L(t.dockerAutoUpdate),typeof t.proactiveKeepaliveEnabled=="boolean"&&V(t.proactiveKeepaliveEnabled),typeof t.wedgeKillEnabled=="boolean"&&K(t.wedgeKillEnabled),typeof t.silenceProbeEnabled=="boolean"&&$(t.silenceProbeEnabled),(t.claudeTransport==="sdk"||t.claudeTransport==="stdio")&&F(t.claudeTransport),(t.cliBridgeMode==="loopback"||t.cliBridgeMode==="jsonHandoff")&&H(t.cliBridgeMode),typeof t.publicUrl=="string"&&(ne(t.publicUrl),o.getState().setPublicUrl(t.publicUrl))}).catch(t=>v(t instanceof Error?t.message:String(t))).finally(()=>ot(!1)),n.getAuthToken().then(t=>Je(t.token)).catch(()=>{})},[]);async function kt(t){t.preventDefault(),S(!0),v(""),y(!1);try{const a=p.trim(),c={anthropicModel:ye.trim()||"claude-sonnet-4-6"};a&&(c.anthropicApiKey=a);const l=await n.updateSettings(c);we(l.anthropicApiKeyConfigured),ve(""),y(!0),setTimeout(()=>y(!1),1800)}catch(a){v(a instanceof Error?a.message:String(a))}finally{S(!1)}}async function me(t){const a=t==="aiValidationEnabled"?M:t==="aiValidationAutoApprove"?_:q,c=!a;t==="aiValidationEnabled"?W(c):t==="aiValidationAutoApprove"?G(c):Y(c);try{await n.updateSettings({[t]:c})}catch{t==="aiValidationEnabled"?W(a):t==="aiValidationAutoApprove"?G(a):Y(a)}}async function Ct(){const t=z;J(!t);try{await n.updateSettings({dashboardEnabled:!t})}catch{J(t)}}async function St(){const t=te;se(!t);try{const a=await n.updateSettings({magicUiEnabled:!t});o.getState().setMagicUiAvailable(!!a.magicUiEnabled&&!!a.claudeCliAvailable)}catch{se(t)}}async function At(t,a){try{await n.updateSettings({magicUiModel:t})}catch{a()}}async function he(t,a){try{await n.updateSettings(t)}catch{a()}}async function Ut(){Ee(!0),w(""),P("");try{const t=await n.forceCheckForUpdate();O(t),t.updateAvailable&&t.latestVersion?w(`Update v${t.latestVersion} is available.`):w("You are up to date.")}catch(t){P(t instanceof Error?t.message:String(t))}finally{Ee(!1)}}async function Et(){Te(!0),w(""),P("");try{localStorage.setItem("companion_docker_prompt_pending","1");const t=await n.triggerUpdate();w(t.message),mt(!0)}catch(t){localStorage.removeItem("companion_docker_prompt_pending"),P(t instanceof Error?t.message:String(t)),Te(!1)}}const r=s.useCallback(t=>a=>{pe.current[t]=a},[]);return e.jsxs("div",{className:`${fe?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased flex flex-col`,children:[e.jsx("div",{className:"shrink-0 max-w-5xl w-full mx-auto px-4 sm:px-8 pt-6 sm:pt-10",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:"Settings"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Configure API access, notifications, appearance, and workspace defaults."})]}),!fe&&e.jsx("button",{onClick:()=>{const t=o.getState().currentSessionId;t?It(t):Pt()},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"})]})}),e.jsx("div",{className:"sm:hidden shrink-0 border-b border-cc-border",children:e.jsx("nav",{className:"flex gap-1 px-4 py-2 overflow-x-auto [scrollbar-width:none] [&::-webkit-scrollbar]:hidden","aria-label":"Settings categories",children:ge.map(t=>e.jsx("button",{type:"button",onClick:()=>nt(t.id),className:`shrink-0 px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${Ve===t.id?"text-cc-primary bg-cc-primary/8":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:t.label},t.id))})}),e.jsxs("div",{className:"flex-1 min-h-0 flex max-w-5xl w-full mx-auto",children:[e.jsx("nav",{className:"hidden sm:flex flex-col gap-0.5 w-44 shrink-0 pt-2 pr-6 pl-8 sticky top-0 self-start","aria-label":"Settings categories",children:ge.map(t=>e.jsx("button",{type:"button",onClick:()=>nt(t.id),className:`text-left px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${Ve===t.id?"text-cc-primary bg-cc-primary/8":"text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:t.label},t.id))}),e.jsx("div",{ref:at,className:"flex-1 min-w-0 overflow-y-auto px-4 sm:px-8 sm:pl-0 pb-safe",children:e.jsxs("div",{className:"space-y-10 py-4 sm:py-2",children:[e.jsxs("section",{id:"general",ref:r("general"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"General"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:rt,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Theme"}),e.jsx("span",{className:"text-xs text-cc-muted",children:it?"Dark":"Light"})]}),e.jsxs("button",{type:"button",onClick:ut,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Message density"}),e.jsx("span",{className:"text-xs text-cc-muted",children:dt==="compact"?"Compact":"Standard"})]}),e.jsx("p",{className:"text-xs text-cc-muted px-1",children:"Standard shows commands, diffs and tool output inline. Compact collapses each of them to a single line you can expand on demand, and hides empty thinking steps. This setting is stored in this browser only."}),e.jsxs("button",{type:"button",onClick:()=>lt(Ce==="last-commit"?"default-branch":"last-commit"),className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Diff compare against"}),e.jsx("span",{className:"text-xs text-cc-muted",children:Ce==="last-commit"?"Last commit (HEAD)":"Default branch"})]}),e.jsx("p",{className:"text-xs text-cc-muted px-1",children:"Last commit shows only uncommitted changes. Default branch shows all changes since diverging from main."}),e.jsx("div",{className:"pt-3 border-t border-cc-border",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Claude Code bridge mode"}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted",children:'How the Companion hands the bridge URL to the spawned Claude Code CLI. Loopback is the default fix for Claude Code v1.2.1+ which rejects the literal "localhost". JSON handoff is the more robust just-every/code-style approach: writes a temp descriptor with a one-shot token and passes its path via CLAUDE_BRIDGE_CONFIG.'})]}),e.jsxs("select",{"aria-label":"CLI bridge mode",value:Ue,onChange:async t=>{const a=t.target.value==="jsonHandoff"?"jsonHandoff":"loopback",c=Ue;H(a);try{await n.updateSettings({cliBridgeMode:a})}catch{H(c)}},className:"ml-3 px-2 py-1.5 text-xs bg-cc-bg rounded-lg border border-cc-border text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary",children:[e.jsx("option",{value:"loopback",children:"Loopback (default)"}),e.jsx("option",{value:"jsonHandoff",children:"JSON handoff (experimental)"})]})]})}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":U,"aria-label":"Proactive keepalive relaunch",onClick:async()=>{const t=!U,a=U;V(t);try{await n.updateSettings({proactiveKeepaliveEnabled:t})}catch{V(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Proactive keepalive relaunch"}),e.jsx("span",{className:"text-xs text-cc-muted",children:U?"On":"Off"})]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted px-1",children:"When on (default), a CLI process that exits unexpectedly with no browser attached is automatically relaunched to keep long-running sessions (agents, cron) alive. Turn off to experiment with letting dead sessions stay dead."})]}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":E,"aria-label":"Kill wedged CLI processes",onClick:async()=>{const t=!E,a=E;K(t);try{await n.updateSettings({wedgeKillEnabled:t})}catch{K(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Kill wedged CLI processes"}),e.jsx("span",{className:"text-xs text-cc-muted",children:E?"On":"Off"})]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted px-1",children:"When on (default), a CLI whose output stream closes but which does not exit is treated as wedged and killed so the session can recover. This was built for older CLI behaviour, and every process sampled since has turned out to be healthy — usually one supervising a background command. Turn off to test whether the wedge still happens at all: sessions still relaunch, but processes are left to exit on their own instead of being terminated."})]}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":T,"aria-label":"Probe silent CLI processes",onClick:async()=>{const t=!T,a=T;$(t);try{await n.updateSettings({silenceProbeEnabled:t})}catch{$(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Probe silent CLI processes"}),e.jsx("span",{className:"text-xs text-cc-muted",children:T?"On":"Off"})]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted px-1",children:"When on (default), a CLI that stops responding while its output stream stays open is sent a liveness probe after ~2 minutes of silence. If it does not answer within a further minute the session is relaunched and the in-flight turn replayed. Without this such a session hangs indefinitely showing “Still working…” with no error, because nothing ever closes the stream for companion to notice."})]}),e.jsxs("div",{className:"pt-3 border-t border-cc-border",children:[e.jsxs("button",{type:"button",role:"switch","aria-checked":I==="sdk","aria-label":"Use Agent SDK transport (experimental)",onClick:async()=>{const t=I==="sdk"?"stdio":"sdk",a=I;F(t);try{await n.updateSettings({claudeTransport:t})}catch{F(a)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Use Agent SDK transport (experimental)"}),e.jsx("span",{className:"text-xs text-cc-muted",children:I==="sdk"?"SDK":"stdio"})]}),e.jsxs("p",{className:"mt-1 text-xs text-cc-muted px-1",children:["Claude Code only — Codex sessions are unaffected. When on, new and reconnected Claude sessions run through Anthropic’s official Agent SDK instead of companion’s own stdio bridge: same ",e.jsx("code",{children:"claude"})," binary, same subscription login and usage windows, but the protocol layer is maintained upstream. Applies at launch time, so flip it and hit Reconnect on a session to migrate it (history is preserved via resume). Containerized sessions always use the stdio bridge."]})]})]})]}),e.jsxs("section",{id:"webhooks",ref:r("webhooks"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Webhooks"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"The public URL is used for webhook URLs that external services (Linear, GitHub) send events to. Set this to the externally-reachable address of your Companion instance."}),e.jsxs("p",{className:"text-xs text-cc-muted",children:["Tip:"," ",e.jsx("a",{href:"#/integrations/tailscale",className:"text-cc-primary hover:underline",children:"Use the Tailscale integration"})," ","to get an HTTPS URL automatically."]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium text-cc-fg mb-1.5",htmlFor:"public-url",children:"Public URL"}),e.jsx("input",{id:"public-url",type:"url","aria-label":"Public URL",value:R,onChange:t=>ne(t.target.value),placeholder:"https://your-domain.example.com",className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary font-mono-code"}),e.jsx("p",{className:"mt-1.5 text-[10px] text-cc-muted",children:R?`Using: ${R}`:`Fallback: ${typeof window<"u"?window.location.origin:"http://localhost:3456"}`})]}),e.jsx("button",{type:"button",onClick:async()=>{S(!0),v("");try{const t=await n.updateSettings({publicUrl:R.trim()});ne(t.publicUrl),o.getState().setPublicUrl(t.publicUrl),y(!0),setTimeout(()=>y(!1),1800)}catch(t){v(t instanceof Error?t.message:String(t))}finally{S(!1)}},disabled:f,className:"px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-primary text-white hover:opacity-90 transition-opacity disabled:opacity-50 cursor-pointer",children:f?"Saving...":ke?"Saved!":"Save Public URL"})]})]}),e.jsxs("section",{id:"authentication",ref:r("authentication"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Authentication"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Use the auth token or QR code to connect additional devices (e.g. mobile over Tailscale)."}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",children:"Auth Token"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"flex-1 px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg font-mono-code select-all break-all flex items-center",children:k?de?k:"••••••••••••••••":e.jsx("span",{className:"text-cc-muted",children:"Loading..."})}),e.jsx("button",{type:"button",onClick:()=>Xe(t=>!t),className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",title:de?"Hide token":"Show token",children:de?"Hide":"Show"}),e.jsx("button",{type:"button",onClick:()=>{k&&navigator.clipboard.writeText(k).then(()=>{st(!0),setTimeout(()=>st(!1),1500)})},disabled:!k,className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer disabled:opacity-50 disabled:cursor-not-allowed",title:"Copy token to clipboard",children:Nt?"Copied":"Copy"})]})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",children:"Mobile Login QR"}),u&&u.length>0?e.jsxs("div",{className:"space-y-3",children:[u.length>1&&e.jsx("div",{className:"flex gap-1",children:u.map((t,a)=>e.jsx("button",{type:"button",onClick:()=>wt(a),className:`px-3 py-1.5 rounded-md text-xs font-medium transition-colors cursor-pointer ${a===D?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:t.label},t.label))}),e.jsx("div",{className:"inline-block rounded-lg bg-white p-2",children:e.jsx("img",{src:u[D].qrDataUrl,alt:`QR code for ${u[D].label} login`,className:"w-48 h-48"})}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-bg text-sm font-mono-code text-cc-fg break-all select-all",children:u[D].url}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Scan with your phone's camera app — it will open the URL and auto-authenticate."})]}):u&&u.length===0?e.jsx("p",{className:"text-xs text-cc-muted",children:"No remote addresses detected (LAN or Tailscale). Connect to a network to generate a QR code."}):e.jsx("button",{type:"button",onClick:async()=>{et(!0);try{const t=await n.getAuthQr();Ze(t.qrCodes)}catch{}finally{et(!1)}},disabled:ue,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${ue?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:ue?"Generating...":"Show QR Code"})]}),e.jsxs("div",{className:"pt-2",children:[e.jsx("button",{type:"button",onClick:async()=>{if(confirm("Regenerate auth token? All existing sessions on other devices will be signed out.")){tt(!0);try{const t=await n.regenerateAuthToken();Je(t.token),Xe(!0),Ze(null)}catch{}finally{tt(!1)}}},disabled:xe,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${xe?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:xe?"Regenerating...":"Regenerate Token"}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"Creates a new token. All other signed-in devices will need to re-authenticate."})]})]})]}),e.jsxs("section",{id:"notifications",ref:r("notifications"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Notifications"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("button",{type:"button",onClick:pt,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Sound"}),e.jsx("span",{className:"text-xs text-cc-muted",children:xt?"On":"Off"})]}),ht&&e.jsxs("button",{type:"button",onClick:async()=>{if(Se)Ae(!1);else{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted")return;Ae(!0)}},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Desktop Alerts"}),e.jsx("span",{className:"text-xs text-cc-muted",children:Se?"On":"Off"})]})]})]}),e.jsxs("section",{id:"providers",ref:r("providers"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Providers"}),e.jsxs("div",{className:"space-y-6",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Configure authentication tokens for Claude Code and Codex. These are injected into sessions automatically."}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium",htmlFor:"claude-code-token",children:"Claude Code OAuth Token"}),e.jsxs("p",{className:"text-xs text-cc-muted",children:["Run ",e.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"claude setup-token"})," in your terminal, then paste the token here."]}),e.jsx("input",{id:"claude-code-token",type:"password",value:oe&&!yt&&!b?"••••••••••••••••":b,onChange:t=>He(t.target.value),onFocus:()=>Ye(!0),onBlur:()=>Ye(!1),placeholder:oe?"Enter a new token to replace":"Paste token from claude setup-token",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("p",{className:"text-xs text-cc-muted",children:oe?"Claude Code token configured":"Claude Code token not configured"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("label",{className:"block text-sm font-medium",htmlFor:"openai-api-key",children:"OpenAI API Key (Codex)"}),e.jsxs("p",{className:"text-xs text-cc-muted",children:["Used to authenticate Codex sessions. You can also use ",e.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"codex --login"})," for device-based auth."]}),e.jsx("input",{id:"openai-api-key",type:"password",value:ie&&!jt&&!g?"••••••••••••••••":g,onChange:t=>Qe(t.target.value),onFocus:()=>ze(!0),onBlur:()=>ze(!1),placeholder:ie?"Enter a new key to replace":"sk-...",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("p",{className:"text-xs text-cc-muted",children:ie?"OpenAI key configured":"OpenAI key not configured"})]}),Ge&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:Ge}),vt&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Provider settings saved."}),e.jsx("button",{type:"button",disabled:re||!b.trim()&&!g.trim(),onClick:async()=>{_e(!0),qe(""),le(!1);try{const t={};b.trim()&&(t.claudeCodeOAuthToken=b.trim()),g.trim()&&(t.openaiApiKey=g.trim());const a=await n.updateSettings(t);Be(a.claudeCodeOAuthTokenConfigured),We(a.openaiApiKeyConfigured),He(""),Qe(""),le(!0),setTimeout(()=>le(!1),1800)}catch(t){qe(t instanceof Error?t.message:String(t))}finally{_e(!1)}},className:`px-4 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${re||!b.trim()&&!g.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:re?"Saving...":"Save Provider Settings"})]})]}),e.jsxs("section",{id:"anthropic",ref:r("anthropic"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Anthropic"}),e.jsxs("form",{onSubmit:kt,className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"anthropic-key",children:"Anthropic API Key"}),e.jsx("input",{id:"anthropic-key",type:"password",value:d&&!ft&&!p?"••••••••••••••••":p,onChange:t=>{ve(t.target.value),h(null)},onFocus:()=>$e(!0),onBlur:()=>$e(!1),placeholder:d?"Enter a new key to replace":"sk-ant-api03-...",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("p",{className:"mt-1.5 text-xs text-cc-muted",children:"Auto-renaming is disabled until this key is configured."})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"anthropic-model",children:"Anthropic Model"}),e.jsx("input",{id:"anthropic-model",type:"text",value:ye,onChange:t=>je(t.target.value),placeholder:"claude-sonnet-4-6",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"})]}),Ne&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:Ne}),ke&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:"Settings saved."}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"text-xs text-cc-muted",children:C?"Loading...":d?"Anthropic key configured":"Anthropic key not configured"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button",disabled:ce||!p.trim(),onClick:async()=>{Fe(!0),h(null);try{const t=await n.verifyAnthropicKey(p.trim());h(t),setTimeout(()=>h(null),5e3)}catch(t){h({valid:!1,error:t instanceof Error?t.message:String(t)}),setTimeout(()=>h(null),5e3)}finally{Fe(!1)}},className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${ce||!p.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:ce?"Verifying...":"Verify"}),e.jsx("button",{type:"submit",disabled:f||C,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${f||C?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:f?"Saving...":"Save"})]})]}),N&&e.jsx("div",{className:`px-3 py-2 rounded-lg text-xs ${N.valid?"bg-cc-success/10 border border-cc-success/20 text-cc-success":"bg-cc-error/10 border border-cc-error/20 text-cc-error"}`,children:N.valid?"API key is valid.":`Invalid API key${N.error?`: ${N.error}`:"."}`})]})]}),e.jsxs("section",{id:"ai-validation",ref:r("ai-validation"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"AI Validation"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-cc-muted leading-relaxed",children:"When enabled, an AI model evaluates tool calls before they execute. Safe operations are auto-approved, dangerous ones are blocked, and uncertain cases are shown to you with a recommendation. Requires an Anthropic API key. These settings serve as defaults for new sessions. Each session can override AI validation independently via the shield icon in the session header."}),e.jsxs("button",{type:"button",onClick:()=>me("aiValidationEnabled"),disabled:!d,className:`w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg transition-colors ${d?"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed opacity-60"}`,children:[e.jsx("span",{className:"text-sm",children:"AI Validation Mode"}),e.jsx("span",{className:`text-xs font-medium ${M&&d?"text-cc-success":"text-cc-muted"}`,children:M&&d?"On":"Off"})]}),!d&&e.jsx("p",{className:"text-[11px] text-cc-warning",children:"Configure an Anthropic API key above to enable AI validation."}),M&&d&&e.jsxs(e.Fragment,{children:[e.jsxs("button",{type:"button",onClick:()=>me("aiValidationAutoApprove"),className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm",children:"Auto-approve safe tools"}),e.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5",children:"Automatically allow read-only tools and benign commands"})]}),e.jsx("span",{className:`text-xs font-medium ${_?"text-cc-success":"text-cc-muted"}`,children:_?"On":"Off"})]}),e.jsxs("button",{type:"button",onClick:()=>me("aiValidationAutoDeny"),className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-sm",children:"Auto-deny dangerous tools"}),e.jsx("p",{className:"text-[11px] text-cc-muted mt-0.5",children:"Automatically block destructive commands like rm -rf"})]}),e.jsx("span",{className:`text-xs font-medium ${q?"text-cc-success":"text-cc-muted"}`,children:q?"On":"Off"})]})]})]})]}),e.jsxs("section",{id:"dashboard",ref:r("dashboard"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Project Dashboard"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed",children:["A nightly job summarizes every session with recent activity so the"," ",e.jsx("a",{href:"#/dashboard",className:"underline hover:no-underline",children:"dashboard"})," ",'can show where each project stands. It runs through the Claude Code CLI with the same login your normal sessions use — no separate API key needed. This is opt-in because it spends tokens every night. You can always refresh manually with "Update now" on the dashboard, even when the nightly run is off.']}),e.jsxs("button",{type:"button",onClick:Ct,className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:[e.jsx("span",{className:"text-sm",children:"Nightly dashboard updates"}),e.jsx("span",{className:`text-xs font-medium ${z?"text-cc-success":"text-cc-muted"}`,children:z?"On":"Off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"dashboard-model",children:"Summarization model"}),e.jsxs("select",{id:"dashboard-model",value:Re,onChange:t=>{const a=Re;X(t.target.value),he({dashboardModel:t.target.value},()=>X(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",children:[e.jsx("option",{value:"claude-haiku-4-5",children:"Claude Haiku 4.5 — cheapest, recommended"}),e.jsx("option",{value:"claude-sonnet-4-6",children:"Claude Sonnet 4.6"}),e.jsx("option",{value:"claude-sonnet-5",children:"Claude Sonnet 5"})]}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"Summarize-and-classify doesn't need an expensive model — Haiku keeps the nightly cost low."})]}),e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"dashboard-run-hour",children:"Run at"}),e.jsx("select",{id:"dashboard-run-hour",value:De,onChange:t=>{const a=De,c=Number(t.target.value);Z(c),he({dashboardRunHour:c},()=>Z(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",children:Array.from({length:24},(t,a)=>e.jsxs("option",{value:a,children:[String(a).padStart(2,"0"),":00"]},a))})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"dashboard-max-sessions",children:"Max sessions per run"}),e.jsx("select",{id:"dashboard-max-sessions",value:Oe,onChange:t=>{const a=Oe,c=Number(t.target.value);ee(c),he({dashboardMaxSessionsPerRun:c},()=>ee(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow",children:[10,20,30,50,100,200].map(t=>e.jsx("option",{value:t,children:t},t))})]})]})]})]}),e.jsxs("section",{id:"magic-ui",ref:r("magic-ui"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Magic UI"}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-xs text-cc-muted leading-relaxed",children:["An experimental session view: a cheap watcher model follows the session and paints a live, full-width dashboard — condensed progress, charts, open points, and decisions — instead of the classic chat column. Turning this on only makes the view"," ",e.jsx("em",{children:"available"}),"; each user still enables it per session from the top bar, and the watcher only runs for sessions that opted in. Uses the Claude Code CLI login — no separate API key."]}),!m&&e.jsx("p",{className:"text-xs text-cc-warning",children:"Requires the Claude Code CLI login — no Claude CLI was found on this server, so Magic UI stays unavailable."}),e.jsxs("button",{type:"button",onClick:St,disabled:!m,className:`w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg bg-cc-hover text-cc-fg transition-colors ${m?"hover:bg-cc-active cursor-pointer":"opacity-50 cursor-not-allowed"}`,children:[e.jsx("span",{className:"text-sm",children:"Magic UI available to users"}),e.jsx("span",{className:`text-xs font-medium ${te&&m?"text-cc-success":"text-cc-muted"}`,children:te&&m?"On":"Off"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"magic-ui-model",children:"Watcher model"}),e.jsxs("select",{id:"magic-ui-model",value:Le,disabled:!m,onChange:t=>{const a=Le;ae(t.target.value),At(t.target.value,()=>ae(a))},className:"w-full px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg text-cc-fg focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow disabled:opacity-50",children:[e.jsx("option",{value:"claude-haiku-4-5",children:"Claude Haiku 4.5 — cheapest, recommended"}),e.jsx("option",{value:"claude-sonnet-4-6",children:"Claude Sonnet 4.6"}),e.jsx("option",{value:"claude-sonnet-5",children:"Claude Sonnet 5"})]}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"The watcher runs many small turns per session — Haiku keeps it fast and cheap."})]})]})]}),e.jsxs("section",{id:"updates",ref:r("updates"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Updates"}),e.jsxs("div",{className:"space-y-3",children:[i?e.jsxs("p",{className:"text-xs text-cc-muted",children:["Current version: v",i.currentVersion,i.latestVersion?` • Latest: v${i.latestVersion}`:"",i.channel==="prerelease"?" (prerelease)":""]}):e.jsx("p",{className:"text-xs text-cc-muted",children:"Version information not loaded yet."}),e.jsxs("div",{children:[e.jsx("span",{id:"update-channel-label",className:"block text-sm font-medium mb-1.5",children:"Update Channel"}),e.jsxs("div",{className:"flex gap-1",role:"radiogroup","aria-labelledby":"update-channel-label",children:[e.jsx("button",{type:"button",role:"radio","aria-checked":x==="stable",onClick:async()=>{if(x!=="stable"){j("stable");try{await n.updateSettings({updateChannel:"stable"})}catch{j("prerelease");return}try{const t=await n.forceCheckForUpdate();O(t)}catch{}}},className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${x==="stable"?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-active"}`,children:"Stable"}),e.jsx("button",{type:"button",role:"radio","aria-checked":x==="prerelease",onClick:async()=>{if(x!=="prerelease"){j("prerelease");try{await n.updateSettings({updateChannel:"prerelease"})}catch{j("stable");return}try{const t=await n.forceCheckForUpdate();O(t)}catch{}}},className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer ${x==="prerelease"?"bg-cc-primary text-white":"bg-cc-hover text-cc-muted hover:text-cc-fg hover:bg-cc-active"}`,children:"Prerelease"})]}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:x==="prerelease"?"Tracking prerelease channel. You will receive preview builds from the latest main branch.":"Tracking stable channel. You will only receive versioned releases."})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("span",{className:"block text-sm font-medium",children:"Auto-update Docker image"}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted",children:"Automatically re-pull the sandbox Docker image when updating The Companion"})]}),e.jsx("button",{type:"button",role:"switch","aria-checked":A,onClick:async()=>{const t=!A;L(t);try{await n.updateSettings({dockerAutoUpdate:t})}catch{L(!t)}},className:`relative inline-flex h-6 w-11 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${A?"bg-cc-primary":"bg-cc-hover"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform transition-transform ${A?"translate-x-5":"translate-x-0"}`})})]}),Pe&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:Pe}),Ie&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-success/10 border border-cc-success/20 text-xs text-cc-success",children:Ie}),e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx("button",{type:"button",onClick:Ut,disabled:B,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${B?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:B?"Checking...":"Check for updates"}),i!=null&&i.isServiceMode?e.jsx("button",{type:"button",onClick:Et,disabled:Q||i.updateInProgress||!i.updateAvailable,className:`px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${Q||i.updateInProgress||!i.updateAvailable?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:Q||i.updateInProgress?"Updating...":"Update & Restart"}):e.jsxs("p",{className:"text-xs text-cc-muted self-center",children:["Install service mode with ",e.jsx("code",{className:"font-mono-code bg-cc-code-bg px-1 py-0.5 rounded text-cc-code-fg",children:"the-companion install"})," to enable one-click updates."]})]})]})]}),e.jsxs("section",{id:"telemetry",ref:r("telemetry"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Telemetry"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Anonymous product analytics and crash reports via PostHog to improve reliability."}),e.jsxs("button",{type:"button",onClick:()=>{const t=!Me;Mt(t),bt(t)},className:"w-full flex items-center justify-between px-3 py-3 min-h-[44px] rounded-lg text-sm bg-cc-hover text-cc-fg hover:bg-cc-active transition-colors cursor-pointer",children:[e.jsx("span",{children:"Usage analytics and errors"}),e.jsx("span",{className:"text-xs text-cc-muted",children:Me?"On":"Off"})]}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Browser Do Not Track is respected automatically."})]})]}),e.jsxs("section",{id:"environments",ref:r("environments"),children:[e.jsx("h2",{className:"text-sm font-semibold text-cc-fg mb-4",children:"Environments"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-xs text-cc-muted",children:"Manage reusable environment profiles used when creating sessions."}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/environments"},className:"px-3 py-2 min-h-[44px] rounded-lg text-sm font-medium bg-cc-primary hover:bg-cc-primary-hover text-white transition-colors cursor-pointer",children:"Open Environments Page"})]})]})]})})]})]})}export{Dt as SettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,a as i,j as e,u as d,n as N,b as y}from"./index-DqIZ_Ol5.js";function T({embedded:x=!1}){const[t,r]=l.useState(null),[a,h]=l.useState(!0),[c,o]=l.useState(!1),[g,m]=l.useState(!1);l.useEffect(()=>{i.getTailscaleStatus().then(r).catch(()=>r(null)).finally(()=>h(!1))},[]);async function u(){const s=await i.getTailscaleStatus().catch(()=>null);s&&r(s)}async function p(){o(!0);try{const s=await i.startTailscaleFunnel();r(s),s.funnelUrl&&!s.error&&!s.warning&&d.getState().setPublicUrl(s.funnelUrl)}catch(s){await u(),r(n=>n?{...n,error:s instanceof Error?s.message:String(s)}:null)}finally{o(!1)}}async function b(){o(!0);try{const s=await i.stopTailscaleFunnel();r(s);const n=d.getState().publicUrl;(!n||n===(t==null?void 0:t.funnelUrl))&&d.getState().setPublicUrl("")}catch(s){await u(),r(n=>n?{...n,error:s instanceof Error?s.message:String(s)}:null)}finally{o(!1)}}function f(){t!=null&&t.funnelUrl&&navigator.clipboard.writeText(t.funnelUrl).then(()=>{m(!0),setTimeout(()=>m(!1),1800)}).catch(()=>{})}const j=t?t.installed?t.connected?t.funnelActive?"Funnel active":"Ready":"Not connected":"Not installed":"Loading...",v=t?!t.installed||!t.connected?"text-cc-muted":t.funnelActive?"text-cc-success":"text-amber-500":"text-cc-muted";return e.jsx("div",{className:`${x?"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:"Tailscale Settings"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Expose your Companion over HTTPS with Tailscale Funnel."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{window.location.hash="#/integrations"},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:"Integrations"}),!x&&e.jsx("button",{onClick:()=>{const s=d.getState().currentSessionId;s?N(s):y()},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"})]})]}),e.jsxs("section",{className:"relative overflow-hidden bg-cc-card border border-cc-border rounded-xl p-4 sm:p-6 mb-4",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none bg-[radial-gradient(circle_at_top_right,rgba(6,182,212,0.1),transparent_45%)]"}),e.jsxs("div",{className:"relative flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-full border border-cc-border bg-cc-hover/60 text-xs text-cc-muted",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-cc-fg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),e.jsx("span",{children:"Tailscale Integration"})]}),e.jsx("h2",{className:"mt-3 text-lg sm:text-xl font-semibold text-cc-fg",children:"HTTPS access in one click"}),e.jsx("p",{className:"mt-1.5 text-sm text-cc-muted max-w-2xl",children:"Tailscale Funnel exposes your Companion to the internet over HTTPS with automatic TLS certificates. No configuration needed."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"Automatic TLS"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"Stable *.ts.net domain"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"No API keys needed"})]})]}),e.jsxs("div",{className:"shrink-0 rounded-xl border border-cc-border bg-cc-bg px-3 py-2 text-right min-w-[170px]",children:[e.jsx("p",{className:"text-[11px] text-cc-muted uppercase tracking-wide",children:"Status"}),e.jsx("p",{className:`mt-1 text-sm font-medium ${v}`,children:j}),e.jsx("p",{className:"mt-0.5 text-[11px] text-cc-muted truncate",children:(t==null?void 0:t.dnsName)||"No machine name"})]})]})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4 sm:p-5 space-y-4",children:[e.jsxs("h2",{className:"text-sm font-semibold text-cc-fg flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-cc-fg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),e.jsx("span",{children:"Tailscale Funnel"})]}),a&&e.jsx("p",{className:"text-sm text-cc-muted",children:"Checking Tailscale status..."}),!a&&!t&&e.jsx("p",{className:"text-sm text-cc-muted",children:"Could not check Tailscale status."}),!a&&t&&!t.installed&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"Tailscale is not installed on this machine. Install it to enable one-click HTTPS."}),e.jsxs("a",{href:"https://tailscale.com/download",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors",children:["Install Tailscale",e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),!a&&t&&t.installed&&!t.connected&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"Tailscale is installed but not connected to a tailnet."}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg font-mono-code",children:"tailscale up"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Run this command to connect to your Tailscale network."})]}),!a&&t&&t.installed&&t.connected&&!t.funnelActive&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-cc-muted",children:["Tailscale is connected as ",e.jsx("span",{className:"font-medium text-cc-fg",children:t.dnsName}),". Enable Funnel to expose your Companion over HTTPS."]}),t.needsOperatorMode&&!t.error&&e.jsxs("div",{className:"space-y-2 px-3 py-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx("p",{className:"text-xs text-amber-500 font-medium",children:"Setup needed: Tailscale operator mode"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"On Linux, Tailscale requires operator mode to manage Funnel. Run this command first:"}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg font-mono-code",children:"sudo tailscale set --operator=$USER"})]}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${c?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:c?"Starting...":"Enable HTTPS via Tailscale Funnel"})]}),!a&&t&&t.installed&&t.connected&&t.funnelActive&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"Funnel is active. Your Companion is accessible at:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:t.funnelUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"flex-1 px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-primary font-mono-code truncate flex items-center hover:underline",children:t.funnelUrl}),e.jsx("button",{type:"button",onClick:f,className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:g?"Copied!":"Copy"})]}),e.jsx("p",{className:"text-xs text-cc-muted",children:"This URL has been automatically set as your Public URL in Settings."}),e.jsx("button",{type:"button",onClick:b,disabled:c,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${c?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:c?"Stopping...":"Disable Funnel"})]}),(t==null?void 0:t.error)&&t.needsOperatorMode&&e.jsxs("div",{className:"space-y-3 px-3 py-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx("p",{className:"text-sm font-medium text-amber-500",children:"Operator mode required"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"On Linux, Tailscale requires operator mode to manage Funnel without sudo. Run this command once in your terminal:"}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg font-mono-code",children:"sudo tailscale set --operator=$USER"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"After running the command, click Retry to enable Funnel."}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${c?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:c?"Retrying...":"Retry"})]}),(t==null?void 0:t.warning)&&e.jsxs("div",{className:"space-y-2 px-3 py-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx("p",{className:"text-sm font-medium text-amber-500",children:"URL may not be publicly accessible"}),e.jsx("p",{className:"text-xs text-cc-muted",children:t.warning}),e.jsxs("a",{href:"https://login.tailscale.com/admin/acls",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-cc-primary hover:underline",children:["Open Tailscale admin console",e.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),(t==null?void 0:t.error)&&!t.needsOperatorMode&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:t.error})]}),e.jsxs("section",{className:"mt-4 grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"1. Install"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"Install Tailscale on your machine and sign in."})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"2. Enable"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"One click to get an HTTPS URL with automatic TLS."})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"3. Done"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"Webhooks and remote access just work."})]})]})]})})}export{T as TailscalePage};
|
|
1
|
+
import{r as l,a as i,j as e,u as d,n as N,b as y}from"./index-n6Tt3UFW.js";function T({embedded:x=!1}){const[t,r]=l.useState(null),[a,h]=l.useState(!0),[c,o]=l.useState(!1),[g,m]=l.useState(!1);l.useEffect(()=>{i.getTailscaleStatus().then(r).catch(()=>r(null)).finally(()=>h(!1))},[]);async function u(){const s=await i.getTailscaleStatus().catch(()=>null);s&&r(s)}async function p(){o(!0);try{const s=await i.startTailscaleFunnel();r(s),s.funnelUrl&&!s.error&&!s.warning&&d.getState().setPublicUrl(s.funnelUrl)}catch(s){await u(),r(n=>n?{...n,error:s instanceof Error?s.message:String(s)}:null)}finally{o(!1)}}async function b(){o(!0);try{const s=await i.stopTailscaleFunnel();r(s);const n=d.getState().publicUrl;(!n||n===(t==null?void 0:t.funnelUrl))&&d.getState().setPublicUrl("")}catch(s){await u(),r(n=>n?{...n,error:s instanceof Error?s.message:String(s)}:null)}finally{o(!1)}}function f(){t!=null&&t.funnelUrl&&navigator.clipboard.writeText(t.funnelUrl).then(()=>{m(!0),setTimeout(()=>m(!1),1800)}).catch(()=>{})}const j=t?t.installed?t.connected?t.funnelActive?"Funnel active":"Ready":"Not connected":"Not installed":"Loading...",v=t?!t.installed||!t.connected?"text-cc-muted":t.funnelActive?"text-cc-success":"text-amber-500":"text-cc-muted";return e.jsx("div",{className:`${x?"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:"Tailscale Settings"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Expose your Companion over HTTPS with Tailscale Funnel."})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{onClick:()=>{window.location.hash="#/integrations"},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:"Integrations"}),!x&&e.jsx("button",{onClick:()=>{const s=d.getState().currentSessionId;s?N(s):y()},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"})]})]}),e.jsxs("section",{className:"relative overflow-hidden bg-cc-card border border-cc-border rounded-xl p-4 sm:p-6 mb-4",children:[e.jsx("div",{className:"absolute inset-0 pointer-events-none bg-[radial-gradient(circle_at_top_right,rgba(6,182,212,0.1),transparent_45%)]"}),e.jsxs("div",{className:"relative flex items-start justify-between gap-4 flex-wrap",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 px-2.5 py-1 rounded-full border border-cc-border bg-cc-hover/60 text-xs text-cc-muted",children:[e.jsx("svg",{className:"w-3.5 h-3.5 text-cc-fg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),e.jsx("span",{children:"Tailscale Integration"})]}),e.jsx("h2",{className:"mt-3 text-lg sm:text-xl font-semibold text-cc-fg",children:"HTTPS access in one click"}),e.jsx("p",{className:"mt-1.5 text-sm text-cc-muted max-w-2xl",children:"Tailscale Funnel exposes your Companion to the internet over HTTPS with automatic TLS certificates. No configuration needed."}),e.jsxs("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"Automatic TLS"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"Stable *.ts.net domain"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"No API keys needed"})]})]}),e.jsxs("div",{className:"shrink-0 rounded-xl border border-cc-border bg-cc-bg px-3 py-2 text-right min-w-[170px]",children:[e.jsx("p",{className:"text-[11px] text-cc-muted uppercase tracking-wide",children:"Status"}),e.jsx("p",{className:`mt-1 text-sm font-medium ${v}`,children:j}),e.jsx("p",{className:"mt-0.5 text-[11px] text-cc-muted truncate",children:(t==null?void 0:t.dnsName)||"No machine name"})]})]})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4 sm:p-5 space-y-4",children:[e.jsxs("h2",{className:"text-sm font-semibold text-cc-fg flex items-center gap-2",children:[e.jsx("svg",{className:"w-4 h-4 text-cc-fg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:e.jsx("path",{d:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z"})}),e.jsx("span",{children:"Tailscale Funnel"})]}),a&&e.jsx("p",{className:"text-sm text-cc-muted",children:"Checking Tailscale status..."}),!a&&!t&&e.jsx("p",{className:"text-sm text-cc-muted",children:"Could not check Tailscale status."}),!a&&t&&!t.installed&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"Tailscale is not installed on this machine. Install it to enable one-click HTTPS."}),e.jsxs("a",{href:"https://tailscale.com/download",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors",children:["Install Tailscale",e.jsxs("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),!a&&t&&t.installed&&!t.connected&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"Tailscale is installed but not connected to a tailnet."}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg font-mono-code",children:"tailscale up"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Run this command to connect to your Tailscale network."})]}),!a&&t&&t.installed&&t.connected&&!t.funnelActive&&e.jsxs("div",{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-cc-muted",children:["Tailscale is connected as ",e.jsx("span",{className:"font-medium text-cc-fg",children:t.dnsName}),". Enable Funnel to expose your Companion over HTTPS."]}),t.needsOperatorMode&&!t.error&&e.jsxs("div",{className:"space-y-2 px-3 py-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx("p",{className:"text-xs text-amber-500 font-medium",children:"Setup needed: Tailscale operator mode"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"On Linux, Tailscale requires operator mode to manage Funnel. Run this command first:"}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg font-mono-code",children:"sudo tailscale set --operator=$USER"})]}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${c?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:c?"Starting...":"Enable HTTPS via Tailscale Funnel"})]}),!a&&t&&t.installed&&t.connected&&t.funnelActive&&e.jsxs("div",{className:"space-y-3",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"Funnel is active. Your Companion is accessible at:"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{href:t.funnelUrl||"#",target:"_blank",rel:"noopener noreferrer",className:"flex-1 px-3 py-2.5 min-h-[44px] text-sm bg-cc-bg rounded-lg border border-cc-border text-cc-primary font-mono-code truncate flex items-center hover:underline",children:t.funnelUrl}),e.jsx("button",{type:"button",onClick:f,className:"px-3 py-2.5 min-h-[44px] rounded-lg text-sm bg-cc-hover hover:bg-cc-active text-cc-fg transition-colors cursor-pointer",children:g?"Copied!":"Copy"})]}),e.jsx("p",{className:"text-xs text-cc-muted",children:"This URL has been automatically set as your Public URL in Settings."}),e.jsx("button",{type:"button",onClick:b,disabled:c,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${c?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:c?"Stopping...":"Disable Funnel"})]}),(t==null?void 0:t.error)&&t.needsOperatorMode&&e.jsxs("div",{className:"space-y-3 px-3 py-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx("p",{className:"text-sm font-medium text-amber-500",children:"Operator mode required"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"On Linux, Tailscale requires operator mode to manage Funnel without sudo. Run this command once in your terminal:"}),e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-hover text-xs text-cc-fg font-mono-code",children:"sudo tailscale set --operator=$USER"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"After running the command, click Retry to enable Funnel."}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:`px-4 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors ${c?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:c?"Retrying...":"Retry"})]}),(t==null?void 0:t.warning)&&e.jsxs("div",{className:"space-y-2 px-3 py-3 rounded-lg bg-amber-500/10 border border-amber-500/20",children:[e.jsx("p",{className:"text-sm font-medium text-amber-500",children:"URL may not be publicly accessible"}),e.jsx("p",{className:"text-xs text-cc-muted",children:t.warning}),e.jsxs("a",{href:"https://login.tailscale.com/admin/acls",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-xs text-cc-primary hover:underline",children:["Open Tailscale admin console",e.jsxs("svg",{className:"w-3 h-3",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[e.jsx("path",{d:"M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6"}),e.jsx("polyline",{points:"15 3 21 3 21 9"}),e.jsx("line",{x1:"10",y1:"14",x2:"21",y2:"3"})]})]})]}),(t==null?void 0:t.error)&&!t.needsOperatorMode&&e.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:t.error})]}),e.jsxs("section",{className:"mt-4 grid grid-cols-1 md:grid-cols-3 gap-3",children:[e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"1. Install"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"Install Tailscale on your machine and sign in."})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"2. Enable"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"One click to get an HTTPS URL with automatic TLS."})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4",children:[e.jsx("p",{className:"text-[11px] uppercase tracking-wide text-cc-muted",children:"3. Done"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"Webhooks and remote access just work."})]})]})]})})}export{T as TailscalePage};
|