zidane-gui 9.3.1 → 9.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/out/main/chunks/{remote-hosts-B8_tzg_n.js → remote-hosts-CSiGJAfm.js} +1 -1
  2. package/out/main/chunks/{session-search-sql-2EUzjHAT.js → session-search-sql-D51BmAO2.js} +5 -5
  3. package/out/main/index.js +4397 -4086
  4. package/out/main/session-search-worker.js +1 -1
  5. package/out/preload/index.mjs +36 -2
  6. package/out/renderer/assets/{24BXRY42-eTlQfl4v.js → 24BXRY42-0UXaaWjY.js} +1 -1
  7. package/out/renderer/assets/{4FHPYW2L-BHx1bBmw.js → 4FHPYW2L-BWpHahlW.js} +1 -1
  8. package/out/renderer/assets/{4LWW3ZNH-D7lTurDT.js → 4LWW3ZNH-CPyJ9o9Y.js} +1 -1
  9. package/out/renderer/assets/{5XYWFMKW-e04QMbw9.js → 5XYWFMKW-ZZpHHfGa.js} +1 -1
  10. package/out/renderer/assets/{64PMEAB3-DTIFpDpU.js → 64PMEAB3-DOEnEuzl.js} +1 -1
  11. package/out/renderer/assets/{6BEWHPQE-BrYtHcZG.js → 6BEWHPQE-C2ZZckdj.js} +1 -1
  12. package/out/renderer/assets/{6PIGVMFT-CoAPPYTl.js → 6PIGVMFT-CRGq6eh3.js} +1 -1
  13. package/out/renderer/assets/{75JW6PN6-JbXPfJg4.js → 75JW6PN6-CYzAa9yx.js} +1 -1
  14. package/out/renderer/assets/{7XWI72E6-CFY3Kecs.js → 7XWI72E6-C_GZbyIF.js} +1 -1
  15. package/out/renderer/assets/{BGW36YJW-DhmSG9tb.js → BGW36YJW-BAwgTZ_z.js} +1 -1
  16. package/out/renderer/assets/{CGIZI67J-Cr9B0EmW.js → CGIZI67J-BxXITbQC.js} +1 -1
  17. package/out/renderer/assets/{CodeEditor-C6EJBlGG.js → CodeEditor-CLsAw7eu.js} +2 -2
  18. package/out/renderer/assets/{ComposerEditor-oFIdMkLB.js → ComposerEditor-BqnIn2NQ.js} +1 -1
  19. package/out/renderer/assets/{DNNCRC2E-CMqlK0W6.js → DNNCRC2E-kbsNJgPT.js} +1 -1
  20. package/out/renderer/assets/DiffsTab--BHt7StP.js +3 -0
  21. package/out/renderer/assets/{E67EBMDD-C_T2QnwF.js → E67EBMDD-BOeJkFNZ.js} +1 -1
  22. package/out/renderer/assets/{EFYWJBJK-Cbn-VZcb.js → EFYWJBJK-CFT5CQUG.js} +1 -1
  23. package/out/renderer/assets/{EXE5EH6O-SXdUe5We.js → EXE5EH6O-Cbj5xPKl.js} +1 -1
  24. package/out/renderer/assets/{EditorWorkers-bVeEZI8X.js → EditorWorkers-CXBU_HFf.js} +1 -1
  25. package/out/renderer/assets/{FilesTab-DtM2Q5R0.js → FilesTab-CZHD0eBx.js} +4 -4
  26. package/out/renderer/assets/{G6GPDDNC-XfFyRa0j.js → G6GPDDNC-Ax6dML4i.js} +1 -1
  27. package/out/renderer/assets/{G76NGGFM-Bj_m2WLJ.js → G76NGGFM-BxPXXNt_.js} +1 -1
  28. package/out/renderer/assets/{GH6G3TJC-wPRy41Zv.js → GH6G3TJC-CiCXY2r6.js} +1 -1
  29. package/out/renderer/assets/{HPNUA7RO-BhLNmX-t.js → HPNUA7RO-DiyW9VGu.js} +1 -1
  30. package/out/renderer/assets/{HQRGC5D7-dvTAT1Uv.js → HQRGC5D7-ArfvIYAC.js} +1 -1
  31. package/out/renderer/assets/{IX6Z2TVR-CzV_umYo.js → IX6Z2TVR-Df9chdw8.js} +1 -1
  32. package/out/renderer/assets/IconButtonTip-D0dQOfg6.js +1 -0
  33. package/out/renderer/assets/{J77NQRCJ-DTwwq3Ci.js → J77NQRCJ-DOWauTsf.js} +1 -1
  34. package/out/renderer/assets/{JAD36DTZ-DArKsMUT.js → JAD36DTZ-CJDdMCD5.js} +1 -1
  35. package/out/renderer/assets/{LF3NJQAX-DjYdE7YV.js → LF3NJQAX-B89ZqOpY.js} +1 -1
  36. package/out/renderer/assets/{LRZCOFJZ-C7m8fw-0.js → LRZCOFJZ-BBX_wZ5T.js} +1 -1
  37. package/out/renderer/assets/{N5NF2FGY-CqGhgjNF.js → N5NF2FGY-BoIFu-8L.js} +1 -1
  38. package/out/renderer/assets/{N7OWWQHY-BRk68LVa.js → N7OWWQHY-CloOgGu1.js} +1 -1
  39. package/out/renderer/assets/{NT5JY5WP-B1NtxJ-K.js → NT5JY5WP-BhjzefjG.js} +1 -1
  40. package/out/renderer/assets/{OT7W3RNY-CtDQ--Ld.js → OT7W3RNY-BRzBqtKB.js} +1 -1
  41. package/out/renderer/assets/{P67P66DB-LeAz_z3Z.js → P67P66DB-Dw-K1Ghu.js} +1 -1
  42. package/out/renderer/assets/{PFLLLM7K-CgODCVD8.js → PFLLLM7K-DfSPUrIT.js} +1 -1
  43. package/out/renderer/assets/{PUAMC4MJ-9REX_vGK.js → PUAMC4MJ-BnY1F2cF.js} +1 -1
  44. package/out/renderer/assets/{PVFCHRLY-CK5jTRjy.js → PVFCHRLY-BcyVPS3n.js} +1 -1
  45. package/out/renderer/assets/{PinnedSavedView-Dtdra7Gq.js → PinnedSavedView-ciRhY0cN.js} +1 -1
  46. package/out/renderer/assets/{QQW2P742-B2snHr_6.js → QQW2P742-D6aitZ24.js} +1 -1
  47. package/out/renderer/assets/{S63OEDPG-BeWWF1tc.js → S63OEDPG-Dlz1a9cD.js} +1 -1
  48. package/out/renderer/assets/{SG5TVYLW-ClCsbQ87.js → SG5TVYLW-Bu7LZZpx.js} +1 -1
  49. package/out/renderer/assets/{SavedViewArtifact-ATjDgAUF.js → SavedViewArtifact-CM9L4mc8.js} +1 -1
  50. package/out/renderer/assets/{SidebarPreviewPane-DHllX0GN.js → SidebarPreviewPane-DkOCt7Gb.js} +1 -1
  51. package/out/renderer/assets/{TranscriptViews-DD_JshFH.js → TranscriptViews-aYvP71ow.js} +1 -1
  52. package/out/renderer/assets/{UGRSUGA2-jP6nv8HL.js → UGRSUGA2-avwOtJG1.js} +1 -1
  53. package/out/renderer/assets/{V44WA6U7-Dr_tS3uH.js → V44WA6U7-DMF87Y7j.js} +1 -1
  54. package/out/renderer/assets/{V67O4WWV-BRn52u9c.js → V67O4WWV-BsDLuBDb.js} +1 -1
  55. package/out/renderer/assets/{VBUCM3YD-0sLtn_Zp.js → VBUCM3YD-C6FrRswP.js} +1 -1
  56. package/out/renderer/assets/{VINGRCPA-n98Gf7V0.js → VINGRCPA-Do3Pv3Tc.js} +1 -1
  57. package/out/renderer/assets/{ViewBlock-DdcTHRu3.js → ViewBlock-B-ppjb34.js} +3 -3
  58. package/out/renderer/assets/{ViewCharts-BAw6tExV.js → ViewCharts-jvS22ppO.js} +2 -2
  59. package/out/renderer/assets/{ViewCustom-BzwMbjqg.js → ViewCustom-yFkoy6a-.js} +1 -1
  60. package/out/renderer/assets/{ViewExtension-Ch5_33Ra.js → ViewExtension-DuHxho6W.js} +1 -1
  61. package/out/renderer/assets/{ViewInputs-BHooAs2f.js → ViewInputs-VAMDh56H.js} +1 -1
  62. package/out/renderer/assets/{ViewMcpApp-CJnOESMk.js → ViewMcpApp-CH_W9CZt.js} +1 -1
  63. package/out/renderer/assets/{ViewSessionAction-BHJv5QNb.js → ViewSessionAction-66veqRhO.js} +1 -1
  64. package/out/renderer/assets/{ViewTables-DBTupg46.js → ViewTables-CKKDcYKH.js} +1 -1
  65. package/out/renderer/assets/{WL6DNKX4-Csfp__Nw.js → WL6DNKX4-Cq-YK4Uf.js} +1 -1
  66. package/out/renderer/assets/{WQ63CJYP-oSbguA5n.js → WQ63CJYP-fjrhTSVs.js} +1 -1
  67. package/out/renderer/assets/{XOYAOB3S-DfDDKmX8.js → XOYAOB3S-CAQPI0he.js} +1 -1
  68. package/out/renderer/assets/{Y5LQLG3M-BnZ8APdi.js → Y5LQLG3M-DKntYAaW.js} +1 -1
  69. package/out/renderer/assets/{YIK6JTN6-Bunk5CDx.js → YIK6JTN6-CcjcC5JX.js} +1 -1
  70. package/out/renderer/assets/{core-BbPUgmX7.js → core-Cj89wpQh.js} +4 -4
  71. package/out/renderer/assets/{file-tabs-CFdJBYJ9.js → file-tabs-PoAgFa7v.js} +1 -1
  72. package/out/renderer/assets/{ghostty-web-Dn7o-dzQ.js → ghostty-web-DiMuvUtH.js} +1 -1
  73. package/out/renderer/assets/{highlights-eTGcn9lP.js → highlights-7WH0ppQl.js} +1 -1
  74. package/out/renderer/assets/{highlights-D4Jo_Sz0.js → highlights-DnSmFBdQ.js} +1 -1
  75. package/out/renderer/assets/index-CiuUSFeC.js +11 -0
  76. package/out/renderer/assets/kit-CD3F-f6F.js +147 -0
  77. package/out/renderer/assets/{langs-CXhlGiW6.js → langs-D5CRC9qz.js} +1 -1
  78. package/out/renderer/assets/{lazy-D3tN-GAO.js → lazy-CUmWiDAP.js} +3 -3
  79. package/out/renderer/assets/{loader-DGyfh0zB.js → loader-CPY9efuc.js} +1 -1
  80. package/out/renderer/assets/{pierre-theme-BZvsTYqQ.js → pierre-theme-BrzM0xZU.js} +3 -3
  81. package/out/renderer/assets/setting-demos-BW7cG2_G.css +1 -0
  82. package/out/renderer/assets/setting-demos-DEURBrvf.js +1 -0
  83. package/out/renderer/assets/{shiki-Wqv4XEGM.js → shiki-DFrbO9j3.js} +1 -1
  84. package/out/renderer/assets/{sidebar-layout-sK8ujsHX.js → sidebar-layout-fobokay5.js} +1 -1
  85. package/out/renderer/assets/{stream-tokenizer-C18hljKL.js → stream-tokenizer-CT1HAjvR.js} +1 -1
  86. package/out/renderer/assets/{themes-Dfx1_kFe.js → themes-Cj62ov9J.js} +1 -1
  87. package/out/renderer/assets/{useFind-BBxfQuQ2.js → useFind-Cdl0rVJO.js} +3 -3
  88. package/out/renderer/assets/{useFolderChanges-BcfSJoBT.js → useFolderChanges-C9L_NOgw.js} +2 -2
  89. package/out/renderer/assets/{view-preview-B2Rj--lZ.js → view-preview-BvCO9WZH.js} +1 -1
  90. package/out/renderer/assets/{zoom-reset-l-YVDJrI.js → zoom-reset-COqHFP45.js} +1 -1
  91. package/out/renderer/index.html +5 -5
  92. package/out/renderer/view-preview.html +6 -6
  93. package/package.json +2 -2
  94. package/out/renderer/assets/DiffsTab-D690H0Dy.js +0 -3
  95. package/out/renderer/assets/IconButtonTip-P9QUxPjA.js +0 -1
  96. package/out/renderer/assets/index-c95EBMdk.js +0 -8
  97. package/out/renderer/assets/kit-C9O_D5xC.js +0 -147
  98. package/out/renderer/assets/setting-demos-B0787McX.js +0 -1
  99. package/out/renderer/assets/setting-demos-vtrBsYTd.css +0 -1
@@ -39,7 +39,7 @@ ${end}
39
39
  `,idx-1);if(nl<floor)break;if(c2.at+nl+1<to&&--left===0)return c2.at+nl+1;idx=nl}}return from}stateAt(offset){if(this.head>=this.chunks.length)return this.state;const i=this.find(offset),c2=this.chunks[i],head=c2.data.slice(0,Math.max(0,offset-c2.at));return scanModes(c2.before,c2.carry+head,c2.at-c2.carry.length)}};const MEDIA_BY_EXTENSION={png:{kind:"image",mime:"image/png"},jpg:{kind:"image",mime:"image/jpeg"},jpeg:{kind:"image",mime:"image/jpeg"},gif:{kind:"image",mime:"image/gif"},webp:{kind:"image",mime:"image/webp"},avif:{kind:"image",mime:"image/avif"},svg:{kind:"image",mime:"image/svg+xml"},bmp:{kind:"image",mime:"image/bmp"},ico:{kind:"image",mime:"image/x-icon"},mp4:{kind:"video",mime:"video/mp4"},m4v:{kind:"video",mime:"video/mp4"},webm:{kind:"video",mime:"video/webm"},ogv:{kind:"video",mime:"video/ogg"},mov:{kind:"video",mime:"video/quicktime"},mp3:{kind:"audio",mime:"audio/mpeg"},wav:{kind:"audio",mime:"audio/wav"},ogg:{kind:"audio",mime:"audio/ogg"},oga:{kind:"audio",mime:"audio/ogg"},m4a:{kind:"audio",mime:"audio/mp4"},flac:{kind:"audio",mime:"audio/flac"},pdf:{kind:"pdf",mime:"application/pdf"}};function mediaTypeOfPath(path){const name=path.slice(path.lastIndexOf("/")+1).toLowerCase(),dot=name.lastIndexOf(".");return dot>0?MEDIA_BY_EXTENSION[name.slice(dot+1)]??null:null}const HOST_TOOLS=[{name:"git",label:"git",icon:"i-ph-git-branch",why:"Worktrees, cloning, the git bar"},{name:"gh",label:"GitHub CLI",icon:"i-ph-github-logo",why:"Pull requests"},{name:"glab",label:"GitLab CLI",icon:"i-ph-gitlab-logo",why:"Merge requests"},{name:"docker",label:"Docker",icon:"i-ph-cube",why:"Docker sessions"},{name:"node",label:"Node.js",icon:"i-ph-file-js",why:"npm extensions, stdio MCP servers"},{name:"bun",label:"Bun",icon:"i-ph-lightning",why:"Extensions"},{name:"python3",label:"Python",icon:"i-ph-file-py",why:"Python MCP servers"},{name:"rg",label:"ripgrep",icon:"i-ph-magnifying-glass",why:"Fast search"},{name:"ssh",label:"ssh",icon:"i-ph-terminal",why:"git over ssh",versionArgs:["-V"]}],RIPGREP="14.1.1",RIPGREP_TARGETS={x64:"x86_64-unknown-linux-musl",arm64:"aarch64-unknown-linux-gnu"},BUN="curl -fsSL https://bun.sh/install | bash",BREW={gh:"gh",glab:"glab",node:"node",python3:"python",rg:"ripgrep",git:"git"},APT={git:"git",node:"nodejs",python3:"python3",ssh:"openssh-client",rg:"ripgrep"},PAGES={gh:"https://github.com/cli/cli#installation",glab:"https://gitlab.com/gitlab-org/cli#installation",docker:"https://docs.docker.com/engine/install/",node:"https://nodejs.org/en/download",python3:"https://www.python.org/downloads/",rg:"https://github.com/BurntSushi/ripgrep#installation",git:"https://git-scm.com/downloads",ssh:"https://www.openssh.com/portable.html",bun:"https://bun.sh/docs/installation"};function toolInstall(name,capabilities){if(!HOST_TOOLS.some(tool=>tool.name===name))return;const{platform,arch}=capabilities.os,{brew=!1,apt=!1}=capabilities.installers??{};if(name==="bun"&&(platform==="linux"||platform==="darwin"))return{kind:"run",command:BUN};if(platform==="darwin"&&brew&&BREW[name])return{kind:"run",command:`brew install ${BREW[name]}`};if(platform==="linux"&&name==="rg"&&RIPGREP_TARGETS[arch]){const dir=`ripgrep-${RIPGREP}-${RIPGREP_TARGETS[arch]}`;return{kind:"run",command:`mkdir -p "$HOME/.local/bin" && curl -fsSL https://github.com/BurntSushi/ripgrep/releases/download/${RIPGREP}/${dir}.tar.gz | tar -xz -C "$HOME/.local/bin" --strip-components=1 ${dir}/rg`}}return platform==="linux"&&name==="docker"?{kind:"copy",command:"curl -fsSL https://get.docker.com | sudo sh"}:platform==="linux"&&apt&&APT[name]?{kind:"copy",command:`sudo apt-get install -y ${APT[name]}`}:PAGES[name]?{kind:"link",url:PAGES[name]}:void 0}function hasTool(capabilities,name){return capabilities?.tools.find(tool=>tool.name===name)?.found}function capabilityTags(capabilities,max=4){const all=[...capabilities.tools.filter(tool=>tool.found&&tool.name!=="ssh"&&tool.name!=="rg").map(tool=>tool.name),...capabilities.environments.filter(env=>env.available&&env.kind!=="local"&&env.kind!=="worktree"&&!env.kind.includes("@")).map(env=>env.kind)],unique=[...new Set(all)];return{tags:unique.slice(0,max),more:Math.max(0,unique.length-max)}}const SHORTHAND=/^([\w.-]+)\/([\w.-]+?)(?:\.git)?$/,SCP=/^(?:[\w.-]+@)?([A-Z0-9.-]+):(?!\/\/)(\S+?)\/?$/i,FORGE_VIEWS=new Set(["tree","blob","commit","commits","pull","pulls","issues","releases","actions","-"]);function stripGit(segment){return segment.replace(/\.git$/,"")}function nameOf(path){const last=stripGit(path.replace(/\/+$/,"").split("/").pop()??"");return last&&last!=="."&&last!==".."?last:null}function parseRepoInput(raw){const input=raw.trim();if(!input||/\s/.test(input))return null;const short=SHORTHAND.exec(input);if(short&&!input.includes(":")){const[,owner,repo]=short;return nameOf(repo)?{cloneUrl:`https://github.com/${owner}/${repo}.git`,name:repo,label:`${owner}/${repo}`}:null}const scp=SCP.exec(input);if(scp&&!/^[a-z][a-z0-9+.-]*:\/\//i.test(input)){const[,host2,path2]=scp,name2=nameOf(path2);return name2?{cloneUrl:input,name:name2,label:`${host2}:${stripGit(path2)}`}:null}const withScheme=/^[a-z][a-z0-9+.-]*:\/\//i.test(input)?input:/^[\w.-]+\.[a-z]{2,}\//i.test(input)?`https://${input}`:null;if(!withScheme)return null;let url;try{url=new URL(withScheme)}catch{return null}const protocol=url.protocol.replace(/:$/,"");if(!["https","http","ssh","git","file"].includes(protocol))return null;if(protocol==="file"){const name2=nameOf(url.pathname);return name2?{cloneUrl:input,name:name2,label:url.pathname}:null}const segments=url.pathname.split("/").filter(Boolean);if(segments.length<2)return null;let branch,treePath;const view=segments.findIndex((s,i)=>i>=2&&FORGE_VIEWS.has(s));let repoPath=segments;if(view>=2){repoPath=segments.slice(0,view);const rest=segments.slice(view+(segments[view]==="-"?1:0));if(rest[0]==="tree"&&rest[1])try{branch=decodeURIComponent(rest[1]),rest.length>2&&(treePath=rest.slice(1).map(decodeURIComponent).join("/"))}catch{branch=void 0,treePath=void 0}}const host=url.host,path=repoPath.join("/"),name=nameOf(path);return name?{cloneUrl:protocol==="https"||protocol==="http"?`${url.protocol}//${url.username?`${url.username}@`:""}${host}/${stripGit(path)}.git`:input,name,label:host==="github.com"?stripGit(path):`${host}/${stripGit(path)}`,...branch?{branch}:{},...treePath?{treePath}:{}}:null}const SAVED_VIEWS_UNSUPPORTED="saved-views-unsupported";function sessionViewRef(sessionId,id){return{kind:"session",sessionId,id}}function viewRefKey(ref){return ref.kind==="session"?JSON.stringify({kind:"session",sessionId:ref.sessionId,id:ref.id}):JSON.stringify({kind:"saved",scope:ref.scope,key:ref.key,...ref.version!==void 0?{version:ref.version}:{}})}const DEFAULT_SETTINGS={showRowIcons:!0,showThinking:!0,thinkingAutoExpand:!1,toolCallDisplay:"formatted",showToolResults:!0,groupToolCalls:!0,showFullShellOutput:!1,showRunReceipt:!0,showCacheNotices:!1,showToolAttachments:!0,approvalMode:"ask",useDaemon:!1,remoteHosts:!1,orchestration:!1,schedules:!1,schedulesAgent:!0,loadProjectExtensions:!1,importForeignConfigs:!1,importRulerConfigs:!0,hideSubagentOutput:!0,subagentModels:!0,imageGeneration:!0,webSearch:!0,secrets:!1,imageModel:"",maxParallelSubagents:3,messageDelivery:"queue",theme:"default",showAllProjects:!1,spaces:!1,spaceList:[],spacesHome:"",resumeLastSession:!0,autoArchiveMergedSessions:!1,persistToolResults:!0,stableToolList:!0,freezeSessionPrompt:!0,compactBeforeCacheExpiry:!1,compactToolCatalog:!1,codemode:!0,codemodeShowCalls:!1,codemodeStreamProgress:!1,sandbox:!1,sandboxNetwork:"allow",sandboxAllowWrite:"",autoCompact:!0,autoCompactThreshold:.8,autoCompactMaxTokens:0,backgroundCompaction:!1,resumeOnMaxTokens:!1,maxOutputTokens:0,maxTurns:0,retryMaxAttempts:0,maxCostUsd:0,maxTotalTokens:0,maxWallMinutes:0,thinkingBinding:"drop_block",showEditDiffs:!0,editDiffDisplay:"full",transcriptDensity:"compact",showCompactionSummary:!1,compactionModel:"",defaultAgent:"",defaultModel:"",defaultEffort:"",defaultModelOptions:{},decisions:!1,decisionModel:"",autoTitle:!1,runEstimates:!1,textModel:"",targetFps:60,mouseInteractions:!0,interactionMode:"ask",browserMediaAnyPath:!1,durability:"resume-ask",smoothStreaming:!0,fileLogging:!1,showTodoIndicator:!0,showUsageIndicator:!0,showThrobber:!1,artifacts:!0,preserveScroll:!0,transcriptRail:!1,renderDiagrams:!0,views:!1,viewsCustomCode:!0,viewsMcpApps:!0,viewsInputs:!0,viewsLiveData:!1,viewsSave:!1,viewsNetwork:"blocked",viewsMcp:"off",viewsMcpAllowed:[],viewsOrchestration:"off",browser:!0,browserAgent:!0,browserAutoShow:!0,terminal:!0,terminalAgent:!0,terminalAgentTasks:!0,closeTerminalOnCleanExit:!0,confirmGitSync:!0,sidebarRunDetails:!0,sidebarLayout:"groups",sidebarGroupBy:"project",sidebarSortBy:"createdTime",sidebarInboxGroupBy:"none",sidebarEarlierDays:3,restoreWindowPlacement:!0,projectHome:!1,notifications:!1,notificationSound:!0,openIn:"panel",editor:{},checkForUpdates:!0,autoInstallUpdates:!1,subscriptionUsage:!0,uiMode:"full",userInstructionsScope:"both",ctrlCBehavior:"quit",terminalTitle:"off",sessionIcon:"",attentionIcon:"",activeIcon:"",attachmentsEnabled:!0,externalEditor:!0,inlineAutocomplete:!0,composerMarkdown:!1,promptSuggestions:!1};function decisionsEnabled(settings){return settings.decisions===!0||settings.approvalMode==="decide"}function retryLabel(info){const suffix=info.source==="parent"?"":` (${info.source})`;return`retrying ${info.attempt}/${info.max}${suffix}`}function compactingParts(estTokens,startedAt,now=Date.now()){const elapsedMs=typeof startedAt=="number"?now-startedAt:0;return{label:"Compacting...",meta:[typeof estTokens=="number"&&estTokens>0?`~${fmtTokens(estTokens)}`:"",elapsedMs>=1e3?formatDuration(elapsedMs):""].filter(Boolean)}}function autoCompactShare(threshold,maxTokens,effectiveWindow){return!maxTokens||maxTokens<=0||!effectiveWindow||effectiveWindow<=0?threshold:Math.min(threshold,maxTokens/effectiveWindow)}const DEFAULT_RESULT_LIMIT$1=50,MIN_TOKEN_LENGTH=6;function normalizeId(id){return id.replace(/-/g,"").toLowerCase()}function projectLabel(projectRoot){if(!projectRoot)return"";const parts=projectRoot.split(/[\\/]/).filter(Boolean);return parts[parts.length-1]??projectRoot}const tokensByCatalog=new WeakMap;function catalogTokens(catalog){let cached=tokensByCatalog.get(catalog);return cached||(cached={normalizedIds:catalog.map(entry=>normalizeId(entry.id)),tokens:new Map},tokensByCatalog.set(catalog,cached)),cached}function tokenFor(id,catalog){const{normalizedIds,tokens}=catalogTokens(catalog),known=tokens.get(id);if(known!==void 0)return known;const normalized=normalizeId(id);let result;for(let len=Math.min(MIN_TOKEN_LENGTH,normalized.length);len<=normalized.length;len++){const token=normalized.slice(0,len);if(normalizedIds.filter(candidate=>candidate.startsWith(token)).length===1){result=token;break}}return result??=normalized||shortId(id),tokens.set(id,result),result}function stripTrailingPunctuation(candidate){return candidate.replace(/[.,;:)\]}!?]+$/,"")}function descriptionFor(entry,token,scope){const bits=[`#${token}`,ageString(entry.updatedAt),`${entry.userMessageCount} msg${entry.userMessageCount===1?"":"s"}`];(entry.artifactCount??0)>0&&bits.push(`${entry.artifactCount} artifact${entry.artifactCount===1?"":"s"}`);const project=projectLabel(entry.projectRoot);return scope==="all"&&project&&bits.push(project),bits.join(", ")}function scoreChats(catalog,tokenCatalog,query,limit,scope){const q=query.trim().toLowerCase(),rows=catalog.map(entry=>({entry,token:tokenFor(entry.id,tokenCatalog),project:projectLabel(entry.projectRoot)})),fuzzyHits=q.length>0?new Set(new Fzf(rows,{selector:r=>`${r.entry.title} ${r.token} ${r.project}`,casing:"case-insensitive"}).find(q).map(r=>r.item)):null,scored=[];for(const row of rows){const title=row.entry.title.toLowerCase(),token=row.token.toLowerCase(),project=row.project.toLowerCase();if(q.length===0){scored.push({entry:row.entry,token:row.token,rank:5});continue}if(token.startsWith(q)){scored.push({entry:row.entry,token:row.token,rank:0});continue}if(title.startsWith(q)){scored.push({entry:row.entry,token:row.token,rank:1});continue}if(title.includes(q)){scored.push({entry:row.entry,token:row.token,rank:2});continue}if(project.includes(q)){scored.push({entry:row.entry,token:row.token,rank:3});continue}fuzzyHits?.has(row)&&scored.push({entry:row.entry,token:row.token,rank:4})}return scored.sort((a,b)=>a.rank!==b.rank?a.rank-b.rank:b.entry.updatedAt-a.entry.updatedAt),scored.slice(0,limit).map(({entry,token})=>({id:token,label:entry.title,description:descriptionFor(entry,token,scope),insertText:`#${token} `,data:{entry,token}}))}function createChatsCompletionProvider(opts){const limit=opts.limit??DEFAULT_RESULT_LIMIT$1,scope=()=>opts.getScope?.()??"project";return{id:"chats",trigger:"#",label:"Chats",suggest(query){const current=opts.getCatalog(),tokenCatalog=opts.getReferenceCatalog?.()??current,effectiveTokenCatalog=tokenCatalog.length>0?tokenCatalog:current;return current.length>0?scoreChats(current,effectiveTokenCatalog,query,limit,scope()):opts.ensureCatalog?opts.ensureCatalog().then(loaded=>{const refreshed=opts.getReferenceCatalog?.()??loaded;return scoreChats(loaded,refreshed.length>0?refreshed:loaded,query,limit,scope())}):[]},parseReferences(text,_ctx){const catalog=opts.getReferenceCatalog?.()??opts.getCatalog();if(catalog.length===0)return[];const byToken=new Map;for(const entry of catalog){const token=tokenFor(entry.id,catalog);byToken.set(token,{entry,token})}const refs=[];for(const m of text.matchAll(/(^|\s)#(\S+)/g)){const candidate=stripTrailingPunctuation(m[2]),data=byToken.get(candidate.toLowerCase());if(!data)continue;const start=m.index+m[1].length;refs.push({providerId:"chats",start,end:start+1+candidate.length,itemId:data.entry.id,data})}return refs}}}const DATE_DASHED=/-(\d{4})-(\d{2})-(\d{2})(?=$|[-:])/,SIZE=/^(?:\d+(?:\.\d+)?[bkm]|a\d+(?:\.\d+)?b|e\d+b|\d+x\d+b)$/,SNAPSHOT=/^\d{4}$|^\d{6,8}$/,NUMBER=/^\d+(?:\.\d+)*$/,PADDED=/^0\d{1,2}$/,REVISION=/^v\d+$/,LETTERS_VERSION=/^([a-z]+)(\d+(?:\.\d+)*)$/,VERSION_LETTERS=/^(\d+(?:\.\d+)*)([a-z]+)$/,NOISE=new Set(["preview","latest","exp","experimental"]);function parseModelId(id){let rest=id.toLowerCase(),variant="";const colon=rest.indexOf(":");colon>=0&&(variant=rest.slice(colon+1),rest=rest.slice(0,colon));let vendor="";const slash=rest.lastIndexOf("/");slash>=0&&(vendor=rest.slice(0,slash),rest=rest.slice(slash+1));let snapshot2="";const dated=DATE_DASHED.exec(rest);dated&&(snapshot2=`${dated[1]}${dated[2]}${dated[3]}`,rest=rest.slice(0,dated.index)+rest.slice(dated.index+dated[0].length));const words2=[],version=[],sizes=[],snapParts=[];let afterNoise=!1;const pushVersion=v=>{for(const n of v.split("."))version.push(Number(n))};for(const token of rest.split(/[-_\s]+/).filter(Boolean)){if(NOISE.has(token)){afterNoise=!0;continue}if(SIZE.test(token)){sizes.push(token);continue}if((words2.length>0||version.length>0)&&(SNAPSHOT.test(token)||afterNoise&&NUMBER.test(token)||version.length>0&&(PADDED.test(token)||REVISION.test(token)))){snapParts.push(token);continue}if(NUMBER.test(token)){pushVersion(token);continue}const lv=LETTERS_VERSION.exec(token);if(lv){words2.push(lv[1]),pushVersion(lv[2]);continue}const vl=VERSION_LETTERS.exec(token);if(vl){pushVersion(vl[1]),words2.push(vl[2]);continue}words2.push(token)}return!snapshot2&&snapParts.length>0&&(snapshot2=snapParts.length===2&&/^\d{2}$/.test(snapParts[0])&&/^\d{4}$/.test(snapParts[1])?`${snapParts[1]}${snapParts[0]}`:snapParts.join("")),{vendor,family:words2.join("-"),version,size:sizes.join("-"),snapshot:snapshot2,variant}}function compareModelVersion(a,b){const n=Math.max(a.length,b.length);for(let i=0;i<n;i++){const x=a[i],y=b[i];if(x===void 0)return-1;if(y===void 0)return 1;if(x!==y)return x-y}return 0}function preferAlias(a,b){const sa=a.parts.snapshot,sb=b.parts.snapshot;return!sa!=!sb?sa?1:-1:sa!==sb?sa<sb?1:-1:!a.parts.variant!=!b.parts.variant?a.parts.variant?1:-1:a.id.length-b.id.length||(a.id<b.id?-1:a.id>b.id?1:0)}const lineupKey=e=>`${e.providerKey}\0${e.modelId}`;function currentModelKeys(entries,keep=[]){const groups=new Map;for(const entry of entries){const parts=parseModelId(entry.modelId),group=`${entry.providerKey}\0${parts.vendor}\0${parts.family}`,list=groups.get(group),item={id:entry.modelId,key:lineupKey(entry),parts};list?list.push(item):groups.set(group,[item])}const kept=new Set(keep.map(lineupKey));for(const list of groups.values()){let newest=[];for(const item of list)compareModelVersion(item.parts.version,newest)>0&&(newest=item.parts.version);const bySize=new Map;for(const item of list){if(compareModelVersion(item.parts.version,newest)!==0)continue;const best=bySize.get(item.parts.size);(!best||preferAlias(item,best)<0)&&bySize.set(item.parts.size,item)}for(const item of bySize.values())kept.add(item.key)}return kept}function currentModels(entries,keep=[]){const kept=currentModelKeys(entries,keep);return entries.filter(entry=>kept.has(lineupKey(entry)))}const SMALL_WORDS=new Set(["haiku","luna","mini","small","lite","nano","micro"]),MEDIUM_WORDS=new Set(["sonnet","terra","flash","medium"]),LARGE_WORDS=new Set(["opus","fable","sol","pro","large"]),SPECIAL_WORDS=new Set(["image","live","audio","tts","realtime","transcribe","embedding","embed","computer","research","customtools","moderation","guard","ocr"]);function heuristicModelTier(modelId){const words2=parseModelId(modelId).family.split("-");if(words2.some(w=>SMALL_WORDS.has(w)))return"small";if(words2.some(w=>MEDIUM_WORDS.has(w)))return"medium";if(words2.some(w=>LARGE_WORDS.has(w)))return"large"}function modelTier(model){return model.tier??heuristicModelTier(model.id)}function generalPurpose(model){if(model.input&&!model.input.includes("text"))return!1;const parts=parseModelId(model.id);return parts.variant||parts.family==="auto"||model.id.startsWith("~")?!1:!parts.family.split("-").some(w=>SPECIAL_WORDS.has(w))}const inputRate=model=>model.cost?.input??Number.POSITIVE_INFINITY;function autoTextModelId(models,mainModelId){let pool=currentModels(models.filter(generalPurpose).map(model=>({providerKey:"",modelId:model.id,model}))).map(e=>e.model);const vendor=parseModelId(mainModelId).vendor;if(vendor){const sameVendor=pool.filter(m=>parseModelId(m.id).vendor===vendor);sameVendor.length>0&&(pool=sameVendor)}const cheapest=list=>list.reduce((best,m)=>!best||inputRate(m)<inputRate(best)?m:best,void 0),small=pool.filter(m=>modelTier(m)==="small");return small.length>0?cheapest(small).id:cheapest(pool.filter(m=>m.cost!==void 0))?.id}function waitedMs(wait,now){return wait?wait.ms+(wait.since!==void 0?Math.max(now-wait.since,0):0):0}function workedMs(startedAt,wait,now){return Math.max(now-startedAt-waitedMs(wait,now),0)}function isRunEstimated(view){return!("problem"in view)}function estimateViewAt(view){return isRunEstimated(view)?view.at:view.problem.at}function estimateReadout(view,now){const worked=workedMs(view.startedAt,{ms:view.waitMs,...view.waitingSince!==void 0?{since:view.waitingSince}:{}},now),remainingMs=Math.max(view.totalMs-worked,0);return worked>view.highMs?{state:"over",remainingMs:0}:view.waitingSince!==void 0?{state:"paused",remainingMs}:{state:remainingMs>0?"live":"due",remainingMs}}function formatEstimate(ms){const seconds=Math.max(ms,0)/1e3;if(seconds<60)return`~${Math.max(Math.ceil(seconds/10)*10,10)}s`;const minutes=Math.ceil(seconds/60);if(minutes<60)return`~${minutes}m`;if(minutes>1440)return"24h+";if(minutes<600){const rounded=Math.round(minutes/5)*5,h=Math.floor(rounded/60),m=rounded%60;return m===0?`~${h}h`:`~${h}h ${m}m`}return`~${Math.round(minutes/60)}h`}const LATTE={pink:"#ea76cb",mauve:"#8839ef",red:"#d20f39",maroon:"#e64553",peach:"#fe640b",yellow:"#df8e1d",green:"#40a02b",teal:"#179299",sky:"#04a5e5",sapphire:"#209fb5",blue:"#1e66f5",lavender:"#7287fd",text:"#4c4f69",subtext1:"#5c5f77",subtext0:"#6c6f85",overlay2:"#7c7f93",overlay1:"#8c8fa1",overlay0:"#9ca0b0",surface1:"#bcc0cc",surface0:"#ccd0da",base:"#eff1f5",mantle:"#e6e9ef",crust:"#dce0e8"},FRAPPE={pink:"#f4b8e4",mauve:"#ca9ee6",red:"#e78284",maroon:"#ea999c",peach:"#ef9f76",yellow:"#e5c890",green:"#a6d189",teal:"#81c8be",sky:"#99d1db",sapphire:"#85c1dc",blue:"#8caaee",lavender:"#babbf1",text:"#c6d0f5",subtext1:"#b5bfe2",subtext0:"#a5adce",overlay2:"#949cbb",overlay1:"#838ba7",overlay0:"#737994",surface1:"#51576d",surface0:"#414559",base:"#303446",mantle:"#292c3c",crust:"#232634"},MACCHIATO={pink:"#f5bde6",mauve:"#c6a0f6",red:"#ed8796",maroon:"#ee99a0",peach:"#f5a97f",yellow:"#eed49f",green:"#a6da95",teal:"#8bd5ca",sky:"#91d7e3",sapphire:"#7dc4e4",blue:"#8aadf4",lavender:"#b7bdf8",text:"#cad3f5",subtext1:"#b8c0e0",subtext0:"#a5adcb",overlay2:"#939ab7",overlay1:"#8087a2",overlay0:"#6e738d",surface1:"#494d64",surface0:"#363a4f",base:"#24273a",mantle:"#1e2030",crust:"#181926"},MOCHA={pink:"#f5c2e7",mauve:"#cba6f7",red:"#f38ba8",maroon:"#eba0ac",peach:"#fab387",yellow:"#f9e2af",green:"#a6e3a1",teal:"#94e2d5",sky:"#89dceb",sapphire:"#74c7ec",blue:"#89b4fa",lavender:"#b4befe",text:"#cdd6f4",subtext1:"#bac2de",subtext0:"#a6adc8",overlay2:"#9399b2",overlay1:"#7f849c",overlay0:"#6c7086",surface1:"#45475a",surface0:"#313244",base:"#1e1e2e",mantle:"#181825",crust:"#11111b"};function catppuccinTheme(id,label,p){return{id,label,colors:{brand:p.mauve,accent:p.green,model:p.blue,warn:p.yellow,error:p.red,dim:p.subtext1,mute:p.overlay0,border:p.surface1,borderActive:p.overlay0,throbber:{from:p.mauve,to:p.pink}},select:{backgroundColor:"transparent",focusedBackgroundColor:"transparent",selectedBackgroundColor:"transparent",selectedTextColor:p.mauve,textColor:p.subtext1,descriptionColor:p.overlay0,selectedDescriptionColor:p.subtext0},surfaces:{background:p.crust,modal:p.mantle,chips:{default:{bg:p.mauve,fg:p.base},skills:{bg:p.mauve,fg:p.base},files:{bg:p.blue,fg:p.base}},selection:p.surface0,diff:{addBg:p.surface0,removeBg:p.surface0,addContentBg:p.surface1,removeContentBg:p.surface1,addFg:p.green,removeFg:p.red}},syntax:{default:{fg:p.text},"markup.heading":{fg:p.mauve,bold:!0},"markup.heading.1":{fg:p.mauve,bold:!0},"markup.heading.2":{fg:p.lavender,bold:!0},"markup.heading.3":{fg:p.blue,bold:!0},"markup.bold":{fg:p.text,bold:!0},"markup.strong":{fg:p.text,bold:!0},"markup.italic":{fg:p.text,italic:!0},"markup.link":{fg:p.sky,underline:!0},"markup.link.url":{fg:p.sky,underline:!0},"markup.list":{fg:p.peach},"markup.raw":{fg:p.green},"markup.raw.block":{fg:p.green},"markup.quote":{fg:p.overlay2,italic:!0},keyword:{fg:p.mauve,bold:!0},"keyword.import":{fg:p.pink,bold:!0},"keyword.operator":{fg:p.sky},string:{fg:p.green},"string.escape":{fg:p.pink,bold:!0},character:{fg:p.teal},comment:{fg:p.overlay1,italic:!0},number:{fg:p.peach},boolean:{fg:p.peach},constant:{fg:p.peach},"constant.builtin":{fg:p.peach},function:{fg:p.blue},"function.call":{fg:p.blue},"function.method":{fg:p.blue},"function.method.call":{fg:p.blue},"function.builtin":{fg:p.blue},"function.macro":{fg:p.teal},type:{fg:p.yellow},"type.builtin":{fg:p.yellow},constructor:{fg:p.yellow},attribute:{fg:p.yellow},tag:{fg:p.lavender},variable:{fg:p.text},"variable.builtin":{fg:p.red},"variable.parameter":{fg:p.maroon,italic:!0},"variable.member":{fg:p.text},property:{fg:p.lavender},operator:{fg:p.sky},punctuation:{fg:p.overlay2},"punctuation.bracket":{fg:p.overlay2},"punctuation.delimiter":{fg:p.overlay2},label:{fg:p.sapphire}}}}const CATPPUCCIN_MOCHA=catppuccinTheme("catppuccin-mocha","Catppuccin Mocha",MOCHA),CATPPUCCIN_MACCHIATO=catppuccinTheme("catppuccin-macchiato","Catppuccin Macchiato",MACCHIATO),CATPPUCCIN_FRAPPE=catppuccinTheme("catppuccin-frappe","Catppuccin Frappé",FRAPPE),CATPPUCCIN_LATTE=catppuccinTheme("catppuccin-latte","Catppuccin Latte (light)",LATTE),c={cumin:"#BF976F",sriracha:"#EB4268",coral:"#FF577D",salmon:"#FF7F90",cheeky:"#FF79D0",dolly:"#FF60FF",pony:"#FF4FBF",mauve:"#D46EFF",hazy:"#8B75FF",charple:"#6B50FF",guppy:"#7272FF",malibu:"#00A4FF",zinc:"#10B1AE",guac:"#12C78F",julep:"#00FFB2",bok:"#68FFD6",zest:"#E8FE96",pepper:"#201F26",bbq:"#2D2C35",charcoal:"#3A3943",oyster:"#605F6B",squid:"#858392",smoke:"#BFBCC8",salt:"#F1EFEF",butter:"#FFFAF1"};function crushTheme(){return{id:"crush",label:"Crush (Pantera)",colors:{brand:c.charple,accent:c.bok,model:c.malibu,warn:c.julep,money:c.zest,error:c.sriracha,dim:c.smoke,mute:c.oyster,border:c.charcoal,borderActive:c.charple,throbber:{from:c.charple,to:c.dolly}},select:{backgroundColor:"transparent",focusedBackgroundColor:"transparent",selectedBackgroundColor:"transparent",selectedTextColor:c.charple,textColor:c.smoke,descriptionColor:c.oyster,selectedDescriptionColor:c.squid},surfaces:{background:c.pepper,modal:c.bbq,chips:{default:{bg:c.charple,fg:c.butter},skills:{bg:c.charple,fg:c.butter},files:{bg:c.malibu,fg:c.butter}},selection:c.charcoal,diff:{addBg:"#2b322a",removeBg:"#312929",addContentBg:"#323931",removeContentBg:"#383030",addFg:"#629657",removeFg:"#a45c59"}},syntax:{default:{fg:c.smoke},"markup.heading":{fg:c.malibu,bold:!0},"markup.heading.1":{fg:c.butter,bg:c.charple,bold:!0},"markup.heading.2":{fg:c.malibu,bold:!0},"markup.heading.3":{fg:c.malibu,bold:!0},"markup.bold":{fg:c.smoke,bold:!0},"markup.strong":{fg:c.smoke,bold:!0},"markup.italic":{fg:c.smoke,italic:!0},"markup.link":{fg:c.guac,bold:!0},"markup.link.url":{fg:c.zinc,underline:!0},"markup.list":{fg:c.smoke},"markup.raw":{fg:c.coral,bg:c.charcoal},"markup.raw.block":{fg:c.coral,bg:c.charcoal},"markup.quote":{fg:c.smoke},keyword:{fg:c.malibu},"keyword.import":{fg:c.pony},"keyword.operator":{fg:c.salmon},string:{fg:c.cumin},"string.escape":{fg:c.bok},character:{fg:c.cumin},comment:{fg:c.oyster,italic:!0},number:{fg:c.julep},boolean:{fg:c.julep},constant:{fg:c.julep},"constant.builtin":{fg:c.julep},function:{fg:c.guac},"function.call":{fg:c.guac},"function.method":{fg:c.guac},"function.method.call":{fg:c.guac},"function.builtin":{fg:c.cheeky},"function.macro":{fg:c.bok},type:{fg:c.guppy},"type.builtin":{fg:c.guppy},constructor:{fg:c.salt,bold:!0},attribute:{fg:c.hazy},tag:{fg:c.mauve},variable:{fg:c.smoke},"variable.builtin":{fg:c.cheeky},"variable.parameter":{fg:c.smoke,italic:!0},"variable.member":{fg:c.smoke},property:{fg:c.smoke},operator:{fg:c.salmon},punctuation:{fg:c.squid},"punctuation.bracket":{fg:c.squid},"punctuation.delimiter":{fg:c.squid},label:{fg:c.malibu}}}}const CRUSH_THEME=crushTheme(),DARK={dark:!0,bg0:"#282828",bg1:"#3c3836",bg2:"#504945",bg4:"#7c6f64",fg0:"#fbf1c7",fg1:"#ebdbb2",fg2:"#d5c4a1",fg3:"#bdae93",fg4:"#a89984",red:"#fb4934",green:"#b8bb26",yellow:"#fabd2f",blue:"#83a598",purple:"#d3869b",aqua:"#8ec07c",orange:"#fe8019",gray:"#928374"},LIGHT={dark:!1,bg0:"#fbf1c7",bg1:"#ebdbb2",bg2:"#d5c4a1",bg4:"#a89984",fg0:"#282828",fg1:"#3c3836",fg2:"#504945",fg3:"#665c54",fg4:"#7c6f64",red:"#cc241d",green:"#98971a",yellow:"#d79921",blue:"#458588",purple:"#b16286",aqua:"#689d6a",orange:"#d65d0e",gray:"#928374"};function gruvboxTheme(id,label,p){return{id,label,colors:{brand:p.yellow,accent:p.green,model:p.blue,warn:p.orange,error:p.red,dim:p.fg3,mute:p.gray,border:p.bg2,borderActive:p.bg4,throbber:{from:p.yellow,to:p.orange},money:p.yellow},select:{backgroundColor:"transparent",focusedBackgroundColor:"transparent",selectedBackgroundColor:"transparent",selectedTextColor:p.yellow,textColor:p.fg2,descriptionColor:p.fg4,selectedDescriptionColor:p.fg3},surfaces:{background:p.dark?"#1d2021":"#f9f5d7",modal:p.bg0,chips:{default:{bg:p.yellow,fg:p.dark?p.bg0:p.fg0},skills:{bg:p.yellow,fg:p.dark?p.bg0:p.fg0},files:{bg:p.blue,fg:p.dark?p.bg0:"#fbf1c7"}},selection:p.bg1,diff:{addBg:p.bg1,removeBg:p.bg1,addContentBg:p.bg2,removeContentBg:p.bg2,addFg:p.green,removeFg:p.red}},syntax:{default:{fg:p.fg1},"markup.heading":{fg:p.yellow,bold:!0},"markup.heading.1":{fg:p.yellow,bold:!0},"markup.heading.2":{fg:p.orange,bold:!0},"markup.heading.3":{fg:p.blue,bold:!0},"markup.bold":{fg:p.fg0,bold:!0},"markup.strong":{fg:p.fg0,bold:!0},"markup.italic":{fg:p.fg1,italic:!0},"markup.link":{fg:p.blue,underline:!0},"markup.link.url":{fg:p.blue,underline:!0},"markup.list":{fg:p.orange},"markup.raw":{fg:p.green},"markup.raw.block":{fg:p.green},"markup.quote":{fg:p.fg4,italic:!0},keyword:{fg:p.red,bold:!0},"keyword.import":{fg:p.red,bold:!0},"keyword.operator":{fg:p.orange},string:{fg:p.green},"string.escape":{fg:p.orange,bold:!0},character:{fg:p.aqua},comment:{fg:p.gray,italic:!0},number:{fg:p.purple},boolean:{fg:p.purple},constant:{fg:p.purple},"constant.builtin":{fg:p.purple},function:{fg:p.blue},"function.call":{fg:p.blue},"function.method":{fg:p.blue},"function.method.call":{fg:p.blue},"function.builtin":{fg:p.blue},"function.macro":{fg:p.aqua},type:{fg:p.yellow},"type.builtin":{fg:p.yellow},constructor:{fg:p.yellow},attribute:{fg:p.aqua},tag:{fg:p.aqua},variable:{fg:p.fg1},"variable.builtin":{fg:p.red},"variable.parameter":{fg:p.orange,italic:!0},"variable.member":{fg:p.fg1},property:{fg:p.blue},operator:{fg:p.orange},punctuation:{fg:p.fg4},"punctuation.bracket":{fg:p.fg2},"punctuation.delimiter":{fg:p.fg4},label:{fg:p.aqua}}}}const GRUVBOX_DARK=gruvboxTheme("gruvbox-dark","Gruvbox Dark",DARK),GRUVBOX_LIGHT=gruvboxTheme("gruvbox-light","Gruvbox Light",LIGHT),TEXT="#1f2328",DIM="#656d76",MUTE="#8c959f",BORDER="#d0d7de",BORDER_ACTIVE="#0969da",BRAND="#0969da",ACCENT="#1a7f37",MODEL="#0550ae",WARN="#9a6700",ERROR="#d1242f",LIGHT_THEME={id:"light",label:"Light",colors:{brand:BRAND,accent:ACCENT,model:MODEL,warn:WARN,error:ERROR,dim:DIM,mute:MUTE,border:BORDER,borderActive:BORDER_ACTIVE,throbber:{from:BRAND,to:MODEL}},select:{backgroundColor:"transparent",focusedBackgroundColor:"transparent",selectedBackgroundColor:"transparent",selectedTextColor:BRAND,textColor:TEXT,descriptionColor:MUTE,selectedDescriptionColor:DIM},surfaces:{background:"#ffffff",modal:"#f6f8fa",chips:{default:{bg:BRAND,fg:"#ffffff"},skills:{bg:BRAND,fg:"#ffffff"},files:{bg:"#ddf4ff",fg:"#0550ae"}},selection:"#eceef1",diff:{addBg:"#dafbe1",removeBg:"#ffebe9",addContentBg:"#aceebb",removeContentBg:"#ffcecb",addFg:ACCENT,removeFg:ERROR}},syntax:{default:{fg:TEXT},"markup.heading":{fg:BRAND,bold:!0},"markup.heading.1":{fg:BRAND,bold:!0},"markup.heading.2":{fg:MODEL,bold:!0},"markup.heading.3":{fg:TEXT,bold:!0},"markup.bold":{fg:TEXT,bold:!0},"markup.strong":{fg:TEXT,bold:!0},"markup.italic":{fg:TEXT,italic:!0},"markup.link":{fg:BRAND,underline:!0},"markup.link.url":{fg:BRAND,underline:!0},"markup.list":{fg:"#953800"},"markup.raw":{fg:"#953800"},"markup.raw.block":{fg:"#953800"},"markup.quote":{fg:DIM,italic:!0},keyword:{fg:"#cf222e",bold:!0},"keyword.import":{fg:"#cf222e",bold:!0},"keyword.operator":{fg:"#cf222e"},string:{fg:"#0a3069"},"string.escape":{fg:"#0a3069",bold:!0},character:{fg:"#0a3069"},comment:{fg:"#6e7781",italic:!0},number:{fg:"#0550ae"},boolean:{fg:"#0550ae"},constant:{fg:"#0550ae"},"constant.builtin":{fg:"#0550ae"},function:{fg:"#8250df"},"function.call":{fg:"#8250df"},"function.method":{fg:"#8250df"},"function.method.call":{fg:"#8250df"},"function.builtin":{fg:"#8250df"},"function.macro":{fg:"#8250df"},type:{fg:"#953800"},"type.builtin":{fg:"#953800"},constructor:{fg:"#953800"},attribute:{fg:"#0550ae"},tag:{fg:"#116329"},variable:{fg:TEXT},"variable.builtin":{fg:"#0550ae"},"variable.parameter":{fg:"#953800"},"variable.member":{fg:"#0550ae"},property:{fg:"#0550ae"},operator:{fg:"#cf222e"},punctuation:{fg:DIM},"punctuation.bracket":{fg:TEXT},"punctuation.delimiter":{fg:TEXT},label:{fg:"#0550ae"}}},PALETTE={pink:"#E95378",pinkBright:"#FF71CE",cyan:"#01CDFE",cyanBright:"#59E1E3",blue:"#94D0FF",greenBright:"#09F7A0",yellow:"#FFFB96",red:"#F43E5C",text:"#D5D8DA",textDim:"#B7C5D3",textBright:"#EEFFFF",comment:"#BBBBBB",muted:"#6C6F93",surface:"#2E303E",panel:"#232530",bgDeep:"#1a1c26"};function vaporwaveTheme(){return{id:"vaporwave",label:"Vaporwave",colors:{brand:PALETTE.pink,accent:PALETTE.greenBright,model:PALETTE.blue,warn:PALETTE.yellow,error:PALETTE.red,dim:PALETTE.textDim,mute:PALETTE.muted,border:PALETTE.surface,borderActive:PALETTE.muted,throbber:{from:PALETTE.pink,to:PALETTE.cyan}},select:{backgroundColor:"transparent",focusedBackgroundColor:"transparent",selectedBackgroundColor:"transparent",selectedTextColor:PALETTE.pink,textColor:PALETTE.text,descriptionColor:PALETTE.muted,selectedDescriptionColor:PALETTE.text},surfaces:{background:PALETTE.bgDeep,modal:PALETTE.panel,chips:{default:{bg:PALETTE.pink,fg:PALETTE.panel},skills:{bg:PALETTE.pink,fg:PALETTE.panel},files:{bg:PALETTE.cyan,fg:PALETTE.panel}},selection:PALETTE.surface,diff:{addBg:"#1a3528",removeBg:"#3a1a23",addContentBg:"#234c39",removeContentBg:"#52232f",addFg:PALETTE.greenBright,removeFg:PALETTE.red}},syntax:{default:{fg:PALETTE.text},"markup.heading":{fg:PALETTE.pink,bold:!0},"markup.heading.1":{fg:PALETTE.pink,bold:!0},"markup.heading.2":{fg:PALETTE.pinkBright,bold:!0},"markup.heading.3":{fg:PALETTE.blue,bold:!0},"markup.bold":{fg:PALETTE.textBright,bold:!0},"markup.strong":{fg:PALETTE.textBright,bold:!0},"markup.italic":{fg:PALETTE.greenBright,italic:!0},"markup.link":{fg:PALETTE.yellow,underline:!0},"markup.link.url":{fg:PALETTE.yellow,underline:!0},"markup.list":{fg:PALETTE.textBright},"markup.raw":{fg:PALETTE.yellow},"markup.raw.block":{fg:PALETTE.yellow},"markup.quote":{fg:PALETTE.yellow,italic:!0},keyword:{fg:PALETTE.pinkBright,bold:!0},"keyword.import":{fg:PALETTE.pinkBright,bold:!0},"keyword.operator":{fg:PALETTE.comment},string:{fg:PALETTE.yellow},"string.escape":{fg:PALETTE.greenBright,bold:!0},character:{fg:PALETTE.yellow},comment:{fg:PALETTE.comment,italic:!0},number:{fg:PALETTE.textBright},boolean:{fg:PALETTE.textBright},constant:{fg:PALETTE.textBright},"constant.builtin":{fg:PALETTE.textBright},function:{fg:PALETTE.greenBright},"function.call":{fg:PALETTE.greenBright},"function.method":{fg:PALETTE.greenBright},"function.method.call":{fg:PALETTE.greenBright},"function.builtin":{fg:PALETTE.greenBright},"function.macro":{fg:PALETTE.greenBright},type:{fg:PALETTE.greenBright},"type.builtin":{fg:PALETTE.greenBright},constructor:{fg:PALETTE.greenBright},attribute:{fg:PALETTE.yellow},tag:{fg:PALETTE.blue},variable:{fg:PALETTE.blue},"variable.builtin":{fg:PALETTE.cyanBright},"variable.parameter":{fg:PALETTE.text},"variable.member":{fg:PALETTE.blue},property:{fg:PALETTE.blue},operator:{fg:PALETTE.comment},punctuation:{fg:PALETTE.comment},"punctuation.bracket":{fg:PALETTE.textBright},"punctuation.delimiter":{fg:PALETTE.comment},label:{fg:PALETTE.cyan}}}}const VAPORWAVE_THEME=vaporwaveTheme(),DEFAULT_COLORS={brand:"#2ba6ff",accent:"#22c55e",model:"#8adaff",warn:"#53c4ff",error:"#ef4444",dim:"#a3a3ac",mute:"#525258",border:"#3c3c41",borderActive:"#1488fc",throbber:{from:"#2ba6ff",to:"#8adaff"}};function defaultTheme(){return{id:"default",label:"Default",colors:DEFAULT_COLORS,select:{backgroundColor:"transparent",focusedBackgroundColor:"transparent",selectedBackgroundColor:"transparent",selectedTextColor:DEFAULT_COLORS.brand,textColor:DEFAULT_COLORS.dim,descriptionColor:DEFAULT_COLORS.mute,selectedDescriptionColor:DEFAULT_COLORS.dim},surfaces:{background:"#0a0a0c",modal:"#111114",chips:{default:{bg:DEFAULT_COLORS.brand,fg:"#eef9ff"},skills:{bg:DEFAULT_COLORS.brand,fg:"#eef9ff"},files:{bg:"#8adaff",fg:"#122f59"}},selection:"#1c1c21",diff:{addBg:"#0e2218",removeBg:"#2a1414",addContentBg:"#143728",removeContentBg:"#3d1d1d",addFg:"#22c55e",removeFg:"#ef4444"}},syntax:{default:{fg:"#fefeff"},"markup.heading":{fg:"#2ba6ff",bold:!0},"markup.heading.1":{fg:"#2ba6ff",bold:!0},"markup.heading.2":{fg:"#53c4ff",bold:!0},"markup.heading.3":{fg:"#8adaff",bold:!0},"markup.bold":{fg:"#ffffff",bold:!0},"markup.strong":{fg:"#ffffff",bold:!0},"markup.italic":{fg:"#fefeff",italic:!0},"markup.link":{fg:DEFAULT_COLORS.model,underline:!0},"markup.link.url":{fg:DEFAULT_COLORS.model,underline:!0},"markup.list":{fg:"#fb923c"},"markup.raw":{fg:"#bae7ff"},"markup.raw.block":{fg:"#bae7ff"},"markup.quote":{fg:DEFAULT_COLORS.dim,italic:!0},keyword:{fg:"#f87171",bold:!0},"keyword.import":{fg:"#f87171",bold:!0},"keyword.operator":{fg:"#f87171"},string:{fg:"#bae7ff"},"string.escape":{fg:"#bae7ff",bold:!0},character:{fg:"#bae7ff"},comment:{fg:"#73737b",italic:!0},number:{fg:"#8adaff"},boolean:{fg:"#8adaff"},constant:{fg:"#8adaff"},"constant.builtin":{fg:"#8adaff"},function:{fg:"#86efac"},"function.call":{fg:"#86efac"},"function.method":{fg:"#86efac"},"function.method.call":{fg:"#86efac"},"function.builtin":{fg:"#86efac"},"function.macro":{fg:"#86efac"},type:{fg:"#fb923c"},"type.builtin":{fg:"#fb923c"},constructor:{fg:"#fb923c"},attribute:{fg:"#fb923c"},tag:{fg:"#4ade80"},variable:{fg:"#fefeff"},"variable.builtin":{fg:"#8adaff"},"variable.parameter":{fg:"#fb923c"},"variable.member":{fg:"#8adaff"},property:{fg:"#8adaff"},operator:{fg:"#f87171"},punctuation:{fg:DEFAULT_COLORS.mute},"punctuation.bracket":{fg:"#fefeff"},"punctuation.delimiter":{fg:"#d4d4dd"},label:{fg:"#8adaff"}}}}const DEFAULT_THEME=defaultTheme(),BUILTIN_THEMES=themesById([DEFAULT_THEME,LIGHT_THEME,CATPPUCCIN_MOCHA,CATPPUCCIN_MACCHIATO,CATPPUCCIN_FRAPPE,CATPPUCCIN_LATTE,GRUVBOX_DARK,GRUVBOX_LIGHT,CRUSH_THEME,VAPORWAVE_THEME]);function themesById(themes){return Object.fromEntries(themes.map(theme=>[theme.id,theme]))}const MCP_KEY_REFUSED_HINT="Check the headers in mcps.json.";function enabledMcpsWith(list,name){return list===void 0||list.includes(name)?void 0:[...list,name]}const NATIVE_EXTENSIONS_REPO="Tahul/zidane",NATIVE_EXTENSIONS=[{name:"git-flow",label:"Git flow",description:"Adds /commit, /review, /fix, /pr and /ticket. The agent writes your commits and pull requests, and reviews code with several models.",group:"workflows",needs:[{kind:"command",name:"git",why:"commits and branches"},{kind:"command",name:"gh",why:"pull requests and review comments",optional:!0}],brand:"git",icon:{gui:"i-ph-git-branch"}},{name:"goal",label:"Goal",description:"Adds /goal. The agent keeps working until the goal is done, for up to 10 runs. Esc stops it.",group:"workflows",needs:[{kind:"decisions"}],icon:{gui:"i-ph-target"}},{name:"linear",label:"Linear",description:"Shows Linear issues and projects as badges in prompts and replies, and links them to the chats that use them.",group:"integrations",needs:[{kind:"connector",id:"linear"}],brand:"linear",icon:{gui:"i-ph-ticket"}},{name:"ai-autocomplete",label:"AI autocomplete",description:"Suggests the end of your prompt as you type, from a local Ollama model. Press Tab to accept.",group:"composer",needs:[{kind:"command",name:"ollama",why:"serves the model",optional:!0},{kind:"command",name:"docker",why:"runs Ollama for you when it is not installed",optional:!0}],brand:"ollama",icon:{gui:"i-ph-sparkle"}},{name:"bolt",label:"Bolt",description:"Adds Bolt as a provider. Sign in with your Bolt account to use its models.",group:"providers",needs:[{kind:"account",label:"Bolt"}],provider:"bolt",icon:{gui:"i-ph-lightning"}}],NATIVE_EXTENSION_GROUPS=[{id:"workflows",label:"Workflows"},{id:"integrations",label:"Integrations"},{id:"composer",label:"Composer"},{id:"providers",label:"Providers"}];function nativeExtensionByName(name){return NATIVE_EXTENSIONS.find(entry=>entry.name===name)}function nativeExtensionSource(entry,version){return`${NATIVE_EXTENSIONS_REPO}#v${version.replace(/^v/,"")}:extensions/${entry.name}`}const DEFAULT_EXTENSION_SOURCE=NATIVE_EXTENSIONS_REPO,DEFAULT_EXTENSION_SOURCE_UNREACHABLE=`${NATIVE_EXTENSIONS_REPO} is private or out of reach. You need access to install from it.`,PROVIDER_BRANDS={anthropic:"anthropic",arcee:"arcee",baseten:"baseten",cerebras:"cerebras",openai:"openai",xai:"xai",zai:"zai",google:"googlegemini","google-vertex":"googlecloud",openrouter:"openrouter",mistral:"mistralai",cursor:"cursor"},ONBOARDING_AGENT_BRANDS={"claude-code":"claudecode",codex:"codex",pi:void 0},LOCAL_SERVER_BRANDS={ollama:"ollama","lm-studio":"lmstudio",vllm:"vllm"};function providerBrand(key){return PROVIDER_BRANDS[key]}const USAGE_RANGES=["all","30d","7d"],TRANSCRIPT_PRESET_KEYS=["transcriptDensity","showRowIcons","showThinking","thinkingAutoExpand","toolCallDisplay","showToolResults","groupToolCalls","showEditDiffs","editDiffDisplay","showRunReceipt","showToolAttachments","hideSubagentOutput","showCacheNotices","showFullShellOutput","showCompactionSummary"];function presetValues(settings){return Object.fromEntries(TRANSCRIPT_PRESET_KEYS.map(key=>[key,settings[key]]))}const TRANSCRIPT_PRESETS=buildTranscriptPresets();function buildTranscriptPresets(){const BALANCED=presetValues(DEFAULT_SETTINGS);return[{id:"focused",label:"Focused",description:"Shows the answers. The work shows as one short row. Thinking and run costs are hidden.",settings:{...BALANCED,transcriptDensity:"compact",showRowIcons:!1,showThinking:!1,thinkingAutoExpand:!1,groupToolCalls:!0,editDiffDisplay:"compact",showRunReceipt:!1,showToolAttachments:!1,hideSubagentOutput:!0,showCacheNotices:!1,showFullShellOutput:!1,showCompactionSummary:!1}},{id:"balanced",label:"Balanced",description:"Shows the answers, one short row for the work, diffs and the cost of each run. The default.",settings:BALANCED},{id:"detailed",label:"Detailed",description:"Shows every step and its output, with thinking open and full diffs.",settings:{...BALANCED,transcriptDensity:"full",showRowIcons:!0,showThinking:!0,thinkingAutoExpand:!0,groupToolCalls:!1,editDiffDisplay:"full",showRunReceipt:!0,showToolAttachments:!0,hideSubagentOutput:!1,showCacheNotices:!0,showFullShellOutput:!0,showCompactionSummary:!0}}]}function transcriptPreset(id){return TRANSCRIPT_PRESETS.find(preset=>preset.id===id)}function transcriptPresetOf(settings){const value=key=>settings[key]??DEFAULT_SETTINGS[key];return TRANSCRIPT_PRESETS.find(preset=>TRANSCRIPT_PRESET_KEYS.every(key=>value(key)===preset.settings[key]))?.id??"custom"}const TRANSCRIPT_PRESET_PALETTE_ID="setting:conversation-preset",PALETTE_CHOICE=`${TRANSCRIPT_PRESET_PALETTE_ID}:`,PALETTE_TITLE="Conversation preset";function transcriptPresetPaletteItem(settings,source){const current=transcriptPresetOf(settings);return{id:TRANSCRIPT_PRESET_PALETTE_ID,title:PALETTE_TITLE,description:current==="custom"?"Custom":transcriptPreset(current).label,group:"Settings",kind:"picker",icon:{gui:"i-ph-chats-circle"},keywords:["conversation","transcript","output","focused","balanced","detailed","thinking","tool calls"],source}}function transcriptPresetPalettePicker(settings,source){const current=transcriptPresetOf(settings);return{kind:"items",title:PALETTE_TITLE,items:TRANSCRIPT_PRESETS.map(preset=>({id:`${PALETTE_CHOICE}${preset.id}`,title:preset.label,description:preset.description,group:PALETTE_TITLE,kind:"toggle",checked:current===preset.id,source}))}}function transcriptPresetOfPaletteItem(itemId){if(!itemId.startsWith(PALETTE_CHOICE))return;const id=itemId.slice(PALETTE_CHOICE.length);return TRANSCRIPT_PRESETS.find(preset=>preset.id===id)?.id}function transcriptPresetNotice(id){return`${PALETTE_TITLE}: ${transcriptPreset(id).label}`}const ONBOARDING_STEPS=[{id:"welcome",scope:"none",label:"Welcome",title:"Set up zidane",lede:"This takes about two minutes. You can change every choice later in Settings."},{id:"connect",scope:"shared",label:"Connect",title:"Choose an AI provider",lede:"The provider runs the model that answers you. Your keys stay on this computer, in a file that only you can read."},{id:"import",scope:"shared",label:"Bring your setup",title:"Use your setup from other agents",lede:"zidane copies what you pick. It does not change the files of the other agent."},{id:"connectors",scope:"shared",label:"Connectors",title:"Connect your tools",lede:"The agent can read and change data in these services. Most of them ask you to sign in through your browser."},{id:"skills",scope:"shared",label:"Skills",title:"Teach zidane how you work",lede:"A skill is a folder of instructions. The agent reads one when a task needs it."},{id:"extensions",scope:"shared",label:"Extensions",title:"Add extensions",lede:"Extensions add commands and features. zidane installs them for you from its repository."},{id:"look",scope:"surface",label:"Look",title:"Choose how zidane looks",lede:"The preview shows each choice at once."},{id:"sidebar",scope:"surface",label:"Sidebar",title:"How should the sidebar list your sessions?",lede:"Each space can pick its own later, in its filter menu."},{id:"conversation",scope:"shared",label:"Conversation",title:"How much detail do you want to see?",lede:"Pick a preset. The preview shows a sample conversation with it. Then pick what happens to a message that you send while the agent works."},{id:"autonomy",scope:"shared",label:"Autonomy",title:"What can zidane do without asking?",lede:"Commands in your safelist always run, whatever you pick. Your safelist holds the commands that you allowed with Always allow."},{id:"features",scope:"shared",label:"Features",title:"Turn on what you want",lede:"You can change these, and more, in Settings."},{id:"ready",scope:"none",label:"Ready",title:"You are ready",lede:"Type a task and press Enter to start."}],STEP_ORDER=stepIds();function stepIds(){return ONBOARDING_STEPS.map(step=>step.id)}function planOnboarding(ctx){const applies=id=>ctx.exclude?.includes(id)?!1:id==="import"?ctx.importAvailable:id==="connectors"||id==="skills"||id==="extensions"?ctx.installsAvailable:id==="sidebar"?ctx.surface!=="tui":!0;switch(ctx.mode){case"full":return STEP_ORDER.filter(applies);case"rerun":return STEP_ORDER.filter(id=>id!=="welcome"&&applies(id));case"quick":return["welcome","connect","import","ready"].filter(applies);case"extras":return["look","sidebar","features","ready"].filter(applies);case"connect":return["connect"]}}const SETUP_PALETTE_ITEM={id:"app:setup",title:"Run setup",description:"Open the setup wizard: provider, connectors, skills, extensions, look, conversation, autonomy and features.",keywords:["setup","onboarding","wizard","welcome","get started","provider","theme","connectors","skills","extensions"]},ALL=["tui","desktop","web"],APPS=["desktop","web"],DESKTOP$1=["desktop"],TUI=["tui"],TUI_DESKTOP=["tui","desktop"],APPROVAL_MODE_OPTIONS=[{value:"ask",label:"Ask me",description:"Ask you before each tool call, except commands you safelisted."},{value:"decide",label:"Let a model decide",badges:["usesTokens"],description:"The decision model, a small helper model, allows safe calls and blocks risky ones. When it is not sure, it asks you."},{value:"off",label:"Allow everything",description:"Run every tool call without asking. The agent still asks before it types into your terminals.",note:{tone:"warn",text:"Turn on the sandbox, or work in a folder that you can throw away."}}],MESSAGE_DELIVERY_OPTIONS=[{value:"steer",label:"Steer the run",description:"Your message goes into the run. The agent reads it after its current step and changes course."},{value:"queue",label:"Wait for the run",description:"Your message waits in a queue. zidane sends it when the run ends."}],DURABILITY_OPTIONS=[{value:"resume-ask",label:"Ask before resuming",description:"Keep a checkpoint, and ask you before an interrupted run continues."},{value:"on",label:"Resume by itself",description:"Keep a checkpoint, and continue an interrupted run by itself."},{value:"off",label:"Off",description:"Keep no checkpoint. The next run tells the agent which tool calls stopped."}],SETTINGS_ROWS_SETUP=[{kind:"toggle",key:"resumeLastSession",page:"general",section:"start",label:"Reopen the last session",description:"When zidane starts, open the last session. Off: open the sessions list.",surfaces:TUI,scope:"window"},{kind:"toggle",key:"showAllProjects",page:"general",section:"start",label:"Show sessions from all projects",description:"List sessions from every project. Off: list this project's sessions only.",surfaces:TUI,scope:"window"},{kind:"toggle",key:"autoArchiveMergedSessions",page:"general",section:"start",label:"Archive sessions when their pull requests merge",description:"Archive a session once every pull request it opened or linked is merged.",surfaces:ALL,scope:"host"},{kind:"action",id:"claude-import",page:"general",section:"start",label:"Import from Claude Code",description:"Copy sessions, MCP servers and skills from ~/.claude.",surfaces:ALL,scope:"host"},{kind:"action",id:"run-setup",page:"general",section:"start",label:"Run setup again",description:"Open the setup wizard: provider, connectors, extensions, look, conversation, autonomy and features.",surfaces:TUI,scope:"window"},{kind:"toggle",key:"notifications",page:"general",section:"notifications",label:"Notify me",description:"When no zidane window is in front, notify you when a run ends or needs you.",surfaces:APPS,scope:"window",keywords:["notification","notify","alert","badge","banner"],demo:"notifications"},{kind:"toggle",key:"notificationSound",page:"general",section:"notifications",parent:"notifications",label:"Play a notification sound",description:"Play the system sound with each notification.",surfaces:APPS,scope:"window",keywords:["notification","sound","chime","beep"]},{kind:"toggle",key:"checkForUpdates",page:"general",section:"updates",label:"Check for updates",description:"Check daily for a new version and show it in the footer.",surfaces:TUI_DESKTOP,scope:"window",localOnly:!0,demo:"checkForUpdates"},{kind:"toggle",key:"autoInstallUpdates",page:"general",section:"updates",requires:"checkForUpdates",parent:"checkForUpdates",label:"Install updates automatically",description:"Install new versions in the background. The new version runs after you restart.",surfaces:TUI_DESKTOP,scope:"window",localOnly:!0},{kind:"toggle",key:"spaces",page:"spaces",section:"spaces",label:"Group sessions into spaces",description:"Sort sessions into spaces, like Personal and Work. Each space has its own default model.",surfaces:TUI,scope:"window",demo:"spaces"},{kind:"custom",id:"agentDefaults",page:"models",section:"defaults",label:"Defaults for new sessions",description:"The agent, model and effort new sessions start with.",surfaces:APPS,scope:"window",localOnly:!0,search:[{label:"Default agent",description:"The agent new sessions start on.",key:"agentDefaults",keywords:["build","plan","mode","profile"]},{label:"Default model",description:"The model new sessions start on.",key:"agentDefaults",keywords:["opus","sonnet","gpt"]},{label:"Effort and options",description:"The effort and options new sessions start with.",key:"agentDefaults",keywords:["reasoning","thinking","fast"]}]},{kind:"custom",id:"textModel",page:"models",section:"helpers",label:"Text model",description:"The model that writes titles, commit messages and other short text.",surfaces:APPS,scope:"host",display:{apps:"menu"},search:[{label:"Text model",description:"The model that writes titles, commit messages and other short text.",key:"textModel",keywords:["title","commit message","helper"]}]},{kind:"toggle",key:"decisions",page:"models",section:"helpers",label:"Let hooks ask the decision model",description:"Hooks and extensions can ask the decision model, a small helper model, for quick yes or no, choice and score answers.",surfaces:ALL,scope:"host",badges:["usesTokens"]},{kind:"custom",id:"decisionModel",page:"models",section:"helpers",parent:"decisions",label:"Decision model",description:"The small model that answers yes or no, choice and score questions. It needs an OpenRouter key or an OpenAI platform key.",surfaces:ALL,scope:"host",display:{apps:"menu",tui:"picker"},search:[{label:"Decision model",description:"The small model that answers yes or no, choice and score questions.",key:"decisionModel",keywords:["helper","yes no"]}]},{kind:"action",id:"decision-model-test",page:"models",section:"helpers",parent:"decisions",label:"Test the decision model",description:"Send one small decision to the decision model to check that it works.",surfaces:TUI,scope:"host"},{kind:"custom",id:"compactionModel",page:"models",section:"helpers",label:"Compaction model",description:"The model that writes compaction summaries. By default, the session's model.",surfaces:ALL,scope:"host",display:{apps:"menu",tui:"picker"},search:[{label:"Compaction model",description:"The model that writes compaction summaries. By default, the session's model.",key:"compactionModel",keywords:["compact","summarize"]}]},{kind:"toggle",key:"subagentModels",page:"models",section:"subagents",label:"Let subagents use cheaper models",description:"The agent can give tasks to subagents that run on cheaper models.",surfaces:ALL,scope:"host"},{kind:"choice",key:"maxParallelSubagents",page:"models",section:"subagents",label:"Subagents at once",description:"How many subagents a session runs at the same time. Extra subagents wait for a free slot.",surfaces:ALL,scope:"host",keywords:["concurrency","concurrent","simultaneous","spawn","sub-agents","parallel"],options:[{value:1,label:"1"},{value:2,label:"2"},{value:3,label:"3"},{value:5,label:"5"},{value:10,label:"10"},{value:0,label:"Unlimited"}]},{kind:"toggle",key:"webSearch",page:"agent",section:"tools",label:"Let the agent search the web",description:"The agent can search the web for docs, errors and recent changes.",surfaces:ALL,scope:"host",demo:"webSearch"},{kind:"toggle",key:"imageGeneration",page:"agent",section:"tools",label:"Let the agent make images",description:"The agent can make images with your providers' image models.",surfaces:ALL,scope:"host",badges:["usesTokens"]},{kind:"toggle",key:"codemode",page:"agent",section:"tools",label:"Run tool calls as scripts",description:"The agent runs several tool calls at once in one short script, inside a sandbox. This saves steps and tokens. Off: one tool call per step.",surfaces:ALL,scope:"host",badges:["experimental"],keywords:["codemode","script","batch"],demo:"codemode"},{kind:"toggle",key:"codemodeShowCalls",page:"agent",section:"tools",requires:"codemode",parent:"codemode",label:"Show the calls inside scripts",description:"List each call a script makes under the script. Calls that start a subagent always show.",surfaces:ALL,scope:"host",keywords:["codemode"]},{kind:"toggle",key:"codemodeStreamProgress",page:"agent",section:"tools",requires:"codemode",parent:"codemode",label:"Show script progress live",description:"While a script runs, show its current line, how many calls are done, and what it prints.",surfaces:ALL,scope:"host",keywords:["codemode","stream","progress"]},{kind:"toggle",key:"schedules",page:"agent",section:"automations",label:"Allow reminders",description:"Send a prompt to a session at a set time, once or on a repeat. Extensions can set reminders too.",surfaces:ALL,scope:"host",keywords:["reminder","remind","cron","schedule","timer","recurring"],demo:"schedules"},{kind:"toggle",key:"schedulesAgent",page:"agent",section:"automations",parent:"schedules",label:"Let the agent set reminders",description:'The agent can schedule a prompt to its own session, such as "check the CI in 20 minutes".',surfaces:ALL,scope:"host",keywords:["reminder","remind","cron","schedule","agent"]},{kind:"toggle",key:"autoTitle",page:"agent",section:"automations",requires:"decisions",label:"Title sessions automatically",description:"Title a session after its first run, and rename it when the topic changes. Titles you typed stay.",surfaces:ALL,scope:"host",badges:["usesTokens"],demo:"autoTitle"},{kind:"toggle",key:"runEstimates",page:"agent",section:"automations",requires:"decisions",label:"Estimate time left",description:"Show how long running sessions and subagents have left. The decision model guesses when each run starts.",surfaces:APPS,scope:"host",badges:["usesTokens"],keywords:["estimate","eta","time left","remaining","duration","countdown"],demo:"runEstimates"},{kind:"toggle",key:"promptSuggestions",page:"agent",section:"automations",label:"Suggest the next prompt",description:"After a run, suggest a next message in the empty composer. The text model writes it.",surfaces:APPS,scope:"host",badges:["experimental","usesTokens"],keywords:["suggestion","next prompt","follow-up"]},{kind:"toggle",key:"orchestration",page:"agent",section:"automations",requires:"useDaemon",label:"Use a main session",description:"Pin one session that can start, steer and read your other sessions. Needs the background service.",surfaces:ALL,scope:"host",badges:["experimental"],keywords:["orchestrator","main session","daemon"]},{kind:"toggle",key:"autoCompact",page:"agent",section:"sessions",label:"Compact long sessions",description:"When the context passes the threshold below, zidane compacts the session so it can go on.",surfaces:ALL,scope:"host",keywords:["compact","summarize","context window","auto-compact"],demo:"autoCompact"},{kind:"choice",key:"autoCompactThreshold",page:"agent",section:"sessions",parent:"autoCompact",label:"Compact at",description:"How full the model's context gets before zidane compacts the session.",surfaces:ALL,scope:"host",keywords:["compact","summarize","context window","threshold"],options:[{value:.6,label:"60%"},{value:.7,label:"70%"},{value:.8,label:"80%"},{value:.9,label:"90%"}]},{kind:"choice",key:"autoCompactMaxTokens",page:"agent",section:"sessions",parent:"autoCompact",label:"Compact after",description:"Compact once the context reaches this many tokens, even below the threshold. Each step reads the whole context again, so a lower limit costs less.",surfaces:ALL,scope:"host",keywords:["compact","summarize","context window","tokens","cost","limit"],options:[{value:0,label:"No limit"},{value:2e5,label:"200K tokens"},{value:35e4,label:"350K tokens"},{value:5e5,label:"500K tokens"}]},{kind:"toggle",key:"backgroundCompaction",page:"agent",section:"sessions",parent:"autoCompact",label:"Prepare summaries early",description:"zidane writes the summary before it is needed, so the session does not pause when it compacts. A summary that is not used still costs tokens.",surfaces:ALL,scope:"host",badges:["experimental","usesTokens"],keywords:["compact","summarize","background"]},{kind:"toggle",key:"compactBeforeCacheExpiry",page:"agent",section:"sessions",label:"Compact idle sessions before the cache expires",description:"When a long session is idle, zidane compacts it one minute before the provider's cache expires. Your next message then costs less.",surfaces:ALL,scope:"host",badges:["usesTokens"],keywords:["compact","prompt cache","idle"]},{kind:"choice",key:"durability",page:"agent",section:"sessions",label:"Crash recovery",description:"Save a checkpoint of each run so it can go on after a crash. Needs the SQLite session store.",surfaces:ALL,scope:"host",keywords:["durable","crash","recover","resume","checkpoint","interrupted"],options:DURABILITY_OPTIONS},{kind:"choice",key:"userInstructionsScope",page:"agent",section:"instructionFiles",label:"Instruction files",description:"Which AGENTS.md and CLAUDE.md files the agent reads: yours, the project's, both, or none.",surfaces:ALL,scope:"host",keywords:["agents.md","claude.md","user instructions"],options:[{value:"both",label:"Both"},{value:"user",label:"Yours only"},{value:"project",label:"Project only"},{value:"none",label:"None"}]},{kind:"choice",key:"approvalMode",page:"safety",section:"approvals",label:"Tool approvals",description:"Who approves tool calls: you, the decision model, or nobody. Commands you safelisted always run.",surfaces:ALL,scope:"host",display:{apps:"card"},keywords:["approval","approve","permissions","ask","auto approve","yolo","safe mode","full access"],demo:"approval",options:APPROVAL_MODE_OPTIONS},{kind:"action",id:"safelist",page:"safety",section:"approvals",label:"Safelisted commands",description:"Review and remove the commands you chose to always allow, per project.",surfaces:APPS,scope:"host"},{kind:"choice",key:"interactionMode",page:"safety",section:"approvals",label:"Agent questions",description:"What the agent does when it has a question: ask you, decide from the project, or not ask at all.",surfaces:ALL,scope:"host",keywords:["questions","ask user","plan","interaction mode"],options:[{value:"ask",label:"Ask me"},{value:"skip",label:"Decide alone"},{value:"disabled",label:"No questions"}]},{kind:"toggle",key:"secrets",page:"safety",section:"approvals",label:"Let the agent ask for secrets",description:"The agent can ask you for an API key or a token. zidane keeps it in a private file for this project, out of the session and tool output.",surfaces:ALL,scope:"host",demo:"secrets"},{kind:"toggle",key:"sandbox",page:"safety",section:"sandbox",label:"Sandbox the agent's commands",description:"Keep the agent's commands and edits inside the project, and hide your credentials from them. MCP servers and commands you run with ! are not sandboxed. Applies to new sessions.",surfaces:ALL,scope:"host",display:{apps:"card"},keywords:["isolation","seatbelt","container"],demo:"sandbox"},{kind:"choice",key:"sandboxNetwork",page:"safety",section:"sandbox",parent:"sandbox",label:"Network in the sandbox",description:"Whether sandboxed commands can reach the internet. Allowed keeps installs and git working. Blocked stops every connection.",surfaces:ALL,scope:"host",display:{apps:"segmented"},options:[{value:"allow",label:"Allowed"},{value:"deny",label:"Blocked"}]},{kind:"input",key:"sandboxAllowWrite",page:"safety",section:"sandbox",parent:"sandbox",label:"Folders the sandbox can write to",description:"Extra folders that sandboxed commands can write to. Separate them with commas.",placeholder:"~/.cache, ~/.bun/install/cache",surfaces:ALL,scope:"host"},{kind:"action",id:"environments",page:"safety",section:"sandbox",label:"Environments",description:"Where new sessions run: on this computer with the OS sandbox, in a git worktree, or with a sandbox provider.",surfaces:TUI,scope:"host"},{kind:"choice",key:"maxCostUsd",page:"safety",section:"limits",label:"Cost limit per run",description:"Stop a run once its estimated cost passes this amount.",surfaces:ALL,scope:"host",keywords:["budget","spend","money","dollars","max cost"],options:[{value:0,label:"Unlimited"},{value:1,label:"$1"},{value:5,label:"$5"},{value:10,label:"$10"},{value:25,label:"$25"}]},{kind:"choice",key:"maxTotalTokens",page:"safety",section:"limits",label:"Token limit per run",description:"Stop a run once it has used this many tokens.",surfaces:ALL,scope:"host",keywords:["max tokens"],options:[{value:0,label:"Unlimited"},{value:5e5,label:"500K"},{value:1e6,label:"1M"},{value:2e6,label:"2M"},{value:5e6,label:"5M"}]},{kind:"choice",key:"maxTurns",page:"safety",section:"limits",label:"Step limit per run",description:"Stop a run after this many model calls.",surfaces:ALL,scope:"host",keywords:["max turns","turns"],options:[{value:0,label:"Unlimited"},{value:25,label:"25"},{value:50,label:"50"},{value:100,label:"100"},{value:200,label:"200"}]},{kind:"choice",key:"maxWallMinutes",page:"safety",section:"limits",label:"Time limit per run",description:"Stop a run after this much time.",surfaces:ALL,scope:"host",keywords:["max run time","duration"],options:[{value:0,label:"Unlimited"},{value:5,label:"5 min"},{value:15,label:"15 min"},{value:30,label:"30 min"},{value:60,label:"60 min"}]},{kind:"toggle",key:"loadProjectExtensions",page:"safety",section:"trust",label:"Run this project's extensions",description:"Run the extensions in this project. They can run any code on your computer.",surfaces:ALL,scope:"host",overrides:{serverDescription:"Run the extensions in this project. They can run any code on {host}."},demo:"loadProjectExtensions"},{kind:"toggle",key:"importForeignConfigs",page:"safety",section:"trust",label:"Use setups from other agents",description:"Use the MCP servers, skills, commands and subagents you set up for other agents, such as Claude Code. Their MCP servers run commands from files zidane does not own.",surfaces:ALL,scope:"host",keywords:["import","claude code","cursor","foreign"]},{kind:"toggle",key:"importRulerConfigs",page:"safety",section:"trust",label:"Read Ruler folders (.ruler)",description:'Read .ruler folders, a shared setup format for coding agents. Their MCP servers also need "Use setups from other agents".',surfaces:ALL,scope:"host",keywords:["ruler"]}],SETTINGS_ROWS_SIDEBAR=[{kind:"choice",key:"sidebarLayout",page:"sidebar",section:"layout",label:"Layout",description:"Groups puts sessions under their project. Inbox lists pinned and active sessions first, with shelves for working, snoozed, earlier and settled ones.",surfaces:APPS,scope:"window",display:{apps:"segmented"},keywords:["sidebar","inbox","groups","layout","snooze","settle","pinned","shelves"],options:[{value:"groups",label:"Groups",description:"Sessions under their project, host or date."},{value:"inbox",label:"Inbox",description:"What needs you first, the rest on shelves."}]},{kind:"choice",key:"sidebarGroupBy",page:"sidebar",section:"groups",label:"Group by",description:"How sessions group in a space that has not picked a grouping.",surfaces:APPS,scope:"window",display:{apps:"menu"},keywords:["sidebar","group","project","host","date"],options:[{value:"project",label:"Project"},{value:"host",label:"Host"},{value:"date",label:"Date"},{value:"state",label:"State"},{value:"agent",label:"Agent"},{value:"none",label:"None"}]},{kind:"choice",key:"sidebarSortBy",page:"sidebar",section:"groups",label:"Sort by",description:"How sessions sort in a space that has not picked a sort.",surfaces:ALL,scope:"window",display:{apps:"menu",tui:"cycle"},keywords:["sidebar","sort","order","recent","alphabetical"],options:[{value:"createdTime",label:"Created"},{value:"recency",label:"Last activity"},{value:"lastUserMessage",label:"Last message"},{value:"alphabetical",label:"Name"}]},{kind:"choice",key:"sidebarInboxGroupBy",page:"sidebar",section:"inbox",label:"Active sessions",description:"One list, or under their project.",surfaces:APPS,scope:"window",display:{apps:"segmented"},keywords:["sidebar","inbox","project","folder","group"],options:[{value:"none",label:"One list"},{value:"project",label:"By project"}]},{kind:"choice",key:"sidebarEarlierDays",page:"sidebar",section:"inbox",label:"Move to Earlier after",description:"A session with no activity for this long moves from the active list to the Earlier shelf.",surfaces:APPS,scope:"window",display:{apps:"segmented"},keywords:["sidebar","inbox","earlier","quiet","idle","days"],options:[{value:1,label:"1 day"},{value:3,label:"3 days"},{value:7,label:"7 days"}]},{kind:"toggle",key:"sidebarRunDetails",page:"sidebar",section:"rows",label:"Show run details in the sidebar",description:"Show each run's activity, time, commits and pull requests in the sidebar.",surfaces:DESKTOP$1,scope:"window",keywords:["sidebar","status","commits","pull requests"]},{kind:"toggle",key:"projectHome",page:"sidebar",section:"rows",label:"Open a project home",description:"Click a project in the sidebar to open its home: a new session with the project's recent sessions, usage and extension blocks.",surfaces:APPS,scope:"window",badges:["experimental"],keywords:["project","home","dashboard","blocks","usage","welcome"]}];function themeOptions(){return Object.values(BUILTIN_THEMES).map(t=>({value:t.id,label:t.label}))}const SETTINGS_ROWS_VIEW=[{kind:"custom",id:"conversationPresets",page:"conversation",section:"preset",label:"Conversation preset",description:"Set the options below in one click: Focused, Balanced or Detailed.",surfaces:APPS,scope:"window",display:{apps:"card"},search:[{label:"Conversation preset",description:"Set the options below in one click: Focused, Balanced or Detailed.",keywords:["transcript","output","focused","balanced","detailed"]}]},{kind:"choice",key:"transcriptDensity",page:"conversation",section:"messages",label:"Message detail",description:"Every step shows each step of the agent. Folded puts the work of each reply in one row.",surfaces:ALL,scope:"window",keywords:["compact","condensed","fold","classic","full","layout","density"],options:[{value:"full",label:"Every step"},{value:"compact",label:"Folded"}]},{kind:"toggle",key:"showRowIcons",page:"conversation",section:"messages",label:"Show row icons",description:"Show an icon next to each message and step.",surfaces:APPS,scope:"window",keywords:["badges","dots","avatars","gutter","timeline"]},{kind:"toggle",key:"showThinking",page:"conversation",section:"messages",label:"Show thinking",description:"Show the agent's reasoning in the session.",surfaces:ALL,scope:"window",keywords:["reasoning","thoughts"]},{kind:"toggle",key:"thinkingAutoExpand",page:"conversation",section:"messages",parent:"showThinking",label:"Expand thinking while it streams",description:"Keep a thinking block open while the agent reasons.",surfaces:APPS,scope:"window",keywords:["reasoning","thoughts","expand","open","live"]},{kind:"toggle",key:"showRunReceipt",page:"conversation",section:"messages",label:"Show a summary after each run",description:"After each run, show the agent, model, time, cost and tokens.",surfaces:ALL,scope:"window",keywords:["receipt","details","tokens","cost","stats"]},{kind:"toggle",key:"hideSubagentOutput",page:"conversation",section:"messages",label:"Collapse subagent runs",description:"Show each subagent run folded to its start and end. Open one to see the rest.",surfaces:ALL,scope:"window",keywords:["subagent","hide","collapse"]},{kind:"toggle",key:"renderDiagrams",page:"conversation",section:"messages",label:"Draw diagrams",description:"Draw Mermaid diagrams, a text format for charts, in your theme's colors. Off: show their code.",surfaces:APPS,scope:"window",keywords:["mermaid","diagram","chart","flowchart","sequence","graph"]},{kind:"toggle",key:"preserveScroll",page:"conversation",section:"messages",label:"Remember scroll position",description:"Reopen each session where you left it.",surfaces:DESKTOP$1,scope:"window",keywords:["remember","restore","switch","jump"]},{kind:"toggle",key:"transcriptRail",page:"conversation",section:"messages",label:"Message rail",description:"Show a mark for each message you sent beside the conversation. Hover one to preview it, click to scroll to it.",surfaces:APPS,scope:"window",keywords:["rail","minimap","outline","navigate","jump","scroll","messages","prompts"]},{kind:"choice",key:"toolCallDisplay",page:"conversation",section:"tools",label:"Show tool calls as",description:"Show tool calls as a summary, their full input, or not at all.",surfaces:ALL,scope:"window",options:[{value:"formatted",label:"Summary"},{value:"full",label:"Full input"},{value:"hidden",label:"Hidden"}]},{kind:"toggle",key:"showToolResults",page:"conversation",section:"tools",label:"Show tool outputs",description:"Show the output under each tool call.",surfaces:ALL,scope:"window"},{kind:"toggle",key:"groupToolCalls",page:"conversation",section:"tools",label:"Group tool calls",description:"Fold the tool calls of each reply into one row.",surfaces:ALL,scope:"window",keywords:["compact","batch","collapse","fold"]},{kind:"toggle",key:"showFullShellOutput",page:"conversation",section:"tools",label:"Show full shell output",description:"Show every line of the commands you run with !. Off: show the last 10 lines.",surfaces:ALL,scope:"window"},{kind:"toggle",key:"showEditDiffs",page:"conversation",section:"tools",label:"Show edits as diffs",description:"Show each file edit as a diff of the changed lines.",surfaces:ALL,scope:"window"},{kind:"choice",key:"editDiffDisplay",page:"conversation",section:"tools",parent:"showEditDiffs",label:"Show edits as",description:"Show each edit as a full diff or a short summary.",surfaces:TUI,scope:"window",options:[{value:"full",label:"Full diff"},{value:"compact",label:"Summary"}]},{kind:"toggle",key:"showToolAttachments",page:"conversation",section:"tools",label:"Group tool images",description:"Gather the images that tool calls return under the Working row. Only with Folded message detail.",surfaces:APPS,scope:"window"},{kind:"toggle",key:"showCacheNotices",page:"conversation",section:"notices",label:"Show cache notices",description:"Add a row when the provider's cache expires or resets, or when it drops earlier reasoning. The next call then costs more.",surfaces:ALL,scope:"window",keywords:["prompt cache","cache hit","reasoning dropped","thinking dropped"]},{kind:"toggle",key:"showCompactionSummary",page:"conversation",section:"notices",label:"Show compaction summaries",description:"Show the summary text under the compaction line.",surfaces:TUI,scope:"window",keywords:["compact","summary"]},{kind:"toggle",key:"smoothStreaming",page:"conversation",section:"motion",label:"Stream replies smoothly",description:"Reveal replies at a steady pace as they stream.",surfaces:TUI_DESKTOP,scope:"window"},{kind:"toggle",key:"showThrobber",page:"conversation",section:"motion",label:"Show a busy animation",description:"Animate an icon while the agent works.",surfaces:TUI_DESKTOP,scope:"window",keywords:["throbber","spinner"]},{kind:"toggle",key:"showTodoIndicator",page:"conversation",section:"status",label:"Show the todo count",description:"Show how many todos the agent has left, as a badge in the composer.",surfaces:ALL,scope:"window",keywords:["todo","todos","badge","indicator"],overrides:{description:{tui:"Show how many todos the agent has left, in the footer. ctrl+t opens the todo list."}}},{kind:"toggle",key:"subscriptionUsage",page:"conversation",section:"status",label:"Check plan usage",description:"Fetch plan limits and credits from the providers you signed in to, and from GitHub.",surfaces:ALL,scope:"window",keywords:["usage","limits","credits","quota"],demo:"subscriptionUsage"},{kind:"toggle",key:"showUsageIndicator",page:"conversation",section:"status",parent:"subscriptionUsage",label:"Show plan usage",description:"Show the plan usage gauge in the sidebar.",surfaces:ALL,scope:"window",keywords:["usage","gauge","indicator"],overrides:{description:{tui:"Show plan usage in the footer. ctrl+p opens the usage panel."}}},{kind:"choice",key:"uiMode",page:"conversation",section:"status",label:"Footer shortcuts",description:"Show every shortcut in the footer, or hide them until you press ctrl+y.",surfaces:TUI,scope:"window",keywords:["ui mode","minimal","footer"],options:[{value:"full",label:"Show all"},{value:"minimal",label:"Hide"}]},{kind:"choice",key:"theme",page:"appearance",section:"look",label:"Theme",description:"The colors of the app, messages and code.",surfaces:TUI,scope:"window",keywords:["color","colors","dark mode","light mode"],options:themeOptions()},{kind:"choice",key:"targetFps",page:"appearance",section:"look",label:"Frame rate",description:"How often the terminal app redraws. 30 saves power. 60 suits most screens. 120 suits fast screens.",surfaces:TUI,scope:"window",keywords:["fps","renderer"],options:[{value:30,label:"30 fps"},{value:60,label:"60 fps"},{value:120,label:"120 fps"}]},{kind:"toggle",key:"views",page:"views",section:"views",label:"Show views in replies",description:"The agent can show charts, tables and stats in its replies. The terminal app shows their code.",surfaces:APPS,scope:"host",badges:["experimental"],keywords:["view","chart","table","graph","stats","visual","widget"],demo:"views"},{kind:"toggle",key:"viewsInputs",page:"views",section:"views",requires:"views",keepsValue:!0,parent:"views",label:"Make views clickable",description:"Buttons, choices and forms in views work. A click sends a message for you. Off: views are read-only.",surfaces:APPS,scope:"host",keywords:["view","button","form","choice","click"]},{kind:"toggle",key:"viewsMcpApps",page:"views",section:"views",requires:"views",keepsValue:!0,parent:"views",label:"Show MCP Apps",description:"Show the screens that MCP servers send with their tools, such as a GitHub profile card. Off: show the tool result as text.",surfaces:APPS,scope:"host",keywords:["mcp","app","apps","ui","interface","server","mcp apps","mcp ui"]},{kind:"toggle",key:"viewsCustomCode",page:"views",section:"views",requires:"views",keepsValue:!0,parent:"views",label:"Run custom code in views",description:"Run code that the agent wrote for a view, in its own sandbox. Off: show the view's title and a short text.",surfaces:APPS,scope:"host",keywords:["view","custom","code","sandbox","script"]},{kind:"toggle",key:"viewsLiveData",page:"views",section:"views",requires:"views",parent:"views",label:"Refresh live data in views",description:"Parts of a view that come from an extension load fresh data. Off: show the data from when the agent made the view.",surfaces:APPS,scope:"host",keywords:["view","live","refresh","extension","fetch"]},{kind:"toggle",key:"viewsSave",page:"views",section:"views",requires:"views",parent:"views",label:"Save views",description:"You and the agent can save a view to keep it across sessions. Saved views show in Artifacts.",surfaces:APPS,scope:"host",keywords:["view","save","saved","keep","artifact"]},{kind:"choice",key:"viewsNetwork",page:"views",section:"views",parent:"views",label:"Network access for views",description:"Whether views can load images and data from the internet. Blocked keeps your data from leaking through a view.",surfaces:APPS,scope:"host",keywords:["view","network","images","domains","internet"],options:[{value:"blocked",label:"Blocked"},{value:"all",label:"Allowed"}]},{kind:"choice",key:"viewsMcp",page:"views",section:"views",parent:"views",label:"MCP data in views",description:"Whether views can show data from your MCP tools. Ask: you allow each tool first. Allowed tools only: only the tools in the list below.",surfaces:APPS,scope:"host",keywords:["view","mcp","tool","source","live","data"],options:[{value:"off",label:"Off"},{value:"ask",label:"Ask"},{value:"approved",label:"Allowed tools only"}]},{kind:"custom",id:"viewsMcpAllowed",page:"views",section:"views",parent:"views",label:"Tools views can use",description:'Views call these MCP tools without asking. "Always for this tool" on a view adds one.',surfaces:APPS,scope:"host",search:[{label:"Tools views can use",description:"Views call these MCP tools without asking.",key:"viewsMcpAllowed",keywords:["mcp","tool","allow","view"]}]},{kind:"choice",key:"viewsOrchestration",page:"views",section:"views",parent:"views",label:"Sessions in views",description:"Whether buttons in views can start and drive sessions. Drafts: you send each one. Approve once: you allow each view's button once. Schedules always ask.",surfaces:APPS,scope:"host",keywords:["view","session","orchestration","start","button","row","action"],options:[{value:"off",label:"Off"},{value:"read",label:"Read only"},{value:"draft",label:"Drafts"},{value:"approve",label:"Approve once"},{value:"trusted",label:"Trusted"}]},{kind:"choice",key:"messageDelivery",page:"workspace",section:"composer",label:"Messages during a run",description:"What happens to a message that you send while the agent works. alt+enter sends one message the other way.",surfaces:ALL,scope:"host",display:{apps:"segmented"},keywords:["queue","queuing","steer","steering","send while running","interrupt"],demo:"delivery",options:MESSAGE_DELIVERY_OPTIONS},{kind:"toggle",key:"attachmentsEnabled",page:"workspace",section:"composer",label:"Turn pastes into attachments",description:"Turn dropped files and long pastes into attachments. Off: paste the text into the prompt.",surfaces:ALL,scope:"host",keywords:["paste","attachment","drop"]},{kind:"toggle",key:"composerMarkdown",page:"workspace",section:"composer",label:"Format lists and code as you type",description:"Turn - and 1. into lists, backticks into code, and ``` into a code block. zidane sends them as Markdown.",surfaces:APPS,scope:"window",keywords:["markdown","list","bullet","code block","backtick","formatting"]},{kind:"toggle",key:"inlineAutocomplete",page:"workspace",section:"composer",label:"Suggest completions as you type",description:"Suggest the rest of a path or command as you type. Press tab to accept.",surfaces:ALL,scope:"window",keywords:["autocomplete","ghost text","completion","suggest"],demo:"inlineAutocomplete"},{kind:"toggle",key:"externalEditor",page:"workspace",section:"composer",label:"Write prompts in your editor",description:"Press ctrl+g to write the prompt in your editor ($EDITOR).",surfaces:TUI,scope:"window",keywords:["$editor","vim","external"]},{kind:"toggle",key:"terminal",page:"workspace",section:"terminals",label:"Show terminals",description:"Show terminals next to the session. They run on the same computer as the session.",surfaces:APPS,scope:"host",demo:"terminal"},{kind:"toggle",key:"terminalAgent",page:"workspace",section:"terminals",requires:"terminal",parent:"terminal",label:"Let the agent use your terminals",description:"The agent can read your terminals. It types in them only after you approve.",surfaces:DESKTOP$1,scope:"host"},{kind:"toggle",key:"terminalAgentTasks",page:"workspace",section:"terminals",requires:"terminal",parent:"terminal",label:"Open background tasks in terminals",description:"Give each background command that the agent starts its own terminal tab.",surfaces:DESKTOP$1,scope:"host"},{kind:"toggle",key:"closeTerminalOnCleanExit",page:"workspace",section:"terminals",requires:"terminal",parent:"terminal",label:"Close terminals that finish without errors",description:"Close a terminal when its shell exits without an error. Terminals that fail stay open.",surfaces:DESKTOP$1,scope:"window"},{kind:"toggle",key:"browser",page:"workspace",section:"browser",label:"Show the browser",description:"Show a browser next to the session to preview your app.",surfaces:DESKTOP$1,scope:"window",demo:"browser"},{kind:"toggle",key:"browserAgent",page:"workspace",section:"browser",parent:"browser",label:"Let the agent use the browser",description:"The agent can open, read, click and type in pages to check its work.",surfaces:DESKTOP$1,scope:"host"},{kind:"toggle",key:"browserAutoShow",page:"workspace",section:"browser",parent:"browser",label:"Open the browser when the agent uses it",description:"Open the browser tab when the agent starts using it.",surfaces:DESKTOP$1,scope:"window"},{kind:"custom",id:"clearSiteData",page:"workspace",section:"browser",label:"Clear site data for this project",description:"Delete the logins, cookies and stored data of pages you opened in this project.",surfaces:DESKTOP$1,scope:"window",acts:!0,search:[{label:"Clear site data for this project",description:"Delete the logins, cookies and stored data of pages you opened in this project.",key:"clearSiteData",keywords:["cookies","browser"]}]},{kind:"toggle",key:"artifacts",page:"workspace",section:"sidebar",label:"Track what sessions make",description:"List each session's pull requests, branches, commits and files.",surfaces:ALL,scope:"window",keywords:["artifacts","pull requests","branches"]},{kind:"toggle",key:"confirmGitSync",page:"workspace",section:"sidebar",label:"Ask before git pull and push",description:"Ask you before the git bar pulls, pushes or publishes your branch.",surfaces:DESKTOP$1,scope:"window",keywords:["git","push","pull","sync"]},{kind:"toggle",key:"restoreWindowPlacement",page:"workspace",section:"sidebar",label:"Reopen windows where they were",description:"Open each kind of window on the screen, at the position and size the last one had.",surfaces:DESKTOP$1,scope:"window",keywords:["window","position","size","bounds","remember","monitor","screen"]},{kind:"choice",key:"terminalTitle",page:"workspace",section:"terminalWindow",label:"Terminal window title",description:"What the terminal's title bar shows.",surfaces:TUI,scope:"window",options:[{value:"off",label:"Off"},{value:"app",label:"zidane"},{value:"session",label:"Session title"},{value:"icon-session",label:"Icon and session title"}]},{kind:"input",key:"sessionIcon",page:"workspace",section:"terminalWindow",label:"Session icon",description:"The icon before the session title in the terminal's title bar.",placeholder:"⚽",surfaces:TUI,scope:"window"},{kind:"input",key:"attentionIcon",page:"workspace",section:"terminalWindow",label:"Needs-you icon",description:"Replaces the session icon while zidane waits for you.",placeholder:"⚠️",surfaces:TUI,scope:"window"},{kind:"input",key:"activeIcon",page:"workspace",section:"terminalWindow",label:"Working icon",description:"Replaces the session icon while zidane works.",placeholder:"⚡",surfaces:TUI,scope:"window"},{kind:"toggle",key:"mouseInteractions",page:"workspace",section:"terminalWindow",label:"Use the mouse",description:"Click, hover and scroll rows. Off: the terminal's own text selection works.",surfaces:TUI,scope:"window",keywords:["clickable","mouse","select"]},{kind:"choice",key:"ctrlCBehavior",page:"workspace",section:"terminalWindow",label:"When you press ctrl+c",description:"Quit right away, ask first, or stop what is running and quit on a second press.",surfaces:TUI,scope:"window",options:[{value:"quit",label:"Quit"},{value:"quit-confirm",label:"Ask first"},{value:"stop-then-quit",label:"Stop, then quit"}]},{kind:"choice",key:"openIn",page:"editor",section:"open",label:"Open files and diffs in",description:"Where clicked files and diffs open: your editor or zidane's panels.",surfaces:TUI_DESKTOP,scope:"window",keywords:["finder","editor","vscode","cursor","external","panel","click"],options:[{value:"editor",label:"Your editor"},{value:"panel",label:"zidane panels"}]},{kind:"action",id:"keybindings",page:"keybindings",section:"file",label:"Keybindings",description:"Open ~/.zidane/keybindings.json. Restart to apply.",surfaces:TUI,scope:"window"},{kind:"action",id:"reauth",page:"accounts",section:"signIn",label:"Sign-ins",description:"Switch provider, add one, or sign in again.",surfaces:TUI,scope:"host"},{kind:"toggle",key:"remoteHosts",page:"hosts",section:"remote",killSwitchEnv:"ZIDANE_NO_REMOTE",label:"Use remote hosts",description:"Run sessions on other computers that run zidane server.",surfaces:TUI_DESKTOP,scope:"window",badges:["experimental"],keywords:["server","remote","zidane-server"]},{kind:"toggle",key:"browserMediaAnyPath",page:"hosts",section:"remote",label:"Show media from any folder in the web app",description:"A browser paired with this host can show images, video and audio from any folder on it, not only from its projects. Credential folders stay hidden.",surfaces:ALL,scope:"host",keywords:["media","paired browser","web app"]},{kind:"toggle",key:"useDaemon",page:"advanced",section:"runtime",label:"Keep sessions running in the background",description:"Sessions run in a background service, the daemon. They keep going when you close a window, and every window shows them. Applies to new sessions.",surfaces:TUI_DESKTOP,scope:"window",keywords:["daemon","background","server","terminal"],demo:"useDaemon"},{kind:"toggle",key:"persistToolResults",page:"advanced",section:"cache",label:"Save large tool outputs to files",description:"Save tool outputs over 8 KB to a file and show a preview in the session. This keeps the context small.",surfaces:ALL,scope:"host"},{kind:"toggle",key:"stableToolList",page:"advanced",section:"cache",label:"Keep the tool list fixed",description:"The agent reaches new MCP tools through one fixed tool, so the provider's cache keeps working and calls cost less. Off: each new tool resets the cache. Applies to new sessions.",surfaces:ALL,scope:"host",keywords:["call_tool","prompt cache"]},{kind:"toggle",key:"freezeSessionPrompt",page:"advanced",section:"cache",label:"Keep the system prompt fixed",description:"Each session keeps the instructions it started with. Later changes reach the agent as a note, so calls cost less. /refresh loads the new version.",surfaces:ALL,scope:"host",keywords:["freeze","prompt cache","system prompt"]},{kind:"toggle",key:"compactToolCatalog",page:"advanced",section:"cache",label:"List MCP tools by name only",description:"The prompt lists MCP tools by name, and the agent looks a tool up before it uses it. This saves tokens when you connect many tools. Applies to new sessions.",surfaces:ALL,scope:"host",badges:["experimental"],keywords:["short tool list","tokens"]},{kind:"choice",key:"maxOutputTokens",page:"advanced",section:"calls",label:"Longest reply",description:"The most the model can write in one reply, in tokens.",surfaces:ALL,scope:"host",keywords:["max output tokens","output limit"],options:[{value:0,label:"Model's limit"},{value:8192,label:"8K"},{value:16384,label:"16K"},{value:32e3,label:"32K"},{value:64e3,label:"64K"}]},{kind:"toggle",key:"resumeOnMaxTokens",page:"advanced",section:"calls",label:"Continue past the output limit",description:"When a reply hits the model's output limit, the agent goes on in a new reply. Off: the reply stops there.",surfaces:ALL,scope:"host",keywords:["auto-resume","output limit","max tokens"]},{kind:"choice",key:"retryMaxAttempts",page:"advanced",section:"calls",label:"Tries per provider call",description:"How many times zidane tries a provider call that fails or stalls.",surfaces:ALL,scope:"host",keywords:["retry","retries","attempts"],options:[{value:0,label:"3 (default)"},{value:1,label:"1 (no retry)"},{value:2,label:"2"},{value:5,label:"5"},{value:8,label:"8"}]},{kind:"choice",key:"thinkingBinding",page:"advanced",section:"calls",label:"Outdated reasoning (Anthropic)",description:"What happens when saved reasoning no longer matches the session, for example after you edit a message.",surfaces:ALL,scope:"window",keywords:["reasoning","thoughts","signature","preserved thinking"],options:[{value:"drop_block",label:"Drop it"},{value:"error",label:"Stop the run"},{value:"off",label:"Provider default"}]},{kind:"toggle",key:"fileLogging",page:"logs",section:"files",label:"Save logs to a file",description:"Save this session's logs to ~/.zidane/logs.",surfaces:TUI,scope:"window",keywords:["log","logging","debug"]}],COMPACT="Compact: replace older messages with a short summary.",SETTINGS_PAGES=[{id:"general",label:"General",icon:"i-ph-faders-horizontal",description:"How zidane starts, notifies you and updates.",kind:"rows",scope:"window",surfaces:["tui","desktop","web"],sections:[{id:"start",title:"Start"},{id:"notifications",title:"Notifications"},{id:"updates",title:"Updates",note:"updates",localOnly:!0}]},{id:"accounts",label:"Accounts",icon:"i-ph-key",description:"Your API keys and sign-ins. zidane saves them in ~/.zidane/credentials.json, and the terminal app uses them too.",serverDescription:"Keys and sign-ins saved on {host}.",kind:"panel",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"signIn",title:"Sign-ins"}],search:[{label:"Accounts",description:"Sign in to providers with an API key or your account.",keywords:["authentication","api key","oauth","login"]}]},{id:"appearance",label:"Appearance",icon:"i-ph-paint-brush",description:"Themes, colors, fonts, size and motion on this computer.",kind:"panel",scope:"window",surfaces:["tui","desktop","web"],sections:[{id:"look",title:"Look"}],search:[{label:"Appearance",description:"Light and dark mode, themes, accent, app icon, contrast, fonts and size."},{label:"Mode",description:"Light, dark, or follow the system.",key:"mode",keywords:["dark mode","light mode","system"]},{label:"Dark theme",description:"The theme in dark mode, including extension themes.",key:"darkTheme",keywords:["theme","color","colors","dark mode","palette"]},{label:"Light theme",description:"The theme in light mode, including extension themes.",key:"lightTheme",keywords:["theme","color","colors","light mode","palette"]},{label:"Code theme",description:"The syntax colors of code and diffs in dark mode.",key:"codeTheme",keywords:["syntax","highlighting","shiki"]},{label:"Light code theme",description:"The syntax colors of code and diffs in light mode.",key:"codeTheme",keywords:["syntax","highlighting","shiki"]},{label:"Accent",description:"The highlight color.",key:"accent",keywords:["color"]},{label:"App icon",description:"The icon in the Dock and in Finder.",key:"appIcon",keywords:["icon","dock","logo","midnight","modern","chrome","holographic"]},{label:"Text contrast",description:"Lower softens, higher sharpens.",key:"contrast",keywords:["contrast"]},{label:"Interface font",description:"The font of the sidebar and controls.",key:"fonts",keywords:["typeface"]},{label:"Chat font",description:"The font of messages.",key:"fonts",keywords:["typeface"]},{label:"Prompt font",description:"The font of the composer.",key:"fonts",keywords:["typeface"]},{label:"Code font",description:"The font of code, diffs and paths.",key:"fonts",keywords:["typeface","monospace"]},{label:"Chat text",description:"The size of messages.",key:"sizes",keywords:["font size"]},{label:"Prompt text",description:"The size of what you type in the composer.",key:"sizes",keywords:["font size"]},{label:"Code size",description:"The size of code, diffs and paths.",key:"sizes",keywords:["font size"]},{label:"Interface size",description:"The scale of the whole window.",key:"sizes",keywords:["zoom","scale"]},{label:"Show the zoom level",description:"For a few seconds after it changes, with a reset to 100%.",key:"sizes",keywords:["zoom","indicator","hide"]},{label:"Motion",description:"How much the interface animates.",key:"motion",keywords:["animation","reduced motion"]},{label:"Spring animations",description:"Panels, menus and indicators settle with a slight bounce.",key:"motion",keywords:["animation","springs"]},{label:"Panel animation",description:"How long panels take to open and close.",key:"motion",keywords:["animation"]}]},{id:"agent",label:"Agent",icon:"i-ph-robot",description:"What the agent can do, what it does on its own, and how long sessions go on.",kind:"rows",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"tools",title:"Tools"},{id:"automations",title:"Automations"},{id:"sessions",title:"Long sessions",description:COMPACT},{id:"instructionFiles",title:"Instruction files"}]},{id:"workspace",label:"Workspace",icon:"i-ph-app-window",description:"The composer and the panels around the session: terminals, browser, sidebar and git.",kind:"rows",scope:"window",surfaces:["tui","desktop","web"],sections:[{id:"composer",title:"Composer"},{id:"terminals",title:"Terminals",note:"terminalDaemon"},{id:"browser",title:"Browser"},{id:"sidebar",title:"Sidebar and git"},{id:"terminalWindow",title:"Terminal window"}]},{id:"extensions",label:"Extensions",icon:"i-ph-puzzle-piece",description:"Your extensions and this project's. Choose which ones run.",kind:"panel",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"integrations",title:"Integrations",surfaces:["tui"]}],search:[{label:"Extensions",description:"Choose which extensions run."}]},{id:"advanced",label:"Advanced",icon:"i-ph-flask",description:"Internals: the background service, the prompt cache and model calls. Change them only if you know why.",kind:"rows",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"runtime",title:"Background service"},{id:"cache",title:"Prompt cache and tokens"},{id:"calls",title:"Model calls"}]},{id:"models",parent:"agent",label:"Models",icon:"i-ph-cpu",description:"Which models do the work: the one new sessions start on, and the helpers.",kind:"rows",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"defaults",title:"New sessions start with"},{id:"helpers",title:"Helper models",description:"Models that do side jobs, such as titles, yes or no checks and summaries."},{id:"subagents",title:"Subagents"}]},{id:"instructions",parent:"agent",label:"Instructions",icon:"i-ph-file-text",description:"What the agent reads when a session starts, and where each part comes from.",kind:"panel",scope:"host",surfaces:["tui","desktop","web"],localOnly:!0,search:[{label:"Instructions",description:"Each part of the agent's instructions and where it comes from."}]},{id:"skills",parent:"agent",label:"Skills",icon:"i-ph-book-bookmark",description:"Your skills and this project's. Choose which ones the agent can use.",kind:"panel",scope:"host",surfaces:["tui","desktop","web"],search:[{label:"Skills",description:"Choose which skills the agent can use."}]},{id:"mcp",parent:"agent",label:"MCP servers",icon:"i-ph-lightning",description:"MCP servers give the agent more tools. They come from your mcps.json and the project's. Test one to check that it connects.",serverDescription:"MCP servers give the agent more tools. They come from {host}'s mcps.json and the project's. Test one to check that it connects.",kind:"panel",scope:"host",surfaces:["tui","desktop","web"],search:[{label:"MCP servers",description:"Turn MCP servers on or off, test their tools and sign in."}]},{id:"safety",parent:"agent",label:"Safety",icon:"i-ph-shield-check",description:"What needs your approval, where commands can reach, and how far a run can go.",kind:"rows",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"approvals",title:"Approvals"},{id:"sandbox",title:"Sandbox"},{id:"limits",title:"Spending and run limits"},{id:"trust",title:"Project trust"}]},{id:"environments",parent:"agent",label:"Environments",icon:"i-ph-cube",description:"Where sessions run: on this computer, in a git worktree, or with a sandbox provider.",kind:"panel",scope:"host",surfaces:["desktop","web"],localOnly:!0,search:[{label:"Environments",description:"Where new sessions run: worktrees, the OS sandbox and sandbox providers."},{label:"Worktree",description:"Run a session on its own branch in a git worktree, a second checkout of your repository."}]},{id:"views",parent:"agent",label:"Views",icon:"i-ph-chart-bar",description:"Charts, tables and forms the agent can put in its replies.",kind:"rows",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"views",title:"Views in replies"}]},{id:"conversation",parent:"appearance",label:"Conversation",icon:"i-ph-chat-text",description:"What a session shows: messages, tool calls, notices and status.",kind:"rows",scope:"window",surfaces:["tui","desktop","web"],aliases:["interface"],sections:[{id:"preset",title:"Preset"},{id:"messages",title:"Messages"},{id:"tools",title:"Tool calls and edits"},{id:"notices",title:"Notices",description:COMPACT},{id:"motion",title:"Motion"},{id:"status",title:"Status"}]},{id:"sidebar",parent:"appearance",label:"Sidebar",icon:"i-ph-sidebar-simple",description:"How the sidebar lists your sessions. Each space can pick its own in its filter menu.",kind:"rows",scope:"window",surfaces:["tui","desktop","web"],preview:"sidebar",sections:[{id:"layout",title:"Layout"},{id:"groups",title:"Groups",description:"How the Groups layout groups and sorts sessions."},{id:"inbox",title:"Inbox",description:"Pinned and active sessions first, then shelves for the rest."},{id:"rows",title:"Rows"}]},{id:"spaces",parent:"workspace",label:"Spaces",icon:"i-ph-stack",description:"Group sessions into spaces, each with its own icon and defaults for new sessions.",kind:"rows",scope:"window",surfaces:["tui","desktop","web"],localOnly:!0,sections:[{id:"spaces",title:"Spaces",panel:"spaces",localOnly:!0,surfaces:["desktop","web"],search:[{label:"Spaces",description:"Group sessions into spaces, each with its own icon and defaults for new sessions.",key:"spaces",keywords:["personal","work"]}]}]},{id:"editor",parent:"workspace",label:"Files and editor",icon:"i-ph-note-pencil",description:"Where files open and how the Files panel edits them.",kind:"panel",scope:"window",surfaces:["tui","desktop","web"],sections:[{id:"open",title:"Opening files"}],search:[{label:"File tree side",description:"Left or right of the Files panel.",key:"filesTreeSide",keywords:["files","tree","left","right","layout","explorer"]},{label:"Edit files in the panel",description:"Type in the viewer. ⌘S saves.",key:"editing",keywords:["editable","read-only"]},{label:"Save",description:"When zidane saves your edits.",key:"editing",keywords:["autosave"]},{label:"Tab size",description:"Spaces per indent level.",key:"editing",keywords:["indent","spaces"]},{label:"Wrap long lines",description:"Wrap lines wider than the editor instead of scrolling sideways.",key:"wordWrap",keywords:["wrap","word wrap","soft wrap"]},{label:"Match brackets",description:"Highlight the bracket pair around the caret.",key:"editing",keywords:["brackets","parentheses"]},{label:"Rounded selection",description:"Draw text selections with rounded corners.",key:"editing"},{label:"Auto-surround",description:"Typing a quote or bracket over a selection wraps it.",key:"editing",keywords:["quotes","brackets"]},{label:"Diagnostics",description:"Check files with the project's tools or language servers.",key:"diagnostics",keywords:["lint","lsp","typecheck","errors"]},{label:"Diagnostics run",description:"On open, or only after your own saves.",key:"diagnostics"},{label:"Diagnostics timeout",description:"How long each check can run before zidane stops it.",key:"diagnostics",keywords:["slow"]},{label:"Hovers",description:"Show types and docs from the language server on hover.",key:"diagnostics",keywords:["lsp","hover","tooltip"]},{label:"Stop language servers when idle",description:"Stop a server with no open file after a while.",key:"diagnostics",keywords:["lsp","idle"]}]},{id:"keybindings",parent:"workspace",label:"Keybindings",icon:"i-ph-keyboard",description:"Every shortcut. To change one, edit ~/.zidane/keybindings.json, then reload the window.",kind:"panel",scope:"window",surfaces:["tui","desktop","web"],localOnly:!0,sections:[{id:"file",title:"Keybindings file"}],search:[{label:"Keyboard shortcuts",description:"Every shortcut, and the keybindings.json file that changes them.",keywords:["keybindings","hotkeys"]}]},{id:"plugins",parent:"extensions",label:"Plugins",icon:"i-ph-squares-four",description:"Plugins are bundles of skills and MCP servers. Choose which ones load.",kind:"panel",scope:"host",surfaces:["desktop","web"],search:[{label:"Plugins",description:"Choose which Agent Plugins load, with their skills and MCP servers."}]},{id:"secrets",parent:"accounts",label:"Secrets",icon:"i-ph-lock-key",description:"The keys and tokens the agent asked you for, per project.",kind:"panel",scope:"host",surfaces:["tui"]},{id:"hosts",parent:"advanced",label:"Hosts",icon:"i-ph-hard-drives",description:"This computer and the remote hosts you saved.",kind:"rows",scope:"window",surfaces:["tui","desktop","web"],sections:[{id:"remote",title:"Remote hosts"},{id:"saved",title:"Saved hosts",panel:"hosts",surfaces:["desktop","web"],search:[{label:"Hosts",description:"Add, test, rename or remove saved remote hosts.",key:"hosts"}]}]},{id:"logs",parent:"advanced",label:"Logs",icon:"i-ph-file-magnifying-glass",description:"Live warnings and debug lines from extensions, MCP servers and the host.",kind:"panel",scope:"host",surfaces:["tui","desktop","web"],sections:[{id:"files",title:"Log files"}],search:[{label:"Logs",description:"Extension warnings, MCP diagnostics and host debug lines."}]},{id:"performance",parent:"advanced",label:"Performance",icon:"i-ph-gauge",description:"Live CPU, memory and GPU use per process. zidane measures only while this page is open.",kind:"panel",scope:"host",surfaces:["desktop","web"],search:[{label:"Performance",description:"CPU, memory and GPU per process and thread, slow frames, reports and CPU profiles.",keywords:["cpu","memory","gpu","profile","threads","slow","monitor","ipc"]}]}],SETTINGS_ROWS=[...SETTINGS_ROWS_SETUP,...SETTINGS_ROWS_VIEW,...SETTINGS_ROWS_SIDEBAR];function rowsOfKind(kind){return SETTINGS_ROWS.filter(row=>row.kind===kind)}const SETTINGS_TOGGLES=rowsOfKind("toggle"),SETTINGS_CHOICES=rowsOfKind("choice");function settingRowId(row){return row.kind==="custom"||row.kind==="action"?row.id:row.key}function rowsById(){return new Map(SETTINGS_ROWS.map(row=>[settingRowId(row),row]))}const ROW_BY_ID=rowsById();function settingRow(id){return ROW_BY_ID.get(id)}function settingKeywords(key){return ROW_BY_ID.get(key)?.keywords??[]}function settingDescription(row,surface,host){const server=row.overrides?.serverDescription;return host!==void 0&&server?server.replaceAll("{host}",host):row.overrides?.description?.[surface]??row.description}function pageAliases(){return Object.fromEntries(SETTINGS_PAGES.flatMap(page=>[[page.id,page.id],...(page.aliases??[]).map(alias=>[alias,page.id])]))}const SETTINGS_PAGE_ALIASES=pageAliases();function resolveSettingsPage(id){return Object.hasOwn(SETTINGS_PAGE_ALIASES,id)?SETTINGS_PAGE_ALIASES[id]:void 0}function pageOfSetting(key){const row=ROW_BY_ID.get(key);if(row)return row.page;for(const page of SETTINGS_PAGES)if(page.search?.some(entry=>entry.key===key)||page.sections?.some(section=>section.search?.some(entry=>entry.key===key)))return page.id}function settingsTarget(page,key){return{page:(key!==void 0?pageOfSetting(key):void 0)??resolveSettingsPage(page),...key!==void 0?{key}:{}}}function parentOn(row,settings){return row.parent===void 0||requirementMet(settings,row.parent)}function enforceSettingsInvariants(settings){let next=null;for(const row of SETTINGS_TOGGLES)!row.requires||row.keepsValue||(next??settings)[row.key]===!0&&!requirementMet(next??settings,row.requires)&&(next={...next??settings,[row.key]:!1});return next??settings}function requirementMet(settings,key){return key==="decisions"?decisionsEnabled(settings):settings[key]===!0}function toggleHeldOn(key,settings){return key==="decisions"&&settings.approvalMode==="decide"?"On because tool approvals use the decision model":void 0}function toggleApplies(key,settings){return key!=="showToolAttachments"||settings.transcriptDensity==="compact"}const BOTH=["tui","desktop"],DESKTOP=["desktop"],FEATURE_PICKS=[{key:"codemode",group:"work",surfaces:BOTH},{key:"webSearch",group:"work",surfaces:BOTH},{key:"inlineAutocomplete",group:"work",surfaces:BOTH},{key:"autoTitle",group:"work",surfaces:BOTH},{key:"runEstimates",group:"work",surfaces:DESKTOP},{key:"spaces",group:"work",surfaces:BOTH},{key:"checkForUpdates",group:"background",surfaces:BOTH},{key:"subscriptionUsage",group:"background",surfaces:BOTH},{key:"useDaemon",group:"background",surfaces:DESKTOP},{key:"schedules",group:"background",surfaces:BOTH,includes:["schedulesAgent"]},{key:"browser",group:"desktop",surfaces:DESKTOP,includes:["browserAgent"]},{key:"terminal",group:"desktop",surfaces:DESKTOP,includes:["terminalAgent"]},{key:"notifications",group:"desktop",surfaces:DESKTOP,includes:["notificationSound"]},{key:"loadProjectExtensions",group:"trust",surfaces:BOTH},{key:"secrets",group:"trust",surfaces:BOTH}],FEATURE_BADGES=new Set(["experimental","usesTokens"]);function featureOf(pick){const row=SETTINGS_TOGGLES.find(toggle=>toggle.key===pick.key);if(!row)throw new Error(`onboarding feature "${pick.key}" has no row in SETTINGS_TOGGLES`);const badges=(row.badges??[]).filter(badge=>FEATURE_BADGES.has(badge));return{...pick,...badges.length?{badges}:{}}}function featuresOf(picks){return picks.map(featureOf)}const ONBOARDING_FEATURES=featuresOf(FEATURE_PICKS),ONBOARDING_FEATURE_GROUPS=[{id:"desktop",label:"Desktop"},{id:"work",label:"Work"},{id:"trust",label:"Trust"},{id:"background",label:"In the background"}];function onboardingFeatures(surface,mode){return ONBOARDING_FEATURES.filter(feature=>feature.surfaces.includes(surface)?mode!=="extras"||feature.surfaces.length===1:!1)}function onboardingFeatureCopy(key){const row=SETTINGS_TOGGLES.find(toggle=>toggle.key===key);if(!row)throw new Error(`onboarding feature "${key}" has no row in SETTINGS_TOGGLES`);return{label:row.label,description:row.description}}function toggleRequires(key){return SETTINGS_TOGGLES.find(toggle=>toggle.key===key)?.requires}function featureIncludes(key){return ONBOARDING_FEATURES.find(feature=>feature.key===key)?.includes??[]}function featureStepSettings(){const keys=ONBOARDING_FEATURES.flatMap(feature=>[feature.key,...feature.includes??[]]);return[...new Set([...keys,...keys.flatMap(key=>toggleRequires(key)??[])])]}const ONBOARDING_STEP_SETTINGS={import:["importForeignConfigs"],look:["theme","mouseInteractions"],sidebar:["sidebarLayout","sidebarGroupBy","sidebarInboxGroupBy"],conversation:[...TRANSCRIPT_PRESET_KEYS,"messageDelivery"],autonomy:["approvalMode","sandbox","sandboxNetwork","maxCostUsd"],features:featureStepSettings()},ONBOARDING_SETTING_KEYS=stepSettingKeys(ONBOARDING_STEP_SETTINGS);function stepSettingKeys(steps){return[...new Set(Object.values(steps).flatMap(keys=>keys??[]))]}function stepsFor(context,path){const mode=context.mode==="full"&&path==="quick"?"quick":context.mode;return planOnboarding({...context,mode})}function createOnboardingFlow(context,start){const draft={path:"custom",connectors:[],skills:[],extensions:[],settings:{...start.settings},...start.provider?{provider:start.provider}:{},...start.appearance?{appearance:start.appearance}:{}};return{context,steps:stepsFor(context,draft.path),index:0,draft,initial:draft,tasks:[],done:!1}}function applySettingsPatch(settings,patch){const next={...settings,...patch};for(const[key,value]of Object.entries(patch)){if(value!==!0)continue;const requires=toggleRequires(key);requires&&next[requires]!==!0&&(next[requires]=!0);for(const included of featureIncludes(key))next[included]=!0}return enforceSettingsInvariants(next)}function currentOnboardingStep(state){return state.steps[state.index]}function canSkipOnboardingStep(state){const step=currentOnboardingStep(state);return step==="welcome"||step==="ready"?!1:!(step==="connect"&&state.context.surface==="tui")}function restoreStep(state,step){const{draft,initial}=state,keys=ONBOARDING_STEP_SETTINGS[step]??[],settings=keys.length?{...draft.settings,...Object.fromEntries(keys.map(key=>[key,initial.settings[key]]))}:draft.settings,next={...draft,settings};return step==="connect"&&(next.provider=initial.provider),step==="import"&&(next.imports=initial.imports),step==="connectors"&&(next.connectors=initial.connectors),step==="skills"&&(next.skills=initial.skills),step==="extensions"&&(next.extensions=initial.extensions),step==="look"&&(next.appearance=initial.appearance),next}function toggledSkills(list,picks,on){const keys=new Set(picks.map(pick=>pick.key)),without=list.filter(pick=>!keys.has(pick.key));return on?[...without,...picks.filter((pick,i)=>picks.findIndex(other=>other.key===pick.key)===i)]:without}function toggled(list,item,on){const without=list.filter(entry=>entry!==item);return on?[...without,item]:without}function move(state,delta){const index2=state.index+delta;return index2>=state.steps.length?{...state,done:!0}:index2<0?state:{...state,index:index2}}function replan(state,context,path){const current=currentOnboardingStep(state),steps=stepsFor(context,path),kept=steps.indexOf(current);return{...state,context,steps,index:kept>=0?kept:Math.min(state.index,steps.length-1)}}function withDraft(state,draft){return{...state,draft:{...state.draft,...draft}}}function onboardingReducer(state,action){switch(action.type){case"next":return move(state,1);case"back":return move(state,-1);case"goto":{const index2=state.steps.indexOf(action.step);return index2<0?state:{...state,index:index2,done:!1}}case"skip":return move({...state,draft:restoreStep(state,currentOnboardingStep(state))},1);case"finish":return{...state,done:!0};case"choose-path":return replan(withDraft(state,{path:action.path}),state.context,action.path);case"set-context":return replan(state,{...state.context,...action.context},state.draft.path);case"set-settings":return withDraft(state,{settings:applySettingsPatch(state.draft.settings,action.settings)});case"apply-preset":return withDraft(state,{settings:applySettingsPatch(state.draft.settings,transcriptPreset(action.preset).settings)});case"set-provider":return withDraft(state,{provider:action.provider});case"set-imports":return withDraft(state,{imports:action.imports});case"set-appearance":return withDraft(state,{appearance:action.appearance});case"toggle-connector":return withDraft(state,{connectors:toggled(state.draft.connectors,action.id,action.on)});case"toggle-extension":return withDraft(state,{extensions:toggled(state.draft.extensions,action.name,action.on)});case"toggle-skills":return withDraft(state,{skills:toggledSkills(state.draft.skills,action.picks,action.on)});case"task":{const tasks=state.tasks.some(task=>task.id===action.task.id)?state.tasks.map(task=>task.id===action.task.id?action.task:task):[...state.tasks,action.task];return{...state,tasks}}}}function sameValue(a,b){return Object.is(a,b)?!0:typeof a=="object"&&a!==null&&typeof b=="object"&&b!==null&&JSON.stringify(a)===JSON.stringify(b)}function forcedOff(settings,key){const requires=SETTINGS_TOGGLES.find(toggle=>toggle.key===key)?.requires;return settings[key]===!1&&requires!==void 0&&!requirementMet(settings,requires)}function onboardingSettingsChange(draft,initial,stored){const set={},reset=[];for(const key of ONBOARDING_SETTING_KEYS)if(!(!(key in draft)||sameValue(draft[key],initial[key])||forcedOff(draft,key))){if(sameValue(draft[key],DEFAULT_SETTINGS[key])){key in stored&&reset.push(key);continue}Object.assign(set,{[key]:draft[key]})}return{set,reset}}function onboardingRecord(surface,now=new Date,migrated=!1){return{version:1,completedAt:now.toISOString(),surface,...migrated?{migrated:!0}:{}}}function onboardingRecords(mode,surface,now=new Date){if(mode==="connect")return{};const record=onboardingRecord(surface,now),own=surfaceRecord(surface,record);return mode==="extras"?own:{shared:record,...own}}function surfaceRecord(surface,record){return surface==="tui"?{tui:record}:{desktop:record}}function effectiveOnboardingMode(state){return state.context.mode==="full"&&state.draft.path==="quick"?"quick":state.context.mode}function buildOnboardingResult(state,stored,now=new Date){const mode=effectiveOnboardingMode(state),{draft,initial}=state,provider=draft.provider&&!sameValue(draft.provider,initial.provider)?draft.provider:void 0,appearance=draft.appearance&&!sameValue(draft.appearance,initial.appearance)?draft.appearance:void 0;return{mode,surface:state.context.surface,settings:onboardingSettingsChange(draft.settings,initial.settings,stored),...provider?{provider}:{},...appearance?{appearance}:{},records:onboardingRecords(mode,state.context.surface,now)}}const CACHE_HINT_MIN_TOKENS=2e4;function cacheHintText(impact,current=!1){if(!(current||!impact||impact.keepsCache||impact.expired||impact.tokens<2e4))return`re-reads ~${formatCount(impact.tokens)} tokens`}function parseHex(hex2){const h=hex2.replace("#","");return[Number.parseInt(h.slice(0,2),16),Number.parseInt(h.slice(2,4),16),Number.parseInt(h.slice(4,6),16)]}function rgbToHsl(r,g,b){r/=255,g/=255,b/=255;const max=Math.max(r,g,b),min=Math.min(r,g,b),l=(max+min)/2;if(max===min)return[0,0,l];const d=max-min,s=l>.5?d/(2-max-min):d/(max+min);let h;return max===r?h=(g-b)/d+(g<b?6:0):max===g?h=(b-r)/d+2:h=(r-g)/d+4,[h/6,s,l]}function hslToRgb(h,s,l){if(s===0)return[l*255,l*255,l*255];const hue2rgb=(p2,q2,t)=>(t<0&&(t+=1),t>1&&(t-=1),t<1/6?p2+(q2-p2)*6*t:t<1/2?q2:t<2/3?p2+(q2-p2)*(2/3-t)*6:p2),q=l<.5?l*(1+s):l+s-l*s,p=2*l-q;return[hue2rgb(p,q,h+1/3)*255,hue2rgb(p,q,h)*255,hue2rgb(p,q,h-1/3)*255]}function toHex(rgb){const pad=v=>Math.round(Math.max(0,Math.min(255,v))).toString(16).padStart(2,"0");return`#${pad(rgb[0])}${pad(rgb[1])}${pad(rgb[2])}`}function blendHsl(from,to,t){const[r1,g1,b1]=parseHex(from),[r2,g2,b2]=parseHex(to),[h1,s1,l1]=rgbToHsl(r1,g1,b1),[h2,s2,l2]=rgbToHsl(r2,g2,b2);let dh=h2-h1;return dh>.5?dh-=1:dh<-.5&&(dh+=1),toHex(hslToRgb((h1+dh*t+1)%1,s1+(s2-s1)*t,l1+(l2-l1)*t))}const fzfByCatalog$2=new WeakMap;function fzfFor$1(catalog){let fzf=fzfByCatalog$2.get(catalog);return fzf||(fzf=new Fzf(catalog,{selector:c2=>c2.name,casing:"case-insensitive"}),fzfByCatalog$2.set(catalog,fzf)),fzf}function scoreCommands(catalog,query){const q=query.trim().toLowerCase(),fuzzyHits=q.length>0?new Set(fzfFor$1(catalog).find(q).map(r=>r.item)):null,scored=[];for(const command of catalog){const name=command.name.toLowerCase(),aliases=(command.aliases??[]).map(a=>a.toLowerCase()),group=command.group?.toLowerCase(),desc=command.description.toLowerCase();q.length===0?scored.push({command,rank:4}):name.startsWith(q)||aliases.some(a=>a.startsWith(q))?scored.push({command,rank:0}):name.includes(q)||aliases.some(a=>a.includes(q))||group!==void 0&&q.length>=2&&group.startsWith(q)?scored.push({command,rank:1}):desc.includes(q)?scored.push({command,rank:2}):fuzzyHits?.has(command)&&scored.push({command,rank:3})}return scored.sort((a,b)=>a.rank!==b.rank?a.rank-b.rank:a.command.name.localeCompare(b.command.name)),scored.map(({command})=>({id:command.name,label:command.name,description:command.aliases?.length?`${command.description} (alias: ${command.aliases.map(a=>`/${a}`).join(", ")})`:command.description,insertText:`/${command.name} `,data:command}))}function createCommandsCompletionProvider(opts){return{id:"commands",trigger:"/",label:"Commands",allowSpacesInQuery:!0,suggest(query,ctx){const spaceIdx=query.search(/\s/);if(spaceIdx!==-1){if(ctx.text.trimStart()[0]!=="/")return[];const typed=query.slice(0,spaceIdx).toLowerCase(),command=opts.getCommands().find(c2=>c2.name.toLowerCase()===typed||c2.aliases?.some(a=>a.toLowerCase()===typed));if(!command?.completeArgs)return[];const argsPrefix=query.slice(spaceIdx+1).replace(/^\s+/,"");return Promise.resolve(command.completeArgs(argsPrefix)).then(suggestions=>(suggestions??[]).map(s=>({id:`${command.name}:${s.value}`,label:s.label??s.value,...s.description!==void 0?{description:s.description}:{},insertText:`/${command.name} ${s.value} `,data:command})))}return scoreCommands(opts.getCommands(),query)},parseReferences(){return[]}}}const DEFAULT_RESULT_LIMIT=50,IDENTITY_FORMAT=entry=>entry.path,fzfByCatalog$1=new WeakMap;function fzfFor(catalog){let fzf=fzfByCatalog$1.get(catalog);return fzf||(fzf=new Fzf(catalog,{selector:f=>f.name,casing:"case-insensitive"}),fzfByCatalog$1.set(catalog,fzf)),fzf}function displayOf(entry,formatPath){const base=formatPath(entry);return entry.kind==="dir"&&!base.endsWith("/")?`${base}/`:base}function scoreFiles(catalog,query,limit,formatPath){const q=query.trim().toLowerCase(),fuzzyHits=q.length>0?new Set(fzfFor(catalog).find(q).map(r=>r.item)):null,scored=[];for(const file of catalog){const display=displayOf(file,formatPath),name=file.name.toLowerCase(),path=display.toLowerCase();if(q.length===0){scored.push({entry:file,display,rank:5});continue}if(name===q){scored.push({entry:file,display,rank:0});continue}if(name.startsWith(q)){scored.push({entry:file,display,rank:1});continue}if(name.includes(q)){scored.push({entry:file,display,rank:2});continue}if(path.includes(q)){scored.push({entry:file,display,rank:3});continue}if(fuzzyHits?.has(file)){scored.push({entry:file,display,rank:4});continue}}return scored.sort((a,b)=>a.rank!==b.rank?a.rank-b.rank:a.display.localeCompare(b.display)),scored.slice(0,limit).map(({entry,display})=>({id:display,label:entry.kind==="dir"?`${entry.name}/`:entry.name,description:parentDir(entry.path),insertText:`@${display} `,data:entry}))}function createFilesCompletionProvider(opts){const limit=opts.limit??DEFAULT_RESULT_LIMIT,formatPath=opts.formatPath??IDENTITY_FORMAT;return{id:"files",trigger:"@",label:"Files",suggest(query){if(opts.ensureCatalog){const pending=opts.ensureCatalog();if(opts.getCatalog().length===0)return pending.then(loaded=>scoreFiles(loaded,query,limit,formatPath))}return scoreFiles(opts.getCatalog(),query,limit,formatPath)},parseReferences(text,_ctx){const catalog=opts.getCatalog();if(catalog.length===0)return[];const byPath=new Map;for(const file of catalog){const display=displayOf(file,formatPath);byPath.set(display,file),file.kind==="dir"&&byPath.set(formatPath(file),file)}const refs=[];for(const m of text.matchAll(/(^|\s)@(\S+)/g)){const rawCandidate=m[2],stripped=byPath.has(rawCandidate)?rawCandidate:rawCandidate.replace(/[.,;:)\]}!?]+$/,""),file=byPath.get(stripped);if(!file)continue;const start=m.index+m[1].length,trimmedLen=1+stripped.length;refs.push({providerId:"files",start,end:start+trimmedLen,itemId:displayOf(file,formatPath),data:file})}return refs}}}function parentDir(path){const lastSlash=path.lastIndexOf("/");return lastSlash<=0?"":path.slice(0,lastSlash)}function isSkillGroupCompletion(data){return typeof data=="object"&&data!==null&&data.kind==="skill-group"}function groupCompletion(group){const listed=group.members?group.members.map(m=>({name:m.name,status:m.status})):group.skills.map(name=>({name})),members=listed.filter(m=>m.status===void 0||m.status==="enabled").map(m=>m.name);return{kind:"skill-group",command:group.command,name:group.name,description:group.description,members,memberCount:members.length,listed}}const SKILL_NAME_RX=/^[a-z0-9][a-z0-9-]*$/,fzfByCatalog=new WeakMap;function validAndFzfFor(catalog){let cached=fzfByCatalog.get(catalog);if(!cached){const valid=catalog.filter(skill=>SKILL_NAME_RX.test(skill.name));cached={valid,fzf:new Fzf(valid,{selector:s=>s.name,casing:"case-insensitive"})},fzfByCatalog.set(catalog,cached)}return cached}function scoreSkills(catalog,query){const q=query.trim().toLowerCase(),{valid,fzf}=validAndFzfFor(catalog),fuzzyHits=q.length>0?new Set(fzf.find(q).map(r=>r.item)):null,scored=[];for(const skill of valid){const name=skill.name.toLowerCase(),desc=skill.description.toLowerCase();if(q.length===0){scored.push({skill,rank:4});continue}if(name.startsWith(q)){scored.push({skill,rank:0});continue}if(name.includes(q)){scored.push({skill,rank:1});continue}if(desc.includes(q)){scored.push({skill,rank:2});continue}if(fuzzyHits?.has(skill)){scored.push({skill,rank:3});continue}}return scored.sort((a,b)=>a.rank!==b.rank?a.rank-b.rank:a.skill.name.localeCompare(b.skill.name)),scored.map(({skill})=>({id:skill.name,label:skill.name,description:skill.description,insertText:`/${skill.name} `,data:skill}))}function scoreGroups(groups,query){const q=query.trim().toLowerCase(),out=[];for(const group of groups){const command=group.command,rank2=q.length===0?4:command.startsWith(q)?0:command.includes(q)||group.name.toLowerCase().includes(q)?1:group.description.toLowerCase().includes(q)?2:-1;rank2<0||out.push({rank:rank2,item:{id:command,label:command,description:group.description||group.name,insertText:`/${command} `,data:group}})}return out}function createSkillsCompletionProvider(opts){const groups=()=>{const seen=new Set,out=[];for(const group of opts.getGroups?.()??[])group.overriddenBy||seen.has(group.command)||!SKILL_NAME_RX.test(group.command)||(seen.add(group.command),out.push(groupCompletion(group)));return out},visible=()=>{const all=opts.getCatalog(),enabled=opts.getEnabled?.();if(enabled===void 0)return[...all];const allow=new Set(enabled);return all.filter(s=>allow.has(s.name))},suggestAll=query=>{const live=groups();if(live.length===0)return scoreSkills(visible(),query);const commands=new Set(live.map(g=>g.command)),skills=scoreSkills(visible().filter(s=>!commands.has(s.name)),query),ranked=scoreGroups(live,query).sort((a,b)=>a.rank-b.rank||a.item.id.localeCompare(b.item.id)),out=[];let i=0;for(const skill of skills){const rank2=skillRank(skill.data,query);for(;i<ranked.length&&ranked[i].rank<=rank2;)out.push(ranked[i++].item);out.push(skill)}for(;i<ranked.length;)out.push(ranked[i++].item);return out};return{id:"skills",trigger:"/",label:"Skills",suggest(query){if(opts.ensureCatalog){const pending=opts.ensureCatalog();if(opts.getCatalog().length===0)return pending.then(()=>suggestAll(query))}return suggestAll(query)},parseReferences(text,_ctx){const catalog=visible(),live=groups();if(catalog.length===0&&live.length===0)return[];const byName=new Map;for(const skill of catalog)byName.set(skill.name,skill);for(const group of live)byName.set(group.command,group);const refs=[];for(const m of text.matchAll(/(^|\s)(\/([a-z0-9][a-z0-9-]*))/g)){const name=m[3],data=byName.get(name);if(!data)continue;const start=m.index+m[1].length;refs.push({providerId:"skills",start,end:start+m[2].length,itemId:name,data})}return refs}}}function skillRank(skill,query){const q=query.trim().toLowerCase();if(q.length===0)return 4;const name=skill.name.toLowerCase();return name.startsWith(q)?0:name.includes(q)?1:skill.description.toLowerCase().includes(q)?2:3}function uniqueSkillNamesFromReferences(references){const out=[],seen=new Set;for(const ref of references)ref.providerId==="skills"&&(seen.has(ref.itemId)||(seen.add(ref.itemId),out.push(ref.itemId)));return out}const DAEMON_HEALTH_STYLE={connected:{tone:"accent",label:"daemon connected"},connecting:{tone:"warn",label:"connecting to daemon…"},disconnected:{tone:"error",label:"daemon unreachable"}};function applyHistoryOp(rows,change,context){const historyId=change.historyId??context.historyId;if(context.historyId!==void 0&&change.historyId!==void 0&&change.historyId!==context.historyId)return{refetch:!0,pos:change.pos,historyId};const applied=context.pos;if(applied!==void 0&&change.pos<=applied)return{rows,pos:applied,historyId};if(applied!==void 0&&change.pos!==applied+1)return{refetch:!0,pos:change.pos,historyId};const{op}=change;if(op.kind==="rewrite")return{refetch:!0,pos:change.pos,historyId};if(change.events===void 0)return{rows,pos:change.pos,historyId};const shown=new Set;for(const row of rows)row.turnId!==void 0&&shown.add(row.turnId);const{events}=change,turns=events===null?op.turnIds:[...new Set(events.flatMap(e=>e.turnId!==void 0?[e.turnId]:[]))],onShow=turns.filter(id=>shown.has(id)).length;return onShow===turns.length?{rows,pos:change.pos,historyId}:events===null||onShow>0?{refetch:!0,pos:change.pos,historyId}:{rows:insertAfterTurn(rows,events,change.after),pos:change.pos,historyId}}function insertAfterTurn(rows,added,after){if(after===void 0)return[...rows,...added];let at=-1;for(let i=rows.length-1;i>=0;i--)if(rows[i].turnId===after){at=i+1;break}if(at<0)return[...rows,...added];for(;at<rows.length&&rows[at].turnId===void 0;)at++;return[...rows.slice(0,at),...added,...rows.slice(at)]}function applyHistorySince(rows,since,context){const historyId=since.historyId??context.historyId;if(context.historyId!==void 0&&since.historyId!==void 0&&since.historyId!==context.historyId)return{refetch:!0,pos:since.pos,historyId};if(context.pos!==void 0&&since.pos<=context.pos)return{rows,pos:context.pos,...historyId!==void 0?{historyId}:{}};const shown=new Set;for(const row of rows)row.turnId!==void 0&&shown.add(row.turnId);const turns=[...new Set(since.events.flatMap(e=>e.turnId!==void 0?[e.turnId]:[]))],onShow=turns.filter(id=>shown.has(id)).length,at=historyId!==void 0?{historyId}:{};return onShow===turns.length&&turns.length>0?{rows,pos:since.pos,...at}:onShow>0?{refetch:!0,pos:since.pos,...at}:{rows:since.events.length>0?insertAfterTurn(rows,since.events,since.after):rows,pos:since.pos,...at}}function readFreshness(read,applied,appliedHistoryId,retired){return read.historyId!==void 0&&appliedHistoryId!==void 0&&read.historyId!==appliedHistoryId?retired?.has(read.historyId)?"stale":"fresh":read.pos!==void 0&&applied!==void 0&&read.pos<applied?"stale":"fresh"}function cursorValid(cursorPos,page,cursorHistoryId){return cursorHistoryId!==void 0&&page.historyId!==void 0&&page.historyId!==cursorHistoryId?!1:cursorPos===void 0||page.floor===void 0||page.floor<=cursorPos}async function climbReconnectLadder(bookmark,steps){if(steps.resume&&bookmark.epoch!==void 0&&bookmark.seq!==void 0){const signals=await steps.resume(bookmark.epoch,bookmark.seq);if(signals)return{via:"resume",signals}}if(steps.since&&bookmark.pos!==void 0&&bookmark.historyId!==void 0){const since=await steps.since(bookmark.pos,bookmark.historyId);if(since)return{via:"since",since}}return{via:"tail"}}const LIST_ITEM_RE=/^( *)(?:[-+*]|\d+[.)]) +/,MARKDOWN_RENDER_CHUNK_TARGET_BYTES=24576;function isUnsafeChunkBoundary(line){return LIST_ITEM_RE.test(line)||/^ *>/.test(line)||/^ *\|/.test(line)||/^ {4,}/.test(line)}function chunkMarkdownForRender(text,targetBytes=MARKDOWN_RENDER_CHUNK_TARGET_BYTES){if(text.length<=targetBytes)return[text];const lines=text.split(`
40
40
  `),chunks=[];let current=[],currentBytes=0,inFence=!1,fenceChar="",fenceLen=0;const push=line=>{current.push(line),currentBytes+=line.length+1};for(let i=0;i<lines.length;i++){const line=lines[i];if(inFence){push(line),isFenceClose(line,fenceChar,fenceLen)&&(inFence=!1);continue}const open=parseFenceOpen(line);if(open){push(line),inFence=!0,fenceChar=open.char,fenceLen=open.length;continue}if(line.trim()===""&&currentBytes>=targetBytes&&current.length>0){let next=i+1;for(;next<lines.length&&lines[next].trim()==="";)next++;if(next<lines.length&&!isUnsafeChunkBoundary(lines[next])){chunks.push(current.join(`
41
41
  `)),current=[],currentBytes=0,i=next-1;continue}}push(line)}return current.length>0&&chunks.push(current.join(`
42
- `)),chunks.length>0?chunks:[text]}function parseFenceOpen(line){const indent=leadingSpaces(line),char=line[indent];if(char!=="`"&&char!=="~")return null;const length=countRun(line,indent,char);if(length<3)return null;const info=line.slice(indent+length);return char==="`"&&info.includes("`")?null:{indent,char,length}}function isFenceClose(line,fenceChar,fenceLen){const indent=leadingSpaces(line);if(line[indent]!==fenceChar)return!1;const length=countRun(line,indent,fenceChar);return length<fenceLen?!1:onlySpaces(line,indent+length)}function leadingSpaces(line){let i=0;for(;i<line.length&&line[i]===" ";)i++;return i}function countRun(line,start,char){let i=start;for(;i<line.length&&line[i]===char;)i++;return i-start}function onlySpaces(line,start){for(let i=start;i<line.length;i++)if(line[i]!==" ")return!1;return!0}const MCP_STATUS_LABEL={authed:"Signed in","needs-auth":"Needs sign-in",authorizing:"Signing in…",error:"Sign-in failed","bootstrap-error":"Couldn't connect","key-refused":"Key refused"};function otherDelivery(delivery){return delivery==="steer"?"queue":"steer"}function customModelTargets(query,providers,fallbackProviderKey){const{modelId,named}=splitProviderPrefix(query,providers);if(!modelId)return[];const rank2=p=>p.key===named?.key?0:p.key===fallbackProviderKey?1:2;return providers.map((p,i)=>({p,i})).sort((a,b)=>rank2(a.p)-rank2(b.p)||a.i-b.i).map(({p})=>({providerKey:p.key,providerLabel:p.label,modelId,...p.key===named?.key?{named:!0}:{}}))}function splitProviderPrefix(query,providers){const trimmed=query.trim().replace(/\s+/g," ");if(!trimmed)return{modelId:"",named:void 0};const lower2=trimmed.toLowerCase(),match=providers.flatMap(p=>[{provider:p,token:p.label.toLowerCase()},{provider:p,token:p.key.toLowerCase()}]).filter(candidate=>lower2.startsWith(`${candidate.token} `)).sort((a,b)=>b.token.length-a.token.length)[0];return{modelId:match?trimmed.slice(match.token.length).trim():trimmed,named:match?.provider}}const BEARER="Bearer ",CONNECTORS=[{id:"github",label:"GitHub",description:"Repositories, issues, pull requests and Actions.",category:"code",transport:{kind:"http",url:"https://api.githubcopilot.com/mcp/"},auth:{kind:"token",header:"Authorization",prefix:BEARER,createUrl:"https://github.com/settings/personal-access-tokens/new",placeholder:"github_pat_…",reuse:"github"},docsUrl:"https://github.com/github/github-mcp-server",brand:"github"},{id:"linear",label:"Linear",description:"Issues, projects and cycles.",category:"work",transport:{kind:"http",url:"https://mcp.linear.app/mcp"},auth:{kind:"oauth"},docsUrl:"https://linear.app/docs/mcp",brand:"linear"},{id:"notion",label:"Notion",description:"Pages, databases and comments.",category:"work",transport:{kind:"http",url:"https://mcp.notion.com/mcp"},auth:{kind:"oauth"},docsUrl:"https://developers.notion.com/docs/mcp",brand:"notion"},{id:"atlassian",label:"Atlassian",description:"Jira work items and Confluence pages.",category:"work",transport:{kind:"http",url:"https://mcp.atlassian.com/v2/mcp"},auth:{kind:"oauth"},docsUrl:"https://support.atlassian.com/atlassian-rovo-mcp-server/docs/getting-started-with-the-atlassian-remote-mcp-server/",brand:"atlassian"},{id:"cloudflare",label:"Cloudflare",description:"Workers, DNS, storage and the rest of the Cloudflare API.",category:"cloud",transport:{kind:"http",url:"https://mcp.cloudflare.com/mcp"},auth:{kind:"oauth"},docsUrl:"https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/",brand:"cloudflare"},{id:"supabase",label:"Supabase",description:"Projects, Postgres queries, migrations and edge functions.",category:"cloud",transport:{kind:"http",url:"https://mcp.supabase.com/mcp"},auth:{kind:"oauth"},docsUrl:"https://supabase.com/docs/guides/ai-tools/mcp",brand:"supabase"},{id:"neon",label:"Neon",description:"Serverless Postgres projects, branches and queries.",category:"cloud",transport:{kind:"http",url:"https://mcp.neon.tech/mcp"},auth:{kind:"oauth"},docsUrl:"https://neon.com/docs/ai/neon-mcp-server",brand:"neon"},{id:"stripe",label:"Stripe",description:"Customers, payments, invoices and the Stripe docs.",category:"cloud",transport:{kind:"http",url:"https://mcp.stripe.com"},auth:{kind:"oauth"},docsUrl:"https://docs.stripe.com/mcp",brand:"stripe"},{id:"sentry",label:"Sentry",description:"Errors, issues and performance data, with Seer analysis.",category:"observability",transport:{kind:"http",url:"https://mcp.sentry.dev/mcp"},auth:{kind:"oauth"},docsUrl:"https://docs.sentry.io/product/sentry-mcp/",brand:"sentry"},{id:"braintrust",label:"Braintrust",description:"Experiments, logs, datasets and evaluations.",category:"observability",transport:{kind:"http",url:"https://api.braintrust.dev/mcp"},auth:{kind:"oauth"},docsUrl:"https://www.braintrust.dev/docs/reference/mcp",brand:"braintrust"},{id:"context7",label:"Context7",description:"Up-to-date documentation for libraries and frameworks.",category:"docs",transport:{kind:"http",url:"https://mcp.context7.com/mcp"},auth:{kind:"token",header:"CONTEXT7_API_KEY",optional:!0,createUrl:"https://context7.com/dashboard",placeholder:"ctx7sk-…"},docsUrl:"https://github.com/upstash/context7"},{id:"deepwiki",label:"DeepWiki",description:"Ask questions about any public GitHub repository.",category:"docs",transport:{kind:"http",url:"https://mcp.deepwiki.com/mcp"},auth:{kind:"none"},docsUrl:"https://mcp.deepwiki.com/"},{id:"huggingface",label:"Hugging Face",description:"Models, datasets, Spaces and papers.",category:"docs",transport:{kind:"http",url:"https://huggingface.co/mcp"},auth:{kind:"token",header:"Authorization",prefix:BEARER,optional:!0,createUrl:"https://huggingface.co/settings/tokens",placeholder:"hf_…"},docsUrl:"https://huggingface.co/docs/hub/agents-mcp",brand:"huggingface"},{id:"playwright",label:"Playwright",description:"A browser that the agent controls. It opens pages, clicks, types and reads. Needs Node.js.",category:"browser",transport:{kind:"stdio",command:"npx",args:["@playwright/mcp@latest"]},auth:{kind:"none"},docsUrl:"https://github.com/microsoft/playwright-mcp"}],CONNECTOR_CATEGORIES=[{id:"code",label:"Code"},{id:"work",label:"Work"},{id:"cloud",label:"Cloud and data"},{id:"observability",label:"Observability"},{id:"docs",label:"Docs and research"},{id:"browser",label:"Browser"}];function connectorById(id){return CONNECTORS.find(entry=>entry.id===id)}function connectorInputError(entry,input={}){if(entry.auth.kind==="token"&&!entry.auth.optional&&!input.token?.trim())return`Paste a ${entry.label} token first.`}function connectorServerConfig(entry,input={}){const error=connectorInputError(entry,input);if(error)throw new Error(error);if(entry.transport.kind==="stdio")return{name:entry.id,transport:"stdio",command:entry.transport.command,args:[...entry.transport.args]};const token=input.token?.trim(),headers=entry.auth.kind==="token"&&token?{[entry.auth.header]:`${entry.auth.prefix??""}${token}`}:void 0;return{name:entry.id,transport:"streamable-http",url:entry.transport.url,...headers?{headers}:{}}}const sameUrl=(a,b)=>a.replace(/\/+$/,"").toLowerCase()===b.replace(/\/+$/,"").toLowerCase();function connectorInstalled(entry,servers){const transport=entry.transport;return servers.some(server=>server.name===entry.id?!0:transport.kind==="http"?server.url!==void 0&&sameUrl(server.url,transport.url):server.command===transport.command&&(server.args??[]).join(" ")===transport.args.join(" "))}function defaultImportSelection(preview){const{sessions}=preview;return{sessions:sessions.all>0,allProjects:sessions.project===0&&sessions.all>0,mcps:preview.mcps.copy.length>0,skills:preview.skills.copy.length>0,commands:preview.commands.copy.length>0,agents:preview.agents.copy.length>0}}function importsSomething(selection){return!!(selection&&(selection.sessions||selection.mcps||selection.skills||selection.commands||selection.agents))}const ROUTE_BEFORE=`export const chat = route('/chat', async (req) => {
42
+ `)),chunks.length>0?chunks:[text]}function parseFenceOpen(line){const indent=leadingSpaces(line),char=line[indent];if(char!=="`"&&char!=="~")return null;const length=countRun(line,indent,char);if(length<3)return null;const info=line.slice(indent+length);return char==="`"&&info.includes("`")?null:{indent,char,length}}function isFenceClose(line,fenceChar,fenceLen){const indent=leadingSpaces(line);if(line[indent]!==fenceChar)return!1;const length=countRun(line,indent,fenceChar);return length<fenceLen?!1:onlySpaces(line,indent+length,line.endsWith("\r")?line.length-1:line.length)}function leadingSpaces(line){let i=0;for(;i<line.length&&line[i]===" ";)i++;return i}function countRun(line,start,char){let i=start;for(;i<line.length&&line[i]===char;)i++;return i-start}function onlySpaces(line,start,end){for(let i=start;i<end;i++)if(line[i]!==" ")return!1;return!0}const MCP_STATUS_LABEL={authed:"Signed in","needs-auth":"Needs sign-in",authorizing:"Signing in…",error:"Sign-in failed","bootstrap-error":"Couldn't connect","key-refused":"Key refused"};function otherDelivery(delivery){return delivery==="steer"?"queue":"steer"}function customModelTargets(query,providers,fallbackProviderKey){const{modelId,named}=splitProviderPrefix(query,providers);if(!modelId)return[];const rank2=p=>p.key===named?.key?0:p.key===fallbackProviderKey?1:2;return providers.map((p,i)=>({p,i})).sort((a,b)=>rank2(a.p)-rank2(b.p)||a.i-b.i).map(({p})=>({providerKey:p.key,providerLabel:p.label,modelId,...p.key===named?.key?{named:!0}:{}}))}function splitProviderPrefix(query,providers){const trimmed=query.trim().replace(/\s+/g," ");if(!trimmed)return{modelId:"",named:void 0};const lower2=trimmed.toLowerCase(),match=providers.flatMap(p=>[{provider:p,token:p.label.toLowerCase()},{provider:p,token:p.key.toLowerCase()}]).filter(candidate=>lower2.startsWith(`${candidate.token} `)).sort((a,b)=>b.token.length-a.token.length)[0];return{modelId:match?trimmed.slice(match.token.length).trim():trimmed,named:match?.provider}}const BEARER="Bearer ",CONNECTORS=[{id:"github",label:"GitHub",description:"Repositories, issues, pull requests and Actions.",category:"code",transport:{kind:"http",url:"https://api.githubcopilot.com/mcp/"},auth:{kind:"token",header:"Authorization",prefix:BEARER,createUrl:"https://github.com/settings/personal-access-tokens/new",placeholder:"github_pat_…",reuse:"github"},docsUrl:"https://github.com/github/github-mcp-server",brand:"github"},{id:"linear",label:"Linear",description:"Issues, projects and cycles.",category:"work",transport:{kind:"http",url:"https://mcp.linear.app/mcp"},auth:{kind:"oauth"},docsUrl:"https://linear.app/docs/mcp",brand:"linear"},{id:"notion",label:"Notion",description:"Pages, databases and comments.",category:"work",transport:{kind:"http",url:"https://mcp.notion.com/mcp"},auth:{kind:"oauth"},docsUrl:"https://developers.notion.com/docs/mcp",brand:"notion"},{id:"atlassian",label:"Atlassian",description:"Jira work items and Confluence pages.",category:"work",transport:{kind:"http",url:"https://mcp.atlassian.com/v2/mcp"},auth:{kind:"oauth"},docsUrl:"https://support.atlassian.com/atlassian-rovo-mcp-server/docs/getting-started-with-the-atlassian-remote-mcp-server/",brand:"atlassian"},{id:"cloudflare",label:"Cloudflare",description:"Workers, DNS, storage and the rest of the Cloudflare API.",category:"cloud",transport:{kind:"http",url:"https://mcp.cloudflare.com/mcp"},auth:{kind:"oauth"},docsUrl:"https://developers.cloudflare.com/agents/model-context-protocol/cloudflare/servers-for-cloudflare/",brand:"cloudflare"},{id:"supabase",label:"Supabase",description:"Projects, Postgres queries, migrations and edge functions.",category:"cloud",transport:{kind:"http",url:"https://mcp.supabase.com/mcp"},auth:{kind:"oauth"},docsUrl:"https://supabase.com/docs/guides/ai-tools/mcp",brand:"supabase"},{id:"neon",label:"Neon",description:"Serverless Postgres projects, branches and queries.",category:"cloud",transport:{kind:"http",url:"https://mcp.neon.tech/mcp"},auth:{kind:"oauth"},docsUrl:"https://neon.com/docs/ai/neon-mcp-server",brand:"neon"},{id:"stripe",label:"Stripe",description:"Customers, payments, invoices and the Stripe docs.",category:"cloud",transport:{kind:"http",url:"https://mcp.stripe.com"},auth:{kind:"oauth"},docsUrl:"https://docs.stripe.com/mcp",brand:"stripe"},{id:"sentry",label:"Sentry",description:"Errors, issues and performance data, with Seer analysis.",category:"observability",transport:{kind:"http",url:"https://mcp.sentry.dev/mcp"},auth:{kind:"oauth"},docsUrl:"https://docs.sentry.io/product/sentry-mcp/",brand:"sentry"},{id:"braintrust",label:"Braintrust",description:"Experiments, logs, datasets and evaluations.",category:"observability",transport:{kind:"http",url:"https://api.braintrust.dev/mcp"},auth:{kind:"oauth"},docsUrl:"https://www.braintrust.dev/docs/reference/mcp",brand:"braintrust"},{id:"context7",label:"Context7",description:"Up-to-date documentation for libraries and frameworks.",category:"docs",transport:{kind:"http",url:"https://mcp.context7.com/mcp"},auth:{kind:"token",header:"CONTEXT7_API_KEY",optional:!0,createUrl:"https://context7.com/dashboard",placeholder:"ctx7sk-…"},docsUrl:"https://github.com/upstash/context7"},{id:"deepwiki",label:"DeepWiki",description:"Ask questions about any public GitHub repository.",category:"docs",transport:{kind:"http",url:"https://mcp.deepwiki.com/mcp"},auth:{kind:"none"},docsUrl:"https://mcp.deepwiki.com/"},{id:"huggingface",label:"Hugging Face",description:"Models, datasets, Spaces and papers.",category:"docs",transport:{kind:"http",url:"https://huggingface.co/mcp"},auth:{kind:"token",header:"Authorization",prefix:BEARER,optional:!0,createUrl:"https://huggingface.co/settings/tokens",placeholder:"hf_…"},docsUrl:"https://huggingface.co/docs/hub/agents-mcp",brand:"huggingface"},{id:"playwright",label:"Playwright",description:"A browser that the agent controls. It opens pages, clicks, types and reads. Needs Node.js.",category:"browser",transport:{kind:"stdio",command:"npx",args:["@playwright/mcp@latest"]},auth:{kind:"none"},docsUrl:"https://github.com/microsoft/playwright-mcp"}],CONNECTOR_CATEGORIES=[{id:"code",label:"Code"},{id:"work",label:"Work"},{id:"cloud",label:"Cloud and data"},{id:"observability",label:"Observability"},{id:"docs",label:"Docs and research"},{id:"browser",label:"Browser"}];function connectorById(id){return CONNECTORS.find(entry=>entry.id===id)}function connectorInputError(entry,input={}){if(entry.auth.kind==="token"&&!entry.auth.optional&&!input.token?.trim())return`Paste a ${entry.label} token first.`}function connectorServerConfig(entry,input={}){const error=connectorInputError(entry,input);if(error)throw new Error(error);if(entry.transport.kind==="stdio")return{name:entry.id,transport:"stdio",command:entry.transport.command,args:[...entry.transport.args]};const token=input.token?.trim(),headers=entry.auth.kind==="token"&&token?{[entry.auth.header]:`${entry.auth.prefix??""}${token}`}:void 0;return{name:entry.id,transport:"streamable-http",url:entry.transport.url,...headers?{headers}:{}}}const sameUrl=(a,b)=>a.replace(/\/+$/,"").toLowerCase()===b.replace(/\/+$/,"").toLowerCase();function connectorInstalled(entry,servers){const transport=entry.transport;return servers.some(server=>server.name===entry.id?!0:transport.kind==="http"?server.url!==void 0&&sameUrl(server.url,transport.url):server.command===transport.command&&(server.args??[]).join(" ")===transport.args.join(" "))}function defaultImportSelection(preview){const{sessions}=preview;return{sessions:sessions.all>0,allProjects:sessions.project===0&&sessions.all>0,mcps:preview.mcps.copy.length>0,skills:preview.skills.copy.length>0,commands:preview.commands.copy.length>0,agents:preview.agents.copy.length>0}}function importsSomething(selection){return!!(selection&&(selection.sessions||selection.mcps||selection.skills||selection.commands||selection.agents))}const ROUTE_BEFORE=`export const chat = route('/chat', async (req) => {
43
43
  return stream(await agent.run(req.body))
44
44
  })`,ROUTE_AFTER=`const limit = slidingWindow({ perMinute: 20 })
45
45
 
@@ -56,7 +56,7 @@ Ran 12 tests across 3 files. [0.41s]`},{kind:"markdown",turnId:TURN,text:`The ro
56
56
  - Over the limit, a **429** with a \`Retry-After\` header, so clients know how long to wait
57
57
 
58
58
  All 12 tests pass.`},{kind:"run-summary",turnId:TURN,text:"",runSummary:{modelId:"claude-opus-5-5",providerKey:"anthropic",durationMs:21400,turns:4,costUsd:.042,tokensIn:9800,tokensOut:640}}],TUTORIALS={connectors:{title:"How connectors work",steps:[{title:"Pick a service",detail:"zidane adds its MCP server to your mcps.json file."},{title:"Sign in once",detail:"Most services open your browser. The token stays on this computer."},{title:"The agent uses its tools",detail:"When a task needs the service, the agent calls its tools. Your approval mode still applies."}]},skills:{title:"How skills work",steps:[{title:"Pick skills",detail:"A skill is a folder with a SKILL.md file of instructions. zidane copies it to your skills folder."},{title:"The agent sees the list",detail:"Each run starts with the name and the description of every skill."},{title:"It reads a skill when a task fits",detail:"The agent then follows the full instructions of that skill."}]},mcp:{title:"How MCP servers work",steps:[{title:"Add a server",detail:"A server is a command or a URL in your mcps.json file. A project can add its own."},{title:"Sign in if it asks",detail:"A server that needs an account opens your browser once. The token stays on this computer."},{title:"The agent calls its tools",detail:"When a task needs the service, the agent calls a tool of the server. Your approval mode applies."}]},instructions:{title:"How instructions work",steps:[{title:"zidane builds one system prompt",detail:"It joins its own rules, your AGENTS.md files, the instructions of your MCP servers and the list of your skills."},{title:"A SYSTEM.md replaces its rules",detail:"Your own SYSTEM.md takes the place of the built-in prompt. Your AGENTS.md files still load."},{title:"Each run starts with it",detail:"This page shows each part, where it comes from and its size in tokens."}]},extensions:{title:"How extensions work",steps:[{title:"An extension is a TypeScript module",detail:"Its folder sits in ~/.zidane/extensions, or in .zidane/extensions of a project. You can also install one from GitHub or npm."},{title:"It adds what you need",detail:"It can add commands, tools, side panels, badges or a model provider. Both apps load it at startup."},{title:"You choose what runs",detail:"Turn each one on or off here. A project's extensions also need your trust."}]},environments:{title:"How environments work",steps:[{title:"A session runs its commands somewhere",detail:"By default, on this computer, in the session folder."},{title:"A worktree gives it a branch of its own",detail:"So two sessions can change one repository at once."},{title:"A sandbox limits what commands touch",detail:"The OS sandbox limits writes to the project and folders you add. Docker uses a container. E2B and Daytona use the cloud."}]},files:{title:"How files open",steps:[{title:"Click a path in the chat",detail:"It works for a file, a folder or a diff."},{title:"It opens where you choose",detail:"The setting below picks the Files panel or your $EDITOR. ⌘-click opens the other one."},{title:"The Files panel edits and checks",detail:"It saves your edits to disk. The project's tools, such as tsc or ESLint, mark the problem lines."}]},accounts:{title:"How accounts work",steps:[{title:"Sign in, or paste an API key",detail:"Sign in with your Claude or ChatGPT plan, or paste a key from the provider."},{title:"zidane keeps them on this computer",detail:"They stay in ~/.zidane/credentials.json, which only you can read."},{title:"Every app uses them",detail:"The terminal app reads the same file. A key in your environment works too."}]},hosts:{title:"Run zidane on a server",steps:[{title:"Start zidane-server on a machine",detail:"It runs zidane with no window, on a VPS, a home server or a container."},{title:"Create a device token",detail:"On the server, zidane server token create prints a token for one device."},{title:"Add the server here",detail:"Paste its address and the token. Its sessions run there, and a run keeps going when you close this window."}]},secrets:{title:"How secrets work",steps:[{title:"The agent asks for a key",detail:"When a task needs an API key or a token, the agent asks you for it in a password field."},{title:"zidane keeps it out of the chat",detail:"It stays in a private file for this project, for the time you pick. The chat and the transcript never show it."},{title:"Commands read it from the file",detail:"Commands read it at $ZIDANE_SECRETS/NAME, and tool output shows [secret:NAME]. You revoke it in the Secrets panel or in Settings."}]}},ON_SERVER={connectors:host=>({1:{title:"Sign in once",detail:`Most services open your browser. The token stays on ${host}.`}}),mcp:host=>({0:{title:"Add a server",detail:`A server is a command or a URL in ${host}'s mcps.json file. A project can add its own.`},1:{title:"Sign in if it asks",detail:`A server that needs an account opens your browser once. The token stays on ${host}.`}}),extensions:host=>({1:{title:"It adds what you need",detail:`It can add commands, tools, side panels, badges or a model provider. ${host} loads it at startup.`}}),environments:host=>({0:{title:"A session runs its commands somewhere",detail:`By default, it runs them on ${host}, in the folder of the session.`}}),accounts:host=>({1:{title:`${host} keeps them`,detail:`They stay in ~/.zidane/credentials.json on ${host}.`},2:{title:"Every app uses them",detail:`Every session on ${host} uses them, from any app. A key in its environment works too.`}}),secrets:host=>({1:{title:"zidane keeps it out of the chat",detail:`It stays in a private file on ${host}, for this project, for the time you pick. The chat and the transcript never show it.`}})};function tutorialOnServer(topic,host){const words2=TUTORIALS[topic],steps=ON_SERVER[topic]?.(host);if(!steps)return words2;const[a,b,c2]=words2.steps;return{title:words2.title,steps:[steps[0]??a,steps[1]??b,steps[2]??c2]}}const ONBOARDING_AGENT_NAMES={"claude-code":"Claude Code",codex:"Codex",pi:"Pi"},LOCAL_SERVER_NAMES={ollama:"Ollama","lm-studio":"LM Studio",vllm:"vLLM"};function joinNames(list){return list.length<2?list[0]??"":`${list.slice(0,-1).join(", ")} and ${list[list.length-1]}`}function joinFewNames(list){return list.length<=2?joinNames(list):`${list.slice(0,2).join(", ")} and ${list.length-2} more`}const ONBOARDING_WORDS={agentName:agent=>ONBOARDING_AGENT_NAMES[agent],detecting:"Looking at this computer…",fullSetup:"Full setup",quickStart:"Quick start",found:"Found on this computer",foundEnvKey:envKey=>`${envKey} in your environment`,foundSignedIn:provider=>`Signed in to ${provider}`,foundSaved:provider=>`${provider} is set up`,foundAgent:agent=>`${ONBOARDING_AGENT_NAMES[agent]} setup`,foundGithub:(login,source)=>login?`Signed in to GitHub as @${login}`:`A GitHub token from ${source}`,foundLocalServer:server=>`${LOCAL_SERVER_NAMES[server.kind]} at ${server.url}`,moreProviders:"More providers",localFound:server=>`${LOCAL_SERVER_NAMES[server.kind]} is running`,model:"Model",effort:"Effort",effortHint:"More effort thinks longer and costs more.",testing:"Sending a test message…",credentialsAt:path=>`zidane saves keys in ${path}. Only you can read this file.`,importSessions:"Sessions",importSessionsDetail:(project,all)=>project===all?`${all} conversations`:`${project} in this project, ${all} in all projects`,importAllProjects:"Include all projects",importMcps:"MCP servers",importSkills:"Skills",importCommands:"Commands",importAgents:"Subagents",importNames:list=>list.length>4?`${list.slice(0,4).join(", ")} and ${list.length-4} more`:list.join(", "),importSkipped:count=>`${count} already in zidane`,readInPlaceDetail:"zidane reads their MCP servers, skills, commands and subagents where they are. Those servers run commands from files zidane does not own.",tutorials:TUTORIALS,tutorialOnServer,recommendedSources:"Recommended sources",sourcePlaceholder:"owner/repo, GitHub link, skills.sh link, npx skills add, npm package",browsing:source=>`Reading ${source}…`,browseFailed:message=>`The source did not load. ${message}`,skillCount:count=>count===1?"1 skill":`${count} skills`,noSkills:"No skills here",noSkillsHint:"A skill is a folder with a SKILL.md file. This source has none.",packHint:"A pack lists skills from several repositories. Each skill installs from its own repository.",fromRepo:repo=>`from ${repo}`,listingTruncated:"GitHub cut the file list short, so some skills are missing.",needsCommand:(name,optional)=>optional?`${name} (optional)`:name,needsConnector:connector=>`the ${connector} connector`,needsDecisions:"the decision model",needsAccount:account=>`a ${account} account`,custom:"Custom",preview:"Preview",spendCap:"Spend limit per run",spendCapDetail:"Stops a run that costs more than this. Only API keys charge per token.",background:"Background work",recapNone:"None",recapProvider:(provider,model)=>model?`${provider}, ${model}`:provider,recapSwitched:(on,off)=>[on.length>0&&`On: ${joinFewNames(on)}`,off.length>0&&`Off: ${joinFewNames(off)}`].filter(Boolean).join(". ")||"No changes",sandboxed:"with the sandbox",changeLater:"You can change every choice in Settings. To open this setup again, use Run setup in the command palette."};function nativeExtensionNeedText(need,words2=ONBOARDING_WORDS){switch(need.kind){case"command":return words2.needsCommand(need.name,need.optional===!0);case"connector":return words2.needsConnector(connectorById(need.id)?.label??need.id);case"decisions":return words2.needsDecisions;case"account":return words2.needsAccount(need.label)}}function connectorAuthText(entry,ghLogin,words2){return entry.auth.kind==="oauth"?null:entry.auth.kind==="none"?words2.noAccount:entry.auth.reuse==="github"&&ghLogin?words2.tokenOrGhLogin:entry.auth.optional?words2.tokenOptionalAuth:words2.tokenSignIn}function onboardingImportParts(selection,words2=ONBOARDING_WORDS){return selection?[[selection.sessions,words2.importSessions],[selection.mcps,words2.importMcps],[selection.skills,words2.importSkills],[selection.commands,words2.importCommands],[selection.agents,words2.importAgents]].flatMap(([picked,word])=>picked?[word]:[]):[]}function onboardingSwitchedFeatures(state){const{draft,initial,context}=state,changed=onboardingFeatures(context.surface,context.mode).filter(feature=>!!draft.settings[feature.key]!=!!initial.settings[feature.key]),named=on=>changed.filter(feature=>!!draft.settings[feature.key]===on).map(feature=>onboardingFeatureCopy(feature.key).label);return{on:named(!0),off:named(!1)}}function connectorsFromImport(preview,selection){return preview.kind!=="ready"||!selection?.mcps?[]:preview.preview.mcps.copy.filter(name=>connectorById(name)!==void 0)}function box(initial){let value=initial;const listeners=new Set;return{get:()=>value,set(next){if(!Object.is(next,value)){value=next;for(const listener of[...listeners])listener()}},subscribe(onChange){return listeners.add(onChange),()=>{listeners.delete(onChange)}}}}function errorMessage(error){return error instanceof Error?error.message:String(error)}function createOnboardingRun(host,setup,options={}){const now=options.now??(()=>new Date);let flow=createOnboardingFlow(setup.context,{settings:{...DEFAULT_SETTINGS,...setup.settings},...setup.appearance?{appearance:setup.appearance}:{},...setup.provider?{provider:setup.provider}:{}});options.start&&(flow=onboardingReducer(flow,{type:"goto",step:options.start}));const state=box(flow),phase=box({kind:"running"}),importPreview=box({kind:"none"}),inputs=new Map,runners=new Map,lanes={import:Promise.resolve(),connector:Promise.resolve(),skill:Promise.resolve(),extension:Promise.resolve()},skillsStarted=new Set;host.imports&&(importPreview.set({kind:"loading"}),host.imports.preview().then(preview=>importPreview.set({kind:"ready",preview}),error=>importPreview.set({kind:"failed",message:errorMessage(error)})));const report2=task=>state.set(onboardingReducer(state.get(),{type:"task",task})),taskOf=id=>state.get().tasks.find(task=>task.id===id),enqueue=task=>{const run2=runners.get(task.id);run2&&(report2({...task,status:"queued"}),lanes[task.kind]=lanes[task.kind].then(async()=>{report2({...task,status:"running"});try{report2({...task,status:await run2()??"done"})}catch(error){report2({...task,status:"failed",message:errorMessage(error)})}}))},progress=id=>line=>{const task=taskOf(id);task?.status==="running"&&report2({...task,message:line})},startPassed=s=>{const passed=new Set(s.done?s.steps:s.steps.slice(0,s.index)),started=id=>s.tasks.some(task=>task.id===id),{imports,connectors,skills,extensions}=host;if(imports&&passed.has("import")&&importsSomething(s.draft.imports)&&!started("import:claude-code")){const selection=s.draft.imports;runners.set("import:claude-code",()=>imports.run(selection)),enqueue({id:"import:claude-code",kind:"import",label:ONBOARDING_AGENT_NAMES["claude-code"]})}if(connectors&&(passed.has("connectors")||passed.has("extensions"))){const installed=connectors.installed(),imported=connectorsFromImport(importPreview.get(),s.draft.imports);for(const id of s.draft.connectors){const entry=connectorById(id);!entry||installed.includes(id)||imported.includes(id)||started(`connector:${id}`)||(runners.set(`connector:${id}`,async()=>(await connectors.add(id,inputs.get(id)),entry.auth.kind==="oauth"&&connectors.signInLater?"needs-sign-in":"done")),enqueue({id:`connector:${id}`,kind:"connector",label:entry.label}))}}if(skills&&passed.has("skills")){const installed=skills.installed(),fresh=s.draft.skills.filter(pick=>!skillsStarted.has(pick.key)&&!installed.includes(pick.name));for(const group of groupSkillPicks(fresh)){const id=`skill:${group.source}:${skillsStarted.size}`;for(const pick of fresh.filter(p=>p.install.source===group.source))skillsStarted.add(pick.key);runners.set(id,()=>skills.install(group.source,group.rels,progress(id))),enqueue({id,kind:"skill",label:group.label})}}if(extensions&&passed.has("extensions")){const installed=extensions.installed();for(const name of s.draft.extensions){const entry=nativeExtensionByName(name);!entry||installed.includes(name)||started(`extension:${name}`)||(runners.set(`extension:${name}`,()=>extensions.install(name,progress(`extension:${name}`))),enqueue({id:`extension:${name}`,kind:"extension",label:entry.label}))}}},missingConnectors=(name,s)=>{const entry=nativeExtensionByName(name);if(!entry||!host.connectors)return[];const installed=host.connectors.installed(),imported=connectorsFromImport(importPreview.get(),s.draft.imports);return entry.needs.flatMap(need=>need.kind==="connector"&&![installed,imported,s.draft.connectors].some(list=>list.includes(need.id))?[need.id]:[])},reduce=(s,action)=>{const next=onboardingReducer(s,action);return action.type!=="toggle-extension"||!action.on||next===s?next:missingConnectors(action.name,s).reduce((flow2,id)=>onboardingReducer(flow2,{type:"toggle-connector",id,on:!0}),next)},save=()=>{const result=buildOnboardingResult(state.get(),setup.settings,now());phase.set({kind:"saving"}),host.commit(result).then(()=>phase.set({kind:"saved",result}),error=>{phase.set({kind:"failed",message:errorMessage(error)}),state.set(onboardingReducer(state.get(),{type:"goto",step:currentOnboardingStep(state.get())}))})};return{state,phase,importPreview,dispatch(action){const life=phase.get().kind;if(life==="saving"||life==="saved")return;const before=state.get(),after=reduce(before,action);after!==before&&(state.set(after),after.draft.appearance!==before.draft.appearance&&host.previewLook?.(after.draft.appearance??null),(after.done||after.index>before.index)&&startPassed(after),after.done&&save())},setConnectorInput(id,input){inputs.set(id,input)},connectorInput(id){return inputs.get(id)??{}},retry(taskId){const task=taskOf(taskId);task?.status==="failed"&&enqueue({id:task.id,kind:task.kind,label:task.label})},dispose(){phase.get().kind!=="saved"&&host.previewLook?.(null)}}}const MAX_SCAN=2e3;function runTailActivity(events){const last=events.at(-1);if(last?.kind==="markdown"&&last.streaming)return"streaming";if(last?.kind==="thinking")for(let i=events.length-1;i>=0;i--){const event=events[i];if(event.kind!=="thinking"||event.childId!==last.childId)break;if(event.text.trim()!=="")return"thinking"}const answered=new Set,stop=Math.max(0,events.length-MAX_SCAN);for(let i=events.length-1;i>=stop;i--){const event=events[i];if(event.kind==="user-prompt"&&event.childId===void 0)break;if(event.kind==="tool-result"&&event.callId!==void 0)answered.add(event.callId);else if(event.kind==="tool"&&event.callId!==void 0&&!answered.has(event.callId))return"tool"}return"waiting"}function runStatusKey(status){return status.retry?`retry:${status.retry.source??"parent"}:${status.retry.attempt}`:status.waiting?"waiting":null}const RUN_STATUS_TIME_MS=5e3;function runFoldStatus({retry,waitedMs:waitedMs2}){return retry?{kind:"retrying",retry}:waitedMs2!==null&&waitedMs2>=1500?{kind:"waiting"}:{kind:"working"}}const RUN_WAITING_LABEL="Waiting for the model";function runRetryingLabel(retry){const source=retry.source&&retry.source!=="parent"?` in ${retry.source}`:"";return`Retrying ${retry.attempt}/${retry.max}${source}`}function spacesHomeOf(settings){const home=settings?.spacesHome;return typeof home=="string"&&home!==""&&home!=="local"?home:void 0}function arrangeSpaceList(stored,order,hidden){const byId=new Map(normalizeSpaces(stored).map(s=>[s.id,s]));return order.map(({id,name})=>{const{hidden:_was,...rest}=byId.get(id)??{id,name};return id!=="default"&&hidden.has(id)?{...rest,hidden:!0}:rest})}function spawnParents(rows){const parents=new Map;for(const row of rows){const parent=row.spawn?.parentChildId;row.childId!==void 0&&parent!==void 0&&(row.kind==="spawn-start"||row.kind==="spawn-end")&&parents.set(row.childId,parent)}return parents}function spawnLane(childId,parents,present2){let lane=childId;const seen=new Set([lane]);for(let parent=parents.get(lane);parent!==void 0&&present2.has(parent)&&!seen.has(parent);parent=parents.get(lane))lane=parent,seen.add(lane);return lane}function spawnLaneResolver(rows){const parents=spawnParents(rows);if(parents.size===0)return childId=>childId;const present2=new Set;for(const row of rows)row.childId!==void 0&&present2.add(row.childId);return childId=>spawnLane(childId,parents,present2)}const PARENT_OWNER="parent";function ownerOf(event){return event.childId??PARENT_OWNER}function isChildOwned(event){return event.childId!==void 0||(event.depth??0)>0}function mergeTargetIndex(events,owner){for(let i=events.length-1;i>=0;i--){const event=events[i];if(ownerOf(event)===owner)return i;if(!isChildOwned(event))return-1}return-1}const unsplittableAtLength=new WeakMap,SEGMENT_SPLIT_RETRY_GROWTH=1.25,tailDeltaRoots=new WeakMap;function recordTailDelta(prev,next){tailDeltaRoots.set(next,tailDeltaRoots.get(prev)??prev)}function tagEvent(evt,owner,depth,turnId){const withTurn=turnId?{...evt,turnId}:evt;return owner===PARENT_OWNER?withTurn:{...withTurn,childId:owner,...depth!==void 0?{depth}:{}}}function appendMarkdownDelta(prev,delta,owner,depth,turnId,options={}){const segmentChars=options.segmentChars??65536;prev.length;const at=mergeTargetIndex(prev,owner),target=at>=0?prev[at]:void 0;if(target&&target.kind==="markdown"&&target.streaming){const merged2=target.text+delta,next=prev.slice();if(merged2.length>segmentChars){const lastFailed=unsplittableAtLength.get(target);if(lastFailed===void 0||merged2.length>lastFailed*SEGMENT_SPLIT_RETRY_GROWTH){const chunks=chunkMarkdownForRender(merged2);if(chunks.length>1){const segments=chunks.map((chunk,i)=>i===chunks.length-1?{...target,text:chunk}:{...target,text:chunk,streaming:!1});return next.splice(at,1,...segments),next}const grown2={...target,text:merged2};return unsplittableAtLength.set(grown2,merged2.length),next[at]=grown2,at===prev.length-1&&recordTailDelta(prev,next),next}const grown={...target,text:merged2};return unsplittableAtLength.set(grown,lastFailed),next[at]=grown,at===prev.length-1&&recordTailDelta(prev,next),next}return next[at]={...target,text:merged2},at===prev.length-1&&recordTailDelta(prev,next),next}return[...prev,tagEvent({kind:"markdown",text:delta,streaming:!0},owner,depth,turnId)]}function appendThinkingLines(prev,delta,owner,depth,turnId,options={}){const lines=delta.split(`
59
- `);prev.length;const at=mergeTargetIndex(prev,owner),target=at>=0?prev[at]:void 0,row=text=>tagEvent({kind:"thinking",text},owner,depth,turnId);if(target&&target.kind==="thinking"&&(turnId===void 0||target.turnId===void 0||target.turnId===turnId)){const next=prev.slice();return next[at]={...target,text:target.text+lines[0]},lines.length>1?next.splice(at+1,0,...lines.slice(1).map(row)):at===prev.length-1&&recordTailDelta(prev,next),next}const result=[...prev];if(lines[0]||lines.length>1){const first=row(lines[0]);result.push(options.onLaneOpen?options.onLaneOpen(first):first)}for(let i=1;i<lines.length;i++)result.push(row(lines[i]));return result}function discardThinking(events,owner,turnId){const kept=events.filter(e=>!((e.kind==="thinking"||e.kind==="markdown")&&e.turnId===turnId&&ownerOf(e)===owner));return kept.length===events.length?events:kept}function finalizeStreamingMarkdown(events){let changed=!1;const next=events.map(e=>e.kind==="markdown"&&e.streaming?(changed=!0,{...e,streaming:!1}):e);return changed?next:events}function finalizeStreamingMarkdownForOwner(events,owner){for(let i=events.length-1;i>=0;i--){const e=events[i];if(e.kind!=="markdown"||!e.streaming||ownerOf(e)!==owner)continue;const next=events.slice();return next[i]={...e,streaming:!1},next}return events}const SMOOTH_BURST_CPS=600,SMOOTH_BURST_BACKLOG_CHARS=400,SMOOTH_MAX_CPS=4e3;function smoothCpsForBacklog(backlog){if(backlog<=0)return 0;if(backlog>=4e3)return SMOOTH_MAX_CPS;if(backlog<=SMOOTH_BURST_BACKLOG_CHARS)return 200+backlog/SMOOTH_BURST_BACKLOG_CHARS*400;const t=(backlog-SMOOTH_BURST_BACKLOG_CHARS)/3600;return SMOOTH_BURST_CPS+t*3400}function smoothCharsForTick(backlog,carry,dtMs){if(backlog<=0)return{take:0,carry:0};const want=smoothCpsForBacklog(backlog)*dtMs/1e3+carry,take=Math.floor(want);return take<=0?{take:0,carry:want}:take>=backlog?{take:backlog,carry:0}:{take,carry:want-take}}function takeChars(buf,n){if(buf.length<=n)return{taken:buf,rest:""};if(n<=0)return{taken:"",rest:buf};let end=n;const last=buf.charCodeAt(end-1);return last>=55296&&last<=56319&&end<buf.length&&end++,{taken:buf.slice(0,end),rest:buf.slice(end)}}let versions=0;function make(chunks,tail,prefixLength){return Object.freeze({chunks,tail,prefixLength,length:prefixLength+tail.length,version:++versions})}function isExchangeStart(event){return event.kind==="user-prompt"&&!event.childId&&!event.depth}function exchangeStarts(events){const starts=[];for(let i=1;i<events.length;i++){if(!isExchangeStart(events[i]))continue;let start=i;for(;start>0&&events[start-1].kind==="separator";)start--;start>0&&starts.push(start)}return starts}const arrays=new WeakMap,owners=new WeakMap,flats=new WeakMap;function remember(transcript,events){return arrays.set(transcript,events),owners.set(events,transcript),transcript}function emptyTranscript(){return remember(make([],[],0),[])}function transcriptFromArray(events,prev){const known=owners.get(events);if(known)return known;events.length;const starts=exchangeStarts(events);if(starts.length===0)return remember(make([],events,0),events);const reusable=new Map;for(const chunk of prev?.chunks??[])chunk.length>0&&reusable.set(chunk[0],chunk);const chunks=[];let from=0;for(const start of starts)chunks.push(reuse(reusable,events,from,start)),from=start;return remember(make(chunks,events.slice(from),from),events)}function reuse(reusable,events,from,to){const chunk=reusable.get(events[from]);if(chunk&&chunk.length===to-from){let same=!0;for(let k=1;k<chunk.length&&same;k++)same=chunk[k]===events[from+k];if(same)return chunk}return events.slice(from,to)}function transcriptArray(transcript){const known=arrays.get(transcript);if(known)return known;if(transcript.chunks.length===0)return remember(transcript,transcript.tail),transcript.tail;let flat=flats.get(transcript.chunks);flat||(transcript.prefixLength,flat=transcript.chunks.flat(),flats.set(transcript.chunks,flat)),transcript.length;const events=flat.concat(transcript.tail);return remember(transcript,events),events}function transcriptOfArray(events){return owners.get(events)}function settleTranscript(transcript){const{tail}=transcript,starts=exchangeStarts(tail);if(starts.length===0)return transcript;tail.length;const chunks=transcript.chunks.slice();let from=0;for(const start of starts)chunks.push(tail.slice(from,start)),from=start;return make(chunks,tail.slice(from),transcript.prefixLength+from)}function withTranscriptTail(transcript,tail,settle=!1){if(tail===transcript.tail)return transcript;const next=make(transcript.chunks,tail,transcript.prefixLength);return settle?settleTranscript(next):next}function appendTranscriptEvent(transcript,event){return withTranscriptTail(transcript,[...transcript.tail,event],isExchangeStart(event))}const facts=new WeakMap;function chunkFact(chunk,key,compute){let map=facts.get(chunk);if(map||(map=new Map,facts.set(chunk,map)),map.has(key))return map.get(key);`${key}`,chunk.length;const value=compute(chunk);return map.set(key,value),value}function replaceChunk(transcript,index2,chunk){const old=transcript.chunks[index2];if(chunk===old)return transcript;const chunks=transcript.chunks.slice();return chunks[index2]=chunk,make(chunks,transcript.tail,transcript.prefixLength-old.length+chunk.length)}function mapTranscript(transcript,update,touches){let chunks=null,prefixLength=transcript.prefixLength;transcript.chunks.forEach((chunk,i)=>{if(touches&&!touches(chunk))return;const next=update(chunk);next!==chunk&&(chunks??=transcript.chunks.slice(),chunks[i]=next,prefixLength+=next.length-chunk.length)});const tail=update(transcript.tail);return!chunks&&tail===transcript.tail?transcript:make(chunks??transcript.chunks,tail,prefixLength)}function hasStreamingMarkdown(events){return events.some(e=>e.kind==="markdown"&&e.streaming===!0)}const streams=chunk=>chunkFact(chunk,"streaming",hasStreamingMarkdown);function transcriptMarkdownDelta(transcript,delta,owner,depth,turnId,options){return withTranscriptTail(transcript,appendMarkdownDelta(transcript.tail,delta,owner,depth,turnId,options))}function transcriptThinkingLines(transcript,delta,owner,depth,turnId,options){return withTranscriptTail(transcript,appendThinkingLines(transcript.tail,delta,owner,depth,turnId,options))}function transcriptFinalizeStreamingMarkdownForOwner(transcript,owner){const tail=finalizeStreamingMarkdownForOwner(transcript.tail,owner);if(tail!==transcript.tail)return withTranscriptTail(transcript,tail);for(let i=transcript.chunks.length-1;i>=0;i--){const chunk=transcript.chunks[i];if(!streams(chunk))continue;const next=finalizeStreamingMarkdownForOwner(chunk,owner);if(next!==chunk)return replaceChunk(transcript,i,next)}return transcript}function turnsOf(events){return new Set(events.flatMap(e=>e.turnId!==void 0?[e.turnId]:[]))}function transcriptDiscardThinking(transcript,owner,turnId){return mapTranscript(transcript,events=>discardThinking(events,owner,turnId),chunk=>chunkFact(chunk,"turns",turnsOf).has(turnId))}const progressKey=e=>`${e.childId??""}\0${e.callId??""}`;function progressKeysOf(events){return new Set(events.flatMap(e=>e.kind==="tool-progress"?[progressKey(e)]:[]))}function transcriptUpsertToolProgress(transcript,event){const{tail}=transcript,key=progressKey(event);if(event.kind==="tool-progress"&&!tail.some(e=>e.kind==="tool-progress"&&progressKey(e)===key))for(let i=transcript.chunks.length-1;i>=0;i--){const chunk=transcript.chunks[i];if(chunkFact(chunk,"progress",progressKeysOf).has(key))return replaceChunk(transcript,i,upsertToolProgress(chunk,event))}return withTranscriptTail(transcript,upsertToolProgress(tail,event))}function setupIdsOf(events){return new Set(events.flatMap(e=>{const id=readEnvironmentSetup(e)?.id;return id===void 0?[]:[id]}))}function transcriptUpsertEnvironmentSetup(transcript,event){const id=readEnvironmentSetup(event)?.id;if(id!==void 0){const at=transcript.chunks.findIndex(chunk=>chunkFact(chunk,"setups",setupIdsOf).has(id));if(at!==-1)return replaceChunk(transcript,at,upsertEnvironmentSetup(transcript.chunks[at],event))}return withTranscriptTail(transcript,upsertEnvironmentSetup(transcript.tail,event))}const SESSIONS_VERB_LABEL={create:"Create session",send:"Send to session",steer:"Steer session",cancel:"Cancel session",read:"Read session",transcript:"Session transcript",list:"List sessions"},TOOL_DISPLAY={read_file:{displayName:"Read",format:input=>{const path=stringField(input,"path");if(!path){const paths=readFileInputPaths(input);return paths.length===0?null:{target:paths[0],meta:paths.length>1?[`+${paths.length-1} more`]:[]}}const meta=[],offset=numberField(input,"offset"),limit=numberField(input,"limit");return offset!==void 0&&limit!==void 0&&limit>0?meta.push(`L${offset}–${offset+limit-1}`):offset!==void 0?meta.push(`from L${offset}`):limit!==void 0&&limit>0&&meta.push(`${limit} lines`),{target:path,meta}}},list_files:{displayName:"List",format:input=>({target:stringField(input,"path")??"."})},glob:{displayName:"Glob",format:input=>{const pattern=stringField(input,"pattern");if(!pattern)return null;const meta=[],limit=numberField(input,"limit");return limit!==void 0&&meta.push(`limit ${limit}`),{target:pattern,meta}}},grep:{displayName:"Grep",format:input=>{const pattern=stringField(input,"pattern");if(!pattern)return null;const target=`/${pattern}/`,meta=[],path=stringField(input,"path");path&&path!=="."&&meta.push(`in ${path}`);const glob=stringField(input,"glob");glob&&meta.push(glob);const type=stringField(input,"type");type&&meta.push(`type:${type}`),input["-i"]===!0&&meta.push("case-insensitive");const mode=stringField(input,"output_mode");return mode&&mode!=="files_with_matches"&&meta.push(mode),{target,meta}}},shell:{displayName:input=>{const label=descriptionLabel(input);return label||(input?.run_in_background===!0?"Shell (background)":"Shell")},format:input=>{const command=stringField(input,"command");return command?stringField(input,"description")?.trim()?input.run_in_background===!0?{meta:["background"]}:{}:{target:previewLine(command,200)}:null}},shell_kill:{displayName:"Kill task",format:input=>{const taskId=stringField(input,"task_id");return taskId?{target:taskId}:null}},wait_task:{displayName:"Wait for task",format:input=>{const taskId=stringField(input,"task_id");if(!taskId)return null;const timeoutMs=input.timeout_ms;return{target:taskId,meta:typeof timeoutMs=="number"?[`${Math.round(timeoutMs/1e3)}s timeout`]:[]}}},edit:{displayName:"Edit",format:input=>{const path=stringField(input,"path");return path?{target:path,meta:input.replace_all===!0?["replace all"]:[]}:null}},multi_edit:{displayName:"Multi-edit",format:input=>{const path=stringField(input,"path");if(!path)return null;const edits=Array.isArray(input.edits)?input.edits.length:0;return{target:path,meta:edits>0?[`${edits} hunk${edits===1?"":"s"}`]:[]}}},write_file:{displayName:"Write",format:input=>{const path=stringField(input,"path");if(!path)return null;const content=stringField(input,"content"),meta=[];if(content!==void 0){const bytes=utf8ByteLength(content);meta.push(`${formatBytes(bytes)}`)}return{target:path,meta}}},spawn:{displayName:"Agent",format:input=>{const task=stringField(input,"task");if(!task)return null;const resume=stringField(input,"resume");return{target:previewLine(task,200),...resume?{meta:[`resumed ${resume}`]}:{}}}},generate_image:{displayName:input=>input?.list===!0?"Image models":"Generate image",format:input=>{if(input.list===!0)return{target:"list"};const prompt=stringField(input,"prompt");if(!prompt)return null;const meta=[stringField(input,"model"),stringField(input,"aspect_ratio"),typeof input.n=="number"&&input.n>1?`${Math.floor(input.n)} images`:void 0].filter(v=>typeof v=="string"&&v!=="");return{target:previewLine(prompt,200),...meta.length?{meta}:{}}}},codemode:{displayName:input=>descriptionLabel(input)??"Codemode",format:input=>{const description=stringField(input,"description")?.trim(),code=stringField(input,"code"),lines=code?code.split(`
59
+ `);prev.length;const at=mergeTargetIndex(prev,owner),target=at>=0?prev[at]:void 0,row=text=>tagEvent({kind:"thinking",text},owner,depth,turnId);if(target&&target.kind==="thinking"&&(turnId===void 0||target.turnId===void 0||target.turnId===turnId)){const next=prev.slice();return next[at]={...target,text:target.text+lines[0]},lines.length>1?next.splice(at+1,0,...lines.slice(1).map(row)):at===prev.length-1&&recordTailDelta(prev,next),next}const result=[...prev];if(lines[0]||lines.length>1){const first=row(lines[0]);result.push(options.onLaneOpen?options.onLaneOpen(first):first)}for(let i=1;i<lines.length;i++)result.push(row(lines[i]));return result}function discardThinking(events,owner,turnId){const kept=events.filter(e=>!((e.kind==="thinking"||e.kind==="markdown")&&e.turnId===turnId&&ownerOf(e)===owner));return kept.length===events.length?events:kept}function replaceTurnText(events,owner,turnId,texts){const first=events.findIndex(e=>e.kind==="markdown"&&e.turnId===turnId&&ownerOf(e)===owner);if(first<0)return events;const row=events[first],next=events.filter((e,i)=>i<first||!(e.kind==="markdown"&&e.turnId===turnId&&ownerOf(e)===owner));return next.splice(first,0,...texts.map(text=>({...row,text,streaming:!1}))),next}function finalizeStreamingMarkdown(events){let changed=!1;const next=events.map(e=>e.kind==="markdown"&&e.streaming?(changed=!0,{...e,streaming:!1}):e);return changed?next:events}function finalizeStreamingMarkdownForOwner(events,owner){for(let i=events.length-1;i>=0;i--){const e=events[i];if(e.kind!=="markdown"||!e.streaming||ownerOf(e)!==owner)continue;const next=events.slice();return next[i]={...e,streaming:!1},next}return events}const SMOOTH_BURST_CPS=600,SMOOTH_BURST_BACKLOG_CHARS=400,SMOOTH_MAX_CPS=4e3;function smoothCpsForBacklog(backlog){if(backlog<=0)return 0;if(backlog>=4e3)return SMOOTH_MAX_CPS;if(backlog<=SMOOTH_BURST_BACKLOG_CHARS)return 200+backlog/SMOOTH_BURST_BACKLOG_CHARS*400;const t=(backlog-SMOOTH_BURST_BACKLOG_CHARS)/3600;return SMOOTH_BURST_CPS+t*3400}function smoothCharsForTick(backlog,carry,dtMs){if(backlog<=0)return{take:0,carry:0};const want=smoothCpsForBacklog(backlog)*dtMs/1e3+carry,take=Math.floor(want);return take<=0?{take:0,carry:want}:take>=backlog?{take:backlog,carry:0}:{take,carry:want-take}}function takeChars(buf,n){if(buf.length<=n)return{taken:buf,rest:""};if(n<=0)return{taken:"",rest:buf};let end=n;const last=buf.charCodeAt(end-1);return last>=55296&&last<=56319&&end<buf.length&&end++,{taken:buf.slice(0,end),rest:buf.slice(end)}}let versions=0;function make(chunks,tail,prefixLength){return Object.freeze({chunks,tail,prefixLength,length:prefixLength+tail.length,version:++versions})}function isExchangeStart(event){return event.kind==="user-prompt"&&!event.childId&&!event.depth}function exchangeStarts(events){const starts=[];for(let i=1;i<events.length;i++){if(!isExchangeStart(events[i]))continue;let start=i;for(;start>0&&events[start-1].kind==="separator";)start--;start>0&&starts.push(start)}return starts}const arrays=new WeakMap,owners=new WeakMap,flats=new WeakMap;function remember(transcript,events){return arrays.set(transcript,events),owners.set(events,transcript),transcript}function emptyTranscript(){return remember(make([],[],0),[])}function transcriptFromArray(events,prev){const known=owners.get(events);if(known)return known;events.length;const starts=exchangeStarts(events);if(starts.length===0)return remember(make([],events,0),events);const reusable=new Map;for(const chunk of prev?.chunks??[])chunk.length>0&&reusable.set(chunk[0],chunk);const chunks=[];let from=0;for(const start of starts)chunks.push(reuse(reusable,events,from,start)),from=start;return remember(make(chunks,events.slice(from),from),events)}function reuse(reusable,events,from,to){const chunk=reusable.get(events[from]);if(chunk&&chunk.length===to-from){let same=!0;for(let k=1;k<chunk.length&&same;k++)same=chunk[k]===events[from+k];if(same)return chunk}return events.slice(from,to)}function transcriptArray(transcript){const known=arrays.get(transcript);if(known)return known;if(transcript.chunks.length===0)return remember(transcript,transcript.tail),transcript.tail;let flat=flats.get(transcript.chunks);flat||(transcript.prefixLength,flat=transcript.chunks.flat(),flats.set(transcript.chunks,flat)),transcript.length;const events=flat.concat(transcript.tail);return remember(transcript,events),events}function transcriptOfArray(events){return owners.get(events)}function settleTranscript(transcript){const{tail}=transcript,starts=exchangeStarts(tail);if(starts.length===0)return transcript;tail.length;const chunks=transcript.chunks.slice();let from=0;for(const start of starts)chunks.push(tail.slice(from,start)),from=start;return make(chunks,tail.slice(from),transcript.prefixLength+from)}function withTranscriptTail(transcript,tail,settle=!1){if(tail===transcript.tail)return transcript;const next=make(transcript.chunks,tail,transcript.prefixLength);return settle?settleTranscript(next):next}function appendTranscriptEvent(transcript,event){return withTranscriptTail(transcript,[...transcript.tail,event],isExchangeStart(event))}const facts=new WeakMap;function chunkFact(chunk,key,compute){let map=facts.get(chunk);if(map||(map=new Map,facts.set(chunk,map)),map.has(key))return map.get(key);`${key}`,chunk.length;const value=compute(chunk);return map.set(key,value),value}function replaceChunk(transcript,index2,chunk){const old=transcript.chunks[index2];if(chunk===old)return transcript;const chunks=transcript.chunks.slice();return chunks[index2]=chunk,make(chunks,transcript.tail,transcript.prefixLength-old.length+chunk.length)}function mapTranscript(transcript,update,touches){let chunks=null,prefixLength=transcript.prefixLength;transcript.chunks.forEach((chunk,i)=>{if(touches&&!touches(chunk))return;const next=update(chunk);next!==chunk&&(chunks??=transcript.chunks.slice(),chunks[i]=next,prefixLength+=next.length-chunk.length)});const tail=update(transcript.tail);return!chunks&&tail===transcript.tail?transcript:make(chunks??transcript.chunks,tail,prefixLength)}function hasStreamingMarkdown(events){return events.some(e=>e.kind==="markdown"&&e.streaming===!0)}const streams=chunk=>chunkFact(chunk,"streaming",hasStreamingMarkdown);function transcriptMarkdownDelta(transcript,delta,owner,depth,turnId,options){return withTranscriptTail(transcript,appendMarkdownDelta(transcript.tail,delta,owner,depth,turnId,options))}function transcriptThinkingLines(transcript,delta,owner,depth,turnId,options){return withTranscriptTail(transcript,appendThinkingLines(transcript.tail,delta,owner,depth,turnId,options))}function transcriptFinalizeStreamingMarkdownForOwner(transcript,owner){const tail=finalizeStreamingMarkdownForOwner(transcript.tail,owner);if(tail!==transcript.tail)return withTranscriptTail(transcript,tail);for(let i=transcript.chunks.length-1;i>=0;i--){const chunk=transcript.chunks[i];if(!streams(chunk))continue;const next=finalizeStreamingMarkdownForOwner(chunk,owner);if(next!==chunk)return replaceChunk(transcript,i,next)}return transcript}function turnsOf(events){return new Set(events.flatMap(e=>e.turnId!==void 0?[e.turnId]:[]))}function transcriptDiscardThinking(transcript,owner,turnId){return mapTranscript(transcript,events=>discardThinking(events,owner,turnId),chunk=>chunkFact(chunk,"turns",turnsOf).has(turnId))}function transcriptReplaceTurnText(transcript,owner,turnId,texts){return mapTranscript(transcript,events=>replaceTurnText(events,owner,turnId,texts),chunk=>chunkFact(chunk,"turns",turnsOf).has(turnId))}const progressKey=e=>`${e.childId??""}\0${e.callId??""}`;function progressKeysOf(events){return new Set(events.flatMap(e=>e.kind==="tool-progress"?[progressKey(e)]:[]))}function transcriptUpsertToolProgress(transcript,event){const{tail}=transcript,key=progressKey(event);if(event.kind==="tool-progress"&&!tail.some(e=>e.kind==="tool-progress"&&progressKey(e)===key))for(let i=transcript.chunks.length-1;i>=0;i--){const chunk=transcript.chunks[i];if(chunkFact(chunk,"progress",progressKeysOf).has(key))return replaceChunk(transcript,i,upsertToolProgress(chunk,event))}return withTranscriptTail(transcript,upsertToolProgress(tail,event))}function setupIdsOf(events){return new Set(events.flatMap(e=>{const id=readEnvironmentSetup(e)?.id;return id===void 0?[]:[id]}))}function transcriptUpsertEnvironmentSetup(transcript,event){const id=readEnvironmentSetup(event)?.id;if(id!==void 0){const at=transcript.chunks.findIndex(chunk=>chunkFact(chunk,"setups",setupIdsOf).has(id));if(at!==-1)return replaceChunk(transcript,at,upsertEnvironmentSetup(transcript.chunks[at],event))}return withTranscriptTail(transcript,upsertEnvironmentSetup(transcript.tail,event))}const SESSIONS_VERB_LABEL={create:"Create session",send:"Send to session",steer:"Steer session",cancel:"Cancel session",read:"Read session",transcript:"Session transcript",list:"List sessions"},TOOL_DISPLAY={read_file:{displayName:"Read",format:input=>{const path=stringField(input,"path");if(!path){const paths=readFileInputPaths(input);return paths.length===0?null:{target:paths[0],meta:paths.length>1?[`+${paths.length-1} more`]:[]}}const meta=[],offset=numberField(input,"offset"),limit=numberField(input,"limit");return offset!==void 0&&limit!==void 0&&limit>0?meta.push(`L${offset}–${offset+limit-1}`):offset!==void 0?meta.push(`from L${offset}`):limit!==void 0&&limit>0&&meta.push(`${limit} lines`),{target:path,meta}}},list_files:{displayName:"List",format:input=>({target:stringField(input,"path")??"."})},glob:{displayName:"Glob",format:input=>{const pattern=stringField(input,"pattern");if(!pattern)return null;const meta=[],limit=numberField(input,"limit");return limit!==void 0&&meta.push(`limit ${limit}`),{target:pattern,meta}}},grep:{displayName:"Grep",format:input=>{const pattern=stringField(input,"pattern");if(!pattern)return null;const target=`/${pattern}/`,meta=[],path=stringField(input,"path");path&&path!=="."&&meta.push(`in ${path}`);const glob=stringField(input,"glob");glob&&meta.push(glob);const type=stringField(input,"type");type&&meta.push(`type:${type}`),input["-i"]===!0&&meta.push("case-insensitive");const mode=stringField(input,"output_mode");return mode&&mode!=="files_with_matches"&&meta.push(mode),{target,meta}}},shell:{displayName:input=>{const label=descriptionLabel(input);return label||(input?.run_in_background===!0?"Shell (background)":"Shell")},format:input=>{const command=stringField(input,"command");return command?stringField(input,"description")?.trim()?input.run_in_background===!0?{meta:["background"]}:{}:{target:previewLine(command,200)}:null}},shell_kill:{displayName:"Kill task",format:input=>{const taskId=stringField(input,"task_id");return taskId?{target:taskId}:null}},wait_task:{displayName:"Wait for task",format:input=>{const taskId=stringField(input,"task_id");if(!taskId)return null;const timeoutMs=input.timeout_ms;return{target:taskId,meta:typeof timeoutMs=="number"?[`${Math.round(timeoutMs/1e3)}s timeout`]:[]}}},edit:{displayName:"Edit",format:input=>{const path=stringField(input,"path");return path?{target:path,meta:input.replace_all===!0?["replace all"]:[]}:null}},multi_edit:{displayName:"Multi-edit",format:input=>{const path=stringField(input,"path");if(!path)return null;const edits=Array.isArray(input.edits)?input.edits.length:0;return{target:path,meta:edits>0?[`${edits} hunk${edits===1?"":"s"}`]:[]}}},write_file:{displayName:"Write",format:input=>{const path=stringField(input,"path");if(!path)return null;const content=stringField(input,"content"),meta=[];if(content!==void 0){const bytes=utf8ByteLength(content);meta.push(`${formatBytes(bytes)}`)}return{target:path,meta}}},spawn:{displayName:"Agent",format:input=>{const task=stringField(input,"task");if(!task)return null;const resume=stringField(input,"resume");return{target:previewLine(task,200),...resume?{meta:[`resumed ${resume}`]}:{}}}},generate_image:{displayName:input=>input?.list===!0?"Image models":"Generate image",format:input=>{if(input.list===!0)return{target:"list"};const prompt=stringField(input,"prompt");if(!prompt)return null;const meta=[stringField(input,"model"),stringField(input,"aspect_ratio"),typeof input.n=="number"&&input.n>1?`${Math.floor(input.n)} images`:void 0].filter(v=>typeof v=="string"&&v!=="");return{target:previewLine(prompt,200),...meta.length?{meta}:{}}}},codemode:{displayName:input=>descriptionLabel(input)??"Codemode",format:input=>{const description=stringField(input,"description")?.trim(),code=stringField(input,"code"),lines=code?code.split(`
60
60
  `).filter(line=>line.trim()!==""&&!line.trimStart().startsWith("// @options:")):[],meta=lines.length>0?[`${lines.length} line${lines.length===1?"":"s"}`]:[];return description?{meta}:lines.length===0?null:{target:previewLine(lines[0].trim(),120),meta}}},browser_open:{displayName:"Browser",format:input=>({target:stringField(input,"url")??"open"})},browser_navigate:{displayName:"Navigate",format:input=>({target:stringField(input,"url")??stringField(input,"action")??""})},browser_snapshot:{displayName:"Snapshot",format:()=>({target:"page"})},browser_screenshot:{displayName:"Screenshot",format:input=>({target:stringField(input,"ref")??"viewport"})},browser_click:{displayName:"Click",format:input=>({target:browserTarget(input)})},browser_type:{displayName:"Type",format:input=>{const text=stringField(input,"text")??"",where=browserTarget(input);return{target:previewLine(JSON.stringify(text),80),...where?{meta:[`into ${where}`]}:{}}}},browser_press:{displayName:"Press",format:input=>({target:[...Array.isArray(input.modifiers)?input.modifiers.map(String):[],stringField(input,"key")??""].join("+")})},browser_scroll:{displayName:"Scroll",format:input=>({target:`${numberField(input,"dx")??0}, ${numberField(input,"dy")??0}`})},browser_wait_for:{displayName:"Wait for",format:input=>({target:stringField(input,"text")??stringField(input,"selector")??stringField(input,"urlIncludes")??""})},browser_evaluate:{displayName:"Evaluate",format:input=>({target:previewLine(stringField(input,"expression")??"",120)})},browser_console:{displayName:"Console",format:input=>({target:stringField(input,"level")??"all"})},browser_viewport:{displayName:"Viewport",format:input=>({target:viewportTarget(input)})},terminal_list:{displayName:"Terminals",format:()=>({target:"list"})},terminal_read:{displayName:"Read terminal",format:input=>({target:stringField(input,"id")??""})},terminal_write:{displayName:"Type in terminal",format:input=>{const text=stringField(input,"text"),keys=Array.isArray(input.keys)?input.keys.map(String).filter(Boolean):[],typed=[text?previewLine(JSON.stringify(text),80):"",...keys].filter(Boolean).join(" + "),id=stringField(input,"id");return{target:typed||(id??""),...id&&typed?{meta:[id]}:{}}}},tool_search:{displayName:"Search tools",format:input=>{const query=stringField(input,"query"),names=Array.isArray(input.names)?input.names.length:0;return query?{target:`“${query}”`}:names>0?{target:`${names} tool${names===1?"":"s"}`}:null}},call_tool:{displayName:"Call tool",format:input=>{const name=stringField(input,"name");return name?{target:name,meta:["malformed call"]}:null}},skills_use:{displayName:input=>(input?stringField(input,"mode"):void 0)==="deactivate"?"Disable skill":"Enable skill",format:input=>{const name=stringField(input,"name");return name?{target:name}:null}},skills_read:{displayName:"Read skill",format:input=>{const name=stringField(input,"name"),path=stringField(input,"path");return name?{target:path?`${name}/${path}`:name}:null}},skills_run_script:{displayName:"Run script",format:input=>{const name=stringField(input,"name"),script=stringField(input,"script");if(!name||!script)return null;const meta=[`skill ${name}`],args=Array.isArray(input.args)?input.args:null;return args&&args.length>0&&meta.push(previewLine(args.map(String).join(" "),80)),{target:script,meta}}},todowrite:{displayName:"Todos",format:input=>{const todos=Array.isArray(input.todos)?input.todos:null;if(!todos)return null;const counts={pending:0,in_progress:0,completed:0,cancelled:0};for(const t of todos){if(!t||typeof t!="object")continue;const status=t.status;typeof status=="string"&&status in counts&&(counts[status]+=1)}const meta=[];return counts.completed&&meta.push(`${counts.completed} done`),counts.in_progress&&meta.push(`${counts.in_progress} in progress`),counts.pending&&meta.push(`${counts.pending} pending`),counts.cancelled&&meta.push(`${counts.cancelled} cancelled`),{target:`${todos.length} item${todos.length===1?"":"s"}`,meta}}},todoread:{displayName:"Todos",format:()=>({target:"read"})},ask_user:{displayName:"Ask user",format:input=>{const questions=Array.isArray(input.questions)?input.questions.length:0;return questions===0?null:{target:`${questions} question${questions===1?"":"s"}`}}},present_plan:{displayName:"Present plan",format:input=>{const title=stringField(input,"title");return title?{target:title}:null}},sessions:{displayName:input=>SESSIONS_VERB_LABEL[stringField(input??{},"verb")??""]??"Sessions",format:input=>{const verb=stringField(input,"verb"),id=stringField(input,"sessionId"),limit=numberField(input,"limit"),ref=id?{target:shortSessionId(id),sessionId:id}:null;switch(verb){case"create":{const prompt=stringField(input,"prompt");if(!prompt)return null;const cwd=stringField(input,"cwd");return{target:stringField(input,"title")??"new worker",meta:cwd?[`in ${cwd}`]:[],detail:prompt}}case"send":case"steer":{const text=stringField(input,verb==="send"?"prompt":"message");return!text||!ref?null:{...ref,detail:text}}case"cancel":case"read":return ref;case"transcript":return ref?{...ref,meta:limit!==void 0?[`last ${limit} turns`]:[]}:null;case"list":return{target:"all sessions",meta:limit!==void 0?[`limit ${limit}`]:[]};default:return null}}}},SENTENCE_WORD=/^[a-z][a-z']*$/,PREFIXED_WORD=/^(?:anti|auto|co|counter|cross|de|mid|multi|non|out|over|post|pre|re|self|semi|sub|un|under)-[a-z][a-z'-]*$/;function descriptionLabel(input){const description=input?stringField(input,"description")?.trim():void 0;if(!description)return;const line=previewLine(description,120),first=line.split(/\s/,1)[0];return SENTENCE_WORD.test(first)||PREFIXED_WORD.test(first)?line.charAt(0).toUpperCase()+line.slice(1):line}function displayNameFor(name,input){const entry=TOOL_DISPLAY[name];return entry?typeof entry.displayName=="function"?entry.displayName(input):entry.displayName:sentenceCase(name.startsWith("mcp_")?name.slice(4):name)}function toolInputCode(name,input){if(!input)return null;if(name==="codemode"){const code=stringField(input,"code");return!code||code.trim()===""?null:{code:code.replace(/^\n+|\s+$/g,""),language:"javascript"}}if(name==="shell"||name==="bash"){const command=stringField(input,"command");return!command||command.trim()===""?null:{code:command.replace(/^\n+|\s+$/g,""),language:"bash"}}return null}function formatToolCall(name,input){const entry=TOOL_DISPLAY[name];if(!entry)return null;try{return entry.format(input)}catch{return null}}function browserTarget(input){const x=numberField(input,"x"),y=numberField(input,"y");return stringField(input,"ref")??stringField(input,"selector")??(x!==void 0&&y!==void 0?`${x}, ${y}`:"")}function viewportTarget(input){if(input.reset===!0)return"reset";const w=numberField(input,"width"),h=numberField(input,"height"),size=w!==void 0||h!==void 0?`${w??"…"}×${h??"…"}`:void 0,turn=input.landscape===!0?"landscape":input.landscape===!1?"portrait":void 0;return[stringField(input,"device")??size,turn,stringField(input,"colorScheme")].filter(Boolean).join(", ")}function stringField(input,key){const v=input[key];return typeof v=="string"&&v.length>0?v:void 0}function numberField(input,key){const v=input[key];return typeof v=="number"&&Number.isFinite(v)?v:void 0}function sentenceCase(s){const words2=s.split(/[-_\s]+/).filter(Boolean).map(w=>w.toLowerCase());return words2.length===0?"":(words2[0]=(words2[0][0]?.toUpperCase()??"")+words2[0].slice(1),words2.join(" "))}function reconcileEvents(prev,next){if(prev.length===0)return[...next];const pool=new Map;for(const event of prev){const key=bucketKey(event),bucket=pool.get(key);bucket?bucket.push(event):pool.set(key,[event])}const out=next.map(event=>{const bucket=pool.get(bucketKey(event));if(!bucket)return event;const hit=bucket.findIndex(candidate=>sameEvent(candidate,event));return hit===-1?event:bucket.splice(hit,1)[0]});return out.length===prev.length&&out.every((event,i)=>event===prev[i])?prev:out}function bucketKey(event){const text=typeof event.text=="string"?event.text.length:0;return`${event.kind}\0${event.turnId??""}\0${event.callId??""}\0${event.childId??""}\0${text}`}const TIMING_KEYS=new Set(["receivedAt","startedAt","durationMs"]);function sameEvent(a,b){return a===b?!0:a.kind==="user-prompt"&&b.kind==="user-prompt"?a.text===b.text&&!!a.synthetic==!!b.synthetic:deepEqual(a,b,TIMING_KEYS)}function deepEqual(a,b,ignore){if(a===b)return!0;if(typeof a!="object"||typeof b!="object"||a===null||b===null)return!1;if(Array.isArray(a)||Array.isArray(b))return Array.isArray(a)&&Array.isArray(b)&&a.length===b.length&&a.every((item,i)=>deepEqual(item,b[i]));const objA=a,objB=b,keys=Object.keys(objA).filter(key=>!ignore?.has(key));return keys.length===Object.keys(objB).filter(key=>!ignore?.has(key)).length&&keys.every(key=>key in objB&&deepEqual(objA[key],objB[key]))}const collator=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function keyOf(value){return typeof value=="string"?value:typeof value=="object"?JSON.stringify(value):String(value)}function groupKeysOf(value){return value==null?[]:Array.isArray(value)?[...new Set(value.filter(v=>v!=null).map(keyOf))]:[keyOf(value)]}function groupRows(rows,groupBy,options={}){const issues=validateGroupBy(groupBy);if(issues.length>0)throw new SessionQueryError(issues);const field=parseFieldPath(groupBy.field),groups=new Map,missing=[];for(const row of rows){const keys=groupKeysOf(readParsedField(row,field));keys.length===0&&missing.push(row);for(const key of keys){let group=groups.get(key);group||(group={key,label:(groupBy.labels&&Object.hasOwn(groupBy.labels,key)?groupBy.labels[key]:void 0)??(options.labels&&Object.hasOwn(options.labels,key)?options.labels[key]:void 0)??key,rows:[]},groups.set(key,group)),group.rows.push(row)}}const byLabel2=(a,b)=>collator.compare(a.label,b.label)||(a.key<b.key?-1:a.key>b.key?1:0),order=groupBy.order??"asc";let list=[...groups.values()];if(order==="asc"||order==="desc")list.sort(byLabel2),order==="desc"&&list.reverse();else{const rankOf=new Map;order.forEach((key,i)=>{rankOf.has(key)||rankOf.set(key,i)}),list=[...list.filter(g=>rankOf.has(g.key)).sort((a,b)=>rankOf.get(a.key)-rankOf.get(b.key)),...list.filter(g=>!rankOf.has(g.key)).sort(byLabel2)]}return missing.length>0&&list.push({key:null,label:options.missingLabel??"None",rows:missing}),list}const DEFAULT_SPACE="default";function flattenQuery(query){if("not"in query&&query.not!==void 0)return{not:flattenQuery(query.not)};for(const kind of["all","any"]){const list=query[kind];if(!Array.isArray(list))continue;const merged2=list.map(flattenQuery).flatMap(child=>{const inner=child[kind];return Array.isArray(inner)?inner:[child]});return merged2.length===1?merged2[0]:kind==="all"?{all:merged2}:{any:merged2}}return query}function membership(space,knownSpaceIds){return{any:[{field:"isMain",eq:!0},space.id===DEFAULT_SPACE?{field:"spaceId",nin:[...new Set(knownSpaceIds.filter(id=>id!==DEFAULT_SPACE))]}:{field:"spaceId",eq:space.id},...space.query?[space.query]:[]]}}function viewQuery(input){const{space,view}=input,parts=[];space&&parts.push(membership(space,input.knownSpaceIds)),view.project&&parts.push({field:"projectName",eq:view.project}),view.agent&&parts.push({field:"agentId",eq:view.agent}),(view.archive==="active"||view.archive==="archived")&&parts.push({field:"archived",eq:view.archive==="archived"}),view.updatedSince!==void 0&&parts.push({field:"updatedAt",gte:view.updatedSince}),parts.push(...view.filters??[]);const query=flattenQuery({all:parts}),issues=validateQuery(query,"query");return issues.length>0?{issues}:{query}}const CONTINUE_PROMPT="Continue from where you stopped.";function sessionKey(hostKey,sessionId){if(!hostKey||hostKey==="local")return sessionId.includes("")?`${LOCAL_HOST_KEY}${sessionId}`:sessionId;if(hostKey.includes(""))throw new Error("A host key cannot contain U+001F.");return`${hostKey}${sessionId}`}function parseSessionKey(key){const at=key.indexOf("");return at<0?{hostKey:LOCAL_HOST_KEY,sessionId:key}:{hostKey:key.slice(0,at),sessionId:key.slice(at+1)}}const MAX_IMAGE_ATTACHMENT_BYTES=3670016,MAX_MEDIA_ATTACHMENT_BYTES=8388608,MAX_FILE_ATTACHMENT_BYTES=20971520,ATTACHMENT_SNIFF_BYTES=8192,SENDABLE_IMAGE_TYPES=new Set(["image/png","image/jpeg","image/gif","image/webp"]),IMAGE_BY_EXTENSION={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",gif:"image/gif",webp:"image/webp",avif:"image/avif",bmp:"image/bmp",ico:"image/x-icon",svg:"image/svg+xml",heic:"image/heic",heif:"image/heif",tif:"image/tiff",tiff:"image/tiff"},AV_BY_EXTENSION={mp4:{kind:"video",mediaType:"video/mp4"},m4v:{kind:"video",mediaType:"video/mp4"},mov:{kind:"video",mediaType:"video/quicktime"},webm:{kind:"video",mediaType:"video/webm"},ogv:{kind:"video",mediaType:"video/ogg"},mkv:{kind:"video",mediaType:"video/x-matroska"},avi:{kind:"video",mediaType:"video/x-msvideo"},mp3:{kind:"audio",mediaType:"audio/mpeg"},wav:{kind:"audio",mediaType:"audio/wav"},m4a:{kind:"audio",mediaType:"audio/mp4"},aac:{kind:"audio",mediaType:"audio/aac"},ogg:{kind:"audio",mediaType:"audio/ogg"},oga:{kind:"audio",mediaType:"audio/ogg"},opus:{kind:"audio",mediaType:"audio/ogg"},weba:{kind:"audio",mediaType:"audio/webm"},flac:{kind:"audio",mediaType:"audio/flac"},aif:{kind:"audio",mediaType:"audio/aiff"},aiff:{kind:"audio",mediaType:"audio/aiff"}},TEXT_TYPED_AS_AV=new Set(["video/mp2t","video/vnd.dlna.mpeg-tts","audio/x-mpegurl","audio/mpegurl"]);function avMediaOf(name,mediaType){const declared=mediaType.split(";")[0].trim().toLowerCase();if(!TEXT_TYPED_AS_AV.has(declared))return declared.startsWith("audio/")?{kind:"audio",mediaType:declared}:declared.startsWith("video/")?{kind:"video",mediaType:declared}:AV_BY_EXTENSION[extensionOf(name)]}const EXPORT_AS_PDF=new Set(["doc","docx","odt","pages","ppt","pptx","odp","key","xls","xlsx","ods","numbers"]);function isTextType(mime){return mime.startsWith("text/")||mime==="application/json"||mime==="application/xml"||mime==="application/javascript"||mime==="application/typescript"||mime.endsWith("+json")||mime.endsWith("+xml")}function extensionOf(name){const base=name.slice(name.lastIndexOf("/")+1).toLowerCase(),dot=base.lastIndexOf(".");return dot>0?base.slice(dot+1):""}const tooLarge=(size,limit)=>({kind:"refuse",reason:"too-large",size,limit});function planAttachment(file){if(file.size===0)return{kind:"refuse",reason:"empty"};const declared=file.mediaType.split(";")[0].trim().toLowerCase(),ext=extensionOf(file.name),image=declared.startsWith("image/")?declared:IMAGE_BY_EXTENSION[ext];if(image)return SENDABLE_IMAGE_TYPES.has(image)&&file.size<=3670016?{kind:"image",mediaType:image}:{kind:"convert-image",mediaType:image};const av=avMediaOf(file.name,declared);return av?file.size>8388608?tooLarge(file.size,MAX_MEDIA_ATTACHMENT_BYTES):av:declared==="application/pdf"||ext==="pdf"||file.head.startsWith("%PDF-")?file.size>20971520?tooLarge(file.size,MAX_FILE_ATTACHMENT_BYTES):{kind:"pdf",mediaType:"application/pdf"}:EXPORT_AS_PDF.has(ext)?{kind:"refuse",reason:"export-pdf"}:looksBinary(file.head)?{kind:"refuse",reason:"unsupported"}:file.size>20971520?tooLarge(file.size,MAX_FILE_ATTACHMENT_BYTES):{kind:"text",mediaType:isTextType(declared)?declared:"text/plain"}}function authPrimaryAction(auth){return auth.kind==="busy"||auth.kind==="network"?"retry":"sign-in"}function authOffersSignInFallback(auth){return auth.kind==="busy"}function authProviderKeys(auth){return[...new Set([auth.providerId,auth.provider].filter(key=>!!key))]}function sameAuthTarget(a,b){return a.source===b.source&&authProviderKeys(a).some(key=>authProviderKeys(b).includes(key))&&(a.accountId??null)===(b.accountId??null)}function authFailureHeadline(auth,label=auth.provider){const who=auth.accountLabel?`${label} (${auth.accountLabel})`:label;switch(auth.kind){case"expired":return`${who} sign-in expired`;case"revoked":return`${who} sign-in was revoked`;case"missing":return`Not signed in to ${who}`;case"busy":return`${who} sign-in is stuck refreshing in another process${auth.holderPid?` (pid ${auth.holderPid})`:""}`;case"network":return`Couldn't reach ${label} to refresh the sign-in`;case"rejected":return`${who} rejected the credentials`}}const SUBCOMMAND_PROGRAMS=new Set(["git","gh","bun","npm","pnpm","yarn","npx","bunx","cargo","go","docker","kubectl","make","uv","pip","pip3","brew","deno","node","playwright","vitest","jest","tsc","eslint","prettier"]),WRAPPERS=new Set(["sudo","time","nice","nohup","exec","command","caffeinate"]),SETUP=new Set(["cd","pushd","popd","export","set","source",".","unset","true","mkdir"]);function splitSegments(command){const out=[];let cur="",quote=null;for(let i=0;i<command.length;i++){const ch=command[i];if(quote){ch===quote&&(quote=null),cur+=ch;continue}if(ch==='"'||ch==="'"){quote=ch,cur+=ch;continue}const two=command.slice(i,i+2);if(two==="&&"||two==="||"){out.push(cur),cur="",i++;continue}if(ch===";"||ch==="|"||ch===`
61
61
  `){out.push(cur),cur="";continue}cur+=ch}return out.push(cur),out.map(s=>s.trim()).filter(Boolean)}function words(segment){const out=[];for(const m of segment.matchAll(/"([^"]*)"|'([^']*)'|(\S+)/g))out.push(m[1]??m[2]??m[3]??"");return out}function segmentGist(segment){let w=words(segment);for(;;){if(w.length===0)return null;const head=w[0];if(/^[A-Z_]\w*=/i.test(head))w=w.slice(1);else if(WRAPPERS.has(head))w=w.slice(1);else if(head==="env")for(w=w.slice(1);w[0]&&(w[0].startsWith("-")||/^[A-Z_]\w*=/i.test(w[0]));){const flag=w[0];w=w.slice(1),flag==="-u"&&w[0]&&(w=w.slice(1))}else if(head==="timeout"&&w[1]&&/^\d/.test(w[1]))w=w.slice(2);else break}const program=w[0].split("/").pop();if(SETUP.has(program))return null;if(!SUBCOMMAND_PROGRAMS.has(program))return program;const rest=w.slice(1).filter(arg=>!arg.startsWith("-"));let sub=rest[0];if((program==="npx"||program==="bunx")&&sub){const tool=sub.split("/").pop(),next=rest[1];return SUBCOMMAND_PROGRAMS.has(tool)&&next&&!next.includes("/")&&!next.includes(".")?`${tool} ${next}`:tool}return(sub==="run"||sub==="exec")&&rest[1]&&["bun","npm","pnpm","yarn"].includes(program)?`${program} ${sub} ${rest[1]}`:(sub&&(sub.includes("/")||/\.[a-z]+$/i.test(sub))&&(sub=void 0),sub?`${program} ${sub}`:program)}function commandGist(command){const gists=splitSegments(command.replace(/<<-?\s*(['"]?)(\w+)\1[\s\S]*?(?:\n\2\b|$)/g,"")).map(segmentGist).filter(g=>g!==null);return gists.length===0?{gist:"a command",more:0}:{gist:gists[0],more:gists.length-1}}function splitPath(path){const clean=path.replace(/\/+$/,""),i=clean.lastIndexOf("/");return i<0?{name:clean,dir:""}:{name:clean.slice(i+1),dir:clean.slice(0,i)}}function str$2(input,key){const v=input?.[key];return typeof v=="string"&&v.trim()!==""?v:void 0}function editCounts(edit){if(!edit)return null;let added=0,removed=0;for(const h of edit.hunks)for(const d of computeLineDiff(h.oldString,h.newString))d.op==="add"?added++:d.op==="remove"&&removed++;return{added,removed}}function viewportLabel(input){if(input?.reset===!0)return"Reset the viewport";const id=str$2(input,"device");if(id)return`Showed the page as ${BROWSER_DEVICES.find(d=>d.id===id)?.label??id}`;const w=input?.width,h=input?.height;if(typeof w=="number"||typeof h=="number")return`Resized the page to ${typeof w=="number"?w:"…"}×${typeof h=="number"?h:"…"}`;if(typeof input?.landscape=="boolean")return input.landscape?"Turned the page to landscape":"Turned the page to portrait";const scheme=str$2(input,"colorScheme");return scheme?`Switched to the ${scheme==="system"?"system":scheme} color scheme`:"Changed the viewport"}function shortUrl(url){const short=url.replace(/^https?:\/\//,"").replace(/\/$/,"");return short.length>48?`${short.slice(0,47)}…`:short}function browserOverview(tool){const input=tool.input,url=str$2(input,"url"),head=typeof tool.result=="string"&&tool.ok?tool.result.split(`
62
62
  `)[0].replace(/\. No navigation, dialog or error\.$|\.$/,""):"";switch(tool.name){case"browser_open":return url?{label:`Opened ${shortUrl(url)}`,title:url}:{label:"Opened the browser"};case"browser_navigate":{const action=str$2(input,"action");return action==="back"?{label:"Went back"}:action==="forward"?{label:"Went forward"}:action==="reload"?{label:"Reloaded the page"}:url?{label:`Went to ${shortUrl(url)}`,title:url}:{label:"Navigated"}}case"browser_snapshot":return{label:"Read the page"};case"browser_screenshot":return{label:"Took a screenshot"};case"browser_click":return{label:head.startsWith("Clicked")?head:`Clicked ${tool.target??"the page"}`};case"browser_type":return{label:head.startsWith("Typed")?head:"Typed in the page"};case"browser_press":return{label:head.startsWith("Pressed")?head:`Pressed ${str$2(input,"key")??"a key"}`};case"browser_scroll":return{label:"Scrolled the page"};case"browser_wait_for":{const what=str$2(input,"text")??str$2(input,"selector")??str$2(input,"urlIncludes");return{label:what?`Waited for “${what.length>40?`${what.slice(0,39)}…`:what}”`:"Waited"}}case"browser_evaluate":{const expression=str$2(input,"expression")??"";return{label:"Ran a script in the page",...expression?{title:expression.slice(0,600)}:{}}}case"browser_console":return{label:"Read the console"};case"browser_viewport":return{label:viewportLabel(input)};default:return null}}function toolOverview(tool){const input=tool.input;if(tool.name.startsWith("browser_")){const browser=browserOverview(tool);if(browser)return browser}switch(tool.name){case"shell":case"bash":{const command=str$2(input,"command")??tool.target??"",description=descriptionLabel(input);if(description)return{label:description,title:command.slice(0,600)};const{gist,more}=commandGist(command);return{label:`Ran ${gist}`,...more>0?{hint:`+${more}`}:{},title:command.slice(0,600)}}case"read_file":{const batch=str$2(input,"path")?[]:readFileInputPaths(input);if(batch.length>1)return{label:`Read ${splitPath(batch[0]).name} +${batch.length-1}`,title:batch.join(`
@@ -74,7 +74,7 @@ All 12 tests pass.`},{kind:"run-summary",turnId:TURN,text:"",runSummary:{modelId
74
74
  `&&(e.lex=""),e.pos++;continue;case"block":if(c2==="*"){if(pos+1>=len)return STALL;if(src[pos+1]==="/"){e.lex="",e.pos+=2;continue}}e.pos++;continue;case"re":case"reclass":if(c2==="\\"){if(pos+1>=len)return STALL;e.pos+=2;continue}c2===`
75
75
  `?e.lex="":e.lex==="reclass"&&c2==="]"?e.lex="re":e.lex==="re"&&c2==="["?e.lex="reclass":e.lex==="re"&&c2==="/"&&(e.lex=""),e.pos++;continue}const frame=e.frames[e.frames.length-1];if(frame==="tpl"){if(c2==="\\"){if(pos+1>=len)return STALL;e.pos+=2}else if(c2==="`")e.frames.pop(),e.prevSig=")",e.prevSigPos=pos,e.pos++;else if(c2==="$"){if(pos+1>=len)return STALL;src[pos+1]==="{"?(e.frames.push(0),e.prevSig="{",e.prevSigPos=pos+1,e.pos+=2):e.pos++}else e.pos++;continue}if(isSpace(c2)){e.pos++;continue}if(c2==="/"){if(pos+1>=len)return STALL;const next=src[pos+1];if(next==="/"){e.lex="line",e.pos+=2;continue}if(next==="*"){e.lex="block",e.pos+=2;continue}e.hasCode=!0,expressionMayStart(src,e)&&(e.lex="re"),e.prevSig="/",e.prevSigPos=pos,e.pos++;continue}if(c2==="}"){if(frame===0){if(e.frames.pop(),e.frames.length===0)return e.end=pos+1,DONE;e.pos++;continue}e.frames[e.frames.length-1]=frame-1,e.prevSig="}",e.prevSigPos=pos,e.pos++;continue}if(c2==="<"&&expressionMayStart(src,e)){if(pos+1>=len)return STALL;if(isLetter(src[pos+1])){e.parts.push({kind:"code",code:src.slice(e.partStart,pos)}),e.nested=newMachine(shared,"single",pos);continue}}e.hasCode=!0,c2==='"'?e.lex="dq":c2==="'"?e.lex="sq":c2==="`"?e.frames.push("tpl"):c2==="{"&&(e.frames[e.frames.length-1]=frame+1),e.prevSig=c2,e.prevSigPos=pos,e.pos++}}function finishExpr(e,src){const close=e.end-1,parts=e.parts.slice();return(e.partStart<close||parts.length===0)&&parts.push({kind:"code",code:src.slice(e.partStart,close)}),{source:src.slice(e.start+1,close),parts,empty:!e.hasCode,start:e.start,end:e.end}}function advanceFence(state,source){(state.finished||source.length<state.length||source.slice(Math.max(0,state.length-TAIL),state.length)!==state.tail)&&Object.assign(state,createFenceState());const m=state.machine;return index(m.shared,source),state.length=source.length,state.tail=source.slice(Math.max(0,source.length-TAIL)),checkSize(m)||run(m,source,!1),snapshot(m)}function finishFence(state,source){advanceFence(state,source);const m=state.machine;if(state.finished=!0,!m.shared.tooLarge){run(m,source,!0);for(let i=m.stack.length-1;i>=1;i--){const element=m.stack[i];report(m.shared,element.start,`<${element.name}> is not closed. Add </${element.name}>.`)}}return{nodes:m.root.children,refs:m.shared.refs,errors:m.shared.errors}}function createFenceParser(){const state=createFenceState();return{state,update:source=>advanceFence(state,source),finish:source=>finishFence(state,source)}}function checkSize(m){return m.shared.tooLarge?!0:m.shared.bytes<=VIEW_LIMITS.sourceBytes?!1:(m.shared.tooLarge=!0,report(m.shared,0,`The view source is larger than ${VIEW_LIMITS.sourceBytes/1024} KB. Read large data through a data: ref.`),m.root.children=[],m.stack=[m.root],m.pending=void 0,!0)}function snapshot(m){const children=m.root.children,last=children[children.length-1],open=last?.kind==="element"&&!last.closed?last:void 0;return{nodes:open?children.slice(0,-1):children.slice(),...open?{open}:{},refs:m.shared.refs,errors:m.shared.errors}}function parseCommandInvocation(prompt,known){const body=prompt.trimStart();if(body[0]!=="/")return null;const afterSlash=body.slice(1),wsIdx=afterSlash.search(/\s/),typed=(wsIdx===-1?afterSlash:afterSlash.slice(0,wsIdx)).toLowerCase();if(typed.length===0)return null;let canonical2;for(const entry of known){const name=typeof entry=="string"?entry:entry.name;if(name.toLowerCase()===typed){canonical2=name;break}if(typeof entry!="string"&&entry.aliases?.some(a=>a.toLowerCase()===typed)){canonical2=name;break}}if(canonical2===void 0)return null;const args=(wsIdx===-1?"":afterSlash.slice(wsIdx+1)).trim();return{name:canonical2,invokedAs:typed,args,argv:args.length>0?args.split(/\s+/):[]}}const VIEW_STATE_LIMITS={valueBytes:1024,sliderValues:50,searchChars:200},VIEW_CONTROL_TYPES=["Segmented","Select","Slider","Toggle","Search"];function stateJsonBytes(value){return new TextEncoder().encode(JSON.stringify(value??null)).length}function viewStateKey(vars,state){return JSON.stringify(vars.map(v=>(Object.hasOwn(state,v.name)?state[v.name]:v.initial)??null))}function initialViewState(vars){return Object.fromEntries(vars.map(v=>[v.name,v.initial]))}function viewControls(tree){const out=[],walk2=(children,path)=>{children.forEach((child,index2)=>{typeof child!="string"&&(VIEW_CONTROL_TYPES.includes(child.type)&&typeof child.props.bind=="string"&&out.push({node:child,path:[...path,index2]}),walk2(child.children,[...path,index2]))})};return walk2(tree.children,[]),out}function controlOptions(node){return(Array.isArray(node.props.options)?node.props.options:[]).flatMap(option=>{if(typeof option=="string")return[{value:option,label:option}];if(option&&typeof option=="object"&&!Array.isArray(option)&&"value"in option){const value=option.value??null;return[{value,label:typeof option.label=="string"?option.label:String(value)}]}return[]})}function decimals(value){const text=String(value),at=text.indexOf(".");return at===-1?0:Math.min(10,text.length-at-1)}function sliderRange(props){const{min,max}=props,step=props.step??1;if(!(typeof min!="number"||typeof max!="number"||typeof step!="number")&&!(!Number.isFinite(min)||!Number.isFinite(max)||!(step>0)||max<min))return{min,max,step}}function snapSlider(value,range){const places=Math.max(decimals(range.min),decimals(range.step)),count=Math.floor((range.max-range.min)/range.step+1e-9),index2=Math.min(count,Math.max(0,Math.round((value-range.min)/range.step)));return Number((range.min+index2*range.step).toFixed(places))}function sliderValues(range,cap=VIEW_STATE_LIMITS.sliderValues){const count=Math.floor((range.max-range.min)/range.step+1e-9)+1;if(!(count>cap))return Array.from({length:count},(_,i)=>snapSlider(range.min+i*range.step,range))}function controlValues(node){switch(node.type){case"Segmented":case"Select":return controlOptions(node).map(option=>option.value);case"Toggle":return[!1,!0];case"Slider":{const range=sliderRange(node.props);return range?sliderValues(range):void 0}default:return}}function storedStateTree(view,state){const vars=view.states?.vars;if(!vars||vars.length===0)return view.tree;const key=viewStateKey(vars,state);return key===viewStateKey(vars,{})?view.tree:view.states?.trees?.[key]}const CUSTOM_FRAMES_MAX=3,CUSTOM_FRAME_MAX_HEIGHT=2e3,CUSTOM_FRAME_DEFAULT_HEIGHT=240,CUSTOM_MESSAGE_MAX_CHARS=4096,CUSTOM_PAGE_PROBLEMS_MAX=5,IMAGE_NAME_MAX_CHARS=200,CUSTOM_HOST_FUNCTION="__zidaneViewHost",CUSTOM_CONSOLE_PREFIX="⁣zg-view:",PROBLEM_KINDS=["console-error","overflow","empty"];function parseViewProblem(raw){if(!raw||typeof raw!="object"||Array.isArray(raw))return;const{kind,message}=raw;if(!(typeof kind!="string"||!PROBLEM_KINDS.includes(kind))&&!(message!==void 0&&typeof message!="string"))return{kind,message:(message??"").replace(/[\u0000-\u001F\u007F]+/g," ").trim().slice(0,500)}}function nodePathOf(tree,node){const walk2=(children,path)=>{for(let i=0;i<children.length;i++){const child=children[i];if(typeof child=="string")continue;if(child===node)return[...path,i];const found=walk2(child.children,[...path,i]);if(found)return found}};return walk2(tree.children,[])}const VAR_NAME=/^--zg-[a-z0-9-]{1,64}$/,VAR_VALUE_BAD=/[;{}<>\\\n\r]|url\s*\(|expression\s*\(|@import/i;function parseCustomTheme(raw){const out={};if(!raw||typeof raw!="object"||Array.isArray(raw))return out;let count=0;for(const[name,value]of Object.entries(raw)){if(count>=400)break;if(!VAR_NAME.test(name)||typeof value!="string")continue;const flat=value.replace(/\s+/g," ").trim();flat.length>256||VAR_VALUE_BAD.test(flat)||(out[name]=flat,count++)}return out}function scriptJson(value){return JSON.stringify(value??null).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}const DATA_TAG="data";`${JSON.stringify(CUSTOM_HOST_FUNCTION)}`;function customDataMessage(channel,data){const text=JSON.stringify({zgView:DATA_TAG,channel,data:data??null});return text.length>263168?void 0:text}function customHostScript(message){return`void (typeof window[${JSON.stringify(CUSTOM_HOST_FUNCTION)}] === 'function' && window[${JSON.stringify(CUSTOM_HOST_FUNCTION)}](${scriptJson(message)}))`}function customThemeCss(theme){return`:root{${Object.entries(parseCustomTheme(theme)).map(([name,value])=>`${name}:${value} !important`).join(";")}}`}function parseCustomFrameMessage(raw,channel){if(typeof raw!="string"||!channel)return;const long=raw.length>CUSTOM_MESSAGE_MAX_CHARS;if(long&&(raw.length>14680064||!raw.startsWith('{"kind":"image"')))return;let value;try{value=JSON.parse(raw)}catch{return}if(!value||typeof value!="object"||Array.isArray(value))return;const message=value;if(!(message.zgView!=="custom"||message.channel!==channel)){if(message.kind==="image"){const src=customImageSource(message.src);return!src||message.name!==void 0&&typeof message.name!="string"?void 0:{kind:"image",src,name:cleanText(message.name??"",IMAGE_NAME_MAX_CHARS)}}if(!long){if(message.kind==="open-link"){const url=customLinkUrl(message.url);return url?{kind:"open-link",url}:void 0}if(message.kind==="key")return parseCustomKey(message);if(message.kind==="height"){const height=message.height;return typeof height!="number"||!Number.isFinite(height)||height<0?void 0:{kind:"height",height:Math.min(Math.round(height),CUSTOM_FRAME_MAX_HEIGHT)}}if(message.kind==="problem"){const problem=parseViewProblem(message.problem);return problem?{kind:"problem",problem}:void 0}}}}function cleanText(text,max){return text.replace(/[\u0000-\u001F\u007F]+/g," ").trim().slice(0,max)}function customLinkUrl(raw){if(typeof raw!="string"||raw.length>2048)return;let url;try{url=new URL(raw)}catch{return}if(!(url.protocol!=="http:"&&url.protocol!=="https:"||url.username||url.password||url.href.length>2048))return url.href}const IMAGE_DATA_URL=/^data:image\/(?:png|jpeg|gif|webp|avif|svg\+xml)(?:;[\w.+-]+=[\w.+-]+)*(?:;base64)?,[^\s"'<>\\]+$/i;function customImageSource(raw){return typeof raw=="string"&&raw.length<=14680064&&IMAGE_DATA_URL.test(raw)?raw:void 0}const KEY_CODE=/^\w{0,32}$/;function parseCustomKey(message){const{key,code,ctrlKey,metaKey,altKey,shiftKey,repeat}=message,flags=[ctrlKey,metaKey,altKey,shiftKey,repeat];if(!(typeof key!="string"||key.length===0||key.length>32||typeof code!="string"||!KEY_CODE.test(code))&&flags.every(flag=>typeof flag=="boolean")&&!(/[\u0000-\u001F\u007F]/.test(key)||!(ctrlKey||metaKey||altKey)))return{kind:"key",key,code,ctrlKey,metaKey,altKey,shiftKey,repeat}}function parseCustomConsoleLine(line,channel){if(!(typeof line!="string"||!line.startsWith("⁣zg-view:")))return parseCustomFrameMessage(line.slice(9),channel)}function mergeSuggestions(groups,groupCount=groups.length){const sectioned=groupCount>1,out=[];for(const{provider,items}of groups)for(const item of items){const section=sectioned?item.section??provider.label:item.section,providerId=item.providerId??provider.id;out.push(item.section===section&&item.providerId===providerId?item:{...item,section,providerId})}return out}function opener(line){let i=0;for(;i<3&&line[i]===" ";)i++;const char=line[i];if(char!=="`"&&char!=="~")return;let end=i;for(;line[end]===char;)end++;if(!(end-i<3))return[line.slice(0,i),line.slice(i,end),line.slice(end)]}function findViewFences(text){const fences=[],lines=text.split(`
76
76
  `);let offset=0,i=0;for(;i<lines.length;){const line=lines[i].replace(/\r$/,""),lineStart=offset;offset+=lines[i].length+1,i++;const open=opener(line);if(!open)continue;const[indent,marker,rest]=open;if(marker[0]==="`"&&rest.includes("`"))continue;const info=rest.trim().split(/\s+/)[0]??"",body=[];let closed=!1,end=text.length;const close=new RegExp(`^ {0,3}${marker[0]==="`"?"`":"~"}{${marker.length},}\\s*$`);for(;i<lines.length;){const inner=lines[i].replace(/\r$/,"");if(offset+=lines[i].length+1,i++,close.test(inner)){closed=!0,end=Math.min(offset-1,text.length);break}body.push(indent.length>0?inner.replace(new RegExp(`^ {0,${indent.length}}`),""):inner)}info==="view"&&fences.push({index:fences.length,source:body.join(`
77
- `),start:lineStart,end,closed})}return fences}function mayHoldViewFence(text){return/(?:`{3,}|~{3,})[ \t]*view\b/.test(text)}const DEFAULT_OAUTH_ACCOUNT_LABEL="Default";function extensionMark(input){const native=nativeExtensionByName(input.nativeName??input.id),own=input.icon?.gui?.trim();if(own&&!(native?.brand&&own===native.icon?.gui?.trim()))return{kind:"icon",gui:own};const brand=input.brand?.trim()||native?.brand;if(brand)return{kind:"brand",brand};const nativeIcon=native?.icon?.gui?.trim();if(nativeIcon)return{kind:"icon",gui:nativeIcon};const name=input.name?.trim()||native?.label||input.id;return{kind:"letter",letter:(Array.from(name).find(char=>/[\p{L}\p{N}]/u.test(char))??"?").toLocaleUpperCase()}}const COMPARE_DEFAULTS={goodWhen:"down",noise:.02};function relativeChange(before,after){return before===after?0:before===0?after>0?1/0:-1/0:(after-before)/Math.abs(before)}function compareVerdict(before,after,goodWhen=COMPARE_DEFAULTS.goodWhen,noise=COMPARE_DEFAULTS.noise){if(!Number.isFinite(before)||!Number.isFinite(after))return"same";const change=relativeChange(before,after);return Math.abs(change)<=noise?"same":change>0==(goodWhen==="up")?"better":"worse"}function compareChange(before,after,goodWhen,noise){const verdict=compareVerdict(before,after,goodWhen,noise);if(!Number.isFinite(before)||!Number.isFinite(after))return{change:0,verdict};const change=relativeChange(before,after);return{change:Number.isFinite(change)?change:null,verdict}}function statChange(p){if(typeof p.delta=="number"&&Number.isFinite(p.delta))return{delta:p.delta,format:p.deltaFormat};if(typeof p.from=="number"&&Number.isFinite(p.from)&&p.from!==0&&typeof p.value=="number"&&Number.isFinite(p.value))return{delta:(p.value-p.from)/Math.abs(p.from),format:p.deltaFormat??"percent"}}function str$1(value){return value==null?"":typeof value=="object"?Array.isArray(value)?value.map(str$1).join(", "):"":String(value)}function clip(text,max){const flat=text.replace(/\s+/g," ").trim();return flat.length<=max?flat:`${flat.slice(0,max-1).trimEnd()}…`}function textOf(children){return children.map(child=>typeof child=="string"?child:textOf(child.children)).join("").trim()}function walk(children,visit){for(const child of children)typeof child!="string"&&visit(child)!==!1&&walk(child.children,visit)}function titleParts(tree){let heading="",titled="",first="";return walk(tree.children,node=>{const p=node.props;!heading&&node.type==="Heading"&&(heading=textOf(node.children)),!titled&&(p.title||p.caption)&&node.type!=="Custom"&&(titled=str$1(p.title??p.caption)),!titled&&node.type==="Custom"&&(titled=str$1(p.title)),!first&&(node.type==="Stat"||node.type==="Headline")&&(first=str$1(p.label)),!first&&(node.type==="Text"||node.type==="Callout")&&(first=textOf(node.children))}),{heading,titled,first}}function viewTitle(tree){const{heading,titled,first}=titleParts(tree),title=heading||titled||first;return title?clip(title,80):"View"}function formatTokens(n){return!Number.isFinite(n)||n<=0?"0":formatCount(n)}function formatCost(usd){return!Number.isFinite(usd)||usd<=0?"$0":usd<10?formatCostLabel(usd):usd<1e4?`$${Math.round(usd).toLocaleString("en-US")}`:`$${(usd/1e3).toFixed(1)}k`}function formatHour(hour){return`${hour%12===0?12:hour%12} ${hour<12?"am":"pm"}`}const COMPARISONS=[{label:"The Little Prince",tokens:22e3},{label:"The Lord of the Rings",tokens:64e4},{label:"the complete works of Shakespeare",tokens:118e4}];function tokenComparison(totalTokens,seed){const pick=COMPARISONS[Math.abs(seed)%COMPARISONS.length],times=totalTokens/pick.tokens;return times<2?null:`You've processed ~${times>=1e3?`${Math.round(times/100)*100}`.replace(/\B(?=(?:\d{3})+(?!\d))/g,","):String(Math.round(times))}× the tokens of ${pick.label}.`}function dayOfYear(d){return Math.floor((d.getTime()-new Date(d.getFullYear(),0,0).getTime())/864e5)}const MONTHS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function shortDayLabel(day){const[,m,d]=day.split("-").map(Number);return`${MONTHS[(m??1)-1]} ${d}`}function longDayLabel(day){const[y,m,d]=day.split("-").map(Number);return new Date(y,(m??1)-1,d??1).toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric"})}const USAGE_BLOCK_ID="zidane/usage",USAGE_TABS=["overview","models"],RANGE_LABELS={all:"All","30d":"30d","7d":"7d"},USAGE_OPTIONS=[{id:"comparison",label:"Show token comparison"}],HEATMAP_WEEKS=26,TOP_MODELS=5,CHART_MAX_DAYS=120,plural=(n,one,many=`${one}s`)=>`${n.toLocaleString("en-US")} ${n===1?one:many}`,percent=share=>`${share>=1?Math.round(share):share.toFixed(1)}%`,defaultModelName=modelId=>modelDisplayName({modelId}).name;function localDay(d){return`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")}`}function usageBlockView(view){const tab=USAGE_TABS.find(t=>t===view?.tab)??"overview",range=USAGE_RANGES.find(r=>r===view?.range)??"all",picked=panelViewValues(view,"show",USAGE_OPTIONS.map(o=>o.id));return{tab,range,show:USAGE_OPTIONS.map(o=>o.id).filter(id=>picked.includes(id))}}function usageBlockContent(summary,view,{now,modelName=defaultModelName,project}){const{tab,range,show}=usageBlockView(view),controls=[{id:"tab",label:"Usage view",role:"tabs",value:tab,options:[{id:"overview",label:"Overview"},{id:"models",label:"Models"}]},{id:"range",label:"Time range",value:range,options:USAGE_RANGES.map(r=>({id:r,label:RANGE_LABELS[r]}))},{id:"show",label:"Usage settings",kind:"options",value:USAGE_OPTIONS[0].id,values:show,options:[...USAGE_OPTIONS]}];return summary.sessions===0&&summary.messages===0&&summary.totalTokens===0?{title:"Usage",controls,sections:[],empty:range!=="all"?"No usage in this range.":project?"No usage in this project yet.":"No usage yet. Start a chat to see your stats here."}:{title:"Usage",controls,sections:tab==="overview"?overviewSections(summary,now,modelName,show.includes("comparison")):modelSections(summary,now,modelName)}}function overviewSections(s,now,modelName,withComparison){const stats={kind:"stats",columns:4,stats:[{value:s.sessions.toLocaleString("en-US"),label:"Sessions"},{value:s.messages.toLocaleString("en-US"),label:"Messages"},{value:formatTokens(s.totalTokens),label:"Total tokens",hint:`${s.totalTokens.toLocaleString("en-US")} tokens`},{value:String(s.activeDays),label:"Active days"},{value:plural(s.currentStreak,"day"),label:"Current streak"},{value:plural(s.longestStreak,"day"),label:"Longest streak"},{value:s.peakHour===null?"None yet":formatHour(s.peakHour),label:"Peak hour"},{value:s.favoriteModel===null?"None yet":modelName(s.favoriteModel),label:"Favorite model",...s.favoriteModel?{hint:s.favoriteModel}:{}}]},heatmap={kind:"heatmap",label:`Activity, last ${HEATMAP_WEEKS} weeks`,end:localDay(now),weeks:HEATMAP_WEEKS,legend:{less:"Less",more:"More"},days:s.heatmap.map(d=>({date:d.day,value:d.tokens,tip:[`${formatTokens(d.tokens)} tokens`,plural(d.messages,"message")]}))},comparison=withComparison?tokenComparison(s.totalTokens,dayOfYear(now)):null;return[{id:"totals",items:[stats]},{id:"activity",items:comparison?[heatmap,{kind:"markdown",text:comparison}]:[heatmap]}]}function chartDays(s,now){if(s.range==="7d")return 7;if(s.range==="30d")return 30;const first=s.modelDaily[0]?.day;if(!first)return 30;const[y,m,d]=first.split("-").map(Number),days=Math.floor((now.getTime()-new Date(y,m-1,d).getTime())/864e5)+1;return Math.max(7,Math.min(CHART_MAX_DAYS,days))}function modelSections(s,now,modelName){const top2=s.models.slice(0,TOP_MODELS),rest=s.models.slice(TOP_MODELS),tokensOf=m=>m.tokensIn+m.tokensOut,total=s.models.reduce((a,m)=>a+tokensOf(m),0),share=tokens=>percent(total>0?tokens/total*100:0),slot=new Map(top2.map((m,i)=>[m.modelId,i])),other=rest.length>0,slots=top2.length+(other?1:0),byDay=new Map;for(const p of s.modelDaily){let values=byDay.get(p.day);values||byDay.set(p.day,values=Array.from({length:slots}).fill(0));const i=slot.get(p.modelId)??(other?slots-1:-1);i>=0&&(values[i]+=p.tokens)}const span=chartDays(s,now),points=Array.from({length:span},(_,k)=>{const day=localDay(new Date(now.getFullYear(),now.getMonth(),now.getDate()-(span-1-k))),values=byDay.get(day)??Array.from({length:slots}).fill(0),sum=values.reduce((a,b)=>a+b,0);return{label:shortDayLabel(day),values,title:`${longDayLabel(day)}: ${formatTokens(sum)} tokens`}}),series=[...top2.map(m=>({label:modelName(m.modelId),hint:m.modelId,chips:[`${formatTokens(m.tokensIn)} in`,`${formatTokens(m.tokensOut)} out`],share:share(tokensOf(m))})),...other?[{label:plural(rest.length,"other model"),share:share(rest.reduce((a,m)=>a+tokensOf(m),0))}]:[]],sections=[];if(series.length>0?sections.push({id:"models",items:[{kind:"bars",label:"Daily token usage by model",series,points,...other?{other:!0}:{},empty:"No model activity in this range."}]}):sections.push({id:"models",items:[{kind:"markdown",text:"No model activity in this range."}]}),s.providers.length>0){const spend=s.providers.reduce((a,p)=>a+p.cost,0),max=s.providers[0]?.cost??0,rows=s.providers.map(p=>({kind:"row",id:p.provider,title:p.provider,meter:max>0?p.cost/max:0,badges:[{text:formatCost(p.cost)},{text:percent(spend>0?p.cost/spend*100:0),tone:"neutral"}]}));sections.push({id:"spend",title:`Spend by provider · ${formatCost(spend)} total`,items:[...rows,{kind:"markdown",text:"_Estimated at API list prices. Your bill may differ._"}]})}return sections}const SAVED_VIEW_BLOCK_PREFIX="zidane/view:";function isSavedViewBlockId(id){return id.startsWith(SAVED_VIEW_BLOCK_PREFIX)}function declaredDefault(question){switch(question.type){case"select":{const picked=question.choices.filter(choice=>choice.selected).map(choice=>choice.id);return question.multi?picked.length>0?picked:void 0:picked[0]}case"secret":return;default:return question.default}}function isRequired(question){return question.required??(question.type==="select"||question.type==="confirm")}function isEmail(value){const at=value.indexOf("@"),domain=value.slice(at+1),dot=domain.lastIndexOf(".");return at>0&&!value.includes(" ")&&!domain.includes("@")&&dot>0&&dot<domain.length-1}const DATE_PATTERN=/^\d{4}-\d{2}-\d{2}$/,DATE_TIME_PATTERN=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/;function formatProblem(format2,value){switch(format2){case"email":return isEmail(value)?void 0:"Enter an email address.";case"uri":return URL.canParse(value)?void 0:"Enter a full URL, such as https://example.com.";case"date":return DATE_PATTERN.test(value)&&!Number.isNaN(Date.parse(value))?void 0:"Enter a date as YYYY-MM-DD.";case"date-time":return DATE_TIME_PATTERN.test(value)&&!Number.isNaN(Date.parse(value))?void 0:"Enter a date and time as YYYY-MM-DDTHH:MM with a time zone (Z or +02:00)."}}function answerProblem(question,value){if(value===void 0||value===""||Array.isArray(value)&&value.length===0)return isRequired(question)?"An answer is required.":void 0;switch(question.type){case"text":case"textarea":return typeof value!="string"?"Enter text.":question.minLength!==void 0&&value.length<question.minLength?`Enter at least ${question.minLength} characters.`:question.maxLength!==void 0&&value.length>question.maxLength?`Enter at most ${question.maxLength} characters.`:question.format?formatProblem(question.format,value.trim()):void 0;case"number":{const number=typeof value=="string"?Number(value.trim()):value;return typeof number!="number"||!Number.isFinite(number)?"Enter a number.":question.integer&&!Number.isInteger(number)?"Enter a whole number.":question.minimum!==void 0&&number<question.minimum?`Enter ${question.minimum} or more.`:question.maximum!==void 0&&number>question.maximum?`Enter ${question.maximum} or less.`:void 0}case"select":{const ids=new Set(question.choices.map(choice=>choice.id)),picked=Array.isArray(value)?value:[value];return picked.every(id=>typeof id=="string"&&ids.has(id))?!question.multi&&picked.length>1?"Pick one choice.":question.minItems!==void 0&&picked.length<question.minItems?`Pick at least ${question.minItems}.`:question.maxItems!==void 0&&picked.length>question.maxItems?`Pick at most ${question.maxItems}.`:void 0:"Pick from the choices."}case"confirm":return typeof value=="boolean"?void 0:"Answer yes or no.";case"secret":return}}function elicitationQuestions(request){return request.payload.mode==="form"?{intro:request.payload.message,questions:request.payload.questions}:{intro:request.payload.message,questions:[]}}function urlHostOf(url){try{return new URL(url).host||void 0}catch{return}}function isOpenableUrl(url){try{const parsed=new URL(url);return(parsed.protocol==="https:"||parsed.protocol==="http:")&&parsed.host!==""}catch{return!1}}function isSuspiciousHost(url){let parsed;try{parsed=new URL(url)}catch{return!0}if(parsed.hostname.split(".").some(label=>label.startsWith("xn--")))return!0;const loopback=parsed.hostname==="localhost"||parsed.hostname==="127.0.0.1"||parsed.hostname==="[::1]";return parsed.protocol!=="https:"&&!loopback}const SESSION_SCOPE="session";function planProgress(plan){const out={completed:0,cancelled:0,inProgress:0,pending:0,total:plan.steps.length,activeIndex:-1};for(const s of plan.steps)s.status==="completed"?out.completed++:s.status==="cancelled"?out.cancelled++:s.status==="in_progress"?out.inProgress++:out.pending++;return out.activeIndex=plan.steps.findIndex(s=>s.status==="in_progress"),out.activeIndex<0&&(out.activeIndex=plan.steps.findIndex(s=>s.status==="pending")),out}function planProgressLabel(progress){return progress.total===0?null:`${progress.inProgress>0?progress.activeIndex+1:progress.completed+progress.cancelled}/${progress.total}`}const MARKS={pending:"[ ]",in_progress:"[>]",completed:"[x]",cancelled:"[-]"};function formatPlanForModel(plan){const p=planProgress(plan),lines=[`${plan.title?`Plan "${plan.title}"`:"Task list"} (${plan.state}${plan.stopReason?`: ${plan.stopReason.replace("_"," ")}`:""}) · ${p.completed}/${p.total} completed`];for(const s of plan.steps){const extra=s.status==="cancelled"&&s.cancelledBy==="user"?" (cancelled by user)":s.added?" (added)":"";lines.push(`${MARKS[s.status]} ${s.id}: ${s.title}${extra}`)}return lines.join(`
77
+ `),start:lineStart,end,closed})}return fences}function mayHoldViewFence(text){return/(?:`{3,}|~{3,})[ \t]*view\b/.test(text)}const DEFAULT_OAUTH_ACCOUNT_LABEL="Default";function extensionMark(input){const native=nativeExtensionByName(input.nativeName??input.id),own=input.icon?.gui?.trim();if(own&&!(native?.brand&&own===native.icon?.gui?.trim()))return{kind:"icon",gui:own};const brand=input.brand?.trim()||native?.brand;if(brand)return{kind:"brand",brand};const nativeIcon=native?.icon?.gui?.trim();if(nativeIcon)return{kind:"icon",gui:nativeIcon};const name=input.name?.trim()||native?.label||input.id;return{kind:"letter",letter:(Array.from(name).find(char=>/[\p{L}\p{N}]/u.test(char))??"?").toLocaleUpperCase()}}const COMPARE_DEFAULTS={goodWhen:"down",noise:.02};function relativeChange(before,after){return before===after?0:before===0?after>0?1/0:-1/0:(after-before)/Math.abs(before)}function compareVerdict(before,after,goodWhen=COMPARE_DEFAULTS.goodWhen,noise=COMPARE_DEFAULTS.noise){if(!Number.isFinite(before)||!Number.isFinite(after))return"same";const change=relativeChange(before,after);return Math.abs(change)<=noise?"same":change>0==(goodWhen==="up")?"better":"worse"}function compareChange(before,after,goodWhen,noise){const verdict=compareVerdict(before,after,goodWhen,noise);if(!Number.isFinite(before)||!Number.isFinite(after))return{change:0,verdict};const change=relativeChange(before,after);return{change:Number.isFinite(change)?change:null,verdict}}function statChange(p){if(typeof p.delta=="number"&&Number.isFinite(p.delta))return{delta:p.delta,format:p.deltaFormat};if(typeof p.from=="number"&&Number.isFinite(p.from)&&p.from!==0&&typeof p.value=="number"&&Number.isFinite(p.value))return{delta:(p.value-p.from)/Math.abs(p.from),format:p.deltaFormat??"percent"}}function str$1(value){return value==null?"":typeof value=="object"?Array.isArray(value)?value.map(str$1).join(", "):"":String(value)}function clip(text,max){const flat=text.replace(/\s+/g," ").trim();return flat.length<=max?flat:`${flat.slice(0,max-1).trimEnd()}…`}function textOf(children){return children.map(child=>typeof child=="string"?child:textOf(child.children)).join("").trim()}function walk(children,visit){for(const child of children)typeof child!="string"&&visit(child)!==!1&&walk(child.children,visit)}function titleParts(tree){let heading="",titled="",first="";return walk(tree.children,node=>{const p=node.props;!heading&&node.type==="Heading"&&(heading=textOf(node.children)),!titled&&(p.title||p.caption)&&node.type!=="Custom"&&(titled=str$1(p.title??p.caption)),!titled&&node.type==="Custom"&&(titled=str$1(p.title)),!first&&(node.type==="Stat"||node.type==="Headline")&&(first=str$1(p.label)),!first&&(node.type==="Text"||node.type==="Callout")&&(first=textOf(node.children))}),{heading,titled,first}}function viewTitle(tree){const{heading,titled,first}=titleParts(tree),title=heading||titled||first;return title?clip(title,80):"View"}function shownRows(rows){return rows.filter(row=>row.class!=="unused")}function movingCount(preview){return preview.changed.length+preview.untracked.length}function workTarget(checkout,preview,sessionId){const repo=checkout.replace(/\/+$/,""),short=sessionId.replace(/[^\w-]/g,"").slice(0,8)||"session",branch=preview.branch??`teleport-${short}`,slash=repo.lastIndexOf("/");return{repo,path:`${slash>0?repo.slice(0,slash):repo}/${slash>=0?repo.slice(slash+1):repo}-${branch.replace(/[^\w.-]/g,"-")}`,branch}}function formatTokens(n){return!Number.isFinite(n)||n<=0?"0":formatCount(n)}function formatCost(usd){return!Number.isFinite(usd)||usd<=0?"$0":usd<10?formatCostLabel(usd):usd<1e4?`$${Math.round(usd).toLocaleString("en-US")}`:`$${(usd/1e3).toFixed(1)}k`}function formatHour(hour){return`${hour%12===0?12:hour%12} ${hour<12?"am":"pm"}`}const COMPARISONS=[{label:"The Little Prince",tokens:22e3},{label:"The Lord of the Rings",tokens:64e4},{label:"the complete works of Shakespeare",tokens:118e4}];function tokenComparison(totalTokens,seed){const pick=COMPARISONS[Math.abs(seed)%COMPARISONS.length],times=totalTokens/pick.tokens;return times<2?null:`You've processed ~${times>=1e3?`${Math.round(times/100)*100}`.replace(/\B(?=(?:\d{3})+(?!\d))/g,","):String(Math.round(times))}× the tokens of ${pick.label}.`}function dayOfYear(d){return Math.floor((d.getTime()-new Date(d.getFullYear(),0,0).getTime())/864e5)}const MONTHS=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function shortDayLabel(day){const[,m,d]=day.split("-").map(Number);return`${MONTHS[(m??1)-1]} ${d}`}function longDayLabel(day){const[y,m,d]=day.split("-").map(Number);return new Date(y,(m??1)-1,d??1).toLocaleDateString("en-US",{weekday:"long",month:"short",day:"numeric"})}const USAGE_BLOCK_ID="zidane/usage",USAGE_TABS=["overview","models"],RANGE_LABELS={all:"All","30d":"30d","7d":"7d"},USAGE_OPTIONS=[{id:"comparison",label:"Show token comparison"}],HEATMAP_WEEKS=26,TOP_MODELS=5,CHART_MAX_DAYS=120,plural=(n,one,many=`${one}s`)=>`${n.toLocaleString("en-US")} ${n===1?one:many}`,percent=share=>`${share>=1?Math.round(share):share.toFixed(1)}%`,defaultModelName=modelId=>modelDisplayName({modelId}).name;function localDay(d){return`${d.getFullYear()}-${String(d.getMonth()+1).padStart(2,"0")}-${String(d.getDate()).padStart(2,"0")}`}function usageBlockView(view){const tab=USAGE_TABS.find(t=>t===view?.tab)??"overview",range=USAGE_RANGES.find(r=>r===view?.range)??"all",picked=panelViewValues(view,"show",USAGE_OPTIONS.map(o=>o.id));return{tab,range,show:USAGE_OPTIONS.map(o=>o.id).filter(id=>picked.includes(id))}}function usageBlockContent(summary,view,{now,modelName=defaultModelName,project}){const{tab,range,show}=usageBlockView(view),controls=[{id:"tab",label:"Usage view",role:"tabs",value:tab,options:[{id:"overview",label:"Overview"},{id:"models",label:"Models"}]},{id:"range",label:"Time range",value:range,options:USAGE_RANGES.map(r=>({id:r,label:RANGE_LABELS[r]}))},{id:"show",label:"Usage settings",kind:"options",value:USAGE_OPTIONS[0].id,values:show,options:[...USAGE_OPTIONS]}];return summary.sessions===0&&summary.messages===0&&summary.totalTokens===0?{title:"Usage",controls,sections:[],empty:range!=="all"?"No usage in this range.":project?"No usage in this project yet.":"No usage yet. Start a chat to see your stats here."}:{title:"Usage",controls,sections:tab==="overview"?overviewSections(summary,now,modelName,show.includes("comparison")):modelSections(summary,now,modelName)}}function overviewSections(s,now,modelName,withComparison){const stats={kind:"stats",columns:4,stats:[{value:s.sessions.toLocaleString("en-US"),label:"Sessions"},{value:s.messages.toLocaleString("en-US"),label:"Messages"},{value:formatTokens(s.totalTokens),label:"Total tokens",hint:`${s.totalTokens.toLocaleString("en-US")} tokens`},{value:String(s.activeDays),label:"Active days"},{value:plural(s.currentStreak,"day"),label:"Current streak"},{value:plural(s.longestStreak,"day"),label:"Longest streak"},{value:s.peakHour===null?"None yet":formatHour(s.peakHour),label:"Peak hour"},{value:s.favoriteModel===null?"None yet":modelName(s.favoriteModel),label:"Favorite model",...s.favoriteModel?{hint:s.favoriteModel}:{}}]},heatmap={kind:"heatmap",label:`Activity, last ${HEATMAP_WEEKS} weeks`,end:localDay(now),weeks:HEATMAP_WEEKS,legend:{less:"Less",more:"More"},days:s.heatmap.map(d=>({date:d.day,value:d.tokens,tip:[`${formatTokens(d.tokens)} tokens`,plural(d.messages,"message")]}))},comparison=withComparison?tokenComparison(s.totalTokens,dayOfYear(now)):null;return[{id:"totals",items:[stats]},{id:"activity",items:comparison?[heatmap,{kind:"markdown",text:comparison}]:[heatmap]}]}function chartDays(s,now){if(s.range==="7d")return 7;if(s.range==="30d")return 30;const first=s.modelDaily[0]?.day;if(!first)return 30;const[y,m,d]=first.split("-").map(Number),days=Math.floor((now.getTime()-new Date(y,m-1,d).getTime())/864e5)+1;return Math.max(7,Math.min(CHART_MAX_DAYS,days))}function modelSections(s,now,modelName){const top2=s.models.slice(0,TOP_MODELS),rest=s.models.slice(TOP_MODELS),tokensOf=m=>m.tokensIn+m.tokensOut,total=s.models.reduce((a,m)=>a+tokensOf(m),0),share=tokens=>percent(total>0?tokens/total*100:0),slot=new Map(top2.map((m,i)=>[m.modelId,i])),other=rest.length>0,slots=top2.length+(other?1:0),byDay=new Map;for(const p of s.modelDaily){let values=byDay.get(p.day);values||byDay.set(p.day,values=Array.from({length:slots}).fill(0));const i=slot.get(p.modelId)??(other?slots-1:-1);i>=0&&(values[i]+=p.tokens)}const span=chartDays(s,now),points=Array.from({length:span},(_,k)=>{const day=localDay(new Date(now.getFullYear(),now.getMonth(),now.getDate()-(span-1-k))),values=byDay.get(day)??Array.from({length:slots}).fill(0),sum=values.reduce((a,b)=>a+b,0);return{label:shortDayLabel(day),values,title:`${longDayLabel(day)}: ${formatTokens(sum)} tokens`}}),series=[...top2.map(m=>({label:modelName(m.modelId),hint:m.modelId,chips:[`${formatTokens(m.tokensIn)} in`,`${formatTokens(m.tokensOut)} out`],share:share(tokensOf(m))})),...other?[{label:plural(rest.length,"other model"),share:share(rest.reduce((a,m)=>a+tokensOf(m),0))}]:[]],sections=[];if(series.length>0?sections.push({id:"models",items:[{kind:"bars",label:"Daily token usage by model",series,points,...other?{other:!0}:{},empty:"No model activity in this range."}]}):sections.push({id:"models",items:[{kind:"markdown",text:"No model activity in this range."}]}),s.providers.length>0){const spend=s.providers.reduce((a,p)=>a+p.cost,0),max=s.providers[0]?.cost??0,rows=s.providers.map(p=>({kind:"row",id:p.provider,title:p.provider,meter:max>0?p.cost/max:0,badges:[{text:formatCost(p.cost)},{text:percent(spend>0?p.cost/spend*100:0),tone:"neutral"}]}));sections.push({id:"spend",title:`Spend by provider · ${formatCost(spend)} total`,items:[...rows,{kind:"markdown",text:"_Estimated at API list prices. Your bill may differ._"}]})}return sections}const SAVED_VIEW_BLOCK_PREFIX="zidane/view:";function isSavedViewBlockId(id){return id.startsWith(SAVED_VIEW_BLOCK_PREFIX)}function declaredDefault(question){switch(question.type){case"select":{const picked=question.choices.filter(choice=>choice.selected).map(choice=>choice.id);return question.multi?picked.length>0?picked:void 0:picked[0]}case"secret":return;default:return question.default}}function isRequired(question){return question.required??(question.type==="select"||question.type==="confirm")}function isEmail(value){const at=value.indexOf("@"),domain=value.slice(at+1),dot=domain.lastIndexOf(".");return at>0&&!value.includes(" ")&&!domain.includes("@")&&dot>0&&dot<domain.length-1}const DATE_PATTERN=/^\d{4}-\d{2}-\d{2}$/,DATE_TIME_PATTERN=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}(?::\d{2}(?:\.\d+)?)?(?:Z|[+-]\d{2}:\d{2})$/;function formatProblem(format2,value){switch(format2){case"email":return isEmail(value)?void 0:"Enter an email address.";case"uri":return URL.canParse(value)?void 0:"Enter a full URL, such as https://example.com.";case"date":return DATE_PATTERN.test(value)&&!Number.isNaN(Date.parse(value))?void 0:"Enter a date as YYYY-MM-DD.";case"date-time":return DATE_TIME_PATTERN.test(value)&&!Number.isNaN(Date.parse(value))?void 0:"Enter a date and time as YYYY-MM-DDTHH:MM with a time zone (Z or +02:00)."}}function answerProblem(question,value){if(value===void 0||value===""||Array.isArray(value)&&value.length===0)return isRequired(question)?"An answer is required.":void 0;switch(question.type){case"text":case"textarea":return typeof value!="string"?"Enter text.":question.minLength!==void 0&&value.length<question.minLength?`Enter at least ${question.minLength} characters.`:question.maxLength!==void 0&&value.length>question.maxLength?`Enter at most ${question.maxLength} characters.`:question.format?formatProblem(question.format,value.trim()):void 0;case"number":{const number=typeof value=="string"?Number(value.trim()):value;return typeof number!="number"||!Number.isFinite(number)?"Enter a number.":question.integer&&!Number.isInteger(number)?"Enter a whole number.":question.minimum!==void 0&&number<question.minimum?`Enter ${question.minimum} or more.`:question.maximum!==void 0&&number>question.maximum?`Enter ${question.maximum} or less.`:void 0}case"select":{const ids=new Set(question.choices.map(choice=>choice.id)),picked=Array.isArray(value)?value:[value];return picked.every(id=>typeof id=="string"&&ids.has(id))?!question.multi&&picked.length>1?"Pick one choice.":question.minItems!==void 0&&picked.length<question.minItems?`Pick at least ${question.minItems}.`:question.maxItems!==void 0&&picked.length>question.maxItems?`Pick at most ${question.maxItems}.`:void 0:"Pick from the choices."}case"confirm":return typeof value=="boolean"?void 0:"Answer yes or no.";case"secret":return}}function elicitationQuestions(request){return request.payload.mode==="form"?{intro:request.payload.message,questions:request.payload.questions}:{intro:request.payload.message,questions:[]}}function urlHostOf(url){try{return new URL(url).host||void 0}catch{return}}function isOpenableUrl(url){try{const parsed=new URL(url);return(parsed.protocol==="https:"||parsed.protocol==="http:")&&parsed.host!==""}catch{return!1}}function isSuspiciousHost(url){let parsed;try{parsed=new URL(url)}catch{return!0}if(parsed.hostname.split(".").some(label=>label.startsWith("xn--")))return!0;const loopback=parsed.hostname==="localhost"||parsed.hostname==="127.0.0.1"||parsed.hostname==="[::1]";return parsed.protocol!=="https:"&&!loopback}const SESSION_SCOPE="session";function planProgress(plan){const out={completed:0,cancelled:0,inProgress:0,pending:0,total:plan.steps.length,activeIndex:-1};for(const s of plan.steps)s.status==="completed"?out.completed++:s.status==="cancelled"?out.cancelled++:s.status==="in_progress"?out.inProgress++:out.pending++;return out.activeIndex=plan.steps.findIndex(s=>s.status==="in_progress"),out.activeIndex<0&&(out.activeIndex=plan.steps.findIndex(s=>s.status==="pending")),out}function planProgressLabel(progress){return progress.total===0?null:`${progress.inProgress>0?progress.activeIndex+1:progress.completed+progress.cancelled}/${progress.total}`}const MARKS={pending:"[ ]",in_progress:"[>]",completed:"[x]",cancelled:"[-]"};function formatPlanForModel(plan){const p=planProgress(plan),lines=[`${plan.title?`Plan "${plan.title}"`:"Task list"} (${plan.state}${plan.stopReason?`: ${plan.stopReason.replace("_"," ")}`:""}) · ${p.completed}/${p.total} completed`];for(const s of plan.steps){const extra=s.status==="cancelled"&&s.cancelledBy==="user"?" (cancelled by user)":s.added?" (added)":"";lines.push(`${MARKS[s.status]} ${s.id}: ${s.title}${extra}`)}return lines.join(`
78
78
  `)}function buildPlanResumeMessage(plan){return`Resume ${plan.title?`the plan "${plan.title}"`:"your task list"}${plan.stoppedAt?` from step ${plan.stoppedAt}`:""}. Call todowrite with its step ids as you continue.
79
79
 
80
80
  ${formatPlanForModel(plan)}`}function buildStepRetryMessage(step){return`Retry step ${step.id} (currently ${step.status}): "${step.title}"`}const SECRET_TTLS=["1h","24h","7d","never"],DEFAULT_SECRET_TTL="24h",SECRET_NAME_PATTERN=/^[A-Z][A-Z0-9_]{0,63}$/;function isSecretName(name){return typeof name=="string"&&SECRET_NAME_PATTERN.test(name)}function isSecretAnswer(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;const kind=value.kind;return kind==="secret-value"||kind==="secret-declined"}function isSecretReference(value){if(typeof value!="object"||value===null||Array.isArray(value))return!1;const cast=value;return typeof cast.secret!="string"||"value"in cast?!1:cast.declined===!0||typeof cast.path=="string"}const VIEW_SESSION_ACTION_LIMITS={keyChars:200,contextFields:32,contextBytes:16384,artifacts:10,schedulesPerView:20,rowActions:1e3,linkKeys:200,filledChars:200};function expandRowAction(stored,index2){const patch=stored?.rows[index2];return!stored||!patch?null:{label:patch.label??stored.base.label,session:{...stored.base.session,...patch.session},...patch.tone??stored.base.tone?{tone:patch.tone??stored.base.tone}:{}}}function sessionActionAccess(mode,verb){return mode==="off"||mode==="read"?"hidden":mode==="draft"?verb==="start"||verb==="send"?"draft":"hidden":verb==="schedule"?"approve-each":mode==="approve"?"approve":"run"}function scheduleLabel(schedule){if(schedule.name)return schedule.name;if(schedule.action.kind==="extension")return`${schedule.action.extensionId}: ${schedule.action.handler}`;const text=schedule.action.text.replace(/\s+/g," ").trim();return text.length>48?`${text.slice(0,47)}…`:text}function scheduleTargetSession(action){return action.kind==="prompt"&&"sessionId"in action?action.sessionId:void 0}const LEVEL_ORDER={debug:0,info:1,warn:2,error:3},LOG_LEVEL_CYCLE=["debug","info","warn","error"];function filterLogRecords(records,minLevel){const min=LEVEL_ORDER[minLevel];return records.filter(r=>LEVEL_ORDER[r.level]>=min)}function formatLogLine(record){const ts=new Date(record.timestamp).toISOString(),kv=Object.entries(record.attrs).filter(([,v])=>v!==void 0).map(([k,v])=>`${k}=${typeof v=="string"?v:JSON.stringify(v)}`).join(" ");return`${ts} ${record.level.toUpperCase().padEnd(5)} ${record.message}${kv?` ${kv}`:""}`}function mergeReplyText(turn){const{content}=turn;if(!isClaudeReply(turn))return content;let merged2;for(let i=0;i<content.length;i++){const block=content[i],prev=merged2?merged2.at(-1):content[i-1];block.type==="text"&&prev?.type==="text"?(merged2??=content.slice(0,i),merged2[merged2.length-1]={type:"text",text:prev.text+block.text}):merged2?.push(block)}return merged2??content}function isClaudeReply(turn){return turn.role==="assistant"&&turn.usage?.modelId?.startsWith("claude")===!0}function modelPickKey(provider,model,account){return account?`${provider}\0${model}\0${account}`:`${provider}\0${model}`}function toggleKeyed(chain,entry,keyOf2){const key=keyOf2(entry),idx=chain.findIndex(e=>keyOf2(e)===key);return idx===-1?[...chain,entry]:[...chain.slice(0,idx),...chain.slice(idx+1)]}function pickPrimaryKeyed(chain,entry,keyOf2){const key=keyOf2(entry);return[entry,...chain.filter(e=>keyOf2(e)!==key)]}function positionKeyed(chain,key,keyOf2){const idx=chain.findIndex(e=>keyOf2(e)===key);return idx===-1?null:idx+1}function chainsEqualKeyed(a,b,keyOf2){return a.length===b.length&&a.every((e,i)=>keyOf2(e)===keyOf2(b[i]))}function reorderKeyed(chain,key,delta,keyOf2){const from=chain.findIndex(e=>keyOf2(e)===key),to=from+delta;if(from<0||to<0||to>=chain.length)return chain;const next=[...chain],[entry]=next.splice(from,1);return next.splice(to,0,entry),next}function rememberableChain(chain,providerOf,scope){const primary=chain[0];return primary===void 0?null:scope.onServer?scope.canRunHere(providerOf(primary))?chain.filter(entry=>scope.canRunHere(providerOf(entry))):null:[...chain]}function str(value){return value==null||typeof value=="object"?"":String(value)}let formats;function nf(){return formats??={grouped:new Intl.NumberFormat("en-US",{maximumFractionDigits:2}),short:new Intl.NumberFormat("en-US",{maximumFractionDigits:1}),significant:new Intl.NumberFormat("en-US",{maximumSignificantDigits:3}),percent:new Intl.NumberFormat("en-US",{style:"percent",maximumFractionDigits:1})}}const grouped={format:v=>nf().grouped.format(v)},PREFIX_UNITS=new Set(["$","€","£","¥","₹"]),TIGHT_UNITS=new Set(["%","‰","×"]);function fmt(value,format2,unit){return withUnit(grouped.format(value),unit)}function withUnit(text,unit){const u=str(unit).trim();return u?PREFIX_UNITS.has(u)?text.startsWith("-")?`-${u}${text.slice(1)}`:`${u}${text}`:TIGHT_UNITS.has(u)?`${text}${u}`:`${text} ${u}`:text}function controlValueText(value,node){if(node.type==="Toggle")return value===!0?"on":"off";const option=controlOptions(node).find(o=>JSON.stringify(o.value)===JSON.stringify(value??null));return option?option.label:typeof value=="number"?fmt(value,void 0,node.props.unit):str(value)||"empty"}function controlsOf(tree){const out=[],walk2=list=>{for(const child of list)typeof child!="string"&&(VIEW_CONTROL_TYPES.includes(child.type)&&out.push(child),walk2(child.children))};return walk2(tree.children),out}function viewStateNote(view){const vars=view.states?.vars??[];if(vars.length===0)return"";const state=initialViewState(vars),controls=controlsOf(view.tree),names=controls.map(node=>{const name=str(node.props.label)||str(node.props.bind);if(node.type==="Segmented"||node.type==="Select")return`${name} (${controlOptions(node).map(o=>o.label).join(", ")})`;if(node.type==="Slider"){const range=sliderRange(node.props);return range?`${name} (${fmt(range.min,void 0,node.props.unit)} to ${fmt(range.max,void 0,node.props.unit)})`:name}return`${name} (${node.type==="Toggle"?"on or off":"search"})`}),shown=controls.map(node=>`${str(node.props.label)||str(node.props.bind)} ${controlValueText(state[str(node.props.bind)],node)}`);return names.length===0?"This view changes with its state in zidane. The export shows its first state.":`In zidane this view has controls: ${names.join(", ")}. The export shows its first state: ${shown.join(", ")}.`}function exportViewIndex(views){const fences=new Map,calls=new Map,ids=new Map;for(const view of views)if(ids.set(view.id,view),view.anchor.kind==="fence")fences.set(`${view.anchor.turnId}\0${view.anchor.fenceIndex}`,view);else{const key=`${view.anchor.turnId}\0${view.anchor.toolCallId}`;calls.set(key,[...calls.get(key)??[],view])}return{fence:(turnId,index2)=>fences.get(`${turnId}\0${index2}`),codemode:(turnId,toolCallId)=>calls.get(`${turnId}\0${toolCallId}`)??[],byId:id=>ids.get(id)}}function viewExportNote(view){const title=view.title||viewTitle(view.tree),lines=[`**View ${view.id}: ${title.replace(/\s+/g," ").trim()}**`],alt=view.alt.trim();alt&&lines.push("",...alt.split(`
@@ -92,4 +92,4 @@ ${block.summary}`);return parts.join(`
92
92
 
93
93
  `)}function editableTurnText(turn){return mergeReplyText(turn).filter(block=>block.type==="text"&&!block.systemNote).map(block=>block.text).join(`
94
94
 
95
- `)}function stringifyArgs(input){try{return JSON.stringify(input,null,2)}catch{return String(input)}}function countNeighbors(turnIds,turnId){const idx=turnIds.indexOf(turnId);return idx===-1?null:{before:idx,after:turnIds.length-1-idx}}const VIEW_SOURCE_EVERY={min:60},VIEW_SOURCE_BACKOFF_MAX_MS=36e5,VIEW_SESSIONS_DATA="@sessions";function viewSourceTool(target){const at=target.indexOf("/");return at<0?{server:target,tool:""}:{server:target.slice(0,at),tool:target.slice(at+1)}}function viewSourceLabel(source){if(source.kind==="mcp")return viewSourceTool(source.target).server||source.name;if(source.kind==="host")return"Sessions";try{return new URL(source.target).hostname||source.name}catch{return source.name}}const RANK={failed:0,ask:1,off:2,ok:3};function viewSourceSummary(sources){if(!sources||sources.length===0)return;const sorted=[...sources].sort((a,b)=>RANK[a.status]-RANK[b.status]);return{first:sorted[0],more:sorted.length-1,off:sources.every(source=>source.status==="off"),failed:sources.some(source=>source.status==="failed"),ask:sources.some(source=>source.status==="ask")}}function viewSourceDelayMs(every,failures){return failures<=0?every*1e3:Math.min(VIEW_SOURCE_BACKOFF_MAX_MS,6e4*2**Math.min(failures-1,10))}function viewSourceEvery(sources){const asks=(sources??[]).map(source=>source.every).filter(every=>typeof every=="number");return asks.length>0?Math.max(VIEW_SOURCE_EVERY.min,Math.min(...asks)):void 0}const MCP_APP_NODE_TYPE="McpApp",MCP_APP_PERMISSIONS=["camera","microphone","geolocation","clipboardWrite"],isObject=value=>!!value&&typeof value=="object"&&!Array.isArray(value);function parseMcpAppRpc(raw){if(!isObject(raw)||raw.jsonrpc!=="2.0")return;let text;try{text=JSON.stringify(raw)}catch{return}if(!(text===void 0||text.length>262144))return JSON.parse(text)}function parseMcpAppConsoleLine(line,channel){if(typeof line!="string"||!channel||!line.startsWith("⁣zg-view:")||line.length>263168)return;let value;try{value=JSON.parse(line.slice(CUSTOM_CONSOLE_PREFIX.length))}catch{return}if(!isObject(value)||value.kind!=="rpc"||value.zgView!=="mcp-app"||value.channel!==channel)return;const message=parseMcpAppRpc(value.message);return message?{kind:"rpc",message,active:value.active===!0}:void 0}function mcpAppHostMessage(channel,message){const text=JSON.stringify({zgView:"mcp-app",channel,message});return text.length>263168?void 0:text}const VIEW_PREVIEW_GLOBAL="__zidaneViewPreview",VIEW_REFRESH_EVERY={min:30,max:3600};function viewRefreshEvery(tree){for(const node of tree?.children??[]){if(typeof node=="string"||node.type!=="Refresh")continue;const every=node.props.every;return typeof every!="number"||!Number.isFinite(every)?void 0:Math.min(VIEW_REFRESH_EVERY.max,Math.max(VIEW_REFRESH_EVERY.min,Math.round(every)))}}const SYNC_CATEGORIES=["settings","safelists","files","mcps","extensions","environments","keys"],SYNC_CATEGORY_INFO={settings:{label:"Agent settings",description:"Safe mode, limits, models."},safelists:{label:"Allowlists",description:"For projects the server also has."},files:{label:"SYSTEM.md and skills",description:"Copied as files."},mcps:{label:"MCP servers",description:"Sign-ins stay here."},extensions:{label:"Extensions",description:"From npm or GitHub only."},environments:{label:"Cloud sandboxes",description:"E2B and Daytona, with their keys."},keys:{label:"Model accounts",description:"API keys and sign-ins."}},SYNC_MODES=["off","once","keep"],SYNC_MODE_LABEL={off:"Off",once:"Import once",keep:"Keep in sync"};function syncAgo(at,now=Date.now()){if(at===void 0)return"never";const s=Math.max(0,Math.round((now-at)/1e3));return s<60?`${s}s ago`:s<3600?`${Math.round(s/60)} min ago`:new Date(at).toLocaleString()}const settingField=key=>`setting:${key}`;function syncMarkerOf(status,field){return status?.source?status.overrides[field]?{kind:"override",device:status.source.deviceName}:status.fields[field]?{kind:"synced",device:status.source.deviceName}:null:null}function fenceHasCode(nodes){return nodes.some(function visit(node){return node.kind==="expression"?!node.expression.empty:node.kind==="element"?node.attrs.some(attr=>attr.value.kind==="expression")||node.children.some(visit):!1})}function staticTree(nodes){const elements=[];function build2(node){if(node.kind==="text")return node.value;if(node.kind==="expression")return;const src=elements.length;if(node.name==="svg")return elements.push({name:"svg",offset:node.start}),{type:"svg",props:{markup:svgMarkup(node)},children:[],src};elements.push({name:node.name,offset:node.start,...node.refs?{refs:node.refs}:{}});const props={};for(const attr of node.attrs)attr.value.kind==="string"?props[attr.name]=attr.value.value:attr.value.kind==="boolean"&&(props[attr.name]=!0);const children=node.children.map(build2).filter(child=>child!==void 0);return{type:node.name,props,children,src}}return{children:nodes.map(build2).filter(child=>child!==void 0),elements}}const SVG_ATTR=/^[A-Z_][\w:.-]*$/i;function escapeSvgText(text){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function svgAttributes(props){let out="";for(const[key,value]of props)SVG_ATTR.test(key)&&(value===!0?out+=` ${key}=""`:typeof value=="string"?out+=` ${key}="${escapeSvgText(value).replace(/"/g,"&quot;")}"`:typeof value=="number"&&Number.isFinite(value)&&(out+=` ${key}="${String(value)}"`));return out}function svgMarkup(node){const attrs=svgAttributes(node.attrs.flatMap(attr=>attr.value.kind==="string"?[[attr.name,attr.value.value]]:attr.value.kind==="boolean"?[[attr.name,!0]]:[])),inner=node.children.map(child=>child.kind==="text"?escapeSvgText(child.value):child.kind==="element"?svgMarkup(child):"").join("");return inner?`<${node.name}${attrs}>${inner}</${node.name}>`:`<${node.name}${attrs}/>`}function sameJson(a,b){return JSON.stringify(a??null)===JSON.stringify(b??null)}function controlTakes(node,value){if(node.type==="Search")return typeof value=="string"&&value.length<=VIEW_STATE_LIMITS.searchChars;if(node.type==="Slider"){const range=sliderRange(node.props);return typeof value=="number"&&range!==void 0&&snapSlider(value,range)===value}return(controlValues(node)??[]).some(option=>sameJson(option,value))}function carriedViewState(previous,view){const out={},controls=viewControls(view.tree);for(const v of view.states?.vars??[]){if(!Object.hasOwn(previous,v.name))continue;const value=previous[v.name];sameJson(value,v.initial)||stateJsonBytes(value)>VIEW_STATE_LIMITS.valueBytes||controls.some(({node})=>node.props.bind===v.name&&controlTakes(node,value))&&(out[v.name]=value)}return out}function createViewStateController(options){const{view,run:run2}=options,vars=view.states?.vars??[],debounceMs=options.debounceMs??250,trees=new Map,listeners=new Set;let timer;const initial=Object.fromEntries(vars.map(v=>[v.name,v.initial])),live=run2!==void 0||view.states?.trees!==void 0,carried=options.values?carriedViewState(options.values,view):{},start={...initial,...carried},startTree=Object.keys(carried).length>0?storedStateTree(view,start):view.tree,askFirst=startTree===void 0&&run2!==void 0;let snapshot2={values:startTree||askFirst?start:initial,tree:startTree??view.tree,waiting:askFirst,live};const publish=next=>{snapshot2=next;for(const listener of[...listeners])listener()},remember2=(key,tree)=>{for(trees.delete(key),trees.set(key,tree);trees.size>16;)trees.delete(trees.keys().next().value)},recall=key=>{const tree=trees.get(key);return tree&&remember2(key,tree),tree},ask=()=>{if(timer=void 0,!run2)return;const values=snapshot2.values,key=viewStateKey(vars,values);run2({...values}).then(answer=>{answer.ok&&answer.value&&remember2(key,answer.value.tree),viewStateKey(vars,snapshot2.values)===key&&(answer.ok&&answer.value?publish({values:snapshot2.values,tree:answer.value.tree,waiting:!1,live:snapshot2.live}):publish({...snapshot2,waiting:!1,error:answer.ok?{code:"failed",message:"No such view."}:answer.error}))})};return askFirst&&ask(),{get:()=>snapshot2,subscribe(onChange){return listeners.add(onChange),()=>listeners.delete(onChange)},set(name,value){if(!vars.some(v=>v.name===name))return;const values={...snapshot2.values,[name]:value},known=storedStateTree(view,values)??recall(viewStateKey(vars,values));if(clearTimeout(timer),timer=void 0,known){publish({values,tree:known,waiting:!1,live:snapshot2.live});return}if(!run2){publish({values,tree:snapshot2.tree,waiting:!1,live:snapshot2.live,error:{code:"unsupported"}});return}publish({values,tree:snapshot2.tree,waiting:!0,live:snapshot2.live}),timer=setTimeout(ask,debounceMs)},dispose(){clearTimeout(timer),timer=void 0}}}async function runBlockOnHost(client,sessionId,request,options={}){let runId=null;const early=[];let finish;const ended=new Promise(resolve=>{finish=resolve}),apply=signal=>{signal.kind==="block-run:data"?options.onOutput?.(signal.stream,signal.chunk):finish(signal)},unsubscribe=client.onSignal(signal=>{signal.kind!=="block-run:data"&&signal.kind!=="block-run:end"||(runId===null?early.push(signal):signal.runId===runId&&apply(signal))});try{runId=(await client.call("sessions.runBlock",{sessionId,...request})).runId;for(const signal of early.splice(0))signal.runId===runId&&apply(signal);const id=runId,onAbort=()=>{client.call("sessions.runBlockCancel",{runId:id}).catch(()=>{})};options.signal?.addEventListener("abort",onAbort,{once:!0}),options.signal?.aborted&&onAbort();try{const end=await ended;if(!end.run)throw new Error(end.error??"The block did not run.");return end.run}finally{options.signal?.removeEventListener("abort",onAbort)}}finally{unsubscribe()}}new TextDecoder;export{messageMediaOf as $,findReferences as A,GITHUB_ISSUE_PROVIDER_ID as B,githubRefKey as C,DEFAULT_SETTINGS as D,isFenceClose as E,parseFenceOpen as F,GITHUB_PULL_PROVIDER_ID as G,mayHoldViewFence as H,findViewFences as I,noteTranscriptPass as J,isShellFence as K,authProviderKeys as L,sameAuthTarget as M,spawnParents as N,ONBOARDING_WORDS as O,summarizeTools as P,placeEnvironmentSetups as Q,RUN_WAITING_LABEL as R,SYNC_MODE_LABEL as S,TOAST_CANCEL as T,scriptProgressByCall as U,mcpJobsByCall as V,readEnvironmentSetup as W,isUserBashEvent as X,scriptProgressKey as Y,formatToolCall as Z,displayNameFor as _,toastDuration as a,planProgressLabel as a$,planFold as a0,setupLabel as a1,noteLabel as a2,thoughtLabel as a3,toolOverview as a4,countTaskOutcomes as a5,taskOutcome as a6,foldSummary as a7,foldsInCompactShape as a8,nestedCallShown as a9,FILES_PANEL_ID as aA,TOAST_VISIBLE as aB,parseSessionKey as aC,cacheHintText as aD,CACHE_HINT_MIN_TOKENS as aE,accentColor as aF,otherDelivery as aG,formatCostLabel as aH,modelDisplayName as aI,rememberableChain as aJ,currentModelKeys as aK,customModelTargets as aL,modelPickKey as aM,pickPrimaryKeyed as aN,positionKeyed as aO,toggleKeyed as aP,reorderKeyed as aQ,chainsEqualKeyed as aR,formatElapsed as aS,EMPTY_RATE as aT,stepStreamRate as aU,streamRateValue as aV,parseWhen as aW,scheduleTargetSession as aX,QUEUE_PANEL_ID as aY,describeTime as aZ,INBOX_PANEL_ID as a_,createRunStopMarker as aa,MAX_FILE_ATTACHMENT_BYTES as ab,ATTACHMENT_SNIFF_BYTES as ac,planAttachment as ad,formatBytes as ae,MAX_IMAGE_ATTACHMENT_BYTES as af,hasAnsi as ag,parseAnsi as ah,scriptProgressView as ai,SCRIPT_OUTPUT_TAIL_LINES as aj,formatRunDuration as ak,toolInputCode as al,summarizeOutcomes as am,computeLineDiff as an,transcriptArray as ao,heatmapThresholds as ap,daysEndingAt as aq,heatmapLevel as ar,pickTab as as,openForAttention as at,openProactive as au,cycleTab as av,closePanel as aw,togglePanel as ax,DIFFS_PANEL_ID as ay,REMINDERS_PANEL_ID as az,parseBindingSpecs as b,activeSpaceOf as b$,parseMachineKind as b0,orderByMachine as b1,machineBlockedReason as b2,isolationLabel as b3,LOCAL_HOST_KEY as b4,machineKind as b5,placeEnvironmentKind as b6,placeOfPick as b7,samePlace as b8,retryLabel as b9,mergeTargetIndex as bA,chunkFact as bB,finalizeStreamingMarkdown as bC,transcriptFromArray as bD,dedupeEnvironmentSetups as bE,applyHistoryOp as bF,applyHistorySince as bG,readFreshness as bH,transcriptDiscardThinking as bI,cursorValid as bJ,climbReconnectLadder as bK,blockRunKey as bL,createOutputTail as bM,applySessionInboxPatch as bN,renderTemplate as bO,readField as bP,compileQuery as bQ,resolveSessionSpace as bR,isExtensionSpaceId as bS,DEFAULT_SPACE_ID as bT,validateQuery as bU,validateGroupBy as bV,validateSort as bW,groupRows as bX,viewQuery as bY,SessionQueryError as bZ,normalizeSpaces as b_,bindingAlternatives as ba,parseRepoInput as bb,skillCategory as bc,newChatPlacePatch as bd,defaultSessionModel as be,defaultSessionKnobs as bf,formatModelSetting as bg,defaultSessionAgent as bh,newChatPlace as bi,parseModelSetting as bj,DEFAULT_MODEL_PICK as bk,inferPromptRefs as bl,titleFromText as bm,reconcileEvents as bn,emptyTranscript as bo,smoothCharsForTick as bp,takeChars as bq,withTranscriptTail as br,transcriptFinalizeStreamingMarkdownForOwner as bs,mapTranscript as bt,transcriptUpsertToolProgress as bu,transcriptUpsertEnvironmentSetup as bv,ownerOf as bw,transcriptThinkingLines as bx,transcriptMarkdownDelta as by,appendTranscriptEvent as bz,canonicalKeyName as c,transcriptOfArray as c$,arrangeSpaceList as c0,sessionDirLabel as c1,createRecentChanges as c2,projectNameOf as c3,SESSION_INBOX_KEYS as c4,estimateViewAt as c5,highlightSegments as c6,searchHighlightRanges as c7,sortRows as c8,formatCount as c9,isSecretReference as cA,declaredDefault as cB,answerProblem as cC,urlHostOf as cD,isOpenableUrl as cE,isSuspiciousHost as cF,elicitationQuestions as cG,SECRETS_PANEL_ID as cH,SESSION_EVENT_STATUS_STYLE as cI,sessionEventMeta as cJ,sessionEventExcerpt as cK,shortSessionId as cL,spawnStartParts as cM,describeSpawnEnd as cN,tidyPromptText as cO,splitPromptSegments as cP,formatRunReceiptCells as cQ,shellBlockPlan as cR,blockTerminalInput as cS,stripAnsi as cT,previewLine as cU,formatTaskStatus as cV,formatDuration as cW,turnAsText as cX,ageString as cY,isCacheNotice as cZ,gatherCommandNotes as c_,isRunEstimated as ca,estimateReadout as cb,formatEstimate as cc,sessionBadgeTarget as cd,blendHsl as ce,activeSnapshotFor as cf,mostConstrainedWindow as cg,usageTone as ch,formatUsagePercent as ci,resetLabel as cj,compactingParts as ck,newSpaceId as cl,CONTINUE_PROMPT as cm,authPrimaryAction as cn,authOffersSignInFallback as co,runStatusKey as cp,runFoldStatus as cq,RUN_STATUS_TIME_MS as cr,formatCostUsd as cs,formatTokenCount as ct,RUN_RECEIPT_SWITCH_GLYPH as cu,RUN_RECEIPT_TURN_GLYPH as cv,isMcpJobDone as cw,SECRET_TTLS as cx,DEFAULT_SECRET_TTL as cy,isSecretAnswer as cz,taskBurstSummary as d,groupSkillPicks as d$,turnSelectionOwnership as d0,MACHINE_LINK_STATE_TEXT as d1,hasTool as d2,spaceOfSwitchItem as d3,spaceSwitchItems as d4,SETUP_PALETTE_ITEM as d5,TRANSCRIPT_PRESET_PALETTE_ID as d6,transcriptPresetPalettePicker as d7,transcriptPresetOfPaletteItem as d8,transcriptPreset as d9,SETTINGS_PAGES as dA,SETTINGS_ROWS as dB,settingRow as dC,nativeExtensionByName as dD,NATIVE_EXTENSIONS as dE,DEFAULT_EXTENSION_SOURCE_UNREACHABLE as dF,skillPickOf as dG,RECOMMENDED_SKILL_SOURCES as dH,githubPreviewImageUrl as dI,githubAvatarUrl as dJ,DEFAULT_EXTENSION_SOURCE as dK,skillTokenWeights as dL,formatTokens as dM,instructionPreviewLines as dN,instructionOriginBadge as dO,filterLogRecords as dP,formatLogLine as dQ,LOG_LEVEL_CYCLE as dR,enabledMcpsWith as dS,MCP_KEY_REFUSED_HINT as dT,MCP_STATUS_LABEL as dU,MCP_TRANSPORTS as dV,CONNECTORS as dW,connectorInstalled as dX,validateMcpForm as dY,DEFAULT_OAUTH_ACCOUNT_LABEL as dZ,providerBrand as d_,transcriptPresetNotice as da,transcriptPresetPaletteItem as db,rankPaletteItems as dc,groupPaletteRows as dd,savedViewRefOfArtifact as de,savedViewHeightsOfArtifact as df,SESSION_SCOPE as dg,planProgress as dh,buildStepRetryMessage as di,buildPlanResumeMessage as dj,SAVED_VIEW_TITLE_MAX as dk,extensionMark as dl,isSavedViewBlockId as dm,scheduleLabel as dn,describeTrigger as dp,isSecretName as dq,editableTurnText as dr,updatedLabel as ds,showsAccount as dt,formatBalance as du,usageBlockView as dv,usageBlockContent as dw,buildUnifiedDiff as dx,transcriptPresetOf as dy,TRANSCRIPT_PRESETS as dz,mcpJobLine as e,viewRefKey as e$,autoTextModelId as e0,APPROVAL_MODE_OPTIONS as e1,readNewChatPlace as e2,SETTINGS_TOGGLES as e3,SETTINGS_CHOICES as e4,settingKeywords as e5,settingDescription as e6,requirementMet as e7,toggleApplies as e8,toggleHeldOn as e9,settingsSidebar as eA,settingsSearchIndex as eB,mergeSuggestions as eC,createCommandsCompletionProvider as eD,isSkillGroupCompletion as eE,createFilesCompletionProvider as eF,createChatsCompletionProvider as eG,patchInlineGhost as eH,createSkillsCompletionProvider as eI,uniqueSkillNamesFromReferences as eJ,ONBOARDING_PREVIEW_FOLLOW_UP as eK,ONBOARDING_PREVIEW_EVENTS as eL,LOCAL_SERVER_BRANDS as eM,connectorById as eN,connectorsFromImport as eO,connectorInputError as eP,CONNECTOR_CATEGORIES as eQ,connectorAuthText as eR,NATIVE_EXTENSION_GROUPS as eS,nativeExtensionNeedText as eT,onboardingFeatures as eU,ONBOARDING_FEATURE_GROUPS as eV,defaultImportSelection as eW,ONBOARDING_AGENT_BRANDS as eX,onboardingSwitchedFeatures as eY,onboardingImportParts as eZ,CUSTOM_FRAMES_MAX as e_,parentOn as ea,panelBadgeText as eb,TERMINAL_PANEL_ID as ec,machineInstallCommand as ed,machineSetupCommand as ee,isValidMachineName as ef,DAEMON_HEALTH_STYLE as eg,HOST_TOOLS as eh,capabilityTags as ei,toolInstall as ej,syncAgo as ek,SYNC_MODES as el,SYNC_CATEGORIES as em,machineVersionDiffers as en,clockOrDateText as eo,clockText as ep,syncMarkerOf as eq,settingField as er,runTailActivity as es,modePrefixLength as et,sliceEnd as eu,OutputHistory as ev,TERMINAL_HISTORY_MAX_CHARS as ew,TERMINAL_VIEW_MAX_LINES as ex,TERMINAL_VIEW_SCROLLBACK as ey,moveTab as ez,authFailureHeadline as f,customHostScript as f$,VIEWS_RESOLVE_MAX as f0,parseViewHeights as f1,VIEWS_REFRESH_UNSUPPORTED as f2,SAVED_VIEWS_UNSUPPORTED as f3,VIEWS_GET_MAX as f4,createFenceParser as f5,fenceHasCode as f6,staticTree as f7,createViewStateController as f8,nodePathOf as f9,sessionKey as fA,LOCAL_HOST_NAME as fB,ARTIFACT_BADGES_MAX as fC,spacesEnabled as fD,spacesHomeOf as fE,ARTIFACTS_PANEL_ID as fF,buildPanelCatalog as fG,BROWSER_PANEL_ID as fH,MEDIA_BY_EXTENSION as fI,USAGE_BLOCK_ID as fJ,nativeExtensionSource as fK,connectorServerConfig as fL,autoCompactShare as fM,machineWaiting as fN,SIDE_PANEL_ID as fO,normalizeBrowserUrl as fP,BROWSER_DEVICES as fQ,responsiveDevice as fR,clampDeviceSize as fS,settingsTarget as fT,countNeighbors as fU,selectableTurnIds as fV,runBlockOnHost as fW,customDataMessage as fX,customThemeCss as fY,mcpAppHostMessage as fZ,parseCustomConsoleLine as f_,CUSTOM_FRAME_DEFAULT_HEIGHT as fa,CUSTOM_PAGE_PROBLEMS_MAX as fb,CUSTOM_FRAME_MAX_HEIGHT as fc,customLinkUrl as fd,MCP_APP_PROTOCOL_VERSION as fe,MCP_APP_PERMISSIONS as ff,VIEW_SESSIONS_DATA as fg,VIEW_SESSION_ACTION_LIMITS as fh,sessionActionAccess as fi,expandRowAction as fj,VIEW_PREVIEW_GLOBAL as fk,VIEW_STATE_LIMITS as fl,sliderRange as fm,snapSlider as fn,controlOptions as fo,MCP_APP_NODE_TYPE as fp,VIEW_FALLBACK_TYPE as fq,compareChange as fr,statChange as fs,viewSourceEvery as ft,viewSourceDelayMs as fu,viewSourceSummary as fv,viewSourceLabel as fw,viewSourceTool as fx,sessionViewRef as fy,viewRefreshEvery as fz,SYNC_CATEGORY_INFO as g,parseMcpAppConsoleLine as g0,createOnboardingRun as h,ONBOARDING_STEPS as i,joinNames as j,canSkipOnboardingStep as k,lentServerMachines as l,modelConcern as m,currentOnboardingStep as n,pushPaletteRecent as o,parseBindingSpec as p,nameFromModelId as q,runRetryingLabel as r,builtinBadgeActions as s,toastKey as t,mergeBadgeMenu as u,builtinBadgeEffect as v,isBadgeColor as w,ageStep as x,fmtTokens as y,parseCommandInvocation as z};
95
+ `)}function stringifyArgs(input){try{return JSON.stringify(input,null,2)}catch{return String(input)}}function countNeighbors(turnIds,turnId){const idx=turnIds.indexOf(turnId);return idx===-1?null:{before:idx,after:turnIds.length-1-idx}}const VIEW_SOURCE_EVERY={min:60},VIEW_SOURCE_BACKOFF_MAX_MS=36e5,VIEW_SESSIONS_DATA="@sessions";function viewSourceTool(target){const at=target.indexOf("/");return at<0?{server:target,tool:""}:{server:target.slice(0,at),tool:target.slice(at+1)}}function viewSourceLabel(source){if(source.kind==="mcp")return viewSourceTool(source.target).server||source.name;if(source.kind==="host")return"Sessions";try{return new URL(source.target).hostname||source.name}catch{return source.name}}const RANK={failed:0,ask:1,off:2,ok:3};function viewSourceSummary(sources){if(!sources||sources.length===0)return;const sorted=[...sources].sort((a,b)=>RANK[a.status]-RANK[b.status]);return{first:sorted[0],more:sorted.length-1,off:sources.every(source=>source.status==="off"),failed:sources.some(source=>source.status==="failed"),ask:sources.some(source=>source.status==="ask")}}function viewSourceDelayMs(every,failures){return failures<=0?every*1e3:Math.min(VIEW_SOURCE_BACKOFF_MAX_MS,6e4*2**Math.min(failures-1,10))}function viewSourceEvery(sources){const asks=(sources??[]).map(source=>source.every).filter(every=>typeof every=="number");return asks.length>0?Math.max(VIEW_SOURCE_EVERY.min,Math.min(...asks)):void 0}const MCP_APP_NODE_TYPE="McpApp",MCP_APP_PERMISSIONS=["camera","microphone","geolocation","clipboardWrite"],isObject=value=>!!value&&typeof value=="object"&&!Array.isArray(value);function parseMcpAppRpc(raw){if(!isObject(raw)||raw.jsonrpc!=="2.0")return;let text;try{text=JSON.stringify(raw)}catch{return}if(!(text===void 0||text.length>262144))return JSON.parse(text)}function parseMcpAppConsoleLine(line,channel){if(typeof line!="string"||!channel||!line.startsWith("⁣zg-view:")||line.length>263168)return;let value;try{value=JSON.parse(line.slice(CUSTOM_CONSOLE_PREFIX.length))}catch{return}if(!isObject(value)||value.kind!=="rpc"||value.zgView!=="mcp-app"||value.channel!==channel)return;const message=parseMcpAppRpc(value.message);return message?{kind:"rpc",message,active:value.active===!0}:void 0}function mcpAppHostMessage(channel,message){const text=JSON.stringify({zgView:"mcp-app",channel,message});return text.length>263168?void 0:text}const VIEW_PREVIEW_GLOBAL="__zidaneViewPreview",VIEW_REFRESH_EVERY={min:30,max:3600};function viewRefreshEvery(tree){for(const node of tree?.children??[]){if(typeof node=="string"||node.type!=="Refresh")continue;const every=node.props.every;return typeof every!="number"||!Number.isFinite(every)?void 0:Math.min(VIEW_REFRESH_EVERY.max,Math.max(VIEW_REFRESH_EVERY.min,Math.round(every)))}}const SYNC_CATEGORIES=["settings","safelists","files","mcps","extensions","environments","keys"],SYNC_CATEGORY_INFO={settings:{label:"Agent settings",description:"Safe mode, limits, models."},safelists:{label:"Allowlists",description:"For projects the server also has."},files:{label:"SYSTEM.md and skills",description:"Copied as files."},mcps:{label:"MCP servers",description:"Sign-ins stay here."},extensions:{label:"Extensions",description:"From npm or GitHub only."},environments:{label:"Cloud sandboxes",description:"E2B and Daytona, with their keys."},keys:{label:"Model accounts",description:"API keys and sign-ins."}},SYNC_MODES=["off","once","keep"],SYNC_MODE_LABEL={off:"Off",once:"Import once",keep:"Keep in sync"};function syncAgo(at,now=Date.now()){if(at===void 0)return"never";const s=Math.max(0,Math.round((now-at)/1e3));return s<60?`${s}s ago`:s<3600?`${Math.round(s/60)} min ago`:new Date(at).toLocaleString()}const settingField=key=>`setting:${key}`;function syncMarkerOf(status,field){return status?.source?status.overrides[field]?{kind:"override",device:status.source.deviceName}:status.fields[field]?{kind:"synced",device:status.source.deviceName}:null:null}function fenceHasCode(nodes){return nodes.some(function visit(node){return node.kind==="expression"?!node.expression.empty:node.kind==="element"?node.attrs.some(attr=>attr.value.kind==="expression")||node.children.some(visit):!1})}function staticTree(nodes){const elements=[];function build2(node){if(node.kind==="text")return node.value;if(node.kind==="expression")return;const src=elements.length;if(node.name==="svg")return elements.push({name:"svg",offset:node.start}),{type:"svg",props:{markup:svgMarkup(node)},children:[],src};elements.push({name:node.name,offset:node.start,...node.refs?{refs:node.refs}:{}});const props={};for(const attr of node.attrs)attr.value.kind==="string"?props[attr.name]=attr.value.value:attr.value.kind==="boolean"&&(props[attr.name]=!0);const children=node.children.map(build2).filter(child=>child!==void 0);return{type:node.name,props,children,src}}return{children:nodes.map(build2).filter(child=>child!==void 0),elements}}const SVG_ATTR=/^[A-Z_][\w:.-]*$/i;function escapeSvgText(text){return text.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function svgAttributes(props){let out="";for(const[key,value]of props)SVG_ATTR.test(key)&&(value===!0?out+=` ${key}=""`:typeof value=="string"?out+=` ${key}="${escapeSvgText(value).replace(/"/g,"&quot;")}"`:typeof value=="number"&&Number.isFinite(value)&&(out+=` ${key}="${String(value)}"`));return out}function svgMarkup(node){const attrs=svgAttributes(node.attrs.flatMap(attr=>attr.value.kind==="string"?[[attr.name,attr.value.value]]:attr.value.kind==="boolean"?[[attr.name,!0]]:[])),inner=node.children.map(child=>child.kind==="text"?escapeSvgText(child.value):child.kind==="element"?svgMarkup(child):"").join("");return inner?`<${node.name}${attrs}>${inner}</${node.name}>`:`<${node.name}${attrs}/>`}function sameJson(a,b){return JSON.stringify(a??null)===JSON.stringify(b??null)}function controlTakes(node,value){if(node.type==="Search")return typeof value=="string"&&value.length<=VIEW_STATE_LIMITS.searchChars;if(node.type==="Slider"){const range=sliderRange(node.props);return typeof value=="number"&&range!==void 0&&snapSlider(value,range)===value}return(controlValues(node)??[]).some(option=>sameJson(option,value))}function carriedViewState(previous,view){const out={},controls=viewControls(view.tree);for(const v of view.states?.vars??[]){if(!Object.hasOwn(previous,v.name))continue;const value=previous[v.name];sameJson(value,v.initial)||stateJsonBytes(value)>VIEW_STATE_LIMITS.valueBytes||controls.some(({node})=>node.props.bind===v.name&&controlTakes(node,value))&&(out[v.name]=value)}return out}function createViewStateController(options){const{view,run:run2}=options,vars=view.states?.vars??[],debounceMs=options.debounceMs??250,trees=new Map,listeners=new Set;let timer;const initial=Object.fromEntries(vars.map(v=>[v.name,v.initial])),live=run2!==void 0||view.states?.trees!==void 0,carried=options.values?carriedViewState(options.values,view):{},start={...initial,...carried},startTree=Object.keys(carried).length>0?storedStateTree(view,start):view.tree,askFirst=startTree===void 0&&run2!==void 0;let snapshot2={values:startTree||askFirst?start:initial,tree:startTree??view.tree,waiting:askFirst,live};const publish=next=>{snapshot2=next;for(const listener of[...listeners])listener()},remember2=(key,tree)=>{for(trees.delete(key),trees.set(key,tree);trees.size>16;)trees.delete(trees.keys().next().value)},recall=key=>{const tree=trees.get(key);return tree&&remember2(key,tree),tree},ask=()=>{if(timer=void 0,!run2)return;const values=snapshot2.values,key=viewStateKey(vars,values);run2({...values}).then(answer=>{answer.ok&&answer.value&&remember2(key,answer.value.tree),viewStateKey(vars,snapshot2.values)===key&&(answer.ok&&answer.value?publish({values:snapshot2.values,tree:answer.value.tree,waiting:!1,live:snapshot2.live}):publish({...snapshot2,waiting:!1,error:answer.ok?{code:"failed",message:"No such view."}:answer.error}))})};return askFirst&&ask(),{get:()=>snapshot2,subscribe(onChange){return listeners.add(onChange),()=>listeners.delete(onChange)},set(name,value){if(!vars.some(v=>v.name===name))return;const values={...snapshot2.values,[name]:value},known=storedStateTree(view,values)??recall(viewStateKey(vars,values));if(clearTimeout(timer),timer=void 0,known){publish({values,tree:known,waiting:!1,live:snapshot2.live});return}if(!run2){publish({values,tree:snapshot2.tree,waiting:!1,live:snapshot2.live,error:{code:"unsupported"}});return}publish({values,tree:snapshot2.tree,waiting:!0,live:snapshot2.live}),timer=setTimeout(ask,debounceMs)},dispose(){clearTimeout(timer),timer=void 0}}}async function runBlockOnHost(client,sessionId,request,options={}){let runId=null;const early=[];let finish;const ended=new Promise(resolve=>{finish=resolve}),apply=signal=>{signal.kind==="block-run:data"?options.onOutput?.(signal.stream,signal.chunk):finish(signal)},unsubscribe=client.onSignal(signal=>{signal.kind!=="block-run:data"&&signal.kind!=="block-run:end"||(runId===null?early.push(signal):signal.runId===runId&&apply(signal))});try{runId=(await client.call("sessions.runBlock",{sessionId,...request})).runId;for(const signal of early.splice(0))signal.runId===runId&&apply(signal);const id=runId,onAbort=()=>{client.call("sessions.runBlockCancel",{runId:id}).catch(()=>{})};options.signal?.addEventListener("abort",onAbort,{once:!0}),options.signal?.aborted&&onAbort();try{const end=await ended;if(!end.run)throw new Error(end.error??"The block did not run.");return end.run}finally{options.signal?.removeEventListener("abort",onAbort)}}finally{unsubscribe()}}new TextDecoder;export{messageMediaOf as $,findReferences as A,GITHUB_ISSUE_PROVIDER_ID as B,githubRefKey as C,DEFAULT_SETTINGS as D,isFenceClose as E,parseFenceOpen as F,GITHUB_PULL_PROVIDER_ID as G,mayHoldViewFence as H,findViewFences as I,noteTranscriptPass as J,isShellFence as K,authProviderKeys as L,sameAuthTarget as M,spawnParents as N,ONBOARDING_WORDS as O,summarizeTools as P,placeEnvironmentSetups as Q,RUN_WAITING_LABEL as R,SYNC_MODE_LABEL as S,TOAST_CANCEL as T,scriptProgressByCall as U,mcpJobsByCall as V,readEnvironmentSetup as W,isUserBashEvent as X,scriptProgressKey as Y,formatToolCall as Z,displayNameFor as _,toastDuration as a,planProgressLabel as a$,planFold as a0,setupLabel as a1,noteLabel as a2,thoughtLabel as a3,toolOverview as a4,countTaskOutcomes as a5,taskOutcome as a6,foldSummary as a7,foldsInCompactShape as a8,nestedCallShown as a9,FILES_PANEL_ID as aA,TOAST_VISIBLE as aB,parseSessionKey as aC,cacheHintText as aD,CACHE_HINT_MIN_TOKENS as aE,accentColor as aF,otherDelivery as aG,formatCostLabel as aH,modelDisplayName as aI,rememberableChain as aJ,currentModelKeys as aK,customModelTargets as aL,modelPickKey as aM,pickPrimaryKeyed as aN,positionKeyed as aO,toggleKeyed as aP,reorderKeyed as aQ,chainsEqualKeyed as aR,formatElapsed as aS,EMPTY_RATE as aT,stepStreamRate as aU,streamRateValue as aV,parseWhen as aW,scheduleTargetSession as aX,QUEUE_PANEL_ID as aY,describeTime as aZ,INBOX_PANEL_ID as a_,createRunStopMarker as aa,MAX_FILE_ATTACHMENT_BYTES as ab,ATTACHMENT_SNIFF_BYTES as ac,planAttachment as ad,formatBytes as ae,MAX_IMAGE_ATTACHMENT_BYTES as af,hasAnsi as ag,parseAnsi as ah,scriptProgressView as ai,SCRIPT_OUTPUT_TAIL_LINES as aj,formatRunDuration as ak,toolInputCode as al,summarizeOutcomes as am,computeLineDiff as an,transcriptArray as ao,heatmapThresholds as ap,daysEndingAt as aq,heatmapLevel as ar,pickTab as as,openForAttention as at,openProactive as au,cycleTab as av,closePanel as aw,togglePanel as ax,DIFFS_PANEL_ID as ay,REMINDERS_PANEL_ID as az,parseBindingSpecs as b,normalizeSpaces as b$,parseMachineKind as b0,orderByMachine as b1,machineBlockedReason as b2,isolationLabel as b3,LOCAL_HOST_KEY as b4,machineKind as b5,placeEnvironmentKind as b6,placeOfPick as b7,samePlace as b8,retryLabel as b9,mergeTargetIndex as bA,chunkFact as bB,finalizeStreamingMarkdown as bC,transcriptFromArray as bD,dedupeEnvironmentSetups as bE,applyHistoryOp as bF,applyHistorySince as bG,readFreshness as bH,transcriptReplaceTurnText as bI,transcriptDiscardThinking as bJ,cursorValid as bK,climbReconnectLadder as bL,blockRunKey as bM,createOutputTail as bN,applySessionInboxPatch as bO,renderTemplate as bP,readField as bQ,compileQuery as bR,resolveSessionSpace as bS,isExtensionSpaceId as bT,DEFAULT_SPACE_ID as bU,validateQuery as bV,validateGroupBy as bW,validateSort as bX,groupRows as bY,viewQuery as bZ,SessionQueryError as b_,bindingAlternatives as ba,parseRepoInput as bb,skillCategory as bc,newChatPlacePatch as bd,defaultSessionModel as be,defaultSessionKnobs as bf,formatModelSetting as bg,defaultSessionAgent as bh,newChatPlace as bi,parseModelSetting as bj,DEFAULT_MODEL_PICK as bk,inferPromptRefs as bl,titleFromText as bm,reconcileEvents as bn,emptyTranscript as bo,smoothCharsForTick as bp,takeChars as bq,withTranscriptTail as br,transcriptFinalizeStreamingMarkdownForOwner as bs,mapTranscript as bt,transcriptUpsertToolProgress as bu,transcriptUpsertEnvironmentSetup as bv,ownerOf as bw,transcriptThinkingLines as bx,transcriptMarkdownDelta as by,appendTranscriptEvent as bz,canonicalKeyName as c,gatherCommandNotes as c$,activeSpaceOf as c0,arrangeSpaceList as c1,sessionDirLabel as c2,createRecentChanges as c3,projectNameOf as c4,SESSION_INBOX_KEYS as c5,estimateViewAt as c6,highlightSegments as c7,searchHighlightRanges as c8,sortRows as c9,isSecretAnswer as cA,isSecretReference as cB,declaredDefault as cC,answerProblem as cD,urlHostOf as cE,isOpenableUrl as cF,isSuspiciousHost as cG,elicitationQuestions as cH,SECRETS_PANEL_ID as cI,SESSION_EVENT_STATUS_STYLE as cJ,sessionEventMeta as cK,sessionEventExcerpt as cL,shortSessionId as cM,spawnStartParts as cN,describeSpawnEnd as cO,tidyPromptText as cP,splitPromptSegments as cQ,formatRunReceiptCells as cR,shellBlockPlan as cS,blockTerminalInput as cT,stripAnsi as cU,previewLine as cV,formatTaskStatus as cW,formatDuration as cX,turnAsText as cY,ageString as cZ,isCacheNotice as c_,formatCount as ca,isRunEstimated as cb,estimateReadout as cc,formatEstimate as cd,sessionBadgeTarget as ce,blendHsl as cf,activeSnapshotFor as cg,mostConstrainedWindow as ch,usageTone as ci,formatUsagePercent as cj,resetLabel as ck,compactingParts as cl,newSpaceId as cm,CONTINUE_PROMPT as cn,authPrimaryAction as co,authOffersSignInFallback as cp,runStatusKey as cq,runFoldStatus as cr,RUN_STATUS_TIME_MS as cs,formatCostUsd as ct,formatTokenCount as cu,RUN_RECEIPT_SWITCH_GLYPH as cv,RUN_RECEIPT_TURN_GLYPH as cw,isMcpJobDone as cx,SECRET_TTLS as cy,DEFAULT_SECRET_TTL as cz,taskBurstSummary as d,providerBrand as d$,transcriptOfArray as d0,turnSelectionOwnership as d1,MACHINE_LINK_STATE_TEXT as d2,hasTool as d3,spaceOfSwitchItem as d4,spaceSwitchItems as d5,SETUP_PALETTE_ITEM as d6,TRANSCRIPT_PRESET_PALETTE_ID as d7,transcriptPresetPalettePicker as d8,transcriptPresetOfPaletteItem as d9,TRANSCRIPT_PRESETS as dA,SETTINGS_PAGES as dB,SETTINGS_ROWS as dC,settingRow as dD,nativeExtensionByName as dE,NATIVE_EXTENSIONS as dF,DEFAULT_EXTENSION_SOURCE_UNREACHABLE as dG,skillPickOf as dH,RECOMMENDED_SKILL_SOURCES as dI,githubPreviewImageUrl as dJ,githubAvatarUrl as dK,DEFAULT_EXTENSION_SOURCE as dL,skillTokenWeights as dM,formatTokens as dN,instructionPreviewLines as dO,instructionOriginBadge as dP,filterLogRecords as dQ,formatLogLine as dR,LOG_LEVEL_CYCLE as dS,enabledMcpsWith as dT,MCP_KEY_REFUSED_HINT as dU,MCP_STATUS_LABEL as dV,MCP_TRANSPORTS as dW,CONNECTORS as dX,connectorInstalled as dY,validateMcpForm as dZ,DEFAULT_OAUTH_ACCOUNT_LABEL as d_,transcriptPreset as da,transcriptPresetNotice as db,transcriptPresetPaletteItem as dc,rankPaletteItems as dd,groupPaletteRows as de,savedViewRefOfArtifact as df,savedViewHeightsOfArtifact as dg,SESSION_SCOPE as dh,planProgress as di,buildStepRetryMessage as dj,buildPlanResumeMessage as dk,SAVED_VIEW_TITLE_MAX as dl,extensionMark as dm,isSavedViewBlockId as dn,scheduleLabel as dp,describeTrigger as dq,isSecretName as dr,editableTurnText as ds,updatedLabel as dt,showsAccount as du,formatBalance as dv,usageBlockView as dw,usageBlockContent as dx,buildUnifiedDiff as dy,transcriptPresetOf as dz,mcpJobLine as e,ONBOARDING_AGENT_BRANDS as e$,groupSkillPicks as e0,autoTextModelId as e1,APPROVAL_MODE_OPTIONS as e2,readNewChatPlace as e3,SETTINGS_TOGGLES as e4,SETTINGS_CHOICES as e5,settingKeywords as e6,settingDescription as e7,requirementMet as e8,toggleApplies as e9,TERMINAL_HISTORY_MAX_CHARS as eA,TERMINAL_VIEW_MAX_LINES as eB,TERMINAL_VIEW_SCROLLBACK as eC,moveTab as eD,settingsSidebar as eE,settingsSearchIndex as eF,mergeSuggestions as eG,createCommandsCompletionProvider as eH,isSkillGroupCompletion as eI,createFilesCompletionProvider as eJ,createChatsCompletionProvider as eK,patchInlineGhost as eL,createSkillsCompletionProvider as eM,uniqueSkillNamesFromReferences as eN,ONBOARDING_PREVIEW_FOLLOW_UP as eO,ONBOARDING_PREVIEW_EVENTS as eP,LOCAL_SERVER_BRANDS as eQ,connectorById as eR,connectorsFromImport as eS,connectorInputError as eT,CONNECTOR_CATEGORIES as eU,connectorAuthText as eV,NATIVE_EXTENSION_GROUPS as eW,nativeExtensionNeedText as eX,onboardingFeatures as eY,ONBOARDING_FEATURE_GROUPS as eZ,defaultImportSelection as e_,toggleHeldOn as ea,parentOn as eb,panelBadgeText as ec,TERMINAL_PANEL_ID as ed,machineInstallCommand as ee,machineSetupCommand as ef,isValidMachineName as eg,DAEMON_HEALTH_STYLE as eh,HOST_TOOLS as ei,capabilityTags as ej,toolInstall as ek,syncAgo as el,SYNC_MODES as em,SYNC_CATEGORIES as en,machineVersionDiffers as eo,clockOrDateText as ep,clockText as eq,syncMarkerOf as er,settingField as es,runTailActivity as et,movingCount as eu,shownRows as ev,workTarget as ew,modePrefixLength as ex,sliceEnd as ey,OutputHistory as ez,authFailureHeadline as f,customDataMessage as f$,onboardingSwitchedFeatures as f0,onboardingImportParts as f1,CUSTOM_FRAMES_MAX as f2,viewRefKey as f3,VIEWS_RESOLVE_MAX as f4,parseViewHeights as f5,VIEWS_REFRESH_UNSUPPORTED as f6,SAVED_VIEWS_UNSUPPORTED as f7,VIEWS_GET_MAX as f8,createFenceParser as f9,viewSourceLabel as fA,viewSourceTool as fB,sessionViewRef as fC,viewRefreshEvery as fD,sessionKey as fE,LOCAL_HOST_NAME as fF,ARTIFACT_BADGES_MAX as fG,spacesEnabled as fH,spacesHomeOf as fI,ARTIFACTS_PANEL_ID as fJ,buildPanelCatalog as fK,BROWSER_PANEL_ID as fL,MEDIA_BY_EXTENSION as fM,USAGE_BLOCK_ID as fN,nativeExtensionSource as fO,connectorServerConfig as fP,autoCompactShare as fQ,machineWaiting as fR,SIDE_PANEL_ID as fS,normalizeBrowserUrl as fT,BROWSER_DEVICES as fU,responsiveDevice as fV,clampDeviceSize as fW,settingsTarget as fX,countNeighbors as fY,selectableTurnIds as fZ,runBlockOnHost as f_,fenceHasCode as fa,staticTree as fb,createViewStateController as fc,nodePathOf as fd,CUSTOM_FRAME_DEFAULT_HEIGHT as fe,CUSTOM_PAGE_PROBLEMS_MAX as ff,CUSTOM_FRAME_MAX_HEIGHT as fg,customLinkUrl as fh,MCP_APP_PROTOCOL_VERSION as fi,MCP_APP_PERMISSIONS as fj,VIEW_SESSIONS_DATA as fk,VIEW_SESSION_ACTION_LIMITS as fl,sessionActionAccess as fm,expandRowAction as fn,VIEW_PREVIEW_GLOBAL as fo,VIEW_STATE_LIMITS as fp,sliderRange as fq,snapSlider as fr,controlOptions as fs,MCP_APP_NODE_TYPE as ft,VIEW_FALLBACK_TYPE as fu,compareChange as fv,statChange as fw,viewSourceEvery as fx,viewSourceDelayMs as fy,viewSourceSummary as fz,SYNC_CATEGORY_INFO as g,customThemeCss as g0,mcpAppHostMessage as g1,parseCustomConsoleLine as g2,customHostScript as g3,parseMcpAppConsoleLine as g4,createOnboardingRun as h,ONBOARDING_STEPS as i,joinNames as j,canSkipOnboardingStep as k,lentServerMachines as l,modelConcern as m,currentOnboardingStep as n,pushPaletteRecent as o,parseBindingSpec as p,nameFromModelId as q,runRetryingLabel as r,builtinBadgeActions as s,toastKey as t,mergeBadgeMenu as u,builtinBadgeEffect as v,ageStep as w,fmtTokens as x,parseCommandInvocation as y,isBadgeColor as z};