cli-jaw 2.17.60 → 2.17.61

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/package.json +1 -1
  2. package/public/css/chat.css +18 -4
  3. package/public/css/layout.css +12 -0
  4. package/public/dist/.vite/manifest.json +120 -110
  5. package/public/dist/assets/Profile-DPqrYA44.js +1 -0
  6. package/public/dist/assets/{app-Cn7mvbfa.js → app-ByMfeXp-.js} +4 -4
  7. package/public/dist/assets/app-DAJWqs33.css +1 -0
  8. package/public/dist/assets/bgtask-badge-Ch88fnhf.js +1 -0
  9. package/public/dist/assets/{bgtask-badge-DwA2ufcC.js → bgtask-badge-DfiHuzxT.js} +1 -1
  10. package/public/dist/assets/{employees-DrXQ9oRa.js → employees-BQaJNp-u.js} +1 -1
  11. package/public/dist/assets/favicon-32-C4u_h46P.png +0 -0
  12. package/public/dist/assets/icon-192-CADbZUeU.png +0 -0
  13. package/public/dist/assets/{iframe-renderer-CLqxxRj1.js → iframe-renderer-Bj1JolO8.js} +2 -2
  14. package/public/dist/assets/iframe-renderer-DWnvUSrx.js +1 -0
  15. package/public/dist/assets/manager-BnQHAKk6.css +1 -0
  16. package/public/dist/assets/{manager-BpPiQqP8.js → manager-C5cU1joU.js} +1 -1
  17. package/public/dist/assets/{manifest-Bw-LRm-c.json → manifest-BgdjNQXm.json} +1 -1
  18. package/public/dist/assets/mascot-BPkuMHQQ.png +0 -0
  19. package/public/dist/assets/memory-Bk_cb3sw.js +1 -0
  20. package/public/dist/assets/{memory-CPfFQFaW.js → memory-EG1B51up.js} +1 -1
  21. package/public/dist/assets/{message-history-BhiEuMLw.js → message-history-D2vniu04.js} +1 -1
  22. package/public/dist/assets/message-history-GAtF_wbZ.js +1 -0
  23. package/public/dist/assets/{render-CdATJ4wM.js → render-Dp07lZAJ.js} +1 -1
  24. package/public/dist/assets/{settings-CUxM2lH7.js → settings-CA2LQDGh.js} +1 -1
  25. package/public/dist/assets/settings-WVGhtneN.js +1 -0
  26. package/public/dist/assets/{settings-core-D_2F4S22.js → settings-core-B5Uf_lWY.js} +1 -1
  27. package/public/dist/assets/settings-core-CgKGnMA5.js +1 -0
  28. package/public/dist/assets/{settings-embedding-LIMq5ebM.css → settings-embedding-DhEdT86W.css} +1 -1
  29. package/public/dist/assets/{settings-embedding-abQOXHyq.js → settings-embedding-oGvFayh-.js} +1 -1
  30. package/public/dist/assets/{settings-Cjrg6SrM.js → settings-jlI4X-zt.js} +1 -1
  31. package/public/dist/assets/shark-sprite-v5dtON_I.png +0 -0
  32. package/public/dist/assets/sidebar-BUemG2ZN.js +49 -0
  33. package/public/dist/assets/{skills-CD3PFa7e.js → skills-CKUcEN9m.js} +1 -1
  34. package/public/dist/assets/skills-Co7Mr-qP.js +1 -0
  35. package/public/dist/assets/slash-commands-BEr-vmIr.js +1 -0
  36. package/public/dist/assets/{slash-commands-Czgl_F8c.js → slash-commands-D34GgHFX.js} +1 -1
  37. package/public/dist/assets/{trace-drawer-BYKkBIG-.js → trace-drawer-DBmK-5F_.js} +1 -1
  38. package/public/dist/assets/ui-TUyJsMUf.js +1 -0
  39. package/public/dist/assets/{ui-B0OYr3pK.js → ui-vm2iuLcS.js} +1 -1
  40. package/public/dist/index.html +8 -8
  41. package/public/dist/manager/index.html +4 -4
  42. package/public/dist/settings/index.html +2 -2
  43. package/public/icons/favicon-32.png +0 -0
  44. package/public/icons/icon-192.png +0 -0
  45. package/public/icons/icon-512-maskable.png +0 -0
  46. package/public/icons/icon-512.png +0 -0
  47. package/public/icons/mascot.png +0 -0
  48. package/public/img/shark-sprite.png +0 -0
  49. package/public/index.html +4 -4
  50. package/public/js/features/attention-badge.ts +22 -4
  51. package/public/js/features/avatar.ts +4 -2
  52. package/public/manager/src/components/CommandBar.tsx +1 -0
  53. package/public/manager/src/manager-p0-1-1.css +7 -0
  54. package/public/manager/src/settings/pages/components/AvatarCard.tsx +3 -1
  55. package/public/manager/src/settings-shell.css +6 -0
  56. package/public/manifest.json +1 -1
  57. package/public/sw.js +1 -1
  58. package/scripts/brand/generate-brand-assets.py +226 -0
  59. package/scripts/brand/mascot-master.png +0 -0
  60. package/scripts/check-app-icon-assets.cjs +19 -0
  61. package/public/assets/shark.svg +0 -1
  62. package/public/dist/assets/Profile-BSV3ztzm.js +0 -1
  63. package/public/dist/assets/app-BCBnxiGr.css +0 -1
  64. package/public/dist/assets/bgtask-badge-C_bWwh_e.js +0 -1
  65. package/public/dist/assets/icon-192-CwXPIYF5.png +0 -0
  66. package/public/dist/assets/iframe-renderer-DjRrBgkV.js +0 -1
  67. package/public/dist/assets/manager-Nk7-RYPs.css +0 -1
  68. package/public/dist/assets/memory-BOwQYuLb.js +0 -1
  69. package/public/dist/assets/message-history-CqWYH9Sx.js +0 -1
  70. package/public/dist/assets/settings-core-BNFL4oSA.js +0 -1
  71. package/public/dist/assets/settings-kHiXb__9.js +0 -1
  72. package/public/dist/assets/shark-sprite-B3AAuERd.png +0 -0
  73. package/public/dist/assets/sidebar-DE-2OtXs.js +0 -49
  74. package/public/dist/assets/skills-iVr8hW-f.js +0 -1
  75. package/public/dist/assets/slash-commands-DbBIj8wv.js +0 -1
  76. package/public/dist/assets/ui-CpxBqLlq.js +0 -1
