@sma1lboy/kobe 0.8.13 → 0.8.14
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 +2 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -39,7 +39,7 @@ data: ${JSON.stringify(j)}
|
|
|
39
39
|
`)){let U=W.trim();if(!U)continue;if(!KX(U))continue;let M;try{M=JSON.parse(U)}catch{continue}if(!m_(M)||typeof M.type!=="string")continue;let L=typeof M.timestamp==="string"?M.timestamp:new Date().toISOString(),j=m_(M.data)?M.data:{};if(M.type==="session.start"){let F=typeof j.sessionId==="string"?j.sessionId:void 0;if(F)Q=F;continue}if(M.type==="user.message"){let F=typeof j.content==="string"?j.content:"";if(!F)continue;if(!q)q=Buffer.from(F.slice(0,E01),"utf8").toString("utf8");Z.push({role:"user",blocks:[{type:"text",text:F}],timestamp:L,sessionId:Q});continue}if(M.type==="assistant.message"){let F=[],V=typeof j.content==="string"?j.content:"";if(V)F.push({type:"text",text:V});let T=Array.isArray(j.toolRequests)?j.toolRequests:[];for(let D of T){if(!m_(D))continue;let A=typeof D.id==="string"?D.id:typeof D.toolCallId==="string"?D.toolCallId:"tool",b=typeof D.name==="string"?D.name:typeof D.toolName==="string"?D.toolName:"tool";F.push({type:"tool_call",callId:A,name:b,input:D.arguments??{}})}if(F.length>0)Z.push({role:"assistant",blocks:F,timestamp:L,sessionId:Q});continue}if(M.type==="tool.execution_start"){let F=typeof j.toolCallId==="string"?j.toolCallId:void 0,V=typeof j.toolName==="string"?j.toolName:"tool";if(F)z.set(F,V);continue}if(M.type==="tool.execution_complete"){let F=typeof j.toolCallId==="string"?j.toolCallId:void 0;if(!F)continue;let V=z.get(F)??(typeof j.toolName==="string"?j.toolName:"tool"),T=j.result??(j.success===!1?{success:!1}:void 0);Z.push({role:"assistant",blocks:[{type:"tool_result",callId:F,output:T,isError:j.success===!1}],timestamp:L,sessionId:Q});continue}if(M.type==="session.shutdown")Y=Ag(j)}return{messages:Z,toolNameById:z,sessionId:Q,usageMetrics:Y,firstUserMessage:q}}function m_($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var uG,S01,E01=200;var Pg=s(()=>{bG();rN();uG={copilotDir(){let $=process.env.COPILOT_HOME?.trim();if($)return $;return aZ.join(D01(),".copilot")},async readdir($){try{return await A01($)}catch{return[]}},async readFile($){return await uY($)},stat:V01,async rm($){await _01($,{recursive:!0,force:!0})}};S01=nY({initial:R01,parseChunk:($,X)=>w01($,X)})});var Tg,Ig,Rg,Sg;var c_=s(()=>{Tg=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],Ig=["\xB7","\u2722","\u2733","\u2736","\u273B","\u273D"],Rg=[...Ig,...[...Ig].reverse()],Sg=[...Array(10).fill("\u25CF"),...Array(10).fill("\xB7")]});import{readFile as wg}from"fs/promises";class GF{supportsCompletionMarkers(){return!0}async latestCompletion($){return(await this.latestActivity($)).marker}}function Eg($){return L5($).createTurnDetector()}function k01($,X="claude",Z=0){let z=null,Q=0;for(let Y of $.split(`
|
|
40
40
|
`)){Q++;let q=gg(Y);if(!q)continue;let W=p_(q.message)?q.message:q;if(W.role!=="assistant")continue;if(!("content"in W))continue;let U=fg(q,Z),M={id:`claude:${X}:${U}:${Q}`,timestampMs:U,source:"claude"};if(!z||M.timestampMs>=z.timestampMs)z=M}return z}function b01($){if($.type==="turn.completed")return!0;if($.type!=="event_msg")return!1;let X=p_($.payload)?$.payload:void 0;return typeof X?.type==="string"&&y01.has(X.type)}function v01($,X="codex"){let Z=null,z=0;for(let Q of $.split(`
|
|
41
41
|
`)){z++;let Y=gg(Q);if(!Y||!b01(Y))continue;let q=fg(Y,0),W={id:`codex:${X}:${q}:${z}`,timestampMs:q,source:"codex"};if(!Z||W.timestampMs>=Z.timestampMs)Z=W}return Z}function gg($){let X=$.trim();if(!X)return null;try{let Z=JSON.parse(X);return p_(Z)?Z:null}catch{return null}}function fg($,X){let Z=typeof $.timestamp==="string"?Date.parse($.timestamp):Number.NaN;return Number.isFinite(Z)?Z:X}function p_($){return typeof $==="object"&&$!==null&&!Array.isArray($)}var f01,d_,x01,l_,SB,y01;var n_=s(()=>{__();b_();t7();f01={listSessionFiles:($)=>IB($),readFile:($)=>wg($,"utf8")};d_=class d_ extends GF{deps;vendor="claude";cache=new Map;constructor($=f01){super();this.deps=$}async latestActivity($){let X=await this.deps.listSessionFiles($),Z=X[0]?.mtimeMs??0,z=null,Q=new Map;for(let Y of X.slice(0,4)){let q=this.cache.get(Y.path),W;if(q&&Y.mtimeMs>0&&q.mtimeMs===Y.mtimeMs)W=q.marker;else{let U=await this.deps.readFile(Y.path).catch(()=>"");W=k01(U,Y.path,Y.mtimeMs)}if(Q.set(Y.path,{mtimeMs:Y.mtimeMs,marker:W}),W&&(!z||W.timestampMs>z.timestampMs))z=W}return this.cache=Q,{marker:z,mtimeMs:Z}}};x01={findLatestRollout:($)=>y_($),readFile:($)=>wg($,"utf8")};l_=class l_ extends GF{deps;vendor="codex";cache=null;constructor($=x01){super();this.deps=$}async latestActivity($){if(!$)return{marker:null,mtimeMs:0};let X=await this.deps.findLatestRollout($);if(!X)return{marker:null,mtimeMs:0};if(this.cache&&this.cache.path===X.path&&X.mtimeMs>0&&this.cache.mtimeMs===X.mtimeMs)return{marker:this.cache.marker,mtimeMs:X.mtimeMs};let Z=await this.deps.readFile(X.path).catch(()=>"");if(!Z)return{marker:null,mtimeMs:X.mtimeMs};let z=v01(Z,X.path);return this.cache={path:X.path,mtimeMs:X.mtimeMs,marker:z},{marker:z,mtimeMs:X.mtimeMs}}};SB=class SB extends GF{vendor;constructor($){super();this.vendor=$}supportsCompletionMarkers(){return!1}async latestActivity(){return{marker:null,mtimeMs:0}}};y01=new Set(["task_complete","turn_complete","turn_aborted"])});function c01($){return{vendor:$,builtin:!1,displayName:$,defaultCommand:[$],history:xg,detectAccount:async()=>({binary:{found:!1,error:"custom engine: kobe has no account detector for it"},account:{kind:"none"}}),createHookAdapter:()=>new wB($),createTurnDetector:()=>new SB($)}}function L5($){return C8($)?kg[$]:c01($)}function i_($){if(!$)return null;let X=$.toLowerCase();for(let Z of Object.values(kg)){if(Z.identity&&X.includes(Z.identity.productName.toLowerCase()))return Z.vendor;let z=Z.defaultCommand[0]?.toLowerCase();if(z&&new RegExp(`(^|\\s)${z}(\\s|$)`).test(X))return Z.vendor}return null}function yg($){let X=i_($);return X?L5(X).defaultCommand[0]??X:$}var xg,m01,h01,u01,kg;var t7=s(()=>{A8();MX();mE();__();$g();Jg();b_();Cg();Pg();o_();c_();n_();xg={async listSessionIdsForWorktree(){return[]},async readHistory(){return[]},async latestTranscriptMtimeForWorktree(){return 0}},m01={async listSessionIdsForWorktree($){return[...await IB($)].sort((Z,z)=>Z.mtimeMs-z.mtimeMs).map((Z)=>Z.sessionId)},readHistory:($)=>iE($),latestTranscriptMtimeForWorktree:($)=>nE($)},h01={listSessionIdsForWorktree:($)=>Ng($),readHistory:($)=>Og($),latestTranscriptMtimeForWorktree:($)=>Fg($)},u01={listSessionIdsForWorktree:($)=>_g($),readHistory:($)=>Dg($),latestTranscriptMtimeForWorktree:($)=>Vg($)},kg={claude:{vendor:"claude",builtin:!0,displayName:"Claude",defaultCommand:["claude"],history:m01,detectAccount:($)=>cY($),createHookAdapter:()=>new T_,createTurnDetector:()=>new d_,capabilities:bE,identity:vE,spinnerFrames:Rg,terminalTitle:{ownsStatus:!0}},codex:{vendor:"codex",builtin:!0,displayName:"Codex",defaultCommand:["codex"],effortLevels:["none","low","medium","high","xhigh"],history:h01,detectAccount:($)=>dY($),createHookAdapter:()=>new v_,createTurnDetector:()=>new l_,capabilities:Xg,identity:Zg,terminalTitle:{ownsStatus:!0,launchArgs:["-c",'tui.terminal_title=["activity","thread-title"]']}},copilot:{vendor:"copilot",builtin:!0,displayName:"Copilot",defaultCommand:["copilot"],history:u01,detectAccount:($)=>lY($),createHookAdapter:()=>new wB("copilot"),createTurnDetector:()=>new SB("copilot")},kimi:{vendor:"kimi",builtin:!0,displayName:"Kimi",defaultCommand:["kimi"],history:xg,detectAccount:($)=>oN($),createHookAdapter:()=>new wB("kimi"),createTurnDetector:()=>new SB("kimi")}}});function a_($){return L5($).createHookAdapter()}class wB{vendor;constructor($){this.vendor=$}supportsHooks(){return!1}globalSettingsPath(){return""}activityDetailFromPayload(){return}sessionFromPayload(){return}async installActivityHooks(){}async removeActivityHooks(){}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(){}async installWorktreeWatchHook(){}async removeWorktreeWatchHook(){}}var o_=s(()=>{t7()});function zF($){return d01.includes($)}var d01;var r_=s(()=>{d01=["session-start","turn-start","turn-complete","turn-failed","awaiting-input","session-end"]});var ng={};i2(ng,{runHookSubcommand:()=>r01,readTextWithTimeout:()=>mg,parseWorktreeRemovePath:()=>dg,parseWorktreeAddPath:()=>cg,ensureGlobalKobeHooks:()=>e_});import{homedir as l01}from"os";import{join as vg,resolve as s_}from"path";async function mg($,X=p01){let Z;try{return await Promise.race([$(),new Promise((z)=>{Z=setTimeout(()=>z(""),X)})])}finally{if(Z!==void 0)clearTimeout(Z)}}async function hg(){try{let $=await mg(()=>Bun.stdin.text());if(!$.trim())return{};let X=JSON.parse($);return X&&typeof X==="object"&&!Array.isArray(X)?X:{}}catch{return{}}}function n01($,X){for(let Z=0;Z<$.length;Z++){if($[Z]===X)return $[Z+1];if($[Z].startsWith(`${X}=`))return $[Z].slice(X.length+1)}return}function o01($){return!!$&&typeof $==="object"&&!Array.isArray($)}function ug($){let X=[],Z=/"([^"]*)"|'([^']*)'|(\S+)/g,z;while((z=Z.exec($))!==null)X.push(z[1]??z[2]??z[3]??"");return X}function cg($){let X=ug($),Z=new Set(["-b","-B","--reason"]);for(let z=0;z+1<X.length;z++){if(X[z]!=="worktree"||X[z+1]!=="add")continue;let Q=z+2;while(Q<X.length){let Y=X[Q];if(Y==="&&"||Y==="||"||Y===";"||Y==="|"||Y===">"||Y===">>")break;if(Y.startsWith("-")){Q+=Z.has(Y)?2:1;continue}return Y}}return}function dg($){let X=ug($);for(let Z=0;Z+1<X.length;Z++){if(X[Z]!=="worktree"||X[Z+1]!=="remove")continue;let z=Z+2;while(z<X.length){let Q=X[z];if(Q==="&&"||Q==="||"||Q===";"||Q==="|"||Q===">"||Q===">>")break;if(Q.startsWith("-")){z+=1;continue}return Q}}return}async function a01(){let $=await hg(),X=o01($.tool_input)?$.tool_input:{},Z=typeof X.command==="string"?X.command:"";if(!Z.includes("worktree"))return;let z=typeof $.cwd==="string"&&$.cwd?$.cwd:process.cwd(),Q=cg(Z),Y=Q?void 0:dg(Z);if(!Q&&!Y)return;let q=await hZ();if(!q)return;try{if(Q)await q.request("worktree.reconcile",{cwd:z,worktreePath:s_(z,Q)});else if(Y)await q.request("worktree.archiveRemoved",{worktreePath:s_(z,Y)})}finally{q.close()}}async function r01($){let[X,...Z]=$;if(X==="setup"){await e01(Z);return}if(X===i01){try{await a01()}catch{}return}try{if(!X||!zF(X))return;let z=await hg(),Q=n01(Z,"--task-id"),Y=typeof z.cwd==="string"&&z.cwd?z.cwd:process.cwd(),q=process.env.KOBE_TASK_ID,W=process.env.KOBE_TAB_ID,U;for(let j of t_())if(U=j.activityDetailFromPayload(X,z),U)break;let M;for(let j of t_())if(M=j.sessionFromPayload(z),M)break;let L=await hZ();if(!L)return;try{let j=Q??q;await L.request("engine.reportEvent",{...j?{taskId:j}:{cwd:Y},kind:X,...W?{tabId:W}:{},...U?{detail:U}:{},...M?{sessionId:M.sessionId}:{},...M?.transcriptPath?{transcriptPath:M.transcriptPath}:{}})}finally{L.close()}}catch{}}function s01(){return n7.map(($)=>a_($)).filter(($)=>$.supportsWorktreeSync())}function t_(){return n7.map(($)=>a_($)).filter(($)=>$.supportsHooks())}function lg(){return vg(l01(),".claude","settings.json")}function t01($){if(!$||$==="off")return;if($==="global")return lg();if($.startsWith("repo:"))return vg(s_($.slice(5)),".claude","settings.json");return $}async function e_(){try{for(let $ of t_()){let X=$.globalSettingsPath();if(!X)continue;await $.installActivityHooks(X),await $.installWorktreeWatchHook(X)}await pg()}catch{}}async function pg(){let $=s01();if($.length===0)return;let X=_8(bg),Z=new Set([lg()]),z=t01(X);if(z)Z.add(z);for(let Q of $)for(let Y of Z)await Q.removeWorktreeSyncHook(Y);if(X!=="off")K$(bg,"off")}async function e01($){await pg(),process.stdout.write(["kobe hook setup is deprecated and now a no-op (cleanup only).","","The old external-worktree sync used a global WorktreeCreate hook, which is","a VCS provider hook \u2014 its presence broke `claude --worktree` / EnterWorktree","in every repo. Any hook kobe previously installed has been removed.","","Sync is now automatic: a `claude --worktree` (or any session) started in a","worktree under a repo kobe already tracks is adopted as a task on launch.","To adopt existing worktrees on demand, use the New Task dialog or `kobe adopt`.",""].join(`
|
|
42
|
-
`))}var p01=500,i01="worktree-created",bg="externalWorktreeSync";var $V=s(()=>{r7();o_();r_();b5();A8()});var QF;var ig=s(()=>{QF={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/kobe",version:"0.8.
|
|
42
|
+
`))}var p01=500,i01="worktree-created",bg="externalWorktreeSync";var $V=s(()=>{r7();o_();r_();b5();A8()});var QF;var ig=s(()=>{QF={$schema:"https://json.schemastore.org/package.json",name:"@sma1lboy/kobe",version:"0.8.14",description:"TUI orchestrator for Claude Code (codename)",type:"module",packageManager:"bun@1.3.13",bin:{kobe:"dist/cli/index.js"},files:["dist/cli","dist/web-ui","dist/*.wav","README.md","LICENSE"],publishConfig:{access:"public"},repository:{type:"git",url:"git+https://github.com/Sma1lboy/kobe.git"},homepage:"https://github.com/Sma1lboy/kobe#readme",bugs:{url:"https://github.com/Sma1lboy/kobe/issues"},engines:{bun:">=1.3.11"},scripts:{dev:"env KOBE_DEV=1 bun --conditions=browser ./src/cli/index.ts","dev:mock":"env KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react":"env KOBE_DEV=1 bun ./src/tui-react/mock/host.tsx","dev:mock-react-task-dialogs":"env KOBE_DEV=1 bun ./src/tui-react/component/mock-dialogs-host.tsx","dev:mock-react-filetree":"env KOBE_DEV=1 bun ./src/tui-react/panes/filetree/mock-host.tsx","dev:mock-react-sidebar":"env KOBE_DEV=1 bun ./src/tui-react/panes/sidebar/mock-host.tsx","dev:mock-react-terminal":"env KOBE_DEV=1 bun ./src/tui-react/panes/terminal/mock-host.tsx","dev:mock-react-dialogs":"env KOBE_DEV=1 bun ./src/tui-react/mock/dialogs-host.tsx","dev:mock-react-workspace":"env 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 --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.0",ws:"^8.18.0"},devDependencies:{"@biomejs/biome":"1.9.4","@sma1lboy/kobe-daemon":"0.7.11","@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 ag={};i2(ag,{repoSlug:()=>cG,releasePageUrl:()=>QV,recommendedGlobalInstallCommand:()=>JV,isNewerSemver:()=>XV,fetchReleaseSummaries:()=>gB,fetchReleaseNotesRange:()=>zV,fetchReleaseNotes:()=>GV,compareSemver:()=>Y6,checkLatestVersion:()=>dG,breakingVersionsCrossed:()=>EB,UPDATE_SCRIPT_URL:()=>YF,UPDATE_COMMAND:()=>$9,PACKAGE_NAME:()=>ZV,CURRENT_VERSION:()=>_2,BREAKING_VERSIONS:()=>NX});function cG(){let $=QF.repository?.url;if(!$)return null;let X=$.match(/github\.com[:/]([^/]+)\/([^/.]+)/);if(!X||!X[1]||!X[2])return null;return`${X[1]}/${X[2]}`}function JV(){return`npm install -g ${ZV}@latest`}function EB($,X,Z=NX){let[z,Q]=Y6($,X)<=0?[$,X]:[X,$];return Z.filter((Y)=>Y6(Y,z)>0&&Y6(Y,Q)<=0)}async function X21($){let X=new AbortController,Z=setTimeout(()=>X.abort(),HF);try{let z=$.replace("/","%2F"),Q=await fetch(`https://registry.npmjs.org/${z}/latest`,{signal:X.signal,headers:{accept:"application/json"}});if(!Q.ok)return null;let Y=await Q.json();if(typeof Y.version!=="string")return null;return Y.version}catch{return null}finally{clearTimeout(Z)}}function XV($,X){return Y6($,X)>0}function Y6($,X){let Z=(Y)=>Y.split("-")[0]??Y,z=Z($).split(".").map((Y)=>Number.parseInt(Y,10)),Q=Z(X).split(".").map((Y)=>Number.parseInt(Y,10));for(let Y=0;Y<3;Y++){let q=z[Y]??0,W=Q[Y]??0;if(Number.isNaN(q)||Number.isNaN(W))return 0;if(q>W)return 1;if(q<W)return-1}return 0}async function dG($={}){let X=process.env.KOBE_FAKE_UPDATE;if(X)return{current:_2,latest:X,hasUpdate:XV(X,_2)};if(_Y()&&!$.force)return null;let Z=await X21(ZV);if(!Z)return null;return{current:_2,latest:Z,hasUpdate:XV(Z,_2)}}function og($){if(typeof $!=="string")return null;return $.match(/^v(\d+\.\d+\.\d+)$/)?.[1]??null}async function GV($){let X=cG();if(!X)return null;let Z=`v${$}`,z=new AbortController,Q=setTimeout(()=>z.abort(),HF);try{let Y=await fetch(`https://api.github.com/repos/${X}/releases/tags/${Z}`,{signal:z.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!Y.ok)return null;let q=await Y.json();if(typeof q.body!=="string"||typeof q.html_url!=="string")return null;return{body:q.body,url:q.html_url,version:$}}catch{return null}finally{clearTimeout(Q)}}async function zV($){let X=cG();if(!X)return[];let Z=$.limit??100,z=new AbortController,Q=setTimeout(()=>z.abort(),HF);try{let Y=await fetch(`https://api.github.com/repos/${X}/releases?per_page=${Z}`,{signal:z.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!Y.ok)return[];let q=await Y.json();if(!Array.isArray(q))return[];return q.map((W)=>{let U=og(W.tag_name);if(!U||typeof W.html_url!=="string"||typeof W.body!=="string")return null;if(Y6(U,$.current)<=0)return null;if(Y6(U,$.latest)>0)return null;return{version:U,url:W.html_url,body:W.body}}).filter((W)=>W!==null)}catch{return[]}finally{clearTimeout(Q)}}async function gB($=12){let X=cG();if(!X)return[];let Z=new AbortController,z=setTimeout(()=>Z.abort(),HF);try{let Q=await fetch(`https://api.github.com/repos/${X}/releases?per_page=${$}`,{signal:Z.signal,headers:{accept:"application/vnd.github+json","x-github-api-version":"2022-11-28"}});if(!Q.ok)return[];let Y=await Q.json();if(!Array.isArray(Y))return[];return Y.map((q)=>{let W=og(q.tag_name);if(!W||typeof q.html_url!=="string")return null;return{version:W,url:q.html_url}}).filter((q)=>q!==null)}catch{return[]}finally{clearTimeout(z)}}function QV($){let X=cG();if(!X)return null;return`https://github.com/${X}/releases/tag/v${$}`}var _2,ZV,YF="https://raw.githubusercontent.com/Sma1lboy/kobe/main/scripts/update.sh",$9,NX,HF=3000;var f3=s(()=>{ig();R4();_2=QF.version,ZV=QF.name;$9=`curl -fsSL ${YF} | sh`;NX=[]});var sg={};i2(sg,{stampResetGate:()=>WF,resetGateBlockers:()=>rg,enforceResetGate:()=>HV,LAST_RUN_VERSION_KEY:()=>YV});function rg($,X=_2,Z=NX){if(typeof $!=="string"||$.length===0)return[];let[z,Q]=Y6($,X)<=0?[$,X]:[X,$];return Z.filter((Y)=>Y6(Y,z)>0&&Y6(Y,Q)<=0)}function HV(){let $=H4()[YV],X=rg($);if(X.length>0){let Z=typeof $==="string"?$:"unknown";console.error([`kobe ${_2}: cannot start \u2014 version ${X.join(", ")} introduced breaking changes`,`(last run: ${Z}). Your daemon/session state may be incompatible.`,"","Run:"," kobe reset # stop daemon + PTY host + sessions (tasks kept)"," kobe reset --hard # additionally wipe the task index + UI state","","Then relaunch kobe. Worktrees are never touched."].join(`
|
|
43
43
|
`)),process.exit(1)}if($!==_2)WF()}function WF(){try{U$({[YV]:_2})}catch{}}var YV="app.lastRunVersion";var qF=s(()=>{s7();f3()});import{existsSync as Z21,readFileSync as J21}from"fs";import{homedir as G21}from"os";import{join as tg}from"path";function BF($={}){return["skills","add",z21,"--skill","kobe","--agent",$.agent??fB]}function lG($={}){return`npx ${BF($).join(" ")}`}async function BV($=fB){return await Bun.spawn(["npx",...BF({agent:$})],{stdin:"inherit",stdout:"inherit",stderr:"inherit"}).exited}function UV($={}){let X=$.home??G21(),Z=$.cwd??process.cwd();return[tg(X,eg),tg(Z,eg)]}function Q21($){let X=$.match(/kobe-skill-version:\s*(\d+)/);return X?Number.parseInt(X[1],10):null}function xB($){let X=UV($).find((Q)=>Z21(Q));if(!X)return{installed:!1,installedVersion:null,currentVersion:WV,stale:!1};let Z=null;try{Z=Q21(J21(X,"utf8"))}catch{Z=null}let z=Z===null||Z<WV;return{installed:!0,installedVersion:Z,currentVersion:WV,stale:z}}function Y21(){return new Promise(($)=>{process.stdin.resume(),process.stdin.once("data",(X)=>{process.stdin.pause(),$(String(X))})})}async function $f($={}){let X=xB();if(!X.installed){if(_8(qV)==="1")return;K$(qV,"1"),process.stderr.write(`
|
|
44
44
|
kobe: the kobe agent skill isn't installed \u2014 install it so your coding agent can drive kobe via \`kobe api\`:
|
|
45
45
|
${oY}
|
|
@@ -421,7 +421,7 @@ ${y.join(`
|
|
|
421
421
|
... and ${i.length-r} more leaking disposables
|
|
422
422
|
|
|
423
423
|
`),{leaks:i,details:F1}}}function A(r){return T?.trackDisposable(r),r}function b(r){T?.markAsDisposed(r)}function R(r,H1){T?.setParent(r,H1)}function S(r){return typeof r=="object"&&r!==null&&typeof r.dispose=="function"&&r.dispose.length===0}function I(r){if(V.Iterable.is(r)){let H1=[];for(let i of r)if(i)try{i.dispose()}catch($1){H1.push($1)}if(H1.length===1)throw H1[0];if(H1.length>1)throw AggregateError(H1,"Encountered errors while disposing of store");return Array.isArray(r)?[]:r}if(r)return r.dispose(),r}function k(r){let H1=A({dispose:(0,F.createSingleCallFunction)(()=>{b(H1),r()})});return H1}W.DisposableTracker=D;class v{static{this.DISABLE_DISPOSED_WARNING=!1}constructor(){this._toDispose=new Set,this._isDisposed=!1,A(this)}dispose(){this._isDisposed||(b(this),this._isDisposed=!0,this.clear())}get isDisposed(){return this._isDisposed}clear(){if(this._toDispose.size!==0)try{I(this._toDispose)}finally{this._toDispose.clear()}}add(r){if(!r)return r;if(r===this)throw Error("Cannot register a disposable on itself!");return R(r,this),this._isDisposed?v.DISABLE_DISPOSED_WARNING||console.warn(Error("Trying to add a disposable to a DisposableStore that has already been disposed of. The added object will be leaked!").stack):this._toDispose.add(r),r}delete(r){if(r){if(r===this)throw Error("Cannot dispose a disposable on itself!");this._toDispose.delete(r),r.dispose()}}deleteAndLeak(r){r&&this._toDispose.has(r)&&(this._toDispose.delete(r),R(r,null))}}W.DisposableStore=v;class l{static{this.None=Object.freeze({dispose(){}})}constructor(){this._store=new v,A(this),R(this._store,this)}dispose(){b(this),this._store.dispose()}_register(r){if(r===this)throw Error("Cannot register a disposable on itself!");return this._store.add(r)}}W.Disposable=l;class o{constructor(){this._isDisposed=!1,A(this)}get value(){return this._isDisposed?void 0:this._value}set value(r){this._isDisposed||r===this._value||(this._value?.dispose(),r&&R(r,this),this._value=r)}clear(){this.value=void 0}dispose(){this._isDisposed=!0,b(this),this._value?.dispose(),this._value=void 0}clearAndLeak(){let r=this._value;return this._value=void 0,r&&R(r,null),r}}W.MutableDisposable=o,W.MandatoryMutableDisposable=class{constructor(r){this._disposable=new o,this._isDisposed=!1,this._disposable.value=r}get value(){return this._disposable.value}set value(r){this._isDisposed||r===this._disposable.value||(this._disposable.value=r)}dispose(){this._isDisposed=!0,this._disposable.dispose()}},W.RefCountedDisposable=class{constructor(r){this._disposable=r,this._counter=1}acquire(){return this._counter++,this}release(){return--this._counter==0&&this._disposable.dispose(),this}},W.SafeDisposable=class{constructor(){this.dispose=()=>{},this.unset=()=>{},this.isset=()=>!1,A(this)}set(r){let H1=r;return this.unset=()=>H1=void 0,this.isset=()=>H1!==void 0,this.dispose=()=>{H1&&(H1(),H1=void 0,b(this))},this}},W.ReferenceCollection=class{constructor(){this.references=new Map}acquire(r,...H1){let i=this.references.get(r);i||(i={counter:0,object:this.createReferencedObject(r,...H1)},this.references.set(r,i));let{object:$1}=i,O1=(0,F.createSingleCallFunction)(()=>{--i.counter==0&&(this.destroyReferencedObject(r,i.object),this.references.delete(r))});return i.counter++,{object:$1,dispose:O1}}},W.AsyncReferenceCollection=class{constructor(r){this.referenceCollection=r}async acquire(r,...H1){let i=this.referenceCollection.acquire(r,...H1);try{return{object:await i.object,dispose:()=>i.dispose()}}catch($1){throw i.dispose(),$1}}},W.ImmortalReference=class{constructor(r){this.object=r}dispose(){}};class W1{constructor(){this._store=new Map,this._isDisposed=!1,A(this)}dispose(){b(this),this._isDisposed=!0,this.clearAndDisposeAll()}clearAndDisposeAll(){if(this._store.size)try{I(this._store.values())}finally{this._store.clear()}}has(r){return this._store.has(r)}get size(){return this._store.size}get(r){return this._store.get(r)}set(r,H1,i=!1){this._isDisposed&&console.warn(Error("Trying to add a disposable to a DisposableMap that has already been disposed of. The added object will be leaked!").stack),i||this._store.get(r)?.dispose(),this._store.set(r,H1)}deleteAndDispose(r){this._store.get(r)?.dispose(),this._store.delete(r)}deleteAndLeak(r){let H1=this._store.get(r);return this._store.delete(r),H1}keys(){return this._store.keys()}values(){return this._store.values()}[Symbol.iterator](){return this._store[Symbol.iterator]()}}W.DisposableMap=W1},6317:(q,W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.LinkedList=void 0;class U{static{this.Undefined=new U(void 0)}constructor(L){this.element=L,this.next=U.Undefined,this.prev=U.Undefined}}class M{constructor(){this._first=U.Undefined,this._last=U.Undefined,this._size=0}get size(){return this._size}isEmpty(){return this._first===U.Undefined}clear(){let L=this._first;for(;L!==U.Undefined;){let j=L.next;L.prev=U.Undefined,L.next=U.Undefined,L=j}this._first=U.Undefined,this._last=U.Undefined,this._size=0}unshift(L){return this._insert(L,!1)}push(L){return this._insert(L,!0)}_insert(L,j){let F=new U(L);if(this._first===U.Undefined)this._first=F,this._last=F;else if(j){let T=this._last;this._last=F,F.prev=T,T.next=F}else{let T=this._first;this._first=F,F.next=T,T.prev=F}this._size+=1;let V=!1;return()=>{V||(V=!0,this._remove(F))}}shift(){if(this._first!==U.Undefined){let L=this._first.element;return this._remove(this._first),L}}pop(){if(this._last!==U.Undefined){let L=this._last.element;return this._remove(this._last),L}}_remove(L){if(L.prev!==U.Undefined&&L.next!==U.Undefined){let j=L.prev;j.next=L.next,L.next.prev=j}else L.prev===U.Undefined&&L.next===U.Undefined?(this._first=U.Undefined,this._last=U.Undefined):L.next===U.Undefined?(this._last=this._last.prev,this._last.next=U.Undefined):L.prev===U.Undefined&&(this._first=this._first.next,this._first.prev=U.Undefined);this._size-=1}*[Symbol.iterator](){let L=this._first;for(;L!==U.Undefined;)yield L.element,L=L.next}}W.LinkedList=M},2608:(q,W)=>{var U;Object.defineProperty(W,"__esModule",{value:!0}),W.SetMap=W.BidirectionalMap=W.CounterSet=W.Touch=void 0,W.getOrSet=function(M,L,j){let F=M.get(L);return F===void 0&&(F=j,M.set(L,F)),F},W.mapToString=function(M){let L=[];return M.forEach((j,F)=>{L.push(`${F} => ${j}`)}),`Map(${M.size}) {${L.join(", ")}}`},W.setToString=function(M){let L=[];return M.forEach((j)=>{L.push(j)}),`Set(${M.size}) {${L.join(", ")}}`},W.mapsStrictEqualIgnoreOrder=function(M,L){if(M===L)return!0;if(M.size!==L.size)return!1;for(let[j,F]of M)if(!L.has(j)||L.get(j)!==F)return!1;for(let[j]of L)if(!M.has(j))return!1;return!0},function(M){M[M.None=0]="None",M[M.AsOld=1]="AsOld",M[M.AsNew=2]="AsNew"}(U||(W.Touch=U={})),W.CounterSet=class{constructor(){this.map=new Map}add(M){return this.map.set(M,(this.map.get(M)||0)+1),this}delete(M){let L=this.map.get(M)||0;return L!==0&&(L--,L===0?this.map.delete(M):this.map.set(M,L),!0)}has(M){return this.map.has(M)}},W.BidirectionalMap=class{constructor(M){if(this._m1=new Map,this._m2=new Map,M)for(let[L,j]of M)this.set(L,j)}clear(){this._m1.clear(),this._m2.clear()}set(M,L){this._m1.set(M,L),this._m2.set(L,M)}get(M){return this._m1.get(M)}getKey(M){return this._m2.get(M)}delete(M){let L=this._m1.get(M);return L!==void 0&&(this._m1.delete(M),this._m2.delete(L),!0)}forEach(M,L){this._m1.forEach((j,F)=>{M.call(L,j,F,this)})}keys(){return this._m1.keys()}values(){return this._m1.values()}},W.SetMap=class{constructor(){this.map=new Map}add(M,L){let j=this.map.get(M);j||(j=new Set,this.map.set(M,j)),j.add(L)}delete(M,L){let j=this.map.get(M);j&&(j.delete(L),j.size===0&&this.map.delete(M))}forEach(M,L){let j=this.map.get(M);j&&j.forEach(L)}get(M){return this.map.get(M)||new Set}}},9725:(q,W)=>{Object.defineProperty(W,"__esModule",{value:!0}),W.StopWatch=void 0;let U=globalThis.performance&&typeof globalThis.performance.now=="function";class M{static create(L){return new M(L)}constructor(L){this._now=U&&L===!1?Date.now:globalThis.performance.now.bind(globalThis.performance),this._startTime=this._now(),this._stopTime=-1}stop(){this._stopTime=this._now()}reset(){this._startTime=this._now(),this._stopTime=-1}elapsed(){return this._stopTime!==-1?this._stopTime-this._startTime:this._now()-this._startTime}}W.StopWatch=M}},X={};function Z(q){var W=X[q];if(W!==void 0)return W.exports;var U=X[q]={exports:{}};return $[q].call(U.exports,U,U.exports,Z),U.exports}var z={};(()=>{var q=z;Object.defineProperty(q,"__esModule",{value:!0}),q.Terminal=void 0;let W=Z(5101),U=Z(6097),M=Z(4335),L=Z(5856),j=Z(3027),F=Z(7150),V=["cols","rows"];class T extends F.Disposable{constructor(D){super(),this._core=this._register(new L.Terminal(D)),this._addonManager=this._register(new j.AddonManager),this._publicOptions={...this._core.options};let A=(R)=>this._core.options[R],b=(R,S)=>{this._checkReadonlyOptions(R),this._core.options[R]=S};for(let R in this._core.options){Object.defineProperty(this._publicOptions,R,{get:()=>this._core.options[R],set:(I)=>{this._checkReadonlyOptions(R),this._core.options[R]=I}});let S={get:A.bind(this,R),set:b.bind(this,R)};Object.defineProperty(this._publicOptions,R,S)}}_checkReadonlyOptions(D){if(V.includes(D))throw Error(`Option "${D}" can only be set in the constructor`)}_checkProposedApi(){if(!this._core.optionsService.options.allowProposedApi)throw Error("You must set the allowProposedApi option to true to use proposed API")}get onBell(){return this._core.onBell}get onBinary(){return this._core.onBinary}get onCursorMove(){return this._core.onCursorMove}get onData(){return this._core.onData}get onLineFeed(){return this._core.onLineFeed}get onResize(){return this._core.onResize}get onScroll(){return this._core.onScroll}get onTitleChange(){return this._core.onTitleChange}get onWriteParsed(){return this._core.onWriteParsed}get parser(){return this._checkProposedApi(),this._parser||(this._parser=new U.ParserApi(this._core)),this._parser}get unicode(){return this._checkProposedApi(),new M.UnicodeApi(this._core)}get rows(){return this._core.rows}get cols(){return this._core.cols}get buffer(){return this._checkProposedApi(),this._buffer||(this._buffer=this._register(new W.BufferNamespaceApi(this._core))),this._buffer}get markers(){return this._checkProposedApi(),this._core.markers}get modes(){let D=this._core.coreService.decPrivateModes,A="none";switch(this._core.coreMouseService.activeProtocol){case"X10":A="x10";break;case"VT200":A="vt200";break;case"DRAG":A="drag";break;case"ANY":A="any"}return{applicationCursorKeysMode:D.applicationCursorKeys,applicationKeypadMode:D.applicationKeypad,bracketedPasteMode:D.bracketedPasteMode,insertMode:this._core.coreService.modes.insertMode,mouseTrackingMode:A,originMode:D.origin,reverseWraparoundMode:D.reverseWraparound,sendFocusMode:D.sendFocus,synchronizedOutputMode:D.synchronizedOutput,wraparoundMode:D.wraparound}}get options(){return this._publicOptions}set options(D){for(let A in D)this._publicOptions[A]=D[A]}input(D,A=!0){this._core.input(D,A)}resize(D,A){this._verifyIntegers(D,A),this._core.resize(D,A)}registerMarker(D=0){return this._checkProposedApi(),this._verifyIntegers(D),this._core.addMarker(D)}addMarker(D){return this.registerMarker(D)}dispose(){super.dispose()}scrollLines(D){this._verifyIntegers(D),this._core.scrollLines(D)}scrollPages(D){this._verifyIntegers(D),this._core.scrollPages(D)}scrollToTop(){this._core.scrollToTop()}scrollToBottom(){this._core.scrollToBottom()}scrollToLine(D){this._verifyIntegers(D),this._core.scrollToLine(D)}clear(){this._core.clear()}write(D,A){this._core.write(D,A)}writeln(D,A){this._core.write(D),this._core.write(`\r
|
|
424
|
-
`,A)}reset(){this._core.reset()}loadAddon(D){this._addonManager.loadAddon(this,D)}_verifyIntegers(...D){for(let A of D)if(A===1/0||isNaN(A)||A%1!=0)throw Error("This API only accepts integers")}}q.Terminal=T})();var Q=Vk;for(var Y in z)Q[Y]=z[Y];z.__esModule&&Object.defineProperty(Q,"__esModule",{value:!0})})()});function dF($){let X=typeof $==="number"?Math.floor($):typeof $==="string"?Number.parseInt($.trim(),10):Number.NaN;if(!Number.isFinite(X))return cF;return Math.min(T41,Math.max(I41,X))}function Pk(){return dF(H4()[uF])}var uF="terminal.scrollbackRows",cF=1000,I41=100,T41=1e5;var GD=s(()=>{s7()});var Ik;var Tk=s(()=>{Ik=[{id:"chat.send",scope:"workspace",keys:[],category:"Workspace",description:"Send message (composer)",hint:{keys:"enter"}},{id:"chat.newline",scope:"workspace",keys:[],category:"Workspace",description:"Newline in composer",hint:{keys:"shift+enter"}},{id:"chat.cycle-mode",scope:"workspace",keys:[],category:"Workspace",description:"Cycle permission mode (composer)",hint:{keys:"shift+tab"}},{id:"chat.steer",scope:"workspace",keys:[],category:"Workspace",description:"Steer (interrupt + send) \u2014 mid-stream only",hint:{keys:"ctrl+enter"}},{id:"chat.tab.new",scope:"workspace",keys:["ctrl+t"],category:"Workspace",description:"New chat tab",hint:{keys:"ctrl+t"}},{id:"chat.tab.chooseEngine",scope:"workspace",keys:["ctrl+e"],category:"Workspace",description:"New tab with a chosen engine or a plain shell",hint:{keys:"ctrl+e"}},{id:"chat.fork.new",scope:"workspace",keys:[],prefixKeys:["f"],category:"Workspace",description:"Quick-fork: create child task seeded with current repo/branch/model",hint:{keys:"ctrl+f"}},{id:"chat.session.resume",scope:"workspace",keys:[],prefixKeys:["y"],category:"Workspace",description:"Resume a prior session in this task's worktree",hint:{keys:"ctrl+y"}},{id:"chat.tab.close",scope:"workspace",keys:["ctrl+w"],category:"Workspace",description:"Close chat tab",hint:{keys:"ctrl+w"}},{id:"chat.tab.rename",scope:"workspace",keys:["f2"],category:"Workspace",description:"Rename active chat tab",hint:{keys:"f2"}},{id:"chat.tab.cycle-next",scope:"workspace",keys:["ctrl+]"],category:"Workspace",description:"Next chat tab",hint:{keys:"ctrl+]"}},{id:"chat.tab.cycle-prev",scope:"workspace",keys:["ctrl+["],category:"Workspace",description:"Previous chat tab",hint:{keys:"ctrl+["}},{id:"workspace.split.right",scope:"workspace",keys:[],prefixKeys:["\\"],category:"Workspace",description:"Split right",hint:{keys:"ctrl+\\"}},{id:"workspace.split.down",scope:"workspace",keys:[],prefixKeys:["="],category:"Workspace",description:"Split down",hint:{keys:"ctrl+="}},{id:"workspace.split.focus-next",scope:"workspace",keys:["f3"],category:"Workspace",description:"Focus next split",hint:{keys:"f3"}},{id:"workspace.split.close",scope:"workspace",keys:[],prefixKeys:["w"],category:"Workspace",description:"Close active split (tab when unsplit)",hint:{keys:"ctrl+w"}},{id:"workspace.split.rename",scope:"workspace",keys:["f2"],category:"Workspace",description:"Rename active split (tab when unsplit)",hint:{keys:"f2"}},{id:"chat.question.nav",scope:"workspace",keys:["j","k","down","up"],category:"Workspace",description:"Move highlight in question picker",hint:{keys:"j/k"}},{id:"chat.question.toggle",scope:"workspace",keys:["space"],category:"Workspace",description:"Toggle highlighted option in question picker",hint:{keys:"space"}},{id:"chat.question.submit",scope:"workspace",keys:["return"],category:"Workspace",description:"Advance / submit question picker",hint:{keys:"enter"}},{id:"chat.question.pick-number",scope:"workspace",keys:["1","2","3","4","5","6","7","8","9"],category:"Workspace",description:"Pick option by number in question picker",hint:{keys:"1-9"}}]});var Rk;var Sk=s(()=>{Rk=[{id:"files.nav",scope:"files",keys:["j","k","down","up"],category:"Files",description:"Move cursor up/down",hint:{keys:"j/k"}},{id:"files.hierarchy",scope:"files",keys:["h","l","left","right"],category:"Files",description:"Collapse / expand tree level",hint:{keys:"h/l"}},{id:"files.open",scope:"files",keys:["return"],category:"Files",description:"Open file in nvim (diff vs HEAD when changed)",hint:{keys:"enter"}},{id:"files.tab",scope:"files",keys:["[","]"],category:"Files",description:"Switch tab (cycle All / Changes)",hint:{keys:"[/]"}},{id:"files.refresh",scope:"files",keys:["r"],category:"Files",description:"Refresh",hint:{keys:"r"}},{id:"files.scope",scope:"files",keys:["b"],category:"Files",description:"Toggle Changes scope (working \u2194 branch vs base)",hint:{keys:"b"}},{id:"files.diff",scope:"files",keys:["d"],category:"Files",description:"Open read-only diff in a workspace tab",hint:{keys:"d"}},{id:"files.openExternal",scope:"files",keys:["o"],category:"Files",description:"Open file in system default app (audio / video / pdf preview)",hint:{keys:"o"}},{id:"files.mention",scope:"files",keys:["a"],category:"Files",description:"Inject @<path> mention into the engine pane",hint:{keys:"a"}},{id:"files.createPR",scope:"global",keys:[],prefixKeys:["p","shift+p"],category:"Files",description:"Create PR from the current task"}]});var wk;var Ek=s(()=>{wk=[{id:"inbox.show",scope:"global",keys:[],prefixKeys:["i"],category:"Global",description:"Open Inbox"},{id:"inbox.nav",scope:"inbox",keys:["j","k","down","up"],category:"Inbox",description:"Move cursor up/down",hint:{keys:"j/k"}},{id:"inbox.open",scope:"inbox",keys:["return"],category:"Inbox",description:"Open the selected Task and Terminal Tab",hint:{keys:"enter"}},{id:"inbox.delete",scope:"inbox",keys:["d"],category:"Inbox",description:"Remove the selected Inbox item",hint:{keys:"d"}}]});var gk;var fk=s(()=>{gk=[{id:"sidebar.nav",scope:"sidebar",keys:["j","k","down","up"],category:"Sidebar",description:"Move cursor up/down",hint:{keys:"j/k"}},{id:"sidebar.select",scope:"sidebar",keys:["return"],category:"Sidebar",description:"Open the selected task",hint:{keys:"enter"}},{id:"sidebar.goto",scope:"sidebar",keys:["g","shift+g"],category:"Sidebar",description:"Top / bottom of list (gg or shift-G)"},{id:"sidebar.rename",scope:"sidebar",keys:["r"],category:"Sidebar",description:"Rename task",hint:{keys:"r"}},{id:"sidebar.archive",scope:"sidebar",keys:["a"],category:"Sidebar",description:"Toggle archive",hint:{keys:"a"}},{id:"sidebar.localMerge",scope:"sidebar",keys:["shift+m"],category:"Sidebar",description:"Reorder task (Shift+M, then j/k)",hint:{keys:"M"}},{id:"sidebar.pin",scope:"sidebar",keys:["shift+p"],category:"Sidebar",description:"Pin / unpin task at top (Shift+P)",hint:{keys:"P"}},{id:"sidebar.previewToggle",scope:"sidebar",keys:["i"],category:"Sidebar",description:"Toggle live preview for task (i)",hint:{keys:"i"}},{id:"sidebar.view",scope:"sidebar",keys:["[","]"],category:"Sidebar",description:"Switch view (Working session \u2194 Archives)",hint:{keys:"[/]"}},{id:"sidebar.sort",scope:"sidebar",keys:["t"],category:"Sidebar",description:"Switch task sort (default \u2194 recent)",hint:{keys:"t"}},{id:"sidebar.projectFilter",scope:"sidebar",keys:["ctrl+p"],category:"Sidebar",description:"Cycle task project filter",hint:{keys:"ctrl+p"}},{id:"sidebar.delete",scope:"sidebar",keys:["d"],category:"Sidebar",description:"Delete task (with confirm)",hint:{keys:"d"}},{id:"sidebar.search.enter",scope:"sidebar",keys:["/"],category:"Sidebar",description:"Search tasks (fuzzy filter)",hint:{keys:"/"}},{id:"sidebar.search.nav",scope:"sidebar",keys:["down","up"],category:"Sidebar",description:"Move highlight in search results"},{id:"sidebar.search.submit",scope:"sidebar",keys:["return"],category:"Sidebar",description:"Select search match and exit search"},{id:"sidebar.search.cancel",scope:"sidebar",keys:["escape"],category:"Sidebar",description:"Cancel search (restore prior selection)"},{id:"tasks.openWorktree",scope:"sidebar",keys:["o"],category:"Tasks pane",description:"Open selected task's worktree in your editor",hint:{keys:"o"}},{id:"tasks.renameBranch",scope:"sidebar",keys:["b"],category:"Tasks pane",description:"Rename the selected task's git branch",hint:{keys:"b"}},{id:"tasks.cycleEngine",scope:"sidebar",keys:["v"],category:"Tasks pane",description:"Cycle engine vendor (claude \u2194 codex \u2194 \u2026) \u2014 applies on reopen",hint:{keys:"v"}},{id:"tasks.update",scope:"sidebar",keys:["u"],category:"Tasks pane",description:"Open the update page (when a new version is available)",hint:{keys:"u"}},{id:"tasks.focusEngine",scope:"sidebar",keys:["right"],category:"Tasks pane",description:"Focus the engine pane of the current window",hint:{keys:"\u2192"}},{id:"tasks.toggleKeys",scope:"sidebar",keys:["?"],category:"Tasks pane",description:"Collapse / expand the keys legend",hint:{keys:"?"}}]});var N$;var zD=s(()=>{Tk();Sk();Ek();fk();N$=[{id:"help.open",scope:"global",keys:["f1"],category:"Global",description:"Show keybindings help",hint:{keys:"F1"}},{id:"task.new",scope:"sidebar",keys:["n"],category:"Sidebar",description:"New task",hint:{keys:"n"}},{id:"task.openEditor",scope:"global",keys:[],prefixKeys:["o"],category:"Global",description:"Open active task worktree in editor"},{id:"task.moveMode",scope:"global",keys:[],prefixKeys:["m"],category:"Global",description:"Reorder tasks/projects (then j/k)"},{id:"settings.open",scope:"global",keys:[],prefixKeys:[","],category:"Global",description:"Open settings"},{id:"settings.open.sidebar",scope:"sidebar",keys:["s"],category:"Sidebar",description:"Open settings",hint:{keys:"s"}},{id:"worktrees.open.sidebar",scope:"sidebar",keys:["x"],category:"Sidebar",description:"Open worktrees",hint:{keys:"x"}},{id:"kanban.open.sidebar",scope:"sidebar",keys:["c"],category:"Sidebar",description:"Open kanban (issues board)",hint:{keys:"c"}},{id:"app.quit",scope:"sidebar",keys:["q","ctrl+q"],category:"Sidebar",description:"Quit (with confirm)",hint:{keys:"q"}},{id:"focus.sidebar",scope:"workspace",keys:["ctrl+q"],category:"Workspace",description:"Back to sidebar (tasks)",hint:{keys:"ctrl+q"}},{id:"focus.previous",scope:"global",keys:[],prefixKeys:["h"],category:"Navigation",description:"Focus previous pane (files \u2192 workspace \u2192 sidebar)"},{id:"focus.next",scope:"global",keys:["f4"],prefixKeys:["l"],category:"Navigation",description:"Focus next pane (sidebar \u2192 workspace \u2192 files)",hint:{keys:"f4"}},{id:"attention.next",scope:"global",keys:["f7"],category:"Navigation",description:"Jump to the next available Inbox item",hint:{keys:"f7"}},{id:"workspace.zenToggle",scope:"global",keys:[],prefixKeys:["z"],category:"Navigation",description:"Toggle zen mode (hide the files column)"},{id:"chat.interrupt",scope:"workspace",keys:[],category:"Workspace",description:"Interrupt current turn (esc while streaming)"},...gk,...Ik,...Rk,...wk,{id:"terminal.scroll-up",scope:"terminal",keys:["ctrl+pageup"],category:"Terminal",description:"Scroll scrollback up",hint:{keys:"ctrl+pgup"}},{id:"terminal.scroll-down",scope:"terminal",keys:["ctrl+pagedown"],category:"Terminal",description:"Scroll scrollback down"},{id:"terminal.reset",scope:"terminal",keys:["f5"],category:"Terminal",description:"Reset terminal \u2014 kill the current shell and respawn",hint:{keys:"f5"}},{id:"dialog.cancel",scope:"global",keys:[],category:"Dialog",description:"Close the top dialog (esc)"},{id:"dialog.newtask.tab.cycle",scope:"global",keys:[],category:"Dialog",description:"Switch New Task tab (Existing / New Repo)",hint:{keys:"ctrl+[/]"}}]});function L4($){let X=[];for(let Z in $){let z=$[Z];if(!z)continue;let Q=WH(Z),Y=Q?.keys??[],q=Q?.prefixKeys??[];if(Y.length===0&&q.length===0){console.warn(`[kobe/keybindings] bindByIds: id="${Z}" has no chords (or doesn't exist in KobeKeymap)`);continue}Y.forEach((W,U)=>X.push({key:W,cmd:z,slot:U,id:Z})),q.forEach((W,U)=>X.push({key:W,prefix:!0,cmd:z,slot:U,id:Z}))}return X}var xk=s(()=>{_X()});function yk($){return kk.get($)?.keys??[]}function YD(){for(let $ of N$){let X=kk.get($.id);if(!X)continue;let Z=$;Z.keys=[...X.keys],Z.prefixKeys=X.prefixKeys&&[...X.prefixKeys],Z.hint=X.hint?{...X.hint}:void 0}}function HD(){return bk}function WD($){return QD.add($),()=>{QD.delete($)}}function qD(){bk+=1;for(let $ of[...QD])$()}function WH($){return S41.get($)}var kk,bk=0,QD,S41;var _X=s(()=>{zD();zD();xk();kk=new Map(N$.map(($)=>[$.id,{keys:[...$.keys],prefixKeys:$.prefixKeys&&[...$.prefixKeys],hint:$.hint?{...$.hint}:void 0}]));QD=new Set;S41=new Map(N$.map(($)=>[$.id,$]))});function BD($){let X=$,Z=typeof X.sequence==="string"&&X.sequence.length>0?X.sequence:null,z=typeof X.raw==="string"&&vk.test(X.raw)||Z!=null&&vk.test(Z);if(Z!=null&&!z)return Z;if(Z!=null&&Z.length===1&&Z>=" "&&Z!=="\x7F"&&!$.ctrl&&!X.option&&!X.meta)return Z;return mk($)}function mk($){let X=$.name;if(!X)return null;if($.shift&&X==="tab")return"\x1B[Z";if($.option||$.meta){let Z=mk({...$,option:!1,meta:!1});return Z==null?null:`\x1B${Z}`}switch(X){case"return":case"enter":return"\r";case"tab":return"\t";case"backspace":return"\x7F";case"delete":return"\x1B[3~";case"up":return"\x1B[A";case"down":return"\x1B[B";case"right":return"\x1B[C";case"left":return"\x1B[D";case"home":return"\x1B[H";case"end":return"\x1B[F";case"escape":return"\x1B";case"space":return $.ctrl?"\x00":" ";default:if(X.length===1){if($.ctrl){let z=X.toLowerCase().charCodeAt(0);if(z>=97&&z<=122)return String.fromCharCode(z-96);let Q=w41[X];if(Q!=null)return Q;return null}if($.shift&&X>="a"&&X<="z")return X.toUpperCase();return X}return null}}function ck($,X,Z,z){if($.mouseTracking)return`\x1B[<${X==="up"?64:65};${Math.max(1,Z)};${Math.max(1,z)}M`;if($.alternateScreen)return($.applicationCursorKeys?X==="up"?"\x1BOA":"\x1BOB":X==="up"?"\x1B[A":"\x1B[B").repeat(3);return null}var vk,w41,hk=10,E41,g41,f41,x41,uk;var UD=s(()=>{_X();vk=/^\x1b\[[\d:;]*u$/,w41={"@":"\x00","[":"\x1B","\\":"\x1C","]":"\x1D","^":"\x1E",_:"\x1F","?":"\x7F"};E41=[{id:"focus.sidebar"},{id:"chat.tab.new"},{id:"chat.tab.close"},{id:"chat.tab.cycle-next"},{id:"chat.tab.cycle-prev"},{id:"chat.tab.rename"},"ctrl+e","ctrl+f","ctrl+\\","ctrl+=",{id:"workspace.split.focus-next"},{id:"focus.next"},{id:"terminal.reset"},{id:"attention.next"}],g41=[...new Set(E41.flatMap(($)=>typeof $==="string"?[$]:yk($.id)))],f41=[..."abcdefghijklmnopqrstuvwxyz".split(""),..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),..."0123456789".split(""),..." `~!@#$%^&*()-_=+[]{}\\|;:'\",.<>/?".split(""),"return","enter","space","tab","backspace","delete","up","down","left","right","home","end","pageup","pagedown","escape","insert","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12"],x41=["","ctrl+","alt+","shift+","ctrl+shift+","alt+shift+","ctrl+alt+"],uk=f41.flatMap(($)=>x41.map((X)=>`${X}${$}`)).filter(($)=>!g41.includes($))});class KD{data=new Set;exits=new Set;titles=new Set;get dataCount(){return this.data.size}addData($){return this.data.add($),()=>this.data.delete($)}addExit($){return this.exits.add($),()=>this.exits.delete($)}addTitle($){return this.titles.add($),()=>this.titles.delete($)}publishData($,X){for(let Z of this.data)try{Z($,X)}catch{}}publishTitle($){for(let X of this.titles)try{X($)}catch{}}drainExits(){let $=[...this.exits];return this.exits.clear(),$}clearData(){this.data.clear()}clearAll(){this.data.clear(),this.exits.clear(),this.titles.clear()}}function dk($,X){if($===X)return!0;return $!==void 0&&X!==void 0&&$[0]===X[0]&&$[1]===X[1]&&$[2]===X[2]}function k41($,X){return $.text===X.text&&($.attributes??0)===(X.attributes??0)&&dk($.fg,X.fg)&&dk($.bg,X.bg)}function y41($,X){if($===X)return!0;if($.length!==X.length)return!1;for(let Z=0;Z<$.length;Z++)if(!k41($[Z],X[Z]))return!1;return!0}function MD($,X){return $&&y41($,X)?$:X}function lk($,X){if($.length!==X.length)return X;let Z=!1;for(let z=0;z<X.length;z++){let Q=MD($[z],X[z]);if(X[z]=Q,Q!==$[z])Z=!0}return Z?X:$}function pk($,X){if($===X)return $;if($&&X&&$.x===X.x&&$.y===X.y)return $;return X}function VX($){if($<0)return[0,0,0];if($<16)return b41[$]??[0,0,0];if($<232){let X=$-16,Z=Math.floor(X/36),z=Math.floor(X/6%6),Q=X%6,Y=(q)=>q===0?0:55+40*q;return[Y(Z),Y(z),Y(Q)]}if($<256){let X=8+10*($-232);return[X,X,X]}return[0,0,0]}function v41($,X){let Z=X.length===0?[0]:X.map((W)=>W===""?0:Number.parseInt(W,10)||0),z=$.fg,Q=$.bg,Y=$.attributes,q=0;while(q<Z.length){let W=Z[q];if(W===void 0)break;if(W===0){z=void 0,Q=void 0,Y=0,q+=1;continue}if(W===1){Y|=Y5.BOLD,q+=1;continue}if(W===2){Y|=Y5.DIM,q+=1;continue}if(W===3){Y|=Y5.ITALIC,q+=1;continue}if(W===4){Y|=Y5.UNDERLINE,q+=1;continue}if(W===5||W===6){Y|=Y5.BLINK,q+=1;continue}if(W===7){Y|=Y5.INVERSE,q+=1;continue}if(W===8){Y|=Y5.HIDDEN,q+=1;continue}if(W===9){Y|=Y5.STRIKETHROUGH,q+=1;continue}if(W===22){Y&=~(Y5.BOLD|Y5.DIM),q+=1;continue}if(W===23){Y&=~Y5.ITALIC,q+=1;continue}if(W===24){Y&=~Y5.UNDERLINE,q+=1;continue}if(W===25){Y&=~Y5.BLINK,q+=1;continue}if(W===27){Y&=~Y5.INVERSE,q+=1;continue}if(W===28){Y&=~Y5.HIDDEN,q+=1;continue}if(W===29){Y&=~Y5.STRIKETHROUGH,q+=1;continue}if(W>=30&&W<=37){z=VX(W-30),q+=1;continue}if(W>=90&&W<=97){z=VX(W-90+8),q+=1;continue}if(W===39){z=void 0,q+=1;continue}if(W>=40&&W<=47){Q=VX(W-40),q+=1;continue}if(W>=100&&W<=107){Q=VX(W-100+8),q+=1;continue}if(W===49){Q=void 0,q+=1;continue}if(W===38){let U=Z[q+1];if(U===5){let M=Z[q+2]??0;z=VX(M),q+=3;continue}if(U===2){let M=Z[q+2]??0,L=Z[q+3]??0,j=Z[q+4]??0;z=[M,L,j],q+=5;continue}q+=1;continue}if(W===48){let U=Z[q+1];if(U===5){let M=Z[q+2]??0;Q=VX(M),q+=3;continue}if(U===2){let M=Z[q+2]??0,L=Z[q+3]??0,j=Z[q+4]??0;Q=[M,L,j],q+=5;continue}q+=1;continue}q+=1}return{fg:z,bg:Q,attributes:Y}}function m41($){let X=$;if(X.charCodeAt(0)===27)X=X.slice(2);else if(X.charCodeAt(0)===155)X=X.slice(1);if(X.endsWith("m"))X=X.slice(0,-1);return X.split(";")}function h41($,X=nk){if($.length===0)return{chunks:[],endStyle:X};let Z=[],z={...X},Q="",Y=()=>{if(Q.length===0)return;let W={text:Q,...z.fg?{fg:z.fg}:{},...z.bg?{bg:z.bg}:{},...z.attributes!==0?{attributes:z.attributes}:{}};Z.push(W),Q=""},q=lB($);for(let W of q){if(W.type==="TEXT"){Q+=W.raw;continue}if(W.type==="CSI"&&W.command==="m")Y(),z=v41(z,m41(W.raw))}return Y(),{chunks:Z,endStyle:z}}function lF($){let X=$.split(`
|
|
424
|
+
`,A)}reset(){this._core.reset()}loadAddon(D){this._addonManager.loadAddon(this,D)}_verifyIntegers(...D){for(let A of D)if(A===1/0||isNaN(A)||A%1!=0)throw Error("This API only accepts integers")}}q.Terminal=T})();var Q=Vk;for(var Y in z)Q[Y]=z[Y];z.__esModule&&Object.defineProperty(Q,"__esModule",{value:!0})})()});function dF($){let X=typeof $==="number"?Math.floor($):typeof $==="string"?Number.parseInt($.trim(),10):Number.NaN;if(!Number.isFinite(X))return cF;return Math.min(T41,Math.max(I41,X))}function Pk(){return dF(H4()[uF])}var uF="terminal.scrollbackRows",cF=1000,I41=100,T41=1e5;var GD=s(()=>{s7()});var Ik;var Tk=s(()=>{Ik=[{id:"chat.send",scope:"workspace",keys:[],category:"Workspace",description:"Send message (composer)",hint:{keys:"enter"}},{id:"chat.newline",scope:"workspace",keys:[],category:"Workspace",description:"Newline in composer",hint:{keys:"shift+enter"}},{id:"chat.cycle-mode",scope:"workspace",keys:[],category:"Workspace",description:"Cycle permission mode (composer)",hint:{keys:"shift+tab"}},{id:"chat.steer",scope:"workspace",keys:[],category:"Workspace",description:"Steer (interrupt + send) \u2014 mid-stream only",hint:{keys:"ctrl+enter"}},{id:"chat.tab.new",scope:"workspace",keys:["ctrl+t"],category:"Workspace",description:"New chat tab",hint:{keys:"ctrl+t"}},{id:"chat.tab.chooseEngine",scope:"workspace",keys:["ctrl+e"],category:"Workspace",description:"New tab with a chosen engine or a plain shell",hint:{keys:"ctrl+e"}},{id:"chat.fork.new",scope:"workspace",keys:[],prefixKeys:["f"],category:"Workspace",description:"Quick-fork: create child task seeded with current repo/branch/model",hint:{keys:"ctrl+f"}},{id:"chat.session.resume",scope:"workspace",keys:[],prefixKeys:["y"],category:"Workspace",description:"Resume a prior session in this task's worktree",hint:{keys:"ctrl+y"}},{id:"chat.tab.close",scope:"workspace",keys:["ctrl+w"],category:"Workspace",description:"Close chat tab",hint:{keys:"ctrl+w"}},{id:"chat.tab.rename",scope:"workspace",keys:["f2"],category:"Workspace",description:"Rename active chat tab",hint:{keys:"f2"}},{id:"chat.tab.cycle-next",scope:"workspace",keys:["ctrl+]"],category:"Workspace",description:"Next chat tab",hint:{keys:"ctrl+]"}},{id:"chat.tab.cycle-prev",scope:"workspace",keys:["ctrl+["],category:"Workspace",description:"Previous chat tab",hint:{keys:"ctrl+["}},{id:"workspace.split.right",scope:"workspace",keys:["ctrl+\\"],category:"Workspace",description:"Split right",hint:{keys:"ctrl+\\"}},{id:"workspace.split.down",scope:"workspace",keys:["ctrl+="],category:"Workspace",description:"Split down",hint:{keys:"ctrl+="}},{id:"workspace.split.focus-next",scope:"workspace",keys:["f3"],category:"Workspace",description:"Focus next split",hint:{keys:"f3"}},{id:"workspace.split.close",scope:"workspace",keys:[],prefixKeys:["w"],category:"Workspace",description:"Close active split (tab when unsplit)",hint:{keys:"ctrl+w"}},{id:"workspace.split.rename",scope:"workspace",keys:["f2"],category:"Workspace",description:"Rename active split (tab when unsplit)",hint:{keys:"f2"}},{id:"chat.question.nav",scope:"workspace",keys:["j","k","down","up"],category:"Workspace",description:"Move highlight in question picker",hint:{keys:"j/k"}},{id:"chat.question.toggle",scope:"workspace",keys:["space"],category:"Workspace",description:"Toggle highlighted option in question picker",hint:{keys:"space"}},{id:"chat.question.submit",scope:"workspace",keys:["return"],category:"Workspace",description:"Advance / submit question picker",hint:{keys:"enter"}},{id:"chat.question.pick-number",scope:"workspace",keys:["1","2","3","4","5","6","7","8","9"],category:"Workspace",description:"Pick option by number in question picker",hint:{keys:"1-9"}}]});var Rk;var Sk=s(()=>{Rk=[{id:"files.nav",scope:"files",keys:["j","k","down","up"],category:"Files",description:"Move cursor up/down",hint:{keys:"j/k"}},{id:"files.hierarchy",scope:"files",keys:["h","l","left","right"],category:"Files",description:"Collapse / expand tree level",hint:{keys:"h/l"}},{id:"files.open",scope:"files",keys:["return"],category:"Files",description:"Open file in nvim (diff vs HEAD when changed)",hint:{keys:"enter"}},{id:"files.tab",scope:"files",keys:["[","]"],category:"Files",description:"Switch tab (cycle All / Changes)",hint:{keys:"[/]"}},{id:"files.refresh",scope:"files",keys:["r"],category:"Files",description:"Refresh",hint:{keys:"r"}},{id:"files.scope",scope:"files",keys:["b"],category:"Files",description:"Toggle Changes scope (working \u2194 branch vs base)",hint:{keys:"b"}},{id:"files.diff",scope:"files",keys:["d"],category:"Files",description:"Open read-only diff in a workspace tab",hint:{keys:"d"}},{id:"files.openExternal",scope:"files",keys:["o"],category:"Files",description:"Open file in system default app (audio / video / pdf preview)",hint:{keys:"o"}},{id:"files.mention",scope:"files",keys:["a"],category:"Files",description:"Inject @<path> mention into the engine pane",hint:{keys:"a"}},{id:"files.createPR",scope:"global",keys:[],prefixKeys:["p","shift+p"],category:"Files",description:"Create PR from the current task"}]});var wk;var Ek=s(()=>{wk=[{id:"inbox.show",scope:"global",keys:[],prefixKeys:["i"],category:"Global",description:"Open Inbox"},{id:"inbox.nav",scope:"inbox",keys:["j","k","down","up"],category:"Inbox",description:"Move cursor up/down",hint:{keys:"j/k"}},{id:"inbox.open",scope:"inbox",keys:["return"],category:"Inbox",description:"Open the selected Task and Terminal Tab",hint:{keys:"enter"}},{id:"inbox.delete",scope:"inbox",keys:["d"],category:"Inbox",description:"Remove the selected Inbox item",hint:{keys:"d"}}]});var gk;var fk=s(()=>{gk=[{id:"sidebar.nav",scope:"sidebar",keys:["j","k","down","up"],category:"Sidebar",description:"Move cursor up/down",hint:{keys:"j/k"}},{id:"sidebar.select",scope:"sidebar",keys:["return"],category:"Sidebar",description:"Open the selected task",hint:{keys:"enter"}},{id:"sidebar.goto",scope:"sidebar",keys:["g","shift+g"],category:"Sidebar",description:"Top / bottom of list (gg or shift-G)"},{id:"sidebar.rename",scope:"sidebar",keys:["r"],category:"Sidebar",description:"Rename task",hint:{keys:"r"}},{id:"sidebar.archive",scope:"sidebar",keys:["a"],category:"Sidebar",description:"Toggle archive",hint:{keys:"a"}},{id:"sidebar.localMerge",scope:"sidebar",keys:["shift+m"],category:"Sidebar",description:"Reorder task (Shift+M, then j/k)",hint:{keys:"M"}},{id:"sidebar.pin",scope:"sidebar",keys:["shift+p"],category:"Sidebar",description:"Pin / unpin task at top (Shift+P)",hint:{keys:"P"}},{id:"sidebar.previewToggle",scope:"sidebar",keys:["i"],category:"Sidebar",description:"Toggle live preview for task (i)",hint:{keys:"i"}},{id:"sidebar.view",scope:"sidebar",keys:["[","]"],category:"Sidebar",description:"Switch view (Working session \u2194 Archives)",hint:{keys:"[/]"}},{id:"sidebar.sort",scope:"sidebar",keys:["t"],category:"Sidebar",description:"Switch task sort (default \u2194 recent)",hint:{keys:"t"}},{id:"sidebar.projectFilter",scope:"sidebar",keys:["ctrl+p"],category:"Sidebar",description:"Cycle task project filter",hint:{keys:"ctrl+p"}},{id:"sidebar.delete",scope:"sidebar",keys:["d"],category:"Sidebar",description:"Delete task (with confirm)",hint:{keys:"d"}},{id:"sidebar.search.enter",scope:"sidebar",keys:["/"],category:"Sidebar",description:"Search tasks (fuzzy filter)",hint:{keys:"/"}},{id:"sidebar.search.nav",scope:"sidebar",keys:["down","up"],category:"Sidebar",description:"Move highlight in search results"},{id:"sidebar.search.submit",scope:"sidebar",keys:["return"],category:"Sidebar",description:"Select search match and exit search"},{id:"sidebar.search.cancel",scope:"sidebar",keys:["escape"],category:"Sidebar",description:"Cancel search (restore prior selection)"},{id:"tasks.openWorktree",scope:"sidebar",keys:["o"],category:"Tasks pane",description:"Open selected task's worktree in your editor",hint:{keys:"o"}},{id:"tasks.renameBranch",scope:"sidebar",keys:["b"],category:"Tasks pane",description:"Rename the selected task's git branch",hint:{keys:"b"}},{id:"tasks.cycleEngine",scope:"sidebar",keys:["v"],category:"Tasks pane",description:"Cycle engine vendor (claude \u2194 codex \u2194 \u2026) \u2014 applies on reopen",hint:{keys:"v"}},{id:"tasks.update",scope:"sidebar",keys:["u"],category:"Tasks pane",description:"Open the update page (when a new version is available)",hint:{keys:"u"}},{id:"tasks.focusEngine",scope:"sidebar",keys:["right"],category:"Tasks pane",description:"Focus the engine pane of the current window",hint:{keys:"\u2192"}},{id:"tasks.toggleKeys",scope:"sidebar",keys:["?"],category:"Tasks pane",description:"Collapse / expand the keys legend",hint:{keys:"?"}}]});var N$;var zD=s(()=>{Tk();Sk();Ek();fk();N$=[{id:"help.open",scope:"global",keys:["f1"],category:"Global",description:"Show keybindings help",hint:{keys:"F1"}},{id:"task.new",scope:"sidebar",keys:["n"],category:"Sidebar",description:"New task",hint:{keys:"n"}},{id:"task.openEditor",scope:"global",keys:[],prefixKeys:["o"],category:"Global",description:"Open active task worktree in editor"},{id:"task.moveMode",scope:"global",keys:[],prefixKeys:["m"],category:"Global",description:"Reorder tasks/projects (then j/k)"},{id:"settings.open",scope:"global",keys:[],prefixKeys:[","],category:"Global",description:"Open settings"},{id:"settings.open.sidebar",scope:"sidebar",keys:["s"],category:"Sidebar",description:"Open settings",hint:{keys:"s"}},{id:"worktrees.open.sidebar",scope:"sidebar",keys:["x"],category:"Sidebar",description:"Open worktrees",hint:{keys:"x"}},{id:"kanban.open.sidebar",scope:"sidebar",keys:["c"],category:"Sidebar",description:"Open kanban (issues board)",hint:{keys:"c"}},{id:"app.quit",scope:"sidebar",keys:["q","ctrl+q"],category:"Sidebar",description:"Quit (with confirm)",hint:{keys:"q"}},{id:"focus.sidebar",scope:"workspace",keys:["ctrl+q"],category:"Workspace",description:"Back to sidebar (tasks)",hint:{keys:"ctrl+q"}},{id:"focus.previous",scope:"global",keys:[],prefixKeys:["h"],category:"Navigation",description:"Focus previous pane (files \u2192 workspace \u2192 sidebar)"},{id:"focus.next",scope:"global",keys:["f4"],prefixKeys:["l"],category:"Navigation",description:"Focus next pane (sidebar \u2192 workspace \u2192 files)",hint:{keys:"f4"}},{id:"attention.next",scope:"global",keys:["f7"],category:"Navigation",description:"Jump to the next available Inbox item",hint:{keys:"f7"}},{id:"workspace.zenToggle",scope:"global",keys:[],prefixKeys:["z"],category:"Navigation",description:"Toggle zen mode (hide the files column)"},{id:"chat.interrupt",scope:"workspace",keys:[],category:"Workspace",description:"Interrupt current turn (esc while streaming)"},...gk,...Ik,...Rk,...wk,{id:"terminal.scroll-up",scope:"terminal",keys:["ctrl+pageup"],category:"Terminal",description:"Scroll scrollback up",hint:{keys:"ctrl+pgup"}},{id:"terminal.scroll-down",scope:"terminal",keys:["ctrl+pagedown"],category:"Terminal",description:"Scroll scrollback down"},{id:"terminal.reset",scope:"terminal",keys:["f5"],category:"Terminal",description:"Reset terminal \u2014 kill the current shell and respawn",hint:{keys:"f5"}},{id:"dialog.cancel",scope:"global",keys:[],category:"Dialog",description:"Close the top dialog (esc)"},{id:"dialog.newtask.tab.cycle",scope:"global",keys:[],category:"Dialog",description:"Switch New Task tab (Existing / New Repo)",hint:{keys:"ctrl+[/]"}}]});function L4($){let X=[];for(let Z in $){let z=$[Z];if(!z)continue;let Q=WH(Z),Y=Q?.keys??[],q=Q?.prefixKeys??[];if(Y.length===0&&q.length===0){console.warn(`[kobe/keybindings] bindByIds: id="${Z}" has no chords (or doesn't exist in KobeKeymap)`);continue}Y.forEach((W,U)=>X.push({key:W,cmd:z,slot:U,id:Z})),q.forEach((W,U)=>X.push({key:W,prefix:!0,cmd:z,slot:U,id:Z}))}return X}var xk=s(()=>{_X()});function yk($){return kk.get($)?.keys??[]}function YD(){for(let $ of N$){let X=kk.get($.id);if(!X)continue;let Z=$;Z.keys=[...X.keys],Z.prefixKeys=X.prefixKeys&&[...X.prefixKeys],Z.hint=X.hint?{...X.hint}:void 0}}function HD(){return bk}function WD($){return QD.add($),()=>{QD.delete($)}}function qD(){bk+=1;for(let $ of[...QD])$()}function WH($){return S41.get($)}var kk,bk=0,QD,S41;var _X=s(()=>{zD();zD();xk();kk=new Map(N$.map(($)=>[$.id,{keys:[...$.keys],prefixKeys:$.prefixKeys&&[...$.prefixKeys],hint:$.hint?{...$.hint}:void 0}]));QD=new Set;S41=new Map(N$.map(($)=>[$.id,$]))});function BD($){let X=$,Z=typeof X.sequence==="string"&&X.sequence.length>0?X.sequence:null,z=typeof X.raw==="string"&&vk.test(X.raw)||Z!=null&&vk.test(Z);if(Z!=null&&!z)return Z;if(Z!=null&&Z.length===1&&Z>=" "&&Z!=="\x7F"&&!$.ctrl&&!X.option&&!X.meta)return Z;return mk($)}function mk($){let X=$.name;if(!X)return null;if($.shift&&X==="tab")return"\x1B[Z";if($.option||$.meta){let Z=mk({...$,option:!1,meta:!1});return Z==null?null:`\x1B${Z}`}switch(X){case"return":case"enter":return"\r";case"tab":return"\t";case"backspace":return"\x7F";case"delete":return"\x1B[3~";case"up":return"\x1B[A";case"down":return"\x1B[B";case"right":return"\x1B[C";case"left":return"\x1B[D";case"home":return"\x1B[H";case"end":return"\x1B[F";case"escape":return"\x1B";case"space":return $.ctrl?"\x00":" ";default:if(X.length===1){if($.ctrl){let z=X.toLowerCase().charCodeAt(0);if(z>=97&&z<=122)return String.fromCharCode(z-96);let Q=w41[X];if(Q!=null)return Q;return null}if($.shift&&X>="a"&&X<="z")return X.toUpperCase();return X}return null}}function ck($,X,Z,z){if($.mouseTracking)return`\x1B[<${X==="up"?64:65};${Math.max(1,Z)};${Math.max(1,z)}M`;if($.alternateScreen)return($.applicationCursorKeys?X==="up"?"\x1BOA":"\x1BOB":X==="up"?"\x1B[A":"\x1B[B").repeat(3);return null}var vk,w41,hk=10,E41,g41,f41,x41,uk;var UD=s(()=>{_X();vk=/^\x1b\[[\d:;]*u$/,w41={"@":"\x00","[":"\x1B","\\":"\x1C","]":"\x1D","^":"\x1E",_:"\x1F","?":"\x7F"};E41=[{id:"focus.sidebar"},{id:"chat.tab.new"},{id:"chat.tab.close"},{id:"chat.tab.cycle-next"},{id:"chat.tab.cycle-prev"},{id:"chat.tab.rename"},"ctrl+e","ctrl+f",{id:"workspace.split.right"},{id:"workspace.split.down"},{id:"workspace.split.focus-next"},{id:"focus.next"},{id:"terminal.reset"},{id:"attention.next"}],g41=[...new Set(E41.flatMap(($)=>typeof $==="string"?[$]:yk($.id)))],f41=[..."abcdefghijklmnopqrstuvwxyz".split(""),..."ABCDEFGHIJKLMNOPQRSTUVWXYZ".split(""),..."0123456789".split(""),..." `~!@#$%^&*()-_=+[]{}\\|;:'\",.<>/?".split(""),"return","enter","space","tab","backspace","delete","up","down","left","right","home","end","pageup","pagedown","escape","insert","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12"],x41=["","ctrl+","alt+","shift+","ctrl+shift+","alt+shift+","ctrl+alt+"],uk=f41.flatMap(($)=>x41.map((X)=>`${X}${$}`)).filter(($)=>!g41.includes($))});class KD{data=new Set;exits=new Set;titles=new Set;get dataCount(){return this.data.size}addData($){return this.data.add($),()=>this.data.delete($)}addExit($){return this.exits.add($),()=>this.exits.delete($)}addTitle($){return this.titles.add($),()=>this.titles.delete($)}publishData($,X){for(let Z of this.data)try{Z($,X)}catch{}}publishTitle($){for(let X of this.titles)try{X($)}catch{}}drainExits(){let $=[...this.exits];return this.exits.clear(),$}clearData(){this.data.clear()}clearAll(){this.data.clear(),this.exits.clear(),this.titles.clear()}}function dk($,X){if($===X)return!0;return $!==void 0&&X!==void 0&&$[0]===X[0]&&$[1]===X[1]&&$[2]===X[2]}function k41($,X){return $.text===X.text&&($.attributes??0)===(X.attributes??0)&&dk($.fg,X.fg)&&dk($.bg,X.bg)}function y41($,X){if($===X)return!0;if($.length!==X.length)return!1;for(let Z=0;Z<$.length;Z++)if(!k41($[Z],X[Z]))return!1;return!0}function MD($,X){return $&&y41($,X)?$:X}function lk($,X){if($.length!==X.length)return X;let Z=!1;for(let z=0;z<X.length;z++){let Q=MD($[z],X[z]);if(X[z]=Q,Q!==$[z])Z=!0}return Z?X:$}function pk($,X){if($===X)return $;if($&&X&&$.x===X.x&&$.y===X.y)return $;return X}function VX($){if($<0)return[0,0,0];if($<16)return b41[$]??[0,0,0];if($<232){let X=$-16,Z=Math.floor(X/36),z=Math.floor(X/6%6),Q=X%6,Y=(q)=>q===0?0:55+40*q;return[Y(Z),Y(z),Y(Q)]}if($<256){let X=8+10*($-232);return[X,X,X]}return[0,0,0]}function v41($,X){let Z=X.length===0?[0]:X.map((W)=>W===""?0:Number.parseInt(W,10)||0),z=$.fg,Q=$.bg,Y=$.attributes,q=0;while(q<Z.length){let W=Z[q];if(W===void 0)break;if(W===0){z=void 0,Q=void 0,Y=0,q+=1;continue}if(W===1){Y|=Y5.BOLD,q+=1;continue}if(W===2){Y|=Y5.DIM,q+=1;continue}if(W===3){Y|=Y5.ITALIC,q+=1;continue}if(W===4){Y|=Y5.UNDERLINE,q+=1;continue}if(W===5||W===6){Y|=Y5.BLINK,q+=1;continue}if(W===7){Y|=Y5.INVERSE,q+=1;continue}if(W===8){Y|=Y5.HIDDEN,q+=1;continue}if(W===9){Y|=Y5.STRIKETHROUGH,q+=1;continue}if(W===22){Y&=~(Y5.BOLD|Y5.DIM),q+=1;continue}if(W===23){Y&=~Y5.ITALIC,q+=1;continue}if(W===24){Y&=~Y5.UNDERLINE,q+=1;continue}if(W===25){Y&=~Y5.BLINK,q+=1;continue}if(W===27){Y&=~Y5.INVERSE,q+=1;continue}if(W===28){Y&=~Y5.HIDDEN,q+=1;continue}if(W===29){Y&=~Y5.STRIKETHROUGH,q+=1;continue}if(W>=30&&W<=37){z=VX(W-30),q+=1;continue}if(W>=90&&W<=97){z=VX(W-90+8),q+=1;continue}if(W===39){z=void 0,q+=1;continue}if(W>=40&&W<=47){Q=VX(W-40),q+=1;continue}if(W>=100&&W<=107){Q=VX(W-100+8),q+=1;continue}if(W===49){Q=void 0,q+=1;continue}if(W===38){let U=Z[q+1];if(U===5){let M=Z[q+2]??0;z=VX(M),q+=3;continue}if(U===2){let M=Z[q+2]??0,L=Z[q+3]??0,j=Z[q+4]??0;z=[M,L,j],q+=5;continue}q+=1;continue}if(W===48){let U=Z[q+1];if(U===5){let M=Z[q+2]??0;Q=VX(M),q+=3;continue}if(U===2){let M=Z[q+2]??0,L=Z[q+3]??0,j=Z[q+4]??0;Q=[M,L,j],q+=5;continue}q+=1;continue}q+=1}return{fg:z,bg:Q,attributes:Y}}function m41($){let X=$;if(X.charCodeAt(0)===27)X=X.slice(2);else if(X.charCodeAt(0)===155)X=X.slice(1);if(X.endsWith("m"))X=X.slice(0,-1);return X.split(";")}function h41($,X=nk){if($.length===0)return{chunks:[],endStyle:X};let Z=[],z={...X},Q="",Y=()=>{if(Q.length===0)return;let W={text:Q,...z.fg?{fg:z.fg}:{},...z.bg?{bg:z.bg}:{},...z.attributes!==0?{attributes:z.attributes}:{}};Z.push(W),Q=""},q=lB($);for(let W of q){if(W.type==="TEXT"){Q+=W.raw;continue}if(W.type==="CSI"&&W.command==="m")Y(),z=v41(z,m41(W.raw))}return Y(),{chunks:Z,endStyle:z}}function lF($){let X=$.split(`
|
|
425
425
|
`),Z=[],z=nk;for(let Q of X){let{chunks:Y,endStyle:q}=h41(Q,z);Z.push(Y),z=q}return Z}var Y5,nk,b41;var qH=s(()=>{pV();Y5=Object.freeze({BOLD:1,DIM:2,ITALIC:4,UNDERLINE:8,BLINK:16,INVERSE:32,HIDDEN:64,STRIKETHROUGH:128}),nk=Object.freeze({fg:void 0,bg:void 0,attributes:0});b41=[[21,22,30],[247,118,142],[158,206,106],[224,175,104],[122,162,247],[187,154,247],[125,207,255],[169,177,214],[65,72,104],[255,137,157],[158,224,68],[250,186,74],[141,176,255],[199,169,255],[164,218,255],[192,202,245]]});function ik($){if($==="")return;let X=$.indexOf(":"),Z=Number($.slice(X+1));if($.startsWith("rgb:"))return[Z>>16&255,Z>>8&255,Z&255];if($.startsWith("pal:"))return VX(Z);return}function ok($,X){if(X==="fg"?$.isFgDefault():$.isBgDefault())return"";let z=X==="fg"?$.getFgColorMode():$.getBgColorMode(),Q=X==="fg"?$.getFgColor():$.getBgColor();if(z===sk||(X==="fg"?$.isFgRGB():$.isBgRGB()))return`rgb:${Q}`;if(z===rk||(X==="fg"?$.isFgPalette():$.isBgPalette()))return`pal:${Q}`;if(z===u41)return"";return""}function tk($){let X=0;if($.isBold())X|=Y5.BOLD;if($.isDim())X|=Y5.DIM;if($.isItalic())X|=Y5.ITALIC;if($.isUnderline())X|=Y5.UNDERLINE;if($.isBlink())X|=Y5.BLINK;if($.isInverse())X|=Y5.INVERSE;if($.isInvisible())X|=Y5.HIDDEN;if($.isStrikethrough())X|=Y5.STRIKETHROUGH;return X}function d41($){return{fg:ok($,"fg"),bg:ok($,"bg"),attrs:tk($)}}function l41($,X){return $.fg===X.fg&&$.bg===X.bg&&$.attrs===X.attrs}function p41($){let X=ik($.fg),Z=ik($.bg);return{...X?{fg:X}:{},...Z?{bg:Z}:{},...$.attrs!==0?{attributes:$.attrs}:{}}}function ek($){let X=$.getChars();if(X!==""&&X!==" ")return!0;return!$.isAttributeDefault()||!$.isFgDefault()||!$.isBgDefault()}function pF($,X){if(ND===void 0){let Z=$.getCell(X);if(Z)ND=Z;return Z}return $.getCell(X,ND)}function $y($,X=-1){let Z=Math.min($.length-1,X);for(let W=0;W<$.length;W++){let U=pF($,W);if(!U||U.getWidth()===0)continue;if(ek(U))Z=Math.max(Z,W)}if(Z===-1)return[];let z=[],Q=c41,Y="",q=()=>{if(Y==="")return;z.push({text:Y,...p41(Q)}),Y=""};for(let W=0;W<=Z;W++){let U=pF($,W);if(!U||U.getWidth()===0)continue;let M=d41(U);if(!l41(Q,M))q(),Q=M;Y+=U.getChars()||" "}return q(),z}function ak($,X,Z){if(Z==="fg"?X.isFgDefault():X.isBgDefault())return $===void 0;if(!$)return!1;let Q=Z==="fg"?X.getFgColorMode():X.getBgColorMode(),Y=Z==="fg"?X.getFgColor():X.getBgColor();if(Q===sk||(Z==="fg"?X.isFgRGB():X.isBgRGB()))return $[0]===(Y>>16&255)&&$[1]===(Y>>8&255)&&$[2]===(Y&255);if(Q===rk||(Z==="fg"?X.isFgPalette():X.isBgPalette())){let q=VX(Y);return $[0]===q[0]&&$[1]===q[1]&&$[2]===q[2]}return!1}function n41($,X){return($.attributes??0)===tk(X)&&ak($.fg,X,"fg")&&ak($.bg,X,"bg")}function Xy($,X,Z=-1){if(!$)return X.length===0;let z=Math.min($.length-1,Z);for(let q=0;q<$.length;q++){let W=pF($,q);if(!W||W.getWidth()===0)continue;if(ek(W))z=Math.max(z,q)}if(z===-1)return X.length===0;let Q=0,Y=0;for(let q=0;q<=z;q++){let W=pF($,q);if(!W||W.getWidth()===0)continue;let U=X[Q];if(!U||!n41(U,W))return!1;let M=W.getChars()||" ";if(!U.text.startsWith(M,Y))return!1;if(Y+=M.length,Y===U.text.length)Q++,Y=0;else if(Y>U.text.length)return!1}return Q===X.length&&Y===0}var u41=0,rk=16777216,sk=50331648,c41,ND;var FD=s(()=>{qH();c41=Object.freeze({fg:"",bg:"",attrs:0})});function Zy($,X){$.onData(X.onReply),$.onTitleChange(X.onTitle)}class OD{dirty=null;subscription;supported;constructor($){let X=$._core?._inputHandler?.onRequestRefreshRows;if(!X){this.supported=!1,this.subscription=null;return}this.supported=!0,this.subscription=X((Z)=>{if(!Z){this.dirty={kind:"all"};return}if(!this.dirty)this.dirty={kind:"range",start:Z.start,end:Z.end};else if(this.dirty.kind==="range")this.dirty.start=Math.min(this.dirty.start,Z.start),this.dirty.end=Math.max(this.dirty.end,Z.end)})}markAll(){this.dirty={kind:"all"}}peek(){return this.dirty}clear(){this.dirty=null}dispose(){this.subscription?.dispose()}}function Jy($,X,Z){return{type:$.type,baseY:$.baseY,length:$.length,start:Math.max(0,$.length-(X+Z))}}function i41($,X){return $.type===X.type&&$.baseY===X.baseY&&$.length===X.length&&$.start===X.start}function Gy($,X,Z,z,Q,Y){if(!Z||!i41(Z,z)||!Q)return!1;let q=z.start,W=z.length-1;if(Q.kind==="range")q=Math.max(q,$.baseY+Q.start),W=Math.min(W,$.baseY+Q.end);let U=$.baseY+$.cursorY;for(let M=q;M<=W;M++){let L=X[M-z.start];if(!L)return!1;let j=!Y&&M===U?$.cursorX-1:-1;if(!Xy($.getLine(M),L,j))return!1}return!0}function zy($){try{return $.modes.synchronizedOutputMode===!0}catch{return!1}}function nF($){try{return $._core?.coreService?.isCursorHidden===!0}catch{return!1}}var LD=s(()=>{FD()});class pB{taskId;cwd;term;listeners=new KD;snapshot=[];cursor=null;snapshotDirty=!1;scrollbackCache=new Map;anchor;anchorId=0;_title=null;_unwatchedSince=Date.now();_killed=!1;muteReplies=!1;cols;rows;refreshQueued=!1;refreshTracker;publishedMeta=null;scrollbackRows;constructor($){if(this.taskId=$.taskId,this.cwd=$.cwd,this.cols=$.cols??zH,this.rows=$.rows??QH,$.restore?.title)this._title=$.restore.title;this.scrollbackRows=$.scrollback??Pk(),this.term=new Qy.Terminal({allowProposedApi:!0,cols:this.cols,rows:this.rows,scrollback:this.scrollbackRows}),this.term.loadAddon(new Ak),this.term.unicode.activeVersion="11",this.refreshTracker=new OD(this.term),Zy(this.term,{onReply:(X)=>{if(this._killed||this.muteReplies)return;try{this.transportWrite(X)}catch{}},onTitle:(X)=>{if(!X||X===this._title)return;this._title=X,this.listeners.publishTitle(X)}})}get killed(){return this._killed}write($){if(this._killed||$.length===0)return;try{this.transportWrite($)}catch{this.markDead(!1)}}onExit($){if(this._killed)return $(),()=>{};return this.listeners.addExit($)}onTitleChange($){let X=this.listeners.addTitle($);if(this._title)try{$(this._title)}catch{}return X}paste($){if(this._killed||$.length===0)return;let X=!1;try{X=this.term.modes.bracketedPasteMode===!0}catch{}this.write(X?`\x1B[200~${$}\x1B[201~`:$)}wheel($,X,Z){if(this._killed)return!1;try{let z=this.term.modes,Q=ck({mouseTracking:z.mouseTrackingMode!=="none",applicationCursorKeys:z.applicationCursorKeysMode===!0,alternateScreen:this.term.buffer.active.type==="alternate"},$,X,Z);if(Q!==null)return this.write(Q),!0}catch{}return!1}onData($){this.ensureFreshSnapshot();let X=this.listeners.addData($);if(this._unwatchedSince=null,this.snapshot.length>0)try{$(this.snapshot,this.cursor)}catch{}return()=>{if(X(),this.listeners.dataCount===0&&this._unwatchedSince===null)this._unwatchedSince=Date.now()}}unwatchedSinceMs(){return this._unwatchedSince}get windowTitle(){return this._title}get scrollback(){return this.scrollbackRows}resizeEmulator($,X){this.cols=$,this.rows=X,this.term.resize($,X),this.invalidateScrollbackCache(),this.refreshTracker.markAll()}resize($,X){if(this._killed)return;this.cols=$,this.rows=X;try{this.term.resize($,X),this.invalidateScrollbackCache(),this.transportResize($,X),this.refreshTracker.markAll(),this.refreshSnapshot()}catch{this.markDead(!1)}}invalidateScrollbackCache(){this.scrollbackCache.clear(),this.anchor?.dispose(),this.anchor=void 0,this.anchorId=0}capture(){return this.ensureFreshSnapshot(),this.snapshot}captureCursor(){return this.ensureFreshSnapshot(),this.cursor}ensureFreshSnapshot(){if(!this.snapshotDirty||this._killed)return;this.refreshSnapshot()}kill(){if(this._killed)return;this.markDead(!0)}feed($){if(this._killed)return;this.term.write($,()=>{if(!this.refreshTracker.supported)this.refreshTracker.markAll();this.queueRefresh()})}feedReplay($){if(this._killed)return;this.muteReplies=!0,this.term.write($,()=>{if(this.muteReplies=!1,!this.refreshTracker.supported)this.refreshTracker.markAll();this.queueRefresh()})}queueRefresh(){if(this.listeners.dataCount===0){this.snapshotDirty=!0;return}if(this.refreshQueued)return;this.refreshQueued=!0,setTimeout(()=>{this.refreshQueued=!1,this.refreshSnapshot()},16)}refreshSnapshot(){if(this._killed)return;let $=this.snapshot,X=this.cursor;if(zy(this.term)){this.queueRefresh();return}let Z=this.term.buffer.active,z=nF(this.term),Q=Jy(Z,this.rows,this.scrollbackRows),Y=pk(X,z?null:{x:Z.cursorX,y:Z.baseY+Z.cursorY-Q.start});if(Gy(Z,$,this.publishedMeta,Q,this.refreshTracker.peek(),z)){if(this.snapshotDirty=!1,this.refreshTracker.clear(),this.publishedMeta=Q,this.cursor=Y,this.cursor!==X)this.publishSnapshot();return}let q=Z.type==="alternate";if(!q&&(this.anchor===void 0||this.anchor.isDisposed)){this.scrollbackCache.clear();let V=this.term.registerMarker(0);if(V)this.anchor=V,this.anchorId=V.line}let W=!q&&this.anchor!==void 0&&!this.anchor.isDisposed,U=W?this.anchorId-this.anchor.line:0,M=this.scrollbackCache,L=[],j=Z.baseY+Z.cursorY,F=Q.start;for(let V=F;V<Z.length;V++){let T=W&&V<Z.baseY;if(T){let S=M.get(U+V);if(S){L.push(S);continue}}let D=Z.getLine(V),A=!z&&V===j?Z.cursorX-1:-1,b=D?$y(D,A):[],R=T?MD($[L.length],b):b;if(L.push(R),T)M.set(U+V,R)}if(W){let V=U+F;for(let T of M.keys())if(T<V)M.delete(T)}if(!q){let V=this.term.registerMarker(0);if(V)this.anchorId=W?U+V.line:0,this.anchor?.dispose(),this.anchor=V}if(this.snapshot=lk($,L),this.snapshotDirty=!1,this.refreshTracker.clear(),this.publishedMeta=Q,this.cursor=Y,this.snapshot===$&&this.cursor===X)return;this.publishSnapshot()}publishSnapshot(){this.listeners.publishData(this.snapshot,this.cursor)}disposeEmulator(){try{this.term.dispose()}catch{}}markDead($){if(this._killed)return;if(this._killed=!0,this.refreshTracker.dispose(),this.disposeEmulator(),$)try{this.transportKill()}catch{}let X=this.listeners.drainExits();this.listeners.clearData();for(let Z of X)try{Z()}catch{}}silentDispose(){this._killed=!0,this.refreshTracker.dispose(),this.disposeEmulator(),this.listeners.clearAll()}}var Qy;var jD=s(()=>{_k();GD();UD();H6();FD();LD();Qy=H0(Dk(),1)});function o41($){let X=Jz.get($.taskId);if(!X)X=new Set,Jz.set($.taskId,X);X.add($)}function a41($){let X=Jz.get($.taskId);if(!X)return 0;if(X.delete($),X.size===0)Jz.delete($.taskId);return X.size}function r41($){if(Yy.has($))return;Yy.add($),$.on("pty.data",(X)=>{let Z=X.payload,z=Jz.get(Z.key);if(z)for(let Q of z)Q.feedFrame(Z.data)}),$.on("pty.exit",(X)=>{let Z=X.payload,z=Jz.get(Z.key);if(z)for(let Q of[...z])Q.remoteExited(Z.pid)})}function Hy(){if(Zz)return Zz;let $=(async()=>{let X=await ZN(),Z=new Z8(X);return await Z.connect(),r41(Z),Z.onLifecycle("close",()=>{if(Zz===$)Zz=null}),Z})();return $.catch(()=>{if(Zz===$)Zz=null}),Zz=$,$}function Wy($,X=l4()){if((process.env.KOBE_TERMINAL_BACKEND??"hosted")!=="hosted")return;Hy().then((Z)=>Z.request("pty.warm",{cwd:$,shell:X})).catch(()=>{})}var Zz=null,Jz,Yy,nB;var iF=s(()=>{zX();GX();JN();Zk();H6();jD();LD();Jz=new Map;Yy=new WeakSet;nB=class nB extends pB{client=null;opened=!1;pendingInput=[];pendingResize=null;unsubs=[];deadOnAttach=!1;sessionPid=void 0;pendingExitPid=null;serializer=new Xk;hostOffset=null;constructor($){super($);this.term.loadAddon(this.serializer),this.openRemote($)}static createdFresh($){return $.alive&&($.created??$.replay.length===0)}async openRemote($){try{let X=await Hy();if(this.killed)return;this.client=X,o41(this),this.unsubs.push(X.onLifecycle("close",()=>this.remoteGone()));let Z=await X.request("pty.open",{key:this.taskId,cwd:this.cwd,command:$.command,shell:$.shell,cols:this.cols,rows:this.rows,sinceOffset:$.restore?.byteOffset,sincePid:$.restore?.pid??void 0});if(this.killed)return;this.sessionPid=Z.pid??null,this.hostOffset=Z.offset??null;let z=$.restore!==void 0&&Z.sinceValid===!0&&Z.created!==!0&&(Z.pid??null)===$.restore.pid;if(z&&$.restore){if(await this.restoreParked($.restore,Buffer.from(Z.replay,"base64")),this.killed)return}else if(Z.replay.length>0)this.feedReplay(Buffer.from(Z.replay,"base64"));if(this.opened=!0,this.pendingResize){let{cols:Y,rows:q}=this.pendingResize;this.pendingResize=null,this.sendResize(Y,q)}if($.initialInput&&nB.createdFresh(Z))this.sendInput($.initialInput);for(let Y of this.pendingInput.splice(0))this.sendInput(Y);let Q=this.pendingExitPid;if(this.pendingExitPid=null,!Z.alive)this.deadOnAttach=Z.replay.length>0||z,this.remoteGone();else if(Q!==null&&Q===this.sessionPid)this.remoteGone();else if(Z.replay.length>0&&!z){if(this.sendResize(this.cols,Math.max(1,this.rows-1)),await this.nextDataOrTimeout(500),!this.killed)this.sendResize(this.cols,this.rows)}}catch(X){o5("pty-hosted",X),this.remoteGone()}}transportWrite($){if(!this.opened){this.pendingInput.push($);return}this.sendInput($)}transportResize($,X){if(!this.opened){this.pendingResize={cols:$,rows:X};return}this.sendResize($,X)}transportKill(){let $=this.client;if($)$.request("pty.kill",{key:this.taskId}).catch(()=>{});this.cleanup()}kill(){if(this.killed){this.client?.request("pty.kill",{key:this.taskId}).catch(()=>{});return}super.kill()}capturePark(){if(this.killed||!this.opened||this.hostOffset===null||this.sessionPid===void 0)return null;try{return{serialized:Buffer.from(this.serializer.serialize({scrollback:this.scrollback}),"utf8").toString(),title:this.windowTitle,cursorHidden:nF(this.term),cols:this.cols,rows:this.rows,byteOffset:this.hostOffset,pid:this.sessionPid}}catch{return null}}async restoreParked($,X){let Z=this.cols,z=this.rows;if($.cols!==Z||$.rows!==z)this.resizeEmulator($.cols,$.rows);if(this.feedReplay($.serialized+($.cursorHidden?"\x1B[?25l":"")),X.byteLength>0)this.feedReplay(X);if(await new Promise((Q)=>{let Y=this.onExit(Q);this.term.write("",()=>{Y(),Q()})}),!this.killed&&(this.cols!==Z||this.rows!==z))this.resizeEmulator(Z,z)}detach($={}){let X=this.client;this.cleanup();let Z=Jz.get(this.taskId)?.size??0;if(X&&Z===0)X.request("pty.detach",{key:this.taskId,parked:$.parked===!0,parkedScreenBytes:$.parkedScreenBytes}).catch(()=>{});this.silentDispose()}sendInput($){this.client?.request("pty.write",{key:this.taskId,data:$}).catch(()=>this.remoteGone())}sendResize($,X){this.client?.request("pty.resize",{key:this.taskId,cols:$,rows:X}).catch(()=>{})}dataWaiter=null;nextDataOrTimeout($){return new Promise((X)=>{let Z=setTimeout(()=>{this.dataWaiter=null,X()},$);this.dataWaiter=()=>{this.dataWaiter=null,clearTimeout(Z),X()}})}feedFrame($){this.dataWaiter?.();let X=Buffer.from($,"base64");if(this.hostOffset!==null)this.hostOffset+=X.byteLength;this.feed(X)}remoteExited($){if(this.killed)return;if($===void 0){this.remoteGone();return}if(this.sessionPid===void 0){this.pendingExitPid=$;return}if($!==null&&$===this.sessionPid)this.remoteGone()}remoteGone(){this.cleanup(),this.markDead(!1)}cleanup(){a41(this);for(let $ of this.unsubs.splice(0))try{$()}catch{}}}});class oF{taskId;cwd;listeners=new Set;buffer="";writes=[];_killed=!1;_title=null;exitListeners=new Set;titleListeners=new Set;pastes=[];deadOnAttach=!1;wheels=[];_cols;_rows;_cursor=null;constructor($){if(this.taskId=$.taskId,this.cwd=$.cwd,this._cols=$.cols??zH,this._rows=$.rows??QH,$.initialInput)this.writes.push($.initialInput)}get killed(){return this._killed}get writeLog(){return this.writes}get geometry(){return{cols:this._cols,rows:this._rows}}feed($){if(this._killed)return;this.buffer+=$;let X=yF($);if(X&&X!==this._title){this._title=X;for(let z of this.titleListeners)try{z(X)}catch{}}let Z=this.capture();for(let z of this.listeners)try{z(Z,this._cursor)}catch{}}write($){if(this._killed)return;this.writes.push($)}onData($){if(this.listeners.add($),this.buffer!=="")try{$(this.capture(),this._cursor)}catch{}return()=>{this.listeners.delete($)}}resize($,X){if(this._killed)return;this._cols=$,this._rows=X}capture(){return lF(this.buffer)}setCursor($){this._cursor=$}captureCursor(){if(this._killed)return null;return this._cursor}kill(){if(this._killed)return;this._killed=!0,this.listeners.clear();let $=[...this.exitListeners];this.exitListeners.clear();for(let X of $)X()}paste($){if(this._killed)return;this.pastes.push($)}wheel($,X,Z){if(this._killed)return!1;return this.wheels.push({direction:$,col:X,row:Z}),!1}onExit($){if(this._killed)return $(),()=>{};return this.exitListeners.add($),()=>{this.exitListeners.delete($)}}onTitleChange($){if(this.titleListeners.add($),this._title)try{$(this._title)}catch{}return()=>{this.titleListeners.delete($)}}}var CD=s(()=>{H6();qH()});import{spawn as s41}from"child_process";class aF{taskId;cwd;proc;listeners=new Set;buffer="";_killed=!1;_title=null;exitListeners=new Set;titleListeners=new Set;cols;rows;constructor($){this.taskId=$.taskId,this.cwd=$.cwd,this.cols=$.cols??zH,this.rows=$.rows??QH;let X=bF($),Z=X[0]??l4(),z=X.slice(1);if(this.proc=s41(Z,z,{cwd:$.cwd,env:GH(process.env,{TERM:process.env.TERM??"xterm-256color",COLUMNS:String(this.cols),LINES:String(this.rows),KOBE_TERMINAL_PIPE:"1"}),stdio:["pipe","pipe","pipe"]}),this.proc.stdout?.setEncoding("utf8"),this.proc.stderr?.setEncoding("utf8"),this.proc.stdout?.on("data",(Q)=>this.append(Q)),this.proc.stderr?.on("data",(Q)=>this.append(Q)),this.proc.stdin?.on("error",()=>this.markDead(!1)),this.proc.on("error",(Q)=>{this.append(`
|
|
426
426
|
[kobe terminal] failed to start shell: ${Q.message}
|
|
427
427
|
`),this.markDead(!1)}),this.proc.on("exit",()=>this.markDead(!1)),this.proc.unref?.(),$.initialInput)this.write($.initialInput)}get killed(){return this._killed}write($){if(this._killed||$.length===0)return;let X=this.proc.stdin;if(!X||X.destroyed)return;let Z=$.replace(/\r/g,`
|
package/package.json
CHANGED