@sma1lboy/kobe 0.8.183 → 0.8.184

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -79,7 +79,7 @@ You were spawned by Rove task ${J}. When the work is finished, send your outcome
79
79
  `).split(`
80
80
  `).map((X)=>(X.split("\r").pop()??"").slice(0,ZW0));while(J.length>0&&(J[J.length-1]??"").trim()==="")J.pop();return J.slice(-$W0)}function uu($=Zj()){try{let Z=JSON.parse(rG0($,"utf8"));if(Z===null||typeof Z!=="object"||Array.isArray(Z))return{};return Z}catch{return{}}}function RT($,Z=Zj()){if($.key.startsWith("::"))return;if($.exit.code===0&&$.exit.signal===null)return;let J=uu(Z);J[$.key]={key:$.key,pid:$.pid,code:$.exit.code,signal:$.exit.signal,at:$.exit.at,tail:hu($.tail)};let X=Object.values(J).sort((z,G)=>z.at<G.at?1:-1).slice(0,eG0);aG0(tG0(Z),{recursive:!0}),sG0(Z,JSON.stringify(Object.fromEntries(X.map((z)=>[z.key,z])),null,2),"utf8")}var eG0=50,$W0=40,ZW0=500,JW0;var hj=l(()=>{R2();JW0=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)?|\x1b[@-_]/g});var du={};A$(du,{setRepoLastActiveVendor:()=>lJ,setGlobalDefaultVendor:()=>IT,resolvePreferredVendor:()=>K9,getRepoLastActiveVendor:()=>lu,getGlobalDefaultVendor:()=>uj});function ST($,Z){let J=$?.trim();if(!J)return;if(n2(J)||Z.includes(J))return J;return}function lu($){return ST(E5(cu+$),w7())}function lJ($,Z){J6(cu+$,Z)}function uj(){let $=w7();return ST(E5("defaultVendor"),$)??ST(E5("lastSelectedVendor"),$)}function IT($){J6("defaultVendor",$)}function K9($){return($?lu($):void 0)??uj()??H4}var cu="lastActiveVendor.";var AZ=l(()=>{D2();$2();A4()});function z8($=process.env){return{...$,...ET}}var ET;var dJ=l(()=>{ET={GIT_OPTIONAL_LOCKS:"0"}});function pu($){return $>="0"&&$<="7"}function ou($,Z){let J=[],X="",z=()=>{if(X.length>0){for(let W of XW0.encode(X))J.push(W);X=""}},G=Z+1;while(G<$.length){let W=$[G];if(W==='"'){G++;break}if(W==="\\"){let q=$[G+1];if(q===void 0){X+="\\",G++;continue}switch(q){case"a":z(),J.push(7),G+=2;break;case"b":z(),J.push(8),G+=2;break;case"t":z(),J.push(9),G+=2;break;case"n":z(),J.push(10),G+=2;break;case"v":z(),J.push(11),G+=2;break;case"f":z(),J.push(12),G+=2;break;case"r":z(),J.push(13),G+=2;break;case'"':X+='"',G+=2;break;case"\\":X+="\\",G+=2;break;default:if(pu(q)){let U="",B=G+1;while(B<$.length&&U.length<3&&pu($[B]))U+=$[B],B++;z(),J.push(Number.parseInt(U,8)&255),G=B}else X+=q,G+=2;break}}else X+=W,G++}return z(),{value:QW0.decode(new Uint8Array(J)),end:G}}function DZ($){if($.length===0||$[0]!=='"')return $;return ou($,0).value}function au($,Z){if($[0]==='"'){let X=ou($,0);if($.startsWith(Z,X.end))return{orig:X.value,neu:DZ($.slice(X.end+Z.length))};return null}let J=$.indexOf(Z);if(J<0)return null;return{orig:$.slice(0,J),neu:DZ($.slice(J+Z.length))}}function nu($,Z,J){if(Z.length===0&&$.endsWith("/")&&J.startsWith("/"))return $+J.slice(1);return $+Z+J}function zW0($){let Z=$.indexOf("{");if(Z>=0){let X=$.indexOf("}",Z),z=$.indexOf(" => ",Z);if(X>Z&&z>=0&&z<X){let G=$.slice(0,Z),W=$.slice(Z+1,z),q=$.slice(z+4,X),U=$.slice(X+1);return{path:nu(G,q,U),origPath:nu(G,W,U)}}}let J=au($," => ");if(J)return{path:J.neu,origPath:J.orig};return{path:DZ($)}}function cj($){let Z=[];for(let J of $.split(`
81
81
  `)){let X=J.replace(/\r$/,"");if(X.length<4)continue;if(X.startsWith("##"))continue;let z=X[0],G=X[1];if(X[2]!==" ")continue;let W=X.slice(3);if(z==="R"||z==="C"||G==="R"||G==="C"){let q=au(W," -> ");if(q){Z.push({x:z,y:G,path:q.neu,origPath:q.orig});continue}}Z.push({x:z,y:G,path:DZ(W)})}return Z}function iu($){if($==="-")return null;let Z=Number.parseInt($,10);return Number.isNaN(Z)?null:Z}function ru($){let Z=[];for(let J of $.split(`
