kaizen-agent 1.85.0 → 1.85.1
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/package.json +1 -1
- package/web/board/home-ws.ts +20 -9
- package/web/board/phone.ts +8 -5
- package/web/board.html +7 -1
- package/web/board.js +108 -108
- package/web/notebook.js +1 -1
- package/web/term.js +1 -1
- package/web/video.js +1 -1
package/web/notebook.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen notebook
|
|
1
|
+
/* kaizen notebook 1b06857f87822e5f -- generated by bun run build:web from web/notebook.ts; do not edit */
|
|
2
2
|
var ei=null,Ll=(e,t=ei)=>t?.find((n)=>n.dir===e.state&&(n.id===e.taskId||e.kind==="run"&&[n.activeRun,...(n.runs??n.runIds??[]).map((s)=>typeof s==="string"?s:s.id),...n.legacy?.kind==="run"?[n.legacy.id]:[]].includes(e.id)));function Sr(e){if(ei=e,typeof document<"u"){let t=e.filter((n)=>n.attention.category==="needs-you").length;document.querySelectorAll('.rail a[data-view="tasks"]').forEach((n)=>{if(t)n.dataset.n=String(t);else delete n.dataset.n;n.title=t?`Tasks · ${t} need you`:"Tasks",n.setAttribute("aria-label",n.title)}),dispatchEvent(new Event("kz-task-attention"))}}function ug(e,t=ei){if(t){let n=new Set(e.map((s)=>s.state).filter(Boolean));return t.filter((s)=>(!n.size||n.has(s.dir))&&s.attention.category==="needs-you").length}return e.filter((n)=>!n.archived&&(n.kind==="run"&&n.status==="waiting"||n.pty?.alive&&n.pty.asking)).length}var su=null,hg=null,fg=(e)=>{hg=e};function iu(e,t,n){if(nu++,su=e,typeof window<"u")dispatchEvent(new Event("kz-all-cards"));hg?.(e,t,n)}var nu=0,lg="",tu=!1,Ml=!1,p1=2000,cg=0,dg;async function Os(){if(tu){Ml=!0;return}let e=cg+p1-Date.now();if(e>0){dg??=setTimeout(()=>{dg=void 0,Os()},e);return}cg=Date.now(),tu=!0;do{Ml=!1;let t=nu;try{let n=await fetch("/state?all=1");if(!n.ok)continue;let s=await n.text(),i=s.replace(/"now":\d+\}$/,"");if(i===lg)continue;let{cards:r,projects:o,rail:a,agents:l}=JSON.parse(s);if(!Ml&&t===nu)lg=i,iu(r,[...o,...a??[]],l)}catch{}}while(Ml);tu=!1}var k={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1,dir:null},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,flash:new Set,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,sevMenu:!1,wantTerm:null,wantPty:null,shells:[],setQ:"",setScope:"all",setPage:null,setBack:!1,pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var m=(e)=>document.getElementById(e),ti=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]);class ou{s;constructor(e){this.s=e}toString(){return this.s}}var _=(e)=>new ou(String(e)),pg=(e)=>e instanceof ou?e.s:Array.isArray(e)?e.map(pg).join(""):e==null||e===!1?"":ti(e),p=(e,...t)=>_(e.reduce((n,s,i)=>n+pg(t[i-1])+s)),R=(e)=>_(`<svg><use href="#i-${e}"/></svg>`),mt=(e,t={})=>{let n="chk"+(t.sm?" sm":""),s=_(Object.entries(t.attrs??{}).map(([i,r])=>` ${i}="${ti(r)}"`).join(""));return t.box?p`<input type="checkbox" class="${n}" role="switch"${s}${_(e?" checked":"")}>`:p`<button type="button" class="${n}${e?" on":""}" role="switch" aria-checked="${String(e)}"${s}></button>`},mg=_('<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>"),m1=1500000;async function g1(e){if(e.size<=m1||!/^image\/(jpeg|png|webp|bmp|heic|heif)$/.test(e.type))return e;try{let t=await createImageBitmap(e),n=Math.min(1,2560/Math.max(t.width,t.height)),s=document.createElement("canvas");s.width=Math.round(t.width*n),s.height=Math.round(t.height*n),s.getContext("2d").drawImage(t,0,0,s.width,s.height);let i=await new Promise((r)=>s.toBlob(r,"image/jpeg",0.85));return i&&i.size<e.size?new File([i],e.name.replace(/\.\w+$/,"")+".jpg",{type:"image/jpeg"}):e}catch{return e}}var _i=(e)=>Promise.all(e.map(async(t)=>{let n=await g1(t);return new Promise((s)=>{let i=new FileReader;i.onload=()=>s({name:n.name,data:i.result}),i.readAsDataURL(n)})}));function Nt(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(n)=>{if(n.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var xr=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},Qr=(e)=>xr()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve()),ru=[5,25,50,100];function El(e){let t=25;try{let n=Number(localStorage.getItem("kz-page:"+e));if(ru.includes(n))t=n}catch{}return{id:e,size:t,at:0,total:0}}function Rl(e,t){return e.total=t.length,e.at=Math.max(0,Math.min(e.at,Math.ceil(t.length/e.size)-1)),t.slice(e.at*e.size,(e.at+1)*e.size)}function Bo(e){if(e.total<=ru[0])return"";let t=e.at*e.size+1,n=Math.min(e.total,t+e.size-1);return p`<div class="kpager" id="pg-${e.id}"><label>Rows<select class="sel" aria-label="Rows per page">${ru.map((s)=>p`<option${s===e.size?_(" selected"):""}>${s}</option>`)}</select></label><span>${t}–${n} of ${e.total}</span><button class="btn sm" type="button" data-to="-1"${e.at?"":_(" disabled")}>Prev</button><button class="btn sm" type="button" data-to="1"${n<e.total?"":_(" disabled")}>Next</button></div>`}function jl(e,t){let n=m("pg-"+e.id);if(!n)return;n.querySelector("select").onchange=(s)=>{e.size=+s.target.value,e.at=0;try{localStorage.setItem("kz-page:"+e.id,String(e.size))}catch{}t()},n.querySelectorAll("[data-to]").forEach((s)=>s.onclick=()=>{e.at+=+s.dataset.to,t()})}var O1=!1;try{O1=localStorage.getItem("kz-res-disk")==="1"}catch{}var gg=86400000,nt=(e,t)=>{let n=t-e;return n<3600000?Math.round(n/60000)+"m":n<86400000?Math.round(n/3600000)+"h":Math.round(n/86400000)+"d"},au={claude:"Claude Code",codex:"Codex",agy:"Antigravity",opencode:"OpenCode",gemini:"Gemini",cursor:"Cursor",yolo:"yolo",unrechecked:"fix not rechecked"},Og={claude:1,codex:1,agy:1,opencode:1,gemini:1,cursor:1,full:1,lite:1},bg=(e,t,n)=>t&&e.includes(t)?t:n?null:e[0]??null,yg=["Tasks","Planning","Building","Review","Done"],ni={idea:"idea",starting:"start",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"},b1={explore:"exploration needs your decision","approvals.plan":"plan needs your approval","approvals.review":"review needs your approval"},Un=(e)=>b1[e]||e,si={idea:"idea",starting:"starting",running:"running",stalled:"stalled",waiting:"waiting on you",done:"done",abandoned:"abandoned"};var He=(e)=>typeof e==="string"?[e]:e.kids.flatMap(He);function Ar(e,t){if(typeof e==="string")return t(e)?e:null;let n=[],s=[];if(e.kids.forEach((i,r)=>{let o=Ar(i,t);if(o)n.push(o),s.push(e.sizes[r]??1)}),!n.length)return null;if(n.length===1)return n[0];return n.length===e.kids.length&&n.every((i,r)=>i===e.kids[r])?e:{dir:e.dir,kids:n,sizes:s}}var Wi=(e,t)=>`ws:${e}:${t}`,Ni=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending",Xl=(e)=>e.gitDue==="push"?"push":"commit",Yi=(e)=>e.kind==="run"&&(e.status==="abandoned"||e.status==="done"&&e.accept!=="needs"&&!Ni(e)),$g=(e,t,n,s)=>e.state===t&&s(e)===n,du=(e,t,n,s)=>e.filter((i)=>!i.archived&&$g(i,t,n,s)&&(i.kind==="idea"?!!i.pty:i.kind==="run"&&!Yi(i))),uu=(e,t,n,s)=>e.filter((i)=>Yi(i)&&$g(i,t,n,s)).sort((i,r)=>(r.moved??0)-(i.moved??0));function Sg(e,t,n,s){let i=!1;for(let r of t){let o=n(r),a=e[o];if(!a)continue;let l=e[Wi(r.state,s(r))]||={tabs:[],hidden:[],screens:[],on:null},c=new Set(l.screens.flatMap((d)=>He(d.tree)));for(let d of a.tabs??[])if(!l.tabs.some((h)=>h.id===d.id))l.tabs.push(d);for(let d of a.hidden??[])if(!l.hidden.includes(d))l.hidden.push(d);for(let d of a.screens??[]){let h=d.tree&&Ar(d.tree,(u)=>!c.has(u));if(!h)continue;He(h).forEach((u)=>c.add(u)),l.screens.push({...d,tree:h,focus:He(h).includes(d.focus)?d.focus:He(h)[0]})}l.on??=a.on,delete e[o],i=!0}return i}var Bi=(e)=>e.kind==="run"&&(e.status==="waiting"||e.status==="done"&&e.accept==="needs"||Ni(e)||!!(e.pty?.alive&&e.pty.asking)),xg=(e,t,n,s)=>du(e,t,n,s).filter((i)=>i.kind==="run").sort((i,r)=>+Bi(r)-+Bi(i)||(r.moved??0)-(i.moved??0)),Qg=(e,t,n,s=(i)=>i.id)=>[...e,...t].find((i)=>s(i)===n)??e[0]??null;function y1(e){if(e?.kind!=="run")return{};let t=e?.pty?.all??[],n=e?.pty?.stages??{},s={};for(let o of["explore","impl","review"])if(n[o]&&t.includes(n[o]))s[o]=n[o];if(n.plan&&t.includes(n.plan))s.plan=n.plan;let i=t.find((o)=>!Object.values(n).includes(o)),r=e.stage==="explore"?"explore":{1:"plan",2:"impl",3:"review"}[e.column];if(i&&r&&!Object.keys(n).length)s[r]=i;return s}function Pg(e,t){let n={explore:"Explore",plan:"Plan",impl:"Build",review:"Review"},s=e?.pty?e.pty.all??[e.pty.key]:[],i=new Map(Object.entries(y1(e)).map(([l,c])=>[c,n[l]])),r=s.filter((l)=>!i.has(l)),o=e?.stage==="explore"?"Explore":n[{1:"plan",2:"impl",3:"review"}[e?.column]??""],a=s.at(-1);if(o&&a&&i.has(a))i.set(a,o);return s.map((l)=>({key:l,title:i.has(l)?`${i.get(l)} · ${t}`:t+(r.length>1?" "+(r.indexOf(l)+1):"")}))}var Ag=(e)=>e.kind==="run"&&(e.column===3||e.status==="done"),hu=(e)=>e?/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/.exec(e)?.[0]:void 0;function ql(e,t){let n=e?[...e.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/g)].map((i)=>i[0]):[],s=(i)=>Number(new URL(i).port||80);return n.find((i)=>t.includes(s(i)))??(t.length?`http://localhost:${t[0]}`:n[0])}var Tg=(e,t,n)=>{let s=e.filter((i,r)=>r!==t);return s.splice(n>t?n-1:n,0,e[t]),s},Cg=(e,t)=>e===t||e.startsWith(t+"/")&&!e.startsWith(t+"/.kaizen/wt/"),Mg=(e,t)=>t!==void 0&&e>t,Lg=3000,Zl=new Map,Wo=(e)=>e.key+"@"+(e.born??0),kg={conflict:0,failed:0,asking:0,working:1,done:2},Pr={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},Dl={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function fu(e,t,n=Zl){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return n.set(Wo(e),t),"working";return t-(n.get(Wo(e))??-1/0)<Lg?"working":"done"}var Eg=(e,t,n=Zl)=>Math.min(1/0,...e.filter((s)=>!s.asking&&!s.busy&&n.has(Wo(s))).map((s)=>Lg-(t-n.get(Wo(s)))).filter((s)=>s>0)),Rg=(e,t=Zl)=>{let n=new Set(e.map(Wo));for(let s of t.keys())if(!n.has(s))t.delete(s)},pu=(e,t,n,s,i,r=Zl)=>e.filter((o)=>o.dir===t&&s({state:o.dir,ws:o.ws})===n).map((o)=>({a:o,st:fu(o,i,r)})).sort((o,a)=>kg[o.st]-kg[a.st]),wg=({a:e,st:t})=>(e.land?"":e.last)||`${Pr[t]} - ${e.name}`,vg=(e,t)=>!e?"":t-e<60000?"now":nt(e,t),k1=(e,t)=>e+"\x00"+t;function jg(e,t,n){let s=k1(t,n);if(e[s])delete e[s];else e[s]=!0;return e}var w1=["claude","codex","gemini"],lu=(e)=>p`<svg aria-hidden="true"><use href="#i-${w1.includes(e.agent??"")?e.agent:"ai"}"/></svg>`,cu=(e)=>p`<i class="si ${Dl[e]}"></i>`,v1=p`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;function Xg(e,t,n,s,i){if(!e.length)return"";let r=p`data-dir="${s}" data-ws="${i}"`;if(e.length===1){let l=e[0];return p`<div class="wag"><button type="button" class="aone" data-term="${l.a.key}" ${r} title="${l.a.name}: open its terminal">${cu(l.st)}${lu(l.a)}<span class="atx">${Pr[l.st]} - ${l.a.name}</span><small>${vg(l.a.at,t)}</small></button></div>`}let o=p`<button type="button" class="wchev${n?" on":""}" data-wopen ${r} aria-expanded="${String(n)}" aria-label="${String(e.length)} agents: ${n?"hide":"show"} the list">${v1}</button>`;if(n)return p`<div class="wag"><span class="aht">${String(e.length)} agents</span>${o}</div><div class="alist">${e.map((l)=>p`<button type="button" class="arow" data-term="${l.a.key}" ${r} title="${wg(l)}">${cu(l.st)}${lu(l.a)}<span class="atx">${wg(l)}</span><small>${vg(l.a.at,t)}</small></button>`)}</div>`;let a=["conflict","failed","asking","working","done"].map((l)=>({st:l,rs:e.filter((c)=>c.st===l)})).filter((l)=>l.rs.length);return p`<div class="wag"><span class="chips">${a.map((l)=>p`<span class="chip">${cu(l.st)}${l.rs.map((c)=>p`<button type="button" class="amark" data-term="${c.a.key}" ${r} title="${c.a.name} - ${Pr[l.st]}: open its terminal" aria-label="${c.a.name} - ${Pr[l.st]}: open its terminal">${lu(c.a)}</button>`)}</span>`)}</span>${o}</div>`}function mu(e){return e.toLowerCase().trim().replace(/[^a-z0-9/._-]+/g,"-").replace(/\.{2,}/g,".").replace(/\/{2,}/g,"/").replace(/(^|\/)[-.]+/g,"$1").slice(0,60).replace(/[-./]+(\/|$)/g,"$1").replace(/\/$/,"").replace(/\.lock(\/|$)/g,"-lock$1")}var qg;function j(e,t){let n=m("toast");if(n.textContent=e,n.classList.toggle("rep",!!t),t){let s=document.createElement("a");s.href="/issue?"+new URLSearchParams(t),s.target="_blank",s.rel="noopener",s.textContent="Report",n.append(" ",s)}n.classList.add("on"),clearTimeout(qg),qg=setTimeout(()=>n.classList.remove("on"),t?8000:4000)}function bs(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}var Dg=(e,t)=>{try{return localStorage.getItem(e)||t}catch(n){return t}},zl=()=>Dg("kz-notify","on")==="on",Ui=()=>Dg("kz-sound","Bellatrix"),zg=["Adara","Alya","Bellatrix","Beryllium","Cobalt","Fluorine","Krypton","Palladium","Rubidium","Xenon"],Il=["off",...zg,"chime","bell","pop"],Zg={chime:[[880,0,0.25],[1320,0.12,0.35]],bell:[[660,0,0.9]],pop:[[520,0,0.08]]},Hn;function Tr(e=Ui()){try{if(zg.includes(e)){let n=new Audio(`/sounds/${e}.mp3`);n.volume=0.35,n.play().catch(()=>{});return}if(!Zg[e])return;Hn=Hn||new AudioContext,Hn.resume();let t=Hn.currentTime+0.02;for(let[n,s,i]of Zg[e]){let r=Hn.createOscillator(),o=Hn.createGain();r.type=e==="pop"?"triangle":"sine",r.frequency.value=n,o.gain.setValueAtTime(0.0001,t+s),o.gain.exponentialRampToValueAtTime(0.25,t+s+0.01),o.gain.exponentialRampToValueAtTime(0.0001,t+s+i),r.connect(o).connect(Hn.destination),r.start(t+s),r.stop(t+s+i+0.05)}}catch(t){}}addEventListener("pointerdown",()=>{try{Hn=Hn||new AudioContext,Hn.resume()}catch(e){}},{once:!0});function gu(e,t){if(!zl())return;Tr();try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var _l=null,Bl=null,Ig=null,Hi=(e)=>e.pty?"running in its workspace":"opened in your terminal",No=()=>Ig||=new Promise((e,t)=>{let n=document.createElement("link");n.rel="stylesheet",n.href="/term.css",document.head.append(n);let s=document.createElement("script");s.src="/term.js",s.onload=()=>e(window.kzTerm),s.onerror=()=>{Ig=null,t()},document.head.append(s)});function ys(){if(Bl)Bl();Bl=null,_l=null,m("panel").classList.remove("wide")}async function Ou(e){let t=e.pty.key;if(_l===t&&m("pbody").querySelector(".term"))return;ys(),_l=t,m("panel").classList.add("wide"),m("pbody").innerHTML='<div class="term" aria-label="Agent terminal"></div>';let n;try{n=await No()}catch{m("pbody").innerHTML='<p style="color:var(--dim)">The terminal could not load.</p>';return}if(_l!==t)return;Bl=n(m("pbody").querySelector(".term"),t,()=>pe(!0))}var Bg="kz-mic",bu=()=>{try{return localStorage.getItem(Bg)||""}catch{return""}},_g=(e="")=>({channelCount:1,noiseSuppression:!0,echoCancellation:!0,...e?{deviceId:{exact:e}}:{}});async function Wg(e,t,n){try{return await e(_g(t))}catch(s){if(!t||s?.name!=="OverconstrainedError")throw s;return n("Chosen microphone not found. Using the default"),e(_g())}}var Ng=()=>p`<select class="sel" id="v-mic" aria-labelledby="v-mic-l"><option value="">System default</option></select>`;async function Yg(){let e=m("v-mic");if(!e||!navigator.mediaDevices?.enumerateDevices)return;let t=bu(),n=(await navigator.mediaDevices.enumerateDevices().catch(()=>[])).filter((s)=>s.kind==="audioinput"&&s.deviceId&&s.deviceId!=="default");e.innerHTML=p`<option value="">System default</option>${n.map((s,i)=>p`<option value="${s.deviceId}">${s.label||`Microphone ${i+1}`}</option>`)}`.s,e.value=n.some((s)=>s.deviceId===t)?t:"",e.onchange=()=>{try{localStorage.setItem(Bg,e.value)}catch{}}}var $1="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",Ug={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},yu=null,S1=`import{pipeline}from"${$1}";let asr=null;
|
|
3
3
|
onmessage=async e=>{const m=e.data;try{
|
|
4
4
|
if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
|
package/web/term.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen terminal
|
|
1
|
+
/* kaizen terminal 1b06857f87822e5f -- generated by bun run build:web from web/term.ts; do not edit */
|
|
2
2
|
(()=>{var Ro=0,Ao=()=>{};function Sc(e,t,i,s){return s&&Math.abs(i-1)<0.05&&t-e>100?Math.round(e):null}function To(){if(Ro++===0){let e=window.visualViewport,t=()=>{let s=document.activeElement,r=s instanceof HTMLElement&&!!s.closest(".term, .termkeys"),n=e&&matchMedia("(max-width:640px)").matches?Sc(e.height,window.innerHeight,e.scale,r):null;if(document.body.classList.toggle("term-keyboard",n!==null),n!==null)document.documentElement.style.setProperty("--term-viewport-height",`${n}px`);else document.documentElement.style.removeProperty("--term-viewport-height")},i=()=>requestAnimationFrame(t);e?.addEventListener("resize",t),e?.addEventListener("scroll",t),window.addEventListener("resize",t),document.addEventListener("focusin",i),document.addEventListener("focusout",i),t(),Ao=()=>{e?.removeEventListener("resize",t),e?.removeEventListener("scroll",t),window.removeEventListener("resize",t),document.removeEventListener("focusin",i),document.removeEventListener("focusout",i),document.body.classList.remove("term-keyboard"),document.documentElement.style.removeProperty("--term-viewport-height")}}return()=>{if(--Ro===0)Ao()}}var{defineProperty:Ia,getOwnPropertyDescriptor:bc}=Object,yc=(e,t)=>{for(var i in t)Ia(e,i,{get:t[i],enumerable:!0})},ge=(e,t,i,s)=>{for(var r=s>1?void 0:s?bc(t,i):t,n=e.length-1,o;n>=0;n--)(o=e[n])&&(r=(s?o(t,i,r):o(r))||r);return s&&r&&Ia(t,i,r),r},O=(e,t)=>(i,s)=>t(i,s,e),Bo="Terminal input",$r={get:()=>Bo,set:(e)=>Bo=e},Po="Too much output to announce, navigate to rows manually to read",Ur={get:()=>Po,set:(e)=>Po=e};function Cc(e){return e.replace(/\r?\n/g,"\r")}function xc(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function kc(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function Lc(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Na(r,t,i,s)}}function Na(e,t,i,s){e=Cc(e),e=xc(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Fa(e,t,i){let s=i.getBoundingClientRect(),r=e.clientX-s.left-10,n=e.clientY-s.top-10;t.style.width="20px",t.style.height="20px",t.style.left=`${r}px`,t.style.top=`${n}px`,t.style.zIndex="1000",t.focus()}function Oo(e,t,i,s,r){Fa(e,t,i),r&&s.rightClickSelect(e),t.value=s.selectionText,t.select()}function Jt(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function qs(e,t=0,i=e.length){let s="";for(let r=t;r<i;++r){let n=e[r];n>65535?(n-=65536,s+=String.fromCharCode((n>>10)+55296)+String.fromCharCode(n%1024+56320)):s+=String.fromCharCode(n)}return s}var Ec=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r=0;if(this._interim){let n=e.charCodeAt(r++);56320<=n&&n<=57343?t[s++]=(this._interim-55296)*1024+n-56320+65536:(t[s++]=this._interim,t[s++]=n),this._interim=0}for(let n=r;n<i;++n){let o=e.charCodeAt(n);if(55296<=o&&o<=56319){if(++n>=i)return this._interim=o,s;let a=e.charCodeAt(n);56320<=a&&a<=57343?t[s++]=(o-55296)*1024+a-56320+65536:(t[s++]=o,t[s++]=a);continue}o!==65279&&(t[s++]=o)}return s}},Mc=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let i=e.length;if(!i)return 0;let s=0,r,n,o,a,h=0,l=0;if(this.interim[0]){let f=!1,g=this.interim[0];g&=(g&224)===192?31:(g&240)===224?15:7;let v=0,y;for(;(y=this.interim[++v]&63)&&v<4;)g<<=6,g|=y;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,R=E-v;for(;l<R;){if(l>=i)return 0;if(y=e[l++],(y&192)!==128){l--,f=!0;break}else this.interim[v++]=y,g<<=6,g|=y&63}f||(E===2?g<128?l--:t[s++]=g:E===3?g<2048||g>=55296&&g<=57343||g===65279||(t[s++]=g):g<65536||g>1114111||(t[s++]=g)),this.interim.fill(0)}let d=i-4,c=l;for(;c<i;){for(;c<d&&!((r=e[c])&128)&&!((n=e[c+1])&128)&&!((o=e[c+2])&128)&&!((a=e[c+3])&128);)t[s++]=r,t[s++]=n,t[s++]=o,t[s++]=a,c+=4;if(r=e[c++],r<128)t[s++]=r;else if((r&224)===192){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(h=(r&31)<<6|n&63,h<128){c--;continue}t[s++]=h}else if((r&240)===224){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(h=(r&15)<<12|(n&63)<<6|o&63,h<2048||h>=55296&&h<=57343||h===65279)continue;t[s++]=h}else if((r&248)===240){if(c>=i)return this.interim[0]=r,s;if(n=e[c++],(n&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,s;if(o=e[c++],(o&192)!==128){c--;continue}if(c>=i)return this.interim[0]=r,this.interim[1]=n,this.interim[2]=o,s;if(a=e[c++],(a&192)!==128){c--;continue}if(h=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,h<65536||h>1114111)continue;t[s++]=h}}return s}},Wa="",Qt=" ",as=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Is}static toColorRGB(t){return[t>>>16&255,t>>>8&255,t&255]}static fromColorRGB(t){return(t[0]&255)<<16|(t[1]&255)<<8|t[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)===50331648}isBgRGB(){return(this.bg&50331648)===50331648}isFgPalette(){return(this.fg&50331648)===16777216||(this.fg&50331648)===33554432}isBgPalette(){return(this.bg&50331648)===16777216||(this.bg&50331648)===33554432}isFgDefault(){return(this.fg&50331648)===0}isBgDefault(){return(this.bg&50331648)===0}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===16777216||(this.extended.underlineColor&50331648)===33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)===0:this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},Is=class e{constructor(t=0,i=0){this._ext=0,this._urlId=0,this._ext=t,this._urlId=i}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(t){this._ext=t}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(t){this._ext&=-469762049,this._ext|=t<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(t){this._ext&=-67108864,this._ext|=t&67108863}get urlId(){return this._urlId}set urlId(t){this._urlId=t}get underlineVariantOffset(){let t=(this._ext&3758096384)>>29;return t<0?t^4294967288:t}set underlineVariantOffset(t){this._ext&=536870911,this._ext|=t<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},_t=class e extends as{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new Is,this.combinedData=""}static fromCharData(t){let i=new e;return i.setFromCharData(t),i}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?Jt(this.content&2097151):""}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(t){this.fg=t[0],this.bg=0;let i=!1;if(t[1].length>2)i=!0;else if(t[1].length===2){let s=t[1].charCodeAt(0);if(55296<=s&&s<=56319){let r=t[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(s-55296)*1024+r-56320+65536|t[2]<<22:i=!0}else i=!0}else this.content=t[1].charCodeAt(0)|t[2]<<22;i&&(this.combinedData=t[1],this.content=2097152|t[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},Io="di$target",Kr="di$dependencies",Lr=new Map;function Dc(e){return e[Kr]||[]}function Ae(e){if(Lr.has(e))return Lr.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");Rc(t,i,r)};return t._id=e,Lr.set(e,t),t}function Rc(e,t,i){t[Io]===t?t[Kr].push({id:e,index:i}):(t[Kr]=[{id:e,index:i}],t[Io]=t)}var Ke=Ae("BufferService"),za=Ae("CoreMouseService"),mi=Ae("CoreService"),Ac=Ae("CharsetService"),wn=Ae("InstantiationService"),Ha=Ae("LogService"),qe=Ae("OptionsService"),$a=Ae("OscLinkService"),Tc=Ae("UnicodeService"),hs=Ae("DecorationService"),qr=class{constructor(e,t,i){this._bufferService=e,this._optionsService=t,this._oscLinkService=i}provideLinks(e,t){let i=this._bufferService.buffer.lines.get(e-1);if(!i){t(void 0);return}let s=[],r=this._optionsService.rawOptions.linkHandler,n=new _t,o=i.getTrimmedLength(),a=-1,h=-1,l=!1;for(let d=0;d<o;d++)if(!(h===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(h===-1){h=d,a=n.extended.urlId;continue}else l=n.extended.urlId!==a;else h!==-1&&(l=!0);if(l||h!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(a)?.uri;if(c){let f={start:{x:h+1,y:e},end:{x:d+(!l&&d===o-1?1:0),y:e}},g=!1;if(!r?.allowNonHttpProtocols)try{let v=new URL(c);["http:","https:"].includes(v.protocol)||(g=!0)}catch{g=!0}g||s.push({text:c,range:f,activate:(v,y)=>r?r.activate(v,y,f):Bc(v,y),hover:(v,y)=>r?.hover?.(v,y,f),leave:(v,y)=>r?.leave?.(v,y,f)})}l=!1,n.hasExtendedAttrs()&&n.extended.urlId?(h=d,a=n.extended.urlId):(h=-1,a=-1)}}t(s)}};qr=ge([O(0,Ke),O(1,qe),O(2,$a)],qr);function Bc(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
3
3
|
|
|
4
4
|
WARNING: This link could potentially be dangerous`)){let i=window.open();if(i){try{i.opener=null}catch{}i.location.href=t}else console.warn("Opening link blocked as opener could not be cleared")}}var Vs=Ae("CharSizeService"),Ot=Ae("CoreBrowserService"),Sn=Ae("MouseService"),It=Ae("RenderService"),Pc=Ae("SelectionService"),Ua=Ae("CharacterJoinerService"),ki=Ae("ThemeService"),Ka=Ae("LinkProviderService"),Oc=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?No.isErrorNoTelemetry(e)?new No(e.message+`
|
package/web/video.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* kaizen video page
|
|
1
|
+
/* kaizen video page 1b06857f87822e5f -- generated by bun run build:web from web/video.ts; do not edit */
|
|
2
2
|
(()=>{var gn=null,Na=(e,t=gn)=>t?.find((n)=>n.dir===e.state&&(n.id===e.taskId||e.kind==="run"&&[n.activeRun,...(n.runs??n.runIds??[]).map((s)=>typeof s==="string"?s:s.id),...n.legacy?.kind==="run"?[n.legacy.id]:[]].includes(e.id)));function ls(e){if(gn=e,typeof document<"u"){let t=e.filter((n)=>n.attention.category==="needs-you").length;document.querySelectorAll('.rail a[data-view="tasks"]').forEach((n)=>{if(t)n.dataset.n=String(t);else delete n.dataset.n;n.title=t?`Tasks · ${t} need you`:"Tasks",n.setAttribute("aria-label",n.title)}),dispatchEvent(new Event("kz-task-attention"))}}function Yl(e,t=gn){if(t){let n=new Set(e.map((s)=>s.state).filter(Boolean));return t.filter((s)=>(!n.size||n.has(s.dir))&&s.attention.category==="needs-you").length}return e.filter((n)=>!n.archived&&(n.kind==="run"&&n.status==="waiting"||n.pty?.alive&&n.pty.asking)).length}var hi=null,Ql=null,Xl=(e)=>{Ql=e};function gi(e,t,n){if(fi++,hi=e,typeof window<"u")dispatchEvent(new Event("kz-all-cards"));Ql?.(e,t,n)}var fi=0,Vl="",mi=!1,Pa=!1,gm=2000,_l=0,Jl;async function Wt(){if(mi){Pa=!0;return}let e=_l+gm-Date.now();if(e>0){Jl??=setTimeout(()=>{Jl=void 0,Wt()},e);return}_l=Date.now(),mi=!0;do{Pa=!1;let t=fi;try{let n=await fetch("/state?all=1");if(!n.ok)continue;let s=await n.text(),a=s.replace(/"now":\d+\}$/,"");if(a===Vl)continue;let{cards:o,projects:i,rail:c,agents:u}=JSON.parse(s);if(!Pa&&t===fi)Vl=a,gi(o,[...i,...c??[]],u)}catch{}}while(Pa);mi=!1}var g={S:{project:null,projects:[],cards:[],now:Date.now(),all:!1,dir:null},all:new URLSearchParams(location.search).get("all")!=="0",dir:null,openKey:null,mode:null,modeKey:null,menuKey:null,flash:new Set,tab:"request",lastTab:"request",runDoc:null,clearMenu:!1,sevMenu:!1,wantTerm:null,wantPty:null,shells:[],setQ:"",setScope:"all",setPage:null,setBack:!1,pageGen:0,PL:[],shown:new Set((()=>{try{return JSON.parse(localStorage.getItem("kz-show"))||[]}catch(e){return[]}})())};var l=(e)=>document.getElementById(e),bn=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&","<":"<",">":">",'"':"""})[t]);class yi{s;constructor(e){this.s=e}toString(){return this.s}}var I=(e)=>new yi(String(e)),Zl=(e)=>e instanceof yi?e.s:Array.isArray(e)?e.map(Zl).join(""):e==null||e===!1?"":bn(e),r=(e,...t)=>I(e.reduce((n,s,a)=>n+Zl(t[a-1])+s)),M=(e)=>I(`<svg><use href="#i-${e}"/></svg>`),Pe=(e,t={})=>{let n="chk"+(t.sm?" sm":""),s=I(Object.entries(t.attrs??{}).map(([a,o])=>` ${a}="${bn(o)}"`).join(""));return t.box?r`<input type="checkbox" class="${n}" role="switch"${s}${I(e?" checked":"")}>`:r`<button type="button" class="${n}${e?" on":""}" role="switch" aria-checked="${String(e)}"${s}></button>`},ec=I('<div aria-busy="true" aria-label="Loading"><span class="skel" style="height:16px;width:35%;margin:20px 0 14px"></span>'+'<span class="skel" style="height:44px;margin-bottom:10px"></span>'.repeat(4)+"</div>"),bm=1500000;async function ym(e){if(e.size<=bm||!/^image\/(jpeg|png|webp|bmp|heic|heif)$/.test(e.type))return e;try{let t=await createImageBitmap(e),n=Math.min(1,2560/Math.max(t.width,t.height)),s=document.createElement("canvas");s.width=Math.round(t.width*n),s.height=Math.round(t.height*n),s.getContext("2d").drawImage(t,0,0,s.width,s.height);let a=await new Promise((o)=>s.toBlob(o,"image/jpeg",0.85));return a&&a.size<e.size?new File([a],e.name.replace(/\.\w+$/,"")+".jpg",{type:"image/jpeg"}):e}catch{return e}}var Bn=(e)=>Promise.all(e.map(async(t)=>{let n=await ym(t);return new Promise((s)=>{let a=new FileReader;a.onload=()=>s({name:n.name,data:a.result}),a.readAsDataURL(n)})}));function nt(e){let t=document.createElement("dialog");return t.className="kz",t.innerHTML=`<form class="inl" method="dialog">${e}</form>`,t.onclose=()=>t.remove(),t.onclick=(n)=>{if(n.target===t)t.close()},document.body.appendChild(t),t.showModal(),t}var cs=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},ds=(e)=>cs()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve()),bi=[5,25,50,100];function za(e){let t=25;try{let n=Number(localStorage.getItem("kz-page:"+e));if(bi.includes(n))t=n}catch{}return{id:e,size:t,at:0,total:0}}function Oa(e,t){return e.total=t.length,e.at=Math.max(0,Math.min(e.at,Math.ceil(t.length/e.size)-1)),t.slice(e.at*e.size,(e.at+1)*e.size)}function Ks(e){if(e.total<=bi[0])return"";let t=e.at*e.size+1,n=Math.min(e.total,t+e.size-1);return r`<div class="kpager" id="pg-${e.id}"><label>Rows<select class="sel" aria-label="Rows per page">${bi.map((s)=>r`<option${s===e.size?I(" selected"):""}>${s}</option>`)}</select></label><span>${t}–${n} of ${e.total}</span><button class="btn sm" type="button" data-to="-1"${e.at?"":I(" disabled")}>Prev</button><button class="btn sm" type="button" data-to="1"${n<e.total?"":I(" disabled")}>Next</button></div>`}function Ba(e,t){let n=l("pg-"+e.id);if(!n)return;n.querySelector("select").onchange=(s)=>{e.size=+s.target.value,e.at=0;try{localStorage.setItem("kz-page:"+e.id,String(e.size))}catch{}t()},n.querySelectorAll("[data-to]").forEach((s)=>s.onclick=()=>{e.at+=+s.dataset.to,t()})}var vm=!1;try{vm=localStorage.getItem("kz-res-disk")==="1"}catch{}var tc=86400000,Me=(e,t)=>{let n=t-e;return n<3600000?Math.round(n/60000)+"m":n<86400000?Math.round(n/3600000)+"h":Math.round(n/86400000)+"d"},vi={claude:"Claude Code",codex:"Codex",agy:"Antigravity",opencode:"OpenCode",gemini:"Gemini",cursor:"Cursor",yolo:"yolo",unrechecked:"fix not rechecked"},nc={claude:1,codex:1,agy:1,opencode:1,gemini:1,cursor:1,full:1,lite:1},sc=(e,t,n)=>t&&e.includes(t)?t:n?null:e[0]??null,ac=["Tasks","Planning","Building","Review","Done"],yn={idea:"idea",starting:"start",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"},wm={explore:"exploration needs your decision","approvals.plan":"plan needs your approval","approvals.review":"review needs your approval"},Mt=(e)=>wm[e]||e,vn={idea:"idea",starting:"starting",running:"running",stalled:"stalled",waiting:"waiting on you",done:"done",abandoned:"abandoned"};var Ee=(e)=>typeof e==="string"?[e]:e.kids.flatMap(Ee);function us(e,t){if(typeof e==="string")return t(e)?e:null;let n=[],s=[];if(e.kids.forEach((a,o)=>{let i=us(a,t);if(i)n.push(i),s.push(e.sizes[o]??1)}),!n.length)return null;if(n.length===1)return n[0];return n.length===e.kids.length&&n.every((a,o)=>a===e.kids[o])?e:{dir:e.dir,kids:n,sizes:s}}var Wn=(e,t)=>`ws:${e}:${t}`,Kn=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending",Ua=(e)=>e.gitDue==="push"?"push":"commit",Fn=(e)=>e.kind==="run"&&(e.status==="abandoned"||e.status==="done"&&e.accept!=="needs"&&!Kn(e)),lc=(e,t,n,s)=>e.state===t&&s(e)===n,$i=(e,t,n,s)=>e.filter((a)=>!a.archived&&lc(a,t,n,s)&&(a.kind==="idea"?!!a.pty:a.kind==="run"&&!Fn(a))),xi=(e,t,n,s)=>e.filter((a)=>Fn(a)&&lc(a,t,n,s)).sort((a,o)=>(o.moved??0)-(a.moved??0));function cc(e,t,n,s){let a=!1;for(let o of t){let i=n(o),c=e[i];if(!c)continue;let u=e[Wn(o.state,s(o))]||={tabs:[],hidden:[],screens:[],on:null},h=new Set(u.screens.flatMap((f)=>Ee(f.tree)));for(let f of c.tabs??[])if(!u.tabs.some((y)=>y.id===f.id))u.tabs.push(f);for(let f of c.hidden??[])if(!u.hidden.includes(f))u.hidden.push(f);for(let f of c.screens??[]){let y=f.tree&&us(f.tree,(m)=>!h.has(m));if(!y)continue;Ee(y).forEach((m)=>h.add(m)),u.screens.push({...f,tree:y,focus:Ee(y).includes(f.focus)?f.focus:Ee(y)[0]})}u.on??=c.on,delete e[i],a=!0}return a}var Un=(e)=>e.kind==="run"&&(e.status==="waiting"||e.status==="done"&&e.accept==="needs"||Kn(e)||!!(e.pty?.alive&&e.pty.asking)),dc=(e,t,n,s)=>$i(e,t,n,s).filter((a)=>a.kind==="run").sort((a,o)=>+Un(o)-+Un(a)||(o.moved??0)-(a.moved??0)),pc=(e,t,n,s=(a)=>a.id)=>[...e,...t].find((a)=>s(a)===n)??e[0]??null;function km(e){if(e?.kind!=="run")return{};let t=e?.pty?.all??[],n=e?.pty?.stages??{},s={};for(let i of["explore","impl","review"])if(n[i]&&t.includes(n[i]))s[i]=n[i];if(n.plan&&t.includes(n.plan))s.plan=n.plan;let a=t.find((i)=>!Object.values(n).includes(i)),o=e.stage==="explore"?"explore":{1:"plan",2:"impl",3:"review"}[e.column];if(a&&o&&!Object.keys(n).length)s[o]=a;return s}function uc(e,t){let n={explore:"Explore",plan:"Plan",impl:"Build",review:"Review"},s=e?.pty?e.pty.all??[e.pty.key]:[],a=new Map(Object.entries(km(e)).map(([u,h])=>[h,n[u]])),o=s.filter((u)=>!a.has(u)),i=e?.stage==="explore"?"Explore":n[{1:"plan",2:"impl",3:"review"}[e?.column]??""],c=s.at(-1);if(i&&c&&a.has(c))a.set(c,i);return s.map((u)=>({key:u,title:a.has(u)?`${a.get(u)} · ${t}`:t+(o.length>1?" "+(o.indexOf(u)+1):"")}))}var mc=(e)=>e.kind==="run"&&(e.column===3||e.status==="done"),Si=(e)=>e?/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/.exec(e)?.[0]:void 0;function Wa(e,t){let n=e?[...e.matchAll(/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/g)].map((a)=>a[0]):[],s=(a)=>Number(new URL(a).port||80);return n.find((a)=>t.includes(s(a)))??(t.length?`http://localhost:${t[0]}`:n[0])}var fc=(e,t,n)=>{let s=e.filter((a,o)=>o!==t);return s.splice(n>t?n-1:n,0,e[t]),s},hc=(e,t)=>e===t||e.startsWith(t+"/")&&!e.startsWith(t+"/.kaizen/wt/"),gc=(e,t)=>t!==void 0&&e>t,bc=3000,Ka=new Map,Fs=(e)=>e.key+"@"+(e.born??0),oc={conflict:0,failed:0,asking:0,working:1,done:2},ps={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},Fa={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function Ei(e,t,n=Ka){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return n.set(Fs(e),t),"working";return t-(n.get(Fs(e))??-1/0)<bc?"working":"done"}var yc=(e,t,n=Ka)=>Math.min(1/0,...e.filter((s)=>!s.asking&&!s.busy&&n.has(Fs(s))).map((s)=>bc-(t-n.get(Fs(s)))).filter((s)=>s>0)),vc=(e,t=Ka)=>{let n=new Set(e.map(Fs));for(let s of t.keys())if(!n.has(s))t.delete(s)},Ai=(e,t,n,s,a,o=Ka)=>e.filter((i)=>i.dir===t&&s({state:i.dir,ws:i.ws})===n).map((i)=>({a:i,st:Ei(i,a,o)})).sort((i,c)=>oc[i.st]-oc[c.st]),ic=({a:e,st:t})=>(e.land?"":e.last)||`${ps[t]} - ${e.name}`,rc=(e,t)=>!e?"":t-e<60000?"now":Me(e,t),$m=(e,t)=>e+"\x00"+t;function wc(e,t,n){let s=$m(t,n);if(e[s])delete e[s];else e[s]=!0;return e}var xm=["claude","codex","gemini"],wi=(e)=>r`<svg aria-hidden="true"><use href="#i-${xm.includes(e.agent??"")?e.agent:"ai"}"/></svg>`,ki=(e)=>r`<i class="si ${Fa[e]}"></i>`,Sm=r`<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M6 9l6 6 6-6" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>`;function kc(e,t,n,s,a){if(!e.length)return"";let o=r`data-dir="${s}" data-ws="${a}"`;if(e.length===1){let u=e[0];return r`<div class="wag"><button type="button" class="aone" data-term="${u.a.key}" ${o} title="${u.a.name}: open its terminal">${ki(u.st)}${wi(u.a)}<span class="atx">${ps[u.st]} - ${u.a.name}</span><small>${rc(u.a.at,t)}</small></button></div>`}let i=r`<button type="button" class="wchev${n?" on":""}" data-wopen ${o} aria-expanded="${String(n)}" aria-label="${String(e.length)} agents: ${n?"hide":"show"} the list">${Sm}</button>`;if(n)return r`<div class="wag"><span class="aht">${String(e.length)} agents</span>${i}</div><div class="alist">${e.map((u)=>r`<button type="button" class="arow" data-term="${u.a.key}" ${o} title="${ic(u)}">${ki(u.st)}${wi(u.a)}<span class="atx">${ic(u)}</span><small>${rc(u.a.at,t)}</small></button>`)}</div>`;let c=["conflict","failed","asking","working","done"].map((u)=>({st:u,rs:e.filter((h)=>h.st===u)})).filter((u)=>u.rs.length);return r`<div class="wag"><span class="chips">${c.map((u)=>r`<span class="chip">${ki(u.st)}${u.rs.map((h)=>r`<button type="button" class="amark" data-term="${h.a.key}" ${o} title="${h.a.name} - ${ps[u.st]}: open its terminal" aria-label="${h.a.name} - ${ps[u.st]}: open its terminal">${wi(h.a)}</button>`)}</span>`)}</span>${i}</div>`}function Li(e){return e.toLowerCase().trim().replace(/[^a-z0-9/._-]+/g,"-").replace(/\.{2,}/g,".").replace(/\/{2,}/g,"/").replace(/(^|\/)[-.]+/g,"$1").slice(0,60).replace(/[-./]+(\/|$)/g,"$1").replace(/\/$/,"").replace(/\.lock(\/|$)/g,"-lock$1")}var $c;function H(e,t){let n=l("toast");if(n.textContent=e,n.classList.toggle("rep",!!t),t){let s=document.createElement("a");s.href="/issue?"+new URLSearchParams(t),s.target="_blank",s.rel="noopener",s.textContent="Report",n.append(" ",s)}n.classList.add("on"),clearTimeout($c),$c=setTimeout(()=>n.classList.remove("on"),t?8000:4000)}function Kt(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}var Sc=(e,t)=>{try{return localStorage.getItem(e)||t}catch(n){return t}},Ga=()=>Sc("kz-notify","on")==="on",Gn=()=>Sc("kz-sound","Bellatrix"),Ec=["Adara","Alya","Bellatrix","Beryllium","Cobalt","Fluorine","Krypton","Palladium","Rubidium","Xenon"],Va=["off",...Ec,"chime","bell","pop"],xc={chime:[[880,0,0.25],[1320,0.12,0.35]],bell:[[660,0,0.9]],pop:[[520,0,0.08]]},Ct;function ms(e=Gn()){try{if(Ec.includes(e)){let n=new Audio(`/sounds/${e}.mp3`);n.volume=0.35,n.play().catch(()=>{});return}if(!xc[e])return;Ct=Ct||new AudioContext,Ct.resume();let t=Ct.currentTime+0.02;for(let[n,s,a]of xc[e]){let o=Ct.createOscillator(),i=Ct.createGain();o.type=e==="pop"?"triangle":"sine",o.frequency.value=n,i.gain.setValueAtTime(0.0001,t+s),i.gain.exponentialRampToValueAtTime(0.25,t+s+0.01),i.gain.exponentialRampToValueAtTime(0.0001,t+s+a),o.connect(i).connect(Ct.destination),o.start(t+s),o.stop(t+s+a+0.05)}}catch(t){}}addEventListener("pointerdown",()=>{try{Ct=Ct||new AudioContext,Ct.resume()}catch(e){}},{once:!0});function Ti(e,t){if(!Ga())return;ms();try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var _a=null,Ja=null,Ac=null,Vn=(e)=>e.pty?"running in its workspace":"opened in your terminal",Gs=()=>Ac||=new Promise((e,t)=>{let n=document.createElement("link");n.rel="stylesheet",n.href="/term.css",document.head.append(n);let s=document.createElement("script");s.src="/term.js",s.onload=()=>e(window.kzTerm),s.onerror=()=>{Ac=null,t()},document.head.append(s)});function Ft(){if(Ja)Ja();Ja=null,_a=null,l("panel").classList.remove("wide")}async function Mi(e){let t=e.pty.key;if(_a===t&&l("pbody").querySelector(".term"))return;Ft(),_a=t,l("panel").classList.add("wide"),l("pbody").innerHTML='<div class="term" aria-label="Agent terminal"></div>';let n;try{n=await Gs()}catch{l("pbody").innerHTML='<p style="color:var(--dim)">The terminal could not load.</p>';return}if(_a!==t)return;Ja=n(l("pbody").querySelector(".term"),t,()=>se(!0))}var Tc="kz-mic",Ci=()=>{try{return localStorage.getItem(Tc)||""}catch{return""}},Lc=(e="")=>({channelCount:1,noiseSuppression:!0,echoCancellation:!0,...e?{deviceId:{exact:e}}:{}});async function Mc(e,t,n){try{return await e(Lc(t))}catch(s){if(!t||s?.name!=="OverconstrainedError")throw s;return n("Chosen microphone not found. Using the default"),e(Lc())}}var Cc=()=>r`<select class="sel" id="v-mic" aria-labelledby="v-mic-l"><option value="">System default</option></select>`;async function Hc(){let e=l("v-mic");if(!e||!navigator.mediaDevices?.enumerateDevices)return;let t=Ci(),n=(await navigator.mediaDevices.enumerateDevices().catch(()=>[])).filter((s)=>s.kind==="audioinput"&&s.deviceId&&s.deviceId!=="default");e.innerHTML=r`<option value="">System default</option>${n.map((s,a)=>r`<option value="${s.deviceId}">${s.label||`Microphone ${a+1}`}</option>`)}`.s,e.value=n.some((s)=>s.deviceId===t)?t:"",e.onchange=()=>{try{localStorage.setItem(Tc,e.value)}catch{}}}var Em="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",jc={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},Hi=null,Am=`import{pipeline}from"${Em}";let asr=null;
|
|
3
3
|
onmessage=async e=>{const m=e.data;try{
|
|
4
4
|
if(m.type==="load"){const prog=p=>{if(p.status==="progress")postMessage({type:"progress",file:p.file,pct:p.progress||0})};
|