kaizen-agent 1.82.1 → 1.83.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/web/notebook.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen notebook 8ea2cb9161d5ea08 -- generated by bun run build:web from web/notebook.ts; do not edit */
1
+ /* kaizen notebook a438553e8f8d3a37 -- generated by bun run build:web from web/notebook.ts; do not edit */
2
2
  var Js=null,Ml=(e,t=Js)=>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 $r(e){if(Js=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 cg(e,t=Js){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 tu=null,dg=null,ug=(e)=>{dg=e};function nu(e,t,n){if(eu++,tu=e,typeof window<"u")dispatchEvent(new Event("kz-all-cards"));dg?.(e,t,n)}var eu=0,og="",Jd=!1,Tl=!1,r1=2000,ag=0,lg;async function gs(){if(Jd){Tl=!0;return}let e=ag+r1-Date.now();if(e>0){lg??=setTimeout(()=>{lg=void 0,gs()},e);return}ag=Date.now(),Jd=!0;do{Tl=!1;let t=eu;try{let n=await fetch("/state?all=1");if(!n.ok)continue;let s=await n.text(),i=s.replace(/"now":\d+\}$/,"");if(i===og)continue;let{cards:r,projects:o,rail:a,agents:l}=JSON.parse(s);if(!Tl&&t===eu)og=i,nu(r,[...o,...a??[]],l)}catch{}}while(Tl);Jd=!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),ei=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]);class iu{s;constructor(e){this.s=e}toString(){return this.s}}var I=(e)=>new iu(String(e)),hg=(e)=>e instanceof iu?e.s:Array.isArray(e)?e.map(hg).join(""):e==null||e===!1?"":ei(e),p=(e,...t)=>I(e.reduce((n,s,i)=>n+hg(t[i-1])+s)),E=(e)=>I(`<svg><use href="#i-${e}"/></svg>`),pt=(e,t={})=>{let n="chk"+(t.sm?" sm":""),s=I(Object.entries(t.attrs??{}).map(([i,r])=>` ${i}="${ei(r)}"`).join(""));return t.box?p`<input type="checkbox" class="${n}" role="switch"${s}${I(e?" checked":"")}>`:p`<button type="button" class="${n}${e?" on":""}" role="switch" aria-checked="${String(e)}"${s}></button>`},fg=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>"),o1=1500000;async function a1(e){if(e.size<=o1||!/^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 zi=(e)=>Promise.all(e.map(async(t)=>{let n=await a1(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 Sr=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},xr=(e)=>Sr()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve()),su=[5,25,50,100];function Ll(e){let t=25;try{let n=Number(localStorage.getItem("kz-page:"+e));if(su.includes(n))t=n}catch{}return{id:e,size:t,at:0,total:0}}function El(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 _o(e){if(e.total<=su[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">${su.map((s)=>p`<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 Rl(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 l1=!1;try{l1=localStorage.getItem("kz-res-disk")==="1"}catch{}var pg=86400000,et=(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"},ru={claude:"Claude Code",codex:"Codex",agy:"Antigravity",opencode:"OpenCode",gemini:"Gemini",cursor:"Cursor",yolo:"yolo",unrechecked:"fix not rechecked"},mg={claude:1,codex:1,agy:1,opencode:1,gemini:1,cursor:1,full:1,lite:1},gg=(e,t,n)=>t&&e.includes(t)?t:n?null:e[0]??null,Og=["Tasks","Planning","Building","Review","Done"],ti={idea:"idea",starting:"start",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"},c1={explore:"exploration needs your decision","approvals.plan":"plan needs your approval","approvals.review":"review needs your approval"},Yn=(e)=>c1[e]||e,ni={idea:"idea",starting:"starting",running:"running",stalled:"stalled",waiting:"waiting on you",done:"done",abandoned:"abandoned"};var Ne=(e)=>typeof e==="string"?[e]:e.kids.flatMap(Ne);function Pr(e,t){if(typeof e==="string")return t(e)?e:null;let n=[],s=[];if(e.kids.forEach((i,r)=>{let o=Pr(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 _i=(e,t)=>`ws:${e}:${t}`,Bi=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending",jl=(e)=>e.gitDue==="push"?"push":"commit",Wi=(e)=>e.kind==="run"&&(e.status==="abandoned"||e.status==="done"&&e.accept!=="needs"&&!Bi(e)),wg=(e,t,n,s)=>e.state===t&&s(e)===n,lu=(e,t,n,s)=>e.filter((i)=>!i.archived&&wg(i,t,n,s)&&(i.kind==="idea"?!!i.pty:i.kind==="run"&&!Wi(i))),cu=(e,t,n,s)=>e.filter((i)=>Wi(i)&&wg(i,t,n,s)).sort((i,r)=>(r.moved??0)-(i.moved??0));function vg(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[_i(r.state,s(r))]||={tabs:[],hidden:[],screens:[],on:null},c=new Set(l.screens.flatMap((d)=>Ne(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&&Pr(d.tree,(u)=>!c.has(u));if(!h)continue;Ne(h).forEach((u)=>c.add(u)),l.screens.push({...d,tree:h,focus:Ne(h).includes(d.focus)?d.focus:Ne(h)[0]})}l.on??=a.on,delete e[o],i=!0}return i}var Ii=(e)=>e.kind==="run"&&(e.status==="waiting"||e.status==="done"&&e.accept==="needs"||Bi(e)||!!(e.pty?.alive&&e.pty.asking)),$g=(e,t,n,s)=>lu(e,t,n,s).filter((i)=>i.kind==="run").sort((i,r)=>+Ii(r)-+Ii(i)||(r.moved??0)-(i.moved??0)),Sg=(e,t,n,s=(i)=>i.id)=>[...e,...t].find((i)=>s(i)===n)??e[0]??null;function d1(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 xg(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(d1(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 Qg=(e)=>e.kind==="run"&&(e.column===3||e.status==="done"),du=(e)=>e?/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/.exec(e)?.[0]:void 0;function Xl(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 Pg=3000,ql=new Map,Bo=(e)=>e.key+"@"+(e.born??0),bg={conflict:0,failed:0,asking:0,working:1,done:2},Qr={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},Zl={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function uu(e,t,n=ql){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return n.set(Bo(e),t),"working";return t-(n.get(Bo(e))??-1/0)<Pg?"working":"done"}var Ag=(e,t,n=ql)=>Math.min(1/0,...e.filter((s)=>!s.asking&&!s.busy&&n.has(Bo(s))).map((s)=>Pg-(t-n.get(Bo(s)))).filter((s)=>s>0)),Cg=(e,t=ql)=>{let n=new Set(e.map(Bo));for(let s of t.keys())if(!n.has(s))t.delete(s)},hu=(e,t,n,s,i,r=ql)=>e.filter((o)=>o.dir===t&&s({state:o.dir,ws:o.ws})===n).map((o)=>({a:o,st:uu(o,i,r)})).sort((o,a)=>bg[o.st]-bg[a.st]),yg=({a:e,st:t})=>(e.land?"":e.last)||`${Qr[t]} - ${e.name}`,kg=(e,t)=>!e?"":t-e<60000?"now":et(e,t),u1=(e,t)=>e+"\x00"+t;function Tg(e,t,n){let s=u1(t,n);if(e[s])delete e[s];else e[s]=!0;return e}var h1=["claude","codex","gemini"],ou=(e)=>p`<svg aria-hidden="true"><use href="#i-${h1.includes(e.agent??"")?e.agent:"ai"}"/></svg>`,au=(e)=>p`<i class="si ${Zl[e]}"></i>`,f1=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 Mg(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">${au(l.st)}${ou(l.a)}<span class="atx">${Qr[l.st]} - ${l.a.name}</span><small>${kg(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">${f1}</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="${yg(l)}">${au(l.st)}${ou(l.a)}<span class="atx">${yg(l)}</span><small>${kg(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">${au(l.st)}${l.rs.map((c)=>p`<button type="button" class="amark" data-term="${c.a.key}" ${r} title="${c.a.name} - ${Qr[l.st]}: open its terminal" aria-label="${c.a.name} - ${Qr[l.st]}: open its terminal">${ou(c.a)}</button>`)}</span>`)}</span>${o}</div>`}function fu(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 Lg;function R(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(Lg),Lg=setTimeout(()=>n.classList.remove("on"),t?8000:4000)}function Os(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}var Rg=(e,t)=>{try{return localStorage.getItem(e)||t}catch(n){return t}},Dl=()=>Rg("kz-notify","on")==="on",Ni=()=>Rg("kz-sound","Bellatrix"),jg=["Adara","Alya","Bellatrix","Beryllium","Cobalt","Fluorine","Krypton","Palladium","Rubidium","Xenon"],zl=["off",...jg,"chime","bell","pop"],Eg={chime:[[880,0,0.25],[1320,0.12,0.35]],bell:[[660,0,0.9]],pop:[[520,0,0.08]]},Un;function Ar(e=Ni()){try{if(jg.includes(e)){let n=new Audio(`/sounds/${e}.mp3`);n.volume=0.35,n.play().catch(()=>{});return}if(!Eg[e])return;Un=Un||new AudioContext,Un.resume();let t=Un.currentTime+0.02;for(let[n,s,i]of Eg[e]){let r=Un.createOscillator(),o=Un.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(Un.destination),r.start(t+s),r.stop(t+s+i+0.05)}}catch(t){}}addEventListener("pointerdown",()=>{try{Un=Un||new AudioContext,Un.resume()}catch(e){}},{once:!0});function pu(e,t){if(!Dl())return;Ar();try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var Il=null,_l=null,Xg=null,Yi=(e)=>e.pty?"running in its workspace":"opened in your terminal",Wo=()=>Xg||=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=()=>{Xg=null,t()},document.head.append(s)});function bs(){if(_l)_l();_l=null,Il=null,m("panel").classList.remove("wide")}async function mu(e){let t=e.pty.key;if(Il===t&&m("pbody").querySelector(".term"))return;bs(),Il=t,m("panel").classList.add("wide"),m("pbody").innerHTML='<div class="term" aria-label="Agent terminal"></div>';let n;try{n=await Wo()}catch{m("pbody").innerHTML='<p style="color:var(--dim)">The terminal could not load.</p>';return}if(Il!==t)return;_l=n(m("pbody").querySelector(".term"),t,()=>ue(!0))}var Zg="kz-mic",gu=()=>{try{return localStorage.getItem(Zg)||""}catch{return""}},qg=(e="")=>({channelCount:1,noiseSuppression:!0,echoCancellation:!0,...e?{deviceId:{exact:e}}:{}});async function Dg(e,t,n){try{return await e(qg(t))}catch(s){if(!t||s?.name!=="OverconstrainedError")throw s;return n("Chosen microphone not found. Using the default"),e(qg())}}var zg=()=>p`<select class="sel" id="v-mic" aria-labelledby="v-mic-l"><option value="">System default</option></select>`;async function Ig(){let e=m("v-mic");if(!e||!navigator.mediaDevices?.enumerateDevices)return;let t=gu(),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(Zg,e.value)}catch{}}}var p1="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",_g={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},Ou=null,m1=`import{pipeline}from"${p1}";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})};
