diff --git a/_pagefind/fragment/en_40c597a.pf_fragment b/_pagefind/fragment/en_40c597a.pf_fragment new file mode 100644 index 00000000..a9dc65d6 Binary files /dev/null and b/_pagefind/fragment/en_40c597a.pf_fragment differ diff --git a/_pagefind/fragment/en_546c891.pf_fragment b/_pagefind/fragment/en_546c891.pf_fragment deleted file mode 100644 index 518da2d5..00000000 Binary files a/_pagefind/fragment/en_546c891.pf_fragment and /dev/null differ diff --git a/_pagefind/fragment/en_7ac7daa.pf_fragment b/_pagefind/fragment/en_7ac7daa.pf_fragment new file mode 100644 index 00000000..187d243a Binary files /dev/null and b/_pagefind/fragment/en_7ac7daa.pf_fragment differ diff --git a/_pagefind/fragment/en_8eed9fa.pf_fragment b/_pagefind/fragment/en_8eed9fa.pf_fragment deleted file mode 100644 index 4c55f422..00000000 Binary files a/_pagefind/fragment/en_8eed9fa.pf_fragment and /dev/null differ diff --git a/_pagefind/fragment/en_c51dd09.pf_fragment b/_pagefind/fragment/en_c51dd09.pf_fragment new file mode 100644 index 00000000..812a555c Binary files /dev/null and b/_pagefind/fragment/en_c51dd09.pf_fragment differ diff --git a/_pagefind/fragment/en_e3b7649.pf_fragment b/_pagefind/fragment/en_e3b7649.pf_fragment deleted file mode 100644 index e719cda0..00000000 Binary files a/_pagefind/fragment/en_e3b7649.pf_fragment and /dev/null differ diff --git a/_pagefind/index/en_177d4d9.pf_index b/_pagefind/index/en_177d4d9.pf_index new file mode 100644 index 00000000..5947181c Binary files /dev/null and b/_pagefind/index/en_177d4d9.pf_index differ diff --git a/_pagefind/index/en_8b5e3d6.pf_index b/_pagefind/index/en_8b5e3d6.pf_index deleted file mode 100644 index 678bcc13..00000000 Binary files a/_pagefind/index/en_8b5e3d6.pf_index and /dev/null differ diff --git a/_pagefind/pagefind-entry.json b/_pagefind/pagefind-entry.json index d6de6945..3663880d 100644 --- a/_pagefind/pagefind-entry.json +++ b/_pagefind/pagefind-entry.json @@ -1 +1 @@ -{"version":"1.4.0","languages":{"en":{"hash":"en_6352fc3c3c","wasm":"en","page_count":21}},"include_characters":["_","‿","⁀","⁔","︳","︴","﹍","﹎","﹏","_"]} \ No newline at end of file +{"version":"1.4.0","languages":{"en":{"hash":"en_8ffd7ed64b","wasm":"en","page_count":21}},"include_characters":["_","‿","⁀","⁔","︳","︴","﹍","﹎","﹏","_"]} \ No newline at end of file diff --git a/_pagefind/pagefind.en_6352fc3c3c.pf_meta b/_pagefind/pagefind.en_6352fc3c3c.pf_meta deleted file mode 100644 index 8b1f2b9e..00000000 Binary files a/_pagefind/pagefind.en_6352fc3c3c.pf_meta and /dev/null differ diff --git a/_pagefind/pagefind.en_8ffd7ed64b.pf_meta b/_pagefind/pagefind.en_8ffd7ed64b.pf_meta new file mode 100644 index 00000000..11557003 Binary files /dev/null and b/_pagefind/pagefind.en_8ffd7ed64b.pf_meta differ diff --git a/advanced/json-output/index.html b/advanced/json-output/index.html index 184b4881..f54ed6ce 100644 --- a/advanced/json-output/index.html +++ b/advanced/json-output/index.html @@ -7,7 +7,7 @@ - + diff --git a/advanced/subagents/index.html b/advanced/subagents/index.html index 52ce00ab..a6d5a59c 100644 --- a/advanced/subagents/index.html +++ b/advanced/subagents/index.html @@ -7,7 +7,7 @@ - + @@ -42,12 +42,12 @@ Key flags for subprocess usage: Positional arguments are the prompt. `@file` arguments attach file content as context. -## Built-in spawn_subagent tool +## Built-in subagent tool -Kit includes a built-in `spawn_subagent` tool that the LLM can use to delegate tasks to independent child agents: +Kit includes a built-in `subagent` tool that the LLM can use to delegate tasks to independent child agents: ``` -spawn_subagent( +subagent( task: "Analyze the test files and summarize coverage", model: "anthropic/claude-haiku-latest", // optional system_prompt: "You are a test analysis expert.", // optional @@ -71,7 +71,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{ ### Monitoring subagents from extensions -When the LLM (not the extension itself) spawns a subagent using the `spawn_subagent` tool, extensions can monitor its activity in real-time using three lifecycle event handlers: +When the LLM (not the extension itself) spawns a subagent using the `subagent` tool, extensions can monitor its activity in real-time using three lifecycle event handlers: ```go // Track active subagents and display their output @@ -157,11 +157,11 @@ result, err := host.Subagent(ctx, kit.SubagentConfig{ ### Real-time subagent events -Use `SubscribeSubagent` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the `spawn_subagent` tool). Register inside an `OnToolCall` handler using the tool call ID: +Use `SubscribeSubagent` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the `subagent` tool). Register inside an `OnToolCall` handler using the tool call ID: ```go host.OnToolCall(func(e kit.ToolCallEvent) { - if e.ToolName == "spawn_subagent" { + if e.ToolName == "subagent" { host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) { switch ev := event.(type) { case kit.MessageUpdateEvent: diff --git a/advanced/testing/index.html b/advanced/testing/index.html index 9691c282..3d2e02e7 100644 --- a/advanced/testing/index.html +++ b/advanced/testing/index.html @@ -7,7 +7,7 @@ - + diff --git a/assets/callbacks-Qmb83k7P.js b/assets/callbacks-Bhc1BBj7.js similarity index 99% rename from assets/callbacks-Qmb83k7P.js rename to assets/callbacks-Bhc1BBj7.js index bb0740c1..2b50602f 100644 --- a/assets/callbacks-Qmb83k7P.js +++ b/assets/callbacks-Bhc1BBj7.js @@ -56,9 +56,9 @@ const s={frontmatter:{title:"Callbacks",description:"Monitor tool calls and stre })

The first argument is a priority (lower = runs first).

Subagent event monitoring

-

Monitor real-time events from LLM-initiated subagents (when the model uses the spawn_subagent tool):

+

Monitor real-time events from LLM-initiated subagents (when the model uses the subagent tool):