82
- `)){let X=J.replace(/\r$/,"");if(X.length===0)continue;let z=X.indexOf("\t");if(z<0)continue;let G=X.indexOf("\t",z+1);if(G<0)continue;let W=X.slice(G+1);if(W.length===0)continue;let q=zW0(W);if(q.path.length===0)continue;Z.push({path:q.path,...q.origPath!==void 0?{origPath:q.origPath}:{},added:iu(X.slice(0,z)),deleted:iu(X.slice(z+1,G))})}return Z}var XW0,QW0;var lj=l(()=>{XW0=new TextEncoder,QW0=new TextDecoder});var su={};A$(su,{sameWorktreeChanges:()=>FF,readWorktreeChanges:()=>GW0,pickPushedChanges:()=>wT,parsePorcelain:()=>LH});import{spawnSync as YW0}from"child_process";function FF($,Z){return $.added===Z.added&&$.deleted===Z.deleted}function wT($,Z){if(!$)return null;return $.get(Z)??dj}function GW0($){if(!$)return dj;try{let Z=YW0("git",["status","--porcelain=v1"],{cwd:$,encoding:"utf8",stdio:["ignore","pipe","pipe"],env:z8()});if(Z.status!==0||!Z.stdout)return dj;return LH(Z.stdout)}catch{return dj}}function LH($){let Z=0,J=0;for(let{x:X,y:z}of cj($))if(X==="D"||z==="D")J+=1;else Z+=1;return{added:Z,deleted:J}}var dj;var OH=l(()=>{dJ();lj();dj={added:0,deleted:0}});var Zc={};A$(Zc,{resolveBaseRef:()=>eu,readBranchSignals:()=>qW0,parseShortstat:()=>$c});import{spawnSync as WW0}from"child_process";function pj($,Z){try{let J=WW0("git",[...Z],{cwd:$,encoding:"utf8",stdio:["ignore","pipe","pipe"],env:z8()});return J.status===0?J.stdout.trim():null}catch{return null}}function eu($){let Z=pj($,["symbolic-ref","--short","refs/remotes/origin/HEAD"]);if(Z)return Z;for(let J of["origin/main","origin/master","main","master"])if(pj($,["rev-parse","--verify","--quiet",J])!==null)return J;return null}function $c($){let Z=(J)=>{let X=$.match(J);return X?Number.parseInt(X[1]??"0",10):0};return{files:Z(/(\d+) files? changed/),insertions:Z(/(\d+) insertions?\(\+\)/),deletions:Z(/(\d+) deletions?\(-\)/)}}function qW0($){if(!$)return tu;let Z=eu($);if(!Z)return tu;let J=pj($,["rev-list","--count",`${Z}..HEAD`]),X=J===null?null:Number.parseInt(J,10),z=pj($,["diff","--shortstat",`${Z}...HEAD`]),G=z===null?null:$c(z);return{baseRef:Z,ahead:X!==null&&Number.isNaN(X)?null:X,diff:G}}var tu;var Jc=l(()=>{dJ();tu={baseRef:null,ahead:null,diff:null}});async function HW0($,Z,J){let X;try{X=await ZT()}catch(z){throw new K1(`failed to start PTY host for ${$.id}: ${z instanceof Error?z.message:String(z)}`,"SESSION_FAILED")}try{if($.tab&&$.tab!=="new"){let L=U7({command:$.command,vendor:$.vendor,effort:$.modelEffort})[0];return await QT(X.rpc,$.id,$.tab,Z,J,{engineBin:L})}let z=$.tab==="new"?mu($.id,$.tabVendor,$.tabCommand):void 0,G=$.tabVendor??$.vendor,W=$.tabCommand??($.tabVendor?void 0:$.command),{argv:q,sessionId:U}=dQ(U7({command:W,vendor:G,effort:$.modelEffort}),G);qH(G,Z);let B=WH({task:{id:$.id,kind:$.kind,vendor:G,repo:$.repo},worktreePath:Z,shell:process.env.SHELL?.trim()||"/bin/zsh",argv:q,promptIntent:$.newTask?{kind:"new-task",prompt:J,spawnerTaskId:(await zH())?.taskId}:{kind:"explicit",prompt:J},tabId:z}),M=await XT(X.rpc,{id:$.id,engineBin:q[0]},Z,J,B,{forceNew:z!==void 0});if(M.started&&!M.engineReady)throw new K1(`failed to start hosted engine session for ${$.id}`,"SESSION_FAILED");if(M.started&&U)if(z)ku($.id,z,U);else DT($.id,U);else if(!z)DT($.id);return M}catch(z){if(z instanceof K1)throw z;throw new K1(`hosted engine session failed for ${$.id}: ${z instanceof Error?z.message:String(z)}`,"SESSION_FAILED")}finally{X.close()}}async function xT($,Z,J,X=UW0){let z=Z.worktreePath;if(!z)z=(await $.request("task.ensureWorktree",{taskId:Z.id})).worktreePath;if(!z)throw new K1(`task ${Z.id} has no worktree`,"NO_WORKTREE");let G=await X.deliverHosted(Z,z,J);if(!G)throw new K1(`failed to start hosted engine session for ${Z.id}`,"SESSION_FAILED");return G}var UW0,MF;var NF=l(()=>{H9();J2();Dj();Pj();Tj();YF();Uj();PT();$8();UW0={deliverHosted:HW0};MF={isTaskRunning:async($)=>(await MF.taskTabs($)).running,taskTabs:async($)=>{let Z=[],J=await XH();if(J)try{Z=await QH(J.rpc)}finally{J.close()}let X;try{let{foregroundEngineIn:W,parsePsSnapshot:q,psSnapshot:U}=await Promise.resolve().then(() => (LZ(),sO)),B=Z.filter((M)=>M.alive&&typeof M.pid==="number"&&M.pid>0);if(B.length>0){let M=q(await U());X=new Map(B.map((L)=>[L.key,W(M,L.pid)?.vendor??null]))}}catch{}let z={};try{z=(await Promise.resolve().then(() => (hj(),TT))).readPtyExitRecords()}catch{}let G=yu($);return{tabs:gu(G,$,Z,z,X),running:vu(G,$,Z)}},deliverPrompt:($,Z,J)=>xT($,Z,J),resolveRepoRoot:async($)=>(await Promise.resolve().then(() => (A4(),mq))).resolveMainRepoRoot($),defaultVendor:async($)=>{let{getGlobalDefaultVendor:Z,getRepoLastActiveVendor:J}=await Promise.resolve().then(() => (AZ(),du));return($?J($):void 0)??Z()},readWorktreeChanges:async($)=>(await Promise.resolve().then(() => (OH(),su))).readWorktreeChanges($),readBranchSignals:async($)=>(await Promise.resolve().then(() => (Jc(),Zc))).readBranchSignals($),tearDownSession:async($)=>{let Z=await XH();if(Z)try{await zT(Z.rpc,$T(await QH(Z.rpc),$))}catch{}finally{Z.close()}}}});var nj;var Xc=l(()=>{nj={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.8.183",description:"Rove \u2014 the agent multiplexer for your terminal. Run coding agents on parallel tasks with isolated worktrees and persistent sessions.",type:"module",packageManager:"bun@1.3.13",bin:{kobe:"dist/cli/kobe.js",rove:"dist/cli/rove.js"},files:["dist/cli","dist/web-ui","dist/skills","dist/*.wav","README.md","LICENSE"],publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sma1lboy/rove.git"},homepage:"https://github.com/Sma1lboy/rove#readme",bugs:{url:"https://github.com/Sma1lboy/rove/issues"},engines:{bun:">=1.3.11"},scripts:{dev:"ROVE_DEV=1 bun --conditions=browser ./src/cli/rove.ts","dev:kobe":"KOBE_DEV=1 bun --conditions=browser ./src/cli/kobe.ts","dev:mock":"KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react":"KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react-task-dialogs":"KOBE_DEV=1 bun ./src/tui-react/component/mock-dialogs-host.tsx","dev:mock-react-filetree":"KOBE_DEV=1 bun ./src/tui-react/panes/filetree/mock-host.tsx","dev:mock-react-sidebar":"KOBE_DEV=1 bun ./src/tui-react/panes/sidebar/mock-host.tsx","dev:mock-react-terminal":"KOBE_DEV=1 bun ./src/tui-react/panes/terminal/mock-host.tsx","dev:mock-react-dialogs":"KOBE_DEV=1 bun ./src/tui-react/mock/dialogs-host.tsx","dev:mock-react-workspace":"KOBE_DEV=1 bun ./src/tui-react/workspace/mock-host.tsx","dev:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts","build:with-web":"bun run build",compile:"bun run scripts/compile.ts",typecheck:"tsc --noEmit","check-i18n":"bun run scripts/check-i18n.ts",test:"bun run test:fast && bun run test:socket","perf:golden":"bun scripts/perf-golden.ts","pty:soak":"bun scripts/pty-soak.ts","test:fast":"vitest run --passWithNoTests --minWorkers=1 --maxWorkers=8","test:socket":"KOBE_INCLUDE_SOCKET=1 vitest run test/daemon --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:socket:coverage":"KOBE_INCLUDE_SOCKET=1 KOBE_COVERAGE_DAEMON=1 vitest run test/daemon --coverage --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:behavior":"KOBE_INCLUDE_BEHAVIOR=1 vitest run test/behavior --pool forks --minWorkers=1 --maxWorkers=1 --retry=2 --passWithNoTests","test:render":"bun test test/render --coverage --coverage-reporter=text --coverage-reporter=lcov --coverage-dir=coverage-render",coverage:"vitest run --coverage --passWithNoTests",bench:"vitest bench --run",lint:"biome check .",knip:"knip-bun",postinstall:"bun run scripts/check-preview-deps.ts || true",prepublishOnly:"bun run typecheck && bun run build"},"//":"biome.json + bunfig.toml live at the monorepo root since they apply repo-wide; bun.lock also lives at root (workspace-shared).",dependencies:{"@ansi-tools/parser":"^1.0.15","@opentui/core":"0.4.3","@opentui/react":"0.4.3","@xterm/addon-serialize":"^0.14.0","@xterm/addon-unicode11":"^0.9.0","@xterm/headless":"^6.0.0","node-pty":"^1.1.0",react:"^19.2.8",ws:"^8.18.0"},devDependencies:{"@biomejs/biome":"1.9.4","@sma1lboy/kobe-daemon":"0.7.14","@tsconfig/bun":"1.0.10","@types/bun":"1.3.14","@types/node":"25.6.2","@types/react":"^19.2.0","@vitest/coverage-v8":"2.1.9",knip:"^6.14.2","kobe-web":"workspace:*","react-devtools-core":"^7.0.1",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]}});var zc={};A$(zc,{repoSlug:()=>aY,releasePageUrl:()=>kT,recommendedGlobalInstallCommand:()=>bT,isNewerSemver:()=>fT,fetchReleaseSummaries:()=>OF,fetchReleaseNotesRange:()=>vT,fetchReleaseNotes:()=>gT,compareSemver:()=>A3,checkLatestVersion:()=>rY,breakingVersionsCrossed:()=>LF,UPDATE_SCRIPT_URL:()=>ij,UPDATE_COMMAND:()=>PZ,PACKAGE_NAME:()=>yT,CURRENT_VERSION:()=>D$,BREAKING_VERSIONS:()=>pJ});function aY(){let $=nj.repository?.url;if(!$)return null;let Z=$.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!Z||!Z[1]||!Z[2])return null;return`${Z[1]}/${Z[2]}`}function bT(){return`npm install -g ${yT}@latest`}function LF($,Z,J=pJ){let[X,z]=A3($,Z)<=0?[$,Z]:[Z,$];return J.filter((G)=>A3(G,X)>0&&A3(G,z)<=0)}async function KW0($){let Z=new AbortController,J=setTimeout(()=>Z.abort(),oj);try{let X=$.replace("/","%2F"),z=await fetch(`https://registry.npmjs.org/${X}/latest`,{signal:Z.signal,headers:{accept:"application/json"}});if(!z.ok)return null;let G=await z.json();if(typeof G.version!=="string")return null;return G.version}catch{return null}finally{clearTimeout(J)}}function fT($,Z){return A3($,Z)>0}function A3($,Z){let J=(G)=>G.split("-")[0]??G,X=J($).split(".").map((G)=>Number.parseInt(G,10)),z=J(Z).split(".").map((G)=>Number.parseInt(G,10));for(let G=0;G<3;G++){let W=X[G]??0,q=z[G]??0;if(Number.isNaN(W)||Number.isNaN(q))return 0;if(W>q)return 1;if(W<q)return-1}return 0}async function rY($={}){let Z=process.env.KOBE_FAKE_UPDATE;if(Z)return{current:D$,latest:Z,hasUpdate:fT(Z,D$)};if(fq()&&!$.force)return null;let J=await KW0(yT);if(!J)return null;return{current:D$,latest:J,hasUpdate:fT(J,D$)}}function Qc($){if(typeof $!=="string")return null;return $.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}async function gT($){let Z=aY();if(!Z)return null;let J=`v${$}`,X=new AbortController,z=setTimeout(()=>X.abort(),oj);try{let G=await fetch(`https://api.github.com/repos/${Z}/releases/tags/${J}`,{signal:X.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!G.ok)return null;let W=await G.json();if(typeof W.body!=="string"||typeof W.html_url!=="string")return null;return{body:W.body,url:W.html_url,version:$}}catch{return null}finally{clearTimeout(z)}}async function vT($){let Z=aY();if(!Z)return[];let J=$.limit??100,X=new AbortController,z=setTimeout(()=>X.abort(),oj);try{let G=await fetch(`https://api.github.com/repos/${Z}/releases?per_page=${J}`,{signal:X.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!G.ok)return[];let W=await G.json();if(!Array.isArray(W))return[];return W.map((q)=>{let U=Qc(q.tag_name);if(!U||typeof q.html_url!=="string"||typeof q.body!=="string")return null;if(A3(U,$.current)<=0)return null;if(A3(U,$.latest)>0)return null;return{version:U,url:q.html_url,body:q.body}}).filter((q)=>q!==null)}catch{return[]}finally{clearTimeout(z)}}async function OF($=12){let Z=aY();if(!Z)return[];let J=new AbortController,X=setTimeout(()=>J.abort(),oj);try{let z=await fetch(`https://api.github.com/repos/${Z}/releases?per_page=${$}`,{signal:J.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!z.ok)return[];let G=await z.json();if(!Array.isArray(G))return[];return G.map((W)=>{let q=Qc(W.tag_name);if(!q||typeof W.html_url!=="string")return null;return{version:q,url:W.html_url}}).filter((W)=>W!==null)}catch{return[]}finally{clearTimeout(X)}}function kT($){let Z=aY();if(!Z)return null;return`https://github.com/${Z}/releases/tag/v${$}`}var D$,yT,ij="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",PZ,pJ,oj=3000;var l8=l(()=>{Xc();j5();D$=nj.version,yT=nj.name;PZ=`curl -fsSL ${ij} | sh`;pJ=[]});function i4($){if(!$.client)throw new K1("daemon required","BAD_DAEMON");return $.client}async function Z4($,Z,J){return i4($).request(Z,J)}async function Yc(){let[{KobeDaemonClient:$},{defaultPtyHostSocketPath:Z}]=await Promise.all([Promise.resolve().then(() => (W9(),aR)),Promise.resolve().then(() => (R2(),pR))]),J=new $(Z());try{return await J.connect(),await J.request("pty.list",{})}catch{return{sessions:[]}}finally{J.close()}}var B7=l(()=>{$8()});async function FW0($){let Z=$.args.require("command"),J=pQ(Z);return await Z4($,"task.setCommand",{taskId:$.args.require("task-id"),command:Z,vendor:J}),{ok:!0,command:Z,protocol:J,...J===cY?{generic:!0}:{}}}var Gc,Wc;var mT=l(()=>{H9();f7();B7();Gc={name:"engine-list",summary:"List every engine Rove can launch \u2014 built-ins and your registered presets \u2014 each with its RAW launch command, exactly as it runs. Copy one into `add --command` / `send --tab new --command` verbatim, or edit its flags first. `protocol` is the adapter Rove speaks to it (history, trust, delivery); `generic` = none, which still runs fine but loses transcript reads. Returns { engines }.",flags:[],offline:!0,handler:async()=>({engines:om()})};Wc={name:"set-command",summary:"Set a task's engine launch command (takes effect on the next session rebuild). The protocol Rove speaks to it is derived from the command \u2014 the result reports which one, `generic` when the command names no engine Rove knows.",flags:[$$.taskId(),{...$$.command(),required:!0}],handler:FW0}});function Bc($){let Z=$.args.str("precheck");if(Z===void 0)return{};if(Z.length===0)return{precheck:null};return{precheck:{command:Z,timeoutSeconds:$.args.int("precheck-timeout")??120}}}var qc,Hc,Uc,Kc;var Fc=l(()=>{f7();B7();qc={name:"schedule",type:"string",placeholder:"CRON",description:"Five-field cron in the daemon host's local time, e.g. '0 9 * * MON-FRI'."},Hc=[{name:"precheck",type:"string",placeholder:"CMD",description:"Shell command run in the repo BEFORE the engine starts. Non-zero exit skips the run without spawning an agent \u2014 the cheap way to avoid burning a turn when nothing changed."},{name:"precheck-timeout",type:"int",placeholder:"SEC",description:"Seconds before the precheck is killed and the run skipped (default 120)."}],Uc={name:"grace",type:"int",placeholder:"MIN",description:"How late a missed occurrence may still run when the daemon was down (default 60). Only the most recent missed occurrence is ever run."};Kc=[{name:"routine-list",summary:"List scheduled routines with their next run time.",flags:[],handler:($)=>Z4($,"automation.list",{})},{name:"routine-create",summary:"Schedule a prompt. Each firing creates a fresh task (worktree + engine) and delivers it. An enabled routine keeps the daemon alive so it fires with no TUI attached.",flags:[$$.repo(),{name:"name",type:"string",required:!0,placeholder:"N",description:"Routine name."},$$.prompt(!0,"Text delivered as the new session's first message."),{...qc,required:!0},$$.vendor(),{name:"base-branch",type:"string",placeholder:"B",description:"Base ref each run's worktree branches from."},...Hc,Uc,{name:"disabled",type:"bool",description:"Create it paused instead of active."}],handler:($)=>Z4($,"automation.create",{repo:$.args.requirePath("repo"),name:$.args.require("name"),prompt:$.args.require("prompt"),schedule:$.args.require("schedule"),...$.args.vendor()?{vendor:$.args.vendor()}:{},...$.args.str("base-branch")?{baseRef:$.args.str("base-branch")}:{},...Bc($),...$.args.int("grace")!==void 0?{missedRunGraceMinutes:$.args.int("grace")}:{},...$.args.bool("disabled")?{enabled:!1}:{}})},{name:"routine-update",summary:"Change a routine. A new --schedule re-anchors its next run; --precheck '' clears the precheck.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."},{name:"name",type:"string",placeholder:"N",description:"New name."},$$.prompt(!1,"New prompt."),qc,$$.vendor(),{name:"base-branch",type:"string",placeholder:"B",description:"New base ref ('' to clear)."},...Hc,Uc],handler:($)=>Z4($,"automation.update",{id:$.args.require("id"),...$.args.str("name")!==void 0?{name:$.args.str("name")}:{},...$.args.str("prompt")!==void 0?{prompt:$.args.str("prompt")}:{},...$.args.str("schedule")!==void 0?{schedule:$.args.str("schedule")}:{},...$.args.vendor()?{vendor:$.args.vendor()}:{},...$.args.str("base-branch")!==void 0?{baseRef:$.args.str("base-branch")}:{},...Bc($),...$.args.int("grace")!==void 0?{missedRunGraceMinutes:$.args.int("grace")}:{}})},{name:"routine-set-enabled",summary:"Pause or resume a routine. Disabling the last active one releases the daemon's keep-alive hold.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."},{name:"enabled",type:"bool",required:!0,description:"true to resume, false to pause."}],handler:($)=>Z4($,"automation.update",{id:$.args.require("id"),enabled:$.args.bool("enabled")})},{name:"routine-delete",summary:"Delete a routine and its run history. Tasks it already created are untouched.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."}],handler:($)=>Z4($,"automation.delete",{id:$.args.require("id")})},{name:"routine-run-now",summary:"Run a routine immediately, skipping its precheck (asking for it IS the answer). Does not shift its schedule.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."}],handler:($)=>Z4($,"automation.runNow",{id:$.args.require("id")})},{name:"routine-runs",summary:"Run history, newest first. Statuses: dispatched, skipped_precheck (nothing to do), skipped_missed, skipped_unavailable, dispatch_failed.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."}],handler:($)=>Z4($,"automation.runs",{id:$.args.require("id")})}]});async function Mc($,Z){let J=$.args.str("command");if(J)return{command:J,vendor:pQ(J)};let X=await $.runtime.defaultVendor(Z);return X?{command:X,vendor:X}:{}}function Nc($){return{...$.command?{command:$.command}:{},...$.vendor?{vendor:$.vendor}:{}}}async function Lc($){let{args:Z,runtime:J}=$,X=await J.resolveRepoRoot(Z.requirePath("repo")),z=Z.int("count"),G=Z.str("agents");if(z!==void 0||G)return NW0($,X,z,G);return MW0($,X)}async function MW0($,Z){let J=i4($),{args:X}=$,z=await Mc($,Z),G={repo:Z,...await GT(),...Nc(z)},W=X.str("title");if(W)G.title=W;let q=X.str("branch");if(q)G.branch=q;let U=X.str("base-branch");if(U)G.baseRef=U;let B=await J.request("task.create",G),M=B.taskId;if(X.bool("activate"))await J.request("task.setActive",{taskId:M});let L=X.enumOf("status");if(L)await J.request("task.status",{taskId:M,status:L});let N=X.bool("pin");if(N!==void 0)await J.request("task.pin",{taskId:M,pinned:N});let j=B.task;if(L||N!==void 0)j=(await J.request("task.get",{taskId:M})).task;let D=X.str("prompt");if(!D)return{taskId:M,task:j,started:!1};let C=await $.runtime.deliverPrompt(J,{id:M,worktreePath:j.worktreePath,kind:j.kind,vendor:j.vendor,command:j.command,modelEffort:j.modelEffort,repo:j.repo,newTask:!0},D);if(j=(await J.request("task.get",{taskId:M})).task,!C.delivered)throw new K1(`task ${M} created but the prompt was not delivered (paste did not land)`,"NOT_DELIVERED",{taskId:M});return{taskId:M,task:j,started:C.started,engineReady:C.engineReady,session:C.session,delivered:C.delivered}}async function NW0($,Z,J,X){let z=i4($),{args:G}=$,W=G.str("prompt");if(!W)throw new K1("--count/--agents spawn parallel attempts of ONE prompt \u2014 pass --prompt","MISSING_FLAG",O3("add"));if(G.str("branch"))throw new K1("--branch names ONE branch and cannot be shared by parallel siblings \u2014 drop it (each sibling gets its own auto branch) or spawn them one at a time","BAD_FLAG",O3("add"));if(X){let I=J!==void 0?"--count":G.str("command")?"--command":null;if(I)throw new K1(`${I} conflicts with --agents, which already names each sibling's engine and how many \u2014 pass one or the other`,"BAD_FLAG",O3("add"))}let q=G.str("title"),U=G.str("base-branch"),B=await Mc($,Z),M=X?Nj(X):Lj(J??1,B.vendor??"claude");if(M.length>jZ)throw new K1(`a parallel round of ${M.length} exceeds the cap of ${jZ} \u2014 spawn in batches`,"BAD_FLAG");let L=BO(),N=[],j=null,D=await GT();for(let[I,R]of M.entries()){let w=X?{command:R,vendor:R}:{...B,vendor:R},f={repo:Z,groupId:L,...D,...Nc(w)};if(q)f.title=M.length>1?`${q} #${I+1}/${M.length}`:q;if(U)f.baseRef=U;try{let y=await z.request("task.create",f);N.push({taskId:y.taskId,vendor:R,task:y.task})}catch(y){let k=y instanceof K1?y.code:"CREATE_FAILED",u=y instanceof Error?y.message:String(y);j={vendor:R,error:{message:u,code:k}};break}}let C=await Promise.allSettled(N.map(({taskId:I,vendor:R,task:w})=>$.runtime.deliverPrompt(z,{id:I,worktreePath:w.worktreePath,kind:w.kind,vendor:R,command:w.command,modelEffort:w.modelEffort,repo:w.repo,newTask:!0},W))),_=[],g=[];if(C.forEach((I,R)=>{let{taskId:w,vendor:f}=N[R];if(I.status==="fulfilled"&&I.value.delivered){_.push({ok:!0,taskId:w,vendor:f,started:I.value.started,engineReady:I.value.engineReady,session:I.value.session});return}let y=I.status==="rejected"?I.reason:new K1(`prompt was not confirmed in ${w}'s engine`,"NOT_DELIVERED"),k=y instanceof K1?y.code:"DELIVER_FAILED",u=y instanceof Error?y.message:String(y);g.push({ok:!1,taskId:w,vendor:f,error:{message:u,code:k}})}),j)g.push({ok:!1,vendor:j.vendor,error:j.error});let E={count:N.length,requested:M.length,groupId:L,tasks:_,failures:g};if(g.length>0)throw new K1(`add delivered ${_.length}/${M.length}`,"PARTIAL_FANOUT",E);return E}var Oc=l(()=>{H9();yP();YF();f7();B7();$8()});var aj;var hT=l(()=>{aj=["backlog","in_progress","in_review","done","canceled","error"]});var jc;var Vc=l(()=>{f7();Oc();hT();jc=[{name:"add",summary:`Create a task (shows in the sidebar immediately). With --prompt it also starts the engine and delivers it. PARALLEL ATTEMPTS: --count N spawns N sibling tasks of the SAME prompt, each in its own worktree/branch (--agents claude:2,codex:1 for a mixed fleet); capped at ${jZ}, prefer 3-4. Does NOT steal focus \u2014 pass --activate to make it the active task. Alias: spawn-task.`,flags:[$$.repo(),$$.title(),{name:"branch",type:"string",placeholder:"B",description:"Explicit branch name (else derived from the title in the repo's own style). Single task only."},{name:"base-branch",type:"string",placeholder:"B",description:"Base ref the worktree branches from."},$$.command(),{name:"count",type:"int",placeholder:"N",description:`Spawn N sibling tasks of one prompt (parallel attempts, cap ${jZ}). Requires --prompt.`},{name:"agents",type:"string",placeholder:"claude:2,codex:1",description:"Per-ENGINE counts for a mixed parallel round (alternative to --count). Engine ids only \u2014 see `engine-list`."},{name:"status",type:"enum",values:aj,default:"backlog",description:"Initial lifecycle status."},{name:"pin",type:"bool",description:"Pin the task to the top of the sidebar."},{name:"activate",type:"bool",default:"false",description:"Make this the active task (pulls every mounted TUI's Tasks-pane focus). Off by default."},$$.prompt(!1,"Optional first message \u2014 when set, materializes the worktree, starts the engine, and pastes it. Required with --count/--agents.")],handler:Lc}]});var _c,Cc;var Ac=l(()=>{hJ();f7();B7();NF();$8();_c={name:"pane-open",summary:"Open a terminal pane in a task's workspace: split the focused tab (default, or --tab's tab) or open a separate command tab, optionally running a command. Broadcast over the daemon's tab.open channel \u2014 an attached TUI showing the task performs the split. Task defaults to $ROVE_TASK_ID, then the active task.",flags:[$$.taskId(!1),{name:"tab",type:"string",placeholder:"TAB",description:"Host tab for the split (e.g. tab-3) instead of the focused tab (split placement only)."},{name:"command",type:"string",placeholder:"CMD",description:"Shell command the pane runs (via the login shell's `-ilc`, so pipes/args and your shell rc's PATH/exports work); the pane closes when it exits. Omit for an interactive shell."},{name:"direction",type:"enum",values:["right","down"],default:"right",description:"Split orientation relative to the active pane (split placement only)."},{name:"placement",type:"enum",values:["split","tab"],default:"split",description:"`split` joins the focused tab's split group; `tab` opens a separate command tab."},{name:"title",type:"string",placeholder:"TEXT",description:`Pane label (default: the command's first word, else "shell").`}],handler:async($)=>{let Z=i4($),J=$.args.str("task-id")??process.env.KOBE_TASK_ID??await uJ(Z);if(!J)throw new K1("no target task: pass --task-id (no $ROVE_TASK_ID, no active task)","TASK_NOT_FOUND");let X=$.args.str("command"),z=y7({fallback:"/bin/sh"}),G=X?[z,"-ilc",X]:[z,"-il"],W=$.args.str("title")??(X?X.trim().split(/\s+/)[0]??"shell":"shell"),q=$.args.str("tab");return Z4($,"tab.open",{taskId:J,argv:G,title:W,...q!==void 0?{tabId:q}:{},placement:$.args.str("placement")??"split",direction:$.args.str("direction")??"right"})}},Cc={name:"pane-close",summary:"Close panes opened by pane-open: every split pane / command tab in the task whose label matches --title. Broadcast over the daemon's tab.close channel \u2014 an attached TUI showing the task performs the close (headless no-op). Task defaults to $ROVE_TASK_ID, then the active task.",flags:[$$.taskId(!1),{name:"title",type:"string",required:!0,placeholder:"TEXT",description:"Pane label to close \u2014 the --title the pane was opened with (engine panes are never closed)."},{name:"tab",type:"string",placeholder:"TAB",description:"Scope the title match to one tab (e.g. tab-3) instead of every tab of the task."}],handler:async($)=>{let Z=i4($),J=$.args.str("task-id")??process.env.KOBE_TASK_ID??await uJ(Z);if(!J)throw new K1("no target task: pass --task-id (no $ROVE_TASK_ID, no active task)","TASK_NOT_FOUND");let X=$.args.str("tab");return Z4($,"tab.close",{taskId:J,title:$.args.str("title"),...X!==void 0?{tabId:X}:{}})}}});var uT,jF,cT,lT="DIRTY_WORKTREE",dT,pT,LW0="TASK_DELETING",oQ,OW0="MAIN_CHECKOUT_DIRTY",nT,jW0="EMPTY_BRANCH",iT,rj="EMPTY_BRANCH_DIRTY_WORKTREE",oT,VW0="LAND_CONFLICT",sj;var nJ=l(()=>{uT=class uT extends Error{from;to;taskId;constructor($,Z,J){super(`illegal transition for task ${J}: ${$} -> ${Z}`);this.from=$;this.to=Z;this.taskId=J;this.name="IllegalTransitionError"}};jF=class jF extends Error{constructor($){super(`task not found: ${$}`);this.name="TaskNotFoundError"}};cT=class cT extends Error{constructor(){super("cannot delete a main task; remove the repo from saved repos instead");this.name="CannotDeleteMainTaskError"}};dT=class dT extends Error{taskId;constructor($){super(`${lT}: task ${$} worktree has uncommitted or untracked changes`);this.taskId=$;this.name="DirtyWorktreeError"}};pT=class pT extends Error{taskId;cause;constructor($,Z){super(`failed to remove worktree for task ${$}: ${M1(Z)}`);this.taskId=$;this.cause=Z;this.name="WorktreeRemoveFailedError"}};oQ=class oQ extends Error{taskId;constructor($){super(`${LW0}: task ${$} is being deleted`);this.taskId=$;this.name="TaskDeletingError"}};nT=class nT extends Error{repo;dir;constructor($,Z){super(`${OW0}: base checkout at ${Z} has uncommitted changes; commit or stash them before landing`);this.repo=$;this.dir=Z;this.name="MainCheckoutDirtyError"}};iT=class iT extends Error{branch;landedOn;constructor($,Z){super(`${jW0}: '${$}' has no commits ahead of '${Z}' \u2014 landing it would be a no-op (the worker may not have delivered anything)`);this.branch=$;this.landedOn=Z;this.name="EmptyBranchError"}};oT=class oT extends Error{branch;landedOn;worktreePath;files;constructor($,Z,J,X){let z=X.length>0?X.join(", "):"(none reported)";super(`${rj}: '${$}' has no commits ahead of '${Z}' but its worktree ${J} has uncommitted changes (${z}) \u2014 commit them in the worktree first, then land again`);this.branch=$;this.landedOn=Z;this.worktreePath=J;this.files=X;this.name="EmptyBranchDirtyWorktreeError"}};sj=class sj extends Error{taskId;branch;files;constructor($,Z,J){let X=J.length>0?J.join(", "):"(none reported)";super(`${VW0}: merging '${Z}' hit conflicts, merge aborted \u2014 conflicted files: ${X}`);this.taskId=$;this.branch=Z;this.files=J;this.name="LandConflictError"}}});async function _W0($,Z,J){let X=await zH(),z=X?.taskId;if(!z||z===Z)return J;let G=z;try{let U=await $.request("task.get",{taskId:z});G=U.task.title||U.task.branch||z}catch{}let W=_3(),q=`--task-id ${z} --tab ${X.tabId}`;return`[ROVE PEER] from "${G}" (task ${z} \u2014 load the Rove agent skill FIRST (registered as /rove; legacy /kobe installs still work), then reply: \`${W} send ${q} --prompt "<text>"\`; verb reference: \`${W} schema\`): ${J}`}async function Dc($){let Z=$.args.str("title"),J=$.args.str("body"),X=$.args.str("task");if(Z===void 0&&J===void 0&&X===void 0)throw new K1("issue-update requires --title, --body, and/or --task","MISSING_FLAG");let z=$.args.requirePath("repo"),G=$.args.int("id"),W;if(Z!==void 0||J!==void 0)W=await Z4($,"issue.mutate",{repoRoot:z,op:{type:"update",id:G,title:Z,body:J}});if(X!==void 0)W=await Z4($,"issue.mutate",{repoRoot:z,op:X==="none"?{type:"unlink",id:G}:{type:"link",id:G,taskId:X}});return W}async function Pc($){let Z=i4($),J=$.args.require("prompt"),X=$.args.str("tab");if(X&&X!=="new"&&!/^tab-[A-Za-z0-9-]+$/.test(X))throw new K1(`--tab must be "new" or a tab id like tab-2 (got ${JSON.stringify(X)})`,"BAD_TAB");let z=$.args.str("command");if(z&&X!=="new")throw new K1(`--command only applies to a new tab; pass --tab new (got --tab ${X??"<canonical>"})`,"BAD_FLAG",O3("send"));let G=z?pQ(z):void 0,W=$.args.str("task-id");if(!W){let M=await um(Z);if(M){if(W=M.taskId,X===void 0)X=await cm($.runtime,M)}else{let L=await uJ(Z);if(!L)throw new K1("no --task-id given and no active task \u2014 open a task first or pass --task-id","MISSING_TARGET");W=L}}let q=await Z.request("task.get",{taskId:W}),U=$.args.bool("plain")?J:await _W0(Z,W,J),B=await $.runtime.deliverPrompt(Z,{id:W,worktreePath:q.task.worktreePath,kind:q.task.kind,vendor:q.task.vendor,command:q.task.command,modelEffort:z?void 0:q.task.modelEffort,repo:q.task.repo,tab:X,tabVendor:G,tabCommand:z},U);if(!B.delivered)throw new K1(`prompt was not confirmed in ${W}'s engine (paste did not land)`,"NOT_DELIVERED");return{ok:!0,taskId:W,session:B.session,started:B.started,engineReady:B.engineReady}}async function CW0($){let Z=i4($),J=$.args.require("task-id"),X=$.args.require("prompt"),z=$.args.str("tab"),G=await Z.request("session.deliver",{taskId:J,text:X,...z!==void 0?{tabId:z}:{},source:"dispatcher"});return{ok:!0,taskId:J,...z!==void 0?{tabId:z}:{},routed:"session.deliver",...G?.clients!==void 0?{clients:G.clients}:{}}}async function Tc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.require("text");return await Z.request("note.file",{taskId:J,text:X})}async function Sc($){let Z=i4($),J=$.args.require("task-id"),X=await Z.request("task.get",{taskId:J}),{tabs:z,running:G}=await $.runtime.taskTabs(J);return{task:X.task,running:G,tabs:z}}async function Ic($){return i4($).request("task.list")}async function Ec($){let Z=i4($),X=$.args.bool("none")?null:$.args.require("task-id");return await Z.request("task.setActive",{taskId:X}),{ok:!0,activeTaskId:X}}async function wc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.bool("archived")??!0,z=await Z.request("task.archive",{taskId:J,archived:X});if(X)await $.runtime.tearDownSession(J);return z}async function xc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.bool("force")??!1,z=$.args.bool("delete-branch")??!1,G=await Z.request("task.delete",{taskId:J,force:X,deleteBranch:z});return await $.runtime.tearDownSession(J),G}async function fc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.str("strategy")==="squash"?"squash":"merge",z=$.args.bool("remove-worktree")??!1,G;try{G=await Z.request("task.land",{taskId:J,strategy:X,deleteBranch:$.args.bool("delete-branch")??!1,archive:$.args.bool("then-archive")??!1,removeWorktree:z,...z?{callerCwd:process.cwd()}:{}})}catch(W){throw AW0(W,J)}return{ok:!0,taskId:J,...G.result}}function AW0($,Z){let J=M1($);if(!J.includes(rj))return $;let X=/EMPTY_BRANCH_DIRTY_WORKTREE: '([^']+)'/.exec(J)?.[1]??"your task branch";return new K1(J,rj,{hint:"the worker wrote files but never committed them \u2014 send it back to commit its own work, then land again",nextCommandArgs:["api","send","--task-id",Z,"--prompt",`your work is uncommitted on ${X} \u2014 commit it yourself with a proper message, then report back`]})}async function yc($){let Z=i4($),{args:J}=$,X={repo:J.requirePath("repo"),worktreePath:J.requirePath("worktree")},z=J.str("branch");if(z)X.branch=z;let G=J.str("command");if(G)X.command=G,X.vendor=pQ(G);let W=J.str("title");if(W)X.title=W;return Z.request("worktree.adopt",X)}var Rc;var jH=l(()=>{H9();J2();nJ();YF();f7();B7();NF();$8();Rc={name:"dispatch",summary:"Route text into a task's live session via the daemon's session.deliver channel. The dispatcher's messenger (docs/design/dispatcher.md); unlike `send`, it requires an already-hosted session.",flags:[$$.taskId(!0),$$.prompt(!0,"Text delivered into the task's engine session."),{name:"tab",type:"string",required:!1,placeholder:"TAB",description:"Deliver into exactly this tab (e.g. tab-3) instead of the canonical engine tab."}],handler:CW0}});var bc;var gc=l(()=>{f7();B7();Ac();jH();bc=[{name:"send",summary:"Paste a follow-up prompt into a task's running engine (one full turn). Without --task-id, a task spawned from another Rove session replies to its dispatcher's tab (then that task's live canonical engine; nothing alive = DISPATCHER_UNREACHABLE, never a silent spawn); otherwise the active task. Sent from inside another Rove task ($ROVE_TASK_ID), the prompt is prefixed with [ROVE PEER] provenance \u2014 who sent it and how to reply (tab-precise) \u2014 so agent-to-agent messaging needs no coordinator.",flags:[$$.taskId(!1),$$.prompt(!0,"Text pasted + submitted into the engine pane."),{name:"tab",type:"string",required:!1,placeholder:"TAB",description:'Tab addressing: "new" spawns the prompt in a fresh engine tab; "tab-N" delivers to that exact alive tab (error when dead/absent). Omitted = the canonical engine tab.'},{...$$.command(),description:"Engine launch command for a `--tab new` tab \u2014 the API twin of the TUI's ctrl+e pick. Lets one worktree run two agents on the same files (e.g. hand the stuck work to codex without leaving the branch). An engine id from `engine-list` or a full command line; pinned to that tab, so it survives restarts and a later set-command on the task. Only valid with --tab new."},{name:"plain",type:"bool",required:!1,description:"Deliver the prompt verbatim \u2014 skip the [ROVE PEER] provenance prefix."}],handler:Pc},Rc,{name:"note",summary:"File a one-line field note \u2014 a resolved, repo-level gotcha worth sharing. Appended to the repo's durable note store (every future session on this repo starts with it) and forwarded to the dispatcher session for live relay (docs/design/dispatcher.md).",flags:[$$.taskId(!0),{name:"text",type:"string",required:!0,placeholder:"TEXT",description:"One line: the verified conclusion another session could act on."}],handler:Tc},{name:"note-list",summary:"Read a repo's accumulated field notes, newest first. Returns { notes }.",flags:[$$.repo(!0)],handler:($)=>Z4($,"note.list",{repo:$.args.requirePath("repo")})},_c,Cc,{name:"notify",summary:"Show a toast in every attached Rove UI \u2014 broadcast over the daemon's notice.event channel. Agents/scripts use it to surface 'done / needs input / error' moments without touching the task's session.",flags:[{name:"title",type:"string",required:!0,placeholder:"TEXT",description:"Toast text (one line)."},{name:"kind",type:"string",default:"done",placeholder:"KIND",description:`Free-form kind tag. "done", "needs_input" and "error" get the TUI's severity styling/unread mark; any other value renders neutrally.`},$$.taskId(!1),{name:"source",type:"string",placeholder:"TAG",description:"Free-form origin tag (e.g. an agent name) recorded on the event."}],handler:async($)=>{return Z4($,"notice.send",{title:$.args.str("title"),kind:$.args.str("kind")??"done",taskId:$.args.str("task-id"),source:$.args.str("source")})}},{name:"prompt",summary:"Ask the human for a line of text through the attached TUI's input dialog (plugins' host-provided prompt). Blocks until answered, cancelled, or timed out; returns { value } or { cancelled, reason }.",flags:[{name:"title",type:"string",required:!0,placeholder:"TEXT",description:"Dialog title (shown verbatim)."},{name:"placeholder",type:"string",placeholder:"TEXT",description:"Input placeholder."},{name:"initial",type:"string",placeholder:"TEXT",description:"Pre-filled input value."},{name:"timeout",type:"string",placeholder:"MS",description:"Give up after this many milliseconds (default 120000, max 600000)."}],handler:async($)=>{let Z=$.args.str("timeout"),J=Z?Number.parseInt(Z,10):void 0;return Z4($,"ui.prompt",{title:$.args.str("title"),placeholder:$.args.str("placeholder"),initial:$.args.str("initial"),...J&&Number.isFinite(J)?{timeoutMs:J}:{}})}},{name:"set-active",summary:"Set the shared active task (the focus every Tasks pane highlights). Pass --none to clear.",flags:[$$.taskId(!1),{name:"none",type:"bool",description:"Clear the active task instead of setting one."}],handler:Ec}]});var vc;var kc=l(()=>{f7();B7();mT();hT();vc=[{name:"rename",summary:"Set a task's title.",flags:[$$.taskId(),{name:"title",type:"string",required:!0,placeholder:"T",description:"New title."}],handler:($)=>Z4($,"task.rename",{taskId:$.args.require("task-id"),title:$.args.require("title")})},{name:"set-branch",summary:"Rename a task's branch (git branch -m if materialized, else recorded).",flags:[$$.taskId(),{name:"branch",type:"string",required:!0,placeholder:"B",description:"New branch name."}],handler:($)=>Z4($,"task.setBranch",{taskId:$.args.require("task-id"),branch:$.args.require("branch")})},Wc,{name:"set-status",summary:"Set a task's lifecycle status.",flags:[$$.taskId(),{name:"status",type:"enum",required:!0,values:aj,description:"New status."}],handler:($)=>Z4($,"task.status",{taskId:$.args.require("task-id"),status:$.args.requireEnum("status")})}]});import{spawnSync as DW0}from"child_process";function TW0($){let[Z,J]=$.split("/");if(!Z||!J)throw Error(`invalid GitHub repository slug: ${$}`);return{owner:Z,name:J}}function mc($,Z){let J=$.trim();if(!J)throw Error(`${Z} is required`);return J}function hc($,Z){let J=Z?.map((X)=>typeof X.message==="string"?X.message:null).filter((X)=>!!X);if(J&&J.length>0)return J.join("; ");return $.trim()||"GitHub CLI returned an empty response"}function uc($,Z,J){let X=["api","graphql","-f",`query=${$}`];for(let[U,B]of Object.entries(Z))X.push("-f",`${U}=${B}`);let z=J.spawn("gh",X,{encoding:"utf8"});if(z.error)throw Error(`failed to run gh: ${z.error.message}`);let G=typeof z.stdout==="string"?z.stdout:String(z.stdout??""),W=typeof z.stderr==="string"?z.stderr:String(z.stderr??""),q;try{q=JSON.parse(G)}catch{throw Error(`failed to parse gh response: ${hc(W,void 0)}`)}if((z.status??0)!==0||q.errors?.length)throw Error(hc(W,q.errors));if(!q.data)throw Error("GitHub CLI response did not include data");return q.data}function SW0($){return`${$}
82
+ `)){let X=J.replace(/\r$/,"");if(X.length===0)continue;let z=X.indexOf("\t");if(z<0)continue;let G=X.indexOf("\t",z+1);if(G<0)continue;let W=X.slice(G+1);if(W.length===0)continue;let q=zW0(W);if(q.path.length===0)continue;Z.push({path:q.path,...q.origPath!==void 0?{origPath:q.origPath}:{},added:iu(X.slice(0,z)),deleted:iu(X.slice(z+1,G))})}return Z}var XW0,QW0;var lj=l(()=>{XW0=new TextEncoder,QW0=new TextDecoder});var su={};A$(su,{sameWorktreeChanges:()=>FF,readWorktreeChanges:()=>GW0,pickPushedChanges:()=>wT,parsePorcelain:()=>LH});import{spawnSync as YW0}from"child_process";function FF($,Z){return $.added===Z.added&&$.deleted===Z.deleted}function wT($,Z){if(!$)return null;return $.get(Z)??dj}function GW0($){if(!$)return dj;try{let Z=YW0("git",["status","--porcelain=v1"],{cwd:$,encoding:"utf8",stdio:["ignore","pipe","pipe"],env:z8()});if(Z.status!==0||!Z.stdout)return dj;return LH(Z.stdout)}catch{return dj}}function LH($){let Z=0,J=0;for(let{x:X,y:z}of cj($))if(X==="D"||z==="D")J+=1;else Z+=1;return{added:Z,deleted:J}}var dj;var OH=l(()=>{dJ();lj();dj={added:0,deleted:0}});var Zc={};A$(Zc,{resolveBaseRef:()=>eu,readBranchSignals:()=>qW0,parseShortstat:()=>$c});import{spawnSync as WW0}from"child_process";function pj($,Z){try{let J=WW0("git",[...Z],{cwd:$,encoding:"utf8",stdio:["ignore","pipe","pipe"],env:z8()});return J.status===0?J.stdout.trim():null}catch{return null}}function eu($){let Z=pj($,["symbolic-ref","--short","refs/remotes/origin/HEAD"]);if(Z)return Z;for(let J of["origin/main","origin/master","main","master"])if(pj($,["rev-parse","--verify","--quiet",J])!==null)return J;return null}function $c($){let Z=(J)=>{let X=$.match(J);return X?Number.parseInt(X[1]??"0",10):0};return{files:Z(/(\d+) files? changed/),insertions:Z(/(\d+) insertions?\(\+\)/),deletions:Z(/(\d+) deletions?\(-\)/)}}function qW0($){if(!$)return tu;let Z=eu($);if(!Z)return tu;let J=pj($,["rev-list","--count",`${Z}..HEAD`]),X=J===null?null:Number.parseInt(J,10),z=pj($,["diff","--shortstat",`${Z}...HEAD`]),G=z===null?null:$c(z);return{baseRef:Z,ahead:X!==null&&Number.isNaN(X)?null:X,diff:G}}var tu;var Jc=l(()=>{dJ();tu={baseRef:null,ahead:null,diff:null}});async function HW0($,Z,J){let X;try{X=await ZT()}catch(z){throw new K1(`failed to start PTY host for ${$.id}: ${z instanceof Error?z.message:String(z)}`,"SESSION_FAILED")}try{if($.tab&&$.tab!=="new"){let L=U7({command:$.command,vendor:$.vendor,effort:$.modelEffort})[0];return await QT(X.rpc,$.id,$.tab,Z,J,{engineBin:L})}let z=$.tab==="new"?mu($.id,$.tabVendor,$.tabCommand):void 0,G=$.tabVendor??$.vendor,W=$.tabCommand??($.tabVendor?void 0:$.command),{argv:q,sessionId:U}=dQ(U7({command:W,vendor:G,effort:$.modelEffort}),G);qH(G,Z);let B=WH({task:{id:$.id,kind:$.kind,vendor:G,repo:$.repo},worktreePath:Z,shell:process.env.SHELL?.trim()||"/bin/zsh",argv:q,promptIntent:$.newTask?{kind:"new-task",prompt:J,spawnerTaskId:(await zH())?.taskId}:{kind:"explicit",prompt:J},tabId:z}),M=await XT(X.rpc,{id:$.id,engineBin:q[0]},Z,J,B,{forceNew:z!==void 0});if(M.started&&!M.engineReady)throw new K1(`failed to start hosted engine session for ${$.id}`,"SESSION_FAILED");if(M.started&&U)if(z)ku($.id,z,U);else DT($.id,U);else if(!z)DT($.id);return M}catch(z){if(z instanceof K1)throw z;throw new K1(`hosted engine session failed for ${$.id}: ${z instanceof Error?z.message:String(z)}`,"SESSION_FAILED")}finally{X.close()}}async function xT($,Z,J,X=UW0){let z=Z.worktreePath;if(!z)z=(await $.request("task.ensureWorktree",{taskId:Z.id})).worktreePath;if(!z)throw new K1(`task ${Z.id} has no worktree`,"NO_WORKTREE");let G=await X.deliverHosted(Z,z,J);if(!G)throw new K1(`failed to start hosted engine session for ${Z.id}`,"SESSION_FAILED");return G}var UW0,MF;var NF=l(()=>{H9();J2();Dj();Pj();Tj();YF();Uj();PT();$8();UW0={deliverHosted:HW0};MF={isTaskRunning:async($)=>(await MF.taskTabs($)).running,taskTabs:async($)=>{let Z=[],J=await XH();if(J)try{Z=await QH(J.rpc)}finally{J.close()}let X;try{let{foregroundEngineIn:W,parsePsSnapshot:q,psSnapshot:U}=await Promise.resolve().then(() => (LZ(),sO)),B=Z.filter((M)=>M.alive&&typeof M.pid==="number"&&M.pid>0);if(B.length>0){let M=q(await U());X=new Map(B.map((L)=>[L.key,W(M,L.pid)?.vendor??null]))}}catch{}let z={};try{z=(await Promise.resolve().then(() => (hj(),TT))).readPtyExitRecords()}catch{}let G=yu($);return{tabs:gu(G,$,Z,z,X),running:vu(G,$,Z)}},deliverPrompt:($,Z,J)=>xT($,Z,J),resolveRepoRoot:async($)=>(await Promise.resolve().then(() => (A4(),mq))).resolveMainRepoRoot($),defaultVendor:async($)=>{let{getGlobalDefaultVendor:Z,getRepoLastActiveVendor:J}=await Promise.resolve().then(() => (AZ(),du));return($?J($):void 0)??Z()},readWorktreeChanges:async($)=>(await Promise.resolve().then(() => (OH(),su))).readWorktreeChanges($),readBranchSignals:async($)=>(await Promise.resolve().then(() => (Jc(),Zc))).readBranchSignals($),tearDownSession:async($)=>{let Z=await XH();if(Z)try{await zT(Z.rpc,$T(await QH(Z.rpc),$))}catch{}finally{Z.close()}}}});var nj;var Xc=l(()=>{nj={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/rove",version:"0.8.184",description:"Rove \u2014 the agent multiplexer for your terminal. Run coding agents on parallel tasks with isolated worktrees and persistent sessions.",type:"module",packageManager:"bun@1.3.13",bin:{kobe:"dist/cli/kobe.js",rove:"dist/cli/rove.js"},files:["dist/cli","dist/web-ui","dist/skills","dist/*.wav","README.md","LICENSE"],publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sma1lboy/rove.git"},homepage:"https://github.com/Sma1lboy/rove#readme",bugs:{url:"https://github.com/Sma1lboy/rove/issues"},engines:{bun:">=1.3.11"},scripts:{dev:"ROVE_DEV=1 bun --conditions=browser ./src/cli/rove.ts","dev:kobe":"KOBE_DEV=1 bun --conditions=browser ./src/cli/kobe.ts","dev:mock":"KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react":"KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react-task-dialogs":"KOBE_DEV=1 bun ./src/tui-react/component/mock-dialogs-host.tsx","dev:mock-react-filetree":"KOBE_DEV=1 bun ./src/tui-react/panes/filetree/mock-host.tsx","dev:mock-react-sidebar":"KOBE_DEV=1 bun ./src/tui-react/panes/sidebar/mock-host.tsx","dev:mock-react-terminal":"KOBE_DEV=1 bun ./src/tui-react/panes/terminal/mock-host.tsx","dev:mock-react-dialogs":"KOBE_DEV=1 bun ./src/tui-react/mock/dialogs-host.tsx","dev:mock-react-workspace":"KOBE_DEV=1 bun ./src/tui-react/workspace/mock-host.tsx","dev:sandbox":"bun run scripts/dev-sandbox.ts run","dev:sandbox:reset":"bun run scripts/dev-sandbox.ts reset",build:"bun run scripts/build.ts","build:with-web":"bun run build",compile:"bun run scripts/compile.ts",typecheck:"tsc --noEmit","check-i18n":"bun run scripts/check-i18n.ts",test:"bun run test:fast && bun run test:socket","perf:golden":"bun scripts/perf-golden.ts","pty:soak":"bun scripts/pty-soak.ts","test:fast":"vitest run --passWithNoTests --minWorkers=1 --maxWorkers=8","test:socket":"KOBE_INCLUDE_SOCKET=1 vitest run test/daemon --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:socket:coverage":"KOBE_INCLUDE_SOCKET=1 KOBE_COVERAGE_DAEMON=1 vitest run test/daemon --coverage --pool forks --minWorkers=1 --maxWorkers=4 --passWithNoTests","test:behavior":"KOBE_INCLUDE_BEHAVIOR=1 vitest run test/behavior --pool forks --minWorkers=1 --maxWorkers=1 --retry=2 --passWithNoTests","test:render":"bun test test/render --coverage --coverage-reporter=text --coverage-reporter=lcov --coverage-dir=coverage-render",coverage:"vitest run --coverage --passWithNoTests",bench:"vitest bench --run",lint:"biome check .",knip:"knip-bun",postinstall:"bun run scripts/check-preview-deps.ts || true",prepublishOnly:"bun run typecheck && bun run build"},"//":"biome.json + bunfig.toml live at the monorepo root since they apply repo-wide; bun.lock also lives at root (workspace-shared).",dependencies:{"@ansi-tools/parser":"^1.0.15","@opentui/core":"0.4.3","@opentui/react":"0.4.3","@xterm/addon-serialize":"^0.14.0","@xterm/addon-unicode11":"^0.9.0","@xterm/headless":"^6.0.0","node-pty":"^1.1.0",react:"^19.2.8",ws:"^8.18.0"},devDependencies:{"@biomejs/biome":"1.9.4","@sma1lboy/kobe-daemon":"0.7.14","@tsconfig/bun":"1.0.10","@types/bun":"1.3.14","@types/node":"25.6.2","@types/react":"^19.2.0","@vitest/coverage-v8":"2.1.9",knip:"^6.14.2","kobe-web":"workspace:*","react-devtools-core":"^7.0.1",typescript:"5.8.2",vitest:"2.1.9"},trustedDependencies:[]}});var zc={};A$(zc,{repoSlug:()=>aY,releasePageUrl:()=>kT,recommendedGlobalInstallCommand:()=>bT,isNewerSemver:()=>fT,fetchReleaseSummaries:()=>OF,fetchReleaseNotesRange:()=>vT,fetchReleaseNotes:()=>gT,compareSemver:()=>A3,checkLatestVersion:()=>rY,breakingVersionsCrossed:()=>LF,UPDATE_SCRIPT_URL:()=>ij,UPDATE_COMMAND:()=>PZ,PACKAGE_NAME:()=>yT,CURRENT_VERSION:()=>D$,BREAKING_VERSIONS:()=>pJ});function aY(){let $=nj.repository?.url;if(!$)return null;let Z=$.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!Z||!Z[1]||!Z[2])return null;return`${Z[1]}/${Z[2]}`}function bT(){return`npm install -g ${yT}@latest`}function LF($,Z,J=pJ){let[X,z]=A3($,Z)<=0?[$,Z]:[Z,$];return J.filter((G)=>A3(G,X)>0&&A3(G,z)<=0)}async function KW0($){let Z=new AbortController,J=setTimeout(()=>Z.abort(),oj);try{let X=$.replace("/","%2F"),z=await fetch(`https://registry.npmjs.org/${X}/latest`,{signal:Z.signal,headers:{accept:"application/json"}});if(!z.ok)return null;let G=await z.json();if(typeof G.version!=="string")return null;return G.version}catch{return null}finally{clearTimeout(J)}}function fT($,Z){return A3($,Z)>0}function A3($,Z){let J=(G)=>G.split("-")[0]??G,X=J($).split(".").map((G)=>Number.parseInt(G,10)),z=J(Z).split(".").map((G)=>Number.parseInt(G,10));for(let G=0;G<3;G++){let W=X[G]??0,q=z[G]??0;if(Number.isNaN(W)||Number.isNaN(q))return 0;if(W>q)return 1;if(W<q)return-1}return 0}async function rY($={}){let Z=process.env.KOBE_FAKE_UPDATE;if(Z)return{current:D$,latest:Z,hasUpdate:fT(Z,D$)};if(fq()&&!$.force)return null;let J=await KW0(yT);if(!J)return null;return{current:D$,latest:J,hasUpdate:fT(J,D$)}}function Qc($){if(typeof $!=="string")return null;return $.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}async function gT($){let Z=aY();if(!Z)return null;let J=`v${$}`,X=new AbortController,z=setTimeout(()=>X.abort(),oj);try{let G=await fetch(`https://api.github.com/repos/${Z}/releases/tags/${J}`,{signal:X.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!G.ok)return null;let W=await G.json();if(typeof W.body!=="string"||typeof W.html_url!=="string")return null;return{body:W.body,url:W.html_url,version:$}}catch{return null}finally{clearTimeout(z)}}async function vT($){let Z=aY();if(!Z)return[];let J=$.limit??100,X=new AbortController,z=setTimeout(()=>X.abort(),oj);try{let G=await fetch(`https://api.github.com/repos/${Z}/releases?per_page=${J}`,{signal:X.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!G.ok)return[];let W=await G.json();if(!Array.isArray(W))return[];return W.map((q)=>{let U=Qc(q.tag_name);if(!U||typeof q.html_url!=="string"||typeof q.body!=="string")return null;if(A3(U,$.current)<=0)return null;if(A3(U,$.latest)>0)return null;return{version:U,url:q.html_url,body:q.body}}).filter((q)=>q!==null)}catch{return[]}finally{clearTimeout(z)}}async function OF($=12){let Z=aY();if(!Z)return[];let J=new AbortController,X=setTimeout(()=>J.abort(),oj);try{let z=await fetch(`https://api.github.com/repos/${Z}/releases?per_page=${$}`,{signal:J.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!z.ok)return[];let G=await z.json();if(!Array.isArray(G))return[];return G.map((W)=>{let q=Qc(W.tag_name);if(!q||typeof W.html_url!=="string")return null;return{version:q,url:W.html_url}}).filter((W)=>W!==null)}catch{return[]}finally{clearTimeout(X)}}function kT($){let Z=aY();if(!Z)return null;return`https://github.com/${Z}/releases/tag/v${$}`}var D$,yT,ij="https://raw.githubusercontent.com/Sma1lboy/rove/main/scripts/update.sh",PZ,pJ,oj=3000;var l8=l(()=>{Xc();j5();D$=nj.version,yT=nj.name;PZ=`curl -fsSL ${ij} | sh`;pJ=[]});function i4($){if(!$.client)throw new K1("daemon required","BAD_DAEMON");return $.client}async function Z4($,Z,J){return i4($).request(Z,J)}async function Yc(){let[{KobeDaemonClient:$},{defaultPtyHostSocketPath:Z}]=await Promise.all([Promise.resolve().then(() => (W9(),aR)),Promise.resolve().then(() => (R2(),pR))]),J=new $(Z());try{return await J.connect(),await J.request("pty.list",{})}catch{return{sessions:[]}}finally{J.close()}}var B7=l(()=>{$8()});async function FW0($){let Z=$.args.require("command"),J=pQ(Z);return await Z4($,"task.setCommand",{taskId:$.args.require("task-id"),command:Z,vendor:J}),{ok:!0,command:Z,protocol:J,...J===cY?{generic:!0}:{}}}var Gc,Wc;var mT=l(()=>{H9();f7();B7();Gc={name:"engine-list",summary:"List every engine Rove can launch \u2014 built-ins and your registered presets \u2014 each with its RAW launch command, exactly as it runs. Copy one into `add --command` / `send --tab new --command` verbatim, or edit its flags first. `protocol` is the adapter Rove speaks to it (history, trust, delivery); `generic` = none, which still runs fine but loses transcript reads. Returns { engines }.",flags:[],offline:!0,handler:async()=>({engines:om()})};Wc={name:"set-command",summary:"Set a task's engine launch command (takes effect on the next session rebuild). The protocol Rove speaks to it is derived from the command \u2014 the result reports which one, `generic` when the command names no engine Rove knows.",flags:[$$.taskId(),{...$$.command(),required:!0}],handler:FW0}});function Bc($){let Z=$.args.str("precheck");if(Z===void 0)return{};if(Z.length===0)return{precheck:null};return{precheck:{command:Z,timeoutSeconds:$.args.int("precheck-timeout")??120}}}var qc,Hc,Uc,Kc;var Fc=l(()=>{f7();B7();qc={name:"schedule",type:"string",placeholder:"CRON",description:"Five-field cron in the daemon host's local time, e.g. '0 9 * * MON-FRI'."},Hc=[{name:"precheck",type:"string",placeholder:"CMD",description:"Shell command run in the repo BEFORE the engine starts. Non-zero exit skips the run without spawning an agent \u2014 the cheap way to avoid burning a turn when nothing changed."},{name:"precheck-timeout",type:"int",placeholder:"SEC",description:"Seconds before the precheck is killed and the run skipped (default 120)."}],Uc={name:"grace",type:"int",placeholder:"MIN",description:"How late a missed occurrence may still run when the daemon was down (default 60). Only the most recent missed occurrence is ever run."};Kc=[{name:"routine-list",summary:"List scheduled routines with their next run time.",flags:[],handler:($)=>Z4($,"automation.list",{})},{name:"routine-create",summary:"Schedule a prompt. Each firing creates a fresh task (worktree + engine) and delivers it. An enabled routine keeps the daemon alive so it fires with no TUI attached.",flags:[$$.repo(),{name:"name",type:"string",required:!0,placeholder:"N",description:"Routine name."},$$.prompt(!0,"Text delivered as the new session's first message."),{...qc,required:!0},$$.vendor(),{name:"base-branch",type:"string",placeholder:"B",description:"Base ref each run's worktree branches from."},...Hc,Uc,{name:"disabled",type:"bool",description:"Create it paused instead of active."}],handler:($)=>Z4($,"automation.create",{repo:$.args.requirePath("repo"),name:$.args.require("name"),prompt:$.args.require("prompt"),schedule:$.args.require("schedule"),...$.args.vendor()?{vendor:$.args.vendor()}:{},...$.args.str("base-branch")?{baseRef:$.args.str("base-branch")}:{},...Bc($),...$.args.int("grace")!==void 0?{missedRunGraceMinutes:$.args.int("grace")}:{},...$.args.bool("disabled")?{enabled:!1}:{}})},{name:"routine-update",summary:"Change a routine. A new --schedule re-anchors its next run; --precheck '' clears the precheck.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."},{name:"name",type:"string",placeholder:"N",description:"New name."},$$.prompt(!1,"New prompt."),qc,$$.vendor(),{name:"base-branch",type:"string",placeholder:"B",description:"New base ref ('' to clear)."},...Hc,Uc],handler:($)=>Z4($,"automation.update",{id:$.args.require("id"),...$.args.str("name")!==void 0?{name:$.args.str("name")}:{},...$.args.str("prompt")!==void 0?{prompt:$.args.str("prompt")}:{},...$.args.str("schedule")!==void 0?{schedule:$.args.str("schedule")}:{},...$.args.vendor()?{vendor:$.args.vendor()}:{},...$.args.str("base-branch")!==void 0?{baseRef:$.args.str("base-branch")}:{},...Bc($),...$.args.int("grace")!==void 0?{missedRunGraceMinutes:$.args.int("grace")}:{}})},{name:"routine-set-enabled",summary:"Pause or resume a routine. Disabling the last active one releases the daemon's keep-alive hold.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."},{name:"enabled",type:"bool",required:!0,description:"true to resume, false to pause."}],handler:($)=>Z4($,"automation.update",{id:$.args.require("id"),enabled:$.args.bool("enabled")})},{name:"routine-delete",summary:"Delete a routine and its run history. Tasks it already created are untouched.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."}],handler:($)=>Z4($,"automation.delete",{id:$.args.require("id")})},{name:"routine-run-now",summary:"Run a routine immediately, skipping its precheck (asking for it IS the answer). Does not shift its schedule.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."}],handler:($)=>Z4($,"automation.runNow",{id:$.args.require("id")})},{name:"routine-runs",summary:"Run history, newest first. Statuses: dispatched, skipped_precheck (nothing to do), skipped_missed, skipped_unavailable, dispatch_failed.",flags:[{name:"id",type:"string",required:!0,placeholder:"ID",description:"Routine id."}],handler:($)=>Z4($,"automation.runs",{id:$.args.require("id")})}]});async function Mc($,Z){let J=$.args.str("command");if(J)return{command:J,vendor:pQ(J)};let X=await $.runtime.defaultVendor(Z);return X?{command:X,vendor:X}:{}}function Nc($){return{...$.command?{command:$.command}:{},...$.vendor?{vendor:$.vendor}:{}}}async function Lc($){let{args:Z,runtime:J}=$,X=await J.resolveRepoRoot(Z.requirePath("repo")),z=Z.int("count"),G=Z.str("agents");if(z!==void 0||G)return NW0($,X,z,G);return MW0($,X)}async function MW0($,Z){let J=i4($),{args:X}=$,z=await Mc($,Z),G={repo:Z,...await GT(),...Nc(z)},W=X.str("title");if(W)G.title=W;let q=X.str("branch");if(q)G.branch=q;let U=X.str("base-branch");if(U)G.baseRef=U;let B=await J.request("task.create",G),M=B.taskId;if(X.bool("activate"))await J.request("task.setActive",{taskId:M});let L=X.enumOf("status");if(L)await J.request("task.status",{taskId:M,status:L});let N=X.bool("pin");if(N!==void 0)await J.request("task.pin",{taskId:M,pinned:N});let j=B.task;if(L||N!==void 0)j=(await J.request("task.get",{taskId:M})).task;let D=X.str("prompt");if(!D)return{taskId:M,task:j,started:!1};let C=await $.runtime.deliverPrompt(J,{id:M,worktreePath:j.worktreePath,kind:j.kind,vendor:j.vendor,command:j.command,modelEffort:j.modelEffort,repo:j.repo,newTask:!0},D);if(j=(await J.request("task.get",{taskId:M})).task,!C.delivered)throw new K1(`task ${M} created but the prompt was not delivered (paste did not land)`,"NOT_DELIVERED",{taskId:M});return{taskId:M,task:j,started:C.started,engineReady:C.engineReady,session:C.session,delivered:C.delivered}}async function NW0($,Z,J,X){let z=i4($),{args:G}=$,W=G.str("prompt");if(!W)throw new K1("--count/--agents spawn parallel attempts of ONE prompt \u2014 pass --prompt","MISSING_FLAG",O3("add"));if(G.str("branch"))throw new K1("--branch names ONE branch and cannot be shared by parallel siblings \u2014 drop it (each sibling gets its own auto branch) or spawn them one at a time","BAD_FLAG",O3("add"));if(X){let I=J!==void 0?"--count":G.str("command")?"--command":null;if(I)throw new K1(`${I} conflicts with --agents, which already names each sibling's engine and how many \u2014 pass one or the other`,"BAD_FLAG",O3("add"))}let q=G.str("title"),U=G.str("base-branch"),B=await Mc($,Z),M=X?Nj(X):Lj(J??1,B.vendor??"claude");if(M.length>jZ)throw new K1(`a parallel round of ${M.length} exceeds the cap of ${jZ} \u2014 spawn in batches`,"BAD_FLAG");let L=BO(),N=[],j=null,D=await GT();for(let[I,R]of M.entries()){let w=X?{command:R,vendor:R}:{...B,vendor:R},f={repo:Z,groupId:L,...D,...Nc(w)};if(q)f.title=M.length>1?`${q} #${I+1}/${M.length}`:q;if(U)f.baseRef=U;try{let y=await z.request("task.create",f);N.push({taskId:y.taskId,vendor:R,task:y.task})}catch(y){let k=y instanceof K1?y.code:"CREATE_FAILED",u=y instanceof Error?y.message:String(y);j={vendor:R,error:{message:u,code:k}};break}}let C=await Promise.allSettled(N.map(({taskId:I,vendor:R,task:w})=>$.runtime.deliverPrompt(z,{id:I,worktreePath:w.worktreePath,kind:w.kind,vendor:R,command:w.command,modelEffort:w.modelEffort,repo:w.repo,newTask:!0},W))),_=[],g=[];if(C.forEach((I,R)=>{let{taskId:w,vendor:f}=N[R];if(I.status==="fulfilled"&&I.value.delivered){_.push({ok:!0,taskId:w,vendor:f,started:I.value.started,engineReady:I.value.engineReady,session:I.value.session});return}let y=I.status==="rejected"?I.reason:new K1(`prompt was not confirmed in ${w}'s engine`,"NOT_DELIVERED"),k=y instanceof K1?y.code:"DELIVER_FAILED",u=y instanceof Error?y.message:String(y);g.push({ok:!1,taskId:w,vendor:f,error:{message:u,code:k}})}),j)g.push({ok:!1,vendor:j.vendor,error:j.error});let E={count:N.length,requested:M.length,groupId:L,tasks:_,failures:g};if(g.length>0)throw new K1(`add delivered ${_.length}/${M.length}`,"PARTIAL_FANOUT",E);return E}var Oc=l(()=>{H9();yP();YF();f7();B7();$8()});var aj;var hT=l(()=>{aj=["backlog","in_progress","in_review","done","canceled","error"]});var jc;var Vc=l(()=>{f7();Oc();hT();jc=[{name:"add",summary:`Create a task (shows in the sidebar immediately). With --prompt it also starts the engine and delivers it. PARALLEL ATTEMPTS: --count N spawns N sibling tasks of the SAME prompt, each in its own worktree/branch (--agents claude:2,codex:1 for a mixed fleet); capped at ${jZ}, prefer 3-4. Does NOT steal focus \u2014 pass --activate to make it the active task. Alias: spawn-task.`,flags:[$$.repo(),$$.title(),{name:"branch",type:"string",placeholder:"B",description:"Explicit branch name (else derived from the title in the repo's own style). Single task only."},{name:"base-branch",type:"string",placeholder:"B",description:"Base ref the worktree branches from."},$$.command(),{name:"count",type:"int",placeholder:"N",description:`Spawn N sibling tasks of one prompt (parallel attempts, cap ${jZ}). Requires --prompt.`},{name:"agents",type:"string",placeholder:"claude:2,codex:1",description:"Per-ENGINE counts for a mixed parallel round (alternative to --count). Engine ids only \u2014 see `engine-list`."},{name:"status",type:"enum",values:aj,default:"backlog",description:"Initial lifecycle status."},{name:"pin",type:"bool",description:"Pin the task to the top of the sidebar."},{name:"activate",type:"bool",default:"false",description:"Make this the active task (pulls every mounted TUI's Tasks-pane focus). Off by default."},$$.prompt(!1,"Optional first message \u2014 when set, materializes the worktree, starts the engine, and pastes it. Required with --count/--agents.")],handler:Lc}]});var _c,Cc;var Ac=l(()=>{hJ();f7();B7();NF();$8();_c={name:"pane-open",summary:"Open a terminal pane in a task's workspace: split the focused tab (default, or --tab's tab) or open a separate command tab, optionally running a command. Broadcast over the daemon's tab.open channel \u2014 an attached TUI showing the task performs the split. Task defaults to $ROVE_TASK_ID, then the active task.",flags:[$$.taskId(!1),{name:"tab",type:"string",placeholder:"TAB",description:"Host tab for the split (e.g. tab-3) instead of the focused tab (split placement only)."},{name:"command",type:"string",placeholder:"CMD",description:"Shell command the pane runs (via the login shell's `-ilc`, so pipes/args and your shell rc's PATH/exports work); the pane closes when it exits. Omit for an interactive shell."},{name:"direction",type:"enum",values:["right","down"],default:"right",description:"Split orientation relative to the active pane (split placement only)."},{name:"placement",type:"enum",values:["split","tab"],default:"split",description:"`split` joins the focused tab's split group; `tab` opens a separate command tab."},{name:"title",type:"string",placeholder:"TEXT",description:`Pane label (default: the command's first word, else "shell").`}],handler:async($)=>{let Z=i4($),J=$.args.str("task-id")??process.env.KOBE_TASK_ID??await uJ(Z);if(!J)throw new K1("no target task: pass --task-id (no $ROVE_TASK_ID, no active task)","TASK_NOT_FOUND");let X=$.args.str("command"),z=y7({fallback:"/bin/sh"}),G=X?[z,"-ilc",X]:[z,"-il"],W=$.args.str("title")??(X?X.trim().split(/\s+/)[0]??"shell":"shell"),q=$.args.str("tab");return Z4($,"tab.open",{taskId:J,argv:G,title:W,...q!==void 0?{tabId:q}:{},placement:$.args.str("placement")??"split",direction:$.args.str("direction")??"right"})}},Cc={name:"pane-close",summary:"Close panes opened by pane-open: every split pane / command tab in the task whose label matches --title. Broadcast over the daemon's tab.close channel \u2014 an attached TUI showing the task performs the close (headless no-op). Task defaults to $ROVE_TASK_ID, then the active task.",flags:[$$.taskId(!1),{name:"title",type:"string",required:!0,placeholder:"TEXT",description:"Pane label to close \u2014 the --title the pane was opened with (engine panes are never closed)."},{name:"tab",type:"string",placeholder:"TAB",description:"Scope the title match to one tab (e.g. tab-3) instead of every tab of the task."}],handler:async($)=>{let Z=i4($),J=$.args.str("task-id")??process.env.KOBE_TASK_ID??await uJ(Z);if(!J)throw new K1("no target task: pass --task-id (no $ROVE_TASK_ID, no active task)","TASK_NOT_FOUND");let X=$.args.str("tab");return Z4($,"tab.close",{taskId:J,title:$.args.str("title"),...X!==void 0?{tabId:X}:{}})}}});var uT,jF,cT,lT="DIRTY_WORKTREE",dT,pT,LW0="TASK_DELETING",oQ,OW0="MAIN_CHECKOUT_DIRTY",nT,jW0="EMPTY_BRANCH",iT,rj="EMPTY_BRANCH_DIRTY_WORKTREE",oT,VW0="LAND_CONFLICT",sj;var nJ=l(()=>{uT=class uT extends Error{from;to;taskId;constructor($,Z,J){super(`illegal transition for task ${J}: ${$} -> ${Z}`);this.from=$;this.to=Z;this.taskId=J;this.name="IllegalTransitionError"}};jF=class jF extends Error{constructor($){super(`task not found: ${$}`);this.name="TaskNotFoundError"}};cT=class cT extends Error{constructor(){super("cannot delete a main task; remove the repo from saved repos instead");this.name="CannotDeleteMainTaskError"}};dT=class dT extends Error{taskId;constructor($){super(`${lT}: task ${$} worktree has uncommitted or untracked changes`);this.taskId=$;this.name="DirtyWorktreeError"}};pT=class pT extends Error{taskId;cause;constructor($,Z){super(`failed to remove worktree for task ${$}: ${M1(Z)}`);this.taskId=$;this.cause=Z;this.name="WorktreeRemoveFailedError"}};oQ=class oQ extends Error{taskId;constructor($){super(`${LW0}: task ${$} is being deleted`);this.taskId=$;this.name="TaskDeletingError"}};nT=class nT extends Error{repo;dir;constructor($,Z){super(`${OW0}: base checkout at ${Z} has uncommitted changes; commit or stash them before landing`);this.repo=$;this.dir=Z;this.name="MainCheckoutDirtyError"}};iT=class iT extends Error{branch;landedOn;constructor($,Z){super(`${jW0}: '${$}' has no commits ahead of '${Z}' \u2014 landing it would be a no-op (the worker may not have delivered anything)`);this.branch=$;this.landedOn=Z;this.name="EmptyBranchError"}};oT=class oT extends Error{branch;landedOn;worktreePath;files;constructor($,Z,J,X){let z=X.length>0?X.join(", "):"(none reported)";super(`${rj}: '${$}' has no commits ahead of '${Z}' but its worktree ${J} has uncommitted changes (${z}) \u2014 commit them in the worktree first, then land again`);this.branch=$;this.landedOn=Z;this.worktreePath=J;this.files=X;this.name="EmptyBranchDirtyWorktreeError"}};sj=class sj extends Error{taskId;branch;files;constructor($,Z,J){let X=J.length>0?J.join(", "):"(none reported)";super(`${VW0}: merging '${Z}' hit conflicts, merge aborted \u2014 conflicted files: ${X}`);this.taskId=$;this.branch=Z;this.files=J;this.name="LandConflictError"}}});async function _W0($,Z,J){let X=await zH(),z=X?.taskId;if(!z||z===Z)return J;let G=z;try{let U=await $.request("task.get",{taskId:z});G=U.task.title||U.task.branch||z}catch{}let W=_3(),q=`--task-id ${z} --tab ${X.tabId}`;return`[ROVE PEER] from "${G}" (task ${z} \u2014 load the Rove agent skill FIRST (registered as /rove; legacy /kobe installs still work), then reply: \`${W} send ${q} --prompt "<text>"\`; verb reference: \`${W} schema\`): ${J}`}async function Dc($){let Z=$.args.str("title"),J=$.args.str("body"),X=$.args.str("task");if(Z===void 0&&J===void 0&&X===void 0)throw new K1("issue-update requires --title, --body, and/or --task","MISSING_FLAG");let z=$.args.requirePath("repo"),G=$.args.int("id"),W;if(Z!==void 0||J!==void 0)W=await Z4($,"issue.mutate",{repoRoot:z,op:{type:"update",id:G,title:Z,body:J}});if(X!==void 0)W=await Z4($,"issue.mutate",{repoRoot:z,op:X==="none"?{type:"unlink",id:G}:{type:"link",id:G,taskId:X}});return W}async function Pc($){let Z=i4($),J=$.args.require("prompt"),X=$.args.str("tab");if(X&&X!=="new"&&!/^tab-[A-Za-z0-9-]+$/.test(X))throw new K1(`--tab must be "new" or a tab id like tab-2 (got ${JSON.stringify(X)})`,"BAD_TAB");let z=$.args.str("command");if(z&&X!=="new")throw new K1(`--command only applies to a new tab; pass --tab new (got --tab ${X??"<canonical>"})`,"BAD_FLAG",O3("send"));let G=z?pQ(z):void 0,W=$.args.str("task-id");if(!W){let M=await um(Z);if(M){if(W=M.taskId,X===void 0)X=await cm($.runtime,M)}else{let L=await uJ(Z);if(!L)throw new K1("no --task-id given and no active task \u2014 open a task first or pass --task-id","MISSING_TARGET");W=L}}let q=await Z.request("task.get",{taskId:W}),U=$.args.bool("plain")?J:await _W0(Z,W,J),B=await $.runtime.deliverPrompt(Z,{id:W,worktreePath:q.task.worktreePath,kind:q.task.kind,vendor:q.task.vendor,command:q.task.command,modelEffort:z?void 0:q.task.modelEffort,repo:q.task.repo,tab:X,tabVendor:G,tabCommand:z},U);if(!B.delivered)throw new K1(`prompt was not confirmed in ${W}'s engine (paste did not land)`,"NOT_DELIVERED");return{ok:!0,taskId:W,session:B.session,started:B.started,engineReady:B.engineReady}}async function CW0($){let Z=i4($),J=$.args.require("task-id"),X=$.args.require("prompt"),z=$.args.str("tab"),G=await Z.request("session.deliver",{taskId:J,text:X,...z!==void 0?{tabId:z}:{},source:"dispatcher"});return{ok:!0,taskId:J,...z!==void 0?{tabId:z}:{},routed:"session.deliver",...G?.clients!==void 0?{clients:G.clients}:{}}}async function Tc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.require("text");return await Z.request("note.file",{taskId:J,text:X})}async function Sc($){let Z=i4($),J=$.args.require("task-id"),X=await Z.request("task.get",{taskId:J}),{tabs:z,running:G}=await $.runtime.taskTabs(J);return{task:X.task,running:G,tabs:z}}async function Ic($){return i4($).request("task.list")}async function Ec($){let Z=i4($),X=$.args.bool("none")?null:$.args.require("task-id");return await Z.request("task.setActive",{taskId:X}),{ok:!0,activeTaskId:X}}async function wc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.bool("archived")??!0,z=await Z.request("task.archive",{taskId:J,archived:X});if(X)await $.runtime.tearDownSession(J);return z}async function xc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.bool("force")??!1,z=$.args.bool("delete-branch")??!1,G=await Z.request("task.delete",{taskId:J,force:X,deleteBranch:z});return await $.runtime.tearDownSession(J),G}async function fc($){let Z=i4($),J=$.args.require("task-id"),X=$.args.str("strategy")==="squash"?"squash":"merge",z=$.args.bool("remove-worktree")??!1,G;try{G=await Z.request("task.land",{taskId:J,strategy:X,deleteBranch:$.args.bool("delete-branch")??!1,archive:$.args.bool("then-archive")??!1,removeWorktree:z,...z?{callerCwd:process.cwd()}:{}})}catch(W){throw AW0(W,J)}return{ok:!0,taskId:J,...G.result}}function AW0($,Z){let J=M1($);if(!J.includes(rj))return $;let X=/EMPTY_BRANCH_DIRTY_WORKTREE: '([^']+)'/.exec(J)?.[1]??"your task branch";return new K1(J,rj,{hint:"the worker wrote files but never committed them \u2014 send it back to commit its own work, then land again",nextCommandArgs:["api","send","--task-id",Z,"--prompt",`your work is uncommitted on ${X} \u2014 commit it yourself with a proper message, then report back`]})}async function yc($){let Z=i4($),{args:J}=$,X={repo:J.requirePath("repo"),worktreePath:J.requirePath("worktree")},z=J.str("branch");if(z)X.branch=z;let G=J.str("command");if(G)X.command=G,X.vendor=pQ(G);let W=J.str("title");if(W)X.title=W;return Z.request("worktree.adopt",X)}var Rc;var jH=l(()=>{H9();J2();nJ();YF();f7();B7();NF();$8();Rc={name:"dispatch",summary:"Route text into a task's live session via the daemon's session.deliver channel. The dispatcher's messenger (docs/design/dispatcher.md); unlike `send`, it requires an already-hosted session.",flags:[$$.taskId(!0),$$.prompt(!0,"Text delivered into the task's engine session."),{name:"tab",type:"string",required:!1,placeholder:"TAB",description:"Deliver into exactly this tab (e.g. tab-3) instead of the canonical engine tab."}],handler:CW0}});var bc;var gc=l(()=>{f7();B7();Ac();jH();bc=[{name:"send",summary:"Paste a follow-up prompt into a task's running engine (one full turn). Without --task-id, a task spawned from another Rove session replies to its dispatcher's tab (then that task's live canonical engine; nothing alive = DISPATCHER_UNREACHABLE, never a silent spawn); otherwise the active task. Sent from inside another Rove task ($ROVE_TASK_ID), the prompt is prefixed with [ROVE PEER] provenance \u2014 who sent it and how to reply (tab-precise) \u2014 so agent-to-agent messaging needs no coordinator.",flags:[$$.taskId(!1),$$.prompt(!0,"Text pasted + submitted into the engine pane."),{name:"tab",type:"string",required:!1,placeholder:"TAB",description:'Tab addressing: "new" spawns the prompt in a fresh engine tab; "tab-N" delivers to that exact alive tab (error when dead/absent). Omitted = the canonical engine tab.'},{...$$.command(),description:"Engine launch command for a `--tab new` tab \u2014 the API twin of the TUI's ctrl+e pick. Lets one worktree run two agents on the same files (e.g. hand the stuck work to codex without leaving the branch). An engine id from `engine-list` or a full command line; pinned to that tab, so it survives restarts and a later set-command on the task. Only valid with --tab new."},{name:"plain",type:"bool",required:!1,description:"Deliver the prompt verbatim \u2014 skip the [ROVE PEER] provenance prefix."}],handler:Pc},Rc,{name:"note",summary:"File a one-line field note \u2014 a resolved, repo-level gotcha worth sharing. Appended to the repo's durable note store (every future session on this repo starts with it) and forwarded to the dispatcher session for live relay (docs/design/dispatcher.md).",flags:[$$.taskId(!0),{name:"text",type:"string",required:!0,placeholder:"TEXT",description:"One line: the verified conclusion another session could act on."}],handler:Tc},{name:"note-list",summary:"Read a repo's accumulated field notes, newest first. Returns { notes }.",flags:[$$.repo(!0)],handler:($)=>Z4($,"note.list",{repo:$.args.requirePath("repo")})},_c,Cc,{name:"notify",summary:"Show a toast in every attached Rove UI \u2014 broadcast over the daemon's notice.event channel. Agents/scripts use it to surface 'done / needs input / error' moments without touching the task's session.",flags:[{name:"title",type:"string",required:!0,placeholder:"TEXT",description:"Toast text (one line)."},{name:"kind",type:"string",default:"done",placeholder:"KIND",description:`Free-form kind tag. "done", "needs_input" and "error" get the TUI's severity styling/unread mark; any other value renders neutrally.`},$$.taskId(!1),{name:"source",type:"string",placeholder:"TAG",description:"Free-form origin tag (e.g. an agent name) recorded on the event."}],handler:async($)=>{return Z4($,"notice.send",{title:$.args.str("title"),kind:$.args.str("kind")??"done",taskId:$.args.str("task-id"),source:$.args.str("source")})}},{name:"prompt",summary:"Ask the human for a line of text through the attached TUI's input dialog (plugins' host-provided prompt). Blocks until answered, cancelled, or timed out; returns { value } or { cancelled, reason }.",flags:[{name:"title",type:"string",required:!0,placeholder:"TEXT",description:"Dialog title (shown verbatim)."},{name:"placeholder",type:"string",placeholder:"TEXT",description:"Input placeholder."},{name:"initial",type:"string",placeholder:"TEXT",description:"Pre-filled input value."},{name:"timeout",type:"string",placeholder:"MS",description:"Give up after this many milliseconds (default 120000, max 600000)."}],handler:async($)=>{let Z=$.args.str("timeout"),J=Z?Number.parseInt(Z,10):void 0;return Z4($,"ui.prompt",{title:$.args.str("title"),placeholder:$.args.str("placeholder"),initial:$.args.str("initial"),...J&&Number.isFinite(J)?{timeoutMs:J}:{}})}},{name:"set-active",summary:"Set the shared active task (the focus every Tasks pane highlights). Pass --none to clear.",flags:[$$.taskId(!1),{name:"none",type:"bool",description:"Clear the active task instead of setting one."}],handler:Ec}]});var vc;var kc=l(()=>{f7();B7();mT();hT();vc=[{name:"rename",summary:"Set a task's title.",flags:[$$.taskId(),{name:"title",type:"string",required:!0,placeholder:"T",description:"New title."}],handler:($)=>Z4($,"task.rename",{taskId:$.args.require("task-id"),title:$.args.require("title")})},{name:"set-branch",summary:"Rename a task's branch (git branch -m if materialized, else recorded).",flags:[$$.taskId(),{name:"branch",type:"string",required:!0,placeholder:"B",description:"New branch name."}],handler:($)=>Z4($,"task.setBranch",{taskId:$.args.require("task-id"),branch:$.args.require("branch")})},Wc,{name:"set-status",summary:"Set a task's lifecycle status.",flags:[$$.taskId(),{name:"status",type:"enum",required:!0,values:aj,description:"New status."}],handler:($)=>Z4($,"task.status",{taskId:$.args.require("task-id"),status:$.args.requireEnum("status")})}]});import{spawnSync as DW0}from"child_process";function TW0($){let[Z,J]=$.split("/");if(!Z||!J)throw Error(`invalid GitHub repository slug: ${$}`);return{owner:Z,name:J}}function mc($,Z){let J=$.trim();if(!J)throw Error(`${Z} is required`);return J}function hc($,Z){let J=Z?.map((X)=>typeof X.message==="string"?X.message:null).filter((X)=>!!X);if(J&&J.length>0)return J.join("; ");return $.trim()||"GitHub CLI returned an empty response"}function uc($,Z,J){let X=["api","graphql","-f",`query=${$}`];for(let[U,B]of Object.entries(Z))X.push("-f",`${U}=${B}`);let z=J.spawn("gh",X,{encoding:"utf8"});if(z.error)throw Error(`failed to run gh: ${z.error.message}`);let G=typeof z.stdout==="string"?z.stdout:String(z.stdout??""),W=typeof z.stderr==="string"?z.stderr:String(z.stderr??""),q;try{q=JSON.parse(G)}catch{throw Error(`failed to parse gh response: ${hc(W,void 0)}`)}if((z.status??0)!==0||q.errors?.length)throw Error(hc(W,q.errors));if(!q.data)throw Error("GitHub CLI response did not include data");return q.data}function SW0($){return`${$}
83
83
 