@@ -215,7 +215,7 @@ For at least one agent, a folder or link of the same name is in the way. It is d
215
215
  ${l}
216
216
  </div>
217
217
  </div>
218
- `);return}e.innerHTML=String(p`
218
+ `);return}if(t.running){e.innerHTML=String(p`<div><p class="ph-h">WhatsApp Bridge</p><p class="ph-wait">Connecting…</p>${l}</div>`);return}e.innerHTML=String(p`
219
219
  <div>
220
220
  <p class="ph-h">WhatsApp Bridge</p>
221
221
  <p>Send finished videos and files straight to your phone's WhatsApp without opening any app.</p>
@@ -224,7 +224,7 @@ For at least one agent, a folder or link of the same name is in the way. It is d
224
224
  </div>
225
225
  ${l}
226
226
  </div>
227
- `)},o=async()=>{let l=await ec();if(l.error&&!l.installed)n=l.error;else t=l;r()};e.innerHTML='<p class="ph-wait">Checking WhatsApp…</p>',await o(),i=setInterval(async()=>{if(!e.isConnected){clearInterval(i);return}if(t&&!t.connected&&(t.qrSvg||s)){let l=await ec();if(!l.error)t=l,r()}},2500),e.onclick=async(l)=>{let c=l.target.closest("[data-wa]")?.dataset.wa;if(!c||s)return;if(n="",c==="check")return o();if(s=!0,r(),c==="connect"){let d=await ec({op:"connect"});if(s=!1,d.error)n=d.error;else t=d;r()}else if(c==="disconnect")await ec({op:"disconnect"}),s=!1,await o()}}var Zu=[["AI Capabilities",[{id:"agents",title:"Agents",desc:"Manage AI agents, set a default, and customize commands.",ico:"ai"},{id:"accounts",title:"AI Provider Accounts",desc:"Who is signed in to each AI tool kaizen runs. Add accounts only to switch between more than one.",ico:"link"},{id:"orchestration",title:"Orchestration",desc:"Split a run into workers, each in its own terminal. Off by default.",ico:"ai"},{id:"skills",title:"Skills",desc:"What your agents can do. Changes apply to new sessions.",ico:"note"},{id:"voice",title:"Voice",desc:"Speech-to-text dictation, run in the browser.",ico:"mic"}]],["Set Up",[{id:"general",title:"General",desc:"Which settings you are editing, folders, and maintenance.",ico:"gear"},{id:"integrations",title:"Integrations",desc:"Request sources, your Google account, and web research.",ico:"link"},{id:"mobile",title:"Mobile",desc:"Open kaizen from your phone.",ico:"send"}]],["Workflows",[{id:"approvals",title:"Approvals",desc:"Where a run stops and waits for you.",ico:"check"},{id:"autofix",title:"Auto-fix",desc:"What happens to review findings.",ico:"bug"},{id:"automations",title:"Automations",desc:"Schedules that start a run in this project.",ico:"clock"},{id:"git",title:"Git & Source Control",desc:"Branches and commits for each run.",ico:"pen"},{id:"terminal",title:"Terminal",desc:"The terminal dashboard.",ico:"term"}]],["Interface",[{id:"appearance",title:"Appearance",desc:"Theme, color and motion in this browser.",ico:"note"},{id:"notifications",title:"Notifications",desc:"Notices and sounds in this browser.",ico:"clock"},{id:"shortcuts",title:"Shortcuts",desc:"Keyboard shortcuts for common actions.",ico:"kbd"}]]],eQ=[[/^(preset|runner|explore\.|build\.|review\.executor)/,"agents","Workflow"],[/^(subagents\.|agent\.model\.)/,"agents","Models"],[/^agent\.handoff_model\./,"agents","Handoff session"],[/^agent\.default$/,"agents","Default agent"],[/^agent\./,"agents","Running agents"],[/^orchestration\./,"orchestration","Workers"],[/^dictation\./,"voice","Dictation"],[/^sources\./,"integrations","Request sources"],[/^(mode|approvals\.|auto_accept)/,"approvals","Approvals"],[/^auto_fix\./,"autofix","Auto-fix"],[/^auto_guard\./,"autofix","Auto mode guard"],[/^git\./,"git","Git"],[/^ui\./,"terminal","Terminal"],[/^board\.chat_hotkey$/,"shortcuts","Shortcuts"],[/^board\./,"general","App"],[/^(review\.|state\.)/,"general","Project"]],BO=(e)=>{let t=eQ.find(([n])=>n.test(e));return t?[t[1],t[2]]:["general","Other"]};var nt=null,ui=null,Dr=globalThis.kaizenDesktop,hi=Dr?"Kaizen":"kaizen",tQ=(e)=>Dr?Dr.check():fetch(e?"/version?fresh=1":"/version").then((t)=>t.json()),WO=(e)=>`${hi} ${e.latest} is available. You are running ${e.version}. Update it from the desktop app on your computer.`;function nQ(e){ui=e,nt=e.update?e:null;let t=document.querySelector('.rail a[data-view="settings"]');return t.classList.toggle("upd",!!nt),t.title=nt?`Settings: ${hi} ${e.latest} is available`:"Settings",!!nt}function Du(){let e=document.createElement("div");if(e.className=`updbar${nt?"":" quiet"}`,!nt)e.innerHTML=p`<span id="upd-msg" aria-live="polite">${ui?ui.behind?WO(ui):`${hi} ${ui.version}`:hi}</span
227
+ `)},o=async()=>{let l=await ec();if(l.error&&!l.installed)n=l.error;else t=l;r()};e.innerHTML='<p class="ph-wait">Checking WhatsApp…</p>',await o(),i=setInterval(async()=>{if(!e.isConnected){clearInterval(i);return}if(t&&!t.connected&&(t.qrSvg||s||t.running)){let l=await ec();if(!l.error)t=l,r()}},2500),e.onclick=async(l)=>{let c=l.target.closest("[data-wa]")?.dataset.wa;if(!c||s)return;if(n="",c==="check")return o();if(s=!0,r(),c==="connect"){let d=await ec({op:"connect"});if(s=!1,d.error)n=d.error;else t=d;r()}else if(c==="disconnect")await ec({op:"disconnect"}),s=!1,await o()}}var Zu=[["AI Capabilities",[{id:"agents",title:"Agents",desc:"Manage AI agents, set a default, and customize commands.",ico:"ai"},{id:"accounts",title:"AI Provider Accounts",desc:"Who is signed in to each AI tool kaizen runs. Add accounts only to switch between more than one.",ico:"link"},{id:"orchestration",title:"Orchestration",desc:"Split a run into workers, each in its own terminal. Off by default.",ico:"ai"},{id:"skills",title:"Skills",desc:"What your agents can do. Changes apply to new sessions.",ico:"note"},{id:"voice",title:"Voice",desc:"Speech-to-text dictation, run in the browser.",ico:"mic"}]],["Set Up",[{id:"general",title:"General",desc:"Which settings you are editing, folders, and maintenance.",ico:"gear"},{id:"integrations",title:"Integrations",desc:"Request sources, your Google account, and web research.",ico:"link"},{id:"mobile",title:"Mobile",desc:"Open kaizen from your phone.",ico:"send"}]],["Workflows",[{id:"approvals",title:"Approvals",desc:"Where a run stops and waits for you.",ico:"check"},{id:"autofix",title:"Auto-fix",desc:"What happens to review findings.",ico:"bug"},{id:"automations",title:"Automations",desc:"Schedules that start a run in this project.",ico:"clock"},{id:"git",title:"Git & Source Control",desc:"Branches and commits for each run.",ico:"pen"},{id:"terminal",title:"Terminal",desc:"The terminal dashboard.",ico:"term"}]],["Interface",[{id:"appearance",title:"Appearance",desc:"Theme, color and motion in this browser.",ico:"note"},{id:"notifications",title:"Notifications",desc:"Notices and sounds in this browser.",ico:"clock"},{id:"shortcuts",title:"Shortcuts",desc:"Keyboard shortcuts for common actions.",ico:"kbd"}]]],eQ=[[/^(preset|runner|explore\.|build\.|review\.executor)/,"agents","Workflow"],[/^(subagents\.|agent\.model\.)/,"agents","Models"],[/^agent\.handoff_model\./,"agents","Handoff session"],[/^agent\.default$/,"agents","Default agent"],[/^agent\./,"agents","Running agents"],[/^orchestration\./,"orchestration","Workers"],[/^dictation\./,"voice","Dictation"],[/^sources\./,"integrations","Request sources"],[/^(mode|approvals\.|auto_accept)/,"approvals","Approvals"],[/^auto_fix\./,"autofix","Auto-fix"],[/^auto_guard\./,"autofix","Auto mode guard"],[/^git\./,"git","Git"],[/^ui\./,"terminal","Terminal"],[/^board\.chat_hotkey$/,"shortcuts","Shortcuts"],[/^board\./,"general","App"],[/^(review\.|state\.)/,"general","Project"]],BO=(e)=>{let t=eQ.find(([n])=>n.test(e));return t?[t[1],t[2]]:["general","Other"]};var nt=null,ui=null,Dr=globalThis.kaizenDesktop,hi=Dr?"Kaizen":"kaizen",tQ=(e)=>Dr?Dr.check():fetch(e?"/version?fresh=1":"/version").then((t)=>t.json()),WO=(e)=>`${hi} ${e.latest} is available. You are running ${e.version}. Update it from the desktop app on your computer.`;function nQ(e){ui=e,nt=e.update?e:null;let t=document.querySelector('.rail a[data-view="settings"]');return t.classList.toggle("upd",!!nt),t.title=nt?`Settings: ${hi} ${e.latest} is available`:"Settings",!!nt}function Du(){let e=document.createElement("div");if(e.className=`updbar${nt?"":" quiet"}`,!nt)e.innerHTML=p`<span id="upd-msg" aria-live="polite">${ui?ui.behind?WO(ui):`${hi} ${ui.version}`:hi}</span
228
228
  ><button class="btn" id="upd-chk">Check for updates</button>`;else{let s=(nt.notes||[]).map((r)=>p`<li><b>${r.v}</b> ${r.text}</li>`),i=s.length?p`<span class="updnew"
