@codeuxai/codeux 0.8.1 → 0.8.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +128 -45
  2. package/dashboard/dist/assets/{AgentAvatarScene-DAjdNR8q.js → AgentAvatarScene-CdYNjBsU.js} +1 -1
  3. package/dashboard/dist/assets/{AgentsPage-dG7HaQww.js → AgentsPage-BKJ1Zdbv.js} +2 -2
  4. package/dashboard/dist/assets/{BackgroundManager-CxjNC7ME.js → BackgroundManager-B4A4jACF.js} +1 -1
  5. package/dashboard/dist/assets/{BranchNameSchemeEditor-wfv629Ml.js → BranchNameSchemeEditor-DfnH2VYW.js} +1 -1
  6. package/dashboard/dist/assets/{BrowserPage-5eFh6pZt.js → BrowserPage-BxfAsG3M.js} +1 -1
  7. package/dashboard/dist/assets/{ChatPage-CfunB4-0.js → ChatPage-MXugCDvS.js} +1 -1
  8. package/dashboard/dist/assets/{ErrorPage-CEHtK2Hk.js → ErrorPage-Y-fEDzly.js} +1 -1
  9. package/dashboard/dist/assets/{FileBrowserPage-BOVIkrrv.js → FileBrowserPage-B4JEdW9B.js} +1 -1
  10. package/dashboard/dist/assets/{KnowledgePage-CeKSiAys.js → KnowledgePage-DVbW7o61.js} +1 -1
  11. package/dashboard/dist/assets/{ListWindowSelector-cshzGFot.js → ListWindowSelector-CPMgebqM.js} +1 -1
  12. package/dashboard/dist/assets/{MemoryPage-Cctk6NFp.js → MemoryPage-C3RWZJL5.js} +1 -1
  13. package/dashboard/dist/assets/{OverviewTelemetry-D_V7-M2H.js → OverviewTelemetry-Cy9vzhdY.js} +1 -1
  14. package/dashboard/dist/assets/{ProjectsPage-D8ICYJVv.js → ProjectsPage-RmR2LMuR.js} +1 -1
  15. package/dashboard/dist/assets/{SchedulerPage-BM0sGrEZ.js → SchedulerPage-Bg08X7Tm.js} +1 -1
  16. package/dashboard/dist/assets/{SettingsPage-BlDplYC7.js → SettingsPage-DzE_F7Kw.js} +1 -1
  17. package/dashboard/dist/assets/{SprintBoatRace-DaP10JYZ.js → SprintBoatRace-BeZOItMO.js} +1 -1
  18. package/dashboard/dist/assets/{SprintDag-DbxJdjBK.js → SprintDag-vF8f33gn.js} +1 -1
  19. package/dashboard/dist/assets/{SprintsPage-XGhd04Sn.js → SprintsPage-bRHQPfWP.js} +1 -1
  20. package/dashboard/dist/assets/{StatsPage-CrSwtTGq.js → StatsPage-BZl_tzUr.js} +1 -1
  21. package/dashboard/dist/assets/{TasksPage-DNpVBxt6.js → TasksPage-rLMlkgxX.js} +1 -1
  22. package/dashboard/dist/assets/{index-BViPTeJx.js → index-DdNzHP9F.js} +5 -5
  23. package/dashboard/dist/assets/{monaco.contribution-KtWzfVt5.js → monaco.contribution-2KFAi0p0.js} +2 -2
  24. package/dashboard/dist/assets/{tsMode-CalcmZZa.js → tsMode-dZI5bz0O.js} +1 -1
  25. package/dashboard/dist/index.html +1 -1
  26. package/dist/infrastructure/providers/cli/provider-logs/opencode-log-parser.js +174 -20
  27. package/dist/infrastructure/providers/cli/provider-runner.js +51 -0
  28. package/dist/infrastructure/providers/cli/provider-usage.js +39 -6
  29. package/dist/infrastructure/providers/cli/workspace-artifact-service.js +17 -7
  30. package/dist/repositories/execution-repository.js +77 -0
  31. package/dist/services/provider-execution-service.js +10 -1
  32. package/dist/services/runtime-startup-recovery-service.js +170 -0
  33. package/dist/services/sprint-task-dispatch-service.js +7 -0
  34. package/docs/getting-started/quickstart.md +14 -3
  35. package/docs/operations/runbook.md +2 -0
  36. package/docs/settings/configuration-and-storage.md +2 -0
  37. package/package.json +1 -1
  38. package/.code-ux/debug.log +0 -97190