84
84
  ---
85
85
  Submitted from Rove ${D$}.`}function VH($,Z={}){let J=mc($.title,"feedback title"),X=SW0(mc($.body,"feedback body")),z=(Z.repoSlug??aY)();if(!z)throw Error("package repository is not a GitHub repository");let{owner:G,name:W}=TW0(z),q=$.categorySlug?.trim()||aT,U={spawn:Z.spawn??DW0},M=uc(PW0,{owner:G,name:W},U).repository,L=M?.id;if(!L)throw Error(`GitHub repository not found: ${z}`);let N=M.discussionCategories?.nodes?.find((C)=>C.slug===q);if(!N)throw Error(`GitHub Discussion category not found: ${q}`);let D=uc(RW0,{repositoryId:L,categoryId:N.id,title:J,body:X},U).createDiscussion?.discussion;if(!D?.url||typeof D.number!=="number")throw Error("GitHub did not return the created Discussion");return{number:D.number,url:D.url}}var aT="feedback",PW0=`
@@ -910,7 +910,7 @@ ${G}`:G,X+=1}return J}function _f($){return`#${$.id} ${$.title}`}function M50($)
910
910
  `)}function L50($,Z="rove api"){return[...M50($),"You are working directly in the project checkout \u2014 no dedicated worktree or branch was created. Keep changes reviewable and do not switch branches unless asked.","Before finishing, verify the acceptance criteria implied by the story and summarize what changed plus any verification still needed.",`When the work lands, run: ${Z} issue-set-status --repo . --id ${$.id} --status done`].join(`