229
229
  ><button class="btn" aria-describedby="upd-notes">What's new</button
230
230
  ><span class="updpop" id="upd-notes" role="tooltip"
package/web/term.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen terminal 8ea2cb9161d5ea08 -- generated by bun run build:web from web/term.ts; do not edit */
1
+ /* kaizen terminal a438553e8f8d3a37 -- generated by bun run build:web from web/term.ts; do not edit */
2
2
  (()=>{var ko=0,Lo=()=>{};function pc(e,t,i,s){return s&&Math.abs(i-1)<0.05&&t-e>100?Math.round(e):null}function Eo(){if(ko++===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?pc(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(),Lo=()=>{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(--ko===0)Lo()}}var{defineProperty:Aa,getOwnPropertyDescriptor:vc}=Object,mc=(e,t)=>{for(var i in t)Aa(e,i,{get:t[i],enumerable:!0})},_e=(e,t,i,s)=>{for(var r=s>1?void 0:s?vc(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&&Aa(t,i,r),r},I=(e,t)=>(i,s)=>t(i,s,e),Mo="Terminal input",Nr={get:()=>Mo,set:(e)=>Mo=e},Do="Too much output to announce, navigate to rows manually to read",Fr={get:()=>Do,set:(e)=>Do=e};function wc(e){return e.replace(/\r?\n/g,"\r")}function Sc(e,t){return t?"\x1B[200~"+e+"\x1B[201~":e}function bc(e,t){e.clipboardData&&e.clipboardData.setData("text/plain",t.selectionText),e.preventDefault()}function yc(e,t,i,s){if(e.stopPropagation(),e.clipboardData){let r=e.clipboardData.getData("text/plain");Ta(r,t,i,s)}}function Ta(e,t,i,s){e=wc(e),e=Sc(e,i.decPrivateModes.bracketedPasteMode&&s.rawOptions.ignoreBracketedPasteMode!==!0),i.triggerDataEvent(e,!0),t.value=""}function Ba(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 Ro(e,t,i,s,r){Ba(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 Hs(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 Cc=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}},xc=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,l=0,h=0;if(this.interim[0]){let f=!1,p=this.interim[0];p&=(p&224)===192?31:(p&240)===224?15:7;let w=0,y;for(;(y=this.interim[++w]&63)&&w<4;)p<<=6,p|=y;let E=(this.interim[0]&224)===192?2:(this.interim[0]&240)===224?3:4,B=E-w;for(;h<B;){if(h>=i)return 0;if(y=e[h++],(y&192)!==128){h--,f=!0;break}else this.interim[w++]=y,p<<=6,p|=y&63}f||(E===2?p<128?h--:t[s++]=p:E===3?p<2048||p>=55296&&p<=57343||p===65279||(t[s++]=p):p<65536||p>1114111||(t[s++]=p)),this.interim.fill(0)}let d=i-4,c=h;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(l=(r&31)<<6|n&63,l<128){c--;continue}t[s++]=l}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(l=(r&15)<<12|(n&63)<<6|o&63,l<2048||l>=55296&&l<=57343||l===65279)continue;t[s++]=l}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(l=(r&7)<<18|(n&63)<<12|(o&63)<<6|a&63,l<65536||l>1114111)continue;t[s++]=l}}return s}},Pa="",Gt=" ",ss=class e{constructor(){this.fg=0,this.bg=0,this.extended=new Ts}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}},Ts=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}},lt=class e extends ss{constructor(){super(...arguments);this.content=0,this.fg=0,this.bg=0,this.extended=new Ts,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()]}},Ao="di$target",Wr="di$dependencies",br=new Map;function kc(e){return e[Wr]||[]}function Ae(e){if(br.has(e))return br.get(e);let t=function(i,s,r){if(arguments.length!==3)throw Error("@IServiceName-decorator can only be used to decorate a parameter");Lc(t,i,r)};return t._id=e,br.set(e,t),t}function Lc(e,t,i){t[Ao]===t?t[Wr].push({id:e,index:i}):(t[Wr]=[{id:e,index:i}],t[Ao]=t)}var $e=Ae("BufferService"),Oa=Ae("CoreMouseService"),ui=Ae("CoreService"),Ec=Ae("CharsetService"),fn=Ae("InstantiationService"),Ia=Ae("LogService"),Ue=Ae("OptionsService"),Na=Ae("OscLinkService"),Mc=Ae("UnicodeService"),rs=Ae("DecorationService"),zr=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 lt,o=i.getTrimmedLength(),a=-1,l=-1,h=!1;for(let d=0;d<o;d++)if(!(l===-1&&!i.hasContent(d))){if(i.loadCell(d,n),n.hasExtendedAttrs()&&n.extended.urlId)if(l===-1){l=d,a=n.extended.urlId;continue}else h=n.extended.urlId!==a;else l!==-1&&(h=!0);if(h||l!==-1&&d===o-1){let c=this._oscLinkService.getLinkData(a)?.uri;if(c){let f={start:{x:l+1,y:e},end:{x:d+(!h&&d===o-1?1:0),y:e}},p=!1;if(!r?.allowNonHttpProtocols)try{let w=new URL(c);["http:","https:"].includes(w.protocol)||(p=!0)}catch{p=!0}p||s.push({text:c,range:f,activate:(w,y)=>r?r.activate(w,y,f):Dc(w,y),hover:(w,y)=>r?.hover?.(w,y,f),leave:(w,y)=>r?.leave?.(w,y,f)})}h=!1,n.hasExtendedAttrs()&&n.extended.urlId?(l=d,a=n.extended.urlId):(l=-1,a=-1)}}t(s)}};zr=_e([I(0,$e),I(1,Ue),I(2,Na)],zr);function Dc(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 $s=Ae("CharSizeService"),Rt=Ae("CoreBrowserService"),gn=Ae("MouseService"),At=Ae("RenderService"),Rc=Ae("SelectionService"),Fa=Ae("CharacterJoinerService"),Si=Ae("ThemeService"),Wa=Ae("LinkProviderService"),Ac=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?To.isErrorNoTelemetry(e)?new To(e.message+`
package/web/video.js CHANGED
@@ -1,4 +1,4 @@
1
- /* kaizen video page 8ea2cb9161d5ea08 -- generated by bun run build:web from web/video.ts; do not edit */
1
+ /* kaizen video page a438553e8f8d3a37 -- generated by bun run build:web from web/video.ts; do not edit */
2
2
  (()=>{var mn=null,Pa=(e,t=mn)=>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 is(e){if(mn=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 Vl(e,t=mn){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 pi=null,_l=null,Jl=(e)=>{_l=e};function fi(e,t,n){if(ui++,pi=e,typeof window<"u")dispatchEvent(new Event("kz-all-cards"));_l?.(e,t,n)}var ui=0,Kl="",di=!1,Ia=!1,lf=2000,Fl=0,Gl;async function Ut(){if(di){Ia=!0;return}let e=Fl+lf-Date.now();if(e>0){Gl??=setTimeout(()=>{Gl=void 0,Ut()},e);return}Fl=Date.now(),di=!0;do{Ia=!1;let t=ui;try{let n=await fetch("/state?all=1");if(!n.ok)continue;let s=await n.text(),a=s.replace(/"now":\d+\}$/,"");if(a===Kl)continue;let{cards:o,projects:r,rail:d,agents:p}=JSON.parse(s);if(!Ia&&t===ui)Kl=a,fi(o,[...r,...d??[]],p)}catch{}}while(Ia);di=!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),hn=(e)=>String(e).replace(/[&<>"]/g,(t)=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[t]);class hi{s;constructor(e){this.s=e}toString(){return this.s}}var I=(e)=>new hi(String(e)),Yl=(e)=>e instanceof hi?e.s:Array.isArray(e)?e.map(Yl).join(""):e==null||e===!1?"":hn(e),i=(e,...t)=>I(e.reduce((n,s,a)=>n+Yl(t[a-1])+s)),C=(e)=>I(`<svg><use href="#i-${e}"/></svg>`),Ie=(e,t={})=>{let n="chk"+(t.sm?" sm":""),s=I(Object.entries(t.attrs??{}).map(([a,o])=>` ${a}="${hn(o)}"`).join(""));return t.box?i`<input type="checkbox" class="${n}" role="switch"${s}${I(e?" checked":"")}>`:i`<button type="button" class="${n}${e?" on":""}" role="switch" aria-checked="${String(e)}"${s}></button>`},Ql=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>"),cf=1500000;async function df(e){if(e.size<=cf||!/^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 Nn=(e)=>Promise.all(e.map(async(t)=>{let n=await df(t);return new Promise((s)=>{let a=new FileReader;a.onload=()=>s({name:n.name,data:a.result}),a.readAsDataURL(n)})}));function Ze(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 rs=()=>{let e=document.documentElement.dataset.motion;return e?e==="full":!matchMedia("(prefers-reduced-motion: reduce)").matches},ls=(e)=>rs()&&document.startViewTransition?document.startViewTransition(e).updateCallbackDone:(e(),Promise.resolve()),mi=[5,25,50,100];function Na(e){let t=25;try{let n=Number(localStorage.getItem("kz-page:"+e));if(mi.includes(n))t=n}catch{}return{id:e,size:t,at:0,total:0}}function za(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 Ws(e){if(e.total<=mi[0])return"";let t=e.at*e.size+1,n=Math.min(e.total,t+e.size-1);return i`<div class="kpager" id="pg-${e.id}"><label>Rows<select class="sel" aria-label="Rows per page">${mi.map((s)=>i`<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 Oa(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 uf=!1;try{uf=localStorage.getItem("kz-res-disk")==="1"}catch{}var Xl=86400000,Te=(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"},gi={claude:"Claude Code",codex:"Codex",agy:"Antigravity",opencode:"OpenCode",gemini:"Gemini",cursor:"Cursor",yolo:"yolo",unrechecked:"fix not rechecked"},Zl={claude:1,codex:1,agy:1,opencode:1,gemini:1,cursor:1,full:1,lite:1},ec=(e,t,n)=>t&&e.includes(t)?t:n?null:e[0]??null,tc=["Tasks","Planning","Building","Review","Done"],gn={idea:"idea",starting:"start",running:"run",stalled:"stall",waiting:"wait",done:"done",abandoned:"aband"},pf={explore:"exploration needs your decision","approvals.plan":"plan needs your approval","approvals.review":"review needs your approval"},Et=(e)=>pf[e]||e,bn={idea:"idea",starting:"starting",running:"running",stalled:"stalled",waiting:"waiting on you",done:"done",abandoned:"abandoned"};var xe=(e)=>typeof e==="string"?[e]:e.kids.flatMap(xe);function ds(e,t){if(typeof e==="string")return t(e)?e:null;let n=[],s=[];if(e.kids.forEach((a,o)=>{let r=ds(a,t);if(r)n.push(r),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 On=(e,t)=>`ws:${e}:${t}`,Bn=(e)=>e.kind==="run"&&e.status==="done"&&e.accept!=="needs"&&!e.archived&&e.git==="pending",Ba=(e)=>e.gitDue==="push"?"push":"commit",Un=(e)=>e.kind==="run"&&(e.status==="abandoned"||e.status==="done"&&e.accept!=="needs"&&!Bn(e)),oc=(e,t,n,s)=>e.state===t&&s(e)===n,vi=(e,t,n,s)=>e.filter((a)=>!a.archived&&oc(a,t,n,s)&&(a.kind==="idea"?!!a.pty:a.kind==="run"&&!Un(a))),wi=(e,t,n,s)=>e.filter((a)=>Un(a)&&oc(a,t,n,s)).sort((a,o)=>(o.moved??0)-(a.moved??0));function ic(e,t,n,s){let a=!1;for(let o of t){let r=n(o),d=e[r];if(!d)continue;let p=e[On(o.state,s(o))]||={tabs:[],hidden:[],screens:[],on:null},m=new Set(p.screens.flatMap((h)=>xe(h.tree)));for(let h of d.tabs??[])if(!p.tabs.some((y)=>y.id===h.id))p.tabs.push(h);for(let h of d.hidden??[])if(!p.hidden.includes(h))p.hidden.push(h);for(let h of d.screens??[]){let y=h.tree&&ds(h.tree,(f)=>!m.has(f));if(!y)continue;xe(y).forEach((f)=>m.add(f)),p.screens.push({...h,tree:y,focus:xe(y).includes(h.focus)?h.focus:xe(y)[0]})}p.on??=d.on,delete e[r],a=!0}return a}var zn=(e)=>e.kind==="run"&&(e.status==="waiting"||e.status==="done"&&e.accept==="needs"||Bn(e)||!!(e.pty?.alive&&e.pty.asking)),rc=(e,t,n,s)=>vi(e,t,n,s).filter((a)=>a.kind==="run").sort((a,o)=>+zn(o)-+zn(a)||(o.moved??0)-(a.moved??0)),lc=(e,t,n,s=(a)=>a.id)=>[...e,...t].find((a)=>s(a)===n)??e[0]??null;function ff(e){if(e?.kind!=="run")return{};let t=e?.pty?.all??[],n=e?.pty?.stages??{},s={};for(let r of["explore","impl","review"])if(n[r]&&t.includes(n[r]))s[r]=n[r];if(n.plan&&t.includes(n.plan))s.plan=n.plan;let a=t.find((r)=>!Object.values(n).includes(r)),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 cc(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(ff(e)).map(([p,m])=>[m,n[p]])),o=s.filter((p)=>!a.has(p)),r=e?.stage==="explore"?"Explore":n[{1:"plan",2:"impl",3:"review"}[e?.column]??""],d=s.at(-1);if(r&&d&&a.has(d))a.set(d,r);return s.map((p)=>({key:p,title:a.has(p)?`${a.get(p)} · ${t}`:t+(o.length>1?" "+(o.indexOf(p)+1):"")}))}var dc=(e)=>e.kind==="run"&&(e.column===3||e.status==="done"),ki=(e)=>e?/https?:\/\/(?:localhost|127\.0\.0\.1|\[::1\])(?::\d+)?[^\s)`'"<>]*/.exec(e)?.[0]:void 0;function Ua(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 uc=3000,Wa=new Map,Ks=(e)=>e.key+"@"+(e.born??0),nc={conflict:0,failed:0,asking:0,working:1,done:2},cs={conflict:"Conflict",failed:"Land failed",asking:"Asking",working:"Working",done:"Done"},Ka={conflict:"fail",failed:"fail",asking:"wait",working:"build",done:"done"};function $i(e,t,n=Wa){if(e.land)return e.land==="conflict"?"conflict":"failed";if(e.asking)return"asking";if(e.busy)return n.set(Ks(e),t),"working";return t-(n.get(Ks(e))??-1/0)<uc?"working":"done"}var pc=(e,t,n=Wa)=>Math.min(1/0,...e.filter((s)=>!s.asking&&!s.busy&&n.has(Ks(s))).map((s)=>uc-(t-n.get(Ks(s)))).filter((s)=>s>0)),fc=(e,t=Wa)=>{let n=new Set(e.map(Ks));for(let s of t.keys())if(!n.has(s))t.delete(s)},xi=(e,t,n,s,a,o=Wa)=>e.filter((r)=>r.dir===t&&s({state:r.dir,ws:r.ws})===n).map((r)=>({a:r,st:$i(r,a,o)})).sort((r,d)=>nc[r.st]-nc[d.st]),sc=({a:e,st:t})=>(e.land?"":e.last)||`${cs[t]} - ${e.name}`,ac=(e,t)=>!e?"":t-e<60000?"now":Te(e,t),mf=(e,t)=>e+"\x00"+t;function mc(e,t,n){let s=mf(t,n);if(e[s])delete e[s];else e[s]=!0;return e}var hf=["claude","codex","gemini"],bi=(e)=>i`<svg aria-hidden="true"><use href="#i-${hf.includes(e.agent??"")?e.agent:"ai"}"/></svg>`,yi=(e)=>i`<i class="si ${Ka[e]}"></i>`,gf=i`<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 hc(e,t,n,s,a){if(!e.length)return"";let o=i`data-dir="${s}" data-ws="${a}"`;if(e.length===1){let p=e[0];return i`<div class="wag"><button type="button" class="aone" data-term="${p.a.key}" ${o} title="${p.a.name}: open its terminal">${yi(p.st)}${bi(p.a)}<span class="atx">${cs[p.st]} - ${p.a.name}</span><small>${ac(p.a.at,t)}</small></button></div>`}let r=i`<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">${gf}</button>`;if(n)return i`<div class="wag"><span class="aht">${String(e.length)} agents</span>${r}</div><div class="alist">${e.map((p)=>i`<button type="button" class="arow" data-term="${p.a.key}" ${o} title="${sc(p)}">${yi(p.st)}${bi(p.a)}<span class="atx">${sc(p)}</span><small>${ac(p.a.at,t)}</small></button>`)}</div>`;let d=["conflict","failed","asking","working","done"].map((p)=>({st:p,rs:e.filter((m)=>m.st===p)})).filter((p)=>p.rs.length);return i`<div class="wag"><span class="chips">${d.map((p)=>i`<span class="chip">${yi(p.st)}${p.rs.map((m)=>i`<button type="button" class="amark" data-term="${m.a.key}" ${o} title="${m.a.name} - ${cs[p.st]}: open its terminal" aria-label="${m.a.name} - ${cs[p.st]}: open its terminal">${bi(m.a)}</button>`)}</span>`)}</span>${r}</div>`}function Si(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 gc;function j(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(gc),gc=setTimeout(()=>n.classList.remove("on"),t?8000:4000)}function Wt(){try{if(typeof Notification<"u"&&Notification.permission==="default")Notification.requestPermission()}catch(e){}}var yc=(e,t)=>{try{return localStorage.getItem(e)||t}catch(n){return t}},Fa=()=>yc("kz-notify","on")==="on",Wn=()=>yc("kz-sound","Bellatrix"),vc=["Adara","Alya","Bellatrix","Beryllium","Cobalt","Fluorine","Krypton","Palladium","Rubidium","Xenon"],Ga=["off",...vc,"chime","bell","pop"],bc={chime:[[880,0,0.25],[1320,0.12,0.35]],bell:[[660,0,0.9]],pop:[[520,0,0.08]]},Lt;function us(e=Wn()){try{if(vc.includes(e)){let n=new Audio(`/sounds/${e}.mp3`);n.volume=0.35,n.play().catch(()=>{});return}if(!bc[e])return;Lt=Lt||new AudioContext,Lt.resume();let t=Lt.currentTime+0.02;for(let[n,s,a]of bc[e]){let o=Lt.createOscillator(),r=Lt.createGain();o.type=e==="pop"?"triangle":"sine",o.frequency.value=n,r.gain.setValueAtTime(0.0001,t+s),r.gain.exponentialRampToValueAtTime(0.25,t+s+0.01),r.gain.exponentialRampToValueAtTime(0.0001,t+s+a),o.connect(r).connect(Lt.destination),o.start(t+s),o.stop(t+s+a+0.05)}}catch(t){}}addEventListener("pointerdown",()=>{try{Lt=Lt||new AudioContext,Lt.resume()}catch(e){}},{once:!0});function Ai(e,t){if(!Fa())return;us();try{if(typeof Notification<"u"&&Notification.permission==="granted")new Notification("kaizen",{body:e,icon:"/logo.png",tag:t})}catch(n){}}var Va=null,_a=null,wc=null,Kn=(e)=>e.pty?"running in its workspace":"opened in your terminal",Fs=()=>wc||=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=()=>{wc=null,t()},document.head.append(s)});function Kt(){if(_a)_a();_a=null,Va=null,l("panel").classList.remove("wide")}async function Ei(e){let t=e.pty.key;if(Va===t&&l("pbody").querySelector(".term"))return;Kt(),Va=t,l("panel").classList.add("wide"),l("pbody").innerHTML='<div class="term" aria-label="Agent terminal"></div>';let n;try{n=await Fs()}catch{l("pbody").innerHTML='<p style="color:var(--dim)">The terminal could not load.</p>';return}if(Va!==t)return;_a=n(l("pbody").querySelector(".term"),t,()=>te(!0))}var $c="kz-mic",Li=()=>{try{return localStorage.getItem($c)||""}catch{return""}},kc=(e="")=>({channelCount:1,noiseSuppression:!0,echoCancellation:!0,...e?{deviceId:{exact:e}}:{}});async function xc(e,t,n){try{return await e(kc(t))}catch(s){if(!t||s?.name!=="OverconstrainedError")throw s;return n("Chosen microphone not found. Using the default"),e(kc())}}var Sc=()=>i`<select class="sel" id="v-mic" aria-labelledby="v-mic-l"><option value="">System default</option></select>`;async function Ac(){let e=l("v-mic");if(!e||!navigator.mediaDevices?.enumerateDevices)return;let t=Li(),n=(await navigator.mediaDevices.enumerateDevices().catch(()=>[])).filter((s)=>s.kind==="audioinput"&&s.deviceId&&s.deviceId!=="default");e.innerHTML=i`<option value="">System default</option>${n.map((s,a)=>i`<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($c,e.value)}catch{}}}var bf="https://cdn.jsdelivr.net/npm/@huggingface/transformers@4.3.0",Ec={tiny:"onnx-community/whisper-tiny",base:"onnx-community/whisper-base",small:"onnx-community/whisper-small","large-v3-turbo":"onnx-community/whisper-large-v3-turbo"},Ti=null,yf=`import{pipeline}from"${bf}";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})};
@@ -213,7 +213,7 @@ For at least one agent, a folder or link of the same name is in the way. It is d
213
213
  ${p}
214
214
  </div>
215
215
  </div>
216
- `);return}e.innerHTML=String(i`
216
+ `);return}if(t.running){e.innerHTML=String(i`<div><p class="ph-h">WhatsApp Bridge</p><p class="ph-wait">Connecting…</p>${p}</div>`);return}e.innerHTML=String(i`
217
217
  <div>
218
218
  <p class="ph-h">WhatsApp Bridge</p>
219
219
  <p>Send finished videos and files straight to your phone's WhatsApp without opening any app.</p>
@@ -222,7 +222,7 @@ For at least one agent, a folder or link of the same name is in the way. It is d
222
222
  </div>
223
223
  ${p}
224
224
  </div>
225
- `)},r=async()=>{let p=await oo();if(p.error&&!p.installed)n=p.error;else t=p;o()};e.innerHTML='<p class="ph-wait">Checking WhatsApp…</p>',await r(),a=setInterval(async()=>{if(!e.isConnected){clearInterval(a);return}if(t&&!t.connected&&(t.qrSvg||s)){let p=await oo();if(!p.error)t=p,o()}},2500),e.onclick=async(p)=>{let m=p.target.closest("[data-wa]")?.dataset.wa;if(!m||s)return;if(n="",m==="check")return r();if(s=!0,o(),m==="connect"){let h=await oo({op:"connect"});if(s=!1,h.error)n=h.error;else t=h;o()}else if(m==="disconnect")await oo({op:"disconnect"}),s=!1,await r()}}var Vi=[["AI Capabilities",[{id:"agents",title:"Agents",desc:"Manage AI agents, set a default, and customize commands.",ico:"ai"},{id:"accounts",title:"AI Provider Accounts",desc:"Who is signed in to each AI tool kaizen runs. Add accounts only to switch between more than one.",ico:"link"},{id:"orchestration",title:"Orchestration",desc:"Split a run into workers, each in its own terminal. Off by default.",ico:"ai"},{id:"skills",title:"Skills",desc:"What your agents can do. Changes apply to new sessions.",ico:"note"},{id:"voice",title:"Voice",desc:"Speech-to-text dictation, run in the browser.",ico:"mic"}]],["Set Up",[{id:"general",title:"General",desc:"Which settings you are editing, folders, and maintenance.",ico:"gear"},{id:"integrations",title:"Integrations",desc:"Request sources, your Google account, and web research.",ico:"link"},{id:"mobile",title:"Mobile",desc:"Open kaizen from your phone.",ico:"send"}]],["Workflows",[{id:"approvals",title:"Approvals",desc:"Where a run stops and waits for you.",ico:"check"},{id:"autofix",title:"Auto-fix",desc:"What happens to review findings.",ico:"bug"},{id:"automations",title:"Automations",desc:"Schedules that start a run in this project.",ico:"clock"},{id:"git",title:"Git & Source Control",desc:"Branches and commits for each run.",ico:"pen"},{id:"terminal",title:"Terminal",desc:"The terminal dashboard.",ico:"term"}]],["Interface",[{id:"appearance",title:"Appearance",desc:"Theme, color and motion in this browser.",ico:"note"},{id:"notifications",title:"Notifications",desc:"Notices and sounds in this browser.",ico:"clock"},{id:"shortcuts",title:"Shortcuts",desc:"Keyboard shortcuts for common actions.",ico:"kbd"}]]],tm=[[/^(preset|runner|explore\.|build\.|review\.executor)/,"agents","Workflow"],[/^(subagents\.|agent\.model\.)/,"agents","Models"],[/^agent\.handoff_model\./,"agents","Handoff session"],[/^agent\.default$/,"agents","Default agent"],[/^agent\./,"agents","Running agents"],[/^orchestration\./,"orchestration","Workers"],[/^dictation\./,"voice","Dictation"],[/^sources\./,"integrations","Request sources"],[/^(mode|approvals\.|auto_accept)/,"approvals","Approvals"],[/^auto_fix\./,"autofix","Auto-fix"],[/^auto_guard\./,"autofix","Auto mode guard"],[/^git\./,"git","Git"],[/^ui\./,"terminal","Terminal"],[/^board\.chat_hotkey$/,"shortcuts","Shortcuts"],[/^board\./,"general","App"],[/^(review\.|state\.)/,"general","Project"]],kd=(e)=>{let t=tm.find(([n])=>n.test(e));return t?[t[1],t[2]]:["general","Other"]};var Ce=null,En=null,$s=globalThis.kaizenDesktop,Ln=$s?"Kaizen":"kaizen",nm=(e)=>$s?$s.check():fetch(e?"/version?fresh=1":"/version").then((t)=>t.json()),$d=(e)=>`${Ln} ${e.latest} is available. You are running ${e.version}. Update it from the desktop app on your computer.`;function sm(e){En=e,Ce=e.update?e:null;let t=document.querySelector('.rail a[data-view="settings"]');return t.classList.toggle("upd",!!Ce),t.title=Ce?`Settings: ${Ln} ${e.latest} is available`:"Settings",!!Ce}function _i(){let e=document.createElement("div");if(e.className=`updbar${Ce?"":" quiet"}`,!Ce)e.innerHTML=i`<span id="upd-msg" aria-live="polite">${En?En.behind?$d(En):`${Ln} ${En.version}`:Ln}</span
225
+ `)},r=async()=>{let p=await oo();if(p.error&&!p.installed)n=p.error;else t=p;o()};e.innerHTML='<p class="ph-wait">Checking WhatsApp…</p>',await r(),a=setInterval(async()=>{if(!e.isConnected){clearInterval(a);return}if(t&&!t.connected&&(t.qrSvg||s||t.running)){let p=await oo();if(!p.error)t=p,o()}},2500),e.onclick=async(p)=>{let m=p.target.closest("[data-wa]")?.dataset.wa;if(!m||s)return;if(n="",m==="check")return r();if(s=!0,o(),m==="connect"){let h=await oo({op:"connect"});if(s=!1,h.error)n=h.error;else t=h;o()}else if(m==="disconnect")await oo({op:"disconnect"}),s=!1,await r()}}var Vi=[["AI Capabilities",[{id:"agents",title:"Agents",desc:"Manage AI agents, set a default, and customize commands.",ico:"ai"},{id:"accounts",title:"AI Provider Accounts",desc:"Who is signed in to each AI tool kaizen runs. Add accounts only to switch between more than one.",ico:"link"},{id:"orchestration",title:"Orchestration",desc:"Split a run into workers, each in its own terminal. Off by default.",ico:"ai"},{id:"skills",title:"Skills",desc:"What your agents can do. Changes apply to new sessions.",ico:"note"},{id:"voice",title:"Voice",desc:"Speech-to-text dictation, run in the browser.",ico:"mic"}]],["Set Up",[{id:"general",title:"General",desc:"Which settings you are editing, folders, and maintenance.",ico:"gear"},{id:"integrations",title:"Integrations",desc:"Request sources, your Google account, and web research.",ico:"link"},{id:"mobile",title:"Mobile",desc:"Open kaizen from your phone.",ico:"send"}]],["Workflows",[{id:"approvals",title:"Approvals",desc:"Where a run stops and waits for you.",ico:"check"},{id:"autofix",title:"Auto-fix",desc:"What happens to review findings.",ico:"bug"},{id:"automations",title:"Automations",desc:"Schedules that start a run in this project.",ico:"clock"},{id:"git",title:"Git & Source Control",desc:"Branches and commits for each run.",ico:"pen"},{id:"terminal",title:"Terminal",desc:"The terminal dashboard.",ico:"term"}]],["Interface",[{id:"appearance",title:"Appearance",desc:"Theme, color and motion in this browser.",ico:"note"},{id:"notifications",title:"Notifications",desc:"Notices and sounds in this browser.",ico:"clock"},{id:"shortcuts",title:"Shortcuts",desc:"Keyboard shortcuts for common actions.",ico:"kbd"}]]],tm=[[/^(preset|runner|explore\.|build\.|review\.executor)/,"agents","Workflow"],[/^(subagents\.|agent\.model\.)/,"agents","Models"],[/^agent\.handoff_model\./,"agents","Handoff session"],[/^agent\.default$/,"agents","Default agent"],[/^agent\./,"agents","Running agents"],[/^orchestration\./,"orchestration","Workers"],[/^dictation\./,"voice","Dictation"],[/^sources\./,"integrations","Request sources"],[/^(mode|approvals\.|auto_accept)/,"approvals","Approvals"],[/^auto_fix\./,"autofix","Auto-fix"],[/^auto_guard\./,"autofix","Auto mode guard"],[/^git\./,"git","Git"],[/^ui\./,"terminal","Terminal"],[/^board\.chat_hotkey$/,"shortcuts","Shortcuts"],[/^board\./,"general","App"],[/^(review\.|state\.)/,"general","Project"]],kd=(e)=>{let t=tm.find(([n])=>n.test(e));return t?[t[1],t[2]]:["general","Other"]};var Ce=null,En=null,$s=globalThis.kaizenDesktop,Ln=$s?"Kaizen":"kaizen",nm=(e)=>$s?$s.check():fetch(e?"/version?fresh=1":"/version").then((t)=>t.json()),$d=(e)=>`${Ln} ${e.latest} is available. You are running ${e.version}. Update it from the desktop app on your computer.`;function sm(e){En=e,Ce=e.update?e:null;let t=document.querySelector('.rail a[data-view="settings"]');return t.classList.toggle("upd",!!Ce),t.title=Ce?`Settings: ${Ln} ${e.latest} is available`:"Settings",!!Ce}function _i(){let e=document.createElement("div");if(e.className=`updbar${Ce?"":" quiet"}`,!Ce)e.innerHTML=i`<span id="upd-msg" aria-live="polite">${En?En.behind?$d(En):`${Ln} ${En.version}`:Ln}</span
226
226
  ><button class="btn" id="upd-chk">Check for updates</button>`;else{let s=(Ce.notes||[]).map((o)=>i`<li><b>${o.v}</b> ${o.text}</li>`),a=s.length?i`<span class="updnew"
227
227
  ><button class="btn" aria-describedby="upd-notes">What's new</button
228
228
  ><span class="updpop" id="upd-notes" role="tooltip"