@hellcoder/companion 0.119.1 → 0.120.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-E73zA-6k.js → AgentsPage-V7NBPNSh.js} +5 -5
- package/dist/assets/CronManager-CGfXlVZS.js +1 -0
- package/dist/assets/{DashboardPage-Dk4z826H.js → DashboardPage-N7MWZiJQ.js} +1 -1
- package/dist/assets/{IntegrationsPage-C7cQyPBt.js → IntegrationsPage-DRP477b0.js} +1 -1
- package/dist/assets/{LinearOAuthSettingsPage-BG4-JYjD.js → LinearOAuthSettingsPage-CPW4TQuD.js} +1 -1
- package/dist/assets/{LinearSettingsPage-CBbKNZVH.js → LinearSettingsPage-BwVTEKqs.js} +1 -1
- package/dist/assets/{MagicUIDashboard-DpxmzOIx.js → MagicUIDashboard-exuRY5LQ.js} +1 -1
- package/dist/assets/MagicUIView-AKoy6jOb.js +1 -0
- package/dist/assets/{Playground-BdB18EpN.js → Playground-BiEa7THU.js} +1 -1
- package/dist/assets/{PromptsPage-C7vU_XHW.js → PromptsPage-BYtZdliB.js} +1 -1
- package/dist/assets/{RunsPage-BsIYybEZ.js → RunsPage-DD6KPNKm.js} +1 -1
- package/dist/assets/{SandboxManager-DKcCgC-r.js → SandboxManager-C8tBjBXY.js} +1 -1
- package/dist/assets/SettingsPage-77tDzDuD.js +1 -0
- package/dist/assets/{TailscalePage-BhGXhs0h.js → TailscalePage-B0TbcOPL.js} +1 -1
- package/dist/assets/{index-C0oFg9YU.js → index-BM8QkiV8.js} +58 -58
- package/dist/assets/{sw-register-CWqt9RnE.js → sw-register-Cr16zatT.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/sw.js +1 -1
- package/package.json +1 -1
- package/server/codex-app-server.ts +61 -0
- package/server/codex-auth.test.ts +254 -0
- package/server/codex-auth.ts +315 -0
- package/server/codex-models.ts +2 -43
- package/server/protocol/codex-upstream/ClientRequest.ts.txt +62 -17
- package/server/protocol/codex-upstream/README.md +1 -1
- package/server/protocol/codex-upstream/ServerNotification.ts.txt +52 -4
- package/server/protocol/codex-upstream/ServerRequest.ts.txt +4 -1
- package/server/protocol/codex-upstream/v2/DynamicToolCallParams.ts.txt +1 -1
- package/server/routes/codex-auth-routes.test.ts +115 -0
- package/server/routes/codex-auth-routes.ts +49 -0
- package/server/routes.ts +2 -0
- package/dist/assets/CronManager-Dbz9rad2.js +0 -1
- package/dist/assets/MagicUIView-wrboravS.js +0 -1
- package/dist/assets/SettingsPage-BIvJyPOd.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as a,a as N,j as t,t as w,e as T,n as P}from"./index-C0oFg9YU.js";const I=[{id:"all",label:"All"},{id:"unfinished",label:"Unfinished"},{id:"awaiting_user",label:"Needs input"},{id:"completed",label:"Completed"},{id:"archivable",label:"Archivable"}],D={completed:{label:"Completed",className:"bg-cc-success/10 text-cc-success border-cc-success/20",dotClassName:"bg-cc-success"},in_progress:{label:"In progress",className:"bg-cc-primary/10 text-cc-primary border-cc-primary/20",dotClassName:"bg-cc-primary"},awaiting_user:{label:"Needs input",className:"bg-cc-warning/10 text-cc-warning border-cc-warning/20",dotClassName:"bg-cc-warning"},stalled:{label:"Stalled",className:"bg-cc-error/10 text-cc-error border-cc-error/20",dotClassName:"bg-cc-error"}};function $(e,s){switch(s){case"all":return!0;case"unfinished":return e.status==="in_progress"||e.status==="stalled";case"awaiting_user":return e.status==="awaiting_user";case"completed":return e.status==="completed";case"archivable":return e.archivable&&!e.companionArchived}}function U(e){const s=new Map;for(const i of e){const c=i.cwd.replace(/\/+$/,"")||"/";let n=s.get(c);n||(n={key:c,label:T(c),sessions:[],lastActivityAt:0},s.set(c,n)),n.sessions.push(i),n.lastActivityAt=Math.max(n.lastActivityAt,i.lastActivityAt)}const l=Array.from(s.values()).sort((i,c)=>c.lastActivityAt-i.lastActivityAt);for(const i of l)i.sessions.sort((c,n)=>n.lastActivityAt-c.lastActivityAt);return l}function E(e){return e.displayName||e.slug||`Session ${e.sessionId.slice(0,8)}`}function L({status:e}){const s=D[e];return t.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full border text-[11px] font-medium whitespace-nowrap ${s.className}`,children:[t.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${s.dotClassName}`,"aria-hidden":"true"}),s.label]})}function _({progress:e}){const s=e.total>0?Math.round(e.processed/e.total*100):0,l=e.total>0?`Summarizing session ${Math.min(e.processed+1,e.total)} of ${e.total}${e.currentSession?` — ${e.currentSession}`:""}`:"Scanning sessions...";return t.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-sm text-cc-fg",children:l}),e.total>0&&t.jsxs("span",{className:"text-xs text-cc-muted tabular-nums",children:[s,"%"]})]}),t.jsx("div",{role:"progressbar","aria-label":"Dashboard update progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.total>0?s:void 0,className:"h-2 w-full rounded-full bg-cc-hover overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full bg-cc-primary transition-all duration-500 ${e.total===0?"animate-pulse w-1/4":""}`,style:e.total>0?{width:`${Math.max(s,3)}%`}:void 0})}),e.failed>0&&t.jsxs("p",{className:"mt-2 text-[11px] text-cc-warning",children:[e.failed," session",e.failed===1?"":"s"," failed so far"]})]})}function B({session:e,onArchived:s}){const[l,i]=a.useState(!1),[c,n]=a.useState(""),p=!!e.companionSessionId&&e.archivable&&!e.companionArchived,b=[e.userName?`by ${e.userName}`:null,e.gitBranch?e.gitBranch:null,`active ${w(e.lastActivityAt)}`].filter(Boolean);async function h(){if(e.companionSessionId){i(!0),n("");try{await N.archiveSession(e.companionSessionId,{linearTransition:"none"}),s(e.companionSessionId)}catch(d){n(d instanceof Error?d.message:String(d))}finally{i(!1)}}}return t.jsx("li",{className:"rounded-lg border border-cc-border bg-cc-bg p-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.companionSessionId&&!e.companionArchived?t.jsx("button",{type:"button",onClick:()=>P(e.companionSessionId),className:"text-sm font-medium text-cc-fg hover:text-cc-primary truncate cursor-pointer text-left",title:"Open session",children:E(e)}):t.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:E(e)}),t.jsx(L,{status:e.status}),e.companionArchived&&t.jsx("span",{className:"text-[11px] text-cc-muted border border-cc-border rounded-full px-2 py-0.5",children:"Archived"}),!e.companionSessionId&&t.jsx("span",{className:"text-[11px] text-cc-muted border border-cc-border rounded-full px-2 py-0.5",title:"Discovered from ~/.claude — not launched through the companion",children:"External"})]}),t.jsx("p",{className:"mt-1.5 text-sm text-cc-fg/90 leading-relaxed",children:e.summary}),e.openItems.length>0&&t.jsx("ul",{className:"mt-2 space-y-1",children:e.openItems.map(d=>t.jsxs("li",{className:"text-xs text-cc-muted flex items-start gap-1.5",children:[t.jsx("span",{className:"mt-1 w-1 h-1 rounded-full bg-cc-muted shrink-0","aria-hidden":"true"}),d]},d))}),t.jsx("p",{className:"mt-2 text-[11px] text-cc-muted",children:b.join(" · ")}),c&&t.jsx("p",{className:"mt-1 text-[11px] text-cc-error",children:c})]}),p&&t.jsx("button",{type:"button",onClick:h,disabled:l,className:`shrink-0 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-colors ${l?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:l?"Archiving...":"Archive"})]})})}function z(){var C;const[e,s]=a.useState(null),[l,i]=a.useState(!0),[c,n]=a.useState(""),[p,b]=a.useState(""),[h,d]=a.useState("all"),[u,g]=a.useState(null),[f,M]=a.useState(new Set),m=a.useRef(null),v=a.useCallback(async()=>{try{const r=await N.getDashboard();s(r),g(r.progress.state==="running"?r.progress:null),n("")}catch(r){n(r instanceof Error?r.message:String(r))}finally{i(!1)}},[]);a.useEffect(()=>{v()},[v]),a.useEffect(()=>{if(!u||u.state!=="running"){m.current&&(clearInterval(m.current),m.current=null);return}if(!m.current)return m.current=setInterval(async()=>{try{const r=await N.getDashboardRunStatus();r.progress.state==="running"?g(r.progress):(g(null),v())}catch{}},1500),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[u,v]);async function k(){b("");try{await N.runDashboardUpdate(),g({state:"running",trigger:"manual",total:0,processed:0,failed:0})}catch(r){b(r instanceof Error?r.message:String(r))}}const y=(u==null?void 0:u.state)==="running",A=a.useMemo(()=>e?e.sessions.filter(r=>!(r.companionSessionId&&f.has(r.companionSessionId))).filter(r=>$(r,h)):[],[e,h,f]),R=a.useMemo(()=>{const r=new Map;if(!e)return r;const x=e.sessions.filter(o=>!(o.companionSessionId&&f.has(o.companionSessionId)));for(const o of I)r.set(o.id,x.filter(j=>$(j,o.id)).length);return r},[e,f]),S=a.useMemo(()=>U(A),[A]);return t.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:t.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-6 space-y-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Project Dashboard"}),t.jsx("p",{className:"mt-0.5 text-xs text-cc-muted",children:e!=null&&e.runMeta?`Last updated ${w(e.runMeta.lastRunCompletedAt)} (${e.runMeta.trigger==="manual"?"manual":"nightly"} run, ${e.runMeta.model})`:"No summarization run yet"})]}),t.jsx("button",{type:"button",onClick:k,disabled:y||l||!(e!=null&&e.claudeCliAvailable),className:`px-3 py-2 min-h-[40px] rounded-lg text-sm font-medium transition-colors ${y||l||!(e!=null&&e.claudeCliAvailable)?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:y?"Updating...":"Update now"})]}),c&&t.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:c}),p&&t.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:p}),e&&!e.claudeCliAvailable&&t.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-warning/10 border border-cc-warning/20 text-xs text-cc-warning",children:"The Claude Code CLI was not found — the summarizer uses your Claude Code login to generate summaries, so the CLI must be installed on this machine."}),e&&e.claudeCliAvailable&&!e.enabled&&t.jsxs("div",{className:"px-3 py-2 rounded-lg bg-cc-primary/10 border border-cc-primary/20 text-xs text-cc-fg",children:['Nightly updates are off — summaries only refresh when you press "Update now".'," ",t.jsx("a",{href:"#/settings",className:"underline hover:no-underline",children:"Enable them in Settings"}),"."]}),((C=e==null?void 0:e.runMeta)==null?void 0:C.lastRunStatus)==="error"&&t.jsxs("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:["The last run failed",e.runMeta.lastRunError?`: ${e.runMeta.lastRunError}`:"."]}),y&&u&&t.jsx(_,{progress:u}),l?t.jsx("div",{className:"text-sm text-cc-muted py-12 text-center",children:"Loading dashboard..."}):!e||e.sessions.length===0?t.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-8 text-center",children:[t.jsx("p",{className:"text-sm text-cc-fg font-medium",children:"No session summaries yet"}),t.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:'Press "Update now" to summarize your recent Claude Code sessions, or enable the nightly run in Settings to keep this dashboard fresh automatically.'})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",role:"group","aria-label":"Filter sessions",children:I.map(r=>{const x=h===r.id,o=R.get(r.id)??0;return t.jsxs("button",{type:"button",onClick:()=>d(r.id),"aria-pressed":x,className:`px-2.5 py-1.5 rounded-full text-xs font-medium transition-colors cursor-pointer ${x?"bg-cc-primary text-white":"bg-cc-hover hover:bg-cc-active text-cc-fg"}`,children:[r.label," ",t.jsx("span",{className:x?"opacity-80":"text-cc-muted",children:o})]},r.id)})}),S.length===0?t.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:"No sessions match this filter."}):S.map(r=>t.jsxs("section",{"aria-label":`Project ${r.label}`,className:"rounded-xl border border-cc-border bg-cc-card p-4",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-3",children:[t.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",title:r.key,children:r.label}),t.jsxs("span",{className:"text-[11px] text-cc-muted whitespace-nowrap",children:[r.sessions.length," session",r.sessions.length===1?"":"s"," · active ",w(r.lastActivityAt)]})]}),t.jsx("ul",{className:"space-y-2",children:r.sessions.map(x=>t.jsx(B,{session:x,onArchived:o=>M(j=>new Set(j).add(o))},x.sessionId))})]},r.key))]})]})})}export{z as DashboardPage};
|
|
1
|
+
import{r as a,a as N,j as t,t as w,e as T,n as P}from"./index-BM8QkiV8.js";const I=[{id:"all",label:"All"},{id:"unfinished",label:"Unfinished"},{id:"awaiting_user",label:"Needs input"},{id:"completed",label:"Completed"},{id:"archivable",label:"Archivable"}],D={completed:{label:"Completed",className:"bg-cc-success/10 text-cc-success border-cc-success/20",dotClassName:"bg-cc-success"},in_progress:{label:"In progress",className:"bg-cc-primary/10 text-cc-primary border-cc-primary/20",dotClassName:"bg-cc-primary"},awaiting_user:{label:"Needs input",className:"bg-cc-warning/10 text-cc-warning border-cc-warning/20",dotClassName:"bg-cc-warning"},stalled:{label:"Stalled",className:"bg-cc-error/10 text-cc-error border-cc-error/20",dotClassName:"bg-cc-error"}};function $(e,s){switch(s){case"all":return!0;case"unfinished":return e.status==="in_progress"||e.status==="stalled";case"awaiting_user":return e.status==="awaiting_user";case"completed":return e.status==="completed";case"archivable":return e.archivable&&!e.companionArchived}}function U(e){const s=new Map;for(const i of e){const c=i.cwd.replace(/\/+$/,"")||"/";let n=s.get(c);n||(n={key:c,label:T(c),sessions:[],lastActivityAt:0},s.set(c,n)),n.sessions.push(i),n.lastActivityAt=Math.max(n.lastActivityAt,i.lastActivityAt)}const l=Array.from(s.values()).sort((i,c)=>c.lastActivityAt-i.lastActivityAt);for(const i of l)i.sessions.sort((c,n)=>n.lastActivityAt-c.lastActivityAt);return l}function E(e){return e.displayName||e.slug||`Session ${e.sessionId.slice(0,8)}`}function L({status:e}){const s=D[e];return t.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full border text-[11px] font-medium whitespace-nowrap ${s.className}`,children:[t.jsx("span",{className:`w-1.5 h-1.5 rounded-full ${s.dotClassName}`,"aria-hidden":"true"}),s.label]})}function _({progress:e}){const s=e.total>0?Math.round(e.processed/e.total*100):0,l=e.total>0?`Summarizing session ${Math.min(e.processed+1,e.total)} of ${e.total}${e.currentSession?` — ${e.currentSession}`:""}`:"Scanning sessions...";return t.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-4",children:[t.jsxs("div",{className:"flex items-center justify-between mb-2",children:[t.jsx("span",{className:"text-sm text-cc-fg",children:l}),e.total>0&&t.jsxs("span",{className:"text-xs text-cc-muted tabular-nums",children:[s,"%"]})]}),t.jsx("div",{role:"progressbar","aria-label":"Dashboard update progress","aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":e.total>0?s:void 0,className:"h-2 w-full rounded-full bg-cc-hover overflow-hidden",children:t.jsx("div",{className:`h-full rounded-full bg-cc-primary transition-all duration-500 ${e.total===0?"animate-pulse w-1/4":""}`,style:e.total>0?{width:`${Math.max(s,3)}%`}:void 0})}),e.failed>0&&t.jsxs("p",{className:"mt-2 text-[11px] text-cc-warning",children:[e.failed," session",e.failed===1?"":"s"," failed so far"]})]})}function B({session:e,onArchived:s}){const[l,i]=a.useState(!1),[c,n]=a.useState(""),p=!!e.companionSessionId&&e.archivable&&!e.companionArchived,b=[e.userName?`by ${e.userName}`:null,e.gitBranch?e.gitBranch:null,`active ${w(e.lastActivityAt)}`].filter(Boolean);async function h(){if(e.companionSessionId){i(!0),n("");try{await N.archiveSession(e.companionSessionId,{linearTransition:"none"}),s(e.companionSessionId)}catch(d){n(d instanceof Error?d.message:String(d))}finally{i(!1)}}}return t.jsx("li",{className:"rounded-lg border border-cc-border bg-cc-bg p-3",children:t.jsxs("div",{className:"flex items-start justify-between gap-3",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.companionSessionId&&!e.companionArchived?t.jsx("button",{type:"button",onClick:()=>P(e.companionSessionId),className:"text-sm font-medium text-cc-fg hover:text-cc-primary truncate cursor-pointer text-left",title:"Open session",children:E(e)}):t.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:E(e)}),t.jsx(L,{status:e.status}),e.companionArchived&&t.jsx("span",{className:"text-[11px] text-cc-muted border border-cc-border rounded-full px-2 py-0.5",children:"Archived"}),!e.companionSessionId&&t.jsx("span",{className:"text-[11px] text-cc-muted border border-cc-border rounded-full px-2 py-0.5",title:"Discovered from ~/.claude — not launched through the companion",children:"External"})]}),t.jsx("p",{className:"mt-1.5 text-sm text-cc-fg/90 leading-relaxed",children:e.summary}),e.openItems.length>0&&t.jsx("ul",{className:"mt-2 space-y-1",children:e.openItems.map(d=>t.jsxs("li",{className:"text-xs text-cc-muted flex items-start gap-1.5",children:[t.jsx("span",{className:"mt-1 w-1 h-1 rounded-full bg-cc-muted shrink-0","aria-hidden":"true"}),d]},d))}),t.jsx("p",{className:"mt-2 text-[11px] text-cc-muted",children:b.join(" · ")}),c&&t.jsx("p",{className:"mt-1 text-[11px] text-cc-error",children:c})]}),p&&t.jsx("button",{type:"button",onClick:h,disabled:l,className:`shrink-0 px-2.5 py-1.5 rounded-lg text-xs font-medium transition-colors ${l?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:l?"Archiving...":"Archive"})]})})}function z(){var C;const[e,s]=a.useState(null),[l,i]=a.useState(!0),[c,n]=a.useState(""),[p,b]=a.useState(""),[h,d]=a.useState("all"),[u,g]=a.useState(null),[f,M]=a.useState(new Set),m=a.useRef(null),v=a.useCallback(async()=>{try{const r=await N.getDashboard();s(r),g(r.progress.state==="running"?r.progress:null),n("")}catch(r){n(r instanceof Error?r.message:String(r))}finally{i(!1)}},[]);a.useEffect(()=>{v()},[v]),a.useEffect(()=>{if(!u||u.state!=="running"){m.current&&(clearInterval(m.current),m.current=null);return}if(!m.current)return m.current=setInterval(async()=>{try{const r=await N.getDashboardRunStatus();r.progress.state==="running"?g(r.progress):(g(null),v())}catch{}},1500),()=>{m.current&&(clearInterval(m.current),m.current=null)}},[u,v]);async function k(){b("");try{await N.runDashboardUpdate(),g({state:"running",trigger:"manual",total:0,processed:0,failed:0})}catch(r){b(r instanceof Error?r.message:String(r))}}const y=(u==null?void 0:u.state)==="running",A=a.useMemo(()=>e?e.sessions.filter(r=>!(r.companionSessionId&&f.has(r.companionSessionId))).filter(r=>$(r,h)):[],[e,h,f]),R=a.useMemo(()=>{const r=new Map;if(!e)return r;const x=e.sessions.filter(o=>!(o.companionSessionId&&f.has(o.companionSessionId)));for(const o of I)r.set(o.id,x.filter(j=>$(j,o.id)).length);return r},[e,f]),S=a.useMemo(()=>U(A),[A]);return t.jsx("div",{className:"h-full overflow-y-auto bg-cc-bg",children:t.jsxs("div",{className:"max-w-3xl mx-auto px-4 py-6 space-y-4",children:[t.jsxs("div",{className:"flex items-start justify-between gap-3 flex-wrap",children:[t.jsxs("div",{children:[t.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Project Dashboard"}),t.jsx("p",{className:"mt-0.5 text-xs text-cc-muted",children:e!=null&&e.runMeta?`Last updated ${w(e.runMeta.lastRunCompletedAt)} (${e.runMeta.trigger==="manual"?"manual":"nightly"} run, ${e.runMeta.model})`:"No summarization run yet"})]}),t.jsx("button",{type:"button",onClick:k,disabled:y||l||!(e!=null&&e.claudeCliAvailable),className:`px-3 py-2 min-h-[40px] rounded-lg text-sm font-medium transition-colors ${y||l||!(e!=null&&e.claudeCliAvailable)?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:y?"Updating...":"Update now"})]}),c&&t.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:c}),p&&t.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:p}),e&&!e.claudeCliAvailable&&t.jsx("div",{className:"px-3 py-2 rounded-lg bg-cc-warning/10 border border-cc-warning/20 text-xs text-cc-warning",children:"The Claude Code CLI was not found — the summarizer uses your Claude Code login to generate summaries, so the CLI must be installed on this machine."}),e&&e.claudeCliAvailable&&!e.enabled&&t.jsxs("div",{className:"px-3 py-2 rounded-lg bg-cc-primary/10 border border-cc-primary/20 text-xs text-cc-fg",children:['Nightly updates are off — summaries only refresh when you press "Update now".'," ",t.jsx("a",{href:"#/settings",className:"underline hover:no-underline",children:"Enable them in Settings"}),"."]}),((C=e==null?void 0:e.runMeta)==null?void 0:C.lastRunStatus)==="error"&&t.jsxs("div",{className:"px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:["The last run failed",e.runMeta.lastRunError?`: ${e.runMeta.lastRunError}`:"."]}),y&&u&&t.jsx(_,{progress:u}),l?t.jsx("div",{className:"text-sm text-cc-muted py-12 text-center",children:"Loading dashboard..."}):!e||e.sessions.length===0?t.jsxs("div",{className:"rounded-xl border border-cc-border bg-cc-card p-8 text-center",children:[t.jsx("p",{className:"text-sm text-cc-fg font-medium",children:"No session summaries yet"}),t.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:'Press "Update now" to summarize your recent Claude Code sessions, or enable the nightly run in Settings to keep this dashboard fresh automatically.'})]}):t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"flex items-center gap-1.5 flex-wrap",role:"group","aria-label":"Filter sessions",children:I.map(r=>{const x=h===r.id,o=R.get(r.id)??0;return t.jsxs("button",{type:"button",onClick:()=>d(r.id),"aria-pressed":x,className:`px-2.5 py-1.5 rounded-full text-xs font-medium transition-colors cursor-pointer ${x?"bg-cc-primary text-white":"bg-cc-hover hover:bg-cc-active text-cc-fg"}`,children:[r.label," ",t.jsx("span",{className:x?"opacity-80":"text-cc-muted",children:o})]},r.id)})}),S.length===0?t.jsx("div",{className:"text-sm text-cc-muted py-8 text-center",children:"No sessions match this filter."}):S.map(r=>t.jsxs("section",{"aria-label":`Project ${r.label}`,className:"rounded-xl border border-cc-border bg-cc-card p-4",children:[t.jsxs("div",{className:"flex items-baseline justify-between gap-2 mb-3",children:[t.jsx("h2",{className:"text-sm font-semibold text-cc-fg truncate",title:r.key,children:r.label}),t.jsxs("span",{className:"text-[11px] text-cc-muted whitespace-nowrap",children:[r.sessions.length," session",r.sessions.length===1?"":"s"," · active ",w(r.lastActivityAt)]})]}),t.jsx("ul",{className:"space-y-2",children:r.sessions.map(x=>t.jsx(B,{session:x,onArchived:o=>M(j=>new Set(j).add(o))},x.sessionId))})]},r.key))]})]})})}export{z as DashboardPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,a,j as e,u as N,n as y,b as _,L as h}from"./index-C0oFg9YU.js";function L({embedded:d=!1}){const[g,p]=r.useState(!1),[b,v]=r.useState(""),[x,f]=r.useState(""),[s,m]=r.useState(null),[c,j]=r.useState([]),[o,w]=r.useState([]);r.useEffect(()=>{a.getTailscaleStatus().then(m).catch(()=>m({installed:!1,binaryPath:null,connected:!1,dnsName:null,funnelActive:!1,funnelUrl:null,error:"Could not reach Tailscale status endpoint"})),a.getSettings().then(t=>{if(t.linearApiKeyConfigured)return a.getLinearConnection().then(n=>{p(n.connected);const i=n.viewerName||n.viewerEmail||"Connected account",l=n.teamName?` • ${n.teamName}`:"";v(`${i}${l}`)})}).catch(t=>f(t instanceof Error?t.message:String(t))),a.listLinearOAuthConnections().then(t=>j(t.connections)).catch(()=>{}),a.listAgents().then(t=>{w(t.filter(n=>{var i,l;return(l=(i=n.triggers)==null?void 0:i.linear)==null?void 0:l.enabled}))}).catch(()=>{})},[]);const u=c.filter(t=>t.status==="connected").length;return e.jsx("div",{className:`${d?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto`,children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-cc-fg",children:"Integrations"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connect tools and open their dedicated settings page."})]}),!d&&e.jsx("button",{onClick:()=>{const t=N.getState().currentSessionId;t?y(t):_()},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"})]}),x&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:x}),e.jsxs("section",{className:"group relative overflow-hidden rounded-3xl border border-cc-border/80 bg-cc-card p-5 pb-16 sm:p-7 sm:pb-7 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_18px_44px_rgba(0,0,0,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(251,146,60,0.18),transparent_52%)]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 bg-[linear-gradient(120deg,transparent_0%,rgba(255,255,255,0.04)_35%,transparent_62%)]"}),e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx(h,{className:"h-3.5 w-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear Tickets"}),g&&e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Connected",title:"Connected"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2.5",children:e.jsx("h2",{className:"text-[clamp(1.45rem,2.6vw,2rem)] font-semibold leading-[1.12] tracking-tight text-cc-fg",children:"Issue context before first prompt"})}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-cc-muted sm:text-[15px]",children:"Connect your workspace, search an issue from Home, and inject scope automatically when a session starts."}),e.jsx("div",{className:"mt-4 inline-flex max-w-full items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:e.jsx("span",{className:"truncate",children:b||"No workspace linked yet"})})]}),e.jsx("div",{className:"absolute bottom-0 right-0 sm:bottom-0 sm:right-0 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},"aria-label":"Open Linear Tickets settings",title:"Open Linear Tickets settings",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})})]})]}),e.jsxs("section",{className:"group relative mt-6 overflow-hidden rounded-3xl border border-cc-border/80 bg-cc-card p-5 pb-16 sm:p-7 sm:pb-7 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_18px_44px_rgba(0,0,0,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(124,58,237,0.18),transparent_52%)]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 bg-[linear-gradient(120deg,transparent_0%,rgba(255,255,255,0.04)_35%,transparent_62%)]"}),e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx(h,{className:"h-3.5 w-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear OAuth Apps"}),u>0&&e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Connected",title:"Connected"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2.5",children:e.jsx("h2",{className:"text-[clamp(1.45rem,2.6vw,2rem)] font-semibold leading-[1.12] tracking-tight text-cc-fg",children:"Agent triggers via Linear"})}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-cc-muted sm:text-[15px]",children:"Create OAuth apps to trigger agents from @mentions in Linear issues. Each app can connect to a different workspace."}),e.jsx("div",{className:"mt-4 inline-flex max-w-full items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:e.jsxs("span",{className:"truncate",children:[c.length===0?"No OAuth apps configured":`${c.length} app${c.length!==1?"s":""}, ${u} connected`,o.length>0&&` · ${o.length} agent${o.length!==1?"s":""}`]})})]}),e.jsxs("div",{className:"absolute bottom-0 right-0 sm:bottom-0 sm:right-0 flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{window.location.hash="#/agents?setup=linear"},"aria-label":"Set up Linear Agent",title:"Set up Linear Agent",className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-full border border-violet-500/28 bg-violet-500/12 text-xs font-medium text-cc-fg transition-colors hover:border-violet-500/50 hover:bg-violet-500/20 focus:outline-none focus:ring-2 focus:ring-violet-500/35 cursor-pointer",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60","aria-hidden":"true",children:e.jsx("path",{d:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"})}),"Setup Agent"]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear-oauth"},"aria-label":"Open Linear OAuth settings",title:"Open Linear OAuth settings",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-violet-500/28 bg-violet-500/12 text-cc-fg transition-colors hover:border-violet-500/50 hover:bg-violet-500/20 focus:outline-none focus:ring-2 focus:ring-violet-500/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})]})]})]}),e.jsxs("section",{className:"group relative mt-6 overflow-hidden rounded-3xl border border-cc-border/80 bg-cc-card p-5 pb-16 sm:p-7 sm:pb-7 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_18px_44px_rgba(0,0,0,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(6,182,212,0.18),transparent_52%)]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 bg-[linear-gradient(120deg,transparent_0%,rgba(255,255,255,0.04)_35%,transparent_62%)]"}),e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx("svg",{className:"h-3.5 w-3.5 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"}),(s==null?void 0:s.funnelActive)&&e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Funnel active",title:"Funnel active"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2.5",children:e.jsx("h2",{className:"text-[clamp(1.45rem,2.6vw,2rem)] font-semibold leading-[1.12] tracking-tight text-cc-fg",children:"HTTPS access in one click"})}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-cc-muted sm:text-[15px]",children:"Use Tailscale Funnel to expose your Companion over HTTPS with automatic TLS certificates."}),e.jsx("div",{className:"mt-4 inline-flex max-w-full items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:e.jsx("span",{className:"truncate",children:s===null?"Checking...":s.funnelActive&&s.funnelUrl?s.funnelUrl:s.connected?s.dnsName||"Connected":s.installed?"Not connected":"Not installed"})})]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/tailscale"},"aria-label":"Open Tailscale settings",title:"Open Tailscale settings",className:"absolute bottom-0 right-0 sm:bottom-0 sm:right-0 inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})]})]})]})})}export{L as IntegrationsPage};
|
|
1
|
+
import{r,a,j as e,u as N,n as y,b as _,L as h}from"./index-BM8QkiV8.js";function L({embedded:d=!1}){const[g,p]=r.useState(!1),[b,v]=r.useState(""),[x,f]=r.useState(""),[s,m]=r.useState(null),[c,j]=r.useState([]),[o,w]=r.useState([]);r.useEffect(()=>{a.getTailscaleStatus().then(m).catch(()=>m({installed:!1,binaryPath:null,connected:!1,dnsName:null,funnelActive:!1,funnelUrl:null,error:"Could not reach Tailscale status endpoint"})),a.getSettings().then(t=>{if(t.linearApiKeyConfigured)return a.getLinearConnection().then(n=>{p(n.connected);const i=n.viewerName||n.viewerEmail||"Connected account",l=n.teamName?` • ${n.teamName}`:"";v(`${i}${l}`)})}).catch(t=>f(t instanceof Error?t.message:String(t))),a.listLinearOAuthConnections().then(t=>j(t.connections)).catch(()=>{}),a.listAgents().then(t=>{w(t.filter(n=>{var i,l;return(l=(i=n.triggers)==null?void 0:i.linear)==null?void 0:l.enabled}))}).catch(()=>{})},[]);const u=c.filter(t=>t.status==="connected").length;return e.jsx("div",{className:`${d?"h-full":"h-[100dvh]"} bg-cc-bg text-cc-fg font-sans-ui antialiased overflow-y-auto`,children:e.jsxs("div",{className:"max-w-5xl mx-auto px-4 sm:px-8 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-6",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-xl font-semibold text-cc-fg",children:"Integrations"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connect tools and open their dedicated settings page."})]}),!d&&e.jsx("button",{onClick:()=>{const t=N.getState().currentSessionId;t?y(t):_()},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"})]}),x&&e.jsx("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-error/10 border border-cc-error/20 text-xs text-cc-error",children:x}),e.jsxs("section",{className:"group relative overflow-hidden rounded-3xl border border-cc-border/80 bg-cc-card p-5 pb-16 sm:p-7 sm:pb-7 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_18px_44px_rgba(0,0,0,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(251,146,60,0.18),transparent_52%)]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 bg-[linear-gradient(120deg,transparent_0%,rgba(255,255,255,0.04)_35%,transparent_62%)]"}),e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx(h,{className:"h-3.5 w-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear Tickets"}),g&&e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Connected",title:"Connected"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2.5",children:e.jsx("h2",{className:"text-[clamp(1.45rem,2.6vw,2rem)] font-semibold leading-[1.12] tracking-tight text-cc-fg",children:"Issue context before first prompt"})}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-cc-muted sm:text-[15px]",children:"Connect your workspace, search an issue from Home, and inject scope automatically when a session starts."}),e.jsx("div",{className:"mt-4 inline-flex max-w-full items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:e.jsx("span",{className:"truncate",children:b||"No workspace linked yet"})})]}),e.jsx("div",{className:"absolute bottom-0 right-0 sm:bottom-0 sm:right-0 flex items-center gap-2",children:e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear"},"aria-label":"Open Linear Tickets settings",title:"Open Linear Tickets settings",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})})]})]}),e.jsxs("section",{className:"group relative mt-6 overflow-hidden rounded-3xl border border-cc-border/80 bg-cc-card p-5 pb-16 sm:p-7 sm:pb-7 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_18px_44px_rgba(0,0,0,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(124,58,237,0.18),transparent_52%)]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 bg-[linear-gradient(120deg,transparent_0%,rgba(255,255,255,0.04)_35%,transparent_62%)]"}),e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx(h,{className:"h-3.5 w-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear OAuth Apps"}),u>0&&e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Connected",title:"Connected"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2.5",children:e.jsx("h2",{className:"text-[clamp(1.45rem,2.6vw,2rem)] font-semibold leading-[1.12] tracking-tight text-cc-fg",children:"Agent triggers via Linear"})}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-cc-muted sm:text-[15px]",children:"Create OAuth apps to trigger agents from @mentions in Linear issues. Each app can connect to a different workspace."}),e.jsx("div",{className:"mt-4 inline-flex max-w-full items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:e.jsxs("span",{className:"truncate",children:[c.length===0?"No OAuth apps configured":`${c.length} app${c.length!==1?"s":""}, ${u} connected`,o.length>0&&` · ${o.length} agent${o.length!==1?"s":""}`]})})]}),e.jsxs("div",{className:"absolute bottom-0 right-0 sm:bottom-0 sm:right-0 flex items-center gap-2",children:[e.jsxs("button",{type:"button",onClick:()=>{window.location.hash="#/agents?setup=linear"},"aria-label":"Set up Linear Agent",title:"Set up Linear Agent",className:"inline-flex items-center gap-1.5 px-3 py-2 rounded-full border border-violet-500/28 bg-violet-500/12 text-xs font-medium text-cc-fg transition-colors hover:border-violet-500/50 hover:bg-violet-500/20 focus:outline-none focus:ring-2 focus:ring-violet-500/35 cursor-pointer",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-3.5 h-3.5 opacity-60","aria-hidden":"true",children:e.jsx("path",{d:"M8 1.5a2.5 2.5 0 00-2.5 2.5c0 1.38 1.12 2.5 2.5 2.5s2.5-1.12 2.5-2.5S9.38 1.5 8 1.5zM4 8a4 4 0 00-4 4v1.5a.5.5 0 00.5.5h15a.5.5 0 00.5-.5V12a4 4 0 00-4-4H4z"})}),"Setup Agent"]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/linear-oauth"},"aria-label":"Open Linear OAuth settings",title:"Open Linear OAuth settings",className:"inline-flex h-10 w-10 items-center justify-center rounded-full border border-violet-500/28 bg-violet-500/12 text-cc-fg transition-colors hover:border-violet-500/50 hover:bg-violet-500/20 focus:outline-none focus:ring-2 focus:ring-violet-500/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})]})]})]}),e.jsxs("section",{className:"group relative mt-6 overflow-hidden rounded-3xl border border-cc-border/80 bg-cc-card p-5 pb-16 sm:p-7 sm:pb-7 transition-all duration-300 hover:border-cc-primary/35 hover:shadow-[0_18px_44px_rgba(0,0,0,0.18)]",children:[e.jsx("div",{className:"pointer-events-none absolute inset-0 bg-[radial-gradient(80%_140%_at_100%_0%,rgba(6,182,212,0.18),transparent_52%)]"}),e.jsx("div",{className:"pointer-events-none absolute inset-0 opacity-30 bg-[linear-gradient(120deg,transparent_0%,rgba(255,255,255,0.04)_35%,transparent_62%)]"}),e.jsxs("div",{className:"relative min-w-0",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsxs("div",{className:"inline-flex items-center gap-2 rounded-full border border-cc-border bg-cc-hover/55 px-3 py-1.5 text-xs tracking-wide text-cc-muted",children:[e.jsx("svg",{className:"h-3.5 w-3.5 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"}),(s==null?void 0:s.funnelActive)&&e.jsx("span",{className:"inline-block h-1.5 w-1.5 rounded-full bg-cc-success shadow-[0_0_0_3px_rgba(34,197,94,0.15)]","aria-label":"Funnel active",title:"Funnel active"})]}),e.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-2.5",children:e.jsx("h2",{className:"text-[clamp(1.45rem,2.6vw,2rem)] font-semibold leading-[1.12] tracking-tight text-cc-fg",children:"HTTPS access in one click"})}),e.jsx("p",{className:"mt-2 max-w-2xl text-sm leading-relaxed text-cc-muted sm:text-[15px]",children:"Use Tailscale Funnel to expose your Companion over HTTPS with automatic TLS certificates."}),e.jsx("div",{className:"mt-4 inline-flex max-w-full items-center rounded-lg border border-cc-border/80 bg-black/10 px-3 py-1.5 text-xs text-cc-muted/95",children:e.jsx("span",{className:"truncate",children:s===null?"Checking...":s.funnelActive&&s.funnelUrl?s.funnelUrl:s.connected?s.dnsName||"Connected":s.installed?"Not connected":"Not installed"})})]}),e.jsx("button",{type:"button",onClick:()=>{window.location.hash="#/integrations/tailscale"},"aria-label":"Open Tailscale settings",title:"Open Tailscale settings",className:"absolute bottom-0 right-0 sm:bottom-0 sm:right-0 inline-flex h-10 w-10 items-center justify-center rounded-full border border-cc-primary/28 bg-cc-primary/12 text-cc-fg transition-colors hover:border-cc-primary/50 hover:bg-cc-primary/20 focus:outline-none focus:ring-2 focus:ring-cc-primary/35 cursor-pointer",children:e.jsxs("svg",{viewBox:"0 0 24 24",className:"h-4.5 w-4.5",fill:"none",stroke:"currentColor",strokeWidth:"1.8","aria-hidden":"true",children:[e.jsx("path",{d:"M9.67 4.53 10 2h4l.33 2.53a7.9 7.9 0 0 1 1.7.7l2.03-1.55 2.83 2.83-1.55 2.03c.28.54.51 1.1.7 1.7L22 10v4l-2.53.33a7.9 7.9 0 0 1-.7 1.7l1.55 2.03-2.83 2.83-2.03-1.55c-.54.28-1.1.51-1.7.7L14 22h-4l-.33-2.53a7.9 7.9 0 0 1-1.7-.7l-2.03 1.55-2.83-2.83 1.55-2.03a7.9 7.9 0 0 1-.7-1.7L2 14v-4l2.53-.33c.19-.6.42-1.16.7-1.7L3.68 5.94 6.5 3.1l2.03 1.55c.54-.28 1.1-.51 1.7-.7Z"}),e.jsx("circle",{cx:"12",cy:"12",r:"3.2"})]})})]})]})]})})}export{L as IntegrationsPage};
|
package/dist/assets/{LinearOAuthSettingsPage-BG4-JYjD.js → LinearOAuthSettingsPage-CPW4TQuD.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,a as i,j as e,u as X,n as Y,b as Z,L as M}from"./index-C0oFg9YU.js";function te({embedded:C=!1}){const[o,B]=r.useState([]),[P,U]=r.useState(!0),[S,q]=r.useState(""),[g,A]=r.useState(!1),[l,k]=r.useState(""),[d,I]=r.useState(""),[u,L]=r.useState(""),[m,O]=r.useState(""),[b,D]=r.useState(!1),[E,x]=r.useState(""),[f,$]=r.useState(null),[v,_]=r.useState(null),[F,h]=r.useState(""),[j,R]=r.useState(null),[z,H]=r.useState([]),[w,p]=r.useState(null),a=r.useCallback(async()=>{try{const t=await i.listLinearOAuthConnections();B(t.connections)}catch(t){q(t instanceof Error?t.message:String(t))}finally{U(!1)}},[]),W=r.useCallback(async()=>{try{const t=await i.listAgents();H(t)}catch{}},[]);r.useEffect(()=>{a(),W();let t;const s=window.location.hash;if(s.includes("oauth_success=true"))p({type:"success",message:"OAuth app connected to workspace successfully!"}),window.location.hash="#/integrations/linear-oauth",t=setTimeout(()=>p(null),5e3);else if(s.includes("oauth_error=")){const c=s.match(/oauth_error=([^&]*)/);let n;try{n=decodeURIComponent((c==null?void 0:c[1])||"OAuth failed")}catch{n=(c==null?void 0:c[1])||"OAuth failed"}p({type:"error",message:n}),window.location.hash="#/integrations/linear-oauth"}return()=>{t&&clearTimeout(t)}},[a,W]);async function G(t){t.preventDefault();const s=l.trim(),c=d.trim(),n=u.trim(),T=m.trim();if(!s||!c||!n||!T){x("All fields are required.");return}D(!0),x("");try{await i.createLinearOAuthConnection({name:s,oauthClientId:c,oauthClientSecret:n,webhookSecret:T}),k(""),I(""),L(""),O(""),A(!1),await a()}catch(N){x(N instanceof Error?N.message:String(N))}finally{D(!1)}}async function J(t){if(f!==t){$(t),h("");return}_(t),$(null);try{await i.deleteLinearOAuthConnection(t),h(""),await a()}catch(s){h(s instanceof Error?s.message:String(s)),await a()}finally{_(null)}}async function K(t){R(t);try{const s=await i.getLinearOAuthConnectionAuthorizeUrl(t,"/#/integrations/linear-oauth");window.open(s.url,"_self")}catch(s){p({type:"error",message:s instanceof Error?s.message:String(s)}),R(null)}}function Q(t,s=16){return t.length<=s?t:t.slice(0,s)+"..."}function V(t){return z.filter(s=>{var c,n;return((n=(c=s.triggers)==null?void 0:c.linear)==null?void 0:n.oauthConnectionId)===t})}const y=o.filter(t=>t.status==="connected").length;return e.jsx("div",{className:`${C?"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:"Linear OAuth Apps"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Manage OAuth app connections for Linear agent integrations."})]}),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"}),!C&&e.jsx("button",{onClick:()=>{const t=X.getState().currentSessionId;t?Y(t):Z()},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("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-hover/60 border border-cc-border text-sm text-cc-muted",children:["Looking for ticket integration?"," ",e.jsx("a",{href:"#/settings/linear",className:"text-cc-primary underline cursor-pointer",children:"Linear Tickets Settings"})]}),w&&e.jsx("div",{className:`mb-4 px-3 py-2 rounded-lg text-xs border ${w.type==="success"?"bg-cc-success/10 border-cc-success/20 text-cc-success":"bg-cc-error/10 border-cc-error/20 text-cc-error"}`,children:w.message}),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(124,58,237,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(M,{className:"w-3.5 h-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear OAuth"})]}),e.jsx("h2",{className:"mt-3 text-lg sm:text-xl font-semibold text-cc-fg",children:"OAuth app connections for agent workflows"}),e.jsx("p",{className:"mt-1.5 text-sm text-cc-muted max-w-2xl",children:"Each connection represents a Linear OAuth app. Agents reference these connections to receive @mentions and interact with Linear issues."})]}),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 ${y>0?"text-cc-success":"text-cc-muted"}`,children:y>0?`${y} connected`:"Not connected"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-cc-muted truncate",children:o.length>0?`${o.length} connection${o.length!==1?"s":""} configured`:"No connections yet"})]})]})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4 sm:p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-sm font-semibold text-cc-fg flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-cc-fg"}),e.jsx("span",{children:"OAuth Connections"})]}),e.jsx("button",{type:"button",onClick:()=>{A(!g),x(""),h("")},className:"px-3 py-2 rounded-lg text-sm font-medium transition-colors bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer",children:g?"Cancel":"Add Connection"})]}),S&&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:S}),F&&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:F}),g&&e.jsxs("form",{onSubmit:G,className:"border border-cc-border rounded-lg p-4 space-y-3 bg-cc-bg",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-name",children:"Connection Name"}),e.jsx("input",{id:"new-oauth-name",type:"text",value:l,onChange:t=>k(t.target.value),placeholder:'e.g. "Production App", "Dev App"',className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-client-id",children:"OAuth Client ID"}),e.jsx("input",{id:"new-oauth-client-id",type:"text",value:d,onChange:t=>I(t.target.value),placeholder:"OAuth app client ID from Linear",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-client-secret",children:"OAuth Client Secret"}),e.jsx("input",{id:"new-oauth-client-secret",type:"password",value:u,onChange:t=>L(t.target.value),placeholder:"OAuth app client secret",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-webhook-secret",children:"Webhook Secret"}),e.jsx("input",{id:"new-oauth-webhook-secret",type:"password",value:m,onChange:t=>O(t.target.value),placeholder:"Webhook signing secret from Linear",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),E&&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:E}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",disabled:b||!l.trim()||!d.trim()||!u.trim()||!m.trim(),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${b||!l.trim()||!d.trim()||!u.trim()||!m.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:b?"Saving...":"Save"})})]}),P?e.jsx("p",{className:"text-sm text-cc-muted",children:"Loading connections..."}):o.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"No OAuth connections yet."}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:"Add your first OAuth app connection to enable Linear agent integrations."})]}):e.jsx("div",{className:"space-y-3",children:o.map(t=>{const s=V(t.id);return e.jsx("div",{className:"border border-cc-border rounded-lg overflow-hidden",children:e.jsxs("div",{className:"p-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:t.name}),e.jsx("span",{className:`px-2 py-0.5 text-[10px] rounded-full border ${t.status==="connected"?"bg-cc-success/10 text-cc-success border-cc-success/20":"bg-cc-hover text-cc-muted border-cc-border"}`,children:t.status==="connected"?"Connected":"Disconnected"})]}),e.jsxs("p",{className:"mt-1 text-xs text-cc-muted truncate",children:["Client ID: ",Q(t.oauthClientId)]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:t.status==="connected"?"Ready to receive @mentions and post updates back to Linear.":"This app may already be installed in Linear, but Companion no longer has a valid OAuth token. Reconnect it to restore agent replies."}),s.length>0&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:s.map(c=>e.jsxs("span",{className:"px-2 py-0.5 text-[10px] rounded-md bg-cc-hover text-cc-muted",children:["Agent: ",c.name]},c.id))})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>K(t.id),disabled:j===t.id,"aria-label":t.status==="connected"?`Manage ${t.name}`:`Reconnect ${t.name}`,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${j===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-violet-600 hover:bg-violet-700 text-white cursor-pointer"}`,children:j===t.id?"Redirecting...":t.status==="connected"?"Manage in Linear":"Reconnect to Workspace"}),e.jsx("button",{type:"button",onClick:()=>J(t.id),disabled:v===t.id,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${v===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":f===t.id?"bg-cc-error hover:bg-cc-error/90 text-white cursor-pointer":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:v===t.id?"Deleting...":f===t.id?"Confirm Delete":"Delete"})]})]})},t.id)})})]})]})})}export{te as LinearOAuthSettingsPage};
|
|
1
|
+
import{r,a as i,j as e,u as X,n as Y,b as Z,L as M}from"./index-BM8QkiV8.js";function te({embedded:C=!1}){const[o,B]=r.useState([]),[P,U]=r.useState(!0),[S,q]=r.useState(""),[g,A]=r.useState(!1),[l,k]=r.useState(""),[d,I]=r.useState(""),[u,L]=r.useState(""),[m,O]=r.useState(""),[b,D]=r.useState(!1),[E,x]=r.useState(""),[f,$]=r.useState(null),[v,_]=r.useState(null),[F,h]=r.useState(""),[j,R]=r.useState(null),[z,H]=r.useState([]),[w,p]=r.useState(null),a=r.useCallback(async()=>{try{const t=await i.listLinearOAuthConnections();B(t.connections)}catch(t){q(t instanceof Error?t.message:String(t))}finally{U(!1)}},[]),W=r.useCallback(async()=>{try{const t=await i.listAgents();H(t)}catch{}},[]);r.useEffect(()=>{a(),W();let t;const s=window.location.hash;if(s.includes("oauth_success=true"))p({type:"success",message:"OAuth app connected to workspace successfully!"}),window.location.hash="#/integrations/linear-oauth",t=setTimeout(()=>p(null),5e3);else if(s.includes("oauth_error=")){const c=s.match(/oauth_error=([^&]*)/);let n;try{n=decodeURIComponent((c==null?void 0:c[1])||"OAuth failed")}catch{n=(c==null?void 0:c[1])||"OAuth failed"}p({type:"error",message:n}),window.location.hash="#/integrations/linear-oauth"}return()=>{t&&clearTimeout(t)}},[a,W]);async function G(t){t.preventDefault();const s=l.trim(),c=d.trim(),n=u.trim(),T=m.trim();if(!s||!c||!n||!T){x("All fields are required.");return}D(!0),x("");try{await i.createLinearOAuthConnection({name:s,oauthClientId:c,oauthClientSecret:n,webhookSecret:T}),k(""),I(""),L(""),O(""),A(!1),await a()}catch(N){x(N instanceof Error?N.message:String(N))}finally{D(!1)}}async function J(t){if(f!==t){$(t),h("");return}_(t),$(null);try{await i.deleteLinearOAuthConnection(t),h(""),await a()}catch(s){h(s instanceof Error?s.message:String(s)),await a()}finally{_(null)}}async function K(t){R(t);try{const s=await i.getLinearOAuthConnectionAuthorizeUrl(t,"/#/integrations/linear-oauth");window.open(s.url,"_self")}catch(s){p({type:"error",message:s instanceof Error?s.message:String(s)}),R(null)}}function Q(t,s=16){return t.length<=s?t:t.slice(0,s)+"..."}function V(t){return z.filter(s=>{var c,n;return((n=(c=s.triggers)==null?void 0:c.linear)==null?void 0:n.oauthConnectionId)===t})}const y=o.filter(t=>t.status==="connected").length;return e.jsx("div",{className:`${C?"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:"Linear OAuth Apps"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Manage OAuth app connections for Linear agent integrations."})]}),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"}),!C&&e.jsx("button",{onClick:()=>{const t=X.getState().currentSessionId;t?Y(t):Z()},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("div",{className:"mb-4 px-3 py-2 rounded-lg bg-cc-hover/60 border border-cc-border text-sm text-cc-muted",children:["Looking for ticket integration?"," ",e.jsx("a",{href:"#/settings/linear",className:"text-cc-primary underline cursor-pointer",children:"Linear Tickets Settings"})]}),w&&e.jsx("div",{className:`mb-4 px-3 py-2 rounded-lg text-xs border ${w.type==="success"?"bg-cc-success/10 border-cc-success/20 text-cc-success":"bg-cc-error/10 border-cc-error/20 text-cc-error"}`,children:w.message}),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(124,58,237,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(M,{className:"w-3.5 h-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear OAuth"})]}),e.jsx("h2",{className:"mt-3 text-lg sm:text-xl font-semibold text-cc-fg",children:"OAuth app connections for agent workflows"}),e.jsx("p",{className:"mt-1.5 text-sm text-cc-muted max-w-2xl",children:"Each connection represents a Linear OAuth app. Agents reference these connections to receive @mentions and interact with Linear issues."})]}),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 ${y>0?"text-cc-success":"text-cc-muted"}`,children:y>0?`${y} connected`:"Not connected"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-cc-muted truncate",children:o.length>0?`${o.length} connection${o.length!==1?"s":""} configured`:"No connections yet"})]})]})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4 sm:p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-sm font-semibold text-cc-fg flex items-center gap-2",children:[e.jsx(M,{className:"w-4 h-4 text-cc-fg"}),e.jsx("span",{children:"OAuth Connections"})]}),e.jsx("button",{type:"button",onClick:()=>{A(!g),x(""),h("")},className:"px-3 py-2 rounded-lg text-sm font-medium transition-colors bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer",children:g?"Cancel":"Add Connection"})]}),S&&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:S}),F&&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:F}),g&&e.jsxs("form",{onSubmit:G,className:"border border-cc-border rounded-lg p-4 space-y-3 bg-cc-bg",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-name",children:"Connection Name"}),e.jsx("input",{id:"new-oauth-name",type:"text",value:l,onChange:t=>k(t.target.value),placeholder:'e.g. "Production App", "Dev App"',className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-client-id",children:"OAuth Client ID"}),e.jsx("input",{id:"new-oauth-client-id",type:"text",value:d,onChange:t=>I(t.target.value),placeholder:"OAuth app client ID from Linear",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-client-secret",children:"OAuth Client Secret"}),e.jsx("input",{id:"new-oauth-client-secret",type:"password",value:u,onChange:t=>L(t.target.value),placeholder:"OAuth app client secret",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-oauth-webhook-secret",children:"Webhook Secret"}),e.jsx("input",{id:"new-oauth-webhook-secret",type:"password",value:m,onChange:t=>O(t.target.value),placeholder:"Webhook signing secret from Linear",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),E&&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:E}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",disabled:b||!l.trim()||!d.trim()||!u.trim()||!m.trim(),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${b||!l.trim()||!d.trim()||!u.trim()||!m.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:b?"Saving...":"Save"})})]}),P?e.jsx("p",{className:"text-sm text-cc-muted",children:"Loading connections..."}):o.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"No OAuth connections yet."}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:"Add your first OAuth app connection to enable Linear agent integrations."})]}):e.jsx("div",{className:"space-y-3",children:o.map(t=>{const s=V(t.id);return e.jsx("div",{className:"border border-cc-border rounded-lg overflow-hidden",children:e.jsxs("div",{className:"p-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:t.name}),e.jsx("span",{className:`px-2 py-0.5 text-[10px] rounded-full border ${t.status==="connected"?"bg-cc-success/10 text-cc-success border-cc-success/20":"bg-cc-hover text-cc-muted border-cc-border"}`,children:t.status==="connected"?"Connected":"Disconnected"})]}),e.jsxs("p",{className:"mt-1 text-xs text-cc-muted truncate",children:["Client ID: ",Q(t.oauthClientId)]}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:t.status==="connected"?"Ready to receive @mentions and post updates back to Linear.":"This app may already be installed in Linear, but Companion no longer has a valid OAuth token. Reconnect it to restore agent replies."}),s.length>0&&e.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:s.map(c=>e.jsxs("span",{className:"px-2 py-0.5 text-[10px] rounded-md bg-cc-hover text-cc-muted",children:["Agent: ",c.name]},c.id))})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>K(t.id),disabled:j===t.id,"aria-label":t.status==="connected"?`Manage ${t.name}`:`Reconnect ${t.name}`,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${j===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-violet-600 hover:bg-violet-700 text-white cursor-pointer"}`,children:j===t.id?"Redirecting...":t.status==="connected"?"Manage in Linear":"Reconnect to Workspace"}),e.jsx("button",{type:"button",onClick:()=>J(t.id),disabled:v===t.id,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${v===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":f===t.id?"bg-cc-error hover:bg-cc-error/90 text-white cursor-pointer":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:v===t.id?"Deleting...":f===t.id?"Confirm Delete":"Delete"})]})]})},t.id)})})]})]})})}export{te as LinearOAuthSettingsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,a as x,j as e,u as M,n as Q,b as X,L as _}from"./index-C0oFg9YU.js";function Z({embedded:I=!1}){const[m,O]=o.useState([]),[H,V]=o.useState(!0),[C,q]=o.useState(""),[v,L]=o.useState(!1),[g,$]=o.useState(""),[p,A]=o.useState(""),[N,E]=o.useState(!1),[W,u]=o.useState(""),[s,c]=o.useState(null),[j,D]=o.useState(null),[y,F]=o.useState(null),l=o.useCallback(async()=>{try{const t=await x.listLinearConnections();O(t.connections)}catch(t){q(t instanceof Error?t.message:String(t))}finally{V(!1)}},[]);o.useEffect(()=>{l()},[l]);async function B(t){t.preventDefault();const a=g.trim(),i=p.trim();if(!a||!i){u("Name and API key are required.");return}E(!0),u("");try{const r=await x.createLinearConnection({name:a,apiKey:i});r.error?u(r.error):($(""),A(""),L(!1),await l())}catch(r){u(r instanceof Error?r.message:String(r))}finally{E(!1)}}async function R(t){D(t);try{await x.verifyLinearConnection(t),await l()}catch{await l()}finally{D(null)}}async function U(t){F(t);try{await x.deleteLinearConnection(t),(s==null?void 0:s.connectionId)===t&&c(null),await l()}catch{await l()}finally{F(null)}}async function z(t){if((s==null?void 0:s.connectionId)===t.id){c(null);return}const a={connectionId:t.id,teams:[],loadingStates:!0,autoTransition:t.autoTransition,autoTransitionTeamId:"",autoTransitionStateId:t.autoTransitionStateId,autoTransitionStateName:t.autoTransitionStateName,autoTransitionWorkflowStates:[],archiveTransition:t.archiveTransition,archiveTransitionTeamId:"",archiveTransitionStateId:t.archiveTransitionStateId,archiveTransitionStateName:t.archiveTransitionStateName,archiveTransitionWorkflowStates:[],saving:!1,saved:!1,error:""};c(a);try{const r=(await x.getLinearStates(t.id)).teams,n=r[0];let b="",w=[],K=t.autoTransitionStateId;if(t.autoTransitionStateName&&r.length>0)for(const d of r){const h=d.states.find(k=>k.name===t.autoTransitionStateName);if(h){b=d.id,w=d.states,K=h.id;break}}!b&&n&&(b=n.id,w=n.states);let f="",S=[],P=t.archiveTransitionStateId;if(t.archiveTransitionStateName&&r.length>0)for(const d of r){const h=d.states.find(k=>k.name===t.archiveTransitionStateName);if(h){f=d.id,S=d.states,P=h.id;break}}!f&&n&&(f=n.id,S=n.states),c(d=>d&&d.connectionId===t.id?{...d,teams:r,loadingStates:!1,autoTransitionTeamId:b,autoTransitionStateId:K,autoTransitionWorkflowStates:w,archiveTransitionTeamId:f,archiveTransitionStateId:P,archiveTransitionWorkflowStates:S}:d)}catch{c(i=>i&&i.connectionId===t.id?{...i,loadingStates:!1}:i)}}async function G(){if(s){c(t=>t&&{...t,saving:!0,saved:!1,error:""});try{await x.updateLinearConnection(s.connectionId,{autoTransition:s.autoTransition,autoTransitionStateId:s.autoTransitionStateId,autoTransitionStateName:s.autoTransitionStateName,archiveTransition:s.archiveTransition,archiveTransitionStateId:s.archiveTransitionStateId,archiveTransitionStateName:s.archiveTransitionStateName}),c(t=>t&&{...t,saving:!1,saved:!0}),setTimeout(()=>c(t=>t&&{...t,saved:!1}),1800),await l()}catch(t){c(a=>a&&{...a,saving:!1,error:t instanceof Error?t.message:String(t)})}}}const T=m.filter(t=>t.connected).length,J=m.length>0;return e.jsx("div",{className:`${I?"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:"Linear Settings"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connect Linear for issue context injection and agent @mentions via the Agent SDK."})]}),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"}),!I&&e.jsx("button",{onClick:()=>{const t=M.getState().currentSessionId;t?Q(t):X()},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(124,58,237,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(_,{className:"w-3.5 h-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear Integration"})]}),e.jsx("h2",{className:"mt-3 text-lg sm:text-xl font-semibold text-cc-fg",children:"Turn issues into concrete session context"}),e.jsx("p",{className:"mt-1.5 text-sm text-cc-muted max-w-2xl",children:"Search and attach the right Linear issue before the first prompt, so the companion starts with scope, state, and links."}),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:"Issue lookup on Home"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"Context injection on start"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"No key exposure in API responses"})]})]}),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 ${T>0?"text-cc-success":"text-cc-muted"}`,children:T>0?`${T} connected`:"Not connected"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-cc-muted truncate",children:J?`${m.length} connection${m.length!==1?"s":""} configured`:"No connections yet"})]})]})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4 sm:p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-sm font-semibold text-cc-fg flex items-center gap-2",children:[e.jsx(_,{className:"w-4 h-4 text-cc-fg"}),e.jsx("span",{children:"Linear Connections"})]}),e.jsx("button",{type:"button",onClick:()=>{L(!v),u("")},className:"px-3 py-2 rounded-lg text-sm font-medium transition-colors bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer",children:v?"Cancel":"Add Connection"})]}),C&&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:C}),v&&e.jsxs("form",{onSubmit:B,className:"border border-cc-border rounded-lg p-4 space-y-3 bg-cc-bg",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-conn-name",children:"Connection Name"}),e.jsx("input",{id:"new-conn-name",type:"text",value:g,onChange:t=>$(t.target.value),placeholder:'e.g. "Work", "Personal"',className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-conn-key",children:"API Key"}),e.jsx("input",{id:"new-conn-key",type:"password",value:p,onChange:t=>A(t.target.value),placeholder:"lin_api_...",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"The key is verified automatically when saved."})]}),W&&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:W}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",disabled:N||!g.trim()||!p.trim(),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${N||!g.trim()||!p.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:N?"Saving...":"Save"})})]}),H?e.jsx("p",{className:"text-sm text-cc-muted",children:"Loading connections..."}):m.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"No Linear connections yet."}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:"Add your first connection to search and attach Linear issues to sessions."})]}):e.jsx("div",{className:"space-y-3",children:m.map(t=>e.jsxs("div",{className:"border border-cc-border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"p-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:t.name}),e.jsx("span",{className:`px-2 py-0.5 text-[10px] rounded-full border ${t.connected?"bg-cc-success/10 text-cc-success border-cc-success/20":"bg-cc-error/10 text-cc-error border-cc-error/20"}`,children:t.connected?"Connected":"Not connected"})]}),e.jsxs("p",{className:"mt-1 text-xs text-cc-muted truncate",children:[t.workspaceName&&t.viewerName?`${t.viewerName} -- ${t.workspaceName}`:t.workspaceName||t.viewerName||"Unverified"," ","· Key ending in ...",t.apiKeyLast4]}),(t.autoTransition||t.archiveTransition)&&e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[t.autoTransition&&t.autoTransitionStateName&&e.jsxs("span",{className:"px-2 py-0.5 text-[10px] rounded-md bg-cc-hover text-cc-muted",children:["Auto-transition: ",t.autoTransitionStateName]}),t.archiveTransition&&t.archiveTransitionStateName&&e.jsxs("span",{className:"px-2 py-0.5 text-[10px] rounded-md bg-cc-hover text-cc-muted",children:["On archive: ",t.archiveTransitionStateName]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>z(t),disabled:!t.connected,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${t.connected?(s==null?void 0:s.connectionId)===t.id?"bg-cc-active text-cc-fg cursor-pointer":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:(s==null?void 0:s.connectionId)===t.id?"Close":"Edit"}),e.jsx("button",{type:"button",onClick:()=>R(t.id),disabled:j===t.id,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${j===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:j===t.id?"Checking...":"Verify"}),e.jsx("button",{type:"button",onClick:()=>U(t.id),disabled:y===t.id,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${y===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:y===t.id?"Deleting...":"Delete"})]})]}),(s==null?void 0:s.connectionId)===t.id&&e.jsxs("div",{className:"border-t border-cc-border p-4 space-y-5 bg-cc-bg/50",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Auto-transition"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Automatically move the linked issue to a chosen status when starting a session."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":s.autoTransition,onClick:()=>c(a=>a&&{...a,autoTransition:!a.autoTransition}),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${s.autoTransition?"bg-cc-primary":"bg-cc-hover"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${s.autoTransition?"translate-x-4":"translate-x-0"}`})}),e.jsx("span",{className:"text-sm text-cc-fg",children:s.autoTransition?"Enabled":"Disabled"})]}),s.autoTransition&&s.teams.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`auto-team-${t.id}`,children:"Team"}),e.jsx("select",{id:`auto-team-${t.id}`,value:s.autoTransitionTeamId,onChange:a=>{const i=a.target.value,r=s.teams.find(n=>n.id===i);c(n=>n&&{...n,autoTransitionTeamId:i,autoTransitionWorkflowStates:(r==null?void 0:r.states)||[],autoTransitionStateId:"",autoTransitionStateName:""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:s.teams.map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.key,")"]},a.id))})]}),s.autoTransition&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`auto-state-${t.id}`,children:"Target status"}),s.loadingStates?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading workflow states..."}):s.autoTransitionWorkflowStates.length===0?e.jsx("p",{className:"text-xs text-cc-muted",children:"No workflow states found."}):e.jsxs("select",{id:`auto-state-${t.id}`,value:s.autoTransitionStateId,onChange:a=>{const i=s.autoTransitionWorkflowStates.find(r=>r.id===a.target.value);c(r=>r&&{...r,autoTransitionStateId:a.target.value,autoTransitionStateName:(i==null?void 0:i.name)||""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:[e.jsx("option",{value:"",children:"Select a status..."}),s.autoTransitionWorkflowStates.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]})]}),e.jsx("div",{className:"border-t border-cc-border"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"On session archive"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"When archiving a session linked to a Linear issue that is not done, optionally move it to a chosen status."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":s.archiveTransition,onClick:()=>c(a=>a&&{...a,archiveTransition:!a.archiveTransition}),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${s.archiveTransition?"bg-cc-primary":"bg-cc-hover"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${s.archiveTransition?"translate-x-4":"translate-x-0"}`})}),e.jsx("span",{className:"text-sm text-cc-fg",children:s.archiveTransition?"Enabled":"Disabled"})]}),s.archiveTransition&&s.teams.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`archive-team-${t.id}`,children:"Team"}),e.jsx("select",{id:`archive-team-${t.id}`,value:s.archiveTransitionTeamId,onChange:a=>{const i=a.target.value,r=s.teams.find(n=>n.id===i);c(n=>n&&{...n,archiveTransitionTeamId:i,archiveTransitionWorkflowStates:(r==null?void 0:r.states)||[],archiveTransitionStateId:"",archiveTransitionStateName:""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:s.teams.map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.key,")"]},a.id))})]}),s.archiveTransition&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`archive-state-${t.id}`,children:"Target status"}),s.loadingStates?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading workflow states..."}):s.archiveTransitionWorkflowStates.length===0?e.jsx("p",{className:"text-xs text-cc-muted",children:"No workflow states found."}):e.jsxs("select",{id:`archive-state-${t.id}`,value:s.archiveTransitionStateId,onChange:a=>{const i=s.archiveTransitionWorkflowStates.find(r=>r.id===a.target.value);c(r=>r&&{...r,archiveTransitionStateId:a.target.value,archiveTransitionStateName:(i==null?void 0:i.name)||""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:[e.jsx("option",{value:"",children:"Select a status..."}),s.archiveTransitionWorkflowStates.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]})]}),s.error&&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:s.error}),s.saved&&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:"Connection settings saved."}),(()=>{const a=s.saving||s.autoTransition&&!s.autoTransitionStateId||s.archiveTransition&&!s.archiveTransitionStateId;return e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:G,disabled:a,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${a?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:s.saving?"Saving...":"Save Settings"})})})()]})]},t.id))})]}),e.jsxs("div",{className:"mt-4 px-3 py-3 rounded-xl bg-cc-card border border-cc-border text-sm text-cc-muted",children:["Looking for OAuth app settings for agent triggers?"," ",e.jsx("a",{href:"#/integrations/linear-oauth",className:"text-cc-primary underline cursor-pointer",children:"Linear OAuth Apps"})]}),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. Configure"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"Add a Linear API key and verify the connection."})]}),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. Select"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"From Home, search an issue by key or title in one click."})]}),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. Start"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"The issue details are injected as startup context."})]})]})]})})}export{Z as LinearSettingsPage};
|
|
1
|
+
import{r as o,a as x,j as e,u as M,n as Q,b as X,L as _}from"./index-BM8QkiV8.js";function Z({embedded:I=!1}){const[m,O]=o.useState([]),[H,V]=o.useState(!0),[C,q]=o.useState(""),[v,L]=o.useState(!1),[g,$]=o.useState(""),[p,A]=o.useState(""),[N,E]=o.useState(!1),[W,u]=o.useState(""),[s,c]=o.useState(null),[j,D]=o.useState(null),[y,F]=o.useState(null),l=o.useCallback(async()=>{try{const t=await x.listLinearConnections();O(t.connections)}catch(t){q(t instanceof Error?t.message:String(t))}finally{V(!1)}},[]);o.useEffect(()=>{l()},[l]);async function B(t){t.preventDefault();const a=g.trim(),i=p.trim();if(!a||!i){u("Name and API key are required.");return}E(!0),u("");try{const r=await x.createLinearConnection({name:a,apiKey:i});r.error?u(r.error):($(""),A(""),L(!1),await l())}catch(r){u(r instanceof Error?r.message:String(r))}finally{E(!1)}}async function R(t){D(t);try{await x.verifyLinearConnection(t),await l()}catch{await l()}finally{D(null)}}async function U(t){F(t);try{await x.deleteLinearConnection(t),(s==null?void 0:s.connectionId)===t&&c(null),await l()}catch{await l()}finally{F(null)}}async function z(t){if((s==null?void 0:s.connectionId)===t.id){c(null);return}const a={connectionId:t.id,teams:[],loadingStates:!0,autoTransition:t.autoTransition,autoTransitionTeamId:"",autoTransitionStateId:t.autoTransitionStateId,autoTransitionStateName:t.autoTransitionStateName,autoTransitionWorkflowStates:[],archiveTransition:t.archiveTransition,archiveTransitionTeamId:"",archiveTransitionStateId:t.archiveTransitionStateId,archiveTransitionStateName:t.archiveTransitionStateName,archiveTransitionWorkflowStates:[],saving:!1,saved:!1,error:""};c(a);try{const r=(await x.getLinearStates(t.id)).teams,n=r[0];let b="",w=[],K=t.autoTransitionStateId;if(t.autoTransitionStateName&&r.length>0)for(const d of r){const h=d.states.find(k=>k.name===t.autoTransitionStateName);if(h){b=d.id,w=d.states,K=h.id;break}}!b&&n&&(b=n.id,w=n.states);let f="",S=[],P=t.archiveTransitionStateId;if(t.archiveTransitionStateName&&r.length>0)for(const d of r){const h=d.states.find(k=>k.name===t.archiveTransitionStateName);if(h){f=d.id,S=d.states,P=h.id;break}}!f&&n&&(f=n.id,S=n.states),c(d=>d&&d.connectionId===t.id?{...d,teams:r,loadingStates:!1,autoTransitionTeamId:b,autoTransitionStateId:K,autoTransitionWorkflowStates:w,archiveTransitionTeamId:f,archiveTransitionStateId:P,archiveTransitionWorkflowStates:S}:d)}catch{c(i=>i&&i.connectionId===t.id?{...i,loadingStates:!1}:i)}}async function G(){if(s){c(t=>t&&{...t,saving:!0,saved:!1,error:""});try{await x.updateLinearConnection(s.connectionId,{autoTransition:s.autoTransition,autoTransitionStateId:s.autoTransitionStateId,autoTransitionStateName:s.autoTransitionStateName,archiveTransition:s.archiveTransition,archiveTransitionStateId:s.archiveTransitionStateId,archiveTransitionStateName:s.archiveTransitionStateName}),c(t=>t&&{...t,saving:!1,saved:!0}),setTimeout(()=>c(t=>t&&{...t,saved:!1}),1800),await l()}catch(t){c(a=>a&&{...a,saving:!1,error:t instanceof Error?t.message:String(t)})}}}const T=m.filter(t=>t.connected).length,J=m.length>0;return e.jsx("div",{className:`${I?"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:"Linear Settings"}),e.jsx("p",{className:"mt-1 text-sm text-cc-muted",children:"Connect Linear for issue context injection and agent @mentions via the Agent SDK."})]}),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"}),!I&&e.jsx("button",{onClick:()=>{const t=M.getState().currentSessionId;t?Q(t):X()},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(124,58,237,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(_,{className:"w-3.5 h-3.5 text-cc-fg"}),e.jsx("span",{children:"Linear Integration"})]}),e.jsx("h2",{className:"mt-3 text-lg sm:text-xl font-semibold text-cc-fg",children:"Turn issues into concrete session context"}),e.jsx("p",{className:"mt-1.5 text-sm text-cc-muted max-w-2xl",children:"Search and attach the right Linear issue before the first prompt, so the companion starts with scope, state, and links."}),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:"Issue lookup on Home"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"Context injection on start"}),e.jsx("span",{className:"px-2 py-1 rounded-md bg-cc-hover text-cc-muted",children:"No key exposure in API responses"})]})]}),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 ${T>0?"text-cc-success":"text-cc-muted"}`,children:T>0?`${T} connected`:"Not connected"}),e.jsx("p",{className:"mt-0.5 text-[11px] text-cc-muted truncate",children:J?`${m.length} connection${m.length!==1?"s":""} configured`:"No connections yet"})]})]})]}),e.jsxs("div",{className:"bg-cc-card border border-cc-border rounded-xl p-4 sm:p-5 space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-sm font-semibold text-cc-fg flex items-center gap-2",children:[e.jsx(_,{className:"w-4 h-4 text-cc-fg"}),e.jsx("span",{children:"Linear Connections"})]}),e.jsx("button",{type:"button",onClick:()=>{L(!v),u("")},className:"px-3 py-2 rounded-lg text-sm font-medium transition-colors bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer",children:v?"Cancel":"Add Connection"})]}),C&&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:C}),v&&e.jsxs("form",{onSubmit:B,className:"border border-cc-border rounded-lg p-4 space-y-3 bg-cc-bg",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-conn-name",children:"Connection Name"}),e.jsx("input",{id:"new-conn-name",type:"text",value:g,onChange:t=>$(t.target.value),placeholder:'e.g. "Work", "Personal"',className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:"new-conn-key",children:"API Key"}),e.jsx("input",{id:"new-conn-key",type:"password",value:p,onChange:t=>A(t.target.value),placeholder:"lin_api_...",className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:border-cc-primary/60"}),e.jsx("p",{className:"mt-1.5 text-xs text-cc-muted",children:"The key is verified automatically when saved."})]}),W&&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:W}),e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"submit",disabled:N||!g.trim()||!p.trim(),className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${N||!g.trim()||!p.trim()?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:N?"Saving...":"Save"})})]}),H?e.jsx("p",{className:"text-sm text-cc-muted",children:"Loading connections..."}):m.length===0?e.jsxs("div",{className:"text-center py-8",children:[e.jsx("p",{className:"text-sm text-cc-muted",children:"No Linear connections yet."}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:"Add your first connection to search and attach Linear issues to sessions."})]}):e.jsx("div",{className:"space-y-3",children:m.map(t=>e.jsxs("div",{className:"border border-cc-border rounded-lg overflow-hidden",children:[e.jsxs("div",{className:"p-4 flex items-start justify-between gap-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg",children:t.name}),e.jsx("span",{className:`px-2 py-0.5 text-[10px] rounded-full border ${t.connected?"bg-cc-success/10 text-cc-success border-cc-success/20":"bg-cc-error/10 text-cc-error border-cc-error/20"}`,children:t.connected?"Connected":"Not connected"})]}),e.jsxs("p",{className:"mt-1 text-xs text-cc-muted truncate",children:[t.workspaceName&&t.viewerName?`${t.viewerName} -- ${t.workspaceName}`:t.workspaceName||t.viewerName||"Unverified"," ","· Key ending in ...",t.apiKeyLast4]}),(t.autoTransition||t.archiveTransition)&&e.jsxs("div",{className:"mt-1.5 flex flex-wrap gap-1.5",children:[t.autoTransition&&t.autoTransitionStateName&&e.jsxs("span",{className:"px-2 py-0.5 text-[10px] rounded-md bg-cc-hover text-cc-muted",children:["Auto-transition: ",t.autoTransitionStateName]}),t.archiveTransition&&t.archiveTransitionStateName&&e.jsxs("span",{className:"px-2 py-0.5 text-[10px] rounded-md bg-cc-hover text-cc-muted",children:["On archive: ",t.archiveTransitionStateName]})]})]}),e.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[e.jsx("button",{type:"button",onClick:()=>z(t),disabled:!t.connected,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${t.connected?(s==null?void 0:s.connectionId)===t.id?"bg-cc-active text-cc-fg cursor-pointer":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer":"bg-cc-hover text-cc-muted cursor-not-allowed"}`,children:(s==null?void 0:s.connectionId)===t.id?"Close":"Edit"}),e.jsx("button",{type:"button",onClick:()=>R(t.id),disabled:j===t.id,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${j===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-hover hover:bg-cc-active text-cc-fg cursor-pointer"}`,children:j===t.id?"Checking...":"Verify"}),e.jsx("button",{type:"button",onClick:()=>U(t.id),disabled:y===t.id,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${y===t.id?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-error/10 hover:bg-cc-error/20 text-cc-error cursor-pointer"}`,children:y===t.id?"Deleting...":"Delete"})]})]}),(s==null?void 0:s.connectionId)===t.id&&e.jsxs("div",{className:"border-t border-cc-border p-4 space-y-5 bg-cc-bg/50",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Auto-transition"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"Automatically move the linked issue to a chosen status when starting a session."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":s.autoTransition,onClick:()=>c(a=>a&&{...a,autoTransition:!a.autoTransition}),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${s.autoTransition?"bg-cc-primary":"bg-cc-hover"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${s.autoTransition?"translate-x-4":"translate-x-0"}`})}),e.jsx("span",{className:"text-sm text-cc-fg",children:s.autoTransition?"Enabled":"Disabled"})]}),s.autoTransition&&s.teams.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`auto-team-${t.id}`,children:"Team"}),e.jsx("select",{id:`auto-team-${t.id}`,value:s.autoTransitionTeamId,onChange:a=>{const i=a.target.value,r=s.teams.find(n=>n.id===i);c(n=>n&&{...n,autoTransitionTeamId:i,autoTransitionWorkflowStates:(r==null?void 0:r.states)||[],autoTransitionStateId:"",autoTransitionStateName:""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:s.teams.map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.key,")"]},a.id))})]}),s.autoTransition&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`auto-state-${t.id}`,children:"Target status"}),s.loadingStates?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading workflow states..."}):s.autoTransitionWorkflowStates.length===0?e.jsx("p",{className:"text-xs text-cc-muted",children:"No workflow states found."}):e.jsxs("select",{id:`auto-state-${t.id}`,value:s.autoTransitionStateId,onChange:a=>{const i=s.autoTransitionWorkflowStates.find(r=>r.id===a.target.value);c(r=>r&&{...r,autoTransitionStateId:a.target.value,autoTransitionStateName:(i==null?void 0:i.name)||""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:[e.jsx("option",{value:"",children:"Select a status..."}),s.autoTransitionWorkflowStates.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]})]}),e.jsx("div",{className:"border-t border-cc-border"}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"On session archive"}),e.jsx("p",{className:"text-xs text-cc-muted",children:"When archiving a session linked to a Linear issue that is not done, optionally move it to a chosen status."}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",role:"switch","aria-checked":s.archiveTransition,onClick:()=>c(a=>a&&{...a,archiveTransition:!a.archiveTransition}),className:`relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ${s.archiveTransition?"bg-cc-primary":"bg-cc-hover"}`,children:e.jsx("span",{className:`pointer-events-none inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition-transform ${s.archiveTransition?"translate-x-4":"translate-x-0"}`})}),e.jsx("span",{className:"text-sm text-cc-fg",children:s.archiveTransition?"Enabled":"Disabled"})]}),s.archiveTransition&&s.teams.length>1&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`archive-team-${t.id}`,children:"Team"}),e.jsx("select",{id:`archive-team-${t.id}`,value:s.archiveTransitionTeamId,onChange:a=>{const i=a.target.value,r=s.teams.find(n=>n.id===i);c(n=>n&&{...n,archiveTransitionTeamId:i,archiveTransitionWorkflowStates:(r==null?void 0:r.states)||[],archiveTransitionStateId:"",archiveTransitionStateName:""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:s.teams.map(a=>e.jsxs("option",{value:a.id,children:[a.name," (",a.key,")"]},a.id))})]}),s.archiveTransition&&e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium mb-1.5",htmlFor:`archive-state-${t.id}`,children:"Target status"}),s.loadingStates?e.jsx("p",{className:"text-xs text-cc-muted",children:"Loading workflow states..."}):s.archiveTransitionWorkflowStates.length===0?e.jsx("p",{className:"text-xs text-cc-muted",children:"No workflow states found."}):e.jsxs("select",{id:`archive-state-${t.id}`,value:s.archiveTransitionStateId,onChange:a=>{const i=s.archiveTransitionWorkflowStates.find(r=>r.id===a.target.value);c(r=>r&&{...r,archiveTransitionStateId:a.target.value,archiveTransitionStateName:(i==null?void 0:i.name)||""})},className:"w-full px-3 py-2.5 text-sm bg-cc-input-bg border border-cc-border rounded-lg text-cc-fg focus:outline-none focus:border-cc-primary/60",children:[e.jsx("option",{value:"",children:"Select a status..."}),s.archiveTransitionWorkflowStates.map(a=>e.jsx("option",{value:a.id,children:a.name},a.id))]})]})]}),s.error&&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:s.error}),s.saved&&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:"Connection settings saved."}),(()=>{const a=s.saving||s.autoTransition&&!s.autoTransitionStateId||s.archiveTransition&&!s.archiveTransitionStateId;return e.jsx("div",{className:"flex justify-end",children:e.jsx("button",{type:"button",onClick:G,disabled:a,className:`px-3 py-2 rounded-lg text-sm font-medium transition-colors ${a?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary hover:bg-cc-primary-hover text-white cursor-pointer"}`,children:s.saving?"Saving...":"Save Settings"})})})()]})]},t.id))})]}),e.jsxs("div",{className:"mt-4 px-3 py-3 rounded-xl bg-cc-card border border-cc-border text-sm text-cc-muted",children:["Looking for OAuth app settings for agent triggers?"," ",e.jsx("a",{href:"#/integrations/linear-oauth",className:"text-cc-primary underline cursor-pointer",children:"Linear OAuth Apps"})]}),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. Configure"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"Add a Linear API key and verify the connection."})]}),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. Select"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"From Home, search an issue by key or title in one click."})]}),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. Start"}),e.jsx("p",{className:"mt-1 text-sm text-cc-fg",children:"The issue details are injected as startup context."})]})]})]})})}export{Z as LinearSettingsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{O as C,Q as D,r,u as m,R as P,j as O}from"./index-BM8QkiV8.js";const A=`/* MagicUI iframe runtime.
|
|
2
2
|
*
|
|
3
3
|
* Plain dependency-free JS (Chart.js UMD is inlined separately by the host).
|
|
4
4
|
* Runs inside a sandboxed, opaque-origin iframe with a no-network CSP.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as l,r as s,c as k,j as r,D as M,M as R,P as _,d as C}from"./index-BM8QkiV8.js";import{d as P,t as D,M as E}from"./MagicUIDashboard-exuRY5LQ.js";const N=4e3;function A({sessionId:t}){const u=l(e=>e.pendingPermissions.get(t)),h=l(e=>e.removePermission),m=l(e=>e.connectionStatus.get(t)??"disconnected"),x=l(e=>e.cliConnected.get(t)??!1),i=s.useMemo(()=>u?Array.from(u.values()):[],[u]),[a,g]=s.useState(new Set),f=s.useRef(new Set),c=s.useRef(new Map);s.useEffect(()=>{for(const e of i){const n=e.request_id;f.current.has(n)||a.has(n)||c.current.has(n)||c.current.set(n,setTimeout(()=>{c.current.delete(n),f.current.has(n)||g(o=>new Set(o).add(n))},N))}for(const[e,n]of c.current)i.some(o=>o.request_id===e)||(clearTimeout(n),c.current.delete(e))},[i,a]),s.useEffect(()=>()=>{for(const e of c.current.values())clearTimeout(e);c.current.clear()},[]);const b=s.useCallback(e=>{f.current.add(e);const n=c.current.get(e);n&&(clearTimeout(n),c.current.delete(e))},[]),v=s.useCallback((e,n)=>{var d;const o=(d=l.getState().pendingPermissions.get(t))==null?void 0:d.get(e);o&&(k(t,P(o,n)),h(t,e))},[t,h]),w=s.useCallback(()=>{g(e=>{var o;const n=new Set(e);for(const d of((o=l.getState().pendingPermissions.get(t))==null?void 0:o.values())??[])n.add(d.request_id);return n})},[t]),j=s.useMemo(()=>i.filter(e=>!a.has(e.request_id)).map(D),[i,a]),p=s.useMemo(()=>i.filter(e=>a.has(e.request_id)),[i,a]),S=m==="connected"&&!x;return r.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[(S||m==="disconnected")&&r.jsxs("div",{className:"px-4 py-1.5 bg-gradient-to-r from-cc-warning/8 to-cc-warning/4 border-b border-cc-warning/15 flex items-center justify-center gap-2",children:[r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-cc-warning animate-[pulse-dot_1.5s_ease-in-out_infinite] shrink-0"}),r.jsx("span",{className:"text-xs text-cc-warning font-medium",children:m==="disconnected"?"Reconnecting to session…":"CLI disconnected — switch to Standard view to reconnect"})]}),r.jsx("div",{className:"h-36 shrink-0 border-b border-cc-border relative overflow-hidden","aria-label":"Raw session output",children:r.jsx(M,{value:"compact",children:r.jsx(R,{sessionId:t})})}),r.jsx("div",{className:"flex-1 min-h-0 relative bg-cc-bg",children:r.jsx(E,{sessionId:t,decisions:j,onDecisionAck:b,onDecisionResponse:v,onRuntimeError:w})}),p.length>0&&r.jsx("div",{className:"shrink-0 max-h-[50dvh] overflow-y-auto border-t border-cc-border bg-cc-card",children:p.map(e=>r.jsx(_,{permission:e,sessionId:t},e.request_id))}),r.jsx(C,{sessionId:t})]})}export{A as MagicUIView};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as x,j as e,u as b,n as ge,b as be,P as v,
|
|
1
|
+
import{r as x,j as e,u as b,n as ge,b as be,P as v,f as fe,A as Q,h,D as _,T as w,G as P,L as X,k as L,S as B,l as U,m as O,o as Z,p as ee,q as je,v as ve,w as we,U as Ne,x as ye,y as ae,z as ie,a as ke,B as _e,E as S,H as Se}from"./index-BM8QkiV8.js";import{M as Ce}from"./MagicUIDashboard-exuRY5LQ.js";const Ae=new Set(["pulling_image","running_init_script","building_image"]);function E({steps:t,error:c}){const[n,i]=x.useState({}),[r,m]=x.useState(new Set),o=x.useRef(new Map),g=x.useCallback(l=>p=>{p?o.current.set(l,p):o.current.delete(l)},[]);return x.useEffect(()=>{for(const l of t)l.detail&&Ae.has(l.step)&&(i(p=>{const a=p[l.step]||[];return a.length===0||a[a.length-1]!==l.detail?{...p,[l.step]:[...a,l.detail]}:p}),m(p=>{if(p.has(l.step))return p;const a=new Set(p);return a.add(l.step),a}))},[t]),x.useEffect(()=>{var l;for(const p of o.current.values())(l=p.scrollTo)==null||l.call(p,{top:p.scrollHeight})},[n]),t.length===0?null:e.jsxs("div",{className:"w-full max-w-md mx-auto mt-4 mb-2",children:[e.jsx("div",{className:"space-y-1.5",children:t.map(l=>{const p=n[l.step],a=p&&p.length>0,y=r.has(l.step);return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center gap-2.5 py-1",children:[e.jsxs("div",{className:"w-4 h-4 flex items-center justify-center shrink-0",children:[l.status==="in_progress"&&e.jsx("span",{className:"w-3.5 h-3.5 border-2 border-cc-primary/30 border-t-cc-primary rounded-full animate-spin"}),l.status==="done"&&e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-success",children:e.jsx("path",{d:"M13.25 4.75L6 12 2.75 8.75",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}),l.status==="error"&&e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",className:"w-3.5 h-3.5 text-cc-error",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round"})})]}),e.jsx("span",{className:`text-sm flex-1 ${l.status==="in_progress"?"text-cc-fg font-medium":l.status==="done"?"text-cc-muted":"text-cc-error"}`,children:l.label}),a&&e.jsx("button",{onClick:()=>m(N=>{const u=new Set(N);return u.has(l.step)?u.delete(l.step):u.add(l.step),u}),className:"text-[10px] text-cc-muted hover:text-cc-fg transition-colors cursor-pointer",children:y?"Hide logs":"Show logs"})]}),a&&y&&e.jsx("pre",{ref:g(l.step),className:"ml-[26px] mt-1 mb-1 px-3 py-2 text-[10px] font-mono-code bg-black/20 border border-cc-border rounded-md text-cc-muted max-h-[150px] overflow-auto whitespace-pre-wrap",children:p.slice(-30).join(`
|
|
2
2
|
`)})]},l.step)})}),c&&e.jsx("div",{className:"mt-2.5 px-3 py-2 rounded-lg bg-cc-error/5 border border-cc-error/20",children:e.jsx("p",{className:"text-xs text-cc-error whitespace-pre-wrap",children:c})})]})}const j="playground-session";function f(t){return{request_id:`perm-${Math.random().toString(36).slice(2,8)}`,tool_use_id:`tu-${Math.random().toString(36).slice(2,8)}`,timestamp:Date.now(),...t}}const ce=f({tool_name:"Bash",input:{command:"git log --oneline -20 && npm run build",description:"View recent commits and build the project"},permission_suggestions:[{type:"addRules",rules:[{toolName:"Bash",ruleContent:"git log --oneline -20 && npm run build"}],behavior:"allow",destination:"session"},{type:"addRules",rules:[{toolName:"Bash",ruleContent:"git log --oneline -20 && npm run build"}],behavior:"allow",destination:"projectSettings"}]}),Ee=f({tool_name:"Edit",input:{file_path:"/Users/stan/Dev/project/src/utils/format.ts",old_string:`export function formatDate(d: Date) {
|
|
3
3
|
return d.toISOString();
|
|
4
4
|
}`,new_string:`export function formatDate(d: Date, locale = "en-US") {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as o,u as X,a as Z,j as e,n as ne,b as ae,F as Y}from"./index-
|
|
1
|
+
import{r as o,u as X,a as Z,j as e,n as ne,b as ae,F as Y}from"./index-BM8QkiV8.js";function me({embedded:r=!1}){const[a,i]=o.useState([]),[b,h]=o.useState(!0),[l,f]=o.useState(!1),[j,d]=o.useState(""),[v,P]=o.useState(""),[y,E]=o.useState(""),[u,N]=o.useState("global"),[p,w]=o.useState([]),[A,F]=o.useState(!1),[g,$]=o.useState(null),[D,S]=o.useState(""),[G,C]=o.useState(""),[L,k]=o.useState("global"),[M,m]=o.useState([]),[se,H]=o.useState(!1),[z,re]=o.useState(""),[B,q]=o.useState(!1),U=X(t=>t.currentSessionId),x=X(t=>{var s,c;return t.currentSessionId&&(((s=t.sessions.get(t.currentSessionId))==null?void 0:s.cwd)||((c=t.sdkSessions.find(n=>n.sessionId===t.currentSessionId))==null?void 0:c.cwd))||""}),I=o.useMemo(()=>{const t=z.trim().toLowerCase();return t?a.filter(s=>`${s.name}
|
|
2
2
|
${s.content}
|
|
3
3
|
${s.scope}`.toLowerCase().includes(t)):a},[a,z]),V=a.length,J=I.length,T=o.useMemo(()=>{const t=I.filter(n=>n.scope==="global"),s=I.filter(n=>n.scope==="project"),c=new Map;for(const n of s){const _=n.projectPaths??(n.projectPath?[n.projectPath]:[]),W=_.length>0?_.slice().sort().join(`
|
|
4
4
|
`):"(no folder)",oe=_.length>0?_.map(Q=>Q.split("/").pop()||Q).join(", "):"(no folder)";c.has(W)||c.set(W,{label:oe,prompts:[]}),c.get(W).prompts.push(n)}return{globalPrompts:t,folderGroups:c}},[I]),R=o.useCallback(async()=>{h(!0),d("");try{const t=await Z.listPrompts();i(t)}catch(t){d(t instanceof Error?t.message:String(t))}finally{h(!1)}},[]);o.useEffect(()=>{R()},[R]);async function ce(t){if(t.preventDefault(),!(!v.trim()||!y.trim())){if(u==="project"&&p.length===0){d("Select at least one project folder");return}f(!0),d("");try{await Z.createPrompt({name:v.trim(),content:y.trim(),scope:u,projectPaths:u==="project"?p:void 0}),P(""),E(""),N("global"),w([]),q(!1),await R()}catch(s){d(s instanceof Error?s.message:String(s))}finally{f(!1)}}}async function K(t){try{await Z.deletePrompt(t),await R()}catch(s){d(s instanceof Error?s.message:String(s))}}async function O(){if(!(!g||!D.trim()||!G.trim())){if(L==="project"&&M.length===0){d("Select at least one project folder");return}try{await Z.updatePrompt(g,{name:D.trim(),content:G.trim(),scope:L,projectPaths:L==="project"?M:void 0}),$(null),S(""),C(""),k("global"),m([]),await R()}catch(t){d(t instanceof Error?t.message:String(t))}}}return e.jsxs("div",{className:`${r?"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-6 py-6 sm:py-10 pb-safe",children:[e.jsxs("div",{className:"flex items-start justify-between gap-3 mb-2",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Saved Prompts"}),e.jsxs("p",{className:"mt-0.5 text-[13px] text-cc-muted leading-relaxed",children:["Create reusable prompts — insert with ",e.jsx("code",{className:"text-cc-fg text-xs bg-cc-hover rounded px-1 py-0.5",children:"@title"})," in the composer."]})]}),!r&&e.jsx("button",{onClick:()=>{U?ne(U):ae()},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 shrink-0",children:"Back"})]}),e.jsxs("div",{className:"flex items-center gap-2 mt-4 mb-5",children:[e.jsxs("div",{className:"relative flex-1 min-w-0",children:[e.jsxs("svg",{className:"absolute left-3 top-1/2 -translate-y-1/2 w-3.5 h-3.5 text-cc-muted pointer-events-none",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[e.jsx("circle",{cx:"11",cy:"11",r:"8"}),e.jsx("path",{d:"m21 21-4.35-4.35"})]}),e.jsx("input",{value:z,onChange:t=>re(t.target.value),placeholder:"Search by title or content...",className:"w-full pl-9 pr-3 py-2.5 min-h-[44px] text-sm bg-cc-card rounded-lg text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"})]}),e.jsxs("button",{onClick:()=>q(!B),className:`flex items-center gap-1.5 px-3.5 py-2.5 min-h-[44px] rounded-lg text-sm font-medium transition-colors cursor-pointer shrink-0 ${B?"bg-cc-active text-cc-fg":"bg-cc-primary hover:bg-cc-primary-hover text-white"}`,children:[e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-4 h-4",children:B?e.jsx("path",{d:"M18 6 6 18M6 6l12 12"}):e.jsx("path",{d:"M12 5v14M5 12h14"})}),e.jsx("span",{className:"hidden sm:inline",children:B?"Cancel":"New Prompt"})]})]}),B&&e.jsx("form",{onSubmit:ce,className:"mb-6",style:{animation:"fadeSlideIn 150ms ease-out"},children:e.jsx(te,{mode:"create",name:v,content:y,scope:u,folders:p,error:j,saving:l,submitLabel:l?"Saving...":"Create Prompt",onNameChange:P,onContentChange:E,onScopeChange:t=>{N(t),t==="project"&&p.length===0&&x&&w([x])},onRemoveFolder:t=>w(s=>s.filter(c=>c!==t)),onAddFolder:()=>F(!0)})}),e.jsx("div",{className:"flex items-center gap-2 mb-3 text-[12px] text-cc-muted",children:e.jsx("span",{children:J===V?`${V} prompt${V!==1?"s":""}`:`${J} of ${V}`})}),b?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"Loading prompts..."}):a.length===0?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No prompts yet."}):I.length===0?e.jsx("div",{className:"py-12 text-center text-sm text-cc-muted",children:"No prompts match your search."}):e.jsxs("div",{className:"space-y-4",children:[T.globalPrompts.length>0&&e.jsxs("div",{children:[e.jsx("h2",{className:"text-[11px] uppercase tracking-wider text-cc-muted font-semibold mb-1.5 px-1",children:"Global"}),e.jsx("div",{className:"space-y-1",children:T.globalPrompts.map(t=>e.jsx(ee,{prompt:t,isEditing:g===t.id,error:j,editName:D,editContent:G,editScope:L,editFolders:M,cwd:x,onEditNameChange:S,onEditContentChange:C,onEditScopeChange:s=>{k(s),s==="project"&&M.length===0&&x&&m([x])},onEditRemoveFolder:s=>m(c=>c.filter(n=>n!==s)),onEditAddFolder:()=>H(!0),onStartEdit:()=>{$(t.id),S(t.name),C(t.content),k(t.scope),m(t.projectPaths??(t.projectPath?[t.projectPath]:[]))},onCancelEdit:()=>{$(null),S(""),C(""),k("global"),m([])},onSaveEdit:()=>void O(),onDelete:()=>void K(t.id)},t.id))})]}),Array.from(T.folderGroups.entries()).map(([t,s])=>e.jsxs("div",{children:[e.jsx("h2",{className:"text-[11px] uppercase tracking-wider text-cc-muted font-semibold mb-1.5 px-1",children:s.label}),e.jsx("div",{className:"space-y-1",children:s.prompts.map(c=>e.jsx(ee,{prompt:c,isEditing:g===c.id,error:j,editName:D,editContent:G,editScope:L,editFolders:M,cwd:x,onEditNameChange:S,onEditContentChange:C,onEditScopeChange:n=>{k(n),n==="project"&&M.length===0&&x&&m([x])},onEditRemoveFolder:n=>m(_=>_.filter(W=>W!==n)),onEditAddFolder:()=>H(!0),onStartEdit:()=>{$(c.id),S(c.name),C(c.content),k(c.scope),m(c.projectPaths??(c.projectPath?[c.projectPath]:[]))},onCancelEdit:()=>{$(null),S(""),C(""),k("global"),m([])},onSaveEdit:()=>void O(),onDelete:()=>void K(c.id)},c.id))})]},t))]})]}),A&&e.jsx(Y,{initialPath:x||"/",onSelect:t=>{w(s=>s.includes(t)?s:[...s,t]),F(!1)},onClose:()=>F(!1)}),se&&e.jsx(Y,{initialPath:x||"/",onSelect:t=>{m(s=>s.includes(t)?s:[...s,t]),H(!1)},onClose:()=>H(!1)})]})}function ie({scope:r,onScopeChange:a,folders:i,onRemoveFolder:b,onAddFolder:h}){return e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-xs font-medium uppercase tracking-[0.24em] text-cc-muted",children:"Scope"}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted/80",children:"Choose whether this prompt should be available everywhere or only inside specific repos."})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("button",{type:"button","aria-pressed":r==="global",onClick:()=>a("global"),className:`inline-flex min-h-[40px] items-center rounded-full border px-4 py-2 text-sm transition-colors cursor-pointer ${r==="global"?"border-cc-primary/40 text-cc-primary bg-cc-primary/10 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.04)]":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:"Global"}),e.jsx("button",{type:"button","aria-pressed":r==="project",onClick:()=>a("project"),className:`inline-flex min-h-[40px] items-center rounded-full border px-4 py-2 text-sm transition-colors cursor-pointer ${r==="project"?"border-cc-primary/40 text-cc-primary bg-cc-primary/10 shadow-[inset_0_0_0_1px_rgba(255,255,255,0.04)]":"border-cc-border text-cc-muted hover:text-cc-fg hover:bg-cc-hover"}`,children:"Project folders"})]}),r==="project"&&e.jsxs("div",{className:"rounded-2xl border border-cc-border/70 bg-cc-bg/60 p-3 space-y-3",children:[e.jsx("div",{className:"flex items-start justify-between gap-3",children:e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium text-cc-fg",children:"Project folders"}),e.jsx("p",{className:"mt-1 text-xs text-cc-muted",children:"Prompts scoped to folders only appear when the active session is inside one of those paths."})]})}),i.length>0&&e.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(l=>e.jsxs("span",{className:"inline-flex min-h-[32px] items-center gap-1.5 rounded-full border border-cc-border/80 bg-cc-hover px-3 py-1.5 text-xs font-mono-code text-cc-fg",children:[e.jsx("span",{className:"truncate max-w-[200px]",title:l,children:l.split("/").pop()||l}),e.jsx("button",{type:"button",onClick:()=>b(l),className:"text-cc-muted hover:text-cc-error cursor-pointer shrink-0","aria-label":`Remove folder ${l}`,children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"w-3 h-3",children:e.jsx("path",{d:"M4 4l8 8M12 4l-8 8",strokeLinecap:"round"})})})]},l))}),e.jsxs("button",{type:"button",onClick:h,className:"inline-flex min-h-[40px] items-center gap-1.5 rounded-full border border-dashed border-cc-border px-3 py-2 text-sm text-cc-muted transition-colors cursor-pointer hover:text-cc-fg hover:bg-cc-hover",children:[e.jsx("svg",{viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3 h-3",children:e.jsx("path",{d:"M8 3v10M3 8h10",strokeLinecap:"round"})}),"Add folder"]})]})]})}function te({mode:r,name:a,content:i,scope:b,folders:h,saving:l=!1,error:f,submitLabel:j,cancelLabel:d="Cancel",onNameChange:v,onContentChange:P,onScopeChange:y,onRemoveFolder:E,onAddFolder:u,onSubmit:N,onCancel:p}){const w=!!(a.trim()&&i.trim()),A=i.split(/\r?\n/).length,F=i.length;return e.jsxs("section",{className:"overflow-hidden rounded-[28px] border border-cc-border/70 bg-cc-card shadow-[0_20px_60px_rgba(0,0,0,0.22)]",children:[e.jsx("div",{className:"border-b border-cc-border/60 bg-[linear-gradient(135deg,rgba(255,255,255,0.04),rgba(255,255,255,0))] px-5 py-4 sm:px-6",children:e.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-[0.28em] text-cc-primary/80",children:r==="create"?"Prompt Studio":"Edit Prompt"}),e.jsx("h2",{className:"mt-1 text-xl font-semibold text-cc-fg",children:r==="create"?"Write with room to think":"Refine this saved prompt"}),e.jsx("p",{className:"mt-1 max-w-2xl text-sm leading-relaxed text-cc-muted",children:"Structure the title, scope, and body separately so longer instructions stay easy to review before saving."})]}),e.jsxs("div",{className:"flex flex-wrap gap-2 text-xs text-cc-muted",children:[e.jsxs("span",{className:"inline-flex min-h-[32px] items-center rounded-full border border-cc-border/70 bg-cc-bg/60 px-3",children:[A," line",A>1?"s":""]}),e.jsxs("span",{className:"inline-flex min-h-[32px] items-center rounded-full border border-cc-border/70 bg-cc-bg/60 px-3",children:[F," char",F>1?"s":""]})]})]})}),e.jsxs("div",{className:"grid gap-0 lg:grid-cols-[minmax(280px,340px)_minmax(0,1fr)]",children:[e.jsx("div",{className:"border-b border-cc-border/60 p-5 sm:p-6 lg:border-b-0 lg:border-r",children:e.jsxs("div",{className:"space-y-5",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium uppercase tracking-[0.24em] text-cc-muted",htmlFor:r==="create"?"prompt-name":void 0,children:"Title"}),e.jsx("input",{id:r==="create"?"prompt-name":void 0,type:"text",value:a,onChange:g=>v(g.target.value),placeholder:"review-pr",className:"w-full rounded-2xl border border-cc-border/70 bg-cc-bg px-4 py-3 text-sm text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow"}),e.jsxs("p",{className:"mt-2 text-xs leading-relaxed text-cc-muted",children:["Use a short handle that is easy to insert with ",e.jsx("code",{className:"rounded bg-cc-hover px-1 py-0.5 text-[11px] text-cc-fg",children:"@title"}),"."]})]}),e.jsx(ie,{scope:b,onScopeChange:y,folders:h,onRemoveFolder:E,onAddFolder:u}),e.jsxs("div",{className:"rounded-2xl border border-dashed border-cc-border/70 bg-cc-bg/40 p-4",children:[e.jsx("p",{className:"text-xs font-medium uppercase tracking-[0.24em] text-cc-muted",children:"Storage"}),e.jsxs("p",{className:"mt-2 text-sm leading-relaxed text-cc-muted",children:["Saved in ",e.jsx("code",{className:"text-[11px] text-cc-fg",children:"~/.companion/prompts.json"})," and available from the composer autocomplete."]})]})]})}),e.jsx("div",{className:"p-5 sm:p-6",children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"flex flex-wrap items-end justify-between gap-3",children:e.jsxs("div",{children:[e.jsx("label",{className:"mb-1.5 block text-xs font-medium uppercase tracking-[0.24em] text-cc-muted",htmlFor:r==="create"?"prompt-content":void 0,children:"Content"}),e.jsx("p",{className:"text-sm text-cc-muted",children:"Longer prompts stay readable here. Leave breathing room for detailed review flows, checklists, or operating instructions."})]})}),e.jsx("textarea",{id:r==="create"?"prompt-content":void 0,value:i,onChange:g=>P(g.target.value),placeholder:"Review this PR and summarize risks, regressions, and missing tests.",rows:r==="create"?14:10,className:"min-h-[320px] w-full resize-y rounded-[24px] border border-cc-border/70 bg-cc-bg px-4 py-4 text-sm leading-7 text-cc-fg placeholder:text-cc-muted focus:outline-none focus:ring-1 focus:ring-cc-primary/40 transition-shadow lg:min-h-[420px]"}),f&&e.jsx("div",{className:"rounded-2xl border border-cc-error/20 bg-cc-error/10 px-4 py-3 text-sm text-cc-error",children:f}),e.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-cc-border/60 pt-4",children:[p&&e.jsx("button",{type:"button",onClick:p,className:"min-h-[44px] rounded-full px-4 py-2.5 text-sm text-cc-muted transition-colors cursor-pointer hover:bg-cc-hover hover:text-cc-fg",children:d}),e.jsx("button",{type:N?"button":"submit",onClick:N,disabled:l||!w,className:`min-h-[44px] rounded-full px-5 py-2.5 text-sm font-medium transition-colors ${l||!w?"bg-cc-hover text-cc-muted cursor-not-allowed":"bg-cc-primary text-white cursor-pointer hover:bg-cc-primary-hover"}`,children:j})]})]})})]})]})}function le({prompt:r}){if(r.scope==="global")return e.jsx("span",{className:"text-[10px] uppercase tracking-wider text-cc-muted opacity-60",children:"global"});const a=r.projectPaths??(r.projectPath?[r.projectPath]:[]);return a.length===0?null:e.jsx("span",{className:"inline-flex items-center gap-1 flex-wrap",children:a.map(i=>e.jsx("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-cc-primary/8 text-cc-primary/70 font-mono-code",title:i,children:i.split("/").pop()||i},i))})}function ee({prompt:r,isEditing:a,error:i,editName:b,editContent:h,editScope:l,editFolders:f,onEditNameChange:j,onEditContentChange:d,onEditScopeChange:v,onEditRemoveFolder:P,onEditAddFolder:y,onStartEdit:E,onCancelEdit:u,onSaveEdit:N,onDelete:p}){return a?e.jsx("div",{className:"rounded-2xl",style:{animation:"fadeSlideIn 150ms ease-out"},children:e.jsx(te,{mode:"edit",name:b,content:h,scope:l,folders:f,error:i,submitLabel:"Save",onNameChange:j,onContentChange:d,onScopeChange:v,onRemoveFolder:P,onAddFolder:y,onCancel:u,onSubmit:N})}):e.jsxs("div",{className:"group flex items-start gap-3 px-3 py-3 min-h-[44px] rounded-lg hover:bg-cc-hover/60 transition-colors",children:[e.jsx("div",{className:"shrink-0 mt-0.5 w-7 h-7 rounded-md bg-cc-primary/10 flex items-center justify-center",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5 text-cc-primary",children:e.jsx("path",{d:"M7 8h10M7 12h6M3 5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H8l-4 4V5Z"})})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"text-sm font-medium text-cc-fg truncate",children:r.name}),e.jsx(le,{prompt:r})]}),e.jsx("p",{className:"mt-0.5 text-xs text-cc-muted line-clamp-2 leading-relaxed",children:r.content})]}),e.jsxs("div",{className:"shrink-0 flex items-center gap-0.5 opacity-100 sm:opacity-0 sm:group-hover:opacity-100 transition-opacity",children:[e.jsx("button",{onClick:E,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-fg hover:bg-cc-active transition-colors cursor-pointer","aria-label":"Edit",children:e.jsxs("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:[e.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),e.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5Z"})]})}),e.jsx("button",{onClick:p,className:"p-2 min-h-[44px] min-w-[44px] sm:min-h-0 sm:min-w-0 sm:p-1.5 rounded-md text-cc-muted hover:text-cc-error hover:bg-cc-error/10 transition-colors cursor-pointer","aria-label":"Delete",children:e.jsx("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"w-3.5 h-3.5",children:e.jsx("path",{d:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2m3 0v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6h14Z"})})})]})]})}export{me as PromptsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r,a as N,j as e,t as I}from"./index-
|
|
1
|
+
import{r,a as N,j as e,t as I}from"./index-BM8QkiV8.js";function g(c){switch(c){case"manual":return"Manual";case"webhook":return"Webhook";case"schedule":return"Schedule";case"linear":return"Linear";default:return c}}function v(c){switch(c){case"manual":return"bg-blue-500/10 text-blue-600 dark:text-blue-400";case"webhook":return"bg-purple-500/10 text-purple-600 dark:text-purple-400";case"schedule":return"bg-amber-500/10 text-amber-600 dark:text-amber-400";case"linear":return"bg-violet-500/10 text-violet-600 dark:text-violet-400";default:return"bg-cc-hover text-cc-muted"}}function E(c){return c.error?{label:"Error",color:"text-cc-error"}:c.success?{label:"Success",color:"text-cc-success"}:c.completedAt?{label:"Unknown",color:"text-cc-muted"}:{label:"Running",color:"text-cc-warning"}}function y(c,x){const l=(x||Date.now())-c;if(l<1e3)return"<1s";if(l<6e4)return`${Math.round(l/1e3)}s`;const u=Math.floor(l/6e4),h=Math.round(l%6e4/1e3);return`${u}m ${h}s`}function T(){const[c,x]=r.useState([]),[m,l]=r.useState([]),[u,h]=r.useState(0),[k,w]=r.useState(!0),[n,A]=r.useState("all"),[i,S]=r.useState("all"),[o,C]=r.useState(""),[s,f]=r.useState(null),p=r.useCallback(async()=>{try{const t={limit:100};n!=="all"&&(t.triggerType=n),i!=="all"&&(t.status=i),o&&(t.agentId=o);const a=await N.listExecutions(t);x(a.executions),h(a.total)}catch(t){console.error("[runs] Failed to fetch executions:",t)}finally{w(!1)}},[n,i,o]),b=r.useCallback(async()=>{try{const t=await N.listAgents();l(t)}catch(t){console.error("[runs] Failed to fetch agents:",t)}},[]);r.useEffect(()=>{b()},[b]),r.useEffect(()=>{p();const t=setInterval(p,5e3);return()=>clearInterval(t)},[p]);const j=t=>{const a=m.find(d=>d.id===t);return(a==null?void 0:a.name)||t};return e.jsxs("div",{className:"h-full flex flex-col bg-cc-bg",children:[e.jsxs("div",{className:"shrink-0 border-b border-cc-border px-6 py-4",children:[e.jsx("h1",{className:"text-lg font-semibold text-cc-fg",children:"Runs"}),e.jsx("p",{className:"text-sm text-cc-muted mt-1",children:"Monitor agent executions across all triggers"})]}),e.jsxs("div",{className:"shrink-0 border-b border-cc-border px-6 py-3 flex items-center gap-4 flex-wrap",children:[e.jsxs("select",{value:o,onChange:t=>C(t.target.value),className:"text-sm rounded-md border border-cc-border bg-cc-input-bg text-cc-fg px-2 py-1","aria-label":"Filter by agent",children:[e.jsx("option",{value:"",children:"All agents"}),m.map(t=>e.jsx("option",{value:t.id,children:t.name},t.id))]}),e.jsx("div",{className:"flex items-center gap-1",children:["all","manual","webhook","schedule","linear"].map(t=>e.jsx("button",{onClick:()=>A(t),className:`text-xs px-2.5 py-1 rounded-full transition-colors ${n===t?"bg-cc-fg text-cc-bg":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:t==="all"?"All triggers":g(t)},t))}),e.jsx("div",{className:"flex items-center gap-1",children:["all","running","success","error"].map(t=>e.jsx("button",{onClick:()=>S(t),className:`text-xs px-2.5 py-1 rounded-full transition-colors ${i===t?"bg-cc-fg text-cc-bg":"bg-cc-hover text-cc-muted hover:text-cc-fg"}`,children:t==="all"?"All statuses":t.charAt(0).toUpperCase()+t.slice(1)},t))}),e.jsxs("span",{className:"text-xs text-cc-muted ml-auto",children:[u," total"]})]}),e.jsx("div",{className:"flex-1 overflow-auto",children:k?e.jsx("div",{className:"text-sm text-cc-muted text-center py-12",children:"Loading..."}):c.length===0?e.jsxs("div",{className:"text-center py-16",children:[e.jsx("div",{className:"mb-3 flex justify-center text-cc-muted",children:e.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",className:"w-8 h-8",children:e.jsx("path",{d:"M8 1a7 7 0 100 14A7 7 0 008 1zm-.75 3.5a.75.75 0 011.5 0v3.19l2.03 2.03a.75.75 0 01-1.06 1.06l-2.25-2.25A.75.75 0 017.25 8V4.5z"})})}),e.jsx("p",{className:"text-sm text-cc-muted",children:"No executions found"}),e.jsx("p",{className:"text-xs text-cc-muted mt-1",children:"Run an agent to see executions here"})]}):e.jsxs("table",{className:"w-full text-sm",role:"table",children:[e.jsx("thead",{className:"sticky top-0 bg-cc-card backdrop-blur",children:e.jsxs("tr",{className:"text-left text-xs text-cc-muted uppercase tracking-wider",children:[e.jsx("th",{className:"px-6 py-2 font-medium",children:"Agent"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Trigger"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Status"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Started"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Duration"}),e.jsx("th",{className:"px-4 py-2 font-medium",children:"Session"})]})}),e.jsx("tbody",{className:"divide-y divide-cc-border/50",children:c.map(t=>{const a=E(t),d=(s==null?void 0:s.sessionId)===t.sessionId;return e.jsxs("tr",{onClick:()=>f(d?null:t),className:`cursor-pointer transition-colors ${d?"bg-cc-active":"hover:bg-cc-hover"}`,children:[e.jsx("td",{className:"px-6 py-3",children:e.jsx("div",{className:"flex items-center gap-2",children:e.jsx("span",{className:"text-cc-fg font-medium",children:j(t.agentId)})})}),e.jsx("td",{className:"px-4 py-3",children:e.jsx("span",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${v(t.triggerType)}`,children:g(t.triggerType)})}),e.jsx("td",{className:"px-4 py-3",children:e.jsxs("span",{className:`font-medium ${a.color}`,children:[!t.completedAt&&!t.error&&e.jsx("span",{className:"inline-block w-1.5 h-1.5 rounded-full bg-cc-warning mr-1.5 animate-pulse"}),a.label]})}),e.jsx("td",{className:"px-4 py-3 text-cc-muted",children:I(t.startedAt)}),e.jsx("td",{className:"px-4 py-3 text-cc-muted font-mono text-xs",children:y(t.startedAt,t.completedAt)}),e.jsx("td",{className:"px-4 py-3",children:t.sessionId&&e.jsx("a",{href:`#/session/${t.sessionId}`,onClick:$=>$.stopPropagation(),className:"text-cc-primary hover:text-cc-primary-hover text-xs font-mono underline",children:"Open"})})]},`${t.sessionId}-${t.startedAt}`)})})]})}),s&&e.jsxs("div",{className:"shrink-0 border-t border-cc-border bg-cc-card px-6 py-4",children:[e.jsxs("div",{className:"flex items-center justify-between mb-2",children:[e.jsx("h3",{className:"text-sm font-semibold text-cc-fg",children:"Execution Details"}),e.jsx("button",{onClick:()=>f(null),className:"text-cc-muted hover:text-cc-fg text-sm transition-colors","aria-label":"Close details",children:"Close"})]}),e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4 text-sm",children:[e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-muted",children:"Agent"}),e.jsx("p",{className:"text-cc-fg font-medium",children:j(s.agentId)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-muted",children:"Trigger"}),e.jsx("p",{className:`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${v(s.triggerType)}`,children:g(s.triggerType)})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-muted",children:"Started"}),e.jsx("p",{className:"text-cc-fg",children:new Date(s.startedAt).toLocaleString()})]}),e.jsxs("div",{children:[e.jsx("span",{className:"text-cc-muted",children:"Duration"}),e.jsx("p",{className:"text-cc-fg font-mono",children:y(s.startedAt,s.completedAt)})]})]}),s.error&&e.jsx("div",{className:"mt-3 p-2 bg-cc-error/10 rounded text-sm text-cc-error font-mono whitespace-pre-wrap",children:s.error}),s.sessionId&&e.jsx("a",{href:`#/session/${s.sessionId}`,className:"mt-3 inline-flex items-center gap-1 text-sm text-cc-primary hover:text-cc-primary-hover",children:"Open session to view live output"})]})]})}export{T as RunsPage};
|
|
@@ -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-BM8QkiV8.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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,u as o,g as Tt,a as n,j as e,n as It,b as Pt,C as Mt,s as Rt}from"./index-BM8QkiV8.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 Ot({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,z]=s.useState(!1),[Y,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,ze]=s.useState(!1),[jt,Ye]=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"&&z(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):z(c);try{await n.updateSettings({[t]:c})}catch{t==="aiValidationEnabled"?W(a):t==="aiValidationAutoApprove"?G(a):z(a)}}async function Ct(){const t=Y;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:()=>ze(!0),onBlur:()=>ze(!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.jsx(Mt,{}),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.jsx("p",{className:"text-xs text-cc-muted",children:"Optional fallback for Codex sessions when you aren't signing in with a ChatGPT subscription above."}),e.jsx("input",{id:"openai-api-key",type:"password",value:ie&&!jt&&!g?"••••••••••••••••":g,onChange:t=>Qe(t.target.value),onFocus:()=>Ye(!0),onBlur:()=>Ye(!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 ${Y?"text-cc-success":"text-cc-muted"}`,children:Y?"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;Rt(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{Ot as SettingsPage};
|