@kilocode/cli-darwin-arm64 7.3.45 → 7.3.46

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.
@@ -17,7 +17,7 @@ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-CU
17
17
 
18
18
  `);y=L.pop()??"";for(const M of L){const S=M.split(`
19
19
  `),T=[];let R;for(const z of S)if(z.startsWith("data:"))T.push(z.replace(/^data:\s*/,""));else if(z.startsWith("event:"))R=z.replace(/^event:\s*/,"");else if(z.startsWith("id:"))c=z.replace(/^id:\s*/,"");else if(z.startsWith("retry:")){const iA=Number.parseInt(z.replace(/^retry:\s*/,""),10);Number.isNaN(iA)||(C=iA)}let P,X=!1;if(T.length){const z=T.join(`
20
- `);try{P=JSON.parse(z),X=!0}catch{P=z}}X&&(i&&await i(P),n&&(P=await n(P))),t?.({data:P,event:R,id:c,retry:C}),T.length&&(yield P)}}}finally{u.removeEventListener("abort",k),N.releaseLock()}break}catch(h){if(e?.(h),o!==void 0&&f>=o)break;const w=Math.min(C*2**(f-1),s??3e4);await Q(w)}}}()}},ok=A=>{switch(A){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},sk=A=>{switch(A){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},ak=A=>{switch(A){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},$u=({allowReserved:A,explode:e,name:t,style:n,value:i})=>{if(!e){const s=(A?i:i.map(a=>encodeURIComponent(a))).join(sk(n));switch(n){case"label":return`.${s}`;case"matrix":return`;${t}=${s}`;case"simple":return s;default:return`${t}=${s}`}}const r=ok(n),o=i.map(s=>n==="label"||n==="simple"?A?s:encodeURIComponent(s):Pa({allowReserved:A,name:t,value:s})).join(r);return n==="label"||n==="matrix"?r+o:o},Pa=({allowReserved:A,name:e,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${A?t:encodeURIComponent(t)}`},Wu=({allowReserved:A,explode:e,name:t,style:n,value:i,valueOnly:r})=>{if(i instanceof Date)return r?i.toISOString():`${t}=${i.toISOString()}`;if(n!=="deepObject"&&!e){let a=[];Object.entries(i).forEach(([g,c])=>{a=[...a,g,A?c:encodeURIComponent(c)]});const l=a.join(",");switch(n){case"form":return`${t}=${l}`;case"label":return`.${l}`;case"matrix":return`;${t}=${l}`;default:return l}}const o=ak(n),s=Object.entries(i).map(([a,l])=>Pa({allowReserved:A,name:n==="deepObject"?`${t}[${a}]`:a,value:l})).join(o);return n==="label"||n==="matrix"?o+s:s},lk=/\{[^{}]+\}/g,gk=({path:A,url:e})=>{let t=e;const n=e.match(lk);if(n)for(const i of n){let r=!1,o=i.substring(1,i.length-1),s="simple";o.endsWith("*")&&(r=!0,o=o.substring(0,o.length-1)),o.startsWith(".")?(o=o.substring(1),s="label"):o.startsWith(";")&&(o=o.substring(1),s="matrix");const a=A[o];if(a==null)continue;if(Array.isArray(a)){t=t.replace(i,$u({explode:r,name:o,style:s,value:a}));continue}if(typeof a=="object"){t=t.replace(i,Wu({explode:r,name:o,style:s,value:a,valueOnly:!0}));continue}if(s==="matrix"){t=t.replace(i,`;${Pa({name:o,value:a})}`);continue}const l=encodeURIComponent(s==="label"?`.${a}`:a);t=t.replace(i,l)}return t},ck=({baseUrl:A,path:e,query:t,querySerializer:n,url:i})=>{const r=i.startsWith("/")?i:`/${i}`;let o=(A??"")+r;e&&(o=gk({path:e,url:o}));let s=t?n(t):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function xd(A){const e=A.body!==void 0;if(e&&A.bodySerializer)return"serializedBody"in A?A.serializedBody!==void 0&&A.serializedBody!==""?A.serializedBody:null:A.body!==""?A.body:null;if(e)return A.body}const Qk=async(A,e)=>{const t=typeof e=="function"?await e(A):e;if(t)return A.scheme==="bearer"?`Bearer ${t}`:A.scheme==="basic"?`Basic ${btoa(t)}`:t},dk={bodySerializer:A=>JSON.stringify(A,(e,t)=>typeof t=="bigint"?t.toString():t)},Zu=({parameters:A={},...e}={})=>n=>{const i=[];if(n&&typeof n=="object")for(const r in n){const o=n[r];if(o==null)continue;const s=A[r]||e;if(Array.isArray(o)){const a=$u({allowReserved:s.allowReserved,explode:!0,name:r,style:"form",value:o,...s.array});a&&i.push(a)}else if(typeof o=="object"){const a=Wu({allowReserved:s.allowReserved,explode:!0,name:r,style:"deepObject",value:o,...s.object});a&&i.push(a)}else{const a=Pa({allowReserved:s.allowReserved,name:r,value:o});a&&i.push(a)}}return i.join("&")},Bk=A=>{if(!A)return"stream";const e=A.split(";")[0]?.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return"json";if(e==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(t=>e.startsWith(t)))return"blob";if(e.startsWith("text/"))return"text"}},Ek=(A,e)=>e?!!(A.headers.has(e)||A.query?.[e]||A.headers.get("Cookie")?.includes(`${e}=`)):!1,Ck=async({security:A,...e})=>{for(const t of A){if(Ek(e,t.name))continue;const n=await Qk(t,e.auth);if(!n)continue;const i=t.name??"Authorization";switch(t.in){case"query":e.query||(e.query={}),e.query[i]=n;break;case"cookie":e.headers.append("Cookie",`${i}=${n}`);break;default:e.headers.set(i,n);break}}},Fd=A=>ck({baseUrl:A.baseUrl,path:A.path,query:A.query,querySerializer:typeof A.querySerializer=="function"?A.querySerializer:Zu(A.querySerializer),url:A.url}),Gd=(A,e)=>{const t={...A,...e};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=Xu(A.headers,e.headers),t},uk=A=>{const e=[];return A.forEach((t,n)=>{e.push([n,t])}),e},Xu=(...A)=>{const e=new Headers;for(const t of A){if(!t)continue;const n=t instanceof Headers?uk(t):Object.entries(t);for(const[i,r]of n)if(r===null)e.delete(i);else if(Array.isArray(r))for(const o of r)e.append(i,o);else r!==void 0&&e.set(i,typeof r=="object"?JSON.stringify(r):r)}return e};class Hl{fns=[];clear(){this.fns=[]}eject(e){const t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){const t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e=="number"?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){const n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}}const Ik=()=>({error:new Hl,request:new Hl,response:new Hl}),hk=Zu({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),fk={"Content-Type":"application/json"},AI=(A={})=>({...dk,headers:fk,parseAs:"auto",querySerializer:hk,...A}),eI=(A={})=>{let e=Gd(AI(),A);const t=()=>({...e}),n=l=>(e=Gd(e,l),t()),i=Ik(),r=async l=>{const g={...e,...l,fetch:l.fetch??e.fetch??globalThis.fetch,headers:Xu(e.headers,l.headers),serializedBody:void 0};g.security&&await Ck({...g,security:g.security}),g.requestValidator&&await g.requestValidator(g),g.body!==void 0&&g.bodySerializer&&(g.serializedBody=g.bodySerializer(g.body)),(g.body===void 0||g.serializedBody==="")&&g.headers.delete("Content-Type");const c=Fd(g);return{opts:g,url:c}},o=async l=>{const{opts:g,url:c}=await r(l),Q={redirect:"follow",...g,body:xd(g)};let d=new Request(c,Q);for(const m of i.request.fns)m&&(d=await m(d,g));const B=g.fetch;let C;try{C=await B(d)}catch(m){let D=m;for(const N of i.error.fns)N&&(D=await N(m,void 0,d,g));if(D=D||{},g.throwOnError)throw D;return g.responseStyle==="data"?void 0:{error:D,request:d,response:void 0}}for(const m of i.response.fns)m&&(C=await m(C,d,g));const f={request:d,response:C};if(C.ok){const m=(g.parseAs==="auto"?Bk(C.headers.get("Content-Type")):g.parseAs)??"json";if(C.status===204||C.headers.get("Content-Length")==="0"){let N;switch(m){case"arrayBuffer":case"blob":case"text":N=await C[m]();break;case"formData":N=new FormData;break;case"stream":N=C.body;break;default:N={};break}return g.responseStyle==="data"?N:{data:N,...f}}let D;switch(m){case"arrayBuffer":case"blob":case"formData":case"text":D=await C[m]();break;case"json":{const N=await C.text();D=N?JSON.parse(N):{};break}case"stream":return g.responseStyle==="data"?C.body:{data:C.body,...f}}return m==="json"&&(g.responseValidator&&await g.responseValidator(D),g.responseTransformer&&(D=await g.responseTransformer(D))),g.responseStyle==="data"?D:{data:D,...f}}const u=await C.text();let I;try{I=JSON.parse(u)}catch{}const h=I??u;let w=h;for(const m of i.error.fns)m&&(w=await m(h,C,d,g));if(w=w||{},g.throwOnError)throw w;return g.responseStyle==="data"?void 0:{error:w,...f}},s=l=>g=>o({...g,method:l}),a=l=>async g=>{const{opts:c,url:Q}=await r(g);return rk({...c,body:c.body,headers:c.headers,method:l,onRequest:async(d,B)=>{let C=new Request(d,B);for(const f of i.request.fns)f&&(C=await f(C,c));return C},serializedBody:xd(c),url:Q})};return{buildUrl:Fd,connect:s("CONNECT"),delete:s("DELETE"),get:s("GET"),getConfig:t,head:s("HEAD"),interceptors:i,options:s("OPTIONS"),patch:s("PATCH"),post:s("POST"),put:s("PUT"),request:o,setConfig:n,sse:{connect:a("CONNECT"),delete:a("DELETE"),get:a("GET"),head:a("HEAD"),options:a("OPTIONS"),patch:a("PATCH"),post:a("POST"),put:a("PUT"),trace:a("TRACE")},trace:s("TRACE")}},pk={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},mk=Object.entries(pk),tI=(A,e)=>{e||(e=new Map);for(const t of A)"in"in t?t.key&&e.set(t.key,{in:t.in,map:t.map}):"key"in t?e.set(t.key,{map:t.map}):t.args&&tI(t.args,e);return e},wk=A=>{for(const[e,t]of Object.entries(A))t&&typeof t=="object"&&!Object.keys(t).length&&delete A[e]},H=(A,e)=>{const t={body:{},headers:{},path:{},query:{}},n=tI(e);let i;for(const[r,o]of A.entries())if(e[r]&&(i=e[r]),!!i)if("in"in i)if(i.key){const s=n.get(i.key),a=s.map||i.key;s.in&&(t[s.in][a]=o)}else t.body=o;else for(const[s,a]of Object.entries(o??{})){const l=n.get(s);if(l)if(l.in){const g=l.map||s;t[l.in][g]=a}else t[l.map]=a;else{const g=mk.find(([c])=>s.startsWith(c));if(g){const[c,Q]=g;t[Q][s.slice(c.length)]=a}else if("allowExtra"in i&&i.allowExtra){for(const[c,Q]of Object.entries(i.allowExtra))if(Q){t[c][s]=a;break}}}}return wk(t),t},Dk=eI(AI({baseUrl:"http://localhost:4096"}));class bA{client;constructor(e){this.client=e?.client??Dk}}class yk{defaultKey="default";instances=new Map;get(e){const t=this.instances.get(e??this.defaultKey);if(!t)throw new Error('No SDK client found. Create one with "new KiloClient()" to fix this error.');return t}set(e,t){this.instances.set(t??this.defaultKey,e)}}class kk extends bA{remove(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"}]}]);return(t?.client??this.client).delete({url:"/auth/{providerID}",...t,...n})}set(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{key:"auth",map:"body"}]}]);return(t?.client??this.client).put({url:"/auth/{providerID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}let bk=class extends bA{log(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"service"},{in:"body",key:"level"},{in:"body",key:"message"},{in:"body",key:"extra"}]}]);return(t?.client??this.client).post({url:"/log",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}agents(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/agent",...t,...n})}skills(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/skill",...t,...n})}};class vk extends bA{get(e){return(e?.client??this.client).get({url:"/global/config",...e})}update(e,t){const n=H([e],[{args:[{key:"config",map:"body"}]}]);return(t?.client??this.client).patch({url:"/global/config",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Mk extends bA{health(e){return(e?.client??this.client).get({url:"/global/health",...e})}event(e){return(e?.client??this.client).sse.get({url:"/global/event",...e})}dispose(e){return(e?.client??this.client).post({url:"/global/dispose",...e})}upgrade(e,t){const n=H([e],[{args:[{in:"body",key:"target"}]}]);return(t?.client??this.client).post({url:"/global/upgrade",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_config;get config(){return this._config??=new vk({client:this.client})}}let Nk=class extends bA{subscribe(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).sse.get({url:"/event",...t,...n})}};class Sk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"config",map:"body"}]}]);return(t?.client??this.client).patch({url:"/config",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}warnings(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/warnings",...t,...n})}providers(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/providers",...t,...n})}overlay(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"}]}]);return(t?.client??this.client).get({url:"/config/overlay",...t,...n})}overlayUpdate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"scope"},{in:"body",key:"set"},{in:"body",key:"unset"}]}]);return(t?.client??this.client).patch({url:"/config/overlay",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}sources(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/sources",...t,...n})}effective(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/effective",...t,...n})}rules(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"}]}]);return(t?.client??this.client).get({url:"/config/rules",...t,...n})}rulesUpdate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"scope"},{in:"body",key:"content"}]}]);return(t?.client??this.client).put({url:"/config/rules",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}modelState(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/model-state",...t,...n})}modelStateUpdate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"favorite"}]}]);return(t?.client??this.client).patch({url:"/config/model-state",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Lk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/console",...t,...n})}listOrgs(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/console/orgs",...t,...n})}switchOrg(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"accountID"},{in:"body",key:"orgID"}]}]);return(t?.client??this.client).post({url:"/experimental/console/switch",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class xk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"projectID"},{in:"query",key:"worktrees"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"cursor"},{in:"query",key:"search"},{in:"query",key:"limit"},{in:"query",key:"archived"}]}]);return(t?.client??this.client).get({url:"/experimental/session",...t,...n})}}class Fk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/resource",...t,...n})}}class Gk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/workspace/adapter",...t,...n})}}class _k extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/workspace",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"type"},{in:"body",key:"branch"},{in:"body",key:"extra"}]}]);return(t?.client??this.client).post({url:"/experimental/workspace",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}syncList(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/experimental/workspace/sync-list",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/workspace/status",...t,...n})}remove(e,t){const n=H([e],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/experimental/workspace/{id}",...t,...n})}warp(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"sessionID"},{in:"body",key:"copyChanges"}]}]);return(t?.client??this.client).post({url:"/experimental/workspace/warp",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_adapter;get adapter(){return this._adapter??=new Gk({client:this.client})}}class Rk extends bA{_console;get console(){return this._console??=new Lk({client:this.client})}_session;get session(){return this._session??=new xk({client:this.client})}_resource;get resource(){return this._resource??=new Fk({client:this.client})}_workspace;get workspace(){return this._workspace??=new _k({client:this.client})}}class Uk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"provider"},{in:"query",key:"model"}]}]);return(t?.client??this.client).get({url:"/experimental/tool",...t,...n})}ids(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/tool/ids",...t,...n})}}class Ok extends bA{remove(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeRemoveInput",map:"body"}]}]);return(t?.client??this.client).delete({url:"/experimental/worktree",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeCreateInput",map:"body"}]}]);return(t?.client??this.client).post({url:"/experimental/worktree",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}reset(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeResetInput",map:"body"}]}]);return(t?.client??this.client).post({url:"/experimental/worktree/reset",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}diff(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"base"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree/diff",...t,...n})}diffSummary(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"base"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree/diff/summary",...t,...n})}diffFile(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"base"},{in:"query",key:"file"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree/diff/file",...t,...n})}}class Kk extends bA{text(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"pattern"}]}]);return(t?.client??this.client).get({url:"/find",...t,...n})}files(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"query"},{in:"query",key:"dirs"},{in:"query",key:"type"},{in:"query",key:"limit"}]}]);return(t?.client??this.client).get({url:"/find/file",...t,...n})}symbols(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"query"}]}]);return(t?.client??this.client).get({url:"/find/symbol",...t,...n})}}let Tk=class extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"path"}]}]);return(t?.client??this.client).get({url:"/file",...t,...n})}read(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"path"}]}]);return(t?.client??this.client).get({url:"/file/content",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/file/status",...t,...n})}};class qk extends bA{dispose(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/instance/dispose",...t,...n})}}class Jk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/path",...t,...n})}}let Hk=class extends bA{raw(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/vcs/diff/raw",...t,...n})}};class Yk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/vcs",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/vcs/status",...t,...n})}diff(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"mode"}]}]);return(t?.client??this.client).get({url:"/vcs/diff",...t,...n})}apply(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"patch"}]}]);return(t?.client??this.client).post({url:"/vcs/apply",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_diff;get diff2(){return this._diff??=new Hk({client:this.client})}}class Pk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/command",...t,...n})}}class Vk extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/lsp",...t,...n})}}class jk extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/formatter",...t,...n})}}class zk extends bA{remove(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/mcp/{name}/auth",...t,...n})}start(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/auth",...t,...n})}callback(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"code"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/auth/callback",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}authenticate(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/auth/authenticate",...t,...n})}}class $k extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/mcp",...t,...n})}add(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"},{in:"body",key:"config"}]}]);return(t?.client??this.client).post({url:"/mcp",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}connect(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/connect",...t,...n})}disconnect(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/disconnect",...t,...n})}_auth;get auth(){return this._auth??=new zk({client:this.client})}}class Wk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/project",...t,...n})}current(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/project/current",...t,...n})}initGit(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/project/git/init",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"projectID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"},{in:"body",key:"icon"},{in:"body",key:"commands"}]}]);return(t?.client??this.client).patch({url:"/project/{projectID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Zk extends bA{shells(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty/shells",...t,...n})}list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"command"},{in:"body",key:"args"},{in:"body",key:"cwd"},{in:"body",key:"title"},{in:"body",key:"env"}]}]);return(t?.client??this.client).post({url:"/pty",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}remove(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/pty/{ptyID}",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty/{ptyID}",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"sessionID"},{in:"body",key:"size"}]}]);return(t?.client??this.client).put({url:"/pty/{ptyID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}connectToken(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/pty/{ptyID}/connect-token",...t,...n})}connect(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty/{ptyID}/connect",...t,...n})}}class Xk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/question",...t,...n})}reply(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"answers"}]}]);return(t?.client??this.client).post({url:"/question/{requestID}/reply",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}reject(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/question/{requestID}/reject",...t,...n})}}class A3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/permission",...t,...n})}reply(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"reply"},{in:"body",key:"message"}]}]);return(t?.client??this.client).post({url:"/permission/{requestID}/reply",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}saveAlwaysRules(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"approvedAlways"},{in:"body",key:"deniedAlways"}]}]);return(t?.client??this.client).post({url:"/permission/{requestID}/always-rules",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}allowEverything(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"enable"},{in:"body",key:"requestID"},{in:"body",key:"sessionID"}]}]);return(t?.client??this.client).post({url:"/permission/allow-everything",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}respond(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"permissionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"response"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/permissions/{permissionID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class e3 extends bA{authorize(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"method"},{in:"body",key:"inputs"}]}]);return(t?.client??this.client).post({url:"/provider/{providerID}/oauth/authorize",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}callback(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"method"},{in:"body",key:"code"}]}]);return(t?.client??this.client).post({url:"/provider/{providerID}/oauth/callback",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class t3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/provider",...t,...n})}auth(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/provider/auth",...t,...n})}_oauth;get oauth(){return this._oauth??=new e3({client:this.client})}}class n3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"},{in:"query",key:"path"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"limit"}]}]);return(t?.client??this.client).get({url:"/session",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"parentID"},{in:"body",key:"title"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"permission"},{in:"body",key:"platform"},{in:"body",key:"workspaceID"}]}]);return(t?.client??this.client).post({url:"/session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/status",...t,...n})}delete(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"permission"},{in:"body",key:"time"}]}]);return(t?.client??this.client).patch({url:"/session/{sessionID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}children(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/children",...t,...n})}todo(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/todo",...t,...n})}diff(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"messageID"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/diff",...t,...n})}messages(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"before"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/message",...t,...n})}prompt(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"format"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"snapshotInitialization"},{in:"body",key:"editorContext"},{in:"body",key:"parts"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/message",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}deleteMessage(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}",...t,...n})}message(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/message/{messageID}",...t,...n})}fork(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/fork",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}abort(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/abort",...t,...n})}init(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"modelID"},{in:"body",key:"providerID"},{in:"body",key:"messageID"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/init",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}unshare(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}/share",...t,...n})}share(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/share",...t,...n})}summarize(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"providerID"},{in:"body",key:"modelID"},{in:"body",key:"auto"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/summarize",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}promptAsync(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"format"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"snapshotInitialization"},{in:"body",key:"editorContext"},{in:"body",key:"parts"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/prompt_async",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}command(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"arguments"},{in:"body",key:"command"},{in:"body",key:"variant"},{in:"body",key:"snapshotInitialization"},{in:"body",key:"parts"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/command",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}shell(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"command"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/shell",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}revert(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"partID"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/revert",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}unrevert(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/unrevert",...t,...n})}viewed(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"focused"},{in:"body",key:"open"}]}]);return(t?.client??this.client).post({url:"/session/viewed",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class i3 extends bA{delete(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"part",map:"body"}]}]);return(t?.client??this.client).patch({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class r3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return(t?.client??this.client).post({url:"/sync/history",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class o3 extends bA{start(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/sync/start",...t,...n})}replay(e,t){const n=H([e],[{args:[{in:"query",key:"query_directory",map:"directory"},{in:"query",key:"workspace"},{in:"body",key:"body_directory",map:"directory"},{in:"body",key:"events"}]}]);return(t?.client??this.client).post({url:"/sync/replay",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}steal(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionID"}]}]);return(t?.client??this.client).post({url:"/sync/steal",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_history;get history(){return this._history??=new r3({client:this.client})}}class s3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"order"},{in:"query",key:"path"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"cursor"}]}]);return(t?.client??this.client).get({url:"/api/session",...t,...n})}prompt(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"prompt"},{in:"body",key:"delivery"}]}]);return(t?.client??this.client).post({url:"/api/session/{sessionID}/prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}compact(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/api/session/{sessionID}/compact",...t,...n})}wait(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/api/session/{sessionID}/wait",...t,...n})}context(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/api/session/{sessionID}/context",...t,...n})}messages(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"order"},{in:"query",key:"cursor"}]}]);return(t?.client??this.client).get({url:"/api/session/{sessionID}/message",...t,...n})}}class a3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"instance"}]}]);return(t?.client??this.client).get({url:"/api/model",...t,...n})}}class l3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"instance"}]}]);return(t?.client??this.client).get({url:"/api/provider",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{in:"query",key:"instance"}]}]);return(t?.client??this.client).get({url:"/api/provider/{providerID}",...t,...n})}}class g3 extends bA{_session;get session(){return this._session??=new s3({client:this.client})}_model;get model(){return this._model??=new a3({client:this.client})}_provider;get provider(){return this._provider??=new l3({client:this.client})}}class c3 extends bA{next(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/tui/control/next",...t,...n})}response(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return(t?.client??this.client).post({url:"/tui/control/response",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Q3 extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/tui/config",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"},{in:"body",key:"$schema"},{in:"body",key:"theme"},{in:"body",key:"keybinds"},{in:"body",key:"plugin"},{in:"body",key:"plugin_enabled"},{in:"body",key:"scroll_speed"},{in:"body",key:"scroll_acceleration"},{in:"body",key:"diff_style"},{in:"body",key:"mouse"},{in:"body",key:"attention"}]}]);return(t?.client??this.client).patch({url:"/tui/config",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class d3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/tui/keybinds",...t,...n})}}class B3 extends bA{appendPrompt(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"text"}]}]);return(t?.client??this.client).post({url:"/tui/append-prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}openHelp(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-help",...t,...n})}openSessions(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-sessions",...t,...n})}openThemes(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-themes",...t,...n})}openModels(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-models",...t,...n})}submitPrompt(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/submit-prompt",...t,...n})}clearPrompt(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/clear-prompt",...t,...n})}executeCommand(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"command"}]}]);return(t?.client??this.client).post({url:"/tui/execute-command",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}showToast(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"message"},{in:"body",key:"variant"},{in:"body",key:"duration"}]}]);return(t?.client??this.client).post({url:"/tui/show-toast",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}publish(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return(t?.client??this.client).post({url:"/tui/publish",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}selectSession(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionID"}]}]);return(t?.client??this.client).post({url:"/tui/select-session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_control;get control(){return this._control??=new c3({client:this.client})}_config;get config(){return this._config??=new Q3({client:this.client})}_keybind;get keybind(){return this._keybind??=new d3({client:this.client})}}class E3 extends bA{preview(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"scope"},{in:"body",key:"description"},{in:"body",key:"mode"},{in:"body",key:"model"},{in:"body",key:"color"},{in:"body",key:"steps"},{in:"body",key:"tools"},{in:"body",key:"permission"},{in:"body",key:"prompt"}]}]);return(t?.client??this.client).post({url:"/agent-builder/preview",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}save(e,t){const n=H([e],[{args:[{in:"path",key:"path_id",map:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"body_id",map:"id"},{in:"body",key:"scope"},{in:"body",key:"description"},{in:"body",key:"mode"},{in:"body",key:"model"},{in:"body",key:"color"},{in:"body",key:"steps"},{in:"body",key:"tools"},{in:"body",key:"permission"},{in:"body",key:"prompt"}]}]);return(t?.client??this.client).put({url:"/agent-builder/{id}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class C3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/background-process",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/background-process/{processID}",...t,...n})}logs(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/background-process/{processID}/logs",...t,...n})}stop(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/background-process/{processID}/stop",...t,...n})}restart(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/background-process/{processID}/restart",...t,...n})}stopSession(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/background-process/session/{sessionID}/stop",...t,...n})}}class u3 extends bA{generate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"path"},{in:"body",key:"selectedFiles"},{in:"body",key:"previousMessage"}]}]);return(t?.client??this.client).post({url:"/commit-message",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class I3 extends bA{enhance(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"text"}]}]);return(t?.client??this.client).post({url:"/enhance-prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class h3 extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/indexing/status",...t,...n})}warnings(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/indexing/warnings",...t,...n})}models(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/indexing/models",...t,...n})}}class f3 extends bA{transcriptions(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"model"},{in:"body",key:"input_audio"},{in:"body",key:"language"},{in:"body",key:"prompt"},{in:"body",key:"temperature"}]}]);return(t?.client??this.client).post({url:"/kilo/audio/transcriptions",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class p3 extends bA{set(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"organizationId"}]}]);return(t?.client??this.client).post({url:"/kilo/organization",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class m3 extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/claw/status",...t,...n})}chatCredentials(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/claw/chat-credentials",...t,...n})}}class w3 extends bA{get(e,t){const n=H([e],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/cloud/session/{id}",...t,...n})}import(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionId"}]}]);return(t?.client??this.client).post({url:"/kilo/cloud/session/import",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class D3 extends bA{_session;get session(){return this._session??=new w3({client:this.client})}}class y3 extends bA{profile(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/profile",...t,...n})}modes(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/modes",...t,...n})}fim(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"prefix"},{in:"body",key:"suffix"},{in:"body",key:"provider"},{in:"body",key:"model"},{in:"body",key:"maxTokens"},{in:"body",key:"temperature"}]}]);return(t?.client??this.client).sse.post({url:"/kilo/fim",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}edit(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"provider"},{in:"body",key:"model"},{in:"body",key:"maxTokens"},{in:"body",key:"currentFilePath"},{in:"body",key:"currentFileContent"},{in:"body",key:"cursorLine"},{in:"body",key:"cursorCharacter"},{in:"body",key:"editableRegionStartLine"},{in:"body",key:"editableRegionEndLine"},{in:"body",key:"recentlyViewedSnippets"},{in:"body",key:"editDiffHistory"}]}]);return(t?.client??this.client).post({url:"/kilo/edit",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}notifications(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/notifications",...t,...n})}cloudSessions(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"cursor"},{in:"query",key:"limit"},{in:"query",key:"gitUrl"}]}]);return(t?.client??this.client).get({url:"/kilo/cloud-sessions",...t,...n})}_audio;get audio(){return this._audio??=new f3({client:this.client})}_organization;get organization(){return this._organization??=new p3({client:this.client})}_claw;get claw(){return this._claw??=new m3({client:this.client})}_cloud;get cloud(){return this._cloud??=new D3({client:this.client})}}class k3 extends bA{snapshot(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/kilocode/heap/snapshot",...t,...n})}}class b3 extends bA{project(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"worktree"},{in:"body",key:"vcs"},{in:"body",key:"name"},{in:"body",key:"iconUrl"},{in:"body",key:"iconColor"},{in:"body",key:"timeCreated"},{in:"body",key:"timeUpdated"},{in:"body",key:"timeInitialized"},{in:"body",key:"sandboxes"},{in:"body",key:"commands"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/project",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}session(e,t){const n=H([e],[{args:[{in:"query",key:"query_directory",map:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"projectID"},{in:"body",key:"force"},{in:"body",key:"workspaceID"},{in:"body",key:"parentID"},{in:"body",key:"slug"},{in:"body",key:"body_directory",map:"directory"},{in:"body",key:"title"},{in:"body",key:"version"},{in:"body",key:"shareURL"},{in:"body",key:"summary"},{in:"body",key:"revert"},{in:"body",key:"permission"},{in:"body",key:"timeCreated"},{in:"body",key:"timeUpdated"},{in:"body",key:"timeCompacting"},{in:"body",key:"timeArchived"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}message(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"sessionID"},{in:"body",key:"timeCreated"},{in:"body",key:"data"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/message",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}part(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"messageID"},{in:"body",key:"sessionID"},{in:"body",key:"timeCreated"},{in:"body",key:"data"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/part",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class v3 extends bA{removeSkill(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"location"}]}]);return(t?.client??this.client).post({url:"/kilocode/skill/remove",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}removeAgent(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"}]}]);return(t?.client??this.client).post({url:"/kilocode/agent/remove",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_heap;get heap(){return this._heap??=new k3({client:this.client})}_sessionImport;get sessionImport(){return this._sessionImport??=new b3({client:this.client})}}class M3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/network",...t,...n})}reply(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/network/{requestID}/reply",...t,...n})}reject(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/network/{requestID}/reject",...t,...n})}}class N3 extends bA{enable(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/remote/enable",...t,...n})}disable(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/remote/disable",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/remote/status",...t,...n})}}class S3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/suggestion",...t,...n})}accept(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"index"}]}]);return(t?.client??this.client).post({url:"/suggestion/{requestID}/accept",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}dismiss(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/suggestion/{requestID}/dismiss",...t,...n})}}class L3 extends bA{capture(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"event"},{in:"body",key:"properties"}]}]);return(t?.client??this.client).post({url:"/telemetry/capture",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}setEnabled(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"enabled"}]}]);return(t?.client??this.client).post({url:"/telemetry/setEnabled",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class N0 extends bA{static __registry=new yk;constructor(e){super(e),N0.__registry.set(this,e?.key)}_auth;get auth(){return this._auth??=new kk({client:this.client})}_app;get app(){return this._app??=new bk({client:this.client})}_global;get global(){return this._global??=new Mk({client:this.client})}_event;get event(){return this._event??=new Nk({client:this.client})}_config;get config(){return this._config??=new Sk({client:this.client})}_experimental;get experimental(){return this._experimental??=new Rk({client:this.client})}_tool;get tool(){return this._tool??=new Uk({client:this.client})}_worktree;get worktree(){return this._worktree??=new Ok({client:this.client})}_find;get find(){return this._find??=new Kk({client:this.client})}_file;get file(){return this._file??=new Tk({client:this.client})}_instance;get instance(){return this._instance??=new qk({client:this.client})}_path;get path(){return this._path??=new Jk({client:this.client})}_vcs;get vcs(){return this._vcs??=new Yk({client:this.client})}_command;get command(){return this._command??=new Pk({client:this.client})}_lsp;get lsp(){return this._lsp??=new Vk({client:this.client})}_formatter;get formatter(){return this._formatter??=new jk({client:this.client})}_mcp;get mcp(){return this._mcp??=new $k({client:this.client})}_project;get project(){return this._project??=new Wk({client:this.client})}_pty;get pty(){return this._pty??=new Zk({client:this.client})}_question;get question(){return this._question??=new Xk({client:this.client})}_permission;get permission(){return this._permission??=new A3({client:this.client})}_provider;get provider(){return this._provider??=new t3({client:this.client})}_session;get session(){return this._session??=new n3({client:this.client})}_part;get part(){return this._part??=new i3({client:this.client})}_sync;get sync(){return this._sync??=new o3({client:this.client})}_v2;get v2(){return this._v2??=new g3({client:this.client})}_tui;get tui(){return this._tui??=new B3({client:this.client})}_agentBuilder;get agentBuilder(){return this._agentBuilder??=new E3({client:this.client})}_backgroundProcess;get backgroundProcess(){return this._backgroundProcess??=new C3({client:this.client})}_commitMessage;get commitMessage(){return this._commitMessage??=new u3({client:this.client})}_enhancePrompt;get enhancePrompt(){return this._enhancePrompt??=new I3({client:this.client})}_indexing;get indexing(){return this._indexing??=new h3({client:this.client})}_kilo;get kilo(){return this._kilo??=new y3({client:this.client})}_kilocode;get kilocode(){return this._kilocode??=new v3({client:this.client})}_network;get network(){return this._network??=new M3({client:this.client})}_remote;get remote(){return this._remote??=new N3({client:this.client})}_suggestion;get suggestion(){return this._suggestion??=new S3({client:this.client})}_telemetry;get telemetry(){return this._telemetry??=new L3({client:this.client})}}function x3(A,e,t,n){if(!n?.throwOnError||A instanceof Error)return A;if(typeof A=="object"&&A!==null&&Object.keys(A).length>0){const r=A,o=typeof r.data?.message=="string"&&r.data.message||typeof r.message=="string"&&r.message||typeof r.name=="string"&&r.name||_d(t,e);return new Error(o,{cause:{body:A,status:e?.status}})}if(typeof A=="string"&&A.length>0)return new Error(A,{cause:{body:A,status:e?.status}});const i=e?"(empty response body)":"network error (no response)";return new Error(`kilo server ${_d(t,e)}: ${i}`,{cause:{body:A,status:e?.status}})}function _d(A,e){const t=A?.method??"?",n=A?.url??"?",i=e?.status,r=e?.statusText;return`${t} ${n}${i?" → "+i:""}${r?" "+r:""}`}function F3(A,e,t){if(A)return e&&(A===e||t&&A===t(e))?e:A}function G3(A,e){if(A.method!=="GET"&&A.method!=="HEAD")return A;const t=new URL(A.url);let n=!1;for(const[r,o]of[["x-kilo-directory","directory"],["x-kilo-workspace","workspace"]]){const s=F3(A.headers.get(r),o==="directory"?e.directory:e.workspace,o==="directory"?encodeURIComponent:void 0);s&&(t.searchParams.has(o)||t.searchParams.set(o,s),n=!0)}if(!n)return A;const i=new Request(t,A);return i.headers.delete("x-kilo-directory"),i.headers.delete("x-kilo-workspace"),i}function _3(A){A?.fetch||(A={...A,fetch:n=>fetch(n,{duplex:"half",timeout:!1})}),A?.directory&&(A.headers={...A.headers,"x-kilo-directory":encodeURIComponent(A.directory)}),A?.experimental_workspaceID&&(A.headers={...A.headers,"x-kilo-workspace":A.experimental_workspaceID}),A.duplex="half";const e=eI(A);return e.interceptors.request.use(t=>G3(t,{directory:A?.directory,workspace:A?.experimental_workspaceID})),e.interceptors.response.use(t=>{if(t.headers.get("content-type")==="text/html")throw new Error("Request is not supported by this version of OpenCode Server (Server responded with text/html)");return t}),e.interceptors.error.use(x3),new N0({client:e})}const R3=Array.from({length:20},(A,e)=>4097+e),U3=1440*60*1e3,S0="kilo.config.server",hr={},L0=window.fetch.bind(window);function O3(A){const e=new TextEncoder().encode(A);return btoa(String.fromCharCode(...e))}function Rd(A){return A?decodeURIComponent(A):""}function Va(A){const e=new URL(A),t=Rd(e.username)||"kilo",n=Rd(e.password)||"kilo";return e.username="",e.password="",e.search="",e.hash="",{url:e.toString().replace(/\/$/,""),token:O3(`${t}:${n}`)}}function ge(A){const e=Va(A.url);return _3({baseUrl:e.url,directory:x0(A.dir),headers:{Authorization:`Basic ${e.token}`},fetch:L0})}function x0(A){const e=A.trim();if(e)return e}function ea(A){return A instanceof Error?A.message:typeof A=="string"?A:A==null?"Unknown error":JSON.stringify(A)}function zA(A,e){if(e.error)throw new Error(`${A}: ${ea(e.error)}`);if(e.data===void 0)throw new Error(`${A}: empty response`);return e.data}async function K3(A){const t=(await ja(A)).find(n=>n.id===A.project);if(!t)throw new Error(`Project not found: ${A.project}`);return t}async function lt(A,e){return await e.then(t=>{if(t.error){console.warn(`${A}: ${ea(t.error)}`);return}return t.data}).catch(t=>{console.warn(`${A}: ${ea(t)}`)})}function T3(A){if(typeof A!="string")return;const e=A.indexOf("/");if(!(e<=0||e>=A.length-1))return{provider:A.slice(0,e),model:A.slice(e+1)}}function q3(A){return A.split("_").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function J3(A){return{keybinds:Object.entries(A.keybinds??{}).map(([e,t])=>({id:e,label:q3(e),group:"Configured",default:t??"none",description:"Configured TUI keybind"}))}}function ta(A){return A.replace(/\\/g,"/").replace(/\/+$/,"")||"/"}function H3(A,e){const t=ta(A),n=ta(e);return n===t?!0:n.startsWith(`${t}/`)}function nI(A){return A.id!=="global"?!0:ta(A.worktree)!=="/"}function Y3(A,e){return[A.worktree,...A.sandboxes].reduce((t,n)=>H3(n,e)?Math.max(t,ta(n).length):t,-1)}function P3(A,e){const t=A.find(n=>n.id===e.projectID);return t||A.reduce((n,i)=>{const r=Y3(i,e.directory);return r<=n.score?n:{item:i,score:r}},{score:-1}).item}async function iI(A){const e=new AbortController,t=window.setTimeout(()=>e.abort(),400),n=Va(A);return await L0(`${n.url}/global/health`,{headers:{Authorization:`Basic ${n.token}`},signal:e.signal}).then(i=>i.ok?A:void 0).catch(()=>{}).finally(()=>window.clearTimeout(t))}function V3(A){return Array.isArray(A)?A.filter(e=>{if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.worktree=="string"&&typeof t.time?.updated=="number"}):[]}function j3(A){return A.reduce((e,t)=>Math.max(e,t.time.updated),0)}async function z3(A){if(!await iI(A))return;const t=new AbortController,n=window.setTimeout(()=>t.abort(),400),i=Va(A);return await L0(`${i.url}/project`,{headers:{Authorization:`Basic ${i.token}`},signal:t.signal}).then(async r=>{if(!r.ok)return{url:A,count:0,time:0};const o=V3(await r.json()).filter(nI);return{url:A,count:o.length,time:j3(o)}}).catch(()=>({url:A,count:0,time:0})).finally(()=>window.clearTimeout(n))}function Ud(A){return Number(new URL(A).port)||0}function Od(A){return new URL(A).hostname==="127.0.0.1"?1:0}function It(){return window.localStorage.getItem(S0)??""}function f1(A){window.localStorage.setItem(S0,A)}function Ar(){window.localStorage.removeItem(S0)}async function $3(A){return await iI(A)!==void 0}async function W3(){const A=R3.flatMap(t=>[`http://127.0.0.1:${t}`,`http://localhost:${t}`]);return(await Promise.all(A.map(z3))).filter(t=>t!==void 0).toSorted((t,n)=>n.count-t.count||n.time-t.time||Ud(n.url)-Ud(t.url)||Od(n.url)-Od(t.url))[0]?.url}async function er(){if(hr.run)return await hr.run;const A=W3().finally(()=>{hr.run===A&&(hr.run=void 0)});return hr.run=A,await A}async function vo(){const A=await er();if(A)return A;const e=It();if(e){if(await $3(e))return e;Ar()}}async function Z3(A){const e=ge(A),[t,n,i,r,o,s,a,l,g,c,Q,d]=await Promise.all([e.global.health(),e.config.overlay({scope:A.scope}),e.config.modelState(),e.provider.list(),e.provider.auth(),e.tui.config.get(),lt("TUI keybinds",e.tui.keybind.list()),e.tool.ids(),e.mcp.status(),e.lsp.status(),e.formatter.status(),e.app.agents()]),B=zA("Config overlay",n),C=T3(B.effective.model),f=C?await lt("Tool metadata",e.tool.list(C)):void 0,u=zA("TUI config",s);return{health:zA("Health",t),effective:B.effective,overlay:B,sources:{sources:B.sources},modelState:zA("Model state",i),providers:zA("Providers",r),authMethods:zA("Provider auth methods",o),tui:u,keybinds:a??J3(u),tools:zA("Tools",l),toolDetails:f??[],mcp:zA("MCP status",g),lsp:zA("LSP status",c),formatter:zA("Formatter status",Q),agents:zA("Agents",d)}}async function X3(A){return zA("Kilo embedding models",await ge(A).indexing.models())}async function rI(A){const e=ge(A),t=x0(A.dir),n=await e.project.list(t?{directory:t}:void 0);return zA("Projects",n)}async function ja(A){return(await rI(A)).filter(nI)}async function Ab(A){const e=ge(A),[t,n]=await Promise.all([ja(A),e.experimental.session.list({archived:!1,start:Date.now()-U3,limit:500})]),i=zA("Recent sessions",n),r=new Map;for(const o of i){const s=P3(t,o);s&&r.set(s.id,(r.get(s.id)??0)+1)}return t.map(o=>({...o,sessions:r.get(o.id)??0})).filter(o=>o.sessions>0)}async function eb(A){const e=await K3(A),t={url:A.url,dir:e.worktree},n=ge(t),[i,r,o]=await Promise.all([n.config.overlay({scope:"global"}),n.vcs.get({directory:t.dir}),n.worktree.list({directory:t.dir})]),s=zA("Worktrees",o),a=await Promise.all([t.dir,...s].map(l=>rb({url:A.url},l)));return{project:e,config:zA("Config",i).effective,vcs:zA("VCS",r),worktrees:s,terminals:a.flat()}}async function tb(A,e){const t=ge(A),n=e?.trim(),i=await t.worktree.create({directory:A.dir,...n?{worktreeCreateInput:{name:n}}:{}});return zA("Create worktree",i)}async function nb(A,e){const n=await ge(A).worktree.remove({directory:A.dir,worktreeRemoveInput:{directory:e}});return zA("Remove worktree",n)}async function ib(A,e){const n=await ge(A).worktree.reset({directory:A.dir,worktreeResetInput:{directory:e}});return zA("Reset worktree",n)}async function rb(A,e){const t=ge({url:A.url,dir:e}),[n,i,r,o]=await Promise.all([t.pty.list({directory:e}),lt("Session status",t.session.status({directory:e})),lt("Pending permissions",t.permission.list({directory:e})),lt("Pending questions",t.question.list({directory:e}))]),s=zA("Terminals",n),a=i??{},l=Kd(r??[]),g=Kd(o??[]),c=new Map;return await Promise.all(s.map(async Q=>{if(!Q.sessionID||c.has(Q.sessionID))return;const d=await lt("Session",t.session.get({directory:e,sessionID:Q.sessionID}));d&&c.set(Q.sessionID,d)})),s.map(Q=>{const d=Q.sessionID?c.get(Q.sessionID):void 0;return{...Q,directory:e,session:d,sessionStatus:Q.sessionID?a[Q.sessionID]:void 0,attention:Q.sessionID?ab(Q.sessionID,l,g):void 0}})}function oI(A){return new Set(A.flatMap(e=>e.sessionID?[e.sessionID]:[]))}function Kd(A){return new Set(A.map(e=>e.sessionID))}function Td(A,e){return A.some(t=>e.has(t.sessionID))}async function ob(A,e){const t=ge({url:A.url,dir:e}),[n,i,r,o]=await Promise.all([lt("Session status",t.session.status({directory:e})),lt("Terminals",t.pty.list({directory:e})),lt("Pending permissions",t.permission.list({directory:e})),lt("Pending questions",t.question.list({directory:e}))]),s=oI(i??[]),a=Object.entries(n??{}).some(([g,c])=>s.has(g)&&c.type!=="idle"),l=Td(r??[],s)||Td(o??[],s);return{busy:a,attention:l}}async function sb(A,e){const t=ge({url:A.url,dir:e}),n=await lt("Terminals",t.pty.list({directory:e}));return oI(n??[])}function ab(A,e,t){if(e.has(A))return"permission";if(t.has(A))return"question"}async function lb(A,e){const n=await ge({url:A.url,dir:e}).worktree.diffSummary({directory:e});return zA("Worktree diff",n)}async function gb(A,e,t){const i=await ge({url:A.url,dir:e}).worktree.diffFile({directory:e,file:t});return zA("Worktree diff file",i)}async function cb(A,e,t="Kilo session"){const i=await ge({url:A.url,dir:e}).pty.create({directory:e,command:"kilo",cwd:e,title:t});return zA("Create terminal",i)}async function Qb(A,e){const n=await ge({url:A.url,dir:A.dir}).pty.remove({directory:A.dir,ptyID:e});return zA("Remove terminal",n)}async function db(A,e,t){const i=await ge(A).session.viewed({directory:A.dir,focused:e,open:t});return zA("Viewed sessions",i)}function sI(A,e){const t=ge(A),n=new AbortController;return(async()=>{const i=await t.global.event({signal:n.signal,sseMaxRetryAttempts:0});for await(const r of i.stream){if(n.signal.aborted)return;e(r)}})().catch(i=>{n.signal.aborted||console.warn(`Project events: ${ea(i)}`)}),()=>n.abort()}async function Bb(A,e,t,n){const r=await ge({url:A.url,dir:A.dir}).pty.update({directory:A.dir,ptyID:e,size:{cols:t,rows:n}});return zA("Resize terminal",r)}function Eb(A,e,t=0){const n=Va(A.url),i=new URL(`/pty/${encodeURIComponent(e)}/connect`,n.url);return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.searchParams.set("directory",A.dir),i.searchParams.set("cursor",String(t)),i.searchParams.set("auth_token",n.token),i.toString()}async function io(A,e,t){const n=ge(A),i=Object.keys(e).length?e:void 0,r=await n.config.overlayUpdate({directory:x0(A.dir),scope:A.scope,set:i,unset:t});return zA("Update config",r)}async function Cb(A,e){return io(A,e)}async function ub(A,e){return io(A,{},e)}async function Ib(A,e){const n=await ge(A).config.modelStateUpdate({favorite:e});return zA("Update model state",n)}async function hb(A,e,t,n){const i=ge(A),r=n?{type:"api",key:t,metadata:n}:{type:"api",key:t},o=await i.auth.set({providerID:e,auth:r});zA("Connect provider",o),await i.global.dispose()}async function fb(A,e,t,n){const r=await ge(A).provider.oauth.authorize({providerID:e,method:t,inputs:n});return zA("Authorize provider",r)}async function pb(A,e,t,n){const i=ge(A),r=await i.provider.oauth.callback({providerID:e,method:t,code:n});zA("Complete provider authorization",r),await i.global.dispose()}async function mb(A,e){const n=await ge(A).mcp.connect({name:e});return zA("Connect MCP server",n)}async function wb(A,e){const n=await ge(A).mcp.disconnect({name:e});return zA("Disconnect MCP server",n)}async function Db(A,e){const n=await ge(A).mcp.auth.authenticate({name:e});return zA("Authenticate MCP server",n)}async function yb(A,e){const n=await ge(A).tui.config.update({scope:A.scope,...e});return zA("Update TUI config",n)}async function kb(A,e){const n=await ge(A).agentBuilder.preview(e);return zA("Preview agent",n)}async function bb(A,e){const n=await ge(A).agentBuilder.save({path_id:e.id,scope:e.scope,description:e.description,mode:e.mode,model:e.model,color:e.color,steps:e.steps,tools:e.tools,permission:e.permission,prompt:e.prompt});return zA("Save agent",n)}function vb(A){return!A||A==="normal"?"default":A==="small"?"sm":A==="large"?"lg":A}function Mb(A){return!A||A==="default"?"primary":A}function IA(A){const[e,t]=uA(A,["variant","size","icon","class","classList","children"]);return E(bo,lA(t,{"data-component":"button",get"data-size"(){return vb(e.size)},get"data-variant"(){return Mb(e.variant)},get"data-icon"(){return e.icon?"inline-start":void 0},get classList(){return{...e.classList,[e.class??""]:!!e.class}},get children(){return[E(Y,{get when(){return e.icon},children:n=>E(Vt,{get name(){return n()},size:"small"})}),MA(()=>e.children)]}}))}function Nb(A,e){const t=Object.fromEntries(Object.entries(e).filter(n=>n[1]!==void 0));if(typeof A=="string"){const n=Object.entries(t).map(i=>`${i[0]}:${i[1]}`).join(";");return n?`${A};${n}`:A}return{...A??{},...t}}var Sb=b("<div>");function ue(A){const[e,t]=uA(A,["variant","size","padding","style","class","classList","children"]),n=()=>typeof e.padding=="number"?`${e.padding}px`:e.padding;return(()=>{var i=Sb();return p1(i,lA(t,{"data-component":"card",get"data-variant"(){return e.variant??"normal"},get"data-size"(){return e.size??"default"},get style(){return Nb(e.style,{"--kw-card-padding":n()})},get classList(){return{...e.classList,[e.class??""]:!!e.class}}}),!1,!0),p(i,()=>e.children),i})()}var Lb=b("<span>");function aI(A){const[e,t]=uA(A,["size","tone","class","classList","children"]);return(()=>{var n=Lb();return p1(n,lA(t,{"data-component":"tag",get"data-size"(){return e.size??"normal"},get"data-tone"(){return e.tone??"neutral"},get classList(){return{...e.classList,[e.class??""]:!!e.class}}}),!1,!0),p(n,()=>e.children),n})()}var xb=b("<span data-slot=status-dot aria-hidden=true>"),Fb=b("<p>"),Gb=b("<section data-component=section-title><div><h2>"),_b=b("<div data-component=banner role=alert><div><span>"),Rb=b("<strong>"),Ub=b("<span data-slot=config-row-accent>"),Ob=b("<div data-slot=config-row-body><div data-slot=config-row-title>"),Kb=b("<div data-slot=config-row-trailing>"),Tb=b("<div data-slot=config-row-leading>"),qb=b("<div data-slot=config-row-subtitle>"),Jb=b("<div data-slot=config-row-actions>"),Hb=b("<a data-component=config-row>"),Yb=b("<button type=button data-component=config-row>"),Pb=b("<div data-component=config-row>");function Ae(A){return E(aI,lA(A,{"data-slot":"config-tag"}))}function Se(A){return E(Ae,lA(A,{tone:"neutral"}))}function lI(A){return A.source==="project"||A.source==="local override"?"project":A.source==="global"||A.source==="inherited"?"global":A.overridden?"project":A.inherited?"global":"default"}function gI(A){return(()=>{var e=xb();return V(()=>W(e,"data-tone",A.tone)),e})()}function ro(A){const e=()=>["connected","healthy","running"].includes(A.status)?{tone:"success",label:A.status==="healthy"?"Healthy":A.status==="running"?"Running":"Connected"}:["failed","error","unhealthy"].includes(A.status)?{tone:"critical",label:A.status==="unhealthy"?"Unhealthy":A.status==="failed"?"Failed":"Error"}:A.status==="stopped"?{tone:"neutral",label:"Stopped"}:{tone:"neutral",label:A.status||"Unknown"};return E(Ae,{get tone(){return e().tone},class:"kw-status-tag",get children(){return[E(gI,{get tone(){return MA(()=>e().tone==="critical")()?"critical":e().tone==="success"?"success":"neutral"}}),MA(()=>e().label)]}})}function cI(A){const e=()=>lI(A),t=()=>e().toUpperCase();return E(Ae,{class:"mono",get tone(){return e()==="project"?"info":"neutral"},get children(){return t()}})}function Bt(A){return(()=>{var e=Gb(),t=e.firstChild,n=t.firstChild;return p(n,()=>A.children),p(t,()=>A.trailing,null),p(e,E(Y,{get when(){return A.description},children:i=>(()=>{var r=Fb();return p(r,i),r})()}),null),e})()}function Vb(A){const e=()=>A.tone==="critical"||A.tone==="warning"?"warning":A.tone==="success"?"circle-check":"help";return(()=>{var t=_b(),n=t.firstChild,i=n.firstChild;return p(t,E(Vt,{get name(){return e()},size:"small"}),n),p(n,E(Y,{get when(){return A.title},children:r=>(()=>{var o=Rb();return p(o,r),o})()}),i),p(i,()=>A.children),p(t,()=>A.action,null),V(()=>W(t,"data-tone",A.tone??"info")),t})()}function S1(A){const e=()=>lI({source:A.source})==="project"||A.highlightOverride,t=()=>[E(Y,{get when(){return e()},get children(){return Ub()}}),E(Y,{get when(){return A.leading},children:n=>(()=>{var i=Tb();return p(i,n),i})()}),(()=>{var n=Ob(),i=n.firstChild;return p(i,()=>A.title),p(n,E(Y,{get when(){return A.subtitle},children:r=>(()=>{var o=qb();return p(o,r),o})()}),null),n})(),(()=>{var n=Kb();return p(n,E(Y,{get when(){return A.source!==void 0},get children(){return E(cI,{get source(){return A.source}})}}),null),p(n,()=>A.status,null),p(n,E(Y,{get when(){return A.actions},children:i=>(()=>{var r=Jb();return p(r,i),r})()}),null),n})()];return A.href?(()=>{var n=Hb();return p(n,t),V(i=>{var r=e()||void 0,o=A.href;return r!==i.e&&W(n,"data-override",i.e=r),o!==i.t&&W(n,"href",i.t=o),i},{e:void 0,t:void 0}),n})():A.onClick?(()=>{var n=Yb();return RA(n,"click",A.onClick,!0),p(n,t),V(()=>W(n,"data-override",e()||void 0)),n})():(()=>{var n=Pb();return p(n,t),V(()=>W(n,"data-override",e()||void 0)),n})()}pe(["click"]);var jb=b("<details><summary></summary><div class=models-select-menu role=listbox>"),zb=b("<button class=models-select-option type=button role=option>");function gt(A){const e=()=>A.options.find(i=>i.value===A.value)?.label??A.value;function t(i,r){A.disabled||i.disabled||(A.onSelect(i.value),r.currentTarget.closest("details")?.removeAttribute("open"))}function n(i){if(A.disabled){i.currentTarget.removeAttribute("open");return}i.currentTarget.open&&i.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(r=>{r!==i.currentTarget&&r.removeAttribute("open")})}return(()=>{var i=jb(),r=i.firstChild,o=r.nextSibling;return i.addEventListener("toggle",n),p(r,e),p(o,E(kA,{get each(){return A.options},children:s=>(()=>{var a=zb();return a.$$click=l=>t(s,l),p(a,()=>s.label),V(l=>{var g=s.value===A.value,c=!!s.disabled,Q=s.value===A.value,d=A.disabled||s.disabled;return g!==l.e&&a.classList.toggle("selected",l.e=g),c!==l.t&&a.classList.toggle("disabled",l.t=c),Q!==l.a&&W(a,"aria-selected",l.a=Q),d!==l.o&&(a.disabled=l.o=d),l},{e:void 0,t:void 0,a:void 0,o:void 0}),a})()})),V(s=>{var a=`models-select ${A.class??""}`,l=!!A.disabled,g=!!A.invalid,c=A.label,Q=A.disabled,d=A.label;return a!==s.e&&Ri(i,s.e=a),l!==s.t&&i.classList.toggle("disabled",s.t=l),g!==s.a&&i.classList.toggle("invalid",s.a=g),c!==s.o&&W(r,"aria-label",s.o=c),Q!==s.i&&W(r,"aria-disabled",s.i=Q),d!==s.n&&W(o,"aria-label",s.n=d),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),i})()}pe(["click"]);var $b=b("<label data-component=search-field><span data-slot=search-label></span><input>");function W1(A){const[e,t]=uA(A,["label","value","variant","hideLabel","inputClass","class","classList","onValue"]);return(()=>{var n=$b(),i=n.firstChild,r=i.nextSibling;return p(i,()=>e.label),p1(r,lA(t,{get class(){return e.inputClass},type:"search",get value(){return e.value},get"aria-label"(){return MA(()=>e.hideLabel===!1)()?void 0:e.label},onInput:o=>e.onValue(o.currentTarget.value)}),!1,!1),V(o=>{var s=e.variant??"list",a=e.hideLabel===!1?"visible":"hidden",l={...e.classList,[e.class??""]:!!e.class};return s!==o.e&&W(n,"data-variant",o.e=s),a!==o.t&&W(n,"data-label",o.t=a),o.a=Cn(n,l,o.a),o},{e:void 0,t:void 0,a:void 0}),n})()}const QI=De();function $e(){const A=fe(QI);if(!A)throw new Error("useConfig must be used within ConfigLayout");return A}function F0(){return"/console/".replace(/\/$/,"")}function Mo(A,e=F0()){return!e||e==="/"?A:A===e?"/":A.startsWith(`${e}/`)?A.slice(e.length):A}function dI(A,e=F0()){const t=Mo(A,e),n=t.indexOf("/settings");return n>0?`${t.slice(0,n)}/settings`:t.startsWith("/config")?"/config":"/settings"}function Wb(A,e=F0()){const t=Mo(A,e);return t==="/profile"?"/profile":t.startsWith("/settings")||t.startsWith("/config")?"/settings":t.startsWith("/projects/")?"/project":"/projects"}const Zb={apply_patch:"Apply Patch",bash:"Bash",edit:"Edit File",glob:"Find Files",grep:"Search Content",lsp:"Language Server",question:"Ask User",read:"Read File",recall:"Local Recall",skill:"Load Skill",task:"Subagent Task",todowrite:"Todo List",webfetch:"Fetch URL",websearch:"Web Search",write:"Write File"},Xb={apply_patch:["Apply structured patches to add, update, move, or delete files.","Keeps edits explicit and easy to review."],bash:["Run shell commands in the current workspace.","Supports timeouts, working directories, and command descriptions."],edit:["Replace exact text inside an existing file.","Can update one match or all matches when needed."],glob:["Find files by path patterns.","Useful for locating files before reading or editing them."],grep:["Search file contents with regular expressions.","Can limit results to a file pattern such as TypeScript or CSS files."],lsp:["Use language-server features for code navigation.","Supports operations such as definitions, references, and diagnostics."],question:["Ask the user for a decision during execution.","Supports single-choice and multi-choice prompts."],read:["Read files, directories, images, and PDFs from the workspace.","Supports line offsets and limits for large files."],recall:["Search and read previous project conversations.","Useful for recovering prior decisions or implementation context."],skill:["Load task-specific instructions and workflows.","Applies specialized repo guidance when a matching skill exists."],task:["Delegate focused exploration or implementation work to a subagent.","Useful for parallel codebase research and complex subtasks."],todowrite:["Track multi-step implementation work.","Shows progress with pending, in-progress, and completed states."],webfetch:["Fetch and convert web pages for analysis.","Supports markdown, text, and HTML output formats."],websearch:["Search the web for external information.","Supports fast, automatic, and deep search modes."],write:["Create or overwrite files with complete contents.","Best for new files or full-file replacements."]},A8=new Set(["api","html","id","json","lsp","mcp","pdf","url"]);function HA(A){return A.trim()}function Tn(A){return A==null||A===""?"Not set":typeof A=="string"?A:typeof A=="number"||typeof A=="boolean"?String(A):JSON.stringify(A)??"Unserializable value"}function BI(A){return[...A].sort((e,t)=>e.localeCompare(t))}function Qc(A){return A.split(/\s+/).map(e=>e.trim()).filter(Boolean)}function F1(A){return A.trim().split(/[\s._/-]+/).filter(Boolean).map(e=>/^[A-Z0-9]+$/.test(e)&&e.length<=4?e:`${e[0]?.toUpperCase()??""}${e.slice(1).toLowerCase()}`).join(" ")}function e8(A){const e=A.toLowerCase();return A8.has(e)?e.toUpperCase():A.charAt(0).toUpperCase()+A.slice(1)}function qd(A){return A.length<=180?A:`${A.slice(0,177)}...`}function t8(A){const e=A.replace(/```[\s\S]*?```/g," ").replace(/[*`#>_-]+/g," ").replace(/\s+/g," ").trim(),t=e.split(/(?:\.|\?|!)\s+/).map(n=>n.trim()).filter(Boolean).slice(0,2);return t.length?t.map(qd):e?[qd(e)]:[]}function bt(A){const e=Zb[A];if(e)return e;const t=A.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._:/-]+/g," ").replace(/\s+/g," ").trim();return t?t.split(" ").map(e8).join(" "):A}function G0(A){const e=Xb[A.id];if(e)return e;const t=A.detail?.description.trim();return t?t8(t):["No capability description is available for this tool."]}function Ki(A){return A.split(",").map(e=>e.trim()).filter(Boolean)}function Jd(A){return!A||typeof A!="object"||Array.isArray(A)?0:Object.keys(A).length}function Q1(A){return A instanceof Error?A.message:typeof A=="string"?A:Tn(A)}function n8(A){return A==="subagent"?"subagent":A==="all"?"all":"primary"}var i8=b("<main class=config-page><section class=config-page-header><div><h1>"),r8=b("<p>"),o8=b("<div class=config-page-actions>"),s8=b("<section class=config-toolbar>"),a8=b("<div class=config-toolbar-controls>"),l8=b("<div class=config-toolbar-meta>");function We(A){return(()=>{var e=i8(),t=e.firstChild,n=t.firstChild,i=n.firstChild;return p(i,()=>A.title),p(n,E(Y,{get when(){return A.description},children:r=>(()=>{var o=r8();return p(o,r),o})()}),null),p(t,E(Y,{get when(){return A.actions},children:r=>(()=>{var o=o8();return p(o,r),o})()}),null),p(e,()=>A.children,null),e})()}function EI(A){return E(Y,{get when(){return A.children||A.meta},get children(){var e=s8();return p(e,E(Y,{get when(){return A.children},children:t=>(()=>{var n=a8();return p(n,t),n})()}),null),p(e,E(Y,{get when(){return A.meta},children:t=>(()=>{var n=l8();return p(n,t),n})()}),null),e}})}function Ve(A){return E(cI,A)}const CI=[{value:"ask",label:"Ask"},{value:"allow",label:"Allow"},{value:"deny",label:"Deny"}],jt=[{id:"external_directory",title:"External Directory",description:"Access files outside the project directory.",noun:"path",placeholder:"e.g. ~/Downloads/**"},{id:"bash",title:"Bash",description:"Run shell commands.",noun:"command",placeholder:"e.g. git status or npm *"},{id:"read",title:"Read",description:"Read files by matching file paths.",noun:"path",placeholder:"e.g. **/*.env"},{id:"edit",title:"Edit",description:"Modify files, including writes, patches, and multi-edits.",noun:"path",placeholder:"e.g. src/**/*.ts"}],_0=[{id:"glob",title:"Glob",description:"Match files using glob patterns."},{id:"grep",title:"Grep",description:"Search file contents using regular expressions."},{id:"list",title:"List",description:"List files within a directory."},{id:"task",title:"Task",description:"Launch sub-agents."},{id:"skill",title:"Skill",description:"Load a skill by name."},{id:"lsp",title:"LSP",description:"Run language server queries."},{id:"todowrite",title:"Todo Write",description:"Update the todo list."},{id:"question",title:"Question",description:"Ask the user a question."},{id:"webfetch",title:"Web Fetch",description:"Fetch content from a URL."},{id:"websearch",title:"Web Search",description:"Search the web."},{id:"doom_loop",title:"Doom Loop",description:"Detect repeated tool calls with identical input."},{id:"agent_manager",title:"Agent Manager",description:"Manage Agent Manager operations."}],uI=[...jt,..._0],g8=new Set(jt.map(A=>A.id)),c8=new Set(uI.map(A=>A.id));function R0(A,e="ask"){return A==="ask"||A==="allow"||A==="deny"?A:e}function za(A){return A&&typeof A=="object"&&!Array.isArray(A)?A:{}}function II(A){return za(A.effective.permission)}function U0(A,e){return A.overlay.collections.permission?.find(t=>t.key===e)}function hI(A,e){return typeof A.effective.permission=="string"?A.effective.permission:II(A)[e]}function fI(A){return R0(A.effective.permission)}function Q8(A,e){return A?e==="*"&&typeof A.value=="string"?A.path:[...A.path,e]:["permission",e]}function oo(A,e,t,n){if(!(t!=="ask"&&t!=="allow"&&t!=="deny"))return{tool:A,pattern:e,action:t,source:n?.source??"default",inherited:n?.inherited??!1,overridden:n?.overridden??!1,path:n?Q8(n,e):["permission",A,e]}}function d8(A){const e=A.value;if(e&&typeof e=="object"&&!Array.isArray(e))return Object.entries(e).flatMap(([n,i])=>oo(A.key,n,i,A)??[]);const t=oo(A.key,"*",e,A);return t?[t]:[]}function B8(A,e,t){const n=za(e);if(Object.keys(n).length)return Object.entries(n).flatMap(([r,o])=>oo(A,r,o,t)??[]);const i=oo(A,"*",e,t);return i?[i]:[]}function E8(A,e){const t=U0(A,e.id),n=hI(A,e.id),i=za(n),r=fI(A);return{...e,action:R0(typeof n=="string"?n:i["*"],r),source:t?.source??"default",inherited:t?.inherited??!1,overridden:t?.overridden??!1}}function C8(A,e){const t=U0(A,e.id),n=hI(A,e.id),i=za(n),r=fI(A);return{...e,action:R0(typeof n=="string"?n:i["*"],r),source:t?.source??"default",inherited:t?.inherited??!1,overridden:t?.overridden??!1,rules:Object.entries(i).filter(([o])=>o!=="*").flatMap(([o,s])=>oo(e.id,o,s,t)??[])}}function u8(){const A=$e(),e=()=>A.data(),[t,n]=U("closed"),[i,r]=U("external_directory"),[o,s]=U(""),[a,l]=U("ask"),g=G(()=>(e()?.overlay.collections.permission??[]).flatMap(d8)),c=G(()=>{const w=e();return w?jt.map(m=>C8(w,m)):[]}),Q=G(()=>{const w=e();return w?_0.map(m=>E8(w,m)):[]}),d=G(()=>{const w=e();return w?Object.entries(II(w)).filter(([m])=>!c8.has(m)).flatMap(([m,D])=>B8(m,D,U0(w,m))).sort((m,D)=>m.tool.localeCompare(D.tool)||m.pattern.localeCompare(D.pattern)):[]}),B=G(()=>jt.find(w=>w.id===i())??jt[0]);function C(w){r(w),s(""),l("ask"),n("rule")}function f(){n("closed")}function u(){const w=e(),m=HA(o());if(!w||!m){A.fail(`Enter a ${B().noun} pattern before saving.`);return}const D={[i()]:{[m]:a()}};A.save({permission:D}),f()}function I(w,m){const D=g8.has(w)?{[w]:{"*":m}}:{[w]:m};A.save({permission:D})}function h(w){A.unset([w.path])}return{ctx:A,mode:t,kind:i,pattern:o,setPattern:s,action:a,setAction:l,rules:g,groups:c,settings:Q,other:d,selected:B,open:C,close:f,add:u,setDefault:I,remove:h}}var dc=b("<div class=permission-row-meta>"),I8=b('<details class="models-select permission-select"><summary></summary><div class=models-select-menu role=listbox>'),h8=b("<button class=models-select-option type=button role=option>"),f8=b("<section class=permission-group><div class=permission-rules>"),p8=b("<div class=permissions><section class=permission-group><div class=permission-rules>"),m8=b("<div class=drawer-scrim>"),w8=b('<aside class="provider-drawer permission-drawer"aria-label="Permission rule configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form permission-form"><label class="required-field wide"><input></label><label class="required-field wide">Method</label></div><footer class=drawer-footer>'),D8=b("<span class=config-title-count>Permissions"),y8=b("<section class=permission-group><header class=permission-group-header><div class=permission-group-copy><h2></h2><span></span><p></p></div><div class=permission-section-actions></div></header><div class=permission-rules>"),k8=b("<p class=permission-empty>No specific <!> rules."),b8=b("<span class=permission-pattern>"),v8=b("<span class=permission-subtitle><span></span><span class=permission-pattern>");function pI(A){return A==="allow"?"success":A==="deny"?"critical":"warning"}function O0(A){return CI.find(e=>e.value===A)?.label??A}function Hd(A){return(()=>{var e=dc();return p(e,E(Ae,{get tone(){return pI(A.rule.action)},get children(){return O0(A.rule.action)}}),null),p(e,E(Ve,{get source(){return A.rule.source},get inherited(){return A.rule.inherited},get overridden(){return A.rule.overridden}}),null),e})()}function Ti(A){const e=()=>O0(A.value);function t(i,r){A.disabled||(A.onSelect(i),r.currentTarget.closest("details")?.removeAttribute("open"))}function n(i){if(A.disabled){i.currentTarget.removeAttribute("open");return}i.currentTarget.open&&i.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(r=>{r!==i.currentTarget&&r.removeAttribute("open")})}return(()=>{var i=I8(),r=i.firstChild,o=r.nextSibling;return i.addEventListener("toggle",n),p(r,e),p(o,E(kA,{each:CI,children:s=>(()=>{var a=h8();return a.$$click=l=>t(s.value,l),p(a,()=>s.label),V(l=>{var g=s.value===A.value,c=s.value===A.value;return g!==l.e&&a.classList.toggle("selected",l.e=g),c!==l.t&&W(a,"aria-selected",l.t=c),l},{e:void 0,t:void 0}),a})()})),V(s=>{var a=!!A.disabled,l=A.label,g=A.disabled,c=A.label;return a!==s.e&&i.classList.toggle("disabled",s.e=a),l!==s.t&&W(r,"aria-label",s.t=l),g!==s.a&&W(r,"aria-disabled",s.a=g),c!==s.o&&W(o,"aria-label",s.o=c),s},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()}function M8(){const A=u8();return E(We,{get title(){return(()=>{var e=D8();return e.firstChild,p(e,E(Se,{get children(){return A.groups().length+A.settings().length}}),null),e})()},description:"Control what tools agents can use by default and add pattern-specific allow, ask, or deny rules.",get children(){return[(()=>{var e=p8(),t=e.firstChild,n=t.firstChild;return p(e,E(kA,{get each(){return A.groups()},children:i=>(()=>{var r=y8(),o=r.firstChild,s=o.firstChild,a=s.firstChild,l=a.nextSibling,g=l.nextSibling,c=s.nextSibling,Q=o.nextSibling;return p(a,()=>i.title),p(l,()=>i.id),p(g,()=>i.description),p(c,E(Se,{get children(){return i.rules.length}}),null),p(c,E(IA,{icon:"plus",variant:"primary",get disabled(){return!!A.ctx.saving()},onClick:()=>A.open(i.id),children:"Add rule"}),null),p(r,E(S1,{title:"Default method",get subtitle(){return`Used for ${i.noun}s that do not match a specific rule.`},get status(){return(()=>{var d=dc();return p(d,E(Ve,{get source(){return i.source},get inherited(){return i.inherited},get overridden(){return i.overridden}})),d})()},get actions(){return E(Ti,{get label(){return`Default method for ${i.title}`},get value(){return i.action},get disabled(){return!!A.ctx.saving()},onSelect:d=>A.setDefault(i.id,d)})}}),Q),p(Q,E(Y,{get when(){return i.rules.length},get fallback(){return(()=>{var d=k8(),B=d.firstChild,C=B.nextSibling;return C.nextSibling,p(d,()=>i.noun,C),d})()},get children(){return E(kA,{get each(){return i.rules},children:d=>E(S1,{get title(){return(()=>{var B=b8();return p(B,()=>d.pattern),B})()},get subtitle(){return`${i.title} ${i.noun} rule`},get status(){return E(Hd,{rule:d})},get actions(){return E(Te,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${i.title} rule ${d.pattern}`},get disabled(){return!!A.ctx.saving()},onClick:()=>A.remove(d)})}})})}})),r})()}),t),p(t,E(Bt,{get trailing(){return E(Se,{get children(){return A.settings().length}})},description:"Default methods for additional built-in tool permissions.",children:"Tool Defaults"}),n),p(n,E(kA,{get each(){return A.settings()},children:i=>E(S1,{get title(){return i.title},get subtitle(){return`${i.id} · ${i.description}`},get status(){return(()=>{var r=dc();return p(r,E(Ve,{get source(){return i.source},get inherited(){return i.inherited},get overridden(){return i.overridden}})),r})()},get actions(){return E(Ti,{get label(){return`Default method for ${i.title}`},get value(){return i.action},get disabled(){return!!A.ctx.saving()},onSelect:r=>A.setDefault(i.id,r)})}})})),p(e,E(Y,{get when(){return A.other().length},get children(){var i=f8(),r=i.firstChild;return p(i,E(Bt,{get trailing(){return E(Se,{get children(){return A.other().length}})},description:"Additional tool permission rules from config.",children:"Other Permissions"}),r),p(r,E(kA,{get each(){return A.other()},children:o=>E(S1,{get title(){return bt(o.tool)},get subtitle(){return(()=>{var s=v8(),a=s.firstChild,l=a.nextSibling;return p(a,()=>o.tool),p(l,()=>o.pattern),s})()},get status(){return E(Hd,{rule:o})},get actions(){return E(Te,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${o.tool} rule ${o.pattern}`},get disabled(){return!!A.ctx.saving()},onClick:()=>A.remove(o)})}})})),i}}),null),e})(),E(Y,{get when(){return A.mode()==="rule"},get children(){return[(()=>{var e=m8();return RA(e,"click",A.close,!0),e})(),(()=>{var e=w8(),t=e.firstChild,n=t.firstChild,i=n.firstChild,r=i.nextSibling,o=t.nextSibling,s=o.firstChild,a=s.firstChild,l=s.nextSibling;l.firstChild;var g=o.nextSibling;return p(i,()=>`Add ${A.selected().title} Rule`),p(r,()=>`${A.selected().id} · ${A.selected().description}`),p(t,E(IA,{variant:"ghost","aria-label":"Close permission rule overlay",get onClick(){return A.close},children:"X"}),null),p(s,()=>A.selected().noun==="command"?"Command pattern":"Path pattern",a),a.$$input=c=>A.setPattern(c.currentTarget.value),W(a,"spellcheck",!1),p(l,E(Ti,{label:"Rule method",get value(){return A.action()},get disabled(){return!!A.ctx.saving()},get onSelect(){return A.setAction}}),null),p(g,E(IA,{variant:"ghost",get onClick(){return A.close},children:"Cancel"}),null),p(g,E(IA,{variant:"primary",get disabled(){return!!A.ctx.saving()},get onClick(){return A.add},children:"Save Rule"}),null),V(()=>W(a,"placeholder",A.selected().placeholder)),V(()=>a.value=A.pattern()),e})()]}})]}})}pe(["click","input"]);const N8=["Review the current diff and report risks, regressions, and missing tests.","Plan the work in small steps, then implement the smallest correct change.","Inspect relevant files first, then summarize the root cause before editing.","Run the smallest relevant validation checks and report any remaining failures."];function S8(A,e){return A.id==="kilo"?-1:e.id==="kilo"?1:A.name.localeCompare(e.name)}function L8(A,e){return A.provider.id===e.providerID&&A.model.id===e.modelID?!0:A.model.providerID===e.providerID&&A.model.id===e.modelID}function Yl(A){const e=HA(A);if(e)return e}function x8(A){const e=Number(A);if(Number.isInteger(e)&&e>0)return e}function Tt(A){return A&&typeof A=="object"&&!Array.isArray(A)?A:{}}function dn(A){return typeof A=="string"?A:""}function F8(A){if(typeof A=="number"&&Number.isFinite(A))return A}function Yd(A,e="ask"){return A==="allow"||A==="deny"||A==="ask"?A:e}function Bc(A,e,t){if(!(t!=="allow"&&t!=="deny"&&t!=="ask"))return{tool:A,pattern:e,action:t}}function Pd(A,e){const t=Tt(e);if(Object.keys(t).length)return Object.entries(t).flatMap(([i,r])=>Bc(A,i,r)??[]);const n=Bc(A,"*",e);return n?[n]:[]}const G8=new Set(jt.map(A=>A.id)),_8=new Set(uI.map(A=>A.id));function R8(A){const e=A.options.source;if(typeof e=="string")return e}function U8(A){const e=Object.entries(O8(A));return{tools:BI(e.filter(([,t])=>t==="allow").map(([t])=>t)),permission:Object.fromEntries(e.filter(([,t])=>t!=="allow"))}}function O8(A){return Array.isArray(A)?A.reduce((e,t)=>{const n=Tt(t),i=dn(n.permission),r=dn(n.action);if(!i||!r)return e;const o=dn(n.pattern)||"*";if(o==="*")return{...e,[i]:r};const s=e[i],a=s&&typeof s=="object"&&!Array.isArray(s)?s:{};return{...e,[i]:{...a,[o]:r}}},{}):Tt(A)}function K8(A,e){return(A.overlay.collections.agent??[]).find(t=>t.key===e)}function fr(A){return A.displayName??F1(A.name)}function T8(A){return A.model?`${A.model.providerID}/${A.model.modelID}`:""}function Ec(A,e){return!(A.native||e?.inherited||e?.editable===!1||R8(A)==="organization")}function q8(A){const e=$e(),t=()=>e.data(),n=G(()=>e.query()?.scope??"project"),[i,r]=U(),[o,s]=U(!0),[a,l]=U(!1),[g,c]=U("reviewer"),[Q,d]=U(""),[B,C]=U("subagent"),[f,u]=U(""),[I,h]=U(""),[w,m]=U(""),[D,N]=U([]),[y,k]=U(""),[_,F]=U("external_directory"),[L,M]=U(""),[S,T]=U("ask"),[R,P]=U({}),[X,z]=U(),[iA,BA]=U("closed"),[nA,hA]=U(""),[J,K]=U(""),[$,oA]=U(""),[AA,gA]=U([]),j=G(()=>{const tA=t();if(!tA)return[];const EA=new Set([...Object.keys(tA.effective.provider??{}),...tA.providers.connected]);return tA.providers.all.filter(wA=>EA.has(wA.id)).filter(wA=>Object.keys(wA.models).length>0).sort(S8)}),Z=G(()=>j().flatMap(tA=>Object.values(tA.models).map(EA=>({id:`${tA.id}/${EA.id}`,provider:tA,model:EA})))),dA=G(()=>t()?.modelState.favorite??[]),aA=tA=>dA().some(EA=>L8(tA,EA)),v=G(()=>{const tA=nA().trim().toLowerCase();return Z().filter(EA=>tA?`${EA.id} ${EA.model.name} ${EA.provider.name}`.toLowerCase().includes(tA):!0).sort((EA,wA)=>{const jA=Number(aA(wA))-Number(aA(EA));if(jA!==0)return jA;const Ee=EA.model.name.localeCompare(wA.model.name);if(Ee!==0)return Ee;const ee=EA.provider.name.localeCompare(wA.provider.name);return ee!==0?ee:EA.id.localeCompare(wA.id)})}),yA=tA=>{if(typeof tA=="string")return Z().find(EA=>EA.id===tA||`${EA.model.providerID}/${EA.model.id}`===tA)},NA=G(()=>yA(f())),vA=G(()=>{const tA=t();if(!tA)return[];const EA=$().trim().toLowerCase(),wA=new Map(tA.toolDetails.map(jA=>[jA.id,jA]));return tA.tools.map(jA=>({id:jA,detail:wA.get(jA)})).filter(jA=>EA?`${jA.id} ${bt(jA.id)} ${G0(jA).join(" ")}`.toLowerCase().includes(EA):!0).sort((jA,Ee)=>bt(jA.id).localeCompare(bt(Ee.id)))}),pA=G(()=>new Set(AA())),SA=G(()=>Object.entries(R()).flatMap(([tA,EA])=>Pd(tA,EA))),_A=G(()=>jt.map(tA=>{const EA=R()[tA.id],wA=Tt(EA);return{...tA,action:Yd(typeof EA=="string"?EA:wA["*"]),rules:Object.entries(wA).filter(([jA])=>jA!=="*").flatMap(([jA,Ee])=>Bc(tA.id,jA,Ee)??[])}})),se=G(()=>_0.map(tA=>{const EA=R()[tA.id],wA=Tt(EA);return{...tA,action:Yd(typeof EA=="string"?EA:wA["*"])}})),ae=G(()=>Object.entries(R()).filter(([tA])=>!_8.has(tA)).flatMap(([tA,EA])=>Pd(tA,EA)).sort((tA,EA)=>tA.tool.localeCompare(EA.tool)||tA.pattern.localeCompare(EA.pattern))),LA=G(()=>jt.find(tA=>tA.id===_())??jt[0]);function KA(tA="reviewer"){c(tA),d(""),C("subagent"),u(""),h(""),m(""),N([]),k(""),P({}),z(void 0),l(!1),BA("closed"),F("external_directory"),M(""),T("ask"),hA(""),K(""),oA(""),gA([])}rA(()=>{A?.()||i()!==""&&(KA(),s(!0),r(""))}),rA(()=>{const tA=t(),EA=A?.();if(!tA||!EA||i()===EA)return;KA(EA),s(!1),r(EA);const wA=tA.agents.find(X1=>X1.name===EA);if(!wA){e.fail(`Agent not found: ${EA}`);return}const jA=K8(tA,EA),Ee=Ec(wA,jA);e.fail(""),s(!0),l(!Ee);const ee=Tt(jA?.value),w1=U8(ee.permission??(Ee?void 0:wA.permission)),_1=F8(ee.steps)??wA.steps;c(wA.name),d(dn(ee.description)||wA.description||""),C(n8(dn(ee.mode)||wA.mode)),u(dn(ee.model)||T8(wA)),h(dn(ee.color)||wA.color||""),m(_1?String(_1):""),N(w1.tools),P(w1.permission),k(dn(ee.prompt)||wA.prompt||"")});function ie(){BA("closed")}function xA(){return a()?(e.fail("Inspected agents are read-only."),!1):!0}function he(){const tA=g1();tA&&(z(void 0),BA("markdown"),e.run("Previewing agent",()=>kb(e.target(),tA).then(z),{refetch:!1}))}function re(){xA()&&(hA(""),K(f()),BA("model"))}function Je(tA){K(tA.id)}function s1(){if(!xA())return;const tA=J();if(!tA){e.fail("Select a model before saving the agent model field.");return}u(tA),ie()}function a1(){xA()&&u("")}function JA(){xA()&&(oA(""),gA(D()),BA("tools"))}function sA(tA){if(!xA())return;const EA=new Set(AA());EA.has(tA)?EA.delete(tA):EA.add(tA),gA(BI(EA))}function GA(){xA()&&(N(AA()),ie())}function XA(){xA()&&N([])}function Fe(tA){xA()&&(F(tA),M(""),T("ask"),BA("permission"))}function He(tA,EA){if(!xA())return;const wA={...R()};if(!G8.has(tA)){wA[tA]=EA,P(wA);return}const jA=Tt(wA[tA]);wA[tA]={...jA,"*":EA},P(wA)}function Be(){if(!xA())return;const tA=HA(L());if(!tA){e.fail(`Enter a ${LA().noun} pattern before saving.`);return}const EA=_(),wA={...R()},jA=wA[EA],Ee=jA&&typeof jA=="object"&&!Array.isArray(jA)?{...jA}:{};Ee[tA]=S(),wA[EA]=Ee,P(wA),ie()}function Ue(tA){if(!xA())return;const EA={...R()};if(tA.pattern==="*"){const jA={...Tt(EA[tA.tool])};if(Object.keys(jA).length){delete jA["*"],Object.keys(jA).length?EA[tA.tool]=jA:delete EA[tA.tool],P(EA);return}delete EA[tA.tool],P(EA);return}const wA={...Tt(EA[tA.tool])};delete wA[tA.pattern],Object.keys(wA).length?EA[tA.tool]=wA:delete EA[tA.tool],P(EA)}function l1(tA){if(!xA())return;const EA=HA(y());k(EA?`${EA}
20
+ `);try{P=JSON.parse(z),X=!0}catch{P=z}}X&&(i&&await i(P),n&&(P=await n(P))),t?.({data:P,event:R,id:c,retry:C}),T.length&&(yield P)}}}finally{u.removeEventListener("abort",k),N.releaseLock()}break}catch(h){if(e?.(h),o!==void 0&&f>=o)break;const w=Math.min(C*2**(f-1),s??3e4);await Q(w)}}}()}},ok=A=>{switch(A){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},sk=A=>{switch(A){case"form":return",";case"pipeDelimited":return"|";case"spaceDelimited":return"%20";default:return","}},ak=A=>{switch(A){case"label":return".";case"matrix":return";";case"simple":return",";default:return"&"}},$u=({allowReserved:A,explode:e,name:t,style:n,value:i})=>{if(!e){const s=(A?i:i.map(a=>encodeURIComponent(a))).join(sk(n));switch(n){case"label":return`.${s}`;case"matrix":return`;${t}=${s}`;case"simple":return s;default:return`${t}=${s}`}}const r=ok(n),o=i.map(s=>n==="label"||n==="simple"?A?s:encodeURIComponent(s):Pa({allowReserved:A,name:t,value:s})).join(r);return n==="label"||n==="matrix"?r+o:o},Pa=({allowReserved:A,name:e,value:t})=>{if(t==null)return"";if(typeof t=="object")throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${e}=${A?t:encodeURIComponent(t)}`},Wu=({allowReserved:A,explode:e,name:t,style:n,value:i,valueOnly:r})=>{if(i instanceof Date)return r?i.toISOString():`${t}=${i.toISOString()}`;if(n!=="deepObject"&&!e){let a=[];Object.entries(i).forEach(([g,c])=>{a=[...a,g,A?c:encodeURIComponent(c)]});const l=a.join(",");switch(n){case"form":return`${t}=${l}`;case"label":return`.${l}`;case"matrix":return`;${t}=${l}`;default:return l}}const o=ak(n),s=Object.entries(i).map(([a,l])=>Pa({allowReserved:A,name:n==="deepObject"?`${t}[${a}]`:a,value:l})).join(o);return n==="label"||n==="matrix"?o+s:s},lk=/\{[^{}]+\}/g,gk=({path:A,url:e})=>{let t=e;const n=e.match(lk);if(n)for(const i of n){let r=!1,o=i.substring(1,i.length-1),s="simple";o.endsWith("*")&&(r=!0,o=o.substring(0,o.length-1)),o.startsWith(".")?(o=o.substring(1),s="label"):o.startsWith(";")&&(o=o.substring(1),s="matrix");const a=A[o];if(a==null)continue;if(Array.isArray(a)){t=t.replace(i,$u({explode:r,name:o,style:s,value:a}));continue}if(typeof a=="object"){t=t.replace(i,Wu({explode:r,name:o,style:s,value:a,valueOnly:!0}));continue}if(s==="matrix"){t=t.replace(i,`;${Pa({name:o,value:a})}`);continue}const l=encodeURIComponent(s==="label"?`.${a}`:a);t=t.replace(i,l)}return t},ck=({baseUrl:A,path:e,query:t,querySerializer:n,url:i})=>{const r=i.startsWith("/")?i:`/${i}`;let o=(A??"")+r;e&&(o=gk({path:e,url:o}));let s=t?n(t):"";return s.startsWith("?")&&(s=s.substring(1)),s&&(o+=`?${s}`),o};function xd(A){const e=A.body!==void 0;if(e&&A.bodySerializer)return"serializedBody"in A?A.serializedBody!==void 0&&A.serializedBody!==""?A.serializedBody:null:A.body!==""?A.body:null;if(e)return A.body}const Qk=async(A,e)=>{const t=typeof e=="function"?await e(A):e;if(t)return A.scheme==="bearer"?`Bearer ${t}`:A.scheme==="basic"?`Basic ${btoa(t)}`:t},dk={bodySerializer:A=>JSON.stringify(A,(e,t)=>typeof t=="bigint"?t.toString():t)},Zu=({parameters:A={},...e}={})=>n=>{const i=[];if(n&&typeof n=="object")for(const r in n){const o=n[r];if(o==null)continue;const s=A[r]||e;if(Array.isArray(o)){const a=$u({allowReserved:s.allowReserved,explode:!0,name:r,style:"form",value:o,...s.array});a&&i.push(a)}else if(typeof o=="object"){const a=Wu({allowReserved:s.allowReserved,explode:!0,name:r,style:"deepObject",value:o,...s.object});a&&i.push(a)}else{const a=Pa({allowReserved:s.allowReserved,name:r,value:o});a&&i.push(a)}}return i.join("&")},Bk=A=>{if(!A)return"stream";const e=A.split(";")[0]?.trim();if(e){if(e.startsWith("application/json")||e.endsWith("+json"))return"json";if(e==="multipart/form-data")return"formData";if(["application/","audio/","image/","video/"].some(t=>e.startsWith(t)))return"blob";if(e.startsWith("text/"))return"text"}},Ek=(A,e)=>e?!!(A.headers.has(e)||A.query?.[e]||A.headers.get("Cookie")?.includes(`${e}=`)):!1,Ck=async({security:A,...e})=>{for(const t of A){if(Ek(e,t.name))continue;const n=await Qk(t,e.auth);if(!n)continue;const i=t.name??"Authorization";switch(t.in){case"query":e.query||(e.query={}),e.query[i]=n;break;case"cookie":e.headers.append("Cookie",`${i}=${n}`);break;default:e.headers.set(i,n);break}}},Fd=A=>ck({baseUrl:A.baseUrl,path:A.path,query:A.query,querySerializer:typeof A.querySerializer=="function"?A.querySerializer:Zu(A.querySerializer),url:A.url}),Gd=(A,e)=>{const t={...A,...e};return t.baseUrl?.endsWith("/")&&(t.baseUrl=t.baseUrl.substring(0,t.baseUrl.length-1)),t.headers=Xu(A.headers,e.headers),t},uk=A=>{const e=[];return A.forEach((t,n)=>{e.push([n,t])}),e},Xu=(...A)=>{const e=new Headers;for(const t of A){if(!t)continue;const n=t instanceof Headers?uk(t):Object.entries(t);for(const[i,r]of n)if(r===null)e.delete(i);else if(Array.isArray(r))for(const o of r)e.append(i,o);else r!==void 0&&e.set(i,typeof r=="object"?JSON.stringify(r):r)}return e};class Hl{fns=[];clear(){this.fns=[]}eject(e){const t=this.getInterceptorIndex(e);this.fns[t]&&(this.fns[t]=null)}exists(e){const t=this.getInterceptorIndex(e);return!!this.fns[t]}getInterceptorIndex(e){return typeof e=="number"?this.fns[e]?e:-1:this.fns.indexOf(e)}update(e,t){const n=this.getInterceptorIndex(e);return this.fns[n]?(this.fns[n]=t,e):!1}use(e){return this.fns.push(e),this.fns.length-1}}const Ik=()=>({error:new Hl,request:new Hl,response:new Hl}),hk=Zu({allowReserved:!1,array:{explode:!0,style:"form"},object:{explode:!0,style:"deepObject"}}),fk={"Content-Type":"application/json"},AI=(A={})=>({...dk,headers:fk,parseAs:"auto",querySerializer:hk,...A}),eI=(A={})=>{let e=Gd(AI(),A);const t=()=>({...e}),n=l=>(e=Gd(e,l),t()),i=Ik(),r=async l=>{const g={...e,...l,fetch:l.fetch??e.fetch??globalThis.fetch,headers:Xu(e.headers,l.headers),serializedBody:void 0};g.security&&await Ck({...g,security:g.security}),g.requestValidator&&await g.requestValidator(g),g.body!==void 0&&g.bodySerializer&&(g.serializedBody=g.bodySerializer(g.body)),(g.body===void 0||g.serializedBody==="")&&g.headers.delete("Content-Type");const c=Fd(g);return{opts:g,url:c}},o=async l=>{const{opts:g,url:c}=await r(l),Q={redirect:"follow",...g,body:xd(g)};let d=new Request(c,Q);for(const m of i.request.fns)m&&(d=await m(d,g));const B=g.fetch;let C;try{C=await B(d)}catch(m){let D=m;for(const N of i.error.fns)N&&(D=await N(m,void 0,d,g));if(D=D||{},g.throwOnError)throw D;return g.responseStyle==="data"?void 0:{error:D,request:d,response:void 0}}for(const m of i.response.fns)m&&(C=await m(C,d,g));const f={request:d,response:C};if(C.ok){const m=(g.parseAs==="auto"?Bk(C.headers.get("Content-Type")):g.parseAs)??"json";if(C.status===204||C.headers.get("Content-Length")==="0"){let N;switch(m){case"arrayBuffer":case"blob":case"text":N=await C[m]();break;case"formData":N=new FormData;break;case"stream":N=C.body;break;default:N={};break}return g.responseStyle==="data"?N:{data:N,...f}}let D;switch(m){case"arrayBuffer":case"blob":case"formData":case"text":D=await C[m]();break;case"json":{const N=await C.text();D=N?JSON.parse(N):{};break}case"stream":return g.responseStyle==="data"?C.body:{data:C.body,...f}}return m==="json"&&(g.responseValidator&&await g.responseValidator(D),g.responseTransformer&&(D=await g.responseTransformer(D))),g.responseStyle==="data"?D:{data:D,...f}}const u=await C.text();let I;try{I=JSON.parse(u)}catch{}const h=I??u;let w=h;for(const m of i.error.fns)m&&(w=await m(h,C,d,g));if(w=w||{},g.throwOnError)throw w;return g.responseStyle==="data"?void 0:{error:w,...f}},s=l=>g=>o({...g,method:l}),a=l=>async g=>{const{opts:c,url:Q}=await r(g);return rk({...c,body:c.body,headers:c.headers,method:l,onRequest:async(d,B)=>{let C=new Request(d,B);for(const f of i.request.fns)f&&(C=await f(C,c));return C},serializedBody:xd(c),url:Q})};return{buildUrl:Fd,connect:s("CONNECT"),delete:s("DELETE"),get:s("GET"),getConfig:t,head:s("HEAD"),interceptors:i,options:s("OPTIONS"),patch:s("PATCH"),post:s("POST"),put:s("PUT"),request:o,setConfig:n,sse:{connect:a("CONNECT"),delete:a("DELETE"),get:a("GET"),head:a("HEAD"),options:a("OPTIONS"),patch:a("PATCH"),post:a("POST"),put:a("PUT"),trace:a("TRACE")},trace:s("TRACE")}},pk={$body_:"body",$headers_:"headers",$path_:"path",$query_:"query"},mk=Object.entries(pk),tI=(A,e)=>{e||(e=new Map);for(const t of A)"in"in t?t.key&&e.set(t.key,{in:t.in,map:t.map}):"key"in t?e.set(t.key,{map:t.map}):t.args&&tI(t.args,e);return e},wk=A=>{for(const[e,t]of Object.entries(A))t&&typeof t=="object"&&!Object.keys(t).length&&delete A[e]},H=(A,e)=>{const t={body:{},headers:{},path:{},query:{}},n=tI(e);let i;for(const[r,o]of A.entries())if(e[r]&&(i=e[r]),!!i)if("in"in i)if(i.key){const s=n.get(i.key),a=s.map||i.key;s.in&&(t[s.in][a]=o)}else t.body=o;else for(const[s,a]of Object.entries(o??{})){const l=n.get(s);if(l)if(l.in){const g=l.map||s;t[l.in][g]=a}else t[l.map]=a;else{const g=mk.find(([c])=>s.startsWith(c));if(g){const[c,Q]=g;t[Q][s.slice(c.length)]=a}else if("allowExtra"in i&&i.allowExtra){for(const[c,Q]of Object.entries(i.allowExtra))if(Q){t[c][s]=a;break}}}}return wk(t),t},Dk=eI(AI({baseUrl:"http://localhost:4096"}));class bA{client;constructor(e){this.client=e?.client??Dk}}class yk{defaultKey="default";instances=new Map;get(e){const t=this.instances.get(e??this.defaultKey);if(!t)throw new Error('No SDK client found. Create one with "new KiloClient()" to fix this error.');return t}set(e,t){this.instances.set(t??this.defaultKey,e)}}class kk extends bA{remove(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"}]}]);return(t?.client??this.client).delete({url:"/auth/{providerID}",...t,...n})}set(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{key:"auth",map:"body"}]}]);return(t?.client??this.client).put({url:"/auth/{providerID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}let bk=class extends bA{log(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"service"},{in:"body",key:"level"},{in:"body",key:"message"},{in:"body",key:"extra"}]}]);return(t?.client??this.client).post({url:"/log",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}agents(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/agent",...t,...n})}skills(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/skill",...t,...n})}};class vk extends bA{get(e){return(e?.client??this.client).get({url:"/global/config",...e})}update(e,t){const n=H([e],[{args:[{key:"config",map:"body"}]}]);return(t?.client??this.client).patch({url:"/global/config",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Mk extends bA{health(e){return(e?.client??this.client).get({url:"/global/health",...e})}event(e){return(e?.client??this.client).sse.get({url:"/global/event",...e})}dispose(e){return(e?.client??this.client).post({url:"/global/dispose",...e})}upgrade(e,t){const n=H([e],[{args:[{in:"body",key:"target"}]}]);return(t?.client??this.client).post({url:"/global/upgrade",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_config;get config(){return this._config??=new vk({client:this.client})}}let Nk=class extends bA{subscribe(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).sse.get({url:"/event",...t,...n})}};class Sk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"config",map:"body"}]}]);return(t?.client??this.client).patch({url:"/config",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}warnings(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/warnings",...t,...n})}providers(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/providers",...t,...n})}overlay(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"}]}]);return(t?.client??this.client).get({url:"/config/overlay",...t,...n})}overlayUpdate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"scope"},{in:"body",key:"set"},{in:"body",key:"unset"}]}]);return(t?.client??this.client).patch({url:"/config/overlay",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}sources(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/sources",...t,...n})}effective(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/effective",...t,...n})}rules(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"}]}]);return(t?.client??this.client).get({url:"/config/rules",...t,...n})}rulesUpdate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"scope"},{in:"body",key:"content"}]}]);return(t?.client??this.client).put({url:"/config/rules",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}modelState(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/config/model-state",...t,...n})}modelStateUpdate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"favorite"}]}]);return(t?.client??this.client).patch({url:"/config/model-state",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Lk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/console",...t,...n})}listOrgs(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/console/orgs",...t,...n})}switchOrg(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"accountID"},{in:"body",key:"orgID"}]}]);return(t?.client??this.client).post({url:"/experimental/console/switch",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class xk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"projectID"},{in:"query",key:"worktrees"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"cursor"},{in:"query",key:"search"},{in:"query",key:"limit"},{in:"query",key:"archived"}]}]);return(t?.client??this.client).get({url:"/experimental/session",...t,...n})}}class Fk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/resource",...t,...n})}}class Gk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/workspace/adapter",...t,...n})}}class _k extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/workspace",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"type"},{in:"body",key:"branch"},{in:"body",key:"extra"}]}]);return(t?.client??this.client).post({url:"/experimental/workspace",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}syncList(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/experimental/workspace/sync-list",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/workspace/status",...t,...n})}remove(e,t){const n=H([e],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/experimental/workspace/{id}",...t,...n})}warp(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"sessionID"},{in:"body",key:"copyChanges"}]}]);return(t?.client??this.client).post({url:"/experimental/workspace/warp",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_adapter;get adapter(){return this._adapter??=new Gk({client:this.client})}}class Rk extends bA{_console;get console(){return this._console??=new Lk({client:this.client})}_session;get session(){return this._session??=new xk({client:this.client})}_resource;get resource(){return this._resource??=new Fk({client:this.client})}_workspace;get workspace(){return this._workspace??=new _k({client:this.client})}}class Uk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"provider"},{in:"query",key:"model"}]}]);return(t?.client??this.client).get({url:"/experimental/tool",...t,...n})}ids(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/tool/ids",...t,...n})}}class Ok extends bA{remove(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeRemoveInput",map:"body"}]}]);return(t?.client??this.client).delete({url:"/experimental/worktree",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeCreateInput",map:"body"}]}]);return(t?.client??this.client).post({url:"/experimental/worktree",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}reset(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"worktreeResetInput",map:"body"}]}]);return(t?.client??this.client).post({url:"/experimental/worktree/reset",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}diff(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"base"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree/diff",...t,...n})}diffSummary(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"base"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree/diff/summary",...t,...n})}diffFile(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"base"},{in:"query",key:"file"}]}]);return(t?.client??this.client).get({url:"/experimental/worktree/diff/file",...t,...n})}}class Kk extends bA{text(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"pattern"}]}]);return(t?.client??this.client).get({url:"/find",...t,...n})}files(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"query"},{in:"query",key:"dirs"},{in:"query",key:"type"},{in:"query",key:"limit"}]}]);return(t?.client??this.client).get({url:"/find/file",...t,...n})}symbols(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"query"}]}]);return(t?.client??this.client).get({url:"/find/symbol",...t,...n})}}let Tk=class extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"path"}]}]);return(t?.client??this.client).get({url:"/file",...t,...n})}read(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"path"}]}]);return(t?.client??this.client).get({url:"/file/content",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/file/status",...t,...n})}};class qk extends bA{dispose(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/instance/dispose",...t,...n})}}class Jk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/path",...t,...n})}}let Hk=class extends bA{raw(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/vcs/diff/raw",...t,...n})}};class Yk extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/vcs",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/vcs/status",...t,...n})}diff(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"mode"}]}]);return(t?.client??this.client).get({url:"/vcs/diff",...t,...n})}apply(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"patch"}]}]);return(t?.client??this.client).post({url:"/vcs/apply",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_diff;get diff2(){return this._diff??=new Hk({client:this.client})}}class Pk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/command",...t,...n})}}class Vk extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/lsp",...t,...n})}}class jk extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/formatter",...t,...n})}}class zk extends bA{remove(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/mcp/{name}/auth",...t,...n})}start(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/auth",...t,...n})}callback(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"code"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/auth/callback",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}authenticate(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/auth/authenticate",...t,...n})}}class $k extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/mcp",...t,...n})}add(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"},{in:"body",key:"config"}]}]);return(t?.client??this.client).post({url:"/mcp",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}connect(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/connect",...t,...n})}disconnect(e,t){const n=H([e],[{args:[{in:"path",key:"name"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/mcp/{name}/disconnect",...t,...n})}_auth;get auth(){return this._auth??=new zk({client:this.client})}}class Wk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/project",...t,...n})}current(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/project/current",...t,...n})}initGit(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/project/git/init",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"projectID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"},{in:"body",key:"icon"},{in:"body",key:"commands"}]}]);return(t?.client??this.client).patch({url:"/project/{projectID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Zk extends bA{shells(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty/shells",...t,...n})}list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"command"},{in:"body",key:"args"},{in:"body",key:"cwd"},{in:"body",key:"title"},{in:"body",key:"env"}]}]);return(t?.client??this.client).post({url:"/pty",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}remove(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/pty/{ptyID}",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty/{ptyID}",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"sessionID"},{in:"body",key:"size"}]}]);return(t?.client??this.client).put({url:"/pty/{ptyID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}connectToken(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/pty/{ptyID}/connect-token",...t,...n})}connect(e,t){const n=H([e],[{args:[{in:"path",key:"ptyID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/pty/{ptyID}/connect",...t,...n})}}class Xk extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/question",...t,...n})}reply(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"answers"}]}]);return(t?.client??this.client).post({url:"/question/{requestID}/reply",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}reject(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/question/{requestID}/reject",...t,...n})}}class A3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/permission",...t,...n})}reply(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"reply"},{in:"body",key:"message"}]}]);return(t?.client??this.client).post({url:"/permission/{requestID}/reply",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}saveAlwaysRules(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"approvedAlways"},{in:"body",key:"deniedAlways"}]}]);return(t?.client??this.client).post({url:"/permission/{requestID}/always-rules",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}allowEverything(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"enable"},{in:"body",key:"requestID"},{in:"body",key:"sessionID"}]}]);return(t?.client??this.client).post({url:"/permission/allow-everything",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}respond(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"permissionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"response"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/permissions/{permissionID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class e3 extends bA{authorize(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"method"},{in:"body",key:"inputs"}]}]);return(t?.client??this.client).post({url:"/provider/{providerID}/oauth/authorize",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}callback(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"method"},{in:"body",key:"code"}]}]);return(t?.client??this.client).post({url:"/provider/{providerID}/oauth/callback",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class t3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/provider",...t,...n})}auth(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/provider/auth",...t,...n})}_oauth;get oauth(){return this._oauth??=new e3({client:this.client})}}class n3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"},{in:"query",key:"path"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"limit"}]}]);return(t?.client??this.client).get({url:"/session",...t,...n})}create(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"parentID"},{in:"body",key:"title"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"permission"},{in:"body",key:"platform"},{in:"body",key:"workspaceID"}]}]);return(t?.client??this.client).post({url:"/session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/status",...t,...n})}delete(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"permission"},{in:"body",key:"time"}]}]);return(t?.client??this.client).patch({url:"/session/{sessionID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}children(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/children",...t,...n})}todo(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/todo",...t,...n})}diff(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"messageID"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/diff",...t,...n})}messages(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"before"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/message",...t,...n})}prompt(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"format"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"snapshotInitialization"},{in:"body",key:"editorContext"},{in:"body",key:"parts"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/message",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}deleteMessage(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}",...t,...n})}message(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/session/{sessionID}/message/{messageID}",...t,...n})}fork(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/fork",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}abort(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/abort",...t,...n})}init(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"modelID"},{in:"body",key:"providerID"},{in:"body",key:"messageID"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/init",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}unshare(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}/share",...t,...n})}share(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/share",...t,...n})}summarize(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"providerID"},{in:"body",key:"modelID"},{in:"body",key:"auto"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/summarize",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}promptAsync(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"model"},{in:"body",key:"agent"},{in:"body",key:"noReply"},{in:"body",key:"tools"},{in:"body",key:"format"},{in:"body",key:"system"},{in:"body",key:"variant"},{in:"body",key:"snapshotInitialization"},{in:"body",key:"editorContext"},{in:"body",key:"parts"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/prompt_async",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}command(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"arguments"},{in:"body",key:"command"},{in:"body",key:"variant"},{in:"body",key:"snapshotInitialization"},{in:"body",key:"parts"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/command",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}shell(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"agent"},{in:"body",key:"model"},{in:"body",key:"command"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/shell",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}revert(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"messageID"},{in:"body",key:"partID"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/revert",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}unrevert(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/session/{sessionID}/unrevert",...t,...n})}viewed(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"focused"},{in:"body",key:"open"}]}]);return(t?.client??this.client).post({url:"/session/viewed",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class i3 extends bA{delete(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).delete({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"path",key:"messageID"},{in:"path",key:"partID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"part",map:"body"}]}]);return(t?.client??this.client).patch({url:"/session/{sessionID}/message/{messageID}/part/{partID}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class r3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return(t?.client??this.client).post({url:"/sync/history",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class o3 extends bA{start(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/sync/start",...t,...n})}replay(e,t){const n=H([e],[{args:[{in:"query",key:"query_directory",map:"directory"},{in:"query",key:"workspace"},{in:"body",key:"body_directory",map:"directory"},{in:"body",key:"events"}]}]);return(t?.client??this.client).post({url:"/sync/replay",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}steal(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionID"}]}]);return(t?.client??this.client).post({url:"/sync/steal",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_history;get history(){return this._history??=new r3({client:this.client})}}class s3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"order"},{in:"query",key:"path"},{in:"query",key:"roots"},{in:"query",key:"start"},{in:"query",key:"search"},{in:"query",key:"cursor"}]}]);return(t?.client??this.client).get({url:"/api/session",...t,...n})}prompt(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"prompt"},{in:"body",key:"delivery"}]}]);return(t?.client??this.client).post({url:"/api/session/{sessionID}/prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}compact(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/api/session/{sessionID}/compact",...t,...n})}wait(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/api/session/{sessionID}/wait",...t,...n})}context(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/api/session/{sessionID}/context",...t,...n})}messages(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"limit"},{in:"query",key:"order"},{in:"query",key:"cursor"}]}]);return(t?.client??this.client).get({url:"/api/session/{sessionID}/message",...t,...n})}}class a3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"location"}]}]);return(t?.client??this.client).get({url:"/api/model",...t,...n})}}class l3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"location"}]}]);return(t?.client??this.client).get({url:"/api/provider",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"providerID"},{in:"query",key:"location"}]}]);return(t?.client??this.client).get({url:"/api/provider/{providerID}",...t,...n})}}class g3 extends bA{_session;get session(){return this._session??=new s3({client:this.client})}_model;get model(){return this._model??=new a3({client:this.client})}_provider;get provider(){return this._provider??=new l3({client:this.client})}}class c3 extends bA{next(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/tui/control/next",...t,...n})}response(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return(t?.client??this.client).post({url:"/tui/control/response",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class Q3 extends bA{get(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/tui/config",...t,...n})}update(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"scope"},{in:"body",key:"$schema"},{in:"body",key:"theme"},{in:"body",key:"keybinds"},{in:"body",key:"plugin"},{in:"body",key:"plugin_enabled"},{in:"body",key:"scroll_speed"},{in:"body",key:"scroll_acceleration"},{in:"body",key:"diff_style"},{in:"body",key:"mouse"},{in:"body",key:"attention"}]}]);return(t?.client??this.client).patch({url:"/tui/config",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class d3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/tui/keybinds",...t,...n})}}class B3 extends bA{appendPrompt(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"text"}]}]);return(t?.client??this.client).post({url:"/tui/append-prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}openHelp(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-help",...t,...n})}openSessions(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-sessions",...t,...n})}openThemes(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-themes",...t,...n})}openModels(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/open-models",...t,...n})}submitPrompt(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/submit-prompt",...t,...n})}clearPrompt(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/tui/clear-prompt",...t,...n})}executeCommand(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"command"}]}]);return(t?.client??this.client).post({url:"/tui/execute-command",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}showToast(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"title"},{in:"body",key:"message"},{in:"body",key:"variant"},{in:"body",key:"duration"}]}]);return(t?.client??this.client).post({url:"/tui/show-toast",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}publish(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{key:"body",map:"body"}]}]);return(t?.client??this.client).post({url:"/tui/publish",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}selectSession(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionID"}]}]);return(t?.client??this.client).post({url:"/tui/select-session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_control;get control(){return this._control??=new c3({client:this.client})}_config;get config(){return this._config??=new Q3({client:this.client})}_keybind;get keybind(){return this._keybind??=new d3({client:this.client})}}class E3 extends bA{preview(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"scope"},{in:"body",key:"description"},{in:"body",key:"mode"},{in:"body",key:"model"},{in:"body",key:"color"},{in:"body",key:"steps"},{in:"body",key:"tools"},{in:"body",key:"permission"},{in:"body",key:"prompt"}]}]);return(t?.client??this.client).post({url:"/agent-builder/preview",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}save(e,t){const n=H([e],[{args:[{in:"path",key:"path_id",map:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"body_id",map:"id"},{in:"body",key:"scope"},{in:"body",key:"description"},{in:"body",key:"mode"},{in:"body",key:"model"},{in:"body",key:"color"},{in:"body",key:"steps"},{in:"body",key:"tools"},{in:"body",key:"permission"},{in:"body",key:"prompt"}]}]);return(t?.client??this.client).put({url:"/agent-builder/{id}",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class C3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/background-process",...t,...n})}get(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/background-process/{processID}",...t,...n})}logs(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/background-process/{processID}/logs",...t,...n})}stop(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/background-process/{processID}/stop",...t,...n})}restart(e,t){const n=H([e],[{args:[{in:"path",key:"processID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/background-process/{processID}/restart",...t,...n})}stopSession(e,t){const n=H([e],[{args:[{in:"path",key:"sessionID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/background-process/session/{sessionID}/stop",...t,...n})}}class u3 extends bA{generate(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"path"},{in:"body",key:"selectedFiles"},{in:"body",key:"previousMessage"}]}]);return(t?.client??this.client).post({url:"/commit-message",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class I3 extends bA{enhance(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"text"}]}]);return(t?.client??this.client).post({url:"/enhance-prompt",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class h3 extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/indexing/status",...t,...n})}warnings(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/indexing/warnings",...t,...n})}models(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/indexing/models",...t,...n})}}class f3 extends bA{transcriptions(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"model"},{in:"body",key:"input_audio"},{in:"body",key:"language"},{in:"body",key:"prompt"},{in:"body",key:"temperature"}]}]);return(t?.client??this.client).post({url:"/kilo/audio/transcriptions",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class p3 extends bA{set(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"organizationId"}]}]);return(t?.client??this.client).post({url:"/kilo/organization",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class m3 extends bA{status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/claw/status",...t,...n})}chatCredentials(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/claw/chat-credentials",...t,...n})}}class w3 extends bA{get(e,t){const n=H([e],[{args:[{in:"path",key:"id"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/cloud/session/{id}",...t,...n})}import(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"sessionId"}]}]);return(t?.client??this.client).post({url:"/kilo/cloud/session/import",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class D3 extends bA{_session;get session(){return this._session??=new w3({client:this.client})}}class y3 extends bA{profile(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/profile",...t,...n})}modes(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/modes",...t,...n})}fim(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"prefix"},{in:"body",key:"suffix"},{in:"body",key:"provider"},{in:"body",key:"model"},{in:"body",key:"maxTokens"},{in:"body",key:"temperature"}]}]);return(t?.client??this.client).sse.post({url:"/kilo/fim",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}edit(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"provider"},{in:"body",key:"model"},{in:"body",key:"maxTokens"},{in:"body",key:"currentFilePath"},{in:"body",key:"currentFileContent"},{in:"body",key:"cursorLine"},{in:"body",key:"cursorCharacter"},{in:"body",key:"editableRegionStartLine"},{in:"body",key:"editableRegionEndLine"},{in:"body",key:"recentlyViewedSnippets"},{in:"body",key:"editDiffHistory"}]}]);return(t?.client??this.client).post({url:"/kilo/edit",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}notifications(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/kilo/notifications",...t,...n})}cloudSessions(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"query",key:"cursor"},{in:"query",key:"limit"},{in:"query",key:"gitUrl"}]}]);return(t?.client??this.client).get({url:"/kilo/cloud-sessions",...t,...n})}_audio;get audio(){return this._audio??=new f3({client:this.client})}_organization;get organization(){return this._organization??=new p3({client:this.client})}_claw;get claw(){return this._claw??=new m3({client:this.client})}_cloud;get cloud(){return this._cloud??=new D3({client:this.client})}}class k3 extends bA{snapshot(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/kilocode/heap/snapshot",...t,...n})}}class b3 extends bA{project(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"worktree"},{in:"body",key:"vcs"},{in:"body",key:"name"},{in:"body",key:"iconUrl"},{in:"body",key:"iconColor"},{in:"body",key:"timeCreated"},{in:"body",key:"timeUpdated"},{in:"body",key:"timeInitialized"},{in:"body",key:"sandboxes"},{in:"body",key:"commands"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/project",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}session(e,t){const n=H([e],[{args:[{in:"query",key:"query_directory",map:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"projectID"},{in:"body",key:"force"},{in:"body",key:"workspaceID"},{in:"body",key:"parentID"},{in:"body",key:"slug"},{in:"body",key:"body_directory",map:"directory"},{in:"body",key:"title"},{in:"body",key:"version"},{in:"body",key:"shareURL"},{in:"body",key:"summary"},{in:"body",key:"revert"},{in:"body",key:"permission"},{in:"body",key:"timeCreated"},{in:"body",key:"timeUpdated"},{in:"body",key:"timeCompacting"},{in:"body",key:"timeArchived"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/session",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}message(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"sessionID"},{in:"body",key:"timeCreated"},{in:"body",key:"data"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/message",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}part(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"id"},{in:"body",key:"messageID"},{in:"body",key:"sessionID"},{in:"body",key:"timeCreated"},{in:"body",key:"data"}]}]);return(t?.client??this.client).post({url:"/kilocode/session-import/part",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class v3 extends bA{removeSkill(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"location"}]}]);return(t?.client??this.client).post({url:"/kilocode/skill/remove",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}removeAgent(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"name"}]}]);return(t?.client??this.client).post({url:"/kilocode/agent/remove",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}_heap;get heap(){return this._heap??=new k3({client:this.client})}_sessionImport;get sessionImport(){return this._sessionImport??=new b3({client:this.client})}}class M3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/network",...t,...n})}reply(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/network/{requestID}/reply",...t,...n})}reject(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/network/{requestID}/reject",...t,...n})}}class N3 extends bA{enable(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/remote/enable",...t,...n})}disable(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/remote/disable",...t,...n})}status(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/remote/status",...t,...n})}}class S3 extends bA{list(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).get({url:"/suggestion",...t,...n})}accept(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"index"}]}]);return(t?.client??this.client).post({url:"/suggestion/{requestID}/accept",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}dismiss(e,t){const n=H([e],[{args:[{in:"path",key:"requestID"},{in:"query",key:"directory"},{in:"query",key:"workspace"}]}]);return(t?.client??this.client).post({url:"/suggestion/{requestID}/dismiss",...t,...n})}}class L3 extends bA{capture(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"event"},{in:"body",key:"properties"}]}]);return(t?.client??this.client).post({url:"/telemetry/capture",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}setEnabled(e,t){const n=H([e],[{args:[{in:"query",key:"directory"},{in:"query",key:"workspace"},{in:"body",key:"enabled"}]}]);return(t?.client??this.client).post({url:"/telemetry/setEnabled",...t,...n,headers:{"Content-Type":"application/json",...t?.headers,...n.headers}})}}class N0 extends bA{static __registry=new yk;constructor(e){super(e),N0.__registry.set(this,e?.key)}_auth;get auth(){return this._auth??=new kk({client:this.client})}_app;get app(){return this._app??=new bk({client:this.client})}_global;get global(){return this._global??=new Mk({client:this.client})}_event;get event(){return this._event??=new Nk({client:this.client})}_config;get config(){return this._config??=new Sk({client:this.client})}_experimental;get experimental(){return this._experimental??=new Rk({client:this.client})}_tool;get tool(){return this._tool??=new Uk({client:this.client})}_worktree;get worktree(){return this._worktree??=new Ok({client:this.client})}_find;get find(){return this._find??=new Kk({client:this.client})}_file;get file(){return this._file??=new Tk({client:this.client})}_instance;get instance(){return this._instance??=new qk({client:this.client})}_path;get path(){return this._path??=new Jk({client:this.client})}_vcs;get vcs(){return this._vcs??=new Yk({client:this.client})}_command;get command(){return this._command??=new Pk({client:this.client})}_lsp;get lsp(){return this._lsp??=new Vk({client:this.client})}_formatter;get formatter(){return this._formatter??=new jk({client:this.client})}_mcp;get mcp(){return this._mcp??=new $k({client:this.client})}_project;get project(){return this._project??=new Wk({client:this.client})}_pty;get pty(){return this._pty??=new Zk({client:this.client})}_question;get question(){return this._question??=new Xk({client:this.client})}_permission;get permission(){return this._permission??=new A3({client:this.client})}_provider;get provider(){return this._provider??=new t3({client:this.client})}_session;get session(){return this._session??=new n3({client:this.client})}_part;get part(){return this._part??=new i3({client:this.client})}_sync;get sync(){return this._sync??=new o3({client:this.client})}_v2;get v2(){return this._v2??=new g3({client:this.client})}_tui;get tui(){return this._tui??=new B3({client:this.client})}_agentBuilder;get agentBuilder(){return this._agentBuilder??=new E3({client:this.client})}_backgroundProcess;get backgroundProcess(){return this._backgroundProcess??=new C3({client:this.client})}_commitMessage;get commitMessage(){return this._commitMessage??=new u3({client:this.client})}_enhancePrompt;get enhancePrompt(){return this._enhancePrompt??=new I3({client:this.client})}_indexing;get indexing(){return this._indexing??=new h3({client:this.client})}_kilo;get kilo(){return this._kilo??=new y3({client:this.client})}_kilocode;get kilocode(){return this._kilocode??=new v3({client:this.client})}_network;get network(){return this._network??=new M3({client:this.client})}_remote;get remote(){return this._remote??=new N3({client:this.client})}_suggestion;get suggestion(){return this._suggestion??=new S3({client:this.client})}_telemetry;get telemetry(){return this._telemetry??=new L3({client:this.client})}}function x3(A,e,t,n){if(!n?.throwOnError||A instanceof Error)return A;if(typeof A=="object"&&A!==null&&Object.keys(A).length>0){const r=A,o=typeof r.data?.message=="string"&&r.data.message||typeof r.message=="string"&&r.message||typeof r.name=="string"&&r.name||_d(t,e);return new Error(o,{cause:{body:A,status:e?.status}})}if(typeof A=="string"&&A.length>0)return new Error(A,{cause:{body:A,status:e?.status}});const i=e?"(empty response body)":"network error (no response)";return new Error(`kilo server ${_d(t,e)}: ${i}`,{cause:{body:A,status:e?.status}})}function _d(A,e){const t=A?.method??"?",n=A?.url??"?",i=e?.status,r=e?.statusText;return`${t} ${n}${i?" → "+i:""}${r?" "+r:""}`}function F3(A,e,t){if(A)return e&&(A===e||t&&A===t(e))?e:A}function G3(A,e){if(A.method!=="GET"&&A.method!=="HEAD")return A;const t=new URL(A.url);let n=!1;for(const[r,o]of[["x-kilo-directory","directory"],["x-kilo-workspace","workspace"]]){const s=F3(A.headers.get(r),o==="directory"?e.directory:e.workspace,o==="directory"?encodeURIComponent:void 0);s&&(t.searchParams.has(o)||t.searchParams.set(o,s),n=!0)}if(!n)return A;const i=new Request(t,A);return i.headers.delete("x-kilo-directory"),i.headers.delete("x-kilo-workspace"),i}function _3(A){A?.fetch||(A={...A,fetch:n=>fetch(n,{duplex:"half",timeout:!1})}),A?.directory&&(A.headers={...A.headers,"x-kilo-directory":encodeURIComponent(A.directory)}),A?.experimental_workspaceID&&(A.headers={...A.headers,"x-kilo-workspace":A.experimental_workspaceID}),A.duplex="half";const e=eI(A);return e.interceptors.request.use(t=>G3(t,{directory:A?.directory,workspace:A?.experimental_workspaceID})),e.interceptors.response.use(t=>{if(t.headers.get("content-type")==="text/html")throw new Error("Request is not supported by this version of OpenCode Server (Server responded with text/html)");return t}),e.interceptors.error.use(x3),new N0({client:e})}const R3=Array.from({length:20},(A,e)=>4097+e),U3=1440*60*1e3,S0="kilo.config.server",hr={},L0=window.fetch.bind(window);function O3(A){const e=new TextEncoder().encode(A);return btoa(String.fromCharCode(...e))}function Rd(A){return A?decodeURIComponent(A):""}function Va(A){const e=new URL(A),t=Rd(e.username)||"kilo",n=Rd(e.password)||"kilo";return e.username="",e.password="",e.search="",e.hash="",{url:e.toString().replace(/\/$/,""),token:O3(`${t}:${n}`)}}function ge(A){const e=Va(A.url);return _3({baseUrl:e.url,directory:x0(A.dir),headers:{Authorization:`Basic ${e.token}`},fetch:L0})}function x0(A){const e=A.trim();if(e)return e}function ea(A){return A instanceof Error?A.message:typeof A=="string"?A:A==null?"Unknown error":JSON.stringify(A)}function zA(A,e){if(e.error)throw new Error(`${A}: ${ea(e.error)}`);if(e.data===void 0)throw new Error(`${A}: empty response`);return e.data}async function K3(A){const t=(await ja(A)).find(n=>n.id===A.project);if(!t)throw new Error(`Project not found: ${A.project}`);return t}async function lt(A,e){return await e.then(t=>{if(t.error){console.warn(`${A}: ${ea(t.error)}`);return}return t.data}).catch(t=>{console.warn(`${A}: ${ea(t)}`)})}function T3(A){if(typeof A!="string")return;const e=A.indexOf("/");if(!(e<=0||e>=A.length-1))return{provider:A.slice(0,e),model:A.slice(e+1)}}function q3(A){return A.split("_").filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(" ")}function J3(A){return{keybinds:Object.entries(A.keybinds??{}).map(([e,t])=>({id:e,label:q3(e),group:"Configured",default:t??"none",description:"Configured TUI keybind"}))}}function ta(A){return A.replace(/\\/g,"/").replace(/\/+$/,"")||"/"}function H3(A,e){const t=ta(A),n=ta(e);return n===t?!0:n.startsWith(`${t}/`)}function nI(A){return A.id!=="global"?!0:ta(A.worktree)!=="/"}function Y3(A,e){return[A.worktree,...A.sandboxes].reduce((t,n)=>H3(n,e)?Math.max(t,ta(n).length):t,-1)}function P3(A,e){const t=A.find(n=>n.id===e.projectID);return t||A.reduce((n,i)=>{const r=Y3(i,e.directory);return r<=n.score?n:{item:i,score:r}},{score:-1}).item}async function iI(A){const e=new AbortController,t=window.setTimeout(()=>e.abort(),400),n=Va(A);return await L0(`${n.url}/global/health`,{headers:{Authorization:`Basic ${n.token}`},signal:e.signal}).then(i=>i.ok?A:void 0).catch(()=>{}).finally(()=>window.clearTimeout(t))}function V3(A){return Array.isArray(A)?A.filter(e=>{if(!e||typeof e!="object")return!1;const t=e;return typeof t.id=="string"&&typeof t.worktree=="string"&&typeof t.time?.updated=="number"}):[]}function j3(A){return A.reduce((e,t)=>Math.max(e,t.time.updated),0)}async function z3(A){if(!await iI(A))return;const t=new AbortController,n=window.setTimeout(()=>t.abort(),400),i=Va(A);return await L0(`${i.url}/project`,{headers:{Authorization:`Basic ${i.token}`},signal:t.signal}).then(async r=>{if(!r.ok)return{url:A,count:0,time:0};const o=V3(await r.json()).filter(nI);return{url:A,count:o.length,time:j3(o)}}).catch(()=>({url:A,count:0,time:0})).finally(()=>window.clearTimeout(n))}function Ud(A){return Number(new URL(A).port)||0}function Od(A){return new URL(A).hostname==="127.0.0.1"?1:0}function It(){return window.localStorage.getItem(S0)??""}function f1(A){window.localStorage.setItem(S0,A)}function Ar(){window.localStorage.removeItem(S0)}async function $3(A){return await iI(A)!==void 0}async function W3(){const A=R3.flatMap(t=>[`http://127.0.0.1:${t}`,`http://localhost:${t}`]);return(await Promise.all(A.map(z3))).filter(t=>t!==void 0).toSorted((t,n)=>n.count-t.count||n.time-t.time||Ud(n.url)-Ud(t.url)||Od(n.url)-Od(t.url))[0]?.url}async function er(){if(hr.run)return await hr.run;const A=W3().finally(()=>{hr.run===A&&(hr.run=void 0)});return hr.run=A,await A}async function vo(){const A=await er();if(A)return A;const e=It();if(e){if(await $3(e))return e;Ar()}}async function Z3(A){const e=ge(A),[t,n,i,r,o,s,a,l,g,c,Q,d]=await Promise.all([e.global.health(),e.config.overlay({scope:A.scope}),e.config.modelState(),e.provider.list(),e.provider.auth(),e.tui.config.get(),lt("TUI keybinds",e.tui.keybind.list()),e.tool.ids(),e.mcp.status(),e.lsp.status(),e.formatter.status(),e.app.agents()]),B=zA("Config overlay",n),C=T3(B.effective.model),f=C?await lt("Tool metadata",e.tool.list(C)):void 0,u=zA("TUI config",s);return{health:zA("Health",t),effective:B.effective,overlay:B,sources:{sources:B.sources},modelState:zA("Model state",i),providers:zA("Providers",r),authMethods:zA("Provider auth methods",o),tui:u,keybinds:a??J3(u),tools:zA("Tools",l),toolDetails:f??[],mcp:zA("MCP status",g),lsp:zA("LSP status",c),formatter:zA("Formatter status",Q),agents:zA("Agents",d)}}async function X3(A){return zA("Kilo embedding models",await ge(A).indexing.models())}async function rI(A){const e=ge(A),t=x0(A.dir),n=await e.project.list(t?{directory:t}:void 0);return zA("Projects",n)}async function ja(A){return(await rI(A)).filter(nI)}async function Ab(A){const e=ge(A),[t,n]=await Promise.all([ja(A),e.experimental.session.list({archived:!1,start:Date.now()-U3,limit:500})]),i=zA("Recent sessions",n),r=new Map;for(const o of i){const s=P3(t,o);s&&r.set(s.id,(r.get(s.id)??0)+1)}return t.map(o=>({...o,sessions:r.get(o.id)??0})).filter(o=>o.sessions>0)}async function eb(A){const e=await K3(A),t={url:A.url,dir:e.worktree},n=ge(t),[i,r,o]=await Promise.all([n.config.overlay({scope:"global"}),n.vcs.get({directory:t.dir}),n.worktree.list({directory:t.dir})]),s=zA("Worktrees",o),a=await Promise.all([t.dir,...s].map(l=>rb({url:A.url},l)));return{project:e,config:zA("Config",i).effective,vcs:zA("VCS",r),worktrees:s,terminals:a.flat()}}async function tb(A,e){const t=ge(A),n=e?.trim(),i=await t.worktree.create({directory:A.dir,...n?{worktreeCreateInput:{name:n}}:{}});return zA("Create worktree",i)}async function nb(A,e){const n=await ge(A).worktree.remove({directory:A.dir,worktreeRemoveInput:{directory:e}});return zA("Remove worktree",n)}async function ib(A,e){const n=await ge(A).worktree.reset({directory:A.dir,worktreeResetInput:{directory:e}});return zA("Reset worktree",n)}async function rb(A,e){const t=ge({url:A.url,dir:e}),[n,i,r,o]=await Promise.all([t.pty.list({directory:e}),lt("Session status",t.session.status({directory:e})),lt("Pending permissions",t.permission.list({directory:e})),lt("Pending questions",t.question.list({directory:e}))]),s=zA("Terminals",n),a=i??{},l=Kd(r??[]),g=Kd(o??[]),c=new Map;return await Promise.all(s.map(async Q=>{if(!Q.sessionID||c.has(Q.sessionID))return;const d=await lt("Session",t.session.get({directory:e,sessionID:Q.sessionID}));d&&c.set(Q.sessionID,d)})),s.map(Q=>{const d=Q.sessionID?c.get(Q.sessionID):void 0;return{...Q,directory:e,session:d,sessionStatus:Q.sessionID?a[Q.sessionID]:void 0,attention:Q.sessionID?ab(Q.sessionID,l,g):void 0}})}function oI(A){return new Set(A.flatMap(e=>e.sessionID?[e.sessionID]:[]))}function Kd(A){return new Set(A.map(e=>e.sessionID))}function Td(A,e){return A.some(t=>e.has(t.sessionID))}async function ob(A,e){const t=ge({url:A.url,dir:e}),[n,i,r,o]=await Promise.all([lt("Session status",t.session.status({directory:e})),lt("Terminals",t.pty.list({directory:e})),lt("Pending permissions",t.permission.list({directory:e})),lt("Pending questions",t.question.list({directory:e}))]),s=oI(i??[]),a=Object.entries(n??{}).some(([g,c])=>s.has(g)&&c.type!=="idle"),l=Td(r??[],s)||Td(o??[],s);return{busy:a,attention:l}}async function sb(A,e){const t=ge({url:A.url,dir:e}),n=await lt("Terminals",t.pty.list({directory:e}));return oI(n??[])}function ab(A,e,t){if(e.has(A))return"permission";if(t.has(A))return"question"}async function lb(A,e){const n=await ge({url:A.url,dir:e}).worktree.diffSummary({directory:e});return zA("Worktree diff",n)}async function gb(A,e,t){const i=await ge({url:A.url,dir:e}).worktree.diffFile({directory:e,file:t});return zA("Worktree diff file",i)}async function cb(A,e,t="Kilo session"){const i=await ge({url:A.url,dir:e}).pty.create({directory:e,command:"kilo",cwd:e,title:t});return zA("Create terminal",i)}async function Qb(A,e){const n=await ge({url:A.url,dir:A.dir}).pty.remove({directory:A.dir,ptyID:e});return zA("Remove terminal",n)}async function db(A,e,t){const i=await ge(A).session.viewed({directory:A.dir,focused:e,open:t});return zA("Viewed sessions",i)}function sI(A,e){const t=ge(A),n=new AbortController;return(async()=>{const i=await t.global.event({signal:n.signal,sseMaxRetryAttempts:0});for await(const r of i.stream){if(n.signal.aborted)return;e(r)}})().catch(i=>{n.signal.aborted||console.warn(`Project events: ${ea(i)}`)}),()=>n.abort()}async function Bb(A,e,t,n){const r=await ge({url:A.url,dir:A.dir}).pty.update({directory:A.dir,ptyID:e,size:{cols:t,rows:n}});return zA("Resize terminal",r)}function Eb(A,e,t=0){const n=Va(A.url),i=new URL(`/pty/${encodeURIComponent(e)}/connect`,n.url);return i.protocol=i.protocol==="https:"?"wss:":"ws:",i.searchParams.set("directory",A.dir),i.searchParams.set("cursor",String(t)),i.searchParams.set("auth_token",n.token),i.toString()}async function io(A,e,t){const n=ge(A),i=Object.keys(e).length?e:void 0,r=await n.config.overlayUpdate({directory:x0(A.dir),scope:A.scope,set:i,unset:t});return zA("Update config",r)}async function Cb(A,e){return io(A,e)}async function ub(A,e){return io(A,{},e)}async function Ib(A,e){const n=await ge(A).config.modelStateUpdate({favorite:e});return zA("Update model state",n)}async function hb(A,e,t,n){const i=ge(A),r=n?{type:"api",key:t,metadata:n}:{type:"api",key:t},o=await i.auth.set({providerID:e,auth:r});zA("Connect provider",o),await i.global.dispose()}async function fb(A,e,t,n){const r=await ge(A).provider.oauth.authorize({providerID:e,method:t,inputs:n});return zA("Authorize provider",r)}async function pb(A,e,t,n){const i=ge(A),r=await i.provider.oauth.callback({providerID:e,method:t,code:n});zA("Complete provider authorization",r),await i.global.dispose()}async function mb(A,e){const n=await ge(A).mcp.connect({name:e});return zA("Connect MCP server",n)}async function wb(A,e){const n=await ge(A).mcp.disconnect({name:e});return zA("Disconnect MCP server",n)}async function Db(A,e){const n=await ge(A).mcp.auth.authenticate({name:e});return zA("Authenticate MCP server",n)}async function yb(A,e){const n=await ge(A).tui.config.update({scope:A.scope,...e});return zA("Update TUI config",n)}async function kb(A,e){const n=await ge(A).agentBuilder.preview(e);return zA("Preview agent",n)}async function bb(A,e){const n=await ge(A).agentBuilder.save({path_id:e.id,scope:e.scope,description:e.description,mode:e.mode,model:e.model,color:e.color,steps:e.steps,tools:e.tools,permission:e.permission,prompt:e.prompt});return zA("Save agent",n)}function vb(A){return!A||A==="normal"?"default":A==="small"?"sm":A==="large"?"lg":A}function Mb(A){return!A||A==="default"?"primary":A}function IA(A){const[e,t]=uA(A,["variant","size","icon","class","classList","children"]);return E(bo,lA(t,{"data-component":"button",get"data-size"(){return vb(e.size)},get"data-variant"(){return Mb(e.variant)},get"data-icon"(){return e.icon?"inline-start":void 0},get classList(){return{...e.classList,[e.class??""]:!!e.class}},get children(){return[E(Y,{get when(){return e.icon},children:n=>E(Vt,{get name(){return n()},size:"small"})}),MA(()=>e.children)]}}))}function Nb(A,e){const t=Object.fromEntries(Object.entries(e).filter(n=>n[1]!==void 0));if(typeof A=="string"){const n=Object.entries(t).map(i=>`${i[0]}:${i[1]}`).join(";");return n?`${A};${n}`:A}return{...A??{},...t}}var Sb=b("<div>");function ue(A){const[e,t]=uA(A,["variant","size","padding","style","class","classList","children"]),n=()=>typeof e.padding=="number"?`${e.padding}px`:e.padding;return(()=>{var i=Sb();return p1(i,lA(t,{"data-component":"card",get"data-variant"(){return e.variant??"normal"},get"data-size"(){return e.size??"default"},get style(){return Nb(e.style,{"--kw-card-padding":n()})},get classList(){return{...e.classList,[e.class??""]:!!e.class}}}),!1,!0),p(i,()=>e.children),i})()}var Lb=b("<span>");function aI(A){const[e,t]=uA(A,["size","tone","class","classList","children"]);return(()=>{var n=Lb();return p1(n,lA(t,{"data-component":"tag",get"data-size"(){return e.size??"normal"},get"data-tone"(){return e.tone??"neutral"},get classList(){return{...e.classList,[e.class??""]:!!e.class}}}),!1,!0),p(n,()=>e.children),n})()}var xb=b("<span data-slot=status-dot aria-hidden=true>"),Fb=b("<p>"),Gb=b("<section data-component=section-title><div><h2>"),_b=b("<div data-component=banner role=alert><div><span>"),Rb=b("<strong>"),Ub=b("<span data-slot=config-row-accent>"),Ob=b("<div data-slot=config-row-body><div data-slot=config-row-title>"),Kb=b("<div data-slot=config-row-trailing>"),Tb=b("<div data-slot=config-row-leading>"),qb=b("<div data-slot=config-row-subtitle>"),Jb=b("<div data-slot=config-row-actions>"),Hb=b("<a data-component=config-row>"),Yb=b("<button type=button data-component=config-row>"),Pb=b("<div data-component=config-row>");function Ae(A){return E(aI,lA(A,{"data-slot":"config-tag"}))}function Se(A){return E(Ae,lA(A,{tone:"neutral"}))}function lI(A){return A.source==="project"||A.source==="local override"?"project":A.source==="global"||A.source==="inherited"?"global":A.overridden?"project":A.inherited?"global":"default"}function gI(A){return(()=>{var e=xb();return V(()=>W(e,"data-tone",A.tone)),e})()}function ro(A){const e=()=>["connected","healthy","running"].includes(A.status)?{tone:"success",label:A.status==="healthy"?"Healthy":A.status==="running"?"Running":"Connected"}:["failed","error","unhealthy"].includes(A.status)?{tone:"critical",label:A.status==="unhealthy"?"Unhealthy":A.status==="failed"?"Failed":"Error"}:A.status==="stopped"?{tone:"neutral",label:"Stopped"}:{tone:"neutral",label:A.status||"Unknown"};return E(Ae,{get tone(){return e().tone},class:"kw-status-tag",get children(){return[E(gI,{get tone(){return MA(()=>e().tone==="critical")()?"critical":e().tone==="success"?"success":"neutral"}}),MA(()=>e().label)]}})}function cI(A){const e=()=>lI(A),t=()=>e().toUpperCase();return E(Ae,{class:"mono",get tone(){return e()==="project"?"info":"neutral"},get children(){return t()}})}function Bt(A){return(()=>{var e=Gb(),t=e.firstChild,n=t.firstChild;return p(n,()=>A.children),p(t,()=>A.trailing,null),p(e,E(Y,{get when(){return A.description},children:i=>(()=>{var r=Fb();return p(r,i),r})()}),null),e})()}function Vb(A){const e=()=>A.tone==="critical"||A.tone==="warning"?"warning":A.tone==="success"?"circle-check":"help";return(()=>{var t=_b(),n=t.firstChild,i=n.firstChild;return p(t,E(Vt,{get name(){return e()},size:"small"}),n),p(n,E(Y,{get when(){return A.title},children:r=>(()=>{var o=Rb();return p(o,r),o})()}),i),p(i,()=>A.children),p(t,()=>A.action,null),V(()=>W(t,"data-tone",A.tone??"info")),t})()}function S1(A){const e=()=>lI({source:A.source})==="project"||A.highlightOverride,t=()=>[E(Y,{get when(){return e()},get children(){return Ub()}}),E(Y,{get when(){return A.leading},children:n=>(()=>{var i=Tb();return p(i,n),i})()}),(()=>{var n=Ob(),i=n.firstChild;return p(i,()=>A.title),p(n,E(Y,{get when(){return A.subtitle},children:r=>(()=>{var o=qb();return p(o,r),o})()}),null),n})(),(()=>{var n=Kb();return p(n,E(Y,{get when(){return A.source!==void 0},get children(){return E(cI,{get source(){return A.source}})}}),null),p(n,()=>A.status,null),p(n,E(Y,{get when(){return A.actions},children:i=>(()=>{var r=Jb();return p(r,i),r})()}),null),n})()];return A.href?(()=>{var n=Hb();return p(n,t),V(i=>{var r=e()||void 0,o=A.href;return r!==i.e&&W(n,"data-override",i.e=r),o!==i.t&&W(n,"href",i.t=o),i},{e:void 0,t:void 0}),n})():A.onClick?(()=>{var n=Yb();return RA(n,"click",A.onClick,!0),p(n,t),V(()=>W(n,"data-override",e()||void 0)),n})():(()=>{var n=Pb();return p(n,t),V(()=>W(n,"data-override",e()||void 0)),n})()}pe(["click"]);var jb=b("<details><summary></summary><div class=models-select-menu role=listbox>"),zb=b("<button class=models-select-option type=button role=option>");function gt(A){const e=()=>A.options.find(i=>i.value===A.value)?.label??A.value;function t(i,r){A.disabled||i.disabled||(A.onSelect(i.value),r.currentTarget.closest("details")?.removeAttribute("open"))}function n(i){if(A.disabled){i.currentTarget.removeAttribute("open");return}i.currentTarget.open&&i.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(r=>{r!==i.currentTarget&&r.removeAttribute("open")})}return(()=>{var i=jb(),r=i.firstChild,o=r.nextSibling;return i.addEventListener("toggle",n),p(r,e),p(o,E(kA,{get each(){return A.options},children:s=>(()=>{var a=zb();return a.$$click=l=>t(s,l),p(a,()=>s.label),V(l=>{var g=s.value===A.value,c=!!s.disabled,Q=s.value===A.value,d=A.disabled||s.disabled;return g!==l.e&&a.classList.toggle("selected",l.e=g),c!==l.t&&a.classList.toggle("disabled",l.t=c),Q!==l.a&&W(a,"aria-selected",l.a=Q),d!==l.o&&(a.disabled=l.o=d),l},{e:void 0,t:void 0,a:void 0,o:void 0}),a})()})),V(s=>{var a=`models-select ${A.class??""}`,l=!!A.disabled,g=!!A.invalid,c=A.label,Q=A.disabled,d=A.label;return a!==s.e&&Ri(i,s.e=a),l!==s.t&&i.classList.toggle("disabled",s.t=l),g!==s.a&&i.classList.toggle("invalid",s.a=g),c!==s.o&&W(r,"aria-label",s.o=c),Q!==s.i&&W(r,"aria-disabled",s.i=Q),d!==s.n&&W(o,"aria-label",s.n=d),s},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),i})()}pe(["click"]);var $b=b("<label data-component=search-field><span data-slot=search-label></span><input>");function W1(A){const[e,t]=uA(A,["label","value","variant","hideLabel","inputClass","class","classList","onValue"]);return(()=>{var n=$b(),i=n.firstChild,r=i.nextSibling;return p(i,()=>e.label),p1(r,lA(t,{get class(){return e.inputClass},type:"search",get value(){return e.value},get"aria-label"(){return MA(()=>e.hideLabel===!1)()?void 0:e.label},onInput:o=>e.onValue(o.currentTarget.value)}),!1,!1),V(o=>{var s=e.variant??"list",a=e.hideLabel===!1?"visible":"hidden",l={...e.classList,[e.class??""]:!!e.class};return s!==o.e&&W(n,"data-variant",o.e=s),a!==o.t&&W(n,"data-label",o.t=a),o.a=Cn(n,l,o.a),o},{e:void 0,t:void 0,a:void 0}),n})()}const QI=De();function $e(){const A=fe(QI);if(!A)throw new Error("useConfig must be used within ConfigLayout");return A}function F0(){return"/console/".replace(/\/$/,"")}function Mo(A,e=F0()){return!e||e==="/"?A:A===e?"/":A.startsWith(`${e}/`)?A.slice(e.length):A}function dI(A,e=F0()){const t=Mo(A,e),n=t.indexOf("/settings");return n>0?`${t.slice(0,n)}/settings`:t.startsWith("/config")?"/config":"/settings"}function Wb(A,e=F0()){const t=Mo(A,e);return t==="/profile"?"/profile":t.startsWith("/settings")||t.startsWith("/config")?"/settings":t.startsWith("/projects/")?"/project":"/projects"}const Zb={apply_patch:"Apply Patch",bash:"Bash",edit:"Edit File",glob:"Find Files",grep:"Search Content",lsp:"Language Server",question:"Ask User",read:"Read File",recall:"Local Recall",skill:"Load Skill",task:"Subagent Task",todowrite:"Todo List",webfetch:"Fetch URL",websearch:"Web Search",write:"Write File"},Xb={apply_patch:["Apply structured patches to add, update, move, or delete files.","Keeps edits explicit and easy to review."],bash:["Run shell commands in the current workspace.","Supports timeouts, working directories, and command descriptions."],edit:["Replace exact text inside an existing file.","Can update one match or all matches when needed."],glob:["Find files by path patterns.","Useful for locating files before reading or editing them."],grep:["Search file contents with regular expressions.","Can limit results to a file pattern such as TypeScript or CSS files."],lsp:["Use language-server features for code navigation.","Supports operations such as definitions, references, and diagnostics."],question:["Ask the user for a decision during execution.","Supports single-choice and multi-choice prompts."],read:["Read files, directories, images, and PDFs from the workspace.","Supports line offsets and limits for large files."],recall:["Search and read previous project conversations.","Useful for recovering prior decisions or implementation context."],skill:["Load task-specific instructions and workflows.","Applies specialized repo guidance when a matching skill exists."],task:["Delegate focused exploration or implementation work to a subagent.","Useful for parallel codebase research and complex subtasks."],todowrite:["Track multi-step implementation work.","Shows progress with pending, in-progress, and completed states."],webfetch:["Fetch and convert web pages for analysis.","Supports markdown, text, and HTML output formats."],websearch:["Search the web for external information.","Supports fast, automatic, and deep search modes."],write:["Create or overwrite files with complete contents.","Best for new files or full-file replacements."]},A8=new Set(["api","html","id","json","lsp","mcp","pdf","url"]);function HA(A){return A.trim()}function Tn(A){return A==null||A===""?"Not set":typeof A=="string"?A:typeof A=="number"||typeof A=="boolean"?String(A):JSON.stringify(A)??"Unserializable value"}function BI(A){return[...A].sort((e,t)=>e.localeCompare(t))}function Qc(A){return A.split(/\s+/).map(e=>e.trim()).filter(Boolean)}function F1(A){return A.trim().split(/[\s._/-]+/).filter(Boolean).map(e=>/^[A-Z0-9]+$/.test(e)&&e.length<=4?e:`${e[0]?.toUpperCase()??""}${e.slice(1).toLowerCase()}`).join(" ")}function e8(A){const e=A.toLowerCase();return A8.has(e)?e.toUpperCase():A.charAt(0).toUpperCase()+A.slice(1)}function qd(A){return A.length<=180?A:`${A.slice(0,177)}...`}function t8(A){const e=A.replace(/```[\s\S]*?```/g," ").replace(/[*`#>_-]+/g," ").replace(/\s+/g," ").trim(),t=e.split(/(?:\.|\?|!)\s+/).map(n=>n.trim()).filter(Boolean).slice(0,2);return t.length?t.map(qd):e?[qd(e)]:[]}function bt(A){const e=Zb[A];if(e)return e;const t=A.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[._:/-]+/g," ").replace(/\s+/g," ").trim();return t?t.split(" ").map(e8).join(" "):A}function G0(A){const e=Xb[A.id];if(e)return e;const t=A.detail?.description.trim();return t?t8(t):["No capability description is available for this tool."]}function Ki(A){return A.split(",").map(e=>e.trim()).filter(Boolean)}function Jd(A){return!A||typeof A!="object"||Array.isArray(A)?0:Object.keys(A).length}function Q1(A){return A instanceof Error?A.message:typeof A=="string"?A:Tn(A)}function n8(A){return A==="subagent"?"subagent":A==="all"?"all":"primary"}var i8=b("<main class=config-page><section class=config-page-header><div><h1>"),r8=b("<p>"),o8=b("<div class=config-page-actions>"),s8=b("<section class=config-toolbar>"),a8=b("<div class=config-toolbar-controls>"),l8=b("<div class=config-toolbar-meta>");function We(A){return(()=>{var e=i8(),t=e.firstChild,n=t.firstChild,i=n.firstChild;return p(i,()=>A.title),p(n,E(Y,{get when(){return A.description},children:r=>(()=>{var o=r8();return p(o,r),o})()}),null),p(t,E(Y,{get when(){return A.actions},children:r=>(()=>{var o=o8();return p(o,r),o})()}),null),p(e,()=>A.children,null),e})()}function EI(A){return E(Y,{get when(){return A.children||A.meta},get children(){var e=s8();return p(e,E(Y,{get when(){return A.children},children:t=>(()=>{var n=a8();return p(n,t),n})()}),null),p(e,E(Y,{get when(){return A.meta},children:t=>(()=>{var n=l8();return p(n,t),n})()}),null),e}})}function Ve(A){return E(cI,A)}const CI=[{value:"ask",label:"Ask"},{value:"allow",label:"Allow"},{value:"deny",label:"Deny"}],jt=[{id:"external_directory",title:"External Directory",description:"Access files outside the project directory.",noun:"path",placeholder:"e.g. ~/Downloads/**"},{id:"bash",title:"Bash",description:"Run shell commands.",noun:"command",placeholder:"e.g. git status or npm *"},{id:"read",title:"Read",description:"Read files by matching file paths.",noun:"path",placeholder:"e.g. **/*.env"},{id:"edit",title:"Edit",description:"Modify files, including writes, patches, and multi-edits.",noun:"path",placeholder:"e.g. src/**/*.ts"}],_0=[{id:"glob",title:"Glob",description:"Match files using glob patterns."},{id:"grep",title:"Grep",description:"Search file contents using regular expressions."},{id:"list",title:"List",description:"List files within a directory."},{id:"task",title:"Task",description:"Launch sub-agents."},{id:"skill",title:"Skill",description:"Load a skill by name."},{id:"lsp",title:"LSP",description:"Run language server queries."},{id:"todowrite",title:"Todo Write",description:"Update the todo list."},{id:"question",title:"Question",description:"Ask the user a question."},{id:"webfetch",title:"Web Fetch",description:"Fetch content from a URL."},{id:"websearch",title:"Web Search",description:"Search the web."},{id:"doom_loop",title:"Doom Loop",description:"Detect repeated tool calls with identical input."},{id:"agent_manager",title:"Agent Manager",description:"Manage Agent Manager operations."}],uI=[...jt,..._0],g8=new Set(jt.map(A=>A.id)),c8=new Set(uI.map(A=>A.id));function R0(A,e="ask"){return A==="ask"||A==="allow"||A==="deny"?A:e}function za(A){return A&&typeof A=="object"&&!Array.isArray(A)?A:{}}function II(A){return za(A.effective.permission)}function U0(A,e){return A.overlay.collections.permission?.find(t=>t.key===e)}function hI(A,e){return typeof A.effective.permission=="string"?A.effective.permission:II(A)[e]}function fI(A){return R0(A.effective.permission)}function Q8(A,e){return A?e==="*"&&typeof A.value=="string"?A.path:[...A.path,e]:["permission",e]}function oo(A,e,t,n){if(!(t!=="ask"&&t!=="allow"&&t!=="deny"))return{tool:A,pattern:e,action:t,source:n?.source??"default",inherited:n?.inherited??!1,overridden:n?.overridden??!1,path:n?Q8(n,e):["permission",A,e]}}function d8(A){const e=A.value;if(e&&typeof e=="object"&&!Array.isArray(e))return Object.entries(e).flatMap(([n,i])=>oo(A.key,n,i,A)??[]);const t=oo(A.key,"*",e,A);return t?[t]:[]}function B8(A,e,t){const n=za(e);if(Object.keys(n).length)return Object.entries(n).flatMap(([r,o])=>oo(A,r,o,t)??[]);const i=oo(A,"*",e,t);return i?[i]:[]}function E8(A,e){const t=U0(A,e.id),n=hI(A,e.id),i=za(n),r=fI(A);return{...e,action:R0(typeof n=="string"?n:i["*"],r),source:t?.source??"default",inherited:t?.inherited??!1,overridden:t?.overridden??!1}}function C8(A,e){const t=U0(A,e.id),n=hI(A,e.id),i=za(n),r=fI(A);return{...e,action:R0(typeof n=="string"?n:i["*"],r),source:t?.source??"default",inherited:t?.inherited??!1,overridden:t?.overridden??!1,rules:Object.entries(i).filter(([o])=>o!=="*").flatMap(([o,s])=>oo(e.id,o,s,t)??[])}}function u8(){const A=$e(),e=()=>A.data(),[t,n]=U("closed"),[i,r]=U("external_directory"),[o,s]=U(""),[a,l]=U("ask"),g=G(()=>(e()?.overlay.collections.permission??[]).flatMap(d8)),c=G(()=>{const w=e();return w?jt.map(m=>C8(w,m)):[]}),Q=G(()=>{const w=e();return w?_0.map(m=>E8(w,m)):[]}),d=G(()=>{const w=e();return w?Object.entries(II(w)).filter(([m])=>!c8.has(m)).flatMap(([m,D])=>B8(m,D,U0(w,m))).sort((m,D)=>m.tool.localeCompare(D.tool)||m.pattern.localeCompare(D.pattern)):[]}),B=G(()=>jt.find(w=>w.id===i())??jt[0]);function C(w){r(w),s(""),l("ask"),n("rule")}function f(){n("closed")}function u(){const w=e(),m=HA(o());if(!w||!m){A.fail(`Enter a ${B().noun} pattern before saving.`);return}const D={[i()]:{[m]:a()}};A.save({permission:D}),f()}function I(w,m){const D=g8.has(w)?{[w]:{"*":m}}:{[w]:m};A.save({permission:D})}function h(w){A.unset([w.path])}return{ctx:A,mode:t,kind:i,pattern:o,setPattern:s,action:a,setAction:l,rules:g,groups:c,settings:Q,other:d,selected:B,open:C,close:f,add:u,setDefault:I,remove:h}}var dc=b("<div class=permission-row-meta>"),I8=b('<details class="models-select permission-select"><summary></summary><div class=models-select-menu role=listbox>'),h8=b("<button class=models-select-option type=button role=option>"),f8=b("<section class=permission-group><div class=permission-rules>"),p8=b("<div class=permissions><section class=permission-group><div class=permission-rules>"),m8=b("<div class=drawer-scrim>"),w8=b('<aside class="provider-drawer permission-drawer"aria-label="Permission rule configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form permission-form"><label class="required-field wide"><input></label><label class="required-field wide">Method</label></div><footer class=drawer-footer>'),D8=b("<span class=config-title-count>Permissions"),y8=b("<section class=permission-group><header class=permission-group-header><div class=permission-group-copy><h2></h2><span></span><p></p></div><div class=permission-section-actions></div></header><div class=permission-rules>"),k8=b("<p class=permission-empty>No specific <!> rules."),b8=b("<span class=permission-pattern>"),v8=b("<span class=permission-subtitle><span></span><span class=permission-pattern>");function pI(A){return A==="allow"?"success":A==="deny"?"critical":"warning"}function O0(A){return CI.find(e=>e.value===A)?.label??A}function Hd(A){return(()=>{var e=dc();return p(e,E(Ae,{get tone(){return pI(A.rule.action)},get children(){return O0(A.rule.action)}}),null),p(e,E(Ve,{get source(){return A.rule.source},get inherited(){return A.rule.inherited},get overridden(){return A.rule.overridden}}),null),e})()}function Ti(A){const e=()=>O0(A.value);function t(i,r){A.disabled||(A.onSelect(i),r.currentTarget.closest("details")?.removeAttribute("open"))}function n(i){if(A.disabled){i.currentTarget.removeAttribute("open");return}i.currentTarget.open&&i.currentTarget.parentElement?.querySelectorAll(".models-select[open]").forEach(r=>{r!==i.currentTarget&&r.removeAttribute("open")})}return(()=>{var i=I8(),r=i.firstChild,o=r.nextSibling;return i.addEventListener("toggle",n),p(r,e),p(o,E(kA,{each:CI,children:s=>(()=>{var a=h8();return a.$$click=l=>t(s.value,l),p(a,()=>s.label),V(l=>{var g=s.value===A.value,c=s.value===A.value;return g!==l.e&&a.classList.toggle("selected",l.e=g),c!==l.t&&W(a,"aria-selected",l.t=c),l},{e:void 0,t:void 0}),a})()})),V(s=>{var a=!!A.disabled,l=A.label,g=A.disabled,c=A.label;return a!==s.e&&i.classList.toggle("disabled",s.e=a),l!==s.t&&W(r,"aria-label",s.t=l),g!==s.a&&W(r,"aria-disabled",s.a=g),c!==s.o&&W(o,"aria-label",s.o=c),s},{e:void 0,t:void 0,a:void 0,o:void 0}),i})()}function M8(){const A=u8();return E(We,{get title(){return(()=>{var e=D8();return e.firstChild,p(e,E(Se,{get children(){return A.groups().length+A.settings().length}}),null),e})()},description:"Control what tools agents can use by default and add pattern-specific allow, ask, or deny rules.",get children(){return[(()=>{var e=p8(),t=e.firstChild,n=t.firstChild;return p(e,E(kA,{get each(){return A.groups()},children:i=>(()=>{var r=y8(),o=r.firstChild,s=o.firstChild,a=s.firstChild,l=a.nextSibling,g=l.nextSibling,c=s.nextSibling,Q=o.nextSibling;return p(a,()=>i.title),p(l,()=>i.id),p(g,()=>i.description),p(c,E(Se,{get children(){return i.rules.length}}),null),p(c,E(IA,{icon:"plus",variant:"primary",get disabled(){return!!A.ctx.saving()},onClick:()=>A.open(i.id),children:"Add rule"}),null),p(r,E(S1,{title:"Default method",get subtitle(){return`Used for ${i.noun}s that do not match a specific rule.`},get status(){return(()=>{var d=dc();return p(d,E(Ve,{get source(){return i.source},get inherited(){return i.inherited},get overridden(){return i.overridden}})),d})()},get actions(){return E(Ti,{get label(){return`Default method for ${i.title}`},get value(){return i.action},get disabled(){return!!A.ctx.saving()},onSelect:d=>A.setDefault(i.id,d)})}}),Q),p(Q,E(Y,{get when(){return i.rules.length},get fallback(){return(()=>{var d=k8(),B=d.firstChild,C=B.nextSibling;return C.nextSibling,p(d,()=>i.noun,C),d})()},get children(){return E(kA,{get each(){return i.rules},children:d=>E(S1,{get title(){return(()=>{var B=b8();return p(B,()=>d.pattern),B})()},get subtitle(){return`${i.title} ${i.noun} rule`},get status(){return E(Hd,{rule:d})},get actions(){return E(Te,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${i.title} rule ${d.pattern}`},get disabled(){return!!A.ctx.saving()},onClick:()=>A.remove(d)})}})})}})),r})()}),t),p(t,E(Bt,{get trailing(){return E(Se,{get children(){return A.settings().length}})},description:"Default methods for additional built-in tool permissions.",children:"Tool Defaults"}),n),p(n,E(kA,{get each(){return A.settings()},children:i=>E(S1,{get title(){return i.title},get subtitle(){return`${i.id} · ${i.description}`},get status(){return(()=>{var r=dc();return p(r,E(Ve,{get source(){return i.source},get inherited(){return i.inherited},get overridden(){return i.overridden}})),r})()},get actions(){return E(Ti,{get label(){return`Default method for ${i.title}`},get value(){return i.action},get disabled(){return!!A.ctx.saving()},onSelect:r=>A.setDefault(i.id,r)})}})})),p(e,E(Y,{get when(){return A.other().length},get children(){var i=f8(),r=i.firstChild;return p(i,E(Bt,{get trailing(){return E(Se,{get children(){return A.other().length}})},description:"Additional tool permission rules from config.",children:"Other Permissions"}),r),p(r,E(kA,{get each(){return A.other()},children:o=>E(S1,{get title(){return bt(o.tool)},get subtitle(){return(()=>{var s=v8(),a=s.firstChild,l=a.nextSibling;return p(a,()=>o.tool),p(l,()=>o.pattern),s})()},get status(){return E(Hd,{rule:o})},get actions(){return E(Te,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${o.tool} rule ${o.pattern}`},get disabled(){return!!A.ctx.saving()},onClick:()=>A.remove(o)})}})})),i}}),null),e})(),E(Y,{get when(){return A.mode()==="rule"},get children(){return[(()=>{var e=m8();return RA(e,"click",A.close,!0),e})(),(()=>{var e=w8(),t=e.firstChild,n=t.firstChild,i=n.firstChild,r=i.nextSibling,o=t.nextSibling,s=o.firstChild,a=s.firstChild,l=s.nextSibling;l.firstChild;var g=o.nextSibling;return p(i,()=>`Add ${A.selected().title} Rule`),p(r,()=>`${A.selected().id} · ${A.selected().description}`),p(t,E(IA,{variant:"ghost","aria-label":"Close permission rule overlay",get onClick(){return A.close},children:"X"}),null),p(s,()=>A.selected().noun==="command"?"Command pattern":"Path pattern",a),a.$$input=c=>A.setPattern(c.currentTarget.value),W(a,"spellcheck",!1),p(l,E(Ti,{label:"Rule method",get value(){return A.action()},get disabled(){return!!A.ctx.saving()},get onSelect(){return A.setAction}}),null),p(g,E(IA,{variant:"ghost",get onClick(){return A.close},children:"Cancel"}),null),p(g,E(IA,{variant:"primary",get disabled(){return!!A.ctx.saving()},get onClick(){return A.add},children:"Save Rule"}),null),V(()=>W(a,"placeholder",A.selected().placeholder)),V(()=>a.value=A.pattern()),e})()]}})]}})}pe(["click","input"]);const N8=["Review the current diff and report risks, regressions, and missing tests.","Plan the work in small steps, then implement the smallest correct change.","Inspect relevant files first, then summarize the root cause before editing.","Run the smallest relevant validation checks and report any remaining failures."];function S8(A,e){return A.id==="kilo"?-1:e.id==="kilo"?1:A.name.localeCompare(e.name)}function L8(A,e){return A.provider.id===e.providerID&&A.model.id===e.modelID?!0:A.model.providerID===e.providerID&&A.model.id===e.modelID}function Yl(A){const e=HA(A);if(e)return e}function x8(A){const e=Number(A);if(Number.isInteger(e)&&e>0)return e}function Tt(A){return A&&typeof A=="object"&&!Array.isArray(A)?A:{}}function dn(A){return typeof A=="string"?A:""}function F8(A){if(typeof A=="number"&&Number.isFinite(A))return A}function Yd(A,e="ask"){return A==="allow"||A==="deny"||A==="ask"?A:e}function Bc(A,e,t){if(!(t!=="allow"&&t!=="deny"&&t!=="ask"))return{tool:A,pattern:e,action:t}}function Pd(A,e){const t=Tt(e);if(Object.keys(t).length)return Object.entries(t).flatMap(([i,r])=>Bc(A,i,r)??[]);const n=Bc(A,"*",e);return n?[n]:[]}const G8=new Set(jt.map(A=>A.id)),_8=new Set(uI.map(A=>A.id));function R8(A){const e=A.options.source;if(typeof e=="string")return e}function U8(A){const e=Object.entries(O8(A));return{tools:BI(e.filter(([,t])=>t==="allow").map(([t])=>t)),permission:Object.fromEntries(e.filter(([,t])=>t!=="allow"))}}function O8(A){return Array.isArray(A)?A.reduce((e,t)=>{const n=Tt(t),i=dn(n.permission),r=dn(n.action);if(!i||!r)return e;const o=dn(n.pattern)||"*";if(o==="*")return{...e,[i]:r};const s=e[i],a=s&&typeof s=="object"&&!Array.isArray(s)?s:{};return{...e,[i]:{...a,[o]:r}}},{}):Tt(A)}function K8(A,e){return(A.overlay.collections.agent??[]).find(t=>t.key===e)}function fr(A){return A.displayName??F1(A.name)}function T8(A){return A.model?`${A.model.providerID}/${A.model.modelID}`:""}function Ec(A,e){return!(A.native||e?.inherited||e?.editable===!1||R8(A)==="organization")}function q8(A){const e=$e(),t=()=>e.data(),n=G(()=>e.query()?.scope??"project"),[i,r]=U(),[o,s]=U(!0),[a,l]=U(!1),[g,c]=U("reviewer"),[Q,d]=U(""),[B,C]=U("subagent"),[f,u]=U(""),[I,h]=U(""),[w,m]=U(""),[D,N]=U([]),[y,k]=U(""),[_,F]=U("external_directory"),[L,M]=U(""),[S,T]=U("ask"),[R,P]=U({}),[X,z]=U(),[iA,BA]=U("closed"),[nA,hA]=U(""),[J,K]=U(""),[$,oA]=U(""),[AA,gA]=U([]),j=G(()=>{const tA=t();if(!tA)return[];const EA=new Set([...Object.keys(tA.effective.provider??{}),...tA.providers.connected]);return tA.providers.all.filter(wA=>EA.has(wA.id)).filter(wA=>Object.keys(wA.models).length>0).sort(S8)}),Z=G(()=>j().flatMap(tA=>Object.values(tA.models).map(EA=>({id:`${tA.id}/${EA.id}`,provider:tA,model:EA})))),dA=G(()=>t()?.modelState.favorite??[]),aA=tA=>dA().some(EA=>L8(tA,EA)),v=G(()=>{const tA=nA().trim().toLowerCase();return Z().filter(EA=>tA?`${EA.id} ${EA.model.name} ${EA.provider.name}`.toLowerCase().includes(tA):!0).sort((EA,wA)=>{const jA=Number(aA(wA))-Number(aA(EA));if(jA!==0)return jA;const Ee=EA.model.name.localeCompare(wA.model.name);if(Ee!==0)return Ee;const ee=EA.provider.name.localeCompare(wA.provider.name);return ee!==0?ee:EA.id.localeCompare(wA.id)})}),yA=tA=>{if(typeof tA=="string")return Z().find(EA=>EA.id===tA||`${EA.model.providerID}/${EA.model.id}`===tA)},NA=G(()=>yA(f())),vA=G(()=>{const tA=t();if(!tA)return[];const EA=$().trim().toLowerCase(),wA=new Map(tA.toolDetails.map(jA=>[jA.id,jA]));return tA.tools.map(jA=>({id:jA,detail:wA.get(jA)})).filter(jA=>EA?`${jA.id} ${bt(jA.id)} ${G0(jA).join(" ")}`.toLowerCase().includes(EA):!0).sort((jA,Ee)=>bt(jA.id).localeCompare(bt(Ee.id)))}),pA=G(()=>new Set(AA())),SA=G(()=>Object.entries(R()).flatMap(([tA,EA])=>Pd(tA,EA))),_A=G(()=>jt.map(tA=>{const EA=R()[tA.id],wA=Tt(EA);return{...tA,action:Yd(typeof EA=="string"?EA:wA["*"]),rules:Object.entries(wA).filter(([jA])=>jA!=="*").flatMap(([jA,Ee])=>Bc(tA.id,jA,Ee)??[])}})),se=G(()=>_0.map(tA=>{const EA=R()[tA.id],wA=Tt(EA);return{...tA,action:Yd(typeof EA=="string"?EA:wA["*"])}})),ae=G(()=>Object.entries(R()).filter(([tA])=>!_8.has(tA)).flatMap(([tA,EA])=>Pd(tA,EA)).sort((tA,EA)=>tA.tool.localeCompare(EA.tool)||tA.pattern.localeCompare(EA.pattern))),LA=G(()=>jt.find(tA=>tA.id===_())??jt[0]);function KA(tA="reviewer"){c(tA),d(""),C("subagent"),u(""),h(""),m(""),N([]),k(""),P({}),z(void 0),l(!1),BA("closed"),F("external_directory"),M(""),T("ask"),hA(""),K(""),oA(""),gA([])}rA(()=>{A?.()||i()!==""&&(KA(),s(!0),r(""))}),rA(()=>{const tA=t(),EA=A?.();if(!tA||!EA||i()===EA)return;KA(EA),s(!1),r(EA);const wA=tA.agents.find(X1=>X1.name===EA);if(!wA){e.fail(`Agent not found: ${EA}`);return}const jA=K8(tA,EA),Ee=Ec(wA,jA);e.fail(""),s(!0),l(!Ee);const ee=Tt(jA?.value),w1=U8(ee.permission??(Ee?void 0:wA.permission)),_1=F8(ee.steps)??wA.steps;c(wA.name),d(dn(ee.description)||wA.description||""),C(n8(dn(ee.mode)||wA.mode)),u(dn(ee.model)||T8(wA)),h(dn(ee.color)||wA.color||""),m(_1?String(_1):""),N(w1.tools),P(w1.permission),k(dn(ee.prompt)||wA.prompt||"")});function ie(){BA("closed")}function xA(){return a()?(e.fail("Inspected agents are read-only."),!1):!0}function he(){const tA=g1();tA&&(z(void 0),BA("markdown"),e.run("Previewing agent",()=>kb(e.target(),tA).then(z),{refetch:!1}))}function re(){xA()&&(hA(""),K(f()),BA("model"))}function Je(tA){K(tA.id)}function s1(){if(!xA())return;const tA=J();if(!tA){e.fail("Select a model before saving the agent model field.");return}u(tA),ie()}function a1(){xA()&&u("")}function JA(){xA()&&(oA(""),gA(D()),BA("tools"))}function sA(tA){if(!xA())return;const EA=new Set(AA());EA.has(tA)?EA.delete(tA):EA.add(tA),gA(BI(EA))}function GA(){xA()&&(N(AA()),ie())}function XA(){xA()&&N([])}function Fe(tA){xA()&&(F(tA),M(""),T("ask"),BA("permission"))}function He(tA,EA){if(!xA())return;const wA={...R()};if(!G8.has(tA)){wA[tA]=EA,P(wA);return}const jA=Tt(wA[tA]);wA[tA]={...jA,"*":EA},P(wA)}function Be(){if(!xA())return;const tA=HA(L());if(!tA){e.fail(`Enter a ${LA().noun} pattern before saving.`);return}const EA=_(),wA={...R()},jA=wA[EA],Ee=jA&&typeof jA=="object"&&!Array.isArray(jA)?{...jA}:{};Ee[tA]=S(),wA[EA]=Ee,P(wA),ie()}function Ue(tA){if(!xA())return;const EA={...R()};if(tA.pattern==="*"){const jA={...Tt(EA[tA.tool])};if(Object.keys(jA).length){delete jA["*"],Object.keys(jA).length?EA[tA.tool]=jA:delete EA[tA.tool],P(EA);return}delete EA[tA.tool],P(EA);return}const wA={...Tt(EA[tA.tool])};delete wA[tA.pattern],Object.keys(wA).length?EA[tA.tool]=wA:delete EA[tA.tool],P(EA)}function l1(tA){if(!xA())return;const EA=HA(y());k(EA?`${EA}
21
21
 
22
22
  ${tA}`:tA)}function g1(){if(!o()){e.fail("Select an agent before previewing or saving.");return}const tA=HA(g()),EA=HA(y());if(!tA||!EA){e.fail("Enter an agent id and prompt before previewing or saving.");return}const wA=R();return{scope:n(),id:tA,description:Yl(Q()),mode:B(),model:Yl(f()),color:Yl(I()),steps:x8(w()),tools:D().length?D():void 0,permission:Object.keys(wA).length?wA:void 0,prompt:EA}}function mA(){if(!xA())return;const tA=g1();tA&&e.run("Saving agent",()=>bb(e.target(),tA).then(z))}return{ctx:e,snap:t,scope:n,id:g,setId:c,desc:Q,setDesc:d,mode:B,setMode:C,model:f,setModel:u,color:I,setColor:h,steps:w,setSteps:m,tools:D,prompt:y,setPrompt:k,permTool:_,setPermTool:F,permPattern:L,setPermPattern:M,permAction:S,setPermAction:T,permissionGroups:_A,permissionDefaults:se,permissionOther:ae,selectedPermission:LA,draft:X,ready:o,locked:a,panel:iA,close:ie,openMarkdown:he,picker:nA,setPicker:hA,choice:J,models:v,selected:NA,fav:aA,openModel:re,selectModel:Je,saveModel:s1,clearModel:a1,search:$,setSearch:oA,options:vA,pickedDraft:pA,openTools:JA,rules:SA,openPermission:Fe,setPermissionDefault:He,removePermission:Ue,toggleTool:sA,saveTools:GA,clearTools:XA,addPermission:Be,insert:l1,save:mA}}var J8=b("<div class=agent-builder-field-actions>"),H8=b('<div class="ui-field agent-builder-field"><div class=agent-builder-field-head><div><span></span></div></div><div class=agent-builder-control>'),Y8=b("<small>"),P8=b("<div class=permission-row-meta>"),V8=b("<div class=agents>"),j8=b("<span class=config-title-count>Agents"),z8=b("<p class=empty>"),$8=b("<section class=agent-section>"),W8=b("<div>"),Z8=b("<span class=agent-mode-dot aria-hidden=true>"),X8=b("<span class=agent-subtitle><span class=agent-id></span><span class=agent-description>"),A7=b('<div class="tags agent-tags">'),e7=b("<header class=ui-card-header><div><h2>Identity</h2><p>Name, mode, and display metadata for this agent."),t7=b("<input class=mono placeholder=reviewer>"),n7=b('<input placeholder="Review code and report risks">'),i7=b('<div class=agent-color-control><input class=mono placeholder=#0e639c><div class=agent-color-swatches aria-label="Preset colors">'),r7=b("<input class=mono placeholder=optional inputmode=numeric>"),Vd=b('<div class="ui-form agent-builder-form">'),o7=b("<header class=ui-card-header><div><h2>Model And Tools</h2><p>Choose the model and default tool access written into the agent frontmatter."),Pl=b("<strong>"),s7=b('<div class="tag-cloud agent-tool-summary">'),a7=b("<header class=ui-card-header><div><h2>System Prompt</h2><p>Markdown instructions that define how this agent behaves."),l7=b('<textarea class="mono agent-prompt-input"placeholder="Describe how this agent should behave.">'),g7=b('<div class="ui-form agent-builder-form"><div class=agent-snippets><div class=block-title><strong>Prompt snippets</strong><span>Insert a starter instruction into the prompt, then customize it.</span></div><div class=snippet-list>'),c7=b("<header class=ui-card-header><div><h2>Agent Permissions</h2><p>Add scalar or pattern-specific overrides before previewing markdown."),Q7=b("<section class=permission-group><div class=permission-rules>"),d7=b('<div class="ui-card-body agent-permissions-body"><div class="permissions agent-permissions"><section class=permission-group><div class=permission-rules>'),B7=b('<div class="builder agent-builder"><section class="builder-form agent-builder-stack">'),jo=b("<div class=drawer-scrim>"),E7=b('<aside class=provider-drawer aria-label="Agent model selector"><header class=drawer-header><div><h2>Choose Model</h2><span>Favorites are listed first, then models are sorted alphabetically.</span></div></header><div class="provider-picker model-picker"></div><footer class=drawer-footer>'),C7=b('<aside class=provider-drawer aria-label="Agent tool access selector"><header class=drawer-header><div><h2>Choose Tool Access</h2><span>Selected tools are written as allow permissions in the agent frontmatter.</span></div></header><div class="provider-picker tool-picker"></div><footer class=drawer-footer>'),u7=b('<aside class="provider-drawer permission-drawer"aria-label="Agent permission rule configuration"><header class=drawer-header><div><h2></h2><span></span></div></header><div class="provider-form permission-form"><label class="required-field wide"><input></label><label class="required-field wide">Method</label></div><footer class=drawer-footer>'),I7=b('<aside class=provider-drawer aria-label="Generated agent markdown"><header class=drawer-header><div><h2>Markdown</h2><span></span></div></header><div class="provider-picker markdown-picker">'),h7=b("<button class=agent-color-swatch type=button>"),jd=b("<span class=mono>"),f7=b("<strong>No tools selected"),p7=b("<span>No allow permissions will be written."),m7=b("<section class=permission-group><header class=permission-group-header><div class=permission-group-copy><h2></h2><span></span><p></p></div><div class=permission-section-actions></div></header><div class=permission-rules>"),w7=b("<p class=permission-empty>No specific <!> rules."),D7=b("<span class=permission-pattern>"),y7=b("<span class=permission-subtitle><span></span><span class=permission-pattern>"),k7=b("<p class=empty>No models match this filter."),b7=b('<button class="provider-option model-option"type=button><span class=model-star aria-hidden=true></span><div><strong></strong><span></span></div><div class=tags>'),v7=b("<p class=empty>No tools match this filter."),M7=b('<button class="provider-option tool-option"type=button><div class="model-main tool-main"><div class=model-title><div><strong></strong><span></span></div></div><div class=tags></div></div><ul class=tool-capabilities>'),N7=b("<li>"),S7=b("<p class=empty>Generating markdown preview..."),L7=b("<pre class=markdown-preview>");const x7=["#0e639c","#89d185","#cca700","#f14c4c","#3794ff","#c586c0","#9cdcfe"],F7=[{value:"primary",label:"Primary"},{value:"subagent",label:"Subagent"},{value:"all",label:"Both"}];function zd(A){return A.description??"No description available."}function G7(A){return A===0?"Project Agents":"Global Agents"}function mI(){const A=Dn(),e=bu();return{href:n=>{const i=n?`/${encodeURIComponent(n)}`:"";return`${dI(A.pathname)}/agents${i}${A.search}`},nav:e}}function _7(A){return A.length===1?"1 tool":`${A.length} tools`}function rn(A){return(()=>{var e=H8(),t=e.firstChild,n=t.firstChild,i=n.firstChild,r=t.nextSibling;return p(i,()=>A.label),p(n,E(Y,{get when(){return A.description},children:o=>(()=>{var s=Y8();return p(s,o),s})()}),null),p(t,E(Y,{get when(){return A.actions},get children(){var o=J8();return p(o,()=>A.actions),o}}),null),p(r,()=>A.children),e})()}function $d(A){return(()=>{var e=P8();return p(e,E(Ae,{get tone(){return pI(A.action)},get children(){return O0(A.action)}})),e})()}function R7(){const A=mI(),e=$e(),[t,n]=U(""),i=()=>e.data(),r=G(()=>{const l=i();if(!l)return[];const g=e.query()?.scope??"global",c=new Map((l.overlay.collections.agent??[]).map(d=>[d.key,d])),Q=new Set((l.overlay.collections.agent??[]).filter(d=>d.source==="project").map(d=>d.key));return l.agents.filter(d=>{const B=c.get(d.name);return g==="global"?!B?.local:Q.has(d.name)||!B?.local}).map(d=>({item:d,entry:c.get(d.name),rank:Q.has(d.name)?0:1})).sort((d,B)=>d.rank-B.rank||fr(d.item).localeCompare(fr(B.item)))}),o=G(()=>{const l=t().trim().toLowerCase();return l?r().filter(g=>`${fr(g.item)} ${g.item.name} ${zd(g.item)}`.toLowerCase().includes(l)):r()}),s=G(()=>[0,1].map(l=>o().filter(g=>g.rank===l)).filter(l=>l.length)),a=G(()=>r().length?"No agents match this filter.":"No agents loaded.");return E(Y,{get when(){return i()},children:l=>E(We,{get title(){return(()=>{var g=j8();return g.firstChild,p(g,E(Se,{get children(){return r().length}}),null),g})()},description:"Agents are reusable model, prompt, and tool configurations. Primary agents drive sessions; subagents are delegated to.",get actions(){return E(IA,{icon:"plus",variant:"primary",onClick:()=>A.nav(A.href("new")),children:"New agent"})},get children(){return[E(W1,{label:"Filter agents",get value(){return t()},placeholder:"Filter by name or ID...",onValue:n}),(()=>{var g=V8();return p(g,E(Y,{get when(){return s().length},get fallback(){return(()=>{var c=z8();return p(c,a),c})()},get children(){return E(kA,{get each(){return s()},children:c=>(()=>{var Q=$8();return p(Q,E(Y,{get when(){return e.query()?.scope==="project"},get children(){return E(Bt,{get children(){return G7(c[0]?.rank??1)}})}}),null),p(Q,E(kA,{each:c,children:d=>(()=>{var B=W8();return p(B,E(S1,{get leading(){return(()=>{var C=Z8();return V(()=>W(C,"data-mode",d.item.mode)),C})()},get title(){return fr(d.item)},get subtitle(){return(()=>{var C=X8(),f=C.firstChild,u=f.nextSibling;return p(f,()=>d.item.name),p(u,()=>zd(d.item)),C})()},get status(){return(()=>{var C=A7();return p(C,E(Ae,{get tone(){return d.item.mode==="primary"?"brand":"neutral"},get children(){return d.item.mode}}),null),p(C,E(Ae,{get children(){return d.item.native?"Native":"Custom"}}),null),p(C,E(Y,{get when(){return d.item.hidden},get children(){return E(Ae,{children:"Hidden"})}}),null),p(C,E(Y,{get when(){return d.item.deprecated},get children(){return E(Ae,{children:"Deprecated"})}}),null),p(C,E(Y,{get when(){return d.entry},children:f=>E(Ve,{get source(){return f().source},get inherited(){return f().inherited},get overridden(){return f().overridden}})}),null),C})()},get actions(){return E(Te,{get icon(){return Ec(d.item,d.entry)?"edit":"eye"},variant:"ghost",get"aria-label"(){return`${Ec(d.item,d.entry)?"Edit":"Inspect"} ${fr(d.item)}`},onClick:()=>A.nav(A.href(d.item.name))})}})),V(()=>B.classList.toggle("inherited",!!d.entry?.inherited)),B})()}),null),Q})()})}})),g})()]}})})}function Wd(){const A=mI(),e=ko(),t=()=>e.agentID==="new"?void 0:e.agentID,n=q8(t),i=G(()=>t()?n.locked()?"Inspect Agent":"Edit Agent":"Agent Builder");return E(Y,{get when(){return n.snap()},children:r=>E(We,{get title(){return i()},description:"Build a reusable agent by combining a prompt, model, mode, and tool permissions.",get actions(){return[E(IA,{variant:"secondary",get disabled(){return!!n.ctx.saving()||!n.ready()},get onClick(){return n.openMarkdown},children:"Markdown"}),E(Y,{get when(){return!n.locked()},get children(){return E(IA,{variant:"primary",get disabled(){return!!n.ctx.saving()||!n.ready()},get onClick(){return n.save},children:"Save"})}}),E(Te,{icon:"close",variant:"secondary","aria-label":"Close agent builder",onClick:()=>A.nav(A.href())})]},get children(){return[(()=>{var o=B7(),s=o.firstChild;return p(s,E(ue,{class:"ui-card agent-builder-card",padding:0,get children(){return[e7(),(()=>{var a=Vd();return p(a,E(rn,{label:"Agent id",description:"Used in @ mentions, commands, and agent files.",get children(){var l=t7();return l.$$input=g=>n.setId(g.currentTarget.value),W(l,"spellcheck",!1),V(()=>l.readOnly=n.locked()),V(()=>l.value=n.id()),l}}),null),p(a,E(rn,{label:"Description",description:"Shown when choosing or delegating to the agent.",get children(){var l=n7();return l.$$input=g=>n.setDesc(g.currentTarget.value),V(()=>l.readOnly=n.locked()),V(()=>l.value=n.desc()),l}}),null),p(a,E(rn,{label:"Mode",get children(){return E(gt,{label:"Agent mode",get value(){return n.mode()},options:F7,get disabled(){return n.locked()},get onSelect(){return n.setMode}})}}),null),p(a,E(rn,{label:"Color",get children(){var l=i7(),g=l.firstChild,c=g.nextSibling;return g.$$input=Q=>n.setColor(Q.currentTarget.value),p(c,E(kA,{each:x7,children:Q=>(()=>{var d=h7();return d.$$click=()=>n.setColor(Q),W(d,"aria-label",`Use color ${Q}`),Dt(d,"background-color",Q),V(B=>{var C=n.color()===Q,f=n.locked();return C!==B.e&&d.classList.toggle("selected",B.e=C),f!==B.t&&(d.disabled=B.t=f),B},{e:void 0,t:void 0}),d})()})),V(()=>g.readOnly=n.locked()),V(()=>g.value=n.color()),l}}),null),p(a,E(rn,{label:"Max steps",description:"Optional hard cap on tool-call iterations.",get children(){var l=r7();return l.$$input=g=>n.setSteps(g.currentTarget.value),V(()=>l.readOnly=n.locked()),V(()=>l.value=n.steps()),l}}),null),a})()]}}),null),p(s,E(ue,{class:"ui-card agent-builder-card",padding:0,get children(){return[o7(),(()=>{var a=Vd();return p(a,E(rn,{label:"Model",get actions(){return[E(Y,{get when(){return MA(()=>!n.locked())()&&n.model()},get children(){return E(IA,{variant:"secondary",get disabled(){return!!n.ctx.saving()},get onClick(){return n.clearModel},children:"Use Default"})}}),E(Te,{icon:"edit",variant:"secondary","aria-label":"Edit agent model",get disabled(){return!!n.ctx.saving()||n.locked()},get onClick(){return n.openModel}})]},get children(){return E(Y,{get when(){return n.selected()},get fallback(){return[(()=>{var l=Pl();return p(l,()=>n.model()||"Inherit default model"),l})(),E(Y,{get when(){return n.model()},children:l=>(()=>{var g=jd();return p(g,l),g})()})]},children:l=>[(()=>{var g=Pl();return p(g,()=>`${l().provider.name} / ${l().model.name}`),g})(),(()=>{var g=jd();return p(g,()=>l().id),g})()]})}}),null),p(a,E(rn,{label:"Tool access",description:"Selected tools are written as allow permissions.",get actions(){return[E(Y,{get when(){return MA(()=>!n.locked())()&&n.tools().length},get children(){return E(IA,{variant:"secondary",get disabled(){return!!n.ctx.saving()},get onClick(){return n.clearTools},children:"Clear"})}}),E(Te,{icon:"edit",variant:"secondary","aria-label":"Edit tool access",get disabled(){return!!n.ctx.saving()||n.locked()},get onClick(){return n.openTools}})]},get children(){return E(Y,{get when(){return n.tools().length},get fallback(){return[f7(),p7()]},get children(){return[(()=>{var l=Pl();return p(l,()=>_7(n.tools())),l})(),(()=>{var l=s7();return p(l,E(kA,{get each(){return n.tools()},children:g=>E(Ae,{children:g})})),l})()]}})}}),null),a})()]}}),null),p(s,E(ue,{class:"ui-card agent-builder-card",padding:0,get children(){return[a7(),(()=>{var a=g7(),l=a.firstChild,g=l.firstChild,c=g.nextSibling;return p(a,E(rn,{label:"Prompt",get children(){var Q=l7();return Q.$$input=d=>n.setPrompt(d.currentTarget.value),V(()=>Q.readOnly=n.locked()),V(()=>Q.value=n.prompt()),Q}}),l),p(c,E(kA,{each:N8,children:Q=>E(IA,{variant:"secondary",get disabled(){return!!n.ctx.saving()||n.locked()},onClick:()=>n.insert(Q),children:Q})})),a})()]}}),null),p(s,E(ue,{class:"ui-card agent-builder-card",padding:0,get children(){return[(()=>{var a=c7();return a.firstChild,p(a,E(Se,{get children(){return n.rules().length}}),null),a})(),(()=>{var a=d7(),l=a.firstChild,g=l.firstChild,c=g.firstChild;return p(l,E(kA,{get each(){return n.permissionGroups()},children:Q=>(()=>{var d=m7(),B=d.firstChild,C=B.firstChild,f=C.firstChild,u=f.nextSibling,I=u.nextSibling,h=C.nextSibling,w=B.nextSibling;return p(f,()=>Q.title),p(u,()=>Q.id),p(I,()=>Q.description),p(h,E(Se,{get children(){return Q.rules.length}}),null),p(h,E(IA,{icon:"plus",variant:"primary",get disabled(){return!!n.ctx.saving()||n.locked()},onClick:()=>n.openPermission(Q.id),children:"Add rule"}),null),p(d,E(S1,{title:"Default method",get subtitle(){return`Used for ${Q.noun}s that do not match a specific rule.`},get actions(){return E(Ti,{get label(){return`Default method for ${Q.title}`},get value(){return Q.action},get disabled(){return!!n.ctx.saving()||n.locked()},onSelect:m=>n.setPermissionDefault(Q.id,m)})}}),w),p(w,E(Y,{get when(){return Q.rules.length},get fallback(){return(()=>{var m=w7(),D=m.firstChild,N=D.nextSibling;return N.nextSibling,p(m,()=>Q.noun,N),m})()},get children(){return E(kA,{get each(){return Q.rules},children:m=>E(S1,{get title(){return(()=>{var D=D7();return p(D,()=>m.pattern),D})()},get subtitle(){return`${Q.title} ${Q.noun} rule`},get status(){return E($d,{get action(){return m.action}})},get actions(){return E(Te,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${Q.title} rule ${m.pattern}`},get disabled(){return!!n.ctx.saving()||n.locked()},onClick:()=>n.removePermission(m)})}})})}})),d})()}),g),p(g,E(Bt,{get trailing(){return E(Se,{get children(){return n.permissionDefaults().length}})},description:"Default methods for additional built-in tool permissions.",children:"Tool Defaults"}),c),p(c,E(kA,{get each(){return n.permissionDefaults()},children:Q=>E(S1,{get title(){return Q.title},get subtitle(){return`${Q.id} · ${Q.description}`},get actions(){return E(Ti,{get label(){return`Default method for ${Q.title}`},get value(){return Q.action},get disabled(){return!!n.ctx.saving()||n.locked()},onSelect:d=>n.setPermissionDefault(Q.id,d)})}})})),p(l,E(Y,{get when(){return n.permissionOther().length},get children(){var Q=Q7(),d=Q.firstChild;return p(Q,E(Bt,{get trailing(){return E(Se,{get children(){return n.permissionOther().length}})},description:"Additional tool permission rules from this agent.",children:"Other Permissions"}),d),p(d,E(kA,{get each(){return n.permissionOther()},children:B=>E(S1,{get title(){return bt(B.tool)},get subtitle(){return(()=>{var C=y7(),f=C.firstChild,u=f.nextSibling;return p(f,()=>B.tool),p(u,()=>B.pattern),C})()},get status(){return E($d,{get action(){return B.action}})},get actions(){return E(Te,{icon:"trash",variant:"ghost",get"aria-label"(){return`Delete ${B.tool} rule ${B.pattern}`},get disabled(){return!!n.ctx.saving()||n.locked()},onClick:()=>n.removePermission(B)})}})})),Q}}),null),a})()]}}),null),o})(),E(Y,{get when(){return n.panel()==="model"},get children(){return[(()=>{var o=jo();return RA(o,"click",n.close,!0),o})(),(()=>{var o=E7(),s=o.firstChild;s.firstChild;var a=s.nextSibling,l=a.nextSibling;return p(s,E(IA,{variant:"ghost","aria-label":"Close model selector",get onClick(){return n.close},children:"X"}),null),p(o,E(W1,{class:"drawer-search",hideLabel:!1,label:"Filter models",get value(){return n.picker()},variant:"drawer",placeholder:"Search by name, provider, or ID",get onValue(){return n.setPicker}}),a),p(a,E(Y,{get when(){return n.models().length},get fallback(){return k7()},get children(){return E(kA,{get each(){return n.models()},children:g=>(()=>{var c=b7(),Q=c.firstChild,d=Q.nextSibling,B=d.firstChild,C=B.nextSibling,f=d.nextSibling;return c.$$click=()=>n.selectModel(g),p(B,()=>g.model.name),p(C,()=>g.id),p(f,E(Ae,{get children(){return g.provider.name}}),null),p(f,E(Ae,{get children(){return g.model.isFree?"free":"paid"}}),null),V(u=>{var I=n.choice()===g.id,h=!!n.fav(g);return I!==u.e&&c.classList.toggle("selected",u.e=I),h!==u.t&&Q.classList.toggle("active",u.t=h),u},{e:void 0,t:void 0}),c})()})}})),p(l,E(IA,{variant:"ghost",get onClick(){return n.close},children:"Cancel"}),null),p(l,E(IA,{variant:"primary",get disabled(){return!!n.ctx.saving()||n.locked()||!n.choice()},get onClick(){return n.saveModel},children:"Save"}),null),o})()]}}),E(Y,{get when(){return n.panel()==="tools"},get children(){return[(()=>{var o=jo();return RA(o,"click",n.close,!0),o})(),(()=>{var o=C7(),s=o.firstChild;s.firstChild;var a=s.nextSibling,l=a.nextSibling;return p(s,E(IA,{variant:"ghost","aria-label":"Close tool selector",get onClick(){return n.close},children:"X"}),null),p(o,E(W1,{class:"drawer-search",hideLabel:!1,label:"Filter tools",get value(){return n.search()},variant:"drawer",placeholder:"Search by tool name, ID, or capability",get onValue(){return n.setSearch}}),a),p(a,E(Y,{get when(){return n.options().length},get fallback(){return v7()},get children(){return E(kA,{get each(){return n.options()},children:g=>(()=>{var c=M7(),Q=c.firstChild,d=Q.firstChild,B=d.firstChild,C=B.firstChild,f=C.nextSibling,u=d.nextSibling,I=Q.nextSibling;return c.$$click=()=>n.toggleTool(g.id),p(C,()=>bt(g.id)),p(f,()=>g.id),p(u,E(Ae,{get children(){return n.pickedDraft().has(g.id)?"Allowed":"Off"}})),p(I,E(kA,{get each(){return G0(g)},children:h=>(()=>{var w=N7();return p(w,h),w})()})),V(h=>{var w=!!n.pickedDraft().has(g.id),m=n.pickedDraft().has(g.id);return w!==h.e&&c.classList.toggle("selected",h.e=w),m!==h.t&&W(c,"aria-pressed",h.t=m),h},{e:void 0,t:void 0}),c})()})}})),p(l,E(IA,{variant:"ghost",get onClick(){return n.close},children:"Cancel"}),null),p(l,E(IA,{variant:"primary",get disabled(){return!!n.ctx.saving()||n.locked()},get onClick(){return n.saveTools},children:"Save"}),null),o})()]}}),E(Y,{get when(){return n.panel()==="permission"},get children(){return[(()=>{var o=jo();return RA(o,"click",n.close,!0),o})(),(()=>{var o=u7(),s=o.firstChild,a=s.firstChild,l=a.firstChild,g=l.nextSibling,c=s.nextSibling,Q=c.firstChild,d=Q.firstChild,B=Q.nextSibling;B.firstChild;var C=c.nextSibling;return p(l,()=>`Add ${n.selectedPermission().title} Rule`),p(g,()=>`${n.selectedPermission().id} · ${n.selectedPermission().description}`),p(s,E(IA,{variant:"ghost","aria-label":"Close permission rule overlay",get onClick(){return n.close},children:"X"}),null),p(Q,()=>n.selectedPermission().noun==="command"?"Command pattern":"Path pattern",d),d.$$input=f=>n.setPermPattern(f.currentTarget.value),W(d,"spellcheck",!1),p(B,E(Ti,{label:"Rule method",get value(){return n.permAction()},get disabled(){return!!n.ctx.saving()||n.locked()},get onSelect(){return n.setPermAction}}),null),p(C,E(IA,{variant:"ghost",get onClick(){return n.close},children:"Cancel"}),null),p(C,E(IA,{variant:"primary",get disabled(){return!!n.ctx.saving()||n.locked()},get onClick(){return n.addPermission},children:"Save Rule"}),null),V(f=>{var u=n.selectedPermission().placeholder,I=n.locked();return u!==f.e&&W(d,"placeholder",f.e=u),I!==f.t&&(d.readOnly=f.t=I),f},{e:void 0,t:void 0}),V(()=>d.value=n.permPattern()),o})()]}}),E(Y,{get when(){return n.panel()==="markdown"},get children(){return[(()=>{var o=jo();return RA(o,"click",n.close,!0),o})(),(()=>{var o=I7(),s=o.firstChild,a=s.firstChild,l=a.firstChild,g=l.nextSibling,c=s.nextSibling;return p(g,()=>n.draft()?.path??"Previewing the current agent configuration."),p(s,E(IA,{variant:"ghost","aria-label":"Close markdown preview",get onClick(){return n.close},children:"X"}),null),p(c,E(Y,{get when(){return n.draft()},get fallback(){return S7()},children:Q=>(()=>{var d=L7();return p(d,()=>Q().markdown),d})()})),o})()]}})]}})})}pe(["input","click"]);const U7=["#0c0a09","#fafaf9","#f9f76f","#a6a09b","#3794ff","#44403b"],Vl=[{id:"aura",swatches:["#0f0f0f","#edecee","#a277ff","#f694ff","#a277ff","#2d2d2d"]},{id:"ayu",swatches:["#0B0E14","#BFBDB6","#59C2FF","#D2A6FF","#E6B450","#6C7380"]},{id:"carbonfox",swatches:["#161616","#f2f4f8","#33b1ff","#78a9ff","#ff7eb6","#303030"]},{id:"catppuccin",swatches:["#1e1e2e","#cdd6f4","#89b4fa","#cba6f7","#f5c2e7","#313244"]},{id:"catppuccin-frappe",swatches:["#303446","#c6d0f5","#8da4e2","#ca9ee6","#f4b8e4","#414559"]},{id:"catppuccin-macchiato",swatches:["#24273a","#cad3f5","#8aadf4","#c6a0f6","#f5bde6","#363a4f"]},{id:"cobalt2",swatches:["#193549","#ffffff","#0088ff","#9a5feb","#2affdf","#1f4662"]},{id:"colorblind",swatches:["#1A1A2E","#E8E8E8","#0077BB","#EE7733","#33BBEE","#1F4068"]},{id:"cursor",swatches:["#181818","#e4e4e4","#88c0d0","#81a1c1","#88c0d0","#e4e4e413"]},{id:"dracula",swatches:["#282a36","#f8f8f2","#bd93f9","#ff79c6","#8be9fd","#44475a"]},{id:"everforest",swatches:["#2d353b","#d3c6aa","#a7c080","#7fbbb3","#d699b6","#859289"]},{id:"flexoki",swatches:["#100F0F","#CECDC3","#DA702C","#4385BE","#8B7EC8","#575653"]},{id:"github",swatches:["#0d1117","#c9d1d9","#58a6ff","#bc8cff","#39c5cf","#30363d"]},{id:"gruvbox",swatches:["#282828","#ebdbb2","#83a598","#d3869b","#8ec07c","#665c54"]},{id:"kanagawa",swatches:["#1F1F28","#DCD7BA","#7E9CD8","#957FB8","#D27E99","#54546D"]},{id:"kilo",swatches:["#0c0a09","#fafaf9","#f9f76f","#a6a09b","#f9f76f","#44403b"]},{id:"kilo-v1",swatches:["#1e1e1e","#cccccc","#faf74f","#007acc","#007fd4","#3c3c3c"]},{id:"lucent-orng",swatches:["#000000","#eeeeee","#EC5B2B","#EE7948","#FFF7F1","#EC5B2B"]},{id:"material",swatches:["#263238","#eeffff","#82aaff","#c792ea","#89ddff","#37474f"]},{id:"matrix",swatches:["#0a0e0a","#62ff94","#2eff6a","#00efff","#c770ff","#1e2a1b"]},{id:"mercury",swatches:["#171721","#dddde5","#8da4f5","#a7b6f8","#8da4f5","#b4b7c81f"]},{id:"monokai",swatches:["#272822","#f8f8f2","#66d9ef","#ae81ff","#a6e22e","#3e3d32"]},{id:"nightowl",swatches:["#011627","#d6deeb","#82AAFF","#7fdbca","#c792ea","#5f7e97"]},{id:"nord",swatches:["#2E3440","#ECEFF4","#88C0D0","#81A1C1","#8FBCBB","#434C5E"]},{id:"one-dark",swatches:["#282c34","#abb2bf","#61afef","#c678dd","#56b6c2","#393f4a"]},{id:"opencode",swatches:["#0a0a0a","#eeeeee","#fab283","#5c9cf5","#9d7cd8","#484848"]},{id:"orng",swatches:["#0a0a0a","#eeeeee","#EC5B2B","#EE7948","#FFF7F1","#EC5B2B"]},{id:"osaka-jade",swatches:["#111c18","#C1C497","#2DD5B7","#D2689C","#549e6a","#3d4a44"]},{id:"palenight",swatches:["#292d3e","#a6accd","#82aaff","#c792ea","#89ddff","#32364a"]},{id:"rosepine",swatches:["#191724","#e0def4","#9ccfd8","#c4a7e7","#ebbcba","#403d52"]},{id:"solarized",swatches:["#002b36","#839496","#268bd2","#6c71c4","#2aa198","#073642"]},{id:"synthwave84",swatches:["#262335","#ffffff","#36f9f6","#ff7edb","#b084eb","#495495"]},{id:"tokyonight",swatches:["#1a1b26","#c8d3f5","#82aaff","#c099ff","#ff966c","#737aa2"]},{id:"vercel",swatches:["#000000","#EDEDED","#0070F3","#52A8FF","#8E4EC6","#1F1F1F"]},{id:"vesper",swatches:["#101010","#FFF","#FFC799","#99FFE4","#FFC799","#282828"]},{id:"zenburn",swatches:["#3f3f3f","#dcdccc","#8cd0d3","#dc8cc3","#93e0e3","#5f5f5f"]}];function K0(A){return A.split("-").filter(Boolean).map(e=>`${e[0]?.toUpperCase()??""}${e.slice(1)}`).join(" ")}function Zd(A){return{id:A,swatches:U7,custom:!0}}function O7(A){return A==="stacked"?"stacked":"auto"}function Jr(A,e){return typeof A=="boolean"?A:e}function K7(){const A=$e(),e=G(()=>A.data()?.tui.theme??"kilo"),[t,n]=U(""),[i,r]=U("closed"),[o,s]=U(""),[a,l]=U(""),[g,c]=U("3"),[Q,d]=U(!1),[B,C]=U("auto"),[f,u]=U(!0),[I,h]=U(!1),w=G(()=>{const S=HA(o()).toLowerCase(),T=Vl.filter(P=>S?`${P.id} ${K0(P.id)}`.toLowerCase().includes(S):!0),R=HA(o());return!R||Vl.some(P=>P.id===R)||T.length?T:[Zd(R)]});function m(S){return Vl.find(T=>T.id===S)??Zd(S||"kilo")}const D=G(()=>m(t())),N=G(()=>m(a()||t()));rA(()=>{const S=A.data()?.tui;n(e()),!I()&&(c(String(S?.scroll_speed??3)),d(Jr(S?.scroll_acceleration?.enabled,!1)),C(O7(S?.diff_style)),u(Jr(S?.mouse,!0)))});function y(){l(t()),s(""),r("theme")}function k(){r("closed")}function _(S){l(S.id)}function F(S){h(!0),S()}function L(){const S=HA(a());if(!S){A.fail("Select a TUI theme before saving.");return}A.tui({theme:S}),n(S),k()}function M(){const S=Number(g());if(!Number.isFinite(S)||S<.001){A.fail("Enter a scroll speed of at least 0.001.");return}const T={scroll_speed:S,scroll_acceleration:{enabled:Q()},diff_style:B(),mouse:f()};A.tui(T),h(!1)}return{ctx:A,current:e,theme:t,active:D,selected:N,mode:i,picker:o,setPicker:s,choice:a,options:w,edit:y,close:k,select:_,saveTheme:L,speed:g,setSpeed:S=>F(()=>c(S)),accel:Q,setAccel:S=>F(()=>d(S)),diff:B,setDiff:S=>F(()=>C(S)),mouse:f,setMouse:S=>F(()=>u(S)),dirty:I,save:M}}function T7(){const A=$e(),[e,t]=U(!1),[n,i]=U(!0),[r,o]=U(!0),[s,a]=U("0.4"),[l,g]=U(!1);rA(()=>{if(l())return;const d=A.data()?.tui.attention;t(Jr(d?.enabled,!1)),i(Jr(d?.notifications,!0)),o(Jr(d?.sound,!0)),a(String(d?.volume??.4))});function c(d){g(!0),d()}function Q(){const d=Number(s());if(!Number.isFinite(d)||d<0||d>1){A.fail("Enter an attention volume between 0 and 1.");return}A.tui({attention:{enabled:e(),notifications:n(),sound:r(),volume:d}}),g(!1)}return{ctx:A,alert:e,setAlert:d=>c(()=>t(d)),notify:n,setNotify:d=>c(()=>i(d)),sound:r,setSound:d=>c(()=>o(d)),volume:s,setVolume:d=>c(()=>a(d)),dirty:l,save:Q}}var q7=b("<button class=ui-toggle type=button><span><strong></strong><small>"),J7=b("<header class=ui-card-header><div><h2>Attention</h2><p>Control when the TUI asks for attention and how it notifies you."),H7=b('<div class="ui-form attention-form"><label class=ui-field><span>Volume</span><input type=number min=0 max=1 step=0.05><small>Use a value from 0 to 1. The docs example uses 0.4.');function jl(A){return(()=>{var e=q7(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return RA(e,"click",A.onChange,!0),p(n,()=>A.label),p(i,()=>A.description),p(e,E(Ae,{get tone(){return A.checked?"success":"neutral"},get children(){return A.checked?"On":"Off"}}),null),V(r=>{var o=!!A.checked,s=A.checked,a=A.disabled;return o!==r.e&&e.classList.toggle("selected",r.e=o),s!==r.t&&W(e,"aria-pressed",r.t=s),a!==r.a&&(e.disabled=r.a=a),r},{e:void 0,t:void 0,a:void 0}),e})()}function Y7(){const A=T7();return E(We,{title:"CLI Notifications",description:"Configure TUI attention alerts, desktop notifications, and sound defaults.",get actions(){return E(IA,{variant:"primary",get disabled(){return!!A.ctx.saving()||!A.dirty()},get onClick(){return A.save},children:"Save"})},get children(){return E(ue,{class:"ui-card",padding:0,get children(){return[J7(),(()=>{var e=H7(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return p(e,E(jl,{label:"Attention alerts",description:"Turn on TUI attention events.",get checked(){return A.alert()},get disabled(){return!!A.ctx.saving()},onChange:()=>A.setAlert(!A.alert())}),t),p(e,E(jl,{label:"Desktop notifications",description:"Show desktop notifications when attention alerts fire.",get checked(){return A.notify()},get disabled(){return!!A.ctx.saving()||!A.alert()},onChange:()=>A.setNotify(!A.notify())}),t),p(e,E(jl,{label:"Sound",description:"Play an attention sound when alerts fire.",get checked(){return A.sound()},get disabled(){return!!A.ctx.saving()||!A.alert()},onChange:()=>A.setSound(!A.sound())}),t),i.$$input=r=>A.setVolume(r.currentTarget.value),V(()=>i.disabled=!A.alert()),V(()=>i.value=A.volume()),e})()]}})}})}pe(["click","input"]);var P7=b("<div class=theme-swatches aria-hidden=true>"),V7=b("<span class=theme-swatch>"),j7=b("<div class=theme-preview><div><strong></strong><span class=mono>"),z7=b("<button class=ui-toggle type=button><span><strong></strong><small>"),$7=b("<header class=ui-card-header><div><h2>Theme</h2><p>Choose the TUI palette. Custom theme IDs can still be typed in the selector search."),W7=b("<div class=ui-card-body>"),Z7=b("<header class=ui-card-header><div><h2>Interaction</h2><p>Control mouse capture, scrolling, and diff rendering behavior in the terminal."),X7=b("<div class=ui-form><label class=ui-field><span>Diff style</span><small>Auto adapts to terminal width; stacked always uses a single-column diff.</small></label><label class=ui-field><span>Scroll speed</span><input type=number min=0.001 step=0.25><small>Default is 3. Use lower values for slower scrolling."),Av=b("<div class=ui-settings>"),ev=b("<div class=drawer-scrim>"),tv=b('<aside class="provider-drawer theme-drawer"aria-label="Theme selector"><header class=drawer-header><div><h2>Choose Theme</h2><span>Select a built-in theme or type a custom theme ID in search.</span></div></header><div class="provider-picker theme-picker"></div><footer class="drawer-footer theme-footer"><div>'),nv=b("<p class=empty>No themes match this filter."),iv=b('<button class="provider-option theme-option"type=button><div><strong></strong><span>');const rv=[{value:"auto",label:"Auto"},{value:"stacked",label:"Stacked"}];function wI(A){return(()=>{var e=P7();return p(e,E(kA,{get each(){return A.swatches},children:t=>(()=>{var n=V7();return Dt(n,"background-color",t),n})()})),e})()}function Xd(A){return(()=>{var e=j7(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return p(n,()=>K0(A.item.id)),p(i,(()=>{var r=MA(()=>!!A.item.custom);return()=>r()?`${A.item.id} / custom`:A.item.id})()),p(e,E(wI,{get swatches(){return A.item.swatches}}),null),e})()}function AB(A){return(()=>{var e=z7(),t=e.firstChild,n=t.firstChild,i=n.nextSibling;return RA(e,"click",A.onChange,!0),p(n,()=>A.label),p(i,()=>A.description),p(e,E(Ae,{get tone(){return A.checked?"success":"neutral"},get children(){return A.checked?"On":"Off"}}),null),V(r=>{var o=!!A.checked,s=A.checked,a=A.disabled;return o!==r.e&&e.classList.toggle("selected",r.e=o),s!==r.t&&W(e,"aria-pressed",r.t=s),a!==r.a&&(e.disabled=r.a=a),r},{e:void 0,t:void 0,a:void 0}),e})()}function ov(){const A=K7();return E(We,{title:"CLI UI",description:"Configure terminal UI preferences saved in tui.json.",get actions(){return E(IA,{variant:"primary",get disabled(){return!!A.ctx.saving()||!A.dirty()},get onClick(){return A.save},children:"Save"})},get children(){return[(()=>{var e=Av();return p(e,E(ue,{class:"ui-card ui-theme-card",padding:0,get children(){return[(()=>{var t=$7();return t.firstChild,p(t,E(IA,{variant:"secondary",get disabled(){return!!A.ctx.saving()},get onClick(){return A.edit},children:"Change Theme"}),null),t})(),(()=>{var t=W7();return p(t,E(Xd,{get item(){return A.active()}})),t})()]}}),null),p(e,E(ue,{class:"ui-card",padding:0,get children(){return[Z7(),(()=>{var t=X7(),n=t.firstChild,i=n.firstChild,r=i.nextSibling,o=n.nextSibling,s=o.firstChild,a=s.nextSibling;return p(n,E(gt,{label:"Diff style",get value(){return A.diff()},options:rv,get onSelect(){return A.setDiff}}),r),a.$$input=l=>A.setSpeed(l.currentTarget.value),p(t,E(AB,{label:"Mouse capture",description:"Allow the TUI to receive mouse input. Defaults to on.",get checked(){return A.mouse()},get disabled(){return!!A.ctx.saving()},onChange:()=>A.setMouse(!A.mouse())}),null),p(t,E(AB,{label:"Scroll acceleration",description:"Enable macOS-style scroll acceleration.",get checked(){return A.accel()},get disabled(){return!!A.ctx.saving()},onChange:()=>A.setAccel(!A.accel())}),null),V(()=>a.value=A.speed()),t})()]}}),null),e})(),E(Y,{get when(){return A.mode()==="theme"},get children(){return[(()=>{var e=ev();return RA(e,"click",A.close,!0),e})(),(()=>{var e=tv(),t=e.firstChild;t.firstChild;var n=t.nextSibling,i=n.nextSibling,r=i.firstChild;return p(t,E(IA,{variant:"ghost","aria-label":"Close theme selector",get onClick(){return A.close},children:"X"}),null),p(e,E(W1,{class:"drawer-search",hideLabel:!1,label:"Filter themes",get value(){return A.picker()},variant:"drawer",placeholder:"Search theme or type a custom ID",get onValue(){return A.setPicker}}),n),p(n,E(Y,{get when(){return A.options().length},get fallback(){return nv()},get children(){return E(kA,{get each(){return A.options()},children:o=>(()=>{var s=iv(),a=s.firstChild,l=a.firstChild,g=l.nextSibling;return s.$$click=()=>A.select(o),p(l,()=>K0(o.id)),p(g,(()=>{var c=MA(()=>!!o.custom);return()=>c()?`${o.id} / custom theme`:o.id})()),p(s,E(wI,{get swatches(){return o.swatches}}),null),V(()=>s.classList.toggle("selected",A.choice()===o.id)),s})()})}})),p(i,E(Xd,{get item(){return A.selected()}}),r),p(r,E(IA,{variant:"ghost",get onClick(){return A.close},children:"Cancel"}),null),p(r,E(IA,{variant:"primary",get disabled(){return!!A.ctx.saving()||!A.choice()},get onClick(){return A.saveTheme},children:"Save Theme"}),null),e})()]}})]}})}pe(["click","input"]);var sv=b("<svg>"),av=b("<svg><rect width=3 height=3 rx=1></svg>",!1,!0,!1);const lv=new Set([1,2,4,7,8,11,13,14]),gv=new Set([0,3,12,15]),cv=Array.from({length:16},(A,e)=>({id:e,x:e%4*4,y:Math.floor(e/4)*4,delay:Math.random()*1.5,duration:1+Math.random()*1,outer:lv.has(e),corner:gv.has(e)}));function DI(A){return(()=>{var e=sv();return p1(e,lA(A,{viewBox:"0 0 15 15","data-component":"spinner",get classList(){return{...A.classList,[A.class??""]:!!A.class}},fill:"currentColor"}),!0,!0),p(e,E(kA,{each:cv,children:t=>(()=>{var n=av();return V(i=>{var r=t.x,o=t.y,s=t.corner?0:void 0,a=t.corner?void 0:`${t.outer?"pulse-opacity-dim":"pulse-opacity"} ${t.duration}s ease-in-out infinite`,l=t.corner?void 0:"both",g=t.corner?void 0:`${t.delay}s`;return r!==i.e&&W(n,"x",i.e=r),o!==i.t&&W(n,"y",i.t=o),s!==i.a&&Dt(n,"opacity",i.a=s),a!==i.o&&Dt(n,"animation",i.o=a),l!==i.i&&Dt(n,"animation-fill-mode",i.i=l),g!==i.n&&Dt(n,"animation-delay",i.n=g),i},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0}),n})()})),e})()}const na=300,Wn=250,ji=800,ia="unified";function Cc(A){return A==="split"?"split":ia}function uc(A){return typeof A!="number"||!Number.isFinite(A)?na:Math.min(ji,Math.max(Wn,Math.round(A)))}function Qv(A){const e=Number(A);if(Number.isInteger(e)&&!(e<Wn||e>ji))return e}function dv(){const A=$e(),[e,t]=U(String(na)),[n,i]=U(ia),[r,o]=U(!1);rA(()=>{if(r())return;const l=A.data()?.effective.console;t(String(uc(l?.context_sidebar_width))),i(Cc(l?.diff_style))});function s(){const l=Qv(e());if(l===void 0){A.fail(`Enter a sidebar width between ${Wn} and ${ji} pixels.`);return}A.patch({console:{context_sidebar_width:l,diff_style:n()}}),t(String(l)),o(!1)}function a(){A.unset([["console","context_sidebar_width"],["console","diff_style"]]),t(String(na)),i(ia),o(!1)}return{ctx:A,width:e,setWidth:l=>{t(l),o(!0)},style:n,setStyle:l=>{i(Cc(l)),o(!0)},dirty:r,configured:()=>{const l=A.data()?.effective.console;return l?.context_sidebar_width!==void 0||l?.diff_style!==void 0},save:s,reset:a}}var Bv=b("<header class=ui-card-header><div><h2>Project context sidebar</h2><p>Set the default width used by the Context and Changes panel in project consoles."),Ev=b("<div class=ui-form><label class=ui-field><span>Sidebar width</span><input type=number step=1><small>Width in pixels, between <!> and <!>. You can also resize the sidebar by dragging its left edge."),Cv=b("<header class=ui-card-header><div><h2>Diff review</h2><p>Choose the default layout used when reviewing changed files in project consoles."),uv=b("<div class=ui-form><div class=ui-field><span>Diff layout</span><small>Unified shows changes in one column. Split shows the original and modified file side by side."),Iv=b("<div class=ui-settings>");const hv=[{value:"unified",label:"Unified"},{value:"split",label:"Split"}];function fv(){const A=dv();return E(We,{title:"Console UI",description:"Configure the local Kilo Console interface. These preferences are saved in your user config.",get actions(){return[E(Y,{get when(){return A.configured()},get children(){return E(IA,{variant:"secondary",get disabled(){return!!A.ctx.saving()},get onClick(){return A.reset},children:"Use default"})}}),E(IA,{variant:"primary",get disabled(){return!!A.ctx.saving()||!A.dirty()},get"aria-busy"(){return!!A.ctx.saving()},get onClick(){return A.save},get children(){return[E(Y,{get when(){return A.ctx.saving()},get children(){return E(DI,{})}}),"Save"]}})]},get children(){var e=Iv();return p(e,E(ue,{class:"ui-card",padding:0,get children(){return[Bv(),(()=>{var t=Ev(),n=t.firstChild,i=n.firstChild,r=i.nextSibling,o=r.nextSibling,s=o.firstChild,a=s.nextSibling,l=a.nextSibling,g=l.nextSibling;return g.nextSibling,r.$$input=c=>A.setWidth(c.currentTarget.value),W(r,"min",Wn),W(r,"max",ji),p(o,Wn,a),p(o,ji,g),V(()=>r.value=A.width()),t})()]}}),null),p(e,E(ue,{class:"ui-card",padding:0,get children(){return[Cv(),(()=>{var t=uv(),n=t.firstChild,i=n.firstChild,r=i.nextSibling;return p(n,E(gt,{class:"console-diff-select",label:"Diff layout",get value(){return A.style()},options:hv,get disabled(){return!!A.ctx.saving()},get onSelect(){return A.setStyle}}),r),t})()]}}),null),e}})}pe(["input"]);const yI=[{id:"air",ext:[".R"],req:"air command available"},{id:"biome",ext:[".js",".jsx",".ts",".tsx",".html",".css",".md",".json",".yaml"],req:"biome.json(c) config file"},{id:"cargofmt",ext:[".rs"],req:"cargo fmt command available"},{id:"clang-format",ext:[".c",".cpp",".h",".hpp",".ino"],req:".clang-format config file"},{id:"cljfmt",ext:[".clj",".cljs",".cljc",".edn"],req:"cljfmt command available"},{id:"dart",ext:[".dart"],req:"dart command available"},{id:"dfmt",ext:[".d"],req:"dfmt command available"},{id:"gleam",ext:[".gleam"],req:"gleam command available"},{id:"gofmt",ext:[".go"],req:"gofmt command available"},{id:"htmlbeautifier",ext:[".erb",".html.erb"],req:"htmlbeautifier command available"},{id:"ktlint",ext:[".kt",".kts"],req:"ktlint command available"},{id:"latexindent",ext:[".tex"],req:"latexindent command available"},{id:"mix",ext:[".ex",".exs",".eex",".heex",".leex",".neex",".sface"],req:"mix command available"},{id:"nixfmt",ext:[".nix"],req:"nixfmt command available"},{id:"ocamlformat",ext:[".ml",".mli"],req:"ocamlformat command and .ocamlformat config file"},{id:"ormolu",ext:[".hs"],req:"ormolu command available"},{id:"oxfmt",ext:[".js",".jsx",".ts",".tsx"],req:"oxfmt dependency and experimental flag",note:"Experimental"},{id:"pint",ext:[".php"],req:"laravel/pint dependency in composer.json"},{id:"prettier",ext:[".js",".jsx",".ts",".tsx",".html",".css",".md",".json",".yaml"],req:"prettier dependency in package.json"},{id:"rubocop",ext:[".rb",".rake",".gemspec",".ru"],req:"rubocop command available"},{id:"ruff",ext:[".py",".pyi"],req:"ruff command available with config"},{id:"rustfmt",ext:[".rs"],req:"rustfmt command available"},{id:"shfmt",ext:[".sh",".bash"],req:"shfmt command available"},{id:"standardrb",ext:[".rb",".rake",".gemspec",".ru"],req:"standardrb command available"},{id:"terraform",ext:[".tf",".tfvars"],req:"terraform command available"},{id:"uv",ext:[".py",".pyi"],req:"uv command available"},{id:"zig",ext:[".zig",".zon"],req:"zig command available"}],kI=[{id:"astro",ext:[".astro"],req:"Auto-installs for Astro projects"},{id:"bash",ext:[".sh",".bash",".zsh",".ksh"],req:"Auto-installs bash-language-server"},{id:"biome",ext:[".js",".jsx",".ts",".tsx",".json",".jsonc",".css"],req:"biome dependency or config available"},{id:"clangd",ext:[".c",".cpp",".cc",".cxx",".c++",".h",".hpp",".hh",".hxx",".h++"],req:"Auto-installs for C/C++ projects"},{id:"clojure-lsp",ext:[".clj",".cljs",".cljc",".edn"],req:"clojure-lsp command available"},{id:"csharp",title:"C#",ext:[".cs",".csx"],req:".NET SDK installed"},{id:"dart",ext:[".dart"],req:"dart command available"},{id:"deno",ext:[".ts",".tsx",".js",".jsx",".mjs"],req:"deno command available with deno.json/c"},{id:"dockerfile",title:"Dockerfile",ext:["Dockerfile",".dockerfile"],req:"Docker language server available"},{id:"elixir-ls",ext:[".ex",".exs"],req:"elixir command available"},{id:"eslint",title:"ESLint",ext:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue"],req:"eslint dependency in project"},{id:"fsharp",title:"F#",ext:[".fs",".fsi",".fsx",".fsscript"],req:".NET SDK installed"},{id:"gleam",ext:[".gleam"],req:"gleam command available"},{id:"gopls",ext:[".go"],req:"go command available"},{id:"haskell-language-server",title:"HLS",ext:[".hs",".lhs"],req:"haskell-language-server-wrapper command available"},{id:"jdtls",title:"JDTLS",ext:[".java"],req:"Java SDK 21+ installed"},{id:"julials",title:"JuliaLS",ext:[".jl"],req:"julia and LanguageServer.jl installed"},{id:"kotlin-ls",ext:[".kt",".kts"],req:"Auto-installs for Kotlin projects"},{id:"lua-ls",ext:[".lua"],req:"Auto-installs for Lua projects"},{id:"nixd",ext:[".nix"],req:"nixd command available"},{id:"ocaml-lsp",ext:[".ml",".mli"],req:"ocamllsp command available"},{id:"oxlint",ext:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts",".vue",".astro",".svelte"],req:"oxlint dependency in project"},{id:"php intelephense",title:"PHP Intelephense",ext:[".php"],req:"Auto-installs for PHP projects"},{id:"prisma",ext:[".prisma"],req:"prisma command available"},{id:"pyright",ext:[".py",".pyi"],req:"pyright dependency installed"},{id:"razor",ext:[".razor",".cshtml"],req:".NET SDK and VS Code C# extension installed"},{id:"ruby-lsp",ext:[".rb",".rake",".gemspec",".ru"],req:"ruby and gem commands available"},{id:"rust",ext:[".rs"],req:"rust-analyzer command available"},{id:"sourcekit-lsp",ext:[".swift",".objc",".objcpp"],req:"swift installed, Xcode on macOS"},{id:"svelte",ext:[".svelte"],req:"Auto-installs for Svelte projects"},{id:"terraform",ext:[".tf",".tfvars"],req:"Auto-installs from GitHub releases"},{id:"texlab",ext:[".tex"],req:"Auto-installs texlab"},{id:"tinymist",ext:[".typ",".typc"],req:"Auto-installs from GitHub releases"},{id:"ty",title:"Ty",ext:[".py",".pyi"],req:"Experimental Python LSP",note:"Experimental"},{id:"typescript",title:"TypeScript",ext:[".ts",".tsx",".js",".jsx",".mjs",".cjs",".mts",".cts"],req:"typescript dependency in project"},{id:"vue",ext:[".vue"],req:"Auto-installs for Vue projects"},{id:"yaml-ls",title:"YAML LS",ext:[".yaml",".yml"],req:"Auto-installs Red Hat yaml-language-server"},{id:"zls",title:"ZLS",ext:[".zig",".zon"],req:"zig command available"}],pv=new Set(yI.map(A=>A.id)),mv=new Set(kI.map(A=>A.id));function Wt(A){return!A||typeof A!="object"||Array.isArray(A)?{}:A}function bI(A){return Array.isArray(A)?A.filter(e=>typeof e=="string"):[]}function eB(A){return new Map(A.map(e=>[e.key,e]))}function tB(A){return A===!0||!!(A&&typeof A=="object")}function zo(A){return Wt(A?.value).disabled===!0}function $o(A){return bI(Wt(A?.value).command)}function Wo(A,e){return Object.fromEntries(Object.entries(Wt(Wt(A?.value)[e])).filter(t=>typeof t[1]=="string"))}function nB(A){return Wt(Wt(A?.value).initialization)}function zl(A,e,t){const n=bI(Wt(e?.value).extensions);return n.length?n:t.length?t:A.ext}function wv(A){return Object.entries(A).map(e=>`${e[0]}=${e[1]}`).join(`
23
23
  `)}function Dv(A){return Object.keys(A).length?JSON.stringify(A,null,2):""}function iB(A){const e=A.split(`