host.OnToolCall(func(e kit.ToolCallEvent) {
-    if e.ToolName == "spawn_subagent" {
+    if e.ToolName == "subagent" {
         host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {
             // Receives the same event types as Subscribe(), scoped to the child agent
             switch ev := event.(type) {
@@ -142,11 +142,11 @@ The first argument is a priority (lower = runs first).
 
 ## Subagent event monitoring
 
-Monitor real-time events from LLM-initiated subagents (when the model uses the \`spawn_subagent\` tool):
+Monitor real-time events from LLM-initiated subagents (when the model uses the \`subagent\` tool):
 
 \`\`\`go
 host.OnToolCall(func(e kit.ToolCallEvent) {
-    if e.ToolName == "spawn_subagent" {
+    if e.ToolName == "subagent" {
         host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {
             // Receives the same event types as Subscribe(), scoped to the child agent
             switch ev := event.(type) {
diff --git a/assets/capabilities-_AepiUr_.js b/assets/capabilities-CbOsHlR1.js
similarity index 99%
rename from assets/capabilities-_AepiUr_.js
rename to assets/capabilities-CbOsHlR1.js
index 7e43a3e7..593b15f6 100644
--- a/assets/capabilities-_AepiUr_.js
+++ b/assets/capabilities-CbOsHlR1.js
@@ -237,7 +237,7 @@ const s={frontmatter:{title:"Capabilities",description:"All extension capabiliti
     SystemPrompt: "You are a test analysis expert.",
 })

Monitoring subagents spawned by the main agent

-

When the LLM uses the built-in spawn_subagent tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:

+

When the LLM uses the built-in subagent tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:

// Subagent started
 api.OnSubagentStart(func(e ext.SubagentStartEvent, ctx ext.Context) {
     // e.ToolCallID — unique ID for this subagent invocation
@@ -647,7 +647,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{
 
 ### Monitoring subagents spawned by the main agent
 
-When the LLM uses the built-in \`spawn_subagent\` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:
+When the LLM uses the built-in \`subagent\` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:
 
 \`\`\`go
 // Subagent started
diff --git a/assets/index-CYZSlfnb.js b/assets/index-Ena_EbZm.js
similarity index 95%
rename from assets/index-CYZSlfnb.js
rename to assets/index-Ena_EbZm.js
index a72fe541..f5bd50dc 100644
--- a/assets/index-CYZSlfnb.js
+++ b/assets/index-Ena_EbZm.js
@@ -51,11 +51,11 @@ Error generating stack: `+a.message+`
 [Documentation truncated...]`:u;p+=`
 
 Documentation:
-${d}`}return p}async function Gp(u,p,d,c){var A,O,z;const v=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({model:d,messages:[{role:"system",content:um(c)},...u.map(y=>({role:y.role,content:y.content}))]})});if(!v.ok){const y=await v.text();throw new Error(`OpenAI API error (${v.status}): ${y}`)}return((z=(O=(A=(await v.json()).choices)==null?void 0:A[0])==null?void 0:O.message)==null?void 0:z.content)||"No response."}async function Yp(u,p,d,c){var A,O;const v=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:d,max_tokens:1024,system:um(c),messages:u.map(z=>({role:z.role,content:z.content}))})});if(!v.ok){const z=await v.text();throw new Error(`Anthropic API error (${v.status}): ${z}`)}return((O=(A=(await v.json()).content)==null?void 0:A[0])==null?void 0:O.text)||"No response."}function Kp(u){return u==="openai"?"gpt-4o-mini":"claude-sonnet-4-20250514"}function Xp({provider:u,model:p,apiKey:d,context:c}){const[v,E]=B.useState(!1),[A,O]=B.useState([]),[z,y]=B.useState(""),[G,R]=B.useState(!1),[K,nt]=B.useState(null),bt=B.useRef(null),Dt=B.useRef(null),Mt=d||(typeof window<"u"?window.__TOME_AI_API_KEY__:void 0),W=p||Kp(u);B.useEffect(()=>{var Q;(Q=bt.current)==null||Q.scrollIntoView({behavior:"smooth"})},[A]),B.useEffect(()=>{v&&setTimeout(()=>{var Q;return(Q=Dt.current)==null?void 0:Q.focus()},100)},[v]);const I=B.useCallback(async()=>{const Q=z.trim();if(!Q||G||!Mt)return;const Y={role:"user",content:Q},H=[...A,Y];O(H),y(""),R(!0),nt(null);try{let U;u==="openai"?U=await Gp(H,Mt,W,c):U=await Yp(H,Mt,W,c),O(at=>[...at,{role:"assistant",content:U}])}catch(U){nt(U instanceof Error?U.message:"Failed to get response")}finally{R(!1)}},[z,G,A,u,Mt,W,c]),ct=B.useCallback(Q=>{Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),I())},[I]);return v?s.jsxs("div",{"data-testid":"ai-chat-panel",style:{position:"fixed",bottom:24,right:24,zIndex:900,width:380,maxWidth:"calc(100vw - 48px)",height:520,maxHeight:"calc(100vh - 48px)",background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:12,boxShadow:"0 16px 64px rgba(0,0,0,0.3)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"var(--font-body)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--bd)",flexShrink:0},children:[s.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--tx)"},children:"Ask AI"}),s.jsx("button",{"data-testid":"ai-chat-close",onClick:()=>E(!1),"aria-label":"Close AI chat",style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex",padding:4},children:s.jsx(qp,{})})]}),s.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px 16px"},children:[!Mt&&s.jsxs("div",{"data-testid":"ai-chat-no-key",style:{textAlign:"center",color:"var(--txM)",fontSize:13,padding:"24px 8px",lineHeight:1.6},children:[s.jsx("p",{style:{marginBottom:8,fontWeight:500,color:"var(--tx)"},children:"AI not configured"}),s.jsxs("p",{style:{marginBottom:8},children:["To enable AI chat, set the ",s.jsx("code",{style:{fontFamily:"var(--font-code)",fontSize:"0.88em",background:"var(--cdBg)",padding:"0.15em 0.4em",borderRadius:4},children:"apiKeyEnv"})," in ",s.jsx("code",{style:{fontFamily:"var(--font-code)",fontSize:"0.88em",background:"var(--cdBg)",padding:"0.15em 0.4em",borderRadius:4},children:"tome.config.js"})," and provide the environment variable at build time."]}),s.jsxs("p",{style:{fontSize:11.5,color:"var(--txM)"},children:["Example: ",s.jsx("code",{style:{fontFamily:"var(--font-code)",fontSize:"0.88em",background:"var(--cdBg)",padding:"0.15em 0.4em",borderRadius:4},children:"TOME_AI_KEY=sk-... tome build"})]})]}),A.map((Q,Y)=>s.jsx("div",{"data-testid":`ai-chat-message-${Q.role}`,style:{marginBottom:12,display:"flex",justifyContent:Q.role==="user"?"flex-end":"flex-start"},children:s.jsx("div",{style:{maxWidth:"85%",padding:"8px 12px",borderRadius:10,fontSize:13,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-word",background:Q.role==="user"?"var(--ac)":"var(--cdBg)",color:Q.role==="user"?"#fff":"var(--tx)"},children:Q.content})},Y)),G&&s.jsx("div",{"data-testid":"ai-chat-loading",style:{display:"flex",justifyContent:"flex-start",marginBottom:12},children:s.jsx("div",{style:{padding:"8px 12px",borderRadius:10,fontSize:13,background:"var(--cdBg)",color:"var(--txM)"},children:"Thinking..."})}),K&&s.jsx("div",{"data-testid":"ai-chat-error",style:{padding:"8px 12px",borderRadius:8,fontSize:12,background:"rgba(220,50,50,0.1)",color:"#d44",marginBottom:12},children:K}),s.jsx("div",{ref:bt})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderTop:"1px solid var(--bd)",flexShrink:0},children:[s.jsx("input",{ref:Dt,"data-testid":"ai-chat-input",value:z,onChange:Q=>y(Q.target.value),onKeyDown:ct,placeholder:Mt?"Ask a question...":"API key required",disabled:!Mt,style:{flex:1,background:"var(--cdBg)",border:"1px solid var(--bd)",borderRadius:8,padding:"8px 12px",color:"var(--tx)",fontSize:13,fontFamily:"var(--font-body)",outline:"none"}}),s.jsx("button",{"data-testid":"ai-chat-send",onClick:I,disabled:!Mt||!z.trim()||G,"aria-label":"Send message",style:{width:34,height:34,borderRadius:8,background:Mt&&z.trim()?"var(--ac)":"var(--cdBg)",color:Mt&&z.trim()?"#fff":"var(--txM)",border:"none",cursor:Mt&&z.trim()?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s.jsx(Lp,{})})]})]}):s.jsx("button",{"data-testid":"ai-chat-button",onClick:()=>E(!0),"aria-label":"Open AI chat",style:{position:"fixed",bottom:24,right:24,zIndex:900,width:48,height:48,borderRadius:"50%",background:"var(--ac)",color:"#fff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s"},children:s.jsx(Np,{})})}function Qp(u){const p=/^#([0-9a-f]{6})$/i.exec(u.trim());if(!p)return null;const d=parseInt(p[1],16);return[d>>16&255,d>>8&255,d&255]}function Zp(u,p){const d=Qp(u);if(!d)return null;const[c,v,E]=d,A=`rgba(${c},${v},${E},${p?.12:.08})`,O=p?1.15:.85,z=Math.min(255,Math.round(c*O)),y=Math.min(255,Math.round(v*O)),G=Math.min(255,Math.round(E*O)),R=`rgb(${z},${y},${G})`;return{ac:u,acD:A,acT:R}}const je=({d:u,size:p=16})=>s.jsx("svg",{width:p,height:p,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:u})}),rm=()=>s.jsx(je,{d:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3"}),Pd=()=>s.jsx(je,{d:"M9 18l6-6-6-6",size:14}),Zu=()=>s.jsx(je,{d:"M6 9l6 6 6-6",size:14}),Vp=()=>s.jsx(je,{d:"M3 12h18M3 6h18M3 18h18",size:20}),Jp=()=>s.jsx(je,{d:"M18 6L6 18M6 6l12 12",size:18}),tm=()=>s.jsx(je,{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"}),em=()=>s.jsx(je,{d:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0-4a1 1 0 0 1 1-1v-1a1 1 0 0 1-2 0v1a1 1 0 0 1 1 1Zm0 16a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1ZM4 12a1 1 0 0 1-1 1H2a1 1 0 0 1 0-2h1a1 1 0 0 1 1 1Zm18-1h-1a1 1 0 0 1 0 2h1a1 1 0 0 1 0-2ZM6.34 6.34a1 1 0 0 1-1.41 0l-.71-.71a1 1 0 0 1 1.41-1.41l.71.71a1 1 0 0 1 0 1.41Zm12.73-2.12-.71.71a1 1 0 0 1-1.41-1.41l.71-.71a1 1 0 1 1 1.41 1.41ZM6.34 17.66l-.71.71a1 1 0 0 1-1.41-1.41l.71-.71a1 1 0 0 1 1.41 1.41Zm12.73 2.12-.71-.71a1 1 0 0 1 1.41-1.41l.71.71a1 1 0 0 1-1.41 1.41Z"}),nm=()=>s.jsx(je,{d:"M19 12H5M12 19l-7-7 7-7",size:14}),am=()=>s.jsx(je,{d:"M5 12h14M12 5l7 7-7 7",size:14}),Wp=()=>s.jsx(je,{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",size:13});function Fp(u){const p=new Date(u),c=new Date().getTime()-p.getTime();if(isNaN(c))return"";const v=Math.floor(c/1e3),E=Math.floor(v/60),A=Math.floor(E/60),O=Math.floor(A/24),z=Math.floor(O/30),y=Math.floor(O/365);return v<60?"just now":E<60?`${E} minute${E===1?"":"s"} ago`:A<24?`${A} hour${A===1?"":"s"} ago`:O<30?`${O} day${O===1?"":"s"} ago`:z<12?`${z} month${z===1?"":"s"} ago`:y>=1?`${y} year${y===1?"":"s"} ago`:p.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}let ul=null;const $p="/_pagefind/pagefind.js";async function Ip(){if(ul)return ul;try{return ul=await import($p),await ul.init(),ul}catch{return null}}let ko=null;function Pp(){return ko||(ko=Lt(()=>import("./theme-BIHI7g3E.js"),[]).catch(()=>null),ko)}function t0({appId:u,apiKey:p,indexName:d,onNavigate:c,onClose:v,basePath:E=""}){const[A,O]=B.useState(null),[z,y]=B.useState(!1);B.useEffect(()=>{Pp().then(R=>{R&&R.DocSearch?O(()=>R.DocSearch):R&&R.default?O(()=>R.default):y(!0)})},[]);const G=B.useCallback(R=>{try{let nt=new URL(R,"http://localhost").pathname;if(E){const bt=E.replace(/\/$/,"");nt.startsWith(bt)&&(nt=nt.slice(bt.length))}return nt.replace(/^\//,"").replace(/\/index\.html$/,"").replace(/\.html$/,"")||"index"}catch{return"index"}},[E]);return z?s.jsx("div",{onClick:v,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:s.jsx("div",{onClick:R=>R.stopPropagation(),style:{background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:12,width:"100%",maxWidth:520,boxShadow:"0 24px 80px rgba(0,0,0,0.4)",padding:"32px 18px",textAlign:"center",color:"var(--txM)",fontSize:14},children:"Algolia DocSearch is not available. Install @docsearch/react to enable it."})}):A?s.jsx("div",{"data-testid":"algolia-search-modal",children:s.jsx(A,{appId:u,apiKey:p,indexName:d,navigator:{navigate({itemUrl:R}){const K=G(R);c(K)}},hitComponent:({hit:R,children:K})=>s.jsx("a",{href:R.url,onClick:nt=>{nt.preventDefault();const bt=G(R.url);c(bt)},children:K})})}):s.jsx("div",{onClick:v,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:s.jsx("div",{style:{background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:12,width:"100%",maxWidth:520,boxShadow:"0 24px 80px rgba(0,0,0,0.4)",padding:"32px 18px",textAlign:"center",color:"var(--txM)",fontSize:14},children:"Loading search..."})})}const e0=()=>s.jsx(je,{d:"M12 8v4l3 3m6-3a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z",size:14}),n0=()=>s.jsx(je,{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM3.6 9h16.8M3.6 15h16.8M12 3a15 15 0 0 1 4 9 15 15 0 0 1-4 9 15 15 0 0 1-4-9 15 15 0 0 1 4-9Z",size:14}),a0=()=>s.jsx(je,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3",size:11}),l0={github:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z",twitter:"M12.6.75h2.454l-5.36 6.142L16 15.25h-4.937l-3.867-5.07-4.425 5.07H.316l5.733-6.57L0 .75h5.063l3.495 4.633L12.601.75Zm-.86 13.028h1.36L4.323 2.145H2.865l8.875 11.633Z",discord:"M13.545 2.907a13.227 13.227 0 00-3.257-1.011.05.05 0 00-.052.025c-.141.25-.297.577-.406.833a12.19 12.19 0 00-3.658 0 8.258 8.258 0 00-.412-.833.051.051 0 00-.052-.025c-1.125.194-2.22.534-3.257 1.011a.041.041 0 00-.021.018C.356 6.024-.213 9.047.066 12.032c.001.014.01.028.021.037a13.276 13.276 0 003.995 2.02.05.05 0 00.056-.019c.308-.42.582-.863.818-1.329a.05.05 0 00-.028-.07 8.735 8.735 0 01-1.248-.595.05.05 0 01-.005-.083c.084-.063.168-.129.248-.195a.05.05 0 01.051-.007c2.619 1.196 5.454 1.196 8.041 0a.052.052 0 01.053.007c.08.066.164.132.248.195a.051.051 0 01-.004.085c-.399.232-.813.431-1.249.594a.05.05 0 00-.03.07c.24.465.515.909.817 1.329a.05.05 0 00.056.019 13.235 13.235 0 004.001-2.02.049.049 0 00.021-.037c.334-3.451-.559-6.449-2.366-9.106a.034.034 0 00-.02-.019z",linkedin:"M0 1.146C0 .513.526 0 1.175 0h13.65C15.474 0 16 .513 16 1.146v13.708c0 .633-.526 1.146-1.175 1.146H1.175C.526 16 0 15.487 0 14.854V1.146zm4.943 12.248V6.169H2.542v7.225h2.401zm-1.2-8.212c.837 0 1.358-.554 1.358-1.248-.015-.709-.52-1.248-1.342-1.248-.822 0-1.359.54-1.359 1.248 0 .694.521 1.248 1.327 1.248h.016zm4.908 8.212V9.359c0-.216.016-.432.08-.586.173-.431.568-.878 1.232-.878.869 0 1.216.662 1.216 1.634v3.865h2.401V9.25c0-2.22-1.184-3.252-2.764-3.252-1.274 0-1.845.7-2.165 1.193v.025h-.016a5.54 5.54 0 01.016-.025V6.169h-2.4c.03.678 0 7.225 0 7.225h2.4z",youtube:"M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 011.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 01-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 01-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 010 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 011.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 017.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z",mastodon:"M11.19 12.195c2.016-.24 3.77-1.475 3.99-2.603.348-1.778.32-4.339.32-4.339 0-3.47-2.286-4.488-2.286-4.488C12.062.238 10.083.017 8.027 0h-.05C5.92.017 3.942.238 2.79.765 2.79.765.504 1.783.504 5.253c-.005.995-.01 2.19.013 3.44.075 4.21.56 8.354 3.383 9.386 1.302.476 2.418.576 3.317.507 1.628-.125 2.541-.8 2.541-.8l-.054-1.182s-1.163.366-2.47.322c-1.293-.044-2.658-.138-2.867-1.716a3.23 3.23 0 01-.028-.465s1.27.31 2.879.384c.984.045 1.905-.058 2.842-.17zM13 8.59V5.319c0-.67-.17-1.2-.507-1.592-.348-.4-.806-.605-1.373-.605-.656 0-1.154.252-1.486.756L9.2 4.595l-.434-.717c-.332-.504-.83-.756-1.486-.756-.567 0-1.025.204-1.373.605-.338.392-.507.923-.507 1.592V8.59h1.69V5.468c0-.67.285-1.012.855-1.012.63 0 .946.404.946 1.204V7.11h1.682V5.66c0-.8.316-1.204.946-1.204.57 0 .855.342.855 1.012V8.59H13z",bluesky:"M3.468 1.948C5.303 3.325 7.276 6.118 8 7.616c.724-1.498 2.697-4.29 4.532-5.668C13.855 1.013 16 .638 16 3.14c0 .5-.286 4.2-.454 4.8-.585 2.093-2.716 2.628-4.544 2.305 3.195.564 4.007 2.433 2.25 4.302-3.337 3.548-4.8-1.244-5.252-2.547 0 0-.116-.334-.166-.334h.332C8.166 11.666 8.05 12 8.05 12c-.452 1.303-1.916 6.095-5.252 2.547-1.756-1.869-.946-3.738 2.25-4.302-1.829.323-3.96-.212-4.544-2.305C.336 7.34.05 3.64.05 3.14.05.638 2.195 1.013 3.468 1.948z"},i0=({platform:u,customIcon:p})=>{const d=u==="custom"&&p?p:l0[u];return d?s.jsx("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"currentColor",children:s.jsx("path",{d})}):null},o0={Added:"#22c55e",Changed:"#3b82f6",Deprecated:"#f59e0b",Removed:"#ef4444",Fixed:"#8b5cf6",Security:"#f97316"};function s0({entries:u}){const[p,d]=B.useState(u.length<=5),c=p?u:u.slice(0,5);return s.jsxs("div",{"data-testid":"changelog-timeline",style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",left:15,top:8,bottom:8,width:2,background:"var(--bd)"}}),c.map((v,E)=>s.jsxs("div",{"data-testid":`changelog-entry-${v.version}`,style:{position:"relative",paddingLeft:44,paddingBottom:E{const O=o0[A.type]||"#6b7280";return s.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,marginBottom:8},children:[s.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:O}}),s.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:O,fontFamily:"var(--font-code, monospace)"},children:A.type})]}),s.jsx("ul",{style:{margin:0,paddingLeft:18,listStyleType:"disc",color:"var(--tx2)"},children:A.items.map((z,y)=>s.jsx("li",{style:{fontSize:14,lineHeight:1.7,color:"var(--tx2)",marginBottom:2},children:z},y))})]},A.type)})]},v.version)),!p&&u.length>5&&s.jsx("div",{style:{textAlign:"center",marginTop:24},children:s.jsxs("button",{"data-testid":"changelog-show-more",onClick:()=>d(!0),style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"8px 20px",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body, inherit)",cursor:"pointer"},children:["Show all ",u.length," releases"]})})]})}function u0(u,p,d){if(p==="index")return[];for(const c of u)if(c.pages.find(E=>E.id===p)){const E=[],A=c.pages[0];return E.push({label:c.section,href:A?A.urlPath:null}),E.push({label:d,href:null}),E}return[]}function r0({config:u,navigation:p,currentPageId:d,pageHtml:c,pageComponent:v,mdxComponents:E,pageTitle:A,pageDescription:O,headings:z,tocEnabled:y=!0,editUrl:G,lastUpdated:R,changelogEntries:K,apiManifest:nt,apiBaseUrl:bt,apiPlayground:Dt,apiAuth:Mt,ApiReferenceComponent:W,onNavigate:I,allPages:ct,versioning:Q,currentVersion:Y,i18n:H,currentLocale:U,docContext:at,basePath:lt="",isDraft:P,dir:mt,overrides:tt}){var Ca,En,fi,dl,ml,hl,za,ja,pl,gl,qe,Qt,ne,tn,Ma,di,mi,vl,Cn;const At=U||(H==null?void 0:H.defaultLocale)||"en",$t=mt||((Ca=H==null?void 0:H.localeDirs)==null?void 0:Ca[At])||"ltr",ft=$t==="rtl",j=((En=u.theme)==null?void 0:En.mode)||"auto",[w,V]=B.useState(()=>{var x;return j==="dark"?!0:j==="light"?!1:((x=window.matchMedia)==null?void 0:x.call(window,"(prefers-color-scheme: dark)").matches)??!1}),[J,Tt]=B.useState(()=>typeof window<"u"&&window.innerWidth<768),[m,_]=B.useState(()=>typeof window<"u"&&window.innerWidth>=768),[N,L]=B.useState(!1),[it,rt]=B.useState(!1),[Et,It]=B.useState(!1),[Ut,Ve]=B.useState(null),[ha,pa]=B.useState({}),[rl,Je]=B.useState(()=>{var x;if(!((x=u.banner)!=null&&x.text))return!0;try{const q=Array.from(u.banner.text).reduce((et,dt)=>(et<<5)-et+dt.charCodeAt(0)|0,0).toString(36);return localStorage.getItem("tome-banner-dismissed")===q}catch{return!1}}),cl=Q&&Y&&Y!==Q.current,[ga,Do]=B.useState(p.map(x=>x.section)),We=B.useRef(null),Fn=B.useRef(null),fl=B.useRef(""),[va,Oo]=B.useState(()=>typeof window<"u"&&window.innerWidth>1100),si=((fi=u.theme)==null?void 0:fi.preset)||"amber",se=((dl=Ao[si])==null?void 0:dl[w?"dark":"light"])||Ao.amber.dark,ui=(ml=u.theme)!=null&&ml.accent?Zp(u.theme.accent,w):null,te=ui?{...se,...ui}:se,ya=((hl=Ao[si])==null?void 0:hl.fonts)||Ao.amber.fonts,bn={heading:((ja=(za=u.theme)==null?void 0:za.fonts)==null?void 0:ja.heading)||ya.heading,body:((gl=(pl=u.theme)==null?void 0:pl.fonts)==null?void 0:gl.body)||ya.body,code:((Qt=(qe=u.theme)==null?void 0:qe.fonts)==null?void 0:Qt.code)||ya.code};B.useEffect(()=>{if(j!=="auto")return;const x=window.matchMedia("(prefers-color-scheme: dark)"),q=et=>V(et.matches);return x.addEventListener("change",q),()=>x.removeEventListener("change",q)},[j]),B.useEffect(()=>{document.documentElement.classList.toggle("dark",w)},[w]),B.useEffect(()=>{const x=()=>{const q=window.innerWidth;Oo(q>1100),Tt(q<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]),B.useEffect(()=>{if(J&&m)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[J,m]),B.useEffect(()=>{var x;(x=We.current)==null||x.scrollTo(0,0)},[d]),B.useEffect(()=>{const x=We.current;if(!x)return;const q=et=>{const dt=et.target;dt.tagName==="IMG"&&dt.closest(".tome-content")&&Ve(dt.src)};return x.addEventListener("click",q),()=>x.removeEventListener("click",q)},[]),B.useEffect(()=>{const x=We.current;if(!x)return;const q=et=>{const dt=et.target.closest("a");if(!dt)return;const St=dt.getAttribute("href");if(!St||St.startsWith("http://")||St.startsWith("https://")||St.startsWith("mailto:")||St.startsWith("tel:")||St.startsWith("//")||St.startsWith("#"))return;et.preventDefault();let yt=St.replace(/^\.\//,"").replace(/^\//,"").replace(/\.mdx?$/,"").replace(/\/$/,"");if(lt){const ce=lt.replace(/^\//,"").replace(/\/$/,"");ce&&yt.startsWith(ce+"/")?yt=yt.slice(ce.length+1):ce&&yt===ce&&(yt="index")}yt||(yt="index"),I(yt)};return x.addEventListener("click",q),()=>x.removeEventListener("click",q)},[I,lt]),B.useEffect(()=>{if(!Ut)return;const x=q=>{q.key==="Escape"&&Ve(null)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[Ut]);const Sn=u.toc,ri=(Sn==null?void 0:Sn.depth)??3,xa=(Sn==null?void 0:Sn.enabled)!==!1&&y,ye=z.filter(x=>x.depth<=ri),[ue,Me]=B.useState("");B.useEffect(()=>{if(!xa||ye.length<2)return;const x=We.current;if(!x)return;const q=setTimeout(()=>{const et=[];for(const St of ye){const yt=x.querySelector(`#${CSS.escape(St.id)}`);yt&&et.push(yt)}if(et.length===0)return;const dt=new IntersectionObserver(St=>{const yt=St.filter(ce=>ce.isIntersecting).sort((ce,hi)=>ce.boundingClientRect.top-hi.boundingClientRect.top);yt.length>0&&Me(yt[0].target.id)},{root:x,rootMargin:"0px 0px -80% 0px",threshold:0});for(const St of et)dt.observe(St);ee.current=dt},100);return()=>{var et;clearTimeout(q),(et=ee.current)==null||et.disconnect(),ee.current=null}},[d,xa,ye.map(x=>x.id).join(",")]);const ee=B.useRef(null);B.useEffect(()=>{Me("")},[d]),B.useLayoutEffect(()=>{if(!Fn.current||!c)return;const x=c.replace(/]*>[\s\S]*?<\/h1>\s*/,"");Fn.current.innerHTML=x,fl.current=x},[c,d]);const ci=B.useCallback((x,q)=>{x.preventDefault();const et=We.current;if(!et)return;const dt=et.querySelector(`#${CSS.escape(q)}`);dt&&(dt.scrollIntoView({behavior:"smooth",block:"start"}),Me(q))},[]);B.useEffect(()=>{const x=q=>{(q.metaKey||q.ctrlKey)&&q.key==="k"&&(q.preventDefault(),L(!0)),q.key==="Escape"&&L(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const ba=p.flatMap(x=>x.pages),Sa=ba.findIndex(x=>x.id===d),Fe=Sa>0?ba[Sa-1]:null,$e=SaDo(q=>q.includes(x)?q.filter(et=>et!==x):[...q,x]),Ta={"--bg":te.bg,"--sf":te.sf,"--sfH":te.sfH,"--bd":te.bd,"--tx":te.tx,"--tx2":te.tx2,"--txM":te.txM,"--ac":te.ac,"--acD":te.acD,"--acT":te.acT,"--cdBg":te.cdBg,"--cdTx":te.cdTx,"--sbBg":te.sbBg,"--hdBg":te.hdBg,"--font-heading":`"${bn.heading}", serif`,"--font-body":`"${bn.body}", sans-serif`,"--font-code":`"${bn.code}", monospace`},Tn=v,Ne=(ne=u.banner)==null?void 0:ne.link,Ea=Ne?Ne.startsWith("#")||lt&&Ne.startsWith(lt+"/"):!1;return s.jsxs("div",{dir:$t,className:"tome-grain",style:{...Ta,color:"var(--tx)",background:"var(--bg)",fontFamily:"var(--font-body)",height:"100vh",overflow:"clip"},children:[((tn=u.banner)==null?void 0:tn.text)&&!rl&&s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,background:"var(--ac)",color:"#fff",padding:"8px 16px",fontSize:13,fontFamily:"var(--font-body)",fontWeight:500,textAlign:"center",width:"100vw",boxSizing:"border-box"},children:[u.banner.link?s.jsx("a",{href:Ea&&Ne.startsWith("#")?lt+"/"+Ne.slice(1):Ne,...Ea?{}:{target:"_blank",rel:"noopener noreferrer"},style:{color:"#fff",textDecoration:"underline"},onClick:Ea?x=>{x.preventDefault();const q=lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),et=Ne.startsWith("#")?Ne.slice(1):Ne.replace(new RegExp("^"+q+"/?"),"");I(et||"index")}:void 0,children:u.banner.text}):s.jsx("span",{children:u.banner.text}),u.banner.dismissible!==!1&&s.jsx("button",{onClick:()=>{Je(!0);try{const x=Array.from(u.banner.text).reduce((q,et)=>(q<<5)-q+et.charCodeAt(0)|0,0).toString(36);localStorage.setItem("tome-banner-dismissed",x)}catch{}},"aria-label":"Dismiss banner",style:{background:"none",border:"none",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,opacity:.8},children:"×"})]}),N&&((Ma=u.search)==null?void 0:Ma.provider)==="algolia"&&u.search.appId&&u.search.apiKey&&u.search.indexName?s.jsx(t0,{appId:u.search.appId,apiKey:u.search.apiKey,indexName:u.search.indexName,onNavigate:x=>{I(x),L(!1)},onClose:()=>L(!1),basePath:lt}):N?s.jsx(c0,{allPages:ct,onNavigate:x=>{I(x),L(!1)},onClose:()=>L(!1),mobile:J}):null,s.jsxs("div",{style:{display:"flex",flexDirection:ft?"row-reverse":"row",flex:1,height:(di=u.banner)!=null&&di.text&&!rl?"calc(100vh - 32px)":"100vh"},children:[J&&m&&s.jsx("div",{onClick:()=>_(!1),style:{position:"fixed",inset:0,zIndex:200,background:"rgba(0,0,0,0.4)",backdropFilter:"blur(2px)"}}),tt!=null&&tt.Sidebar?s.jsx(tt.Sidebar,{config:u,navigation:p,currentPageId:d,onNavigate:I,mobile:J,sbOpen:m,setSbOpen:_,versioning:Q,currentVersion:Y}):s.jsxs("aside",{style:{width:m?270:0,minWidth:m?270:0,background:"var(--sbBg)",[ft?"borderLeft":"borderRight"]:"1px solid var(--bd)",display:"flex",flexDirection:"column",transition:"width .2s, min-width .2s",overflow:"hidden",...J?{position:"fixed",top:0,[ft?"right":"left"]:0,bottom:0,zIndex:201}:{}},children:[s.jsxs("a",{href:"/",style:{padding:"18px 20px",display:"flex",alignItems:"baseline",gap:6,borderBottom:"1px solid var(--bd)",textDecoration:"none",color:"inherit"},children:[s.jsx("span",{style:{fontFamily:"var(--font-heading)",fontSize:22,fontWeight:700,fontStyle:"italic"},children:u.name}),s.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"var(--ac)",display:"inline-block"}})]}),s.jsx("div",{style:{padding:"12px 14px"},children:s.jsxs("button",{onClick:()=>{L(!0),J&&_(!1)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",background:"var(--cdBg)",border:"1px solid var(--bd)",borderRadius:2,padding:"8px 12px",cursor:"pointer",color:"var(--txM)",fontSize:12.5,fontFamily:"var(--font-body)"},children:[s.jsx(rm,{}),s.jsx("span",{style:{flex:1,textAlign:ft?"right":"left"},children:"Search..."}),s.jsx("kbd",{style:{fontFamily:"var(--font-code)",fontSize:9,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,padding:"2px 6px"},children:"⌘K"})]})}),s.jsx("nav",{style:{flex:1,overflow:"auto",padding:"4px 10px 20px"},children:p.map(x=>s.jsxs("div",{style:{marginBottom:8},children:[s.jsxs("button",{onClick:()=>Pe(x.section),style:{display:"flex",alignItems:"center",gap:6,width:"100%",background:"none",border:"none",padding:"8px 10px",cursor:"pointer",borderRadius:2,color:"var(--txM)",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".1em",fontFamily:"var(--font-code)"},children:[ga.includes(x.section)?s.jsx(Zu,{}):s.jsx(Pd,{}),x.section]}),ga.includes(x.section)&&s.jsx("div",{style:{[ft?"marginRight":"marginLeft"]:8,[ft?"borderRight":"borderLeft"]:"1px solid var(--bd)",[ft?"paddingRight":"paddingLeft"]:0},children:x.pages.map(q=>{const et=d===q.id;return s.jsxs("button",{onClick:()=>{I(q.id),J&&_(!1)},style:{display:"flex",alignItems:"center",gap:10,width:"100%",textAlign:ft?"right":"left",background:"none",border:"none",borderRadius:0,[ft?"borderRight":"borderLeft"]:et?"2px solid var(--ac)":"2px solid transparent",padding:"7px 14px",cursor:"pointer",color:et?"var(--ac)":"var(--tx2)",fontSize:13,fontWeight:et?500:400,fontFamily:"var(--font-body)",transition:"all .12s"},children:[q.title,q.badge&&(()=>{const dt={default:{bg:"var(--sf)",text:"var(--tx2)"},info:{bg:"rgba(59,130,246,0.15)",text:"rgb(59,130,246)"},success:{bg:"rgba(34,197,94,0.15)",text:"rgb(34,197,94)"},warning:{bg:"rgba(234,179,8,0.15)",text:"rgb(202,138,4)"},danger:{bg:"rgba(239,68,68,0.15)",text:"rgb(239,68,68)"}},St=dt[q.badge.variant||"default"]||dt.default;return s.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:4,marginLeft:6,whiteSpace:"nowrap",background:St.bg,color:St.text},children:q.badge.text})})()]},q.id)})})]},x.section))}),Q&&J&&s.jsx("div",{style:{padding:"8px 16px",borderTop:"1px solid var(--bd)",display:"flex",gap:6},children:Q.versions.map(x=>s.jsxs("button",{onClick:()=>{const q=x===Q.current?"index":`${x}/index`;I(q)},style:{flex:1,padding:"3px 0",textAlign:"center",background:x===(Y||Q.current)?"var(--acD)":"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,cursor:"pointer",color:x===(Y||Q.current)?"var(--ac)":"var(--tx2)",fontSize:11,fontFamily:"var(--font-code)",fontWeight:x===Q.current?600:400},children:[x,x===Q.current?" (latest)":""]},x))}),s.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--bd)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[j==="auto"?s.jsx("button",{"aria-label":w?"Switch to light mode":"Switch to dark mode",onClick:()=>V(x=>!x),style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex"},children:w?s.jsx(em,{}):s.jsx(tm,{})}):s.jsx("div",{}),s.jsxs("span",{style:{fontSize:11,color:"var(--txM)",letterSpacing:.2},children:["Built with ","♡"," by Tome"]}),s.jsx("span",{style:{fontFamily:"var(--font-code)",fontSize:10,color:"var(--txM)"},children:"v0.5.0"})]})]}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[tt!=null&&tt.Header?s.jsx(tt.Header,{config:u,navigation:p,currentPageId:d,onNavigate:I,mobile:J,sbOpen:m,setSbOpen:_,isDark:w,setDark:V,versioning:Q,currentVersion:Y,i18n:H,currentLocale:U,onSearchOpen:()=>L(!0),basePath:lt}):s.jsxs("header",{style:{display:"flex",alignItems:"center",gap:J?8:12,padding:J?"8px 12px":"10px 24px",borderBottom:"1px solid var(--bd)",background:"var(--hdBg)",backdropFilter:"blur(12px)",maxWidth:"100vw",overflow:"visible",position:"relative",zIndex:200},children:[s.jsx("button",{"aria-label":m?"Close sidebar":"Open sidebar",onClick:()=>_(!m),style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex"},children:m?s.jsx(Jp,{}):s.jsx(Vp,{})}),J?s.jsx("span",{style:{fontSize:13,color:"var(--ac)",fontFamily:"var(--font-code)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((mi=p.flatMap(x=>x.pages).find(x=>x.id===d))==null?void 0:mi.title)||""}):s.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-code)",fontSize:11,color:"var(--txM)",letterSpacing:".03em",flex:1},children:p.map(x=>{const q=x.pages.find(et=>et.id===d);return q?s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{children:x.section}),s.jsx(Pd,{}),s.jsx("span",{style:{color:"var(--ac)"},children:q.title})]},x.section):null})}),u.topNav&&u.topNav.length>0&&!J&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[u.topNav.map(x=>{const q=x.href.startsWith("#")||lt&&x.href.startsWith(lt+"/"),et=!q;return s.jsxs("a",{href:q&&x.href.startsWith("#")?lt+"/"+x.href.slice(1):x.href,...et?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:q?dt=>{dt.preventDefault();const St=x.href.startsWith("#")?x.href.slice(1):x.href.replace(new RegExp("^"+lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"/?"),"");I(St)}:void 0,style:{display:"flex",alignItems:"center",gap:4,color:"var(--txM)",textDecoration:"none",fontSize:12,fontFamily:"var(--font-body)",fontWeight:500,transition:"color .15s"},onMouseOver:dt=>dt.currentTarget.style.color="var(--ac)",onMouseOut:dt=>dt.currentTarget.style.color="var(--txM)",children:[x.label,et&&s.jsx(a0,{})]},x.label)}),s.jsx("span",{style:{width:1,height:16,background:"var(--bd)"}})]}),u.socialLinks&&u.socialLinks.length>0&&!J&&s.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:u.socialLinks.map(x=>s.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer","aria-label":x.label||x.platform,"data-testid":`social-link-${x.platform}`,style:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--tx2)",cursor:"pointer",transition:"color .15s"},onMouseOver:q=>q.currentTarget.style.color="var(--tx)",onMouseOut:q=>q.currentTarget.style.color="var(--tx2)",children:s.jsx(i0,{platform:x.platform,customIcon:x.icon})},x.url))}),J&&j==="auto"&&s.jsx("button",{"aria-label":w?"Switch to light mode":"Switch to dark mode",onClick:()=>V(x=>!x),style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex",flexShrink:0},children:w?s.jsx(em,{}):s.jsx(tm,{})}),Q&&!J&&s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{"data-testid":"version-switcher",onClick:()=>rt(x=>!x),style:{display:"flex",alignItems:"center",gap:6,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,padding:"5px 10px",cursor:"pointer",color:"var(--tx2)",fontSize:12,fontFamily:"var(--font-code)"},children:[s.jsx(e0,{}),Y||Q.current,s.jsx(Zu,{})]}),it&&s.jsx("div",{"data-testid":"version-dropdown",style:{position:"absolute",top:"100%",right:0,marginTop:4,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.2)",overflow:"hidden",zIndex:100,minWidth:120},children:Q.versions.map(x=>s.jsxs("button",{onClick:()=>{rt(!1);const q=x===Q.current?"index":`${x}/index`;I(q)},style:{display:"block",width:"100%",textAlign:"left",background:x===(Y||Q.current)?"var(--acD)":"none",border:"none",padding:"8px 14px",cursor:"pointer",color:x===(Y||Q.current)?"var(--ac)":"var(--tx2)",fontSize:12,fontFamily:"var(--font-code)",fontWeight:x===Q.current?600:400},children:[x,x===Q.current?" (latest)":""]},x))})]}),H&&H.locales.length>1&&!J&&s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{"data-testid":"language-switcher",onClick:()=>It(x=>!x),style:{display:"flex",alignItems:"center",gap:6,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,padding:"5px 10px",cursor:"pointer",color:"var(--tx2)",fontSize:12,fontFamily:"var(--font-body)"},children:[s.jsx(n0,{}),((vl=H.localeNames)==null?void 0:vl[U||H.defaultLocale])||U||H.defaultLocale,s.jsx(Zu,{})]}),Et&&s.jsx("div",{"data-testid":"language-dropdown",style:{position:"absolute",top:"100%",right:0,marginTop:4,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.2)",overflow:"hidden",zIndex:100,minWidth:120},children:H.locales.map(x=>{var ce;const q=x===(U||H.defaultLocale),et=((ce=H.localeNames)==null?void 0:ce[x])||x,dt=U||H.defaultLocale;let St=d;dt!==H.defaultLocale&&d.startsWith(`${dt}/`)&&(St=d.slice(dt.length+1));const yt=x===H.defaultLocale?St:`${x}/${St}`;return s.jsx("button",{onClick:()=>{It(!1),I(yt)},style:{display:"block",width:"100%",textAlign:"left",background:q?"var(--acD)":"none",border:"none",padding:"8px 14px",cursor:"pointer",color:q?"var(--ac)":"var(--tx2)",fontSize:12,fontFamily:"var(--font-body)",fontWeight:q?600:400},children:et},x)})})]})]}),cl&&s.jsxs("div",{"data-testid":"old-version-banner",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,background:"var(--acD)",borderBottom:"1px solid var(--bd)",padding:"8px 24px",fontSize:13,color:"var(--tx2)"},children:[s.jsxs("span",{children:["You're viewing docs for ",Y,"."]}),s.jsx("button",{onClick:()=>{I("index")},style:{background:"none",border:"none",color:"var(--ac)",cursor:"pointer",fontWeight:600,fontSize:13,fontFamily:"var(--font-body)",textDecoration:"underline"},children:"Switch to latest."})]}),s.jsxs("div",{ref:We,style:{flex:1,overflow:"auto",display:"flex"},children:[s.jsxs("main",{style:{flex:1,maxWidth:J?"100%":nt?1100:760,padding:J?"24px 16px 60px":"40px 48px 80px",margin:"0 auto",minWidth:0},children:[Ie.length>0&&s.jsx("nav",{"aria-label":"Breadcrumbs","data-testid":"breadcrumbs",style:{display:"flex",alignItems:"center",gap:6,fontSize:13,color:"var(--tx2)",marginBottom:8},children:Ie.map((x,q)=>s.jsxs(sm.Fragment,{children:[q>0&&s.jsx("span",{style:{color:"var(--tx2)",opacity:.5},children:"›"}),q{et.preventDefault();const dt=p.flatMap(St=>St.pages).find(St=>St.urlPath===x.href);dt&&I(dt.id)},style:{color:"var(--tx2)",textDecoration:"none",cursor:"pointer"},children:x.label}):s.jsx("span",{style:q===Ie.length-1?{color:"var(--tx)"}:void 0,children:x.label})]},q))}),s.jsx("h1",{style:{fontFamily:"var(--font-heading)",fontSize:J?26:38,fontWeight:400,fontStyle:"italic",lineHeight:1.15,marginBottom:8},children:A}),P&&s.jsx("div",{"data-testid":"draft-banner",style:{background:"#fef3c7",color:"#92400e",padding:"8px 16px",borderRadius:6,fontSize:13,marginBottom:16},children:"Draft — This page is only visible in development"}),O&&s.jsx("p",{style:{fontSize:16,color:"var(--tx2)",lineHeight:1.6,marginBottom:32},children:O}),s.jsx("div",{style:{borderTop:"1px solid var(--bd)",paddingTop:28},children:nt&&W?s.jsx(W,{manifest:nt,baseUrl:bt,showPlayground:Dt,playgroundAuth:Mt}):K&&K.length>0?s.jsx(s0,{entries:K}):Tn?s.jsx("div",{className:"tome-content",children:s.jsx(Tn,{components:E||{}})}):s.jsx("div",{className:"tome-content",ref:Fn},d)}),tt!=null&&tt.PageFooter?s.jsx(tt.PageFooter,{editUrl:G,lastUpdated:R,currentPageId:d,prev:Fe,next:$e,onNavigate:I,mobile:J}):s.jsxs(s.Fragment,{children:[(G||R)&&s.jsxs("div",{style:{marginTop:40,display:"flex",flexDirection:J?"column":"row",alignItems:J?"flex-start":"center",justifyContent:"space-between",gap:J?8:16},children:[G&&s.jsx("div",{"data-testid":"edit-page-link",children:s.jsxs("a",{href:G,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--txM)",textDecoration:"none",fontSize:13,fontFamily:"var(--font-body)",transition:"color .15s"},onMouseOver:x=>x.currentTarget.style.color="var(--ac)",onMouseOut:x=>x.currentTarget.style.color="var(--txM)",children:[s.jsx(Wp,{})," Edit this page on GitHub"]})}),R&&s.jsxs("div",{"data-testid":"last-updated",style:{fontSize:12,color:"var(--txM)",fontFamily:"var(--font-body)"},children:["Last updated ",Fp(R)]})]}),s.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:24,padding:"12px 0"},children:ha[d]?s.jsx("span",{style:{fontSize:13,color:"var(--txM)",fontFamily:"var(--font-body)"},children:"Thanks for your feedback!"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{fontSize:13,color:"var(--txM)",fontFamily:"var(--font-body)"},children:"Was this helpful?"}),s.jsx("button",{onClick:()=>{pa(x=>({...x,[d]:!0}));try{localStorage.setItem(`tome-feedback-${d}`,"up")}catch{}},style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"4px 10px",cursor:"pointer",fontSize:13,color:"var(--txM)",transition:"border-color .15s"},children:"👍"}),s.jsx("button",{onClick:()=>{pa(x=>({...x,[d]:!0}));try{localStorage.setItem(`tome-feedback-${d}`,"down")}catch{}},style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"4px 10px",cursor:"pointer",fontSize:13,color:"var(--txM)",transition:"border-color .15s"},children:"👎"})]})}),s.jsxs("div",{style:{display:"flex",flexDirection:J?"column":"row",justifyContent:"space-between",marginTop:16,paddingTop:24,borderTop:"1px solid var(--bd)",gap:J?12:16},children:[Fe?s.jsxs("button",{onClick:()=>I(Fe.id),style:{display:"flex",alignItems:"center",gap:8,background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"10px 16px",cursor:"pointer",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body)",transition:"border-color .15s, color .15s"},children:[ft?s.jsx(am,{}):s.jsx(nm,{})," ",Fe.title]}):s.jsx("div",{}),$e?s.jsxs("button",{onClick:()=>I($e.id),style:{display:"flex",alignItems:"center",gap:8,background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"10px 16px",cursor:"pointer",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body)",transition:"border-color .15s, color .15s"},children:[$e.title," ",ft?s.jsx(nm,{}):s.jsx(am,{})]}):s.jsx("div",{})]})]})]}),tt!=null&&tt.Toc?xa&&ye.length>=2&&va&&s.jsx(tt.Toc,{headings:ye,activeHeadingId:ue,onScrollToHeading:ci}):xa&&ye.length>=2&&va&&s.jsxs("aside",{"data-testid":"toc-sidebar",style:{width:200,padding:ft?"40px 0 40px 16px":"40px 16px 40px 0",position:"sticky",top:0,alignSelf:"flex-start",flexShrink:0},children:[s.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".1em",color:"var(--txM)",marginBottom:12,fontFamily:"var(--font-code)"},children:"On this page"}),s.jsx("nav",{"aria-label":"Table of contents",style:{[ft?"borderRight":"borderLeft"]:"1px solid var(--bd)",[ft?"paddingRight":"paddingLeft"]:0},children:ye.map((x,q)=>{const et=ue===x.id;return s.jsx("a",{href:`#${x.id}`,onClick:dt=>ci(dt,x.id),"data-testid":`toc-link-${x.id}`,style:{display:"block",fontSize:12,color:et?"var(--ac)":"var(--txM)",fontWeight:et?500:400,textDecoration:"none",padding:"4px 12px",[ft?"paddingRight":"paddingLeft"]:12+(x.depth-2)*12,lineHeight:1.4,transition:"color .15s, font-weight .15s",[ft?"borderRight":"borderLeft"]:et?"2px solid var(--ac)":"2px solid transparent",[ft?"marginRight":"marginLeft"]:-1},children:x.text},q)})})]})]})]})]}),(tt==null?void 0:tt.Footer)&&s.jsx(tt.Footer,{config:u,navigation:p,currentPageId:d,onNavigate:I}),((Cn=u.ai)==null?void 0:Cn.enabled)&&s.jsx(Xp,{provider:u.ai.provider||"anthropic",model:u.ai.model,apiKey:typeof __TOME_AI_API_KEY__<"u"&&__TOME_AI_API_KEY__?__TOME_AI_API_KEY__:void 0,context:(at==null?void 0:at.map(x=>`## ${x.title}
+${d}`}return p}async function Gp(u,p,d,c){var A,O,z;const v=await fetch("https://api.openai.com/v1/chat/completions",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${p}`},body:JSON.stringify({model:d,messages:[{role:"system",content:um(c)},...u.map(y=>({role:y.role,content:y.content}))]})});if(!v.ok){const y=await v.text();throw new Error(`OpenAI API error (${v.status}): ${y}`)}return((z=(O=(A=(await v.json()).choices)==null?void 0:A[0])==null?void 0:O.message)==null?void 0:z.content)||"No response."}async function Yp(u,p,d,c){var A,O;const v=await fetch("https://api.anthropic.com/v1/messages",{method:"POST",headers:{"Content-Type":"application/json","x-api-key":p,"anthropic-version":"2023-06-01","anthropic-dangerous-direct-browser-access":"true"},body:JSON.stringify({model:d,max_tokens:1024,system:um(c),messages:u.map(z=>({role:z.role,content:z.content}))})});if(!v.ok){const z=await v.text();throw new Error(`Anthropic API error (${v.status}): ${z}`)}return((O=(A=(await v.json()).content)==null?void 0:A[0])==null?void 0:O.text)||"No response."}function Kp(u){return u==="openai"?"gpt-4o-mini":"claude-sonnet-4-20250514"}function Xp({provider:u,model:p,apiKey:d,context:c}){const[v,E]=B.useState(!1),[A,O]=B.useState([]),[z,y]=B.useState(""),[G,R]=B.useState(!1),[K,nt]=B.useState(null),bt=B.useRef(null),Dt=B.useRef(null),Mt=d||(typeof window<"u"?window.__TOME_AI_API_KEY__:void 0),W=p||Kp(u);B.useEffect(()=>{var Q;(Q=bt.current)==null||Q.scrollIntoView({behavior:"smooth"})},[A]),B.useEffect(()=>{v&&setTimeout(()=>{var Q;return(Q=Dt.current)==null?void 0:Q.focus()},100)},[v]);const I=B.useCallback(async()=>{const Q=z.trim();if(!Q||G||!Mt)return;const Y={role:"user",content:Q},H=[...A,Y];O(H),y(""),R(!0),nt(null);try{let U;u==="openai"?U=await Gp(H,Mt,W,c):U=await Yp(H,Mt,W,c),O(at=>[...at,{role:"assistant",content:U}])}catch(U){nt(U instanceof Error?U.message:"Failed to get response")}finally{R(!1)}},[z,G,A,u,Mt,W,c]),ct=B.useCallback(Q=>{Q.key==="Enter"&&!Q.shiftKey&&(Q.preventDefault(),I())},[I]);return v?s.jsxs("div",{"data-testid":"ai-chat-panel",style:{position:"fixed",bottom:24,right:24,zIndex:900,width:380,maxWidth:"calc(100vw - 48px)",height:520,maxHeight:"calc(100vh - 48px)",background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:12,boxShadow:"0 16px 64px rgba(0,0,0,0.3)",display:"flex",flexDirection:"column",overflow:"hidden",fontFamily:"var(--font-body)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--bd)",flexShrink:0},children:[s.jsx("span",{style:{fontSize:14,fontWeight:600,color:"var(--tx)"},children:"Ask AI"}),s.jsx("button",{"data-testid":"ai-chat-close",onClick:()=>E(!1),"aria-label":"Close AI chat",style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex",padding:4},children:s.jsx(qp,{})})]}),s.jsxs("div",{style:{flex:1,overflow:"auto",padding:"12px 16px"},children:[!Mt&&s.jsxs("div",{"data-testid":"ai-chat-no-key",style:{textAlign:"center",color:"var(--txM)",fontSize:13,padding:"24px 8px",lineHeight:1.6},children:[s.jsx("p",{style:{marginBottom:8,fontWeight:500,color:"var(--tx)"},children:"AI not configured"}),s.jsxs("p",{style:{marginBottom:8},children:["To enable AI chat, set the ",s.jsx("code",{style:{fontFamily:"var(--font-code)",fontSize:"0.88em",background:"var(--cdBg)",padding:"0.15em 0.4em",borderRadius:4},children:"apiKeyEnv"})," in ",s.jsx("code",{style:{fontFamily:"var(--font-code)",fontSize:"0.88em",background:"var(--cdBg)",padding:"0.15em 0.4em",borderRadius:4},children:"tome.config.js"})," and provide the environment variable at build time."]}),s.jsxs("p",{style:{fontSize:11.5,color:"var(--txM)"},children:["Example: ",s.jsx("code",{style:{fontFamily:"var(--font-code)",fontSize:"0.88em",background:"var(--cdBg)",padding:"0.15em 0.4em",borderRadius:4},children:"TOME_AI_KEY=sk-... tome build"})]})]}),A.map((Q,Y)=>s.jsx("div",{"data-testid":`ai-chat-message-${Q.role}`,style:{marginBottom:12,display:"flex",justifyContent:Q.role==="user"?"flex-end":"flex-start"},children:s.jsx("div",{style:{maxWidth:"85%",padding:"8px 12px",borderRadius:10,fontSize:13,lineHeight:1.55,whiteSpace:"pre-wrap",wordBreak:"break-word",background:Q.role==="user"?"var(--ac)":"var(--cdBg)",color:Q.role==="user"?"#fff":"var(--tx)"},children:Q.content})},Y)),G&&s.jsx("div",{"data-testid":"ai-chat-loading",style:{display:"flex",justifyContent:"flex-start",marginBottom:12},children:s.jsx("div",{style:{padding:"8px 12px",borderRadius:10,fontSize:13,background:"var(--cdBg)",color:"var(--txM)"},children:"Thinking..."})}),K&&s.jsx("div",{"data-testid":"ai-chat-error",style:{padding:"8px 12px",borderRadius:8,fontSize:12,background:"rgba(220,50,50,0.1)",color:"#d44",marginBottom:12},children:K}),s.jsx("div",{ref:bt})]}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 12px",borderTop:"1px solid var(--bd)",flexShrink:0},children:[s.jsx("input",{ref:Dt,"data-testid":"ai-chat-input",value:z,onChange:Q=>y(Q.target.value),onKeyDown:ct,placeholder:Mt?"Ask a question...":"API key required",disabled:!Mt,style:{flex:1,background:"var(--cdBg)",border:"1px solid var(--bd)",borderRadius:8,padding:"8px 12px",color:"var(--tx)",fontSize:13,fontFamily:"var(--font-body)",outline:"none"}}),s.jsx("button",{"data-testid":"ai-chat-send",onClick:I,disabled:!Mt||!z.trim()||G,"aria-label":"Send message",style:{width:34,height:34,borderRadius:8,background:Mt&&z.trim()?"var(--ac)":"var(--cdBg)",color:Mt&&z.trim()?"#fff":"var(--txM)",border:"none",cursor:Mt&&z.trim()?"pointer":"default",display:"flex",alignItems:"center",justifyContent:"center",flexShrink:0},children:s.jsx(Lp,{})})]})]}):s.jsx("button",{"data-testid":"ai-chat-button",onClick:()=>E(!0),"aria-label":"Open AI chat",style:{position:"fixed",bottom:24,right:24,zIndex:900,width:48,height:48,borderRadius:"50%",background:"var(--ac)",color:"#fff",border:"none",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",boxShadow:"0 4px 16px rgba(0,0,0,0.25)",transition:"transform 0.15s"},children:s.jsx(Np,{})})}function Qp(u){const p=/^#([0-9a-f]{6})$/i.exec(u.trim());if(!p)return null;const d=parseInt(p[1],16);return[d>>16&255,d>>8&255,d&255]}function Zp(u,p){const d=Qp(u);if(!d)return null;const[c,v,E]=d,A=`rgba(${c},${v},${E},${p?.12:.08})`,O=p?1.15:.85,z=Math.min(255,Math.round(c*O)),y=Math.min(255,Math.round(v*O)),G=Math.min(255,Math.round(E*O)),R=`rgb(${z},${y},${G})`;return{ac:u,acD:A,acT:R}}const je=({d:u,size:p=16})=>s.jsx("svg",{width:p,height:p,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",children:s.jsx("path",{d:u})}),rm=()=>s.jsx(je,{d:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3"}),Pd=()=>s.jsx(je,{d:"M9 18l6-6-6-6",size:14}),Zu=()=>s.jsx(je,{d:"M6 9l6 6 6-6",size:14}),Vp=()=>s.jsx(je,{d:"M3 12h18M3 6h18M3 18h18",size:20}),Jp=()=>s.jsx(je,{d:"M18 6L6 18M6 6l12 12",size:18}),tm=()=>s.jsx(je,{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"}),em=()=>s.jsx(je,{d:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0-4a1 1 0 0 1 1-1v-1a1 1 0 0 1-2 0v1a1 1 0 0 1 1 1Zm0 16a1 1 0 0 1 1 1v1a1 1 0 0 1-2 0v-1a1 1 0 0 1 1-1ZM4 12a1 1 0 0 1-1 1H2a1 1 0 0 1 0-2h1a1 1 0 0 1 1 1Zm18-1h-1a1 1 0 0 1 0 2h1a1 1 0 0 1 0-2ZM6.34 6.34a1 1 0 0 1-1.41 0l-.71-.71a1 1 0 0 1 1.41-1.41l.71.71a1 1 0 0 1 0 1.41Zm12.73-2.12-.71.71a1 1 0 0 1-1.41-1.41l.71-.71a1 1 0 1 1 1.41 1.41ZM6.34 17.66l-.71.71a1 1 0 0 1-1.41-1.41l.71-.71a1 1 0 0 1 1.41 1.41Zm12.73 2.12-.71-.71a1 1 0 0 1 1.41-1.41l.71.71a1 1 0 0 1-1.41 1.41Z"}),nm=()=>s.jsx(je,{d:"M19 12H5M12 19l-7-7 7-7",size:14}),am=()=>s.jsx(je,{d:"M5 12h14M12 5l7 7-7 7",size:14}),Wp=()=>s.jsx(je,{d:"M17 3a2.83 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z",size:13});function Fp(u){const p=new Date(u),c=new Date().getTime()-p.getTime();if(isNaN(c))return"";const v=Math.floor(c/1e3),E=Math.floor(v/60),A=Math.floor(E/60),O=Math.floor(A/24),z=Math.floor(O/30),y=Math.floor(O/365);return v<60?"just now":E<60?`${E} minute${E===1?"":"s"} ago`:A<24?`${A} hour${A===1?"":"s"} ago`:O<30?`${O} day${O===1?"":"s"} ago`:z<12?`${z} month${z===1?"":"s"} ago`:y>=1?`${y} year${y===1?"":"s"} ago`:p.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}let ul=null;const $p="/_pagefind/pagefind.js";async function Ip(){if(ul)return ul;try{return ul=await import($p),await ul.init(),ul}catch{return null}}let ko=null;function Pp(){return ko||(ko=Lt(()=>import("./theme-BIHI7g3E.js"),[]).catch(()=>null),ko)}function tg({appId:u,apiKey:p,indexName:d,onNavigate:c,onClose:v,basePath:E=""}){const[A,O]=B.useState(null),[z,y]=B.useState(!1);B.useEffect(()=>{Pp().then(R=>{R&&R.DocSearch?O(()=>R.DocSearch):R&&R.default?O(()=>R.default):y(!0)})},[]);const G=B.useCallback(R=>{try{let nt=new URL(R,"http://localhost").pathname;if(E){const bt=E.replace(/\/$/,"");nt.startsWith(bt)&&(nt=nt.slice(bt.length))}return nt.replace(/^\//,"").replace(/\/index\.html$/,"").replace(/\.html$/,"")||"index"}catch{return"index"}},[E]);return z?s.jsx("div",{onClick:v,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:s.jsx("div",{onClick:R=>R.stopPropagation(),style:{background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:12,width:"100%",maxWidth:520,boxShadow:"0 24px 80px rgba(0,0,0,0.4)",padding:"32px 18px",textAlign:"center",color:"var(--txM)",fontSize:14},children:"Algolia DocSearch is not available. Install @docsearch/react to enable it."})}):A?s.jsx("div",{"data-testid":"algolia-search-modal",children:s.jsx(A,{appId:u,apiKey:p,indexName:d,navigator:{navigate({itemUrl:R}){const K=G(R);c(K)}},hitComponent:({hit:R,children:K})=>s.jsx("a",{href:R.url,onClick:nt=>{nt.preventDefault();const bt=G(R.url);c(bt)},children:K})})}):s.jsx("div",{onClick:v,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",display:"flex",alignItems:"flex-start",justifyContent:"center",paddingTop:"12vh"},children:s.jsx("div",{style:{background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:12,width:"100%",maxWidth:520,boxShadow:"0 24px 80px rgba(0,0,0,0.4)",padding:"32px 18px",textAlign:"center",color:"var(--txM)",fontSize:14},children:"Loading search..."})})}const eg=()=>s.jsx(je,{d:"M12 8v4l3 3m6-3a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z",size:14}),ng=()=>s.jsx(je,{d:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM3.6 9h16.8M3.6 15h16.8M12 3a15 15 0 0 1 4 9 15 15 0 0 1-4 9 15 15 0 0 1-4-9 15 15 0 0 1 4-9Z",size:14}),ag=()=>s.jsx(je,{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6M15 3h6v6M10 14L21 3",size:11}),lg={github:"M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z",twitter:"M12.6.75h2.454l-5.36 6.142L16 15.25h-4.937l-3.867-5.07-4.425 5.07H.316l5.733-6.57L0 .75h5.063l3.495 4.633L12.601.75Zm-.86 13.028h1.36L4.323 2.145H2.865l8.875 11.633Z",discord:"M13.545 2.907a13.227 13.227 0 00-3.257-1.011.05.05 0 00-.052.025c-.141.25-.297.577-.406.833a12.19 12.19 0 00-3.658 0 8.258 8.258 0 00-.412-.833.051.051 0 00-.052-.025c-1.125.194-2.22.534-3.257 1.011a.041.041 0 00-.021.018C.356 6.024-.213 9.047.066 12.032c.001.014.01.028.021.037a13.276 13.276 0 003.995 2.02.05.05 0 00.056-.019c.308-.42.582-.863.818-1.329a.05.05 0 00-.028-.07 8.735 8.735 0 01-1.248-.595.05.05 0 01-.005-.083c.084-.063.168-.129.248-.195a.05.05 0 01.051-.007c2.619 1.196 5.454 1.196 8.041 0a.052.052 0 01.053.007c.08.066.164.132.248.195a.051.051 0 01-.004.085c-.399.232-.813.431-1.249.594a.05.05 0 00-.03.07c.24.465.515.909.817 1.329a.05.05 0 00.056.019 13.235 13.235 0 004.001-2.02.049.049 0 00.021-.037c.334-3.451-.559-6.449-2.366-9.106a.034.034 0 00-.02-.019z",linkedin:"M0 1.146C0 .513.526 0 1.175 0h13.65C15.474 0 16 .513 16 1.146v13.708c0 .633-.526 1.146-1.175 1.146H1.175C.526 16 0 15.487 0 14.854V1.146zm4.943 12.248V6.169H2.542v7.225h2.401zm-1.2-8.212c.837 0 1.358-.554 1.358-1.248-.015-.709-.52-1.248-1.342-1.248-.822 0-1.359.54-1.359 1.248 0 .694.521 1.248 1.327 1.248h.016zm4.908 8.212V9.359c0-.216.016-.432.08-.586.173-.431.568-.878 1.232-.878.869 0 1.216.662 1.216 1.634v3.865h2.401V9.25c0-2.22-1.184-3.252-2.764-3.252-1.274 0-1.845.7-2.165 1.193v.025h-.016a5.54 5.54 0 01.016-.025V6.169h-2.4c.03.678 0 7.225 0 7.225h2.4z",youtube:"M8.051 1.999h.089c.822.003 4.987.033 6.11.335a2.01 2.01 0 011.415 1.42c.101.38.172.883.22 1.402l.01.104.022.26.008.104c.065.914.073 1.77.074 1.957v.075c-.001.194-.01 1.108-.082 2.06l-.008.105-.009.104c-.05.572-.124 1.14-.235 1.558a2.007 2.007 0 01-1.415 1.42c-1.16.312-5.569.334-6.18.335h-.142c-.309 0-1.587-.006-2.927-.052l-.17-.006-.087-.004-.171-.007-.171-.007c-1.11-.049-2.167-.128-2.654-.26a2.007 2.007 0 01-1.415-1.419c-.111-.417-.185-.986-.235-1.558L.09 9.82l-.008-.104A31.4 31.4 0 010 7.68v-.123c.002-.215.01-.958.064-1.778l.007-.103.003-.052.008-.104.022-.26.01-.104c.048-.519.119-1.023.22-1.402a2.007 2.007 0 011.415-1.42c.487-.13 1.544-.21 2.654-.26l.17-.007.172-.006.086-.003.171-.007A99.788 99.788 0 017.858 2h.193zM6.4 5.209v4.818l4.157-2.408L6.4 5.209z",mastodon:"M11.19 12.195c2.016-.24 3.77-1.475 3.99-2.603.348-1.778.32-4.339.32-4.339 0-3.47-2.286-4.488-2.286-4.488C12.062.238 10.083.017 8.027 0h-.05C5.92.017 3.942.238 2.79.765 2.79.765.504 1.783.504 5.253c-.005.995-.01 2.19.013 3.44.075 4.21.56 8.354 3.383 9.386 1.302.476 2.418.576 3.317.507 1.628-.125 2.541-.8 2.541-.8l-.054-1.182s-1.163.366-2.47.322c-1.293-.044-2.658-.138-2.867-1.716a3.23 3.23 0 01-.028-.465s1.27.31 2.879.384c.984.045 1.905-.058 2.842-.17zM13 8.59V5.319c0-.67-.17-1.2-.507-1.592-.348-.4-.806-.605-1.373-.605-.656 0-1.154.252-1.486.756L9.2 4.595l-.434-.717c-.332-.504-.83-.756-1.486-.756-.567 0-1.025.204-1.373.605-.338.392-.507.923-.507 1.592V8.59h1.69V5.468c0-.67.285-1.012.855-1.012.63 0 .946.404.946 1.204V7.11h1.682V5.66c0-.8.316-1.204.946-1.204.57 0 .855.342.855 1.012V8.59H13z",bluesky:"M3.468 1.948C5.303 3.325 7.276 6.118 8 7.616c.724-1.498 2.697-4.29 4.532-5.668C13.855 1.013 16 .638 16 3.14c0 .5-.286 4.2-.454 4.8-.585 2.093-2.716 2.628-4.544 2.305 3.195.564 4.007 2.433 2.25 4.302-3.337 3.548-4.8-1.244-5.252-2.547 0 0-.116-.334-.166-.334h.332C8.166 11.666 8.05 12 8.05 12c-.452 1.303-1.916 6.095-5.252 2.547-1.756-1.869-.946-3.738 2.25-4.302-1.829.323-3.96-.212-4.544-2.305C.336 7.34.05 3.64.05 3.14.05.638 2.195 1.013 3.468 1.948z"},ig=({platform:u,customIcon:p})=>{const d=u==="custom"&&p?p:lg[u];return d?s.jsx("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"currentColor",children:s.jsx("path",{d})}):null},og={Added:"#22c55e",Changed:"#3b82f6",Deprecated:"#f59e0b",Removed:"#ef4444",Fixed:"#8b5cf6",Security:"#f97316"};function sg({entries:u}){const[p,d]=B.useState(u.length<=5),c=p?u:u.slice(0,5);return s.jsxs("div",{"data-testid":"changelog-timeline",style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",left:15,top:8,bottom:8,width:2,background:"var(--bd)"}}),c.map((v,E)=>s.jsxs("div",{"data-testid":`changelog-entry-${v.version}`,style:{position:"relative",paddingLeft:44,paddingBottom:E{const O=og[A.type]||"#6b7280";return s.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,marginBottom:8},children:[s.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:O}}),s.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:O,fontFamily:"var(--font-code, monospace)"},children:A.type})]}),s.jsx("ul",{style:{margin:0,paddingLeft:18,listStyleType:"disc",color:"var(--tx2)"},children:A.items.map((z,y)=>s.jsx("li",{style:{fontSize:14,lineHeight:1.7,color:"var(--tx2)",marginBottom:2},children:z},y))})]},A.type)})]},v.version)),!p&&u.length>5&&s.jsx("div",{style:{textAlign:"center",marginTop:24},children:s.jsxs("button",{"data-testid":"changelog-show-more",onClick:()=>d(!0),style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"8px 20px",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body, inherit)",cursor:"pointer"},children:["Show all ",u.length," releases"]})})]})}function ug(u,p,d){if(p==="index")return[];for(const c of u)if(c.pages.find(E=>E.id===p)){const E=[],A=c.pages[0];return E.push({label:c.section,href:A?A.urlPath:null}),E.push({label:d,href:null}),E}return[]}function rg({config:u,navigation:p,currentPageId:d,pageHtml:c,pageComponent:v,mdxComponents:E,pageTitle:A,pageDescription:O,headings:z,tocEnabled:y=!0,editUrl:G,lastUpdated:R,changelogEntries:K,apiManifest:nt,apiBaseUrl:bt,apiPlayground:Dt,apiAuth:Mt,ApiReferenceComponent:W,onNavigate:I,allPages:ct,versioning:Q,currentVersion:Y,i18n:H,currentLocale:U,docContext:at,basePath:lt="",isDraft:P,dir:mt,overrides:tt}){var Ca,En,fi,dl,ml,hl,za,ja,pl,gl,qe,Qt,ne,tn,Ma,di,mi,vl,Cn;const At=U||(H==null?void 0:H.defaultLocale)||"en",$t=mt||((Ca=H==null?void 0:H.localeDirs)==null?void 0:Ca[At])||"ltr",ft=$t==="rtl",j=((En=u.theme)==null?void 0:En.mode)||"auto",[w,V]=B.useState(()=>{var x;return j==="dark"?!0:j==="light"?!1:((x=window.matchMedia)==null?void 0:x.call(window,"(prefers-color-scheme: dark)").matches)??!1}),[J,Tt]=B.useState(()=>typeof window<"u"&&window.innerWidth<768),[m,_]=B.useState(()=>typeof window<"u"&&window.innerWidth>=768),[N,L]=B.useState(!1),[it,rt]=B.useState(!1),[Et,It]=B.useState(!1),[Ut,Ve]=B.useState(null),[ha,pa]=B.useState({}),[rl,Je]=B.useState(()=>{var x;if(!((x=u.banner)!=null&&x.text))return!0;try{const q=Array.from(u.banner.text).reduce((et,dt)=>(et<<5)-et+dt.charCodeAt(0)|0,0).toString(36);return localStorage.getItem("tome-banner-dismissed")===q}catch{return!1}}),cl=Q&&Y&&Y!==Q.current,[ga,Do]=B.useState(p.map(x=>x.section)),We=B.useRef(null),Fn=B.useRef(null),fl=B.useRef(""),[va,Oo]=B.useState(()=>typeof window<"u"&&window.innerWidth>1100),si=((fi=u.theme)==null?void 0:fi.preset)||"amber",se=((dl=Ao[si])==null?void 0:dl[w?"dark":"light"])||Ao.amber.dark,ui=(ml=u.theme)!=null&&ml.accent?Zp(u.theme.accent,w):null,te=ui?{...se,...ui}:se,ya=((hl=Ao[si])==null?void 0:hl.fonts)||Ao.amber.fonts,bn={heading:((ja=(za=u.theme)==null?void 0:za.fonts)==null?void 0:ja.heading)||ya.heading,body:((gl=(pl=u.theme)==null?void 0:pl.fonts)==null?void 0:gl.body)||ya.body,code:((Qt=(qe=u.theme)==null?void 0:qe.fonts)==null?void 0:Qt.code)||ya.code};B.useEffect(()=>{if(j!=="auto")return;const x=window.matchMedia("(prefers-color-scheme: dark)"),q=et=>V(et.matches);return x.addEventListener("change",q),()=>x.removeEventListener("change",q)},[j]),B.useEffect(()=>{document.documentElement.classList.toggle("dark",w)},[w]),B.useEffect(()=>{const x=()=>{const q=window.innerWidth;Oo(q>1100),Tt(q<768)};return x(),window.addEventListener("resize",x),()=>window.removeEventListener("resize",x)},[]),B.useEffect(()=>{if(J&&m)return document.body.style.overflow="hidden",()=>{document.body.style.overflow=""}},[J,m]),B.useEffect(()=>{var x;(x=We.current)==null||x.scrollTo(0,0)},[d]),B.useEffect(()=>{const x=We.current;if(!x)return;const q=et=>{const dt=et.target;dt.tagName==="IMG"&&dt.closest(".tome-content")&&Ve(dt.src)};return x.addEventListener("click",q),()=>x.removeEventListener("click",q)},[]),B.useEffect(()=>{const x=We.current;if(!x)return;const q=et=>{const dt=et.target.closest("a");if(!dt)return;const St=dt.getAttribute("href");if(!St||St.startsWith("http://")||St.startsWith("https://")||St.startsWith("mailto:")||St.startsWith("tel:")||St.startsWith("//")||St.startsWith("#"))return;et.preventDefault();let yt=St.replace(/^\.\//,"").replace(/^\//,"").replace(/\.mdx?$/,"").replace(/\/$/,"");if(lt){const ce=lt.replace(/^\//,"").replace(/\/$/,"");ce&&yt.startsWith(ce+"/")?yt=yt.slice(ce.length+1):ce&&yt===ce&&(yt="index")}yt||(yt="index"),I(yt)};return x.addEventListener("click",q),()=>x.removeEventListener("click",q)},[I,lt]),B.useEffect(()=>{if(!Ut)return;const x=q=>{q.key==="Escape"&&Ve(null)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[Ut]);const Sn=u.toc,ri=(Sn==null?void 0:Sn.depth)??3,xa=(Sn==null?void 0:Sn.enabled)!==!1&&y,ye=z.filter(x=>x.depth<=ri),[ue,Me]=B.useState("");B.useEffect(()=>{if(!xa||ye.length<2)return;const x=We.current;if(!x)return;const q=setTimeout(()=>{const et=[];for(const St of ye){const yt=x.querySelector(`#${CSS.escape(St.id)}`);yt&&et.push(yt)}if(et.length===0)return;const dt=new IntersectionObserver(St=>{const yt=St.filter(ce=>ce.isIntersecting).sort((ce,hi)=>ce.boundingClientRect.top-hi.boundingClientRect.top);yt.length>0&&Me(yt[0].target.id)},{root:x,rootMargin:"0px 0px -80% 0px",threshold:0});for(const St of et)dt.observe(St);ee.current=dt},100);return()=>{var et;clearTimeout(q),(et=ee.current)==null||et.disconnect(),ee.current=null}},[d,xa,ye.map(x=>x.id).join(",")]);const ee=B.useRef(null);B.useEffect(()=>{Me("")},[d]),B.useLayoutEffect(()=>{if(!Fn.current||!c)return;const x=c.replace(/]*>[\s\S]*?<\/h1>\s*/,"");Fn.current.innerHTML=x,fl.current=x},[c,d]);const ci=B.useCallback((x,q)=>{x.preventDefault();const et=We.current;if(!et)return;const dt=et.querySelector(`#${CSS.escape(q)}`);dt&&(dt.scrollIntoView({behavior:"smooth",block:"start"}),Me(q))},[]);B.useEffect(()=>{const x=q=>{(q.metaKey||q.ctrlKey)&&q.key==="k"&&(q.preventDefault(),L(!0)),q.key==="Escape"&&L(!1)};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[]);const ba=p.flatMap(x=>x.pages),Sa=ba.findIndex(x=>x.id===d),Fe=Sa>0?ba[Sa-1]:null,$e=SaDo(q=>q.includes(x)?q.filter(et=>et!==x):[...q,x]),Ta={"--bg":te.bg,"--sf":te.sf,"--sfH":te.sfH,"--bd":te.bd,"--tx":te.tx,"--tx2":te.tx2,"--txM":te.txM,"--ac":te.ac,"--acD":te.acD,"--acT":te.acT,"--cdBg":te.cdBg,"--cdTx":te.cdTx,"--sbBg":te.sbBg,"--hdBg":te.hdBg,"--font-heading":`"${bn.heading}", serif`,"--font-body":`"${bn.body}", sans-serif`,"--font-code":`"${bn.code}", monospace`},Tn=v,Ne=(ne=u.banner)==null?void 0:ne.link,Ea=Ne?Ne.startsWith("#")||lt&&Ne.startsWith(lt+"/"):!1;return s.jsxs("div",{dir:$t,className:"tome-grain",style:{...Ta,color:"var(--tx)",background:"var(--bg)",fontFamily:"var(--font-body)",height:"100vh",overflow:"clip"},children:[((tn=u.banner)==null?void 0:tn.text)&&!rl&&s.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",gap:12,background:"var(--ac)",color:"#fff",padding:"8px 16px",fontSize:13,fontFamily:"var(--font-body)",fontWeight:500,textAlign:"center",width:"100vw",boxSizing:"border-box"},children:[u.banner.link?s.jsx("a",{href:Ea&&Ne.startsWith("#")?lt+"/"+Ne.slice(1):Ne,...Ea?{}:{target:"_blank",rel:"noopener noreferrer"},style:{color:"#fff",textDecoration:"underline"},onClick:Ea?x=>{x.preventDefault();const q=lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),et=Ne.startsWith("#")?Ne.slice(1):Ne.replace(new RegExp("^"+q+"/?"),"");I(et||"index")}:void 0,children:u.banner.text}):s.jsx("span",{children:u.banner.text}),u.banner.dismissible!==!1&&s.jsx("button",{onClick:()=>{Je(!0);try{const x=Array.from(u.banner.text).reduce((q,et)=>(q<<5)-q+et.charCodeAt(0)|0,0).toString(36);localStorage.setItem("tome-banner-dismissed",x)}catch{}},"aria-label":"Dismiss banner",style:{background:"none",border:"none",color:"#fff",cursor:"pointer",fontSize:16,lineHeight:1,padding:0,opacity:.8},children:"×"})]}),N&&((Ma=u.search)==null?void 0:Ma.provider)==="algolia"&&u.search.appId&&u.search.apiKey&&u.search.indexName?s.jsx(tg,{appId:u.search.appId,apiKey:u.search.apiKey,indexName:u.search.indexName,onNavigate:x=>{I(x),L(!1)},onClose:()=>L(!1),basePath:lt}):N?s.jsx(cg,{allPages:ct,onNavigate:x=>{I(x),L(!1)},onClose:()=>L(!1),mobile:J}):null,s.jsxs("div",{style:{display:"flex",flexDirection:ft?"row-reverse":"row",flex:1,height:(di=u.banner)!=null&&di.text&&!rl?"calc(100vh - 32px)":"100vh"},children:[J&&m&&s.jsx("div",{onClick:()=>_(!1),style:{position:"fixed",inset:0,zIndex:200,background:"rgba(0,0,0,0.4)",backdropFilter:"blur(2px)"}}),tt!=null&&tt.Sidebar?s.jsx(tt.Sidebar,{config:u,navigation:p,currentPageId:d,onNavigate:I,mobile:J,sbOpen:m,setSbOpen:_,versioning:Q,currentVersion:Y}):s.jsxs("aside",{style:{width:m?270:0,minWidth:m?270:0,background:"var(--sbBg)",[ft?"borderLeft":"borderRight"]:"1px solid var(--bd)",display:"flex",flexDirection:"column",transition:"width .2s, min-width .2s",overflow:"hidden",...J?{position:"fixed",top:0,[ft?"right":"left"]:0,bottom:0,zIndex:201}:{}},children:[s.jsxs("a",{href:"/",style:{padding:"18px 20px",display:"flex",alignItems:"baseline",gap:6,borderBottom:"1px solid var(--bd)",textDecoration:"none",color:"inherit"},children:[s.jsx("span",{style:{fontFamily:"var(--font-heading)",fontSize:22,fontWeight:700,fontStyle:"italic"},children:u.name}),s.jsx("span",{style:{width:5,height:5,borderRadius:"50%",background:"var(--ac)",display:"inline-block"}})]}),s.jsx("div",{style:{padding:"12px 14px"},children:s.jsxs("button",{onClick:()=>{L(!0),J&&_(!1)},style:{display:"flex",alignItems:"center",gap:8,width:"100%",background:"var(--cdBg)",border:"1px solid var(--bd)",borderRadius:2,padding:"8px 12px",cursor:"pointer",color:"var(--txM)",fontSize:12.5,fontFamily:"var(--font-body)"},children:[s.jsx(rm,{}),s.jsx("span",{style:{flex:1,textAlign:ft?"right":"left"},children:"Search..."}),s.jsx("kbd",{style:{fontFamily:"var(--font-code)",fontSize:9,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,padding:"2px 6px"},children:"⌘K"})]})}),s.jsx("nav",{style:{flex:1,overflow:"auto",padding:"4px 10px 20px"},children:p.map(x=>s.jsxs("div",{style:{marginBottom:8},children:[s.jsxs("button",{onClick:()=>Pe(x.section),style:{display:"flex",alignItems:"center",gap:6,width:"100%",background:"none",border:"none",padding:"8px 10px",cursor:"pointer",borderRadius:2,color:"var(--txM)",fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".1em",fontFamily:"var(--font-code)"},children:[ga.includes(x.section)?s.jsx(Zu,{}):s.jsx(Pd,{}),x.section]}),ga.includes(x.section)&&s.jsx("div",{style:{[ft?"marginRight":"marginLeft"]:8,[ft?"borderRight":"borderLeft"]:"1px solid var(--bd)",[ft?"paddingRight":"paddingLeft"]:0},children:x.pages.map(q=>{const et=d===q.id;return s.jsxs("button",{onClick:()=>{I(q.id),J&&_(!1)},style:{display:"flex",alignItems:"center",gap:10,width:"100%",textAlign:ft?"right":"left",background:"none",border:"none",borderRadius:0,[ft?"borderRight":"borderLeft"]:et?"2px solid var(--ac)":"2px solid transparent",padding:"7px 14px",cursor:"pointer",color:et?"var(--ac)":"var(--tx2)",fontSize:13,fontWeight:et?500:400,fontFamily:"var(--font-body)",transition:"all .12s"},children:[q.title,q.badge&&(()=>{const dt={default:{bg:"var(--sf)",text:"var(--tx2)"},info:{bg:"rgba(59,130,246,0.15)",text:"rgb(59,130,246)"},success:{bg:"rgba(34,197,94,0.15)",text:"rgb(34,197,94)"},warning:{bg:"rgba(234,179,8,0.15)",text:"rgb(202,138,4)"},danger:{bg:"rgba(239,68,68,0.15)",text:"rgb(239,68,68)"}},St=dt[q.badge.variant||"default"]||dt.default;return s.jsx("span",{style:{fontSize:10,fontWeight:600,padding:"2px 6px",borderRadius:4,marginLeft:6,whiteSpace:"nowrap",background:St.bg,color:St.text},children:q.badge.text})})()]},q.id)})})]},x.section))}),Q&&J&&s.jsx("div",{style:{padding:"8px 16px",borderTop:"1px solid var(--bd)",display:"flex",gap:6},children:Q.versions.map(x=>s.jsxs("button",{onClick:()=>{const q=x===Q.current?"index":`${x}/index`;I(q)},style:{flex:1,padding:"3px 0",textAlign:"center",background:x===(Y||Q.current)?"var(--acD)":"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,cursor:"pointer",color:x===(Y||Q.current)?"var(--ac)":"var(--tx2)",fontSize:11,fontFamily:"var(--font-code)",fontWeight:x===Q.current?600:400},children:[x,x===Q.current?" (latest)":""]},x))}),s.jsxs("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--bd)",display:"flex",alignItems:"center",justifyContent:"space-between"},children:[j==="auto"?s.jsx("button",{"aria-label":w?"Switch to light mode":"Switch to dark mode",onClick:()=>V(x=>!x),style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex"},children:w?s.jsx(em,{}):s.jsx(tm,{})}):s.jsx("div",{}),s.jsxs("span",{style:{fontSize:11,color:"var(--txM)",letterSpacing:.2},children:["Built with ","♡"," by Tome"]}),s.jsx("span",{style:{fontFamily:"var(--font-code)",fontSize:10,color:"var(--txM)"},children:"v0.5.0"})]})]}),s.jsxs("div",{style:{flex:1,display:"flex",flexDirection:"column",overflow:"hidden"},children:[tt!=null&&tt.Header?s.jsx(tt.Header,{config:u,navigation:p,currentPageId:d,onNavigate:I,mobile:J,sbOpen:m,setSbOpen:_,isDark:w,setDark:V,versioning:Q,currentVersion:Y,i18n:H,currentLocale:U,onSearchOpen:()=>L(!0),basePath:lt}):s.jsxs("header",{style:{display:"flex",alignItems:"center",gap:J?8:12,padding:J?"8px 12px":"10px 24px",borderBottom:"1px solid var(--bd)",background:"var(--hdBg)",backdropFilter:"blur(12px)",maxWidth:"100vw",overflow:"visible",position:"relative",zIndex:200},children:[s.jsx("button",{"aria-label":m?"Close sidebar":"Open sidebar",onClick:()=>_(!m),style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex"},children:m?s.jsx(Jp,{}):s.jsx(Vp,{})}),J?s.jsx("span",{style:{fontSize:13,color:"var(--ac)",fontFamily:"var(--font-code)",flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:((mi=p.flatMap(x=>x.pages).find(x=>x.id===d))==null?void 0:mi.title)||""}):s.jsx("div",{style:{display:"flex",alignItems:"center",gap:8,fontFamily:"var(--font-code)",fontSize:11,color:"var(--txM)",letterSpacing:".03em",flex:1},children:p.map(x=>{const q=x.pages.find(et=>et.id===d);return q?s.jsxs("span",{style:{display:"flex",alignItems:"center",gap:8},children:[s.jsx("span",{children:x.section}),s.jsx(Pd,{}),s.jsx("span",{style:{color:"var(--ac)"},children:q.title})]},x.section):null})}),u.topNav&&u.topNav.length>0&&!J&&s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[u.topNav.map(x=>{const q=x.href.startsWith("#")||lt&&x.href.startsWith(lt+"/"),et=!q;return s.jsxs("a",{href:q&&x.href.startsWith("#")?lt+"/"+x.href.slice(1):x.href,...et?{target:"_blank",rel:"noopener noreferrer"}:{},onClick:q?dt=>{dt.preventDefault();const St=x.href.startsWith("#")?x.href.slice(1):x.href.replace(new RegExp("^"+lt.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")+"/?"),"");I(St)}:void 0,style:{display:"flex",alignItems:"center",gap:4,color:"var(--txM)",textDecoration:"none",fontSize:12,fontFamily:"var(--font-body)",fontWeight:500,transition:"color .15s"},onMouseOver:dt=>dt.currentTarget.style.color="var(--ac)",onMouseOut:dt=>dt.currentTarget.style.color="var(--txM)",children:[x.label,et&&s.jsx(ag,{})]},x.label)}),s.jsx("span",{style:{width:1,height:16,background:"var(--bd)"}})]}),u.socialLinks&&u.socialLinks.length>0&&!J&&s.jsx("div",{style:{display:"flex",alignItems:"center",gap:8},children:u.socialLinks.map(x=>s.jsx("a",{href:x.url,target:"_blank",rel:"noopener noreferrer","aria-label":x.label||x.platform,"data-testid":`social-link-${x.platform}`,style:{display:"flex",alignItems:"center",justifyContent:"center",color:"var(--tx2)",cursor:"pointer",transition:"color .15s"},onMouseOver:q=>q.currentTarget.style.color="var(--tx)",onMouseOut:q=>q.currentTarget.style.color="var(--tx2)",children:s.jsx(ig,{platform:x.platform,customIcon:x.icon})},x.url))}),J&&j==="auto"&&s.jsx("button",{"aria-label":w?"Switch to light mode":"Switch to dark mode",onClick:()=>V(x=>!x),style:{background:"none",border:"none",color:"var(--txM)",cursor:"pointer",display:"flex",flexShrink:0},children:w?s.jsx(em,{}):s.jsx(tm,{})}),Q&&!J&&s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{"data-testid":"version-switcher",onClick:()=>rt(x=>!x),style:{display:"flex",alignItems:"center",gap:6,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,padding:"5px 10px",cursor:"pointer",color:"var(--tx2)",fontSize:12,fontFamily:"var(--font-code)"},children:[s.jsx(eg,{}),Y||Q.current,s.jsx(Zu,{})]}),it&&s.jsx("div",{"data-testid":"version-dropdown",style:{position:"absolute",top:"100%",right:0,marginTop:4,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.2)",overflow:"hidden",zIndex:100,minWidth:120},children:Q.versions.map(x=>s.jsxs("button",{onClick:()=>{rt(!1);const q=x===Q.current?"index":`${x}/index`;I(q)},style:{display:"block",width:"100%",textAlign:"left",background:x===(Y||Q.current)?"var(--acD)":"none",border:"none",padding:"8px 14px",cursor:"pointer",color:x===(Y||Q.current)?"var(--ac)":"var(--tx2)",fontSize:12,fontFamily:"var(--font-code)",fontWeight:x===Q.current?600:400},children:[x,x===Q.current?" (latest)":""]},x))})]}),H&&H.locales.length>1&&!J&&s.jsxs("div",{style:{position:"relative"},children:[s.jsxs("button",{"data-testid":"language-switcher",onClick:()=>It(x=>!x),style:{display:"flex",alignItems:"center",gap:6,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,padding:"5px 10px",cursor:"pointer",color:"var(--tx2)",fontSize:12,fontFamily:"var(--font-body)"},children:[s.jsx(ng,{}),((vl=H.localeNames)==null?void 0:vl[U||H.defaultLocale])||U||H.defaultLocale,s.jsx(Zu,{})]}),Et&&s.jsx("div",{"data-testid":"language-dropdown",style:{position:"absolute",top:"100%",right:0,marginTop:4,background:"var(--sf)",border:"1px solid var(--bd)",borderRadius:2,boxShadow:"0 8px 32px rgba(0,0,0,0.2)",overflow:"hidden",zIndex:100,minWidth:120},children:H.locales.map(x=>{var ce;const q=x===(U||H.defaultLocale),et=((ce=H.localeNames)==null?void 0:ce[x])||x,dt=U||H.defaultLocale;let St=d;dt!==H.defaultLocale&&d.startsWith(`${dt}/`)&&(St=d.slice(dt.length+1));const yt=x===H.defaultLocale?St:`${x}/${St}`;return s.jsx("button",{onClick:()=>{It(!1),I(yt)},style:{display:"block",width:"100%",textAlign:"left",background:q?"var(--acD)":"none",border:"none",padding:"8px 14px",cursor:"pointer",color:q?"var(--ac)":"var(--tx2)",fontSize:12,fontFamily:"var(--font-body)",fontWeight:q?600:400},children:et},x)})})]})]}),cl&&s.jsxs("div",{"data-testid":"old-version-banner",style:{display:"flex",alignItems:"center",justifyContent:"center",gap:8,background:"var(--acD)",borderBottom:"1px solid var(--bd)",padding:"8px 24px",fontSize:13,color:"var(--tx2)"},children:[s.jsxs("span",{children:["You're viewing docs for ",Y,"."]}),s.jsx("button",{onClick:()=>{I("index")},style:{background:"none",border:"none",color:"var(--ac)",cursor:"pointer",fontWeight:600,fontSize:13,fontFamily:"var(--font-body)",textDecoration:"underline"},children:"Switch to latest."})]}),s.jsxs("div",{ref:We,style:{flex:1,overflow:"auto",display:"flex"},children:[s.jsxs("main",{style:{flex:1,maxWidth:J?"100%":nt?1100:760,padding:J?"24px 16px 60px":"40px 48px 80px",margin:"0 auto",minWidth:0},children:[Ie.length>0&&s.jsx("nav",{"aria-label":"Breadcrumbs","data-testid":"breadcrumbs",style:{display:"flex",alignItems:"center",gap:6,fontSize:13,color:"var(--tx2)",marginBottom:8},children:Ie.map((x,q)=>s.jsxs(sm.Fragment,{children:[q>0&&s.jsx("span",{style:{color:"var(--tx2)",opacity:.5},children:"›"}),q{et.preventDefault();const dt=p.flatMap(St=>St.pages).find(St=>St.urlPath===x.href);dt&&I(dt.id)},style:{color:"var(--tx2)",textDecoration:"none",cursor:"pointer"},children:x.label}):s.jsx("span",{style:q===Ie.length-1?{color:"var(--tx)"}:void 0,children:x.label})]},q))}),s.jsx("h1",{style:{fontFamily:"var(--font-heading)",fontSize:J?26:38,fontWeight:400,fontStyle:"italic",lineHeight:1.15,marginBottom:8},children:A}),P&&s.jsx("div",{"data-testid":"draft-banner",style:{background:"#fef3c7",color:"#92400e",padding:"8px 16px",borderRadius:6,fontSize:13,marginBottom:16},children:"Draft — This page is only visible in development"}),O&&s.jsx("p",{style:{fontSize:16,color:"var(--tx2)",lineHeight:1.6,marginBottom:32},children:O}),s.jsx("div",{style:{borderTop:"1px solid var(--bd)",paddingTop:28},children:nt&&W?s.jsx(W,{manifest:nt,baseUrl:bt,showPlayground:Dt,playgroundAuth:Mt}):K&&K.length>0?s.jsx(sg,{entries:K}):Tn?s.jsx("div",{className:"tome-content",children:s.jsx(Tn,{components:E||{}})}):s.jsx("div",{className:"tome-content",ref:Fn},d)}),tt!=null&&tt.PageFooter?s.jsx(tt.PageFooter,{editUrl:G,lastUpdated:R,currentPageId:d,prev:Fe,next:$e,onNavigate:I,mobile:J}):s.jsxs(s.Fragment,{children:[(G||R)&&s.jsxs("div",{style:{marginTop:40,display:"flex",flexDirection:J?"column":"row",alignItems:J?"flex-start":"center",justifyContent:"space-between",gap:J?8:16},children:[G&&s.jsx("div",{"data-testid":"edit-page-link",children:s.jsxs("a",{href:G,target:"_blank",rel:"noopener noreferrer",style:{display:"inline-flex",alignItems:"center",gap:6,color:"var(--txM)",textDecoration:"none",fontSize:13,fontFamily:"var(--font-body)",transition:"color .15s"},onMouseOver:x=>x.currentTarget.style.color="var(--ac)",onMouseOut:x=>x.currentTarget.style.color="var(--txM)",children:[s.jsx(Wp,{})," Edit this page on GitHub"]})}),R&&s.jsxs("div",{"data-testid":"last-updated",style:{fontSize:12,color:"var(--txM)",fontFamily:"var(--font-body)"},children:["Last updated ",Fp(R)]})]}),s.jsx("div",{style:{display:"flex",alignItems:"center",gap:12,marginTop:24,padding:"12px 0"},children:ha[d]?s.jsx("span",{style:{fontSize:13,color:"var(--txM)",fontFamily:"var(--font-body)"},children:"Thanks for your feedback!"}):s.jsxs(s.Fragment,{children:[s.jsx("span",{style:{fontSize:13,color:"var(--txM)",fontFamily:"var(--font-body)"},children:"Was this helpful?"}),s.jsx("button",{onClick:()=>{pa(x=>({...x,[d]:!0}));try{localStorage.setItem(`tome-feedback-${d}`,"up")}catch{}},style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"4px 10px",cursor:"pointer",fontSize:13,color:"var(--txM)",transition:"border-color .15s"},children:"👍"}),s.jsx("button",{onClick:()=>{pa(x=>({...x,[d]:!0}));try{localStorage.setItem(`tome-feedback-${d}`,"down")}catch{}},style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"4px 10px",cursor:"pointer",fontSize:13,color:"var(--txM)",transition:"border-color .15s"},children:"👎"})]})}),s.jsxs("div",{style:{display:"flex",flexDirection:J?"column":"row",justifyContent:"space-between",marginTop:16,paddingTop:24,borderTop:"1px solid var(--bd)",gap:J?12:16},children:[Fe?s.jsxs("button",{onClick:()=>I(Fe.id),style:{display:"flex",alignItems:"center",gap:8,background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"10px 16px",cursor:"pointer",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body)",transition:"border-color .15s, color .15s"},children:[ft?s.jsx(am,{}):s.jsx(nm,{})," ",Fe.title]}):s.jsx("div",{}),$e?s.jsxs("button",{onClick:()=>I($e.id),style:{display:"flex",alignItems:"center",gap:8,background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"10px 16px",cursor:"pointer",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body)",transition:"border-color .15s, color .15s"},children:[$e.title," ",ft?s.jsx(nm,{}):s.jsx(am,{})]}):s.jsx("div",{})]})]})]}),tt!=null&&tt.Toc?xa&&ye.length>=2&&va&&s.jsx(tt.Toc,{headings:ye,activeHeadingId:ue,onScrollToHeading:ci}):xa&&ye.length>=2&&va&&s.jsxs("aside",{"data-testid":"toc-sidebar",style:{width:200,padding:ft?"40px 0 40px 16px":"40px 16px 40px 0",position:"sticky",top:0,alignSelf:"flex-start",flexShrink:0},children:[s.jsx("div",{style:{fontSize:10,fontWeight:600,textTransform:"uppercase",letterSpacing:".1em",color:"var(--txM)",marginBottom:12,fontFamily:"var(--font-code)"},children:"On this page"}),s.jsx("nav",{"aria-label":"Table of contents",style:{[ft?"borderRight":"borderLeft"]:"1px solid var(--bd)",[ft?"paddingRight":"paddingLeft"]:0},children:ye.map((x,q)=>{const et=ue===x.id;return s.jsx("a",{href:`#${x.id}`,onClick:dt=>ci(dt,x.id),"data-testid":`toc-link-${x.id}`,style:{display:"block",fontSize:12,color:et?"var(--ac)":"var(--txM)",fontWeight:et?500:400,textDecoration:"none",padding:"4px 12px",[ft?"paddingRight":"paddingLeft"]:12+(x.depth-2)*12,lineHeight:1.4,transition:"color .15s, font-weight .15s",[ft?"borderRight":"borderLeft"]:et?"2px solid var(--ac)":"2px solid transparent",[ft?"marginRight":"marginLeft"]:-1},children:x.text},q)})})]})]})]})]}),(tt==null?void 0:tt.Footer)&&s.jsx(tt.Footer,{config:u,navigation:p,currentPageId:d,onNavigate:I}),((Cn=u.ai)==null?void 0:Cn.enabled)&&s.jsx(Xp,{provider:u.ai.provider||"anthropic",model:u.ai.model,apiKey:typeof __TOME_AI_API_KEY__<"u"&&__TOME_AI_API_KEY__?__TOME_AI_API_KEY__:void 0,context:(at==null?void 0:at.map(x=>`## ${x.title}
 ${x.content}`).join(`
 
 `))??ct.map(x=>`- ${x.title}${x.description?": "+x.description:""}`).join(`
-`)}),Ut&&s.jsx("div",{onClick:()=>Ve(null),style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",cursor:"zoom-out"},children:s.jsx("img",{src:Ut,alt:"",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4,boxShadow:"0 16px 64px rgba(0,0,0,0.4)"}})})]})}function c0({allPages:u,onNavigate:p,onClose:d,mobile:c}){const[v,E]=B.useState(""),[A,O]=B.useState([]),[z,y]=B.useState(0),[G,R]=B.useState(null),K=B.useRef(null),nt=B.useRef(void 0);B.useEffect(()=>{Ip().then(W=>R(!!W)),setTimeout(()=>{var W;return(W=K.current)==null?void 0:W.focus()},50)},[]);const bt=B.useCallback(W=>{if(!W.trim())return[];const I=W.toLowerCase();return u.filter(ct=>ct.title.toLowerCase().includes(I)||(ct.description||"").toLowerCase().includes(I)).slice(0,8).map(ct=>({id:ct.id,title:ct.title,excerpt:ct.description}))},[u]),Dt=B.useCallback(async W=>{var ct;if(!W.trim()){O([]),y(0);return}const I=ul;if(I)try{const Q=await I.search(W),Y=[];for(const H of Q.results.slice(0,8)){const U=await H.data(),lt=(U.url||"").replace(/^\//,"").replace(/\/index\.html$/,"").replace(/\.html$/,"")||"index";Y.push({id:lt,title:((ct=U.meta)==null?void 0:ct.title)||lt,excerpt:U.excerpt||void 0})}O(Y),y(0);return}catch{}O(bt(W)),y(0)},[bt]);B.useEffect(()=>(nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>Dt(v),120),()=>{nt.current&&clearTimeout(nt.current)}),[v,Dt]);const Mt=B.useCallback(W=>{W.key==="ArrowDown"?(W.preventDefault(),y(I=>Math.min(I+1,A.length-1))):W.key==="ArrowUp"?(W.preventDefault(),y(I=>Math.max(I-1,0))):W.key==="Enter"&&A.length>0&&(W.preventDefault(),p(A[z].id))},[A,z,p]);return s.jsx("div",{onClick:d,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",display:"flex",alignItems:c?"stretch":"flex-start",justifyContent:"center",paddingTop:c?0:"12vh"},children:s.jsxs("div",{onClick:W=>W.stopPropagation(),style:{background:"var(--sf)",border:c?"none":"1px solid var(--bd)",borderRadius:c?0:2,width:"100%",maxWidth:c?"100%":520,boxShadow:c?"none":"0 24px 80px rgba(0,0,0,0.4)",overflow:"hidden",display:"flex",flexDirection:"column",...c?{height:"100%"}:{}},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--bd)"},children:[s.jsx(rm,{}),s.jsx("input",{ref:K,value:v,onChange:W=>E(W.target.value),onKeyDown:Mt,placeholder:"Search documentation...",style:{flex:1,background:"none",border:"none",outline:"none",color:"var(--tx)",fontSize:15,fontFamily:"var(--font-body)"}}),s.jsx("kbd",{style:{fontFamily:"var(--font-code)",fontSize:10,color:"var(--txM)",background:"var(--cdBg)",padding:"2px 6px",borderRadius:2,border:"1px solid var(--bd)"},children:"ESC"})]}),A.length>0&&s.jsx("div",{style:{padding:6,maxHeight:c?"none":360,overflow:"auto",flex:c?1:void 0},children:A.map((W,I)=>s.jsxs("button",{onClick:()=>p(W.id),style:{display:"block",width:"100%",textAlign:"left",background:I===z?"var(--acD)":"none",border:"none",borderRadius:2,padding:"10px 14px",cursor:"pointer",color:"var(--tx)",fontFamily:"var(--font-body)"},onMouseEnter:()=>y(I),children:[s.jsx("div",{style:{fontWeight:500,fontSize:14,marginBottom:2},children:W.title}),W.excerpt&&s.jsx("div",{style:{fontSize:12,color:"var(--txM)",lineHeight:1.3},dangerouslySetInnerHTML:{__html:W.excerpt}})]},W.id+I))}),v&&!A.length&&s.jsx("div",{style:{padding:"32px 18px",textAlign:"center",color:"var(--txM)",fontSize:14},children:"No results found"}),G===!1&&v&&A.length>0&&s.jsx("div",{style:{padding:"6px 18px 10px",fontSize:11,color:"var(--txM)",textAlign:"center"},children:"Showing title matches. Build your site for full-text search."})]})})}function cm(u,p,d){let c=u;p&&c.startsWith(p)&&(c=c.slice(p.length));const v=c.replace(/^\//,"").replace(/\/index\.html$/,"").replace(/\.html$/,"").replace(/\/$/,"")||"index";return d.find(A=>A.id===v)?v:null}function f0(u,p,d){const c=d.find(v=>v.id===u);return c?p+c.urlPath:p+"/"+u}class d0 extends Error{constructor(p){super(`Page not found: ${p}`),this.code="PAGE_NOT_FOUND",this.name="PageNotFoundError"}}class m0 extends Error{constructor(p,d){super(`Failed to load page: ${p}`),this.code="PAGE_LOAD_ERROR",this.name="PageLoadError",d&&(this.cause=d)}}function h0(u,p){if(!u||!p)return;const{repo:d,branch:c="main",dir:v=""}=u,E=v?`${v.replace(/\/$/,"")}/`:"";return`https://github.com/${d}/edit/${c}/${E}${p}`}function p0(u,p,d,c,v){var O;const E=v(u,c,d);if(E)return E;const A=p.startsWith("#")?p.slice(1):p;return A&&d.some(z=>z.id===A)?A:((O=d[0])==null?void 0:O.id)||"index"}async function fm(u,p,d){const c=p.find(E=>E.id===u);let v;try{v=await d(u)}catch(E){throw new m0(u,E)}if(c!=null&&c.isMdx&&v.meta)return{isMdx:!0,component:v.default,frontmatter:v.meta.frontmatter,headings:v.meta.headings};if(!v.default)throw new d0(u);return v.isApiReference&&v.apiManifest?{isMdx:!1,isApiReference:!0,...v.default,apiManifest:v.apiManifest}:v.isChangelog&&v.changelogEntries?{isMdx:!1,...v.default,changelogEntries:v.changelogEntries}:{isMdx:!1,...v.default}}function g0(u,p){return(u==null?void 0:u.version)||void 0}const Jn={name:"Kit",logo:"/logo.jpg",favicon:"/logo.jpg",baseUrl:"https://go-kit.dev",theme:{preset:"cipher",accent:"#e03030",mode:"dark",fonts:{heading:"Space Grotesk",body:"Space Grotesk",code:"Source Code Pro"}},navigation:[{group:"Getting Started",pages:["index","installation","quick-start"]},{group:"Configuration",pages:["configuration","providers","themes"]},{group:"CLI Reference",pages:["cli/flags","cli/commands"]},{group:"Extensions",pages:["extensions/overview","extensions/capabilities","extensions/examples","extensions/loading","extensions/testing"]},{group:"Sessions",pages:["sessions"]},{group:"Go SDK",pages:["sdk/overview","sdk/options","sdk/callbacks","sdk/sessions"]},{group:"Advanced",pages:["advanced/subagents","advanced/json-output","advanced/testing"]},{group:"Development",pages:["development"]}],search:{provider:"local"},toc:{enabled:!0,depth:3},math:!1,strictLinks:!1,lastUpdated:!0,redirects:[],socialLinks:[{platform:"github",url:"https://github.com/mark3labs/kit"},{platform:"discord",url:"https://discord.gg/RqSS2NQVsY"}]},Wn=[{id:"advanced/json-output",filePath:"advanced/json-output.md",urlPath:"/advanced/json-output",frontmatter:{title:"JSON Output",description:"Machine-readable JSON output for scripting and automation.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"advanced/subagents",filePath:"advanced/subagents.md",urlPath:"/advanced/subagents",frontmatter:{title:"Subagents",description:"Multi-agent orchestration with Kit subagents.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"advanced/testing",filePath:"advanced/testing.md",urlPath:"/advanced/testing",frontmatter:{title:"Testing with tmux",description:"Test Kit's TUI non-interactively using tmux.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"cli/commands",filePath:"cli/commands.md",urlPath:"/cli/commands",frontmatter:{title:"Commands",description:"Complete reference for all Kit CLI subcommands.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"cli/flags",filePath:"cli/flags.md",urlPath:"/cli/flags",frontmatter:{title:"Global Flags",description:"Complete reference for all Kit CLI flags.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"configuration",filePath:"configuration.md",urlPath:"/configuration",frontmatter:{title:"Configuration",description:"Configure Kit using config files, environment variables, and CLI flags.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"development",filePath:"development.md",urlPath:"/development",frontmatter:{title:"Development",description:"Build, test, and contribute to Kit.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"extensions/capabilities",filePath:"extensions/capabilities.md",urlPath:"/extensions/capabilities",frontmatter:{title:"Capabilities",description:"All extension capabilities — lifecycle events, tools, commands, widgets, and more.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"extensions/examples",filePath:"extensions/examples.md",urlPath:"/extensions/examples",frontmatter:{title:"Examples",description:"Catalog of example extensions included with Kit.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"extensions/loading",filePath:"extensions/loading.md",urlPath:"/extensions/loading",frontmatter:{title:"Loading Extensions",description:"How Kit discovers and loads extensions.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"extensions/overview",filePath:"extensions/overview.md",urlPath:"/extensions/overview",frontmatter:{title:"Extension System",description:"Overview of Kit's Go-based extension system.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"extensions/testing",filePath:"extensions/testing.md",urlPath:"/extensions/testing",frontmatter:{title:"Testing Extensions",description:"Write unit tests for your Kit extensions using the test package.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"index",filePath:"index.md",urlPath:"/",frontmatter:{title:"Kit",description:"Kit is a powerful, extensible AI coding agent CLI with multi-provider support, built-in tools, and a rich extension system.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"installation",filePath:"installation.md",urlPath:"/installation",frontmatter:{title:"Installation",description:"Install Kit using npm, bun, pnpm, Go, or build from source.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"providers",filePath:"providers.md",urlPath:"/providers",frontmatter:{title:"Providers",description:"Supported LLM providers and model configuration.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"quick-start",filePath:"quick-start.md",urlPath:"/quick-start",frontmatter:{title:"Quick Start",description:"Get up and running with Kit in minutes.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"sdk/callbacks",filePath:"sdk/callbacks.md",urlPath:"/sdk/callbacks",frontmatter:{title:"Callbacks",description:"Monitor tool calls and streaming output with the Kit Go SDK.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"sdk/options",filePath:"sdk/options.md",urlPath:"/sdk/options",frontmatter:{title:"SDK Options",description:"Configuration options for the Kit Go SDK.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"sdk/overview",filePath:"sdk/overview.md",urlPath:"/sdk/overview",frontmatter:{title:"Go SDK",description:"Embed Kit in your Go applications.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"sdk/sessions",filePath:"sdk/sessions.md",urlPath:"/sdk/sessions",frontmatter:{title:"SDK Sessions",description:"Session management in the Kit Go SDK.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"sessions",filePath:"sessions.md",urlPath:"/sessions",frontmatter:{title:"Session Management",description:"How Kit persists and manages conversation sessions.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"},{id:"themes",filePath:"themes.md",urlPath:"/themes",frontmatter:{title:"Themes",description:"Customize Kit's appearance with built-in themes, custom theme files, and the extension theme API.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:05:09+03:00"}],v0=[{section:"Getting Started",pages:[{title:"Kit",id:"index",urlPath:"/"},{title:"Installation",id:"installation",urlPath:"/installation"},{title:"Quick Start",id:"quick-start",urlPath:"/quick-start"}]},{section:"Configuration",pages:[{title:"Configuration",id:"configuration",urlPath:"/configuration"},{title:"Providers",id:"providers",urlPath:"/providers"},{title:"Themes",id:"themes",urlPath:"/themes"}]},{section:"CLI Reference",pages:[{title:"Global Flags",id:"cli/flags",urlPath:"/cli/flags"},{title:"Commands",id:"cli/commands",urlPath:"/cli/commands"}]},{section:"Extensions",pages:[{title:"Extension System",id:"extensions/overview",urlPath:"/extensions/overview"},{title:"Capabilities",id:"extensions/capabilities",urlPath:"/extensions/capabilities"},{title:"Examples",id:"extensions/examples",urlPath:"/extensions/examples"},{title:"Loading Extensions",id:"extensions/loading",urlPath:"/extensions/loading"},{title:"Testing Extensions",id:"extensions/testing",urlPath:"/extensions/testing"}]},{section:"Sessions",pages:[{title:"Session Management",id:"sessions",urlPath:"/sessions"}]},{section:"Go SDK",pages:[{title:"Go SDK",id:"sdk/overview",urlPath:"/sdk/overview"},{title:"SDK Options",id:"sdk/options",urlPath:"/sdk/options"},{title:"Callbacks",id:"sdk/callbacks",urlPath:"/sdk/callbacks"},{title:"SDK Sessions",id:"sdk/sessions",urlPath:"/sdk/sessions"}]},{section:"Advanced",pages:[{title:"Subagents",id:"advanced/subagents",urlPath:"/advanced/subagents"},{title:"JSON Output",id:"advanced/json-output",urlPath:"/advanced/json-output"},{title:"Testing with tmux",id:"advanced/testing",urlPath:"/advanced/testing"}]},{section:"Development",pages:[{title:"Development",id:"development",urlPath:"/development"}]}],Vu=null,y0={"advanced/json-output":()=>Lt(()=>import("./json-output-BiSiIPM0.js"),[]),"advanced/subagents":()=>Lt(()=>import("./subagents-BKwlFg4K.js"),[]),"advanced/testing":()=>Lt(()=>import("./testing-COLNxuKj.js"),[]),"cli/commands":()=>Lt(()=>import("./commands-D1BMAnYP.js"),[]),"cli/flags":()=>Lt(()=>import("./flags-DZQ--mB7.js"),[]),configuration:()=>Lt(()=>import("./configuration-CMPyPByx.js"),[]),development:()=>Lt(()=>import("./development-BTUHn6x2.js"),[]),"extensions/capabilities":()=>Lt(()=>import("./capabilities-_AepiUr_.js"),[]),"extensions/examples":()=>Lt(()=>import("./examples-D6mMtjxu.js"),[]),"extensions/loading":()=>Lt(()=>import("./loading-CfdMbwrl.js"),[]),"extensions/overview":()=>Lt(()=>import("./overview-BRtZenVZ.js"),[]),"extensions/testing":()=>Lt(()=>import("./testing-BjX63Hnw.js"),[]),index:()=>Lt(()=>import("./index-CGDazwHL.js"),[]),installation:()=>Lt(()=>import("./installation-CkjlJXwY.js"),[]),providers:()=>Lt(()=>import("./providers-D0NHKVlr.js"),[]),"quick-start":()=>Lt(()=>import("./quick-start-6VwH1jFw.js"),[]),"sdk/callbacks":()=>Lt(()=>import("./callbacks-Qmb83k7P.js"),[]),"sdk/options":()=>Lt(()=>import("./options-DhBmR6ye.js"),[]),"sdk/overview":()=>Lt(()=>import("./overview-B-G8B3fT.js"),[]),"sdk/sessions":()=>Lt(()=>import("./sessions-X-l1qojs.js"),[]),sessions:()=>Lt(()=>import("./sessions-B4ha6HAs.js"),[]),themes:()=>Lt(()=>import("./themes-Chyvu6J4.js"),[])};function dm(u){const p=y0[u];if(!p)throw new Error("Unknown page: "+u);return p()}const x0=[{id:"advanced/json-output",title:"JSON Output",content:`
+`)}),Ut&&s.jsx("div",{onClick:()=>Ve(null),style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.7)",backdropFilter:"blur(8px)",cursor:"zoom-out"},children:s.jsx("img",{src:Ut,alt:"",style:{maxWidth:"90vw",maxHeight:"90vh",objectFit:"contain",borderRadius:4,boxShadow:"0 16px 64px rgba(0,0,0,0.4)"}})})]})}function cg({allPages:u,onNavigate:p,onClose:d,mobile:c}){const[v,E]=B.useState(""),[A,O]=B.useState([]),[z,y]=B.useState(0),[G,R]=B.useState(null),K=B.useRef(null),nt=B.useRef(void 0);B.useEffect(()=>{Ip().then(W=>R(!!W)),setTimeout(()=>{var W;return(W=K.current)==null?void 0:W.focus()},50)},[]);const bt=B.useCallback(W=>{if(!W.trim())return[];const I=W.toLowerCase();return u.filter(ct=>ct.title.toLowerCase().includes(I)||(ct.description||"").toLowerCase().includes(I)).slice(0,8).map(ct=>({id:ct.id,title:ct.title,excerpt:ct.description}))},[u]),Dt=B.useCallback(async W=>{var ct;if(!W.trim()){O([]),y(0);return}const I=ul;if(I)try{const Q=await I.search(W),Y=[];for(const H of Q.results.slice(0,8)){const U=await H.data(),lt=(U.url||"").replace(/^\//,"").replace(/\/index\.html$/,"").replace(/\.html$/,"")||"index";Y.push({id:lt,title:((ct=U.meta)==null?void 0:ct.title)||lt,excerpt:U.excerpt||void 0})}O(Y),y(0);return}catch{}O(bt(W)),y(0)},[bt]);B.useEffect(()=>(nt.current&&clearTimeout(nt.current),nt.current=setTimeout(()=>Dt(v),120),()=>{nt.current&&clearTimeout(nt.current)}),[v,Dt]);const Mt=B.useCallback(W=>{W.key==="ArrowDown"?(W.preventDefault(),y(I=>Math.min(I+1,A.length-1))):W.key==="ArrowUp"?(W.preventDefault(),y(I=>Math.max(I-1,0))):W.key==="Enter"&&A.length>0&&(W.preventDefault(),p(A[z].id))},[A,z,p]);return s.jsx("div",{onClick:d,style:{position:"fixed",inset:0,zIndex:1e3,background:"rgba(0,0,0,0.55)",backdropFilter:"blur(6px)",display:"flex",alignItems:c?"stretch":"flex-start",justifyContent:"center",paddingTop:c?0:"12vh"},children:s.jsxs("div",{onClick:W=>W.stopPropagation(),style:{background:"var(--sf)",border:c?"none":"1px solid var(--bd)",borderRadius:c?0:2,width:"100%",maxWidth:c?"100%":520,boxShadow:c?"none":"0 24px 80px rgba(0,0,0,0.4)",overflow:"hidden",display:"flex",flexDirection:"column",...c?{height:"100%"}:{}},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,padding:"14px 18px",borderBottom:"1px solid var(--bd)"},children:[s.jsx(rm,{}),s.jsx("input",{ref:K,value:v,onChange:W=>E(W.target.value),onKeyDown:Mt,placeholder:"Search documentation...",style:{flex:1,background:"none",border:"none",outline:"none",color:"var(--tx)",fontSize:15,fontFamily:"var(--font-body)"}}),s.jsx("kbd",{style:{fontFamily:"var(--font-code)",fontSize:10,color:"var(--txM)",background:"var(--cdBg)",padding:"2px 6px",borderRadius:2,border:"1px solid var(--bd)"},children:"ESC"})]}),A.length>0&&s.jsx("div",{style:{padding:6,maxHeight:c?"none":360,overflow:"auto",flex:c?1:void 0},children:A.map((W,I)=>s.jsxs("button",{onClick:()=>p(W.id),style:{display:"block",width:"100%",textAlign:"left",background:I===z?"var(--acD)":"none",border:"none",borderRadius:2,padding:"10px 14px",cursor:"pointer",color:"var(--tx)",fontFamily:"var(--font-body)"},onMouseEnter:()=>y(I),children:[s.jsx("div",{style:{fontWeight:500,fontSize:14,marginBottom:2},children:W.title}),W.excerpt&&s.jsx("div",{style:{fontSize:12,color:"var(--txM)",lineHeight:1.3},dangerouslySetInnerHTML:{__html:W.excerpt}})]},W.id+I))}),v&&!A.length&&s.jsx("div",{style:{padding:"32px 18px",textAlign:"center",color:"var(--txM)",fontSize:14},children:"No results found"}),G===!1&&v&&A.length>0&&s.jsx("div",{style:{padding:"6px 18px 10px",fontSize:11,color:"var(--txM)",textAlign:"center"},children:"Showing title matches. Build your site for full-text search."})]})})}function cm(u,p,d){let c=u;p&&c.startsWith(p)&&(c=c.slice(p.length));const v=c.replace(/^\//,"").replace(/\/index\.html$/,"").replace(/\.html$/,"").replace(/\/$/,"")||"index";return d.find(A=>A.id===v)?v:null}function fg(u,p,d){const c=d.find(v=>v.id===u);return c?p+c.urlPath:p+"/"+u}class dg extends Error{constructor(p){super(`Page not found: ${p}`),this.code="PAGE_NOT_FOUND",this.name="PageNotFoundError"}}class mg extends Error{constructor(p,d){super(`Failed to load page: ${p}`),this.code="PAGE_LOAD_ERROR",this.name="PageLoadError",d&&(this.cause=d)}}function hg(u,p){if(!u||!p)return;const{repo:d,branch:c="main",dir:v=""}=u,E=v?`${v.replace(/\/$/,"")}/`:"";return`https://github.com/${d}/edit/${c}/${E}${p}`}function pg(u,p,d,c,v){var O;const E=v(u,c,d);if(E)return E;const A=p.startsWith("#")?p.slice(1):p;return A&&d.some(z=>z.id===A)?A:((O=d[0])==null?void 0:O.id)||"index"}async function fm(u,p,d){const c=p.find(E=>E.id===u);let v;try{v=await d(u)}catch(E){throw new mg(u,E)}if(c!=null&&c.isMdx&&v.meta)return{isMdx:!0,component:v.default,frontmatter:v.meta.frontmatter,headings:v.meta.headings};if(!v.default)throw new dg(u);return v.isApiReference&&v.apiManifest?{isMdx:!1,isApiReference:!0,...v.default,apiManifest:v.apiManifest}:v.isChangelog&&v.changelogEntries?{isMdx:!1,...v.default,changelogEntries:v.changelogEntries}:{isMdx:!1,...v.default}}function gg(u,p){return(u==null?void 0:u.version)||void 0}const Jn={name:"Kit",logo:"/logo.jpg",favicon:"/logo.jpg",baseUrl:"https://go-kit.dev",theme:{preset:"cipher",accent:"#e03030",mode:"dark",fonts:{heading:"Space Grotesk",body:"Space Grotesk",code:"Source Code Pro"}},navigation:[{group:"Getting Started",pages:["index","installation","quick-start"]},{group:"Configuration",pages:["configuration","providers","themes"]},{group:"CLI Reference",pages:["cli/flags","cli/commands"]},{group:"Extensions",pages:["extensions/overview","extensions/capabilities","extensions/examples","extensions/loading","extensions/testing"]},{group:"Sessions",pages:["sessions"]},{group:"Go SDK",pages:["sdk/overview","sdk/options","sdk/callbacks","sdk/sessions"]},{group:"Advanced",pages:["advanced/subagents","advanced/json-output","advanced/testing"]},{group:"Development",pages:["development"]}],search:{provider:"local"},toc:{enabled:!0,depth:3},math:!1,strictLinks:!1,lastUpdated:!0,redirects:[],socialLinks:[{platform:"github",url:"https://github.com/mark3labs/kit"},{platform:"discord",url:"https://discord.gg/RqSS2NQVsY"}]},Wn=[{id:"advanced/json-output",filePath:"advanced/json-output.md",urlPath:"/advanced/json-output",frontmatter:{title:"JSON Output",description:"Machine-readable JSON output for scripting and automation.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"advanced/subagents",filePath:"advanced/subagents.md",urlPath:"/advanced/subagents",frontmatter:{title:"Subagents",description:"Multi-agent orchestration with Kit subagents.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"advanced/testing",filePath:"advanced/testing.md",urlPath:"/advanced/testing",frontmatter:{title:"Testing with tmux",description:"Test Kit's TUI non-interactively using tmux.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"cli/commands",filePath:"cli/commands.md",urlPath:"/cli/commands",frontmatter:{title:"Commands",description:"Complete reference for all Kit CLI subcommands.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"cli/flags",filePath:"cli/flags.md",urlPath:"/cli/flags",frontmatter:{title:"Global Flags",description:"Complete reference for all Kit CLI flags.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"configuration",filePath:"configuration.md",urlPath:"/configuration",frontmatter:{title:"Configuration",description:"Configure Kit using config files, environment variables, and CLI flags.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"development",filePath:"development.md",urlPath:"/development",frontmatter:{title:"Development",description:"Build, test, and contribute to Kit.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"extensions/capabilities",filePath:"extensions/capabilities.md",urlPath:"/extensions/capabilities",frontmatter:{title:"Capabilities",description:"All extension capabilities — lifecycle events, tools, commands, widgets, and more.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"extensions/examples",filePath:"extensions/examples.md",urlPath:"/extensions/examples",frontmatter:{title:"Examples",description:"Catalog of example extensions included with Kit.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"extensions/loading",filePath:"extensions/loading.md",urlPath:"/extensions/loading",frontmatter:{title:"Loading Extensions",description:"How Kit discovers and loads extensions.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"extensions/overview",filePath:"extensions/overview.md",urlPath:"/extensions/overview",frontmatter:{title:"Extension System",description:"Overview of Kit's Go-based extension system.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"extensions/testing",filePath:"extensions/testing.md",urlPath:"/extensions/testing",frontmatter:{title:"Testing Extensions",description:"Write unit tests for your Kit extensions using the test package.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"index",filePath:"index.md",urlPath:"/",frontmatter:{title:"Kit",description:"Kit is a powerful, extensible AI coding agent CLI with multi-provider support, built-in tools, and a rich extension system.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"installation",filePath:"installation.md",urlPath:"/installation",frontmatter:{title:"Installation",description:"Install Kit using npm, bun, pnpm, Go, or build from source.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"providers",filePath:"providers.md",urlPath:"/providers",frontmatter:{title:"Providers",description:"Supported LLM providers and model configuration.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"quick-start",filePath:"quick-start.md",urlPath:"/quick-start",frontmatter:{title:"Quick Start",description:"Get up and running with Kit in minutes.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"sdk/callbacks",filePath:"sdk/callbacks.md",urlPath:"/sdk/callbacks",frontmatter:{title:"Callbacks",description:"Monitor tool calls and streaming output with the Kit Go SDK.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"sdk/options",filePath:"sdk/options.md",urlPath:"/sdk/options",frontmatter:{title:"SDK Options",description:"Configuration options for the Kit Go SDK.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"sdk/overview",filePath:"sdk/overview.md",urlPath:"/sdk/overview",frontmatter:{title:"Go SDK",description:"Embed Kit in your Go applications.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"sdk/sessions",filePath:"sdk/sessions.md",urlPath:"/sdk/sessions",frontmatter:{title:"SDK Sessions",description:"Session management in the Kit Go SDK.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"sessions",filePath:"sessions.md",urlPath:"/sessions",frontmatter:{title:"Session Management",description:"How Kit persists and manages conversation sessions.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"},{id:"themes",filePath:"themes.md",urlPath:"/themes",frontmatter:{title:"Themes",description:"Customize Kit's appearance with built-in themes, custom theme files, and the extension theme API.",hidden:!1,draft:!1},isMdx:!1,lastUpdated:"2026-03-29T00:24:18+03:00"}],vg=[{section:"Getting Started",pages:[{title:"Kit",id:"index",urlPath:"/"},{title:"Installation",id:"installation",urlPath:"/installation"},{title:"Quick Start",id:"quick-start",urlPath:"/quick-start"}]},{section:"Configuration",pages:[{title:"Configuration",id:"configuration",urlPath:"/configuration"},{title:"Providers",id:"providers",urlPath:"/providers"},{title:"Themes",id:"themes",urlPath:"/themes"}]},{section:"CLI Reference",pages:[{title:"Global Flags",id:"cli/flags",urlPath:"/cli/flags"},{title:"Commands",id:"cli/commands",urlPath:"/cli/commands"}]},{section:"Extensions",pages:[{title:"Extension System",id:"extensions/overview",urlPath:"/extensions/overview"},{title:"Capabilities",id:"extensions/capabilities",urlPath:"/extensions/capabilities"},{title:"Examples",id:"extensions/examples",urlPath:"/extensions/examples"},{title:"Loading Extensions",id:"extensions/loading",urlPath:"/extensions/loading"},{title:"Testing Extensions",id:"extensions/testing",urlPath:"/extensions/testing"}]},{section:"Sessions",pages:[{title:"Session Management",id:"sessions",urlPath:"/sessions"}]},{section:"Go SDK",pages:[{title:"Go SDK",id:"sdk/overview",urlPath:"/sdk/overview"},{title:"SDK Options",id:"sdk/options",urlPath:"/sdk/options"},{title:"Callbacks",id:"sdk/callbacks",urlPath:"/sdk/callbacks"},{title:"SDK Sessions",id:"sdk/sessions",urlPath:"/sdk/sessions"}]},{section:"Advanced",pages:[{title:"Subagents",id:"advanced/subagents",urlPath:"/advanced/subagents"},{title:"JSON Output",id:"advanced/json-output",urlPath:"/advanced/json-output"},{title:"Testing with tmux",id:"advanced/testing",urlPath:"/advanced/testing"}]},{section:"Development",pages:[{title:"Development",id:"development",urlPath:"/development"}]}],Vu=null,yg={"advanced/json-output":()=>Lt(()=>import("./json-output-BiSiIPM0.js"),[]),"advanced/subagents":()=>Lt(()=>import("./subagents-lghAXYlk.js"),[]),"advanced/testing":()=>Lt(()=>import("./testing-COLNxuKj.js"),[]),"cli/commands":()=>Lt(()=>import("./commands-D1BMAnYP.js"),[]),"cli/flags":()=>Lt(()=>import("./flags-DZQ--mB7.js"),[]),configuration:()=>Lt(()=>import("./configuration-CMPyPByx.js"),[]),development:()=>Lt(()=>import("./development-BTUHn6x2.js"),[]),"extensions/capabilities":()=>Lt(()=>import("./capabilities-CbOsHlR1.js"),[]),"extensions/examples":()=>Lt(()=>import("./examples-D6mMtjxu.js"),[]),"extensions/loading":()=>Lt(()=>import("./loading-CfdMbwrl.js"),[]),"extensions/overview":()=>Lt(()=>import("./overview-BRtZenVZ.js"),[]),"extensions/testing":()=>Lt(()=>import("./testing-BjX63Hnw.js"),[]),index:()=>Lt(()=>import("./index-kfFM907t.js"),[]),installation:()=>Lt(()=>import("./installation-CkjlJXwY.js"),[]),providers:()=>Lt(()=>import("./providers-D0NHKVlr.js"),[]),"quick-start":()=>Lt(()=>import("./quick-start-6VwH1jFw.js"),[]),"sdk/callbacks":()=>Lt(()=>import("./callbacks-Bhc1BBj7.js"),[]),"sdk/options":()=>Lt(()=>import("./options-DhBmR6ye.js"),[]),"sdk/overview":()=>Lt(()=>import("./overview-B-G8B3fT.js"),[]),"sdk/sessions":()=>Lt(()=>import("./sessions-X-l1qojs.js"),[]),sessions:()=>Lt(()=>import("./sessions-B4ha6HAs.js"),[]),themes:()=>Lt(()=>import("./themes-Chyvu6J4.js"),[])};function dm(u){const p=yg[u];if(!p)throw new Error("Unknown page: "+u);return p()}const xg=[{id:"advanced/json-output",title:"JSON Output",content:`
 # JSON Output
 
 Use the \`--json\` flag to get structured output for scripting and automation:
@@ -176,12 +176,12 @@ Key flags for subprocess usage:
 
 Positional arguments are the prompt. \`@file\` arguments attach file content as context.
 
-## Built-in spawn_subagent tool
+## Built-in subagent tool
 
-Kit includes a built-in \`spawn_subagent\` tool that the LLM can use to delegate tasks to independent child agents:
+Kit includes a built-in \`subagent\` tool that the LLM can use to delegate tasks to independent child agents:
 
 \`\`\`
-spawn_subagent(
+subagent(
     task: "Analyze the test files and summarize coverage",
     model: "anthropic/claude-haiku-latest",   // optional
     system_prompt: "You are a test analysis expert.",  // optional
@@ -205,7 +205,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{
 
 ### Monitoring subagents from extensions
 
-When the LLM (not the extension itself) spawns a subagent using the \`spawn_subagent\` tool, extensions can monitor its activity in real-time using three lifecycle event handlers:
+When the LLM (not the extension itself) spawns a subagent using the \`subagent\` tool, extensions can monitor its activity in real-time using three lifecycle event handlers:
 
 \`\`\`go
 // Track active subagents and display their output
@@ -291,11 +291,11 @@ result, err := host.Subagent(ctx, kit.SubagentConfig{
 
 ### Real-time subagent events
 
-Use \`SubscribeSubagent\` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the \`spawn_subagent\` tool). Register inside an \`OnToolCall\` handler using the tool call ID:
+Use \`SubscribeSubagent\` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the \`subagent\` tool). Register inside an \`OnToolCall\` handler using the tool call ID:
 
 \`\`\`go
 host.OnToolCall(func(e kit.ToolCallEvent) {
-    if e.ToolName == "spawn_subagent" {
+    if e.ToolName == "subagent" {
         host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {
             switch ev := event.(type) {
             case kit.MessageUpdateEvent:
@@ -854,7 +854,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{
 
 ### Monitoring subagents spawned by the main agent
 
-When the LLM uses the built-in \`spawn_subagent\` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:
+When the LLM uses the built-in \`subagent\` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:
 
 \`\`\`go
 // Subagent started
@@ -1185,18 +1185,18 @@ func Init(api ext.API) {
     })
 }
 \`\`\`
-`},{id:"extensions/overview",title:"Extension System",content:'\n# Extension System\n\nExtensions are Go source files interpreted at runtime via [Yaegi](https://github.com/traefik/yaegi). They can add custom tools, slash commands, widgets, keyboard shortcuts, and intercept lifecycle events — all without recompiling Kit.\n\n## Minimal extension\n\n```go\n//go:build ignore\n\npackage main\n\nimport "kit/ext"\n\nfunc Init(api ext.API) {\n    api.OnSessionStart(func(_ ext.SessionStartEvent, ctx ext.Context) {\n        ctx.SetFooter(ext.HeaderFooterConfig{\n            Content: ext.WidgetContent{Text: "Custom Footer"},\n        })\n    })\n}\n```\n\nRun it with:\n\n```bash\nkit -e examples/extensions/minimal.go\n```\n\n## How extensions work\n\n1. Kit discovers extension files from [auto-discovery paths](/extensions/loading) or explicit `-e` flags\n2. Each `.go` file is loaded into a Yaegi interpreter with access to the `kit/ext` package\n3. Kit calls the `Init(api ext.API)` function in each extension\n4. The extension registers callbacks, tools, commands, and UI components via the `api` and `ctx` objects\n\n## Key concepts\n\n### The `API` object\n\nPassed to `Init()`, the `API` object is used to register lifecycle event handlers and static components:\n\n- **Lifecycle handlers** — `api.OnSessionStart(...)`, `api.OnToolCall(...)`, etc.\n- **Tools** — `api.RegisterTool(ext.ToolDef{...})`\n- **Commands** — `api.RegisterCommand(ext.CommandDef{...})`\n- **Shortcuts** — `api.RegisterShortcut(ext.ShortcutDef{...}, handler)`\n- **Tool renderers** — `api.RegisterToolRenderer(ext.ToolRenderConfig{...})`\n- **Message renderers** — `api.RegisterMessageRenderer(ext.MessageRendererConfig{...})`\n- **Options** — `api.RegisterOption(ext.OptionDef{...})`\n\n### The `Context` object\n\nPassed to event handlers, the `Context` object provides runtime access to Kit\'s state and UI:\n\n- **Output** — `ctx.Print(...)`, `ctx.PrintInfo(...)`, `ctx.PrintError(...)`\n- **UI components** — `ctx.SetWidget(...)`, `ctx.SetHeader(...)`, `ctx.SetFooter(...)`, `ctx.SetStatus(...)`\n- **Editor** — `ctx.SetEditor(...)`, `ctx.ResetEditor()`\n- **Prompts** — `ctx.PromptSelect(...)`, `ctx.PromptConfirm(...)`, `ctx.PromptInput(...)`\n- **Overlays** — `ctx.ShowOverlay(...)`\n- **Messages** — `ctx.SendMessage(...)`, `ctx.GetMessages()`\n- **Model** — `ctx.SetModel(...)`, `ctx.GetAvailableModels()`\n- **Tools** — `ctx.GetAllTools()`, `ctx.SetActiveTools(...)`\n- **Context stats** — `ctx.GetC'}],b0={};function S0(u){return u>=200&&u<300?"#22c55e":u>=400&&u<500?"#f59e0b":u>=500?"#ef4444":"#6b7280"}function T0(u,p,d,c){let v=p;for(const[A,O]of Object.entries(d))v=v.replace(`{${A}}`,encodeURIComponent(O));const E=new URL(v,u);for(const[A,O]of Object.entries(c))O&&E.searchParams.set(A,O);return E.toString()}function E0(u){return u==="bearer"?"Authorization":"X-API-Key"}const Fu={width:"100%",padding:"6px 10px",border:"1px solid var(--bd)",borderRadius:4,background:"var(--bg)",color:"var(--tx)",fontSize:13,fontFamily:"var(--font-code, monospace)",boxSizing:"border-box"};function Ju({param:u,value:p,onChange:d}){return s.jsxs("div",{style:{marginBottom:10},children:[s.jsxs("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:3,color:"var(--tx)"},children:[u.name,u.required&&s.jsx("span",{style:{color:"#ef4444",marginLeft:2},children:"*"}),s.jsxs("span",{style:{fontWeight:400,color:"var(--txM)",marginLeft:6,fontSize:11},children:[u.in," · ",u.type]})]}),s.jsx("input",{"data-testid":`param-input-${u.name}`,style:Fu,placeholder:u.description||u.name,value:p,onChange:c=>d(c.target.value)})]})}function C0({endpoint:u,baseUrl:p,auth:d}){var lt;const[c,v]=B.useState(!1),[E,A]=B.useState({}),[O,z]=B.useState((lt=u.requestBody)!=null&<.schema?JSON.stringify(u.requestBody.schema,null,2):""),[y,G]=B.useState(""),[R,K]=B.useState(!1),[nt,bt]=B.useState(null),[Dt,Mt]=B.useState(null),[W,I]=B.useState(!1),ct=(P,mt)=>A(tt=>({...tt,[P]:mt})),Q=u.parameters.filter(P=>P.in==="path"),Y=u.parameters.filter(P=>P.in==="query"),H=u.parameters.filter(P=>P.in==="header"),U=u.requestBody!=null,at=async()=>{K(!0),bt(null),Mt(null);const P={};for(const At of Q)P[At.name]=E[At.name]||"";const mt={};for(const At of Y)E[At.name]&&(mt[At.name]=E[At.name]);const tt={};for(const At of H)E[At.name]&&(tt[At.name]=E[At.name]);if(U&&(tt["Content-Type"]="application/json"),d&&y){const At=d.header||E0(d.type);tt[At]=d.type==="bearer"?`Bearer ${y}`:y}try{const At=T0(p,u.path,P,mt),$t=Date.now(),ft=await fetch(At,{method:u.method.toUpperCase(),headers:tt,body:U&&O?O:void 0}),j=Date.now()-$t,w={};ft.headers.forEach((Tt,m)=>{w[m]=Tt});let V;if((ft.headers.get("content-type")||"").includes("json")){const Tt=await ft.json();V=JSON.stringify(Tt,null,2)}else V=await ft.text();bt({status:ft.status,statusText:ft.statusText,headers:w,body:V,time:j})}catch(At){Mt(At instanceof Error?At.message:"Network error")}finally{K(!1)}};return s.jsxs("div",{"data-testid":"api-playground",style:{border:"1px solid var(--bd)",borderRadius:6,overflow:"hidden",marginTop:8},children:[s.jsxs("button",{"data-testid":"playground-toggle",onClick:()=>v(!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"10px 14px",background:"var(--sf)",border:"none",cursor:"pointer",fontFamily:"inherit",fontSize:13,fontWeight:600,color:"var(--ac)"},children:[s.jsx("span",{style:{fontSize:14},children:c?"▼":"▶"}),"Try it out"]}),c&&s.jsxs("div",{style:{padding:"14px 16px",borderTop:"1px solid var(--bd)"},children:[d&&s.jsxs("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:3,color:"var(--tx)"},children:d.type==="bearer"?"Bearer Token":"API Key"}),s.jsx("input",{"data-testid":"auth-input",type:"password",style:Fu,placeholder:d.type==="bearer"?"Enter bearer token":"Enter API key",value:y,onChange:P=>G(P.target.value)})]}),Q.length>0&&s.jsxs("div",{style:{marginBottom:4},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:6,letterSpacing:"0.05em"},children:"Path Parameters"}),Q.map(P=>s.jsx(Ju,{param:P,value:E[P.name]||"",onChange:mt=>ct(P.name,mt)},P.name))]}),Y.length>0&&s.jsxs("div",{style:{marginBottom:4},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:6,letterSpacing:"0.05em"},children:"Query Parameters"}),Y.map(P=>s.jsx(Ju,{param:P,value:E[P.name]||"",onChange:mt=>ct(P.name,mt)},P.name))]}),H.length>0&&s.jsxs("div",{style:{marginBottom:4},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:6,letterSpacing:"0.05em"},children:"Header Parameters"}),H.map(P=>s.jsx(Ju,{param:P,value:E[P.name]||"",onChange:mt=>ct(P.name,mt)},P.name))]}),U&&s.jsxs("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:3,color:"var(--tx)"},children:"Request Body"}),s.jsx("textarea",{"data-testid":"request-body",style:{...Fu,minHeight:100,resize:"vertical",lineHeight:1.5},value:O,onChange:P=>z(P.target.value)})]}),s.jsx("button",{"data-testid":"send-request",onClick:at,disabled:R,style:{padding:"8px 20px",borderRadius:4,border:"none",background:"var(--ac)",color:"#fff",fontWeight:600,fontSize:13,cursor:R?"wait":"pointer",opacity:R?.7:1,fontFamily:"inherit"},children:R?"Sending...":"Send Request"}),Dt&&s.jsx("div",{"data-testid":"playground-error",style:{marginTop:12,padding:"10px 14px",borderRadius:4,background:"#ef444418",border:"1px solid #ef444444",color:"#ef4444",fontSize:13},children:Dt}),nt&&s.jsxs("div",{"data-testid":"playground-response",style:{marginTop:12},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[s.jsxs("span",{"data-testid":"response-status",style:{padding:"2px 10px",borderRadius:4,fontSize:13,fontWeight:700,fontFamily:"var(--font-code, monospace)",color:"#fff",background:S0(nt.status)},children:[nt.status," ",nt.statusText]}),s.jsxs("span",{style:{fontSize:12,color:"var(--txM)"},children:[nt.time,"ms"]})]}),s.jsxs("button",{"data-testid":"toggle-headers",onClick:()=>I(!W),style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",fontSize:12,color:"var(--txM)",padding:"4px 0",fontFamily:"inherit",marginBottom:4},children:[s.jsx("span",{style:{transform:W?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s"},children:"▶"}),"Response Headers"]}),W&&s.jsx("pre",{style:{background:"var(--sf)",padding:10,borderRadius:4,fontSize:11,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.5,marginBottom:8,color:"var(--tx2)",margin:"0 0 8px 0"},children:Object.entries(nt.headers).map(([P,mt])=>`${P}: ${mt}`).join(`
-`)}),s.jsx("pre",{"data-testid":"response-body",style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:14,borderRadius:6,fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0,maxHeight:400},children:nt.body})]})]})]})}function mm({samples:u}){var c;const[p,d]=B.useState(0);return u.length===0?null:s.jsxs("div",{"data-testid":"code-samples",style:{border:"1px solid var(--bd)",borderRadius:8,overflow:"hidden"},children:[s.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--bd)",background:"var(--sf)",overflowX:"auto",WebkitOverflowScrolling:"touch"},children:u.map((v,E)=>s.jsx("button",{onClick:()=>d(E),style:{padding:"8px 16px",fontSize:13,fontWeight:500,background:E===p?"var(--cdBg)":"transparent",color:E===p?"var(--tx)":"var(--tx2)",border:"none",borderBottom:E===p?"2px solid var(--ac)":"2px solid transparent",cursor:"pointer",fontFamily:"var(--font-body)",whiteSpace:"nowrap"},children:v.label},v.language))}),s.jsx("pre",{style:{margin:0,padding:16,background:"var(--cdBg)",overflow:"auto"},children:s.jsx("code",{style:{fontSize:13,fontFamily:"var(--font-code)"},children:(c=u[p])==null?void 0:c.code})})]})}const hm={get:"#22c55e",post:"#3b82f6",put:"#f59e0b",delete:"#ef4444",patch:"#a78bfa",head:"#6b7280",options:"#6b7280"};function z0({method:u}){const p=hm[u.toLowerCase()]||"#6b7280";return s.jsx("span",{"data-testid":"method-badge",style:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:700,fontFamily:"var(--font-code, monospace)",textTransform:"uppercase",color:"#fff",background:p,letterSpacing:"0.05em"},children:u.toUpperCase()})}function j0({parameters:u}){return u.length===0?null:s.jsx("div",{style:{overflowX:"auto",marginBottom:16},children:s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,lineHeight:1.5},children:[s.jsx("thead",{children:s.jsxs("tr",{style:{borderBottom:"2px solid var(--bd)",textAlign:"left"},children:[s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Name"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Type"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"In"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Required"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Description"})]})}),s.jsx("tbody",{children:u.map((p,d)=>s.jsxs("tr",{style:{borderBottom:"1px solid var(--bd)"},children:[s.jsx("td",{style:{padding:"8px 12px",fontFamily:"var(--font-code, monospace)",fontWeight:500,color:p.in==="path"?"var(--ac)":"var(--tx)"},children:p.name}),s.jsx("td",{style:{padding:"8px 12px",fontFamily:"var(--font-code, monospace)",color:"var(--tx2)"},children:p.type}),s.jsx("td",{style:{padding:"8px 12px",color:"var(--txM)"},children:s.jsx("span",{style:{padding:"1px 6px",borderRadius:3,fontSize:11,background:p.in==="path"?"var(--ac)22":"var(--sf)",color:p.in==="path"?"var(--ac)":"var(--txM)"},children:p.in})}),s.jsx("td",{style:{padding:"8px 12px"},children:p.required?s.jsx("span",{"data-testid":"required-badge",style:{padding:"1px 6px",borderRadius:3,fontSize:11,fontWeight:600,background:"#ef444422",color:"#ef4444"},children:"required"}):s.jsx("span",{style:{color:"var(--txM)",fontSize:12},children:"optional"})}),s.jsx("td",{style:{padding:"8px 12px",color:"var(--tx2)"},children:p.description||"—"})]},`${p.name}-${d}`))})]})})}function M0({requestBody:u}){return s.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[s.jsx("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:11,fontFamily:"var(--font-code, monospace)",background:"var(--sf)",color:"var(--tx2)"},children:u.contentType}),u.required&&s.jsx("span",{style:{padding:"1px 6px",borderRadius:3,fontSize:11,fontWeight:600,background:"#ef444422",color:"#ef4444"},children:"required"})]}),u.description&&s.jsx("p",{style:{fontSize:13,color:"var(--tx2)",marginBottom:8,marginTop:0},children:u.description}),u.schema&&s.jsx("pre",{style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:16,borderRadius:6,fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0},children:JSON.stringify(u.schema,null,2)})]})}function A0(u){return u.startsWith("2")?"#22c55e":u.startsWith("4")?"#f59e0b":u.startsWith("5")?"#ef4444":"#6b7280"}function k0({responses:u}){return u.length===0?null:s.jsx("div",{style:{marginBottom:16},children:u.map((p,d)=>{const c=A0(p.statusCode);return s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:6,marginBottom:8,overflow:"hidden"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",background:"var(--sf)"},children:[s.jsx("span",{"data-testid":"status-badge",style:{padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:700,fontFamily:"var(--font-code, monospace)",color:"#fff",background:c},children:p.statusCode}),s.jsx("span",{style:{fontSize:13,color:"var(--tx2)"},children:p.description})]}),p.schema&&s.jsx("pre",{style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:14,fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0,borderTop:"1px solid var(--bd)"},children:JSON.stringify(p.schema,null,2)})]},`${p.statusCode}-${d}`)})})}function _0(u,p){const d=p+u.path,c=[`curl -X ${u.method.toUpperCase()} "${d}"`],v=u.parameters.filter(E=>E.in==="header");for(const E of v)c.push(`  -H "${E.name}: "`);return u.requestBody&&(c.push(`  -H "Content-Type: ${u.requestBody.contentType}"`),u.requestBody.schema&&c.push(`  -d '${JSON.stringify(u.requestBody.schema,null,2)}'`)),c.join(` \\
-`)}function D0(u,p){var A;const d=p+u.path,c=[];c.push(`  method: "${u.method.toUpperCase()}",`);const v={},E=u.parameters.filter(O=>O.in==="header");for(const O of E)v[O.name]="";return u.requestBody&&(v["Content-Type"]=u.requestBody.contentType),Object.keys(v).length>0&&c.push(`  headers: ${JSON.stringify(v,null,4).replace(/\n/g,`
+`},{id:"extensions/overview",title:"Extension System",content:'\n# Extension System\n\nExtensions are Go source files interpreted at runtime via [Yaegi](https://github.com/traefik/yaegi). They can add custom tools, slash commands, widgets, keyboard shortcuts, and intercept lifecycle events — all without recompiling Kit.\n\n## Minimal extension\n\n```go\n//go:build ignore\n\npackage main\n\nimport "kit/ext"\n\nfunc Init(api ext.API) {\n    api.OnSessionStart(func(_ ext.SessionStartEvent, ctx ext.Context) {\n        ctx.SetFooter(ext.HeaderFooterConfig{\n            Content: ext.WidgetContent{Text: "Custom Footer"},\n        })\n    })\n}\n```\n\nRun it with:\n\n```bash\nkit -e examples/extensions/minimal.go\n```\n\n## How extensions work\n\n1. Kit discovers extension files from [auto-discovery paths](/extensions/loading) or explicit `-e` flags\n2. Each `.go` file is loaded into a Yaegi interpreter with access to the `kit/ext` package\n3. Kit calls the `Init(api ext.API)` function in each extension\n4. The extension registers callbacks, tools, commands, and UI components via the `api` and `ctx` objects\n\n## Key concepts\n\n### The `API` object\n\nPassed to `Init()`, the `API` object is used to register lifecycle event handlers and static components:\n\n- **Lifecycle handlers** — `api.OnSessionStart(...)`, `api.OnToolCall(...)`, etc.\n- **Tools** — `api.RegisterTool(ext.ToolDef{...})`\n- **Commands** — `api.RegisterCommand(ext.CommandDef{...})`\n- **Shortcuts** — `api.RegisterShortcut(ext.ShortcutDef{...}, handler)`\n- **Tool renderers** — `api.RegisterToolRenderer(ext.ToolRenderConfig{...})`\n- **Message renderers** — `api.RegisterMessageRenderer(ext.MessageRendererConfig{...})`\n- **Options** — `api.RegisterOption(ext.OptionDef{...})`\n\n### The `Context` object\n\nPassed to event handlers, the `Context` object provides runtime access to Kit\'s state and UI:\n\n- **Output** — `ctx.Print(...)`, `ctx.PrintInfo(...)`, `ctx.PrintError(...)`\n- **UI components** — `ctx.SetWidget(...)`, `ctx.SetHeader(...)`, `ctx.SetFooter(...)`, `ctx.SetStatus(...)`\n- **Editor** — `ctx.SetEditor(...)`, `ctx.ResetEditor()`\n- **Prompts** — `ctx.PromptSelect(...)`, `ctx.PromptConfirm(...)`, `ctx.PromptInput(...)`\n- **Overlays** — `ctx.ShowOverlay(...)`\n- **Messages** — `ctx.SendMessage(...)`, `ctx.GetMessages()`\n- **Model** — `ctx.SetModel(...)`, `ctx.GetAvailableModels()`\n- **Tools** — `ctx.GetAllTools()`, `ctx.SetActiveTools(...)`\n- **Context stats** — `ctx.GetContextStats()`\n- **Session data** — `ctx.A'}],bg={};function Sg(u){return u>=200&&u<300?"#22c55e":u>=400&&u<500?"#f59e0b":u>=500?"#ef4444":"#6b7280"}function Tg(u,p,d,c){let v=p;for(const[A,O]of Object.entries(d))v=v.replace(`{${A}}`,encodeURIComponent(O));const E=new URL(v,u);for(const[A,O]of Object.entries(c))O&&E.searchParams.set(A,O);return E.toString()}function Eg(u){return u==="bearer"?"Authorization":"X-API-Key"}const Fu={width:"100%",padding:"6px 10px",border:"1px solid var(--bd)",borderRadius:4,background:"var(--bg)",color:"var(--tx)",fontSize:13,fontFamily:"var(--font-code, monospace)",boxSizing:"border-box"};function Ju({param:u,value:p,onChange:d}){return s.jsxs("div",{style:{marginBottom:10},children:[s.jsxs("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:3,color:"var(--tx)"},children:[u.name,u.required&&s.jsx("span",{style:{color:"#ef4444",marginLeft:2},children:"*"}),s.jsxs("span",{style:{fontWeight:400,color:"var(--txM)",marginLeft:6,fontSize:11},children:[u.in," · ",u.type]})]}),s.jsx("input",{"data-testid":`param-input-${u.name}`,style:Fu,placeholder:u.description||u.name,value:p,onChange:c=>d(c.target.value)})]})}function Cg({endpoint:u,baseUrl:p,auth:d}){var lt;const[c,v]=B.useState(!1),[E,A]=B.useState({}),[O,z]=B.useState((lt=u.requestBody)!=null&<.schema?JSON.stringify(u.requestBody.schema,null,2):""),[y,G]=B.useState(""),[R,K]=B.useState(!1),[nt,bt]=B.useState(null),[Dt,Mt]=B.useState(null),[W,I]=B.useState(!1),ct=(P,mt)=>A(tt=>({...tt,[P]:mt})),Q=u.parameters.filter(P=>P.in==="path"),Y=u.parameters.filter(P=>P.in==="query"),H=u.parameters.filter(P=>P.in==="header"),U=u.requestBody!=null,at=async()=>{K(!0),bt(null),Mt(null);const P={};for(const At of Q)P[At.name]=E[At.name]||"";const mt={};for(const At of Y)E[At.name]&&(mt[At.name]=E[At.name]);const tt={};for(const At of H)E[At.name]&&(tt[At.name]=E[At.name]);if(U&&(tt["Content-Type"]="application/json"),d&&y){const At=d.header||Eg(d.type);tt[At]=d.type==="bearer"?`Bearer ${y}`:y}try{const At=Tg(p,u.path,P,mt),$t=Date.now(),ft=await fetch(At,{method:u.method.toUpperCase(),headers:tt,body:U&&O?O:void 0}),j=Date.now()-$t,w={};ft.headers.forEach((Tt,m)=>{w[m]=Tt});let V;if((ft.headers.get("content-type")||"").includes("json")){const Tt=await ft.json();V=JSON.stringify(Tt,null,2)}else V=await ft.text();bt({status:ft.status,statusText:ft.statusText,headers:w,body:V,time:j})}catch(At){Mt(At instanceof Error?At.message:"Network error")}finally{K(!1)}};return s.jsxs("div",{"data-testid":"api-playground",style:{border:"1px solid var(--bd)",borderRadius:6,overflow:"hidden",marginTop:8},children:[s.jsxs("button",{"data-testid":"playground-toggle",onClick:()=>v(!c),style:{display:"flex",alignItems:"center",gap:8,width:"100%",padding:"10px 14px",background:"var(--sf)",border:"none",cursor:"pointer",fontFamily:"inherit",fontSize:13,fontWeight:600,color:"var(--ac)"},children:[s.jsx("span",{style:{fontSize:14},children:c?"▼":"▶"}),"Try it out"]}),c&&s.jsxs("div",{style:{padding:"14px 16px",borderTop:"1px solid var(--bd)"},children:[d&&s.jsxs("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:3,color:"var(--tx)"},children:d.type==="bearer"?"Bearer Token":"API Key"}),s.jsx("input",{"data-testid":"auth-input",type:"password",style:Fu,placeholder:d.type==="bearer"?"Enter bearer token":"Enter API key",value:y,onChange:P=>G(P.target.value)})]}),Q.length>0&&s.jsxs("div",{style:{marginBottom:4},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:6,letterSpacing:"0.05em"},children:"Path Parameters"}),Q.map(P=>s.jsx(Ju,{param:P,value:E[P.name]||"",onChange:mt=>ct(P.name,mt)},P.name))]}),Y.length>0&&s.jsxs("div",{style:{marginBottom:4},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:6,letterSpacing:"0.05em"},children:"Query Parameters"}),Y.map(P=>s.jsx(Ju,{param:P,value:E[P.name]||"",onChange:mt=>ct(P.name,mt)},P.name))]}),H.length>0&&s.jsxs("div",{style:{marginBottom:4},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:6,letterSpacing:"0.05em"},children:"Header Parameters"}),H.map(P=>s.jsx(Ju,{param:P,value:E[P.name]||"",onChange:mt=>ct(P.name,mt)},P.name))]}),U&&s.jsxs("div",{style:{marginBottom:12},children:[s.jsx("label",{style:{display:"block",fontSize:12,fontWeight:600,marginBottom:3,color:"var(--tx)"},children:"Request Body"}),s.jsx("textarea",{"data-testid":"request-body",style:{...Fu,minHeight:100,resize:"vertical",lineHeight:1.5},value:O,onChange:P=>z(P.target.value)})]}),s.jsx("button",{"data-testid":"send-request",onClick:at,disabled:R,style:{padding:"8px 20px",borderRadius:4,border:"none",background:"var(--ac)",color:"#fff",fontWeight:600,fontSize:13,cursor:R?"wait":"pointer",opacity:R?.7:1,fontFamily:"inherit"},children:R?"Sending...":"Send Request"}),Dt&&s.jsx("div",{"data-testid":"playground-error",style:{marginTop:12,padding:"10px 14px",borderRadius:4,background:"#ef444418",border:"1px solid #ef444444",color:"#ef4444",fontSize:13},children:Dt}),nt&&s.jsxs("div",{"data-testid":"playground-response",style:{marginTop:12},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10,marginBottom:8},children:[s.jsxs("span",{"data-testid":"response-status",style:{padding:"2px 10px",borderRadius:4,fontSize:13,fontWeight:700,fontFamily:"var(--font-code, monospace)",color:"#fff",background:Sg(nt.status)},children:[nt.status," ",nt.statusText]}),s.jsxs("span",{style:{fontSize:12,color:"var(--txM)"},children:[nt.time,"ms"]})]}),s.jsxs("button",{"data-testid":"toggle-headers",onClick:()=>I(!W),style:{display:"flex",alignItems:"center",gap:4,background:"none",border:"none",cursor:"pointer",fontSize:12,color:"var(--txM)",padding:"4px 0",fontFamily:"inherit",marginBottom:4},children:[s.jsx("span",{style:{transform:W?"rotate(90deg)":"rotate(0)",transition:"transform 0.15s"},children:"▶"}),"Response Headers"]}),W&&s.jsx("pre",{style:{background:"var(--sf)",padding:10,borderRadius:4,fontSize:11,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.5,marginBottom:8,color:"var(--tx2)",margin:"0 0 8px 0"},children:Object.entries(nt.headers).map(([P,mt])=>`${P}: ${mt}`).join(`
+`)}),s.jsx("pre",{"data-testid":"response-body",style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:14,borderRadius:6,fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0,maxHeight:400},children:nt.body})]})]})]})}function mm({samples:u}){var c;const[p,d]=B.useState(0);return u.length===0?null:s.jsxs("div",{"data-testid":"code-samples",style:{border:"1px solid var(--bd)",borderRadius:8,overflow:"hidden"},children:[s.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--bd)",background:"var(--sf)",overflowX:"auto",WebkitOverflowScrolling:"touch"},children:u.map((v,E)=>s.jsx("button",{onClick:()=>d(E),style:{padding:"8px 16px",fontSize:13,fontWeight:500,background:E===p?"var(--cdBg)":"transparent",color:E===p?"var(--tx)":"var(--tx2)",border:"none",borderBottom:E===p?"2px solid var(--ac)":"2px solid transparent",cursor:"pointer",fontFamily:"var(--font-body)",whiteSpace:"nowrap"},children:v.label},v.language))}),s.jsx("pre",{style:{margin:0,padding:16,background:"var(--cdBg)",overflow:"auto"},children:s.jsx("code",{style:{fontSize:13,fontFamily:"var(--font-code)"},children:(c=u[p])==null?void 0:c.code})})]})}const hm={get:"#22c55e",post:"#3b82f6",put:"#f59e0b",delete:"#ef4444",patch:"#a78bfa",head:"#6b7280",options:"#6b7280"};function zg({method:u}){const p=hm[u.toLowerCase()]||"#6b7280";return s.jsx("span",{"data-testid":"method-badge",style:{display:"inline-block",padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:700,fontFamily:"var(--font-code, monospace)",textTransform:"uppercase",color:"#fff",background:p,letterSpacing:"0.05em"},children:u.toUpperCase()})}function jg({parameters:u}){return u.length===0?null:s.jsx("div",{style:{overflowX:"auto",marginBottom:16},children:s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,lineHeight:1.5},children:[s.jsx("thead",{children:s.jsxs("tr",{style:{borderBottom:"2px solid var(--bd)",textAlign:"left"},children:[s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Name"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Type"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"In"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Required"}),s.jsx("th",{style:{padding:"8px 12px",fontWeight:600,color:"var(--tx)"},children:"Description"})]})}),s.jsx("tbody",{children:u.map((p,d)=>s.jsxs("tr",{style:{borderBottom:"1px solid var(--bd)"},children:[s.jsx("td",{style:{padding:"8px 12px",fontFamily:"var(--font-code, monospace)",fontWeight:500,color:p.in==="path"?"var(--ac)":"var(--tx)"},children:p.name}),s.jsx("td",{style:{padding:"8px 12px",fontFamily:"var(--font-code, monospace)",color:"var(--tx2)"},children:p.type}),s.jsx("td",{style:{padding:"8px 12px",color:"var(--txM)"},children:s.jsx("span",{style:{padding:"1px 6px",borderRadius:3,fontSize:11,background:p.in==="path"?"var(--ac)22":"var(--sf)",color:p.in==="path"?"var(--ac)":"var(--txM)"},children:p.in})}),s.jsx("td",{style:{padding:"8px 12px"},children:p.required?s.jsx("span",{"data-testid":"required-badge",style:{padding:"1px 6px",borderRadius:3,fontSize:11,fontWeight:600,background:"#ef444422",color:"#ef4444"},children:"required"}):s.jsx("span",{style:{color:"var(--txM)",fontSize:12},children:"optional"})}),s.jsx("td",{style:{padding:"8px 12px",color:"var(--tx2)"},children:p.description||"—"})]},`${p.name}-${d}`))})]})})}function Mg({requestBody:u}){return s.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[s.jsx("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:11,fontFamily:"var(--font-code, monospace)",background:"var(--sf)",color:"var(--tx2)"},children:u.contentType}),u.required&&s.jsx("span",{style:{padding:"1px 6px",borderRadius:3,fontSize:11,fontWeight:600,background:"#ef444422",color:"#ef4444"},children:"required"})]}),u.description&&s.jsx("p",{style:{fontSize:13,color:"var(--tx2)",marginBottom:8,marginTop:0},children:u.description}),u.schema&&s.jsx("pre",{style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:16,borderRadius:6,fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0},children:JSON.stringify(u.schema,null,2)})]})}function Ag(u){return u.startsWith("2")?"#22c55e":u.startsWith("4")?"#f59e0b":u.startsWith("5")?"#ef4444":"#6b7280"}function kg({responses:u}){return u.length===0?null:s.jsx("div",{style:{marginBottom:16},children:u.map((p,d)=>{const c=Ag(p.statusCode);return s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:6,marginBottom:8,overflow:"hidden"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,padding:"10px 14px",background:"var(--sf)"},children:[s.jsx("span",{"data-testid":"status-badge",style:{padding:"2px 8px",borderRadius:4,fontSize:12,fontWeight:700,fontFamily:"var(--font-code, monospace)",color:"#fff",background:c},children:p.statusCode}),s.jsx("span",{style:{fontSize:13,color:"var(--tx2)"},children:p.description})]}),p.schema&&s.jsx("pre",{style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:14,fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0,borderTop:"1px solid var(--bd)"},children:JSON.stringify(p.schema,null,2)})]},`${p.statusCode}-${d}`)})})}function _g(u,p){const d=p+u.path,c=[`curl -X ${u.method.toUpperCase()} "${d}"`],v=u.parameters.filter(E=>E.in==="header");for(const E of v)c.push(`  -H "${E.name}: "`);return u.requestBody&&(c.push(`  -H "Content-Type: ${u.requestBody.contentType}"`),u.requestBody.schema&&c.push(`  -d '${JSON.stringify(u.requestBody.schema,null,2)}'`)),c.join(` \\
+`)}function Dg(u,p){var A;const d=p+u.path,c=[];c.push(`  method: "${u.method.toUpperCase()}",`);const v={},E=u.parameters.filter(O=>O.in==="header");for(const O of E)v[O.name]="";return u.requestBody&&(v["Content-Type"]=u.requestBody.contentType),Object.keys(v).length>0&&c.push(`  headers: ${JSON.stringify(v,null,4).replace(/\n/g,`
   `)},`),(A=u.requestBody)!=null&&A.schema&&c.push(`  body: JSON.stringify(${JSON.stringify(u.requestBody.schema,null,4).replace(/\n/g,`
   `)}),`),`fetch("${d}", {
 ${c.join(`
 `)}
-});`}function O0(u,p){var O,z;const d=p+u.path,c=["import requests",""],v={},E=u.parameters.filter(y=>y.in==="header");for(const y of E)v[y.name]="";u.requestBody&&(v["Content-Type"]=u.requestBody.contentType),Object.keys(v).length>0&&(c.push(`headers = ${JSON.stringify(v,null,4)}`),c.push("")),(O=u.requestBody)!=null&&O.schema&&(c.push(`data = ${JSON.stringify(u.requestBody.schema,null,4)}`),c.push(""));const A=[`"${d}"`];return Object.keys(v).length>0&&A.push("headers=headers"),(z=u.requestBody)!=null&&z.schema&&A.push("json=data"),c.push(`response = requests.${u.method}(${A.join(", ")})`),c.push("print(response.json())"),c.join(`
-`)}function R0(u,p){var E,A;const d=p+u.path,c=["package main","","import (",'  "fmt"','  "net/http"'];(E=u.requestBody)!=null&&E.schema&&c.push('  "bytes"','  "encoding/json"'),c.push('  "io"',")",""),c.push("func main() {"),(A=u.requestBody)!=null&&A.schema?(c.push(`  body, _ := json.Marshal(${JSON.stringify(u.requestBody.schema)})`),c.push(`  req, _ := http.NewRequest("${u.method.toUpperCase()}", "${d}", bytes.NewBuffer(body))`)):c.push(`  req, _ := http.NewRequest("${u.method.toUpperCase()}", "${d}", nil)`);const v=u.parameters.filter(O=>O.in==="header");for(const O of v)c.push(`  req.Header.Set("${O.name}", "")`);return u.requestBody&&c.push(`  req.Header.Set("Content-Type", "${u.requestBody.contentType}")`),c.push("  resp, _ := http.DefaultClient.Do(req)"),c.push("  defer resp.Body.Close()"),c.push("  data, _ := io.ReadAll(resp.Body)"),c.push("  fmt.Println(string(data))"),c.push("}"),c.join(`
-`)}function B0(u,p){var E;const d=p+u.path,c=["import java.net.http.*;","import java.net.URI;","","var client = HttpClient.newHttpClient();"];(E=u.requestBody)!=null&&E.schema?(c.push(`var body = ${JSON.stringify(JSON.stringify(u.requestBody.schema))};`),c.push("var request = HttpRequest.newBuilder()"),c.push(`  .uri(URI.create("${d}"))`),c.push(`  .method("${u.method.toUpperCase()}", HttpRequest.BodyPublishers.ofString(body))`)):(c.push("var request = HttpRequest.newBuilder()"),c.push(`  .uri(URI.create("${d}"))`),c.push(`  .method("${u.method.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`));const v=u.parameters.filter(A=>A.in==="header");for(const A of v)c.push(`  .header("${A.name}", "")`);return u.requestBody&&c.push(`  .header("Content-Type", "${u.requestBody.contentType}")`),c.push("  .build();"),c.push(""),c.push("var response = client.send(request, HttpResponse.BodyHandlers.ofString());"),c.push("System.out.println(response.body());"),c.join(`
-`)}function w0(u,p){var E;const d=p+u.path,c=["using var client = new HttpClient();","",`var request = new HttpRequestMessage(HttpMethod.${u.method.charAt(0).toUpperCase()+u.method.slice(1)}, "${d}");`],v=u.parameters.filter(A=>A.in==="header");for(const A of v)c.push(`request.Headers.Add("${A.name}", "");`);return(E=u.requestBody)!=null&&E.schema&&(c.push("request.Content = new StringContent("),c.push(`  ${JSON.stringify(JSON.stringify(u.requestBody.schema))},`),c.push("  System.Text.Encoding.UTF8,"),c.push(`  "${u.requestBody.contentType}");`)),c.push(""),c.push("var response = await client.SendAsync(request);"),c.push("var body = await response.Content.ReadAsStringAsync();"),c.push("Console.WriteLine(body);"),c.join(`
-`)}function U0({endpoint:u,baseUrl:p="https://api.example.com"}){const[d,c]=B.useState(0),v=["cURL","JavaScript","Python","Go","Java","C#"],E=[_0(u,p),D0(u,p),O0(u,p),R0(u,p),B0(u,p),w0(u,p)];return s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("div",{style:{display:"flex",gap:0,borderBottom:"1px solid var(--bd)",overflowX:"auto",WebkitOverflowScrolling:"touch"},children:v.map((A,O)=>s.jsx("button",{onClick:()=>c(O),style:{padding:"6px 14px",background:"none",border:"none",borderBottom:d===O?"2px solid var(--ac)":"2px solid transparent",color:d===O?"var(--ac)":"var(--txM)",fontWeight:d===O?600:400,fontSize:12,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap"},children:A},A))}),s.jsx("pre",{style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:16,borderRadius:"0 0 6px 6px",fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0},children:E[d]})]})}function H0({endpoint:u,baseUrl:p,defaultExpanded:d=!1,showPlayground:c,playgroundAuth:v}){const[E,A]=B.useState(d),O=(u.operationId||`${u.method}-${u.path}`).toLowerCase().replace(/[^a-z0-9]+/g,"-"),z=u.parameters.length>0||u.requestBody!=null||u.responses.length>0;return s.jsxs("div",{id:O,style:{border:"1px solid var(--bd)",borderRadius:8,marginBottom:12,overflow:"hidden",scrollMarginTop:24},children:[s.jsxs("button",{onClick:()=>z&&A(!E),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"14px 18px",background:"var(--sf)",border:"none",cursor:z?"pointer":"default",textAlign:"left",fontFamily:"inherit",color:"var(--tx)"},children:[s.jsx(z0,{method:u.method}),s.jsx("span",{style:{fontFamily:"var(--font-code, monospace)",fontSize:14,fontWeight:500},children:u.path}),u.deprecated&&s.jsx("span",{"data-testid":"deprecated-badge",style:{padding:"1px 6px",borderRadius:3,fontSize:10,fontWeight:700,background:"#f59e0b33",color:"#f59e0b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Deprecated"}),u.tags.map(y=>s.jsx("span",{style:{padding:"1px 6px",borderRadius:3,fontSize:10,background:"var(--bd)",color:"var(--txM)"},children:y},y)),s.jsx("span",{style:{flex:1}}),u.summary&&s.jsx("span",{style:{fontSize:13,color:"var(--tx2)",marginRight:8},children:u.summary}),z&&s.jsx("span",{style:{transform:E?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s",fontSize:12,color:"var(--txM)"},children:"▾"})]}),E&&s.jsxs("div",{style:{padding:"16px 18px",borderTop:"1px solid var(--bd)"},children:[u.description&&s.jsx("p",{style:{fontSize:14,color:"var(--tx2)",lineHeight:1.65,marginTop:0,marginBottom:16},children:u.description}),u.parameters.length>0&&s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Parameters"}),s.jsx(j0,{parameters:u.parameters})]}),u.requestBody&&s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Request Body"}),s.jsx(M0,{requestBody:u.requestBody})]}),u.responses.length>0&&s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Responses"}),s.jsx(k0,{responses:u.responses})]}),s.jsxs("div",{children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Code Examples"}),u.codeSamples&&u.codeSamples.length>0?s.jsx(mm,{samples:u.codeSamples}):s.jsx(U0,{endpoint:u,baseUrl:p})]}),c&&s.jsx("div",{style:{marginTop:16},children:s.jsx(C0,{endpoint:u,baseUrl:p||"https://api.example.com",auth:v})})]})]})}function N0({manifest:u,baseUrl:p,showPlayground:d,playgroundAuth:c}){const v=p||(u.servers.length>0?u.servers[0].url:"https://api.example.com"),E=new Map;for(const z of u.endpoints){const y=z.tags.length>0?z.tags[0]:"Other";E.has(y)||E.set(y,[]),E.get(y).push(z)}const A=[];for(const z of u.tags)E.has(z.name)&&A.push(z.name);for(const z of E.keys())A.includes(z)||A.push(z);const O=new Map;for(const z of u.tags)O.set(z.name,z.description);return s.jsxs("div",{style:{display:"flex",gap:32},children:[s.jsxs("nav",{"data-testid":"api-toc",style:{width:200,flexShrink:0,position:"sticky",top:24,alignSelf:"flex-start",maxHeight:"calc(100vh - 48px)",overflowY:"auto"},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:12,letterSpacing:"0.05em"},children:"Endpoints"}),A.map(z=>{const y=z.toLowerCase().replace(/\s+/g,"-");return s.jsxs("div",{style:{marginBottom:14},children:[s.jsx("a",{href:`#${y}`,onClick:G=>{var R;G.preventDefault(),(R=document.getElementById(y))==null||R.scrollIntoView({behavior:"smooth",block:"start"})},style:{display:"block",fontSize:13,fontWeight:600,color:"var(--tx)",textDecoration:"none",marginBottom:4},children:z}),(E.get(z)||[]).map(G=>{const R=(G.operationId||`${G.method}-${G.path}`).toLowerCase().replace(/[^a-z0-9]+/g,"-");return s.jsxs("a",{href:`#${R}`,onClick:K=>{var nt;K.preventDefault(),(nt=document.getElementById(R))==null||nt.scrollIntoView({behavior:"smooth",block:"start"})},style:{display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--tx2)",textDecoration:"none",padding:"3px 0"},children:[s.jsx("span",{style:{fontSize:9,fontWeight:700,fontFamily:"var(--font-code, monospace)",color:hm[G.method]||"#6b7280",width:36,textTransform:"uppercase"},children:G.method}),s.jsx("span",{style:{fontFamily:"var(--font-code, monospace)"},children:G.path})]},`${G.method}-${G.path}`)})]},z)})]}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{marginBottom:32},children:[s.jsx("h1",{style:{fontSize:28,fontWeight:700,marginBottom:4},children:u.title}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[s.jsxs("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,background:"var(--sf)",color:"var(--txM)"},children:["v",u.version]}),u.servers.length>0&&s.jsx("span",{style:{fontSize:12,fontFamily:"var(--font-code, monospace)",color:"var(--tx2)"},children:u.servers[0].url})]}),u.description&&s.jsx("p",{style:{fontSize:14,color:"var(--tx2)",lineHeight:1.65,marginTop:0},children:u.description})]}),A.map(z=>s.jsxs("section",{id:z.toLowerCase().replace(/\s+/g,"-"),"data-testid":"tag-section",style:{marginBottom:40},children:[s.jsx("h2",{style:{fontSize:20,fontWeight:700,marginBottom:4},children:z}),O.get(z)&&s.jsx("p",{style:{fontSize:14,color:"var(--tx2)",lineHeight:1.65,marginTop:0,marginBottom:16},children:O.get(z)}),(E.get(z)||[]).map(y=>s.jsx(H0,{endpoint:y,baseUrl:v,showPlayground:d,playgroundAuth:c},`${y.method}-${y.path}`))]},z))]})]})}function q0({href:u,title:p,description:d,icon:c,external:v}){const E=v??u.startsWith("http");return s.jsxs("a",{href:u,target:E?"_blank":void 0,rel:E?"noopener noreferrer":void 0,style:{display:"block",padding:"16px 20px",border:"1px solid var(--bd)",borderRadius:8,textDecoration:"none",color:"inherit",background:"var(--sf)",transition:"border-color 0.15s, background 0.15s",cursor:"pointer"},onMouseEnter:A=>{A.currentTarget.style.borderColor="var(--ac)",A.currentTarget.style.background="var(--sfH)"},onMouseLeave:A=>{A.currentTarget.style.borderColor="var(--bd)",A.currentTarget.style.background="var(--sf)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c&&s.jsx("span",{style:{fontSize:18},children:c}),s.jsx("span",{style:{fontWeight:600,fontSize:15,color:"var(--tx)"},children:p}),s.jsx("span",{style:{marginLeft:"auto",color:"var(--tx2)",fontSize:14},children:E?"↗":"→"})]}),d&&s.jsx("p",{style:{margin:"6px 0 0",fontSize:13,color:"var(--tx2)",lineHeight:1.5},children:d})]})}function L0({columns:u=2,children:p}){return s.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:12,marginTop:16,marginBottom:16},children:p})}const G0={Added:"#22c55e",Changed:"#3b82f6",Deprecated:"#f59e0b",Removed:"#ef4444",Fixed:"#8b5cf6",Security:"#f97316"};function lm(u){return G0[u]||"#6b7280"}function Y0({entries:u,initialLimit:p}){const[d,c]=B.useState(!p),v=d?u:u.slice(0,p||u.length);return u.length===0?s.jsx("div",{"data-testid":"changelog-empty",style:{padding:"40px 0",textAlign:"center",color:"var(--txM)",fontSize:14},children:"No changelog entries found."}):s.jsxs("div",{"data-testid":"changelog-timeline",style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",left:15,top:8,bottom:8,width:2,background:"var(--bd)"}}),v.map((E,A)=>s.jsxs("div",{"data-testid":`changelog-entry-${E.version}`,style:{position:"relative",paddingLeft:44,paddingBottom:As.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,marginBottom:8},children:[s.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:lm(O.type)}}),s.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:lm(O.type),fontFamily:"var(--font-code, monospace)"},children:O.type})]}),s.jsx("ul",{style:{margin:0,paddingLeft:18,listStyleType:"disc",color:"var(--tx2)"},children:O.items.map((z,y)=>s.jsx("li",{style:{fontSize:14,lineHeight:1.7,color:"var(--tx2)",marginBottom:2},children:z},y))})]},O.type))]},E.version)),!d&&u.length>(p||0)&&s.jsx("div",{style:{textAlign:"center",marginTop:24},children:s.jsxs("button",{"data-testid":"changelog-show-more",onClick:()=>c(!0),style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"8px 20px",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body, inherit)",cursor:"pointer",transition:"border-color .15s, color .15s"},children:["Show all ",u.length," releases"]})})]})}const im={info:{color:"#3b82f6",label:"INFO"},warning:{color:"#f59e0b",label:"WARNING"},tip:{color:"var(--ac, #a78bfa)",label:"TIP"},danger:{color:"#ef4444",label:"DANGER"}};function K0({type:u="info",title:p,children:d}){const c=im[u]||im.info;return s.jsxs("div",{style:{borderLeft:`3px solid ${c.color}`,background:`${c.color}11`,borderRadius:"0 2px 2px 0",padding:"14px 18px",marginBottom:20},children:[p?s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[s.jsx("span",{style:{fontWeight:700,fontSize:10,letterSpacing:".08em",color:c.color,fontFamily:"var(--font-code, monospace)"},children:c.label}),s.jsx("span",{style:{fontWeight:600,fontSize:13,color:c.color},children:p})]}):s.jsx("div",{style:{marginBottom:4},children:s.jsx("span",{style:{fontWeight:700,fontSize:10,letterSpacing:".08em",color:c.color,fontFamily:"var(--font-code, monospace)"},children:c.label})}),s.jsx("div",{style:{fontSize:14,lineHeight:1.65,color:"var(--tx2)"},children:d})]})}function X0({items:u,children:p}){const[d,c]=B.useState(0);return s.jsxs("div",{style:{marginBottom:20},children:[s.jsx("div",{style:{display:"flex",gap:0,borderBottom:"1px solid var(--bd)"},children:u.map((v,E)=>s.jsx("button",{onClick:()=>c(E),style:{padding:"8px 16px",background:"none",border:"none",borderBottom:d===E?"2px solid var(--ac)":"2px solid transparent",color:d===E?"var(--ac)":"var(--txM)",fontWeight:d===E?600:400,fontSize:13,cursor:"pointer",fontFamily:"inherit"},children:v},E))}),s.jsx("div",{style:{padding:"16px 0"},children:p[d]})]})}function Q0({title:u,icon:p,href:d,children:c}){const v=s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:2,padding:"20px",transition:"border-color 0.15s",cursor:d?"pointer":"default"},children:[p&&s.jsx("span",{style:{fontSize:24,marginBottom:8,display:"block"},children:p}),s.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:u}),c&&s.jsx("div",{style:{fontSize:13,color:"var(--txM)",lineHeight:1.5},children:c})]});return d?s.jsx("a",{href:d,style:{textDecoration:"none",color:"inherit"},children:v}):v}function Z0({cols:u=2,children:p}){return s.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:12,marginBottom:20},children:p})}function V0({children:u}){return s.jsx("div",{style:{paddingLeft:24,borderLeft:"2px solid var(--bd)",marginBottom:20},children:sm.Children.map(u,(p,d)=>s.jsxs("div",{style:{position:"relative",paddingBottom:20},children:[s.jsx("div",{style:{position:"absolute",left:-33,top:0,width:20,height:20,borderRadius:"50%",background:"var(--ac)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700},children:d+1}),s.jsx("div",{style:{paddingLeft:8},children:p})]}))})}function J0({title:u,children:p}){const[d,c]=B.useState(!1);return s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:2,marginBottom:8,overflow:"hidden"},children:[s.jsxs("button",{onClick:()=>c(!d),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"12px 16px",background:"var(--sf)",border:"none",cursor:"pointer",fontWeight:500,fontSize:14,color:"var(--tx)",fontFamily:"inherit"},children:[u,s.jsx("span",{style:{transform:d?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s"},children:"▾"})]}),d&&s.jsx("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--bd)",fontSize:14,color:"var(--tx2)",lineHeight:1.65},children:p})]})}const W0={install:{npm:"npm install",yarn:"yarn add",pnpm:"pnpm add",bun:"bun add"},"install -D":{npm:"npm install -D",yarn:"yarn add -D",pnpm:"pnpm add -D",bun:"bun add -d"},uninstall:{npm:"npm uninstall",yarn:"yarn remove",pnpm:"pnpm remove",bun:"bun remove"},run:{npm:"npm run",yarn:"yarn",pnpm:"pnpm",bun:"bun run"},exec:{npm:"npx",yarn:"yarn dlx",pnpm:"pnpm dlx",bun:"bunx"},init:{npm:"npm init",yarn:"yarn init",pnpm:"pnpm init",bun:"bun init"},create:{npm:"npm create",yarn:"yarn create",pnpm:"pnpm create",bun:"bun create"}};function F0(u,p){for(const[d,c]of Object.entries(W0))if(u.startsWith(d+" ")||u===d){const v=u.slice(d.length);return(c[p]||d)+v}return`${p} ${u}`}function $0({command:u}){const[p,d]=B.useState(0),[c,v]=B.useState(!1),E=["npm","yarn","pnpm","bun"],A=F0(u,E[p]);return s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:2,marginBottom:16,overflow:"hidden"},children:[s.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--bd)",background:"var(--sf)",overflowX:"auto"},children:E.map((O,z)=>s.jsx("button",{onClick:()=>{d(z),v(!1)},style:{padding:"8px 14px",background:"none",border:"none",cursor:"pointer",fontSize:12,fontFamily:"var(--font-code)",fontWeight:z===p?600:400,color:z===p?"var(--ac)":"var(--txM)",borderBottom:z===p?"2px solid var(--ac)":"2px solid transparent",whiteSpace:"nowrap"},children:O},O))}),s.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"10px 14px",background:"var(--cdBg)",gap:8},children:[s.jsx("code",{style:{flex:1,fontFamily:"var(--font-code)",fontSize:13,color:"var(--cdTx)",whiteSpace:"pre",overflowX:"auto"},children:A}),s.jsx("button",{onClick:()=>{var O;(O=navigator.clipboard)==null||O.writeText(A),v(!0),setTimeout(()=>v(!1),2e3)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--txM)",fontSize:12,fontFamily:"var(--font-code)",flexShrink:0},children:c?"✓":"Copy"})]})]})}function I0({name:u,fields:p}){return s.jsxs("div",{style:{marginBottom:16},children:[u&&s.jsx("h4",{style:{fontFamily:"var(--font-code)",fontSize:15,marginBottom:8,color:"var(--tx)"},children:u}),s.jsx("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,fontFamily:"var(--font-body)"},children:[s.jsx("thead",{children:s.jsx("tr",{style:{borderBottom:"2px solid var(--bd)"},children:["Property","Type","Required","Default","Description"].map(d=>s.jsx("th",{style:{textAlign:"left",padding:"8px 10px",color:"var(--txM)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:".05em",whiteSpace:"nowrap"},children:d},d))})}),s.jsx("tbody",{children:p.map(d=>s.jsxs("tr",{style:{borderBottom:"1px solid var(--bd)"},children:[s.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-code)",fontWeight:500,color:"var(--tx)"},children:d.name}),s.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-code)",fontSize:12,color:"var(--ac)"},children:d.type}),s.jsx("td",{style:{padding:"8px 10px"},children:d.required&&s.jsx("span",{style:{fontSize:10,fontWeight:600,color:"#e04040",background:"rgba(224,64,64,0.1)",padding:"2px 6px",borderRadius:2},children:"required"})}),s.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-code)",fontSize:12,color:"var(--txM)"},children:d.default||"—"}),s.jsx("td",{style:{padding:"8px 10px",color:"var(--tx2)"},children:d.description||""})]},d.name))})]})})]})}function P0({name:u}){return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 0",fontFamily:"var(--font-code)",fontSize:13,color:"var(--tx2)"},children:[s.jsx("span",{style:{opacity:.6},children:"📄"})," ",u]})}function tg({name:u,defaultOpen:p,children:d}){const[c,v]=B.useState(p??!1);return s.jsxs("div",{children:[s.jsxs("button",{onClick:()=>v(!c),style:{display:"flex",alignItems:"center",gap:6,padding:"3px 0",background:"none",border:"none",cursor:"pointer",fontFamily:"var(--font-code)",fontSize:13,color:"var(--tx)",fontWeight:500},children:[s.jsx("span",{children:c?"📂":"📁"})," ",u]}),c&&s.jsx("div",{style:{paddingLeft:18,borderLeft:"1px solid var(--bd)",marginLeft:8},children:d})]})}function Iu({children:u}){return s.jsx("div",{style:{border:"1px solid var(--bd)",borderRadius:2,padding:"12px 16px",background:"var(--cdBg)",marginBottom:16},children:u})}Iu.File=P0;Iu.Folder=tg;const eg={Callout:K0,Tabs:X0,Card:Q0,CardGroup:Z0,Steps:V0,Accordion:J0,ChangelogTimeline:Y0,PackageManager:$0,TypeTable:I0,FileTree:Iu,CodeSamples:mm,LinkCard:q0,CardGrid:L0},ng=`
+});`}function Og(u,p){var O,z;const d=p+u.path,c=["import requests",""],v={},E=u.parameters.filter(y=>y.in==="header");for(const y of E)v[y.name]="";u.requestBody&&(v["Content-Type"]=u.requestBody.contentType),Object.keys(v).length>0&&(c.push(`headers = ${JSON.stringify(v,null,4)}`),c.push("")),(O=u.requestBody)!=null&&O.schema&&(c.push(`data = ${JSON.stringify(u.requestBody.schema,null,4)}`),c.push(""));const A=[`"${d}"`];return Object.keys(v).length>0&&A.push("headers=headers"),(z=u.requestBody)!=null&&z.schema&&A.push("json=data"),c.push(`response = requests.${u.method}(${A.join(", ")})`),c.push("print(response.json())"),c.join(`
+`)}function Rg(u,p){var E,A;const d=p+u.path,c=["package main","","import (",'  "fmt"','  "net/http"'];(E=u.requestBody)!=null&&E.schema&&c.push('  "bytes"','  "encoding/json"'),c.push('  "io"',")",""),c.push("func main() {"),(A=u.requestBody)!=null&&A.schema?(c.push(`  body, _ := json.Marshal(${JSON.stringify(u.requestBody.schema)})`),c.push(`  req, _ := http.NewRequest("${u.method.toUpperCase()}", "${d}", bytes.NewBuffer(body))`)):c.push(`  req, _ := http.NewRequest("${u.method.toUpperCase()}", "${d}", nil)`);const v=u.parameters.filter(O=>O.in==="header");for(const O of v)c.push(`  req.Header.Set("${O.name}", "")`);return u.requestBody&&c.push(`  req.Header.Set("Content-Type", "${u.requestBody.contentType}")`),c.push("  resp, _ := http.DefaultClient.Do(req)"),c.push("  defer resp.Body.Close()"),c.push("  data, _ := io.ReadAll(resp.Body)"),c.push("  fmt.Println(string(data))"),c.push("}"),c.join(`
+`)}function Bg(u,p){var E;const d=p+u.path,c=["import java.net.http.*;","import java.net.URI;","","var client = HttpClient.newHttpClient();"];(E=u.requestBody)!=null&&E.schema?(c.push(`var body = ${JSON.stringify(JSON.stringify(u.requestBody.schema))};`),c.push("var request = HttpRequest.newBuilder()"),c.push(`  .uri(URI.create("${d}"))`),c.push(`  .method("${u.method.toUpperCase()}", HttpRequest.BodyPublishers.ofString(body))`)):(c.push("var request = HttpRequest.newBuilder()"),c.push(`  .uri(URI.create("${d}"))`),c.push(`  .method("${u.method.toUpperCase()}", HttpRequest.BodyPublishers.noBody())`));const v=u.parameters.filter(A=>A.in==="header");for(const A of v)c.push(`  .header("${A.name}", "")`);return u.requestBody&&c.push(`  .header("Content-Type", "${u.requestBody.contentType}")`),c.push("  .build();"),c.push(""),c.push("var response = client.send(request, HttpResponse.BodyHandlers.ofString());"),c.push("System.out.println(response.body());"),c.join(`
+`)}function wg(u,p){var E;const d=p+u.path,c=["using var client = new HttpClient();","",`var request = new HttpRequestMessage(HttpMethod.${u.method.charAt(0).toUpperCase()+u.method.slice(1)}, "${d}");`],v=u.parameters.filter(A=>A.in==="header");for(const A of v)c.push(`request.Headers.Add("${A.name}", "");`);return(E=u.requestBody)!=null&&E.schema&&(c.push("request.Content = new StringContent("),c.push(`  ${JSON.stringify(JSON.stringify(u.requestBody.schema))},`),c.push("  System.Text.Encoding.UTF8,"),c.push(`  "${u.requestBody.contentType}");`)),c.push(""),c.push("var response = await client.SendAsync(request);"),c.push("var body = await response.Content.ReadAsStringAsync();"),c.push("Console.WriteLine(body);"),c.join(`
+`)}function Ug({endpoint:u,baseUrl:p="https://api.example.com"}){const[d,c]=B.useState(0),v=["cURL","JavaScript","Python","Go","Java","C#"],E=[_g(u,p),Dg(u,p),Og(u,p),Rg(u,p),Bg(u,p),wg(u,p)];return s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("div",{style:{display:"flex",gap:0,borderBottom:"1px solid var(--bd)",overflowX:"auto",WebkitOverflowScrolling:"touch"},children:v.map((A,O)=>s.jsx("button",{onClick:()=>c(O),style:{padding:"6px 14px",background:"none",border:"none",borderBottom:d===O?"2px solid var(--ac)":"2px solid transparent",color:d===O?"var(--ac)":"var(--txM)",fontWeight:d===O?600:400,fontSize:12,cursor:"pointer",fontFamily:"inherit",whiteSpace:"nowrap"},children:A},A))}),s.jsx("pre",{style:{background:"var(--cdBg)",color:"var(--cdTx)",padding:16,borderRadius:"0 0 6px 6px",fontSize:12,fontFamily:"var(--font-code, monospace)",overflow:"auto",lineHeight:1.6,margin:0},children:E[d]})]})}function Hg({endpoint:u,baseUrl:p,defaultExpanded:d=!1,showPlayground:c,playgroundAuth:v}){const[E,A]=B.useState(d),O=(u.operationId||`${u.method}-${u.path}`).toLowerCase().replace(/[^a-z0-9]+/g,"-"),z=u.parameters.length>0||u.requestBody!=null||u.responses.length>0;return s.jsxs("div",{id:O,style:{border:"1px solid var(--bd)",borderRadius:8,marginBottom:12,overflow:"hidden",scrollMarginTop:24},children:[s.jsxs("button",{onClick:()=>z&&A(!E),style:{display:"flex",alignItems:"center",gap:10,width:"100%",padding:"14px 18px",background:"var(--sf)",border:"none",cursor:z?"pointer":"default",textAlign:"left",fontFamily:"inherit",color:"var(--tx)"},children:[s.jsx(zg,{method:u.method}),s.jsx("span",{style:{fontFamily:"var(--font-code, monospace)",fontSize:14,fontWeight:500},children:u.path}),u.deprecated&&s.jsx("span",{"data-testid":"deprecated-badge",style:{padding:"1px 6px",borderRadius:3,fontSize:10,fontWeight:700,background:"#f59e0b33",color:"#f59e0b",textTransform:"uppercase",letterSpacing:"0.05em"},children:"Deprecated"}),u.tags.map(y=>s.jsx("span",{style:{padding:"1px 6px",borderRadius:3,fontSize:10,background:"var(--bd)",color:"var(--txM)"},children:y},y)),s.jsx("span",{style:{flex:1}}),u.summary&&s.jsx("span",{style:{fontSize:13,color:"var(--tx2)",marginRight:8},children:u.summary}),z&&s.jsx("span",{style:{transform:E?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s",fontSize:12,color:"var(--txM)"},children:"▾"})]}),E&&s.jsxs("div",{style:{padding:"16px 18px",borderTop:"1px solid var(--bd)"},children:[u.description&&s.jsx("p",{style:{fontSize:14,color:"var(--tx2)",lineHeight:1.65,marginTop:0,marginBottom:16},children:u.description}),u.parameters.length>0&&s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Parameters"}),s.jsx(jg,{parameters:u.parameters})]}),u.requestBody&&s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Request Body"}),s.jsx(Mg,{requestBody:u.requestBody})]}),u.responses.length>0&&s.jsxs("div",{style:{marginBottom:16},children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Responses"}),s.jsx(kg,{responses:u.responses})]}),s.jsxs("div",{children:[s.jsx("h4",{style:{fontSize:13,fontWeight:600,marginBottom:8,color:"var(--tx)"},children:"Code Examples"}),u.codeSamples&&u.codeSamples.length>0?s.jsx(mm,{samples:u.codeSamples}):s.jsx(Ug,{endpoint:u,baseUrl:p})]}),c&&s.jsx("div",{style:{marginTop:16},children:s.jsx(Cg,{endpoint:u,baseUrl:p||"https://api.example.com",auth:v})})]})]})}function Ng({manifest:u,baseUrl:p,showPlayground:d,playgroundAuth:c}){const v=p||(u.servers.length>0?u.servers[0].url:"https://api.example.com"),E=new Map;for(const z of u.endpoints){const y=z.tags.length>0?z.tags[0]:"Other";E.has(y)||E.set(y,[]),E.get(y).push(z)}const A=[];for(const z of u.tags)E.has(z.name)&&A.push(z.name);for(const z of E.keys())A.includes(z)||A.push(z);const O=new Map;for(const z of u.tags)O.set(z.name,z.description);return s.jsxs("div",{style:{display:"flex",gap:32},children:[s.jsxs("nav",{"data-testid":"api-toc",style:{width:200,flexShrink:0,position:"sticky",top:24,alignSelf:"flex-start",maxHeight:"calc(100vh - 48px)",overflowY:"auto"},children:[s.jsx("div",{style:{fontSize:11,fontWeight:700,textTransform:"uppercase",color:"var(--txM)",marginBottom:12,letterSpacing:"0.05em"},children:"Endpoints"}),A.map(z=>{const y=z.toLowerCase().replace(/\s+/g,"-");return s.jsxs("div",{style:{marginBottom:14},children:[s.jsx("a",{href:`#${y}`,onClick:G=>{var R;G.preventDefault(),(R=document.getElementById(y))==null||R.scrollIntoView({behavior:"smooth",block:"start"})},style:{display:"block",fontSize:13,fontWeight:600,color:"var(--tx)",textDecoration:"none",marginBottom:4},children:z}),(E.get(z)||[]).map(G=>{const R=(G.operationId||`${G.method}-${G.path}`).toLowerCase().replace(/[^a-z0-9]+/g,"-");return s.jsxs("a",{href:`#${R}`,onClick:K=>{var nt;K.preventDefault(),(nt=document.getElementById(R))==null||nt.scrollIntoView({behavior:"smooth",block:"start"})},style:{display:"flex",alignItems:"center",gap:6,fontSize:12,color:"var(--tx2)",textDecoration:"none",padding:"3px 0"},children:[s.jsx("span",{style:{fontSize:9,fontWeight:700,fontFamily:"var(--font-code, monospace)",color:hm[G.method]||"#6b7280",width:36,textTransform:"uppercase"},children:G.method}),s.jsx("span",{style:{fontFamily:"var(--font-code, monospace)"},children:G.path})]},`${G.method}-${G.path}`)})]},z)})]}),s.jsxs("div",{style:{flex:1,minWidth:0},children:[s.jsxs("div",{style:{marginBottom:32},children:[s.jsx("h1",{style:{fontSize:28,fontWeight:700,marginBottom:4},children:u.title}),s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:8},children:[s.jsxs("span",{style:{padding:"2px 8px",borderRadius:4,fontSize:11,fontWeight:600,background:"var(--sf)",color:"var(--txM)"},children:["v",u.version]}),u.servers.length>0&&s.jsx("span",{style:{fontSize:12,fontFamily:"var(--font-code, monospace)",color:"var(--tx2)"},children:u.servers[0].url})]}),u.description&&s.jsx("p",{style:{fontSize:14,color:"var(--tx2)",lineHeight:1.65,marginTop:0},children:u.description})]}),A.map(z=>s.jsxs("section",{id:z.toLowerCase().replace(/\s+/g,"-"),"data-testid":"tag-section",style:{marginBottom:40},children:[s.jsx("h2",{style:{fontSize:20,fontWeight:700,marginBottom:4},children:z}),O.get(z)&&s.jsx("p",{style:{fontSize:14,color:"var(--tx2)",lineHeight:1.65,marginTop:0,marginBottom:16},children:O.get(z)}),(E.get(z)||[]).map(y=>s.jsx(Hg,{endpoint:y,baseUrl:v,showPlayground:d,playgroundAuth:c},`${y.method}-${y.path}`))]},z))]})]})}function qg({href:u,title:p,description:d,icon:c,external:v}){const E=v??u.startsWith("http");return s.jsxs("a",{href:u,target:E?"_blank":void 0,rel:E?"noopener noreferrer":void 0,style:{display:"block",padding:"16px 20px",border:"1px solid var(--bd)",borderRadius:8,textDecoration:"none",color:"inherit",background:"var(--sf)",transition:"border-color 0.15s, background 0.15s",cursor:"pointer"},onMouseEnter:A=>{A.currentTarget.style.borderColor="var(--ac)",A.currentTarget.style.background="var(--sfH)"},onMouseLeave:A=>{A.currentTarget.style.borderColor="var(--bd)",A.currentTarget.style.background="var(--sf)"},children:[s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8},children:[c&&s.jsx("span",{style:{fontSize:18},children:c}),s.jsx("span",{style:{fontWeight:600,fontSize:15,color:"var(--tx)"},children:p}),s.jsx("span",{style:{marginLeft:"auto",color:"var(--tx2)",fontSize:14},children:E?"↗":"→"})]}),d&&s.jsx("p",{style:{margin:"6px 0 0",fontSize:13,color:"var(--tx2)",lineHeight:1.5},children:d})]})}function Lg({columns:u=2,children:p}){return s.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:12,marginTop:16,marginBottom:16},children:p})}const Gg={Added:"#22c55e",Changed:"#3b82f6",Deprecated:"#f59e0b",Removed:"#ef4444",Fixed:"#8b5cf6",Security:"#f97316"};function lm(u){return Gg[u]||"#6b7280"}function Yg({entries:u,initialLimit:p}){const[d,c]=B.useState(!p),v=d?u:u.slice(0,p||u.length);return u.length===0?s.jsx("div",{"data-testid":"changelog-empty",style:{padding:"40px 0",textAlign:"center",color:"var(--txM)",fontSize:14},children:"No changelog entries found."}):s.jsxs("div",{"data-testid":"changelog-timeline",style:{position:"relative"},children:[s.jsx("div",{style:{position:"absolute",left:15,top:8,bottom:8,width:2,background:"var(--bd)"}}),v.map((E,A)=>s.jsxs("div",{"data-testid":`changelog-entry-${E.version}`,style:{position:"relative",paddingLeft:44,paddingBottom:As.jsxs("div",{style:{marginBottom:16},children:[s.jsxs("div",{style:{display:"inline-flex",alignItems:"center",gap:6,marginBottom:8},children:[s.jsx("span",{style:{display:"inline-block",width:8,height:8,borderRadius:"50%",background:lm(O.type)}}),s.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:".06em",color:lm(O.type),fontFamily:"var(--font-code, monospace)"},children:O.type})]}),s.jsx("ul",{style:{margin:0,paddingLeft:18,listStyleType:"disc",color:"var(--tx2)"},children:O.items.map((z,y)=>s.jsx("li",{style:{fontSize:14,lineHeight:1.7,color:"var(--tx2)",marginBottom:2},children:z},y))})]},O.type))]},E.version)),!d&&u.length>(p||0)&&s.jsx("div",{style:{textAlign:"center",marginTop:24},children:s.jsxs("button",{"data-testid":"changelog-show-more",onClick:()=>c(!0),style:{background:"none",border:"1px solid var(--bd)",borderRadius:2,padding:"8px 20px",color:"var(--tx2)",fontSize:13,fontFamily:"var(--font-body, inherit)",cursor:"pointer",transition:"border-color .15s, color .15s"},children:["Show all ",u.length," releases"]})})]})}const im={info:{color:"#3b82f6",label:"INFO"},warning:{color:"#f59e0b",label:"WARNING"},tip:{color:"var(--ac, #a78bfa)",label:"TIP"},danger:{color:"#ef4444",label:"DANGER"}};function Kg({type:u="info",title:p,children:d}){const c=im[u]||im.info;return s.jsxs("div",{style:{borderLeft:`3px solid ${c.color}`,background:`${c.color}11`,borderRadius:"0 2px 2px 0",padding:"14px 18px",marginBottom:20},children:[p?s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:4},children:[s.jsx("span",{style:{fontWeight:700,fontSize:10,letterSpacing:".08em",color:c.color,fontFamily:"var(--font-code, monospace)"},children:c.label}),s.jsx("span",{style:{fontWeight:600,fontSize:13,color:c.color},children:p})]}):s.jsx("div",{style:{marginBottom:4},children:s.jsx("span",{style:{fontWeight:700,fontSize:10,letterSpacing:".08em",color:c.color,fontFamily:"var(--font-code, monospace)"},children:c.label})}),s.jsx("div",{style:{fontSize:14,lineHeight:1.65,color:"var(--tx2)"},children:d})]})}function Xg({items:u,children:p}){const[d,c]=B.useState(0);return s.jsxs("div",{style:{marginBottom:20},children:[s.jsx("div",{style:{display:"flex",gap:0,borderBottom:"1px solid var(--bd)"},children:u.map((v,E)=>s.jsx("button",{onClick:()=>c(E),style:{padding:"8px 16px",background:"none",border:"none",borderBottom:d===E?"2px solid var(--ac)":"2px solid transparent",color:d===E?"var(--ac)":"var(--txM)",fontWeight:d===E?600:400,fontSize:13,cursor:"pointer",fontFamily:"inherit"},children:v},E))}),s.jsx("div",{style:{padding:"16px 0"},children:p[d]})]})}function Qg({title:u,icon:p,href:d,children:c}){const v=s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:2,padding:"20px",transition:"border-color 0.15s",cursor:d?"pointer":"default"},children:[p&&s.jsx("span",{style:{fontSize:24,marginBottom:8,display:"block"},children:p}),s.jsx("div",{style:{fontWeight:600,fontSize:14,marginBottom:4},children:u}),c&&s.jsx("div",{style:{fontSize:13,color:"var(--txM)",lineHeight:1.5},children:c})]});return d?s.jsx("a",{href:d,style:{textDecoration:"none",color:"inherit"},children:v}):v}function Zg({cols:u=2,children:p}){return s.jsx("div",{style:{display:"grid",gridTemplateColumns:`repeat(${u}, 1fr)`,gap:12,marginBottom:20},children:p})}function Vg({children:u}){return s.jsx("div",{style:{paddingLeft:24,borderLeft:"2px solid var(--bd)",marginBottom:20},children:sm.Children.map(u,(p,d)=>s.jsxs("div",{style:{position:"relative",paddingBottom:20},children:[s.jsx("div",{style:{position:"absolute",left:-33,top:0,width:20,height:20,borderRadius:"50%",background:"var(--ac)",color:"#fff",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:700},children:d+1}),s.jsx("div",{style:{paddingLeft:8},children:p})]}))})}function Jg({title:u,children:p}){const[d,c]=B.useState(!1);return s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:2,marginBottom:8,overflow:"hidden"},children:[s.jsxs("button",{onClick:()=>c(!d),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"12px 16px",background:"var(--sf)",border:"none",cursor:"pointer",fontWeight:500,fontSize:14,color:"var(--tx)",fontFamily:"inherit"},children:[u,s.jsx("span",{style:{transform:d?"rotate(180deg)":"rotate(0)",transition:"transform 0.2s"},children:"▾"})]}),d&&s.jsx("div",{style:{padding:"12px 16px",borderTop:"1px solid var(--bd)",fontSize:14,color:"var(--tx2)",lineHeight:1.65},children:p})]})}const Wg={install:{npm:"npm install",yarn:"yarn add",pnpm:"pnpm add",bun:"bun add"},"install -D":{npm:"npm install -D",yarn:"yarn add -D",pnpm:"pnpm add -D",bun:"bun add -d"},uninstall:{npm:"npm uninstall",yarn:"yarn remove",pnpm:"pnpm remove",bun:"bun remove"},run:{npm:"npm run",yarn:"yarn",pnpm:"pnpm",bun:"bun run"},exec:{npm:"npx",yarn:"yarn dlx",pnpm:"pnpm dlx",bun:"bunx"},init:{npm:"npm init",yarn:"yarn init",pnpm:"pnpm init",bun:"bun init"},create:{npm:"npm create",yarn:"yarn create",pnpm:"pnpm create",bun:"bun create"}};function Fg(u,p){for(const[d,c]of Object.entries(Wg))if(u.startsWith(d+" ")||u===d){const v=u.slice(d.length);return(c[p]||d)+v}return`${p} ${u}`}function $g({command:u}){const[p,d]=B.useState(0),[c,v]=B.useState(!1),E=["npm","yarn","pnpm","bun"],A=Fg(u,E[p]);return s.jsxs("div",{style:{border:"1px solid var(--bd)",borderRadius:2,marginBottom:16,overflow:"hidden"},children:[s.jsx("div",{style:{display:"flex",borderBottom:"1px solid var(--bd)",background:"var(--sf)",overflowX:"auto"},children:E.map((O,z)=>s.jsx("button",{onClick:()=>{d(z),v(!1)},style:{padding:"8px 14px",background:"none",border:"none",cursor:"pointer",fontSize:12,fontFamily:"var(--font-code)",fontWeight:z===p?600:400,color:z===p?"var(--ac)":"var(--txM)",borderBottom:z===p?"2px solid var(--ac)":"2px solid transparent",whiteSpace:"nowrap"},children:O},O))}),s.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"10px 14px",background:"var(--cdBg)",gap:8},children:[s.jsx("code",{style:{flex:1,fontFamily:"var(--font-code)",fontSize:13,color:"var(--cdTx)",whiteSpace:"pre",overflowX:"auto"},children:A}),s.jsx("button",{onClick:()=>{var O;(O=navigator.clipboard)==null||O.writeText(A),v(!0),setTimeout(()=>v(!1),2e3)},style:{background:"none",border:"none",cursor:"pointer",color:"var(--txM)",fontSize:12,fontFamily:"var(--font-code)",flexShrink:0},children:c?"✓":"Copy"})]})]})}function Ig({name:u,fields:p}){return s.jsxs("div",{style:{marginBottom:16},children:[u&&s.jsx("h4",{style:{fontFamily:"var(--font-code)",fontSize:15,marginBottom:8,color:"var(--tx)"},children:u}),s.jsx("div",{style:{overflowX:"auto",WebkitOverflowScrolling:"touch"},children:s.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:13,fontFamily:"var(--font-body)"},children:[s.jsx("thead",{children:s.jsx("tr",{style:{borderBottom:"2px solid var(--bd)"},children:["Property","Type","Required","Default","Description"].map(d=>s.jsx("th",{style:{textAlign:"left",padding:"8px 10px",color:"var(--txM)",fontWeight:600,fontSize:11,textTransform:"uppercase",letterSpacing:".05em",whiteSpace:"nowrap"},children:d},d))})}),s.jsx("tbody",{children:p.map(d=>s.jsxs("tr",{style:{borderBottom:"1px solid var(--bd)"},children:[s.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-code)",fontWeight:500,color:"var(--tx)"},children:d.name}),s.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-code)",fontSize:12,color:"var(--ac)"},children:d.type}),s.jsx("td",{style:{padding:"8px 10px"},children:d.required&&s.jsx("span",{style:{fontSize:10,fontWeight:600,color:"#e04040",background:"rgba(224,64,64,0.1)",padding:"2px 6px",borderRadius:2},children:"required"})}),s.jsx("td",{style:{padding:"8px 10px",fontFamily:"var(--font-code)",fontSize:12,color:"var(--txM)"},children:d.default||"—"}),s.jsx("td",{style:{padding:"8px 10px",color:"var(--tx2)"},children:d.description||""})]},d.name))})]})})]})}function Pg({name:u}){return s.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"3px 0",fontFamily:"var(--font-code)",fontSize:13,color:"var(--tx2)"},children:[s.jsx("span",{style:{opacity:.6},children:"📄"})," ",u]})}function t0({name:u,defaultOpen:p,children:d}){const[c,v]=B.useState(p??!1);return s.jsxs("div",{children:[s.jsxs("button",{onClick:()=>v(!c),style:{display:"flex",alignItems:"center",gap:6,padding:"3px 0",background:"none",border:"none",cursor:"pointer",fontFamily:"var(--font-code)",fontSize:13,color:"var(--tx)",fontWeight:500},children:[s.jsx("span",{children:c?"📂":"📁"})," ",u]}),c&&s.jsx("div",{style:{paddingLeft:18,borderLeft:"1px solid var(--bd)",marginLeft:8},children:d})]})}function Iu({children:u}){return s.jsx("div",{style:{border:"1px solid var(--bd)",borderRadius:2,padding:"12px 16px",background:"var(--cdBg)",marginBottom:16},children:u})}Iu.File=Pg;Iu.Folder=t0;const e0={Callout:Kg,Tabs:Xg,Card:Qg,CardGroup:Zg,Steps:Vg,Accordion:Jg,ChangelogTimeline:Yg,PackageManager:$g,TypeTable:Ig,FileTree:Iu,CodeSamples:mm,LinkCard:qg,CardGrid:Lg},n0=`
   @import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&family=Bricolage+Grotesque:wght@300;400;500;600;700&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;0,700;1,300;1,400;1,700&family=Fira+Code:wght@400;500;600&family=Bodoni+Moda:ital,wght@0,400;0,700;0,900;1,400&family=Space+Grotesk:wght@400;500;600;700&family=Source+Code+Pro:wght@400;500;600&family=Inter:wght@300;400;500;600;700&display=swap');
 
   html, body { margin: 0; padding: 0; height: 100%; overflow: clip; }
@@ -1412,4 +1412,4 @@ ${c.join(`
     border-color: var(--bd);
     box-shadow: 0 4px 12px rgba(0,0,0,0.3);
   }
-`,_o=(Jn.basePath||"/").replace(/\/$/,"");function ag(u){return cm(u,_o,Wn)}function Wu(u){return f0(u,_o,Wn)}const pm=p0(window.location.pathname,window.location.hash,Wn,_o,cm),lg=fm(pm,Wn,dm);function ig(){var W,I,ct,Q;const[u,p]=B.useState(pm),[d,c]=B.useState(null),[v,E]=B.useState(!0),A=B.useRef(0),O=B.useCallback(async(Y,H)=>{const U=++A.current;E(!0);let at;try{at=await fm(Y,Wn,dm)}catch(P){if(A.current!==U)return;console.error(`[tome] Navigation failed for page: ${Y}`,P),at=null}if(A.current!==U)return;const lt=Wu(Y);if(H!=null&&H.replace?window.history.replaceState(null,"",lt):window.history.pushState(null,"",lt),p(Y),c(at),E(!1),!(H!=null&&H.skipScroll)){const P=window.location.hash.slice(1);P?requestAnimationFrame(()=>{const mt=document.getElementById(P);mt&&mt.scrollIntoView({behavior:"smooth",block:"start"})}):window.scrollTo(0,0)}},[]);B.useEffect(()=>{const Y=window.location.hash.slice(1);if(Y&&Wn.some(H=>H.id===Y)){const H=Wu(Y);window.history.replaceState(null,"",H),O(Y,{replace:!0})}else{const H=Wu(u);window.history.replaceState(null,"",H),lg.then(U=>{c(U),E(!1)})}},[]),B.useEffect(()=>{const Y=()=>{const H=ag(window.location.pathname);H&&H!==u&&O(H,{replace:!0,skipScroll:!0})};return window.addEventListener("popstate",Y),()=>window.removeEventListener("popstate",Y)},[u,O]);const z=B.useRef(null),[y,G]=B.useState(()=>{var H,U;if(typeof document>"u")return"light";if(document.documentElement.classList.contains("dark"))return"dark";const Y=((H=Jn.theme)==null?void 0:H.mode)||"auto";return Y==="dark"?"dark":Y==="light"?"light":(U=window.matchMedia)!=null&&U.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"});B.useEffect(()=>{const Y=new MutationObserver(()=>{const H=document.documentElement.classList.contains("dark");G(H?"dark":"light")});return Y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>Y.disconnect()},[]),B.useEffect(()=>{const Y=document.querySelectorAll(".tome-mermaid[data-mermaid]");if(Y.length===0)return;let H=!1;const U="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";return(async()=>{try{z.current||(z.current=(await import(U)).default);const at=z.current;if(H)return;const lt=y==="dark",P=getComputedStyle(document.documentElement).getPropertyValue("--font-body").trim()||"sans-serif";at.initialize({startOnLoad:!1,theme:lt?"dark":"default",fontFamily:P,flowchart:{padding:15,nodeSpacing:30,rankSpacing:40}});for(let mt=0;mt{lt.textContent="Failed to load diagram renderer",lt.style.cssText="padding:16px;color:var(--txM);font-size:13px;border:1px dashed var(--bd);border-radius:2px;text-align:center;"})}})(),()=>{H=!0}},[d,v,y]),B.useEffect(()=>{if(v)return;const Y=document.querySelectorAll(".tome-content pre"),H=[];return Y.forEach(U=>{if(U.querySelector(".tome-copy-btn"))return;const at=document.createElement("button");at.className="tome-copy-btn",at.textContent="Copy",at.addEventListener("click",async()=>{const lt=U.querySelector("code");if(lt)try{await navigator.clipboard.writeText(lt.textContent||""),at.textContent="Copied!",setTimeout(()=>{at.textContent="Copy"},2e3)}catch{at.textContent="Failed",setTimeout(()=>{at.textContent="Copy"},2e3)}}),U.appendChild(at),H.push(at)}),()=>{H.forEach(U=>U.remove())}},[d,v]);const R=Wn.map(Y=>({id:Y.id,title:Y.frontmatter.title,description:Y.frontmatter.description})),K=Wn.find(Y=>Y.id===u),nt=g0(K),bt=h0(Jn.editLink,K==null?void 0:K.filePath),Dt=(K==null?void 0:K.locale)||(Vu==null?void 0:Vu.defaultLocale)||"en",Mt="ltr";return B.useEffect(()=>{const Y=document.querySelectorAll(".tome-math[data-math]").length>0;if(!Jn.math&&!Y)return;const H="tome-katex-css";if(document.getElementById(H))return;const U=document.createElement("link");U.id=H,U.rel="stylesheet",U.href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",U.crossOrigin="anonymous",document.head.appendChild(U)},[d,v]),B.useEffect(()=>{const Y=document.querySelectorAll(".tome-math[data-math]");if(Y.length===0)return;let H=!1;const U="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.mjs";return(async()=>{try{const at=(await import(U)).default;if(H)return;for(const lt of Y){const P=lt.getAttribute("data-math");if(P)try{const mt=atob(P),tt=lt.classList.contains("tome-math-block");at.render(mt,lt,{displayMode:tt,throwOnError:!1})}catch(mt){console.warn("[tome] KaTeX render failed:",mt)}}}catch(at){console.warn("[tome] Failed to load KaTeX from CDN:",at)}})(),()=>{H=!0}},[d,v]),s.jsxs(s.Fragment,{children:[s.jsx("style",{children:ng}),s.jsx(r0,{config:Jn,navigation:v0,currentPageId:u,pageHtml:d!=null&&d.isMdx?void 0:v?"":(d==null?void 0:d.html)||"

Page not found

",pageComponent:d!=null&&d.isMdx?d.component:void 0,mdxComponents:eg,pageTitle:(d==null?void 0:d.frontmatter.title)||(v?"":"Not Found"),pageDescription:d==null?void 0:d.frontmatter.description,headings:(d==null?void 0:d.headings)||[],tocEnabled:(d==null?void 0:d.frontmatter.toc)!==!1,editUrl:bt,lastUpdated:K==null?void 0:K.lastUpdated,changelogEntries:d!=null&&d.isMdx||d==null?void 0:d.changelogEntries,apiManifest:!(d!=null&&d.isMdx)&&(d!=null&&d.isApiReference)?d.apiManifest:void 0,apiBaseUrl:(W=Jn.api)==null?void 0:W.baseUrl,apiPlayground:(I=Jn.api)==null?void 0:I.playground,apiAuth:(ct=Jn.api)==null?void 0:ct.auth,ApiReferenceComponent:N0,onNavigate:O,allPages:R,docContext:x0,versioning:void 0,currentVersion:nt,basePath:_o,isDraft:((Q=K==null?void 0:K.frontmatter)==null?void 0:Q.draft)===!0,dir:Mt,i18n:void 0,currentLocale:Dt,overrides:b0})]})}const om=document.getElementById("tome-root");om&&wp.createRoot(om).render(s.jsx(ig,{})); +`,_o=(Jn.basePath||"/").replace(/\/$/,"");function a0(u){return cm(u,_o,Wn)}function Wu(u){return fg(u,_o,Wn)}const pm=pg(window.location.pathname,window.location.hash,Wn,_o,cm),l0=fm(pm,Wn,dm);function i0(){var W,I,ct,Q;const[u,p]=B.useState(pm),[d,c]=B.useState(null),[v,E]=B.useState(!0),A=B.useRef(0),O=B.useCallback(async(Y,H)=>{const U=++A.current;E(!0);let at;try{at=await fm(Y,Wn,dm)}catch(P){if(A.current!==U)return;console.error(`[tome] Navigation failed for page: ${Y}`,P),at=null}if(A.current!==U)return;const lt=Wu(Y);if(H!=null&&H.replace?window.history.replaceState(null,"",lt):window.history.pushState(null,"",lt),p(Y),c(at),E(!1),!(H!=null&&H.skipScroll)){const P=window.location.hash.slice(1);P?requestAnimationFrame(()=>{const mt=document.getElementById(P);mt&&mt.scrollIntoView({behavior:"smooth",block:"start"})}):window.scrollTo(0,0)}},[]);B.useEffect(()=>{const Y=window.location.hash.slice(1);if(Y&&Wn.some(H=>H.id===Y)){const H=Wu(Y);window.history.replaceState(null,"",H),O(Y,{replace:!0})}else{const H=Wu(u);window.history.replaceState(null,"",H),l0.then(U=>{c(U),E(!1)})}},[]),B.useEffect(()=>{const Y=()=>{const H=a0(window.location.pathname);H&&H!==u&&O(H,{replace:!0,skipScroll:!0})};return window.addEventListener("popstate",Y),()=>window.removeEventListener("popstate",Y)},[u,O]);const z=B.useRef(null),[y,G]=B.useState(()=>{var H,U;if(typeof document>"u")return"light";if(document.documentElement.classList.contains("dark"))return"dark";const Y=((H=Jn.theme)==null?void 0:H.mode)||"auto";return Y==="dark"?"dark":Y==="light"?"light":(U=window.matchMedia)!=null&&U.call(window,"(prefers-color-scheme: dark)").matches?"dark":"light"});B.useEffect(()=>{const Y=new MutationObserver(()=>{const H=document.documentElement.classList.contains("dark");G(H?"dark":"light")});return Y.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),()=>Y.disconnect()},[]),B.useEffect(()=>{const Y=document.querySelectorAll(".tome-mermaid[data-mermaid]");if(Y.length===0)return;let H=!1;const U="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";return(async()=>{try{z.current||(z.current=(await import(U)).default);const at=z.current;if(H)return;const lt=y==="dark",P=getComputedStyle(document.documentElement).getPropertyValue("--font-body").trim()||"sans-serif";at.initialize({startOnLoad:!1,theme:lt?"dark":"default",fontFamily:P,flowchart:{padding:15,nodeSpacing:30,rankSpacing:40}});for(let mt=0;mt{lt.textContent="Failed to load diagram renderer",lt.style.cssText="padding:16px;color:var(--txM);font-size:13px;border:1px dashed var(--bd);border-radius:2px;text-align:center;"})}})(),()=>{H=!0}},[d,v,y]),B.useEffect(()=>{if(v)return;const Y=document.querySelectorAll(".tome-content pre"),H=[];return Y.forEach(U=>{if(U.querySelector(".tome-copy-btn"))return;const at=document.createElement("button");at.className="tome-copy-btn",at.textContent="Copy",at.addEventListener("click",async()=>{const lt=U.querySelector("code");if(lt)try{await navigator.clipboard.writeText(lt.textContent||""),at.textContent="Copied!",setTimeout(()=>{at.textContent="Copy"},2e3)}catch{at.textContent="Failed",setTimeout(()=>{at.textContent="Copy"},2e3)}}),U.appendChild(at),H.push(at)}),()=>{H.forEach(U=>U.remove())}},[d,v]);const R=Wn.map(Y=>({id:Y.id,title:Y.frontmatter.title,description:Y.frontmatter.description})),K=Wn.find(Y=>Y.id===u),nt=gg(K),bt=hg(Jn.editLink,K==null?void 0:K.filePath),Dt=(K==null?void 0:K.locale)||(Vu==null?void 0:Vu.defaultLocale)||"en",Mt="ltr";return B.useEffect(()=>{const Y=document.querySelectorAll(".tome-math[data-math]").length>0;if(!Jn.math&&!Y)return;const H="tome-katex-css";if(document.getElementById(H))return;const U=document.createElement("link");U.id=H,U.rel="stylesheet",U.href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css",U.crossOrigin="anonymous",document.head.appendChild(U)},[d,v]),B.useEffect(()=>{const Y=document.querySelectorAll(".tome-math[data-math]");if(Y.length===0)return;let H=!1;const U="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.mjs";return(async()=>{try{const at=(await import(U)).default;if(H)return;for(const lt of Y){const P=lt.getAttribute("data-math");if(P)try{const mt=atob(P),tt=lt.classList.contains("tome-math-block");at.render(mt,lt,{displayMode:tt,throwOnError:!1})}catch(mt){console.warn("[tome] KaTeX render failed:",mt)}}}catch(at){console.warn("[tome] Failed to load KaTeX from CDN:",at)}})(),()=>{H=!0}},[d,v]),s.jsxs(s.Fragment,{children:[s.jsx("style",{children:n0}),s.jsx(rg,{config:Jn,navigation:vg,currentPageId:u,pageHtml:d!=null&&d.isMdx?void 0:v?"":(d==null?void 0:d.html)||"

Page not found

",pageComponent:d!=null&&d.isMdx?d.component:void 0,mdxComponents:e0,pageTitle:(d==null?void 0:d.frontmatter.title)||(v?"":"Not Found"),pageDescription:d==null?void 0:d.frontmatter.description,headings:(d==null?void 0:d.headings)||[],tocEnabled:(d==null?void 0:d.frontmatter.toc)!==!1,editUrl:bt,lastUpdated:K==null?void 0:K.lastUpdated,changelogEntries:d!=null&&d.isMdx||d==null?void 0:d.changelogEntries,apiManifest:!(d!=null&&d.isMdx)&&(d!=null&&d.isApiReference)?d.apiManifest:void 0,apiBaseUrl:(W=Jn.api)==null?void 0:W.baseUrl,apiPlayground:(I=Jn.api)==null?void 0:I.playground,apiAuth:(ct=Jn.api)==null?void 0:ct.auth,ApiReferenceComponent:Ng,onNavigate:O,allPages:R,docContext:xg,versioning:void 0,currentVersion:nt,basePath:_o,isDraft:((Q=K==null?void 0:K.frontmatter)==null?void 0:Q.draft)===!0,dir:Mt,i18n:void 0,currentLocale:Dt,overrides:bg})]})}const om=document.getElementById("tome-root");om&&wp.createRoot(om).render(s.jsx(i0,{})); diff --git a/assets/index-CGDazwHL.js b/assets/index-kfFM907t.js similarity index 97% rename from assets/index-CGDazwHL.js rename to assets/index-kfFM907t.js index 355538b6..a01ab739 100644 --- a/assets/index-CGDazwHL.js +++ b/assets/index-kfFM907t.js @@ -5,7 +5,7 @@ const n={frontmatter:{title:"Kit",description:"Kit is a powerful, extensible AI

Features

  • Multi-Provider LLM Support — Anthropic, OpenAI, Google Gemini, Ollama, Azure OpenAI, AWS Bedrock, OpenRouter, and more
  • -
  • Built-in Core Tools — bash, read, write, edit, grep, find, ls, spawn_subagent with no MCP overhead
  • +
  • Built-in Core Tools — bash, read, write, edit, grep, find, ls, subagent with no MCP overhead
  • MCP Integration — Connect external MCP servers for expanded capabilities
  • Extension System — Write custom tools, commands, widgets, and UI modifications in Go
  • Interactive TUI — Rich terminal interface powered by Bubble Tea with streaming, syntax highlighting, and custom rendering
  • @@ -54,7 +54,7 @@ A powerful, extensible AI coding agent CLI with multi-provider support, built-in ## Features - **Multi-Provider LLM Support** — Anthropic, OpenAI, Google Gemini, Ollama, Azure OpenAI, AWS Bedrock, OpenRouter, and more -- **Built-in Core Tools** — bash, read, write, edit, grep, find, ls, spawn_subagent with no MCP overhead +- **Built-in Core Tools** — bash, read, write, edit, grep, find, ls, subagent with no MCP overhead - **MCP Integration** — Connect external MCP servers for expanded capabilities - **Extension System** — Write custom tools, commands, widgets, and UI modifications in Go - **Interactive TUI** — Rich terminal interface powered by Bubble Tea with streaming, syntax highlighting, and custom rendering diff --git a/assets/subagents-BKwlFg4K.js b/assets/subagents-lghAXYlk.js similarity index 95% rename from assets/subagents-BKwlFg4K.js rename to assets/subagents-lghAXYlk.js index 9c629572..0ee9e415 100644 --- a/assets/subagents-BKwlFg4K.js +++ b/assets/subagents-lghAXYlk.js @@ -40,9 +40,9 @@ const s={frontmatter:{title:"Subagents",description:"Multi-agent orchestration w

    Positional arguments are the prompt. @file arguments attach file content as context.

    -

    Built-in spawn_subagent tool

    -

    Kit includes a built-in spawn_subagent tool that the LLM can use to delegate tasks to independent child agents:

    -
    spawn_subagent(
    +

    Built-in subagent tool

    +

    Kit includes a built-in subagent tool that the LLM can use to delegate tasks to independent child agents:

    +
    subagent(
         task: "Analyze the test files and summarize coverage",
         model: "anthropic/claude-haiku-latest",   // optional
         system_prompt: "You are a test analysis expert.",  // optional
    @@ -58,7 +58,7 @@ const s={frontmatter:{title:"Subagents",description:"Multi-agent orchestration w
         SystemPrompt: "You are a security auditor.",
     })

    Monitoring subagents from extensions

    -

    When the LLM (not the extension itself) spawns a subagent using the spawn_subagent tool, extensions can monitor its activity in real-time using three lifecycle event handlers:

    +

    When the LLM (not the extension itself) spawns a subagent using the subagent tool, extensions can monitor its activity in real-time using three lifecycle event handlers:

    // Track active subagents and display their output
     var subagentWidgets map[string]*SubagentWidget
     
    @@ -129,9 +129,9 @@ const s={frontmatter:{title:"Subagents",description:"Multi-agent orchestration w
         Timeout:      5 * time.Minute,
     })

    Real-time subagent events

    -

    Use SubscribeSubagent to receive real-time events from LLM-initiated subagents (i.e., when the model uses the spawn_subagent tool). Register inside an OnToolCall handler using the tool call ID:

    +

    Use SubscribeSubagent to receive real-time events from LLM-initiated subagents (i.e., when the model uses the subagent tool). Register inside an OnToolCall handler using the tool call ID:

    host.OnToolCall(func(e kit.ToolCallEvent) {
    -    if e.ToolName == "spawn_subagent" {
    +    if e.ToolName == "subagent" {
             host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {
                 switch ev := event.(type) {
                 case kit.MessageUpdateEvent:
    @@ -145,7 +145,7 @@ const s={frontmatter:{title:"Subagents",description:"Multi-agent orchestration w
         }
     })

    The listener receives the same event types as Subscribe() (ToolCallEvent, MessageUpdateEvent, ReasoningDeltaEvent, etc.) but scoped to the child agent's activity. Listeners are cleaned up automatically when the subagent completes.

    -

    If no listeners are registered for a tool call, no event dispatching overhead is incurred.

    `,headings:[{depth:2,text:"Subprocess pattern",id:"subprocess-pattern"},{depth:2,text:"Built-in spawn_subagent tool",id:"built-in-spawn_subagent-tool"},{depth:2,text:"Extension subagents",id:"extension-subagents"},{depth:3,text:"Monitoring subagents from extensions",id:"monitoring-subagents-from-extensions"},{depth:2,text:"Go SDK subagents",id:"go-sdk-subagents"},{depth:3,text:"Real-time subagent events",id:"real-time-subagent-events"}],raw:` +

    If no listeners are registered for a tool call, no event dispatching overhead is incurred.

    `,headings:[{depth:2,text:"Subprocess pattern",id:"subprocess-pattern"},{depth:2,text:"Built-in subagent tool",id:"built-in-subagent-tool"},{depth:2,text:"Extension subagents",id:"extension-subagents"},{depth:3,text:"Monitoring subagents from extensions",id:"monitoring-subagents-from-extensions"},{depth:2,text:"Go SDK subagents",id:"go-sdk-subagents"},{depth:3,text:"Real-time subagent events",id:"real-time-subagent-events"}],raw:` # Subagents Kit supports multi-agent orchestration through both subprocess spawning and in-process subagents. @@ -175,12 +175,12 @@ Key flags for subprocess usage: Positional arguments are the prompt. \`@file\` arguments attach file content as context. -## Built-in spawn_subagent tool +## Built-in subagent tool -Kit includes a built-in \`spawn_subagent\` tool that the LLM can use to delegate tasks to independent child agents: +Kit includes a built-in \`subagent\` tool that the LLM can use to delegate tasks to independent child agents: \`\`\` -spawn_subagent( +subagent( task: "Analyze the test files and summarize coverage", model: "anthropic/claude-haiku-latest", // optional system_prompt: "You are a test analysis expert.", // optional @@ -204,7 +204,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{ ### Monitoring subagents from extensions -When the LLM (not the extension itself) spawns a subagent using the \`spawn_subagent\` tool, extensions can monitor its activity in real-time using three lifecycle event handlers: +When the LLM (not the extension itself) spawns a subagent using the \`subagent\` tool, extensions can monitor its activity in real-time using three lifecycle event handlers: \`\`\`go // Track active subagents and display their output @@ -290,11 +290,11 @@ result, err := host.Subagent(ctx, kit.SubagentConfig{ ### Real-time subagent events -Use \`SubscribeSubagent\` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the \`spawn_subagent\` tool). Register inside an \`OnToolCall\` handler using the tool call ID: +Use \`SubscribeSubagent\` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the \`subagent\` tool). Register inside an \`OnToolCall\` handler using the tool call ID: \`\`\`go host.OnToolCall(func(e kit.ToolCallEvent) { - if e.ToolName == "spawn_subagent" { + if e.ToolName == "subagent" { host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) { switch ev := event.(type) { case kit.MessageUpdateEvent: diff --git a/cli/commands/index.html b/cli/commands/index.html index 8b32f66e..3ff83888 100644 --- a/cli/commands/index.html +++ b/cli/commands/index.html @@ -7,7 +7,7 @@ - + diff --git a/cli/flags/index.html b/cli/flags/index.html index cdffc5e3..4790013a 100644 --- a/cli/flags/index.html +++ b/cli/flags/index.html @@ -7,7 +7,7 @@ - + diff --git a/configuration/index.html b/configuration/index.html index 170f45b8..2e32ef8a 100644 --- a/configuration/index.html +++ b/configuration/index.html @@ -7,7 +7,7 @@ - + diff --git a/development/index.html b/development/index.html index fee77392..3d60cd3d 100644 --- a/development/index.html +++ b/development/index.html @@ -7,7 +7,7 @@ - + diff --git a/extensions/capabilities/index.html b/extensions/capabilities/index.html index 482beed9..e37a80d7 100644 --- a/extensions/capabilities/index.html +++ b/extensions/capabilities/index.html @@ -7,7 +7,7 @@ - + @@ -249,7 +249,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{ ### Monitoring subagents spawned by the main agent -When the LLM uses the built-in `spawn_subagent` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events: +When the LLM uses the built-in `subagent` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events: ```go // Subagent started diff --git a/extensions/examples/index.html b/extensions/examples/index.html index 0a16755d..69b0eae0 100644 --- a/extensions/examples/index.html +++ b/extensions/examples/index.html @@ -7,7 +7,7 @@ - + diff --git a/extensions/loading/index.html b/extensions/loading/index.html index e787719a..f27e04e9 100644 --- a/extensions/loading/index.html +++ b/extensions/loading/index.html @@ -7,7 +7,7 @@ - + diff --git a/extensions/overview/index.html b/extensions/overview/index.html index 803c9580..647a4e85 100644 --- a/extensions/overview/index.html +++ b/extensions/overview/index.html @@ -7,7 +7,7 @@ - + diff --git a/extensions/testing/index.html b/extensions/testing/index.html index f39aea3d..7e322f29 100644 --- a/extensions/testing/index.html +++ b/extensions/testing/index.html @@ -7,7 +7,7 @@ - + diff --git a/index.html b/index.html index 7d55b6a7..80052876 100644 --- a/index.html +++ b/index.html @@ -15,7 +15,7 @@ ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; } - + diff --git a/installation/index.html b/installation/index.html index 0a69f48f..fdefe7cf 100644 --- a/installation/index.html +++ b/installation/index.html @@ -7,7 +7,7 @@ - + diff --git a/llms-full.txt b/llms-full.txt index 131dde1b..bfdd6ec2 100644 --- a/llms-full.txt +++ b/llms-full.txt @@ -128,12 +128,12 @@ Key flags for subprocess usage: Positional arguments are the prompt. `@file` arguments attach file content as context. -## Built-in spawn_subagent tool +## Built-in subagent tool -Kit includes a built-in `spawn_subagent` tool that the LLM can use to delegate tasks to independent child agents: +Kit includes a built-in `subagent` tool that the LLM can use to delegate tasks to independent child agents: ``` -spawn_subagent( +subagent( task: "Analyze the test files and summarize coverage", model: "anthropic/claude-haiku-latest", // optional system_prompt: "You are a test analysis expert.", // optional @@ -157,7 +157,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{ ### Monitoring subagents from extensions -When the LLM (not the extension itself) spawns a subagent using the `spawn_subagent` tool, extensions can monitor its activity in real-time using three lifecycle event handlers: +When the LLM (not the extension itself) spawns a subagent using the `subagent` tool, extensions can monitor its activity in real-time using three lifecycle event handlers: ```go // Track active subagents and display their output @@ -243,11 +243,11 @@ result, err := host.Subagent(ctx, kit.SubagentConfig{ ### Real-time subagent events -Use `SubscribeSubagent` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the `spawn_subagent` tool). Register inside an `OnToolCall` handler using the tool call ID: +Use `SubscribeSubagent` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the `subagent` tool). Register inside an `OnToolCall` handler using the tool call ID: ```go host.OnToolCall(func(e kit.ToolCallEvent) { - if e.ToolName == "spawn_subagent" { + if e.ToolName == "subagent" { host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) { switch ev := event.(type) { case kit.MessageUpdateEvent: @@ -1058,7 +1058,7 @@ result := ctx.SpawnSubagent(ext.SubagentConfig{ ### Monitoring subagents spawned by the main agent -When the LLM uses the built-in `spawn_subagent` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events: +When the LLM uses the built-in `subagent` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events: ```go // Subagent started @@ -2023,7 +2023,7 @@ A powerful, extensible AI coding agent CLI with multi-provider support, built-in ## Features - **Multi-Provider LLM Support** — Anthropic, OpenAI, Google Gemini, Ollama, Azure OpenAI, AWS Bedrock, OpenRouter, and more -- **Built-in Core Tools** — bash, read, write, edit, grep, find, ls, spawn_subagent with no MCP overhead +- **Built-in Core Tools** — bash, read, write, edit, grep, find, ls, subagent with no MCP overhead - **MCP Integration** — Connect external MCP servers for expanded capabilities - **Extension System** — Write custom tools, commands, widgets, and UI modifications in Go - **Interactive TUI** — Rich terminal interface powered by Bubble Tea with streaming, syntax highlighting, and custom rendering @@ -2424,11 +2424,11 @@ The first argument is a priority (lower = runs first). ## Subagent event monitoring -Monitor real-time events from LLM-initiated subagents (when the model uses the `spawn_subagent` tool): +Monitor real-time events from LLM-initiated subagents (when the model uses the `subagent` tool): ```go host.OnToolCall(func(e kit.ToolCallEvent) { - if e.ToolName == "spawn_subagent" { + if e.ToolName == "subagent" { host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) { // Receives the same event types as Subscribe(), scoped to the child agent switch ev := event.(type) { diff --git a/mcp.json b/mcp.json index 8fab732c..cae58f41 100644 --- a/mcp.json +++ b/mcp.json @@ -25,14 +25,14 @@ "description": "Multi-agent orchestration with Kit subagents.", "headings": [ "Subprocess pattern", - "Built-in spawn_subagent tool", + "Built-in subagent tool", "Extension subagents", "Monitoring subagents from extensions", "Go SDK subagents", "Real-time subagent events" ], "tags": [], - "content": "\n# Subagents\n\nKit supports multi-agent orchestration through both subprocess spawning and in-process subagents.\n\n## Subprocess pattern\n\nSpawn Kit as a subprocess for isolated agent execution:\n\n```bash\nkit \"Analyze codebase\" \\\n --json \\\n --no-session \\\n --no-extensions \\\n --quiet \\\n --model anthropic/claude-haiku-latest\n```\n\nKey flags for subprocess usage:\n\n| Flag | Purpose |\n|------|---------|\n| `--quiet` | Stdout only, no TUI |\n| `--no-session` | Ephemeral, no persistence |\n| `--no-extensions` | Prevent recursive extension loading |\n| `--json` | Machine-readable output |\n| `--system-prompt` | Custom system prompt (string or file path) |\n\nPositional arguments are the prompt. `@file` arguments attach file content as context.\n\n## Built-in spawn_subagent tool\n\nKit includes a built-in `spawn_subagent` tool that the LLM can use to delegate tasks to independent child agents:\n\n```\nspawn_subagent(\n task: \"Analyze the test files and summarize coverage\",\n model: \"anthropic/claude-haiku-latest\", // optional\n system_prompt: \"You are a test analysis expert.\", // optional\n timeout_seconds: 300 // optional, max 1800\n)\n```\n\nSubagents run as separate in-process Kit instances with full tool access (except spawning further subagents, to prevent infinite recursion). They can run in parallel.\n\n## Extension subagents\n\nExtensions can spawn subagents programmatically:\n\n```go\nresult := ctx.SpawnSubagent(ext.SubagentConfig{\n Task: \"Review this code for security issues\",\n Model: \"anthropic/claude-sonnet-latest\",\n SystemPrompt: \"You are a security auditor.\",\n})\n```\n\n### Monitoring subagents from extensions\n\nWhen the LLM (not the extension itself) spawns a subagent using the `spawn_subagent` tool, extensions can monitor its activity in real-time using three lifecycle event handlers:\n\n```go\n// Track active subagents and display their output\nvar subagentWidgets map[string]*SubagentWidget\n\nfunc Init(api ext.API) {\n // Subagent started by the main agent\n api.OnSubagentStart(func(e ext.SubagentStartEvent, ctx ext.Context) {\n // e.ToolCallID — unique ID for this subagent invocation\n // e.Task — the task/prompt sent to the subagent\n widget := NewWidget(e.ToolCallID, e.Task)\n subagentWidgets[e.ToolCallID] = widget\n ctx.SetWidget(widget.Config())\n })\n\n // Real-time streaming from subagent\n api.OnSubagentChunk(func(e ext.SubagentChunkEvent, ctx ext.Context) {\n // e.ToolCallID — matches the start event\n // e.ChunkType — \"text\", \"tool_call\", \"tool_execution_start\", \"tool_result\"\n // e.Content — text content\n // e.ToolName — tool name (for tool chunks)\n // e.IsError — true if tool result failed\n widget := subagentWidgets[e.ToolCallID]\n if widget != nil {\n widget.AddOutput(e)\n ctx.SetWidget(widget.Config())\n }\n })\n\n // Subagent completed\n api.OnSubagentEnd(func(e ext.SubagentEndEvent, ctx ext.Context) {\n // e.Response — final response from subagent\n // e.ErrorMsg — error message if subagent failed\n widget := subagentWidgets[e.ToolCallID]\n if widget != nil {\n widget.MarkComplete(e.Response, e.ErrorMsg)\n ctx.SetWidget(widget.Config())\n delete(subagentWidgets, e.ToolCallID)\n }\n })\n}\n```\n\n**Event structs:**\n\n```go\ntype SubagentStartEvent struct {\n ToolCallID string // Unique ID for this subagent invocation\n Task string // The task/prompt sent to subagent\n}\n\ntype SubagentChunkEvent struct {\n ToolCallID string // Matches SubagentStartEvent.ToolCallID\n Task string // Task description\n ChunkType string // \"text\", \"tool_call\", \"tool_execution_start\", \"tool_result\"\n Content string // For text chunks\n ToolName string // For tool-related chunks\n IsError bool // For tool_result chunks\n}\n\ntype SubagentEndEvent struct {\n ToolCallID string // Matches start event\n Task string // Task description\n Response string // Final response from subagent\n ErrorMsg string // Error message if failed\n}\n```\n\nThis enables building monitoring widgets that display real-time activity from all subagents spawned by the main agent.\n\n## Go SDK subagents\n\nThe SDK provides in-process subagent spawning:\n\n```go\nresult, err := host.Subagent(ctx, kit.SubagentConfig{\n Task: \"Summarize the changes in this PR\",\n Model: \"anthropic/claude-haiku-latest\",\n SystemPrompt: \"You are a code reviewer.\",\n Timeout: 5 * time.Minute,\n})\n```\n\n### Real-time subagent events\n\nUse `SubscribeSubagent` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the `spawn_subagent` tool). Register inside an `OnToolCall` handler using the tool call ID:\n\n```go\nhost.OnToolCall(func(e kit.ToolCallEvent) {\n if e.ToolName == \"spawn_subagent\" {\n host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {\n switch ev := event.(type) {\n case kit.MessageUpdateEvent:\n fmt.Print(ev.Chunk) // streaming text from child\n case kit.ToolCallEvent:\n fmt.Printf(\"Child calling: %s\\n\", ev.ToolName)\n case kit.ToolResultEvent:\n fmt.Printf(\"Child result: %s\\n\", ev.ToolName)\n }\n })\n }\n})\n```\n\nThe listener receives the same event types as `Subscribe()` (`ToolCallEvent`, `MessageUpdateEvent`, `ReasoningDeltaEvent`, etc.) but scoped to the child agent's activity. Listeners are cleaned up automatically when the subagent completes.\n\nIf no listeners are registered for a tool call, no event dispatching overhead is incurred.\n" + "content": "\n# Subagents\n\nKit supports multi-agent orchestration through both subprocess spawning and in-process subagents.\n\n## Subprocess pattern\n\nSpawn Kit as a subprocess for isolated agent execution:\n\n```bash\nkit \"Analyze codebase\" \\\n --json \\\n --no-session \\\n --no-extensions \\\n --quiet \\\n --model anthropic/claude-haiku-latest\n```\n\nKey flags for subprocess usage:\n\n| Flag | Purpose |\n|------|---------|\n| `--quiet` | Stdout only, no TUI |\n| `--no-session` | Ephemeral, no persistence |\n| `--no-extensions` | Prevent recursive extension loading |\n| `--json` | Machine-readable output |\n| `--system-prompt` | Custom system prompt (string or file path) |\n\nPositional arguments are the prompt. `@file` arguments attach file content as context.\n\n## Built-in subagent tool\n\nKit includes a built-in `subagent` tool that the LLM can use to delegate tasks to independent child agents:\n\n```\nsubagent(\n task: \"Analyze the test files and summarize coverage\",\n model: \"anthropic/claude-haiku-latest\", // optional\n system_prompt: \"You are a test analysis expert.\", // optional\n timeout_seconds: 300 // optional, max 1800\n)\n```\n\nSubagents run as separate in-process Kit instances with full tool access (except spawning further subagents, to prevent infinite recursion). They can run in parallel.\n\n## Extension subagents\n\nExtensions can spawn subagents programmatically:\n\n```go\nresult := ctx.SpawnSubagent(ext.SubagentConfig{\n Task: \"Review this code for security issues\",\n Model: \"anthropic/claude-sonnet-latest\",\n SystemPrompt: \"You are a security auditor.\",\n})\n```\n\n### Monitoring subagents from extensions\n\nWhen the LLM (not the extension itself) spawns a subagent using the `subagent` tool, extensions can monitor its activity in real-time using three lifecycle event handlers:\n\n```go\n// Track active subagents and display their output\nvar subagentWidgets map[string]*SubagentWidget\n\nfunc Init(api ext.API) {\n // Subagent started by the main agent\n api.OnSubagentStart(func(e ext.SubagentStartEvent, ctx ext.Context) {\n // e.ToolCallID — unique ID for this subagent invocation\n // e.Task — the task/prompt sent to the subagent\n widget := NewWidget(e.ToolCallID, e.Task)\n subagentWidgets[e.ToolCallID] = widget\n ctx.SetWidget(widget.Config())\n })\n\n // Real-time streaming from subagent\n api.OnSubagentChunk(func(e ext.SubagentChunkEvent, ctx ext.Context) {\n // e.ToolCallID — matches the start event\n // e.ChunkType — \"text\", \"tool_call\", \"tool_execution_start\", \"tool_result\"\n // e.Content — text content\n // e.ToolName — tool name (for tool chunks)\n // e.IsError — true if tool result failed\n widget := subagentWidgets[e.ToolCallID]\n if widget != nil {\n widget.AddOutput(e)\n ctx.SetWidget(widget.Config())\n }\n })\n\n // Subagent completed\n api.OnSubagentEnd(func(e ext.SubagentEndEvent, ctx ext.Context) {\n // e.Response — final response from subagent\n // e.ErrorMsg — error message if subagent failed\n widget := subagentWidgets[e.ToolCallID]\n if widget != nil {\n widget.MarkComplete(e.Response, e.ErrorMsg)\n ctx.SetWidget(widget.Config())\n delete(subagentWidgets, e.ToolCallID)\n }\n })\n}\n```\n\n**Event structs:**\n\n```go\ntype SubagentStartEvent struct {\n ToolCallID string // Unique ID for this subagent invocation\n Task string // The task/prompt sent to subagent\n}\n\ntype SubagentChunkEvent struct {\n ToolCallID string // Matches SubagentStartEvent.ToolCallID\n Task string // Task description\n ChunkType string // \"text\", \"tool_call\", \"tool_execution_start\", \"tool_result\"\n Content string // For text chunks\n ToolName string // For tool-related chunks\n IsError bool // For tool_result chunks\n}\n\ntype SubagentEndEvent struct {\n ToolCallID string // Matches start event\n Task string // Task description\n Response string // Final response from subagent\n ErrorMsg string // Error message if failed\n}\n```\n\nThis enables building monitoring widgets that display real-time activity from all subagents spawned by the main agent.\n\n## Go SDK subagents\n\nThe SDK provides in-process subagent spawning:\n\n```go\nresult, err := host.Subagent(ctx, kit.SubagentConfig{\n Task: \"Summarize the changes in this PR\",\n Model: \"anthropic/claude-haiku-latest\",\n SystemPrompt: \"You are a code reviewer.\",\n Timeout: 5 * time.Minute,\n})\n```\n\n### Real-time subagent events\n\nUse `SubscribeSubagent` to receive real-time events from LLM-initiated subagents (i.e., when the model uses the `subagent` tool). Register inside an `OnToolCall` handler using the tool call ID:\n\n```go\nhost.OnToolCall(func(e kit.ToolCallEvent) {\n if e.ToolName == \"subagent\" {\n host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {\n switch ev := event.(type) {\n case kit.MessageUpdateEvent:\n fmt.Print(ev.Chunk) // streaming text from child\n case kit.ToolCallEvent:\n fmt.Printf(\"Child calling: %s\\n\", ev.ToolName)\n case kit.ToolResultEvent:\n fmt.Printf(\"Child result: %s\\n\", ev.ToolName)\n }\n })\n }\n})\n```\n\nThe listener receives the same event types as `Subscribe()` (`ToolCallEvent`, `MessageUpdateEvent`, `ReasoningDeltaEvent`, etc.) but scoped to the child agent's activity. Listeners are cleaned up automatically when the subagent completes.\n\nIf no listeners are registered for a tool call, no event dispatching overhead is incurred.\n" }, { "url": "/advanced/testing", @@ -153,7 +153,7 @@ "Model Resolution" ], "tags": [], - "content": "\n# Extension Capabilities\n\n## Lifecycle events\n\nExtensions can hook into 23 lifecycle events:\n\n| Event | Description |\n|-------|-------------|\n| `OnSessionStart` | Session initialized |\n| `OnSessionShutdown` | Session ending |\n| `OnBeforeAgentStart` | Before the agent loop begins |\n| `OnAgentStart` | Agent loop started |\n| `OnAgentEnd` | Agent loop completed |\n| `OnToolCall` | Tool call requested by the model |\n| `OnToolExecutionStart` | Tool execution beginning |\n| `OnToolOutput` | Streaming tool output chunk (for long-running tools) |\n| `OnToolExecutionEnd` | Tool execution completed |\n| `OnToolResult` | Tool result returned |\n| `OnInput` | User input received |\n| `OnMessageStart` | Assistant message started |\n| `OnMessageUpdate` | Streaming text chunk received |\n| `OnMessageEnd` | Assistant message completed |\n| `OnModelChange` | Model switched |\n| `OnContextPrepare` | Context being assembled for the model |\n| `OnBeforeFork` | Before forking a conversation branch |\n| `OnBeforeSessionSwitch` | Before switching sessions |\n| `OnBeforeCompact` | Before conversation compaction |\n| `OnCustomEvent` | Custom inter-extension event received |\n| `OnSubagentStart` | Subagent spawned by the main agent |\n| `OnSubagentChunk` | Real-time output from subagent (text, tool calls, results) |\n| `OnSubagentEnd` | Subagent completed with final response/error |\n\n### Example\n\n```go\napi.OnToolCall(func(event ext.ToolCallEvent, ctx ext.Context) {\n ctx.PrintInfo(\"Calling tool: \" + event.Name)\n})\n\napi.OnAgentEnd(func(_ ext.AgentEndEvent, ctx ext.Context) {\n ctx.PrintInfo(\"Agent finished\")\n})\n```\n\n## Tools\n\nRegister custom tools that the LLM can invoke:\n\n```go\napi.RegisterTool(ext.ToolDef{\n Name: \"weather\",\n Description: \"Get current weather for a location\",\n Parameters: map[string]ext.ParameterDef{\n \"city\": {Type: \"string\", Description: \"City name\", Required: true},\n },\n Handler: func(ctx ext.Context, params map[string]any) (string, error) {\n city := params[\"city\"].(string)\n return \"Sunny, 72°F in \" + city, nil\n },\n})\n```\n\n## Commands\n\nRegister slash commands that users can invoke directly:\n\n```go\napi.RegisterCommand(ext.CommandDef{\n Name: \"stats\",\n Description: \"Show context statistics\",\n Handler: func(ctx ext.Context, args string) {\n stats := ctx.GetContextStats()\n ctx.PrintInfo(fmt.Sprintf(\"Tokens: %d\", stats.TotalTokens))\n },\n})\n```\n\n## Widgets\n\nAdd persistent status displays above or below the input area:\n\n```go\nctx.SetWidget(ext.WidgetConfig{\n ID: \"token-count\",\n Position: \"bottom\",\n Content: ext.WidgetContent{Text: \"Tokens: 1,234\"},\n})\n\n// Update later\nctx.SetWidget(ext.WidgetConfig{\n ID: \"token-count\",\n Position: \"bottom\",\n Content: ext.WidgetContent{Text: \"Tokens: 2,456\"},\n})\n\n// Remove\nctx.RemoveWidget(\"token-count\")\n```\n\n## Headers and footers\n\nPersistent content above and below the conversation:\n\n```go\nctx.SetHeader(ext.HeaderFooterConfig{\n Content: ext.WidgetContent{Text: \"Project: my-app | Branch: main\"},\n})\n\nctx.SetFooter(ext.HeaderFooterConfig{\n Content: ext.WidgetContent{Text: \"Plan Mode (read-only)\"},\n})\n```\n\n## Status bar\n\nCustom status bar entries:\n\n```go\nctx.SetStatus(\"mode\", \"Planning\")\nctx.RemoveStatus(\"mode\")\n```\n\n## Shortcuts\n\nGlobal keyboard shortcuts:\n\n```go\napi.RegisterShortcut(ext.ShortcutDef{\n Key: \"ctrl+t\",\n Description: \"Toggle plan mode\",\n}, func(ctx ext.Context) {\n // handle shortcut\n})\n```\n\n## Overlays\n\nModal dialogs with markdown content:\n\n```go\nctx.ShowOverlay(ext.OverlayConfig{\n Title: \"Help\",\n Content: \"# Keyboard Shortcuts\\n\\n- **ctrl+t** — Toggle plan mode\\n- **ctrl+s** — Save session\",\n})\n```\n\n## Tool renderers\n\nCustomize how specific tool calls are displayed in the TUI:\n\n```go\napi.RegisterToolRenderer(ext.ToolRenderConfig{\n ToolName: \"bash\",\n Render: func(name, args, result string, isError bool) string {\n return \"$ \" + args + \"\\n\" + result\n },\n})\n```\n\n## Message renderers\n\nCustom rendering for assistant messages:\n\n```go\napi.RegisterMessageRenderer(ext.MessageRendererConfig{\n Name: \"custom\",\n Render: func(content string) string {\n return \">> \" + content\n },\n})\n```\n\n## Editor interceptors\n\nHandle key events and wrap the editor's rendering:\n\n```go\nctx.SetEditor(ext.EditorConfig{\n HandleKey: func(key, text string) ext.EditorKeyAction {\n if key == \"escape\" {\n return ext.EditorKeyAction{Handled: true}\n }\n return ext.EditorKeyAction{Handled: false}\n },\n})\n```\n\n## Interactive prompts\n\nSelect, confirm, input, and multi-select dialogs:\n\n```go\n// Single select\nresponse := ctx.PromptSelect(ext.PromptSelectConfig{\n Title: \"Choose a model\",\n Options: []string{\"claude-sonnet\", \"gpt-4o\", \"llama3\"},\n})\n\n// Confirm\nconfirmed := ctx.PromptConfirm(ext.PromptConfirmConfig{\n Title: \"Delete this file?\",\n})\n\n// Text input\nname := ctx.PromptInput(ext.PromptInputConfig{\n Title: \"Enter project name\",\n Placeholder: \"my-project\",\n})\n```\n\n## Options\n\nRegister configurable extension options:\n\n```go\napi.RegisterOption(ext.OptionDef{\n Name: \"auto-commit\",\n Description: \"Automatically commit on shutdown\",\n DefaultValue: \"false\",\n})\n```\n\n## Subagents\n\nSpawn in-process child Kit instances:\n\n```go\nresult := ctx.SpawnSubagent(ext.SubagentConfig{\n Task: \"Analyze the test files and summarize coverage\",\n Model: \"anthropic/claude-haiku-latest\",\n SystemPrompt: \"You are a test analysis expert.\",\n})\n```\n\n### Monitoring subagents spawned by the main agent\n\nWhen the LLM uses the built-in `spawn_subagent` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:\n\n```go\n// Subagent started\napi.OnSubagentStart(func(e ext.SubagentStartEvent, ctx ext.Context) {\n // e.ToolCallID — unique ID for this subagent invocation\n // e.Task — the task/prompt sent to the subagent\n ctx.PrintInfo(fmt.Sprintf(\"Subagent started: %s\", e.Task))\n})\n\n// Real-time streaming output from subagent\napi.OnSubagentChunk(func(e ext.SubagentChunkEvent, ctx ext.Context) {\n // e.ToolCallID — matches the start event\n // e.Task — task description\n // e.ChunkType — \"text\", \"tool_call\", \"tool_execution_start\", \"tool_result\"\n // e.Content — text content (for text chunks)\n // e.ToolName — tool name (for tool-related chunks)\n // e.IsError — true if tool result is an error\n switch e.ChunkType {\n case \"text\":\n // Streaming text output\n case \"tool_call\":\n // Subagent is calling a tool\n case \"tool_execution_start\":\n // Tool execution started\n case \"tool_result\":\n // Tool execution completed (check e.IsError)\n }\n})\n\n// Subagent completed\napi.OnSubagentEnd(func(e ext.SubagentEndEvent, ctx ext.Context) {\n // e.ToolCallID — matches start event\n // e.Task — task description\n // e.Response — final response from subagent\n // e.ErrorMsg — error message if subagent failed\n if e.ErrorMsg != \"\" {\n ctx.PrintError(fmt.Sprintf(\"Subagent failed: %s\", e.ErrorMsg))\n } else {\n ctx.PrintInfo(fmt.Sprintf(\"Subagent completed: %s\", e.Response))\n }\n})\n```\n\nThis enables building widgets that display real-time subagent activity.\n\n## LLM completion\n\nMake direct model calls without going through the agent loop:\n\n```go\nresponse := ctx.Complete(ext.CompleteRequest{\n Prompt: \"Summarize this in one sentence: \" + content,\n})\n```\n\n## Themes\n\nRegister and switch color themes at runtime:\n\n```go\n// Register a custom theme\nctx.RegisterTheme(\"neon\", ext.ThemeColorConfig{\n Primary: ext.ThemeColor{Light: \"#CC00FF\", Dark: \"#FF00FF\"},\n Secondary: ext.ThemeColor{Light: \"#0088CC\", Dark: \"#00FFFF\"},\n Success: ext.ThemeColor{Light: \"#00CC44\", Dark: \"#00FF66\"},\n Warning: ext.ThemeColor{Light: \"#CCAA00\", Dark: \"#FFFF00\"},\n Error: ext.ThemeColor{Light: \"#CC0033\", Dark: \"#FF0055\"},\n Info: ext.ThemeColor{Light: \"#0088CC\", Dark: \"#00CCFF\"},\n Text: ext.ThemeColor{Light: \"#111111\", Dark: \"#F0F0F0\"},\n Background: ext.ThemeColor{Light: \"#F0F0F0\", Dark: \"#0A0A14\"},\n})\n\n// Switch to it\nctx.SetTheme(\"neon\")\n\n// List all available themes\nnames := ctx.ListThemes()\n```\n\nSee [Themes](/themes) for the full theme file format, built-in themes, and color reference.\n\n## Custom events\n\nInter-extension communication:\n\n```go\n// Emit\nctx.EmitCustomEvent(\"my-extension:data-ready\", payload)\n\n// Listen\napi.OnCustomEvent(\"my-extension:data-ready\", func(data any, ctx ext.Context) {\n // handle event\n})\n```\n\n## Bridged SDK APIs\n\nExtensions can access powerful internal SDK capabilities that enable advanced features like conversation tree navigation, dynamic skill loading, template parsing, and model resolution.\n\n### Tree Navigation\n\nNavigate the conversation tree, summarize branches, and implement \"fresh context\" loops:\n\n```go\n// Get a specific node by ID with full metadata and children\nnode := ctx.GetTreeNode(\"entry-id\")\n// node.ID, node.ParentID, node.Type (\"message\"/\"branch_summary\"/etc)\n// node.Role, node.Content, node.Model, node.Children ([]string)\n\n// Get the current branch from root to leaf\nbranch := ctx.GetCurrentBranch() // []ext.TreeNode\n\n// Get child entry IDs of a node\nchildren := ctx.GetChildren(\"entry-id\") // []string\n\n// Navigate/fork to a different entry in the tree\nresult := ctx.NavigateTo(\"entry-id\") // ext.TreeNavigationResult{Success, Error}\n\n// Summarize a range of the branch using LLM\nsummary := ctx.SummarizeBranch(\"from-id\", \"to-id\") // string\n\n// Collapse a branch range into a summary entry (fresh context primitive)\nresult := ctx.CollapseBranch(\"from-id\", \"to-id\", \"summary text\")\n```\n\n### Skill Loading\n\nLoad and inject skills dynamically at runtime:\n\n```go\n// Discover skills from standard locations\nresult := ctx.DiscoverSkills() // ext.SkillLoadResult{Skills, Error}\n// Standard locations: ~/.config/kit/skills/, .kit/skills/, .agents/skills/\n\n// Load a specific skill file\nskill, err := ctx.LoadSkill(\"/path/to/skill.md\") // (*ext.Skill, error string)\n// skill.Name, skill.Description, skill.Content, skill.Tags, skill.When\n\n// Load all skills from a directory\nresult := ctx.LoadSkillsFromDir(\"/path/to/skills\") // ext.SkillLoadResult\n\n// Inject a skill as context (pre-loads for next turn)\nerr := ctx.InjectSkillAsContext(\"skill-name\") // error string\n\n// Inject a skill file directly\nerr := ctx.InjectRawSkillAsContext(\"/path/to/skill.md\") // error string\n\n// Get all discovered skills\nskills := ctx.GetAvailableSkills() // []ext.Skill\n```\n\n### Template Parsing\n\nParse and render templates with variable substitution:\n\n```go\n// Parse a template to extract {{variables}}\ntpl := ctx.ParseTemplate(\"name\", \"Hello {{name}}, welcome to {{place}}!\")\n// tpl.Name, tpl.Content, tpl.Variables ([]string)\n\n// Render a template with variable values\nvars := map[string]string{\"name\": \"Alice\", \"place\": \"Kit\"}\nrendered := ctx.RenderTemplate(tpl, vars) // \"Hello Alice, welcome to Kit!\"\n\n// Parse command-line style arguments\npattern := ext.ArgumentPattern{\n Positional: []string{\"command\", \"target\"}, // $1, $2\n Rest: \"args\", // $@\n Flags: map[string]string{\"--loop\": \"loop\", \"-f\": \"force\"},\n}\nresult := ctx.ParseArguments(\"deploy staging --loop 5\", pattern)\n// result.Vars[\"command\"] = \"deploy\"\n// result.Vars[\"target\"] = \"staging\"\n// result.Flags[\"--loop\"] = \"5\"\n\n// Simple positional argument parsing ($1, $2, $@)\nargs := ctx.SimpleParseArguments(\"deploy staging --force\", 2)\n// args[0] = \"deploy staging --force\" (full input)\n// args[1] = \"deploy\" ($1)\n// args[2] = \"staging\" ($2)\n// args[3] = \"--force\" ($@)\n\n// Evaluate model conditionals with wildcards\nmatches := ctx.EvaluateModelConditional(\"claude-*\") // bool\n// Patterns: * matches any, ? matches single char, comma = OR\n\n// Render content with conditionals\ncontent := `Hi ClaudeHi there`\nrendered := ctx.RenderWithModelConditionals(content) // based on current model\n```\n\n### Model Resolution\n\nResolve model fallback chains and query capabilities:\n\n```go\n// Resolve a chain of model preferences (tries each until available)\nresult := ctx.ResolveModelChain([]string{\n \"anthropic/claude-opus-4\",\n \"anthropic/claude-sonnet-4\",\n \"openai/gpt-4o\",\n})\n// result.Model (selected), result.Capabilities, result.Attempted, result.Error\n\n// Get capabilities for a specific model\ncaps, err := ctx.GetModelCapabilities(\"anthropic/claude-sonnet-4\")\n// caps.Provider, caps.ModelID, caps.ContextLimit, caps.Reasoning, caps.Streaming\n\n// Check if a model is available (provider exists)\navailable := ctx.CheckModelAvailable(\"anthropic/claude-sonnet-4\") // bool\n\n// Get current provider/model ID\nprovider := ctx.GetCurrentProvider() // \"anthropic\"\nmodelID := ctx.GetCurrentModelID() // \"claude-sonnet-4\"\n```\n" + "content": "\n# Extension Capabilities\n\n## Lifecycle events\n\nExtensions can hook into 23 lifecycle events:\n\n| Event | Description |\n|-------|-------------|\n| `OnSessionStart` | Session initialized |\n| `OnSessionShutdown` | Session ending |\n| `OnBeforeAgentStart` | Before the agent loop begins |\n| `OnAgentStart` | Agent loop started |\n| `OnAgentEnd` | Agent loop completed |\n| `OnToolCall` | Tool call requested by the model |\n| `OnToolExecutionStart` | Tool execution beginning |\n| `OnToolOutput` | Streaming tool output chunk (for long-running tools) |\n| `OnToolExecutionEnd` | Tool execution completed |\n| `OnToolResult` | Tool result returned |\n| `OnInput` | User input received |\n| `OnMessageStart` | Assistant message started |\n| `OnMessageUpdate` | Streaming text chunk received |\n| `OnMessageEnd` | Assistant message completed |\n| `OnModelChange` | Model switched |\n| `OnContextPrepare` | Context being assembled for the model |\n| `OnBeforeFork` | Before forking a conversation branch |\n| `OnBeforeSessionSwitch` | Before switching sessions |\n| `OnBeforeCompact` | Before conversation compaction |\n| `OnCustomEvent` | Custom inter-extension event received |\n| `OnSubagentStart` | Subagent spawned by the main agent |\n| `OnSubagentChunk` | Real-time output from subagent (text, tool calls, results) |\n| `OnSubagentEnd` | Subagent completed with final response/error |\n\n### Example\n\n```go\napi.OnToolCall(func(event ext.ToolCallEvent, ctx ext.Context) {\n ctx.PrintInfo(\"Calling tool: \" + event.Name)\n})\n\napi.OnAgentEnd(func(_ ext.AgentEndEvent, ctx ext.Context) {\n ctx.PrintInfo(\"Agent finished\")\n})\n```\n\n## Tools\n\nRegister custom tools that the LLM can invoke:\n\n```go\napi.RegisterTool(ext.ToolDef{\n Name: \"weather\",\n Description: \"Get current weather for a location\",\n Parameters: map[string]ext.ParameterDef{\n \"city\": {Type: \"string\", Description: \"City name\", Required: true},\n },\n Handler: func(ctx ext.Context, params map[string]any) (string, error) {\n city := params[\"city\"].(string)\n return \"Sunny, 72°F in \" + city, nil\n },\n})\n```\n\n## Commands\n\nRegister slash commands that users can invoke directly:\n\n```go\napi.RegisterCommand(ext.CommandDef{\n Name: \"stats\",\n Description: \"Show context statistics\",\n Handler: func(ctx ext.Context, args string) {\n stats := ctx.GetContextStats()\n ctx.PrintInfo(fmt.Sprintf(\"Tokens: %d\", stats.TotalTokens))\n },\n})\n```\n\n## Widgets\n\nAdd persistent status displays above or below the input area:\n\n```go\nctx.SetWidget(ext.WidgetConfig{\n ID: \"token-count\",\n Position: \"bottom\",\n Content: ext.WidgetContent{Text: \"Tokens: 1,234\"},\n})\n\n// Update later\nctx.SetWidget(ext.WidgetConfig{\n ID: \"token-count\",\n Position: \"bottom\",\n Content: ext.WidgetContent{Text: \"Tokens: 2,456\"},\n})\n\n// Remove\nctx.RemoveWidget(\"token-count\")\n```\n\n## Headers and footers\n\nPersistent content above and below the conversation:\n\n```go\nctx.SetHeader(ext.HeaderFooterConfig{\n Content: ext.WidgetContent{Text: \"Project: my-app | Branch: main\"},\n})\n\nctx.SetFooter(ext.HeaderFooterConfig{\n Content: ext.WidgetContent{Text: \"Plan Mode (read-only)\"},\n})\n```\n\n## Status bar\n\nCustom status bar entries:\n\n```go\nctx.SetStatus(\"mode\", \"Planning\")\nctx.RemoveStatus(\"mode\")\n```\n\n## Shortcuts\n\nGlobal keyboard shortcuts:\n\n```go\napi.RegisterShortcut(ext.ShortcutDef{\n Key: \"ctrl+t\",\n Description: \"Toggle plan mode\",\n}, func(ctx ext.Context) {\n // handle shortcut\n})\n```\n\n## Overlays\n\nModal dialogs with markdown content:\n\n```go\nctx.ShowOverlay(ext.OverlayConfig{\n Title: \"Help\",\n Content: \"# Keyboard Shortcuts\\n\\n- **ctrl+t** — Toggle plan mode\\n- **ctrl+s** — Save session\",\n})\n```\n\n## Tool renderers\n\nCustomize how specific tool calls are displayed in the TUI:\n\n```go\napi.RegisterToolRenderer(ext.ToolRenderConfig{\n ToolName: \"bash\",\n Render: func(name, args, result string, isError bool) string {\n return \"$ \" + args + \"\\n\" + result\n },\n})\n```\n\n## Message renderers\n\nCustom rendering for assistant messages:\n\n```go\napi.RegisterMessageRenderer(ext.MessageRendererConfig{\n Name: \"custom\",\n Render: func(content string) string {\n return \">> \" + content\n },\n})\n```\n\n## Editor interceptors\n\nHandle key events and wrap the editor's rendering:\n\n```go\nctx.SetEditor(ext.EditorConfig{\n HandleKey: func(key, text string) ext.EditorKeyAction {\n if key == \"escape\" {\n return ext.EditorKeyAction{Handled: true}\n }\n return ext.EditorKeyAction{Handled: false}\n },\n})\n```\n\n## Interactive prompts\n\nSelect, confirm, input, and multi-select dialogs:\n\n```go\n// Single select\nresponse := ctx.PromptSelect(ext.PromptSelectConfig{\n Title: \"Choose a model\",\n Options: []string{\"claude-sonnet\", \"gpt-4o\", \"llama3\"},\n})\n\n// Confirm\nconfirmed := ctx.PromptConfirm(ext.PromptConfirmConfig{\n Title: \"Delete this file?\",\n})\n\n// Text input\nname := ctx.PromptInput(ext.PromptInputConfig{\n Title: \"Enter project name\",\n Placeholder: \"my-project\",\n})\n```\n\n## Options\n\nRegister configurable extension options:\n\n```go\napi.RegisterOption(ext.OptionDef{\n Name: \"auto-commit\",\n Description: \"Automatically commit on shutdown\",\n DefaultValue: \"false\",\n})\n```\n\n## Subagents\n\nSpawn in-process child Kit instances:\n\n```go\nresult := ctx.SpawnSubagent(ext.SubagentConfig{\n Task: \"Analyze the test files and summarize coverage\",\n Model: \"anthropic/claude-haiku-latest\",\n SystemPrompt: \"You are a test analysis expert.\",\n})\n```\n\n### Monitoring subagents spawned by the main agent\n\nWhen the LLM uses the built-in `subagent` tool, extensions can monitor the subagent's activity in real-time using three lifecycle events:\n\n```go\n// Subagent started\napi.OnSubagentStart(func(e ext.SubagentStartEvent, ctx ext.Context) {\n // e.ToolCallID — unique ID for this subagent invocation\n // e.Task — the task/prompt sent to the subagent\n ctx.PrintInfo(fmt.Sprintf(\"Subagent started: %s\", e.Task))\n})\n\n// Real-time streaming output from subagent\napi.OnSubagentChunk(func(e ext.SubagentChunkEvent, ctx ext.Context) {\n // e.ToolCallID — matches the start event\n // e.Task — task description\n // e.ChunkType — \"text\", \"tool_call\", \"tool_execution_start\", \"tool_result\"\n // e.Content — text content (for text chunks)\n // e.ToolName — tool name (for tool-related chunks)\n // e.IsError — true if tool result is an error\n switch e.ChunkType {\n case \"text\":\n // Streaming text output\n case \"tool_call\":\n // Subagent is calling a tool\n case \"tool_execution_start\":\n // Tool execution started\n case \"tool_result\":\n // Tool execution completed (check e.IsError)\n }\n})\n\n// Subagent completed\napi.OnSubagentEnd(func(e ext.SubagentEndEvent, ctx ext.Context) {\n // e.ToolCallID — matches start event\n // e.Task — task description\n // e.Response — final response from subagent\n // e.ErrorMsg — error message if subagent failed\n if e.ErrorMsg != \"\" {\n ctx.PrintError(fmt.Sprintf(\"Subagent failed: %s\", e.ErrorMsg))\n } else {\n ctx.PrintInfo(fmt.Sprintf(\"Subagent completed: %s\", e.Response))\n }\n})\n```\n\nThis enables building widgets that display real-time subagent activity.\n\n## LLM completion\n\nMake direct model calls without going through the agent loop:\n\n```go\nresponse := ctx.Complete(ext.CompleteRequest{\n Prompt: \"Summarize this in one sentence: \" + content,\n})\n```\n\n## Themes\n\nRegister and switch color themes at runtime:\n\n```go\n// Register a custom theme\nctx.RegisterTheme(\"neon\", ext.ThemeColorConfig{\n Primary: ext.ThemeColor{Light: \"#CC00FF\", Dark: \"#FF00FF\"},\n Secondary: ext.ThemeColor{Light: \"#0088CC\", Dark: \"#00FFFF\"},\n Success: ext.ThemeColor{Light: \"#00CC44\", Dark: \"#00FF66\"},\n Warning: ext.ThemeColor{Light: \"#CCAA00\", Dark: \"#FFFF00\"},\n Error: ext.ThemeColor{Light: \"#CC0033\", Dark: \"#FF0055\"},\n Info: ext.ThemeColor{Light: \"#0088CC\", Dark: \"#00CCFF\"},\n Text: ext.ThemeColor{Light: \"#111111\", Dark: \"#F0F0F0\"},\n Background: ext.ThemeColor{Light: \"#F0F0F0\", Dark: \"#0A0A14\"},\n})\n\n// Switch to it\nctx.SetTheme(\"neon\")\n\n// List all available themes\nnames := ctx.ListThemes()\n```\n\nSee [Themes](/themes) for the full theme file format, built-in themes, and color reference.\n\n## Custom events\n\nInter-extension communication:\n\n```go\n// Emit\nctx.EmitCustomEvent(\"my-extension:data-ready\", payload)\n\n// Listen\napi.OnCustomEvent(\"my-extension:data-ready\", func(data any, ctx ext.Context) {\n // handle event\n})\n```\n\n## Bridged SDK APIs\n\nExtensions can access powerful internal SDK capabilities that enable advanced features like conversation tree navigation, dynamic skill loading, template parsing, and model resolution.\n\n### Tree Navigation\n\nNavigate the conversation tree, summarize branches, and implement \"fresh context\" loops:\n\n```go\n// Get a specific node by ID with full metadata and children\nnode := ctx.GetTreeNode(\"entry-id\")\n// node.ID, node.ParentID, node.Type (\"message\"/\"branch_summary\"/etc)\n// node.Role, node.Content, node.Model, node.Children ([]string)\n\n// Get the current branch from root to leaf\nbranch := ctx.GetCurrentBranch() // []ext.TreeNode\n\n// Get child entry IDs of a node\nchildren := ctx.GetChildren(\"entry-id\") // []string\n\n// Navigate/fork to a different entry in the tree\nresult := ctx.NavigateTo(\"entry-id\") // ext.TreeNavigationResult{Success, Error}\n\n// Summarize a range of the branch using LLM\nsummary := ctx.SummarizeBranch(\"from-id\", \"to-id\") // string\n\n// Collapse a branch range into a summary entry (fresh context primitive)\nresult := ctx.CollapseBranch(\"from-id\", \"to-id\", \"summary text\")\n```\n\n### Skill Loading\n\nLoad and inject skills dynamically at runtime:\n\n```go\n// Discover skills from standard locations\nresult := ctx.DiscoverSkills() // ext.SkillLoadResult{Skills, Error}\n// Standard locations: ~/.config/kit/skills/, .kit/skills/, .agents/skills/\n\n// Load a specific skill file\nskill, err := ctx.LoadSkill(\"/path/to/skill.md\") // (*ext.Skill, error string)\n// skill.Name, skill.Description, skill.Content, skill.Tags, skill.When\n\n// Load all skills from a directory\nresult := ctx.LoadSkillsFromDir(\"/path/to/skills\") // ext.SkillLoadResult\n\n// Inject a skill as context (pre-loads for next turn)\nerr := ctx.InjectSkillAsContext(\"skill-name\") // error string\n\n// Inject a skill file directly\nerr := ctx.InjectRawSkillAsContext(\"/path/to/skill.md\") // error string\n\n// Get all discovered skills\nskills := ctx.GetAvailableSkills() // []ext.Skill\n```\n\n### Template Parsing\n\nParse and render templates with variable substitution:\n\n```go\n// Parse a template to extract {{variables}}\ntpl := ctx.ParseTemplate(\"name\", \"Hello {{name}}, welcome to {{place}}!\")\n// tpl.Name, tpl.Content, tpl.Variables ([]string)\n\n// Render a template with variable values\nvars := map[string]string{\"name\": \"Alice\", \"place\": \"Kit\"}\nrendered := ctx.RenderTemplate(tpl, vars) // \"Hello Alice, welcome to Kit!\"\n\n// Parse command-line style arguments\npattern := ext.ArgumentPattern{\n Positional: []string{\"command\", \"target\"}, // $1, $2\n Rest: \"args\", // $@\n Flags: map[string]string{\"--loop\": \"loop\", \"-f\": \"force\"},\n}\nresult := ctx.ParseArguments(\"deploy staging --loop 5\", pattern)\n// result.Vars[\"command\"] = \"deploy\"\n// result.Vars[\"target\"] = \"staging\"\n// result.Flags[\"--loop\"] = \"5\"\n\n// Simple positional argument parsing ($1, $2, $@)\nargs := ctx.SimpleParseArguments(\"deploy staging --force\", 2)\n// args[0] = \"deploy staging --force\" (full input)\n// args[1] = \"deploy\" ($1)\n// args[2] = \"staging\" ($2)\n// args[3] = \"--force\" ($@)\n\n// Evaluate model conditionals with wildcards\nmatches := ctx.EvaluateModelConditional(\"claude-*\") // bool\n// Patterns: * matches any, ? matches single char, comma = OR\n\n// Render content with conditionals\ncontent := `Hi ClaudeHi there`\nrendered := ctx.RenderWithModelConditionals(content) // based on current model\n```\n\n### Model Resolution\n\nResolve model fallback chains and query capabilities:\n\n```go\n// Resolve a chain of model preferences (tries each until available)\nresult := ctx.ResolveModelChain([]string{\n \"anthropic/claude-opus-4\",\n \"anthropic/claude-sonnet-4\",\n \"openai/gpt-4o\",\n})\n// result.Model (selected), result.Capabilities, result.Attempted, result.Error\n\n// Get capabilities for a specific model\ncaps, err := ctx.GetModelCapabilities(\"anthropic/claude-sonnet-4\")\n// caps.Provider, caps.ModelID, caps.ContextLimit, caps.Reasoning, caps.Streaming\n\n// Check if a model is available (provider exists)\navailable := ctx.CheckModelAvailable(\"anthropic/claude-sonnet-4\") // bool\n\n// Get current provider/model ID\nprovider := ctx.GetCurrentProvider() // \"anthropic\"\nmodelID := ctx.GetCurrentModelID() // \"claude-sonnet-4\"\n```\n" }, { "url": "/extensions/examples", @@ -252,7 +252,7 @@ "Quick links" ], "tags": [], - "content": "\n
    \n \"KIT\"\n
    \n\nA powerful, extensible AI coding agent CLI with multi-provider support, built-in tools, and a rich extension system.\n\n## Features\n\n- **Multi-Provider LLM Support** — Anthropic, OpenAI, Google Gemini, Ollama, Azure OpenAI, AWS Bedrock, OpenRouter, and more\n- **Built-in Core Tools** — bash, read, write, edit, grep, find, ls, spawn_subagent with no MCP overhead\n- **MCP Integration** — Connect external MCP servers for expanded capabilities\n- **Extension System** — Write custom tools, commands, widgets, and UI modifications in Go\n- **Interactive TUI** — Rich terminal interface powered by Bubble Tea with streaming, syntax highlighting, and custom rendering\n- **Session Management** — Tree-based conversation history with branching support\n- **Non-Interactive Mode** — Script-friendly positional args with JSON output\n- **ACP Server** — Run Kit as an [Agent Client Protocol](https://agentclientprotocol.com) agent over stdio\n- **Go SDK** — Embed Kit in your own applications\n\n## Quick links\n\n| Resource | Description |\n|----------|-------------|\n| [Installation](/installation) | Get Kit up and running |\n| [Quick Start](/quick-start) | Your first Kit session |\n| [Configuration](/configuration) | Customize Kit for your workflow |\n| [Extensions](/extensions/overview) | Build custom tools and UI components |\n| [Go SDK](/sdk/overview) | Embed Kit in your applications |\n" + "content": "\n
    \n \"KIT\"\n
    \n\nA powerful, extensible AI coding agent CLI with multi-provider support, built-in tools, and a rich extension system.\n\n## Features\n\n- **Multi-Provider LLM Support** — Anthropic, OpenAI, Google Gemini, Ollama, Azure OpenAI, AWS Bedrock, OpenRouter, and more\n- **Built-in Core Tools** — bash, read, write, edit, grep, find, ls, subagent with no MCP overhead\n- **MCP Integration** — Connect external MCP servers for expanded capabilities\n- **Extension System** — Write custom tools, commands, widgets, and UI modifications in Go\n- **Interactive TUI** — Rich terminal interface powered by Bubble Tea with streaming, syntax highlighting, and custom rendering\n- **Session Management** — Tree-based conversation history with branching support\n- **Non-Interactive Mode** — Script-friendly positional args with JSON output\n- **ACP Server** — Run Kit as an [Agent Client Protocol](https://agentclientprotocol.com) agent over stdio\n- **Go SDK** — Embed Kit in your own applications\n\n## Quick links\n\n| Resource | Description |\n|----------|-------------|\n| [Installation](/installation) | Get Kit up and running |\n| [Quick Start](/quick-start) | Your first Kit session |\n| [Configuration](/configuration) | Customize Kit for your workflow |\n| [Extensions](/extensions/overview) | Build custom tools and UI components |\n| [Go SDK](/sdk/overview) | Embed Kit in your applications |\n" }, { "url": "/installation", @@ -312,7 +312,7 @@ "Subagent event monitoring" ], "tags": [], - "content": "\n# Callbacks\n\n## Event-based monitoring\n\nFor more granular control, use the event subscription API:\n\n```go\n// Subscribe returns an unsubscribe function\nunsub := host.OnToolCall(func(event kit.ToolCallEvent) {\n fmt.Printf(\"Tool: %s, Args: %s\\n\", event.Name, event.Args)\n})\ndefer unsub()\n\nunsub2 := host.OnToolResult(func(event kit.ToolResultEvent) {\n fmt.Printf(\"Result: %s (error: %v)\\n\", event.Name, event.IsError)\n})\ndefer unsub2()\n\nunsub3 := host.OnStreaming(func(event kit.MessageUpdateEvent) {\n fmt.Print(event.Chunk)\n})\ndefer unsub3()\n\nunsub4 := host.OnResponse(func(event kit.ResponseEvent) {\n fmt.Println(\"Final response received\")\n})\ndefer unsub4()\n\nunsub5 := host.OnTurnStart(func(event kit.TurnStartEvent) {\n fmt.Println(\"Turn started\")\n})\ndefer unsub5()\n\nunsub6 := host.OnTurnEnd(func(event kit.TurnEndEvent) {\n fmt.Println(\"Turn ended\")\n})\ndefer unsub6()\n```\n\n## Hook system\n\nHooks allow you to intercept and modify behavior. Unlike events, hooks can modify or cancel operations:\n\n```go\n// Intercept tool calls before execution\nhost.OnBeforeToolCall(0, func(ctx context.Context, name string, args string) (string, error) {\n if name == \"bash\" {\n log.Println(\"Bash command:\", args)\n }\n return args, nil // return modified args or error to cancel\n})\n\n// Process results after tool execution\nhost.OnAfterToolResult(0, func(ctx context.Context, name string, result string) (string, error) {\n return result, nil\n})\n\n// Before/after each agent turn\nhost.OnBeforeTurn(0, func(ctx context.Context) error {\n return nil\n})\n\nhost.OnAfterTurn(0, func(ctx context.Context) error {\n return nil\n})\n```\n\nThe first argument is a priority (lower = runs first).\n\n## Subagent event monitoring\n\nMonitor real-time events from LLM-initiated subagents (when the model uses the `spawn_subagent` tool):\n\n```go\nhost.OnToolCall(func(e kit.ToolCallEvent) {\n if e.ToolName == \"spawn_subagent\" {\n host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {\n // Receives the same event types as Subscribe(), scoped to the child agent\n switch ev := event.(type) {\n case kit.MessageUpdateEvent:\n fmt.Print(ev.Chunk)\n case kit.ToolCallEvent:\n fmt.Printf(\"Subagent calling: %s\\n\", ev.ToolName)\n }\n })\n }\n})\n```\n\n`SubscribeSubagent` returns an unsubscribe function. Listeners are also cleaned up automatically when the subagent completes. See [Subagents](/advanced/subagents) for more details.\n" + "content": "\n# Callbacks\n\n## Event-based monitoring\n\nFor more granular control, use the event subscription API:\n\n```go\n// Subscribe returns an unsubscribe function\nunsub := host.OnToolCall(func(event kit.ToolCallEvent) {\n fmt.Printf(\"Tool: %s, Args: %s\\n\", event.Name, event.Args)\n})\ndefer unsub()\n\nunsub2 := host.OnToolResult(func(event kit.ToolResultEvent) {\n fmt.Printf(\"Result: %s (error: %v)\\n\", event.Name, event.IsError)\n})\ndefer unsub2()\n\nunsub3 := host.OnStreaming(func(event kit.MessageUpdateEvent) {\n fmt.Print(event.Chunk)\n})\ndefer unsub3()\n\nunsub4 := host.OnResponse(func(event kit.ResponseEvent) {\n fmt.Println(\"Final response received\")\n})\ndefer unsub4()\n\nunsub5 := host.OnTurnStart(func(event kit.TurnStartEvent) {\n fmt.Println(\"Turn started\")\n})\ndefer unsub5()\n\nunsub6 := host.OnTurnEnd(func(event kit.TurnEndEvent) {\n fmt.Println(\"Turn ended\")\n})\ndefer unsub6()\n```\n\n## Hook system\n\nHooks allow you to intercept and modify behavior. Unlike events, hooks can modify or cancel operations:\n\n```go\n// Intercept tool calls before execution\nhost.OnBeforeToolCall(0, func(ctx context.Context, name string, args string) (string, error) {\n if name == \"bash\" {\n log.Println(\"Bash command:\", args)\n }\n return args, nil // return modified args or error to cancel\n})\n\n// Process results after tool execution\nhost.OnAfterToolResult(0, func(ctx context.Context, name string, result string) (string, error) {\n return result, nil\n})\n\n// Before/after each agent turn\nhost.OnBeforeTurn(0, func(ctx context.Context) error {\n return nil\n})\n\nhost.OnAfterTurn(0, func(ctx context.Context) error {\n return nil\n})\n```\n\nThe first argument is a priority (lower = runs first).\n\n## Subagent event monitoring\n\nMonitor real-time events from LLM-initiated subagents (when the model uses the `subagent` tool):\n\n```go\nhost.OnToolCall(func(e kit.ToolCallEvent) {\n if e.ToolName == \"subagent\" {\n host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) {\n // Receives the same event types as Subscribe(), scoped to the child agent\n switch ev := event.(type) {\n case kit.MessageUpdateEvent:\n fmt.Print(ev.Chunk)\n case kit.ToolCallEvent:\n fmt.Printf(\"Subagent calling: %s\\n\", ev.ToolName)\n }\n })\n }\n})\n```\n\n`SubscribeSubagent` returns an unsubscribe function. Listeners are also cleaned up automatically when the subagent completes. See [Subagents](/advanced/subagents) for more details.\n" }, { "url": "/sdk/options", diff --git a/providers/index.html b/providers/index.html index cc0120f9..356e5a98 100644 --- a/providers/index.html +++ b/providers/index.html @@ -7,7 +7,7 @@ - + diff --git a/quick-start/index.html b/quick-start/index.html index e7996851..7e6c9e34 100644 --- a/quick-start/index.html +++ b/quick-start/index.html @@ -7,7 +7,7 @@ - + diff --git a/sdk/callbacks/index.html b/sdk/callbacks/index.html index 82517a73..ce710f73 100644 --- a/sdk/callbacks/index.html +++ b/sdk/callbacks/index.html @@ -7,7 +7,7 @@ - + @@ -84,11 +84,11 @@ The first argument is a priority (lower = runs first). ## Subagent event monitoring -Monitor real-time events from LLM-initiated subagents (when the model uses the `spawn_subagent` tool): +Monitor real-time events from LLM-initiated subagents (when the model uses the `subagent` tool): ```go host.OnToolCall(func(e kit.ToolCallEvent) { - if e.ToolName == "spawn_subagent" { + if e.ToolName == "subagent" { host.SubscribeSubagent(e.ToolCallID, func(event kit.Event) { // Receives the same event types as Subscribe(), scoped to the child agent switch ev := event.(type) { diff --git a/sdk/options/index.html b/sdk/options/index.html index 09996a3a..65b9f340 100644 --- a/sdk/options/index.html +++ b/sdk/options/index.html @@ -7,7 +7,7 @@ - + diff --git a/sdk/overview/index.html b/sdk/overview/index.html index 02afbcb5..65c10b52 100644 --- a/sdk/overview/index.html +++ b/sdk/overview/index.html @@ -7,7 +7,7 @@ - + diff --git a/sdk/sessions/index.html b/sdk/sessions/index.html index cdda02f7..c50d9759 100644 --- a/sdk/sessions/index.html +++ b/sdk/sessions/index.html @@ -7,7 +7,7 @@ - + diff --git a/search.json b/search.json index e8461bf9..07ad3459 100644 --- a/search.json +++ b/search.json @@ -30,7 +30,7 @@ "description": "Multi-agent orchestration with Kit subagents.", "headings": [ "Subprocess pattern", - "Built-in spawn_subagent tool", + "Built-in subagent tool", "Extension subagents", "Monitoring subagents from extensions", "Go SDK subagents", diff --git a/session/index.html b/session/index.html index 166470a1..7788c2ae 100644 --- a/session/index.html +++ b/session/index.html @@ -1566,7 +1566,7 @@ a:hover { text-decoration: underline; } 'grep': '🔍', 'find': '📁', 'ls': '📂', - 'spawn_subagent': '🤖', + 'subagent': '🤖', 'fetch': '🌐', 'todo': '✅' }; @@ -1612,7 +1612,7 @@ a:hover { text-decoration: underline; } headerLabel = formatLsHeader(input); bodyHtml = renderGenericBody(input, result); break; - case 'spawn_subagent': + case 'subagent': headerLabel = formatSubagentHeader(input); bodyHtml = renderSubagentBody(input, result); break; diff --git a/sessions/index.html b/sessions/index.html index 24978ca1..4f940a9a 100644 --- a/sessions/index.html +++ b/sessions/index.html @@ -7,7 +7,7 @@ - + diff --git a/themes/index.html b/themes/index.html index 1699c628..a4841afa 100644 --- a/themes/index.html +++ b/themes/index.html @@ -7,7 +7,7 @@ - +