911
911
  `)}var RG;var aC=l(()=>{OU();RG=["worktree","projectWorktree","project"]});function _X($,Z=Date.now()){let J=Math.max(0,Math.floor((Z-$)/1000));if(J<60)return`${J}s`;let X=Math.floor(J/60);if(X<60)return`${X}m`;let z=Math.floor(X/60);if(z<24)return`${z}h`;return`${Math.floor(z/24)}d`}var TM=()=>{};function SM($){return typeof $==="string"?$:""}function hA0($){let Z=$.detail;if(!Z)return"";let{tool:J,compact:X,subagent:z}=Z,G=SM(J?.name)||SM(X?.trigger)||SM(z?.type)||SM(Z.note);return yZ(G,mA0)}function O50($,Z,J=Cf){return $.slice(-J).reverse().map((X,z)=>{let G=[hA0(X),SM(X.vendor)].filter((W)=>W.length>0);return{key:`${X.at}:${z}`,age:_X(X.at,Z),kind:X.kind,tail:G.join(" \xB7 ")}})}var Cf=12,mA0=40;var j50=l(()=>{TM()});import{TextAttributes as Af}from"@opentui/core";function Df($){let{theme:Z}=c0();return T.jsxDEV("box",{flexDirection:"row",gap:2,children:[T.jsxDEV("text",{fg:$.focused?Z.primary:Z.textMuted,attributes:$.focused?Af.BOLD|Af.UNDERLINE:Af.BOLD,wrapMode:"none",children:$.label},void 0,!1,void 0,this),$.hint?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:$.hint},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function V50($){let{theme:Z}=c0(),J=e0(),[X,z]=rC.useState(null);return rC.useEffect(()=>{let G=$.orchestrator;if(!G){z([]);return}let W=!0;return G.recentTaskEvents($.taskId).then((q)=>{if(W)z(O50(q.events,Date.now(),Cf))}).catch(()=>{if(W)z([])}),()=>{W=!1}},[$.orchestrator,$.taskId]),T.jsxDEV("box",{gap:0,children:[T.jsxDEV(Df,{label:J("kanban.detail.eventsLabel"),focused:!1},void 0,!1,void 0,this),X===null?T.jsxDEV("text",{fg:Z.textMuted,children:J("kanban.detail.eventsLoading")},void 0,!1,void 0,this):X.length===0?T.jsxDEV("text",{fg:Z.textMuted,children:J("kanban.detail.eventsNone")},void 0,!1,void 0,this):X.map((G)=>T.jsxDEV("box",{flexDirection:"row",gap:1,children:[T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:G.age.padStart(uA0)},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.text,wrapMode:"none",children:G.kind},void 0,!1,void 0,this),G.tail?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:["\xB7 ",G.tail]},void 0,!0,void 0,this):null]},G.key,!0,void 0,this))]},void 0,!0,void 0,this)}var rC,uA0=4;var _50=l(async()=>{Q$();j50();i0();await Z$();rC=Q1(H1(),1)});import{TextAttributes as TG}from"@opentui/core";function lA0($){let Z=n$(),{theme:J}=c0(),X=e0(),z=K2(),G=$.issue,W=$.mode==="create",q=!W&&G.taskId&&G.taskId!==""?G.taskId:null,U=W||!q&&G.status!=="done",[B,M]=CX.useState($.defaultVendor),[L,N]=CX.useState(RG[0]??"worktree"),[j,D]=CX.useState(!1),[C,_]=CX.useState(G.title),[g,E]=CX.useState(G.body),[I,R]=CX.useState(W?"title":U?"workspace":q?"open":"title"),w=CX.useRef(null),f=U?["title","description","engine","workspace","jump"]:q?["title","description","open"]:["title","description"];function y(c){if(c.length===0)return;let r=F50(w.current?.plainText??g,c);w.current?.setText(r),E(r)}KV((c)=>{let r=LU(new TextDecoder().decode(c.bytes));if(!r)return;c.preventDefault(),y(r)});function k(){iC().then((c)=>{if(c)y([c])})}function u(c){R((r)=>{let U0=Math.max(0,f.indexOf(r));return f[(U0+c+f.length)%f.length]??"title"})}function h(c){let r=$.engines;if(r.length===0)return;M((U0)=>{let $0=Math.max(0,r.indexOf(U0));return r[($0+c+r.length)%r.length]??U0})}function t(c){N((r)=>{let U0=RG.indexOf(r);return RG[(U0+c+RG.length)%RG.length]??r})}function s(){return{title:C.trim()||G.title,body:w.current?.plainText??g}}function Y0(){if(C.trim().length>0)return!0;return R("title"),!1}function B0(){if(W){if(!Y0())return;$.onSubmit({kind:"create",start:{vendor:B,placement:L,jump:j},...s()})}else if(U)$.onSubmit({kind:"start",vendor:B,placement:L,jump:j,...s()});else if(q)$.onSubmit({kind:"open",taskId:q,...s()});else return;Z.clear()}function K0(){if(!W||!Y0())return;$.onSubmit({kind:"create",start:null,...s()}),Z.clear()}function H0(){if(W)$.onCancel();else $.onSubmit({kind:"close",...s()});Z.clear()}g1(()=>({bindings:[{key:"escape",cmd:()=>H0()},{key:"tab",cmd:()=>u(1)},{key:"shift+tab",cmd:()=>u(-1)},{key:"ctrl+return",cmd:()=>B0()},...W?[{key:"ctrl+s",cmd:()=>K0()}]:[],{key:"ctrl+v",cmd:()=>k()},...I==="engine"?[{key:"left",cmd:()=>h(-1)},{key:"right",cmd:()=>h(1)},{key:"return",cmd:()=>B0()}]:[],...I==="workspace"?[{key:"up",cmd:()=>t(-1)},{key:"down",cmd:()=>t(1)},{key:"return",cmd:()=>B0()}]:[],...I==="jump"?[{key:"left",cmd:()=>D((c)=>!c)},{key:"right",cmd:()=>D((c)=>!c)},{key:"return",cmd:()=>B0()}]:[],...I==="open"?[{key:"return",cmd:()=>B0()}]:[]]}));let W0=G.status==="done"?J.success:G.status==="hold"?J.warning:G.status==="doing"?J.accent:J.textMuted,m=(c,r,U0)=>T.jsxDEV(Df,{label:c,hint:U0,focused:r!==null&&I===r},void 0,!1,void 0,this),n=(c)=>I===c?J.primary:J.borderSubtle;return T.jsxDEV("box",{paddingLeft:z,paddingRight:z,gap:1,children:[T.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[W?T.jsxDEV("text",{fg:J.text,attributes:TG.BOLD,wrapMode:"none",children:X("kanban.detail.newStory")},void 0,!1,void 0,this):T.jsxDEV("box",{flexDirection:"row",gap:2,children:[T.jsxDEV("text",{fg:J.textMuted,attributes:TG.BOLD,wrapMode:"none",children:["#",G.id]},void 0,!0,void 0,this),T.jsxDEV("text",{fg:W0,attributes:TG.BOLD,wrapMode:"none",children:X(`kanban.detail.status.${G.status}`)},void 0,!1,void 0,this),T.jsxDEV("text",{fg:J.textMuted,wrapMode:"none",children:X("kanban.detail.created",{date:G.created})},void 0,!1,void 0,this),q?T.jsxDEV("text",{fg:J.accent,wrapMode:"none",children:X("kanban.detail.linked")},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),T.jsxDEV("text",{fg:J.textMuted,wrapMode:"none",onMouseUp:()=>H0(),children:"esc"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{gap:0,children:[m(X("kanban.detail.titleLabel"),"title"),T.jsxDEV("box",{border:!0,borderColor:n("title"),backgroundColor:J.backgroundElement,paddingLeft:1,paddingRight:1,children:T.jsxDEV("input",{value:C,focused:I==="title",onMouseUp:()=>R("title"),onInput:(c)=>_(n5(c)),onSubmit:()=>R("description")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{gap:0,children:[m(X("kanban.detail.description"),"description",X("kanban.detail.attachHint")),T.jsxDEV("box",{border:!0,borderColor:n("description"),backgroundColor:J.backgroundElement,paddingLeft:1,paddingRight:1,children:T.jsxDEV("textarea",{ref:(c)=>{w.current=c},initialValue:G.body,placeholder:X("kanban.detail.noDescription"),focused:I==="description",height:cA0,wrapMode:"word",onMouseUp:()=>R("description"),onContentChange:()=>E(w.current?.plainText??"")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),U?T.jsxDEV("box",{gap:0,children:[T.jsxDEV("box",{gap:0,children:[m(X("kanban.detail.engine"),"engine","\u2190/\u2192"),T.jsxDEV("box",{flexDirection:"row",gap:1,children:$.engines.map((c)=>{let r=c===B;return T.jsxDEV("box",{border:!0,borderColor:r?J.primary:J.borderSubtle,paddingLeft:2,paddingRight:2,paddingBottom:1,onMouseUp:()=>{R("engine"),M(c)},children:T.jsxDEV("text",{fg:r?J.primary:J.textMuted,attributes:r?TG.BOLD:void 0,wrapMode:"none",children:$.engineLabel(c)},void 0,!1,void 0,this)},c,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{gap:0,paddingBottom:1,children:[m(X("kanban.detail.workspace"),"workspace","\u2191/\u2193"),T.jsxDEV("box",{border:!0,borderColor:n("workspace"),backgroundColor:J.backgroundElement,paddingLeft:1,paddingRight:1,children:RG.map((c)=>{let r=c===L;return T.jsxDEV("text",{fg:r?J.primary:J.textMuted,attributes:r?TG.BOLD:void 0,onMouseUp:()=>{R("workspace"),N(c)},children:[r?"\u25B8 ":" ",X(`kanban.detail.placement.${c}`)]},c,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{gap:0,paddingBottom:1,children:[m(X("kanban.detail.jumpLabel"),"jump","\u2190/\u2192"),T.jsxDEV("box",{flexDirection:"row",gap:1,children:[!1,!0].map((c)=>{let r=c===j;return T.jsxDEV("box",{border:!0,borderColor:r?J.primary:J.borderSubtle,paddingLeft:2,paddingRight:2,onMouseUp:()=>{R("jump"),D(c)},children:T.jsxDEV("text",{fg:r?J.primary:J.textMuted,attributes:r?TG.BOLD:void 0,wrapMode:"none",children:X(c?"kanban.detail.jump.follow":"kanban.detail.jump.stay")},void 0,!1,void 0,this)},String(c),!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{paddingBottom:1,children:T.jsxDEV("text",{fg:J.textMuted,children:W?X("kanban.detail.createLegend"):X("kanban.detail.startLegend")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q?T.jsxDEV("box",{gap:1,children:[T.jsxDEV("box",{gap:0,children:[m(X("kanban.detail.sessionLabel"),"open"),T.jsxDEV("box",{flexDirection:"row",children:T.jsxDEV("box",{border:!0,borderColor:I==="open"?J.primary:J.borderSubtle,paddingLeft:2,paddingRight:2,onMouseUp:()=>{R("open"),B0()},children:T.jsxDEV("text",{fg:I==="open"?J.primary:J.text,attributes:I==="open"?TG.BOLD:void 0,wrapMode:"none",children:X("kanban.detail.openAction")},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(V50,{taskId:q,orchestrator:$.orchestrator??null},void 0,!1,void 0,this),T.jsxDEV("box",{paddingBottom:1,children:T.jsxDEV("text",{fg:J.textMuted,children:X("kanban.detail.openLegend")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):T.jsxDEV("box",{paddingBottom:1,children:T.jsxDEV("text",{fg:J.textMuted,children:X("kanban.detail.doneNote")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function dA0($,Z){return g7($,(J)=>T.jsxDEV(lA0,{...Z,onSubmit:(X)=>J(X),onCancel:()=>J(void 0)},void 0,!1,void 0,this),{size:"large"})}var CX,cA0=8,Pf;var C50=l(async()=>{aC();n8();OU();Q$();i0();await X$([v4(),Z$(),O4(),V5(),_50()]);CX=Q1(H1(),1);Pf={show:dA0}});import{TextAttributes as pA0}from"@opentui/core";function A50($){let{theme:Z,transparentBackground:J}=c0(),X=e0(),{issue:z,column:G,selected:W}=$,q=J?Z.border:Z.borderSubtle,U=G==="done"?Z.textMuted:Z.text,B=z.body.trim(),M=$.activity?nA0[$.activity]:void 0,L=Lf($.activity),N={accent:Z.accent,warning:Z.warning,error:Z.error,success:Z.success};return T.jsxDEV("box",{border:!0,borderColor:W?Z.primary:L?Z.warning:q,backgroundColor:Z.backgroundElement,padding:1,onMouseUp:()=>W?$.onOpen():$.onSelect(),children:[T.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[T.jsxDEV("text",{fg:U,attributes:pA0.BOLD,wrapMode:"word",flexShrink:1,children:z.title},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:["#",z.id]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{height:2,overflow:"hidden",children:B?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:B},void 0,!1,void 0,this):null},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:z.created},void 0,!1,void 0,this),M?T.jsxDEV("text",{fg:N[M.tone],wrapMode:"none",children:X(M.labelKey)},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var nA0;var D50=l(async()=>{Of();Q$();i0();await Z$();nA0={running:{labelKey:"tasks.status.working",tone:"accent"},turn_complete:{labelKey:"kanban.turnComplete",tone:"success"},rate_limited:{labelKey:"tasks.activity.rateLimited",tone:"warning"},permission_needed:{labelKey:"tasks.activity.permissionNeeded",tone:"warning"},error:{labelKey:"tasks.activity.error",tone:"error"}}});import{TextAttributes as sC}from"@opentui/core";function P50($){let{theme:Z,transparentBackground:J}=c0(),X=J?Z.border:Z.borderSubtle,z=e0(),G=n$(),[W,q]=AX.useState(null),[U,B]=AX.useState([]);AX.useEffect(()=>{let m=!1;return FZ().then((n)=>{if(!m)B(n)}),()=>{m=!0}},[]);let[M,L]=AX.useState(0),[N,j]=AX.useState(null);AX.useEffect(()=>{let m=!1,n=$.orchestrator;if(!n){q([]);return}let c=[...new Set(n.listTasks().map((U0)=>U0.repo))];Promise.all(c.map((U0)=>n.listIssues(U0).catch(()=>null))).then((U0)=>{if(m)return;let $0=U0.filter((V0)=>V0!==null);$0.sort((V0,X1)=>V0.repoRoot.localeCompare(X1.repoRoot)),q($0);let a=(V0)=>V0.replace(/^\/private\//,"/").replace(/\/+$/,""),Z0=n.activeTaskSignal().get(),O0=$.focusTask?.repo??n.listTasks().find((V0)=>V0.id===Z0)?.repo,J0=O0?$0.find((V0)=>a(V0.repoRoot)===a(O0)):void 0;j((V0)=>V0??J0?.repoRoot??null);let P0=$.focusTask?.id,y0=P0?J0?.issues.find((V0)=>V0.taskId===P0):void 0;if(y0)w((V0)=>V0??y0.id)});let r=setInterval(()=>L((U0)=>U0+1),iA0);return()=>{m=!0,clearInterval(r)}},[$.orchestrator,M]);let D=W??[],C=Math.max(0,D.findIndex((m)=>m.repoRoot===N)),_=D[C],g=D.map((m)=>m.repoRoot),{columns:E,attentionCount:I}=Q50(_?z50(_.issues):[],(m)=>$.engineStates?.get(m)?.state),[R,w]=AX.useState(null);function f(m){if(D.length===0)return;let n=(C+m+D.length)%D.length;j(D[n]?.repoRoot??null),w(null)}function y(m){let n=X50(E,R,m);if(n!=null)w(n)}function k(m){if(E.some((n)=>n.issues.length>0))y(m);else f(m==="left"?-1:1)}function u(m){let n=_;if(!n)return;w(m.id),Pf.show(G,{issue:m,engines:U,defaultVendor:Vf(n.repoRoot,U),engineLabel:w5,orchestrator:$.orchestrator}).then(async(c)=>{if(!c)return;let r={title:c.title,body:c.body};if(r.title!==m.title||r.body!==m.body)await $.orchestrator?.mutateIssue(n.repoRoot,{type:"update",id:m.id,...r}).catch((U0)=>console.error("[rove kanban] issue update failed:",U0)),L((U0)=>U0+1);if(c.kind==="open"){$.onOpenTask(c.taskId);return}if(c.kind!=="start")return;$.onStartChat({repoRoot:n.repoRoot,issue:{...m,...r},vendor:c.vendor,placement:c.placement,jump:c.jump})})}function h(){let m=_?.issues.find((n)=>n.id===R);if(m)u(m)}function t(){let m=_;if(!m)return;let n={id:m.nextId,title:"",status:"open",created:new Date().toISOString().slice(0,10),body:""};Pf.show(G,{issue:n,mode:"create",engines:U,defaultVendor:Vf(m.repoRoot,U),engineLabel:w5}).then(async(c)=>{if(!c||c.kind!=="create")return;let r=$.orchestrator;if(!r)return;try{let U0=await r.mutateIssue(m.repoRoot,{type:"create",title:c.title,body:c.body});if(L((a)=>a+1),!c.start)return;let $0=U0.issues.find((a)=>a.id===m.nextId)??U0.issues.reduce((a,Z0)=>a&&a.id>Z0.id?a:Z0,null);if(!$0)return;$.onStartChat({repoRoot:m.repoRoot,issue:$0,vendor:c.start.vendor,placement:c.start.placement,jump:c.start.jump})}catch(U0){console.error("[rove kanban] issue create failed:",U0)}})}function s(){let m=_,n=m?.issues.find((c)=>c.id===R);if(!m||!n)return;j4.show(G,z("kanban.confirmDelete.title",{id:String(n.id)}),z("kanban.confirmDelete.body",{title:n.title})).then((c)=>{if(!c)return;$.orchestrator?.mutateIssue(m.repoRoot,{type:"delete",id:n.id}).then(()=>{w(null),L((r)=>r+1)}).catch((r)=>console.error("[rove kanban] issue delete failed:",r))})}g1(()=>({enabled:G.stack.length===0&&$.focused!==!1,bindings:[...a2($.onClose),{key:"r",cmd:()=>L((m)=>m+1)},{key:"tab",cmd:()=>f(1)},{key:"up",cmd:()=>y("up")},{key:"down",cmd:()=>y("down")},{key:"right",cmd:()=>k("right")},{key:"left",cmd:()=>k("left")},{key:"return",cmd:()=>h()},{key:"n",cmd:()=>t()},{key:"d",cmd:()=>s()}]}));let Y0={backlog:Z.textMuted,in_progress:Z.accent,parked:Z.warning,done:Z.success};function B0(m,n){let r=(n==="in_progress"||n==="parked")&&m.taskId?$.engineStates?.get(m.taskId)?.state:void 0;return T.jsxDEV(A50,{issue:m,column:n,selected:m.id===R,activity:r,onSelect:()=>w(m.id),onOpen:()=>u(m)},m.id,!1,void 0,this)}function K0(m){return T.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",paddingTop:1,paddingLeft:3,paddingRight:3,children:[T.jsxDEV("box",{flexDirection:"row",onMouseUp:()=>f(1),children:[T.jsxDEV("text",{fg:Z.primary,attributes:sC.BOLD,wrapMode:"none",children:D9(m.repoRoot,g)},void 0,!1,void 0,this),D.length>1?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:[" ",C+1,"/",D.length]},void 0,!0,void 0,this):null,T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",flexShrink:1,children:[" ",m.repoRoot]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),m.issues.length===0?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:z("kanban.empty")},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function H0(){return T.jsxDEV("box",{flexDirection:"row",gap:1,flexGrow:1,paddingTop:1,paddingLeft:1,paddingRight:1,children:E.map((m)=>T.jsxDEV("box",{flexGrow:1,flexBasis:0,border:!0,borderColor:X,paddingLeft:1,paddingRight:1,children:[T.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",children:[T.jsxDEV("text",{fg:Y0[m.key],attributes:sC.BOLD,wrapMode:"none",children:[z(oA0[m.key])," (",m.issues.length+m.hiddenCount,")"]},void 0,!0,void 0,this),m.key==="in_progress"&&I>0?T.jsxDEV("text",{fg:Z.warning,attributes:sC.BOLD,wrapMode:"none",children:z("kanban.attention",{count:String(I)})},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),T.jsxDEV("scrollbox",{flexGrow:1,paddingTop:1,verticalScrollbarOptions:{trackOptions:{foregroundColor:"transparent"}},children:[m.issues.map((n)=>B0(n,m.key)),m.hiddenCount>0?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:z("kanban.more",{count:String(m.hiddenCount)})},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)]},m.key,!0,void 0,this))},void 0,!1,void 0,this)}let W0=W===null;return T.jsxDEV("box",{flexGrow:1,backgroundColor:Z.background,paddingTop:1,paddingBottom:1,children:[T.jsxDEV("box",{flexDirection:"row",justifyContent:"space-between",paddingLeft:3,paddingRight:3,children:[T.jsxDEV("text",{attributes:sC.BOLD,fg:Z.text,children:z("kanban.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,children:z("kanban.hint")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W0?T.jsxDEV("text",{fg:Z.textMuted,paddingLeft:3,children:z("kanban.loading")},void 0,!1,void 0,this):D.length===0||!_?T.jsxDEV("text",{fg:Z.textMuted,paddingLeft:3,children:z("kanban.noRepos")},void 0,!1,void 0,this):T.jsxDEV(T.Fragment,{children:[K0(_),H0()]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}var AX,iA0=5000,oA0;var R50=l(async()=>{MZ();J2();Of();i8();Q$();oC();i0();await X$([Z$(),O4(),V5(),gZ(),C50(),D50()]);AX=Q1(H1(),1),oA0={backlog:"kanban.column.backlog",in_progress:"kanban.column.inProgress",parked:"kanban.column.parked",done:"kanban.column.done"}});function eC($){return $==="line"||$==="box"?$:"box"}var IM="appearance.splitStyle",tC;var EM=l(()=>{tC=["box","line"]});function aA0($){return`theme:${$}`}function Rf($){return`language:${$}`}function Tf($){return`accent:${$}`}function rA0($){return`engine:${$}`}function Sf($){return`split-style:${$}`}function sA0($){return`plugin:${$}`}function tA0($,Z){return`plugin:${$}:${Z}`}function If($){return[...$.themeNames.map((Z)=>({id:aA0(Z),kind:"theme",name:Z})),...lY.map((Z)=>({id:Rf(Z.id),kind:"language",locale:Z.id})),{id:"transparent",kind:"transparent"},...$.focusAccentSlots.map((Z)=>({id:Tf(Z),kind:"focusAccent",slot:Z})),...tC.map((Z)=>({id:Sf(Z),kind:"splitStyle",style:Z})),{id:"toast",kind:"toast"},{id:"sound",kind:"sound"},{id:"cross-task",kind:"crossTask"},{id:"key-hints",kind:"keyHints"},{id:"zen-default-on",kind:"zenDefaultOn"},{id:"zen-keep-tasks",kind:"zenKeepTasks"},{id:"editor-kind",kind:"editorKind"},{id:"editor-custom",kind:"editorCustom"},{id:"worktree-base",kind:"worktreeBase"},{id:"worktree-custom",kind:"worktreeCustom"},{id:"scrollback-rows",kind:"scrollbackRows"},{id:"tab-strip-hide-single",kind:"tabStripHideSingle"}]}function eA0($){return[...$.map((Z)=>({id:rA0(Z),kind:"engine",vendor:Z})),{id:"add-engine",kind:"engineAdd"}]}function $D0($){return $.flatMap(({id:Z,settingKeys:J})=>[{id:sA0(Z),kind:"pluginToggle",pluginId:Z},...J.map((X)=>({id:tA0(Z,X),kind:"pluginSetting",pluginId:Z,key:X}))])}function ZD0(){return[{id:"feedback-title",kind:"feedbackTitle"},{id:"feedback-body",kind:"feedbackBody"},{id:"feedback-send",kind:"feedbackSend"}]}function Ef($){return[{id:"dev-reset",kind:"devReset"},...$?[{id:"dev-restart",kind:"devRestartDaemon"}]:[],{id:"remote-projects",kind:"devRemoteProjects"},{id:"auto-status",kind:"devAutoStatus"},{id:"dispatcher",kind:"devDispatcher"},{id:"archived-history",kind:"devArchivedHistory"}]}function T50($,Z){switch($){case"general":return If(Z);case"engines":return eA0(Z.engineList);case"keys":return[];case"plugins":return $D0(Z.plugins);case"feedback":return ZD0();case"dev":return Ef(Z.hasDaemon)}}function $A($,Z){return $.findIndex((J)=>J.id===Z)}function wf($,Z){return $[Z]}function S50($){return $.split(/[-_]+/).filter((Z)=>Z.length>0).map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join(" ")}var SG;var wM=l(()=>{EM();pY();SG=[{id:"general",label:"General"},{id:"engines",label:"Engines"},{id:"plugins",label:"Plugins"},{id:"keys",label:"Keybindings"},{id:"feedback",label:"Feedback"},{id:"dev",label:"Dev"}]});import{unlinkSync as JD0}from"fs";import{join as XD0}from"path";function xM($){return $ instanceof oJ}function xf($,Z){try{$?.destroy()}catch(J){console.error(`Rove: renderer.destroy() failed during ${Z}:`,J)}}function I50(){try{JD0(XD0(U2(),"tasks.json"))}catch($){if($.code!=="ENOENT")console.error("Rove: failed to delete tasks.json during reset:",$)}}var ff=l(()=>{wF();j5()});async function yf($,Z,J){if(await j4.show($,"Reset UI state?","Wipes ~/.config/rove/state.json and ~/.rove/tasks.json, then quits Rove \u2014 relaunch for a fresh start with empty Working session / Archive lists. Worktrees on disk and engine session history are NOT touched.","cancel")!==!0)return;Z.clear(),I50(),xf(J,"reset"),process.stderr.write(`Rove: UI state reset. Relaunch Rove to start fresh.
