@cuongtran001/kanna 1.43.8 → 1.43.10
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/client/assets/{BoardsPage-CUNrXNKQ.js → BoardsPage-C4uDY4pp.js} +1 -1
- package/dist/client/assets/{BoardsRoutePage-DiK1jdc2.js → BoardsRoutePage-BWugAmvF.js} +1 -1
- package/dist/client/assets/{CronJobsPage-BSdft0g1.js → CronJobsPage-w89N_oU5.js} +1 -1
- package/dist/client/assets/{CronRunMessage-cjAIeM7Y.js → CronRunMessage-XsD9k-0C.js} +1 -1
- package/dist/client/assets/{LocalProjectsPage-CmRGaxe8.js → LocalProjectsPage-BOWYpirB.js} +1 -1
- package/dist/client/assets/SettingsPage-ChacubF3.js +79 -0
- package/dist/client/assets/{StackBoardsRoutePage-Bjy8Kbh6.js → StackBoardsRoutePage-BSyo88cA.js} +1 -1
- package/dist/client/assets/{WorkflowsPage-Ezw7PXsw.js → WorkflowsPage-BqT6Mn_O.js} +1 -1
- package/dist/client/assets/{WorkflowsSection-qZSEcC1i.js → WorkflowsSection-DWrgXaLX.js} +11 -11
- package/dist/client/assets/{arc-XXnTYyaF.js → arc-CZaWZF6Q.js} +1 -1
- package/dist/client/assets/{architectureDiagram-3BPJPVTR-ByHVauFr.js → architectureDiagram-3BPJPVTR-ClQez79n.js} +1 -1
- package/dist/client/assets/{blockDiagram-GPEHLZMM-Bj2ATdSv.js → blockDiagram-GPEHLZMM-ByPtf8Rq.js} +1 -1
- package/dist/client/assets/{c4Diagram-AAUBKEIU-DKDWdZe2.js → c4Diagram-AAUBKEIU-DHQMChVa.js} +1 -1
- package/dist/client/assets/channel-CMMGLwsP.js +1 -0
- package/dist/client/assets/{chunk-2J33WTMH-LOCPgeZ5.js → chunk-2J33WTMH-7E2zHQ6E.js} +1 -1
- package/dist/client/assets/{chunk-4BX2VUAB-Opq4cy9-.js → chunk-4BX2VUAB-CGdK7T07.js} +1 -1
- package/dist/client/assets/{chunk-55IACEB6-H-jGVEfV.js → chunk-55IACEB6-Cfhp_NUl.js} +1 -1
- package/dist/client/assets/{chunk-727SXJPM-CJdhPZ1f.js → chunk-727SXJPM-lZVSLEDh.js} +1 -1
- package/dist/client/assets/{chunk-AQP2D5EJ-DZ72or56.js → chunk-AQP2D5EJ-6i1tZrt0.js} +1 -1
- package/dist/client/assets/{chunk-FMBD7UC4-DdpGmux5.js → chunk-FMBD7UC4-CZkeKzAl.js} +1 -1
- package/dist/client/assets/{chunk-ND2GUHAM-C5opJm5N.js → chunk-ND2GUHAM-1jiGnfvR.js} +1 -1
- package/dist/client/assets/{chunk-QZHKN3VN-BI-BREif.js → chunk-QZHKN3VN-kiENSnRy.js} +1 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-DmM012sc.js +1 -0
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-DmM012sc.js +1 -0
- package/dist/client/assets/{columnStyle-Bb9iRGZm.js → columnStyle-WWfrgRFo.js} +1 -1
- package/dist/client/assets/{cose-bilkent-S5V4N54A-8MOO_aw6.js → cose-bilkent-S5V4N54A-Cd_1wQLN.js} +1 -1
- package/dist/client/assets/{dagre-BM42HDAG-sDdX7pTP.js → dagre-BM42HDAG-BXin06ji.js} +1 -1
- package/dist/client/assets/{diagram-2AECGRRQ-D7v-KIsO.js → diagram-2AECGRRQ-tAOowxSm.js} +1 -1
- package/dist/client/assets/{diagram-5GNKFQAL-iA3W_-MK.js → diagram-5GNKFQAL-DT-elRqk.js} +1 -1
- package/dist/client/assets/{diagram-KO2AKTUF-Cqtm4jqP.js → diagram-KO2AKTUF-DMJFYSZ-.js} +1 -1
- package/dist/client/assets/{diagram-LMA3HP47-Cs7MQGll.js → diagram-LMA3HP47-B8DEIVAn.js} +1 -1
- package/dist/client/assets/{diagram-OG6HWLK6-BcgpNCKs.js → diagram-OG6HWLK6-BoBXzNJe.js} +1 -1
- package/dist/client/assets/{ChatPreferenceControls-D5r7b-cB.js → editor-icons-CZk3y76B.js} +2 -2
- package/dist/client/assets/{erDiagram-TEJ5UH35-fw4puc-v.js → erDiagram-TEJ5UH35-D0fq4Jkv.js} +1 -1
- package/dist/client/assets/{external-link-Bqp4C3LO.js → external-link-BEoRD1xZ.js} +1 -1
- package/dist/client/assets/{flowDiagram-I6XJVG4X-Ct5bozxi.js → flowDiagram-I6XJVG4X-DP8g_bBc.js} +1 -1
- package/dist/client/assets/{folder-O1wuaAEK.js → folder-BXatlqce.js} +1 -1
- package/dist/client/assets/{ganttDiagram-6RSMTGT7-HQXnMg-s.js → ganttDiagram-6RSMTGT7-CjTffBDB.js} +1 -1
- package/dist/client/assets/{gitGraphDiagram-PVQCEYII-bzdP8tph.js → gitGraphDiagram-PVQCEYII-CkWVTuvj.js} +1 -1
- package/dist/client/assets/{index-DY56RF-Y.js → index-BEOWDYDw.js} +1 -1
- package/dist/client/assets/{index-Dd-M32rM.js → index-C_Pl_fXK.js} +1 -1
- package/dist/client/assets/index-D7ZrZlum.js +333 -0
- package/dist/client/assets/index-Dyo2KoJq.js +297 -0
- package/dist/client/assets/{index-RDOxeJDa.js → index-Ec4H0pgf.js} +1 -1
- package/dist/client/assets/{infoDiagram-5YYISTIA-CvAzNBRJ.js → infoDiagram-5YYISTIA-BX2ikv9C.js} +1 -1
- package/dist/client/assets/{ishikawaDiagram-YF4QCWOH-DoQ87Nke.js → ishikawaDiagram-YF4QCWOH-C-uun1IO.js} +1 -1
- package/dist/client/assets/{journeyDiagram-JHISSGLW-DfPqwX0N.js → journeyDiagram-JHISSGLW-BBEC8Ba7.js} +1 -1
- package/dist/client/assets/{kanban-definition-UN3LZRKU-8C0H-NYt.js → kanban-definition-UN3LZRKU-D-L1GW3d.js} +1 -1
- package/dist/client/assets/{linear-8EJQO7q6.js → linear-Bh51k551.js} +1 -1
- package/dist/client/assets/{mermaid.core-BsJErwJh.js → mermaid.core-DAEa8Ueg.js} +4 -4
- package/dist/client/assets/{mindmap-definition-RKZ34NQL-D6Bxikfx.js → mindmap-definition-RKZ34NQL-Cy4ba5vy.js} +1 -1
- package/dist/client/assets/{monitor-Dt4qUoRz.js → monitor-Czw3iHdG.js} +1 -1
- package/dist/client/assets/{pieDiagram-4H26LBE5-DDqdAK07.js → pieDiagram-4H26LBE5-VV7MzxAN.js} +1 -1
- package/dist/client/assets/{quadrantDiagram-W4KKPZXB-OR-8sJ3s.js → quadrantDiagram-W4KKPZXB-lH3Q4U15.js} +1 -1
- package/dist/client/assets/{requirementDiagram-4Y6WPE33-CJRJR1iP.js → requirementDiagram-4Y6WPE33-9rML5cBr.js} +1 -1
- package/dist/client/assets/{sankeyDiagram-5OEKKPKP-B9O0xrPs.js → sankeyDiagram-5OEKKPKP-CY_-95AW.js} +1 -1
- package/dist/client/assets/{search-5Y-JWamr.js → search-CKRWuWXG.js} +1 -1
- package/dist/client/assets/{sequenceDiagram-3UESZ5HK-BfKZJL6m.js → sequenceDiagram-3UESZ5HK--Zz6RqGw.js} +1 -1
- package/dist/client/assets/{settings-header-button-D67VhYHi.js → settings-header-button-C3noeQRy.js} +1 -1
- package/dist/client/assets/{stateDiagram-AJRCARHV-AWXujzRO.js → stateDiagram-AJRCARHV-CQHm21xY.js} +1 -1
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-BihG1h5A.js +1 -0
- package/dist/client/assets/{terminal-BhIQDTW2.js → terminal-DMpcqVC1.js} +1 -1
- package/dist/client/assets/{timeline-definition-PNZ67QCA-DY-wGzl8.js → timeline-definition-PNZ67QCA-6SpdFAtl.js} +1 -1
- package/dist/client/assets/{vennDiagram-CIIHVFJN-CZb5iRDr.js → vennDiagram-CIIHVFJN-Cm1cyXm8.js} +1 -1
- package/dist/client/assets/{wardley-L42UT6IY-B1gYBVlT.js → wardley-L42UT6IY-cTR_zGXz.js} +1 -1
- package/dist/client/assets/{wardleyDiagram-YWT4CUSO-CsrRgp0z.js → wardleyDiagram-YWT4CUSO-YC-WfF_1.js} +1 -1
- package/dist/client/assets/{xychartDiagram-2RQKCTM6-C2664PvL.js → xychartDiagram-2RQKCTM6-CMJgoZHA.js} +1 -1
- package/dist/client/index.html +1 -1
- package/package.json +1 -1
- package/src/server/agent-coordinator.ts +496 -150
- package/src/server/agent.test.ts +26 -26
- package/src/server/agent.turn-duration-metric.test.ts +3 -3
- package/src/server/agent.turn-tokens-metric.test.ts +5 -5
- package/src/server/app-settings.test.ts +31 -7
- package/src/server/app-settings.ts +10 -95
- package/src/server/claude-cancel-handler.ts +2 -2
- package/src/server/claude-session-state-queries.ts +4 -6
- package/src/server/claude-session-state.test.ts +101 -0
- package/src/server/claude-session-state.ts +19 -0
- package/src/server/event-store-messages.adapter.test.ts +137 -0
- package/src/server/event-store-messages.adapter.ts +23 -23
- package/src/server/event-store-tail-cache.test.ts +40 -1
- package/src/server/event-store-transcript-write.adapter.ts +9 -0
- package/src/server/event-store.ts +6 -1
- package/src/server/server.ts +1 -1
- package/src/server/ws-router.ts +42 -104
- package/src/shared/equality.ts +137 -0
- package/src/shared/types.ts +0 -1
- package/dist/client/assets/SettingsPage-CrGleQfz.js +0 -79
- package/dist/client/assets/channel-Cg9QGyCR.js +0 -1
- package/dist/client/assets/classDiagram-4FO5ZUOK-D84_KBOb.js +0 -1
- package/dist/client/assets/classDiagram-v2-Q7XG4LA2-D84_KBOb.js +0 -1
- package/dist/client/assets/index-CFLubh-A.js +0 -333
- package/dist/client/assets/index-DEMFxBQ5.js +0 -297
- package/dist/client/assets/stateDiagram-v2-BHNVJYJU-DksOV03e.js +0 -1
- package/src/server/agent-deps-builders.ts +0 -588
|
@@ -1 +1 @@
|
|
|
1
|
-
import{l as I,r as o,j as t,B as T,P as R,I as A,d as E,m as z,n as O,E as _,o as $}from"./index-
|
|
1
|
+
import{l as I,r as o,j as t,B as T,P as R,I as A,d as E,m as z,n as O,E as _,o as $}from"./index-D7ZrZlum.js";import{u as C,s as D,o as w,C as L}from"./columnStyle-WWfrgRFo.js";const F=[],u=I()(e=>({templates:F,openMenuId:null,picking:!1,renamingId:null,error:null,setTemplates:s=>e({templates:Array.isArray(s)?s:[]}),openMenu:s=>e({openMenuId:s}),closeMenu:()=>e({openMenuId:null}),openPicker:()=>e({picking:!0,error:null}),closePicker:()=>e({picking:!1}),startRename:s=>e({renamingId:s,picking:!1,openMenuId:null}),stopRename:()=>e({renamingId:null}),setError:s=>e({error:s})}));function U(e){return e.templates}function K({ownerKind:e,ownerId:s,ownerName:a,socket:c,onOpenBoard:l}){const r=w(e,s),i=C(D(r)),x=u(U),p=u(n=>n.picking),h=u(n=>n.renamingId),d=u(n=>n.error),{openPicker:f,closePicker:j,startRename:B,stopRename:k,setError:y,setTemplates:N}=u.getState();o.useEffect(()=>c.subscribe({type:"boards",ownerKind:e,ownerId:s},n=>{C.getState().setBoards(w(n.ownerKind,n.ownerId),n.boards)}),[e,s,c]),o.useEffect(()=>{let n=!1;return c.command({type:"board.templates.list"}).then(m=>{n||N(m)}).catch(()=>{}),()=>{n=!0}},[c,N]);const g=o.useCallback(async n=>{try{await c.command(n),y(null)}catch(m){y(m instanceof Error?m.message:"That did not work.")}},[c,y]),P=o.useCallback(n=>{j(),g({type:"board.create",ownerKind:e,ownerId:s,title:n?n.name:"Untitled board",templateId:(n==null?void 0:n.id)??null})},[j,e,s,g]),M=o.useCallback((n,m)=>{k();const v=m.trim();v!==""&&g({type:"board.update",boardId:n,title:v})},[g,k]),S=p||i.length===0;return t.jsxs("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col bg-background",children:[t.jsxs("header",{className:"flex items-end justify-between gap-4 border-b border-border px-6 py-4",children:[t.jsxs("div",{className:"min-w-0",children:[t.jsx("h1",{className:"text-lg font-medium leading-tight tracking-[-0.01em] text-foreground",children:"Boards"}),t.jsxs("p",{className:"truncate text-13 text-muted-foreground",children:[a,i.length>0?t.jsxs("span",{className:"tabular-nums",children:[" · ",i.length," boards"]}):null]})]}),i.length>0?t.jsxs(T,{size:"sm",onClick:f,children:[t.jsx(R,{className:"size-3.5"}),"New board"]}):null]}),d?t.jsx("p",{className:"border-b border-border px-6 py-2 text-13 text-destructive-text",children:d}):null,t.jsxs("div",{className:"min-h-0 flex-1 overflow-y-auto",children:[S?t.jsx(q,{templates:x,firstRun:i.length===0,onPick:P,onCancel:j}):null,i.length>0?t.jsx("ul",{className:"px-4 py-1",children:i.map(n=>t.jsx(V,{board:n,renaming:h===n.id,onOpen:l,onStartRename:B,onRename:M,onCancelRename:k,onCommand:g},n.id))}):null]})]})}function V({board:e,renaming:s,onOpen:a,onStartRename:c,onRename:l,onCancelRename:r,onCommand:i}){const x=o.useCallback(()=>a(e.id),[e.id,a]),p=o.useCallback(d=>{d.key==="Enter"&&l(e.id,d.currentTarget.value),d.key==="Escape"&&r()},[e.id,r,l]),h=o.useCallback(d=>l(e.id,d.currentTarget.value),[e.id,l]);return t.jsxs("li",{className:"group grid grid-cols-[1fr_auto_auto] items-center gap-5 border-b border-border px-3 py-3 last:border-b-0 hover:bg-secondary",children:[t.jsx("div",{className:"min-w-0",children:s?t.jsx(A,{autoFocus:!0,defaultValue:e.title,onKeyDown:p,onBlur:h,className:"h-7 max-w-sm","aria-label":"Board name"}):t.jsxs("button",{type:"button",onClick:x,className:"block w-full text-left",children:[t.jsx("span",{className:"block truncate text-15 font-semibold tracking-[-0.005em] text-foreground",children:e.title}),e.description?t.jsx("span",{className:"mt-0.5 block truncate text-13 text-muted-foreground",children:e.description}):null]})}),t.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[t.jsxs("span",{children:[t.jsx("b",{className:"font-medium tabular-nums text-foreground",children:e.columnCount})," columns"]}),t.jsxs("span",{children:[t.jsx("b",{className:"font-medium tabular-nums text-foreground",children:e.cardCount})," cards"]})]}),t.jsx(Y,{board:e,onStartRename:c,onCommand:i})]})}function Y({board:e,onStartRename:s,onCommand:a}){const c=u(f=>f.openMenuId===e.id),{openMenu:l,closeMenu:r}=u.getState(),i=o.useCallback(f=>{f?l(e.id):r()},[e.id,r,l]),x=o.useCallback(()=>{r(),s(e.id)},[e.id,r,s]),p=o.useCallback(()=>{r(),a({type:"board.duplicate",boardId:e.id,title:`${e.title} copy`})},[e.id,e.title,r,a]),h=o.useCallback(()=>{r(),a({type:"board.saveAsTemplate",boardId:e.id,name:e.title})},[e.id,e.title,r,a]),d=o.useCallback(()=>{r(),a({type:"board.archive",boardId:e.id})},[e.id,r,a]);return t.jsxs(z,{open:c,onOpenChange:i,children:[t.jsx(O,{asChild:!0,children:t.jsx("button",{type:"button","aria-label":`Actions for ${e.title}`,className:"rounded-md px-1.5 py-1 text-muted-foreground opacity-0 transition-opacity group-hover:opacity-100 data-[state=open]:opacity-100",children:t.jsx(_,{className:"size-4"})})}),t.jsxs($,{align:"end",className:"w-56 p-1",children:[t.jsx(b,{onClick:x,children:"Rename"}),t.jsx(b,{onClick:p,children:"Duplicate structure"}),t.jsx(b,{onClick:h,children:"Save as template"}),t.jsx("div",{className:"my-1 h-px bg-border"}),t.jsx(b,{onClick:d,tone:"destructive",children:"Archive"})]})]})}function b({onClick:e,children:s,tone:a}){return t.jsx("button",{type:"button",onClick:e,className:E("flex w-full items-center rounded-sm px-2 py-1.5 text-left text-xs font-medium hover:bg-secondary",a==="destructive"&&"text-destructive-text"),children:s})}function q({templates:e,firstRun:s,onPick:a,onCancel:c}){const l=o.useCallback(()=>a(null),[a]);return t.jsxs("div",{className:"px-6 py-8",children:[s?t.jsxs(t.Fragment,{children:[t.jsx("h2",{className:"text-15 font-semibold text-foreground",children:"No boards yet."}),t.jsx("p",{className:"mt-1 max-w-[58ch] text-sm text-muted-foreground",children:"A board turns issues into work your agents can pick up. Start from a shape, or import an existing tracker."})]}):t.jsx("h2",{className:"text-15 font-semibold text-foreground",children:"Start from a shape"}),t.jsxs("div",{className:"mt-4 max-w-xl rounded-lg border border-border",children:[e.map(r=>t.jsx(G,{template:r,onPick:a},r.id)),t.jsx("button",{type:"button",onClick:l,className:"flex w-full items-center border-t border-border px-3.5 py-2.5 text-left hover:bg-secondary",children:t.jsxs("span",{children:[t.jsx("span",{className:"block text-sm font-medium text-foreground",children:"Empty board"}),t.jsx("span",{className:"block text-xs text-muted-foreground",children:"Name your own columns"})]})})]}),s?null:t.jsx(T,{variant:"ghost",size:"sm",className:"mt-3",onClick:c,children:"Cancel"})]})}function G({template:e,onPick:s}){const a=o.useCallback(()=>s(e),[s,e]),c=e.definition.columns;return t.jsxs("button",{type:"button",onClick:a,className:"flex w-full items-center gap-3 border-b border-border px-3.5 py-2.5 text-left last:border-b-0 hover:bg-secondary",children:[t.jsxs("span",{className:"min-w-0",children:[t.jsx("span",{className:"block text-sm font-medium text-foreground",children:e.name}),t.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:c.map(l=>l.title).join(" · ")})]}),t.jsx("span",{"aria-hidden":!0,className:"ml-auto flex shrink-0 gap-1",children:c.map((l,r)=>t.jsx("span",{className:E("size-1.5 rounded-full",l.colorToken?L[l.colorToken]:"bg-muted-icon")},`${e.id}-${String(r)}`))})]})}export{K as B};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as p,a as i,b as d,g as u,r as l,j as r}from"./index-
|
|
1
|
+
import{u as p,a as i,b as d,g as u,r as l,j as r}from"./index-D7ZrZlum.js";import{B as m}from"./BoardsPage-C4uDY4pp.js";import"./columnStyle-WWfrgRFo.js";function P(){const o=p(),t=i(),{projectId:e=""}=d(),s=[...o.sidebarData.starredProjectGroups,...o.sidebarData.projectGroups].find(a=>a.groupKey===e),n=s?u(s.localPath):"Project",c=l.useCallback(a=>{t(`/boards/${e}/${a}`)},[t,e]);return r.jsx("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:r.jsx(m,{ownerKind:"project",ownerId:e,ownerName:n,socket:o.socket,onOpenBoard:c})})}export{P as BoardsRoutePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as b,h as f,r as m,j as e,S as g,C as N,g as v,H as w,i as C,k as i,L as P,X as I,d as k}from"./index-
|
|
1
|
+
import{f as b,h as f,r as m,j as e,S as g,C as N,g as v,H as w,i as C,k as i,L as P,X as I,d as k}from"./index-D7ZrZlum.js";import{u as y,C as L,a as x,h as R,P as S,b as A}from"./CronRunMessage-XsD9k-0C.js";import{E}from"./external-link-BEoRD1xZ.js";function D(){const n=b(t=>t.rows),d=f(),o=y(1e3),l=m.useCallback((t,a)=>{d.command({type:t,chatId:a.chatId,jobId:a.job.jobId}).catch(()=>{})},[d]),h=m.useMemo(()=>{const t=new Map;for(const a of n){const r=t.get(a.projectId)??{projectPath:a.projectPath,rows:[]};r.rows.push(a),t.set(a.projectId,r)}return[...t.values()]},[n]);return e.jsx("div",{className:g,children:e.jsxs("div",{className:"mx-auto w-full max-w-[900px] px-4 py-8",children:[e.jsxs("h1",{className:"flex items-center gap-2.5 text-lg font-semibold text-foreground",children:[e.jsx(N,{className:"h-5 w-5 text-muted-foreground","aria-hidden":"true"}),"Cron jobs",e.jsxs("span",{className:"text-sm font-normal text-muted-foreground tabular-nums",children:[n.length," armed"]})]}),n.length===0?e.jsxs("p",{className:"mt-6 text-sm text-muted-foreground",children:["No cron jobs armed anywhere. Arm one from any chat with"," ",e.jsx("code",{className:"font-mono text-xs",children:"/cron <instruction> inline|spawn <schedule>"}),"."]}):e.jsx("div",{className:"mt-6 space-y-6",children:h.map(t=>e.jsxs("div",{className:"rounded-2xl border border-border overflow-hidden",children:[e.jsxs("h2",{className:"border-b border-border bg-card p-3 px-4 text-sm font-medium text-foreground",children:[v(t.projectPath),e.jsx("span",{className:"ml-2 font-mono text-xs font-normal text-muted-foreground",children:t.projectPath})]}),e.jsx("div",{children:t.rows.map((a,r)=>{var u;const s=a.job,j=r===t.rows.length-1,p=o-s.armedAt,c=((u=s.lastRun)==null?void 0:u.status)==="running"?s.lastRun:null;return e.jsxs("div",{className:k("flex items-center gap-3 bg-background px-4 py-2.5",!j&&"border-b border-border"),children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"truncate text-sm text-foreground",children:s.instruction}),s.paused?e.jsx(L,{}):null,!s.paused&&s.lastRun?e.jsx(x,{status:s.lastRun.status}):null]}),e.jsxs("div",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:s.jobId}),e.jsx("span",{children:R(s.schedule,s.scheduleText)}),e.jsxs("span",{children:["· ",s.mode]}),s.model?e.jsx("span",{className:"font-mono",children:s.model}):null,e.jsx(w,{label:new Date(s.armedAt).toLocaleString(),side:"top",children:e.jsxs("span",{className:"tabular-nums",children:["created ",C(p)," ago"]})}),c?e.jsxs("span",{className:"tabular-nums",children:["running for ",i(o-c.firedAt)]}):null,s.paused&&s.lastRun?e.jsxs("span",{className:"tabular-nums",children:["Last run: ",e.jsx(x,{status:s.lastRun.status})]}):null,!s.paused&&s.nextFireAt!==null?e.jsxs("span",{className:"tabular-nums",children:["next in ",i(Math.max(0,s.nextFireAt-o))]}):null,e.jsxs(P,{to:`/chat/${a.chatId}`,className:"inline-flex items-center gap-1 text-primary hover:underline",children:[e.jsx(E,{className:"h-3 w-3","aria-hidden":"true"}),a.chatTitle||"Open chat"]})]})]}),e.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[s.paused?e.jsx("button",{type:"button","aria-label":`Resume cron job ${s.jobId}`,className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-foreground",onClick:()=>l("cron.resume",a),children:e.jsx(S,{className:"h-3.5 w-3.5","aria-hidden":"true"})}):e.jsx("button",{type:"button","aria-label":`Pause cron job ${s.jobId}`,className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-foreground",onClick:()=>l("cron.pause",a),children:e.jsx(A,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),e.jsx("button",{type:"button","aria-label":`Remove cron job ${s.jobId}`,className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted/40 hover:text-destructive",onClick:()=>l("cron.remove",a),children:e.jsx(I,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})]},`${a.chatId} ${s.jobId}`)})})]},t.projectPath))})]})})}export{D as CronJobsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as v,r as m,y as b,j as r,d as g,C as S,a0 as j,L as w}from"./index-
|
|
1
|
+
import{c as v,r as m,y as b,j as r,d as g,C as S,a0 as j,L as w}from"./index-D7ZrZlum.js";import{E as N}from"./external-link-BEoRD1xZ.js";/**
|
|
2
2
|
* @license lucide-react v0.562.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{p as z,j as e,d as b,l as H,y as D,r as h,D as K,z as U,A as W,F as J,G as V,J as Y,I as L,K as q,B as v,M as n,s as M,N as g,P as G,O as Q,Q as X,T as Z,U as ee,g as te,V as se,Y as re,Z as oe,_ as ne,$ as ae,u as ie}from"./index-CFLubh-A.js";import{M as _}from"./monitor-Dt4qUoRz.js";import{C as F,T as ce}from"./terminal-BhIQDTW2.js";import{F as le}from"./folder-O1wuaAEK.js";const T=z("CopyButton",()=>t=>({copied:!1,setCopied:s=>t({copied:s})}));function O({narrow:t=!1,title:s,subtitle:o,icon:a=_}){return e.jsxs("div",{className:b("w-full",t?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[e.jsxs("div",{className:b("flex items-center gap-1 mb-2",t&&"justify-center"),children:[e.jsx("div",{className:"p-2 pl-0 rounded-lg",children:e.jsx(a,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:s})]}),o&&e.jsx("p",{className:b("text-muted-foreground",t&&"mb-10 text-center"),children:o})]})}const u=H()(t=>({tab:"new",name:"",existingPath:"",setTab:s=>t({tab:s}),setName:s=>t({name:s}),setExistingPath:s=>t({existingPath:s}),resetForOpen:()=>t({tab:"new",name:"",existingPath:""})})),de=()=>u(t=>t.tab),xe=()=>u(t=>t.name),me=()=>u(t=>t.existingPath);function ue(t){return t.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function he({open:t,onOpenChange:s,onConfirm:o,ports:a={}}){const l=a.timer??D,i=de(),d=xe(),x=me(),w=u(r=>r.setTab),j=u(r=>r.setName),m=u(r=>r.setExistingPath),f=u(r=>r.resetForOpen),c=h.useRef(null),E=h.useRef(null);h.useEffect(()=>{t&&(f(),l.setTimeout(()=>{var r;return(r=c.current)==null?void 0:r.focus()},0))},[t,f,l]),h.useEffect(()=>{t&&l.setTimeout(()=>{var r,I;i==="new"?(r=c.current)==null||r.focus():(I=E.current)==null||I.focus()},0)},[i,t,l]);const y=ue(d),P=y?`${Y}/${y}`:"",p=x.trim(),$=i==="new"?!!y:!!p,C=()=>{if($){if(i==="new")o({mode:"new",localPath:P,title:d.trim()});else{const r=p.split("/").pop()||p;o({mode:"existing",localPath:p,title:r})}s(!1)}};return e.jsx(K,{open:t,onOpenChange:s,children:e.jsxs(U,{size:"sm",children:[e.jsxs(W,{className:"space-y-4",children:[e.jsx(J,{children:"Add Project"}),e.jsx(V,{value:i,onValueChange:w,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),i==="new"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{ref:c,type:"text",value:d,onChange:r=>j(r.target.value),onKeyDown:r=>{r.key==="Enter"&&C(),r.key==="Escape"&&s(!1)},placeholder:"Project name"}),P&&e.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:P})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{ref:E,type:"text",value:x,onChange:r=>m(r.target.value),onKeyDown:r=>{r.key==="Enter"&&C(),r.key==="Escape"&&s(!1)},placeholder:"~/Projects/my-app"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),e.jsxs(q,{children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:"Cancel"}),e.jsx(v,{variant:"secondary",size:"sm",onClick:C,disabled:!$,children:"Create"})]})]})})}function je({text:t,ports:s={}}){const o=T.useScopedStore(x=>x.copied),a=T.useScopedStore(x=>x.setCopied),l=s.clipboard??oe,i=s.timer??D;async function d(){await l.writeText(t),a(!0),i.setTimeout(()=>a(!1),2e3)}return e.jsx(v,{variant:"ghost",size:"icon-mobile","aria-label":o?"Copied":"Copy to clipboard",className:"text-muted-foreground hover:text-foreground",onClick:()=>void d(),children:o?e.jsx(ne,{className:"h-4 w-4 text-success"}):e.jsx(ae,{className:"h-4 w-4"})})}function fe({text:t}){return e.jsx(T.Provider,{init:{},children:e.jsx(je,{text:t})})}function R({children:t}){return e.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[e.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[e.jsx(X,{className:"inline h-4 w-4 opacity-40"}),e.jsx("code",{children:t})]}),e.jsx(fe,{text:t})]})}function N({children:t}){return e.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:t})}function k({children:t}){return e.jsx("h2",{className:"text-13 font-medium text-muted-foreground tracking-wider mb-3",children:t})}function S({icon:t,title:s,subtitle:o,iconClassName:a}){return e.jsxs("div",{className:"flex flex-col items-start gap-1.5 min-w-0",children:[e.jsx(t,{className:a||"h-5 w-5 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:s}),e.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:o})]})}function A(){return e.jsx("div",{"aria-hidden":!0,className:"mt-5 h-px w-6 shrink-0 bg-border"})}function B({number:t,title:s,children:o}){return e.jsx("div",{className:"flex gap-4",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[t,"."]}),e.jsx("h3",{className:"font-medium text-foreground mb-2",children:s})]}),e.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:o})]})})}function pe({localPath:t,loading:s,onClick:o}){return e.jsxs(Z,{children:[e.jsx(ee,{asChild:!0,children:e.jsxs("button",{className:b("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",s&&"opacity-50 cursor-not-allowed"),disabled:s,onClick:o,children:[e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:te(t)}),s?e.jsx(M,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):e.jsx(se,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),e.jsx(re,{children:e.jsx("p",{children:t})})]})}function ge({connectionStatus:t,ready:s,snapshot:o,startingLocalPath:a,commandError:l,newProjectOpen:i,onNewProjectOpenChange:d,onOpenProject:x,onCreateProject:w}){const j=h.useMemo(()=>(o==null?void 0:o.projects)??[],[o==null?void 0:o.projects]),m=t==="connecting"||!s,f=t==="connected"&&s;return e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[f?e.jsxs(e.Fragment,{children:[e.jsx(O,{title:(o==null?void 0:o.machine.displayName)??"Local Projects",subtitle:`${n} is connected, choose a project below to get started.`}),e.jsxs("div",{className:"w-full px-6 mb-10",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h2",{className:"text-13 font-medium text-muted-foreground tracking-wider",children:"Projects"}),e.jsxs(v,{variant:"default",size:"sm",onClick:()=>d(!0),children:[e.jsx(G,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),j.length>0?e.jsx("div",{className:"grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr))]",children:j.map(c=>e.jsx(pe,{localPath:c.localPath,loading:a===c.localPath,onClick:()=>{x(c.localPath)}},c.localPath))}):e.jsx(N,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),l?e.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:l}):null]})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{narrow:!0,icon:F,title:m?`Connecting ${n}`:`Connect ${n}`,subtitle:m?`${n} is starting up and loading your local projects.`:`Run ${n} directly on your machine with full access to your local files and agent project history.`}),e.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[e.jsx(k,{children:"Status"}),e.jsx("div",{className:"mb-8",children:e.jsx(N,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(M,{className:"h-4 w-4 text-muted-foreground animate-spin"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:m?`Connecting to your local ${n} server...`:e.jsxs(e.Fragment,{children:["Not connected. Run ",e.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:g()})," from any terminal on this machine."]})})]})})}),m?null:e.jsxs("div",{className:"mb-10",children:[e.jsx(k,{children:"How it works"}),e.jsx(N,{children:e.jsxs("div",{className:"flex items-start gap-4 py-2 px-2",children:[e.jsx(S,{icon:ce,title:`${n} CLI`,subtitle:"On Your Machine"}),e.jsx(A,{}),e.jsx(S,{icon:_,title:`${n} Server`,subtitle:"Local WebSocket"}),e.jsx(A,{}),e.jsx(S,{icon:F,title:`${n} UI`,subtitle:"Project Chat"})]})})]}),m?null:e.jsxs("div",{className:"mb-10",children:[e.jsx(k,{children:"Setup"}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(B,{number:1,title:`Start ${n}`,children:[e.jsx("p",{children:"Run this command in your terminal:"}),e.jsx(R,{children:g()})]}),e.jsxs(B,{number:2,title:"Open the local UI",children:[e.jsxs("p",{children:[n," serves the app locally and opens the Local Projects page in an app-style browser window."]}),e.jsx(R,{children:"http://localhost:3210/local"})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground tracking-wider mb-4",children:"Notes"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:g("").trim()}),e.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:g("--no-open")}),e.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),e.jsx(he,{open:i,onOpenChange:d,onConfirm:c=>{w(c)}}),e.jsx("div",{className:"py-4 text-center",children:e.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",Q.split("/")[1]]})})]})}function ye(){const t=ie();return e.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 relative",children:e.jsx(ge,{connectionStatus:t.connectionStatus,ready:t.localProjectsReady,snapshot:t.localProjects,startingLocalPath:t.startingLocalPath,commandError:t.commandError,newProjectOpen:t.addProjectModalOpen,onNewProjectOpenChange:s=>{if(s){t.openAddProjectModal();return}t.closeAddProjectModal()},onOpenProject:t.handleOpenLocalProject,onCreateProject:t.handleCreateProject})})}export{ye as LocalProjectsPage};
|
|
1
|
+
import{p as z,j as e,d as b,l as H,y as D,r as h,D as K,z as U,A as W,F as J,G as V,J as Y,I as L,K as q,B as v,M as n,s as M,N as g,P as G,O as Q,Q as X,T as Z,U as ee,g as te,V as se,Y as re,Z as oe,_ as ne,$ as ae,u as ie}from"./index-D7ZrZlum.js";import{M as _}from"./monitor-Czw3iHdG.js";import{C as F,T as ce}from"./terminal-DMpcqVC1.js";import{F as le}from"./folder-BXatlqce.js";const T=z("CopyButton",()=>t=>({copied:!1,setCopied:s=>t({copied:s})}));function O({narrow:t=!1,title:s,subtitle:o,icon:a=_}){return e.jsxs("div",{className:b("w-full",t?"max-w-2xl px-6 pt-16 mx-auto":"px-6 pt-16 mb-10"),children:[e.jsxs("div",{className:b("flex items-center gap-1 mb-2",t&&"justify-center"),children:[e.jsx("div",{className:"p-2 pl-0 rounded-lg",children:e.jsx(a,{className:"h-6 w-6 text-muted-foreground"})}),e.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:s})]}),o&&e.jsx("p",{className:b("text-muted-foreground",t&&"mb-10 text-center"),children:o})]})}const u=H()(t=>({tab:"new",name:"",existingPath:"",setTab:s=>t({tab:s}),setName:s=>t({name:s}),setExistingPath:s=>t({existingPath:s}),resetForOpen:()=>t({tab:"new",name:"",existingPath:""})})),de=()=>u(t=>t.tab),xe=()=>u(t=>t.name),me=()=>u(t=>t.existingPath);function ue(t){return t.toLowerCase().replace(/[\s_]+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function he({open:t,onOpenChange:s,onConfirm:o,ports:a={}}){const l=a.timer??D,i=de(),d=xe(),x=me(),w=u(r=>r.setTab),j=u(r=>r.setName),m=u(r=>r.setExistingPath),f=u(r=>r.resetForOpen),c=h.useRef(null),E=h.useRef(null);h.useEffect(()=>{t&&(f(),l.setTimeout(()=>{var r;return(r=c.current)==null?void 0:r.focus()},0))},[t,f,l]),h.useEffect(()=>{t&&l.setTimeout(()=>{var r,I;i==="new"?(r=c.current)==null||r.focus():(I=E.current)==null||I.focus()},0)},[i,t,l]);const y=ue(d),P=y?`${Y}/${y}`:"",p=x.trim(),$=i==="new"?!!y:!!p,C=()=>{if($){if(i==="new")o({mode:"new",localPath:P,title:d.trim()});else{const r=p.split("/").pop()||p;o({mode:"existing",localPath:p,title:r})}s(!1)}};return e.jsx(K,{open:t,onOpenChange:s,children:e.jsxs(U,{size:"sm",children:[e.jsxs(W,{className:"space-y-4",children:[e.jsx(J,{children:"Add Project"}),e.jsx(V,{value:i,onValueChange:w,options:[{value:"new",label:"New Folder"},{value:"existing",label:"Existing Path"}],className:"w-full mb-2",optionClassName:"flex-1 justify-center"}),i==="new"?e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{ref:c,type:"text",value:d,onChange:r=>j(r.target.value),onKeyDown:r=>{r.key==="Enter"&&C(),r.key==="Escape"&&s(!1)},placeholder:"Project name"}),P&&e.jsx("p",{className:"text-xs text-muted-foreground font-mono",children:P})]}):e.jsxs("div",{className:"space-y-2",children:[e.jsx(L,{ref:E,type:"text",value:x,onChange:r=>m(r.target.value),onKeyDown:r=>{r.key==="Enter"&&C(),r.key==="Escape"&&s(!1)},placeholder:"~/Projects/my-app"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"The folder will be created if it doesn't exist."})]})]}),e.jsxs(q,{children:[e.jsx(v,{variant:"ghost",size:"sm",onClick:()=>s(!1),children:"Cancel"}),e.jsx(v,{variant:"secondary",size:"sm",onClick:C,disabled:!$,children:"Create"})]})]})})}function je({text:t,ports:s={}}){const o=T.useScopedStore(x=>x.copied),a=T.useScopedStore(x=>x.setCopied),l=s.clipboard??oe,i=s.timer??D;async function d(){await l.writeText(t),a(!0),i.setTimeout(()=>a(!1),2e3)}return e.jsx(v,{variant:"ghost",size:"icon-mobile","aria-label":o?"Copied":"Copy to clipboard",className:"text-muted-foreground hover:text-foreground",onClick:()=>void d(),children:o?e.jsx(ne,{className:"h-4 w-4 text-success"}):e.jsx(ae,{className:"h-4 w-4"})})}function fe({text:t}){return e.jsx(T.Provider,{init:{},children:e.jsx(je,{text:t})})}function R({children:t}){return e.jsxs("div",{className:"grid grid-cols-[1fr_auto] items-center group bg-background border border-border text-foreground rounded-xl p-1.5 pl-3 font-mono text-sm",children:[e.jsxs("pre",{className:"inline-flex items-center gap-2 overflow-x-auto",children:[e.jsx(X,{className:"inline h-4 w-4 opacity-40"}),e.jsx("code",{children:t})]}),e.jsx(fe,{text:t})]})}function N({children:t}){return e.jsx("div",{className:"bg-card border border-border rounded-2xl p-4",children:t})}function k({children:t}){return e.jsx("h2",{className:"text-13 font-medium text-muted-foreground tracking-wider mb-3",children:t})}function S({icon:t,title:s,subtitle:o,iconClassName:a}){return e.jsxs("div",{className:"flex flex-col items-start gap-1.5 min-w-0",children:[e.jsx(t,{className:a||"h-5 w-5 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium text-foreground",children:s}),e.jsx("span",{className:"text-xs text-muted-foreground leading-tight",children:o})]})}function A(){return e.jsx("div",{"aria-hidden":!0,className:"mt-5 h-px w-6 shrink-0 bg-border"})}function B({number:t,title:s,children:o}){return e.jsx("div",{className:"flex gap-4",children:e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"grid grid-cols-[auto_1fr] items-baseline gap-3",children:[e.jsxs("div",{className:"flex-shrink-0 flex items-center justify-center font-medium text-logo",children:[t,"."]}),e.jsx("h3",{className:"font-medium text-foreground mb-2",children:s})]}),e.jsx("div",{className:"text-muted-foreground text-sm space-y-3",children:o})]})})}function pe({localPath:t,loading:s,onClick:o}){return e.jsxs(Z,{children:[e.jsx(ee,{asChild:!0,children:e.jsxs("button",{className:b("border border-border hover:border-primary/30 group rounded-lg bg-card px-4 py-3 flex items-center gap-3 w-full text-left hover:bg-muted/50 transition-colors",s&&"opacity-50 cursor-not-allowed"),disabled:s,onClick:o,children:[e.jsx(le,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),e.jsx("span",{className:"font-medium text-foreground truncate flex-1",children:te(t)}),s?e.jsx(M,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary animate-spin flex-shrink-0"}):e.jsx(se,{className:"h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0"})]})}),e.jsx(re,{children:e.jsx("p",{children:t})})]})}function ge({connectionStatus:t,ready:s,snapshot:o,startingLocalPath:a,commandError:l,newProjectOpen:i,onNewProjectOpenChange:d,onOpenProject:x,onCreateProject:w}){const j=h.useMemo(()=>(o==null?void 0:o.projects)??[],[o==null?void 0:o.projects]),m=t==="connecting"||!s,f=t==="connected"&&s;return e.jsxs("div",{className:"flex-1 flex flex-col min-w-0 bg-background overflow-y-auto",children:[f?e.jsxs(e.Fragment,{children:[e.jsx(O,{title:(o==null?void 0:o.machine.displayName)??"Local Projects",subtitle:`${n} is connected, choose a project below to get started.`}),e.jsxs("div",{className:"w-full px-6 mb-10",children:[e.jsxs("div",{className:"flex items-baseline justify-between mb-3",children:[e.jsx("h2",{className:"text-13 font-medium text-muted-foreground tracking-wider",children:"Projects"}),e.jsxs(v,{variant:"default",size:"sm",onClick:()=>d(!0),children:[e.jsx(G,{className:"h-4 w-4 mr-1.5"}),"Add Project"]})]}),j.length>0?e.jsx("div",{className:"grid gap-2 [grid-template-columns:repeat(auto-fill,minmax(min(260px,100%),1fr))]",children:j.map(c=>e.jsx(pe,{localPath:c.localPath,loading:a===c.localPath,onClick:()=>{x(c.localPath)}},c.localPath))}):e.jsx(N,{children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"No local projects discovered yet. Open one with Claude or Codex, or create a new project here."})}),l?e.jsx("div",{className:"text-sm text-destructive border border-destructive/20 bg-destructive/5 rounded-xl px-4 py-3 mt-4",children:l}):null]})]}):e.jsxs(e.Fragment,{children:[e.jsx(O,{narrow:!0,icon:F,title:m?`Connecting ${n}`:`Connect ${n}`,subtitle:m?`${n} is starting up and loading your local projects.`:`Run ${n} directly on your machine with full access to your local files and agent project history.`}),e.jsxs("div",{className:"max-w-2xl w-full mx-auto pb-12 px-6",children:[e.jsx(k,{children:"Status"}),e.jsx("div",{className:"mb-8",children:e.jsx(N,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(M,{className:"h-4 w-4 text-muted-foreground animate-spin"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:m?`Connecting to your local ${n} server...`:e.jsxs(e.Fragment,{children:["Not connected. Run ",e.jsx("code",{className:"bg-background border border-border rounded-md mx-0.5 p-1 font-mono text-xs text-foreground",children:g()})," from any terminal on this machine."]})})]})})}),m?null:e.jsxs("div",{className:"mb-10",children:[e.jsx(k,{children:"How it works"}),e.jsx(N,{children:e.jsxs("div",{className:"flex items-start gap-4 py-2 px-2",children:[e.jsx(S,{icon:ce,title:`${n} CLI`,subtitle:"On Your Machine"}),e.jsx(A,{}),e.jsx(S,{icon:_,title:`${n} Server`,subtitle:"Local WebSocket"}),e.jsx(A,{}),e.jsx(S,{icon:F,title:`${n} UI`,subtitle:"Project Chat"})]})})]}),m?null:e.jsxs("div",{className:"mb-10",children:[e.jsx(k,{children:"Setup"}),e.jsx(N,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsxs(B,{number:1,title:`Start ${n}`,children:[e.jsx("p",{children:"Run this command in your terminal:"}),e.jsx(R,{children:g()})]}),e.jsxs(B,{number:2,title:"Open the local UI",children:[e.jsxs("p",{children:[n," serves the app locally and opens the Local Projects page in an app-style browser window."]}),e.jsx(R,{children:"http://localhost:3210/local"})]}),e.jsxs("div",{className:"mt-8",children:[e.jsx("h3",{className:"text-sm font-medium text-muted-foreground tracking-wider mb-4",children:"Notes"}),e.jsxs("div",{className:"space-y-3 text-sm",children:[e.jsxs("div",{className:"flex gap-4",children:[e.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:g("").trim()}),e.jsx("span",{className:"text-muted-foreground",children:"Start in the current directory"})]}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx("code",{className:"font-mono text-foreground whitespace-nowrap",children:g("--no-open")}),e.jsx("span",{className:"text-muted-foreground",children:"Start the server without opening the browser"})]})]})]})]})})]})]})]}),e.jsx(he,{open:i,onOpenChange:d,onConfirm:c=>{w(c)}}),e.jsx("div",{className:"py-4 text-center",children:e.jsxs("span",{className:"text-xs text-muted-foreground/50",children:["v",Q.split("/")[1]]})})]})}function ye(){const t=ie();return e.jsx("div",{className:"flex-1 flex flex-col min-w-0 min-h-0 relative",children:e.jsx(ge,{connectionStatus:t.connectionStatus,ready:t.localProjectsReady,snapshot:t.localProjects,startingLocalPath:t.startingLocalPath,commandError:t.commandError,newProjectOpen:t.addProjectModalOpen,onNewProjectOpenChange:s=>{if(s){t.openAddProjectModal();return}t.closeAddProjectModal()},onOpenProject:t.handleOpenLocalProject,onCreateProject:t.handleCreateProject})})}export{ye as LocalProjectsPage};
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import{c as q,l as be,ay as ue,az as pe,aq as W,aA as fn,aB as ze,ar as Rt,r as N,aC as gn,aD as It,j as e,I as P,d as oe,B as O,P as Se,G as Z,aw as pn,aE as ja,as as Na,aF as ya,av as ka,aG as Ca,aH as Ce,aI as Ps,aJ as wa,aK as Ut,aL as Sa,H as Ee,$ as Ea,Z as Da,aM as dt,aN as Ma,aO as _t,aP as bn,y as vn,aQ as jn,T as Nn,U as yn,Y as kn,aR as Ta,aS as Pa,aT as Cn,s as ie,e as Aa,aU as Ia,aV as As,a as _a,b as Oa,u as La,aW as Ra,O as Ua,aX as Fa,aY as za,aZ as Va,a_ as Ka,a$ as nt,b0 as Wa,b1 as $a,b2 as at,b3 as ye,b4 as Ba,b5 as Ha,b6 as Ga,b7 as Ya,b8 as qa,b9 as Is,ba as Ct,bb as Ot,bc as wt,bd as Xa,be as Qa,bf as Za,bg as Ja,bh as el,bi as tl,bj as sl,bk as _s,bl as Os,bm as nl,bn as Ls,bo as Rs,bp as al,bq as ll,br as St,bs as Et,bt as lt,bu as rt,bv as rl,bw as Lt,bx as ol,D as Us,z as Fs,A as zs,F as Vs,K as Ks,X as il,by as dl,bz as cl,bA as Ws,bB as ul,bC as ml}from"./index-D7ZrZlum.js";import{S as ee,a as te,b as se,c as ne,d as $,B as Ft,K as xl,D as $s,e as hl,f as he,E as fl,g as gl,M as Bs,h as Hs,C as Gs,i as pl}from"./editor-icons-CZk3y76B.js";import{E as zt}from"./external-link-BEoRD1xZ.js";import{R as bl,S as vl}from"./search-CKRWuWXG.js";import{S as Ve}from"./settings-header-button-C3noeQRy.js";import{M as jl}from"./monitor-Czw3iHdG.js";/**
|
|
2
|
+
* @license lucide-react v0.562.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/const Nl=[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]],Ys=q("book-text",Nl);/**
|
|
7
|
+
* @license lucide-react v0.562.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/const yl=[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]],kl=q("cloud-download",yl);/**
|
|
12
|
+
* @license lucide-react v0.562.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/const Cl=[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]],wl=q("command",Cl);/**
|
|
17
|
+
* @license lucide-react v0.562.0 - ISC
|
|
18
|
+
*
|
|
19
|
+
* This source code is licensed under the ISC license.
|
|
20
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
21
|
+
*/const Sl=[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]],wn=q("cpu",Sl);/**
|
|
22
|
+
* @license lucide-react v0.562.0 - ISC
|
|
23
|
+
*
|
|
24
|
+
* This source code is licensed under the ISC license.
|
|
25
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
26
|
+
*/const El=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],Dl=q("flask-conical",El);/**
|
|
27
|
+
* @license lucide-react v0.562.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/const Ml=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],Tl=q("info",Ml);/**
|
|
32
|
+
* @license lucide-react v0.562.0 - ISC
|
|
33
|
+
*
|
|
34
|
+
* This source code is licensed under the ISC license.
|
|
35
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
+
*/const Pl=[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]],qs=q("log-out",Pl);/**
|
|
37
|
+
* @license lucide-react v0.562.0 - ISC
|
|
38
|
+
*
|
|
39
|
+
* This source code is licensed under the ISC license.
|
|
40
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
41
|
+
*/const Al=[["path",{d:"M14 14a2 2 0 0 0 2-2V8h-2",key:"1r06pg"}],["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}],["path",{d:"M8 14a2 2 0 0 0 2-2V8H8",key:"1jzu5j"}]],Xs=q("message-square-quote",Al);/**
|
|
42
|
+
* @license lucide-react v0.562.0 - ISC
|
|
43
|
+
*
|
|
44
|
+
* This source code is licensed under the ISC license.
|
|
45
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
46
|
+
*/const Il=[["path",{d:"M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401",key:"kfwtm"}]],_l=q("moon",Il);/**
|
|
47
|
+
* @license lucide-react v0.562.0 - ISC
|
|
48
|
+
*
|
|
49
|
+
* This source code is licensed under the ISC license.
|
|
50
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
51
|
+
*/const Ol=[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z",key:"1xoxul"}],["path",{d:"M9 8V2",key:"14iosj"}]],Sn=q("plug",Ol);/**
|
|
52
|
+
* @license lucide-react v0.562.0 - ISC
|
|
53
|
+
*
|
|
54
|
+
* This source code is licensed under the ISC license.
|
|
55
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
56
|
+
*/const Ll=[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],Rl=q("power-off",Ll);/**
|
|
57
|
+
* @license lucide-react v0.562.0 - ISC
|
|
58
|
+
*
|
|
59
|
+
* This source code is licensed under the ISC license.
|
|
60
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
61
|
+
*/const Ul=[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]],Fl=q("power",Ul);/**
|
|
62
|
+
* @license lucide-react v0.562.0 - ISC
|
|
63
|
+
*
|
|
64
|
+
* This source code is licensed under the ISC license.
|
|
65
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
66
|
+
*/const zl=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],Vl=q("sun",zl);/**
|
|
67
|
+
* @license lucide-react v0.562.0 - ISC
|
|
68
|
+
*
|
|
69
|
+
* This source code is licensed under the ISC license.
|
|
70
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
71
|
+
*/const Kl=[["path",{d:"M12 4v16",key:"1654pz"}],["path",{d:"M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2",key:"e0r10z"}],["path",{d:"M9 20h6",key:"s66wpe"}]],En=q("type",Kl),Wl="gpt-5.4-mini";function $l(t){return t==="previous-assistant-reply"||t==="full-transcript"}function Bl(t){return t==="auto"||t==="manual"}const Hl={enabled:!1,mode:"always-ask"};function Gl(t){const a=t.trim();if(a.startsWith("https://"))try{const n=new URL(a);if(n.protocol!=="https:")return!1;const r=n.hostname.toLowerCase();return!(r==="localhost"||!r.includes(".")||r.startsWith(".")||r.endsWith("."))}catch{return!1}if(a.startsWith("mailto:")){const n=a.slice(7),r=/^[^\s@]+@([^\s@]+)$/.exec(n);if(!r)return!1;const l=r[1].toLowerCase();return!(l==="localhost"||!l.includes(".")||l.startsWith(".")||l.endsWith("."))}return!1}const Qs={maxFileSizeMb:100},ot=1,it=2048;function Dn(t){return t==="claude"||t==="codex"||t==="openrouter"}const Yl=["app_launch","project_opened","project_created","project_removed","chat_created","chat_deleted","message_sent","update_checked","update_installed","update_failed","analytics_enabled","analytics_disabled"],ql=["current_version","environment","latest_version","custom_port_enabled","no_open_enabled","password_enabled","strict_port_enabled","remote_enabled","host_enabled","share_quick_enabled","share_token_enabled"];function Xl(){return{name:"",provider:"claude",model:pe("claude").defaultModel,modelOptions:{...ue},systemPrompt:"",contextScope:"previous-assistant-reply",triggerMode:"auto"}}function Ql(){return{draft:Xl(),error:null,pending:!1,confirmDelete:!1}}const re=be()(t=>({editing:{kind:"list"},form:Ql(),timeoutDraft:"",loopError:null,setEditing:a=>t({editing:a}),resetForm:a=>t({form:{draft:a,error:null,pending:!1,confirmDelete:!1}}),patchForm:a=>t(n=>({form:{...n.form,...a}})),patchFormDraft:a=>t(n=>({form:{...n.form,draft:{...n.form.draft,...a}}})),setTimeoutDraft:a=>t({timeoutDraft:a}),setLoopError:a=>t({loopError:a})}));function Dt(t){return"contextWindow"in t}function Zs(t){return"fastMode"in t}function Zl(t){const a=t.editing,n=N.useMemo(()=>a.kind!=="edit"?null:t.subagents.find(i=>i.id===a.id)??null,[a,t.subagents]),r=a.kind,l=r!=="list",f=t.subagents.length===0;return f&&!l?e.jsx(Jl,{onStartCreate:t.onStartCreate}):e.jsxs("div",{className:"flex flex-col gap-6 md:flex-row md:items-start md:gap-8",children:[f?null:e.jsx(tr,{subagents:t.subagents,editing:t.editing,onSelect:t.onSelect,onStartCreate:t.onStartCreate}),l?e.jsx(rr,{mode:r,subject:r==="edit"?n:null,providerDefaults:t.providerDefaults,availableProviders:t.availableProviders,handlers:t.handlers,onCancelEditing:t.onCancelEditing},r==="edit"?(n==null?void 0:n.id)??"edit":"create"):e.jsx(er,{})]})}function Jl(t){return e.jsxs("div",{className:"flex w-full flex-col items-center gap-4 rounded-lg border border-dashed border-border px-6 py-14 text-center","data-testid":"subagent-empty",children:[e.jsx("div",{className:"flex size-10 items-center justify-center rounded-full bg-muted text-muted-foreground",children:e.jsx(Ft,{className:"size-5","aria-hidden":!0})}),e.jsx("p",{className:"text-sm font-medium text-foreground",children:"No subagents yet"}),e.jsxs(O,{variant:"default",size:"sm",onClick:t.onStartCreate,children:[e.jsx(Se,{className:"mr-1.5 size-4"})," Create subagent"]})]})}function er(){return e.jsx("div",{className:"hidden flex-1 items-center justify-center rounded-lg border border-dashed border-border px-6 py-12 text-center text-sm text-muted-foreground md:flex",children:"Select a subagent to edit, or create a new one."})}function tr(t){const a=t.editing.kind==="edit"?t.editing.id:null;return e.jsxs("aside",{className:"flex w-full flex-col gap-2 md:w-64 md:flex-shrink-0",children:[e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsxs("span",{className:"text-xs font-medium tracking-wide text-muted-foreground",style:{fontVariantNumeric:"tabular-nums"},children:[t.subagents.length," ",t.subagents.length===1?"agent":"agents"]}),e.jsxs(O,{variant:"ghost",size:"sm",onClick:t.onStartCreate,"data-testid":"subagent-create",children:[e.jsx(Se,{className:"size-4"}),e.jsx("span",{className:"sr-only",children:"Create subagent"})]})]}),e.jsx("ul",{className:"flex flex-col gap-0.5",children:t.subagents.map(n=>{var l;const r=((l=n.description)==null?void 0:l.trim())||(n.contextScope==="previous-assistant-reply"?"Last reply":"Full transcript");return e.jsx("li",{children:e.jsxs("button",{type:"button","data-testid":`subagent-row:${n.id}`,onClick:()=>t.onSelect(n.id),className:oe("flex w-full flex-col items-start gap-0.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted",a===n.id&&"bg-muted"),children:[e.jsxs("span",{className:"flex w-full items-center justify-between gap-2",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:n.name}),e.jsx(sr,{provider:n.provider})]}),e.jsx("span",{className:"w-full truncate text-xs text-muted-foreground",children:r})]})},n.id)})})]})}function sr({provider:t}){const a=pe(t).label;return e.jsxs("span",{className:"inline-flex items-center gap-1 rounded border border-border bg-card px-1.5 py-0.5 text-xs font-medium tracking-wide text-muted-foreground",children:[e.jsx(Ft,{className:"size-3"})," ",a]})}const nr=[{value:"claude",label:"Claude"},{value:"codex",label:"Codex"}],ar=[{value:"previous-assistant-reply",label:"Last reply"},{value:"full-transcript",label:"Full transcript"}],lr=[{value:"auto",label:"Auto"},{value:"manual",label:"Manual"}];function rr(t){var U;const a=N.useMemo(()=>t.mode==="edit"&&t.subject?xr(t.subject):Js("claude",t.providerDefaults,t.availableProviders),[t.mode,t.subject,t.providerDefaults,t.availableProviders]),n=re(h=>h.resetForm),r=re(h=>h.form),l=re(h=>h.patchFormDraft),f=re(h=>h.patchForm);N.useEffect(()=>{n(a)},[]);const{draft:i,error:o,pending:d,confirmDelete:p}=r,x=(o==null?void 0:o.field)==="name"?o.message:null,g=(o==null?void 0:o.field)==="general"?o.message:null,j=fr(i,a),y=i.name.trim().length>0&&(t.mode==="create"||j);function v(h){l(h),(o==null?void 0:o.field)==="name"&&"name"in h&&f({error:null})}function w(h){if(h===i.provider)return;const D=Js(h,t.providerDefaults,t.availableProviders);l({provider:h,model:D.model,modelOptions:D.modelOptions})}function I(h){if(i.provider!=="claude")return;const D=Dt(i.modelOptions)?i.modelOptions:ue;l({modelOptions:{...ue,...D,reasoningEffort:h}})}function k(h){if(i.provider!=="claude")return;const D=Dt(i.modelOptions)?i.modelOptions:ue;l({modelOptions:{...ue,...D,contextWindow:h}})}function R(h){if(i.provider!=="codex")return;const D=Zs(i.modelOptions)?i.modelOptions:ze;l({modelOptions:{...ze,...D,reasoningEffort:h}})}async function S(){if(!(!y||d)){f({pending:!0,error:null});try{const h=t.mode==="create"?await t.handlers.onCreate(i):await t.handlers.onUpdate(t.subject.id,i);h.ok||f({error:pr(h.error)})}finally{f({pending:!1})}}}async function V(){if(!(t.mode!=="edit"||!t.subject)){if(!p){f({confirmDelete:!0});return}f({pending:!0});try{await t.handlers.onDelete(t.subject.id)}finally{f({pending:!1,confirmDelete:!1})}}}const K=i.provider==="claude"?{...ue,...Dt(i.modelOptions)?i.modelOptions:{}}:null,z=i.provider==="codex"?{...ze,...Zs(i.modelOptions)?i.modelOptions:{}}:null,T=t.availableProviders.find(h=>h.id===i.provider)??pe(i.provider);return e.jsxs("section",{className:"flex w-full flex-1 flex-col gap-4",children:[e.jsxs("header",{className:"flex flex-col gap-1",children:[e.jsx("h3",{className:"text-base font-medium text-foreground",children:t.mode==="create"?"New subagent":i.name||"Subagent"}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Mention with ",e.jsxs("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:["@agent/",i.name||"<name>"]})," in chat."]})]}),g?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-sm text-destructive",children:g}):null,e.jsx(G,{label:"Name",hint:x,hintTone:x?"destructive":"muted",children:e.jsx(P,{"data-testid":"subagent-form-name",value:i.name,onChange:h=>v({name:br(h.target.value)}),maxLength:Mn,placeholder:"reviewer",className:"font-mono"})}),e.jsx(G,{label:"Description",hint:"Optional. Shown next to the name.",children:e.jsx(P,{"data-testid":"subagent-form-description",value:i.description??"",onChange:h=>v({description:h.target.value}),placeholder:"Reviews diffs against the repo style"})}),e.jsx(G,{label:"Provider",children:e.jsx(Z,{value:i.provider,onValueChange:h=>{Dn(h)&&w(h)},options:nr,size:"sm"})}),e.jsx(G,{label:"Model",children:e.jsxs(ee,{value:i.model,onValueChange:h=>v({model:h}),children:[e.jsx(te,{"data-testid":"subagent-form-model",className:"w-full md:w-72",children:e.jsx(se,{placeholder:"Select a model"})}),e.jsx(ne,{children:T.models.map(h=>e.jsx($,{value:h.id,children:h.label},h.id))})]})}),K?e.jsxs(e.Fragment,{children:[e.jsx(G,{label:"Reasoning effort",children:e.jsx(Z,{value:K.reasoningEffort,onValueChange:h=>{ja(h)&&I(h)},options:pn.map(h=>({value:h.id,label:h.label})),size:"sm"})}),e.jsx(G,{label:"Context window",children:e.jsx(Z,{value:K.contextWindow,onValueChange:h=>{ya(h)&&k(h)},options:Na.map(h=>({value:h.id,label:h.label})),size:"sm"})})]}):null,z?e.jsx(G,{label:"Reasoning effort",children:e.jsx(Z,{value:z.reasoningEffort,onValueChange:h=>{Ca(h)&&R(h)},options:ka.map(h=>({value:h.id,label:h.label})),size:"sm"})}):null,e.jsx(G,{label:"Context scope",children:e.jsx(Z,{value:i.contextScope,onValueChange:h=>{$l(h)&&v({contextScope:h})},options:ar,size:"sm"})}),e.jsx(G,{label:"Trigger",hint:"Auto: the main agent may delegate on its own. Manual: only runs when you @-mention it.",children:e.jsx(Z,{value:i.triggerMode??"auto",onValueChange:h=>{Bl(h)&&v({triggerMode:h})},options:lr,size:"sm"})}),e.jsx(G,{label:"System prompt",hint:"What this persona should focus on. Plain text.",children:e.jsx(Ce,{"data-testid":"subagent-form-system-prompt",value:i.systemPrompt,onChange:h=>v({systemPrompt:h.target.value}),placeholder:"You are a careful code reviewer...",rows:6,className:"min-h-32"})}),e.jsx(G,{label:"Max turns",hint:"Optional. Caps the agentic turns per run (like Claude Code's per-agent maxTurns). Empty = unbounded. Claude SDK runs stop gracefully at the limit; PTY/Codex runs are aborted.",children:e.jsx(P,{"data-testid":"subagent-form-max-turns",type:"number",min:1,step:1,value:((U=i.maxTurns)==null?void 0:U.toString())??"",onChange:h=>{const D=Number.parseInt(h.target.value,10);v({maxTurns:Number.isInteger(D)&&D>0?D:void 0})},placeholder:"unbounded",className:"w-36"})}),i.provider==="claude"?e.jsxs(e.Fragment,{children:[e.jsx(G,{label:"Working directory",hint:"Optional. Relative to the parent chat cwd. Restricts the subagent's filesystem access to this subtree.",children:e.jsx(P,{"data-testid":"subagent-form-working-dir",value:i.workingDir??"",onChange:h=>{const D=h.target.value;v({workingDir:D.length>0?D:void 0})},placeholder:"docs"})}),e.jsx(G,{label:"Allowed paths",hint:"Optional. Newline-separated, relative to the parent chat cwd. When set, file tools can only read/write inside these roots.",children:e.jsx(Ce,{"data-testid":"subagent-form-allowed-paths",value:(i.allowedPaths??[]).join(`
|
|
72
|
+
`),onChange:h=>{const D=h.target.value.split(/\r?\n/).map(X=>X.trim()).filter(X=>X.length>0);v({allowedPaths:D.length>0?D:void 0})},placeholder:`docs
|
|
73
|
+
wiki`,rows:3})})]}):null,e.jsxs("footer",{className:"flex flex-wrap items-center justify-end gap-2 pt-2",children:[e.jsx(O,{variant:"ghost",size:"sm",onClick:t.onCancelEditing,children:"Cancel"}),t.mode==="edit"?e.jsx(O,{variant:"destructive",size:"sm","data-testid":"subagent-form-delete",disabled:d,onClick:V,children:p?"Confirm delete":"Delete"}):null,e.jsx(O,{variant:"default",size:"sm","data-testid":"subagent-form-save",disabled:!y||d,onClick:S,children:d?"Saving…":"Save"})]})]})}function G(t){return e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:t.label}),t.children,t.hint?e.jsx("span",{className:oe("text-xs",t.hintTone==="destructive"?"text-destructive":"text-muted-foreground"),children:t.hint}):null]})}const or=[],ir={claude:{model:pe("claude").defaultModel,modelOptions:{...ue},planMode:!1},codex:{model:pe("codex").defaultModel,modelOptions:{...ze},planMode:!1},openrouter:{model:fn,modelOptions:{},planMode:!1}};function dr(t){const a=W(g=>{var j;return((j=g.settings)==null?void 0:j.subagents)??or}),n=W(g=>{var j;return((j=g.settings)==null?void 0:j.providerDefaults)??ir}),r=W(Rt),l=N.useMemo(()=>gn([...It],r),[r]),f=re(g=>g.editing),i=re(g=>g.setEditing),o=N.useMemo(()=>({onCreate:async g=>{const j=await t.state.socket.command({type:"subagent.create",input:g});return j.ok&&i({kind:"edit",id:j.subagent.id}),j},onUpdate:async(g,j)=>await t.state.socket.command({type:"subagent.update",id:g,patch:{...j,maxTurns:j.maxTurns??null}}),onDelete:async g=>{await t.state.socket.command({type:"subagent.delete",id:g}),i({kind:"list"})}}),[t.state.socket,i]),d=N.useCallback(g=>{i({kind:"edit",id:g})},[i]),p=N.useCallback(()=>{i({kind:"create"})},[i]),x=N.useCallback(()=>{i({kind:"list"})},[i]);return e.jsxs("div",{className:"flex flex-col gap-6 px-6 py-6",children:[e.jsx(ur,{subagents:a,handleWriteAppSettings:t.state.handleWriteAppSettings}),e.jsx(Zl,{subagents:a,providerDefaults:n,availableProviders:l,editing:f,onSelect:d,onStartCreate:p,onCancelEditing:x,handlers:o})]})}const Mt="__none__",Tt=30,Pt=86400,cr=600;function ur(t){const a=W(x=>{var g;return(g=x.settings)==null?void 0:g.subagentRuntime}),n=a?Math.round(a.runTimeoutMs/1e3):cr,r=(a==null?void 0:a.defaultLoopSubagentId)??null,l=re(x=>x.timeoutDraft),f=re(x=>x.setTimeoutDraft),i=re(x=>x.loopError),o=re(x=>x.setLoopError);N.useEffect(()=>{f(String(n))},[n]);function d(){const x=Number(l);if(!Number.isInteger(x)||x<Tt||x>Pt){f(String(n)),o(`Timeout must be a whole number of seconds between ${Tt} and ${Pt}.`);return}o(null),x!==n&&t.handleWriteAppSettings({subagentRuntime:{runTimeoutMs:x*1e3}}).catch(g=>o(g instanceof Error?g.message:"Unable to save subagent runtime settings."))}function p(x){o(null);const g=x===Mt?null:x;t.handleWriteAppSettings({subagentRuntime:{defaultLoopSubagentId:g}}).catch(j=>o(j instanceof Error?j.message:"Unable to save default loop subagent."))}return e.jsxs("section",{className:"flex flex-col gap-4 rounded-lg border border-border/60 bg-card/40 p-4",children:[e.jsxs("header",{className:"flex flex-col gap-1",children:[e.jsx("h3",{className:"text-sm font-medium text-foreground",children:"Loop & runtime"}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Applies to background subagent runs and the autonomous ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono",children:"/loop"}),"."]})]}),i?e.jsx("div",{className:"rounded-md border border-destructive/40 bg-destructive/5 px-3 py-2 text-xs text-destructive",children:i}):null,e.jsx(G,{label:"Stall timeout (seconds)",hint:"A subagent run is aborted only after this long with no streamed activity — not a total wall-clock cap. A steadily-working run is never killed.",children:e.jsx(P,{type:"number",inputMode:"numeric",min:Tt,max:Pt,value:l,onChange:x=>f(x.target.value),onBlur:d,onKeyDown:x=>{x.key==="Enter"&&(d(),x.currentTarget.blur())},className:"w-full md:w-48 tabular-nums"})}),e.jsx(G,{label:"Default loop subagent",hint:"The subagent setup_loop delegates each chunk to when no explicit id is given.",children:e.jsxs(ee,{value:r??Mt,onValueChange:p,children:[e.jsx(te,{className:"w-full md:w-72",children:e.jsx(se,{placeholder:"None"})}),e.jsxs(ne,{children:[e.jsx($,{value:Mt,children:"None (require explicit id)"}),t.subagents.map(x=>e.jsx($,{value:x.id,children:x.name},x.id))]})]})})]})}const Mn=64,mr=new Set(["EMPTY_NAME","INVALID_CHAR","RESERVED_NAME","DUPLICATE_NAME","TOO_LONG"]);function Js(t,a,n){var i,o;if(t==="claude"){const d=a==null?void 0:a.claude,p=(d==null?void 0:d.model)??((i=n==null?void 0:n.find(g=>g.id==="claude"))==null?void 0:i.defaultModel)??pe("claude").defaultModel,x=(d==null?void 0:d.modelOptions)??{...ue};return{name:"",provider:t,model:p,modelOptions:{...x},systemPrompt:"",contextScope:"previous-assistant-reply",triggerMode:"auto"}}const r=a==null?void 0:a.codex,l=(r==null?void 0:r.model)??((o=n==null?void 0:n.find(d=>d.id==="codex"))==null?void 0:o.defaultModel)??pe("codex").defaultModel,f=(r==null?void 0:r.modelOptions)??{...ze};return{name:"",provider:t,model:l,modelOptions:{...f},systemPrompt:"",contextScope:"previous-assistant-reply",triggerMode:"auto"}}function xr(t){return{name:t.name,description:t.description,provider:t.provider,model:t.model,modelOptions:t.modelOptions,systemPrompt:t.systemPrompt,contextScope:t.contextScope,triggerMode:t.triggerMode,workingDir:t.workingDir,allowedPaths:t.allowedPaths,maxTurns:t.maxTurns}}const hr=(t,a)=>{if(t===a)return!0;if(!t||!a||t.length!==a.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!==a[n])return!1;return!0};function fr(t,a){return t.name!==a.name||(t.description??"")!==(a.description??"")||t.provider!==a.provider||t.model!==a.model||t.systemPrompt!==a.systemPrompt||t.contextScope!==a.contextScope||(t.triggerMode??"auto")!==(a.triggerMode??"auto")||(t.workingDir??"")!==(a.workingDir??"")||!hr(t.allowedPaths,a.allowedPaths)||(t.maxTurns??null)!==(a.maxTurns??null)?!0:!gr(t.modelOptions,a.modelOptions)}function gr(t,a){if(!Ps(t)||!Ps(a))return!1;const n=new Set([...Object.keys(t),...Object.keys(a)]);for(const r of n)if(t[r]!==a[r])return!1;return!0}function pr(t){return mr.has(t.code)?{field:"name",message:t.message}:{field:"general",message:t.message}}function br(t){return t.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").slice(0,Mn)}function Tn({icon:t,message:a}){return e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-md border border-dashed px-6 py-10 text-center",children:[e.jsx(t,{className:"mb-3 h-8 w-8 text-muted-foreground","aria-hidden":!0}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})}function Vt({children:t}){return e.jsx("ul",{className:"flex flex-col divide-y rounded-md border",children:t})}function Kt({label:t,onEdit:a,onDelete:n}){return e.jsxs(e.Fragment,{children:[e.jsx(O,{variant:"ghost",size:"sm",onClick:a,"aria-label":`Edit ${t}`,children:e.jsx(wa,{className:"h-4 w-4"})}),e.jsx(O,{variant:"ghost",size:"sm",onClick:n,"aria-label":`Delete ${t}`,children:e.jsx(Ut,{className:"h-4 w-4"})})]})}const en=new Set;function tn(t){var a;return{name:(t==null?void 0:t.name)??"",transport:(t==null?void 0:t.transport)??"stdio",command:(t==null?void 0:t.transport)==="stdio"?t.command:"",argsText:(t==null?void 0:t.transport)==="stdio"?t.args.join(`
|
|
74
|
+
`):"",envText:(t==null?void 0:t.transport)==="stdio"?Object.entries(t.env).map(([n,r])=>`${n}=${r}`).join(`
|
|
75
|
+
`):"",cwd:(t==null?void 0:t.transport)==="stdio"?t.cwd??"":"",url:t!==null&&t.transport!=="stdio"?t.url:"",headersText:t!==null&&t.transport!=="stdio"?Object.entries(t.headers).map(([n,r])=>`${n}: ${r}`).join(`
|
|
76
|
+
`):"",error:null,submitting:!1,oauthEnabled:t!==null&&t.transport!=="stdio"?((a=t.oauth)==null?void 0:a.enabled)??!1:!1,authFlowUrl:null,callbackInput:"",oauthError:null,authenticating:!1,completing:!1}}const ge=be()(t=>({editing:{kind:"list"},testingServerIds:en,editorForm:tn(null),setEditing:a=>t({editing:a}),setServerTesting:(a,n)=>t(r=>{const l=new Set(r.testingServerIds);return n?l.add(a):l.delete(a),{testingServerIds:l.size===0?en:l}}),resetEditorForm:a=>t({editorForm:tn(a)}),patchEditorForm:a=>t(n=>({editorForm:{...n.editorForm,...a}}))}));function Wt(t,a){return N.useMemo(()=>({onCreate:async n=>{await a.handleWriteAppSettings(t({create:n}))},onUpdate:async(n,r)=>{await a.handleWriteAppSettings(t({update:{id:n,patch:r}}))},onDelete:async n=>{await a.handleWriteAppSettings(t({delete:{id:n}}))}}),[t,a])}async function $t(t){t.patch({submitting:!0,error:null});try{await t.save(),t.onDone()}catch(a){t.patch({error:a instanceof Error?a.message:t.fallbackMessage})}finally{t.patch({submitting:!1})}}function Bt(t){return t.submitting?"Saving…":t.isEdit?"Save changes":t.addLabel}const vr=new Set(["stdio","http","sse","ws"]);function jr(t){return vr.has(t)}const Nr=t=>({customMcpServers:t});function yr(t){return t.editing.kind!=="list"?e.jsx(Sr,{initial:t.editing.kind==="edit"?t.servers.find(a=>t.editing.kind==="edit"&&a.id===t.editing.id)??null:null,existingNames:t.servers.map(a=>({id:a.id,name:a.name})),onCancel:t.onCancelEditing,handlers:t.handlers}):t.servers.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center px-6 py-16 text-center",children:[e.jsx(Sn,{className:"mb-4 h-10 w-10 text-muted-foreground","aria-hidden":!0}),e.jsx("h2",{className:"text-lg font-medium",children:"No custom MCP servers"}),e.jsx("p",{className:"mt-2 max-w-md text-sm text-muted-foreground",children:"Install MCP servers to extend the model's tool surface. Supports stdio, http, sse, and ws transports."}),e.jsxs(O,{className:"mt-6",onClick:t.onStartCreate,children:[e.jsx(Se,{className:"mr-1 h-4 w-4"}),"Add server"]})]}):e.jsxs("div",{className:"flex flex-col gap-3 px-6 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("h2",{className:"text-base font-medium",children:"Custom MCP servers"}),e.jsxs(O,{size:"sm",onClick:t.onStartCreate,children:[e.jsx(Se,{className:"mr-1 h-4 w-4"}),"Add server"]})]}),e.jsx(Vt,{children:t.servers.map(a=>e.jsx(kr,{server:a,handlers:t.handlers,onEdit:()=>t.onSelect(a.id)},a.id))})]})}function kr({server:t,handlers:a,onEdit:n,dom:r=dt}){const l=ge(d=>d.testingServerIds.has(t.id)),f=ge(d=>d.setServerTesting),i=N.useCallback(async()=>{f(t.id,!0);try{await a.onTest(t.id)}finally{f(t.id,!1)}},[a,t.id,f]),o=N.useCallback(()=>{r.confirmDialog(`Delete MCP server "${t.name}"?`)&&a.onDelete(t.id)},[r,a,t.id,t.name]);return e.jsxs("li",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:t.name}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.jsx(Cr,{transport:t.transport}),e.jsx("span",{className:"ml-2",children:t.transport==="stdio"?t.command:t.url})]})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[e.jsx(wr,{result:t.lastTest,pending:l}),t.transport!=="stdio"&&e.jsx(Pn,{oauth:t.oauth}),e.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:t.enabled,onChange:d=>{a.onSetEnabled(t.id,d.target.checked)},"aria-label":"Enabled"}),e.jsx("span",{children:"On"})]}),e.jsx(O,{variant:"ghost",size:"sm",onClick:()=>{i()},title:"Test connection",children:e.jsx(bl,{className:oe("h-4 w-4",l&&"animate-spin")})}),e.jsx(Kt,{label:t.name,onEdit:n,onDelete:o})]})]})}function Cr({transport:t}){return e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:t})}function wr({result:t,pending:a}){if(a||t.status==="pending")return e.jsx("span",{className:"text-xs text-muted-foreground",children:"Testing…"});switch(t.status){case"ok":return e.jsxs("span",{className:"text-xs text-green-600",children:["OK · ",t.toolCount," tools"]});case"error":return e.jsx(Ee,{label:t.message,children:e.jsx("span",{className:"text-xs text-red-600",children:"Failed"})});case"untested":default:return e.jsx("span",{className:"text-xs text-muted-foreground",children:"Untested"})}}function Pn({oauth:t}){if(!(t!=null&&t.enabled))return null;switch(t.status){case"authenticated":return e.jsx("span",{className:"text-xs text-green-600",children:"OAuth ✓"});case"error":return e.jsx(Ee,{label:t.errorMessage,children:e.jsx("span",{className:"text-xs text-red-600",children:"OAuth error"})});default:return e.jsx("span",{className:"text-xs text-muted-foreground",children:"OAuth: unauth"})}}function Sr({initial:t,existingNames:a,onCancel:n,handlers:r,clipboard:l=Da}){const f=ge(C=>C.editorForm),i=ge(C=>C.resetEditorForm),o=ge(C=>C.patchEditorForm),d=N.useCallback(C=>{jr(C)&&o({transport:C})},[o]),{name:p,transport:x,command:g,argsText:j,envText:y,cwd:v,url:w,headersText:I,error:k,submitting:R,oauthEnabled:S,authFlowUrl:V,callbackInput:K,oauthError:z,authenticating:T,completing:U}=f,h=N.useRef(t);N.useEffect(()=>{i(h.current)},[i]);const D=t!==null&&t.transport!=="stdio"?t.oauth:void 0,X=N.useCallback(async C=>{o(C?{oauthEnabled:!0}:{oauthEnabled:!1,authFlowUrl:null,callbackInput:"",oauthError:null}),t&&await r.onUpdate(t.id,{oauth:{...D??{status:"unauthenticated"},enabled:C}})},[t,D,r,o]),ae=N.useCallback(async()=>{if(t){o({authenticating:!0,oauthError:null});try{const C=await r.onStartMcpOAuth(t.id);C.ok&&C.authorizationUrl?o({authFlowUrl:C.authorizationUrl}):C.ok&&C.alreadyAuthenticated?o({authFlowUrl:null}):o({oauthError:C.error??"Failed to start OAuth flow"})}finally{o({authenticating:!1})}}},[t,r,o]),de=N.useCallback(async()=>{if(t){o({completing:!0,oauthError:null});try{const C=await r.onCompleteMcpOAuth(t.id,K);C.ok?o({authFlowUrl:null,callbackInput:""}):o({oauthError:C.error??"Failed to complete OAuth flow"})}finally{o({completing:!1})}}},[t,K,r,o]),H=N.useMemo(()=>p.length===0?null:/^[a-zA-Z][a-zA-Z0-9_-]{0,31}$/.test(p)?p==="kanna"?"'kanna' is reserved.":a.find(J=>J.name===p&&J.id!==(t==null?void 0:t.id))?"Name already taken.":null:"Name must start with a letter and contain only letters, digits, '_' or '-' (max 32 chars).",[p,a,t==null?void 0:t.id]),Q=N.useCallback(async()=>{H||await $t({patch:o,save:async()=>{const C=j.split(`
|
|
77
|
+
`).map(M=>M.trim()).filter(M=>M.length>0),J={};for(const M of y.split(`
|
|
78
|
+
`)){const c=M.indexOf("=");c>0&&(J[M.slice(0,c).trim()]=M.slice(c+1))}const b={};for(const M of I.split(`
|
|
79
|
+
`)){const c=M.indexOf(":");c>0&&(b[M.slice(0,c).trim()]=M.slice(c+1).trim())}if(t){const M=x==="stdio"?{name:p,transport:x,command:g,args:C,env:J,cwd:v||void 0}:{name:p,transport:x,url:w,headers:b};await r.onUpdate(t.id,M)}else{const M=x==="stdio"?{name:p,transport:"stdio",command:g,args:C,env:J,cwd:v||void 0}:{name:p,transport:x,url:w,headers:b};await r.onCreate(M)}},onDone:n,fallbackMessage:"Failed to save MCP server"})},[j,g,v,y,r,I,t,p,H,n,x,w,o]),De=Bt({submitting:R,isEdit:t!==null,addLabel:"Add server"});return e.jsxs("div",{className:"flex flex-col gap-4 px-6 py-6 max-w-2xl",children:[e.jsx("h2",{className:"text-base font-medium",children:t?"Edit MCP server":"Add MCP server"}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Name"}),e.jsx(P,{value:p,onChange:C=>o({name:C.target.value}),placeholder:"fs"}),H&&e.jsx("p",{className:"text-xs text-red-600",children:H})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Transport"}),e.jsxs(ee,{value:x,onValueChange:d,children:[e.jsx(te,{children:e.jsx(se,{})}),e.jsxs(ne,{children:[e.jsx($,{value:"stdio",children:"stdio (spawn local command)"}),e.jsx($,{value:"http",children:"http (Streamable HTTP)"}),e.jsx($,{value:"sse",children:"sse (Server-Sent Events)"}),e.jsx($,{value:"ws",children:"ws (WebSocket)"})]})]})]}),x==="stdio"?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Command"}),e.jsx(P,{value:g,onChange:C=>o({command:C.target.value}),placeholder:"/usr/local/bin/mcp-filesystem"})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Args (one per line)"}),e.jsx(Ce,{value:j,onChange:C=>o({argsText:C.target.value}),rows:3,className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Env (KEY=value, one per line)"}),e.jsx(Ce,{value:y,onChange:C=>o({envText:C.target.value}),rows:3,className:"font-mono text-sm"})]}),e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"cwd (optional)"}),e.jsx(P,{value:v,onChange:C=>o({cwd:C.target.value}),placeholder:"/optional/working/dir"})]})]}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"URL"}),e.jsx(P,{value:w,onChange:C=>o({url:C.target.value}),placeholder:x==="ws"?"wss://example.com/mcp":"https://example.com/mcp"})]}),x==="ws"?e.jsx("p",{className:"text-xs text-muted-foreground",children:"Headers are not supported on the ws transport."}):e.jsxs("div",{className:"grid gap-1.5",children:[e.jsx("span",{className:"text-xs font-medium text-foreground",children:"Headers (Key: value, one per line)"}),e.jsx(Ce,{value:I,onChange:C=>o({headersText:C.target.value}),rows:3,className:"font-mono text-sm",disabled:S}),S&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Authorization header is managed by OAuth when enabled."})]}),(x==="http"||x==="sse")&&e.jsxs("div",{className:"flex flex-col gap-3 rounded-md border p-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(xl,{className:"h-4 w-4 text-muted-foreground","aria-hidden":!0}),e.jsx("span",{className:"text-xs font-medium",children:"OAuth 2.1"}),e.jsxs("label",{className:"ml-auto flex cursor-pointer items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("input",{type:"checkbox",checked:S,onChange:C=>{X(C.target.checked)},"aria-label":"Enable OAuth"}),e.jsx("span",{children:"Enable"})]})]}),S&&!t&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"Save the server first, then authenticate."}),S&&t&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pn,{oauth:D}),(D==null?void 0:D.status)==="authenticated"&&e.jsx(O,{variant:"ghost",size:"sm",onClick:()=>{ae()},disabled:T,children:"Re-authenticate"})]}),((D==null?void 0:D.status)!=="authenticated"||V)&&(V?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsxs("a",{href:V,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-xs text-blue-600 underline",children:["Open authorization URL",e.jsx(zt,{className:"h-3 w-3"})]}),e.jsx(Ee,{label:"Copy URL",children:e.jsx("button",{type:"button",onClick:()=>{l.writeText(V)},className:"ml-1 text-muted-foreground hover:text-foreground","aria-label":"Copy authorization URL",children:e.jsx(Ea,{className:"h-3 w-3"})})})]}),e.jsxs("div",{className:"grid gap-1",children:[e.jsx("span",{className:"text-xs text-muted-foreground",children:"After authorizing, paste the callback URL here:"}),e.jsx(P,{value:K,onChange:C=>o({callbackInput:C.target.value}),placeholder:"http://localhost:…/callback?code=…",className:"font-mono text-xs"})]}),e.jsx(O,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>{de()},disabled:U||K.length===0,children:U?"Completing…":"Complete"})]}):e.jsx(O,{variant:"outline",size:"sm",className:"w-fit",onClick:()=>{ae()},disabled:T,children:T?"Starting…":"Authenticate"})),z&&e.jsx("p",{className:"text-xs text-red-600",children:z})]})]})]}),k&&e.jsx("p",{className:"text-xs text-red-600",children:k}),e.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[e.jsx(O,{variant:"ghost",onClick:n,disabled:R,children:"Cancel"}),e.jsx(O,{onClick:()=>{Q()},disabled:R||!!H||p.length===0,children:De})]})]})}function Er(t){const a=W(Sa),n=ge(i=>i.editing),r=ge(i=>i.setEditing),l=Wt(Nr,t.state),f=N.useMemo(()=>({...l,onDelete:async i=>{await l.onDelete(i),r({kind:"list"})},onSetEnabled:async(i,o)=>{await t.state.handleWriteAppSettings({customMcpServers:{setEnabled:{id:i,enabled:o}}})},onTest:async i=>{await t.state.handleTestMcpServer(i)},onStartMcpOAuth:async i=>t.state.handleStartMcpOAuth(i),onCompleteMcpOAuth:async(i,o)=>t.state.handleCompleteMcpOAuth(i,o)}),[l,t.state,r]);return e.jsx(yr,{servers:a,editing:n,onSelect:i=>r({kind:"edit",id:i}),onStartCreate:()=>r({kind:"create"}),onCancelEditing:()=>r({kind:"list"}),handlers:f})}function sn(t,a,n,r){return{id:t,label:a,modelProvider:n,supportedEfforts:r,submitting:!1,error:null}}const we=be()(t=>({editing:{kind:"list"},editorForm:sn("","","claude",[]),setEditing:a=>t({editing:a}),resetEditorForm:(a,n,r,l)=>t({editorForm:sn(a,n,r,l)}),patchEditorForm:a=>t(n=>({editorForm:{...n.editorForm,...a}})),toggleSupportedEffort:a=>t(n=>{const r=n.editorForm.supportedEfforts,l=r.includes(a)?r.filter(f=>f!==a):[...r,a];return{editorForm:{...n.editorForm,supportedEfforts:l}}})})),Dr=t=>({customModels:t}),Mr=new Set(["claude","codex"]);function Tr(t){return Mr.has(t)}const nn={claude:"Claude",codex:"Codex"};function Pr({models:t,handlers:a,dom:n=dt}){const r=we(o=>o.editing),l=we(o=>o.setEditing),f=we(o=>o.resetEditorForm);function i(o){if(o.kind==="create")f("","",o.provider,[]);else if(o.kind==="edit"){const d=t.find(p=>p.id===o.id)??null;d&&f(d.id,d.label,d.provider,d.supportedEfforts??[])}l(o)}if(r.kind!=="list"){const o=r.kind==="edit"?t.find(d=>d.id===r.id)??null:null;return e.jsx(Ir,{initial:o,existing:t.map(d=>({id:d.id,provider:d.provider})),handlers:a,onDone:()=>l({kind:"list"})})}return e.jsx("div",{className:"flex flex-col gap-6 px-6 py-6",children:["claude","codex"].map(o=>{const d=t.filter(p=>p.provider===o);return e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("h2",{className:"text-base font-medium",children:[nn[o]," models"]}),e.jsxs(O,{size:"sm",onClick:()=>i({kind:"create",provider:o}),children:[e.jsx(Se,{className:"mr-1 h-4 w-4"}),"Add model"]})]}),d.length===0?e.jsx(Tn,{icon:wn,message:`No ${nn[o]} models configured.`}):e.jsx(Vt,{children:d.map(p=>e.jsx(Ar,{model:p,onEdit:()=>i({kind:"edit",id:p.id}),onDelete:()=>{n.confirmDialog(`Delete model "${p.label}"?`)&&a.onDelete(p.id)}},p.id))})]},o)})})}function Ar({model:t,onEdit:a,onDelete:n}){var r,l;return e.jsxs("li",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"font-medium",children:t.label}),e.jsx("span",{className:"font-mono text-xs text-muted-foreground",children:t.id})]}),e.jsxs("div",{className:"ml-auto flex items-center gap-2",children:[(((r=t.supportedEfforts)==null?void 0:r.length)??0)>0&&e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"effort"}),((l=t.supportedEfforts)==null?void 0:l.includes("max"))&&e.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs",children:"max"}),e.jsx(Kt,{label:t.label,onEdit:a,onDelete:n})]})]})}function Ir({initial:t,existing:a,handlers:n,onDone:r}){const l=we(S=>S.editorForm),f=we(S=>S.patchEditorForm),i=we(S=>S.toggleSupportedEffort),o=N.useCallback(S=>{Tr(S)&&f({modelProvider:S})},[f]),{id:d,label:p,modelProvider:x,supportedEfforts:g,submitting:j,error:y}=l,v=t!==null,w=N.useMemo(()=>!v&&a.some(S=>S.id===d.trim()&&S.provider===x),[a,d,v,x]),I=d.trim().length>0&&p.trim().length>0&&!w&&!j,k=()=>$t({patch:f,save:async()=>{v&&t?await n.onUpdate(t.id,{label:p.trim(),supportedEfforts:g.length>0?g:null}):await n.onCreate({id:d.trim(),label:p.trim(),provider:x,...g.length>0?{supportedEfforts:g}:{}})},onDone:r,fallbackMessage:"Failed to save model"}),R=Bt({submitting:j,isEdit:v,addLabel:"Add model"});return e.jsxs("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e.jsx("h2",{className:"text-base font-medium",children:v?"Edit model":"Add model"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"Provider"}),e.jsxs(ee,{value:x,onValueChange:o,disabled:v,children:[e.jsx(te,{className:"min-w-[180px]",children:e.jsx(se,{})}),e.jsxs(ne,{children:[e.jsx($,{value:"claude",children:"Claude"}),e.jsx($,{value:"codex",children:"Codex"})]})]})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"Model ID"}),e.jsx(P,{value:d,onChange:S=>f({id:S.target.value}),placeholder:"claude-opus-4-9",disabled:v,className:"font-mono"}),w&&e.jsx("span",{className:"text-xs text-red-600",children:"A model with this id already exists."})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"Label"}),e.jsx(P,{value:p,onChange:S=>f({label:S.target.value}),placeholder:"Opus 4.9"})]}),x==="claude"&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("span",{className:"text-sm font-medium",children:"Supported effort levels"}),pn.map(S=>e.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2 text-sm",children:[e.jsx("input",{type:"checkbox",checked:g.includes(S.id),onChange:()=>i(S.id)}),e.jsx("span",{children:S.label})]},S.id))]}),y&&e.jsx("span",{className:"text-xs text-red-600",children:y}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{onClick:()=>{k()},disabled:!I,children:R}),e.jsx(O,{variant:"ghost",onClick:r,disabled:j,children:"Cancel"})]})]})}function _r(t){const a=W(Rt),n=Wt(Dr,t.state);return e.jsx(Pr,{models:a,handlers:n})}function an(t,a){return{shortcut:t,expansion:a,submitting:!1,error:null}}const Ke=be()(t=>({editing:{kind:"list"},editorForm:an("",""),setEditing:a=>t({editing:a}),resetEditorForm:(a,n)=>t({editorForm:an(a,n)}),patchEditorForm:a=>t(n=>({editorForm:{...n.editorForm,...a}}))})),Or=t=>({textSnippets:t}),Lr=/^\S{1,32}$/;function Rr({snippets:t,handlers:a,dom:n=dt}){const r=Ke(o=>o.editing),l=Ke(o=>o.setEditing),f=Ke(o=>o.resetEditorForm);function i(o){if(o.kind==="create")f("","");else if(o.kind==="edit"){const d=t.find(p=>p.id===o.id)??null;d&&f(d.shortcut,d.expansion)}l(o)}if(r.kind!=="list"){const o=r.kind==="edit"?t.find(d=>d.id===r.id)??null:null;return e.jsx(Fr,{initial:o,existing:t.map(d=>({id:d.id,shortcut:d.shortcut})),handlers:a,onDone:()=>l({kind:"list"})})}return e.jsxs("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("h2",{className:"text-base font-medium",children:"Text snippets"}),e.jsx("p",{className:"max-w-[65ch] text-sm text-muted-foreground",children:"Type a shortcut in the chat composer and press Tab to expand it into the full text. Handy for prompts you send often."})]}),e.jsxs(O,{size:"sm",onClick:()=>i({kind:"create"}),children:[e.jsx(Se,{className:"mr-1 h-4 w-4"}),"Add snippet"]})]}),t.length===0?e.jsx(Tn,{icon:En,message:"No snippets yet. Add one to expand a shortcut with Tab."}):e.jsx(Vt,{children:t.map(o=>e.jsx(Ur,{snippet:o,onEdit:()=>i({kind:"edit",id:o.id}),onDelete:()=>{n.confirmDialog(`Delete snippet "${o.shortcut}"?`)&&a.onDelete(o.id)}},o.id))})]})}function Ur({snippet:t,onEdit:a,onDelete:n}){return e.jsxs("li",{className:"flex items-center gap-3 px-4 py-3",children:[e.jsxs("div",{className:"flex min-w-0 flex-col gap-0.5",children:[e.jsx("span",{className:"font-mono text-sm",children:t.shortcut}),e.jsx("span",{className:"truncate text-xs text-muted-foreground",children:t.expansion})]}),e.jsx("div",{className:"ml-auto flex items-center gap-2",children:e.jsx(Kt,{label:t.shortcut,onEdit:a,onDelete:n})})]})}function Fr({initial:t,existing:a,handlers:n,onDone:r}){const l=Ke(k=>k.editorForm),f=Ke(k=>k.patchEditorForm),{shortcut:i,expansion:o,submitting:d,error:p}=l,x=t!==null,g=i.trim(),j=Lr.test(g),y=N.useMemo(()=>a.some(k=>k.shortcut===g&&k.id!==(t==null?void 0:t.id)),[a,g,t==null?void 0:t.id]),v=j&&!y&&o.length>0&&!d,w=()=>$t({patch:f,save:async()=>{x&&t?await n.onUpdate(t.id,{shortcut:g,expansion:o}):await n.onCreate({shortcut:g,expansion:o})},onDone:r,fallbackMessage:"Failed to save snippet"}),I=Bt({submitting:d,isEdit:x,addLabel:"Add snippet"});return e.jsxs("div",{className:"flex flex-col gap-4 px-6 py-6",children:[e.jsx("h2",{className:"text-base font-medium",children:x?"Edit snippet":"Add snippet"}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"Shortcut"}),e.jsx(P,{value:i,onChange:k=>f({shortcut:k.target.value}),placeholder:"pgm",className:"font-mono",autoFocus:!0}),i.length>0&&!j&&e.jsx("span",{className:"text-xs text-destructive",children:"Shortcut must be 1-32 characters with no spaces."}),y&&e.jsx("span",{className:"text-xs text-destructive",children:"A snippet with this shortcut already exists."})]}),e.jsxs("label",{className:"flex flex-col gap-1",children:[e.jsx("span",{className:"text-sm font-medium",children:"Expands to"}),e.jsx(Ce,{value:o,onChange:k=>f({expansion:k.target.value}),placeholder:"pull request green then merge",rows:4})]}),p&&e.jsx("span",{className:"text-xs text-destructive",children:p}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(O,{onClick:()=>{w()},disabled:!v,children:I}),e.jsx(O,{variant:"ghost",onClick:r,disabled:d,children:"Cancel"})]})]})}function zr(t){const a=W(Ma),n=Wt(Or,t.state);return e.jsx(Rr,{snippets:a,handlers:n})}function Vr(t){if(!t)return"—";const a=t.trim();if(!a)return"—";const n=a.slice(-4);return`${a.startsWith("sk-ant-")?"sk-ant-":""}…${n}`}const le=be()(t=>({addLabel:"",addToken:"",addSubmitting:!1,tokenRowStates:{},setAddLabel:a=>t({addLabel:a}),setAddToken:a=>t({addToken:a}),setAddSubmitting:a=>t({addSubmitting:a}),resetAddForm:()=>t({addLabel:"",addToken:""}),setTokenRowTesting:(a,n)=>t(r=>({tokenRowStates:{...r.tokenRowStates,[a]:{...r.tokenRowStates[a]??{testResult:null,testing:!1},testing:n}}})),setTokenRowTestResult:(a,n)=>t(r=>({tokenRowStates:{...r.tokenRowStates,[a]:{...r.tokenRowStates[a]??{testResult:null,testing:!1},testResult:n}}})),clearTokenRowState:a=>t(n=>{const{[a]:r,...l}=n.tokenRowStates;return{tokenRowStates:l}})}));function Kr(t){if(t<=0)return"reset now";const a=Math.ceil(t/1e3),n=Math.floor(a/60),r=a%60;if(n<60)return`reset in ${n}m ${r.toString().padStart(2,"0")}s`;const l=Math.floor(n/60),f=n%60;return`reset in ${l}h ${f.toString().padStart(2,"00")}m`}function Wr({entry:t,now:a}){if(t.status==="active")return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/50","aria-hidden":"true"}),"Active"]});if(t.status==="limited"){const r=t.limitedUntil!==null?Kr(t.limitedUntil-a):null;return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-amber-600 dark:text-amber-400",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-amber-500","aria-hidden":"true"}),"Limited",r!==null&&e.jsxs(e.Fragment,{children:[" ","(",e.jsx("span",{className:"tabular-nums",children:r}),")"]})]})}if(t.status==="disabled")return e.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground/60",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-muted-foreground/30","aria-hidden":"true"}),"Disabled"]});const n=t.lastErrorMessage??"Unknown error";return e.jsx(jn,{children:e.jsxs(Nn,{children:[e.jsx(yn,{asChild:!0,children:e.jsxs("span",{className:"inline-flex cursor-default items-center gap-1.5 text-xs text-destructive",children:[e.jsx("span",{className:"size-1.5 rounded-full bg-destructive","aria-hidden":"true"}),"Error",e.jsx("span",{className:"sr-only",children:n})]})}),e.jsx(kn,{"aria-hidden":"true",children:n})]})})}function $r({entry:t,now:a,isCurrent:n,concurrencyDefault:r,onRemove:l,onToggleDisabled:f,onTest:i,onChangeMaxConcurrent:o,ports:d}){const p=(d==null?void 0:d.timer)??vn,x=le(S=>S.tokenRowStates),g=le(S=>S.setTokenRowTesting),j=le(S=>S.setTokenRowTestResult),y=x[t.id],v=(y==null?void 0:y.testResult)??null,w=(y==null?void 0:y.testing)??!1,I=async()=>{g(t.id,!0),j(t.id,null);try{const S=await i(t.token),V=S.ok?"OK":S.error??"Error";j(t.id,V),p.setTimeout(()=>j(t.id,null),3e3)}catch{j(t.id,"Error"),p.setTimeout(()=>j(t.id,null),3e3)}finally{g(t.id,!1)}},k=t.status==="disabled",R=t.maxConcurrent??r;return e.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border py-3",children:[e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:`text-sm font-medium ${k?"text-muted-foreground/60":"text-foreground"}`,children:t.label}),e.jsx("code",{className:"text-xs font-mono text-muted-foreground",children:Vr(t.token)}),n&&e.jsx("span",{className:"inline-flex shrink-0 items-center whitespace-nowrap rounded-full border border-primary/40 bg-primary/10 px-1.5 py-0.5 text-xs font-medium tracking-wide text-primary",children:"In use"})]}),e.jsx("div",{className:"mt-0.5",children:e.jsx(Wr,{entry:t,now:a})})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx(Ee,{label:"Maximum concurrent chats sharing this OAuth token. Higher = risks Anthropic rate limits.",children:e.jsxs("label",{className:"inline-flex items-center gap-1 text-xs text-muted-foreground",children:[e.jsx("span",{children:"Concurrent"}),e.jsx(P,{type:"number",value:R,onChange:S=>o(t.id,bn(Number(S.target.value))),min:_t,"aria-label":"Max concurrent chats",className:"h-7 w-14 text-xs",disabled:k})]})}),v!==null&&e.jsx("span",{className:"text-xs text-muted-foreground",children:v}),e.jsxs("button",{type:"button","aria-label":"Test",onClick:I,disabled:w||k,className:"inline-flex items-center gap-1 rounded px-2 py-1 text-xs text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(Dl,{className:"size-3","aria-hidden":"true"}),"Test"]}),e.jsx(jn,{children:e.jsxs(Nn,{children:[e.jsx(yn,{asChild:!0,children:e.jsxs("button",{type:"button","aria-label":k?"Enable":"Disable",onClick:f,className:"rounded p-1 text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[k?e.jsx(Fl,{className:"size-3.5","aria-hidden":"true"}):e.jsx(Rl,{className:"size-3.5","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:k?"Enable":"Disable"})]})}),e.jsx(kn,{children:k?"Enable":"Disable"})]})}),e.jsxs("button",{type:"button","aria-label":"Remove",onClick:l,className:"rounded p-1 text-muted-foreground transition-colors hover:text-destructive focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[e.jsx(Ut,{className:"size-3.5","aria-hidden":"true"}),e.jsx("span",{className:"sr-only",children:"Remove"})]})]})]})}function Br({tokens:t,onWrite:a}){const n=le(g=>g.addLabel),r=le(g=>g.addToken),l=le(g=>g.addSubmitting),f=le(g=>g.setAddLabel),i=le(g=>g.setAddToken),o=le(g=>g.setAddSubmitting),d=le(g=>g.resetAddForm),p=n.trim().length>0&&r.trim().length>0&&!l,x=async()=>{if(p){o(!0);try{const g={id:crypto.randomUUID(),label:n.trim(),token:r.trim(),status:"active",limitedUntil:null,lastUsedAt:null,lastErrorAt:null,lastErrorMessage:null,addedAt:Date.now()};await a({tokens:[...t,g]}),d()}finally{o(!1)}}};return e.jsx("div",{className:"border-t border-border pt-4",children:e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-end sm:gap-3",children:[e.jsx("div",{className:"flex-1",children:e.jsx(P,{value:n,onChange:g=>f(g.target.value),placeholder:"e.g. personal",maxLength:64,className:"text-sm","aria-label":"Token label"})}),e.jsx("div",{className:"flex-[2]",children:e.jsx(P,{value:r,onChange:g=>i(g.target.value),type:"password",placeholder:"sk-ant-...",maxLength:1024,className:"text-sm font-mono","aria-label":"OAuth token"})}),e.jsx("button",{type:"button",onClick:x,disabled:!p,className:"inline-flex shrink-0 items-center rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",children:"Add token"})]})})}function Hr({tokens:t,concurrencyDefault:a,onWrite:n,onTest:r,now:l,ports:f}){var j;const i=l??Date.now(),o=((j=t.reduce((y,v)=>v.lastUsedAt!==null&&(y===null||v.lastUsedAt>(y.lastUsedAt??0))?v:y,null))==null?void 0:j.id)??null,d=y=>{n({tokens:t.filter(v=>v.id!==y)})},p=y=>{n({tokens:t.map(v=>v.id===y?{...v,status:v.status==="disabled"?"active":"disabled"}:v)})},x=(y,v)=>{n({tokens:t.map(w=>w.id===y?{...w,maxConcurrent:v}:w)})},g=y=>{n({concurrencyDefault:bn(y)})};return e.jsxs("div",{children:[e.jsxs("div",{className:"flex items-center justify-between gap-3 pb-3",children:[e.jsx(Ee,{label:"Default concurrent-chat cap applied to any OAuth token whose row does not override it. Sharing across N chats burns Anthropic quota and risks 429s.",children:e.jsxs("label",{className:"flex flex-col gap-0.5 text-sm",children:[e.jsx("span",{className:"font-medium text-foreground",children:"Default concurrency per token"}),e.jsxs("span",{className:"text-xs text-muted-foreground",children:["Cap for tokens without an explicit per-row override. Minimum ",_t,", no upper limit."]})]})}),e.jsx(P,{type:"number",value:a,onChange:y=>g(Number(y.target.value)),min:_t,"aria-label":"Default concurrency per token",className:"h-8 w-16 text-sm"})]}),t.map(y=>e.jsx($r,{entry:y,now:i,isCurrent:y.id===o,concurrencyDefault:a,onRemove:()=>d(y.id),onToggleDisabled:()=>p(y.id),onTest:r,onChangeMaxConcurrent:x,ports:f},y.id)),e.jsx(Br,{tokens:t,onWrite:n})]})}const An="always",In="funk",Gr=[{value:"blow",label:"Blow"},{value:"bottle",label:"Bottle"},{value:"frog",label:"Frog"},{value:"funk",label:"Funk"},{value:"glass",label:"Glass"},{value:"ping",label:"Ping"},{value:"pop",label:"Pop"},{value:"purr",label:"Purr"},{value:"tink",label:"Tink"}];function Yr(t){switch(t){case"never":case"unfocused":case"always":return t;default:return An}}function qr(t){switch(t){case"blow":case"bottle":case"frog":case"funk":case"glass":case"ping":case"pop":case"purr":case"tink":return t;default:return In}}const ln=be()(t=>({chatSoundPreference:An,chatSoundId:In,setChatSoundPreference:a=>t({chatSoundPreference:Yr(a)}),setChatSoundId:a=>t({chatSoundId:qr(a)})})),rn="inline-flex items-center justify-center rounded-lg border border-border bg-background px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted",Xr="inline-flex items-center justify-center rounded-lg bg-foreground px-3 py-1.5 text-sm font-medium text-background transition-colors hover:bg-foreground/90",ke="rounded bg-muted px-1 py-0.5 font-mono text-12 text-foreground",At="text-xs font-medium tracking-wide text-muted-foreground";function Qr(t){const{permissionState:a}=t;if(a==="unsupported")return e.jsx("p",{className:"text-sm text-muted-foreground",children:"Push notifications are not supported in this browser."});if(a==="insecure-context")return e.jsxs("p",{className:"text-sm text-muted-foreground",children:["Push requires HTTPS. Run ",e.jsx("code",{className:ke,children:"kanna --share"})," or open Kanna over a tunnel, then enable on this device."]});if(a==="denied")return e.jsx("p",{className:"text-sm text-muted-foreground",children:"You blocked notifications for this site. Re-enable them in your browser settings, then reload."});if(!(a==="granted"&&t.config.devices.some(d=>d.id===t.currentDeviceId)))return e.jsx("button",{type:"button",onClick:()=>void t.onEnable(),className:Xr,children:"Enable on this device"});const r=new Set(t.config.preferences.mutedProjectPaths),l=t.contactSubjectDraft.trim(),f=Gl(l),i=l!==t.contactSubject,o=()=>{f&&i&&t.onContactSubjectSave(l)};return e.jsxs("div",{className:"flex w-full min-w-0 flex-col gap-5 md:w-[440px]",children:[e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsxs("span",{className:"inline-flex items-center gap-2 rounded-full border border-border bg-card/40 px-3 py-1 text-xs font-medium text-foreground",children:[e.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500","aria-hidden":!0}),"Enabled on this device"]}),e.jsx("button",{type:"button",onClick:()=>void t.onTest(),className:rn,children:"Send test"}),e.jsx("button",{type:"button",onClick:()=>void t.onDisable(),className:rn,children:"Disable"})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:At,children:"Contact for delivery"}),e.jsx(P,{type:"text",inputMode:"email",spellCheck:!1,autoCapitalize:"none",value:t.contactSubjectDraft,onChange:d=>t.onContactSubjectDraftChange(d.target.value),onBlur:o,onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),o())},placeholder:"mailto:you@example.com","aria-label":"Push contact subject","aria-invalid":l!==""&&!f,className:oe("font-mono",l!==""&&!f&&"border-destructive")}),l!==""&&!f?e.jsxs("p",{className:"text-xs text-destructive",children:["Must be a ",e.jsx("code",{className:ke,children:"mailto:"})," address or"," ",e.jsx("code",{className:ke,children:"https:"})," URL with a routable domain (not localhost)."]}):e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Push services require a contact ",e.jsx("code",{className:ke,children:"mailto:"})," or"," ",e.jsx("code",{className:ke,children:"https:"})," URL to sign notifications. Set your own so delivery isn’t rejected."]})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:At,children:"Devices"}),e.jsx("ul",{className:"flex flex-col gap-1.5",children:t.config.devices.map(d=>e.jsxs("li",{className:"flex items-start justify-between gap-3 rounded-lg border border-border bg-card/40 px-3 py-2",children:[e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:d.label}),e.jsx("span",{className:"line-clamp-2 break-all text-xs leading-snug text-muted-foreground",children:d.userAgent})]}),!d.isCurrentDevice&&e.jsx("button",{type:"button",onClick:()=>void t.onRemoveDevice(d.id),"aria-label":`Remove ${d.label}`,className:"shrink-0 rounded-md border border-border bg-background px-2 py-1 text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:"Remove"})]},d.id))})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx("div",{className:At,children:"Per-project"}),e.jsx("ul",{className:"flex flex-col",children:t.projects.map(d=>e.jsx("li",{children:e.jsxs("label",{className:"flex cursor-pointer items-center gap-3 rounded-md px-2 py-1.5 transition-colors hover:bg-muted/50",children:[e.jsx("input",{type:"checkbox",checked:!r.has(d.localPath),onChange:p=>void t.onMuteToggle(d.localPath,!p.target.checked),className:"h-4 w-4 shrink-0 rounded border-border accent-foreground"}),e.jsx(Ta,{inline:!0,className:"min-w-0 flex-1 font-mono text-12 text-foreground",tooltip:d.localPath,children:d.localPath})]})},d.localPath))})]}),e.jsxs("p",{className:"text-xs leading-relaxed text-muted-foreground",children:["Phone setup: this page must be reachable over HTTPS. Run"," ",e.jsx("code",{className:ke,children:"kanna --share"})," or open Kanna over your tunnel on the phone, then enable on that device."]})]})}function Zr(t){return t==="openai"?Wl:t==="openrouter"?fn:""}function Jr(t,a){return{...t,provider:a,model:Zr(a),baseUrl:a==="custom"?t.baseUrl:""}}const eo=[],to=[],so=[],no={},ao={},m=be()((t,a)=>({changelogPendingAction:null,skillQuery:"",skillResults:eo,skillSearchLoading:!1,skillSearchError:null,installedSkills:to,installedSkillIds:new Set,installedLoading:!1,installedError:null,skillOperationError:null,installingSkillId:null,uninstallingSkillId:null,installMessages:ao,globalInstructionsDraft:"",globalInstructionsPersistedAtMount:"",globalInstructionsSaving:!1,globalInstructionsError:null,changelogStatus:"idle",signingOut:!1,authEnabled:!1,releases:so,changelogError:null,pushPermissionState:Cn().state,pushDeviceId:Pa(),scrollbackDraft:"",minColumnWidthDraft:"",tabMinWidthDraft:"",uploadMaxFileSizeDraft:"",claudeIdleMinutesDraft:"",claudeMaxConcurrentDraft:"",editorCommandDraft:"",keybindingDrafts:no,keybindingsError:null,appSettingsError:null,analyticsDialogOpen:!1,tunnelError:null,cloudflaredPathDraft:"",pushContactSubjectDraft:"",shareDefaultTtlDraft:"",llmProviderDraft:{provider:"openai",apiKey:"",model:"",baseUrl:""},llmProviderError:null,llmValidationStatus:"idle",llmValidationError:null,llmValidationDialogOpen:!1,setChangelogPendingAction:n=>t({changelogPendingAction:n}),setSkillQuery:n=>t({skillQuery:n}),setSkillResults:n=>t({skillResults:n}),setSkillSearchLoading:n=>t({skillSearchLoading:n}),setSkillSearchError:n=>t({skillSearchError:n}),setInstalledSkills:n=>t({installedSkills:n}),setInstalledSkillIds:n=>t({installedSkillIds:n}),addInstalledSkillId:n=>{const r=a().installedSkillIds,l=new Set(r);l.add(n),t({installedSkillIds:l})},removeInstalledSkillId:n=>{const r=a().installedSkillIds,l=new Set(r);l.delete(n),t({installedSkillIds:l})},setInstalledLoading:n=>t({installedLoading:n}),setInstalledError:n=>t({installedError:n}),setSkillOperationError:n=>t({skillOperationError:n}),setInstallingSkillId:n=>t({installingSkillId:n}),setUninstallingSkillId:n=>t({uninstallingSkillId:n}),setInstallMessages:n=>t({installMessages:n}),setInstallMessage:(n,r)=>{const l=a().installMessages;t({installMessages:{...l,[n]:r}})},clearInstallMessage:n=>{const l={...a().installMessages};delete l[n],t({installMessages:l})},clearInstallMessagesForSkill:n=>{const l={...a().installMessages};for(const f of Object.keys(l))(f.endsWith(`/${n}`)||f===n)&&delete l[f];t({installMessages:l})},setGlobalInstructionsDraft:n=>t({globalInstructionsDraft:n}),setGlobalInstructionsPersistedAtMount:n=>t({globalInstructionsPersistedAtMount:n}),setGlobalInstructionsSaving:n=>t({globalInstructionsSaving:n}),setGlobalInstructionsError:n=>t({globalInstructionsError:n}),setChangelogStatus:n=>t({changelogStatus:n}),setSigningOut:n=>t({signingOut:n}),setAuthEnabled:n=>t({authEnabled:n}),setReleases:n=>t({releases:n}),setChangelogError:n=>t({changelogError:n}),setPushPermissionState:n=>t({pushPermissionState:n}),setPushDeviceId:n=>t({pushDeviceId:n}),setScrollbackDraft:n=>t({scrollbackDraft:n}),setMinColumnWidthDraft:n=>t({minColumnWidthDraft:n}),setTabMinWidthDraft:n=>t({tabMinWidthDraft:n}),setUploadMaxFileSizeDraft:n=>t({uploadMaxFileSizeDraft:n}),setClaudeIdleMinutesDraft:n=>t({claudeIdleMinutesDraft:n}),setClaudeMaxConcurrentDraft:n=>t({claudeMaxConcurrentDraft:n}),setEditorCommandDraft:n=>t({editorCommandDraft:n}),setKeybindingDrafts:n=>t({keybindingDrafts:n}),setKeybindingDraft:(n,r)=>t(l=>l.keybindingDrafts[n]===r?l:{keybindingDrafts:{...l.keybindingDrafts,[n]:r}}),setKeybindingsError:n=>t({keybindingsError:n}),setAppSettingsError:n=>t({appSettingsError:n}),setAnalyticsDialogOpen:n=>t({analyticsDialogOpen:n}),setTunnelError:n=>t({tunnelError:n}),setCloudflaredPathDraft:n=>t({cloudflaredPathDraft:n}),setPushContactSubjectDraft:n=>t({pushContactSubjectDraft:n}),setShareDefaultTtlDraft:n=>t({shareDefaultTtlDraft:n}),setLlmProviderDraft:n=>t({llmProviderDraft:n}),setLlmProviderError:n=>t({llmProviderError:n}),setLlmValidationStatus:n=>t({llmValidationStatus:n}),setLlmValidationError:n=>t({llmValidationError:n}),setLlmValidationDialogOpen:n=>t({llmValidationDialogOpen:n})})),Fe=[{id:"general",label:"General",icon:hl,subtitle:"Manage appearance, editor behavior, and embedded terminal defaults."},{id:"skills",label:"Skills",icon:Ys,subtitle:"Manage globally installed agent skills from the active skill lock file."},{id:"providers",label:"Providers",icon:Xs,subtitle:"Manage the default chat provider and saved model defaults for Claude Code and Codex."},{id:"models",label:"Models",icon:wn,subtitle:"Add, edit, and remove Claude and Codex models available in the model picker."},{id:"subagents",label:"Subagents",icon:Ft,subtitle:"Define reusable agent personas. Mention them in chat with @agent/<name>."},{id:"mcp-servers",label:"MCP servers",icon:Sn,subtitle:"Install custom MCP servers (stdio, http, sse, ws) and connect-test them."},{id:"snippets",label:"Text snippets",icon:En,subtitle:"Define shortcuts that expand to full text in the chat composer with Tab."},{id:"instructions",label:"Instructions",icon:Xs,subtitle:"Global instructions appended to every Claude and Codex turn (main + subagents)."},{id:"keybindings",label:"Keybindings",icon:wl,subtitle:"Edit global app shortcuts stored in the active keybindings file."},{id:"changelog",label:"Changelog",icon:Ys,subtitle:"Release notes pulled from the public GitHub releases feed."}];function on(t){var a;return t?((a=Fe.find(n=>n.id===t))==null?void 0:a.id)??null:null}const lo=[{value:"light",label:"Light",icon:Vl},{value:"dark",label:"Dark",icon:_l},{value:"system",label:"System",icon:jl}],ro=[{value:"sm",label:"Small"},{value:"md",label:"Default"},{value:"lg",label:"Large"},{value:"xl",label:"Extra Large"},{value:"xxl",label:"XX-Large"}],oo=[{value:"never",label:"Never"},{value:"unfocused",label:"When Unfocused"},{value:"always",label:"Always"}],dn=[{value:"disabled",label:"Off"},{value:"enabled",label:"On"}],io=[{value:"disabled",label:"Off"},{value:"enabled",label:"On"}],co=[{value:"always-ask",label:"Always ask"},{value:"auto-expose",label:"Auto-expose"}],uo=[{value:"openai",label:"OpenAI"},{value:"openrouter",label:"OpenRouter"},{value:"custom",label:"Custom"}],mo=300*1e3;let fe=null;function xo(t){return`Edit global app shortcuts stored in ${t}.`}function cn(t,a){return t!==a}function Ao(){fe=null}function ho(){return fe?Date.now()>=fe.expiresAt?(fe=null,null):fe.releases:null}function fo(t){fe={releases:t,expiresAt:Date.now()+mo}}async function un(t,a){const n=a!=null&&a.force?null:ho();if(n)return n;const r=await t();return fo(r),r}function mn(t,a){const n=i=>i.trim().replace(/^v/i,"").split("-")[0].split(".").map(o=>Number.parseInt(o,10)).filter(o=>Number.isFinite(o)),r=n(t),l=n(a),f=Math.max(r.length,l.length);for(let i=0;i<f;i+=1){const o=r[i]??0,d=l[i]??0;if(o!==d)return o<d?-1:1}return 0}function go(t){if(!t)return"Unpublished";const a=new Date(t);return Number.isNaN(a.getTime())?"Unknown date":new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",year:"numeric"}).format(a)}const xn="__redeploy__";function po({status:t,releases:a,error:n,onRetry:r,updateSnapshot:l,currentVersion:f,onInstallUpdate:i,onCheckForUpdates:o,onForceReload:d}){var z;const p=m(T=>T.changelogPendingAction),x=m(T=>T.setChangelogPendingAction),g=(l==null?void 0:l.latestVersion)??((z=a[0])==null?void 0:z.tag_name)??"Unknown",j=(l==null?void 0:l.currentVersion)??f,y=(l==null?void 0:l.status)==="checking",v=(l==null?void 0:l.status)==="updating"||(l==null?void 0:l.status)==="restart_pending",w=v||p!==null,I=(l==null?void 0:l.updateAvailable)===!0,k=g.replace(/^v/i,""),R=j.replace(/^v/i,""),S=N.useCallback(async T=>{x(T);try{await i(T)}finally{x(null)}},[i,x]),V=N.useCallback(async()=>{x(xn);try{await d()}finally{x(null)}},[d,x]),K=p===xn||v;return e.jsxs("div",{className:"space-y-4",children:[t==="loading"||t==="idle"?e.jsx("div",{className:"flex min-h-[180px] items-center justify-center rounded-2xl border border-border bg-card/40 px-6 py-8 text-sm text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ie,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Loading release notes…"})]})}):null,t==="error"?e.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/5 px-6 py-5",children:e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Could not load changelog"}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:n??"Unable to load changelog."})]}),e.jsx("button",{type:"button",onClick:r,className:"rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground transition-colors hover:bg-muted",children:"Retry"})]})}):null,t==="success"&&a.length===0?e.jsxs("div",{className:"rounded-lg border border-border bg-card/30 px-6 py-8",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"No releases yet"}),e.jsx("div",{className:"mt-2 text-sm text-muted-foreground",children:"GitHub did not return any published releases for this repository."})]}):null,t==="success"?e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(Ve,{variant:"outline",onClick:()=>{V()},disabled:w,children:K?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-3.5 w-3.5 animate-spin"}),"Re-deploying…"]}):"Re-deploy"}),e.jsx(Ve,{variant:"outline",onClick:o,disabled:y||w,children:y?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-3.5 w-3.5 animate-spin"}),"Checking…"]}):"Check for updates"})]}):null,t==="success"&&a.length>0?a.map(T=>{var X,ae;const U=T.tag_name.replace(/^v/i,""),h=U===k,D=U===R;return e.jsxs("article",{className:oe("rounded-xl border bg-card/30 pl-6 pr-4 py-4",h?"border-border bg-muted":"border-border"),children:[e.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-3 ",children:[e.jsxs("div",{className:"flex flex-row items-center min-w-0 flex-1 gap-2 ",children:[e.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:((X=T.name)==null?void 0:X.trim())||T.tag_name}),e.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[e.jsx("span",{children:go(T.published_at)}),T.prerelease?e.jsx("span",{className:"rounded-full border border-border px-2.5 py-1 tracking-wide",children:"Prerelease"}):null]})]}),e.jsxs("div",{className:"flex flex-row items-center justify-end min-w-0 flex-1 gap-2 ",children:[e.jsx("a",{href:T.html_url,target:"_blank",rel:"noopener noreferrer","aria-label":"View release on GitHub",className:oe(Aa({variant:"ghost",size:"icon-sm"}),"h-11 w-11 md:h-8 md:w-8 shrink-0 rounded-md hover:!bg-transparent hover:border-border/0"),children:e.jsx(bo,{className:"h-4 w-4"})}),D?e.jsx("span",{className:oe("bg-transparent border border-border text-secondary-foreground","h-9 rounded-full px-3 text-sm","h-auto gap-1.5 px-3 py-1.5"),children:"Current"}):null,h&&I||!h&&!D?(()=>{const de=p===T.tag_name||v&&p===null;let H;h?H="Update":mn(U,R)<0?H="Rollback":H="Install";let Q;return h?Q="Updating…":mn(U,R)<0?Q="Rolling back…":Q="Installing…",e.jsx(Ve,{variant:"default",className:"",onClick:()=>{S(T.tag_name)},disabled:w,children:e.jsxs("div",{className:"flex flex-row items-center justify-center gap-2",children:[de?e.jsx(ie,{className:"size-4 animate-spin"}):e.jsx(kl,{className:"size-4"}),de?Q:H]})})})():null]})]}),(ae=T.body)!=null&&ae.trim()?e.jsx("div",{className:"prose prose-sm mt-5 max-w-none text-foreground dark:prose-invert",children:Ia(T.body)}):e.jsx("div",{className:"mt-5 text-sm text-muted-foreground",children:"No release notes were provided."})]},T.id)}):null]})}function bo({className:t}){return e.jsx("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:t,children:e.jsx("path",{d:"M12 .5C5.649.5.5 5.649.5 12A11.5 11.5 0 0 0 8.36 22.04c.575.106.785-.25.785-.556 0-.274-.01-1-.015-1.962-3.181.691-3.853-1.532-3.853-1.532-.52-1.322-1.27-1.674-1.27-1.674-1.038-.71.08-.695.08-.695 1.148.08 1.752 1.178 1.752 1.178 1.02 1.748 2.676 1.243 3.328.95.103-.738.399-1.243.725-1.53-2.54-.289-5.211-1.27-5.211-5.65 0-1.248.446-2.27 1.177-3.07-.118-.288-.51-1.45.112-3.024 0 0 .96-.307 3.145 1.173A10.91 10.91 0 0 1 12 6.03c.973.004 1.954.132 2.87.387 2.182-1.48 3.14-1.173 3.14-1.173.625 1.573.233 2.736.115 3.024.734.8 1.175 1.822 1.175 3.07 0 4.39-2.676 5.358-5.224 5.642.41.353.776 1.05.776 2.117 0 1.528-.014 2.761-.014 3.136 0 .309.207.668.79.555A11.502 11.502 0 0 0 23.5 12C23.5 5.649 18.351.5 12 .5Z"})})}function vo(t){return!t||t<=0?"0 installs":t>=1e6?`${(t/1e6).toFixed(1).replace(/\.0$/,"")}M installs`:t>=1e3?`${(t/1e3).toFixed(1).replace(/\.0$/,"")}K installs`:`${t} install${t===1?"":"s"}`}function jo({message:t}){return e.jsx("pre",{className:"max-w-full overflow-x-auto whitespace-pre-wrap rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-xs text-destructive",children:t})}function No({skill:t,uninstalling:a,onUninstall:n}){const r=t.source?`https://skills.sh/${t.source}/${t.name}`:null;return e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 rounded-lg border border-border bg-card/30 p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.name}),e.jsx("div",{className:"truncate text-xs text-muted-foreground",children:t.source||"Unknown source"})]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[r?e.jsx("a",{href:r,target:"_blank",rel:"noreferrer","aria-label":`View ${t.name} on skills.sh`,className:"touch-manipulation inline-flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(zt,{className:"h-4 w-4"})}):null,e.jsx("button",{type:"button","aria-label":`Uninstall ${t.name}`,disabled:a,onClick:n,className:"touch-manipulation inline-flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-destructive/10 hover:text-destructive disabled:pointer-events-none disabled:opacity-50",children:a?e.jsx(ie,{className:"h-4 w-4 animate-spin"}):e.jsx(Ut,{className:"h-4 w-4"})})]})]})}function yo({skill:t,installing:a,installed:n,message:r,onInstall:l}){let f;return n?f="Installed":a?f="Installing":f="Get",e.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-3 rounded-lg border border-border bg-card/30 p-3",children:[e.jsxs("div",{className:"min-w-0",children:[e.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.name}),e.jsxs("div",{className:"truncate text-xs text-muted-foreground",children:[t.source," · ",vo(t.installs)]}),n&&r?e.jsx("div",{className:"mt-1 truncate text-xs text-emerald-500",children:r}):null]}),e.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[e.jsx("a",{href:`https://skills.sh/${t.id}`,target:"_blank",rel:"noreferrer","aria-label":`View ${t.name} on skills.sh`,className:"touch-manipulation inline-flex h-8 w-8 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(zt,{className:"h-4 w-4"})}),e.jsxs(O,{type:"button",size:"sm",variant:n?"secondary":"default",disabled:a||n,onClick:l,className:"h-6 rounded-full px-2 text-xs",children:[a?e.jsx(ie,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):null,f]})]})]})}function ko({state:t,ports:a}){const n=(a==null?void 0:a.timer)??vn,r=t.socket,l=t.connectionStatus,f=m(c=>c.skillQuery),i=m(c=>c.setSkillQuery),o=m(c=>c.skillResults),d=m(c=>c.setSkillResults),p=m(c=>c.skillSearchLoading),x=m(c=>c.setSkillSearchLoading),g=m(c=>c.skillSearchError),j=m(c=>c.setSkillSearchError),y=m(c=>c.installedSkills),v=m(c=>c.setInstalledSkills),w=m(c=>c.installedSkillIds),I=m(c=>c.setInstalledSkillIds),k=m(c=>c.addInstalledSkillId),R=m(c=>c.removeInstalledSkillId),S=m(c=>c.installedLoading),V=m(c=>c.setInstalledLoading),K=m(c=>c.installedError),z=m(c=>c.setInstalledError),T=m(c=>c.skillOperationError),U=m(c=>c.setSkillOperationError),h=m(c=>c.installingSkillId),D=m(c=>c.setInstallingSkillId),X=m(c=>c.uninstallingSkillId),ae=m(c=>c.setUninstallingSkillId),de=m(c=>c.installMessages),H=m(c=>c.setInstallMessage),Q=m(c=>c.clearInstallMessage),De=m(c=>c.clearInstallMessagesForSkill),C=N.useCallback(async()=>{if(l!=="connected"){v([]),I(new Set),z(null),V(!1);return}try{V(!0),z(null);const c=await r.command({type:"skills.listInstalled"});v(c.skills),I(new Set(c.skills.map(B=>B.name)))}catch(c){v([]),I(new Set),z(c instanceof Error?c.message:"Unable to read installed skills.")}finally{V(!1)}},[l,r,v,I,z,V]);N.useEffect(()=>{C()},[l,C,r]),N.useEffect(()=>{const c=f.trim();if(c.length<2){d([]),j(null),x(!1);return}if(l!=="connected"){d([]),x(!1),j("Backend connection required.");return}let B=!1;x(!0),j(null);const Me=n.setTimeout(()=>{r.command({type:"skills.search",query:c,limit:100}).then(ve=>{B||d(ve.skills)}).catch(ve=>{B||(d([]),j(ve instanceof Error?ve.message:"Unable to search skills."))}).finally(()=>{B||x(!1)})},250);return()=>{B=!0,n.clearTimeout(Me)}},[l,f,r,d,j,x,n]);async function J(c){if(l!=="connected"){U("Backend connection required.");return}try{D(c.id),U(null),Q(c.id),await r.command({type:"skills.install",source:c.source,skillId:c.skillId}),k(c.skillId),H(c.id,"Installed globally"),C()}catch(B){U(B instanceof Error?B.message:"Install failed.")}finally{D(null)}}async function b(c){if(l!=="connected"){U("Backend connection required.");return}try{ae(c.name),U(null),await r.command({type:"skills.uninstall",skillId:c.name}),v(y.filter(B=>B.name!==c.name)),R(c.name),De(c.name),C()}catch(B){U(B instanceof Error?B.message:"Uninstall failed.")}finally{ae(null)}}let M;return y.length>0?M=e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:y.map(c=>e.jsx(No,{skill:c,uninstalling:X===c.name,onUninstall:()=>{b(c)}},`${c.source}/${c.name}`))}):S?M=null:M=e.jsx("div",{className:"rounded-lg border border-border bg-card/30 p-3 text-sm text-muted-foreground",children:"No global skills installed."}),e.jsxs("div",{className:"flex flex-col gap-6",children:[T?e.jsx(jo,{message:T}):null,e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Installed"}),S?e.jsx(ie,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"}):null]}),K?e.jsx("div",{className:"text-xs text-destructive",children:K}):null,M]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Discover"}),e.jsxs("div",{className:"flex h-10 items-center gap-2 rounded-lg border border-border bg-card/30 px-3",children:[e.jsx(vl,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),e.jsx("input",{type:"text",role:"searchbox",value:f,onChange:c=>i(c.target.value),placeholder:"Search skills",className:"min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-muted-foreground"}),f?e.jsx("button",{type:"button","aria-label":"Clear skills search",onClick:()=>i(""),className:"touch-manipulation inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:e.jsx(il,{className:"h-3.5 w-3.5"})}):null,p?e.jsx(ie,{className:"h-4 w-4 shrink-0 animate-spin text-muted-foreground"}):null]}),g?e.jsx("div",{className:"text-xs text-destructive",children:g}):null,e.jsx("div",{className:"grid gap-3 md:grid-cols-2",children:o.map(c=>e.jsx(yo,{skill:c,installing:h===c.id,installed:w.has(c.skillId),message:de[c.id],onInstall:()=>{J(c)}},c.id))}),!p&&!g&&f.trim().length>=2&&o.length===0?e.jsx("div",{className:"rounded-lg border border-border bg-card/30 p-3 text-sm text-muted-foreground",children:"No skills found."}):null]})]})}function A({title:t,description:a,children:n,bordered:r=!0,alignStart:l=!1}){return e.jsx("div",{className:r?"border-t border-border":void 0,children:e.jsxs("div",{className:oe("flex flex-col gap-4 py-5 md:flex-row md:justify-between md:gap-8",l?"md:items-start":"md:items-center"),children:[e.jsxs("div",{className:"min-w-0 max-w-xl",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:t}),e.jsx("div",{className:"mt-1 text-13 text-muted-foreground",children:a})]}),e.jsx("div",{className:"flex items-center justify-start md:shrink-0 md:justify-end",children:n})]})})}function Co({checked:t,onChange:a}){return e.jsxs("label",{className:"inline-flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",checked:t,onChange:n=>a(n.target.checked)}),"Enabled"]})}function Io(){return e.jsx("span",{children:"Cloudflare Tunnel"})}function wo({state:t}){const a=W(w=>{var I;return((I=w.settings)==null?void 0:I.globalPromptAppend)??""}),n=m(w=>w.globalInstructionsDraft),r=m(w=>w.setGlobalInstructionsDraft),l=m(w=>w.globalInstructionsPersistedAtMount),f=m(w=>w.globalInstructionsSaving),i=m(w=>w.setGlobalInstructionsSaving),o=m(w=>w.globalInstructionsError),d=m(w=>w.setGlobalInstructionsError);N.useEffect(()=>{a!==l&&m.setState({globalInstructionsPersistedAtMount:a,globalInstructionsDraft:a})},[a,l]);const p=n.replace(/\s+$/u,""),x=p.length>As,g=p!==a,j=f||x||!g,y=N.useCallback(async()=>{if(!j){d(null),i(!0);try{await t.handleWriteAppSettings({globalPromptAppend:p})}catch(w){d(w instanceof Error?w.message:String(w))}finally{i(!1)}}},[j,t,p,d,i]);let v;return f?v="Saving…":g?v="Save":v="Saved",e.jsx("div",{className:"border-b border-border",children:e.jsx(A,{title:"Global Instructions",description:"Appended to every Claude and Codex turn — including subagent turns. Kanna does not read CLAUDE.md or AGENTS.md from disk; paste your global instructions here. Leave blank to disable.",bordered:!1,alignStart:!0,children:e.jsxs("div",{className:"flex w-full flex-col gap-2 md:w-[420px]",children:[e.jsx("textarea",{value:n,onChange:w=>r(w.target.value),placeholder:"e.g. Always write tests before implementation. Prefer Tailwind classes over inline styles.",rows:8,"aria-label":"Global instructions",className:oe("min-h-[160px] w-full resize-y rounded-md border bg-background px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",x?"border-destructive":"border-input"),disabled:f}),e.jsxs("div",{className:"flex items-center justify-between text-xs",children:[e.jsxs("span",{className:x?"text-destructive":"text-muted-foreground",children:[p.length," / ",As," characters",x?" — over limit":""]}),e.jsx(O,{type:"button",size:"sm",onClick:()=>{y()},disabled:j,children:v})]}),o?e.jsx("div",{className:"text-xs text-destructive",children:o}):null]})})})}function _o({ports:t}={}){var Ss,Es,Ds,Ms,Ts;const a=(t==null?void 0:t.dom)??dt,n=_a(),{sectionId:r}=Oa(),l=La(),{theme:f,setTheme:i}=Ra(),o=m(s=>s.changelogStatus),d=m(s=>s.setChangelogStatus),p=m(s=>s.signingOut),x=m(s=>s.setSigningOut),g=m(s=>s.authEnabled),j=m(s=>s.setAuthEnabled),y=m(s=>s.releases),v=m(s=>s.setReleases),w=m(s=>s.changelogError),I=m(s=>s.setChangelogError),k=on(r)??"general",R=l.connectionStatus==="connecting"||!l.localProjectsReady,S=((Ss=l.localProjects)==null?void 0:Ss.machine.displayName)??"Unavailable",V=((Es=l.localProjects)==null?void 0:Es.projects.length)??0,K=Ua.split("/")[1]??"unknown",z=W(Fa),T=W(za),U=W(Va),h=W(Ka),D=nt(s=>s.setScrollbackLines),X=nt(s=>s.setMinColumnWidth),ae=nt(s=>s.setEditorPreset),de=nt(s=>s.setEditorCommandTemplate),H=W(Wa),Q=W($a),De=ln(s=>s.setChatSoundPreference),C=ln(s=>s.setChatSoundId),J=l.keybindings,b=W(s=>s.settings),M=l.llmProvider,c=at(s=>s.autoResumeOnRateLimit),B=at(s=>s.setAutoResumeOnRateLimit),Me=at(s=>s.typographyOverride),ve=at(s=>s.clearTypographyOverride),_n=W(s=>{var u;return(u=s.settings)==null?void 0:u.typography.scale}),On=cl(Me,_n),Ln=ye(s=>s.defaultProvider),je=ye(s=>s.providerDefaults),Rn=ye(s=>s.setDefaultProvider),Un=ye(s=>s.setProviderDefaultModel),Fn=ye(s=>s.setProviderDefaultModelOptions),zn=ye(s=>s.setProviderDefaultPlanMode),Ht=W(Rt),Gt=N.useMemo(()=>gn([...It],Ht),[Ht]),Te=N.useMemo(()=>Ba(J),[J]),Yt=Te.filePathDisplay||Ha(),Vn=m(s=>s.pushPermissionState),qt=m(s=>s.setPushPermissionState),We=m(s=>s.pushDeviceId),$e=m(s=>s.setPushDeviceId),Kn=N.useCallback(async()=>{if(!l.pushConfig)return;const s=await Ga({vapidPublicKey:l.pushConfig.vapidPublicKey,sendToServer:async u=>{const L=await l.socket.command({type:"push.subscribe",subscription:u.subscription,label:u.label,userAgent:u.userAgent});return dl(L.id),{id:L.id}}});$e(s)},[l.pushConfig,l.socket,$e]),Wn=N.useCallback(async()=>{We&&(await Ya({pushDeviceId:We,sendToServer:async s=>{await l.socket.command({type:"push.unsubscribe",pushDeviceId:s})}}),qa(),$e(null))},[We,l.socket,$e]),Xt=m(s=>s.scrollbackDraft),Be=m(s=>s.setScrollbackDraft),Qt=m(s=>s.minColumnWidthDraft),Zt=m(s=>s.tabMinWidthDraft),He=m(s=>s.setMinColumnWidthDraft),Ge=m(s=>s.setTabMinWidthDraft),Ye=(b==null?void 0:b.panes.tabMinWidth)??$s,Pe=(b==null?void 0:b.uploads.maxFileSizeMb)??Qs.maxFileSizeMb,Jt=m(s=>s.uploadMaxFileSizeDraft),Ae=m(s=>s.setUploadMaxFileSizeDraft),es=(b==null?void 0:b.claudeDriver.preference)??Is.preference,Ie=Math.round(((b==null?void 0:b.claudeDriver.lifecycle.idleTimeoutMs)??Ct.idleTimeoutMs)/6e4),_e=(b==null?void 0:b.claudeDriver.lifecycle.maxConcurrent)??Ct.maxConcurrent,ts=m(s=>s.claudeIdleMinutesDraft),Oe=m(s=>s.setClaudeIdleMinutesDraft),ss=m(s=>s.claudeMaxConcurrentDraft),Le=m(s=>s.setClaudeMaxConcurrentDraft),qe=m(s=>s.editorCommandDraft),ct=m(s=>s.setEditorCommandDraft),ut=m(s=>s.keybindingDrafts),mt=m(s=>s.setKeybindingDrafts),$n=m(s=>s.setKeybindingDraft),ns=m(s=>s.keybindingsError),Xe=m(s=>s.setKeybindingsError),as=m(s=>s.appSettingsError),_=m(s=>s.setAppSettingsError),Bn=m(s=>s.analyticsDialogOpen),xt=m(s=>s.setAnalyticsDialogOpen),ls=m(s=>s.tunnelError),rs=m(s=>s.setTunnelError),os=m(s=>s.cloudflaredPathDraft),ht=m(s=>s.setCloudflaredPathDraft),Hn=m(s=>s.pushContactSubjectDraft),ft=m(s=>s.setPushContactSubjectDraft),gt=(b==null?void 0:b.shareDefaultTtlHours)??24,is=m(s=>s.shareDefaultTtlDraft),pt=m(s=>s.setShareDefaultTtlDraft),Y=m(s=>s.llmProviderDraft),Ne=m(s=>s.setLlmProviderDraft),ds=m(s=>s.llmProviderError),cs=m(s=>s.setLlmProviderError),Qe=m(s=>s.llmValidationStatus),Ze=m(s=>s.setLlmValidationStatus),bt=m(s=>s.llmValidationError),Je=m(s=>s.setLlmValidationError),Gn=m(s=>s.llmValidationDialogOpen),vt=m(s=>s.setLlmValidationDialogOpen),E=l.updateSnapshot,F=l.handleWriteAppSettings,Yn=l.handleWriteCloudflareTunnel,qn=l.handleWriteClaudeAuth,Xn=l.handleTestOAuthToken,us=l.handleReadLlmProvider,Qn=l.handleWriteLlmProvider,Zn=l.handleValidateLlmProvider;let ce;(E==null?void 0:E.status)==="checking"?ce="Checking for updates…":(E==null?void 0:E.status)==="updating"?ce="Installing update…":(E==null?void 0:E.status)==="restart_pending"?ce="Restarting Kanna…":(E==null?void 0:E.status)==="available"?ce=`Update available${E.latestVersion?`: ${E.latestVersion}`:""}`:(E==null?void 0:E.status)==="up_to_date"?ce="Up to date":(E==null?void 0:E.status)==="error"?ce="Update check failed":ce="Not checked yet",N.useEffect(()=>{Be(String(z))},[z,Be]),N.useEffect(()=>{He(String(T))},[T,He]),N.useEffect(()=>{Ge(String(Ye))},[Ye,Ge]),N.useEffect(()=>{Ae(String(Pe))},[Pe,Ae]),N.useEffect(()=>{Oe(String(Ie))},[Ie,Oe]),N.useEffect(()=>{Le(String(_e))},[_e,Le]),N.useEffect(()=>{const s=()=>qt(Cn().state);return a.addWindowListener("focus",s)},[a,qt]),N.useEffect(()=>{ct(h)},[h,ct]),N.useEffect(()=>{mt(Object.fromEntries(Ot.map(s=>[s,wt(Te.bindings[s])])))},[Te,mt]),N.useEffect(()=>{M&&Ne({provider:M.provider,apiKey:M.apiKey,model:M.model,baseUrl:M.baseUrl})},[M,Ne]),N.useEffect(()=>{Ze("idle"),Je(null)},[Y.provider,Y.apiKey,Y.model,Y.baseUrl,Ze,Je]),N.useEffect(()=>{r&&(on(r)||n("/settings/general",{replace:!0}))},[n,r]),N.useEffect(()=>{b&&ht(b.cloudflareTunnel.cloudflaredPath)},[b,ht]),N.useEffect(()=>{b&&ft(b.push.contactSubject)},[b,ft]),N.useEffect(()=>{let s=!1;return Xa().then(u=>{s||j(u.enabled===!0)}).catch(()=>{s||j(!1)}),()=>{s=!0}},[j]),N.useEffect(()=>{k!=="providers"||R||us()},[us,R,k]);const jt=N.useCallback(()=>l.socket.command({type:"settings.getChangelog"}),[l.socket]);N.useEffect(()=>{if(k!=="changelog"||R)return;let s=!1;return d("loading"),I(null),un(jt).then(u=>{s||(v(u),d("success"))}).catch(u=>{s||(I(u instanceof Error?u.message:"Unable to load changelog."),d("error"))}),()=>{s=!0}},[R,k,d,I,v,jt]);function ms(){const s=Number(Xt);if(!Number.isFinite(s)){Be(String(z));return}D(s),F({terminal:{scrollbackLines:s}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save terminal settings.")})}function xs(){const s=Number(Qt);if(!Number.isFinite(s)){He(String(T));return}X(s),F({terminal:{minColumnWidth:s}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save terminal settings.")})}function hs(){const s=Number(Zt);if(!Number.isFinite(s)){Ge(String(Ye));return}F({panes:{tabMinWidth:pl(s)}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save pane settings.")})}function fs(){const s=Number(Jt);if(!Number.isFinite(s)||s<ot||s>it){Ae(String(Pe)),_(`Max file size must be between ${ot} and ${it} MB.`);return}if(Math.round(s)===Pe){Ae(String(Pe));return}F({uploads:{maxFileSizeMb:Math.round(s)}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save upload settings.")})}function Jn(s){s!==es&&F({claudeDriver:{preference:s}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save Claude driver preference.")})}function gs(){const s=Number(ts),u=Math.round(Et/6e4),L=Math.round(St/6e4);if(!Number.isFinite(s)||s<u||s>L){Oe(String(Ie)),_(`Idle timeout must be between ${u} and ${L} minutes.`);return}if(Math.round(s)===Ie){Oe(String(Ie));return}F({claudeDriver:{lifecycle:{idleTimeoutMs:Math.round(s)*6e4}}}).catch(Ue=>{_(Ue instanceof Error?Ue.message:"Unable to save Claude lifecycle settings.")})}function ps(){const s=Number(ss);if(!Number.isFinite(s)||s<rt||s>lt){Le(String(_e)),_(`Max concurrent sessions must be between ${rt} and ${lt}.`);return}if(Math.round(s)===_e){Le(String(_e));return}F({claudeDriver:{lifecycle:{maxConcurrent:Math.round(s)}}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save Claude lifecycle settings.")})}function bs(){const s=Number(is);if(!Number.isInteger(s)||s<1){pt(String(gt)),_("Default share link expiry must be a whole number of hours >= 1.");return}if(s===gt){pt(String(gt));return}F({shareDefaultTtlHours:s}).catch(u=>{_(u instanceof Error?u.message:"Unable to save share settings.")})}function me(s,u){s.key==="Enter"&&(u(),s.currentTarget.blur())}function Re(s,u){s.key==="Enter"&&(u(),s.currentTarget.blur())}function vs(){de(qe),F({editor:{commandTemplate:qe}}).catch(s=>{_(s instanceof Error?s.message:"Unable to save editor settings.")})}function ea(s){i(s),F({theme:s}).catch(u=>{_(u instanceof Error?u.message:"Unable to save theme settings.")})}function ta(s){F({typography:{scale:s}}).catch(u=>{_(u instanceof Error?u.message:"Unable to save typography settings.")})}function sa(s){ae(s);const u=s==="custom"?h:ul(s);F({editor:{preset:s,commandTemplate:u}}).catch(L=>{_(L instanceof Error?L.message:"Unable to save editor settings.")})}function na(s){cn(H,s)&&(De(s),F({chatSoundPreference:s}).catch(u=>{_(u instanceof Error?u.message:"Unable to save chat sound settings.")}),Ws(Q,1).catch(()=>{}))}function aa(s){cn(Q,s)&&(C(s),F({chatSoundId:s}).catch(u=>{_(u instanceof Error?u.message:"Unable to save chat sound settings.")}),Ws(s,1).catch(()=>{}))}async function la(s){try{_(null),await F({analyticsEnabled:s==="enabled"})}catch(u){_(u instanceof Error?u.message:"Unable to save analytics settings.")}}async function ra(s){try{_(null),await F({telemetry:{enabled:s==="enabled"}})}catch(u){_(u instanceof Error?u.message:"Unable to save telemetry settings.")}}async function Nt(s){try{rs(null),await Yn(s)}catch(u){rs(u instanceof Error?u.message:"Unable to save Cloudflare Tunnel settings.")}}function oa(s){Rn(s),F({defaultProvider:s}).catch(u=>{_(u instanceof Error?u.message:"Unable to save provider settings.")})}function js(s,u){Un(s,u),F({providerDefaults:{[s]:{model:u}}}).catch(L=>{_(L instanceof Error?L.message:"Unable to save provider settings.")})}function et(s,u){Fn(s,u),F({providerDefaults:{[s]:{modelOptions:u}}}).catch(L=>{_(L instanceof Error?L.message:"Unable to save provider settings.")})}function Ns(s,u){zn(s,u),F({providerDefaults:{[s]:{planMode:u}}}).catch(L=>{_(L instanceof Error?L.message:"Unable to save provider settings.")})}async function ys(){try{Xe(null),await l.socket.command({type:"settings.writeKeybindings",bindings:hn(ut)})}catch(s){Xe(s instanceof Error?s.message:"Unable to save keybindings.")}}async function ia(s){const u={...ut,[s]:wt(Lt[s])};mt(u);try{Xe(null),await l.socket.command({type:"settings.writeKeybindings",bindings:hn(u)})}catch(L){Xe(L instanceof Error?L.message:"Unable to save keybindings.")}}async function xe(s=Y){try{cs(null),await Qn(s);const u=await Zn(s);Ze(u.ok?"valid":"invalid"),Je(u.error)}catch(u){const L=u instanceof Error?{name:u.name,message:u.message}:u;Ze("invalid"),Je(L),cs(u instanceof Error?u.message:"Unable to save quick response provider settings.")}}function da(s){const u=Jr(Y,s);Ne(u),xe(u)}function ca(){fe=null,d("loading"),I(null),un(jt,{force:!0}).then(s=>{v(s),d("success")}).catch(s=>{I(s instanceof Error?s.message:"Unable to load changelog."),d("error")})}const ua=qe.replaceAll("{path}","/Users/jake/Projects/kanna/src/client/app/App.tsx").replaceAll("{line}","12").replaceAll("{column}","1"),ma=Yl,xa=(b==null?void 0:b.analyticsEnabled)===!1?"disabled":"enabled",ha=((Ds=b==null?void 0:b.telemetry)==null?void 0:Ds.enabled)===!1?"disabled":"enabled",yt=(b==null?void 0:b.cloudflareTunnel)??Hl,fa=yt.enabled?"enabled":"disabled",ks=Fe.find(s=>s.id===k)??Fe[0],ga=k==="keybindings"?xo(Yt):ks.subtitle,Cs=!R,pa=bt?JSON.stringify(bt,null,2):"";let tt;Qe==="valid"?tt="text-success":Qe==="invalid"?tt="text-destructive":tt="hidden";let st;Qe==="valid"?st="Credentials valid & saved":Qe==="invalid"?st=e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Credentials invalid."}),bt?e.jsxs(e.Fragment,{children:[" ",e.jsx("button",{type:"button",onClick:()=>vt(!0),className:"underline underline-offset-2",children:"See error"})]}):null]}):st=null;const ba=e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["Use an OpenAI-compatible API for title and commit message generation before Claude and Codex. Stored in ",(M==null?void 0:M.filePathDisplay)??"the active llm-provider.json file","."]}),e.jsx("span",{className:oe("mt-2 block text-sm font-medium",tt),children:st})]});async function ws(){if(!p){x(!0);try{await l.handleSignOut()}finally{x(!1)}}}return e.jsxs("div",{className:"relative flex h-full flex-1 min-w-0 bg-background",children:[e.jsxs("div",{className:"flex min-w-0 flex-1",children:[e.jsx("aside",{className:`hidden w-[200px] shrink-0 md:block ${Cs?"pb-[89px]":""}`,children:e.jsxs("div",{className:"flex flex-col gap-1 px-4 py-6",children:[e.jsx("div",{className:"px-3 pb-5 text-22 font-extrabold tracking-[-0.5px] text-foreground",children:"Settings"}),Fe.map(s=>{const u=s.id==="changelog"&&(E==null?void 0:E.updateAvailable)===!0;return e.jsx("button",{type:"button",onClick:()=>n(`/settings/${s.id}`),className:`cursor-pointer rounded-lg px-3 py-2 text-sm ${s.id===k?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/50 hover:text-foreground"}`,children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(s.icon,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:s.label}),u?e.jsx("span",{className:"ml-auto inline-flex items-center rounded-full bg-logo/20 px-2 py-0.5 text-xs font-bold tracking-wider text-logo",children:"UPDATE"}):null]})},s.label)}),g?e.jsx("button",{type:"button",onClick:()=>{ws()},disabled:p,className:"cursor-pointer rounded-lg px-3 py-2 text-sm text-muted-foreground hover:bg-muted/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(qs,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:p?"Signing out...":"Sign out"})]})}):null]})}),e.jsxs("div",{className:"min-w-0 flex-1 overflow-y-auto",children:[e.jsx("div",{className:"sticky top-0 z-20 border-b border-border bg-background px-2 py-2 md:hidden",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Ee,{label:"Open sidebar",children:e.jsx("button",{type:"button",onClick:l.openSidebar,className:"flex size-11 shrink-0 items-center justify-center rounded-md text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground","aria-label":"Open sidebar",children:e.jsx(Qa,{className:"h-4 w-4 shrink-0"})})}),e.jsxs(ee,{value:k,onValueChange:s=>n(`/settings/${s}`),children:[e.jsx(te,{className:"h-11 min-w-0 flex-1","aria-label":"Settings section",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsx(he,{children:Fe.map(s=>e.jsx($,{value:s.id,children:s.label},s.id))})})]}),g?e.jsxs("button",{type:"button",onClick:()=>{ws()},disabled:p,className:"flex min-h-11 shrink-0 items-center gap-2 rounded-md border border-border bg-background px-3 py-2 text-sm text-muted-foreground transition-colors hover:bg-muted/50 hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50",children:[e.jsx(qs,{className:"h-4 w-4 shrink-0"}),e.jsx("span",{className:"sr-only",children:p?"Signing out...":"Sign out"})]}):null]})}),e.jsxs("div",{className:"w-full px-4 pb-32 pt-8 md:px-6 md:pt-16",children:[R?e.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-2xl border border-border bg-card/40 px-4 py-6 text-sm text-muted-foreground",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(ie,{className:"h-4 w-4 animate-spin"}),e.jsx("span",{children:"Loading machine settings…"})]})}):e.jsxs("div",{className:"mx-auto max-w-4xl",children:[e.jsxs("div",{className:"pb-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 min-h-[34px]",children:[e.jsx("div",{className:"text-lg font-semibold tracking-[-0.2px] text-foreground",children:ks.label}),k==="general"?e.jsx(Ve,{variant:"outline",onClick:()=>n("/settings/changelog"),children:"Check for updates"}):null,k==="keybindings"?e.jsxs(Ve,{onClick:()=>{l.handleOpenExternalPath("open_editor",Yt)},icon:e.jsx(Za,{className:"h-4 w-4"}),children:["Open in ",l.editorLabel]}):null]}),e.jsx("div",{className:"mt-1 text-sm text-muted-foreground",children:ga})]}),k==="general"&&e.jsxs(e.Fragment,{children:[as?e.jsx("div",{className:"mb-4 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:as}):null,e.jsxs("div",{className:"border-b border-border",children:[e.jsx(A,{title:"Application Update",description:e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:[ce,"."]}),E!=null&&E.lastCheckedAt?e.jsxs("span",{children:[" Last checked ",new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}).format(E.lastCheckedAt),"."]}):null,E!=null&&E.error?e.jsxs("span",{children:[" ",E.error]}):null]}),bordered:!1,children:e.jsxs("div",{className:"text-right text-sm text-foreground",children:[e.jsxs("div",{children:["Current: ",(E==null?void 0:E.currentVersion)??K]}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Latest: ",(E==null?void 0:E.latestVersion)??"Unknown"]})]})}),e.jsx(A,{title:"Theme",description:"Choose between light, dark, or system appearance",children:e.jsx(Z,{value:f,onValueChange:ea,options:lo,size:"sm"})}),e.jsx(A,{title:"Typography Scale",description:Me?"This device uses its own text size instead of the account default.":"Choose how large text and UI elements appear across the app.",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsxs(ee,{value:On,onValueChange:s=>{Ja(s)&&ta(s)},children:[e.jsx(te,{className:"min-w-[180px]",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsx(he,{children:ro.map(s=>e.jsx($,{value:s.value,children:s.label},s.value))})})]}),Me?e.jsx(O,{type:"button",variant:"link",size:"sm",onClick:ve,children:"Use account default"}):null]})}),e.jsx(A,{title:"Chat Sounds",description:"Play a pop when a chat starts waiting on you or the unread chat count increases",children:e.jsxs(ee,{value:H,onValueChange:s=>{el(s)&&na(s)},children:[e.jsx(te,{className:"min-w-[180px]",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsx(he,{children:oo.map(s=>e.jsx($,{value:s.value,children:s.label},s.value))})})]})}),e.jsx(A,{title:"Chat Sound",description:"The bundled sound used for chat notification playback and previews",children:e.jsxs(ee,{value:Q,onValueChange:s=>{tl(s)&&aa(s)},children:[e.jsx(te,{className:"min-w-[180px]",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsx(he,{children:Gr.map(s=>e.jsx($,{value:s.value,children:s.label},s.value))})})]})}),e.jsx(A,{title:"Default Editor",description:"Used when opening transcript links or files from the git diff menu",alignStart:!0,children:e.jsxs(ee,{value:U,onValueChange:s=>{sl(s)&&sa(s)},children:[e.jsx(te,{className:"min-w-[180px]",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsx(he,{children:fl.map(s=>e.jsx($,{value:s.value,children:e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(gl,{preset:s.value,className:"h-4 w-4 shrink-0"}),e.jsx("span",{children:s.label})]})},s.value))})})]})}),U==="custom"?e.jsx("div",{className:"border-t border-border",children:e.jsxs("div",{className:"flex justify-between gap-8 py-5 pl-6",children:[e.jsxs("div",{className:"min-w-0 max-w-xl",children:[e.jsx("div",{className:"text-sm font-medium text-foreground",children:"Command Template"}),e.jsxs("div",{className:"mt-1 text-13 text-muted-foreground",children:["Include ","{path}"," and optionally ","{line}"," and ","{column}"," in your command."]})]}),e.jsxs("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:[e.jsx(P,{type:"text",value:qe,onChange:s=>ct(s.target.value),onBlur:vs,onKeyDown:s=>Re(s,vs),className:"font-mono"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Preview: ",e.jsx("span",{className:"font-mono",children:ua})]})]})]})}):null,e.jsx(A,{title:"Terminal Scrollback",description:"Lines retained for embedded terminal history",children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[e.jsx(P,{type:"number",min:Os,max:_s,step:100,value:Xt,onChange:s=>Be(s.target.value),onBlur:ms,onKeyDown:s=>me(s,ms),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),e.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Os,"-",_s," lines",z===nl?" (default)":""]})]})}),e.jsx(A,{title:"Terminal Min Column Width",description:"Minimum width for each terminal pane",children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[e.jsx(P,{type:"number",min:Rs,max:Ls,step:10,value:Qt,onChange:s=>He(s.target.value),onBlur:xs,onKeyDown:s=>me(s,xs),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),e.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Rs,"-",Ls," px",T===al?" (default)":""]})]})}),e.jsx(A,{title:"Tab Minimum Width",description:"How narrow a pane tab may get before the strip scrolls instead of shrinking",children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[e.jsx(P,{type:"number",min:Hs,max:Bs,step:10,value:Zt,onChange:s=>Ge(s.target.value),onBlur:hs,onKeyDown:s=>me(s,hs),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),e.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Hs,"-",Bs," px",Ye===$s?" (default)":""]})]})}),e.jsx(A,{title:"Max upload file size",description:"Largest single file the chat upload endpoint accepts.",children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-1.5 md:w-auto md:items-end",children:[e.jsxs("div",{className:"flex items-center gap-2 md:justify-end",children:[e.jsx(P,{type:"number",min:ot,max:it,step:1,value:Jt,onChange:s=>Ae(s.target.value),onBlur:fs,onKeyDown:s=>me(s,fs),className:"hide-number-steppers w-full text-left font-mono tabular-nums md:w-24 md:text-right","aria-label":"Max upload file size in megabytes"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"MB"})]}),e.jsxs("div",{className:"text-left text-xs text-muted-foreground tabular-nums md:text-right",children:[ot,"–",it," MB · default ",Qs.maxFileSizeMb]})]})}),e.jsx(A,{title:"Auto-resume on rate limit",description:'When you hit a rate limit, automatically schedule "continue" at the reset time instead of asking. You can still cancel each one from the chat.',children:e.jsx(Co,{checked:c,onChange:B})}),l.pushConfig?e.jsx(A,{title:"Push notifications",description:"Get notified when a chat is waiting for you, finishes, or fails. Works on iPhone (after Add to Home Screen), Android, and desktop browsers.",bordered:!1,alignStart:!0,children:e.jsx(Qr,{permissionState:Vn,config:l.pushConfig,projects:((Ms=l.localProjects)==null?void 0:Ms.projects)??[],currentDeviceId:We,contactSubject:(b==null?void 0:b.push.contactSubject)??"",contactSubjectDraft:Hn,onContactSubjectDraftChange:ft,onContactSubjectSave:async s=>{await l.socket.command({type:"settings.writeAppSettingsPatch",patch:{push:{contactSubject:s}}})},onEnable:Kn,onDisable:Wn,onTest:async()=>{await l.socket.command({type:"push.test"})},onMuteToggle:async(s,u)=>{await l.socket.command({type:"push.setProjectMute",localPath:s,muted:u})},onRemoveDevice:async s=>{await l.socket.command({type:"push.unsubscribe",pushDeviceId:s})}})}):null,e.jsx(A,{title:"Anonymous Analytics",description:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Help improve Kanna with anonymous product analytics. Kanna sends tracked event names plus a small set of event properties like current version, environment, update version info, and launch flags. No message content, prompts, file paths, or provider credentials are sent."}),e.jsxs("span",{className:"mt-1 block",children:["Stored in ",(b==null?void 0:b.filePathDisplay)??"~/.kanna/data/settings.json","."," ",e.jsx("button",{type:"button",onClick:()=>xt(!0),className:"underline underline-offset-2 text-foreground hover:text-foreground/80",children:"View tracked events"})]}),b!=null&&b.warning?e.jsx("span",{className:"mt-1 block",children:b.warning}):null]}),children:e.jsx(Z,{value:xa,onValueChange:s=>{la(s)},options:dn,size:"sm"})}),e.jsx(A,{title:"Telemetry Tracing",description:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Export OpenTelemetry traces and metrics (turn timings, subagent runs, process memory) to Kanna's observability collector so each install can be monitored. This machine reports under its computer name. Turning it off stops the export immediately."}),e.jsxs("span",{className:"mt-1 block",children:["Collector: ",((Ts=b==null?void 0:b.telemetry)==null?void 0:Ts.endpoint)??"not configured",". Stored in ",(b==null?void 0:b.filePathDisplay)??"~/.kanna/data/settings.json","."]})]}),children:e.jsx(Z,{value:ha,onValueChange:s=>{ra(s)},options:dn,size:"sm"})})]}),e.jsxs("div",{className:"border-b border-border",children:[ls?e.jsx("div",{className:"mb-4 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ls}):null,e.jsx(A,{title:"Cloudflare Tunnel",description:e.jsxs(e.Fragment,{children:[e.jsxs("span",{children:["When enabled, Claude can call the ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:"expose_port"})," tool to expose a local port via Cloudflare Tunnel. The mode below controls whether each call requires your approval or is exposed automatically. Requires"," ",e.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-xs",children:"cloudflared"})," ","to be installed."]}),e.jsxs("span",{className:"mt-1 block",children:["Stored in ",(b==null?void 0:b.filePathDisplay)??"~/.kanna/data/settings.json","."]})]}),bordered:!1,children:e.jsx(Z,{value:fa,onValueChange:s=>{Nt({enabled:s==="enabled"})},options:io,size:"sm"})}),yt.enabled&&e.jsxs(e.Fragment,{children:[e.jsx(A,{title:"Tool mode",description:"Always ask: each expose_port call shows an accept card. Auto-expose: expose_port calls spawn cloudflared immediately without prompting.",children:e.jsx(Z,{value:yt.mode,onValueChange:s=>{Nt({mode:s})},options:co,size:"sm"})}),e.jsx(A,{title:"cloudflared path",description:"Path to the cloudflared binary. Defaults to the one found on $PATH.",children:e.jsx(P,{value:os,onChange:s=>ht(s.target.value),onBlur:()=>{Nt({cloudflaredPath:os})},placeholder:"cloudflared",className:"w-full font-mono md:w-64"})})]})]}),e.jsx("div",{className:"border-b border-border",children:e.jsx(A,{title:"Public share links",description:"Default expiry for read-only chat share links. Owners can revoke any link manually at any time.",bordered:!1,children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[e.jsxs("div",{className:"flex items-center gap-2 md:justify-end",children:[e.jsx(P,{type:"number",min:1,step:1,value:is,onChange:s=>pt(s.target.value),onBlur:bs,onKeyDown:s=>me(s,bs),className:"hide-number-steppers w-full text-left font-mono tabular-nums md:w-24 md:text-right","aria-label":"Default share link expiry in hours"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"hours"})]}),e.jsx("div",{className:"text-left text-xs text-muted-foreground tabular-nums md:text-right",children:"Minimum 1 hour · default 24"})]})})})]}),k==="providers"&&e.jsxs("div",{className:"border-b border-border",children:[e.jsx(A,{title:"Claude OAuth tokens",description:"Manage multiple Claude OAuth tokens. Kanna switches automatically when one hits its rate limit.",bordered:!1,alignStart:!0,children:e.jsx("div",{className:"w-full md:w-[420px]",children:e.jsx(Hr,{tokens:(b==null?void 0:b.claudeAuth.tokens)??[],concurrencyDefault:(b==null?void 0:b.claudeAuth.concurrencyDefault)??1,onWrite:qn,onTest:Xn})})}),e.jsx(A,{title:"Claude driver",description:"SDK uses the @anthropic-ai/claude-agent-sdk programmatic API (billed at API rates). PTY launches the `claude` CLI under a pseudo-terminal — preserves Pro/Max subscription billing. Requires an OAuth-pool token configured in Kanna settings and ANTHROPIC_API_KEY to be unset. macOS/Linux only.",children:e.jsx(Z,{value:es,onValueChange:s=>{ll(s)&&Jn(s)},options:[{value:"sdk",label:"SDK (API)"},{value:"pty",label:"PTY (subscription)"}]})}),e.jsx(A,{title:"PTY idle timeout",description:"Stop a Claude PTY session after this many minutes without user activity. Lower values free subscription quota faster; higher values keep cold-start latency low.",children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[e.jsx(P,{type:"number",min:Math.round(Et/6e4),max:Math.round(St/6e4),step:1,value:ts,onChange:s=>Oe(s.target.value),onBlur:gs,onKeyDown:s=>me(s,gs),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),e.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[Math.round(Et/6e4),"–",Math.round(St/6e4)," min · default ",Math.round(Ct.idleTimeoutMs/6e4)]})]})}),e.jsx(A,{title:"PTY max concurrent sessions",description:"Hard cap on resident Claude PTY processes. Excess sessions are evicted LRU; their next activation cold-starts.",children:e.jsxs("div",{className:"flex w-full min-w-0 flex-col items-stretch gap-2 md:w-auto md:items-end",children:[e.jsx(P,{type:"number",min:rt,max:lt,step:1,value:ss,onChange:s=>Le(s.target.value),onBlur:ps,onKeyDown:s=>me(s,ps),className:"hide-number-steppers w-full text-left font-mono md:w-28 md:text-right"}),e.jsxs("div",{className:"text-left text-xs text-muted-foreground md:text-right",children:[rt,"–",lt," · default ",Is.lifecycle.maxConcurrent]})]})}),e.jsx(A,{title:"Default Provider",description:"The default harness used for new chats before a provider is locked by an existing session.",children:e.jsxs(ee,{value:Ln,onValueChange:s=>{(s==="last_used"||Dn(s))&&oa(s)},children:[e.jsx(te,{className:"min-w-[180px]",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsxs(he,{children:[e.jsx($,{value:"last_used",children:"Last Used"}),It.map(s=>e.jsx($,{value:s.id,children:s.label},s.id))]})})]})}),e.jsx(A,{title:"Claude Code Defaults",description:"Saved defaults when using Claude Code.",alignStart:!0,children:e.jsx("div",{className:"max-w-[420px]",children:e.jsx(Gs,{availableProviders:Gt,selectedProvider:"claude",showProviderPicker:!1,model:je.claude.model,modelOptions:je.claude.modelOptions,onModelChange:(s,u)=>{js("claude",u)},onModelOptionChange:s=>{s.type==="claudeReasoningEffort"?et("claude",{reasoningEffort:s.effort}):s.type==="contextWindow"&&et("claude",{contextWindow:s.contextWindow})},planMode:je.claude.planMode,onPlanModeChange:s=>Ns("claude",s),includePlanMode:!0,className:"justify-start flex-wrap"})})}),e.jsx(A,{title:"Codex Defaults",description:"Saved defaults when using Codex.",alignStart:!0,children:e.jsx("div",{className:"max-w-[420px]",children:e.jsx(Gs,{availableProviders:Gt,selectedProvider:"codex",showProviderPicker:!1,model:je.codex.model,modelOptions:je.codex.modelOptions,onModelChange:(s,u)=>{js("codex",u)},onModelOptionChange:s=>{s.type==="codexReasoningEffort"?et("codex",{reasoningEffort:s.effort}):s.type==="fastMode"&&et("codex",{fastMode:s.fastMode})},planMode:je.codex.planMode,onPlanModeChange:s=>Ns("codex",s),includePlanMode:!0,className:"justify-start flex-wrap"})})}),e.jsx(A,{title:"Quick Response SDK",description:ba,alignStart:!0,children:e.jsxs("div",{className:"flex w-full max-w-[420px] flex-col gap-3",children:[ds?e.jsx("div",{className:"rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ds}):null,M!=null&&M.warning?e.jsx("div",{className:"rounded-lg border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:M.warning}):null,e.jsxs(ee,{value:Y.provider,onValueChange:s=>{rl(s)&&da(s)},children:[e.jsx(te,{className:"w-full",children:e.jsx(se,{})}),e.jsx(ne,{children:e.jsx(he,{children:uo.map(s=>e.jsx($,{value:s.value,children:s.label},s.value))})})]}),Y.provider==="custom"?e.jsx(P,{value:Y.baseUrl,onChange:s=>Ne({...Y,baseUrl:s.target.value}),onBlur:()=>void xe(),onKeyDown:s=>Re(s,()=>void xe()),placeholder:"https://your-provider.example/v1"}):null,e.jsx(P,{type:"password",value:Y.apiKey,onChange:s=>Ne({...Y,apiKey:s.target.value}),onBlur:()=>void xe(),onKeyDown:s=>Re(s,()=>void xe()),placeholder:"API key"}),e.jsx(P,{value:Y.model,onChange:s=>Ne({...Y,model:s.target.value}),onBlur:()=>void xe(),onKeyDown:s=>Re(s,()=>void xe()),placeholder:"Model id"})]})})]}),k==="keybindings"&&e.jsxs("div",{className:"border-b border-border",children:[ns?e.jsx("div",{className:"mb-4 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:ns}):null,Te.warning?e.jsx("div",{className:"mb-4 rounded-lg border border-border bg-card/30 px-4 py-3 text-sm text-muted-foreground",children:Te.warning}):null,Ot.map((s,u)=>{const L=wt(Lt[s]),Ue=ut[s]??"",va=Ue!==L;return e.jsx(A,{title:ol[s],description:e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"Comma-separated shortcuts."}),va?e.jsxs(e.Fragment,{children:[e.jsx("span",{children:" "}),e.jsxs("button",{type:"button",onClick:()=>{ia(s)},className:"inline rounded text-foreground hover:text-foreground/80",children:["Restore: ",L]})]}):null]}),bordered:u!==0,children:e.jsx("div",{className:"flex min-w-0 max-w-[420px] flex-1 flex-col items-stretch gap-2",children:e.jsx(P,{type:"text",value:Ue,onChange:kt=>$n(s,kt.target.value),onBlur:()=>{ys()},onKeyDown:kt=>Re(kt,()=>{ys()}),className:"font-mono"})})},s)})]}),k==="skills"&&e.jsx(ko,{state:l}),k==="subagents"&&e.jsx(dr,{state:l}),k==="models"&&e.jsx(_r,{state:l}),k==="mcp-servers"&&e.jsx(Er,{state:l}),k==="snippets"&&e.jsx(zr,{state:l}),k==="instructions"&&e.jsx(wo,{state:l}),!["general","providers","keybindings","skills","subagents","models","mcp-servers","snippets","instructions"].includes(k)&&e.jsx(po,{status:o,releases:y,error:w,onRetry:ca,updateSnapshot:E,currentVersion:K,onInstallUpdate:s=>l.handleInstallUpdate(s),onCheckForUpdates:()=>{l.handleCheckForUpdates({force:!0})},onForceReload:()=>l.handleForceReload()})]}),l.commandError?e.jsxs("div",{className:"mx-auto mt-4 flex max-w-4xl items-start gap-3 rounded-lg border border-destructive/20 bg-destructive/5 px-4 py-3 text-sm text-destructive",children:[e.jsx(Tl,{className:"mt-0.5 h-4 w-4 flex-shrink-0"}),e.jsx("span",{children:l.commandError})]}):null]})]})]}),Cs?e.jsx("div",{className:"absolute bottom-0 left-0 right-0 border-t border-border bg-background",children:e.jsx("div",{className:"px-6 py-[14.25px]",children:e.jsxs("div",{className:"grid gap-3 text-xs text-muted-foreground grid-cols-2 lg:grid-cols-4",children:[e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 tracking-wide text-xs text-muted-foreground/80",children:"Machine"}),e.jsx("div",{className:"text-foreground/80",children:S})]}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx("div",{className:"mb-1 tracking-wide text-xs text-muted-foreground/80",children:"Connection"}),e.jsx("div",{className:"text-foreground/80",children:l.connectionStatus})]}),e.jsxs("div",{className:"hidden md:block",children:[e.jsx("div",{className:"mb-1 tracking-wide text-xs text-muted-foreground/80",children:"Projects Indexed"}),e.jsx("div",{className:"text-foreground/80",children:V})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-1 tracking-wide text-xs text-muted-foreground/80",children:"App Version"}),e.jsx("div",{className:"text-foreground/80",children:K})]})]})})}):null,e.jsx(Us,{open:Bn,onOpenChange:xt,children:e.jsxs(Fs,{size:"lg",children:[e.jsxs(zs,{className:"space-y-4",children:[e.jsx(Vs,{children:"Tracked Events"}),e.jsx("div",{className:"text-sm text-muted-foreground",children:"Kanna sends these event names plus the limited property keys below, depending on the event type."}),e.jsxs("div",{className:"max-h-[60vh] overflow-auto rounded-lg border border-border bg-muted/40 p-3",children:[e.jsx("div",{className:"text-xs font-medium tracking-wide text-muted-foreground",children:"Event Names"}),e.jsx("ul",{className:"mt-3 space-y-2 text-sm",children:ma.map(s=>e.jsx("li",{className:"font-mono text-foreground",children:s},s))}),e.jsx("div",{className:"mt-6 text-xs font-medium tracking-wide text-muted-foreground",children:"Property Keys"}),e.jsx("ul",{className:"mt-3 space-y-2 text-sm",children:ql.map(s=>e.jsx("li",{className:"font-mono text-foreground",children:s},s))})]})]}),e.jsx(Ks,{children:e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>xt(!1),children:"Close"})})]})}),e.jsx(Us,{open:Gn,onOpenChange:vt,children:e.jsxs(Fs,{size:"lg",children:[e.jsxs(zs,{className:"space-y-4",children:[e.jsx(Vs,{children:"Validation Error"}),e.jsx("pre",{className:"max-h-[60vh] overflow-auto rounded-lg border border-border bg-muted p-3 text-xs font-mono whitespace-pre-wrap break-words",children:pa})]}),e.jsx(Ks,{children:e.jsx(O,{variant:"secondary",size:"sm",onClick:()=>vt(!1),children:"Close"})})]})})]})}function hn(t){const a={};for(const n of Ot)a[n]=ml(t[n]??"");return{...Lt,...a}}export{Co as AutoResumeToggleSection,po as ChangelogSection,Io as CloudflareTunnelSectionTitle,wo as GlobalInstructionsSection,_o as SettingsPage,ko as SkillsSection,mn as compareSemverTags,go as formatPublishedDate,ho as getCachedChangelog,xo as getKeybindingsSubtitle,un as loadChangelog,Ao as resetSettingsPageChangelogCache,on as resolveSettingsSectionId,fo as setCachedChangelog,cn as shouldPreviewChatSoundChange};
|
package/dist/client/assets/{StackBoardsRoutePage-Bjy8Kbh6.js → StackBoardsRoutePage-BSyo88cA.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as i,a as d,b as l,r as m,j as n}from"./index-
|
|
1
|
+
import{u as i,a as d,b as l,r as m,j as n}from"./index-D7ZrZlum.js";import{B as k}from"./BoardsPage-C4uDY4pp.js";import"./columnStyle-WWfrgRFo.js";function f(){const s=i(),e=d(),{stackId:a=""}=l(),o=s.sidebarData.stacks.find(t=>t.id===a),r=o?o.title:"Stack",c=m.useCallback(t=>{e(`/boards/stack/${a}/${t}`)},[e,a]);return n.jsx("div",{className:"relative flex min-h-0 min-w-0 flex-1 flex-col",children:n.jsx(k,{ownerKind:"stack",ownerId:a,ownerName:r,socket:s.socket,onOpenBoard:c})})}export{f as StackBoardsRoutePage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as T,p as W,j as e,r as u,q as L,s as P,u as B,a as V,b as q,t as M,v as O,x as _,W as z,d as A}from"./index-
|
|
1
|
+
import{c as T,p as W,j as e,r as u,q as L,s as P,u as B,a as V,b as q,t as M,v as O,x as _,W as z,d as A}from"./index-D7ZrZlum.js";import{S as F,a as H,W as G,b as Y}from"./WorkflowsSection-DWrgXaLX.js";import{R as $}from"./search-CKRWuWXG.js";import{S as D}from"./settings-header-button-C3noeQRy.js";import"./terminal-DMpcqVC1.js";/**
|
|
2
2
|
* @license lucide-react v0.562.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|