@@ -1,49 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-DSSkXCir.css"])))=>i.map(i=>d[i]);
2
- import{t as e}from"./state-Dl-xxPoS.js";import{i as t,t as n}from"./api-CUtiCd2-.js";import{n as r,t as i}from"./bounded-api-DdpT93LB.js";import{t as a}from"./preload-helper-CfbQpVni.js";import{O as o,P as s,f as c,g as l,j as u,n as d}from"./render-CdATJ4wM.js";import{t as f}from"./icons-CVkqyECl.js";import{t as p}from"./copy-text-DjgetgoZ.js";import{_ as m,g as h,p as g}from"./iframe-renderer-CLqxxRj1.js";import{A as _,C as v,D as y,E as b,F as x,H as S,I as C,M as w,N as T,O as ee,S as E,T as te,U as D,_ as ne,b as re,d as O,f as ie,g as k,h as A,j as ae,k as oe,m as se,p as ce,u as j,v as le,w as M,x as N,y as ue}from"./message-history-BhiEuMLw.js";import{n as P}from"./presentation-DWHWElFr.js";import{a as de,d as fe,f as F,i as pe,l as me,n as he,r as ge,s as _e,t as ve,u as ye}from"./ui-B0OYr3pK.js";var I=null,be=0,xe=[],Se=2e3,Ce=3e4,we=1.5,Te=null,Ee=4e4,De=1e4,Oe=0,ke=!1,Ae=null,je=null;function Me(e){je=e}function Ne(){let e=null;try{e=je?.()??null}catch{e=null}return e?`&scope=${encodeURIComponent(e)}`:``}function Pe(){Ae||=setInterval(()=>{I&&Ie&&ke&&(Date.now()-Oe<=Ee||(console.warn(`[sse] stalled channel (no ping in`,Ee,`ms) — forcing reconnect`),I.close(),I=null,Ie=!1,He?.(),Xe(Fe)))},De)}var Fe=``,Ie=!1,Le=!1,Re=!1,ze=!1,Be=!1,Ve=null,He=null,Ue=null;function We(e){Ve=e}function Ge(e){He=e}function Ke(e){Ue=e}function qe(e,t,n){let r={topic:e,event:t,handler:n};return xe.push(r),()=>{let e=xe.indexOf(r);e>=0&&xe.splice(e,1)}}function Je(e,t,n){for(let r of xe)if((r.topic===`*`||r.topic===e)&&(r.event===null||r.event===t))try{r.handler(n)}catch(e){console.warn(`[sse] handler error:`,e.message)}}function Ye(){Le||Te||(Te=setTimeout(()=>{Te=null,Xe(Fe)},Se),Se=Math.min(Se*we,Ce))}function Xe(e){Fe=e,Le=!1,Te&&=(clearTimeout(Te),null),I&&I.close();let t=`${n}/api/events?lang=${encodeURIComponent(e)}`+Ne()+(be?`&lastEventId=${be}`:``);ze=!1,Be=!1,I=new EventSource(t),Pe(),I.onopen=()=>{Se=2e3,Ie=!0,Re=!0,ze=!0,Oe=Date.now(),Ve?.()},I.onerror=()=>{if(I?.close(),I=null,!ze&&!Re&&Ue){Be||(Be=!0,Ue());return}Ie&&(Ie=!1,He?.()),Ye()},I.onmessage=e=>{be=parseInt(e.lastEventId||`0`,10)||be;let t;try{t=JSON.parse(e.data)}catch{console.warn(`[sse] malformed message:`,e.data);return}if(!t||typeof t!=`object`||typeof t.topic!=`string`||typeof t.event!=`string`){console.warn(`[sse] invalid message shape:`,t);return}if(Oe=Date.now(),t.topic===`system`&&t.event===`ping`){ke=!0;return}Je(t.topic,t.event,t)}}var Ze=3e3,L=new Map,R=[],Qe=(e,t)=>`${e}:${t}`;function $e(e=[]){let t=document.getElementById(`pendingQueue`);if(t){if(R=e.slice(),!e.length){at(new Set),t.classList.remove(`visible`),t.innerHTML=``;return}t.classList.add(`visible`),t.innerHTML=`
3
- <div class="pending-queue-header">
4
- <span class="pending-queue-title">${f.hourglass} <span data-i18n="queue.pendingTitle">${o(s(`queue.pendingTitle`))}</span> <span class="pending-queue-count">${e.length}</span></span>
5
- </div>
6
- <div class="pending-queue-list">
7
- ${e.map(et).join(``)}
8
- </div>
9
- `,at(new Set(e.map(e=>e.id))),it()}}function et(e){let t=(e.prompt||``).replace(/\s+/g,` `).trim(),n=t.length>140?t.slice(0,140)+`…`:t,r=e.source?`<span class="pending-row-source">${o(e.source)}</span>`:``,i=o(s(`queue.copy`)),a=o(s(`queue.steer`)),c=o(s(`queue.delete`));return`<div class="pending-row" data-pending-id="${o(e.id)}" title="${o(t)}">
10
- <span class="pending-row-text">${o(n)}</span>
11
- ${r}
12
- <button class="pending-row-btn pending-row-copy" data-pending-action="copy" title="${i}" aria-label="${i}"><span class="pending-btn-content">${f.copy}</span></button>
13
- <button class="pending-row-btn pending-row-steer" data-pending-action="steer" data-i18n-title="queue.steer" title="${a}" aria-label="${a}"><span class="pending-arm-fill" aria-hidden="true"></span><span class="pending-btn-content"><span class="pending-steer-arrow" aria-hidden="true">↳</span><span class="pending-steer-label">${a}</span></span></button>
14
- <button class="pending-row-btn pending-row-delete" data-pending-action="delete" data-i18n-title="queue.delete" title="${c}" aria-label="${c}"><span class="pending-arm-fill" aria-hidden="true"></span><span class="pending-btn-content">${f.trash}</span></button>
15
- </div>`}function tt(e,t){let n=document.querySelector(`.pending-row[data-pending-id="${CSS.escape(e)}"]`);return n?n.querySelector(`[data-pending-action="${t}"]`):null}function nt(e,t){let n=tt(e,t);if(!n)return;n.classList.add(`armed`),n.setAttribute(`title`,s(`queue.cancelArm`));let r=n.querySelector(`.pending-arm-fill`);r&&(r.style.animation=`none`,r.offsetWidth,r.style.animation=``)}function rt(e,t){let n=tt(e,t);n&&(n.classList.remove(`armed`),n.setAttribute(`title`,s(t===`steer`?`queue.steer`:`queue.delete`)))}function it(){for(let e of L.values()){let t=tt(e.id,e.action);t&&(t.classList.add(`armed`),t.setAttribute(`title`,s(`queue.cancelArm`)))}}function at(e){for(let[t,n]of L)e.has(n.id)||(clearTimeout(n.timerId),L.delete(t))}function ot(e,n){let r=Qe(e,n),i=setTimeout(()=>ct(e,n),Ze);L.set(r,{id:e,action:n,timerId:i}),nt(e,n),n===`steer`&&t(`/api/orchestrate/queue/${encodeURIComponent(e)}/hold`,`POST`,{}).catch(()=>{})}function st(e,n){let r=Qe(e,n),i=L.get(r);i&&(clearTimeout(i.timerId),L.delete(r),rt(e,n),n===`steer`&&t(`/api/orchestrate/queue/${encodeURIComponent(e)}/hold`,`DELETE`,{}).catch(()=>{}))}async function ct(e,n){L.delete(Qe(e,n));let r=n===`steer`?`/api/orchestrate/queue/${encodeURIComponent(e)}/steer`:`/api/orchestrate/queue/${encodeURIComponent(e)}`,i=n===`steer`?`POST`:`DELETE`;if(n===`steer`&&x(`running`),await t(r,i,{})==null){R=R.filter(t=>t.id!==e),$e(R),n===`steer`&&Z(`steer-fire-miss`).catch(()=>{});return}R=R.filter(t=>t.id!==e),$e(R)}function lt(e,t){if(L.has(Qe(e,t))){st(e,t);return}ot(e,t)}function ut(){let e=document.getElementById(`pendingQueue`);e&&e.addEventListener(`click`,async e=>{let t=e.target?.closest(`[data-pending-action]`);if(!t)return;let n=t.closest(`.pending-row`)?.dataset.pendingId;if(!n)return;let r=t.dataset.pendingAction;if(r===`copy`){let e=R.find(e=>e.id===n);if(e?.prompt&&(await p(e.prompt)).ok){let e=t.querySelector(`.pending-btn-content`);e&&(e.innerHTML=f.checkSimple,setTimeout(()=>{e.innerHTML=f.copy},600))}return}lt(n,r===`steer`?`steer`:`delete`)})}var dt=800,ft=64,pt=`CLI-JAW`,mt=!1,z=0,ht=pt,B=null,gt=``,_t=!1,vt=0;function yt(){return navigator}function bt(){return document.visibilityState!==`visible`||!document.hasFocus()}function xt(e){return e-vt<dt}function St(){if(B)return B;let e=document.querySelector(`link[rel~="icon"]`);if(e)return B=e,gt=e.href||e.getAttribute(`href`)||``,e;let t=document.createElement(`link`);return t.rel=`icon`,document.head.appendChild(t),B=t,_t=!0,t}function Ct(e){let t=document.createElement(`canvas`);t.width=ft,t.height=ft;let n=t.getContext(`2d`);return n?(n.clearRect(0,0,ft,ft),n.font=`44px "Apple Color Emoji", "Segoe UI Emoji", sans-serif`,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(`🦈`,28,36),n.beginPath(),n.arc(50,15,e>1?12:9,0,Math.PI*2),n.fillStyle=`#ff335f`,n.fill(),n.lineWidth=4,n.strokeStyle=`#ffffff`,n.stroke(),e>1&&(n.fillStyle=`#ffffff`,n.font=`bold 15px sans-serif`,n.textAlign=`center`,n.textBaseline=`middle`,n.fillText(String(Math.min(e,9)),50,16)),t.toDataURL(`image/png`)):gt}async function wt(e){let t=yt();if(typeof t.setAppBadge==`function`)try{await t.setAppBadge(e)}catch{}}async function Tt(){let e=yt();if(typeof e.clearAppBadge==`function`)try{await e.clearAppBadge()}catch{}}function Et(){document.title=`(${z}) ${ht}`;let e=St();e&&(e.href=Ct(z)),wt(z)}function Dt(){document.title=ht}function Ot(){if(B){if(_t){B.remove(),B=null,_t=!1;return}B.href=gt}}function kt(){mt||(mt=!0,ht=document.title||pt,St(),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&jt()}),window.addEventListener(`focus`,()=>jt()))}function At(){if(!mt||!bt())return;let e=Date.now();xt(e)||(vt=e,z+=1,Et())}function jt(){mt&&z!==0&&(z=0,vt=0,Dt(),Ot(),Tt())}function Mt(e,t){return!e||!t||e===`all`||e===t}function Nt(e){let t=P(e);return!t||e.version!==1?null:{version:1,...t}}var Pt=6291456,Ft=e=>typeof e==`object`&&!!e&&!Array.isArray(e),V=e=>typeof e==`string`&&e.length>0&&e.length<=240;function It(e){let{runId:t,sessionId:n,scope:r,turnId:i,requestId:a,requestType:o,expiresAt:s}=e;if(!V(t)||!V(n)||!V(r)||!V(i)||!V(a)||o!==`approval`&&o!==`question`||typeof s!=`number`||!Number.isSafeInteger(s))return null;let c=le(e.view);return c?{runId:t,sessionId:n,scope:r,turnId:i,requestId:a,requestType:o,expiresAt:s,view:c}:null}function Lt(e){return JSON.stringify([e.runId,e.sessionId,e.scope,e.turnId,e.requestId,e.requestType,e.view])}function Rt(e){let t=e.view.fields;return t.length>0&&(e.requestType===`approval`?t.length===1&&!t[0].multiSelect&&!t[0].allowFreeform&&t[0].options.length>0:t.every(e=>e.options.length>0||e.allowFreeform))}function zt(e,t,n={}){let a={...t},o=e.ownerDocument,s=o.createElement(`section`);s.className=`native-requests`,s.hidden=!0,s.setAttribute(`aria-label`,`Live runtime requests`);let c=o.createElement(`p`);c.className=`native-request-status`;let l=o.createElement(`p`);l.className=`native-request-announcer`,l.setAttribute(`role`,`status`),l.setAttribute(`aria-live`,`polite`),l.setAttribute(`aria-atomic`,`true`);let u=o.createElement(`h2`);u.className=`native-request-title`;let d=o.createElement(`p`);d.className=`native-request-context`;let f=o.createElement(`div`);f.className=`native-request-controls`;let p=le(`Refresh requests`,()=>{n.onRefresh?n.onRefresh():F()});s.append(u,d,c,f,p);let m=[...e.children].find(e=>e.classList.contains(`chat-input-area`));e.insertBefore(l,m??null),e.insertBefore(s,m??null);let h=null,g=null,_=null,v,y=0,b=0,x=!1,S=!1,C=!1,w=!1,T=n.health??`healthy`,ee=0,E=!1,te=!1,D=()=>!x&&(n.isCurrent?.()??!0),ne=0,re=null,O=null,ie=!1,k=null,A=o.defaultView,ae=()=>{ie=!0,++ne,O=null},oe=()=>{ie=!1},se=e=>{s.contains(e.target)||(++ne,O=null)};o.addEventListener(`focusin`,se),A?.addEventListener(`blur`,ae),A?.addEventListener(`focus`,oe);function ce(){return ie?null:s.contains(o.activeElement)?ne:C&&o.activeElement===o.body?re:null}function j(t=!0){if(O===null)return;if(ie||O!==ne){O=null;return}let n=s.isConnected&&!s.hidden?f.querySelector(`input:not(:disabled), textarea:not(:disabled), button:not(:disabled)[aria-disabled="false"]`)??p:e.querySelector(`#chatInput`)??o.getElementById(`chatInput`);n?.isConnected&&!n.hasAttribute(`disabled`)&&n.focus({preventScroll:!0}),t&&!C&&(O=null)}function le(e,t){let n=o.createElement(`button`);return n.type=`button`,n.textContent=e,n.addEventListener(`click`,t),n}function M(e,t=!1){t&&(k=e);let n=(T===`healthy`?``:T===`unknown`?`Live request updates not connected. `:`Connection lost. Live request updates unavailable. `)+(E&&T!==`healthy`?`Manually refreshed; updates remain unavailable. `:``)+e;c.textContent!==n&&(c.textContent=n);let r=T===`healthy`&&e===`No pending runtime requests.`?k??e:n;l.textContent!==r&&(l.textContent=r)}function N(){f.querySelectorAll(`button`).forEach(e=>{let t=w||C||!S;e.disabled=w||C||!S&&o.activeElement!==e,e.setAttribute(`aria-disabled`,String(t))}),f.querySelectorAll(`input, textarea`).forEach(e=>{e.disabled=C}),s.setAttribute(`aria-busy`,String(C))}function ue(e=ce()){O=e,clearTimeout(v),v=void 0,h=null,S=!1,b++,u.textContent=``,d.textContent=``,f.replaceChildren(),j(!1)}function P(){clearTimeout(v),h&&!w&&(v=setTimeout(()=>{if(D()){if(h&&h.expiresAt>Date.now()){P();return}ue(),M(T===`healthy`?`Request expired. Checking pending requests.`:`Request expired. Refresh requests to check what is pending.`,!0),F(`auto`)}},Math.min(2147483647,Math.max(0,h.expiresAt-Date.now()))))}function de(e){u.textContent=e.view.title,d.textContent=`Execution scope: ${e.scope} · Run: ${e.runId}`;let t=e.view.fields;if(!Rt(e))return;let n=b,r=e=>{b===n&&fe(e)},i=o.createElement(`form`);i.noValidate=!0;let a=[];for(let[n,s]of t.entries()){let t=o.createElement(`fieldset`),c=o.createElement(`legend`);c.textContent=s.label,t.append(c);let l=[];for(let i of s.options)if(e.requestType===`approval`)t.append(le(i.label,()=>r({optionId:i.id})));else{let e=o.createElement(`label`),r=o.createElement(`input`);r.type=s.multiSelect?`checkbox`:`radio`,r.name=`native-question-${n}`,r.value=i.id,e.append(r,o.createTextNode(i.label)),t.append(e),l.push({id:i.id,input:r})}let u=null;if(e.requestType===`question`&&s.allowFreeform){!s.multiSelect&&l.length&&t.append(le(`Clear selection`,()=>{l.forEach(e=>{e.input.checked=!1})}));let e=o.createElement(`label`);e.append(o.createTextNode(`Other answer`)),u=o.createElement(`textarea`),u.maxLength=2e3,e.append(u),t.append(e)}if(e.requestType===`question`){let e=o.createElement(`p`);e.textContent=s.multiSelect?`Choose at least one answer.`:`Choose exactly one answer.`,t.append(e)}a.push({field:s,choices:l,text:u}),i.append(t)}if(e.requestType===`question`){let e=o.createElement(`button`);e.type=`submit`,e.textContent=`Submit answers`,i.append(e)}i.addEventListener(`submit`,t=>{if(t.preventDefault(),e.requestType!==`question`||!D()||w||C||!S||b!==n)return;let i=0,o=[];for(let{field:e,choices:t,text:n}of a){let r=t.filter(e=>e.input.checked).map(e=>e.id),a=n?.value??``,s=a.length>0,c=r.length+(s&&a.trim()?1:0);if(s&&(!e.allowFreeform||!a.trim()||a.length>2e3)||(e.multiSelect?c<1||r.length>e.options.length:c!==1)){M(`Answer every question. Choose one answer for single-choice questions; other answers must be nonblank and at most 2,000 characters.`);return}i+=a.length,o.push([e.id,{selected:r,...s?{text:a}:{}}])}if(i>8e3){M(`Keep all other answers within 8,000 characters in total.`);return}r({answers:Object.fromEntries(o)})}),i.append(le(`Cancel request`,()=>r({optionId:null}))),f.append(i)}async function fe(e){let t=h;if(!D()||w||C||!S||!t)return;if(t.expiresAt<=Date.now()){ue(),M(`Request expired.`,!0),await F(`auto`);return}re=ce();let n=re;C=!0,S=!1;let a=b,o=ee;++y,g?.abort();let s=new AbortController;_=s,k=null,N(),M(`Sending response.`);let c=`optionId`in e&&e.optionId===null?`Request cancelled.`:`Response accepted.`,l=!1;try{let n=await r(`/api/runtime/requests/`+encodeURIComponent(t.requestId),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({runId:t.runId,sessionId:t.sessionId,scope:t.scope,turnId:t.turnId,response:e})},s.signal,65536);if(!Ft(n)||n.ok!==!0||!Ft(n.data)||n.data.accepted!==!0)throw Error(`unconfirmed`);l=!0}catch(e){c=e instanceof i&&e.status===409?`Request expired or was already answered. Pending requests refreshed.`:`Response could not be confirmed. Check pending requests before trying again.`}finally{_===s&&(_=null),C=!1}if(!D())return;if(w||o!==ee){N();return}if(b!==a){N(),j();return}l?ue(n):S=!1,N(),M(c,!0);let u=y+1;await F(`auto`),!x&&!w&&S&&y===u&&!l&&h&&Lt(h)===Lt(t)&&M(c)}async function F(e=`manual`){if(!D()||e===`auto`&&T!==`healthy`)return;let t=++y;g?.abort();let n=new AbortController;g=n,S=!1,N(),!h&&!te&&(s.hidden=!1,M(`Loading pending requests.`));try{if(!V(a.sessionId)||!V(a.scope))throw Error(`invalid_identity`);let i=await r(`/api/runtime/requests?sessionId=`+encodeURIComponent(a.sessionId),{method:`GET`},n.signal,Pt);if(!D()||t!==y||n.signal.aborted)return;if(!Ft(i)||i.ok!==!0||!Ft(i.data))throw Error(`invalid_list`);let o=i.data.requests;if(!Array.isArray(o)||o.length>128)throw Error(`invalid_list`);let c=new Set,l=null,u=null,d=!1;for(let e of o){if(!Ft(e)){d=!0;continue}if(V(e.requestId)){if(c.has(e.requestId))throw Error(`duplicate_request`);c.add(e.requestId)}if(e.sessionId!==a.sessionId)continue;let t=It(e);if(!t){d=!0;continue}t.expiresAt<=Date.now()||(l??=t,h&&Lt(h)===Lt(t)&&(u=t))}let f=u??l;h&&!u&&M(h.expiresAt<=Date.now()?`Request expired.`:`Request is no longer pending.`,!0),u||ue(),h=f,S=!0,w=!1,te=!0,E=e===`manual`,s.hidden=!h&&!d&&T===`healthy`,h?(u||(k=null),M(Rt(h)?(k?k+` `:``)+`Runtime is waiting for your response.`:`This request cannot be answered here. Refresh requests or use Stop.`),u||de(h),P()):M(d?`This request cannot be displayed safely. Refresh requests or use Stop.`:`No pending runtime requests.`),N(),j()}catch{if(!D()||t!==y||n.signal.aborted)return;s.hidden=!1,N(),M(`Pending requests could not be loaded. Refresh requests to retry.`)}finally{g===n&&(g=null)}}function pe(e){x||(T=e,E=!1,++ee,w=!0,S=!1,++y,g?.abort(),g=null,clearTimeout(v),v=void 0,s.hidden=!1,N(),M(`Your draft is kept. Refresh requests to check what is pending.`))}return T!==`healthy`&&pe(T),n.autoStart!==!1&&F(`auto`),{refresh:F,setStreamHealth:pe,suspend(){pe(`unavailable`)},dispose(){x||(x=!0,++y,g?.abort(),_?.abort(),ue(),s.remove(),l.remove(),j(),o.removeEventListener(`focusin`,se),A?.removeEventListener(`blur`,ae),A?.removeEventListener(`focus`,oe))}}}function Bt(t){let n=`unknown`,r=0,i=0,a=null,o=``,s=null,c=null,u=!1,d=null,f=()=>l(`/api/orchestrate/snapshot`),p=e=>a?.sessionId===e.sessionId&&a.scope===e.scope;function m(e){let n=t.host();if(n&&!s){if(!c){let e=n.ownerDocument;c=e.createElement(`section`),c.className=`native-requests`,c.setAttribute(`aria-label`,`Live runtime requests`);let t=e.createElement(`p`);t.className=`native-request-status`,t.setAttribute(`role`,`status`);let r=e.createElement(`button`);r.type=`button`,r.textContent=`Refresh requests`,r.addEventListener(`click`,()=>{_()}),c.append(t,r);let i=[...n.children].find(e=>e.classList.contains(`chat-input-area`));n.insertBefore(c,i??null)}c.querySelector(`p`).textContent=e}}function h(){s?.dispose(),s=null,a=null,e.activityIdentity=null}function g(){if(u||n!==`healthy`||!s||d?.epoch===r&&d.path===o&&(!d.panel||d.panel===s))return;u=!0;let e=r;queueMicrotask(()=>{u=!1,e===r&&n===`healthy`&&o===f()&&s?.refresh(`auto`)})}async function _(){if(d?.epoch===r&&d.path===f()&&d.panel===s)return;let e={epoch:r,path:f(),panel:s};d=e;try{(!s||o!==f())&&await t.refreshSnapshot(),e.epoch===r&&e.path===f()&&o===e.path&&(!e.panel||e.panel===s)&&await s?.refresh(`manual`)}catch{m(`Request identity could not be loaded. Refresh requests to retry.`)}finally{d===e&&(d=null)}}function v(e){n=e,++r,s?.setStreamHealth(e),m(e===`healthy`?`Loading request identity.`:`Live request updates unavailable. Refresh requests to check pending requests manually.`)}return{channelChanged(){v(`unknown`)},unavailable(){v(`unavailable`)},sseOpened(){v(`healthy`)},invalidateIdentity(){++r,++i,h(),m(`Request identity changed. Refresh requests to check this conversation.`)},beginSnapshot(){let l=f();o&&o!==l&&h();let u=r,d=++i,v=()=>u===r&&d===i&&l===f();return{path:l,isCurrent:v,accept(r){if(!v())return;let i=P(r);if(!i){h(),m(`Request identity unavailable. Refresh requests to retry.`);return}if(!p(i)){h(),a=i,o=l;let e=t.host();e&&(c?.remove(),c=null,s=zt(e,i,{health:n,autoStart:!1,onRefresh:()=>{_()},isCurrent:()=>a===i&&o===f()}))}e.activityIdentity=i,g()},fail(){v()&&(h(),m(`Request identity could not be loaded. Refresh requests to retry.`))}}},event(e,t){if(n!==`healthy`||!a||o!==f())return;let r=e===`agent_runtime_requests_changed`?Nt(t):null,i=e===`agent_runtime`?ne(t):null,s=typeof t==`object`&&!!t&&t.sseReplay===!0;(r&&p(r)||i&&p(i)&&(i.kind===`request`||i.kind===`request-settled`||i.kind===`turn-end`&&!s))&&g()},dispose(){++r,++i,h(),c?.remove(),c=null}}}N({currentMessage:()=>e.currentAgentDiv,useMessage:t=>{e.currentAgentDiv=t},createMessage:Vt,reconcileMessage:(e,t)=>m().reconcileMessage(e,t),replaceAnswer:fe,evicted:ie,closeTrace:()=>{a(()=>import(`./trace-drawer-BYKkBIG-.js`).then(e=>e.closeTraceDrawer()),__vite__mapDeps([0])).catch(e=>console.warn(`[activity] trace close unavailable`,e))},inspectTrace:(e,t)=>{a(()=>import(`./trace-drawer-BYKkBIG-.js`).then(n=>n.openTraceDrawer(e,void 0,t)),__vite__mapDeps([0])).catch(e=>console.warn(`[activity] trace unavailable`,e))}});function Vt(){return ge(),S(`agent`,``)}var H=Bt({host:()=>document.querySelector(`.chat-area`),refreshSnapshot:()=>Z(`native-request-retry`,{hydrateRun:!0})}),U=[`I`,`P`,`A`,`B`,`C`],W=null;function Ht(e,t,n){let r=U.indexOf(n);if(r<0)return;let i=e.getBoundingClientRect(),a=t.offsetWidth||36,o=document.getElementById(`dot-${n}`);if(!o)return;let s=U[r+1],c=s?document.getElementById(`dot-${s}`):null;if(c){let e=o.getBoundingClientRect(),n=c.getBoundingClientRect(),r=(e.right+n.left)/2;t.style.transform=`translateX(${r-i.left-a/2}px)`}else{let e=o.getBoundingClientRect();t.style.transform=`translateX(${e.left-i.left+e.width/2-a/2}px)`}}var Ut={},Wt=8,Gt=64,G=null,K=0,Kt=[],qt=new Map;function Jt(e){return e!==null&&(Kt.includes(e)||M(e)||!!v(e)?.answerSource)}function Yt(e){let t=Number(e);return Number.isFinite(t)&&t>0?Math.floor(t):null}function Xt(e,t){if(e&&t!=null)for(t>(qt.get(e)||0)&&qt.set(e,t);qt.size>Gt;){let e=null;for(let t of qt.keys())if(t!==G){e=t;break}if(!e)break;qt.delete(e)}}function Zt(e){let t=new Map;for(let n of e?.toolLog||[]){let e=typeof n?.traceRunId==`string`&&n.traceRunId?n.traceRunId:null,r=Yt(n?.traceSeq);e&&r!=null&&r>(t.get(e)||0)&&t.set(e,r)}return t}function Qt(e,t,n){return!n||!e||t==null?!1:t<=(qt.get(e)||0)}function $t(e){++q;let t=e??G;G=null,K=0,t&&!Kt.includes(t)&&(Kt.push(t),Kt.length>Wt&&Kt.shift())}function en(e){e&&e!==G&&(++q,G=e,K=0)}function tn(e){if(e?.running){typeof e.traceRunId==`string`&&e.traceRunId&&(G=e.traceRunId),K=typeof e.textLen==`number`?e.textLen:(e.text||``).length;for(let[t,n]of Zt(e))Xt(t,n)}}var nn=``,q=0,J=!1,rn=!1,an=0,on=[],sn=!1;function Y(){J=!1,_(!1),A(!1),G&&E(G)}function cn(){re(),on=[],an=0,sn=!1}function ln(t,n=`Activity preview is unavailable at its retention limit. The final answer will still appear here.`){let r=e.currentAgentDiv;if((!r||r.dataset.traceRunId!==t)&&(r=Vt(),e.currentAgentDiv=r,r.dataset.traceRunId=t),!r.querySelector(`.activity-unavailable`)){let e=r.ownerDocument.createElement(`p`);e.className=`activity-unavailable`,e.setAttribute(`role`,`status`),e.textContent=n,r.querySelector(`.agent-body`)?.prepend(e)}en(t)}function un(e){let t=new TextEncoder().encode(JSON.stringify(e)).length;if(on.length>=256||an+t>1048576){on=[],an=0,sn=!0;return}on.push(e),an+=t}function dn(t){let n=e.activityIdentity;if(!J||!n){un({gap:t});return}t.sessionId===n.sessionId&&t.scope===n.scope&&(v(t.runId)?E(t.runId):G===t.runId&&e.currentAgentDiv&&ln(t.runId,`Activity is incomplete. Runtime updates were not recorded; the final answer remains available separately.`))}function fn(t,n=!1){let r=e.activityIdentity;if(!J||!r){un({event:t,replay:n});return}if(t.sessionId!==r.sessionId||t.scope!==r.scope)return;let i=v(t.runId);if(i&&i.model.identity.turnId!==t.turnId)return;let a=Jt(t.runId);if(a&&!i||!i&&G&&G!==t.runId&&(t.kind!==`turn-start`||n))return;let o;try{o=te(t,!G||G===t.runId)??(t.kind===`turn-end`&&i?.model.end?.seq===t.seq?i:null)}catch(e){if(!(e instanceof ue))throw e;!n&&(!G||G===t.runId||t.kind===`turn-start`)&&ln(t.runId);return}if(o){if(++q,sn&&E(t.runId),t.kind!==`turn-end`){!a&&!n&&en(t.runId);return}a||G&&G!==t.runId||e.currentAgentDiv!==o.message||(o.answerSource=`canonical`,$t(t.runId),de(t.finalText,void 0,t.finalText===null?`absent`:`present`,t.runId,o.cacheScope,t.sessionId),At())}}function pn(t){if(t.isEmployee===!0)return;let n=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null,r=t.runtimeFinality===`present`||t.runtimeFinality===`absent`?t.runtimeFinality:void 0;if(!n&&!r&&(t.error===!0||G&&v(G))){typeof t.text==`string`&&t.text&&D(o(t.text),`tool-activity`);return}let i=n?v(n):void 0,a=!!i&&r!==`absent`&&typeof t.text==`string`;if(Jt(n)){if(a&&n)ee(n,t.text);else if(!i&&n&&r!==`absent`&&typeof t.text==`string`){let r=P(t);r&&r.sessionId===e.activityIdentity?.sessionId&&oe({...r,runId:n,text:t.text})}return}if(n&&G&&n!==G)return;w(n,t.runtimeStatus??(t.error===!0?`error`:void 0)),i&&(i.answerSource=`compatibility`),$t(n);let s=t.type===`agent_done`?t.toolLog:void 0;i&&n?(de(r===`absent`?null:t.text||``,s,r??(a?`present`:void 0),n,i.cacheScope,i.model.identity.sessionId),r===`absent`&&typeof t.text==`string`&&t.text&&D(o(t.text.slice(0,500)),`activity-diagnostic`)):de(t.text||``,s,r),At()}function mn(t){let n=e.currentAgentDiv,r=v(t.runId);if(n&&G===t.runId&&e.activityIdentity?.sessionId===t.sessionId&&n===t.message&&n.dataset.traceRunId===t.runId&&!Jt(t.runId)&&!(r&&(r.model.identity.sessionId!==t.sessionId||r.model.identity.scope!==t.scope||t.turnId!==void 0&&r.model.identity.turnId!==t.turnId))){if(w(t.runId,t.status),$t(t.runId),n.dataset.activitySaved===`true`){r&&(r.answerSource=`saved`),delete n.dataset.activityRecovering,ge(),x(`idle`);return}r?r.answerSource=t.answer.kind===`saved`?`saved`:`unavailable`:t.answer.kind!==`saved`&&e.activityIdentity&&T({runId:t.runId,sessionId:t.sessionId,scope:e.activityIdentity.scope,message:n,cacheScope:t.cacheScope}),de(t.answer.kind===`saved`?t.answer.message.content:null,void 0,t.answer.kind===`saved`?`present`:`absent`,t.runId,t.cacheScope,t.sessionId),At()}}function hn(){se(e.activityIdentity,{terminal:mn,refreshIdentity:()=>Z(`history-identity`,{hydrateRun:!0})}),A(J)}function gn(){let t=on;on=[],an=0;for(let e of t)`event`in e?fn(e.event,e.replay):dn(e.gap);sn&&G&&e.currentAgentDiv&&!v(G)&&ln(G,`Activity is incomplete. Updates were dropped while reconnecting; the final answer remains available separately.`),sn=!1}var X=0,_n=null,vn=0,yn=!1,bn=0,xn=750,Sn=750;async function Cn(t={}){let n=H.beginSnapshot(),i=q,o;try{o=await r(n.path,{method:`GET`},new AbortController().signal,16777216)}catch(e){throw n.isCurrent()&&Y(),n.fail(),e}if(!n.isCurrent())return;n.accept(o?.activityIdentity),J=rn&&e.activityIdentity!==null,ae(e.activityIdentity),_(J),hn(),nn=String(o.orc.scope||``),zn(o.orc.state),jn(o.orc.ctx||null),An(o.heartbeat||{pending:0,deferredPending:0}),kn(o.workers),C(o.runtime.queuePending),he(o.queued||[]),$e(o.queued||[]);let s=Jt(o.activeRun?.traceRunId??null),c=i===q;t.hydrateRun&&c&&!s&&(_e(o.activeRun),tn(o.activeRun),o.activeRun?.running&&o.activeRun.traceRunId&&e.currentAgentDiv&&(e.currentAgentDiv.dataset.traceRunId=o.activeRun.traceRunId,e.activityIdentity&&(e.currentAgentDiv.dataset.messageSessionId=e.activityIdentity.sessionId),y(o.activeRun.traceRunId,e.currentAgentDiv))),Ln(),c&&(o.runtime.busy&&!s?x(`running`):me()||x(`idle`)),J&&gn();let l=document.getElementById(`chatMessages`);l&&ce(l),J&&t.hydrateRun&&e.currentAgentDiv&&G&&(c||v(G)?.degraded)&&O(e.currentAgentDiv,G,!0),a(()=>import(`./employees-DrXQ9oRa.js`).then(e=>{typeof e.renderEmployees==`function`&&e.renderEmployees()}),__vite__mapDeps([0]))}function Z(e=`manual`,t={}){let n=Date.now();return t.hydrateRun?Cn(t):_n||(n-vn<xn?Promise.resolve():(vn=n,_n=Cn(t).catch(t=>{throw console.warn(`[ws] orchestrate snapshot sync failed (${e})`,t),t}).finally(()=>{_n=null}),_n))}function wn(e){return e===`iframe-visible`||e===`pageshow`||e===`discard`||e===`visibilitychange`}function Tn(e){h(e),a(()=>import(`./ui-CpxBqLlq.js`).then(async t=>{if(wn(e)&&X>0)try{await t.loadMessages(),X=Date.now()}catch(t){console.warn(`[ws] restore loadMessages failed (${e})`,t)}await Z(e,{hydrateRun:!0})}),__vite__mapDeps([0])).catch(()=>{}).finally(()=>{g(e)})}function En(e){let t=Date.now();!wn(e)&&t-bn<Sn||(bn=t,Tn(e))}function Dn(e){let t=Array.isArray(e.changedKeys)?e.changedKeys:[];if(t.includes(`presentation`)&&a(()=>import(`./presentation-preference-BYEPPRPg.js`).then(e=>e.refreshPresentationSettings()),[]).catch(e=>console.warn(`[ws] presentation refresh failed`,e)),t.includes(`multiSession`)){window.location.reload();return}t.includes(`workingDir`)||t.includes(`projectDirs`)?a(()=>import(`./ui-CpxBqLlq.js`).then(async e=>{try{await e.loadMessages(),X=Date.now()}catch(e){console.warn(`[ws] settings scope loadMessages failed`,e)}await Z(`settings_change`).catch(()=>{}).finally(()=>e.reconcileChatBottomAfterRestore(`settings_change`))}),__vite__mapDeps([0])):Z(`settings_change`).catch(()=>{}),a(()=>import(`./settings-core-BNFL4oSA.js`).then(t=>t.refreshHeaderFromSettingsChange(e)),__vite__mapDeps([0])).catch(()=>{})}function On(){yn||(yn=!0,window.addEventListener(`focus`,()=>{En(`focus`)}),window.addEventListener(`pageshow`,e=>{e.persisted&&En(`pageshow`)}),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`&&En(`visibilitychange`)}),document.addEventListener(`resume`,()=>{En(`resume`)}),`wasDiscarded`in document&&document.wasDiscarded&&En(`discard`),window.addEventListener(`message`,e=>{e.data?.type===`jaw-preview-visibility`&&e.data.visible&&En(`iframe-visible`)}))}function kn(e){for(let e of Object.keys(Ut))delete Ut[e];for(let t of e)t.state===`running`&&t.phase&&(Ut[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``})}function An(t){let n={pending:Number(t?.pending||0),deferredPending:Number(t?.deferredPending||0),...t?.reason?{reason:t.reason}:{},...t?.policy?{policy:t.policy}:{},...t?.jobId?{jobId:t.jobId}:{},...t?.jobName?{jobName:t.jobName}:{}};e.heartbeatRuntime=n;let r=document.getElementById(`pabcHeartbeatStatus`);if(r){if(n.reason===`pabcd_active`&&n.deferredPending>0){let e=n.jobName?`: ${n.jobName}`:``;r.textContent=`heartbeat deferred (${n.deferredPending})${e}`,r.hidden=!1}else r.textContent=``,r.hidden=!0}}function jn(t){e.orcTaskAnchor=String(t?.taskAnchor||``).trim(),e.orcResolvedSelection=t?.resolvedSelection||null;let n=document.getElementById(`pabcTaskAnchor`);n&&(e.orcTaskAnchor?(n.textContent=`anchor: ${e.orcResolvedSelection?.index?`${e.orcResolvedSelection.index}. `:``}${e.orcTaskAnchor}`,n.hidden=!1):(n.textContent=``,n.hidden=!0),Fn(t?.interview||null))}var Mn=(()=>{try{return localStorage.getItem(`jaw:interviewCollapsed`)===`1`}catch{return!1}})();function Nn(e){Mn=e;try{localStorage.setItem(`jaw:interviewCollapsed`,e?`1`:`0`)}catch{}let t=document.getElementById(`interviewPanel`);if(!t)return;t.classList.toggle(`collapsed`,e);let n=t.querySelector(`.iv-toggle`);n&&n.setAttribute(`aria-expanded`,String(!e))}function Pn(e){let t=e=>{switch(e){case`max`:return 1;case`xhigh`:return .8;case`high`:return .6;case`medium`:return .4;default:return .2}},n=e=>{switch(e){case`max`:return`#2196f3`;case`xhigh`:return`#4caf50`;case`high`:return`#8bc34a`;case`medium`:return`#ff9800`;default:return`#f44336`}},r=[t(e.goal),t(e.constraint),t(e.success),t(e.ontology)],i=1-r.reduce((e,t)=>e+t,0)/r.length,a=Object.values(e).every(e=>e===`max`)||i<=.2?`🟢 Ready`:i<=.4?`🟡 Almost`:`🔴 Needs work`,o=(e,r)=>{let i=t(r);return`<div style="display:flex;align-items:center;gap:6px;font-size:12px">
16
- <span style="width:70px;color:var(--text-secondary)">${e}</span>
17
- <div style="flex:1;height:5px;background:var(--bg-tertiary);border-radius:3px">
18
- <div style="width:${i*100}%;height:100%;background:${n(r)};border-radius:3px;transition:width .3s"></div>
19
- </div>
20
- <span style="width:60px;text-align:right;font-weight:600;font-size:11px">${i.toFixed(1)} ${r.toUpperCase()}</span>
21
- </div>`};return`<div style="display:flex;flex-direction:column;gap:3px;margin:6px 0">
22
- <div style="display:flex;justify-content:space-between;font-size:11px;margin-bottom:2px">
23
- <span style="color:var(--text-secondary)">Ambiguity: ${i.toFixed(2)}</span>
24
- <span>${a}</span>
25
- </div>
26
- ${o(`Goal`,e.goal)}
27
- ${o(`Constraint`,e.constraint)}
28
- ${o(`Success`,e.success)}
29
- ${o(`Ontology`,e.ontology)}
30
- </div>`}function Fn(e){let t=document.getElementById(`interviewPanel`);if(!t)return;if(!e||!e.known.length&&!e.unknown.length){t.hidden=!0;return}t.hidden=!1,t.classList.toggle(`collapsed`,Mn);let n=e=>{switch(e){case`user_statement`:return`🟢`;case`repo_fact`:return`🔵`;case`inference`:return`🟡`;case`assumption`:return`🟠`;case`default`:return`⚪`;default:return`·`}},r=e.known.map(e=>{if(typeof e==`string`)return`<li class="iv-known">· ${o(e)}</li>`;let t=e,r=n(t.source),i=t.dimension?` <span class="iv-dim">[${t.dimension}]</span>`:``;return`<li class="iv-known">${r} ${o(t.fact)}${i}</li>`}).join(``),i=e.unknown.map(e=>`<li class="iv-unknown">❓ ${o(typeof e==`string`?e:JSON.stringify(e))}</li>`).join(``);t.innerHTML=`
31
- <button type="button" class="iv-toggle" aria-expanded="${!Mn}" aria-controls="interviewBody" title="인터뷰 트래커 접기/펼치기">
32
- <span class="iv-chevron" aria-hidden="true">▸</span>
33
- <span class="iv-summary">Interview · <span class="iv-known-count">Known ${e.known.length}</span> · <span class="iv-unknown-count">Unknown ${e.unknown.length}</span>${e.known.filter(e=>typeof e==`object`&&e&&`source`in e&&e.source===`assumption`).length>0?` · <span class="iv-assumption-count">⚠️ ${e.known.filter(e=>typeof e==`object`&&e&&`source`in e&&e.source===`assumption`).length} assumptions</span>`:``} · Round ${e.round}</span>
34
- </button>
35
- <div class="iv-body" id="interviewBody">
36
- ${e.assessment?`<div class="iv-section iv-section-ambiguity">${Pn(e.assessment)}</div>`:``}
37
- <div class="iv-section iv-section-known"><strong>Known (${e.known.length})</strong><ul>${r}</ul></div>
38
- <div class="iv-section iv-section-unknown"><strong>Unknown (${e.unknown.length})</strong><ul>${i}</ul></div>
39
- </div>
40
- `,t.dataset.toggleBound||(t.dataset.toggleBound=`1`,t.addEventListener(`click`,e=>{e.target.closest(`.iv-toggle`)&&Nn(!Mn)}))}function In(e,t){let n=document.getElementById(`budgetPanel`);if(!n)return;if(!e||t!==`B`){n.hidden=!0;return}n.hidden=!1;let r=(e,t,n)=>{let r=n>0?Math.min(t/n*100,100):0;return`<div style="display:flex;align-items:center;gap:6px;font-size:12px">
41
- <span style="width:70px;color:var(--text-secondary)">${e}</span>
42
- <div style="flex:1;height:5px;background:var(--bg-tertiary);border-radius:3px">
43
- <div style="width:${r}%;height:100%;background:${r>=100?`#f44336`:r>=66?`#ff9800`:`#4caf50`};border-radius:3px"></div>
44
- </div>
45
- <span style="width:30px;text-align:right;font-size:11px">${t}/${n}</span>
46
- </div>`};n.innerHTML=`<div style="font-size:11px;font-weight:600;margin-bottom:4px;color:var(--text-secondary)">Build Budget</div>
47
- ${r(`Workers`,e.spent.workerDispatches,e.maxWorkerDispatches)}
48
- ${r(`Self-heal`,e.spent.selfHealRetries,e.maxSelfHealRetries)}
49
- ${r(`Verify`,e.spent.verificationRounds,e.maxVerificationRounds)}`}async function Ln(){try{let t=await fetch(`${n}/api/goal`);if(!t.ok)return;let r=await t.json();r.goal?e.activeGoal={id:r.goal.id,objective:r.goal.objective,status:r.goal.status,createdAt:r.goal.createdAt,updatedAt:r.goal.updatedAt,lastCheckpointSummary:r.goal.lastCheckpoint?.summary,nextAction:r.goal.lastCheckpoint?.nextAction}:e.activeGoal=null,Rn()}catch{}}function Rn(){let t=document.getElementById(`goalCockpit`);if(!t)return;let n=e.activeGoal;if(!n||n.status===`complete`||n.status===`cancelled`){t.hidden=!0,t.innerHTML=``;return}t.hidden=!1,t.replaceChildren();let r=n.status===`paused`?`paused`:n.status===`blocked`?`blocked`:`active`,i=document.createElement(`span`);i.className=`goal-objective`,i.title=n.objective,i.textContent=n.objective;let a=document.createElement(`span`);if(a.className=`goal-status goal-status--${r}`,a.textContent=n.status,t.append(i,a),n.nextAction){let e=document.createElement(`span`);e.className=`goal-next`,e.textContent=n.nextAction,t.append(e)}}function zn(t,n){let r=new Set([`IDLE`,`I`,`P`,`A`,`B`,`C`,`D`]).has(t)?t:`IDLE`;if(e.orcState=r,r===`IDLE`||r===`D`)document.body.removeAttribute(`data-orc-state`),document.body.style.removeProperty(`--orc-glow`);else{document.body.setAttribute(`data-orc-state`,r);let e=`--orc-glow-${r}`,t=getComputedStyle(document.documentElement).getPropertyValue(e).trim();document.body.style.setProperty(`--orc-glow`,t)}document.body.classList.add(`orc-pulse`),setTimeout(()=>document.body.classList.remove(`orc-pulse`),700);let i=document.getElementById(`orcStateBadge`);i&&(i.textContent={IDLE:``,I:`INTERVIEW`,P:`PLAN`,A:`AUDIT`,B:`BUILD`,C:`CHECK`,D:`DONE`}[r],i.style.display=r===`IDLE`?`none`:`inline-block`);let a=document.getElementById(`pabcRoadmap`),o=document.getElementById(`sharkRunner`),s=document.getElementById(`pabcBrand`);if(a&&o){if(!a.dataset.resizeObserved){a.dataset.resizeObserved=`1`,new ResizeObserver(()=>{W&&o.classList.contains(`running`)&&Ht(a,o,W)}).observe(a);let e=0;window.addEventListener(`resize`,()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{W&&o.classList.contains(`running`)&&Ht(a,o,W)})})}if(r===`IDLE`)a.classList.remove(`visible`,`shimmer-out`),o.classList.remove(`running`),W=null;else if(r===`D`){U.forEach(e=>{let t=document.getElementById(`dot-${e}`);t&&(t.className=`pabc-dot done`,t.setAttribute(`data-phase`,e))});for(let e=0;e<U.length;e++){let t=document.getElementById(`pabc-conn-${e}`);t&&(t.className=`pabc-connector done`)}o.classList.remove(`running`),W=null,a.classList.add(`shimmer-out`),setTimeout(()=>a.classList.remove(`visible`,`shimmer-out`),1e3)}else{a.classList.remove(`shimmer-out`),a.classList.add(`visible`),o.classList.add(`running`);let e=U.indexOf(r);U.forEach((t,n)=>{let r=document.getElementById(`dot-${t}`);r&&(r.className=`pabc-dot ${n<e?`done`:n===e?`active`:`future`}`,r.setAttribute(`data-phase`,t))});for(let t=0;t<U.length;t++){let n=document.getElementById(`pabc-conn-${t}`);n&&(n.className=`pabc-connector ${t<e?`done`:``}`)}W=r,requestAnimationFrame(()=>Ht(a,o,r))}s&&n&&(s.textContent=n)}}var Bn=!1,Vn=Promise.resolve(),Hn=0;function Un(){rn=!1,Y(),H.channelChanged(),On(),Bn||(Bn=!0,tr()),$n(),Xe(u())}var Wn=Un;function Gn(e){rn=e===`sse`,Y(),e===`sse`&&H.sseOpened(),console.log(`[${e}] connected`),Zn=2e3,Jn();let t=Date.now()-X<1e4;Vn=a(()=>import(`./ui-CpxBqLlq.js`).then(async n=>{if(n.cleanupToolActivity(),!t)try{await n.loadMessages(),X=Date.now()}catch(t){console.error(`[${e}] loadMessages failed`,t)}await Z(`reconnect`,{hydrateRun:!0}).catch(()=>{}).finally(()=>n.reconcileChatBottomAfterRestore(`reconnect`)),a(()=>import(`./memory-BOwQYuLb.js`).then(e=>e.refreshMemorySidebar()),__vite__mapDeps([0])).catch(()=>{}),a(()=>import(`./bgtask-badge-C_bWwh_e.js`).then(e=>e.refreshBgtaskBadge()),__vite__mapDeps([0])).catch(()=>{})}),__vite__mapDeps([0]))}function Kn(){Y(),sn=!0,h(`replay_gap`),Vn=a(()=>import(`./ui-CpxBqLlq.js`).then(async e=>{try{await e.loadMessages(),X=Date.now()}catch(e){console.error(`[sse] replay gap loadMessages failed`,e)}await Z(`replay_gap`,{hydrateRun:!0}).catch(()=>{}).finally(()=>e.reconcileChatBottomAfterRestore(`replay_gap`))}),__vite__mapDeps([0]))}var qn=8e3,Q=null;function Jn(){Q!==null&&(window.clearTimeout(Q),Q=null)}function Yn(){rn=!1,Y(),H.unavailable(),console.log(`[channel] disconnected`),ge(),Q===null&&(Q=window.setTimeout(()=>{Q=null,x(`idle`),D(`${f.exec} ${s(`ws.disconnected`)}`,`tool-activity`)},qn))}var $=null,Xn=!1,Zn=2e3,Qn=3e4;function $n(){if($){Xn=!0;try{$.close()}catch{}$=null}}function er(){if($)return;console.warn(`[channel] /api/events unavailable — falling back to legacy WebSocket`);let e=`ws://${location.host}`,t=new WebSocket(`${e}${n}/?lang=${u()}`);$=t,Xn=!1,t.onmessage=e=>{let t;try{t=JSON.parse(e.data)}catch{console.warn(`[ws] malformed message:`,e.data);return}if(!t||typeof t!=`object`||typeof t.type!=`string`){console.warn(`[ws] invalid message shape:`,t);return}nr(t)};let r=!1;t.onopen=()=>{r=!0,Zn=2e3,Gn(`ws`)},t.onclose=()=>{if($===t&&($=null),Xn){Xn=!1;return}if(r){Yn(),setTimeout(Un,2e3);return}Zn=Math.min(Zn*2,Qn),setTimeout(Un,Zn)}}function tr(){qe(`widget`,`widget_updated`,e=>{let t=e.chatId,n=e.widgetId;typeof t==`string`&&typeof n==`string`&&a(()=>import(`./iframe-renderer-DjRrBgkV.js`).then(e=>e.refreshFileWidget(t,n)),__vite__mapDeps([0])).catch(e=>console.warn(`[widget] refresh failed:`,e.message))}),qe(`*`,null,e=>{H.event(String(e.event),e),nr({...e,type:e.event})}),We(()=>Gn(`sse`)),Ge(()=>Yn()),Ke(()=>{rn=!1,Y(),H.unavailable(),er()})}function nr(t){if(t.type===`agent_runtime`){let e=ne(t);e&&fn(e,t.sseReplay===!0);return}if(t.type===`agent_runtime_gap`){let e=t,n=P(e);n&&typeof e.runId==`string`&&e.runId.length>0&&e.runId.length<=240&&dn({...n,runId:e.runId});return}if(t.type===`agent_tool`){if(me())return;let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null,n=Yt(t.traceSeq);if(Jt(e)||Qt(e,n,t.sseReplay===!0))return;++q,t.isEmployee!==!0&&en(e);let r=t.toolType===`thinking`?`thinking`:t.toolType===`search`?`search`:t.toolType===`subagent`?`subagent`:`tool`;F({id:`step-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:r,icon:t.icon||f.tool,rawIcon:t.rawIcon||t.icon||``,label:t.label||``,isEmployee:t.isEmployee===!0,detail:t.detail||``,stepRef:t.stepRef||``,traceRunId:t.traceRunId||``,traceSeq:t.traceSeq,detailAvailable:t.detailAvailable,detailBytes:t.detailBytes,rawRetentionStatus:t.rawRetentionStatus,status:t.status||`running`,startTime:typeof t.startedAt==`number`&&t.startedAt>0?t.startedAt:Date.now()},typeof t.startedAt==`number`&&t.startedAt>0?t.startedAt:void 0),Xt(e,n)}else if(t.type===`agent_output`||t.type===`agent_chunk`){if(me())return;let e=typeof t.traceRunId==`string`&&t.traceRunId?t.traceRunId:null;if(Jt(e))return;en(e);let n=t.text||``;if(e&&typeof t.textLen==`number`){if(t.textLen<=K){t.sseReplay!==!0&&t.textLen<K&&(console.warn(`[ws] live agent_output behind applied cursor — resync (${t.textLen} < ${K})`),K=t.textLen);return}let e=t.textLen-K;e<n.length&&(n=n.slice(-e)),K=t.textLen}++q,ve(n)}else if(t.type===`agent_status`){if(!t.running&&me())return;t.running&&me()&&pe(),++q,t.running===void 0?x(t.status||`idle`):x(t.running?`running`:`idle`),t.agentId&&t.phase&&(Ut[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``},a(()=>import(`./employees-DrXQ9oRa.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0])))}else if(t.type===`bgtask_update`)a(()=>import(`./bgtask-badge-C_bWwh_e.js`).then(e=>e.applyBgtaskUpdate(t)),__vite__mapDeps([0])).catch(()=>{});else if(t.type===`queue_update`)C(t.pending||0),Array.isArray(t.queued)&&$e(t.queued),Z(`queue_update`).catch(()=>{});else if(t.type===`agent_retry`){let e=Number(t.delay??0),n=t.reason,r=o(String(n||`429`));D(s(e>0?`ws.retry`:`ws.retryNow`,{cli:o(t.cli||``),reason:r,delay:e}),`tool-activity`)}else if(t.type===`agent_fallback`)D(s(`ws.fallback`,{from:o(t.from||``),to:o(t.to||``)}),`tool-activity`);else if(t.type===`agent_smoke`)D(`${f.warning} ${o(t.cli||`agent`)}: smoke response detected — auto-continuing`,`tool-activity`);else if(t.type===`goal_done`)e.activeGoal=null,Rn(),D(`🎯 Goal completed${t.source===`ai_output`?` (detected from AI output)`:``}`,`tool-activity`);else if(t.type===`goal_cancel`)e.activeGoal=null,Rn(),D(`🎯 Goal cancelled`,`tool-activity`);else if(t.type===`schedule_wakeup`)D(`⏰ Wakeup scheduled in ${t.delaySeconds}s — ${o(String(t.reason||``))}`,`tool-activity`);else if(t.type===`goal_continuation_limit`)D(`⚠️ Goal continuation limit reached (${t.attempts} attempts)`,`tool-activity`);else if(t.type===`goal_continuation`)D(`🎯 Active goal — auto-continuing`,`tool-activity`);else if(t.type===`agent_done`){if(t.steered===!0){let e=P(t);e&&t.traceRunId&&b({...e,runId:t.traceRunId})}t.steered||me()||pn(t)}else if(t.type===`orchestrate_done`)pn(t);else if(t.type===`clear`){++q,j(),cn(),ae(e.activityIdentity),d(),ge(),m().clear();let t=document.getElementById(`chatMessages`);t&&(t.innerHTML=``),hn(),k(e.activityIdentity?.sessionId??null,new Set),a(()=>import(`./idb-cache-CFBnPfHz.js`).then(e=>e.clearScopedCache()),[]).catch(()=>{})}else if(t.type===`session_reset`)D(`${f.refresh} Session reset — history preserved`,`tool-activity`);else if(t.type===`agent_added`||t.type===`agent_updated`||t.type===`agent_deleted`)a(()=>import(`./employees-DrXQ9oRa.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0]));else if(t.type===`heartbeat_pending`){let e={pending:t.pending||0,deferredPending:t.deferredPending||0};t.reason!==void 0&&(e.reason=t.reason),t.policy!==void 0&&(e.policy=t.policy),t.jobId!==void 0&&(e.jobId=t.jobId),t.jobName!==void 0&&(e.jobName=t.jobName),An(e)}else if(t.type===`orc_state`)rr(t);else if(t.type===`memory_status`)a(()=>import(`./memory-BOwQYuLb.js`).then(e=>e.refreshMemorySidebar()),__vite__mapDeps([0]));else if(t.type===`steer_started`){let e=P(t);if(e&&t.traceRunId&&b({...e,runId:t.traceRunId}),t.mode===`native-input`||t.mode===`cancel-reprompt`||G&&v(G))return;ye(),$t(null),de(``),x(`steering`)}else if(t.type===`new_message`&&(t.source===`telegram`||t.source===`discord`||t.source===`slack`||t.source===`bgtask`||t.source===`cli`||t.source===`goal`||t.external===!0||t.fromQueue===!0)){let e=t.role===`assistant`?`agent`:t.role||`user`,n=t.content||``,r=t.cli;a(()=>import(`./message-history-CqWYH9Sx.js`).then(i=>{if(i.historyReloadInFlight()){i.loadMessages().then(()=>i.loadMessages()).catch(e=>console.warn(`[ws] new_message reload after in-flight failed`,e));return}S(e,n,r,{...t.steered===void 0?{}:{steered:t.steered}})}),__vite__mapDeps([0]))}else t.type===`system_notice`?D(`ℹ️ ${o(t.text||``)}`,`tool-activity`):t.type===`replay_gap`?Kn():t.type===`worker_stalled`?D(`⚠️ Worker stalled: ${o(t.employeeName||t.agentId||``)}`,`tool-activity`):t.type===`steer_context_lost`?D(`⚠️ 이전 턴의 진행 내용을 살리지 못했습니다 — 새 턴은 그 맥락 없이 시작합니다.`,`tool-activity`):t.type===`worker_disconnected`?D(`🔌 Worker disconnected: ${o(t.agentId||``)} (exit ${o(String(t.exitCode??`?`))})`,`tool-activity`):t.type===`worker_timeout`?D(`⏱️ Worker timed out: ${o(t.employeeName||t.agentId||``)}`,`tool-activity`):t.type===`alert_escalation`?D(o(t.message||``),`tool-activity`):t.type===`schedule_wakeup_failed`?D(`⚠️ Wakeup failed — ${o(String(t.reason||``))}: ${o(String(t.error||``))}`,`tool-activity`):t.type===`goal_continuation_failed`?D(`⚠️ Goal continuation failed: ${o(String(t.error||``))}`,`tool-activity`):t.type===`settings_change`?Dn(t):t.type===`session_list`?c(t):(t.type===`session_switched`||t.type===`session_created`)&&(j(),Y(),cn(),H.invalidateIdentity(),window.location.reload())}function rr(e){let t=++Hn;Vn.then(()=>{t===Hn&&Mt(e.scope,nn)&&(zn(typeof e.state==`string`?e.state:`IDLE`,e.title),jn({taskAnchor:e.taskAnchor||null,resolvedSelection:e.resolvedSelection||null,interview:e.interview||null}),In(e.buildBudget||null,typeof e.state==`string`?e.state:`IDLE`))})}function ir(e){return Ut[e]||null}var ar=`sidebarState`,or=900,sr=768;function cr(){return window.innerWidth<=sr}function lr(){document.body.classList.remove(`left-expanded`,`right-expanded`)}function ur(e){let t=`${e}-expanded`,n=e===`left`?`right-expanded`:`left-expanded`,r=!document.body.classList.contains(t);document.body.classList.remove(n),document.body.classList.toggle(t,r)}function dr(){let e={};try{e=JSON.parse(localStorage.getItem(ar)||`{}`)}catch{}e.left&&document.body.classList.add(`left-collapsed`),e.right&&document.body.classList.add(`right-collapsed`);let t=cr();document.getElementById(`toggleLeft`)?.addEventListener(`click`,pr),document.getElementById(`toggleRight`)?.addEventListener(`click`,mr),window.addEventListener(`resize`,()=>{let e=cr();if(window.innerWidth>or){lr();let e={};try{e=JSON.parse(localStorage.getItem(ar)||`{}`)}catch{}document.body.classList.toggle(`left-collapsed`,!!e.left),document.body.classList.toggle(`right-collapsed`,!!e.right)}else document.body.classList.remove(`left-collapsed`,`right-collapsed`),e!==t&&lr();t=e,_r()}),window.innerWidth<=or&&(document.body.classList.remove(`left-collapsed`,`right-collapsed`),cr()&&lr()),_r()}function fr(){return window.innerWidth<=or}function pr(){fr()?ur(`left`):document.body.classList.toggle(`left-collapsed`),vr(),_r()}function mr(){fr()?ur(`right`):document.body.classList.toggle(`right-collapsed`),gr()&&document.getElementById(`tabAgents`)?.classList.contains(`active`)&&a(()=>import(`./employees-DrXQ9oRa.js`).then(e=>e.loadEmployees(!0)),__vite__mapDeps([0])),vr(),_r()}function hr(){return fr()?document.body.classList.contains(`left-expanded`):!document.body.classList.contains(`left-collapsed`)}function gr(){return fr()?document.body.classList.contains(`right-expanded`):!document.body.classList.contains(`right-collapsed`)}function _r(){let e=document.getElementById(`toggleLeft`),t=document.getElementById(`toggleRight`);e&&(e.innerHTML=hr()?f.chevronLeft:f.chevronRight),t&&(t.innerHTML=gr()?f.chevronRight:f.chevronLeft)}function vr(){localStorage.setItem(ar,JSON.stringify({left:document.body.classList.contains(`left-collapsed`),right:document.body.classList.contains(`right-collapsed`)}))}export{Un as a,Z as c,ut as d,Me as f,mr as i,jt as l,gr as n,ir as o,pr as r,Wn as s,dr as t,kt as u};
@@ -1 +0,0 @@
1
- import{n as e}from"./skills-CD3PFa7e.js";export{e as loadSkills};
@@ -1 +0,0 @@
1
- import{a as e}from"./slash-commands-Czgl_F8c.js";export{e as loadCommands};
@@ -1 +0,0 @@
1
- import{p as e}from"./iframe-renderer-CLqxxRj1.js";import{I as t,s as n}from"./message-history-BhiEuMLw.js";import{r}from"./ui-B0OYr3pK.js";export{r as cleanupToolActivity,n as loadMessages,e as reconcileChatBottomAfterRestore,t as updateQueueBadge};