912
912
  `),process.exit(0)}async function bf($,Z,J){if(!xM(Z))return;if(await j4.show($,"Restart backend?","Quits this Rove window. Relaunch to (re)spawn the daemon. Any other attached windows keep their connection. In v0.6 the daemon's RPC surface shrank to task CRUD + subscribe, so a graceful daemon.stop RPC is no longer plumbed through the client \u2014 quit + relaunch is the path.","cancel")!==!0)return;xf(J,"daemon restart"),process.stderr.write(`Rove: window closed. Relaunch Rove to start fresh.
913
- `),process.exit(0)}var E50=l(async()=>{ff();ff();await gZ()});import{TextAttributes as w50}from"@opentui/core";function i5($){let{theme:Z}=c0(),J=_z.useContext(ZA),X=_z.useRef(null),{cursor:z}=$;return _z.useEffect(()=>{if(z)J?.(X.current)},[z,J]),T.jsxDEV("box",{ref:(G)=>{X.current=G},flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,backgroundColor:$.cursor?Z.primary:$.idleBackground,onMouseUp:$.onMouseUp,children:T.jsxDEV("text",{fg:$.cursor?Z.selectedListItemText:$.fg,attributes:$.bold?w50.BOLD:void 0,wrapMode:"none",children:$.children},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function w3($){let{theme:Z}=c0();return T.jsxDEV("box",{flexDirection:"column",gap:0,paddingTop:$.paddingTop??1,children:[T.jsxDEV("text",{fg:Z.text,attributes:w50.BOLD,children:$.title},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:$.hint},void 0,!1,void 0,this),$.children]},void 0,!0,void 0,this)}var _z,ZA;var JA=l(async()=>{i0();await Z$();_z=Q1(H1(),1),ZA=_z.createContext(null)});import{homedir as QD0}from"os";import{TextAttributes as gf}from"@opentui/core";function x50($){let{theme:Z}=c0(),J=e0(),X=$.vendors.length,z=(W)=>$.level==="body"&&$.bodyRow===W,G=new Map(($.statuses??[]).map((W)=>[W.vendor,W]));return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:Z.text,attributes:gf.BOLD,children:J("settings.engines.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.engines.hint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:[$.vendors.map((W,q)=>{let U=z(q),B=$.isEnabled(W),M=U?Z.selectedListItemText:B?Z.text:Z.textMuted,L=U?Z.selectedListItemText:!B||$.isDefault(W)?Z.textMuted:Z.accent;return T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,overflow:"hidden",backgroundColor:U?Z.primary:void 0,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(q),$.editEngine(W)},children:[T.jsxDEV("text",{fg:U?Z.selectedListItemText:B?Z.text:Z.textMuted,wrapMode:"none",onMouseUp:()=>$.toggleEngine(W),children:B?"[x]":"[ ]"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:U?Z.selectedListItemText:Z.accent,attributes:gf.BOLD,wrapMode:"none",children:$.isDefaultEngine(W)?"\u25CF":" "},void 0,!1,void 0,this),T.jsxDEV("text",{fg:M,attributes:gf.BOLD,wrapMode:"none",children:$.displayName(W)},void 0,!1,void 0,this),T.jsxDEV("text",{fg:L,wrapMode:"none",flexShrink:1,children:$.commandText(W)+($.isCustom(W)?J("settings.engines.customTag"):"")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(zD0,{status:G.get(W)??null,probing:$.statuses===null},void 0,!1,void 0,this)]},W,!0,void 0,this)}),T.jsxDEV("box",{flexDirection:"row",paddingLeft:1,paddingRight:1,backgroundColor:z(X)?Z.primary:void 0,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(X),$.onAddEngine()},children:T.jsxDEV("text",{fg:z(X)?Z.selectedListItemText:Z.primary,wrapMode:"none",children:J("settings.engines.addEngine")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function zD0($){let{theme:Z}=c0(),J=e0(),X=$.status;if(!X)return T.jsxDEV("box",{paddingLeft:6,children:T.jsxDEV("text",{fg:Z.textMuted,children:$.probing?J("settings.accounts.checking"):" "},void 0,!1,void 0,this)},void 0,!1,void 0,this);return T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:6,overflow:"hidden",children:[X.account===null?null:T.jsxDEV(GD0,{account:X.account},void 0,!1,void 0,this),X.accountError?T.jsxDEV("text",{fg:Z.warning,wrapMode:"none",children:`! ${X.accountError}`},void 0,!1,void 0,this):null,T.jsxDEV("text",{fg:X.binary.found?Z.textMuted:Z.warning,wrapMode:"none",flexShrink:1,children:(X.account===null?"":"\xB7 ")+(X.binary.found?YD0(X.binary.path):X.binary.error)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YD0($){let Z=QD0();return Z&&$.startsWith(`${Z}/`)?`~${$.slice(Z.length)}`:$}function GD0({account:$}){let{theme:Z}=c0(),J=e0();if($.kind==="oauth"){if(!("email"in $))return T.jsxDEV("text",{fg:Z.success,wrapMode:"none",children:J("settings.accounts.detected")},void 0,!1,void 0,this);let X=$.billingType;return T.jsxDEV("text",{fg:Z.success,wrapMode:"none",flexShrink:1,children:J("settings.accounts.loggedIn",{email:$.email})+(X?` (${X})`:"")},void 0,!1,void 0,this)}if($.kind==="chatgpt")return T.jsxDEV("text",{fg:Z.success,wrapMode:"none",flexShrink:1,children:J("settings.accounts.chatgptLogin",{email:$.email})+($.plan?` (${$.plan})`:"")},void 0,!1,void 0,this);if($.kind==="apikey")return T.jsxDEV("text",{fg:Z.success,children:J("settings.accounts.apiKeyConfigured")},void 0,!1,void 0,this);if($.kind==="token")return T.jsxDEV("text",{fg:Z.success,children:J("settings.accounts.tokenConfigured",{source:$.source})},void 0,!1,void 0,this);return T.jsxDEV("text",{fg:Z.textMuted,children:J("settings.accounts.notLoggedIn")},void 0,!1,void 0,this)}var f50=l(async()=>{Q$();i0();await Z$()});import{TextAttributes as vf}from"@opentui/core";function b50($){let{theme:Z}=c0(),J=e0();return T.jsxDEV("box",{flexDirection:"column",flexShrink:0,width:14,gap:1,children:SG.map((X,z)=>{let G=z===$.cursor,W=G&&$.level==="sidebar";return T.jsxDEV("box",{paddingLeft:1,paddingRight:1,backgroundColor:W?Z.primary:void 0,onMouseUp:()=>$.switchSection(X.id),children:T.jsxDEV("text",{fg:W?Z.selectedListItemText:G?Z.accent:Z.textMuted,attributes:G?vf.BOLD:void 0,wrapMode:"none",children:J(`settings.sections.${X.id}`)},void 0,!1,void 0,this)},X.id,!1,void 0,this)})},void 0,!1,void 0,this)}function WD0($){let{theme:Z}=c0(),J=e0(),X={ok:Z.success,warn:Z.warning,crit:Z.error},z=Date.now();return T.jsxDEV("box",{flexDirection:"column",flexShrink:0,alignSelf:"flex-start",gap:0,children:[...$.usage.entries()].map(([G,W])=>T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:Z.text,attributes:vf.BOLD,wrapMode:"none",children:`${w5(G).toUpperCase()} ${J("settings.general.usage")}`},void 0,!1,void 0,this),R40(W,z).map((q)=>T.jsxDEV("box",{flexDirection:"row",gap:1,children:[T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:q.label},void 0,!1,void 0,this),T.jsxDEV("text",{fg:X[q.tone],wrapMode:"none",children:`${q.bar} ${q.percentText}`},void 0,!1,void 0,this),q.resetText?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:q.resetText},void 0,!1,void 0,this):null]},q.label,!0,void 0,this))]},G,!0,void 0,this))},void 0,!1,void 0,this)}function g50($){let{prefs:Z}=$,J=c0(),{theme:X}=J,z=e0(),G=b7(),W=y50.useMemo(()=>If({themeNames:$.themeNames,focusAccentSlots:tQ}),[$.themeNames]),q=(u)=>$A(W,u),U=(u)=>$.level==="body"&&$.bodyRow===u,B=(u,h)=>()=>{$.setLevel("body"),$.setBodyRow(u),h()},M=(u)=>u?z("settings.general.on"):z("settings.general.off"),L=(u)=>u?"[x]":"[ ]",N=q("transparent"),j=q("toast"),D=q("sound"),C=q("cross-task"),_=q("key-hints"),g=q("zen-default-on"),E=q("zen-keep-tasks"),I=q("editor-kind"),R=q("editor-custom"),w=q("worktree-base"),f=q("worktree-custom"),y=q("scrollback-rows"),k=q("tab-strip-hide-single");return T.jsxDEV("box",{flexDirection:"row",gap:2,children:[T.jsxDEV("box",{flexDirection:"column",gap:1,flexGrow:1,flexShrink:1,children:[T.jsxDEV("text",{fg:X.text,attributes:vf.BOLD,children:z("settings.general.theme")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:X.textMuted,children:z("settings.general.themeHint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:$.themeNames.map((u,h)=>{let t=u===J.selected;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>$.selectTheme(u)),fg:t?X.accent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${u}`},u,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.language"),hint:z("settings.general.languageHint"),children:lY.map((u)=>{let h=q(Rf(u.id)),t=$.currentLocale===u.id;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>$.selectLanguage(u.id)),fg:t?X.accent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${u.label}`},u.id,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.transparent"),hint:z("settings.general.transparentHint"),children:T.jsxDEV(i5,{cursor:U(N),onMouseUp:B(N,$.toggleTransparent),fg:J.transparentBackground?X.accent:X.textMuted,bold:!0,children:M(J.transparentBackground)},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.focusAccent"),hint:z("settings.general.focusAccentHint"),children:tQ.map((u)=>{let h=q(Tf(u)),t=J.focusAccent===u;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>$.selectFocusAccent(u)),fg:t?X.focusAccent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${z(`settings.general.accent${u.charAt(0).toUpperCase()}${u.slice(1)}`)}`},u,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.appearance"),hint:z("settings.general.appearanceHint"),children:tC.map((u)=>{let h=q(Sf(u)),t=Z.splitStyle()===u;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>Z.selectSplitStyle(u)),fg:t?X.accent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${z(u==="box"?"settings.general.splitBox":"settings.general.splitLine")}`},u,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.notifications"),hint:z("settings.general.notificationsHint"),children:[T.jsxDEV(i5,{cursor:U(j),onMouseUp:B(j,Z.toggleToast),fg:Z.toastEnabled()?X.accent:X.textMuted,bold:!0,children:`${L(Z.toastEnabled())} ${z("settings.general.toast")}`},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(D),onMouseUp:B(D,Z.toggleSound),fg:Z.soundEnabled()?X.accent:X.textMuted,bold:!0,children:`${L(Z.soundEnabled())} ${z("settings.general.sound")}`},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(C),onMouseUp:B(C,Z.toggleCrossTask),fg:Z.crossTaskEnabled()?X.accent:X.textMuted,bold:!0,children:`${L(Z.crossTaskEnabled())} ${z("settings.general.crossTask")}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.keyHints"),hint:z("settings.general.keyHintsHint"),children:T.jsxDEV(i5,{cursor:U(_),onMouseUp:B(_,()=>mC(G)),fg:kC(G)?X.accent:X.textMuted,bold:!0,children:`${L(kC(G))} ${z("settings.general.keyHintsShow")}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.zen"),hint:z("settings.general.zenHint"),children:[T.jsxDEV(i5,{cursor:U(g),onMouseUp:B(g,Z.toggleZenDefaultOn),fg:Z.zenDefaultOn()?X.accent:X.textMuted,bold:!0,children:`${L(Z.zenDefaultOn())} ${z("settings.general.zenDefaultOn")}`},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(E),onMouseUp:B(E,Z.toggleZenKeepsTasks),fg:Z.zenKeepsTasks()?X.accent:X.textMuted,bold:!0,children:`${L(Z.zenKeepsTasks())} ${z("settings.general.zenKeepTasks")}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.editor"),hint:z("settings.general.editorHint"),children:[T.jsxDEV(i5,{cursor:U(I),onMouseUp:B(I,Z.cycleEditorKind),fg:X.accent,bold:!0,children:z("settings.general.editorRow",{kind:Z.editorKind()})},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(R),onMouseUp:B(R,()=>void Z.editEditorCustom()),fg:Z.editorKind()==="custom"?X.text:X.textMuted,children:z("settings.general.editorCustom",{cmd:Z.editorCustomCommand().trim()||z("settings.general.editorCustomUnset")})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.worktree"),hint:z("settings.general.worktreeHint"),children:[T.jsxDEV(i5,{cursor:U(w),onMouseUp:B(w,Z.cycleWorktreeBase),fg:X.accent,bold:!0,children:z("settings.general.worktreeBase",{kind:Z.worktreeKindLabel()})},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(f),onMouseUp:B(f,()=>void Z.editWorktreeCustom()),fg:Z.worktreeKind()==="custom"?X.text:X.textMuted,children:z("settings.general.worktreeCustom",{path:Z.worktreeCustomPath()||z("settings.general.worktreeCustomUnset")})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.terminal"),hint:z("settings.general.terminalHint"),children:[T.jsxDEV(i5,{cursor:U(y),onMouseUp:B(y,()=>void Z.editScrollbackRows()),fg:X.accent,bold:!0,children:z("settings.general.scrollbackRow",{rows:String(Z.scrollbackRows())})},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(k),onMouseUp:B(k,Z.cycleTabStripMode),fg:X.accent,bold:!0,children:z("settings.general.tabStripRow",{mode:z(`settings.general.tabStripMode.${Z.tabStripMode()}`)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.usage&&$.usage.size>0?T.jsxDEV(WD0,{usage:$.usage},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var y50;var v50=l(async()=>{J2();EM();wM();pY();AM();W8();Q$();Wf();i0();await X$([Z$(),JA()]);y50=Q1(H1(),1)});import{TextAttributes as M6}from"@opentui/core";function k50($){let{theme:Z}=c0(),J=e0(),X=$.level==="body",z=X&&$.bodyRow===0,G=X&&$.bodyRow===1,W=X&&$.bodyRow===2,q=(M)=>M?Z.primary:Z.textMuted,U=(M)=>M?M6.BOLD|M6.UNDERLINE:void 0,B=XA.useRef(null);return XA.useEffect(()=>{if($.body===""&&B.current&&B.current.plainText!=="")B.current.setText("")},[$.body]),T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:Z.text,attributes:M6.BOLD,children:J("settings.feedback.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.feedback.hint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("box",{gap:0,children:[T.jsxDEV("text",{fg:q(z),attributes:U(z),children:J("settings.feedback.titleLabel")},void 0,!1,void 0,this),T.jsxDEV("input",{value:$.title,placeholder:J("settings.feedback.titlePlaceholder"),focused:z,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(0)},onInput:(M)=>$.setTitle(n5(M)),onSubmit:()=>$.onTitleSubmit()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{gap:0,children:[T.jsxDEV("text",{fg:q(G),attributes:U(G),children:J("settings.feedback.descriptionLabel")},void 0,!1,void 0,this),T.jsxDEV("textarea",{ref:(M)=>{B.current=M},initialValue:$.body,placeholder:J("settings.feedback.descriptionPlaceholder"),focused:G,height:4,wrapMode:"word",onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(1)},onContentChange:()=>$.setBody(B.current?.plainText??"")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{flexDirection:"row",paddingLeft:1,paddingRight:1,backgroundColor:W?Z.primary:Z.backgroundElement,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(2),$.submit()},children:T.jsxDEV("text",{fg:W?Z.selectedListItemText:Z.accent,attributes:M6.BOLD,children:J("settings.feedback.send")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.status?T.jsxDEV("text",{fg:$.status.startsWith("error:")?Z.warning:Z.success,wrapMode:"word",children:$.status},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function m50($){let{prefs:Z}=$,{theme:J}=c0(),X=e0(),z=Ef($.hasDaemon),G=(U)=>$.level==="body"&&$.bodyRow===U,W=(U,B)=>()=>{$.setLevel("body"),$.setBodyRow(U),B()},q=(U,B,M,L,N,j)=>{let D=$A(z,U);return T.jsxDEV(T.Fragment,{children:[T.jsxDEV("text",{fg:J.textMuted,wrapMode:"word",children:X(M)},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:G(D),onMouseUp:W(D,j),fg:J.text,bold:B,idleBackground:J.backgroundElement,children:B?X(L):X(N)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:J.text,attributes:M6.BOLD,children:X("settings.dev.reset")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:J.textMuted,wrapMode:"word",children:X("settings.dev.resetHint")},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:G(0),onMouseUp:W(0,$.confirmReset),fg:J.warning,bold:!0,idleBackground:J.backgroundElement,children:X("settings.dev.resetButton")},void 0,!1,void 0,this),$.hasDaemon?T.jsxDEV(w3,{title:X("settings.dev.restart"),hint:X("settings.dev.restartHint"),children:T.jsxDEV(i5,{cursor:G(1),onMouseUp:W(1,$.confirmRestartDaemon),fg:J.accent,bold:!0,idleBackground:J.backgroundElement,children:X("settings.dev.restartButton")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,T.jsxDEV("text",{fg:J.textMuted,wrapMode:"word",children:X("settings.dev.doctorHint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,paddingTop:1,children:[T.jsxDEV("text",{fg:J.text,attributes:M6.BOLD,children:X("settings.dev.experimental")},void 0,!1,void 0,this),q("remote-projects",Z.remoteProjectsEnabled(),"settings.dev.remoteHint","settings.dev.remoteOn","settings.dev.remoteOff",Z.toggleRemoteProjects),q("auto-status",Z.autoStatusOn(),"settings.dev.autoStatusHint","settings.dev.autoStatusOn","settings.dev.autoStatusOff",Z.toggleAutoStatus),q("dispatcher",Z.dispatcherOn(),"settings.dev.dispatcherHint","settings.dev.dispatcherOn","settings.dev.dispatcherOff",Z.toggleDispatcher),q("archived-history",Z.archivedHistoryOn(),"settings.dev.archivedHistoryHint","settings.dev.archivedHistoryOn","settings.dev.archivedHistoryOff",Z.toggleArchivedHistory)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function h50(){let{theme:$}=c0(),Z=e0();DG();let J=tS(),X=Y6(),z=Object.keys(dS).sort();return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:Z("settings.keybindings.hint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.configFile")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:J.path+(J.exists?"":Z("settings.keybindings.notCreated"))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.prefixTitle",{prefix:X.key??Z("settings.keybindings.prefixDisabled")})},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:Z("settings.keybindings.prefixHint",{prefix:X.key??Z("settings.keybindings.prefixDisabled"),timeout:X.timeoutMs})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!J.exists?T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.example")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:"prefix:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" key: ctrl+a # first stroke (null disables)"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:` timeoutMs: ${SH.timeoutMs} # second stroke deadline`},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" bindings:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" chat.tab.new: t # ctrl+a, then t"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:"bindings:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" chat.fork.new: ctrl+g # string = one chord"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" sidebar.select: [enter] # list = several chords"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" files.createPR: null # null = unbind"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:"darwin: # platform overlay (also: linux)"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" bindings:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" palette.open: [cmd+p, ctrl+p]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.overridesApplied")},void 0,!1,void 0,this),J.applied.length===0?T.jsxDEV("text",{fg:$.textMuted,children:Z("settings.keybindings.none")},void 0,!1,void 0,this):null,J.applied.map((G)=>T.jsxDEV("text",{fg:$.text,wrapMode:"word",children:`${G.id} \u2192 ${G.keys.length>0?G.keys.join(" / "):"(unbound)"} (default: ${G.defaultKeys.join(" / ")})`},G.id,!1,void 0,this))]},void 0,!0,void 0,this),J.warnings.length>0?T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.warning,attributes:M6.BOLD,children:Z("settings.keybindings.warnings")},void 0,!1,void 0,this),J.warnings.map((G)=>T.jsxDEV("text",{fg:$.warning,wrapMode:"word",children:`! ${G}`},G,!1,void 0,this))]},void 0,!0,void 0,this):null,z.length>0?T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:Z("settings.keybindings.fixed",{ids:z.join(", ")})},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var XA;var u50=l(async()=>{n8();wM();DV();TZ();_V();A9();Q$();i0();await X$([Z$(),JA()]);XA=Q1(H1(),1)});function c50($,Z){return $.map((J)=>{let X=Z[J.key],z=J.default??"";return{key:J.key,label:J.label,type:J.type,options:J.options??[],defaultValue:z,value:X??z,defaulted:X===void 0}})}function QA($){return $!==""&&$!=="0"&&$.toLowerCase()!=="false"}function l50($,Z){if($.length===0)return Z;let J=$.indexOf(Z);return $[(J+1)%$.length]}function d50($){if(!QA($.value))return"1";return QA($.defaultValue)?"0":""}function p50($){let Z=$.trim();if(Z==="")return"";let J=Number(Z);return Number.isFinite(J)?String(J):null}import{TextAttributes as n50}from"@opentui/core";function qD0($){let Z=[],J=0;for(let X of $)Z.push(J),J+=1+X.settings.length;return Z}function HD0($){let{theme:Z}=c0(),J=e0(),{setting:X}=$,z=X.type==="boolean"?QA(X.value)?J("settings.general.on"):J("settings.general.off"):X.value||J("settings.plugins.settingUnset");return T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:5,paddingRight:1,backgroundColor:$.cursor?Z.primary:void 0,onMouseUp:$.onActivate,children:[T.jsxDEV("text",{fg:$.cursor?Z.selectedListItemText:Z.text,wrapMode:"none",children:X.label},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.cursor?Z.selectedListItemText:X.defaulted?Z.textMuted:Z.accent,wrapMode:"none",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function i50($){let{theme:Z}=c0(),J=e0(),X=Date.now(),z=(W)=>$.level==="body"&&$.bodyRow===W,G=qD0($.plugins);return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:Z.text,attributes:n50.BOLD,children:J("settings.plugins.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.plugins.hint")},void 0,!1,void 0,this),$.plugins.length===0?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.plugins.empty")},void 0,!1,void 0,this):T.jsxDEV("box",{flexDirection:"column",gap:0,children:$.plugins.map((W,q)=>{let U=G[q]??0,B=z(U);return T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,backgroundColor:B?Z.primary:void 0,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(U),$.toggle(W.id)},children:[T.jsxDEV("text",{fg:B?Z.selectedListItemText:W.enabled?Z.accent:Z.textMuted,attributes:n50.BOLD,wrapMode:"none",children:`${W.enabled?"[x]":"[ ]"} ${W.id}`},void 0,!1,void 0,this),T.jsxDEV("text",{fg:B?Z.selectedListItemText:Z.textMuted,wrapMode:"none",children:`v${W.version} ${W.linked?J("settings.plugins.sourceLink",{path:W.source}):J("settings.plugins.sourceGithub",{spec:W.source})}`},void 0,!1,void 0,this),W.updateAvailable?T.jsxDEV("text",{fg:Z.warning,wrapMode:"none",children:J("settings.plugins.updateAvailable")},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:5,paddingRight:1,children:[T.jsxDEV("text",{fg:W.declares?Z.textMuted:Z.warning,wrapMode:"none",children:W.declares?J("settings.plugins.declares",{actions:String(W.declares.actions),events:String(W.declares.events),panes:String(W.declares.panes)}):J("settings.plugins.manifestUnreadable")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:W.lastRun?.ok===!1?Z.error:Z.textMuted,wrapMode:"none",children:W.lastRun?J("settings.plugins.lastRun",{label:W.lastRun.label,status:W.lastRun.ok?J("settings.plugins.runOk"):W.lastRun.spawnError?J("settings.plugins.runFailed"):J("settings.plugins.runExit",{code:String(W.lastRun.exitCode)}),ago:_X(W.lastRun.at,X)}):J("settings.plugins.neverRun")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.settings.map((M,L)=>T.jsxDEV(HD0,{setting:M,cursor:z(U+1+L),onActivate:()=>{$.setLevel("body"),$.setBodyRow(U+1+L),$.editSetting(W.id,M.key)}},M.key,!1,void 0,this))]},W.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var o50=l(async()=>{TM();Q$();i0();await Z$()});function a50($,Z,J){let[X,z]=fM.useState([]);fM.useEffect(()=>{iP().then(z)},[]);function G(){let k=$.get("customEngineIds",[]);return Array.isArray(k)?k.filter((u)=>typeof u==="string"&&u.trim().length>0):[]}function W(){return[...new Set([...m8,...G(),...X])]}function q(k){return G().includes(k)}function U(){let k=$.get("disabledEngineIds",[]);return Array.isArray(k)?k.filter((u)=>typeof u==="string"&&u.trim().length>0):[]}function B(k){return!U().includes(k)}function M(k){let u=U();if(u.includes(k)){$.set("disabledEngineIds",u.filter((t)=>t!==k));return}let h=W().find((t)=>t!==k&&!u.includes(t));if(g===k){if(!h)return;I(h)}$.set("disabledEngineIds",[...u,k])}function L(k){let u=$.get(X8(k),"");return typeof u==="string"?u.trim():""}function N(k){return L(k)||cQ(k).join(" ")}function j(k){return!q(k)&&L(k).length===0&&!C(k)}function D(k){let u=$.get(q9(k),"");return typeof u==="string"?u.trim():""}function C(k){return D(k).length>0}function _(k){return D(k)||B$(k).displayName}let[g,E]=fM.useState(()=>uj()??H4);function I(k){IT(k),$.set("defaultVendor",k),E(k)}async function R(k){let u=await b5.show(Z,N(k),{dialogTitle:`${_(k)} launch command`,fieldLabel:"command",submitLabel:"save",allowEmpty:!0});if(u===void 0)return;$.set(X8(k),u.trim())}async function w(k){let u=await b5.show(Z,_(k),{dialogTitle:`${_(k)} display name (blank = default)`,fieldLabel:"name",submitLabel:"save",allowEmpty:!0});if(u===void 0)return;$.set(q9(k),u.trim())}function f(k){if($.set(X8(k),""),$.set(q9(k),""),q(k))$.set(Cj(k),""),$.set("customEngineIds",G().filter((u)=>u!==k)),J(W().length)}async function y(){let k=await b5.show(Z,"",{dialogTitle:"Add engine",fieldLabel:"id",submitLabel:"next",placeholder:"lowercase slug, e.g. aider"});if(k===void 0)return;let u=k.trim().toLowerCase();if(!u||n2(u)||G().includes(u))return;let h=await b5.show(Z,"",{dialogTitle:`Add engine \xB7 ${u}`,fieldLabel:"command",submitLabel:"next",placeholder:"e.g. aider --model sonnet"});if(h===void 0)return;let t=await b5.show(Z,"",{dialogTitle:`Add engine \xB7 ${u} \u2014 protocol (blank = none)`,fieldLabel:"protocol",submitLabel:"next",allowEmpty:!0,placeholder:_j.join(" / ")}),s=await b5.show(Z,u,{dialogTitle:`Add engine \xB7 ${u}`,fieldLabel:"name",submitLabel:"add",allowEmpty:!0});if($.set("customEngineIds",[...G(),u]),h.trim())$.set(X8(u),h.trim());let Y0=t?.trim().toLowerCase()??"";if(Y0&&_j.includes(Y0))$.set(Cj(u),Y0);let B0=s?.trim()??"";$.set(q9(u),B0&&B0!==u?B0:S50(u))}return{engineList:W,isCustomEngine:q,isEngineEnabled:B,toggleEngineEnabled:M,engineName:_,engineCommandText:N,engineIsDefault:j,defaultEngine:g,setEngineDefault:I,editEngine:R,renameEngine:w,resetEngine:f,addEngineFlow:y}}var fM;var r50=l(async()=>{MZ();H9();J2();Z2();AZ();wM();D2();$2();await FX();fM=Q1(H1(),1)});import{spawnSync as UD0}from"child_process";import{statSync as BD0}from"fs";import KD0 from"path";function MD0($){let Z=globalThis.Bun?.which;if(Z)return Z($);let J=UD0(process.platform==="win32"?"where":"which",[$],{encoding:"utf8"});if(J.status!==0)return null;return J.stdout.split(`
913
+ `),process.exit(0)}var E50=l(async()=>{ff();ff();await gZ()});import{TextAttributes as w50}from"@opentui/core";function i5($){let{theme:Z}=c0(),J=_z.useContext(ZA),X=_z.useRef(null),{cursor:z}=$;return _z.useEffect(()=>{if(z)J?.(X.current)},[z,J]),T.jsxDEV("box",{ref:(G)=>{X.current=G},flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,backgroundColor:$.cursor?Z.primary:$.idleBackground,onMouseUp:$.onMouseUp,children:T.jsxDEV("text",{fg:$.cursor?Z.selectedListItemText:$.fg,attributes:$.bold?w50.BOLD:void 0,wrapMode:"none",children:$.children},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function w3($){let{theme:Z}=c0();return T.jsxDEV("box",{flexDirection:"column",gap:0,paddingTop:$.paddingTop??1,children:[T.jsxDEV("text",{fg:Z.text,attributes:w50.BOLD,children:$.title},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:$.hint},void 0,!1,void 0,this),$.children]},void 0,!0,void 0,this)}var _z,ZA;var JA=l(async()=>{i0();await Z$();_z=Q1(H1(),1),ZA=_z.createContext(null)});import{homedir as QD0}from"os";import{TextAttributes as gf}from"@opentui/core";function x50($){let{theme:Z}=c0(),J=e0(),X=$.vendors.length,z=(W)=>$.level==="body"&&$.bodyRow===W,G=new Map(($.statuses??[]).map((W)=>[W.vendor,W]));return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:Z.text,attributes:gf.BOLD,children:J("settings.engines.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.engines.hint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:[$.vendors.map((W,q)=>{let U=z(q),B=$.isEnabled(W),M=U?Z.selectedListItemText:B?Z.text:Z.textMuted,L=U?Z.selectedListItemText:!B||$.isDefault(W)?Z.textMuted:Z.accent;return T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,overflow:"hidden",backgroundColor:U?Z.primary:void 0,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(q),$.editEngine(W)},children:[T.jsxDEV("text",{fg:U?Z.selectedListItemText:B?Z.text:Z.textMuted,wrapMode:"none",onMouseUp:(N)=>{N.stopPropagation(),$.setLevel("body"),$.setBodyRow(q),$.toggleEngine(W)},children:B?"[x]":"[ ]"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:U?Z.selectedListItemText:Z.accent,attributes:gf.BOLD,wrapMode:"none",children:$.isDefaultEngine(W)?"\u25CF":" "},void 0,!1,void 0,this),T.jsxDEV("text",{fg:M,attributes:gf.BOLD,wrapMode:"none",children:$.displayName(W)},void 0,!1,void 0,this),T.jsxDEV("text",{fg:L,wrapMode:"none",flexShrink:1,children:$.commandText(W)+($.isCustom(W)?J("settings.engines.customTag"):"")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(zD0,{status:G.get(W)??null,probing:$.statuses===null},void 0,!1,void 0,this)]},W,!0,void 0,this)}),T.jsxDEV("box",{flexDirection:"row",paddingLeft:1,paddingRight:1,backgroundColor:z(X)?Z.primary:void 0,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(X),$.onAddEngine()},children:T.jsxDEV("text",{fg:z(X)?Z.selectedListItemText:Z.primary,wrapMode:"none",children:J("settings.engines.addEngine")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function zD0($){let{theme:Z}=c0(),J=e0(),X=$.status;if(!X)return T.jsxDEV("box",{paddingLeft:6,children:T.jsxDEV("text",{fg:Z.textMuted,children:$.probing?J("settings.accounts.checking"):" "},void 0,!1,void 0,this)},void 0,!1,void 0,this);return T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:6,overflow:"hidden",children:[X.account===null?null:T.jsxDEV(GD0,{account:X.account},void 0,!1,void 0,this),X.accountError?T.jsxDEV("text",{fg:Z.warning,wrapMode:"none",children:`! ${X.accountError}`},void 0,!1,void 0,this):null,T.jsxDEV("text",{fg:X.binary.found?Z.textMuted:Z.warning,wrapMode:"none",flexShrink:1,children:(X.account===null?"":"\xB7 ")+(X.binary.found?YD0(X.binary.path):X.binary.error)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function YD0($){let Z=QD0();return Z&&$.startsWith(`${Z}/`)?`~${$.slice(Z.length)}`:$}function GD0({account:$}){let{theme:Z}=c0(),J=e0();if($.kind==="oauth"){if(!("email"in $))return T.jsxDEV("text",{fg:Z.success,wrapMode:"none",children:J("settings.accounts.detected")},void 0,!1,void 0,this);let X=$.billingType;return T.jsxDEV("text",{fg:Z.success,wrapMode:"none",flexShrink:1,children:J("settings.accounts.loggedIn",{email:$.email})+(X?` (${X})`:"")},void 0,!1,void 0,this)}if($.kind==="chatgpt")return T.jsxDEV("text",{fg:Z.success,wrapMode:"none",flexShrink:1,children:J("settings.accounts.chatgptLogin",{email:$.email})+($.plan?` (${$.plan})`:"")},void 0,!1,void 0,this);if($.kind==="apikey")return T.jsxDEV("text",{fg:Z.success,children:J("settings.accounts.apiKeyConfigured")},void 0,!1,void 0,this);if($.kind==="token")return T.jsxDEV("text",{fg:Z.success,children:J("settings.accounts.tokenConfigured",{source:$.source})},void 0,!1,void 0,this);return T.jsxDEV("text",{fg:Z.textMuted,children:J("settings.accounts.notLoggedIn")},void 0,!1,void 0,this)}var f50=l(async()=>{Q$();i0();await Z$()});import{TextAttributes as vf}from"@opentui/core";function b50($){let{theme:Z}=c0(),J=e0();return T.jsxDEV("box",{flexDirection:"column",flexShrink:0,width:14,gap:1,children:SG.map((X,z)=>{let G=z===$.cursor,W=G&&$.level==="sidebar";return T.jsxDEV("box",{paddingLeft:1,paddingRight:1,backgroundColor:W?Z.primary:void 0,onMouseUp:()=>$.switchSection(X.id),children:T.jsxDEV("text",{fg:W?Z.selectedListItemText:G?Z.accent:Z.textMuted,attributes:G?vf.BOLD:void 0,wrapMode:"none",children:J(`settings.sections.${X.id}`)},void 0,!1,void 0,this)},X.id,!1,void 0,this)})},void 0,!1,void 0,this)}function WD0($){let{theme:Z}=c0(),J=e0(),X={ok:Z.success,warn:Z.warning,crit:Z.error},z=Date.now();return T.jsxDEV("box",{flexDirection:"column",flexShrink:0,alignSelf:"flex-start",gap:0,children:[...$.usage.entries()].map(([G,W])=>T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:Z.text,attributes:vf.BOLD,wrapMode:"none",children:`${w5(G).toUpperCase()} ${J("settings.general.usage")}`},void 0,!1,void 0,this),R40(W,z).map((q)=>T.jsxDEV("box",{flexDirection:"row",gap:1,children:[T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:q.label},void 0,!1,void 0,this),T.jsxDEV("text",{fg:X[q.tone],wrapMode:"none",children:`${q.bar} ${q.percentText}`},void 0,!1,void 0,this),q.resetText?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"none",children:q.resetText},void 0,!1,void 0,this):null]},q.label,!0,void 0,this))]},G,!0,void 0,this))},void 0,!1,void 0,this)}function g50($){let{prefs:Z}=$,J=c0(),{theme:X}=J,z=e0(),G=b7(),W=y50.useMemo(()=>If({themeNames:$.themeNames,focusAccentSlots:tQ}),[$.themeNames]),q=(u)=>$A(W,u),U=(u)=>$.level==="body"&&$.bodyRow===u,B=(u,h)=>()=>{$.setLevel("body"),$.setBodyRow(u),h()},M=(u)=>u?z("settings.general.on"):z("settings.general.off"),L=(u)=>u?"[x]":"[ ]",N=q("transparent"),j=q("toast"),D=q("sound"),C=q("cross-task"),_=q("key-hints"),g=q("zen-default-on"),E=q("zen-keep-tasks"),I=q("editor-kind"),R=q("editor-custom"),w=q("worktree-base"),f=q("worktree-custom"),y=q("scrollback-rows"),k=q("tab-strip-hide-single");return T.jsxDEV("box",{flexDirection:"row",gap:2,children:[T.jsxDEV("box",{flexDirection:"column",gap:1,flexGrow:1,flexShrink:1,children:[T.jsxDEV("text",{fg:X.text,attributes:vf.BOLD,children:z("settings.general.theme")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:X.textMuted,children:z("settings.general.themeHint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:$.themeNames.map((u,h)=>{let t=u===J.selected;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>$.selectTheme(u)),fg:t?X.accent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${u}`},u,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.language"),hint:z("settings.general.languageHint"),children:lY.map((u)=>{let h=q(Rf(u.id)),t=$.currentLocale===u.id;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>$.selectLanguage(u.id)),fg:t?X.accent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${u.label}`},u.id,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.transparent"),hint:z("settings.general.transparentHint"),children:T.jsxDEV(i5,{cursor:U(N),onMouseUp:B(N,$.toggleTransparent),fg:J.transparentBackground?X.accent:X.textMuted,bold:!0,children:M(J.transparentBackground)},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.focusAccent"),hint:z("settings.general.focusAccentHint"),children:tQ.map((u)=>{let h=q(Tf(u)),t=J.focusAccent===u;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>$.selectFocusAccent(u)),fg:t?X.focusAccent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${z(`settings.general.accent${u.charAt(0).toUpperCase()}${u.slice(1)}`)}`},u,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.appearance"),hint:z("settings.general.appearanceHint"),children:tC.map((u)=>{let h=q(Sf(u)),t=Z.splitStyle()===u;return T.jsxDEV(i5,{cursor:U(h),onMouseUp:B(h,()=>Z.selectSplitStyle(u)),fg:t?X.accent:X.text,bold:U(h)||t,children:`${t?"\u25CF ":" "}${z(u==="box"?"settings.general.splitBox":"settings.general.splitLine")}`},u,!1,void 0,this)})},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.notifications"),hint:z("settings.general.notificationsHint"),children:[T.jsxDEV(i5,{cursor:U(j),onMouseUp:B(j,Z.toggleToast),fg:Z.toastEnabled()?X.accent:X.textMuted,bold:!0,children:`${L(Z.toastEnabled())} ${z("settings.general.toast")}`},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(D),onMouseUp:B(D,Z.toggleSound),fg:Z.soundEnabled()?X.accent:X.textMuted,bold:!0,children:`${L(Z.soundEnabled())} ${z("settings.general.sound")}`},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(C),onMouseUp:B(C,Z.toggleCrossTask),fg:Z.crossTaskEnabled()?X.accent:X.textMuted,bold:!0,children:`${L(Z.crossTaskEnabled())} ${z("settings.general.crossTask")}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.keyHints"),hint:z("settings.general.keyHintsHint"),children:T.jsxDEV(i5,{cursor:U(_),onMouseUp:B(_,()=>mC(G)),fg:kC(G)?X.accent:X.textMuted,bold:!0,children:`${L(kC(G))} ${z("settings.general.keyHintsShow")}`},void 0,!1,void 0,this)},void 0,!1,void 0,this),T.jsxDEV(w3,{title:z("settings.general.zen"),hint:z("settings.general.zenHint"),children:[T.jsxDEV(i5,{cursor:U(g),onMouseUp:B(g,Z.toggleZenDefaultOn),fg:Z.zenDefaultOn()?X.accent:X.textMuted,bold:!0,children:`${L(Z.zenDefaultOn())} ${z("settings.general.zenDefaultOn")}`},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(E),onMouseUp:B(E,Z.toggleZenKeepsTasks),fg:Z.zenKeepsTasks()?X.accent:X.textMuted,bold:!0,children:`${L(Z.zenKeepsTasks())} ${z("settings.general.zenKeepTasks")}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.editor"),hint:z("settings.general.editorHint"),children:[T.jsxDEV(i5,{cursor:U(I),onMouseUp:B(I,Z.cycleEditorKind),fg:X.accent,bold:!0,children:z("settings.general.editorRow",{kind:Z.editorKind()})},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(R),onMouseUp:B(R,()=>void Z.editEditorCustom()),fg:Z.editorKind()==="custom"?X.text:X.textMuted,children:z("settings.general.editorCustom",{cmd:Z.editorCustomCommand().trim()||z("settings.general.editorCustomUnset")})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.worktree"),hint:z("settings.general.worktreeHint"),children:[T.jsxDEV(i5,{cursor:U(w),onMouseUp:B(w,Z.cycleWorktreeBase),fg:X.accent,bold:!0,children:z("settings.general.worktreeBase",{kind:Z.worktreeKindLabel()})},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(f),onMouseUp:B(f,()=>void Z.editWorktreeCustom()),fg:Z.worktreeKind()==="custom"?X.text:X.textMuted,children:z("settings.general.worktreeCustom",{path:Z.worktreeCustomPath()||z("settings.general.worktreeCustomUnset")})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV(w3,{title:z("settings.general.terminal"),hint:z("settings.general.terminalHint"),children:[T.jsxDEV(i5,{cursor:U(y),onMouseUp:B(y,()=>void Z.editScrollbackRows()),fg:X.accent,bold:!0,children:z("settings.general.scrollbackRow",{rows:String(Z.scrollbackRows())})},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:U(k),onMouseUp:B(k,Z.cycleTabStripMode),fg:X.accent,bold:!0,children:z("settings.general.tabStripRow",{mode:z(`settings.general.tabStripMode.${Z.tabStripMode()}`)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$.usage&&$.usage.size>0?T.jsxDEV(WD0,{usage:$.usage},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var y50;var v50=l(async()=>{J2();EM();wM();pY();AM();W8();Q$();Wf();i0();await X$([Z$(),JA()]);y50=Q1(H1(),1)});import{TextAttributes as M6}from"@opentui/core";function k50($){let{theme:Z}=c0(),J=e0(),X=$.level==="body",z=X&&$.bodyRow===0,G=X&&$.bodyRow===1,W=X&&$.bodyRow===2,q=(M)=>M?Z.primary:Z.textMuted,U=(M)=>M?M6.BOLD|M6.UNDERLINE:void 0,B=XA.useRef(null);return XA.useEffect(()=>{if($.body===""&&B.current&&B.current.plainText!=="")B.current.setText("")},[$.body]),T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:Z.text,attributes:M6.BOLD,children:J("settings.feedback.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.feedback.hint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("box",{gap:0,children:[T.jsxDEV("text",{fg:q(z),attributes:U(z),children:J("settings.feedback.titleLabel")},void 0,!1,void 0,this),T.jsxDEV("input",{value:$.title,placeholder:J("settings.feedback.titlePlaceholder"),focused:z,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(0)},onInput:(M)=>$.setTitle(n5(M)),onSubmit:()=>$.onTitleSubmit()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{gap:0,children:[T.jsxDEV("text",{fg:q(G),attributes:U(G),children:J("settings.feedback.descriptionLabel")},void 0,!1,void 0,this),T.jsxDEV("textarea",{ref:(M)=>{B.current=M},initialValue:$.body,placeholder:J("settings.feedback.descriptionPlaceholder"),focused:G,height:4,wrapMode:"word",onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(1)},onContentChange:()=>$.setBody(B.current?.plainText??"")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{flexDirection:"row",paddingLeft:1,paddingRight:1,backgroundColor:W?Z.primary:Z.backgroundElement,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(2),$.submit()},children:T.jsxDEV("text",{fg:W?Z.selectedListItemText:Z.accent,attributes:M6.BOLD,children:J("settings.feedback.send")},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$.status?T.jsxDEV("text",{fg:$.status.startsWith("error:")?Z.warning:Z.success,wrapMode:"word",children:$.status},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}function m50($){let{prefs:Z}=$,{theme:J}=c0(),X=e0(),z=Ef($.hasDaemon),G=(U)=>$.level==="body"&&$.bodyRow===U,W=(U,B)=>()=>{$.setLevel("body"),$.setBodyRow(U),B()},q=(U,B,M,L,N,j)=>{let D=$A(z,U);return T.jsxDEV(T.Fragment,{children:[T.jsxDEV("text",{fg:J.textMuted,wrapMode:"word",children:X(M)},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:G(D),onMouseUp:W(D,j),fg:J.text,bold:B,idleBackground:J.backgroundElement,children:B?X(L):X(N)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:J.text,attributes:M6.BOLD,children:X("settings.dev.reset")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:J.textMuted,wrapMode:"word",children:X("settings.dev.resetHint")},void 0,!1,void 0,this),T.jsxDEV(i5,{cursor:G(0),onMouseUp:W(0,$.confirmReset),fg:J.warning,bold:!0,idleBackground:J.backgroundElement,children:X("settings.dev.resetButton")},void 0,!1,void 0,this),$.hasDaemon?T.jsxDEV(w3,{title:X("settings.dev.restart"),hint:X("settings.dev.restartHint"),children:T.jsxDEV(i5,{cursor:G(1),onMouseUp:W(1,$.confirmRestartDaemon),fg:J.accent,bold:!0,idleBackground:J.backgroundElement,children:X("settings.dev.restartButton")},void 0,!1,void 0,this)},void 0,!1,void 0,this):null,T.jsxDEV("text",{fg:J.textMuted,wrapMode:"word",children:X("settings.dev.doctorHint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,paddingTop:1,children:[T.jsxDEV("text",{fg:J.text,attributes:M6.BOLD,children:X("settings.dev.experimental")},void 0,!1,void 0,this),q("remote-projects",Z.remoteProjectsEnabled(),"settings.dev.remoteHint","settings.dev.remoteOn","settings.dev.remoteOff",Z.toggleRemoteProjects),q("auto-status",Z.autoStatusOn(),"settings.dev.autoStatusHint","settings.dev.autoStatusOn","settings.dev.autoStatusOff",Z.toggleAutoStatus),q("dispatcher",Z.dispatcherOn(),"settings.dev.dispatcherHint","settings.dev.dispatcherOn","settings.dev.dispatcherOff",Z.toggleDispatcher),q("archived-history",Z.archivedHistoryOn(),"settings.dev.archivedHistoryHint","settings.dev.archivedHistoryOn","settings.dev.archivedHistoryOff",Z.toggleArchivedHistory)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function h50(){let{theme:$}=c0(),Z=e0();DG();let J=tS(),X=Y6(),z=Object.keys(dS).sort();return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:Z("settings.keybindings.hint")},void 0,!1,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.configFile")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:J.path+(J.exists?"":Z("settings.keybindings.notCreated"))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.prefixTitle",{prefix:X.key??Z("settings.keybindings.prefixDisabled")})},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:Z("settings.keybindings.prefixHint",{prefix:X.key??Z("settings.keybindings.prefixDisabled"),timeout:X.timeoutMs})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),!J.exists?T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.example")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:"prefix:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" key: ctrl+a # first stroke (null disables)"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:` timeoutMs: ${SH.timeoutMs} # second stroke deadline`},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" bindings:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" chat.tab.new: t # ctrl+a, then t"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:"bindings:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" chat.fork.new: ctrl+g # string = one chord"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" sidebar.select: [enter] # list = several chords"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" files.createPR: null # null = unbind"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:"darwin: # platform overlay (also: linux)"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" bindings:"},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.textMuted,children:" palette.open: [cmd+p, ctrl+p]"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.text,attributes:M6.BOLD,children:Z("settings.keybindings.overridesApplied")},void 0,!1,void 0,this),J.applied.length===0?T.jsxDEV("text",{fg:$.textMuted,children:Z("settings.keybindings.none")},void 0,!1,void 0,this):null,J.applied.map((G)=>T.jsxDEV("text",{fg:$.text,wrapMode:"word",children:`${G.id} \u2192 ${G.keys.length>0?G.keys.join(" / "):"(unbound)"} (default: ${G.defaultKeys.join(" / ")})`},G.id,!1,void 0,this))]},void 0,!0,void 0,this),J.warnings.length>0?T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("text",{fg:$.warning,attributes:M6.BOLD,children:Z("settings.keybindings.warnings")},void 0,!1,void 0,this),J.warnings.map((G)=>T.jsxDEV("text",{fg:$.warning,wrapMode:"word",children:`! ${G}`},G,!1,void 0,this))]},void 0,!0,void 0,this):null,z.length>0?T.jsxDEV("text",{fg:$.textMuted,wrapMode:"word",children:Z("settings.keybindings.fixed",{ids:z.join(", ")})},void 0,!1,void 0,this):null]},void 0,!0,void 0,this)}var XA;var u50=l(async()=>{n8();wM();DV();TZ();_V();A9();Q$();i0();await X$([Z$(),JA()]);XA=Q1(H1(),1)});function c50($,Z){return $.map((J)=>{let X=Z[J.key],z=J.default??"";return{key:J.key,label:J.label,type:J.type,options:J.options??[],defaultValue:z,value:X??z,defaulted:X===void 0}})}function QA($){return $!==""&&$!=="0"&&$.toLowerCase()!=="false"}function l50($,Z){if($.length===0)return Z;let J=$.indexOf(Z);return $[(J+1)%$.length]}function d50($){if(!QA($.value))return"1";return QA($.defaultValue)?"0":""}function p50($){let Z=$.trim();if(Z==="")return"";let J=Number(Z);return Number.isFinite(J)?String(J):null}import{TextAttributes as n50}from"@opentui/core";function qD0($){let Z=[],J=0;for(let X of $)Z.push(J),J+=1+X.settings.length;return Z}function HD0($){let{theme:Z}=c0(),J=e0(),{setting:X}=$,z=X.type==="boolean"?QA(X.value)?J("settings.general.on"):J("settings.general.off"):X.value||J("settings.plugins.settingUnset");return T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:5,paddingRight:1,backgroundColor:$.cursor?Z.primary:void 0,onMouseUp:$.onActivate,children:[T.jsxDEV("text",{fg:$.cursor?Z.selectedListItemText:Z.text,wrapMode:"none",children:X.label},void 0,!1,void 0,this),T.jsxDEV("text",{fg:$.cursor?Z.selectedListItemText:X.defaulted?Z.textMuted:Z.accent,wrapMode:"none",children:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function i50($){let{theme:Z}=c0(),J=e0(),X=Date.now(),z=(W)=>$.level==="body"&&$.bodyRow===W,G=qD0($.plugins);return T.jsxDEV("box",{flexDirection:"column",gap:1,children:[T.jsxDEV("text",{fg:Z.text,attributes:n50.BOLD,children:J("settings.plugins.title")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.plugins.hint")},void 0,!1,void 0,this),$.plugins.length===0?T.jsxDEV("text",{fg:Z.textMuted,wrapMode:"word",children:J("settings.plugins.empty")},void 0,!1,void 0,this):T.jsxDEV("box",{flexDirection:"column",gap:0,children:$.plugins.map((W,q)=>{let U=G[q]??0,B=z(U);return T.jsxDEV("box",{flexDirection:"column",gap:0,children:[T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:1,paddingRight:1,backgroundColor:B?Z.primary:void 0,onMouseUp:()=>{$.setLevel("body"),$.setBodyRow(U),$.toggle(W.id)},children:[T.jsxDEV("text",{fg:B?Z.selectedListItemText:W.enabled?Z.accent:Z.textMuted,attributes:n50.BOLD,wrapMode:"none",children:`${W.enabled?"[x]":"[ ]"} ${W.id}`},void 0,!1,void 0,this),T.jsxDEV("text",{fg:B?Z.selectedListItemText:Z.textMuted,wrapMode:"none",children:`v${W.version} ${W.linked?J("settings.plugins.sourceLink",{path:W.source}):J("settings.plugins.sourceGithub",{spec:W.source})}`},void 0,!1,void 0,this),W.updateAvailable?T.jsxDEV("text",{fg:Z.warning,wrapMode:"none",children:J("settings.plugins.updateAvailable")},void 0,!1,void 0,this):null]},void 0,!0,void 0,this),T.jsxDEV("box",{flexDirection:"row",gap:1,paddingLeft:5,paddingRight:1,children:[T.jsxDEV("text",{fg:W.declares?Z.textMuted:Z.warning,wrapMode:"none",children:W.declares?J("settings.plugins.declares",{actions:String(W.declares.actions),events:String(W.declares.events),panes:String(W.declares.panes)}):J("settings.plugins.manifestUnreadable")},void 0,!1,void 0,this),T.jsxDEV("text",{fg:W.lastRun?.ok===!1?Z.error:Z.textMuted,wrapMode:"none",children:W.lastRun?J("settings.plugins.lastRun",{label:W.lastRun.label,status:W.lastRun.ok?J("settings.plugins.runOk"):W.lastRun.spawnError?J("settings.plugins.runFailed"):J("settings.plugins.runExit",{code:String(W.lastRun.exitCode)}),ago:_X(W.lastRun.at,X)}):J("settings.plugins.neverRun")},void 0,!1,void 0,this)]},void 0,!0,void 0,this),W.settings.map((M,L)=>T.jsxDEV(HD0,{setting:M,cursor:z(U+1+L),onActivate:()=>{$.setLevel("body"),$.setBodyRow(U+1+L),$.editSetting(W.id,M.key)}},M.key,!1,void 0,this))]},W.id,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var o50=l(async()=>{TM();Q$();i0();await Z$()});function a50($,Z,J){let[X,z]=fM.useState([]);fM.useEffect(()=>{iP().then(z)},[]);function G(){let k=$.get("customEngineIds",[]);return Array.isArray(k)?k.filter((u)=>typeof u==="string"&&u.trim().length>0):[]}function W(){return[...new Set([...m8,...G(),...X])]}function q(k){return G().includes(k)}function U(){let k=$.get("disabledEngineIds",[]);return Array.isArray(k)?k.filter((u)=>typeof u==="string"&&u.trim().length>0):[]}function B(k){return!U().includes(k)}function M(k){let u=U();if(u.includes(k)){$.set("disabledEngineIds",u.filter((t)=>t!==k));return}let h=W().find((t)=>t!==k&&!u.includes(t));if(g===k){if(!h)return;I(h)}$.set("disabledEngineIds",[...u,k])}function L(k){let u=$.get(X8(k),"");return typeof u==="string"?u.trim():""}function N(k){return L(k)||cQ(k).join(" ")}function j(k){return!q(k)&&L(k).length===0&&!C(k)}function D(k){let u=$.get(q9(k),"");return typeof u==="string"?u.trim():""}function C(k){return D(k).length>0}function _(k){return D(k)||B$(k).displayName}let[g,E]=fM.useState(()=>uj()??H4);function I(k){IT(k),$.set("defaultVendor",k),E(k)}async function R(k){let u=await b5.show(Z,N(k),{dialogTitle:`${_(k)} launch command`,fieldLabel:"command",submitLabel:"save",allowEmpty:!0});if(u===void 0)return;$.set(X8(k),u.trim())}async function w(k){let u=await b5.show(Z,_(k),{dialogTitle:`${_(k)} display name (blank = default)`,fieldLabel:"name",submitLabel:"save",allowEmpty:!0});if(u===void 0)return;$.set(q9(k),u.trim())}function f(k){if($.set(X8(k),""),$.set(q9(k),""),q(k))$.set(Cj(k),""),$.set("customEngineIds",G().filter((u)=>u!==k)),J(W().length)}async function y(){let k=await b5.show(Z,"",{dialogTitle:"Add engine",fieldLabel:"id",submitLabel:"next",placeholder:"lowercase slug, e.g. aider"});if(k===void 0)return;let u=k.trim().toLowerCase();if(!u||n2(u)||G().includes(u))return;let h=await b5.show(Z,"",{dialogTitle:`Add engine \xB7 ${u}`,fieldLabel:"command",submitLabel:"next",placeholder:"e.g. aider --model sonnet"});if(h===void 0)return;let t=await b5.show(Z,"",{dialogTitle:`Add engine \xB7 ${u} \u2014 protocol (blank = none)`,fieldLabel:"protocol",submitLabel:"next",allowEmpty:!0,placeholder:_j.join(" / ")}),s=await b5.show(Z,u,{dialogTitle:`Add engine \xB7 ${u}`,fieldLabel:"name",submitLabel:"add",allowEmpty:!0});if($.set("customEngineIds",[...G(),u]),h.trim())$.set(X8(u),h.trim());let Y0=t?.trim().toLowerCase()??"";if(Y0&&_j.includes(Y0))$.set(Cj(u),Y0);let B0=s?.trim()??"";$.set(q9(u),B0&&B0!==u?B0:S50(u))}return{engineList:W,isCustomEngine:q,isEngineEnabled:B,toggleEngineEnabled:M,engineName:_,engineCommandText:N,engineIsDefault:j,defaultEngine:g,setEngineDefault:I,editEngine:R,renameEngine:w,resetEngine:f,addEngineFlow:y}}var fM;var r50=l(async()=>{MZ();H9();J2();Z2();AZ();wM();D2();$2();await FX();fM=Q1(H1(),1)});import{spawnSync as UD0}from"child_process";import{statSync as BD0}from"fs";import KD0 from"path";function MD0($){let Z=globalThis.Bun?.which;if(Z)return Z($);let J=UD0(process.platform==="win32"?"where":"which",[$],{encoding:"utf8"});if(J.status!==0)return null;return J.stdout.split(`
914
914
  `).map((X)=>X.trim()).find(Boolean)??null}function s50($,Z){let J=$[0]?.trim();if(!J)return{found:!1,error:"no launch command"};if(J.includes(KD0.sep)||J.startsWith(".")){try{if(BD0(J).isFile())return{found:!0,path:J}}catch{}return{found:!1,error:`not found at ${J}`}}let X=Z(J);return X?{found:!0,path:X}:{found:!1,error:"not found on PATH"}}async function LD0($,Z={}){let J={...ND0,...Z},X=FD0[$];if(!X)return{vendor:$,binary:s50(J.command($),J.which),account:null};let z=await X(J.accountDeps),G=z.binary.found?z.binary:s50(J.command($),J.which);return{vendor:$,binary:G,account:z.account,accountError:z.accountError}}function t50($,Z={}){return Promise.all($.map((J)=>LD0(J,Z)))}var FD0,ND0;var e50=l(()=>{MZ();J2();FD0={claude:cq,codex:lq,copilot:dq,kimi:SO};ND0={which:MD0,command:($)=>lQ($)}});import{mkdirSync as OD0,readFileSync as $20,writeFileSync as jD0}from"fs";import{join as VD0}from"path";function Z20($,Z){return VD0(P3($,Z),".env")}function J20($,Z){let J;try{J=$20(Z20($,Z),"utf8")}catch{return{}}let X={};for(let z of J.split(`
915
915
  `)){let G=z.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);if(G)X[G[1]]=G[2]}return X}function X20($,Z,J){let X=Z20($,J),z=[];try{z=$20(X,"utf8").split(`
916
916
  `)}catch{}let G={...Z},W=[];for(let q of z){let B=q.match(/^([A-Za-z_][A-Za-z0-9_]*)=/)?.[1];if(B&&B in G){let M=G[B];if(delete G[B],M!=="")W.push(`${B}=${M}`);continue}W.push(q)}for(let[q,U]of Object.entries(G))if(U!=="")W.push(`${q}=${U}`);while(W.length>0&&W[W.length-1]==="")W.pop();OD0(P3($,J),{recursive:!0}),jD0(X,W.length>0?`${W.join(`