@@ -1,4 +1,4 @@
1
- import{O as e,S as t,_ as n,a as r,h as i,j as a,v as o,w as s,x as c,y as l}from"./vendor-Dl0fhdV0.js";import{t as u}from"./createLucideIcon-BshUfn15.js";import{t as d}from"./anchor-CpTtI1nV.js";import{i as f,n as p,r as m,t as h}from"./route-BlhVrKsR.js";import{n as g,t as _}from"./sliders-horizontal-6rJeI8Qo.js";import{t as v}from"./gauge-CRJ-5Qy4.js";import{t as y}from"./server-Colb_cUG.js";import{t as b}from"./settings-2-B5NbDo8J.js";import{t as x}from"./wrench-DSVlxBRn.js";import{r as S,s as C}from"./project-data-BSCsMQnj.js";import{f as w,i as T,l as E,o as ee,s as te,t as D,u as ne}from"./use-reduced-motion-Dxh6NCDM.js";import{$ as re,$t as ie,A as O,Ai as k,Ar as ae,At as A,C as oe,Cr as j,D as M,Dr as se,E as ce,Er as N,F as le,G as P,Gr as ue,H as de,Ir as F,M as fe,Mr as I,Ni as L,O as pe,Or as me,Q as he,Qr as ge,Qt as _e,R as ve,S as ye,St as be,Ti as xe,Tr as Se,U as Ce,V as R,W as we,Y as Te,Z as Ee,Zr as De,_ as z,_r as Oe,a as B,ar as ke,b as Ae,br as V,c as H,ci as je,cn as Me,d as U,ei as Ne,f as W,fn as Pe,g as G,h as Fe,i as K,ii as Ie,j as Le,ji as Re,k as ze,ki as Be,kr as Ve,l as He,m as q,mr as Ue,ni as We,o as J,oi as Ge,ot as Ke,p as Y,pr as X,q as qe,s as Z,t as Je,tt as Ye,u as Q,vi as Xe,wi as Ze,y as Qe,yr as $e,z as et}from"./index-BViPTeJx.js";import{i as $,n as tt,r as nt,t as rt}from"./BranchNameSchemeEditor-wfv629Ml.js";var it=u(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),at=u(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ot=u(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),st=u(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),ct=u(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]);c();var lt=`You have unsaved changes. Leave this page?`,ut=new Map,dt=!1,ft=!1,pt=typeof window<`u`?window.location.href:``,mt=null,ht=null,gt=null,_t=null,vt=e=>{ft=!0;try{e()}finally{ft=!1}},yt=()=>{for(let e of ut.values())if(e.shouldBlock())return e;return null},bt=e=>{if(ft)return!0;let t=yt();return t?t.confirmNavigation(e):!0},xt=e=>e?new URL(String(e),window.location.href).href:window.location.href,St=()=>{dt||typeof window>`u`||(mt=window.history.pushState.bind(window.history),ht=window.history.replaceState.bind(window.history),window.history.pushState=((e,t,n)=>{let r=xt(n);r!==window.location.href&&!bt(()=>{vt(()=>{window.history.pushState(e,t,n)})})||(mt?.(e,t,n),pt=r)}),window.history.replaceState=((e,t,n)=>{let r=xt(n);r!==window.location.href&&!bt(()=>{vt(()=>{window.history.replaceState(e,t,n)})})||(ht?.(e,t,n),pt=r)}),gt=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target?.closest(`a[href]`);if(!t||t.target===`_blank`||t.hasAttribute(`download`))return;let n=new URL(t.href,window.location.href);n.origin!==window.location.origin||n.href===window.location.href||bt(()=>{vt(()=>{window.location.href=n.href})})||(e.preventDefault(),e.stopPropagation())},_t=()=>{let e=window.location.href;if(e!==pt){if(!bt(()=>{vt(()=>{window.location.href=e})})){vt(()=>{mt?.(window.history.state,document.title,pt)});return}pt=e}},window.addEventListener(`click`,gt,!0),window.addEventListener(`popstate`,_t),dt=!0)},Ct=()=>{!dt||typeof window>`u`||(mt&&(window.history.pushState=mt),ht&&(window.history.replaceState=ht),gt&&window.removeEventListener(`click`,gt,!0),_t&&window.removeEventListener(`popstate`,_t),mt=null,ht=null,gt=null,_t=null,dt=!1)},wt=({shouldBlock:e,confirmNavigation:t})=>{if(typeof window>`u`)return()=>void 0;St();let n=Symbol(`navigation-blocker`);return ut.set(n,{shouldBlock:e,confirmNavigation:t??(e=>window.confirm(lt))}),()=>{ut.delete(n),ut.size===0&&Ct()}},Tt={jules:`Jules`,gemini:`Gemini`,codex:`Codex`,"claude-code":`Claude Code`,"qwen-code":`Qwen Code`,opencode:`OpenCode`,antigravity:`Antigravity`},Et=[{value:`SMALL`,label:`Small`},{value:`MEDIUM`,label:`Medium`},{value:`HIGH`,label:`High`}],Dt=[{id:`task_coding`,label:`Task coding`,description:`Primary coding execution for provider-routed task work.`},{id:`planning`,label:`Planning`,description:`Virtual planning and prompt-improvement requests.`},{id:`dashboard_reply`,label:`Dashboard reply`,description:`Reply-only dashboard chat responses generated by a CLI provider.`},{id:`clarification_reply`,label:`Clarification reply`,description:`Automatic clarification answers sent back to blocked workers.`},{id:`qa_review`,label:`QA review`,description:`Completion-time quality assurance reviews that can request follow-up fixes.`},{id:`ci_fix`,label:`CI fix`,description:`Worker-owned CI repair loops and retry work.`},{id:`merge_conflict`,label:`Merge conflict`,description:`Worker-owned merge conflict resolution runs.`}],Ot=[{value:`GLOBAL`,label:`Global defaults`},{value:`WORKER`,label:`Worker defaults`}],kt=[{id:`jules`,label:`Jules`,description:`Google Jules API service for agent session and workspace orchestration`},{id:`gemini`,label:`Gemini`,description:`Hosted execution provider and future worker endpoint`},{id:`antigravity`,label:`Antigravity`,description:`Google Antigravity CLI (agy) local container worker execution`},{id:`codex`,label:`Codex`,description:`Hosted execution provider and future worker endpoint`},{id:`claude-code`,label:`Claude Code`,description:`Hosted execution provider and future worker endpoint`},{id:`qwen-code`,label:`Qwen Code`,description:`Qwen CLI with OAuth, Alibaba Coding Plan, and custom model providers`},{id:`opencode`,label:`OpenCode`,description:`OpenCode CLI with local auth, provider keys, and custom OpenAI-compatible endpoints`},{id:`github`,label:`GitHub`,description:`Repository, pull request, branch, and CI integration`},{id:`gitlab`,label:`GitLab`,description:`GitLab repository, merge request, and CI token integration`},{id:`jira`,label:`Jira`,description:`Atlassian Jira issue search, sprint linking, and completion transitions`}],At=[{value:`planningMissing`,label:`Planning Missing`,description:`Shown when a sprint has no planned tasks yet.`},{value:`planningCreated`,label:`Planning Created`,description:`Shown after a planning request is prepared.`},{value:`branchMissing`,label:`Branch Missing`,description:`Shown when the sprint feature branch must be created first.`},{value:`mergeHeader`,label:`Merge Header`,description:`Header for merge-required intervention output.`},{value:`mergeTask`,label:`Merge Task`,description:`Per-task merge instruction block.`},{value:`actionRequiredAgentHeader`,label:`Agent Attention Header`,description:`Header for agent-owned intervention items.`},{value:`actionRequiredAgentTask`,label:`Agent Attention Task`,description:`Per-task agent intervention block.`},{value:`actionRequiredHumanHeader`,label:`Human Attention Header`,description:`Header for human-owned intervention items.`},{value:`actionRequiredHumanTask`,label:`Human Attention Task`,description:`Per-task human intervention block.`},{value:`watchHeader`,label:`Run Header`,description:`Top section for live orchestration status output.`},{value:`watchMergeRequired`,label:`Run Merge Required`,description:`Shown when orchestration pauses for merges.`},{value:`watchNoMoreActions`,label:`Run No More Actions`,description:`Shown when orchestration pauses with nothing runnable.`},{value:`completionSteps`,label:`Completion Steps`,description:`Final sprint completion guidance.`},{value:`cleanupAllMerged`,label:`Cleanup All Merged`,description:`Shown when cleanup confirms a fully merged sprint.`},{value:`cleanupFailed`,label:`Cleanup Failed`,description:`Shown when cleanup is skipped because tasks failed.`},{value:`cleanupDeferred`,label:`Cleanup Deferred`,description:`Shown when cleanup waits on merges.`},{value:`cleanupEmpty`,label:`Cleanup Empty`,description:`Shown when the sprint is still empty.`}],jt=/(?:^|[\s_-])qa(?:$|[\s_-])|quality[\s_-]*assurance/i,Mt=e=>[...e].sort((e,t)=>{let n=(e.labels||[]).some(e=>jt.test(e));return n===(t.labels||[]).some(e=>jt.test(e))?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1}).map(e=>({value:e.id,label:e.name,avatarConfig:e.avatarConfig})),Nt=(e,r)=>{let{deleteProject:a,selectedProject:o,selectedProjectId:c}=S(),u=i(!1),d=i(null);s(()=>{let e=e=>{let t=e.target,n=t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable);e.key===`/`&&!n&&(e.preventDefault(),d.current?.focus(),d.current?.select())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[f,p]=l(`general`),[m,h]=l(`system`),[g,_]=l(null),[v,y]=l(`planningMissing`),[b,x]=l(`task_coding`),[D,re]=l(null),[ie,O]=l(``),[k,ae]=l(null),[A,oe]=l(null),[j,se]=l(null),[N,le]=l(null),[P,ue]=l({}),[de,F]=l(!0),[I,L]=l(null),[me,he]=l(null),ge=t(()=>{L(null),he(null)},[]),[_e,ve]=l(!1),[ye,be]=l(!1),[xe,Se]=l(!1),[Ce,R]=l(!1),[we,Te]=l(!1),[Ee,De]=l(!1),[z,Oe]=l(null),[B,ke]=l([]),Ae=i(`general`),V=t(async()=>{F(!0);try{let[e,t]=await Promise.all([ee(),C()]);if(k||h(e.runtime.lastActiveScope===`project`&&c?`project`:`system`),(!u.current||!k)&&ae(pe(e)),oe(pe(e)),Oe(t),c){let[e,t]=await Promise.all([T(c,{cache:`reload`}),Pe(c).catch(()=>[])]),n=fe(e.settings);(!u.current||!j)&&se(M(n)),le(M(n)),ue(e.sources),ke(Mt(t))}else se(null),le(null),ue({}),ke([]);L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}},[c]);s(()=>{V()},[V]),s(()=>{if(typeof window>`u`)return;let e=()=>{f!==`models`||u.current||V()};return window.addEventListener(`codeux:settings-updated`,e),()=>window.removeEventListener(`codeux:settings-updated`,e)},[f,V]),s(()=>{let e=Ae.current===`models`,t=f===`models`;Ae.current=f,!(!t||e||u.current)&&V()},[f,V]),s(()=>{!o&&m===`project`&&h(`system`)},[m,o]),s(()=>{if(!me)return;let e=window.setTimeout(()=>he(null),2400);return()=>window.clearTimeout(e)},[me]);let H=n(()=>k&&A?JSON.stringify(k)!==JSON.stringify(A):!1,[A,k]),je=n(()=>j&&N?JSON.stringify(j)!==JSON.stringify(N):!1,[j,N]);u.current=H||je;let Me=m===`system`?k?.defaults??null:j,U=e.find(e=>e.id===f)??e[0];s(()=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`codeux:appearance-preview`,{detail:{appearance:Me?.appearance??null}}))},[Me?.appearance]),s(()=>{if(!(typeof window>`u`))return()=>{window.dispatchEvent(new CustomEvent(`codeux:appearance-preview`,{detail:{appearance:null}}))}},[]);let Ne=ie.trim().toLowerCase(),W=n(()=>Ne?e.filter(e=>[e.label,e.description,...r[e.id]||[]].join(` `).toLowerCase().includes(Ne)):e,[Ne]);s(()=>{W.length!==0&&(W.some(e=>e.id===f)||p(W[0].id))},[f,W]);let G=t(e=>{ae(t=>t&&e(t))},[]),Fe=t(e=>{se(t=>t&&e(t))},[]),K=t(e=>{if(m===`system`){G(t=>({...t,defaults:e(t.defaults)}));return}Fe(e)},[m,Fe,G]),Ie=t(async()=>{if(k){De(!0);try{ae(ce(k,await C())),he(`Imported missing integration secrets from env/settings.json.`),L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{De(!1)}}},[k]),Le=t(async()=>{let e=!0,t=!0,n=[];if(H&&k){ve(!0);try{let e=await w(k);if(ae(pe(e)),oe(pe(e)),o){let e=await T(o.id,{cache:`reload`}),t=fe(e.settings);se(M(t)),le(M(t)),ue(e.sources)}}catch(t){n.push(t instanceof Error?t.message:String(t)),e=!1}finally{ve(!1)}}if(je&&o&&j){be(!0);try{await ne(o.id,j);let e=await T(o.id,{cache:`reload`}),t=fe(e.settings);se(M(t)),le(M(t)),ue(e.sources)}catch(e){n.push(e instanceof Error?e.message:String(e)),t=!1}finally{be(!1)}}return n.length>0?L(n.join(` | `)):L(null),e&&t?(he(H&&je?`All settings saved.`:H?`System settings saved.`:je&&o?`Project settings saved for ${o.name}.`:`Settings saved.`),!0):!1},[H,je,k,o,j]),Re=t(async()=>{if(o){Se(!0);try{await te(o.id);let e=await T(o.id,{cache:`reload`}),t=fe(e.settings);se(M(t)),le(M(t)),ue(e.sources),L(null),he(`Project overrides reset for ${o.name}.`)}catch(e){L(e instanceof Error?e.message:String(e))}finally{Se(!1)}}},[o]),ze=t(async()=>{if(o){R(!0);try{await a(o.id),h(`system`),p(`general`),he(`Project ${o.name} deleted.`),L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[o,a]),Be=t(async()=>{Te(!0);try{await E(),h(`system`),p(`general`),await V(),he(`Database reset to a clean state.`),L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{Te(!1)}},[V]),Ve=t((e,t)=>t.split(`.`).reduce((e,t)=>e&&e[t],e),[]),He=t((e,t,n)=>{let r=t.split(`.`),i={...e},a=i;for(let e=0;e<r.length-1;e++){let t=r[e];a[t]={...a[t]},a=a[t]}return a[r[r.length-1]]=n,i},[]),q=t(e=>{if(!k||!j)return;let t=Ve(k.defaults,e);se(n=>n&&He(n,e,t)),ue(t=>({...t,[e]:`system`}))},[k,j,Ve,He]),Ue=t(e=>{if(m===`project`&&P[e]===`project`)return()=>q(e)},[m,P,q]),We=t(async e=>{if(h(e),k){let t={...k,runtime:{...k.runtime,lastActiveScope:e}};ae(t),oe(pe(t));try{await w(t)}catch{}}},[k]),[J,Ge]=l(!1),Ke=i(null),Y=i(!1),X=t(()=>{let e=Ke.current;Ke.current=null,e&&(Y.current=!0,e())},[]),qe=t(()=>{Ge(!1),X()},[X]),Z=t(()=>{Ge(!1),Ke.current=null},[]),Je=t(async()=>{await Le()&&(Ge(!1),X())},[Le,X]);s(()=>{if(typeof window>`u`)return;let e=wt({shouldBlock:()=>u.current,confirmNavigation:e=>(Ke.current=e,Ge(!0),!1)});return()=>{e()}},[]);let Ye=H||je;return s(()=>{if(typeof window>`u`||!Ye)return;let e=e=>{Y.current||(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Ye]),{clearFeedback:ge,activeCategory:f,setActiveCategory:p,activeScope:m,setActiveScope:We,selectedIntegration:g,setSelectedIntegration:_,selectedAgentTemplate:v,setSelectedAgentTemplate:y,activeInvocationRoute:b,setActiveInvocationRoute:x,activeProviderPanel:D,setActiveProviderPanel:re,settingsSearch:ie,setSettingsSearch:O,systemSettings:k,projectSettings:j,projectSources:P,editableSettings:Me,loading:de,error:I,saveMessage:me,savingSystem:_e,savingProject:ye,activeSaving:_e||ye,activeDirty:Ye,resettingProject:xe,deletingProject:Ce,resettingDatabase:we,importingHints:Ee,externalHints:z,activeCategoryConfig:U,filteredCategories:W,categories:e,providerLabels:Tt,thinkingModeOptions:Et,invocationRouteDefinitions:Dt,routingProfileOptions:Ot,integrations:kt,agentInstructionTemplateOptions:At,projectAgentPresetOptions:B,selectedProject:o,updateSystem:G,updateProject:Fe,updateEditableSettings:K,handleImportHints:Ie,handleSave:Le,handleResetProject:Re,handleDeleteProject:ze,handleResetDatabase:Be,loadSettings:V,isDirtyRef:u,searchInputRef:d,resetFieldToDefault:q,getFieldReset:Ue,showUnsavedModal:J,confirmDiscard:qe,cancelDiscard:Z,saveAndLeave:Je}};c();var Pt=[{id:`general`,num:`01`,label:`General`,icon:_,description:`Scope, runtime, and automation posture`},{id:`appearance`,num:`02`,label:`Appearance`,icon:F,description:`Dashboard layout and theme preferences`},{id:`models`,num:`03`,label:`AI Models`,icon:Ge,description:`Provider routing, models, and weighting`},{id:`sprint`,num:`04`,label:`Sprint & Git`,icon:j,description:`Git flow, branch naming, merge rules, and execution runtime`},{id:`browser`,num:`05`,label:`Browser Preview`,icon:je,description:`Preview runtime, browser visibility, and container policy`},{id:`agents`,num:`06`,label:`Agents`,icon:k,description:`Project-local markdown mirrors and agent authoring behavior`},{id:`memory`,num:`07`,label:`Memory`,icon:m,description:`Embedding models, auto-capture, and promotion policy`},{id:`integrations`,num:`08`,label:`Integrations`,icon:p,description:`Provider keys, Git hosts, and external connection policy`},{id:`mcp`,num:`09`,label:`MCP`,icon:y,description:`MCP servers injected into CLIs and built-in tool access`},{id:`danger`,num:`10`,label:`Danger Zone`,icon:Oe,description:`Reset project overrides only when needed`,danger:!0}],Ft={general:[`automation`,`scope`,`runtime`,`dashboard`,`clarification`,`pause`,`resume`],appearance:[`theme`,`layout`,`dock`,`sidebar`,`light`,`dark`,`motion`,`appearance`],models:[`provider`,`routing`,`model`,`thinking`,`worker`,`codex`,`gemini`,`claude`,`jules`],sprint:[`ci`,`merge`,`watch`,`loop`,`docker`,`execution`,`cleanup`,`branch`,`branch name`,`branch naming`,`branch scheme`,`default branch`,`feature branch`,`git flow`,`autofix`,`browser`,`preview`,`container`,`port`],browser:[`browser`,`preview`,`container`,`port`,`routing`,`rebuild`,`launch`,`concurrent`,`iframe`],agents:[`agent`,`prompt`,`template`,`markdown`,`instruction`],memory:[`memory`,`embedding`,`capture`,`promotion`,`learning`],integrations:[`github`,`gitlab`,`jira`,`atlassian`,`token`,`api key`,`auth`,`credential`,`integration`],mcp:[`mcp`,`server`,`tool`,`tools`,`custom mcp`,`model context protocol`,`code_ux`,`toggle`,`http`,`sse`],danger:[`reset`,`delete`,`danger`,`database`,`wipe`]},It=({filteredCategories:e,activeCategory:t,settingsSearch:n,onSwitchCategory:a})=>{let o=n.trim().toLowerCase(),s=i([]),c=(t,n)=>{if(t.key===`ArrowDown`){t.preventDefault();let r=(n+1)%e.length;s.current[r]?.focus(),a(e[r].id)}else if(t.key===`ArrowUp`){t.preventDefault();let r=(n-1+e.length)%e.length;s.current[r]?.focus(),a(e[r].id)}};return r(`div`,{className:`sticky top-16 flex flex-col gap-3 rounded-[1.75rem] border border-[color:var(--border-hairline)] bg-[var(--surface-glass)] p-3 backdrop-blur-2xl shadow-[var(--elevation-base)]`,children:[r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.03] px-4 py-3 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[r(`div`,{className:`flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.2em] text-slate-400 dark:text-slate-600`,children:[r(ue,{className:`h-3.5 w-3.5`,strokeWidth:2}),`Categories`]}),r(`div`,{className:`mt-2 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:o?`Showing ${e.length} categories for “${n.trim()}”.`:`Jump directly into the area you need without digging through the full settings tree.`})]}),e.map((e,n)=>{let i=t===e.id,l=e.danger,u=!!(o&&(Ft[e.id]?.some(e=>e.includes(o))||e.label.toLowerCase().includes(o)||e.description.toLowerCase().includes(o)));return r(`button`,{type:`button`,ref:e=>{s.current[n]=e},onClick:()=>a(e.id),onKeyDown:e=>c(e,n),"aria-current":i?`page`:void 0,className:`group relative flex w-full items-center gap-3.5 rounded-[1.1rem] px-4 py-3.5 text-left ${A} ${l?`focus-visible:ring-status-red`:``} ${i?l?`bg-status-red/[0.07] dark:bg-status-red/[0.08]`:`bg-signal-500/10`:`hover:bg-[var(--fill-muted-hover)]`} ${u&&!i?l?`ring-1 ring-status-red/30 bg-status-red/[0.03] dark:ring-status-red/40 dark:bg-status-red/[0.04]`:`ring-1 ring-signal-500/30 bg-signal-500/[0.03] dark:ring-signal-500/40 dark:bg-signal-500/[0.04]`:``}`,children:[i?r(`div`,{className:`absolute left-0 top-3 bottom-3 w-[3px] rounded-r-full ${l?`bg-status-red`:`bg-signal-500 dark:bg-signal-400`}`}):null,r(`span`,{className:`w-5 shrink-0 text-right font-mono text-[9px] font-bold transition-colors duration-200 ${i?l?`text-status-red/60`:`text-signal-600/60 dark:text-signal-400/60`:`text-slate-300 dark:text-slate-600`}`,children:e.num}),r(e.icon,{className:`h-4 w-4 shrink-0 transition-colors duration-200 ${i?l?`text-status-red`:`text-signal-600 dark:text-signal-400`:`text-slate-400 group-hover:text-slate-600 dark:text-slate-500 dark:group-hover:text-slate-300`}`,strokeWidth:1.75}),r(`div`,{className:`min-w-0 flex-1`,children:[r(`div`,{className:`text-sm font-semibold transition-colors duration-200 ${i?l?`text-status-red`:`text-signal-700 dark:text-signal-300`:`text-slate-700 group-hover:text-slate-900 dark:text-slate-300 dark:group-hover:text-slate-100`}`,children:e.label}),r(`div`,{className:`mt-0.5 truncate text-[10px] font-medium leading-tight transition-colors duration-200 ${i?l?`text-status-red/70`:`text-signal-700/70 dark:text-signal-300/70`:`text-slate-400 group-hover:text-slate-500 dark:text-slate-500 dark:group-hover:text-slate-400`}`,children:e.description})]})]},e.id)}),e.length===0?r($,{title:`No matches`,children:"Try broader terms like `routing`, `CI`, `auth`, `agent`, or `memory`."}):null]})},Lt=({projectName:e,projectId:t,baseDir:n,sourceType:i})=>r(B,{title:`Project Context`,watermark:`PRJ`,icon:r(Ne,{strokeWidth:2.4}),children:[r(Y,{label:`Project`,description:`The selected project receives its own override document and inherits all other values from system defaults.`,children:r(`div`,{className:`rounded-xl bg-black/[0.04] px-3 py-2 text-sm font-semibold text-slate-700 dark:bg-white/[0.04] dark:text-slate-200`,children:e})}),r(Y,{label:`Project id`,description:`Stable identifier used by the API and runtime.`,children:r(`div`,{className:`rounded-xl bg-black/[0.04] px-3 py-2 font-mono text-sm text-slate-600 dark:bg-white/[0.04] dark:text-slate-300`,children:t})}),r(Y,{label:`Base directory`,description:`Workers and local execution enter this directory before acting.`,children:r(`div`,{className:`max-w-[28rem] rounded-xl bg-black/[0.04] px-3 py-2 font-mono text-sm text-slate-600 dark:bg-white/[0.04] dark:text-slate-300`,children:n})})]}),Rt=({settings:e,update:t,getBadge:n,getFieldBadge:i})=>r(B,{title:`Automation`,watermark:`AUTO`,badge:n(`automationLevel`,`automationInterventions`),icon:r(k,{strokeWidth:2.4}),children:[r(Y,{label:`Automation level`,description:`Choose how much the project should proceed without a worker stepping in.`,badge:i(`automationLevel`),children:r(U,{value:e.automationLevel,onChange:e=>t(t=>({...t,automationLevel:e})),options:[{value:`FULL`,label:`Full`,hint:`Moves without confirmation gates.`},{value:`SEMI_AUTO`,label:`Semi-auto`,hint:`Automates routine recovery only.`},{value:`ALWAYS_ASK`,label:`Always ask`,hint:`Requires a decision at every gate.`}]})}),r(Y,{label:`Auto-approve plans`,description:`Use the orchestrator path for routine plan confirmations.`,badge:i(`automationInterventions.autoApprovePlan`),children:r(z,{"aria-label":`Toggle setting`,value:e.automationInterventions.autoApprovePlan,onChange:()=>t(e=>({...e,automationInterventions:{...e.automationInterventions,autoApprovePlan:!e.automationInterventions.autoApprovePlan}}))})}),r(Y,{label:`Auto-answer clarifications`,description:`Answer routine clarification requests automatically when the configured template is sufficient.`,badge:i(`automationInterventions.autoAnswerClarification`),children:r(z,{"aria-label":`Toggle setting`,value:e.automationInterventions.autoAnswerClarification,onChange:()=>t(e=>({...e,automationInterventions:{...e.automationInterventions,autoAnswerClarification:!e.automationInterventions.autoAnswerClarification}}))})}),e.automationInterventions.autoAnswerClarification&&r(Y,{label:`Clarification answer mode`,description:`Choose whether to use a static template or let a worker generate a contextual answer.`,badge:i(`automationInterventions.autoAnswerClarificationMode`),children:r(U,{value:e.automationInterventions.autoAnswerClarificationMode,onChange:e=>t(t=>({...t,automationInterventions:{...t.automationInterventions,autoAnswerClarificationMode:e}})),options:[{value:`TEMPLATE`,label:`Template`,hint:`Fast static reply.`},{value:`WORKER`,label:`Worker`,hint:`Contextual provider-generated reply.`}]})}),(!e.automationInterventions.autoAnswerClarification||e.automationInterventions.autoAnswerClarificationMode===`TEMPLATE`)&&r(Y,{label:`Clarification answer template`,description:`Template used when project automation answers a clarification request.`,badge:i(`automationInterventions.clarificationAnswerTemplate`),children:r(G,{value:e.automationInterventions.clarificationAnswerTemplate,onChange:e=>t(t=>({...t,automationInterventions:{...t.automationInterventions,clarificationAnswerTemplate:e}})),placeholder:`Respond with the usual clarification template...`})}),r(Y,{label:`Auto-resume paused runs`,description:`Resume a project automatically when a transient pause clears.`,badge:i(`automationInterventions.autoResumePaused`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:e.automationInterventions.autoResumePaused,onChange:()=>t(e=>({...e,automationInterventions:{...e.automationInterventions,autoResumePaused:!e.automationInterventions.autoResumePaused}}))})})]}),zt=({settings:e,update:t,getBadge:n,getFieldBadge:i})=>r(B,{title:`Docker Runtime`,watermark:`DKR`,badge:n(`cliWorkflow`),icon:r(it,{strokeWidth:2.4}),children:[r(Y,{label:`Container image`,description:`Default container image used for the task execution runtime.`,badge:i(`cliWorkflow.containerImage`),children:r(G,{value:e.cliWorkflow.containerImage,onChange:e=>t(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerImage:e}})),mono:!0})}),r(Y,{label:`Container setup script`,description:`Optional setup script run inside the container before task execution.`,badge:i(`cliWorkflow.containerSetupScriptPath`),children:r(G,{value:e.cliWorkflow.containerSetupScriptPath,onChange:e=>t(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerSetupScriptPath:e}})),mono:!0})}),r(Y,{label:`Cache setup as image`,description:`Build and reuse a derived Docker image from the base image plus setup script contents.`,badge:i(`cliWorkflow.containerCacheSetupScriptImage`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:e.cliWorkflow.containerCacheSetupScriptImage,onChange:()=>t(e=>({...e,cliWorkflow:{...e.cliWorkflow,containerCacheSetupScriptImage:!e.cliWorkflow.containerCacheSetupScriptImage}}))})})]}),Bt=({state:e})=>{let{activeScope:t,systemSettings:n,projectSettings:i,selectedProject:a,updateSystem:o,editableSettings:s,updateEditableSettings:c,projectSources:l}=e,u=(...e)=>J(t,l,...e),d=e=>Z(t,l,e);return t===`system`?r(`div`,{className:`flex flex-col gap-5`,children:[s?r(Rt,{settings:s,update:c,getBadge:u,getFieldBadge:d}):null,r(B,{title:`System Runtime`,watermark:`SYS`,icon:r(it,{strokeWidth:2.4}),children:[r(Y,{label:`Dashboard port`,description:`System-wide HTTP port for the dashboard server.`,children:r(Q,{value:n?.runtime.dashboardPort??4444,onChange:e=>o(t=>({...t,runtime:{...t.runtime,dashboardPort:e}})),min:1,max:65535})}),r(Y,{label:`Console log level`,description:`Minimum severity printed to the server console. Off suppresses console logging.`,children:r(U,{value:n?.runtime.consoleLogLevel??`info`,onChange:e=>o(t=>({...t,runtime:{...t.runtime,consoleLogLevel:e===`off`||e===`debug`||e===`warn`||e===`error`?e:`info`}})),options:[{value:`off`,label:`Off`,hint:`Suppress console output.`},{value:`debug`,label:`Debug`,hint:`Everything.`},{value:`info`,label:`Info`,hint:`Normal activity.`},{value:`warn`,label:`Warn`,hint:`Warnings and errors.`},{value:`error`,label:`Error`,hint:`Errors only.`}]})}),r(Y,{label:`Debug file level`,description:`Minimum severity written to .code-ux/debug.log. Off disables file logging.`,children:r(U,{value:n?.runtime.debugLogFileLevel??`error`,onChange:e=>o(t=>({...t,runtime:{...t.runtime,debugLogFileLevel:e===`debug`||e===`info`||e===`warn`||e===`off`?e:`error`}})),options:[{value:`off`,label:`Off`,hint:`Do not write the file.`},{value:`debug`,label:`Debug`,hint:`Everything.`},{value:`info`,label:`Info`,hint:`Normal activity.`},{value:`warn`,label:`Warn`,hint:`Warnings and errors.`},{value:`error`,label:`Error`,hint:`Default for debug.log.`}]})}),r(Y,{label:`Console visibility`,description:`Standard hides routine dashboard HTTP request logs. Full includes them.`,last:!0,children:r(U,{value:n?.runtime.consoleLogMode??`standard`,onChange:e=>o(t=>({...t,runtime:{...t.runtime,consoleLogMode:e===`full`?`full`:`standard`}})),options:[{value:`standard`,label:`Standard`,hint:`Important runtime activity.`},{value:`full`,label:`Full`,hint:`Includes HTTP requests.`}]})})]}),r(B,{title:`Database Settings`,watermark:`DBM`,icon:r(g,{strokeWidth:2.4}),children:[r(Y,{label:`Automatic pruning`,description:`Automatically prune completed task runs, VM activities, attention items, and realtime events on startup.`,children:r(z,{"aria-label":`Toggle setting`,value:n?.runtime.dbPruningEnabled??!0,onChange:()=>o(e=>({...e,runtime:{...e.runtime,dbPruningEnabled:!e.runtime.dbPruningEnabled}}))})}),(n?.runtime.dbPruningEnabled??!0)&&r(Y,{label:`Log retention period (days)`,description:`Keep execution logs and session histories for this many days.`,children:r(Q,{value:n?.runtime.dbRetentionDays??14,onChange:e=>o(t=>({...t,runtime:{...t.runtime,dbRetentionDays:e}})),min:1,max:365})}),r(Y,{label:`Automatic vacuum on startup`,description:`Reclaim fragmented SQLite page storage space and shrink DB files on disk after pruning.`,last:!0,children:r(z,{"aria-label":`Toggle setting`,value:n?.runtime.dbAutoVacuumOnStartup??!0,onChange:()=>o(e=>({...e,runtime:{...e.runtime,dbAutoVacuumOnStartup:!e.runtime.dbAutoVacuumOnStartup}}))})})]}),s?r(zt,{settings:s,update:c,getBadge:u,getFieldBadge:d}):null,r(B,{title:`Onboarding`,watermark:`ONB`,icon:r(Se,{strokeWidth:2.4}),children:r(Y,{label:`Show onboarding again`,description:`Launch the interactive setup flow from the beginning.`,last:!0,children:r(nt,{label:`Open Onboarding`,tone:`primary`,onClick:ie})})})]}):!a||!i?r($,{title:`Project scope unavailable`,children:`Select a project first to edit inheritable project settings.`}):r(`div`,{className:`flex flex-col gap-5`,children:[r(Lt,{projectName:a.name,projectId:a.id,baseDir:a.baseDir,sourceType:a.sourceType}),r(Rt,{settings:i,update:c,getBadge:u,getFieldBadge:d})]})};c(),a();var Vt=({state:t})=>{let n=t.editableSettings;if(!n)return null;let{activeScope:i,projectSources:a}=t,o=n.appearance,{theme:s,setTheme:c}=_e(),[u,d]=l(!1),f=typeof window<`u`&&!!window.codeUxDesktop?.setZoom;return r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Display Settings`,watermark:`UI`,icon:r(F,{strokeWidth:2.4}),children:[r(K,{label:`Navigation Mode`,description:`Choose between a floating dock or a traditional sidebar.`,badge:Z(i,a,`appearance.navigationMode`),children:r(U,{value:o.navigationMode,onChange:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,navigationMode:e}}))},options:[{value:`DOCK`,label:`Dock`},{value:`SIDEBAR`,label:`Sidebar`}]})}),r(K,{label:`Theme`,description:`Select light, dark, or sync with your system preferences.`,badge:Z(i,a,`appearance.theme`),children:r(U,{value:i===`system`?s:o.theme,onChange:e=>{let n=e;t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,theme:n}})),i===`system`&&c(n),H({theme:n})},options:[{value:`LIGHT`,label:`Light`},{value:`DARK`,label:`Dark`},{value:`SYSTEM`,label:`System`}]})}),r(K,{label:`Reduced Motion`,description:`Limit interface animations and transitions.`,badge:Z(i,a,`appearance.reducedMotion`),last:!f,children:r(U,{value:o.reducedMotion,onChange:e=>{let n=e;t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,reducedMotion:n}})),H({reducedMotion:n})},options:[{value:`AUTO`,label:`Auto`},{value:`REDUCE`,label:`Reduce`},{value:`NONE`,label:`None`}]})}),f&&r(K,{label:`Zoom Level`,description:`Scale the entire desktop window up or down.`,badge:Z(i,a,`appearance.zoomLevel`),last:!0,children:r(q,{value:String(o.zoomLevel??1),onChange:e=>{let n=Number(e);t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,zoomLevel:n}})),H({zoomLevel:n})},options:[{value:`0.75`,label:`75%`},{value:`0.9`,label:`90%`},{value:`1`,label:`100%`},{value:`1.1`,label:`110%`},{value:`1.25`,label:`125%`},{value:`1.5`,label:`150%`},{value:`1.75`,label:`175%`},{value:`2`,label:`200%`},{value:`2.25`,label:`225%`},{value:`2.5`,label:`250%`}]})})]}),r(B,{title:`Background`,watermark:`BG`,icon:r(at,{strokeWidth:2.4}),children:[r(K,{label:`Background Image`,description:`Upload a custom background image.`,badge:Z(i,a,`appearance.backgroundImage`),children:r(`div`,{className:`flex flex-col gap-2`,children:[r(`div`,{className:`flex items-center gap-4`,children:o.backgroundImage?r(e,{children:[r(`img`,{src:o.backgroundImage,alt:`Background Thumbnail`,className:`h-16 w-16 rounded-lg object-cover border border-black/10 dark:border-white/10`}),r(`button`,{type:`button`,onClick:()=>{t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,backgroundImage:null}})),H({backgroundImage:null})},className:`rounded-lg px-3 py-1.5 text-sm font-bold text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-void-800`,children:`Remove`})]}):r(e,{children:[r(`input`,{type:`file`,accept:`image/*`,id:`bg-image-input`,className:`hidden`,onChange:e=>{let n=e.target.files?.[0];if(!n)return;d(n.size>5*1024*1024);let r=new FileReader;r.onloadend=()=>{let e=r.result;t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,backgroundImage:e}})),H({backgroundImage:e})},r.readAsDataURL(n)}}),r(`button`,{type:`button`,onClick:()=>document.getElementById(`bg-image-input`)?.click(),className:`rounded-lg border border-black/10 bg-white px-4 py-2 text-sm font-bold text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-void-800 dark:text-slate-200 dark:hover:bg-void-700`,children:`Upload Image`})]})}),u&&r(`p`,{className:`text-xs text-amber-600 dark:text-amber-400`,children:`Large images may slow down the settings page.`})]})}),r(K,{label:`Background Mode`,description:`Choose between animated backgrounds or a static solid color.`,badge:Z(i,a,`appearance.backgroundMode`),children:r(U,{value:o.backgroundMode||`ANIMATED`,onChange:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,backgroundMode:e}}))},options:[{value:`ANIMATED`,label:`Animated`},{value:`STATIC`,label:`Static`}]})}),(o.backgroundMode||`ANIMATED`)===`ANIMATED`?r(K,{label:`Animation Style`,description:`Select an award-winning background animation.`,badge:Z(i,a,`appearance.animatedBackground`),children:r(U,{value:o.animatedBackground||`deep-ocean`,onChange:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,animatedBackground:e}}))},options:[{value:`deep-ocean`,label:`Deep Ocean`},{value:`neon-dreams`,label:`Neon Dreams`},{value:`aurora-borealis`,label:`Aurora Borealis`},{value:`cosmic-dust`,label:`Cosmic Dust`},{value:`ethereal-mist`,label:`Ethereal Mist`},{value:`quantum-field`,label:`Quantum Field`}]})}):r(K,{label:`Static Color`,description:`Choose a solid background color.`,badge:Z(i,a,`appearance.staticBackgroundColor`),children:r(`div`,{className:`flex items-center gap-3`,children:[r(`input`,{type:`color`,value:o.staticBackgroundColor||`#0d0f12`,onInput:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,staticBackgroundColor:e.target.value}}))},className:`h-10 w-20 cursor-pointer rounded-lg border-2 border-black/[0.06] bg-transparent p-1 focus:outline-none focus:ring-2 focus:ring-signal-500 dark:border-white/[0.06]`}),r(`span`,{className:`font-mono text-sm uppercase text-slate-500 dark:text-slate-400`,children:o.staticBackgroundColor||`#0d0f12`})]})}),r(K,{label:`Pattern Overlay`,description:`Stack a pattern over your background.`,badge:Z(i,a,`appearance.backgroundPattern`),last:!0,children:r(q,{value:o.backgroundPattern||`NONE`,onChange:e=>{let n=e;t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,backgroundPattern:n}})),H({backgroundPattern:n})},options:[{value:`NONE`,label:`None`},{value:`DIAGONAL_LINES`,label:`Diagonal Lines`},{value:`HORIZONTAL_LINES`,label:`Horizontal Lines`},{value:`VERTICAL_LINES`,label:`Vertical Lines`},{value:`CROSSHATCH`,label:`Crosshatch`},{value:`DOTS`,label:`Dots`},{value:`DIAMONDS`,label:`Diamonds`},{value:`HEXAGONS`,label:`Hexagons`},{value:`TRIANGLES`,label:`Triangles`},{value:`WAVES`,label:`Waves`},{value:`NOISE`,label:`Noise`}]})})]})]})};c();var Ht=`__inherit__`,Ut=(e,t=!1)=>()=>r(oe,{id:e,disabled:t,className:`h-7 w-7 rounded-[0.7rem]`,imageClassName:`h-4 w-4`}),Wt=({strategy:e})=>r(`span`,{className:`rounded-full border px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.16em] ${e===`MANUAL`?`border-signal-500/24 bg-black/[0.035] text-signal-700 dark:border-signal-400/24 dark:bg-white/[0.055] dark:text-signal-200`:`border-black/[0.08] bg-black/[0.035] text-slate-600 dark:border-white/[0.08] dark:bg-white/[0.055] dark:text-slate-300`}`,children:e.toLowerCase()}),Gt=({active:e,label:t})=>r(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.16em] ${e?`border-signal-500/20 bg-signal-500/[0.08] text-signal-700 dark:border-signal-400/20 dark:bg-signal-400/[0.1] dark:text-signal-200`:`border-black/[0.08] bg-black/[0.03] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400`}`,children:[r(`span`,{className:`h-1.5 w-1.5 rounded-full ${e?`bg-signal-500 dark:bg-signal-300`:`bg-slate-400 dark:bg-slate-500`}`}),t||(e?`Active`:`Inactive`)]}),Kt=({value:e,onChange:t,min:n=0,max:i=100,ariaLabel:a=`Weight`})=>{let o=Math.max(n,Math.min(i,e)),s=(o-n)/(i-n)*100;return r(`div`,{className:`group/slider flex w-[17rem] items-center gap-3`,children:[r(`div`,{className:`relative flex h-6 flex-1 items-center`,children:[r(`div`,{className:`absolute inset-x-0 h-2 rounded-full bg-black/[0.07] shadow-[inset_0_1px_2px_rgba(15,23,42,0.08)] dark:bg-white/[0.08] dark:shadow-[inset_0_1px_2px_rgba(0,0,0,0.32)]`}),r(`div`,{className:`pointer-events-none absolute left-0 h-2 rounded-full bg-gradient-to-r from-signal-400 via-signal-500 to-signal-600 shadow-[0_0_14px_rgba(56,189,248,0.45)] transition-[width] duration-150 dark:from-signal-300 dark:via-signal-400 dark:to-signal-500`,style:{width:`${s}%`}}),r(`input`,{type:`range`,min:n,max:i,value:o,"aria-label":a,"aria-valuenow":o,"aria-valuemin":n,"aria-valuemax":i,onInput:e=>t(Number(e.currentTarget.value)),className:`peer absolute inset-x-0 z-10 h-6 w-full cursor-grab appearance-none bg-transparent opacity-0 focus:outline-none active:cursor-grabbing`}),r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -translate-x-1/2 transition-[transform,box-shadow,left] duration-150 ease-out group-hover/slider:scale-110 peer-active:scale-110`,style:{left:`${s}%`},children:r(`div`,{className:`relative h-5 w-5 rounded-full border-[1.5px] border-signal-500 bg-white shadow-[0_3px_10px_rgba(15,23,42,0.22)] dark:border-signal-300 dark:bg-void-800`,children:r(`div`,{className:`absolute inset-0 rounded-full bg-gradient-to-b from-white/80 to-transparent dark:from-white/15`})})})]}),r(`span`,{className:`inline-flex h-9 min-w-[2.75rem] shrink-0 items-center justify-center rounded-[0.85rem] border border-black/[0.08] bg-white/85 px-2.5 text-sm font-bold tabular-nums text-slate-800 shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-100`,children:o})]})},qt=({icon:e,label:t,value:n,tone:i=`neutral`})=>r(`div`,{className:`relative overflow-hidden rounded-[1.15rem] border px-4 py-3 ${i===`signal`?`border-signal-500/24 bg-black/[0.035] dark:border-signal-400/24 dark:bg-white/[0.055]`:`border-black/[0.06] bg-black/[0.025] dark:border-white/[0.06] dark:bg-white/[0.035]`}`,children:[r(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:i===`signal`?`text-signal-600 dark:text-signal-300`:`text-slate-400`,children:e}),r(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:t})]}),r(`div`,{className:`mt-1 truncate text-sm font-black ${i===`signal`?`text-signal-700 dark:text-signal-200`:`text-slate-900 dark:text-white`}`,children:n})]}),Jt=({state:e})=>{let{activeScope:t,editableSettings:n,projectSources:i,systemSettings:a,externalHints:o,activeInvocationRoute:s,setActiveInvocationRoute:c,thinkingModeOptions:u,invocationRouteDefinitions:f,routingProfileOptions:p,updateEditableSettings:m}=e,g=(...e)=>J(t,i,...e),v=e=>Z(t,i,e),[y,x]=l({}),S=e=>{x(t=>({...t,[e]:!t[e]}))},[C,w]=l({}),T=e=>{w(t=>({...t,[e]:!t[e]}))};if(!n||!a)return null;let E=re(Object.entries(n.aiProvider.providers)),ee=le(a,n,o),te=E.filter(([,e])=>e.provider!==`jules`),D=n.aiProvider.provider?n.aiProvider.providers[n.aiProvider.provider]:null,ne=D?.provider||`jules`,ie=D?de(n.aiProvider.provider||``,D,a):Ce(ne),O=n.aiProvider.providers[n.workers.virtualWorkerProvider],k=O?.provider||`codex`,ae=O?de(n.workers.virtualWorkerProvider,O,a):Ce(k),A=(e,t)=>{m(n=>({...n,aiProvider:{...n.aiProvider,providers:{...n.aiProvider.providers,[e]:{...n.aiProvider.providers[e],...t}}}}))},j=(e,t)=>{m(n=>({...n,aiProvider:{...n.aiProvider,invocationRouting:{...n.aiProvider.invocationRouting,[e]:{...n.aiProvider.invocationRouting[e],...t}}}}))},M=(e,t,n)=>{m(r=>({...r,aiProvider:{...r.aiProvider,invocationRouting:{...r.aiProvider.invocationRouting,[e]:{...r.aiProvider.invocationRouting[e],providers:{...r.aiProvider.invocationRouting[e].providers,[t]:{...r.aiProvider.invocationRouting[e].providers[t]||{},...n}}}}}}))},se=(e,t)=>{m(n=>{let r={...n.aiProvider.invocationRouting[e].providers};return delete r[t],{...n,aiProvider:{...n.aiProvider,invocationRouting:{...n.aiProvider.invocationRouting,[e]:{...n.aiProvider.invocationRouting[e],providers:r}}}}})},ce=(e,t)=>{m(n=>{let r=n.aiProvider.invocationRouting[e],i=r.allowedProviders.includes(t)?r.allowedProviders.filter(e=>e!==t):[...r.allowedProviders,t];return{...n,aiProvider:{...n.aiProvider,invocationRouting:{...n.aiProvider.invocationRouting,[e]:{...r,allowedProviders:i}}}}})},N=f.find(e=>e.id===s)||f[0],P=n.aiProvider.invocationRouting[N.id],F=P.strategy===`MANUAL`,fe=P.provider||(P.profile===`WORKER`?n.workers.virtualWorkerProvider:n.aiProvider.provider)||null,I=fe?n.aiProvider.providers[fe]??null:null,L=F&&fe?[fe]:P.allowedProviders.length>0?P.allowedProviders.filter(e=>n.aiProvider.providers[e]):E.map(([e])=>e),pe=F?E.filter(([e])=>e===fe):E,me=F?1:E.length,_e=P.profile===`WORKER`?O:n.aiProvider.provider?n.aiProvider.providers[n.aiProvider.provider]:null,ve=E.filter(([,e])=>e.enabled).length;return r(`div`,{className:`flex flex-col gap-5`,children:[r(`section`,{className:`relative overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/70 p-5 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/35 to-transparent`}),r(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_360px]`,children:[r(`div`,{children:[r(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.2em] text-slate-500 dark:text-slate-300`,children:[r(h,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`AI routing console`]}),r(`h3`,{className:`mt-3 font-display text-3xl font-black tracking-tight text-slate-950 dark:text-white`,children:`Provider defaults, route decisions, and runtime capacity in one place.`}),r(`p`,{className:`mt-2 max-w-3xl text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:`Global and worker anchors define the inherited defaults. Base provider configuration defines each instance. Route mapping decides how work is assigned.`}),r(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2`,children:[r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:r(`div`,{className:`flex items-start gap-3`,children:[D?r(W,{providerId:D.provider,disabled:!D.enabled}):null,r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Global anchor`}),r(`div`,{className:`mt-1 truncate text-sm font-semibold text-slate-900 dark:text-white`,children:D?R(D):`None`}),r(`div`,{className:`mt-1 truncate text-xs text-slate-500 dark:text-slate-400`,children:D?.model||`default`})]})]})}),r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:r(`div`,{className:`flex items-start gap-3`,children:[O?r(W,{providerId:O.provider,disabled:!O.enabled}):null,r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Worker anchor`}),r(`div`,{className:`mt-1 truncate text-sm font-semibold text-slate-900 dark:text-white`,children:O?R(O):`None`}),r(`div`,{className:`mt-1 truncate text-xs text-slate-500 dark:text-slate-400`,children:n.workers.model==="default"?`Default (${O?.model||`default`})`:n.workers.model})]})]})})]})]}),r(`div`,{className:`grid gap-3 sm:grid-cols-3 xl:grid-cols-1`,children:[r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(Ge,{className:`h-4 w-4 text-slate-400`}),r(`span`,{className:`text-2xl font-black text-slate-900 dark:text-white`,children:E.length})]}),r(`div`,{className:`mt-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Provider instances`})]}),r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(_,{className:`h-4 w-4 text-slate-400`}),r(`span`,{className:`text-2xl font-black text-slate-900 dark:text-white`,children:ve})]}),r(`div`,{className:`mt-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Eligible by default`})]}),r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(ge,{className:`h-4 w-4 text-slate-400`}),r(`span`,{className:`text-2xl font-black text-slate-900 dark:text-white`,children:f.length})]}),r(`div`,{className:`mt-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Invocation routes`})]})]})]})]}),r(B,{title:`Default Routing Anchors`,watermark:`DEF`,badge:g(`aiProvider`,`workers`),icon:r(d,{strokeWidth:2.4}),children:[E.length===0?r($,{title:`No provider credentials`,children:`Add provider credentials in Integrations before configuring AI routes.`}):null,r(Y,{label:`Global default instance`,description:`Fallback instance for global-profile routes that inherit their primary provider.`,badge:v(`aiProvider.provider`),children:r(q,{value:n.aiProvider.provider||E[0]?.[0]||``,onChange:e=>m(t=>({...t,aiProvider:{...t.aiProvider,provider:e,providers:{...t.aiProvider.providers,[e]:{...t.aiProvider.providers[e],enabled:!0}}}})),options:E.map(([e,t])=>({value:e,label:R(t),icon:Ut(t.provider)}))})}),r(Y,{label:`Global default model`,description:`Base model used when the global default instance is selected without a route-specific model override.`,badge:v(`aiProvider.providers`),children:r(q,{value:D?.model||`default`,onChange:e=>n.aiProvider.provider?A(n.aiProvider.provider,{model:e}):void 0,disabled:!D||!Ee(D.provider),options:D&&Ee(D.provider)?ie:[{value:`default`,label:`Managed by provider`}]})}),r(Y,{label:`Worker default instance`,description:`Fallback instance for worker-profile routes that inherit their primary provider.`,badge:v(`workers.virtualWorkerProvider`),children:r(q,{value:n.workers.virtualWorkerProvider,onChange:e=>m(t=>({...t,workers:{...t.workers,virtualWorkerProvider:e,model:`default`}})),options:te.map(([e,t])=>({value:e,label:R(t),icon:Ut(t.provider)}))})}),r(Y,{label:`Worker default model`,description:`Model used by inherited worker-profile routes. Default uses the selected worker instance’s base model.`,badge:v(`workers.model`),children:r(q,{value:n.workers.model||`default`,onChange:e=>m(t=>({...t,workers:{...t.workers,model:e}})),options:[{value:`default`,label:`Default (${O?.model||`default`})`},...ae]})}),r(Y,{label:`Max concurrency`,description:`Maximum number of worker-dispatched tasks running at once.`,badge:v(`workers.maxConcurrency`),children:r(Q,{value:n.workers.maxConcurrency,min:1,max:20,onChange:e=>m(t=>({...t,workers:{...t.workers,maxConcurrency:e}}))})}),r(Y,{label:`Dispatch timeout`,description:`Seconds before a worker-dispatched task is considered timed out.`,badge:v(`workers.timeoutSeconds`),last:!0,children:r(Q,{value:n.workers.timeoutSeconds,min:60,max:3600,onChange:e=>m(t=>({...t,workers:{...t.workers,timeoutSeconds:e}}))})})]}),r(B,{title:`Base Provider Configuration`,watermark:`BASE`,badge:g(`aiProvider.providers`),icon:r(ue,{strokeWidth:2.4}),children:[r(`div`,{className:`mb-4 rounded-[1.25rem] border border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:`These values are the inheritance baseline for every route. Route mapping owns manual, weighted, or agent-based selection; this section defines each provider instance’s default model, reasoning depth, weight, and capacity.`}),r(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:E.map(([e,t])=>{let n=!!y[e],i=`base-provider-details-${e}`;return r(`div`,{className:`relative overflow-hidden rounded-[1.35rem] border p-4 shadow-[0_14px_32px_rgba(15,23,42,0.035)] transition-colors dark:shadow-[0_16px_34px_rgba(0,0,0,0.18)] ${t.enabled?`border-signal-500/15 bg-[linear-gradient(180deg,rgba(255,255,255,0.88),rgba(255,255,255,0.72))] dark:border-signal-400/15 dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.075),rgba(255,255,255,0.04))]`:`border-black/[0.06] bg-white/62 opacity-85 dark:border-white/[0.06] dark:bg-white/[0.035]`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-1 ${t.enabled?`bg-signal-500/55`:`bg-slate-300/55 dark:bg-white/15`}`}),r(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-black/[0.06] pb-3 dark:border-white/[0.06]`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(W,{providerId:t.provider,disabled:!t.enabled}),r(`div`,{children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:t.name}),r(`div`,{className:`mt-0.5 text-[11px] text-slate-500 dark:text-slate-400`,children:[we(t.provider),` baseline`]})]})]}),r(`div`,{className:`flex items-center gap-2`,children:[r(Gt,{active:t.enabled,label:t.enabled?`Eligible`:`Paused`}),r(`button`,{type:`button`,onClick:()=>S(e),"aria-expanded":n,"aria-controls":i,"aria-label":n?`Collapse ${t.name} settings`:`Expand ${t.name} settings`,title:n?`Collapse settings`:`Expand settings`,className:`inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-white/80 text-slate-500 transition-colors hover:border-signal-500/30 hover:bg-signal-500/[0.06] hover:text-signal-600 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:border-signal-300/30 dark:hover:bg-signal-300/[0.08] dark:hover:text-signal-200`,children:r(Ze,{className:`h-4 w-4 transition-transform duration-200 ${n?`rotate-180`:`rotate-0`}`,strokeWidth:2.4})})]})]}),r(`div`,{className:`grid gap-2 ${n?`mb-3`:``}`,children:[r(`div`,{className:`rounded-xl border border-signal-500/15 bg-signal-500/[0.05] px-3 py-2 dark:border-signal-400/15 dark:bg-signal-400/[0.06]`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-signal-700/70 dark:text-signal-200/80`,children:`Model`}),r(Ge,{className:`h-3 w-3 text-signal-600/70 dark:text-signal-300/70`,strokeWidth:2.4})]}),r(`div`,{className:`mt-1 truncate font-mono text-sm font-bold text-slate-900 dark:text-white`,title:Ee(t.provider)?t.model:void 0,children:Ee(t.provider)?t.model:`Managed by provider`})]}),r(`div`,{className:`grid grid-cols-3 gap-2`,children:[r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Weight`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:t.weight})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Thinking`}),r(`div`,{className:`mt-1 truncate text-sm font-black text-slate-900 dark:text-white`,children:t.provider===`jules`?`n/a`:t.thinkingMode})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Cap`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:t.maxConcurrentTasks||`∞`})]})]})]}),n?r(`div`,{id:i,className:`grid gap-3`,children:[r(Y,{label:`Eligible by default`,description:`Controls whether this instance participates before route-specific overrides are applied.`,children:r(z,{"aria-label":`Toggle setting`,value:t.enabled,onChange:t=>A(e,{enabled:t})})}),Ee(t.provider)?r(Y,{label:`Base model`,description:`Inherited by routes unless a route-specific model override is set.`,children:r(q,{value:t.model,onChange:t=>A(e,{model:t}),options:de(e,t,a)})}):null,he(t.provider)?r(Y,{label:`Base thinking`,description:`Inherited reasoning depth for this provider instance.`,children:r(q,{value:t.thinkingMode,onChange:t=>A(e,{thinkingMode:t}),options:u})}):null,r(Y,{label:`Base weight`,description:`Used by weighted route strategies unless overridden.`,children:r(Kt,{value:t.weight,onChange:t=>A(e,{weight:t}),ariaLabel:`${t.name} base weight`})}),r(Y,{label:`Max concurrent tasks`,description:`Provider-level cap; 0 means unlimited.`,last:!0,children:r(Q,{value:t.maxConcurrentTasks,min:0,max:50,onChange:t=>A(e,{maxConcurrentTasks:t})})})]}):null]},`base-${e}`)})})]}),r(B,{title:`Route Mapping`,watermark:`MAP`,badge:g(`aiProvider.invocationRouting`),icon:r(ge,{strokeWidth:2.4}),children:r(`div`,{className:`grid gap-4 xl:grid-cols-[340px_minmax(0,1fr)]`,children:[r(`div`,{className:`rounded-[1.6rem] border border-black/[0.06] bg-[linear-gradient(180deg,rgba(15,23,42,0.028),rgba(15,23,42,0.012))] p-3 dark:border-white/[0.06] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.045),rgba(255,255,255,0.02))]`,children:[r(`div`,{className:`mb-3 px-2.5 pt-1`,children:[r(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:[r(st,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Invocation routes`]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:`Each route can inherit a default instance, choose a manual instance, or distribute across a weighted pool of exact instances.`})]}),r(`div`,{className:`flex flex-col gap-2`,children:f.map(e=>{let t=n.aiProvider.invocationRouting[e.id],i=t.provider?n.aiProvider.providers[t.provider]:t.profile===`WORKER`?O:D,a=t.allowedProviders.length||E.length,o=Object.keys(t.providers).length;return r(`button`,{type:`button`,onClick:()=>c(e.id),className:`group relative overflow-hidden rounded-[1.25rem] border px-4 py-3 text-left transition-all duration-200 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 ${e.id===s?`border-signal-500/30 bg-black/[0.045] shadow-[0_18px_34px_rgba(15,23,42,0.08)] dark:border-signal-400/30 dark:bg-white/[0.07]`:`border-black/[0.06] bg-black/[0.025] hover:-translate-y-0.5 hover:border-black/[0.12] hover:bg-black/[0.04] hover:shadow-[0_14px_28px_rgba(15,23,42,0.06)] dark:border-white/[0.06] dark:bg-white/[0.035] dark:hover:border-white/[0.12] dark:hover:bg-white/[0.06]`}`,children:[e.id===s?r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-3 bottom-3 w-1 rounded-r-full bg-signal-500 dark:bg-signal-300`}):null,r(`div`,{className:`flex items-start gap-3`,children:[i?r(oe,{id:i.provider,disabled:!i.enabled,className:`h-8 w-8 rounded-[0.75rem]`,imageClassName:`h-4 w-4`}):null,r(`div`,{className:`min-w-0 flex-1`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`div`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:e.label}),e.id===s?r(Xe,{className:`h-4 w-4 shrink-0 text-signal-600 dark:text-signal-300`}):null]}),r(`div`,{className:`mt-0.5 truncate text-[11px] font-medium text-slate-500 dark:text-slate-400`,children:i?R(i):`No provider`})]})]}),r(`div`,{className:`mt-1 text-[11px] leading-relaxed text-slate-500 dark:text-slate-400`,children:e.description}),r(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-slate-400`,children:[r(`span`,{className:`rounded-full bg-black/[0.04] px-2 py-1 dark:bg-white/[0.04]`,children:t.profile}),r(Wt,{strategy:t.strategy}),r(`span`,{className:`rounded-full bg-black/[0.04] px-2 py-1 dark:bg-white/[0.04]`,children:[a,` instances`]}),o>0?r(`span`,{className:`rounded-full bg-black/[0.04] px-2 py-1 dark:bg-white/[0.04]`,children:[o,` overrides`]}):null]})]},e.id)})})]}),r(`div`,{className:`relative overflow-hidden rounded-[1.6rem] border border-black/[0.06] bg-black/[0.035] p-5 shadow-[0_18px_44px_rgba(15,23,42,0.05)] dark:border-white/[0.06] dark:bg-white/[0.045] dark:shadow-[0_20px_44px_rgba(0,0,0,0.24)]`,children:[r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-signal-500/35 to-transparent`}),r(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4 border-b border-black/[0.06] pb-4 dark:border-white/[0.06]`,children:[r(`div`,{className:`flex min-w-0 items-start gap-3`,children:[I?r(W,{providerId:I.provider,disabled:!I.enabled}):null,r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-signal-600 dark:text-signal-300`,children:`Active route`}),r(`div`,{className:`mt-1 text-xl font-black text-slate-950 dark:text-white`,children:N.label}),r(`div`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:N.description}),r(`div`,{className:`mt-2 text-xs text-slate-500 dark:text-slate-400`,children:[`Inherits from `,r(`span`,{className:`font-semibold text-slate-700 dark:text-slate-200`,children:I?R(I):`no configured provider`})]})]})]}),r(`div`,{className:`flex flex-wrap gap-2`,children:[r(`span`,{className:`rounded-full border border-black/[0.06] bg-black/[0.03] px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300`,children:[P.profile,` profile`]}),r(Wt,{strategy:P.strategy})]})]}),r(`div`,{className:`mb-5 grid gap-3 md:grid-cols-4`,children:[r(qt,{icon:r(h,{className:`h-4 w-4`}),label:`Profile`,value:P.profile.toLowerCase(),tone:`signal`}),r(qt,{icon:r(_,{className:`h-4 w-4`}),label:`Strategy`,value:P.strategy.toLowerCase()}),r(qt,{icon:I?r(oe,{id:I.provider,disabled:!I.enabled,className:`h-6 w-6 rounded-[0.55rem]`,imageClassName:`h-3.5 w-3.5`}):r(Ge,{className:`h-4 w-4`}),label:`Primary`,value:I?I.name:`None`}),r(qt,{icon:r(st,{className:`h-4 w-4`}),label:`Pool`,value:`${L.length} / ${me}`})]}),r(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[r(`div`,{children:[r(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Profile`}),r(U,{value:P.profile,onChange:e=>j(N.id,{profile:e,provider:null}),options:p})]}),r(`div`,{children:[r(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Strategy`}),r(U,{value:P.strategy,onChange:e=>j(N.id,{strategy:e}),options:[{value:`MANUAL`,label:`Manual`,hint:`Pin one exact instance.`},{value:`WEIGHTED`,label:`Weighted`,hint:`Distribute by instance weight.`},{value:`AGENT`,label:`Agent`,hint:`Use agent provider/model.`}]})]})]}),r(`div`,{className:`mt-4`,children:[r(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Primary instance`}),r(q,{value:P.provider||Ht,onChange:e=>{let t=e===Ht?null:e;j(N.id,{provider:t}),t&&M(N.id,t,{enabled:!0})},disabled:P.strategy===`WEIGHTED`,options:[{value:Ht,label:P.profile===`WORKER`?`Inherit worker default (${R(O)})`:`Inherit global default (${_e?R(_e):`None`})`,icon:_e?Ut(_e.provider,!_e.enabled):void 0},...E.map(([e,t])=>({value:e,label:R(t),icon:Ut(t.provider,!t.enabled)}))]})]}),r(`div`,{className:`mt-5 rounded-[1.35rem] border border-black/[0.06] bg-[linear-gradient(180deg,rgba(15,23,42,0.025),rgba(15,23,42,0.01))] p-4 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[r(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[r(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:[r(st,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Allowed pool`]}),r(`div`,{className:`text-[11px] text-slate-500 dark:text-slate-400`,children:F?`Locked to primary (manual)`:P.allowedProviders.length===0?`Using all configured instances`:`${P.allowedProviders.length} pinned`})]}),r(`div`,{className:`grid gap-2 sm:grid-cols-2 xl:grid-cols-3`,children:pe.map(([e,t])=>{let n=F||P.allowedProviders.length===0||P.allowedProviders.includes(e),i=ee.includes(e);return r(`button`,{type:`button`,"aria-pressed":n,disabled:F,onClick:F?void 0:()=>ce(N.id,e),className:`group flex min-h-[68px] items-center justify-between gap-3 rounded-[1rem] border px-3 py-2.5 text-left transition-all duration-200 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 ${n?`border-signal-500/30 bg-black/[0.045] text-slate-900 shadow-[0_10px_20px_rgba(15,23,42,0.06)] dark:border-signal-400/30 dark:bg-white/[0.065] dark:text-white`:`border-black/[0.08] bg-black/[0.025] text-slate-500 hover:border-black/[0.12] hover:bg-black/[0.04] dark:border-white/[0.08] dark:bg-white/[0.035] dark:text-slate-400 dark:hover:border-white/[0.12] dark:hover:bg-white/[0.06]`} ${F?`cursor-default`:``}`,children:[r(`span`,{className:`flex min-w-0 items-center gap-2`,children:[r(oe,{id:t.provider,disabled:!n||!t.enabled,className:`h-7 w-7 rounded-[0.7rem]`,imageClassName:`h-4 w-4`}),r(`span`,{className:`min-w-0`,children:[r(`span`,{className:`block truncate text-xs font-bold`,children:t.name}),r(`span`,{className:`block truncate text-[10px] font-semibold uppercase tracking-[0.12em] opacity-65`,children:we(t.provider)})]})]}),r(`span`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[n?r(Xe,{className:`h-4 w-4 text-signal-600 dark:text-signal-300`}):r(`span`,{className:`h-4 w-4 rounded-full border border-black/[0.12] dark:border-white/[0.16]`}),i?null:r(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.12em] text-amber-600 dark:text-amber-300`,children:`Unavailable`})]})]},`${N.id}-${e}`)})})]}),r(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:L.map(e=>{let t=n.aiProvider.providers[e],i=P.providers[e]||{};if(!t)return null;let o=i.enabled??t.enabled,s=[typeof i.enabled==`boolean`,typeof i.model==`string`,typeof i.thinkingMode==`string`,typeof i.weight==`number`].filter(Boolean).length,c=`${N.id}-${e}`,l=!!C[c],d=`route-override-details-${c}`,f=i.model||t.model,p=i.thinkingMode||t.thinkingMode,m=i.weight??t.weight,h=Ee(t.provider);return r(`div`,{className:`relative overflow-hidden rounded-[1.35rem] border p-4 shadow-[0_14px_32px_rgba(15,23,42,0.035)] dark:shadow-[0_16px_34px_rgba(0,0,0,0.18)] ${o?`border-signal-500/18 bg-black/[0.04] dark:border-signal-400/18 dark:bg-white/[0.055]`:`border-black/[0.06] bg-black/[0.025] opacity-85 dark:border-white/[0.06] dark:bg-white/[0.035]`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-1 ${o?`bg-signal-500/55`:`bg-slate-300/60 dark:bg-white/15`}`}),r(`div`,{className:`mb-3 flex items-center justify-between gap-3 border-b border-black/[0.06] pb-3 dark:border-white/[0.06]`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(W,{providerId:t.provider,disabled:!o}),r(`div`,{children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:t.name}),r(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400`,children:[r(`span`,{children:we(t.provider)}),r(Gt,{active:o,label:o?`In route`:`Paused`}),s>0?r(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/[0.08] px-2 py-0.5 text-[9px] font-bold uppercase tracking-[0.12em] text-amber-700 dark:border-amber-400/20 dark:bg-amber-400/[0.1] dark:text-amber-200`,children:[r(b,{className:`h-3 w-3`}),s]}):null]})]})]}),r(`div`,{className:`flex items-center gap-2`,children:[r(`button`,{type:`button`,title:`Reset route overrides`,"aria-label":`Reset ${t.name} route overrides`,onClick:()=>se(N.id,e),className:`inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-black/[0.03] text-slate-500 transition-colors hover:bg-black/[0.06] hover:text-slate-800 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white`,children:r(Ve,{className:`h-3.5 w-3.5`})}),r(`button`,{type:`button`,onClick:()=>T(c),"aria-expanded":l,"aria-controls":d,"aria-label":l?`Collapse ${t.name} overrides`:`Expand ${t.name} overrides`,title:l?`Collapse overrides`:`Expand overrides`,className:`inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-white/80 text-slate-500 transition-colors hover:border-signal-500/30 hover:bg-signal-500/[0.06] hover:text-signal-600 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:border-signal-300/30 dark:hover:bg-signal-300/[0.08] dark:hover:text-signal-200`,children:r(Ze,{className:`h-4 w-4 transition-transform duration-200 ${l?`rotate-180`:`rotate-0`}`,strokeWidth:2.4})})]})]}),r(`div`,{className:`grid gap-2 ${l?`mb-3`:``}`,children:[r(`div`,{className:`rounded-xl border border-signal-500/15 bg-signal-500/[0.05] px-3 py-2 dark:border-signal-400/15 dark:bg-signal-400/[0.06]`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-signal-700/70 dark:text-signal-200/80`,children:`Model`}),r(Ge,{className:`h-3 w-3 text-signal-600/70 dark:text-signal-300/70`,strokeWidth:2.4})]}),r(`div`,{className:`mt-1 truncate font-mono text-sm font-bold text-slate-900 dark:text-white`,title:h?f:void 0,children:h?f:`Managed by provider`})]}),r(`div`,{className:`grid grid-cols-3 gap-2`,children:[r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Weight`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:m})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Thinking`}),r(`div`,{className:`mt-1 truncate text-sm font-black text-slate-900 dark:text-white`,children:t.provider===`jules`?`n/a`:p})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Cap`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:t.maxConcurrentTasks||`∞`})]})]})]}),l?r(`div`,{id:d,className:`grid gap-3`,children:[r(Y,{label:`Enabled override`,description:`Override route participation for this one instance.`,children:r(z,{"aria-label":`Toggle setting`,value:i.enabled??t.enabled,onChange:t=>M(N.id,e,{enabled:t})})}),h?r(Y,{label:`Model override`,description:`Inherited: ${t.model}`,children:r(q,{value:i.model||t.model,onChange:t=>M(N.id,e,{model:t}),options:de(e,t,a)})}):null,he(t.provider)?r(Y,{label:`Thinking override`,description:`Inherited: ${t.thinkingMode}`,children:r(q,{value:i.thinkingMode||t.thinkingMode,onChange:t=>M(N.id,e,{thinkingMode:t}),options:u})}):null,r(Y,{label:`Weight override`,description:`Inherited: ${t.weight}`,last:!0,children:r(Kt,{value:i.weight??t.weight,onChange:t=>M(N.id,e,{weight:t}),ariaLabel:`${t.name} weight override`})})]}):null]},c)})})]})]})})]})},Yt=({value:e,onChange:t,badge:n})=>r(Y,{label:`Sprint key prefix`,description:`Prefix used when generating sprint keys (e.g. SPR-1).`,badge:n,children:r(G,{value:e,onChange:e=>{t(e.replace(/[^a-zA-Z0-9]/g,``).toUpperCase().slice(0,10))},mono:!0,"aria-label":`Sprint key prefix`,"aria-description":`Prefix used when generating sprint keys (e.g. SPR-1).`})});a();var Xt=[{key:`task_coding`,label:`Coding attempts`,description:`Max times a task is (re)dispatched for coding before it is blocked.`},{key:`ci_fix`,label:`CI autofix attempts`,description:`Max CI autofix attempts (Jules notify or worker) per task.`},{key:`merge_conflict`,label:`Merge conflict resolutions`,description:`Max merge-conflict resolution attempts per task.`},{key:`clarification_reply`,label:`Clarification auto-answers`,description:`Max automatic clarification replies before waiting for a human.`},{key:`planning`,label:`Planning runs`,description:`Max planning invocations attributed to a single task.`}],Zt=[{value:`BLOCK_AND_ESCALATE`,label:`Block + escalate`,hint:`Block the task and hand it to a human.`},{value:`STOP_AND_WAIT`,label:`Stop + wait`,hint:`Stop auto-handling and wait for a human.`},{value:`WARN_ONLY`,label:`Warn only`,hint:`Log a warning but keep going.`}],Qt=({state:t})=>{let{activeScope:n,editableSettings:i,projectSources:a,updateEditableSettings:o}=t,s=(...e)=>J(n,a,...e),c=e=>Z(n,a,e);return i?r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Git Flow`,watermark:`GIT`,badge:s(`git`),icon:r(ge,{strokeWidth:2.4}),children:[r(Y,{label:`Git mode`,description:`Remote enables PR and CI-aware automation. Local keeps orchestration repo-local only.`,badge:c(`git.githubMode`),children:r(U,{value:i.git.githubMode,onChange:e=>o(t=>({...t,git:{...t.git,githubMode:e}})),options:[{value:`REMOTE`,label:`Remote`,hint:`PRs, CI, and remote branch sync stay enabled.`},{value:`LOCAL`,label:`Local`,hint:`Disable remote PR orchestration and stay repo-local.`}]})}),r(Y,{label:`Default branch`,description:`Base branch used for sprint branch creation and merge targets.`,badge:c(`git.defaultBranch`),children:r(G,{value:i.git.defaultBranch,onChange:e=>o(t=>({...t,git:{...t.git,defaultBranch:e}})),mono:!0})}),r(Y,{label:`Feature branch prefix`,description:`Prefix used when worker feature branches are generated automatically.`,badge:c(`git.featureBranchPrefix`),children:r(G,{value:i.git.featureBranchPrefix,onChange:e=>o(t=>({...t,git:{...t.git,featureBranchPrefix:e}})),mono:!0})}),r(Yt,{value:i.git.sprintKeyPrefix,onChange:e=>o(t=>({...t,git:{...t.git,sprintKeyPrefix:e}})),badge:c(`git.sprintKeyPrefix`)}),r(Y,{label:`Branch name scheme`,description:`Template used when naming sprint branches.`,badge:c(`git.sprintBranchScheme`),info:r(tt,{items:[{key:`{sprint_key_prefix}`,desc:`Sprint Key Prefix`},{key:`{sprint_number}`,desc:`Sprint Number`},{key:`{sprint_name}`,desc:`Sprint Name`},{key:`{sprint_id}`,desc:`Sprint ID`},{key:`{planning_agent}`,desc:`Planning Agent`},{key:`{agent_routing}`,desc:`Agent Routing`},{key:`{worker_agent}`,desc:`Worker Agent`},{key:`{worker_provider}`,desc:`Worker Provider`},{key:`{worker_model}`,desc:`Worker Model`}]}),children:r(rt,{value:i.git.sprintBranchScheme,onChange:e=>o(t=>({...t,git:{...t.git,sprintBranchScheme:e}}))})}),r(Y,{label:`Auto-create PRs`,description:i.git.githubMode===`LOCAL`?`Open pull requests automatically for remote git workflows. (Disabled in Local mode)`:`Open pull requests automatically for remote git workflows.`,badge:c(`git.autoCreatePr`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.git.autoCreatePr,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,git:{...e.git,autoCreatePr:!e.git.autoCreatePr}}))})}),r(Y,{label:`Auto-close linked issues`,description:i.git.githubMode===`LOCAL`?`Close imported GitHub/GitLab issues after the sprint finishes and the main merge gate is complete. (Disabled in Local mode)`:`Close imported GitHub/GitLab issues after the sprint finishes and the main merge gate is complete.`,badge:c(`git.autoCloseLinkedIssues`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.git.autoCloseLinkedIssues,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,git:{...e.git,autoCloseLinkedIssues:!e.git.autoCloseLinkedIssues}}))})})]}),r(B,{title:i.git.githubMode===`LOCAL`?`Merge Gates & Autofix (Unavailable in Local Mode)`:`Merge Gates & Autofix`,watermark:`CI`,badge:i.git.githubMode===`LOCAL`?`Disabled in Local Mode`:s(`ciIntelligence`),icon:r(De,{strokeWidth:2.4}),children:[r(Y,{label:`Resolve comments before main merge`,description:`Require review comments to be resolved before finishing the main merge.`,badge:c(`ciIntelligence.resolveAllCommentsBeforeMainMerge`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveAllCommentsBeforeMainMerge,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveAllCommentsBeforeMainMerge:!e.ciIntelligence.resolveAllCommentsBeforeMainMerge}}))})}),r(Y,{label:`Resolve main merge conflicts`,description:"Escalate `feature -> main` merge conflicts to the virtual worker with sprint context.",badge:c(`ciIntelligence.resolveMainMergeConflicts`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveMainMergeConflicts,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveMainMergeConflicts:!e.ciIntelligence.resolveMainMergeConflicts}}))})}),r(Y,{label:`Fix main merge CI failures`,description:"Dispatch the virtual worker to fix failing CI on the `feature -> main` merge gate before escalating to a human.",badge:c(`ciIntelligence.resolveMainMergeFailedChecks`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveMainMergeFailedChecks,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveMainMergeFailedChecks:!e.ciIntelligence.resolveMainMergeFailedChecks}}))})}),r(Y,{label:`Resolve comments before feature merge`,description:`Do not auto-merge a feature branch until review comments are closed.`,badge:c(`ciIntelligence.resolveAllCommentsBeforeFeatureMerge`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveAllCommentsBeforeFeatureMerge,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveAllCommentsBeforeFeatureMerge:!e.ciIntelligence.resolveAllCommentsBeforeFeatureMerge}}))})}),r(Y,{label:`Resolve feature merge conflicts`,description:`Escalate feature-branch merge conflicts to the virtual worker with full branch and task context.`,badge:c(`ciIntelligence.resolveMergeConflicts`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveMergeConflicts,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveMergeConflicts:!e.ciIntelligence.resolveMergeConflicts}}))})}),r(Y,{label:`Jules CI autofix`,description:`Allow Jules to attempt CI autofixes before escalating to a worker.`,badge:c(`ciIntelligence.waitForJulesCiAutofix`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.waitForJulesCiAutofix,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,waitForJulesCiAutofix:!e.ciIntelligence.waitForJulesCiAutofix}}))})}),r(Y,{label:`Feature PR auto-merge mode`,description:`Controls whether feature PRs stay at PR creation, auto-merge when green, auto-merge immediately when allowed, or stay off.`,badge:c(`ciIntelligence.featurePrAutoMergeMode`),children:r(U,{value:i.git.githubMode===`LOCAL`?`OFF`:i.ciIntelligence.featurePrAutoMergeMode,disabled:i.git.githubMode===`LOCAL`,onChange:e=>o(t=>({...t,ciIntelligence:{...t.ciIntelligence,featurePrAutoMergeMode:e}})),options:[{value:`OFF`,label:`Off`,hint:`Never auto-merge.`},{value:`CREATE_PR`,label:`Create PR`,hint:`Open a PR without auto-merging it.`},{value:`WHEN_GREEN`,label:`When green`,hint:`Merge only after checks pass.`},{value:`ALWAYS`,label:`Always`,hint:`Merge as soon as policy allows.`}]})}),r(Y,{label:`Main branch auto-merge mode`,description:`Controls whether the final main-branch PR stays off, is only created, auto-merges when green, or auto-merges immediately when allowed.`,badge:c(`ciIntelligence.mainBranchAutoMergeMode`),last:!0,children:r(U,{value:i.git.githubMode===`LOCAL`?`OFF`:i.ciIntelligence.mainBranchAutoMergeMode,disabled:i.git.githubMode===`LOCAL`,onChange:e=>o(t=>({...t,ciIntelligence:{...t.ciIntelligence,mainBranchAutoMergeMode:e}})),options:[{value:`OFF`,label:`Off`,hint:`Never auto-merge.`},{value:`CREATE_PR`,label:`Create PR`,hint:`Open the PR without auto-merging it.`},{value:`WHEN_GREEN`,label:`When green`,hint:`Merge only after checks pass.`},{value:`ALWAYS`,label:`Always`,hint:`Merge as soon as policy allows.`}]})})]}),r(B,{title:`Guardrails`,watermark:`CAP`,badge:s(`guardrails`),icon:r(ct,{strokeWidth:2.4}),children:[r(Y,{label:`Guardrails enabled`,description:`Cap how many times each agent job type runs per task to stop runaway loops. Counts persist per task across restarts.`,badge:c(`guardrails.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:i.guardrails.enabled,onChange:()=>o(e=>({...e,guardrails:{...e.guardrails,enabled:!e.guardrails.enabled}}))})}),i.guardrails.enabled?r(e,{children:[Xt.map(e=>r(Y,{label:e.label,description:`${e.description} 0 = unlimited.`,badge:c(`guardrails.jobs.${e.key}.cap`),children:r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(Q,{value:i.guardrails.jobs[e.key].cap,min:0,max:100,onChange:t=>o(n=>({...n,guardrails:{...n.guardrails,jobs:{...n.guardrails.jobs,[e.key]:{...n.guardrails.jobs[e.key],cap:t}}}}))}),r(U,{value:i.guardrails.jobs[e.key].onLimit,onChange:t=>o(n=>({...n,guardrails:{...n.guardrails,jobs:{...n.guardrails.jobs,[e.key]:{...n.guardrails.jobs[e.key],onLimit:t}}}})),options:Zt})]})},e.key)),r(Y,{label:`Per-task total ceiling`,description:`Optional hard cap on total agent invocations per task across all job types. 0 disables.`,badge:c(`guardrails.perTaskTotalCeiling`),last:!0,children:r(Q,{value:i.guardrails.perTaskTotalCeiling,min:0,max:500,onChange:e=>o(t=>({...t,guardrails:{...t.guardrails,perTaskTotalCeiling:e}}))})})]}):null]}),r(B,{title:`Rate Limit`,watermark:`RATE`,badge:s(`cliWorkflow`),icon:r(V,{strokeWidth:2.4}),children:[r(Y,{label:`Retry after quota reset`,description:`When a provider reports a concrete quota reset time, wait for that reset and retry automatically.`,badge:c(`cliWorkflow.retryOnQuotaReset`),children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.retryOnQuotaReset,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,retryOnQuotaReset:!e.cliWorkflow.retryOnQuotaReset}}))})}),r(Y,{label:`Retry on rate limit`,description:`Retry transient rate-limit failures after a fixed delay until the configured max retry count is reached.`,badge:c(`cliWorkflow.retryOnRateLimit`),children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.retryOnRateLimit,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,retryOnRateLimit:!e.cliWorkflow.retryOnRateLimit}}))})}),r(Y,{label:`Rate limit retry delay`,description:`Seconds to wait before retrying a rate-limited provider call.`,badge:c(`cliWorkflow.rateLimitRetryDelaySeconds`),children:r(Q,{value:i.cliWorkflow.rateLimitRetryDelaySeconds,onChange:e=>o(t=>({...t,cliWorkflow:{...t.cliWorkflow,rateLimitRetryDelaySeconds:e}})),min:1,max:3600})}),r(Y,{label:`Max rate limit retries`,description:`Maximum retry attempts for rate-limited provider calls before Code UX fails the invocation.`,badge:c(`cliWorkflow.maxRateLimitRetries`),children:r(Q,{value:i.cliWorkflow.maxRateLimitRetries,onChange:e=>o(t=>({...t,cliWorkflow:{...t.cliWorkflow,maxRateLimitRetries:e}})),min:1,max:100})}),r(Y,{label:`Max quota retries without timer`,description:`When a provider reports quota exhaustion without an exact reset time, retry up to this many times before failing the task.`,badge:c(`cliWorkflow.maxQuotaRetriesWithoutTimer`),last:!0,children:r(Q,{value:i.cliWorkflow.maxQuotaRetriesWithoutTimer,onChange:e=>o(t=>({...t,cliWorkflow:{...t.cliWorkflow,maxQuotaRetriesWithoutTimer:e}})),min:1,max:20})})]}),r(B,{title:`Watch Loop`,watermark:`LOOP`,badge:s(`sprintLoopSteps`),icon:r(Ie,{strokeWidth:2.4}),children:[r(Y,{label:`Watch loop`,description:`Keep the live watch loop running between orchestration ticks.`,badge:c(`sprintLoopSteps.watchLoop`),children:r(z,{"aria-label":`Toggle setting`,value:i.sprintLoopSteps.watchLoop,onChange:()=>o(e=>({...e,sprintLoopSteps:{...e.sprintLoopSteps,watchLoop:!e.sprintLoopSteps.watchLoop}}))})}),r(Y,{label:`Watch loop interval`,description:`Seconds between watch loop evaluation cycles.`,badge:c(`sprintLoopSteps.watchLoopIntervalSeconds`),children:r(Q,{value:i.sprintLoopSteps.watchLoopIntervalSeconds,onChange:e=>o(t=>({...t,sprintLoopSteps:{...t.sprintLoopSteps,watchLoopIntervalSeconds:e}})),min:1,max:3600})}),r(Y,{label:`Watch output interval`,description:`Seconds between watch loop output emissions.`,badge:c(`sprintLoopSteps.watchLoopOutputIntervalSeconds`),last:!0,children:r(Q,{value:i.sprintLoopSteps.watchLoopOutputIntervalSeconds,onChange:e=>o(t=>({...t,sprintLoopSteps:{...t.sprintLoopSteps,watchLoopOutputIntervalSeconds:e}})),min:1,max:3600})})]}),r(B,{title:`Workspace Hygiene`,watermark:`CLI`,badge:s(`cliWorkflow`),icon:r(Se,{strokeWidth:2.4}),children:[r(Y,{label:`Cleanup worktree on success`,description:`Remove temporary worktree state after successful CLI execution.`,badge:c(`cliWorkflow.cleanupWorktreeOnSuccess`),children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.cleanupWorktreeOnSuccess,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,cleanupWorktreeOnSuccess:!e.cliWorkflow.cleanupWorktreeOnSuccess}}))})}),r(Y,{label:`Cleanup worktree on failure`,description:`Clean up failed workspaces after execution terminates unsuccessfully.`,badge:c(`cliWorkflow.cleanupWorktreeOnFailure`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.cleanupWorktreeOnFailure,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,cleanupWorktreeOnFailure:!e.cliWorkflow.cleanupWorktreeOnFailure}}))})})]})]}):null},$t=({state:e})=>{let{activeScope:t,editableSettings:n,projectSources:i,updateEditableSettings:a}=e,o=(...e)=>J(t,i,...e),s=e=>Z(t,i,e);return n?r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Workspace Visibility`,watermark:`WEB`,badge:o(`sprintPreview`),icon:r(Ie,{strokeWidth:2.4}),children:[r(Y,{label:`Preview runtime enabled`,description:`Allow Code UX to launch, rebuild, and reconcile preview containers for this scope.`,badge:s(`sprintPreview.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.enabled,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,enabled:!e.sprintPreview.enabled}}))})}),r(Y,{label:`Show in-app browser workspace`,description:`Expose Browser entry points in the dashboard and allow the embedded preview workspace to render.`,badge:s(`sprintPreview.showInAppBrowser`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.showInAppBrowser,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,showInAppBrowser:!e.sprintPreview.showInAppBrowser}}))})}),r(Y,{label:`Launch preview when sprint starts`,description:`Start a preview container automatically when Code UX detects the sprint is actively running.`,badge:s(`sprintPreview.autoStartOnRunningSprint`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.autoStartOnRunningSprint,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,autoStartOnRunningSprint:!e.sprintPreview.autoStartOnRunningSprint}}))})}),r(Y,{label:`Rebuild preview on task completion`,description:`Refresh the active preview after a task finishes so the container reflects the latest sprint output.`,badge:s(`sprintPreview.rebuildOnTaskCompletion`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.rebuildOnTaskCompletion,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,rebuildOnTaskCompletion:!e.sprintPreview.rebuildOnTaskCompletion}}))})}),r(Y,{label:`Rebuild preview on sprint completion`,description:`Run one final rebuild when the sprint reaches its completed terminal state.`,badge:s(`sprintPreview.rebuildOnSprintCompletion`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.rebuildOnSprintCompletion,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,rebuildOnSprintCompletion:!e.sprintPreview.rebuildOnSprintCompletion}}))})}),r(Y,{label:`Stop preview when sprint ends`,description:`Shut down the preview container automatically when the sprint finishes, fails, or is cancelled.`,badge:s(`sprintPreview.autoStopOnTerminalSprint`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.autoStopOnTerminalSprint,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,autoStopOnTerminalSprint:!e.sprintPreview.autoStopOnTerminalSprint}}))})})]}),r(B,{title:`Runtime Limits`,watermark:`PORT`,badge:o(`sprintPreview`),icon:r(v,{strokeWidth:2.4}),children:[r(Y,{label:`Maximum active preview containers`,description:`When this cap is exceeded, Code UX stops the oldest active previews before launching the next one.`,badge:s(`sprintPreview.maxConcurrentContainers`),children:r(Q,{value:n.sprintPreview.maxConcurrentContainers,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,maxConcurrentContainers:e}})),min:1,max:100})}),r(Y,{label:`Host port range start`,description:`Lower bound for preview host-port allocation. Preview ports bind to localhost only.`,badge:s(`sprintPreview.hostPortRangeStart`),children:r(Q,{value:n.sprintPreview.hostPortRangeStart,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,hostPortRangeStart:e}})),min:1,max:65535})}),r(Y,{label:`Host port range end`,description:`Upper bound for preview host-port allocation.`,badge:s(`sprintPreview.hostPortRangeEnd`),children:r(Q,{value:n.sprintPreview.hostPortRangeEnd,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,hostPortRangeEnd:e}})),min:1,max:65535})}),r(Y,{label:`Container app port`,description:`Internal port the preview app listens on inside the container before Code UX maps it to a host port.`,badge:s(`sprintPreview.containerAppPort`),children:r(Q,{value:n.sprintPreview.containerAppPort,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,containerAppPort:e}})),min:1,max:65535})}),r(Y,{label:`Startup script path`,description:`Project-relative path used for the editable preview startup override script.`,badge:s(`sprintPreview.startupScriptPath`),last:!0,children:r(G,{value:n.sprintPreview.startupScriptPath,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,startupScriptPath:e}})),mono:!0})})]})]}):null};a();var en=({settings:t,update:n,getBadge:i,sectionBadge:a,presetOptions:o,selectorsDisabled:s,selectedProjectName:c,activeScope:l})=>r(B,{title:`Quality Assurance`,watermark:`QA`,badge:a,icon:r(N,{strokeWidth:2.4}),children:[r(K,{label:`Enable QA agent`,description:`Runs a senior QA pass after completion events, using full sprint context and continuing the current task session when fixes are required.`,badge:i(`agents.qualityAssurance.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:t.enabled,onChange:e=>n({enabled:e})})}),t.enabled?r(e,{children:[r(K,{label:`Task QA max runs`,description:`How many QA review cycles a single task gets before the exhaustion policy applies. Default is 5.`,badge:i(`agents.qualityAssurance.maxTaskReviewRuns`),children:r(Q,{value:t.maxTaskReviewRuns,min:1,max:20,onChange:e=>n({maxTaskReviewRuns:Number.isFinite(e)?Math.min(20,Math.max(1,Math.floor(e))):1})})}),r(K,{label:`Sprint QA max runs`,description:`How many sprint-completion QA review cycles a sprint gets before its budget is spent. Default is 5.`,badge:i(`agents.qualityAssurance.maxSprintReviewRuns`),children:r(Q,{value:t.maxSprintReviewRuns,min:1,max:20,onChange:e=>n({maxSprintReviewRuns:Number.isFinite(e)?Math.min(20,Math.max(1,Math.floor(e))):1})})}),r(K,{label:`When QA max runs is exhausted`,description:`What to do with a code-complete task whose QA budget is spent without a pass. Escalate holds it for a human; Fail marks it failed and lets the sprint finish; Finish marks it complete despite no QA pass.`,badge:i(`agents.qualityAssurance.exhaustionPolicy`),children:r(q,{value:t.exhaustionPolicy,onChange:e=>n({exhaustionPolicy:e===`FAIL_TASK`||e===`FINISH_TASK`||e===`ESCALATE_TO_HUMAN`?e:`ESCALATE_TO_HUMAN`}),options:[{value:`ESCALATE_TO_HUMAN`,label:`Escalate to human`},{value:`FAIL_TASK`,label:`Fail task`},{value:`FINISH_TASK`,label:`Finish task`}],"aria-label":`QA exhaustion policy`})}),c&&l!==`project`?r(`div`,{className:`rounded-[1.15rem] border border-signal-500/18 bg-signal-500/[0.08] px-4 py-3 text-xs leading-relaxed text-signal-700 dark:border-signal-400/18 dark:bg-signal-400/[0.08] dark:text-signal-200`,children:[`QA settings are project-local. Changing any QA control here switches the panel to Project scope for `,c,`.`]}):null,r(K,{label:`Review every completed task`,description:`Runs once after a task completes, then only repeats for QA-driven follow-up loops until the max run count is reached.`,badge:i(`agents.qualityAssurance.taskCompletion.enabled`),children:r(`div`,{className:`flex flex-wrap items-center gap-3`,children:[r(z,{"aria-label":`Toggle setting`,value:t.taskCompletion.enabled,onChange:e=>n({taskCompletion:{...t.taskCompletion,enabled:e}})}),r(q,{value:t.taskCompletion.agentPresetId||``,onChange:e=>n({taskCompletion:{...t.taskCompletion,agentPresetId:e||null}}),options:o,disabled:s,"aria-label":`Task completion QA agent preset`})]})}),r(K,{label:`Review before sprint completion`,description:`Blocks final sprint completion when QA finds integration problems and can route the fix back into the most relevant task.`,badge:i(`agents.qualityAssurance.sprintCompletion.enabled`),children:r(`div`,{className:`flex flex-wrap items-center gap-3`,children:[r(z,{"aria-label":`Toggle setting`,value:t.sprintCompletion.enabled,onChange:e=>n({sprintCompletion:{...t.sprintCompletion,enabled:e}})}),r(q,{value:t.sprintCompletion.agentPresetId||``,onChange:e=>n({sprintCompletion:{...t.sprintCompletion,agentPresetId:e||null}}),options:o,disabled:s,"aria-label":`Sprint completion QA agent preset`})]})}),r(K,{label:`Review completed tasks without a PR`,description:`Lets QA investigate whether a missing PR is valid or whether the task still needs branch and PR hygiene before it can stay complete.`,badge:i(`agents.qualityAssurance.completedTaskWithoutPr.enabled`),last:!0,children:r(`div`,{className:`flex flex-wrap items-center gap-3`,children:[r(z,{"aria-label":`Toggle setting`,value:t.completedTaskWithoutPr.enabled,onChange:e=>n({completedTaskWithoutPr:{...t.completedTaskWithoutPr,enabled:e}})}),r(q,{value:t.completedTaskWithoutPr.agentPresetId||``,onChange:e=>n({completedTaskWithoutPr:{...t.completedTaskWithoutPr,agentPresetId:e||null}}),options:o,disabled:s,"aria-label":`No PR QA agent preset`})]})}),s?r(`div`,{className:`rounded-[1.15rem] border border-black/[0.05] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.05] dark:bg-white/[0.02] dark:text-slate-400`,children:`Select a project to choose a custom QA agent. Built-in QA routing remains available without a project-specific preset.`}):null]}):r(`div`,{className:`rounded-[1.15rem] border border-dashed border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.02] dark:text-slate-400`,children:`QA is disabled. Enable it to review completed tasks, gate sprint completion, and inspect completed tasks that do not yet have a PR.`})]}),tn={planning:{agentPresetId:null},taskCoding:{mode:`MANUAL`,agentPresetId:null,orchestratorAgentPresetIds:[]},ciFix:{agentPresetId:null},mergeConflict:{agentPresetId:null},dashboardReply:{agentPresetId:null},clarificationReply:{agentPresetId:null}},nn=e=>({planning:{...tn.planning,...e?.planning},taskCoding:{...tn.taskCoding,...e?.taskCoding,orchestratorAgentPresetIds:e?.taskCoding?.orchestratorAgentPresetIds?[...e.taskCoding.orchestratorAgentPresetIds]:[]},ciFix:{...tn.ciFix,...e?.ciFix},mergeConflict:{...tn.mergeConflict,...e?.mergeConflict},dashboardReply:{...tn.dashboardReply,...e?.dashboardReply},clarificationReply:{...tn.clarificationReply,...e?.clarificationReply}}),rn=({state:e})=>{let{activeScope:t,setActiveScope:n,selectedProject:i,editableSettings:a,projectSettings:o,projectSources:s,projectAgentPresetOptions:c,updateProject:l,updateEditableSettings:u}=e,d=(...e)=>J(t,s,...e),f=e=>Z(t,s,e);if(!a)return null;let p=nn(o?.agents.routing??a.agents.routing),m=o?.agents.qualityAssurance??a.agents.qualityAssurance,g=c.map(e=>({...e,icon:()=>r(ye,{avatarConfig:e.avatarConfig,seed:`${e.value}:${e.label}`})})),_=[{value:``,label:`Built-in QA agent`,icon:()=>r(ye,{seed:`built-in:qa`})},...g],v=!i||!o,y=v,b=i?J(`project`,s,`agents.routing`):d(`agents.routing`),x=i?J(`project`,s,`agents`,`agents.qualityAssurance`):d(`agents`,`agents.qualityAssurance`),S=e=>i?Z(`project`,s,e):f(e),C=e=>{if(i&&o){t!==`project`&&n(`project`),l(t=>({...t,agents:{...t.agents,qualityAssurance:e(t.agents.qualityAssurance)}}));return}u(t=>({...t,agents:{...t.agents,qualityAssurance:e(t.agents.qualityAssurance)}}))},w=e=>{if(i&&o){t!==`project`&&n(`project`),l(t=>({...t,agents:{...t.agents,routing:e(nn(t.agents.routing))}}));return}u(t=>({...t,agents:{...t.agents,routing:e(nn(t.agents.routing))}}))},T=e=>{w(t=>{let n=t.taskCoding.orchestratorAgentPresetIds;return{...t,taskCoding:{...t.taskCoding,orchestratorAgentPresetIds:n.includes(e)?n.filter(t=>t!==e):[...n,e]}}})};return r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Project Markdown Mirror`,watermark:`AGT`,badge:d(`agents`),icon:r(We,{strokeWidth:2.4}),children:[r(Y,{label:`Save agent markdown to project directory`,description:"When enabled, dashboard edits write a companion markdown file under `.code-ux/agents` for the selected project. Default and home agent files are never modified.",badge:f(`agents.saveToProjectDirectory`),children:r(z,{"aria-label":`Toggle setting`,value:a.agents.saveToProjectDirectory,onChange:()=>u(e=>({...e,agents:{...e.agents,saveToProjectDirectory:!e.agents.saveToProjectDirectory}}))})}),r(Y,{label:`Mirror directory`,description:`Dashboard-authored markdown companions live alongside other project-local Code UX files.`,last:!0,children:r(`div`,{className:`rounded-xl bg-black/[0.04] px-3 py-2 font-mono text-sm text-slate-600 dark:bg-white/[0.04] dark:text-slate-300`,children:`.code-ux/agents`})})]}),r(B,{title:`Agent Routing`,watermark:`RTE`,badge:b,icon:r(h,{strokeWidth:2.4}),children:r(`div`,{className:`grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]`,children:[r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-black/[0.02] p-4 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-slate-400`,children:`Coding tasks`}),r(`div`,{className:`mt-2`,children:`Manual pins all coding work to one preset. Orchestrator gives the Planning agent a roster and lets it assign the best specialist per task.`}),i&&t!==`project`?r(`div`,{className:`mt-3 rounded-xl border border-signal-500/18 bg-signal-500/[0.08] px-3 py-2 text-signal-700 dark:border-signal-400/18 dark:bg-signal-400/[0.08] dark:text-signal-200`,children:[`Routing edits switch to Project scope for `,i.name,`.`]}):null]}),r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-white/78 p-5 dark:border-white/[0.06] dark:bg-void-900/52 md:p-6`,children:[r(Y,{label:`Coding task routing`,description:`Choose whether coding tasks use one fixed agent or a Planning-agent-selected specialist.`,children:r(U,{value:p.taskCoding.mode,onChange:e=>w(t=>({...t,taskCoding:{...t.taskCoding,mode:e===`ORCHESTRATOR`?`ORCHESTRATOR`:`MANUAL`}})),options:[{value:`MANUAL`,label:`Manual`,hint:`Pin one coding agent.`},{value:`ORCHESTRATOR`,label:`Orchestrator`,hint:`Planner selects per task.`}]})}),p.taskCoding.mode===`ORCHESTRATOR`?r(`div`,{className:`py-5`,children:[r(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Available to orchestrator`}),r(`div`,{className:`text-[11px] text-slate-500 dark:text-slate-400`,children:[p.taskCoding.orchestratorAgentPresetIds.length,` selected`]})]}),r(`div`,{className:`rounded-2xl border border-black/[0.05] bg-black/[0.015] p-3 dark:border-white/[0.06] dark:bg-white/[0.025]`,children:r(`div`,{className:`flex flex-wrap gap-2`,children:c.map(e=>r(`button`,{type:`button`,disabled:v,onClick:()=>T(e.value),className:`rounded-full border px-3 py-2 text-[11px] font-semibold tracking-wide transition-colors disabled:opacity-50 ${p.taskCoding.orchestratorAgentPresetIds.includes(e.value)?`border-signal-500/35 bg-signal-500/12 text-signal-700 dark:border-signal-400/35 dark:bg-signal-400/12 dark:text-signal-200`:`border-black/[0.08] bg-white/78 text-slate-500 dark:border-white/[0.08] dark:bg-void-900/60 dark:text-slate-400`}`,children:e.label},e.value))})}),c.length===0?r(`div`,{className:`mt-3 rounded-[1.15rem] border border-dashed border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.02] dark:text-slate-400`,children:`Create project agents first, then return here to expose coding specialists to the orchestrator.`}):null]}):null,r(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2`,children:[[`planning`,`Planning agent`,`Used for sprint planning and prompt improvement.`,`Built-in Planning agent`],...p.taskCoding.mode===`MANUAL`?[[`taskCoding`,`Coding agent`,`Used for task coding when no task-level orchestrator assignment exists.`,`Built-in Worker agent`]]:[],[`ciFix`,`CI fix`,`Used for automated CI repair loops.`,`Built-in Worker agent`],[`mergeConflict`,`Merge conflict`,`Used for automated conflict resolution.`,`Built-in Worker agent`],[`dashboardReply`,`Dashboard reply`,`Used for generated dashboard chat replies.`,`Built-in Worker agent`],[`clarificationReply`,`Clarification reply`,`Used for automatic worker clarification replies.`,`Built-in Project manager agent`]].map(([e,t,n,i])=>r(`div`,{className:`flex min-w-0 flex-col gap-3 rounded-2xl border border-black/[0.05] bg-white/55 p-4 dark:border-white/[0.06] dark:bg-white/[0.025]`,children:[r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-sm font-semibold text-slate-800 dark:text-slate-100`,children:t}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:n})]}),r(q,{value:p[e].agentPresetId||``,onChange:t=>w(n=>({...n,[e]:e===`taskCoding`?{...n.taskCoding,agentPresetId:t||null}:{agentPresetId:t||null}})),options:[{value:``,label:i,icon:()=>r(ye,{seed:`built-in:${e}:${i}`})},...g],disabled:v})]},e))})]})]})}),r(en,{settings:m,update:e=>C(t=>({...t,...e})),getBadge:S,sectionBadge:x,presetOptions:_,selectorsDisabled:y,selectedProjectName:i?.name,activeScope:t})]})},an=({state:e})=>{let{activeScope:t,selectedProject:n,editableSettings:i,projectSources:a,updateEditableSettings:o}=e,s=(...e)=>J(t,a,...e),c=e=>Z(t,a,e);return i?r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Memory System`,watermark:`MEM`,badge:s(`memory`),icon:r(Be,{strokeWidth:2.4}),children:[r(Y,{label:`Enable memory`,description:`Turn on the memory system for automatic capture, storage, and semantic search of sprint knowledge.`,badge:c(`memory.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,enabled:!e.memory.enabled}}))})}),r(Y,{label:`Auto-capture sprint events`,description:`Automatically create memories when tasks complete, fail, or encounter CI issues during sprint execution.`,badge:c(`memory.autoCaptureSprint`),children:r(z,{"aria-label":`Toggle setting`,value:i.memory.autoCaptureSprint,disabled:!i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,autoCaptureSprint:!e.memory.autoCaptureSprint}}))})}),r(Y,{label:`Auto-capture agent events`,description:`Capture memories from notable agent interactions such as retries and clarifications.`,badge:c(`memory.autoCaptureAgent`),children:r(z,{"aria-label":`Toggle setting`,value:i.memory.autoCaptureAgent,disabled:!i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,autoCaptureAgent:!e.memory.autoCaptureAgent}}))})}),r(Y,{label:`Auto-promote to project scope`,description:`Automatically promote recurring or high-strength sprint memories to long-term project knowledge when a sprint completes.`,badge:c(`memory.autoPromote`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:i.memory.autoPromote,disabled:!i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,autoPromote:!e.memory.autoPromote}}))})})]}),r(B,{title:`Limits`,watermark:`CAP`,badge:s(`memory`),icon:r(v,{strokeWidth:2.4}),children:[r(Y,{label:`Promotion threshold`,description:`Minimum score (0.0–1.0) a sprint memory needs to be auto-promoted to project scope.`,badge:c(`memory.promotionThreshold`),children:r(Q,{value:i.memory.promotionThreshold,min:0,max:1,step:.05,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,promotionThreshold:e}}))})}),r(Y,{label:`Max sprint memories`,description:`Maximum number of memories retained per sprint. Lowest-strength memories are evicted when exceeded.`,badge:c(`memory.maxSprintMemories`),children:r(Q,{value:i.memory.maxSprintMemories,min:10,max:5e3,step:10,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,maxSprintMemories:e}}))})}),r(Y,{label:`Max project memories`,description:`Maximum number of long-term project-scoped memories. Oldest low-strength memories are evicted when exceeded.`,badge:c(`memory.maxProjectMemories`),children:r(Q,{value:i.memory.maxProjectMemories,min:10,max:1e4,step:50,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,maxProjectMemories:e}}))})}),r(Y,{label:`Map edges per node`,description:`Maximum number of similarity connections per memory node on the neural map. Lower values produce a cleaner graph, higher values reveal more relationships.`,badge:c(`memory.mapMaxEdgesPerNode`),last:!0,children:r(Q,{value:i.memory.mapMaxEdgesPerNode,min:1,max:20,step:1,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,mapMaxEdgesPerNode:e}}))})})]}),r(B,{title:`Worker Learnings Instruction`,watermark:`LRN`,badge:s(`memory`),icon:r(Re,{strokeWidth:2.4}),children:r(`div`,{className:`pt-2 pb-1`,children:[r(`div`,{className:`text-xs font-medium leading-relaxed text-slate-400 mb-3`,children:`This instruction is appended to every worker task prompt when auto-capture is enabled. It tells the AI provider what to observe and record in a temporary learnings file that gets processed into sprint memories.`}),r(Fe,{value:i.memory.workerLearningsInstruction,rows:16,placeholder:`Enter the instruction that tells workers what to capture...`,onChange:e=>o(t=>({...t,memory:{...t.memory,workerLearningsInstruction:e}}))})]})}),r($,{title:`Embedding models`,tone:`success`,children:`Download and manage embedding models from the Memory page. Once a model is active, new memories are automatically embedded for semantic search. The memory system works without a model — search falls back to text matching.`})]}):null};c(),a();var on=[`jules`,`gemini`,`antigravity`,`codex`,`claude-code`,`qwen-code`,`opencode`],sn={host:``,email:``,apiToken:``,autoCloseLinkedIssues:!1,defaultProject:``,closeTransitionName:`Done`},cn=e=>e===`jules`?`JLS`:e===`gemini`?`GMN`:e===`codex`?`CDX`:e===`qwen-code`?`QWN`:e===`opencode`?`OPC`:e===`antigravity`?`AGY`:`CLD`,ln=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`,un=e=>Object.entries(e).find(([,e])=>e.provider!==`jules`)?.[0]||null,dn=(e,t)=>{let n=Object.fromEntries(Object.entries(t).map(([t,n])=>{let r=e.aiProvider.providers[t],i=n.provider===`opencode`?ve(n,r?.model):null,a=n.provider===`qwen-code`?P(n,r?.model):null;return[t,r?{...r,provider:n.provider,name:n.name,...i?{model:i}:{},...a?{model:a}:{}}:{...O(n.provider,n.name),...i?{model:i}:{},...a?{model:a}:{}}]})),r=Object.fromEntries(Object.entries(e.aiProvider.invocationRouting).map(([e,t])=>[e,{...t,provider:t.provider&&n[t.provider]?t.provider:null,allowedProviders:t.allowedProviders.filter(e=>n[e]),providers:Object.fromEntries(Object.entries(t.providers).filter(([e])=>n[e]))}])),i=e.aiProvider.provider&&n[e.aiProvider.provider]?e.aiProvider.provider:Object.keys(n)[0]||null,a=n[e.workers.virtualWorkerProvider]?e.workers.virtualWorkerProvider:un(n)||i||e.workers.virtualWorkerProvider;return{...e,aiProvider:{...e.aiProvider,provider:i,providers:n,invocationRouting:r},workers:{...e.workers,virtualWorkerProvider:a}}},fn=(e,t)=>dn(e.defaults,t),pn=({label:e,icon:t,onClick:n,disabled:i=!1,tone:a=`neutral`})=>r(`button`,{type:`button`,disabled:i,onClick:n,className:`inline-flex h-9 shrink-0 items-center justify-center gap-2 rounded-[0.9rem] border px-3 text-[11px] font-bold uppercase tracking-[0.12em] transition-[background-color,border-color,color,transform,box-shadow] duration-200 hover:-translate-y-px focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 disabled:cursor-not-allowed disabled:opacity-45 disabled:hover:translate-y-0 ${a===`primary`?`border-signal-500/25 bg-signal-500/[0.1] text-signal-700 shadow-[0_10px_24px_rgba(0,224,160,0.08)] hover:border-signal-500/35 hover:bg-signal-500/[0.15] dark:text-signal-200`:`border-black/[0.08] bg-white/72 text-slate-600 hover:border-black/[0.14] hover:bg-white hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-300 dark:hover:border-white/[0.14] dark:hover:bg-white/[0.08] dark:hover:text-white`}`,children:[r(t,{className:`h-3.5 w-3.5`,strokeWidth:2.5}),e]}),mn=({label:e,tone:t=`neutral`})=>r(`span`,{className:`inline-flex h-6 items-center rounded-full border px-2.5 text-[9px] font-bold uppercase tracking-[0.15em] ${t===`active`?`border-signal-500/20 bg-signal-500/[0.1] text-signal-700 dark:text-signal-200`:t===`muted`?`border-black/[0.06] bg-black/[0.025] text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.035] dark:text-slate-500`:`border-black/[0.08] bg-black/[0.035] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-400`}`,children:e}),hn=({state:t})=>{let{activeScope:n,editableSettings:a,systemSettings:s,projectSources:c,selectedIntegration:u,setSelectedIntegration:d,integrations:f,importingHints:m,externalHints:h,handleImportHints:g,updateEditableSettings:_,updateSystem:v,updateProject:y}=t,x=(...e)=>J(n,c,...e),S=e=>Z(n,c,e),C=i(null),w=i(null),T=i(null),[E,ee]=l(u),te=i(!0);if(o(()=>{if(!C.current||!w.current||!T.current)return;if(te.current){te.current=!1,u===null?(X.set(w.current,{display:`block`,position:`relative`,x:`0%`,opacity:1}),X.set(T.current,{display:`none`,position:`absolute`,top:0,left:0,x:`100%`,opacity:0})):(X.set(w.current,{display:`none`,position:`relative`,x:`-100%`,opacity:0}),X.set(T.current,{display:`block`,position:`relative`,top:`auto`,left:`auto`,x:`0%`,opacity:1}),X.set(C.current,{height:`auto`}));return}let e=u!==null,t=X.timeline();e?(ee(u),X.set(w.current,{display:`block`,position:`relative`,x:`0%`,opacity:1}),X.set(T.current,{display:`block`,position:`absolute`,top:0,left:0,x:`100%`,opacity:0}),X.set(C.current,{height:T.current.offsetHeight}),t.to(w.current,{x:`-100%`,opacity:0,duration:.4,ease:`power3.inOut`},0).to(T.current,{x:`0%`,opacity:1,duration:.4,ease:`power3.inOut`,onComplete:()=>{w.current&&X.set(w.current,{display:`none`}),T.current&&X.set(T.current,{position:`relative`,top:`auto`,left:`auto`,x:`0%`,opacity:1}),C.current&&X.set(C.current,{height:`auto`})}},0)):(X.set(w.current,{display:`block`,position:`absolute`,top:0,left:0,x:`-100%`,opacity:0}),X.set(T.current,{display:`block`,position:`absolute`,top:0,left:0,x:`0%`,opacity:1}),X.set(C.current,{height:C.current.offsetHeight}),t.to(T.current,{x:`100%`,opacity:0,duration:.4,ease:`power3.inOut`,onComplete:()=>{ee(null),T.current&&X.set(T.current,{display:`none`})}},0).to(w.current,{x:`0%`,opacity:1,duration:.4,ease:`power3.inOut`,onComplete:()=>{w.current&&X.set(w.current,{position:`relative`,top:`auto`,left:`auto`,x:`0%`,opacity:1}),C.current&&X.set(C.current,{height:`auto`})}},0))},[u]),!a||!s)return null;let D=a.cliWorkflow.executionMode===`DOCKER`,ne=[{id:`api`,label:`API`,purpose:`Hosted orchestration and provider services`,items:f.filter(e=>e.id===`jules`)},{id:`cli`,label:`CLI`,purpose:`Provider credentials and local auth-copy settings`,items:f.filter(e=>on.includes(e.id)&&e.id!==`jules`)},{id:`git`,label:`GIT`,purpose:`Source-control tokens, CI, PRs, and git identity`,items:f.filter(e=>e.id===`github`||e.id===`gitlab`)},{id:`pm`,label:`PM`,purpose:`Project management and issue tracker connections`,items:f.filter(e=>e.id===`jira`)}].filter(e=>e.items.length>0),ie=e=>{v(n=>{let r=e({...n.integrations.providers}),i={...n,integrations:{...n.integrations,providers:r},defaults:fn(n,r)};return t.projectSettings&&y(e=>dn(e,r)),i})},O=e=>{if(n!==`system`){d(e);return}let t=qe(s,e).length+1,r=ln(e),i=`${we(e)} ${t}`;ie(t=>({...t,[r]:Le(e,i)})),d(e)},k=(e,n)=>{v(r=>{let i={...r.integrations.providers,[e]:Ye({...r.integrations.providers[e],...n})},a={...r,integrations:{...r.integrations,providers:i},defaults:fn(r,i)};return t.projectSettings&&y(e=>dn(e,i)),a})},ae=e=>{ie(t=>{let n={...t};return delete n[e],n})};return r(`div`,{className:`flex flex-col gap-5`,children:r(B,{title:`Integrations`,watermark:`INT`,badge:x(`integrations`,`cliWorkflow`),icon:r(p,{strokeWidth:2.4}),actions:u?null:r(e,{children:[r(mn,{label:`${f.length} integrations`}),r(mn,{label:D?`Docker auth copy`:`Host execution`,tone:D?`active`:`neutral`}),r(nt,{label:`Import host hints`,onClick:()=>void g(),busy:m})]}),children:r(`div`,{ref:C,className:`relative w-full overflow-hidden`,children:[r(`div`,{ref:w,className:`w-full`,children:r(`div`,{className:`space-y-4`,children:ne.map((e,t)=>r(`div`,{className:`space-y-3`,children:[t>0?r(`div`,{"aria-hidden":!0,className:`h-px bg-black/[0.06] dark:bg-white/[0.06]`}):null,r(`div`,{className:`flex flex-wrap items-center gap-3 px-1`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-500 dark:text-slate-300`,children:e.label}),r(`div`,{className:`h-px min-w-8 flex-1 bg-black/[0.06] dark:bg-white/[0.06]`}),r(`div`,{className:`text-[11px] font-medium text-slate-400 dark:text-slate-500`,children:e.purpose})]}),r(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:e.items.map(e=>{if(e.id===`github`||e.id===`gitlab`||e.id===`jira`){let t=e.id===`gitlab`,i=e.id===`jira`,o=n===`system`?s.integrations.jira:a.jira,c=!!(o?.host?.trim()&&o?.apiToken?.trim());return r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border border-black/[0.06] bg-white/88 p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:border-black/[0.12] hover:bg-white hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] dark:border-white/[0.08] dark:bg-void-800/80 dark:hover:border-white/[0.14] dark:hover:bg-void-800/90`,children:[r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-black/[0.08] to-transparent dark:via-white/[0.12]`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[i?r(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-[1rem] border border-[#0052CC]/18 bg-[#0052CC]/10 text-[#0052CC] dark:border-[#4C9AFF]/18 dark:bg-[#4C9AFF]/10 dark:text-[#4C9AFF]`,"aria-hidden":!0,title:`Jira`,children:r(Je,{className:`h-6 w-6`})}):r(oe,{id:e.id}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:e.label}),i&&c?r(mn,{label:`Active`,tone:`active`}):null]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:e.description})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3 pl-14`,children:[r(`div`,{className:`flex flex-wrap gap-2`,children:[r(mn,{label:i?`Issue tracker`:`Git host`}),r(mn,{label:i?c?`Search + transitions`:`Not configured`:t?`Token + CI`:`Token + auth mount`,tone:i&&c?`neutral`:`muted`})]}),r(pn,{label:`Manage`,icon:b,onClick:()=>d(e.id)})]})]})]},e.id)}let t=e.id,i=ze(t,s,h),o=Te(t,s,h),c=et(t,s,h,D);return r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] ${o?`border-signal-500/24 bg-white/90 hover:border-signal-500/34 dark:border-signal-400/24 dark:bg-void-800/82 dark:hover:border-signal-400/34 dark:hover:bg-void-800/92`:`border-black/[0.06] bg-white/88 hover:border-black/[0.12] hover:bg-white dark:border-white/[0.08] dark:bg-void-800/78 dark:hover:border-white/[0.14] dark:hover:bg-void-800/88`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-5 bottom-5 w-1 rounded-r-full transition-opacity ${o?`bg-signal-500 opacity-100 dark:bg-signal-400`:`bg-slate-300 opacity-0 group-hover:opacity-100 dark:bg-slate-600`}`}),r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-black/[0.08] to-transparent dark:via-white/[0.12]`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(W,{providerId:t,disabled:!o}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:e.label}),o?r(mn,{label:`Active`,tone:`active`}):null]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:e.description})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3 pl-14`,children:[r(`div`,{className:`flex flex-wrap gap-2`,children:[r(mn,{label:`${i} connected`,tone:i>0?`neutral`:`muted`}),c?r(mn,{label:c}):null]}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(pn,{label:`Add`,icon:I,disabled:n!==`system`,tone:`primary`,onClick:()=>O(t)}),r(pn,{label:`Manage`,icon:b,onClick:()=>d(t)})]})]})]})]},e.id)})})]},e.id))})}),r(`div`,{ref:T,className:`w-full`,children:(()=>{let t=E||u;if(!t)return null;let i=r(`button`,{className:`mb-4 flex items-center gap-2 text-sm text-neutral-400 transition-colors hover:text-white`,onClick:()=>d(null),children:[r(L,{className:`h-4 w-4`}),`Back to Integrations`]});if(t===`github`||t===`gitlab`){let o=t===`gitlab`,c=o?`GitLab`:`GitHub`,l=o?`gitlabToken`:`githubToken`;return r(e,{children:[i,r(B,{title:`${c} Configuration`,watermark:o?`GLB`:`GIT`,icon:r(b,{strokeWidth:2.4}),children:[r(Y,{label:`${c} token`,description:n===`system`?`System token used for ${c} repository, ${o?`merge request`:`pull request`}, and CI integration. Projects inherit this unless they override it.`:`Override the ${c} token for this scope. Leave blank to inherit the system token.`,badge:n===`system`?void 0:S(`git.${l}`),children:r(G,{value:n===`system`?s.integrations[l]||``:a.git[l]||``,onChange:e=>n===`system`?v(t=>({...t,integrations:{...t.integrations,[l]:e}})):_(t=>({...t,git:{...t.git,[l]:e}})),mono:!0})}),o?null:r(e,{children:[r(Y,{label:`Mount GitHub auth`,description:"Copy the host `gh` credential directory into Docker for this scope.",badge:S(`cliWorkflow.containerMountGithubAuth`),children:r(z,{"aria-label":`Toggle setting`,value:a.cliWorkflow.containerMountGithubAuth,onChange:()=>_(e=>({...e,cliWorkflow:{...e.cliWorkflow,containerMountGithubAuth:!e.cliWorkflow.containerMountGithubAuth}}))})}),r(Y,{label:`GitHub auth path`,description:`Host path copied into the Docker runtime for GitHub CLI auth.`,badge:S(`cliWorkflow.containerGithubAuthPath`),children:r(G,{value:a.cliWorkflow.containerGithubAuthPath,onChange:e=>_(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerGithubAuthPath:e}})),disabled:!a.cliWorkflow.containerMountGithubAuth,mono:!0})})]}),r(Y,{label:`Copy local git config`,description:"Use host `.gitconfig` in Docker instead of the configured Code UX git identity.",badge:S(`cliWorkflow.containerMountGitConfig`),last:a.cliWorkflow.containerMountGitConfig,children:r(z,{"aria-label":`Toggle setting`,value:a.cliWorkflow.containerMountGitConfig,onChange:()=>_(e=>({...e,cliWorkflow:{...e.cliWorkflow,containerMountGitConfig:!e.cliWorkflow.containerMountGitConfig}}))})}),a.cliWorkflow.containerMountGitConfig?null:r(e,{children:[r(Y,{label:`Git user name`,description:`Git author name configured inside provider containers.`,badge:S(`cliWorkflow.containerGitUserName`),children:r(G,{value:a.cliWorkflow.containerGitUserName,onChange:e=>_(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerGitUserName:e}})),placeholder:`Code UX`})}),r(Y,{label:`Git email`,description:`Git author email configured inside provider containers.`,badge:S(`cliWorkflow.containerGitUserEmail`),last:!0,children:r(G,{value:a.cliWorkflow.containerGitUserEmail,onChange:e=>_(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerGitUserEmail:e}})),placeholder:`agents@codeux.ai`,mono:!0})})]})]})]})}if(t===`jira`){let t=n===`system`?s.integrations.jira||sn:a.jira||sn,o=e=>{if(n===`system`){v(t=>({...t,integrations:{...t.integrations,jira:{...t.integrations.jira||sn,...e}}}));return}_(t=>({...t,jira:{...t.jira||sn,...e}}))};return r(e,{children:[i,r(B,{title:`Jira Configuration`,watermark:`JRA`,icon:r(b,{strokeWidth:2.4}),children:[n===`system`?null:r($,{title:`Project-scope Jira override`,children:`These fields override the system Jira connection for this scope. Cleared fields fall back to the system values.`}),r(Y,{label:`Jira site URL`,description:"Base URL for Jira Cloud or Data Center, for example `https://company.atlassian.net`.",badge:n===`system`?void 0:S(`jira.host`),children:r(G,{value:t.host,onChange:e=>o({host:e}),mono:!0})}),r(Y,{label:`Account email`,description:`Email used with Jira Cloud API tokens. Leave empty for bearer-token Jira deployments.`,badge:n===`system`?void 0:S(`jira.email`),children:r(G,{value:t.email,onChange:e=>o({email:e}),mono:!0})}),r(Y,{label:`API token`,description:`Jira API token used for issue search, issue context loading, and transitions.`,badge:n===`system`?void 0:S(`jira.apiToken`),children:r(G,{value:t.apiToken,onChange:e=>o({apiToken:e}),mono:!0})}),r(Y,{label:`Default project`,description:`Project key used to prefill the Jira import JQL.`,badge:n===`system`?void 0:S(`jira.defaultProject`),children:r(G,{value:t.defaultProject,onChange:e=>o({defaultProject:e.toUpperCase()}),mono:!0})}),r(Y,{label:`Close transition`,description:`Transition name used when auto-closing linked Jira issues after sprint completion.`,badge:n===`system`?void 0:S(`jira.closeTransitionName`),children:r(G,{value:t.closeTransitionName,onChange:e=>o({closeTransitionName:e})})}),r(Y,{label:`Auto-close Jira issues`,description:`Move linked Jira issues through the configured transition after the sprint completes.`,badge:n===`system`?void 0:S(`jira.autoCloseLinkedIssues`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:t.autoCloseLinkedIssues,onChange:()=>o({autoCloseLinkedIssues:!t.autoCloseLinkedIssues})})})]})]})}let o=t,c=re(qe(s,o));return n===`system`?r(e,{children:[i,r(B,{title:`${we(o)} Credentials`,watermark:cn(o),icon:r(ot,{strokeWidth:2.4}),children:[r(`div`,{className:`relative overflow-hidden rounded-[1.45rem] border border-black/[0.06] bg-[linear-gradient(135deg,rgba(255,255,255,0.9),rgba(248,250,252,0.62))] px-5 py-4 shadow-[0_14px_34px_rgba(15,23,42,0.045)] dark:border-white/[0.06] dark:bg-[linear-gradient(135deg,rgba(255,255,255,0.065),rgba(255,255,255,0.025))]`,children:[r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-signal-500/35 to-transparent`}),r(`div`,{className:`relative z-10 flex flex-wrap items-center justify-between gap-4`,children:[r(`div`,{className:`flex min-w-0 items-start gap-3`,children:[r(W,{providerId:o}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:[we(o),` instances`]}),r(`div`,{className:`mt-1 max-w-2xl text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:`Add as many named credentials as you need. AI Models routes each one independently for manual or weighted selection.`})]})]}),r(pn,{label:`Add instance`,icon:I,tone:`primary`,onClick:()=>O(o)})]})]}),c.length===0?r($,{title:`No credentials yet`,children:[`Add a `,we(o),` instance to make it available for routing.`]}):c.map(([e,t],n)=>r(He,{providerConfigId:e,provider:t,providerModel:s.defaults.aiProvider.providers[e]?.model||(t.provider===`opencode`?`anthropic/claude-sonnet-4-5`:`qwen3-coder-plus`),dockerExecutionEnabled:D,onUpdate:t=>k(e,t),onRemove:c.length>1?()=>ae(e):void 0,isLast:n===c.length-1,index:n,total:c.length},e)),r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:`Routing uses named provider instances exactly as configured on the AI Models page. If Docker mode is active, a provider instance marked with local auth will copy only that instance’s configured auth path into the runtime.`})]})]}):r(e,{children:[i,r(B,{title:`${we(o)} Integration`,watermark:cn(o),icon:r(p,{strokeWidth:2.4}),children:[r($,{title:`System-owned credentials`,children:`Provider credentials and auth-copy mounts are managed per instance at system scope. This keeps multiple named providers independent across every route.`}),r($,{title:`Scope behavior`,children:`Project and sprint scopes still control GitHub auth-copy mounts and git config. Provider-specific key or local-auth choices now live on each named provider instance.`})]})]})})()})]})})})};c(),a();var gn={orchestration:{label:`Orchestration`,description:`Projects, sprints, and tasks`,icon:f},agents_memory:{label:`Agents & Memory`,description:`Agent presets and project memory`,icon:m},platform:{label:`Platform`,description:`Settings, previews, and telemetry`,icon:_},advanced:{label:`Advanced`,description:`Deprecated and low-level tools`,icon:x}},_n=[`orchestration`,`agents_memory`,`platform`,`advanced`],vn=[{id:`claude-code`,label:`Claude Code`},{id:`gemini`,label:`Gemini`},{id:`codex`,label:`Codex`},{id:`qwen-code`,label:`Qwen Code`}],yn=/^[a-zA-Z0-9_-]+$/,bn=({label:e,tone:t=`neutral`})=>r(`span`,{className:`inline-flex h-6 items-center rounded-full border px-2.5 text-[9px] font-bold uppercase tracking-[0.15em] ${t===`active`?`border-signal-500/20 bg-signal-500/[0.1] text-signal-700 dark:text-signal-200`:t===`muted`?`border-black/[0.06] bg-black/[0.025] text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.035] dark:text-slate-500`:`border-black/[0.08] bg-black/[0.035] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-400`}`,children:e}),xn=({label:e,icon:t,onClick:n,tone:i=`neutral`,disabled:a=!1})=>r(`button`,{type:`button`,disabled:a,onClick:n,className:`inline-flex h-9 shrink-0 items-center justify-center gap-2 rounded-[0.9rem] border px-3 text-[11px] font-bold uppercase tracking-[0.12em] transition-[background-color,border-color,color,transform,box-shadow] duration-200 hover:-translate-y-px focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 disabled:cursor-not-allowed disabled:opacity-45 disabled:hover:translate-y-0 ${i===`primary`?`border-signal-500/25 bg-signal-500/[0.1] text-signal-700 shadow-[0_10px_24px_rgba(0,224,160,0.08)] hover:border-signal-500/35 hover:bg-signal-500/[0.15] dark:text-signal-200`:i===`danger`?`border-status-red/25 bg-status-red/[0.06] text-status-red hover:border-status-red/40 hover:bg-status-red/[0.1]`:`border-black/[0.08] bg-white/72 text-slate-600 hover:border-black/[0.14] hover:bg-white hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-300 dark:hover:border-white/[0.14] dark:hover:bg-white/[0.08] dark:hover:text-white`}`,children:[r(t,{className:`h-3.5 w-3.5`,strokeWidth:2.5}),e]}),Sn=e=>{if(!e)return`Not configured`;try{let t=new URL(e);return`${t.protocol}//${t.host}${t.pathname}`}catch{return e}},Cn=e=>e.description?e.description:e.transport===`stdio`?[e.command,...e.args??[]].filter(Boolean).join(` `)||`No command set`:Sn(e.url??``),wn=({state:t})=>{let{activeScope:i,systemSettings:a,projectSettings:o,selectedProject:s,updateSystem:c,updateProject:u}=t,d=i===`project`,[f,p]=l({kind:`list`}),m=(d?o?.mcpTools:a?.mcpTools)??[],h=(d?o?.customMcpServers:a?.customMcpServers)??[],g=e=>{d?u(t=>({...t,mcpTools:e})):c(t=>({...t,mcpTools:e}))},_=e=>{d?u(t=>({...t,customMcpServers:e})):c(t=>({...t,customMcpServers:e}))},v=n(()=>{let e=new Map;for(let t of m)e.set(t.name,t.enabled);return e},[m]),x=n(()=>Ke.map(e=>({name:e.name,enabled:v.get(e.name)??!0,isInternal:!0})),[v]),S=x.filter(e=>e.enabled).length,C=(e,t)=>{g(x.map(n=>n.name===e?{...n,enabled:t}:n))},w=(e,t)=>{let n=new Set(Ke.filter(t=>t.category===e).map(e=>e.name));g(x.map(e=>n.has(e.name)?{...e,enabled:t}:e))},T=()=>{let e=globalThis.crypto?.randomUUID?.()??`mcp_${Date.now()}`,t={id:e,name:``,label:``,enabled:!0,transport:`http`,url:``};_([...h,t]),p({kind:`custom`,id:e})},E=(e,t)=>{_(h.map(n=>n.id===e?{...n,...t}:n))},ee=e=>{_(h.filter(t=>t.id!==e)),p({kind:`list`})},te=r(`button`,{type:`button`,onClick:()=>p({kind:`list`}),className:`inline-flex items-center gap-2 self-start rounded-full border border-black/[0.08] bg-white/72 px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.14em] text-slate-600 transition-colors hover:border-black/[0.14] hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-300 dark:hover:text-white`,children:[r(L,{className:`h-3.5 w-3.5`}),`All MCP servers`]}),D=d&&s?`Editing MCP configuration for ${s.name}. Project values override system defaults.`:`System-wide MCP configuration injected into every CLI run across all projects.`;if(f.kind===`internal`)return r(e,{children:[te,r(B,{title:`Built-in MCP (Code UX)`,watermark:`MCP`,icon:r(y,{strokeWidth:2.4}),badge:`${S} enabled`,children:r($,{title:`Tool access`,children:`Toggle which Code UX tools the containerized CLIs may call. Disable a whole category or individual tools. Changes apply on the next CLI run.`})}),_n.map(e=>{let t=gn[e],n=Ke.filter(t=>t.category===e);if(n.length===0)return null;let i=n.every(e=>v.get(e.name)??!0),a=t.icon;return r(B,{title:t.label,icon:r(a,{strokeWidth:2.4}),badge:`${n.filter(e=>v.get(e.name)??!0).length}/${n.length}`,children:[r(Y,{label:`Enable all ${t.label.toLowerCase()} tools`,description:t.description,children:r(z,{"aria-label":`Toggle setting`,value:i,onChange:t=>w(e,t)})}),n.map((e,t)=>r(Y,{label:e.name,description:e.description,last:t===n.length-1,children:r(z,{"aria-label":`Toggle setting`,value:v.get(e.name)??!0,onChange:t=>C(e.name,t)})},e.name))]},e)})]});if(f.kind===`custom`){let t=h.find(e=>e.id===f.id);return t?r(e,{children:[te,r(Dn,{server:t,canRemove:!d,onChange:e=>E(t.id,e),onRemove:()=>ee(t.id)})]}):r(e,{children:[te,r(B,{title:`MCP server`,icon:r(y,{strokeWidth:2.4}),children:r($,{title:`Server not found`,tone:`warning`,children:`This MCP server is no longer available.`})})]})}return r(e,{children:r(B,{title:`MCP Servers`,watermark:`MCP`,icon:r(y,{strokeWidth:2.4}),children:[r($,{title:d?`Project scope`:`System scope`,children:D}),r(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border border-signal-500/24 bg-white/90 p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] dark:border-signal-400/24 dark:bg-void-800/82`,children:[r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-5 bottom-5 w-1 rounded-r-full bg-signal-500 dark:bg-signal-400`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-[0.9rem] border border-signal-500/25 bg-signal-500/[0.1] text-signal-600 dark:text-signal-300`,children:r(y,{className:`h-5 w-5`,strokeWidth:2})}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:`Code UX (built-in)`}),r(bn,{label:`Always on`,tone:`active`})]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:`Our internal MCP server. Manage which tool categories and tools the CLIs can call.`})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3 pl-13`,children:[r(bn,{label:`${S}/${x.length} tools`,tone:S>0?`neutral`:`muted`}),r(xn,{label:`Configure`,icon:b,onClick:()=>p({kind:`internal`})})]})]})]}),h.map(e=>{let t=e.enabled;return r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] ${t?`border-signal-500/24 bg-white/90 dark:border-signal-400/24 dark:bg-void-800/82`:`border-black/[0.06] bg-white/88 dark:border-white/[0.08] dark:bg-void-800/78`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-5 bottom-5 w-1 rounded-r-full transition-opacity ${t?`bg-signal-500 opacity-100 dark:bg-signal-400`:`bg-slate-300 opacity-0 group-hover:opacity-100 dark:bg-slate-600`}`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-[0.9rem] border border-black/[0.08] bg-black/[0.03] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300`,children:r(y,{className:`h-5 w-5`,strokeWidth:2})}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:e.label||e.name||`Untitled server`}),t?r(bn,{label:`Active`,tone:`active`}):r(bn,{label:`Disabled`,tone:`muted`})]}),r(`div`,{className:`mt-1 truncate text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:Cn(e)})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(bn,{label:e.transport===`stdio`?`stdio`:`HTTP`}),r(bn,{label:!e.providers||e.providers.length===0?`All CLIs`:`${e.providers.length} CLIs`})]}),r(`div`,{className:`flex items-center gap-2`,children:[r(z,{"aria-label":`Toggle setting`,value:e.enabled,onChange:t=>E(e.id,{enabled:t})}),r(xn,{label:`Manage`,icon:b,onClick:()=>p({kind:`custom`,id:e.id})})]})]})]})]},e.id)})]}),d?r($,{title:`Add servers at system scope`,tone:`neutral`,children:`New custom servers are added at system scope so every project inherits them. Switch to system scope to add a server. Here you can enable, disable, or override inherited servers.`}):r(`div`,{className:`flex justify-end`,children:r(xn,{label:`Add MCP server`,icon:I,tone:`primary`,onClick:T})})]})})},Tn=({resetKey:e,value:t,placeholder:n,onChange:i})=>{let[a,o]=l(()=>JSON.stringify(t??{},null,2)),[c,u]=l(null);return s(()=>{o(JSON.stringify(t??{},null,2)),u(null)},[e]),r(`div`,{className:`flex w-full flex-col gap-1.5`,children:[r(Fe,{value:a,onChange:e=>{o(e);let t=e.trim();if(t.length===0){u(null),i(void 0);return}try{let e=JSON.parse(t);if(!e||typeof e!=`object`||Array.isArray(e)){u(`Expected a JSON object of string values.`);return}let n={};for(let[t,r]of Object.entries(e)){if(typeof r!=`string`){u(`"${t}" must be a string value.`);return}n[t]=r}u(null),i(Object.keys(n).length>0?n:void 0)}catch{u(`Invalid JSON.`)}},rows:5,placeholder:n}),c?r(`span`,{className:`text-[11px] font-medium text-status-red`,children:c}):null]})},En=[{value:`http`,label:`HTTP / SSE`,hint:`Remote server via URL`},{value:`stdio`,label:`Command (stdio)`,hint:`Local process, e.g. npx`}],Dn=({server:t,canRemove:n,onChange:i,onRemove:a})=>{let o=yn.test(t.name),s=t.providers??[],c=t.transport===`stdio`,l=e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e);let n=Array.from(t);i({providers:n.length===0?void 0:n})},u=e=>{let t=e.split(`
1
+ import{O as e,S as t,_ as n,a as r,h as i,j as a,v as o,w as s,x as c,y as l}from"./vendor-Dl0fhdV0.js";import{t as u}from"./createLucideIcon-BshUfn15.js";import{t as d}from"./anchor-CpTtI1nV.js";import{i as f,n as p,r as m,t as h}from"./route-BlhVrKsR.js";import{n as g,t as _}from"./sliders-horizontal-6rJeI8Qo.js";import{t as v}from"./gauge-CRJ-5Qy4.js";import{t as y}from"./server-Colb_cUG.js";import{t as b}from"./settings-2-B5NbDo8J.js";import{t as x}from"./wrench-DSVlxBRn.js";import{r as S,s as C}from"./project-data-BSCsMQnj.js";import{f as w,i as T,l as E,o as ee,s as te,t as D,u as ne}from"./use-reduced-motion-Dxh6NCDM.js";import{$ as re,$t as ie,A as O,Ai as k,Ar as ae,At as A,C as oe,Cr as j,D as M,Dr as se,E as ce,Er as N,F as le,G as P,Gr as ue,H as de,Ir as F,M as fe,Mr as I,Ni as L,O as pe,Or as me,Q as he,Qr as ge,Qt as _e,R as ve,S as ye,St as be,Ti as xe,Tr as Se,U as Ce,V as R,W as we,Y as Te,Z as Ee,Zr as De,_ as z,_r as Oe,a as B,ar as ke,b as Ae,br as V,c as H,ci as je,cn as Me,d as U,ei as Ne,f as W,fn as Pe,g as G,h as Fe,i as K,ii as Ie,j as Le,ji as Re,k as ze,ki as Be,kr as Ve,l as He,m as q,mr as Ue,ni as We,o as J,oi as Ge,ot as Ke,p as Y,pr as X,q as qe,s as Z,t as Je,tt as Ye,u as Q,vi as Xe,wi as Ze,y as Qe,yr as $e,z as et}from"./index-DdNzHP9F.js";import{i as $,n as tt,r as nt,t as rt}from"./BranchNameSchemeEditor-DfnH2VYW.js";var it=u(`cog`,[[`path`,{d:`M11 10.27 7 3.34`,key:`16pf9h`}],[`path`,{d:`m11 13.73-4 6.93`,key:`794ttg`}],[`path`,{d:`M12 22v-2`,key:`1osdcq`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M14 12h8`,key:`4f43i9`}],[`path`,{d:`m17 20.66-1-1.73`,key:`eq3orb`}],[`path`,{d:`m17 3.34-1 1.73`,key:`2wel8s`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`m20.66 17-1.73-1`,key:`sg0v6f`}],[`path`,{d:`m20.66 7-1.73 1`,key:`1ow05n`}],[`path`,{d:`m3.34 17 1.73-1`,key:`nuk764`}],[`path`,{d:`m3.34 7 1.73 1`,key:`1ulond`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`circle`,{cx:`12`,cy:`12`,r:`8`,key:`46899m`}]]),at=u(`image`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}]]),ot=u(`key`,[[`path`,{d:`m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4`,key:`g0fldk`}],[`path`,{d:`m21 2-9.6 9.6`,key:`1j0ho8`}],[`circle`,{cx:`7.5`,cy:`15.5`,r:`5.5`,key:`yqb3hr`}]]),st=u(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),ct=u(`shield-alert`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`M12 8v4`,key:`1got3b`}],[`path`,{d:`M12 16h.01`,key:`1drbdi`}]]);c();var lt=`You have unsaved changes. Leave this page?`,ut=new Map,dt=!1,ft=!1,pt=typeof window<`u`?window.location.href:``,mt=null,ht=null,gt=null,_t=null,vt=e=>{ft=!0;try{e()}finally{ft=!1}},yt=()=>{for(let e of ut.values())if(e.shouldBlock())return e;return null},bt=e=>{if(ft)return!0;let t=yt();return t?t.confirmNavigation(e):!0},xt=e=>e?new URL(String(e),window.location.href).href:window.location.href,St=()=>{dt||typeof window>`u`||(mt=window.history.pushState.bind(window.history),ht=window.history.replaceState.bind(window.history),window.history.pushState=((e,t,n)=>{let r=xt(n);r!==window.location.href&&!bt(()=>{vt(()=>{window.history.pushState(e,t,n)})})||(mt?.(e,t,n),pt=r)}),window.history.replaceState=((e,t,n)=>{let r=xt(n);r!==window.location.href&&!bt(()=>{vt(()=>{window.history.replaceState(e,t,n)})})||(ht?.(e,t,n),pt=r)}),gt=e=>{if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target?.closest(`a[href]`);if(!t||t.target===`_blank`||t.hasAttribute(`download`))return;let n=new URL(t.href,window.location.href);n.origin!==window.location.origin||n.href===window.location.href||bt(()=>{vt(()=>{window.location.href=n.href})})||(e.preventDefault(),e.stopPropagation())},_t=()=>{let e=window.location.href;if(e!==pt){if(!bt(()=>{vt(()=>{window.location.href=e})})){vt(()=>{mt?.(window.history.state,document.title,pt)});return}pt=e}},window.addEventListener(`click`,gt,!0),window.addEventListener(`popstate`,_t),dt=!0)},Ct=()=>{!dt||typeof window>`u`||(mt&&(window.history.pushState=mt),ht&&(window.history.replaceState=ht),gt&&window.removeEventListener(`click`,gt,!0),_t&&window.removeEventListener(`popstate`,_t),mt=null,ht=null,gt=null,_t=null,dt=!1)},wt=({shouldBlock:e,confirmNavigation:t})=>{if(typeof window>`u`)return()=>void 0;St();let n=Symbol(`navigation-blocker`);return ut.set(n,{shouldBlock:e,confirmNavigation:t??(e=>window.confirm(lt))}),()=>{ut.delete(n),ut.size===0&&Ct()}},Tt={jules:`Jules`,gemini:`Gemini`,codex:`Codex`,"claude-code":`Claude Code`,"qwen-code":`Qwen Code`,opencode:`OpenCode`,antigravity:`Antigravity`},Et=[{value:`SMALL`,label:`Small`},{value:`MEDIUM`,label:`Medium`},{value:`HIGH`,label:`High`}],Dt=[{id:`task_coding`,label:`Task coding`,description:`Primary coding execution for provider-routed task work.`},{id:`planning`,label:`Planning`,description:`Virtual planning and prompt-improvement requests.`},{id:`dashboard_reply`,label:`Dashboard reply`,description:`Reply-only dashboard chat responses generated by a CLI provider.`},{id:`clarification_reply`,label:`Clarification reply`,description:`Automatic clarification answers sent back to blocked workers.`},{id:`qa_review`,label:`QA review`,description:`Completion-time quality assurance reviews that can request follow-up fixes.`},{id:`ci_fix`,label:`CI fix`,description:`Worker-owned CI repair loops and retry work.`},{id:`merge_conflict`,label:`Merge conflict`,description:`Worker-owned merge conflict resolution runs.`}],Ot=[{value:`GLOBAL`,label:`Global defaults`},{value:`WORKER`,label:`Worker defaults`}],kt=[{id:`jules`,label:`Jules`,description:`Google Jules API service for agent session and workspace orchestration`},{id:`gemini`,label:`Gemini`,description:`Hosted execution provider and future worker endpoint`},{id:`antigravity`,label:`Antigravity`,description:`Google Antigravity CLI (agy) local container worker execution`},{id:`codex`,label:`Codex`,description:`Hosted execution provider and future worker endpoint`},{id:`claude-code`,label:`Claude Code`,description:`Hosted execution provider and future worker endpoint`},{id:`qwen-code`,label:`Qwen Code`,description:`Qwen CLI with OAuth, Alibaba Coding Plan, and custom model providers`},{id:`opencode`,label:`OpenCode`,description:`OpenCode CLI with local auth, provider keys, and custom OpenAI-compatible endpoints`},{id:`github`,label:`GitHub`,description:`Repository, pull request, branch, and CI integration`},{id:`gitlab`,label:`GitLab`,description:`GitLab repository, merge request, and CI token integration`},{id:`jira`,label:`Jira`,description:`Atlassian Jira issue search, sprint linking, and completion transitions`}],At=[{value:`planningMissing`,label:`Planning Missing`,description:`Shown when a sprint has no planned tasks yet.`},{value:`planningCreated`,label:`Planning Created`,description:`Shown after a planning request is prepared.`},{value:`branchMissing`,label:`Branch Missing`,description:`Shown when the sprint feature branch must be created first.`},{value:`mergeHeader`,label:`Merge Header`,description:`Header for merge-required intervention output.`},{value:`mergeTask`,label:`Merge Task`,description:`Per-task merge instruction block.`},{value:`actionRequiredAgentHeader`,label:`Agent Attention Header`,description:`Header for agent-owned intervention items.`},{value:`actionRequiredAgentTask`,label:`Agent Attention Task`,description:`Per-task agent intervention block.`},{value:`actionRequiredHumanHeader`,label:`Human Attention Header`,description:`Header for human-owned intervention items.`},{value:`actionRequiredHumanTask`,label:`Human Attention Task`,description:`Per-task human intervention block.`},{value:`watchHeader`,label:`Run Header`,description:`Top section for live orchestration status output.`},{value:`watchMergeRequired`,label:`Run Merge Required`,description:`Shown when orchestration pauses for merges.`},{value:`watchNoMoreActions`,label:`Run No More Actions`,description:`Shown when orchestration pauses with nothing runnable.`},{value:`completionSteps`,label:`Completion Steps`,description:`Final sprint completion guidance.`},{value:`cleanupAllMerged`,label:`Cleanup All Merged`,description:`Shown when cleanup confirms a fully merged sprint.`},{value:`cleanupFailed`,label:`Cleanup Failed`,description:`Shown when cleanup is skipped because tasks failed.`},{value:`cleanupDeferred`,label:`Cleanup Deferred`,description:`Shown when cleanup waits on merges.`},{value:`cleanupEmpty`,label:`Cleanup Empty`,description:`Shown when the sprint is still empty.`}],jt=/(?:^|[\s_-])qa(?:$|[\s_-])|quality[\s_-]*assurance/i,Mt=e=>[...e].sort((e,t)=>{let n=(e.labels||[]).some(e=>jt.test(e));return n===(t.labels||[]).some(e=>jt.test(e))?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1}).map(e=>({value:e.id,label:e.name,avatarConfig:e.avatarConfig})),Nt=(e,r)=>{let{deleteProject:a,selectedProject:o,selectedProjectId:c}=S(),u=i(!1),d=i(null);s(()=>{let e=e=>{let t=e.target,n=t&&(t.tagName===`INPUT`||t.tagName===`TEXTAREA`||t.tagName===`SELECT`||t.isContentEditable);e.key===`/`&&!n&&(e.preventDefault(),d.current?.focus(),d.current?.select())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let[f,p]=l(`general`),[m,h]=l(`system`),[g,_]=l(null),[v,y]=l(`planningMissing`),[b,x]=l(`task_coding`),[D,re]=l(null),[ie,O]=l(``),[k,ae]=l(null),[A,oe]=l(null),[j,se]=l(null),[N,le]=l(null),[P,ue]=l({}),[de,F]=l(!0),[I,L]=l(null),[me,he]=l(null),ge=t(()=>{L(null),he(null)},[]),[_e,ve]=l(!1),[ye,be]=l(!1),[xe,Se]=l(!1),[Ce,R]=l(!1),[we,Te]=l(!1),[Ee,De]=l(!1),[z,Oe]=l(null),[B,ke]=l([]),Ae=i(`general`),V=t(async()=>{F(!0);try{let[e,t]=await Promise.all([ee(),C()]);if(k||h(e.runtime.lastActiveScope===`project`&&c?`project`:`system`),(!u.current||!k)&&ae(pe(e)),oe(pe(e)),Oe(t),c){let[e,t]=await Promise.all([T(c,{cache:`reload`}),Pe(c).catch(()=>[])]),n=fe(e.settings);(!u.current||!j)&&se(M(n)),le(M(n)),ue(e.sources),ke(Mt(t))}else se(null),le(null),ue({}),ke([]);L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{F(!1)}},[c]);s(()=>{V()},[V]),s(()=>{if(typeof window>`u`)return;let e=()=>{f!==`models`||u.current||V()};return window.addEventListener(`codeux:settings-updated`,e),()=>window.removeEventListener(`codeux:settings-updated`,e)},[f,V]),s(()=>{let e=Ae.current===`models`,t=f===`models`;Ae.current=f,!(!t||e||u.current)&&V()},[f,V]),s(()=>{!o&&m===`project`&&h(`system`)},[m,o]),s(()=>{if(!me)return;let e=window.setTimeout(()=>he(null),2400);return()=>window.clearTimeout(e)},[me]);let H=n(()=>k&&A?JSON.stringify(k)!==JSON.stringify(A):!1,[A,k]),je=n(()=>j&&N?JSON.stringify(j)!==JSON.stringify(N):!1,[j,N]);u.current=H||je;let Me=m===`system`?k?.defaults??null:j,U=e.find(e=>e.id===f)??e[0];s(()=>{typeof window>`u`||window.dispatchEvent(new CustomEvent(`codeux:appearance-preview`,{detail:{appearance:Me?.appearance??null}}))},[Me?.appearance]),s(()=>{if(!(typeof window>`u`))return()=>{window.dispatchEvent(new CustomEvent(`codeux:appearance-preview`,{detail:{appearance:null}}))}},[]);let Ne=ie.trim().toLowerCase(),W=n(()=>Ne?e.filter(e=>[e.label,e.description,...r[e.id]||[]].join(` `).toLowerCase().includes(Ne)):e,[Ne]);s(()=>{W.length!==0&&(W.some(e=>e.id===f)||p(W[0].id))},[f,W]);let G=t(e=>{ae(t=>t&&e(t))},[]),Fe=t(e=>{se(t=>t&&e(t))},[]),K=t(e=>{if(m===`system`){G(t=>({...t,defaults:e(t.defaults)}));return}Fe(e)},[m,Fe,G]),Ie=t(async()=>{if(k){De(!0);try{ae(ce(k,await C())),he(`Imported missing integration secrets from env/settings.json.`),L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{De(!1)}}},[k]),Le=t(async()=>{let e=!0,t=!0,n=[];if(H&&k){ve(!0);try{let e=await w(k);if(ae(pe(e)),oe(pe(e)),o){let e=await T(o.id,{cache:`reload`}),t=fe(e.settings);se(M(t)),le(M(t)),ue(e.sources)}}catch(t){n.push(t instanceof Error?t.message:String(t)),e=!1}finally{ve(!1)}}if(je&&o&&j){be(!0);try{await ne(o.id,j);let e=await T(o.id,{cache:`reload`}),t=fe(e.settings);se(M(t)),le(M(t)),ue(e.sources)}catch(e){n.push(e instanceof Error?e.message:String(e)),t=!1}finally{be(!1)}}return n.length>0?L(n.join(` | `)):L(null),e&&t?(he(H&&je?`All settings saved.`:H?`System settings saved.`:je&&o?`Project settings saved for ${o.name}.`:`Settings saved.`),!0):!1},[H,je,k,o,j]),Re=t(async()=>{if(o){Se(!0);try{await te(o.id);let e=await T(o.id,{cache:`reload`}),t=fe(e.settings);se(M(t)),le(M(t)),ue(e.sources),L(null),he(`Project overrides reset for ${o.name}.`)}catch(e){L(e instanceof Error?e.message:String(e))}finally{Se(!1)}}},[o]),ze=t(async()=>{if(o){R(!0);try{await a(o.id),h(`system`),p(`general`),he(`Project ${o.name} deleted.`),L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{R(!1)}}},[o,a]),Be=t(async()=>{Te(!0);try{await E(),h(`system`),p(`general`),await V(),he(`Database reset to a clean state.`),L(null)}catch(e){L(e instanceof Error?e.message:String(e))}finally{Te(!1)}},[V]),Ve=t((e,t)=>t.split(`.`).reduce((e,t)=>e&&e[t],e),[]),He=t((e,t,n)=>{let r=t.split(`.`),i={...e},a=i;for(let e=0;e<r.length-1;e++){let t=r[e];a[t]={...a[t]},a=a[t]}return a[r[r.length-1]]=n,i},[]),q=t(e=>{if(!k||!j)return;let t=Ve(k.defaults,e);se(n=>n&&He(n,e,t)),ue(t=>({...t,[e]:`system`}))},[k,j,Ve,He]),Ue=t(e=>{if(m===`project`&&P[e]===`project`)return()=>q(e)},[m,P,q]),We=t(async e=>{if(h(e),k){let t={...k,runtime:{...k.runtime,lastActiveScope:e}};ae(t),oe(pe(t));try{await w(t)}catch{}}},[k]),[J,Ge]=l(!1),Ke=i(null),Y=i(!1),X=t(()=>{let e=Ke.current;Ke.current=null,e&&(Y.current=!0,e())},[]),qe=t(()=>{Ge(!1),X()},[X]),Z=t(()=>{Ge(!1),Ke.current=null},[]),Je=t(async()=>{await Le()&&(Ge(!1),X())},[Le,X]);s(()=>{if(typeof window>`u`)return;let e=wt({shouldBlock:()=>u.current,confirmNavigation:e=>(Ke.current=e,Ge(!0),!1)});return()=>{e()}},[]);let Ye=H||je;return s(()=>{if(typeof window>`u`||!Ye)return;let e=e=>{Y.current||(e.preventDefault(),e.returnValue=``)};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Ye]),{clearFeedback:ge,activeCategory:f,setActiveCategory:p,activeScope:m,setActiveScope:We,selectedIntegration:g,setSelectedIntegration:_,selectedAgentTemplate:v,setSelectedAgentTemplate:y,activeInvocationRoute:b,setActiveInvocationRoute:x,activeProviderPanel:D,setActiveProviderPanel:re,settingsSearch:ie,setSettingsSearch:O,systemSettings:k,projectSettings:j,projectSources:P,editableSettings:Me,loading:de,error:I,saveMessage:me,savingSystem:_e,savingProject:ye,activeSaving:_e||ye,activeDirty:Ye,resettingProject:xe,deletingProject:Ce,resettingDatabase:we,importingHints:Ee,externalHints:z,activeCategoryConfig:U,filteredCategories:W,categories:e,providerLabels:Tt,thinkingModeOptions:Et,invocationRouteDefinitions:Dt,routingProfileOptions:Ot,integrations:kt,agentInstructionTemplateOptions:At,projectAgentPresetOptions:B,selectedProject:o,updateSystem:G,updateProject:Fe,updateEditableSettings:K,handleImportHints:Ie,handleSave:Le,handleResetProject:Re,handleDeleteProject:ze,handleResetDatabase:Be,loadSettings:V,isDirtyRef:u,searchInputRef:d,resetFieldToDefault:q,getFieldReset:Ue,showUnsavedModal:J,confirmDiscard:qe,cancelDiscard:Z,saveAndLeave:Je}};c();var Pt=[{id:`general`,num:`01`,label:`General`,icon:_,description:`Scope, runtime, and automation posture`},{id:`appearance`,num:`02`,label:`Appearance`,icon:F,description:`Dashboard layout and theme preferences`},{id:`models`,num:`03`,label:`AI Models`,icon:Ge,description:`Provider routing, models, and weighting`},{id:`sprint`,num:`04`,label:`Sprint & Git`,icon:j,description:`Git flow, branch naming, merge rules, and execution runtime`},{id:`browser`,num:`05`,label:`Browser Preview`,icon:je,description:`Preview runtime, browser visibility, and container policy`},{id:`agents`,num:`06`,label:`Agents`,icon:k,description:`Project-local markdown mirrors and agent authoring behavior`},{id:`memory`,num:`07`,label:`Memory`,icon:m,description:`Embedding models, auto-capture, and promotion policy`},{id:`integrations`,num:`08`,label:`Integrations`,icon:p,description:`Provider keys, Git hosts, and external connection policy`},{id:`mcp`,num:`09`,label:`MCP`,icon:y,description:`MCP servers injected into CLIs and built-in tool access`},{id:`danger`,num:`10`,label:`Danger Zone`,icon:Oe,description:`Reset project overrides only when needed`,danger:!0}],Ft={general:[`automation`,`scope`,`runtime`,`dashboard`,`clarification`,`pause`,`resume`],appearance:[`theme`,`layout`,`dock`,`sidebar`,`light`,`dark`,`motion`,`appearance`],models:[`provider`,`routing`,`model`,`thinking`,`worker`,`codex`,`gemini`,`claude`,`jules`],sprint:[`ci`,`merge`,`watch`,`loop`,`docker`,`execution`,`cleanup`,`branch`,`branch name`,`branch naming`,`branch scheme`,`default branch`,`feature branch`,`git flow`,`autofix`,`browser`,`preview`,`container`,`port`],browser:[`browser`,`preview`,`container`,`port`,`routing`,`rebuild`,`launch`,`concurrent`,`iframe`],agents:[`agent`,`prompt`,`template`,`markdown`,`instruction`],memory:[`memory`,`embedding`,`capture`,`promotion`,`learning`],integrations:[`github`,`gitlab`,`jira`,`atlassian`,`token`,`api key`,`auth`,`credential`,`integration`],mcp:[`mcp`,`server`,`tool`,`tools`,`custom mcp`,`model context protocol`,`code_ux`,`toggle`,`http`,`sse`],danger:[`reset`,`delete`,`danger`,`database`,`wipe`]},It=({filteredCategories:e,activeCategory:t,settingsSearch:n,onSwitchCategory:a})=>{let o=n.trim().toLowerCase(),s=i([]),c=(t,n)=>{if(t.key===`ArrowDown`){t.preventDefault();let r=(n+1)%e.length;s.current[r]?.focus(),a(e[r].id)}else if(t.key===`ArrowUp`){t.preventDefault();let r=(n-1+e.length)%e.length;s.current[r]?.focus(),a(e[r].id)}};return r(`div`,{className:`sticky top-16 flex flex-col gap-3 rounded-[1.75rem] border border-[color:var(--border-hairline)] bg-[var(--surface-glass)] p-3 backdrop-blur-2xl shadow-[var(--elevation-base)]`,children:[r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.03] px-4 py-3 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[r(`div`,{className:`flex items-center gap-2 text-[9px] font-bold uppercase tracking-[0.2em] text-slate-400 dark:text-slate-600`,children:[r(ue,{className:`h-3.5 w-3.5`,strokeWidth:2}),`Categories`]}),r(`div`,{className:`mt-2 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:o?`Showing ${e.length} categories for “${n.trim()}”.`:`Jump directly into the area you need without digging through the full settings tree.`})]}),e.map((e,n)=>{let i=t===e.id,l=e.danger,u=!!(o&&(Ft[e.id]?.some(e=>e.includes(o))||e.label.toLowerCase().includes(o)||e.description.toLowerCase().includes(o)));return r(`button`,{type:`button`,ref:e=>{s.current[n]=e},onClick:()=>a(e.id),onKeyDown:e=>c(e,n),"aria-current":i?`page`:void 0,className:`group relative flex w-full items-center gap-3.5 rounded-[1.1rem] px-4 py-3.5 text-left ${A} ${l?`focus-visible:ring-status-red`:``} ${i?l?`bg-status-red/[0.07] dark:bg-status-red/[0.08]`:`bg-signal-500/10`:`hover:bg-[var(--fill-muted-hover)]`} ${u&&!i?l?`ring-1 ring-status-red/30 bg-status-red/[0.03] dark:ring-status-red/40 dark:bg-status-red/[0.04]`:`ring-1 ring-signal-500/30 bg-signal-500/[0.03] dark:ring-signal-500/40 dark:bg-signal-500/[0.04]`:``}`,children:[i?r(`div`,{className:`absolute left-0 top-3 bottom-3 w-[3px] rounded-r-full ${l?`bg-status-red`:`bg-signal-500 dark:bg-signal-400`}`}):null,r(`span`,{className:`w-5 shrink-0 text-right font-mono text-[9px] font-bold transition-colors duration-200 ${i?l?`text-status-red/60`:`text-signal-600/60 dark:text-signal-400/60`:`text-slate-300 dark:text-slate-600`}`,children:e.num}),r(e.icon,{className:`h-4 w-4 shrink-0 transition-colors duration-200 ${i?l?`text-status-red`:`text-signal-600 dark:text-signal-400`:`text-slate-400 group-hover:text-slate-600 dark:text-slate-500 dark:group-hover:text-slate-300`}`,strokeWidth:1.75}),r(`div`,{className:`min-w-0 flex-1`,children:[r(`div`,{className:`text-sm font-semibold transition-colors duration-200 ${i?l?`text-status-red`:`text-signal-700 dark:text-signal-300`:`text-slate-700 group-hover:text-slate-900 dark:text-slate-300 dark:group-hover:text-slate-100`}`,children:e.label}),r(`div`,{className:`mt-0.5 truncate text-[10px] font-medium leading-tight transition-colors duration-200 ${i?l?`text-status-red/70`:`text-signal-700/70 dark:text-signal-300/70`:`text-slate-400 group-hover:text-slate-500 dark:text-slate-500 dark:group-hover:text-slate-400`}`,children:e.description})]})]},e.id)}),e.length===0?r($,{title:`No matches`,children:"Try broader terms like `routing`, `CI`, `auth`, `agent`, or `memory`."}):null]})},Lt=({projectName:e,projectId:t,baseDir:n,sourceType:i})=>r(B,{title:`Project Context`,watermark:`PRJ`,icon:r(Ne,{strokeWidth:2.4}),children:[r(Y,{label:`Project`,description:`The selected project receives its own override document and inherits all other values from system defaults.`,children:r(`div`,{className:`rounded-xl bg-black/[0.04] px-3 py-2 text-sm font-semibold text-slate-700 dark:bg-white/[0.04] dark:text-slate-200`,children:e})}),r(Y,{label:`Project id`,description:`Stable identifier used by the API and runtime.`,children:r(`div`,{className:`rounded-xl bg-black/[0.04] px-3 py-2 font-mono text-sm text-slate-600 dark:bg-white/[0.04] dark:text-slate-300`,children:t})}),r(Y,{label:`Base directory`,description:`Workers and local execution enter this directory before acting.`,children:r(`div`,{className:`max-w-[28rem] rounded-xl bg-black/[0.04] px-3 py-2 font-mono text-sm text-slate-600 dark:bg-white/[0.04] dark:text-slate-300`,children:n})})]}),Rt=({settings:e,update:t,getBadge:n,getFieldBadge:i})=>r(B,{title:`Automation`,watermark:`AUTO`,badge:n(`automationLevel`,`automationInterventions`),icon:r(k,{strokeWidth:2.4}),children:[r(Y,{label:`Automation level`,description:`Choose how much the project should proceed without a worker stepping in.`,badge:i(`automationLevel`),children:r(U,{value:e.automationLevel,onChange:e=>t(t=>({...t,automationLevel:e})),options:[{value:`FULL`,label:`Full`,hint:`Moves without confirmation gates.`},{value:`SEMI_AUTO`,label:`Semi-auto`,hint:`Automates routine recovery only.`},{value:`ALWAYS_ASK`,label:`Always ask`,hint:`Requires a decision at every gate.`}]})}),r(Y,{label:`Auto-approve plans`,description:`Use the orchestrator path for routine plan confirmations.`,badge:i(`automationInterventions.autoApprovePlan`),children:r(z,{"aria-label":`Toggle setting`,value:e.automationInterventions.autoApprovePlan,onChange:()=>t(e=>({...e,automationInterventions:{...e.automationInterventions,autoApprovePlan:!e.automationInterventions.autoApprovePlan}}))})}),r(Y,{label:`Auto-answer clarifications`,description:`Answer routine clarification requests automatically when the configured template is sufficient.`,badge:i(`automationInterventions.autoAnswerClarification`),children:r(z,{"aria-label":`Toggle setting`,value:e.automationInterventions.autoAnswerClarification,onChange:()=>t(e=>({...e,automationInterventions:{...e.automationInterventions,autoAnswerClarification:!e.automationInterventions.autoAnswerClarification}}))})}),e.automationInterventions.autoAnswerClarification&&r(Y,{label:`Clarification answer mode`,description:`Choose whether to use a static template or let a worker generate a contextual answer.`,badge:i(`automationInterventions.autoAnswerClarificationMode`),children:r(U,{value:e.automationInterventions.autoAnswerClarificationMode,onChange:e=>t(t=>({...t,automationInterventions:{...t.automationInterventions,autoAnswerClarificationMode:e}})),options:[{value:`TEMPLATE`,label:`Template`,hint:`Fast static reply.`},{value:`WORKER`,label:`Worker`,hint:`Contextual provider-generated reply.`}]})}),(!e.automationInterventions.autoAnswerClarification||e.automationInterventions.autoAnswerClarificationMode===`TEMPLATE`)&&r(Y,{label:`Clarification answer template`,description:`Template used when project automation answers a clarification request.`,badge:i(`automationInterventions.clarificationAnswerTemplate`),children:r(G,{value:e.automationInterventions.clarificationAnswerTemplate,onChange:e=>t(t=>({...t,automationInterventions:{...t.automationInterventions,clarificationAnswerTemplate:e}})),placeholder:`Respond with the usual clarification template...`})}),r(Y,{label:`Auto-resume paused runs`,description:`Resume a project automatically when a transient pause clears.`,badge:i(`automationInterventions.autoResumePaused`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:e.automationInterventions.autoResumePaused,onChange:()=>t(e=>({...e,automationInterventions:{...e.automationInterventions,autoResumePaused:!e.automationInterventions.autoResumePaused}}))})})]}),zt=({settings:e,update:t,getBadge:n,getFieldBadge:i})=>r(B,{title:`Docker Runtime`,watermark:`DKR`,badge:n(`cliWorkflow`),icon:r(it,{strokeWidth:2.4}),children:[r(Y,{label:`Container image`,description:`Default container image used for the task execution runtime.`,badge:i(`cliWorkflow.containerImage`),children:r(G,{value:e.cliWorkflow.containerImage,onChange:e=>t(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerImage:e}})),mono:!0})}),r(Y,{label:`Container setup script`,description:`Optional setup script run inside the container before task execution.`,badge:i(`cliWorkflow.containerSetupScriptPath`),children:r(G,{value:e.cliWorkflow.containerSetupScriptPath,onChange:e=>t(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerSetupScriptPath:e}})),mono:!0})}),r(Y,{label:`Cache setup as image`,description:`Build and reuse a derived Docker image from the base image plus setup script contents.`,badge:i(`cliWorkflow.containerCacheSetupScriptImage`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:e.cliWorkflow.containerCacheSetupScriptImage,onChange:()=>t(e=>({...e,cliWorkflow:{...e.cliWorkflow,containerCacheSetupScriptImage:!e.cliWorkflow.containerCacheSetupScriptImage}}))})})]}),Bt=({state:e})=>{let{activeScope:t,systemSettings:n,projectSettings:i,selectedProject:a,updateSystem:o,editableSettings:s,updateEditableSettings:c,projectSources:l}=e,u=(...e)=>J(t,l,...e),d=e=>Z(t,l,e);return t===`system`?r(`div`,{className:`flex flex-col gap-5`,children:[s?r(Rt,{settings:s,update:c,getBadge:u,getFieldBadge:d}):null,r(B,{title:`System Runtime`,watermark:`SYS`,icon:r(it,{strokeWidth:2.4}),children:[r(Y,{label:`Dashboard port`,description:`System-wide HTTP port for the dashboard server.`,children:r(Q,{value:n?.runtime.dashboardPort??4444,onChange:e=>o(t=>({...t,runtime:{...t.runtime,dashboardPort:e}})),min:1,max:65535})}),r(Y,{label:`Console log level`,description:`Minimum severity printed to the server console. Off suppresses console logging.`,children:r(U,{value:n?.runtime.consoleLogLevel??`info`,onChange:e=>o(t=>({...t,runtime:{...t.runtime,consoleLogLevel:e===`off`||e===`debug`||e===`warn`||e===`error`?e:`info`}})),options:[{value:`off`,label:`Off`,hint:`Suppress console output.`},{value:`debug`,label:`Debug`,hint:`Everything.`},{value:`info`,label:`Info`,hint:`Normal activity.`},{value:`warn`,label:`Warn`,hint:`Warnings and errors.`},{value:`error`,label:`Error`,hint:`Errors only.`}]})}),r(Y,{label:`Debug file level`,description:`Minimum severity written to .code-ux/debug.log. Off disables file logging.`,children:r(U,{value:n?.runtime.debugLogFileLevel??`error`,onChange:e=>o(t=>({...t,runtime:{...t.runtime,debugLogFileLevel:e===`debug`||e===`info`||e===`warn`||e===`off`?e:`error`}})),options:[{value:`off`,label:`Off`,hint:`Do not write the file.`},{value:`debug`,label:`Debug`,hint:`Everything.`},{value:`info`,label:`Info`,hint:`Normal activity.`},{value:`warn`,label:`Warn`,hint:`Warnings and errors.`},{value:`error`,label:`Error`,hint:`Default for debug.log.`}]})}),r(Y,{label:`Console visibility`,description:`Standard hides routine dashboard HTTP request logs. Full includes them.`,last:!0,children:r(U,{value:n?.runtime.consoleLogMode??`standard`,onChange:e=>o(t=>({...t,runtime:{...t.runtime,consoleLogMode:e===`full`?`full`:`standard`}})),options:[{value:`standard`,label:`Standard`,hint:`Important runtime activity.`},{value:`full`,label:`Full`,hint:`Includes HTTP requests.`}]})})]}),r(B,{title:`Database Settings`,watermark:`DBM`,icon:r(g,{strokeWidth:2.4}),children:[r(Y,{label:`Automatic pruning`,description:`Automatically prune completed task runs, VM activities, attention items, and realtime events on startup.`,children:r(z,{"aria-label":`Toggle setting`,value:n?.runtime.dbPruningEnabled??!0,onChange:()=>o(e=>({...e,runtime:{...e.runtime,dbPruningEnabled:!e.runtime.dbPruningEnabled}}))})}),(n?.runtime.dbPruningEnabled??!0)&&r(Y,{label:`Log retention period (days)`,description:`Keep execution logs and session histories for this many days.`,children:r(Q,{value:n?.runtime.dbRetentionDays??14,onChange:e=>o(t=>({...t,runtime:{...t.runtime,dbRetentionDays:e}})),min:1,max:365})}),r(Y,{label:`Automatic vacuum on startup`,description:`Reclaim fragmented SQLite page storage space and shrink DB files on disk after pruning.`,last:!0,children:r(z,{"aria-label":`Toggle setting`,value:n?.runtime.dbAutoVacuumOnStartup??!0,onChange:()=>o(e=>({...e,runtime:{...e.runtime,dbAutoVacuumOnStartup:!e.runtime.dbAutoVacuumOnStartup}}))})})]}),s?r(zt,{settings:s,update:c,getBadge:u,getFieldBadge:d}):null,r(B,{title:`Onboarding`,watermark:`ONB`,icon:r(Se,{strokeWidth:2.4}),children:r(Y,{label:`Show onboarding again`,description:`Launch the interactive setup flow from the beginning.`,last:!0,children:r(nt,{label:`Open Onboarding`,tone:`primary`,onClick:ie})})})]}):!a||!i?r($,{title:`Project scope unavailable`,children:`Select a project first to edit inheritable project settings.`}):r(`div`,{className:`flex flex-col gap-5`,children:[r(Lt,{projectName:a.name,projectId:a.id,baseDir:a.baseDir,sourceType:a.sourceType}),r(Rt,{settings:i,update:c,getBadge:u,getFieldBadge:d})]})};c(),a();var Vt=({state:t})=>{let n=t.editableSettings;if(!n)return null;let{activeScope:i,projectSources:a}=t,o=n.appearance,{theme:s,setTheme:c}=_e(),[u,d]=l(!1),f=typeof window<`u`&&!!window.codeUxDesktop?.setZoom;return r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Display Settings`,watermark:`UI`,icon:r(F,{strokeWidth:2.4}),children:[r(K,{label:`Navigation Mode`,description:`Choose between a floating dock or a traditional sidebar.`,badge:Z(i,a,`appearance.navigationMode`),children:r(U,{value:o.navigationMode,onChange:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,navigationMode:e}}))},options:[{value:`DOCK`,label:`Dock`},{value:`SIDEBAR`,label:`Sidebar`}]})}),r(K,{label:`Theme`,description:`Select light, dark, or sync with your system preferences.`,badge:Z(i,a,`appearance.theme`),children:r(U,{value:i===`system`?s:o.theme,onChange:e=>{let n=e;t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,theme:n}})),i===`system`&&c(n),H({theme:n})},options:[{value:`LIGHT`,label:`Light`},{value:`DARK`,label:`Dark`},{value:`SYSTEM`,label:`System`}]})}),r(K,{label:`Reduced Motion`,description:`Limit interface animations and transitions.`,badge:Z(i,a,`appearance.reducedMotion`),last:!f,children:r(U,{value:o.reducedMotion,onChange:e=>{let n=e;t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,reducedMotion:n}})),H({reducedMotion:n})},options:[{value:`AUTO`,label:`Auto`},{value:`REDUCE`,label:`Reduce`},{value:`NONE`,label:`None`}]})}),f&&r(K,{label:`Zoom Level`,description:`Scale the entire desktop window up or down.`,badge:Z(i,a,`appearance.zoomLevel`),last:!0,children:r(q,{value:String(o.zoomLevel??1),onChange:e=>{let n=Number(e);t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,zoomLevel:n}})),H({zoomLevel:n})},options:[{value:`0.75`,label:`75%`},{value:`0.9`,label:`90%`},{value:`1`,label:`100%`},{value:`1.1`,label:`110%`},{value:`1.25`,label:`125%`},{value:`1.5`,label:`150%`},{value:`1.75`,label:`175%`},{value:`2`,label:`200%`},{value:`2.25`,label:`225%`},{value:`2.5`,label:`250%`}]})})]}),r(B,{title:`Background`,watermark:`BG`,icon:r(at,{strokeWidth:2.4}),children:[r(K,{label:`Background Image`,description:`Upload a custom background image.`,badge:Z(i,a,`appearance.backgroundImage`),children:r(`div`,{className:`flex flex-col gap-2`,children:[r(`div`,{className:`flex items-center gap-4`,children:o.backgroundImage?r(e,{children:[r(`img`,{src:o.backgroundImage,alt:`Background Thumbnail`,className:`h-16 w-16 rounded-lg object-cover border border-black/10 dark:border-white/10`}),r(`button`,{type:`button`,onClick:()=>{t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,backgroundImage:null}})),H({backgroundImage:null})},className:`rounded-lg px-3 py-1.5 text-sm font-bold text-slate-600 hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-void-800`,children:`Remove`})]}):r(e,{children:[r(`input`,{type:`file`,accept:`image/*`,id:`bg-image-input`,className:`hidden`,onChange:e=>{let n=e.target.files?.[0];if(!n)return;d(n.size>5*1024*1024);let r=new FileReader;r.onloadend=()=>{let e=r.result;t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,backgroundImage:e}})),H({backgroundImage:e})},r.readAsDataURL(n)}}),r(`button`,{type:`button`,onClick:()=>document.getElementById(`bg-image-input`)?.click(),className:`rounded-lg border border-black/10 bg-white px-4 py-2 text-sm font-bold text-slate-700 shadow-sm hover:bg-slate-50 dark:border-white/10 dark:bg-void-800 dark:text-slate-200 dark:hover:bg-void-700`,children:`Upload Image`})]})}),u&&r(`p`,{className:`text-xs text-amber-600 dark:text-amber-400`,children:`Large images may slow down the settings page.`})]})}),r(K,{label:`Background Mode`,description:`Choose between animated backgrounds or a static solid color.`,badge:Z(i,a,`appearance.backgroundMode`),children:r(U,{value:o.backgroundMode||`ANIMATED`,onChange:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,backgroundMode:e}}))},options:[{value:`ANIMATED`,label:`Animated`},{value:`STATIC`,label:`Static`}]})}),(o.backgroundMode||`ANIMATED`)===`ANIMATED`?r(K,{label:`Animation Style`,description:`Select an award-winning background animation.`,badge:Z(i,a,`appearance.animatedBackground`),children:r(U,{value:o.animatedBackground||`deep-ocean`,onChange:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,animatedBackground:e}}))},options:[{value:`deep-ocean`,label:`Deep Ocean`},{value:`neon-dreams`,label:`Neon Dreams`},{value:`aurora-borealis`,label:`Aurora Borealis`},{value:`cosmic-dust`,label:`Cosmic Dust`},{value:`ethereal-mist`,label:`Ethereal Mist`},{value:`quantum-field`,label:`Quantum Field`}]})}):r(K,{label:`Static Color`,description:`Choose a solid background color.`,badge:Z(i,a,`appearance.staticBackgroundColor`),children:r(`div`,{className:`flex items-center gap-3`,children:[r(`input`,{type:`color`,value:o.staticBackgroundColor||`#0d0f12`,onInput:e=>{t.updateEditableSettings(t=>({...t,appearance:{...t.appearance,staticBackgroundColor:e.target.value}}))},className:`h-10 w-20 cursor-pointer rounded-lg border-2 border-black/[0.06] bg-transparent p-1 focus:outline-none focus:ring-2 focus:ring-signal-500 dark:border-white/[0.06]`}),r(`span`,{className:`font-mono text-sm uppercase text-slate-500 dark:text-slate-400`,children:o.staticBackgroundColor||`#0d0f12`})]})}),r(K,{label:`Pattern Overlay`,description:`Stack a pattern over your background.`,badge:Z(i,a,`appearance.backgroundPattern`),last:!0,children:r(q,{value:o.backgroundPattern||`NONE`,onChange:e=>{let n=e;t.updateEditableSettings(e=>({...e,appearance:{...e.appearance,backgroundPattern:n}})),H({backgroundPattern:n})},options:[{value:`NONE`,label:`None`},{value:`DIAGONAL_LINES`,label:`Diagonal Lines`},{value:`HORIZONTAL_LINES`,label:`Horizontal Lines`},{value:`VERTICAL_LINES`,label:`Vertical Lines`},{value:`CROSSHATCH`,label:`Crosshatch`},{value:`DOTS`,label:`Dots`},{value:`DIAMONDS`,label:`Diamonds`},{value:`HEXAGONS`,label:`Hexagons`},{value:`TRIANGLES`,label:`Triangles`},{value:`WAVES`,label:`Waves`},{value:`NOISE`,label:`Noise`}]})})]})]})};c();var Ht=`__inherit__`,Ut=(e,t=!1)=>()=>r(oe,{id:e,disabled:t,className:`h-7 w-7 rounded-[0.7rem]`,imageClassName:`h-4 w-4`}),Wt=({strategy:e})=>r(`span`,{className:`rounded-full border px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.16em] ${e===`MANUAL`?`border-signal-500/24 bg-black/[0.035] text-signal-700 dark:border-signal-400/24 dark:bg-white/[0.055] dark:text-signal-200`:`border-black/[0.08] bg-black/[0.035] text-slate-600 dark:border-white/[0.08] dark:bg-white/[0.055] dark:text-slate-300`}`,children:e.toLowerCase()}),Gt=({active:e,label:t})=>r(`span`,{className:`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-[9px] font-bold uppercase tracking-[0.16em] ${e?`border-signal-500/20 bg-signal-500/[0.08] text-signal-700 dark:border-signal-400/20 dark:bg-signal-400/[0.1] dark:text-signal-200`:`border-black/[0.08] bg-black/[0.03] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400`}`,children:[r(`span`,{className:`h-1.5 w-1.5 rounded-full ${e?`bg-signal-500 dark:bg-signal-300`:`bg-slate-400 dark:bg-slate-500`}`}),t||(e?`Active`:`Inactive`)]}),Kt=({value:e,onChange:t,min:n=0,max:i=100,ariaLabel:a=`Weight`})=>{let o=Math.max(n,Math.min(i,e)),s=(o-n)/(i-n)*100;return r(`div`,{className:`group/slider flex w-[17rem] items-center gap-3`,children:[r(`div`,{className:`relative flex h-6 flex-1 items-center`,children:[r(`div`,{className:`absolute inset-x-0 h-2 rounded-full bg-black/[0.07] shadow-[inset_0_1px_2px_rgba(15,23,42,0.08)] dark:bg-white/[0.08] dark:shadow-[inset_0_1px_2px_rgba(0,0,0,0.32)]`}),r(`div`,{className:`pointer-events-none absolute left-0 h-2 rounded-full bg-gradient-to-r from-signal-400 via-signal-500 to-signal-600 shadow-[0_0_14px_rgba(56,189,248,0.45)] transition-[width] duration-150 dark:from-signal-300 dark:via-signal-400 dark:to-signal-500`,style:{width:`${s}%`}}),r(`input`,{type:`range`,min:n,max:i,value:o,"aria-label":a,"aria-valuenow":o,"aria-valuemin":n,"aria-valuemax":i,onInput:e=>t(Number(e.currentTarget.value)),className:`peer absolute inset-x-0 z-10 h-6 w-full cursor-grab appearance-none bg-transparent opacity-0 focus:outline-none active:cursor-grabbing`}),r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute -translate-x-1/2 transition-[transform,box-shadow,left] duration-150 ease-out group-hover/slider:scale-110 peer-active:scale-110`,style:{left:`${s}%`},children:r(`div`,{className:`relative h-5 w-5 rounded-full border-[1.5px] border-signal-500 bg-white shadow-[0_3px_10px_rgba(15,23,42,0.22)] dark:border-signal-300 dark:bg-void-800`,children:r(`div`,{className:`absolute inset-0 rounded-full bg-gradient-to-b from-white/80 to-transparent dark:from-white/15`})})})]}),r(`span`,{className:`inline-flex h-9 min-w-[2.75rem] shrink-0 items-center justify-center rounded-[0.85rem] border border-black/[0.08] bg-white/85 px-2.5 text-sm font-bold tabular-nums text-slate-800 shadow-[inset_0_1px_0_rgba(255,255,255,0.55)] dark:border-white/[0.08] dark:bg-white/[0.05] dark:text-slate-100`,children:o})]})},qt=({icon:e,label:t,value:n,tone:i=`neutral`})=>r(`div`,{className:`relative overflow-hidden rounded-[1.15rem] border px-4 py-3 ${i===`signal`?`border-signal-500/24 bg-black/[0.035] dark:border-signal-400/24 dark:bg-white/[0.055]`:`border-black/[0.06] bg-black/[0.025] dark:border-white/[0.06] dark:bg-white/[0.035]`}`,children:[r(`div`,{className:`flex items-center gap-2`,children:[r(`span`,{className:i===`signal`?`text-signal-600 dark:text-signal-300`:`text-slate-400`,children:e}),r(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:t})]}),r(`div`,{className:`mt-1 truncate text-sm font-black ${i===`signal`?`text-signal-700 dark:text-signal-200`:`text-slate-900 dark:text-white`}`,children:n})]}),Jt=({state:e})=>{let{activeScope:t,editableSettings:n,projectSources:i,systemSettings:a,externalHints:o,activeInvocationRoute:s,setActiveInvocationRoute:c,thinkingModeOptions:u,invocationRouteDefinitions:f,routingProfileOptions:p,updateEditableSettings:m}=e,g=(...e)=>J(t,i,...e),v=e=>Z(t,i,e),[y,x]=l({}),S=e=>{x(t=>({...t,[e]:!t[e]}))},[C,w]=l({}),T=e=>{w(t=>({...t,[e]:!t[e]}))};if(!n||!a)return null;let E=re(Object.entries(n.aiProvider.providers)),ee=le(a,n,o),te=E.filter(([,e])=>e.provider!==`jules`),D=n.aiProvider.provider?n.aiProvider.providers[n.aiProvider.provider]:null,ne=D?.provider||`jules`,ie=D?de(n.aiProvider.provider||``,D,a):Ce(ne),O=n.aiProvider.providers[n.workers.virtualWorkerProvider],k=O?.provider||`codex`,ae=O?de(n.workers.virtualWorkerProvider,O,a):Ce(k),A=(e,t)=>{m(n=>({...n,aiProvider:{...n.aiProvider,providers:{...n.aiProvider.providers,[e]:{...n.aiProvider.providers[e],...t}}}}))},j=(e,t)=>{m(n=>({...n,aiProvider:{...n.aiProvider,invocationRouting:{...n.aiProvider.invocationRouting,[e]:{...n.aiProvider.invocationRouting[e],...t}}}}))},M=(e,t,n)=>{m(r=>({...r,aiProvider:{...r.aiProvider,invocationRouting:{...r.aiProvider.invocationRouting,[e]:{...r.aiProvider.invocationRouting[e],providers:{...r.aiProvider.invocationRouting[e].providers,[t]:{...r.aiProvider.invocationRouting[e].providers[t]||{},...n}}}}}}))},se=(e,t)=>{m(n=>{let r={...n.aiProvider.invocationRouting[e].providers};return delete r[t],{...n,aiProvider:{...n.aiProvider,invocationRouting:{...n.aiProvider.invocationRouting,[e]:{...n.aiProvider.invocationRouting[e],providers:r}}}}})},ce=(e,t)=>{m(n=>{let r=n.aiProvider.invocationRouting[e],i=r.allowedProviders.includes(t)?r.allowedProviders.filter(e=>e!==t):[...r.allowedProviders,t];return{...n,aiProvider:{...n.aiProvider,invocationRouting:{...n.aiProvider.invocationRouting,[e]:{...r,allowedProviders:i}}}}})},N=f.find(e=>e.id===s)||f[0],P=n.aiProvider.invocationRouting[N.id],F=P.strategy===`MANUAL`,fe=P.provider||(P.profile===`WORKER`?n.workers.virtualWorkerProvider:n.aiProvider.provider)||null,I=fe?n.aiProvider.providers[fe]??null:null,L=F&&fe?[fe]:P.allowedProviders.length>0?P.allowedProviders.filter(e=>n.aiProvider.providers[e]):E.map(([e])=>e),pe=F?E.filter(([e])=>e===fe):E,me=F?1:E.length,_e=P.profile===`WORKER`?O:n.aiProvider.provider?n.aiProvider.providers[n.aiProvider.provider]:null,ve=E.filter(([,e])=>e.enabled).length;return r(`div`,{className:`flex flex-col gap-5`,children:[r(`section`,{className:`relative overflow-hidden rounded-[1.75rem] border border-black/[0.06] bg-white/70 p-5 shadow-[0_2px_20px_rgba(0,0,0,0.04)] backdrop-blur-2xl dark:border-white/[0.06] dark:bg-void-800/60 dark:shadow-[0_4px_24px_rgba(0,0,0,0.2)]`,children:[r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-white/35 to-transparent`}),r(`div`,{className:`grid gap-5 xl:grid-cols-[minmax(0,1fr)_360px]`,children:[r(`div`,{children:[r(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.2em] text-slate-500 dark:text-slate-300`,children:[r(h,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`AI routing console`]}),r(`h3`,{className:`mt-3 font-display text-3xl font-black tracking-tight text-slate-950 dark:text-white`,children:`Provider defaults, route decisions, and runtime capacity in one place.`}),r(`p`,{className:`mt-2 max-w-3xl text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:`Global and worker anchors define the inherited defaults. Base provider configuration defines each instance. Route mapping decides how work is assigned.`}),r(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2`,children:[r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:r(`div`,{className:`flex items-start gap-3`,children:[D?r(W,{providerId:D.provider,disabled:!D.enabled}):null,r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Global anchor`}),r(`div`,{className:`mt-1 truncate text-sm font-semibold text-slate-900 dark:text-white`,children:D?R(D):`None`}),r(`div`,{className:`mt-1 truncate text-xs text-slate-500 dark:text-slate-400`,children:D?.model||`default`})]})]})}),r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:r(`div`,{className:`flex items-start gap-3`,children:[O?r(W,{providerId:O.provider,disabled:!O.enabled}):null,r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Worker anchor`}),r(`div`,{className:`mt-1 truncate text-sm font-semibold text-slate-900 dark:text-white`,children:O?R(O):`None`}),r(`div`,{className:`mt-1 truncate text-xs text-slate-500 dark:text-slate-400`,children:n.workers.model==="default"?`Default (${O?.model||`default`})`:n.workers.model})]})]})})]})]}),r(`div`,{className:`grid gap-3 sm:grid-cols-3 xl:grid-cols-1`,children:[r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(Ge,{className:`h-4 w-4 text-slate-400`}),r(`span`,{className:`text-2xl font-black text-slate-900 dark:text-white`,children:E.length})]}),r(`div`,{className:`mt-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Provider instances`})]}),r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(_,{className:`h-4 w-4 text-slate-400`}),r(`span`,{className:`text-2xl font-black text-slate-900 dark:text-white`,children:ve})]}),r(`div`,{className:`mt-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Eligible by default`})]}),r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.025] p-4 dark:border-white/[0.06] dark:bg-white/[0.035]`,children:[r(`div`,{className:`flex items-center justify-between gap-3`,children:[r(ge,{className:`h-4 w-4 text-slate-400`}),r(`span`,{className:`text-2xl font-black text-slate-900 dark:text-white`,children:f.length})]}),r(`div`,{className:`mt-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Invocation routes`})]})]})]})]}),r(B,{title:`Default Routing Anchors`,watermark:`DEF`,badge:g(`aiProvider`,`workers`),icon:r(d,{strokeWidth:2.4}),children:[E.length===0?r($,{title:`No provider credentials`,children:`Add provider credentials in Integrations before configuring AI routes.`}):null,r(Y,{label:`Global default instance`,description:`Fallback instance for global-profile routes that inherit their primary provider.`,badge:v(`aiProvider.provider`),children:r(q,{value:n.aiProvider.provider||E[0]?.[0]||``,onChange:e=>m(t=>({...t,aiProvider:{...t.aiProvider,provider:e,providers:{...t.aiProvider.providers,[e]:{...t.aiProvider.providers[e],enabled:!0}}}})),options:E.map(([e,t])=>({value:e,label:R(t),icon:Ut(t.provider)}))})}),r(Y,{label:`Global default model`,description:`Base model used when the global default instance is selected without a route-specific model override.`,badge:v(`aiProvider.providers`),children:r(q,{value:D?.model||`default`,onChange:e=>n.aiProvider.provider?A(n.aiProvider.provider,{model:e}):void 0,disabled:!D||!Ee(D.provider),options:D&&Ee(D.provider)?ie:[{value:`default`,label:`Managed by provider`}]})}),r(Y,{label:`Worker default instance`,description:`Fallback instance for worker-profile routes that inherit their primary provider.`,badge:v(`workers.virtualWorkerProvider`),children:r(q,{value:n.workers.virtualWorkerProvider,onChange:e=>m(t=>({...t,workers:{...t.workers,virtualWorkerProvider:e,model:`default`}})),options:te.map(([e,t])=>({value:e,label:R(t),icon:Ut(t.provider)}))})}),r(Y,{label:`Worker default model`,description:`Model used by inherited worker-profile routes. Default uses the selected worker instance’s base model.`,badge:v(`workers.model`),children:r(q,{value:n.workers.model||`default`,onChange:e=>m(t=>({...t,workers:{...t.workers,model:e}})),options:[{value:`default`,label:`Default (${O?.model||`default`})`},...ae]})}),r(Y,{label:`Max concurrency`,description:`Maximum number of worker-dispatched tasks running at once.`,badge:v(`workers.maxConcurrency`),children:r(Q,{value:n.workers.maxConcurrency,min:1,max:20,onChange:e=>m(t=>({...t,workers:{...t.workers,maxConcurrency:e}}))})}),r(Y,{label:`Dispatch timeout`,description:`Seconds before a worker-dispatched task is considered timed out.`,badge:v(`workers.timeoutSeconds`),last:!0,children:r(Q,{value:n.workers.timeoutSeconds,min:60,max:3600,onChange:e=>m(t=>({...t,workers:{...t.workers,timeoutSeconds:e}}))})})]}),r(B,{title:`Base Provider Configuration`,watermark:`BASE`,badge:g(`aiProvider.providers`),icon:r(ue,{strokeWidth:2.4}),children:[r(`div`,{className:`mb-4 rounded-[1.25rem] border border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:`These values are the inheritance baseline for every route. Route mapping owns manual, weighted, or agent-based selection; this section defines each provider instance’s default model, reasoning depth, weight, and capacity.`}),r(`div`,{className:`grid gap-3 lg:grid-cols-2`,children:E.map(([e,t])=>{let n=!!y[e],i=`base-provider-details-${e}`;return r(`div`,{className:`relative overflow-hidden rounded-[1.35rem] border p-4 shadow-[0_14px_32px_rgba(15,23,42,0.035)] transition-colors dark:shadow-[0_16px_34px_rgba(0,0,0,0.18)] ${t.enabled?`border-signal-500/15 bg-[linear-gradient(180deg,rgba(255,255,255,0.88),rgba(255,255,255,0.72))] dark:border-signal-400/15 dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.075),rgba(255,255,255,0.04))]`:`border-black/[0.06] bg-white/62 opacity-85 dark:border-white/[0.06] dark:bg-white/[0.035]`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-1 ${t.enabled?`bg-signal-500/55`:`bg-slate-300/55 dark:bg-white/15`}`}),r(`div`,{className:`mb-3 flex items-start justify-between gap-3 border-b border-black/[0.06] pb-3 dark:border-white/[0.06]`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(W,{providerId:t.provider,disabled:!t.enabled}),r(`div`,{children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:t.name}),r(`div`,{className:`mt-0.5 text-[11px] text-slate-500 dark:text-slate-400`,children:[we(t.provider),` baseline`]})]})]}),r(`div`,{className:`flex items-center gap-2`,children:[r(Gt,{active:t.enabled,label:t.enabled?`Eligible`:`Paused`}),r(`button`,{type:`button`,onClick:()=>S(e),"aria-expanded":n,"aria-controls":i,"aria-label":n?`Collapse ${t.name} settings`:`Expand ${t.name} settings`,title:n?`Collapse settings`:`Expand settings`,className:`inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-white/80 text-slate-500 transition-colors hover:border-signal-500/30 hover:bg-signal-500/[0.06] hover:text-signal-600 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:border-signal-300/30 dark:hover:bg-signal-300/[0.08] dark:hover:text-signal-200`,children:r(Ze,{className:`h-4 w-4 transition-transform duration-200 ${n?`rotate-180`:`rotate-0`}`,strokeWidth:2.4})})]})]}),r(`div`,{className:`grid gap-2 ${n?`mb-3`:``}`,children:[r(`div`,{className:`rounded-xl border border-signal-500/15 bg-signal-500/[0.05] px-3 py-2 dark:border-signal-400/15 dark:bg-signal-400/[0.06]`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-signal-700/70 dark:text-signal-200/80`,children:`Model`}),r(Ge,{className:`h-3 w-3 text-signal-600/70 dark:text-signal-300/70`,strokeWidth:2.4})]}),r(`div`,{className:`mt-1 truncate font-mono text-sm font-bold text-slate-900 dark:text-white`,title:Ee(t.provider)?t.model:void 0,children:Ee(t.provider)?t.model:`Managed by provider`})]}),r(`div`,{className:`grid grid-cols-3 gap-2`,children:[r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Weight`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:t.weight})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Thinking`}),r(`div`,{className:`mt-1 truncate text-sm font-black text-slate-900 dark:text-white`,children:t.provider===`jules`?`n/a`:t.thinkingMode})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Cap`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:t.maxConcurrentTasks||`∞`})]})]})]}),n?r(`div`,{id:i,className:`grid gap-3`,children:[r(Y,{label:`Eligible by default`,description:`Controls whether this instance participates before route-specific overrides are applied.`,children:r(z,{"aria-label":`Toggle setting`,value:t.enabled,onChange:t=>A(e,{enabled:t})})}),Ee(t.provider)?r(Y,{label:`Base model`,description:`Inherited by routes unless a route-specific model override is set.`,children:r(q,{value:t.model,onChange:t=>A(e,{model:t}),options:de(e,t,a)})}):null,he(t.provider)?r(Y,{label:`Base thinking`,description:`Inherited reasoning depth for this provider instance.`,children:r(q,{value:t.thinkingMode,onChange:t=>A(e,{thinkingMode:t}),options:u})}):null,r(Y,{label:`Base weight`,description:`Used by weighted route strategies unless overridden.`,children:r(Kt,{value:t.weight,onChange:t=>A(e,{weight:t}),ariaLabel:`${t.name} base weight`})}),r(Y,{label:`Max concurrent tasks`,description:`Provider-level cap; 0 means unlimited.`,last:!0,children:r(Q,{value:t.maxConcurrentTasks,min:0,max:50,onChange:t=>A(e,{maxConcurrentTasks:t})})})]}):null]},`base-${e}`)})})]}),r(B,{title:`Route Mapping`,watermark:`MAP`,badge:g(`aiProvider.invocationRouting`),icon:r(ge,{strokeWidth:2.4}),children:r(`div`,{className:`grid gap-4 xl:grid-cols-[340px_minmax(0,1fr)]`,children:[r(`div`,{className:`rounded-[1.6rem] border border-black/[0.06] bg-[linear-gradient(180deg,rgba(15,23,42,0.028),rgba(15,23,42,0.012))] p-3 dark:border-white/[0.06] dark:bg-[linear-gradient(180deg,rgba(255,255,255,0.045),rgba(255,255,255,0.02))]`,children:[r(`div`,{className:`mb-3 px-2.5 pt-1`,children:[r(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.2em] text-slate-400`,children:[r(st,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Invocation routes`]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:`Each route can inherit a default instance, choose a manual instance, or distribute across a weighted pool of exact instances.`})]}),r(`div`,{className:`flex flex-col gap-2`,children:f.map(e=>{let t=n.aiProvider.invocationRouting[e.id],i=t.provider?n.aiProvider.providers[t.provider]:t.profile===`WORKER`?O:D,a=t.allowedProviders.length||E.length,o=Object.keys(t.providers).length;return r(`button`,{type:`button`,onClick:()=>c(e.id),className:`group relative overflow-hidden rounded-[1.25rem] border px-4 py-3 text-left transition-all duration-200 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 ${e.id===s?`border-signal-500/30 bg-black/[0.045] shadow-[0_18px_34px_rgba(15,23,42,0.08)] dark:border-signal-400/30 dark:bg-white/[0.07]`:`border-black/[0.06] bg-black/[0.025] hover:-translate-y-0.5 hover:border-black/[0.12] hover:bg-black/[0.04] hover:shadow-[0_14px_28px_rgba(15,23,42,0.06)] dark:border-white/[0.06] dark:bg-white/[0.035] dark:hover:border-white/[0.12] dark:hover:bg-white/[0.06]`}`,children:[e.id===s?r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-3 bottom-3 w-1 rounded-r-full bg-signal-500 dark:bg-signal-300`}):null,r(`div`,{className:`flex items-start gap-3`,children:[i?r(oe,{id:i.provider,disabled:!i.enabled,className:`h-8 w-8 rounded-[0.75rem]`,imageClassName:`h-4 w-4`}):null,r(`div`,{className:`min-w-0 flex-1`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`div`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:e.label}),e.id===s?r(Xe,{className:`h-4 w-4 shrink-0 text-signal-600 dark:text-signal-300`}):null]}),r(`div`,{className:`mt-0.5 truncate text-[11px] font-medium text-slate-500 dark:text-slate-400`,children:i?R(i):`No provider`})]})]}),r(`div`,{className:`mt-1 text-[11px] leading-relaxed text-slate-500 dark:text-slate-400`,children:e.description}),r(`div`,{className:`mt-3 flex flex-wrap items-center gap-2 text-[10px] font-semibold uppercase tracking-[0.14em] text-slate-400`,children:[r(`span`,{className:`rounded-full bg-black/[0.04] px-2 py-1 dark:bg-white/[0.04]`,children:t.profile}),r(Wt,{strategy:t.strategy}),r(`span`,{className:`rounded-full bg-black/[0.04] px-2 py-1 dark:bg-white/[0.04]`,children:[a,` instances`]}),o>0?r(`span`,{className:`rounded-full bg-black/[0.04] px-2 py-1 dark:bg-white/[0.04]`,children:[o,` overrides`]}):null]})]},e.id)})})]}),r(`div`,{className:`relative overflow-hidden rounded-[1.6rem] border border-black/[0.06] bg-black/[0.035] p-5 shadow-[0_18px_44px_rgba(15,23,42,0.05)] dark:border-white/[0.06] dark:bg-white/[0.045] dark:shadow-[0_20px_44px_rgba(0,0,0,0.24)]`,children:[r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-signal-500/35 to-transparent`}),r(`div`,{className:`mb-5 flex flex-wrap items-start justify-between gap-4 border-b border-black/[0.06] pb-4 dark:border-white/[0.06]`,children:[r(`div`,{className:`flex min-w-0 items-start gap-3`,children:[I?r(W,{providerId:I.provider,disabled:!I.enabled}):null,r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-signal-600 dark:text-signal-300`,children:`Active route`}),r(`div`,{className:`mt-1 text-xl font-black text-slate-950 dark:text-white`,children:N.label}),r(`div`,{className:`mt-1 max-w-2xl text-sm leading-relaxed text-slate-500 dark:text-slate-400`,children:N.description}),r(`div`,{className:`mt-2 text-xs text-slate-500 dark:text-slate-400`,children:[`Inherits from `,r(`span`,{className:`font-semibold text-slate-700 dark:text-slate-200`,children:I?R(I):`no configured provider`})]})]})]}),r(`div`,{className:`flex flex-wrap gap-2`,children:[r(`span`,{className:`rounded-full border border-black/[0.06] bg-black/[0.03] px-3 py-1 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.04] dark:text-slate-300`,children:[P.profile,` profile`]}),r(Wt,{strategy:P.strategy})]})]}),r(`div`,{className:`mb-5 grid gap-3 md:grid-cols-4`,children:[r(qt,{icon:r(h,{className:`h-4 w-4`}),label:`Profile`,value:P.profile.toLowerCase(),tone:`signal`}),r(qt,{icon:r(_,{className:`h-4 w-4`}),label:`Strategy`,value:P.strategy.toLowerCase()}),r(qt,{icon:I?r(oe,{id:I.provider,disabled:!I.enabled,className:`h-6 w-6 rounded-[0.55rem]`,imageClassName:`h-3.5 w-3.5`}):r(Ge,{className:`h-4 w-4`}),label:`Primary`,value:I?I.name:`None`}),r(qt,{icon:r(st,{className:`h-4 w-4`}),label:`Pool`,value:`${L.length} / ${me}`})]}),r(`div`,{className:`grid gap-4 md:grid-cols-2`,children:[r(`div`,{children:[r(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Profile`}),r(U,{value:P.profile,onChange:e=>j(N.id,{profile:e,provider:null}),options:p})]}),r(`div`,{children:[r(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Strategy`}),r(U,{value:P.strategy,onChange:e=>j(N.id,{strategy:e}),options:[{value:`MANUAL`,label:`Manual`,hint:`Pin one exact instance.`},{value:`WEIGHTED`,label:`Weighted`,hint:`Distribute by instance weight.`},{value:`AGENT`,label:`Agent`,hint:`Use agent provider/model.`}]})]})]}),r(`div`,{className:`mt-4`,children:[r(`div`,{className:`mb-1 text-[10px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Primary instance`}),r(q,{value:P.provider||Ht,onChange:e=>{let t=e===Ht?null:e;j(N.id,{provider:t}),t&&M(N.id,t,{enabled:!0})},disabled:P.strategy===`WEIGHTED`,options:[{value:Ht,label:P.profile===`WORKER`?`Inherit worker default (${R(O)})`:`Inherit global default (${_e?R(_e):`None`})`,icon:_e?Ut(_e.provider,!_e.enabled):void 0},...E.map(([e,t])=>({value:e,label:R(t),icon:Ut(t.provider,!t.enabled)}))]})]}),r(`div`,{className:`mt-5 rounded-[1.35rem] border border-black/[0.06] bg-[linear-gradient(180deg,rgba(15,23,42,0.025),rgba(15,23,42,0.01))] p-4 dark:border-white/[0.06] dark:bg-white/[0.03]`,children:[r(`div`,{className:`mb-3 flex items-center justify-between gap-3`,children:[r(`div`,{className:`flex items-center gap-2 text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:[r(st,{className:`h-3.5 w-3.5`,strokeWidth:2.4}),`Allowed pool`]}),r(`div`,{className:`text-[11px] text-slate-500 dark:text-slate-400`,children:F?`Locked to primary (manual)`:P.allowedProviders.length===0?`Using all configured instances`:`${P.allowedProviders.length} pinned`})]}),r(`div`,{className:`grid gap-2 sm:grid-cols-2 xl:grid-cols-3`,children:pe.map(([e,t])=>{let n=F||P.allowedProviders.length===0||P.allowedProviders.includes(e),i=ee.includes(e);return r(`button`,{type:`button`,"aria-pressed":n,disabled:F,onClick:F?void 0:()=>ce(N.id,e),className:`group flex min-h-[68px] items-center justify-between gap-3 rounded-[1rem] border px-3 py-2.5 text-left transition-all duration-200 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 ${n?`border-signal-500/30 bg-black/[0.045] text-slate-900 shadow-[0_10px_20px_rgba(15,23,42,0.06)] dark:border-signal-400/30 dark:bg-white/[0.065] dark:text-white`:`border-black/[0.08] bg-black/[0.025] text-slate-500 hover:border-black/[0.12] hover:bg-black/[0.04] dark:border-white/[0.08] dark:bg-white/[0.035] dark:text-slate-400 dark:hover:border-white/[0.12] dark:hover:bg-white/[0.06]`} ${F?`cursor-default`:``}`,children:[r(`span`,{className:`flex min-w-0 items-center gap-2`,children:[r(oe,{id:t.provider,disabled:!n||!t.enabled,className:`h-7 w-7 rounded-[0.7rem]`,imageClassName:`h-4 w-4`}),r(`span`,{className:`min-w-0`,children:[r(`span`,{className:`block truncate text-xs font-bold`,children:t.name}),r(`span`,{className:`block truncate text-[10px] font-semibold uppercase tracking-[0.12em] opacity-65`,children:we(t.provider)})]})]}),r(`span`,{className:`flex shrink-0 flex-col items-end gap-1`,children:[n?r(Xe,{className:`h-4 w-4 text-signal-600 dark:text-signal-300`}):r(`span`,{className:`h-4 w-4 rounded-full border border-black/[0.12] dark:border-white/[0.16]`}),i?null:r(`span`,{className:`text-[9px] font-bold uppercase tracking-[0.12em] text-amber-600 dark:text-amber-300`,children:`Unavailable`})]})]},`${N.id}-${e}`)})})]}),r(`div`,{className:`mt-5 grid gap-3 lg:grid-cols-2`,children:L.map(e=>{let t=n.aiProvider.providers[e],i=P.providers[e]||{};if(!t)return null;let o=i.enabled??t.enabled,s=[typeof i.enabled==`boolean`,typeof i.model==`string`,typeof i.thinkingMode==`string`,typeof i.weight==`number`].filter(Boolean).length,c=`${N.id}-${e}`,l=!!C[c],d=`route-override-details-${c}`,f=i.model||t.model,p=i.thinkingMode||t.thinkingMode,m=i.weight??t.weight,h=Ee(t.provider);return r(`div`,{className:`relative overflow-hidden rounded-[1.35rem] border p-4 shadow-[0_14px_32px_rgba(15,23,42,0.035)] dark:shadow-[0_16px_34px_rgba(0,0,0,0.18)] ${o?`border-signal-500/18 bg-black/[0.04] dark:border-signal-400/18 dark:bg-white/[0.055]`:`border-black/[0.06] bg-black/[0.025] opacity-85 dark:border-white/[0.06] dark:bg-white/[0.035]`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-1 ${o?`bg-signal-500/55`:`bg-slate-300/60 dark:bg-white/15`}`}),r(`div`,{className:`mb-3 flex items-center justify-between gap-3 border-b border-black/[0.06] pb-3 dark:border-white/[0.06]`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(W,{providerId:t.provider,disabled:!o}),r(`div`,{children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:t.name}),r(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-2 text-[11px] text-slate-500 dark:text-slate-400`,children:[r(`span`,{children:we(t.provider)}),r(Gt,{active:o,label:o?`In route`:`Paused`}),s>0?r(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-amber-500/20 bg-amber-500/[0.08] px-2 py-0.5 text-[9px] font-bold uppercase tracking-[0.12em] text-amber-700 dark:border-amber-400/20 dark:bg-amber-400/[0.1] dark:text-amber-200`,children:[r(b,{className:`h-3 w-3`}),s]}):null]})]})]}),r(`div`,{className:`flex items-center gap-2`,children:[r(`button`,{type:`button`,title:`Reset route overrides`,"aria-label":`Reset ${t.name} route overrides`,onClick:()=>se(N.id,e),className:`inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-black/[0.03] text-slate-500 transition-colors hover:bg-black/[0.06] hover:text-slate-800 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:bg-white/[0.08] dark:hover:text-white`,children:r(Ve,{className:`h-3.5 w-3.5`})}),r(`button`,{type:`button`,onClick:()=>T(c),"aria-expanded":l,"aria-controls":d,"aria-label":l?`Collapse ${t.name} overrides`:`Expand ${t.name} overrides`,title:l?`Collapse overrides`:`Expand overrides`,className:`inline-flex h-8 w-8 items-center justify-center rounded-full border border-black/[0.08] bg-white/80 text-slate-500 transition-colors hover:border-signal-500/30 hover:bg-signal-500/[0.06] hover:text-signal-600 focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-signal-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-400 dark:hover:border-signal-300/30 dark:hover:bg-signal-300/[0.08] dark:hover:text-signal-200`,children:r(Ze,{className:`h-4 w-4 transition-transform duration-200 ${l?`rotate-180`:`rotate-0`}`,strokeWidth:2.4})})]})]}),r(`div`,{className:`grid gap-2 ${l?`mb-3`:``}`,children:[r(`div`,{className:`rounded-xl border border-signal-500/15 bg-signal-500/[0.05] px-3 py-2 dark:border-signal-400/15 dark:bg-signal-400/[0.06]`,children:[r(`div`,{className:`flex items-center justify-between gap-2`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-signal-700/70 dark:text-signal-200/80`,children:`Model`}),r(Ge,{className:`h-3 w-3 text-signal-600/70 dark:text-signal-300/70`,strokeWidth:2.4})]}),r(`div`,{className:`mt-1 truncate font-mono text-sm font-bold text-slate-900 dark:text-white`,title:h?f:void 0,children:h?f:`Managed by provider`})]}),r(`div`,{className:`grid grid-cols-3 gap-2`,children:[r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Weight`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:m})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Thinking`}),r(`div`,{className:`mt-1 truncate text-sm font-black text-slate-900 dark:text-white`,children:t.provider===`jules`?`n/a`:p})]}),r(`div`,{className:`rounded-xl border border-black/[0.05] bg-black/[0.025] px-3 py-2 dark:border-white/[0.05] dark:bg-white/[0.035]`,children:[r(`div`,{className:`text-[9px] font-bold uppercase tracking-[0.14em] text-slate-400`,children:`Cap`}),r(`div`,{className:`mt-1 text-sm font-black text-slate-900 dark:text-white`,children:t.maxConcurrentTasks||`∞`})]})]})]}),l?r(`div`,{id:d,className:`grid gap-3`,children:[r(Y,{label:`Enabled override`,description:`Override route participation for this one instance.`,children:r(z,{"aria-label":`Toggle setting`,value:i.enabled??t.enabled,onChange:t=>M(N.id,e,{enabled:t})})}),h?r(Y,{label:`Model override`,description:`Inherited: ${t.model}`,children:r(q,{value:i.model||t.model,onChange:t=>M(N.id,e,{model:t}),options:de(e,t,a)})}):null,he(t.provider)?r(Y,{label:`Thinking override`,description:`Inherited: ${t.thinkingMode}`,children:r(q,{value:i.thinkingMode||t.thinkingMode,onChange:t=>M(N.id,e,{thinkingMode:t}),options:u})}):null,r(Y,{label:`Weight override`,description:`Inherited: ${t.weight}`,last:!0,children:r(Kt,{value:i.weight??t.weight,onChange:t=>M(N.id,e,{weight:t}),ariaLabel:`${t.name} weight override`})})]}):null]},c)})})]})]})})]})},Yt=({value:e,onChange:t,badge:n})=>r(Y,{label:`Sprint key prefix`,description:`Prefix used when generating sprint keys (e.g. SPR-1).`,badge:n,children:r(G,{value:e,onChange:e=>{t(e.replace(/[^a-zA-Z0-9]/g,``).toUpperCase().slice(0,10))},mono:!0,"aria-label":`Sprint key prefix`,"aria-description":`Prefix used when generating sprint keys (e.g. SPR-1).`})});a();var Xt=[{key:`task_coding`,label:`Coding attempts`,description:`Max times a task is (re)dispatched for coding before it is blocked.`},{key:`ci_fix`,label:`CI autofix attempts`,description:`Max CI autofix attempts (Jules notify or worker) per task.`},{key:`merge_conflict`,label:`Merge conflict resolutions`,description:`Max merge-conflict resolution attempts per task.`},{key:`clarification_reply`,label:`Clarification auto-answers`,description:`Max automatic clarification replies before waiting for a human.`},{key:`planning`,label:`Planning runs`,description:`Max planning invocations attributed to a single task.`}],Zt=[{value:`BLOCK_AND_ESCALATE`,label:`Block + escalate`,hint:`Block the task and hand it to a human.`},{value:`STOP_AND_WAIT`,label:`Stop + wait`,hint:`Stop auto-handling and wait for a human.`},{value:`WARN_ONLY`,label:`Warn only`,hint:`Log a warning but keep going.`}],Qt=({state:t})=>{let{activeScope:n,editableSettings:i,projectSources:a,updateEditableSettings:o}=t,s=(...e)=>J(n,a,...e),c=e=>Z(n,a,e);return i?r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Git Flow`,watermark:`GIT`,badge:s(`git`),icon:r(ge,{strokeWidth:2.4}),children:[r(Y,{label:`Git mode`,description:`Remote enables PR and CI-aware automation. Local keeps orchestration repo-local only.`,badge:c(`git.githubMode`),children:r(U,{value:i.git.githubMode,onChange:e=>o(t=>({...t,git:{...t.git,githubMode:e}})),options:[{value:`REMOTE`,label:`Remote`,hint:`PRs, CI, and remote branch sync stay enabled.`},{value:`LOCAL`,label:`Local`,hint:`Disable remote PR orchestration and stay repo-local.`}]})}),r(Y,{label:`Default branch`,description:`Base branch used for sprint branch creation and merge targets.`,badge:c(`git.defaultBranch`),children:r(G,{value:i.git.defaultBranch,onChange:e=>o(t=>({...t,git:{...t.git,defaultBranch:e}})),mono:!0})}),r(Y,{label:`Feature branch prefix`,description:`Prefix used when worker feature branches are generated automatically.`,badge:c(`git.featureBranchPrefix`),children:r(G,{value:i.git.featureBranchPrefix,onChange:e=>o(t=>({...t,git:{...t.git,featureBranchPrefix:e}})),mono:!0})}),r(Yt,{value:i.git.sprintKeyPrefix,onChange:e=>o(t=>({...t,git:{...t.git,sprintKeyPrefix:e}})),badge:c(`git.sprintKeyPrefix`)}),r(Y,{label:`Branch name scheme`,description:`Template used when naming sprint branches.`,badge:c(`git.sprintBranchScheme`),info:r(tt,{items:[{key:`{sprint_key_prefix}`,desc:`Sprint Key Prefix`},{key:`{sprint_number}`,desc:`Sprint Number`},{key:`{sprint_name}`,desc:`Sprint Name`},{key:`{sprint_id}`,desc:`Sprint ID`},{key:`{planning_agent}`,desc:`Planning Agent`},{key:`{agent_routing}`,desc:`Agent Routing`},{key:`{worker_agent}`,desc:`Worker Agent`},{key:`{worker_provider}`,desc:`Worker Provider`},{key:`{worker_model}`,desc:`Worker Model`}]}),children:r(rt,{value:i.git.sprintBranchScheme,onChange:e=>o(t=>({...t,git:{...t.git,sprintBranchScheme:e}}))})}),r(Y,{label:`Auto-create PRs`,description:i.git.githubMode===`LOCAL`?`Open pull requests automatically for remote git workflows. (Disabled in Local mode)`:`Open pull requests automatically for remote git workflows.`,badge:c(`git.autoCreatePr`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.git.autoCreatePr,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,git:{...e.git,autoCreatePr:!e.git.autoCreatePr}}))})}),r(Y,{label:`Auto-close linked issues`,description:i.git.githubMode===`LOCAL`?`Close imported GitHub/GitLab issues after the sprint finishes and the main merge gate is complete. (Disabled in Local mode)`:`Close imported GitHub/GitLab issues after the sprint finishes and the main merge gate is complete.`,badge:c(`git.autoCloseLinkedIssues`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.git.autoCloseLinkedIssues,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,git:{...e.git,autoCloseLinkedIssues:!e.git.autoCloseLinkedIssues}}))})})]}),r(B,{title:i.git.githubMode===`LOCAL`?`Merge Gates & Autofix (Unavailable in Local Mode)`:`Merge Gates & Autofix`,watermark:`CI`,badge:i.git.githubMode===`LOCAL`?`Disabled in Local Mode`:s(`ciIntelligence`),icon:r(De,{strokeWidth:2.4}),children:[r(Y,{label:`Resolve comments before main merge`,description:`Require review comments to be resolved before finishing the main merge.`,badge:c(`ciIntelligence.resolveAllCommentsBeforeMainMerge`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveAllCommentsBeforeMainMerge,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveAllCommentsBeforeMainMerge:!e.ciIntelligence.resolveAllCommentsBeforeMainMerge}}))})}),r(Y,{label:`Resolve main merge conflicts`,description:"Escalate `feature -> main` merge conflicts to the virtual worker with sprint context.",badge:c(`ciIntelligence.resolveMainMergeConflicts`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveMainMergeConflicts,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveMainMergeConflicts:!e.ciIntelligence.resolveMainMergeConflicts}}))})}),r(Y,{label:`Fix main merge CI failures`,description:"Dispatch the virtual worker to fix failing CI on the `feature -> main` merge gate before escalating to a human.",badge:c(`ciIntelligence.resolveMainMergeFailedChecks`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveMainMergeFailedChecks,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveMainMergeFailedChecks:!e.ciIntelligence.resolveMainMergeFailedChecks}}))})}),r(Y,{label:`Resolve comments before feature merge`,description:`Do not auto-merge a feature branch until review comments are closed.`,badge:c(`ciIntelligence.resolveAllCommentsBeforeFeatureMerge`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveAllCommentsBeforeFeatureMerge,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveAllCommentsBeforeFeatureMerge:!e.ciIntelligence.resolveAllCommentsBeforeFeatureMerge}}))})}),r(Y,{label:`Resolve feature merge conflicts`,description:`Escalate feature-branch merge conflicts to the virtual worker with full branch and task context.`,badge:c(`ciIntelligence.resolveMergeConflicts`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.resolveMergeConflicts,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,resolveMergeConflicts:!e.ciIntelligence.resolveMergeConflicts}}))})}),r(Y,{label:`Jules CI autofix`,description:`Allow Jules to attempt CI autofixes before escalating to a worker.`,badge:c(`ciIntelligence.waitForJulesCiAutofix`),children:r(z,{"aria-label":`Toggle setting`,value:i.git.githubMode===`LOCAL`?!1:i.ciIntelligence.waitForJulesCiAutofix,disabled:i.git.githubMode===`LOCAL`,onChange:()=>o(e=>({...e,ciIntelligence:{...e.ciIntelligence,waitForJulesCiAutofix:!e.ciIntelligence.waitForJulesCiAutofix}}))})}),r(Y,{label:`Feature PR auto-merge mode`,description:`Controls whether feature PRs stay at PR creation, auto-merge when green, auto-merge immediately when allowed, or stay off.`,badge:c(`ciIntelligence.featurePrAutoMergeMode`),children:r(U,{value:i.git.githubMode===`LOCAL`?`OFF`:i.ciIntelligence.featurePrAutoMergeMode,disabled:i.git.githubMode===`LOCAL`,onChange:e=>o(t=>({...t,ciIntelligence:{...t.ciIntelligence,featurePrAutoMergeMode:e}})),options:[{value:`OFF`,label:`Off`,hint:`Never auto-merge.`},{value:`CREATE_PR`,label:`Create PR`,hint:`Open a PR without auto-merging it.`},{value:`WHEN_GREEN`,label:`When green`,hint:`Merge only after checks pass.`},{value:`ALWAYS`,label:`Always`,hint:`Merge as soon as policy allows.`}]})}),r(Y,{label:`Main branch auto-merge mode`,description:`Controls whether the final main-branch PR stays off, is only created, auto-merges when green, or auto-merges immediately when allowed.`,badge:c(`ciIntelligence.mainBranchAutoMergeMode`),last:!0,children:r(U,{value:i.git.githubMode===`LOCAL`?`OFF`:i.ciIntelligence.mainBranchAutoMergeMode,disabled:i.git.githubMode===`LOCAL`,onChange:e=>o(t=>({...t,ciIntelligence:{...t.ciIntelligence,mainBranchAutoMergeMode:e}})),options:[{value:`OFF`,label:`Off`,hint:`Never auto-merge.`},{value:`CREATE_PR`,label:`Create PR`,hint:`Open the PR without auto-merging it.`},{value:`WHEN_GREEN`,label:`When green`,hint:`Merge only after checks pass.`},{value:`ALWAYS`,label:`Always`,hint:`Merge as soon as policy allows.`}]})})]}),r(B,{title:`Guardrails`,watermark:`CAP`,badge:s(`guardrails`),icon:r(ct,{strokeWidth:2.4}),children:[r(Y,{label:`Guardrails enabled`,description:`Cap how many times each agent job type runs per task to stop runaway loops. Counts persist per task across restarts.`,badge:c(`guardrails.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:i.guardrails.enabled,onChange:()=>o(e=>({...e,guardrails:{...e.guardrails,enabled:!e.guardrails.enabled}}))})}),i.guardrails.enabled?r(e,{children:[Xt.map(e=>r(Y,{label:e.label,description:`${e.description} 0 = unlimited.`,badge:c(`guardrails.jobs.${e.key}.cap`),children:r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(Q,{value:i.guardrails.jobs[e.key].cap,min:0,max:100,onChange:t=>o(n=>({...n,guardrails:{...n.guardrails,jobs:{...n.guardrails.jobs,[e.key]:{...n.guardrails.jobs[e.key],cap:t}}}}))}),r(U,{value:i.guardrails.jobs[e.key].onLimit,onChange:t=>o(n=>({...n,guardrails:{...n.guardrails,jobs:{...n.guardrails.jobs,[e.key]:{...n.guardrails.jobs[e.key],onLimit:t}}}})),options:Zt})]})},e.key)),r(Y,{label:`Per-task total ceiling`,description:`Optional hard cap on total agent invocations per task across all job types. 0 disables.`,badge:c(`guardrails.perTaskTotalCeiling`),last:!0,children:r(Q,{value:i.guardrails.perTaskTotalCeiling,min:0,max:500,onChange:e=>o(t=>({...t,guardrails:{...t.guardrails,perTaskTotalCeiling:e}}))})})]}):null]}),r(B,{title:`Rate Limit`,watermark:`RATE`,badge:s(`cliWorkflow`),icon:r(V,{strokeWidth:2.4}),children:[r(Y,{label:`Retry after quota reset`,description:`When a provider reports a concrete quota reset time, wait for that reset and retry automatically.`,badge:c(`cliWorkflow.retryOnQuotaReset`),children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.retryOnQuotaReset,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,retryOnQuotaReset:!e.cliWorkflow.retryOnQuotaReset}}))})}),r(Y,{label:`Retry on rate limit`,description:`Retry transient rate-limit failures after a fixed delay until the configured max retry count is reached.`,badge:c(`cliWorkflow.retryOnRateLimit`),children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.retryOnRateLimit,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,retryOnRateLimit:!e.cliWorkflow.retryOnRateLimit}}))})}),r(Y,{label:`Rate limit retry delay`,description:`Seconds to wait before retrying a rate-limited provider call.`,badge:c(`cliWorkflow.rateLimitRetryDelaySeconds`),children:r(Q,{value:i.cliWorkflow.rateLimitRetryDelaySeconds,onChange:e=>o(t=>({...t,cliWorkflow:{...t.cliWorkflow,rateLimitRetryDelaySeconds:e}})),min:1,max:3600})}),r(Y,{label:`Max rate limit retries`,description:`Maximum retry attempts for rate-limited provider calls before Code UX fails the invocation.`,badge:c(`cliWorkflow.maxRateLimitRetries`),children:r(Q,{value:i.cliWorkflow.maxRateLimitRetries,onChange:e=>o(t=>({...t,cliWorkflow:{...t.cliWorkflow,maxRateLimitRetries:e}})),min:1,max:100})}),r(Y,{label:`Max quota retries without timer`,description:`When a provider reports quota exhaustion without an exact reset time, retry up to this many times before failing the task.`,badge:c(`cliWorkflow.maxQuotaRetriesWithoutTimer`),last:!0,children:r(Q,{value:i.cliWorkflow.maxQuotaRetriesWithoutTimer,onChange:e=>o(t=>({...t,cliWorkflow:{...t.cliWorkflow,maxQuotaRetriesWithoutTimer:e}})),min:1,max:20})})]}),r(B,{title:`Watch Loop`,watermark:`LOOP`,badge:s(`sprintLoopSteps`),icon:r(Ie,{strokeWidth:2.4}),children:[r(Y,{label:`Watch loop`,description:`Keep the live watch loop running between orchestration ticks.`,badge:c(`sprintLoopSteps.watchLoop`),children:r(z,{"aria-label":`Toggle setting`,value:i.sprintLoopSteps.watchLoop,onChange:()=>o(e=>({...e,sprintLoopSteps:{...e.sprintLoopSteps,watchLoop:!e.sprintLoopSteps.watchLoop}}))})}),r(Y,{label:`Watch loop interval`,description:`Seconds between watch loop evaluation cycles.`,badge:c(`sprintLoopSteps.watchLoopIntervalSeconds`),children:r(Q,{value:i.sprintLoopSteps.watchLoopIntervalSeconds,onChange:e=>o(t=>({...t,sprintLoopSteps:{...t.sprintLoopSteps,watchLoopIntervalSeconds:e}})),min:1,max:3600})}),r(Y,{label:`Watch output interval`,description:`Seconds between watch loop output emissions.`,badge:c(`sprintLoopSteps.watchLoopOutputIntervalSeconds`),last:!0,children:r(Q,{value:i.sprintLoopSteps.watchLoopOutputIntervalSeconds,onChange:e=>o(t=>({...t,sprintLoopSteps:{...t.sprintLoopSteps,watchLoopOutputIntervalSeconds:e}})),min:1,max:3600})})]}),r(B,{title:`Workspace Hygiene`,watermark:`CLI`,badge:s(`cliWorkflow`),icon:r(Se,{strokeWidth:2.4}),children:[r(Y,{label:`Cleanup worktree on success`,description:`Remove temporary worktree state after successful CLI execution.`,badge:c(`cliWorkflow.cleanupWorktreeOnSuccess`),children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.cleanupWorktreeOnSuccess,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,cleanupWorktreeOnSuccess:!e.cliWorkflow.cleanupWorktreeOnSuccess}}))})}),r(Y,{label:`Cleanup worktree on failure`,description:`Clean up failed workspaces after execution terminates unsuccessfully.`,badge:c(`cliWorkflow.cleanupWorktreeOnFailure`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:i.cliWorkflow.cleanupWorktreeOnFailure,onChange:()=>o(e=>({...e,cliWorkflow:{...e.cliWorkflow,cleanupWorktreeOnFailure:!e.cliWorkflow.cleanupWorktreeOnFailure}}))})})]})]}):null},$t=({state:e})=>{let{activeScope:t,editableSettings:n,projectSources:i,updateEditableSettings:a}=e,o=(...e)=>J(t,i,...e),s=e=>Z(t,i,e);return n?r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Workspace Visibility`,watermark:`WEB`,badge:o(`sprintPreview`),icon:r(Ie,{strokeWidth:2.4}),children:[r(Y,{label:`Preview runtime enabled`,description:`Allow Code UX to launch, rebuild, and reconcile preview containers for this scope.`,badge:s(`sprintPreview.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.enabled,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,enabled:!e.sprintPreview.enabled}}))})}),r(Y,{label:`Show in-app browser workspace`,description:`Expose Browser entry points in the dashboard and allow the embedded preview workspace to render.`,badge:s(`sprintPreview.showInAppBrowser`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.showInAppBrowser,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,showInAppBrowser:!e.sprintPreview.showInAppBrowser}}))})}),r(Y,{label:`Launch preview when sprint starts`,description:`Start a preview container automatically when Code UX detects the sprint is actively running.`,badge:s(`sprintPreview.autoStartOnRunningSprint`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.autoStartOnRunningSprint,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,autoStartOnRunningSprint:!e.sprintPreview.autoStartOnRunningSprint}}))})}),r(Y,{label:`Rebuild preview on task completion`,description:`Refresh the active preview after a task finishes so the container reflects the latest sprint output.`,badge:s(`sprintPreview.rebuildOnTaskCompletion`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.rebuildOnTaskCompletion,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,rebuildOnTaskCompletion:!e.sprintPreview.rebuildOnTaskCompletion}}))})}),r(Y,{label:`Rebuild preview on sprint completion`,description:`Run one final rebuild when the sprint reaches its completed terminal state.`,badge:s(`sprintPreview.rebuildOnSprintCompletion`),children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.rebuildOnSprintCompletion,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,rebuildOnSprintCompletion:!e.sprintPreview.rebuildOnSprintCompletion}}))})}),r(Y,{label:`Stop preview when sprint ends`,description:`Shut down the preview container automatically when the sprint finishes, fails, or is cancelled.`,badge:s(`sprintPreview.autoStopOnTerminalSprint`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:n.sprintPreview.autoStopOnTerminalSprint,onChange:()=>a(e=>({...e,sprintPreview:{...e.sprintPreview,autoStopOnTerminalSprint:!e.sprintPreview.autoStopOnTerminalSprint}}))})})]}),r(B,{title:`Runtime Limits`,watermark:`PORT`,badge:o(`sprintPreview`),icon:r(v,{strokeWidth:2.4}),children:[r(Y,{label:`Maximum active preview containers`,description:`When this cap is exceeded, Code UX stops the oldest active previews before launching the next one.`,badge:s(`sprintPreview.maxConcurrentContainers`),children:r(Q,{value:n.sprintPreview.maxConcurrentContainers,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,maxConcurrentContainers:e}})),min:1,max:100})}),r(Y,{label:`Host port range start`,description:`Lower bound for preview host-port allocation. Preview ports bind to localhost only.`,badge:s(`sprintPreview.hostPortRangeStart`),children:r(Q,{value:n.sprintPreview.hostPortRangeStart,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,hostPortRangeStart:e}})),min:1,max:65535})}),r(Y,{label:`Host port range end`,description:`Upper bound for preview host-port allocation.`,badge:s(`sprintPreview.hostPortRangeEnd`),children:r(Q,{value:n.sprintPreview.hostPortRangeEnd,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,hostPortRangeEnd:e}})),min:1,max:65535})}),r(Y,{label:`Container app port`,description:`Internal port the preview app listens on inside the container before Code UX maps it to a host port.`,badge:s(`sprintPreview.containerAppPort`),children:r(Q,{value:n.sprintPreview.containerAppPort,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,containerAppPort:e}})),min:1,max:65535})}),r(Y,{label:`Startup script path`,description:`Project-relative path used for the editable preview startup override script.`,badge:s(`sprintPreview.startupScriptPath`),last:!0,children:r(G,{value:n.sprintPreview.startupScriptPath,onChange:e=>a(t=>({...t,sprintPreview:{...t.sprintPreview,startupScriptPath:e}})),mono:!0})})]})]}):null};a();var en=({settings:t,update:n,getBadge:i,sectionBadge:a,presetOptions:o,selectorsDisabled:s,selectedProjectName:c,activeScope:l})=>r(B,{title:`Quality Assurance`,watermark:`QA`,badge:a,icon:r(N,{strokeWidth:2.4}),children:[r(K,{label:`Enable QA agent`,description:`Runs a senior QA pass after completion events, using full sprint context and continuing the current task session when fixes are required.`,badge:i(`agents.qualityAssurance.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:t.enabled,onChange:e=>n({enabled:e})})}),t.enabled?r(e,{children:[r(K,{label:`Task QA max runs`,description:`How many QA review cycles a single task gets before the exhaustion policy applies. Default is 5.`,badge:i(`agents.qualityAssurance.maxTaskReviewRuns`),children:r(Q,{value:t.maxTaskReviewRuns,min:1,max:20,onChange:e=>n({maxTaskReviewRuns:Number.isFinite(e)?Math.min(20,Math.max(1,Math.floor(e))):1})})}),r(K,{label:`Sprint QA max runs`,description:`How many sprint-completion QA review cycles a sprint gets before its budget is spent. Default is 5.`,badge:i(`agents.qualityAssurance.maxSprintReviewRuns`),children:r(Q,{value:t.maxSprintReviewRuns,min:1,max:20,onChange:e=>n({maxSprintReviewRuns:Number.isFinite(e)?Math.min(20,Math.max(1,Math.floor(e))):1})})}),r(K,{label:`When QA max runs is exhausted`,description:`What to do with a code-complete task whose QA budget is spent without a pass. Escalate holds it for a human; Fail marks it failed and lets the sprint finish; Finish marks it complete despite no QA pass.`,badge:i(`agents.qualityAssurance.exhaustionPolicy`),children:r(q,{value:t.exhaustionPolicy,onChange:e=>n({exhaustionPolicy:e===`FAIL_TASK`||e===`FINISH_TASK`||e===`ESCALATE_TO_HUMAN`?e:`ESCALATE_TO_HUMAN`}),options:[{value:`ESCALATE_TO_HUMAN`,label:`Escalate to human`},{value:`FAIL_TASK`,label:`Fail task`},{value:`FINISH_TASK`,label:`Finish task`}],"aria-label":`QA exhaustion policy`})}),c&&l!==`project`?r(`div`,{className:`rounded-[1.15rem] border border-signal-500/18 bg-signal-500/[0.08] px-4 py-3 text-xs leading-relaxed text-signal-700 dark:border-signal-400/18 dark:bg-signal-400/[0.08] dark:text-signal-200`,children:[`QA settings are project-local. Changing any QA control here switches the panel to Project scope for `,c,`.`]}):null,r(K,{label:`Review every completed task`,description:`Runs once after a task completes, then only repeats for QA-driven follow-up loops until the max run count is reached.`,badge:i(`agents.qualityAssurance.taskCompletion.enabled`),children:r(`div`,{className:`flex flex-wrap items-center gap-3`,children:[r(z,{"aria-label":`Toggle setting`,value:t.taskCompletion.enabled,onChange:e=>n({taskCompletion:{...t.taskCompletion,enabled:e}})}),r(q,{value:t.taskCompletion.agentPresetId||``,onChange:e=>n({taskCompletion:{...t.taskCompletion,agentPresetId:e||null}}),options:o,disabled:s,"aria-label":`Task completion QA agent preset`})]})}),r(K,{label:`Review before sprint completion`,description:`Blocks final sprint completion when QA finds integration problems and can route the fix back into the most relevant task.`,badge:i(`agents.qualityAssurance.sprintCompletion.enabled`),children:r(`div`,{className:`flex flex-wrap items-center gap-3`,children:[r(z,{"aria-label":`Toggle setting`,value:t.sprintCompletion.enabled,onChange:e=>n({sprintCompletion:{...t.sprintCompletion,enabled:e}})}),r(q,{value:t.sprintCompletion.agentPresetId||``,onChange:e=>n({sprintCompletion:{...t.sprintCompletion,agentPresetId:e||null}}),options:o,disabled:s,"aria-label":`Sprint completion QA agent preset`})]})}),r(K,{label:`Review completed tasks without a PR`,description:`Lets QA investigate whether a missing PR is valid or whether the task still needs branch and PR hygiene before it can stay complete.`,badge:i(`agents.qualityAssurance.completedTaskWithoutPr.enabled`),last:!0,children:r(`div`,{className:`flex flex-wrap items-center gap-3`,children:[r(z,{"aria-label":`Toggle setting`,value:t.completedTaskWithoutPr.enabled,onChange:e=>n({completedTaskWithoutPr:{...t.completedTaskWithoutPr,enabled:e}})}),r(q,{value:t.completedTaskWithoutPr.agentPresetId||``,onChange:e=>n({completedTaskWithoutPr:{...t.completedTaskWithoutPr,agentPresetId:e||null}}),options:o,disabled:s,"aria-label":`No PR QA agent preset`})]})}),s?r(`div`,{className:`rounded-[1.15rem] border border-black/[0.05] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.05] dark:bg-white/[0.02] dark:text-slate-400`,children:`Select a project to choose a custom QA agent. Built-in QA routing remains available without a project-specific preset.`}):null]}):r(`div`,{className:`rounded-[1.15rem] border border-dashed border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.02] dark:text-slate-400`,children:`QA is disabled. Enable it to review completed tasks, gate sprint completion, and inspect completed tasks that do not yet have a PR.`})]}),tn={planning:{agentPresetId:null},taskCoding:{mode:`MANUAL`,agentPresetId:null,orchestratorAgentPresetIds:[]},ciFix:{agentPresetId:null},mergeConflict:{agentPresetId:null},dashboardReply:{agentPresetId:null},clarificationReply:{agentPresetId:null}},nn=e=>({planning:{...tn.planning,...e?.planning},taskCoding:{...tn.taskCoding,...e?.taskCoding,orchestratorAgentPresetIds:e?.taskCoding?.orchestratorAgentPresetIds?[...e.taskCoding.orchestratorAgentPresetIds]:[]},ciFix:{...tn.ciFix,...e?.ciFix},mergeConflict:{...tn.mergeConflict,...e?.mergeConflict},dashboardReply:{...tn.dashboardReply,...e?.dashboardReply},clarificationReply:{...tn.clarificationReply,...e?.clarificationReply}}),rn=({state:e})=>{let{activeScope:t,setActiveScope:n,selectedProject:i,editableSettings:a,projectSettings:o,projectSources:s,projectAgentPresetOptions:c,updateProject:l,updateEditableSettings:u}=e,d=(...e)=>J(t,s,...e),f=e=>Z(t,s,e);if(!a)return null;let p=nn(o?.agents.routing??a.agents.routing),m=o?.agents.qualityAssurance??a.agents.qualityAssurance,g=c.map(e=>({...e,icon:()=>r(ye,{avatarConfig:e.avatarConfig,seed:`${e.value}:${e.label}`})})),_=[{value:``,label:`Built-in QA agent`,icon:()=>r(ye,{seed:`built-in:qa`})},...g],v=!i||!o,y=v,b=i?J(`project`,s,`agents.routing`):d(`agents.routing`),x=i?J(`project`,s,`agents`,`agents.qualityAssurance`):d(`agents`,`agents.qualityAssurance`),S=e=>i?Z(`project`,s,e):f(e),C=e=>{if(i&&o){t!==`project`&&n(`project`),l(t=>({...t,agents:{...t.agents,qualityAssurance:e(t.agents.qualityAssurance)}}));return}u(t=>({...t,agents:{...t.agents,qualityAssurance:e(t.agents.qualityAssurance)}}))},w=e=>{if(i&&o){t!==`project`&&n(`project`),l(t=>({...t,agents:{...t.agents,routing:e(nn(t.agents.routing))}}));return}u(t=>({...t,agents:{...t.agents,routing:e(nn(t.agents.routing))}}))},T=e=>{w(t=>{let n=t.taskCoding.orchestratorAgentPresetIds;return{...t,taskCoding:{...t.taskCoding,orchestratorAgentPresetIds:n.includes(e)?n.filter(t=>t!==e):[...n,e]}}})};return r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Project Markdown Mirror`,watermark:`AGT`,badge:d(`agents`),icon:r(We,{strokeWidth:2.4}),children:[r(Y,{label:`Save agent markdown to project directory`,description:"When enabled, dashboard edits write a companion markdown file under `.code-ux/agents` for the selected project. Default and home agent files are never modified.",badge:f(`agents.saveToProjectDirectory`),children:r(z,{"aria-label":`Toggle setting`,value:a.agents.saveToProjectDirectory,onChange:()=>u(e=>({...e,agents:{...e.agents,saveToProjectDirectory:!e.agents.saveToProjectDirectory}}))})}),r(Y,{label:`Mirror directory`,description:`Dashboard-authored markdown companions live alongside other project-local Code UX files.`,last:!0,children:r(`div`,{className:`rounded-xl bg-black/[0.04] px-3 py-2 font-mono text-sm text-slate-600 dark:bg-white/[0.04] dark:text-slate-300`,children:`.code-ux/agents`})})]}),r(B,{title:`Agent Routing`,watermark:`RTE`,badge:b,icon:r(h,{strokeWidth:2.4}),children:r(`div`,{className:`grid gap-4 xl:grid-cols-[280px_minmax(0,1fr)]`,children:[r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-black/[0.02] p-4 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.18em] text-slate-400`,children:`Coding tasks`}),r(`div`,{className:`mt-2`,children:`Manual pins all coding work to one preset. Orchestrator gives the Planning agent a roster and lets it assign the best specialist per task.`}),i&&t!==`project`?r(`div`,{className:`mt-3 rounded-xl border border-signal-500/18 bg-signal-500/[0.08] px-3 py-2 text-signal-700 dark:border-signal-400/18 dark:bg-signal-400/[0.08] dark:text-signal-200`,children:[`Routing edits switch to Project scope for `,i.name,`.`]}):null]}),r(`div`,{className:`rounded-[1.35rem] border border-black/[0.06] bg-white/78 p-5 dark:border-white/[0.06] dark:bg-void-900/52 md:p-6`,children:[r(Y,{label:`Coding task routing`,description:`Choose whether coding tasks use one fixed agent or a Planning-agent-selected specialist.`,children:r(U,{value:p.taskCoding.mode,onChange:e=>w(t=>({...t,taskCoding:{...t.taskCoding,mode:e===`ORCHESTRATOR`?`ORCHESTRATOR`:`MANUAL`}})),options:[{value:`MANUAL`,label:`Manual`,hint:`Pin one coding agent.`},{value:`ORCHESTRATOR`,label:`Orchestrator`,hint:`Planner selects per task.`}]})}),p.taskCoding.mode===`ORCHESTRATOR`?r(`div`,{className:`py-5`,children:[r(`div`,{className:`mb-2 flex items-center justify-between gap-3`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.16em] text-slate-400`,children:`Available to orchestrator`}),r(`div`,{className:`text-[11px] text-slate-500 dark:text-slate-400`,children:[p.taskCoding.orchestratorAgentPresetIds.length,` selected`]})]}),r(`div`,{className:`rounded-2xl border border-black/[0.05] bg-black/[0.015] p-3 dark:border-white/[0.06] dark:bg-white/[0.025]`,children:r(`div`,{className:`flex flex-wrap gap-2`,children:c.map(e=>r(`button`,{type:`button`,disabled:v,onClick:()=>T(e.value),className:`rounded-full border px-3 py-2 text-[11px] font-semibold tracking-wide transition-colors disabled:opacity-50 ${p.taskCoding.orchestratorAgentPresetIds.includes(e.value)?`border-signal-500/35 bg-signal-500/12 text-signal-700 dark:border-signal-400/35 dark:bg-signal-400/12 dark:text-signal-200`:`border-black/[0.08] bg-white/78 text-slate-500 dark:border-white/[0.08] dark:bg-void-900/60 dark:text-slate-400`}`,children:e.label},e.value))})}),c.length===0?r(`div`,{className:`mt-3 rounded-[1.15rem] border border-dashed border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.02] dark:text-slate-400`,children:`Create project agents first, then return here to expose coding specialists to the orchestrator.`}):null]}):null,r(`div`,{className:`mt-5 grid gap-3 md:grid-cols-2`,children:[[`planning`,`Planning agent`,`Used for sprint planning and prompt improvement.`,`Built-in Planning agent`],...p.taskCoding.mode===`MANUAL`?[[`taskCoding`,`Coding agent`,`Used for task coding when no task-level orchestrator assignment exists.`,`Built-in Worker agent`]]:[],[`ciFix`,`CI fix`,`Used for automated CI repair loops.`,`Built-in Worker agent`],[`mergeConflict`,`Merge conflict`,`Used for automated conflict resolution.`,`Built-in Worker agent`],[`dashboardReply`,`Dashboard reply`,`Used for generated dashboard chat replies.`,`Built-in Worker agent`],[`clarificationReply`,`Clarification reply`,`Used for automatic worker clarification replies.`,`Built-in Project manager agent`]].map(([e,t,n,i])=>r(`div`,{className:`flex min-w-0 flex-col gap-3 rounded-2xl border border-black/[0.05] bg-white/55 p-4 dark:border-white/[0.06] dark:bg-white/[0.025]`,children:[r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-sm font-semibold text-slate-800 dark:text-slate-100`,children:t}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:n})]}),r(q,{value:p[e].agentPresetId||``,onChange:t=>w(n=>({...n,[e]:e===`taskCoding`?{...n.taskCoding,agentPresetId:t||null}:{agentPresetId:t||null}})),options:[{value:``,label:i,icon:()=>r(ye,{seed:`built-in:${e}:${i}`})},...g],disabled:v})]},e))})]})]})}),r(en,{settings:m,update:e=>C(t=>({...t,...e})),getBadge:S,sectionBadge:x,presetOptions:_,selectorsDisabled:y,selectedProjectName:i?.name,activeScope:t})]})},an=({state:e})=>{let{activeScope:t,selectedProject:n,editableSettings:i,projectSources:a,updateEditableSettings:o}=e,s=(...e)=>J(t,a,...e),c=e=>Z(t,a,e);return i?r(`div`,{className:`flex flex-col gap-5`,children:[r(B,{title:`Memory System`,watermark:`MEM`,badge:s(`memory`),icon:r(Be,{strokeWidth:2.4}),children:[r(Y,{label:`Enable memory`,description:`Turn on the memory system for automatic capture, storage, and semantic search of sprint knowledge.`,badge:c(`memory.enabled`),children:r(z,{"aria-label":`Toggle setting`,value:i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,enabled:!e.memory.enabled}}))})}),r(Y,{label:`Auto-capture sprint events`,description:`Automatically create memories when tasks complete, fail, or encounter CI issues during sprint execution.`,badge:c(`memory.autoCaptureSprint`),children:r(z,{"aria-label":`Toggle setting`,value:i.memory.autoCaptureSprint,disabled:!i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,autoCaptureSprint:!e.memory.autoCaptureSprint}}))})}),r(Y,{label:`Auto-capture agent events`,description:`Capture memories from notable agent interactions such as retries and clarifications.`,badge:c(`memory.autoCaptureAgent`),children:r(z,{"aria-label":`Toggle setting`,value:i.memory.autoCaptureAgent,disabled:!i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,autoCaptureAgent:!e.memory.autoCaptureAgent}}))})}),r(Y,{label:`Auto-promote to project scope`,description:`Automatically promote recurring or high-strength sprint memories to long-term project knowledge when a sprint completes.`,badge:c(`memory.autoPromote`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:i.memory.autoPromote,disabled:!i.memory.enabled,onChange:()=>o(e=>({...e,memory:{...e.memory,autoPromote:!e.memory.autoPromote}}))})})]}),r(B,{title:`Limits`,watermark:`CAP`,badge:s(`memory`),icon:r(v,{strokeWidth:2.4}),children:[r(Y,{label:`Promotion threshold`,description:`Minimum score (0.0–1.0) a sprint memory needs to be auto-promoted to project scope.`,badge:c(`memory.promotionThreshold`),children:r(Q,{value:i.memory.promotionThreshold,min:0,max:1,step:.05,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,promotionThreshold:e}}))})}),r(Y,{label:`Max sprint memories`,description:`Maximum number of memories retained per sprint. Lowest-strength memories are evicted when exceeded.`,badge:c(`memory.maxSprintMemories`),children:r(Q,{value:i.memory.maxSprintMemories,min:10,max:5e3,step:10,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,maxSprintMemories:e}}))})}),r(Y,{label:`Max project memories`,description:`Maximum number of long-term project-scoped memories. Oldest low-strength memories are evicted when exceeded.`,badge:c(`memory.maxProjectMemories`),children:r(Q,{value:i.memory.maxProjectMemories,min:10,max:1e4,step:50,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,maxProjectMemories:e}}))})}),r(Y,{label:`Map edges per node`,description:`Maximum number of similarity connections per memory node on the neural map. Lower values produce a cleaner graph, higher values reveal more relationships.`,badge:c(`memory.mapMaxEdgesPerNode`),last:!0,children:r(Q,{value:i.memory.mapMaxEdgesPerNode,min:1,max:20,step:1,disabled:!i.memory.enabled,onChange:e=>o(t=>({...t,memory:{...t.memory,mapMaxEdgesPerNode:e}}))})})]}),r(B,{title:`Worker Learnings Instruction`,watermark:`LRN`,badge:s(`memory`),icon:r(Re,{strokeWidth:2.4}),children:r(`div`,{className:`pt-2 pb-1`,children:[r(`div`,{className:`text-xs font-medium leading-relaxed text-slate-400 mb-3`,children:`This instruction is appended to every worker task prompt when auto-capture is enabled. It tells the AI provider what to observe and record in a temporary learnings file that gets processed into sprint memories.`}),r(Fe,{value:i.memory.workerLearningsInstruction,rows:16,placeholder:`Enter the instruction that tells workers what to capture...`,onChange:e=>o(t=>({...t,memory:{...t.memory,workerLearningsInstruction:e}}))})]})}),r($,{title:`Embedding models`,tone:`success`,children:`Download and manage embedding models from the Memory page. Once a model is active, new memories are automatically embedded for semantic search. The memory system works without a model — search falls back to text matching.`})]}):null};c(),a();var on=[`jules`,`gemini`,`antigravity`,`codex`,`claude-code`,`qwen-code`,`opencode`],sn={host:``,email:``,apiToken:``,autoCloseLinkedIssues:!1,defaultProject:``,closeTransitionName:`Done`},cn=e=>e===`jules`?`JLS`:e===`gemini`?`GMN`:e===`codex`?`CDX`:e===`qwen-code`?`QWN`:e===`opencode`?`OPC`:e===`antigravity`?`AGY`:`CLD`,ln=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,7)}`,un=e=>Object.entries(e).find(([,e])=>e.provider!==`jules`)?.[0]||null,dn=(e,t)=>{let n=Object.fromEntries(Object.entries(t).map(([t,n])=>{let r=e.aiProvider.providers[t],i=n.provider===`opencode`?ve(n,r?.model):null,a=n.provider===`qwen-code`?P(n,r?.model):null;return[t,r?{...r,provider:n.provider,name:n.name,...i?{model:i}:{},...a?{model:a}:{}}:{...O(n.provider,n.name),...i?{model:i}:{},...a?{model:a}:{}}]})),r=Object.fromEntries(Object.entries(e.aiProvider.invocationRouting).map(([e,t])=>[e,{...t,provider:t.provider&&n[t.provider]?t.provider:null,allowedProviders:t.allowedProviders.filter(e=>n[e]),providers:Object.fromEntries(Object.entries(t.providers).filter(([e])=>n[e]))}])),i=e.aiProvider.provider&&n[e.aiProvider.provider]?e.aiProvider.provider:Object.keys(n)[0]||null,a=n[e.workers.virtualWorkerProvider]?e.workers.virtualWorkerProvider:un(n)||i||e.workers.virtualWorkerProvider;return{...e,aiProvider:{...e.aiProvider,provider:i,providers:n,invocationRouting:r},workers:{...e.workers,virtualWorkerProvider:a}}},fn=(e,t)=>dn(e.defaults,t),pn=({label:e,icon:t,onClick:n,disabled:i=!1,tone:a=`neutral`})=>r(`button`,{type:`button`,disabled:i,onClick:n,className:`inline-flex h-9 shrink-0 items-center justify-center gap-2 rounded-[0.9rem] border px-3 text-[11px] font-bold uppercase tracking-[0.12em] transition-[background-color,border-color,color,transform,box-shadow] duration-200 hover:-translate-y-px focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 disabled:cursor-not-allowed disabled:opacity-45 disabled:hover:translate-y-0 ${a===`primary`?`border-signal-500/25 bg-signal-500/[0.1] text-signal-700 shadow-[0_10px_24px_rgba(0,224,160,0.08)] hover:border-signal-500/35 hover:bg-signal-500/[0.15] dark:text-signal-200`:`border-black/[0.08] bg-white/72 text-slate-600 hover:border-black/[0.14] hover:bg-white hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-300 dark:hover:border-white/[0.14] dark:hover:bg-white/[0.08] dark:hover:text-white`}`,children:[r(t,{className:`h-3.5 w-3.5`,strokeWidth:2.5}),e]}),mn=({label:e,tone:t=`neutral`})=>r(`span`,{className:`inline-flex h-6 items-center rounded-full border px-2.5 text-[9px] font-bold uppercase tracking-[0.15em] ${t===`active`?`border-signal-500/20 bg-signal-500/[0.1] text-signal-700 dark:text-signal-200`:t===`muted`?`border-black/[0.06] bg-black/[0.025] text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.035] dark:text-slate-500`:`border-black/[0.08] bg-black/[0.035] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-400`}`,children:e}),hn=({state:t})=>{let{activeScope:n,editableSettings:a,systemSettings:s,projectSources:c,selectedIntegration:u,setSelectedIntegration:d,integrations:f,importingHints:m,externalHints:h,handleImportHints:g,updateEditableSettings:_,updateSystem:v,updateProject:y}=t,x=(...e)=>J(n,c,...e),S=e=>Z(n,c,e),C=i(null),w=i(null),T=i(null),[E,ee]=l(u),te=i(!0);if(o(()=>{if(!C.current||!w.current||!T.current)return;if(te.current){te.current=!1,u===null?(X.set(w.current,{display:`block`,position:`relative`,x:`0%`,opacity:1}),X.set(T.current,{display:`none`,position:`absolute`,top:0,left:0,x:`100%`,opacity:0})):(X.set(w.current,{display:`none`,position:`relative`,x:`-100%`,opacity:0}),X.set(T.current,{display:`block`,position:`relative`,top:`auto`,left:`auto`,x:`0%`,opacity:1}),X.set(C.current,{height:`auto`}));return}let e=u!==null,t=X.timeline();e?(ee(u),X.set(w.current,{display:`block`,position:`relative`,x:`0%`,opacity:1}),X.set(T.current,{display:`block`,position:`absolute`,top:0,left:0,x:`100%`,opacity:0}),X.set(C.current,{height:T.current.offsetHeight}),t.to(w.current,{x:`-100%`,opacity:0,duration:.4,ease:`power3.inOut`},0).to(T.current,{x:`0%`,opacity:1,duration:.4,ease:`power3.inOut`,onComplete:()=>{w.current&&X.set(w.current,{display:`none`}),T.current&&X.set(T.current,{position:`relative`,top:`auto`,left:`auto`,x:`0%`,opacity:1}),C.current&&X.set(C.current,{height:`auto`})}},0)):(X.set(w.current,{display:`block`,position:`absolute`,top:0,left:0,x:`-100%`,opacity:0}),X.set(T.current,{display:`block`,position:`absolute`,top:0,left:0,x:`0%`,opacity:1}),X.set(C.current,{height:C.current.offsetHeight}),t.to(T.current,{x:`100%`,opacity:0,duration:.4,ease:`power3.inOut`,onComplete:()=>{ee(null),T.current&&X.set(T.current,{display:`none`})}},0).to(w.current,{x:`0%`,opacity:1,duration:.4,ease:`power3.inOut`,onComplete:()=>{w.current&&X.set(w.current,{position:`relative`,top:`auto`,left:`auto`,x:`0%`,opacity:1}),C.current&&X.set(C.current,{height:`auto`})}},0))},[u]),!a||!s)return null;let D=a.cliWorkflow.executionMode===`DOCKER`,ne=[{id:`api`,label:`API`,purpose:`Hosted orchestration and provider services`,items:f.filter(e=>e.id===`jules`)},{id:`cli`,label:`CLI`,purpose:`Provider credentials and local auth-copy settings`,items:f.filter(e=>on.includes(e.id)&&e.id!==`jules`)},{id:`git`,label:`GIT`,purpose:`Source-control tokens, CI, PRs, and git identity`,items:f.filter(e=>e.id===`github`||e.id===`gitlab`)},{id:`pm`,label:`PM`,purpose:`Project management and issue tracker connections`,items:f.filter(e=>e.id===`jira`)}].filter(e=>e.items.length>0),ie=e=>{v(n=>{let r=e({...n.integrations.providers}),i={...n,integrations:{...n.integrations,providers:r},defaults:fn(n,r)};return t.projectSettings&&y(e=>dn(e,r)),i})},O=e=>{if(n!==`system`){d(e);return}let t=qe(s,e).length+1,r=ln(e),i=`${we(e)} ${t}`;ie(t=>({...t,[r]:Le(e,i)})),d(e)},k=(e,n)=>{v(r=>{let i={...r.integrations.providers,[e]:Ye({...r.integrations.providers[e],...n})},a={...r,integrations:{...r.integrations,providers:i},defaults:fn(r,i)};return t.projectSettings&&y(e=>dn(e,i)),a})},ae=e=>{ie(t=>{let n={...t};return delete n[e],n})};return r(`div`,{className:`flex flex-col gap-5`,children:r(B,{title:`Integrations`,watermark:`INT`,badge:x(`integrations`,`cliWorkflow`),icon:r(p,{strokeWidth:2.4}),actions:u?null:r(e,{children:[r(mn,{label:`${f.length} integrations`}),r(mn,{label:D?`Docker auth copy`:`Host execution`,tone:D?`active`:`neutral`}),r(nt,{label:`Import host hints`,onClick:()=>void g(),busy:m})]}),children:r(`div`,{ref:C,className:`relative w-full overflow-hidden`,children:[r(`div`,{ref:w,className:`w-full`,children:r(`div`,{className:`space-y-4`,children:ne.map((e,t)=>r(`div`,{className:`space-y-3`,children:[t>0?r(`div`,{"aria-hidden":!0,className:`h-px bg-black/[0.06] dark:bg-white/[0.06]`}):null,r(`div`,{className:`flex flex-wrap items-center gap-3 px-1`,children:[r(`div`,{className:`text-[10px] font-bold uppercase tracking-[0.2em] text-slate-500 dark:text-slate-300`,children:e.label}),r(`div`,{className:`h-px min-w-8 flex-1 bg-black/[0.06] dark:bg-white/[0.06]`}),r(`div`,{className:`text-[11px] font-medium text-slate-400 dark:text-slate-500`,children:e.purpose})]}),r(`div`,{className:`grid gap-3 xl:grid-cols-2`,children:e.items.map(e=>{if(e.id===`github`||e.id===`gitlab`||e.id===`jira`){let t=e.id===`gitlab`,i=e.id===`jira`,o=n===`system`?s.integrations.jira:a.jira,c=!!(o?.host?.trim()&&o?.apiToken?.trim());return r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border border-black/[0.06] bg-white/88 p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:border-black/[0.12] hover:bg-white hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] dark:border-white/[0.08] dark:bg-void-800/80 dark:hover:border-white/[0.14] dark:hover:bg-void-800/90`,children:[r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-black/[0.08] to-transparent dark:via-white/[0.12]`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[i?r(`span`,{className:`flex h-11 w-11 shrink-0 items-center justify-center rounded-[1rem] border border-[#0052CC]/18 bg-[#0052CC]/10 text-[#0052CC] dark:border-[#4C9AFF]/18 dark:bg-[#4C9AFF]/10 dark:text-[#4C9AFF]`,"aria-hidden":!0,title:`Jira`,children:r(Je,{className:`h-6 w-6`})}):r(oe,{id:e.id}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:e.label}),i&&c?r(mn,{label:`Active`,tone:`active`}):null]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:e.description})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3 pl-14`,children:[r(`div`,{className:`flex flex-wrap gap-2`,children:[r(mn,{label:i?`Issue tracker`:`Git host`}),r(mn,{label:i?c?`Search + transitions`:`Not configured`:t?`Token + CI`:`Token + auth mount`,tone:i&&c?`neutral`:`muted`})]}),r(pn,{label:`Manage`,icon:b,onClick:()=>d(e.id)})]})]})]},e.id)}let t=e.id,i=ze(t,s,h),o=Te(t,s,h),c=et(t,s,h,D);return r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] ${o?`border-signal-500/24 bg-white/90 hover:border-signal-500/34 dark:border-signal-400/24 dark:bg-void-800/82 dark:hover:border-signal-400/34 dark:hover:bg-void-800/92`:`border-black/[0.06] bg-white/88 hover:border-black/[0.12] hover:bg-white dark:border-white/[0.08] dark:bg-void-800/78 dark:hover:border-white/[0.14] dark:hover:bg-void-800/88`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-5 bottom-5 w-1 rounded-r-full transition-opacity ${o?`bg-signal-500 opacity-100 dark:bg-signal-400`:`bg-slate-300 opacity-0 group-hover:opacity-100 dark:bg-slate-600`}`}),r(`div`,{"aria-hidden":!0,className:`absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-black/[0.08] to-transparent dark:via-white/[0.12]`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(W,{providerId:t,disabled:!o}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:e.label}),o?r(mn,{label:`Active`,tone:`active`}):null]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:e.description})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3 pl-14`,children:[r(`div`,{className:`flex flex-wrap gap-2`,children:[r(mn,{label:`${i} connected`,tone:i>0?`neutral`:`muted`}),c?r(mn,{label:c}):null]}),r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(pn,{label:`Add`,icon:I,disabled:n!==`system`,tone:`primary`,onClick:()=>O(t)}),r(pn,{label:`Manage`,icon:b,onClick:()=>d(t)})]})]})]})]},e.id)})})]},e.id))})}),r(`div`,{ref:T,className:`w-full`,children:(()=>{let t=E||u;if(!t)return null;let i=r(`button`,{className:`mb-4 flex items-center gap-2 text-sm text-neutral-400 transition-colors hover:text-white`,onClick:()=>d(null),children:[r(L,{className:`h-4 w-4`}),`Back to Integrations`]});if(t===`github`||t===`gitlab`){let o=t===`gitlab`,c=o?`GitLab`:`GitHub`,l=o?`gitlabToken`:`githubToken`;return r(e,{children:[i,r(B,{title:`${c} Configuration`,watermark:o?`GLB`:`GIT`,icon:r(b,{strokeWidth:2.4}),children:[r(Y,{label:`${c} token`,description:n===`system`?`System token used for ${c} repository, ${o?`merge request`:`pull request`}, and CI integration. Projects inherit this unless they override it.`:`Override the ${c} token for this scope. Leave blank to inherit the system token.`,badge:n===`system`?void 0:S(`git.${l}`),children:r(G,{value:n===`system`?s.integrations[l]||``:a.git[l]||``,onChange:e=>n===`system`?v(t=>({...t,integrations:{...t.integrations,[l]:e}})):_(t=>({...t,git:{...t.git,[l]:e}})),mono:!0})}),o?null:r(e,{children:[r(Y,{label:`Mount GitHub auth`,description:"Copy the host `gh` credential directory into Docker for this scope.",badge:S(`cliWorkflow.containerMountGithubAuth`),children:r(z,{"aria-label":`Toggle setting`,value:a.cliWorkflow.containerMountGithubAuth,onChange:()=>_(e=>({...e,cliWorkflow:{...e.cliWorkflow,containerMountGithubAuth:!e.cliWorkflow.containerMountGithubAuth}}))})}),r(Y,{label:`GitHub auth path`,description:`Host path copied into the Docker runtime for GitHub CLI auth.`,badge:S(`cliWorkflow.containerGithubAuthPath`),children:r(G,{value:a.cliWorkflow.containerGithubAuthPath,onChange:e=>_(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerGithubAuthPath:e}})),disabled:!a.cliWorkflow.containerMountGithubAuth,mono:!0})})]}),r(Y,{label:`Copy local git config`,description:"Use host `.gitconfig` in Docker instead of the configured Code UX git identity.",badge:S(`cliWorkflow.containerMountGitConfig`),last:a.cliWorkflow.containerMountGitConfig,children:r(z,{"aria-label":`Toggle setting`,value:a.cliWorkflow.containerMountGitConfig,onChange:()=>_(e=>({...e,cliWorkflow:{...e.cliWorkflow,containerMountGitConfig:!e.cliWorkflow.containerMountGitConfig}}))})}),a.cliWorkflow.containerMountGitConfig?null:r(e,{children:[r(Y,{label:`Git user name`,description:`Git author name configured inside provider containers.`,badge:S(`cliWorkflow.containerGitUserName`),children:r(G,{value:a.cliWorkflow.containerGitUserName,onChange:e=>_(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerGitUserName:e}})),placeholder:`Code UX`})}),r(Y,{label:`Git email`,description:`Git author email configured inside provider containers.`,badge:S(`cliWorkflow.containerGitUserEmail`),last:!0,children:r(G,{value:a.cliWorkflow.containerGitUserEmail,onChange:e=>_(t=>({...t,cliWorkflow:{...t.cliWorkflow,containerGitUserEmail:e}})),placeholder:`agents@codeux.ai`,mono:!0})})]})]})]})}if(t===`jira`){let t=n===`system`?s.integrations.jira||sn:a.jira||sn,o=e=>{if(n===`system`){v(t=>({...t,integrations:{...t.integrations,jira:{...t.integrations.jira||sn,...e}}}));return}_(t=>({...t,jira:{...t.jira||sn,...e}}))};return r(e,{children:[i,r(B,{title:`Jira Configuration`,watermark:`JRA`,icon:r(b,{strokeWidth:2.4}),children:[n===`system`?null:r($,{title:`Project-scope Jira override`,children:`These fields override the system Jira connection for this scope. Cleared fields fall back to the system values.`}),r(Y,{label:`Jira site URL`,description:"Base URL for Jira Cloud or Data Center, for example `https://company.atlassian.net`.",badge:n===`system`?void 0:S(`jira.host`),children:r(G,{value:t.host,onChange:e=>o({host:e}),mono:!0})}),r(Y,{label:`Account email`,description:`Email used with Jira Cloud API tokens. Leave empty for bearer-token Jira deployments.`,badge:n===`system`?void 0:S(`jira.email`),children:r(G,{value:t.email,onChange:e=>o({email:e}),mono:!0})}),r(Y,{label:`API token`,description:`Jira API token used for issue search, issue context loading, and transitions.`,badge:n===`system`?void 0:S(`jira.apiToken`),children:r(G,{value:t.apiToken,onChange:e=>o({apiToken:e}),mono:!0})}),r(Y,{label:`Default project`,description:`Project key used to prefill the Jira import JQL.`,badge:n===`system`?void 0:S(`jira.defaultProject`),children:r(G,{value:t.defaultProject,onChange:e=>o({defaultProject:e.toUpperCase()}),mono:!0})}),r(Y,{label:`Close transition`,description:`Transition name used when auto-closing linked Jira issues after sprint completion.`,badge:n===`system`?void 0:S(`jira.closeTransitionName`),children:r(G,{value:t.closeTransitionName,onChange:e=>o({closeTransitionName:e})})}),r(Y,{label:`Auto-close Jira issues`,description:`Move linked Jira issues through the configured transition after the sprint completes.`,badge:n===`system`?void 0:S(`jira.autoCloseLinkedIssues`),last:!0,children:r(z,{"aria-label":`Toggle setting`,value:t.autoCloseLinkedIssues,onChange:()=>o({autoCloseLinkedIssues:!t.autoCloseLinkedIssues})})})]})]})}let o=t,c=re(qe(s,o));return n===`system`?r(e,{children:[i,r(B,{title:`${we(o)} Credentials`,watermark:cn(o),icon:r(ot,{strokeWidth:2.4}),children:[r(`div`,{className:`relative overflow-hidden rounded-[1.45rem] border border-black/[0.06] bg-[linear-gradient(135deg,rgba(255,255,255,0.9),rgba(248,250,252,0.62))] px-5 py-4 shadow-[0_14px_34px_rgba(15,23,42,0.045)] dark:border-white/[0.06] dark:bg-[linear-gradient(135deg,rgba(255,255,255,0.065),rgba(255,255,255,0.025))]`,children:[r(`div`,{"aria-hidden":!0,className:`pointer-events-none absolute inset-x-0 top-0 h-px bg-gradient-to-r from-transparent via-signal-500/35 to-transparent`}),r(`div`,{className:`relative z-10 flex flex-wrap items-center justify-between gap-4`,children:[r(`div`,{className:`flex min-w-0 items-start gap-3`,children:[r(W,{providerId:o}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:[we(o),` instances`]}),r(`div`,{className:`mt-1 max-w-2xl text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:`Add as many named credentials as you need. AI Models routes each one independently for manual or weighted selection.`})]})]}),r(pn,{label:`Add instance`,icon:I,tone:`primary`,onClick:()=>O(o)})]})]}),c.length===0?r($,{title:`No credentials yet`,children:[`Add a `,we(o),` instance to make it available for routing.`]}):c.map(([e,t],n)=>r(He,{providerConfigId:e,provider:t,providerModel:s.defaults.aiProvider.providers[e]?.model||(t.provider===`opencode`?`anthropic/claude-sonnet-4-5`:`qwen3-coder-plus`),dockerExecutionEnabled:D,onUpdate:t=>k(e,t),onRemove:c.length>1?()=>ae(e):void 0,isLast:n===c.length-1,index:n,total:c.length},e)),r(`div`,{className:`rounded-[1.25rem] border border-black/[0.06] bg-black/[0.02] px-4 py-3 text-xs leading-relaxed text-slate-500 dark:border-white/[0.06] dark:bg-white/[0.03] dark:text-slate-400`,children:`Routing uses named provider instances exactly as configured on the AI Models page. If Docker mode is active, a provider instance marked with local auth will copy only that instance’s configured auth path into the runtime.`})]})]}):r(e,{children:[i,r(B,{title:`${we(o)} Integration`,watermark:cn(o),icon:r(p,{strokeWidth:2.4}),children:[r($,{title:`System-owned credentials`,children:`Provider credentials and auth-copy mounts are managed per instance at system scope. This keeps multiple named providers independent across every route.`}),r($,{title:`Scope behavior`,children:`Project and sprint scopes still control GitHub auth-copy mounts and git config. Provider-specific key or local-auth choices now live on each named provider instance.`})]})]})})()})]})})})};c(),a();var gn={orchestration:{label:`Orchestration`,description:`Projects, sprints, and tasks`,icon:f},agents_memory:{label:`Agents & Memory`,description:`Agent presets and project memory`,icon:m},platform:{label:`Platform`,description:`Settings, previews, and telemetry`,icon:_},advanced:{label:`Advanced`,description:`Deprecated and low-level tools`,icon:x}},_n=[`orchestration`,`agents_memory`,`platform`,`advanced`],vn=[{id:`claude-code`,label:`Claude Code`},{id:`gemini`,label:`Gemini`},{id:`codex`,label:`Codex`},{id:`qwen-code`,label:`Qwen Code`}],yn=/^[a-zA-Z0-9_-]+$/,bn=({label:e,tone:t=`neutral`})=>r(`span`,{className:`inline-flex h-6 items-center rounded-full border px-2.5 text-[9px] font-bold uppercase tracking-[0.15em] ${t===`active`?`border-signal-500/20 bg-signal-500/[0.1] text-signal-700 dark:text-signal-200`:t===`muted`?`border-black/[0.06] bg-black/[0.025] text-slate-400 dark:border-white/[0.06] dark:bg-white/[0.035] dark:text-slate-500`:`border-black/[0.08] bg-black/[0.035] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-400`}`,children:e}),xn=({label:e,icon:t,onClick:n,tone:i=`neutral`,disabled:a=!1})=>r(`button`,{type:`button`,disabled:a,onClick:n,className:`inline-flex h-9 shrink-0 items-center justify-center gap-2 rounded-[0.9rem] border px-3 text-[11px] font-bold uppercase tracking-[0.12em] transition-[background-color,border-color,color,transform,box-shadow] duration-200 hover:-translate-y-px focus:outline-none focus-visible:ring-2 focus-visible:ring-signal-500/50 disabled:cursor-not-allowed disabled:opacity-45 disabled:hover:translate-y-0 ${i===`primary`?`border-signal-500/25 bg-signal-500/[0.1] text-signal-700 shadow-[0_10px_24px_rgba(0,224,160,0.08)] hover:border-signal-500/35 hover:bg-signal-500/[0.15] dark:text-signal-200`:i===`danger`?`border-status-red/25 bg-status-red/[0.06] text-status-red hover:border-status-red/40 hover:bg-status-red/[0.1]`:`border-black/[0.08] bg-white/72 text-slate-600 hover:border-black/[0.14] hover:bg-white hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-300 dark:hover:border-white/[0.14] dark:hover:bg-white/[0.08] dark:hover:text-white`}`,children:[r(t,{className:`h-3.5 w-3.5`,strokeWidth:2.5}),e]}),Sn=e=>{if(!e)return`Not configured`;try{let t=new URL(e);return`${t.protocol}//${t.host}${t.pathname}`}catch{return e}},Cn=e=>e.description?e.description:e.transport===`stdio`?[e.command,...e.args??[]].filter(Boolean).join(` `)||`No command set`:Sn(e.url??``),wn=({state:t})=>{let{activeScope:i,systemSettings:a,projectSettings:o,selectedProject:s,updateSystem:c,updateProject:u}=t,d=i===`project`,[f,p]=l({kind:`list`}),m=(d?o?.mcpTools:a?.mcpTools)??[],h=(d?o?.customMcpServers:a?.customMcpServers)??[],g=e=>{d?u(t=>({...t,mcpTools:e})):c(t=>({...t,mcpTools:e}))},_=e=>{d?u(t=>({...t,customMcpServers:e})):c(t=>({...t,customMcpServers:e}))},v=n(()=>{let e=new Map;for(let t of m)e.set(t.name,t.enabled);return e},[m]),x=n(()=>Ke.map(e=>({name:e.name,enabled:v.get(e.name)??!0,isInternal:!0})),[v]),S=x.filter(e=>e.enabled).length,C=(e,t)=>{g(x.map(n=>n.name===e?{...n,enabled:t}:n))},w=(e,t)=>{let n=new Set(Ke.filter(t=>t.category===e).map(e=>e.name));g(x.map(e=>n.has(e.name)?{...e,enabled:t}:e))},T=()=>{let e=globalThis.crypto?.randomUUID?.()??`mcp_${Date.now()}`,t={id:e,name:``,label:``,enabled:!0,transport:`http`,url:``};_([...h,t]),p({kind:`custom`,id:e})},E=(e,t)=>{_(h.map(n=>n.id===e?{...n,...t}:n))},ee=e=>{_(h.filter(t=>t.id!==e)),p({kind:`list`})},te=r(`button`,{type:`button`,onClick:()=>p({kind:`list`}),className:`inline-flex items-center gap-2 self-start rounded-full border border-black/[0.08] bg-white/72 px-3 py-1.5 text-[11px] font-bold uppercase tracking-[0.14em] text-slate-600 transition-colors hover:border-black/[0.14] hover:text-slate-900 dark:border-white/[0.08] dark:bg-white/[0.045] dark:text-slate-300 dark:hover:text-white`,children:[r(L,{className:`h-3.5 w-3.5`}),`All MCP servers`]}),D=d&&s?`Editing MCP configuration for ${s.name}. Project values override system defaults.`:`System-wide MCP configuration injected into every CLI run across all projects.`;if(f.kind===`internal`)return r(e,{children:[te,r(B,{title:`Built-in MCP (Code UX)`,watermark:`MCP`,icon:r(y,{strokeWidth:2.4}),badge:`${S} enabled`,children:r($,{title:`Tool access`,children:`Toggle which Code UX tools the containerized CLIs may call. Disable a whole category or individual tools. Changes apply on the next CLI run.`})}),_n.map(e=>{let t=gn[e],n=Ke.filter(t=>t.category===e);if(n.length===0)return null;let i=n.every(e=>v.get(e.name)??!0),a=t.icon;return r(B,{title:t.label,icon:r(a,{strokeWidth:2.4}),badge:`${n.filter(e=>v.get(e.name)??!0).length}/${n.length}`,children:[r(Y,{label:`Enable all ${t.label.toLowerCase()} tools`,description:t.description,children:r(z,{"aria-label":`Toggle setting`,value:i,onChange:t=>w(e,t)})}),n.map((e,t)=>r(Y,{label:e.name,description:e.description,last:t===n.length-1,children:r(z,{"aria-label":`Toggle setting`,value:v.get(e.name)??!0,onChange:t=>C(e.name,t)})},e.name))]},e)})]});if(f.kind===`custom`){let t=h.find(e=>e.id===f.id);return t?r(e,{children:[te,r(Dn,{server:t,canRemove:!d,onChange:e=>E(t.id,e),onRemove:()=>ee(t.id)})]}):r(e,{children:[te,r(B,{title:`MCP server`,icon:r(y,{strokeWidth:2.4}),children:r($,{title:`Server not found`,tone:`warning`,children:`This MCP server is no longer available.`})})]})}return r(e,{children:r(B,{title:`MCP Servers`,watermark:`MCP`,icon:r(y,{strokeWidth:2.4}),children:[r($,{title:d?`Project scope`:`System scope`,children:D}),r(`div`,{className:`grid gap-3 md:grid-cols-2`,children:[r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border border-signal-500/24 bg-white/90 p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] dark:border-signal-400/24 dark:bg-void-800/82`,children:[r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-5 bottom-5 w-1 rounded-r-full bg-signal-500 dark:bg-signal-400`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-[0.9rem] border border-signal-500/25 bg-signal-500/[0.1] text-signal-600 dark:text-signal-300`,children:r(y,{className:`h-5 w-5`,strokeWidth:2})}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`text-sm font-semibold text-slate-900 dark:text-white`,children:`Code UX (built-in)`}),r(bn,{label:`Always on`,tone:`active`})]}),r(`div`,{className:`mt-1 text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:`Our internal MCP server. Manage which tool categories and tools the CLIs can call.`})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3 pl-13`,children:[r(bn,{label:`${S}/${x.length} tools`,tone:S>0?`neutral`:`muted`}),r(xn,{label:`Configure`,icon:b,onClick:()=>p({kind:`internal`})})]})]})]}),h.map(e=>{let t=e.enabled;return r(`div`,{className:`group relative min-h-[156px] overflow-hidden rounded-[1.35rem] border p-5 shadow-[0_12px_30px_rgba(15,23,42,0.035)] transition-[border-color,background-color,transform,box-shadow] duration-200 hover:-translate-y-0.5 hover:shadow-[0_18px_42px_rgba(15,23,42,0.07)] ${t?`border-signal-500/24 bg-white/90 dark:border-signal-400/24 dark:bg-void-800/82`:`border-black/[0.06] bg-white/88 dark:border-white/[0.08] dark:bg-void-800/78`}`,children:[r(`div`,{"aria-hidden":!0,className:`absolute left-0 top-5 bottom-5 w-1 rounded-r-full transition-opacity ${t?`bg-signal-500 opacity-100 dark:bg-signal-400`:`bg-slate-300 opacity-0 group-hover:opacity-100 dark:bg-slate-600`}`}),r(`div`,{className:`flex h-full flex-col gap-4`,children:[r(`div`,{className:`flex items-start gap-3`,children:[r(`span`,{className:`inline-flex h-10 w-10 items-center justify-center rounded-[0.9rem] border border-black/[0.08] bg-black/[0.03] text-slate-500 dark:border-white/[0.08] dark:bg-white/[0.04] dark:text-slate-300`,children:r(y,{className:`h-5 w-5`,strokeWidth:2})}),r(`div`,{className:`min-w-0`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(`div`,{className:`truncate text-sm font-semibold text-slate-900 dark:text-white`,children:e.label||e.name||`Untitled server`}),t?r(bn,{label:`Active`,tone:`active`}):r(bn,{label:`Disabled`,tone:`muted`})]}),r(`div`,{className:`mt-1 truncate text-xs leading-relaxed text-slate-500 dark:text-slate-400`,children:Cn(e)})]})]}),r(`div`,{className:`mt-auto flex flex-wrap items-center justify-between gap-3`,children:[r(`div`,{className:`flex flex-wrap items-center gap-2`,children:[r(bn,{label:e.transport===`stdio`?`stdio`:`HTTP`}),r(bn,{label:!e.providers||e.providers.length===0?`All CLIs`:`${e.providers.length} CLIs`})]}),r(`div`,{className:`flex items-center gap-2`,children:[r(z,{"aria-label":`Toggle setting`,value:e.enabled,onChange:t=>E(e.id,{enabled:t})}),r(xn,{label:`Manage`,icon:b,onClick:()=>p({kind:`custom`,id:e.id})})]})]})]})]},e.id)})]}),d?r($,{title:`Add servers at system scope`,tone:`neutral`,children:`New custom servers are added at system scope so every project inherits them. Switch to system scope to add a server. Here you can enable, disable, or override inherited servers.`}):r(`div`,{className:`flex justify-end`,children:r(xn,{label:`Add MCP server`,icon:I,tone:`primary`,onClick:T})})]})})},Tn=({resetKey:e,value:t,placeholder:n,onChange:i})=>{let[a,o]=l(()=>JSON.stringify(t??{},null,2)),[c,u]=l(null);return s(()=>{o(JSON.stringify(t??{},null,2)),u(null)},[e]),r(`div`,{className:`flex w-full flex-col gap-1.5`,children:[r(Fe,{value:a,onChange:e=>{o(e);let t=e.trim();if(t.length===0){u(null),i(void 0);return}try{let e=JSON.parse(t);if(!e||typeof e!=`object`||Array.isArray(e)){u(`Expected a JSON object of string values.`);return}let n={};for(let[t,r]of Object.entries(e)){if(typeof r!=`string`){u(`"${t}" must be a string value.`);return}n[t]=r}u(null),i(Object.keys(n).length>0?n:void 0)}catch{u(`Invalid JSON.`)}},rows:5,placeholder:n}),c?r(`span`,{className:`text-[11px] font-medium text-status-red`,children:c}):null]})},En=[{value:`http`,label:`HTTP / SSE`,hint:`Remote server via URL`},{value:`stdio`,label:`Command (stdio)`,hint:`Local process, e.g. npx`}],Dn=({server:t,canRemove:n,onChange:i,onRemove:a})=>{let o=yn.test(t.name),s=t.providers??[],c=t.transport===`stdio`,l=e=>{let t=new Set(s);t.has(e)?t.delete(e):t.add(e);let n=Array.from(t);i({providers:n.length===0?void 0:n})},u=e=>{let t=e.split(`
2
2
  `).map(e=>e.trim()).filter(e=>e.length>0);i({args:t.length>0?t:void 0})},d={mcpServers:{[t.name||`server_name`]:c?{command:t.command||`npx`,...t.args&&t.args.length>0?{args:t.args}:{},...t.env&&Object.keys(t.env).length>0?{env:t.env}:{}}:{type:`http`,url:t.url||`https://...`,...t.headers&&Object.keys(t.headers).length>0?{headers:t.headers}:{}}}};return r(B,{title:t.label||t.name||`MCP server`,watermark:`MCP`,icon:r(y,{strokeWidth:2.4}),children:[r(Y,{label:`Display name`,description:`Shown on the MCP servers list.`,children:r(G,{value:t.label??``,onChange:e=>i({label:e}),placeholder:`Playwright`})}),r(Y,{label:`Server key`,description:`Identifier used in each CLI's mcpServers config. Letters, numbers, dash, underscore.`,children:r(`div`,{className:`flex flex-col gap-1.5`,children:[r(G,{value:t.name,onChange:e=>i({name:e}),placeholder:`playwright`,mono:!0}),!o&&t.name.length>0?r(`span`,{className:`text-[11px] font-medium text-status-red`,children:`Only letters, numbers, dash, and underscore are allowed.`}):null]})}),r(Y,{label:`Transport`,description:`HTTP/SSE for remote servers, or a local command (stdio) like npx.`,children:r(U,{value:t.transport,onChange:e=>i({transport:e}),options:En})}),c?r(e,{children:[r(Y,{label:`Command`,description:`Executable to launch the MCP server. Must be available inside the CLI container.`,children:r(G,{value:t.command??``,onChange:e=>i({command:e}),placeholder:`npx`,mono:!0})}),r(Y,{label:`Arguments`,description:`One argument per line.`,children:r(Fe,{value:(t.args??[]).join(`
3
3
  `),onChange:u,rows:4,placeholder:`@playwright/mcp@latest`})}),r(Y,{label:`Environment (JSON)`,description:`Optional object of env var name to value passed to the command.`,children:r(Tn,{resetKey:t.id,value:t.env,placeholder:`{
4
4
  "API_KEY": "..."