cli-jaw 1.6.23 → 1.6.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/public/css/tool-ui.css +11 -0
- package/public/dist/assets/{employees-DbPhkoTL.js → employees-Bqy3DcSm.js} +1 -1
- package/public/dist/assets/{index-COKY1Daf.css → index-B4ZSYCSC.css} +1 -1
- package/public/dist/assets/{index-CYnmRzPT.js → index-Br2aZvLo.js} +4 -4
- package/public/dist/assets/{render-DatPJ9kF.js → render-BGh36e9F.js} +1 -1
- package/public/dist/assets/{settings-CxZuFlXv.js → settings-BBR8HhIR.js} +1 -1
- package/public/dist/assets/settings-DCPeIn7T.js +1 -0
- package/public/dist/assets/{skills-CGd2AfXY.js → skills-BcpP9t6k.js} +1 -1
- package/public/dist/assets/skills-DSnKA-Nc.js +1 -0
- package/public/dist/assets/slash-commands-BS7C-3R0.js +1 -0
- package/public/dist/assets/{slash-commands-CG3D5Bh-.js → slash-commands-Utf2zCbI.js} +1 -1
- package/public/dist/assets/ui-N0IhTP91.js +1 -0
- package/public/dist/assets/ui-th_57WwF.js +131 -0
- package/public/dist/assets/{ws-BRDi7fcj.js → ws-jcPcWPwT.js} +1 -1
- package/public/dist/index.html +2 -2
- package/public/js/ui.ts +26 -2
- package/public/js/virtual-scroll.ts +17 -6
- package/public/dist/assets/settings-5Q8WvBhT.js +0 -1
- package/public/dist/assets/skills-B5gmFwWn.js +0 -1
- package/public/dist/assets/slash-commands-CJEW5z-I.js +0 -1
- package/public/dist/assets/ui-BGKtJSnv.js +0 -131
- package/public/dist/assets/ui-Fg7JCZ8n.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,F as i,I as a,M as o,N as s,O as c,P as l,S as u,T as d,_ as f,b as ee,j as p,k as m,u as te,v as ne,w as h,x as re,y as g}from"./vendor-render-D2YP6GiF.js";import{r as ie}from"./api-DygAf_G_.js";import{Q as _,Z as v}from"./vendor-mermaid-C2RBgdM6.js";import{A as ae,B as oe,C as se,D as ce,E as le,F as ue,G as de,H as fe,I as pe,J as me,K as he,L as ge,M as _e,N as ve,O as ye,P as be,R as xe,S as Se,T as Ce,U as we,V as Te,W as Ee,Y as De,_ as Oe,a as ke,b as Ae,c as je,d as Me,f as Ne,g as Pe,h as y,i as Fe,j as Ie,k as Le,l as Re,m as ze,n as Be,o as Ve,p as He,q as Ue,r as We,s as Ge,t as Ke,u as qe,v as Je,w as Ye,x as Xe,y as Ze,z as Qe}from"./vendor-icons-C6LXvgi0.js";var b=`ko`,x={},S={};async function $e(){let e=null;try{e=localStorage.getItem(`claw_locale`)}catch{}if(!e){let t=(navigator.language||`ko`).split(/[-_]/)[0].toLowerCase();e=[`en`,`ko`].includes(t)?t:`ko`}S=await C(`ko`),x=e===`ko`?S:await C(e),b=e,T()}async function C(e){try{let{api:t}=await v(async()=>{let{api:e}=await import(`./api-COrKYKcO.js`);return{api:e}},[]);return await t(`/api/i18n/${e}`)||{}}catch{return{}}}function w(e,t={}){let n=x[e]??S[e]??e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,String(r));return n}function T(){document.querySelectorAll(`[data-i18n]`).forEach(e=>{let t=e.getAttribute(`data-i18n`);t&&(e.textContent=w(t))}),document.querySelectorAll(`[data-i18n-placeholder]`).forEach(e=>{let t=e.getAttribute(`data-i18n-placeholder`);t&&(e.placeholder=w(t))}),document.querySelectorAll(`[data-i18n-title]`).forEach(e=>{let t=e.getAttribute(`data-i18n-title`);t&&(e.title=w(t))}),document.querySelectorAll(`[data-i18n-aria]`).forEach(e=>{let t=e.getAttribute(`data-i18n-aria`);t&&e.setAttribute(`aria-label`,w(t))})}async function et(e){if(e!==b){x=e===`ko`?S:await C(e),b=e;try{localStorage.setItem(`claw_locale`,e)}catch{}T();try{let{loadEmployees:e}=await v(async()=>{let{loadEmployees:e}=await import(`./employees-DbPhkoTL.js`);return{loadEmployees:e}},[]);e()}catch{}try{let{loadSkills:e}=await v(async()=>{let{loadSkills:e}=await import(`./skills-B5gmFwWn.js`);return{loadSkills:e}},[]);e()}catch{}try{let{loadCommands:e}=await v(async()=>{let{loadCommands:e}=await import(`./slash-commands-CJEW5z-I.js`);return{loadCommands:e}},[]);e()}catch{}try{let{loadSettings:e}=await v(async()=>{let{loadSettings:e}=await import(`./settings-5Q8WvBhT.js`);return{loadSettings:e}},[]);e()}catch{}}}function tt(){return b}function nt(e,t={}){let n=new URL(e,location.origin);return n.searchParams.has(`locale`)||n.searchParams.set(`locale`,b),fetch(n.toString(),t)}var rt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12c0 0 2-4 6-4 1 0 2 .5 3 1l3-6c0 0 1 5 3 7 1.5 1.5 5 2 5 2s-1 4-5 4c-1 0-2-.3-3-.8L12 18c0 0-2-1-4-1-4 0-6-5-6-5z"/><circle cx="17" cy="11" r="0.5" fill="currentColor" stroke="none"/><path d="M7 12l1 2"/><path d="M9.5 12l1 2"/></svg>`,E=14,it=16;function D(e,t=it){return De(e,{size:t})}var O={check:D(Qe),error:D(ge),warning:D(Fe),skip:D(Ge),tool:D(We),thinking:D(Ae),search:D(qe),web:D(ae),exec:D(Ke),compacting:D(Oe),plan:D(Je),brain:D(de),heartPulse:D(ye),lock:D(Xe),lockOpen:D(Se),key:D(Ce),settings:D(je),file:D(ve),trash:D(ke),lightbulb:D(Ye),refresh:D(Ne),mic:D(Ze),clipboard:D(pe),robot:D(he),palette:D(Pe),link:D(se),salute:D(Le),shark:rt,user:D(xe),paperclip:D(y),save:D(Me),gamepad:D(Ie),house:D(le),radio:D(He),folder:D(_e),pencil:D(ze),chart:D(Ee),hourglass:D(ce),stop:D(Ve),close:D(Be,E),send:D(Re),copy:D(ue,E),download:D(be,E),checkSimple:D(we,E),chevronLeft:D(Te,E),chevronRight:D(oe,E),chevronDown:D(fe,E),arrowLeft:D(me,E),arrowRight:D(Ue,E)},at={"✅":`check`,"❌":`error`,"🔧":`tool`,"⏭":`skip`,"🧠":`brain`,"💓":`heartPulse`,"🔒":`lock`,"🔓":`lockOpen`,"🔑":`key`,"⚙":`settings`,"⚙️":`settings`,"📄":`file`,"🗑":`trash`,"🗑️":`trash`,"⚠":`warning`,"⚠️":`warning`,"💡":`lightbulb`,"🦈":`shark`,"👤":`user`,"💭":`thinking`,"🔍":`search`,"🌐":`web`,"⚡":`exec`,"🗜":`compacting`,"🗜️":`compacting`,"📝":`plan`,"📑":`clipboard`,"🤖":`robot`,"📋":`clipboard`,"🔄":`refresh`,"🎨":`palette`,"🎤":`mic`,"🔗":`link`,"🫡":`salute`,"📎":`paperclip`,"💾":`save`,"🎮":`gamepad`,"🏠":`house`,"📡":`radio`,"📂":`folder`,"✏️":`pencil`,"📊":`chart`,"🎙️":`mic`};function ot(e){let t=at[e];return t?O[t]:e}function st(e){return e===`✅`?`done`:e===`❌`?`error`:null}function ct(e=document.body){let t=e.querySelectorAll(`[data-icon]`);for(let e of t){let t=e.dataset.icon;t&&O[t]&&(e.innerHTML=O[t],e.classList.add(`icon-hydrated`))}}function lt(e){let t=[],n=e.replace(/```[\s\S]*?```/g,e=>(t.push(e),`\x00P${t.length-1}\x00`)).replace(/`[^`]+`/g,e=>(t.push(e),`\x00P${t.length-1}\x00`));return n=n.replace(/([\p{P}])\*\*(?=[^\s\p{P}])/gu,(e,t)=>t===`*`?e:t+`**`),n=n.replace(/\x00P(\d+)\x00/g,(e,n)=>t[Number(n)]),n}var k=0;function ut(e){let t=new Map;return{text:e.replace(/^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n {0,3}\1[ \t]*$/gm,e=>{let n=`\x00FENCE-${k++}\x00`;return t.set(n,e),n}),fences:t}}function dt(e,t){for(let[n,r]of t)e=e.replace(n,()=>r);return e}function ft(e,t=!1){let n=[],r=``,i=0;for(;i<e.length;){let a=e.indexOf(`<svg`,i);if(a===-1){r+=e.slice(i);break}let o=e[a+4];if(o&&!/[\s\/>]/.test(o)){r+=e.slice(i,a+4),i=a+4;continue}r+=e.slice(i,a);let s=0,c=a,l=!1;for(;c<e.length;){let t=e.indexOf(`<svg`,c+1),o=e.indexOf(`</svg>`,c+(c===a?0:1));if(o===-1)break;if(t!==-1&&t<o){let n=e[t+4];n&&/[\s\/>]/.test(n)&&s++,c=t+4}else if(s===0){let t=o+6,s=e.slice(a,t),c=k++,u=`\n\n<div data-jaw-svg="${c}"></div>\n\n`;n.push({id:c,index:a,length:s.length,svg:s,kind:`complete`,placeholder:u}),r+=u,i=t,l=!0;break}else s--,c=o+6}if(!l){let o=k++;if(t){let t=e.slice(a),s=`\n\n<div data-jaw-svg="${o}" data-jaw-kind="partial"></div>\n\n`;n.push({id:o,index:a,length:t.length,svg:``,kind:`partial`,placeholder:s}),r+=s,i=e.length}else{let t=`\n\n<div data-jaw-svg="${o}" data-jaw-kind="error"></div>\n\n`,s=e.slice(a),c=s.search(/\n\s*\n/),l=c===-1?s.length:c;n.push({id:o,index:a,length:l,svg:``,kind:`error`,placeholder:t}),r+=t,i=a+l}}}return{text:r,blocks:n}}l.registerLanguage(`javascript`,s),l.registerLanguage(`js`,s),l.registerLanguage(`typescript`,o),l.registerLanguage(`ts`,o),l.registerLanguage(`python`,p),l.registerLanguage(`py`,p),l.registerLanguage(`bash`,e),l.registerLanguage(`shell`,m),l.registerLanguage(`sh`,m),l.registerLanguage(`json`,c),l.registerLanguage(`css`,n),l.registerLanguage(`xml`,r),l.registerLanguage(`html`,r),l.registerLanguage(`markdown`,d),l.registerLanguage(`md`,d),l.registerLanguage(`yaml`,h),l.registerLanguage(`yml`,h),l.registerLanguage(`sql`,t),l.registerLanguage(`rust`,u),l.registerLanguage(`rs`,u),l.registerLanguage(`go`,re),l.registerLanguage(`java`,ee),l.registerLanguage(`cpp`,g),l.registerLanguage(`c`,g),l.registerLanguage(`diff`,ne),l.registerLanguage(`plaintext`,f),l.registerLanguage(`text`,f);var A=null,j=Promise.resolve();function pt(){return document.documentElement.getAttribute(`data-theme`)===`light`?{primaryColor:`#e2e8f0`,primaryTextColor:`#1a202c`,primaryBorderColor:`#a0aec0`,lineColor:`#718096`,secondaryColor:`#ebf8ff`,tertiaryColor:`#f7fafc`,background:`transparent`,mainBkg:`#e2e8f0`,nodeBorder:`#a0aec0`,clusterBkg:`#f7fafc`,clusterBorder:`#cbd5e0`,titleColor:`#1a202c`,edgeLabelBackground:`#f7fafc`}:{primaryColor:`#2d3748`,primaryTextColor:`#e2e8f0`,primaryBorderColor:`#4a5568`,lineColor:`#718096`,secondaryColor:`#1a365d`,tertiaryColor:`#1a202c`,background:`transparent`,mainBkg:`#2d3748`,nodeBorder:`#4a5568`,clusterBkg:`#1a202c`,clusterBorder:`#2d3748`,titleColor:`#e2e8f0`,edgeLabelBackground:`#1a202c`}}async function M(){return A||(A=await v(()=>import(`./mermaid.core-CYqc8Qyq.js`),[]),A.default.setParseErrorHandler(()=>{})),A.default}function N(){A.default.initialize({startOnLoad:!1,theme:`base`,htmlLabels:!1,themeVariables:pt(),securityLevel:`strict`,suppressErrorRendering:!0})}function P(e){let t=_.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`script`,`iframe`,`object`,`embed`,`form`,`input`,`foreignObject`,`animate`,`set`,`animateTransform`,`animateMotion`],FORBID_ATTR:[`onerror`,`onclick`,`onload`,`onmouseover`,`onfocus`,`onblur`,`background`]}),n=document.createElement(`div`);n.innerHTML=t;for(let e of n.querySelectorAll(`style`)){let t=e.textContent||``;t=t.replace(/@import\b[^;]*;?/gi,`/* stripped */`),t=t.replace(/@font-face\s*\{[^}]*\}/gi,`/* stripped */`),t=t.replace(/url\s*\(\s*(?!['"]?#)[^)]*\)/gi,`none`),e.textContent=t}return n.innerHTML}function F(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function I(e){return _.sanitize(e,{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},FORBID_TAGS:[`script`,`style`,`iframe`,`object`,`embed`,`form`,`input`,`foreignObject`,`animate`,`set`,`animateTransform`,`animateMotion`],FORBID_ATTR:[`onerror`,`onclick`,`onload`,`onmouseover`,`onfocus`,`onblur`,`background`],ADD_TAGS:[`use`],ADD_ATTR:[`aria-hidden`,`xmlns`,`viewBox`,`role`,`aria-label`,`data-jaw-svg`,`data-jaw-kind`]})}var mt=`http://www.w3.org/2000/svg`,ht=new Set([`a`,`area`,`link`]);_.addHook(`afterSanitizeAttributes`,e=>{let t=e.tagName.toLowerCase();if(e.namespaceURI===mt||!ht.has(t)){let t=e.getAttribute(`href`)||``;t&&!t.startsWith(`#`)&&e.removeAttribute(`href`)}let n=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`xlink:href`)||``;if(n&&!n.startsWith(`#`)&&(e.removeAttributeNS(`http://www.w3.org/1999/xlink`,`href`),e.removeAttribute(`xlink:href`)),t===`image`||t===`feimage`){let t=e.getAttribute(`src`)||``;t&&!t.startsWith(`#`)&&e.removeAttribute(`src`)}let r=[`fill`,`stroke`,`filter`,`mask`,`clip-path`,`marker-start`,`marker-mid`,`marker-end`,`cursor`];if(e.hasAttribute(`style`)){let t=e.style?.cssText||``;if(/url\s*\(/i.test(t)){let n=t.replace(/url\s*\(\s*(?!['"]?#)[^)]*\)/gi,`none`);e.style.cssText=n}}for(let t of r)if(e.hasAttribute(t)){let n=e.getAttribute(t)||``;if(/url\s*\(/i.test(n)){let r=n.replace(/url\s*\(\s*(?!['"]?#)[^)]*\)/gi,`none`);e.setAttribute(t,r)}}});var gt=/["'](?:subtasks|employee_config|agent_phases|orchestration_plan)["']\s*:/;function L(e){let t=e.replace(/```json\n([\s\S]*?)\n```/g,(e,t)=>gt.test(t)?``:e);return t=t.replace(/\{[^{}]*"subtasks"\s*:\s*\[[\s\S]*?\]\s*\}/g,``).trim(),t}function _t(e){let t=[],n=[],r=e.replace(/```[\s\S]*?```/g,e=>(n.push(e),`\x00C${n.length-1}\x00`)).replace(/`[^`]+`/g,e=>(n.push(e),`\x00C${n.length-1}\x00`));return r=r.replace(/\$\$([\s\S]+?)\$\$/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!0}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\\\[([\s\S]+?)\\\]/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!0}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/(?<!\$)\$(?!\$)([^\n$]+?)\$(?!\$)/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!1}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\\\((.+?)\\\)/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!1}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\x00C(\d+)\x00/g,(e,t)=>n[Number(t)]),{text:r,blocks:t}}function vt(e,t,n=!1){return e.replace(/\x00MATH-(\d+)\x00/g,(e,r)=>{let i=t[Number(r)];if(!i)return`<code title="math placeholder error">[math error]</code>`;if(n)return i.displayMode?`<div class="math-placeholder">${F(i.tex)}</div>`:`<code class="math-placeholder">${F(i.tex)}</code>`;try{return te.renderToString(i.tex,{displayMode:i.displayMode,throwOnError:!1})}catch{return i.displayMode?`<pre><code>${F(i.tex)}</code></pre>`:`<code>${F(i.tex)}</code>`}})}var R=0;async function yt(){let e=document.querySelectorAll(`.mermaid-rendered`);if(!e.length)return;let t=await M();for(let n of e){let e=n.dataset.mermaidCode;if(!e)continue;let r=`mermaid-${++R}`;try{N();let{svg:i}=await t.render(r,e);n.innerHTML=P(i),B(n)}catch{}}}var z=null;function bt(){z||=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target;e.classList.contains(`mermaid-pending`)&&(z.unobserve(e),Ct(e))}},{rootMargin:`200px`})}function B(e){e.querySelector(`.mermaid-copy-btn`)?.remove(),e.querySelector(`.mermaid-save-btn`)?.remove();let t=document.createElement(`button`);t.className=`mermaid-save-btn`,t.type=`button`,t.ariaLabel=`Save as image`,t.title=`Save`,t.innerHTML=O.download,e.appendChild(t);let n=document.createElement(`button`);n.className=`mermaid-copy-btn`,n.type=`button`,n.ariaLabel=`Copy source`,n.title=`Copy`,n.innerHTML=O.copy,e.appendChild(n)}function xt(e,t,n){e.classList.remove(`mermaid-rendered`),e.innerHTML=`
|
|
1
|
+
import{A as e,C as t,D as n,E as r,F as i,I as a,M as o,N as s,O as c,P as l,S as u,T as d,_ as f,b as ee,j as p,k as m,u as te,v as ne,w as h,x as re,y as g}from"./vendor-render-D2YP6GiF.js";import{r as ie}from"./api-DygAf_G_.js";import{Q as _,Z as v}from"./vendor-mermaid-C2RBgdM6.js";import{A as ae,B as oe,C as se,D as ce,E as le,F as ue,G as de,H as fe,I as pe,J as me,K as he,L as ge,M as _e,N as ve,O as ye,P as be,R as xe,S as Se,T as Ce,U as we,V as Te,W as Ee,Y as De,_ as Oe,a as ke,b as Ae,c as je,d as Me,f as Ne,g as Pe,h as y,i as Fe,j as Ie,k as Le,l as Re,m as ze,n as Be,o as Ve,p as He,q as Ue,r as We,s as Ge,t as Ke,u as qe,v as Je,w as Ye,x as Xe,y as Ze,z as Qe}from"./vendor-icons-C6LXvgi0.js";var b=`ko`,x={},S={};async function $e(){let e=null;try{e=localStorage.getItem(`claw_locale`)}catch{}if(!e){let t=(navigator.language||`ko`).split(/[-_]/)[0].toLowerCase();e=[`en`,`ko`].includes(t)?t:`ko`}S=await C(`ko`),x=e===`ko`?S:await C(e),b=e,T()}async function C(e){try{let{api:t}=await v(async()=>{let{api:e}=await import(`./api-COrKYKcO.js`);return{api:e}},[]);return await t(`/api/i18n/${e}`)||{}}catch{return{}}}function w(e,t={}){let n=x[e]??S[e]??e;for(let[e,r]of Object.entries(t))n=n.replaceAll(`{${e}}`,String(r));return n}function T(){document.querySelectorAll(`[data-i18n]`).forEach(e=>{let t=e.getAttribute(`data-i18n`);t&&(e.textContent=w(t))}),document.querySelectorAll(`[data-i18n-placeholder]`).forEach(e=>{let t=e.getAttribute(`data-i18n-placeholder`);t&&(e.placeholder=w(t))}),document.querySelectorAll(`[data-i18n-title]`).forEach(e=>{let t=e.getAttribute(`data-i18n-title`);t&&(e.title=w(t))}),document.querySelectorAll(`[data-i18n-aria]`).forEach(e=>{let t=e.getAttribute(`data-i18n-aria`);t&&e.setAttribute(`aria-label`,w(t))})}async function et(e){if(e!==b){x=e===`ko`?S:await C(e),b=e;try{localStorage.setItem(`claw_locale`,e)}catch{}T();try{let{loadEmployees:e}=await v(async()=>{let{loadEmployees:e}=await import(`./employees-Bqy3DcSm.js`);return{loadEmployees:e}},[]);e()}catch{}try{let{loadSkills:e}=await v(async()=>{let{loadSkills:e}=await import(`./skills-DSnKA-Nc.js`);return{loadSkills:e}},[]);e()}catch{}try{let{loadCommands:e}=await v(async()=>{let{loadCommands:e}=await import(`./slash-commands-BS7C-3R0.js`);return{loadCommands:e}},[]);e()}catch{}try{let{loadSettings:e}=await v(async()=>{let{loadSettings:e}=await import(`./settings-DCPeIn7T.js`);return{loadSettings:e}},[]);e()}catch{}}}function tt(){return b}function nt(e,t={}){let n=new URL(e,location.origin);return n.searchParams.has(`locale`)||n.searchParams.set(`locale`,b),fetch(n.toString(),t)}var rt=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M2 12c0 0 2-4 6-4 1 0 2 .5 3 1l3-6c0 0 1 5 3 7 1.5 1.5 5 2 5 2s-1 4-5 4c-1 0-2-.3-3-.8L12 18c0 0-2-1-4-1-4 0-6-5-6-5z"/><circle cx="17" cy="11" r="0.5" fill="currentColor" stroke="none"/><path d="M7 12l1 2"/><path d="M9.5 12l1 2"/></svg>`,E=14,it=16;function D(e,t=it){return De(e,{size:t})}var O={check:D(Qe),error:D(ge),warning:D(Fe),skip:D(Ge),tool:D(We),thinking:D(Ae),search:D(qe),web:D(ae),exec:D(Ke),compacting:D(Oe),plan:D(Je),brain:D(de),heartPulse:D(ye),lock:D(Xe),lockOpen:D(Se),key:D(Ce),settings:D(je),file:D(ve),trash:D(ke),lightbulb:D(Ye),refresh:D(Ne),mic:D(Ze),clipboard:D(pe),robot:D(he),palette:D(Pe),link:D(se),salute:D(Le),shark:rt,user:D(xe),paperclip:D(y),save:D(Me),gamepad:D(Ie),house:D(le),radio:D(He),folder:D(_e),pencil:D(ze),chart:D(Ee),hourglass:D(ce),stop:D(Ve),close:D(Be,E),send:D(Re),copy:D(ue,E),download:D(be,E),checkSimple:D(we,E),chevronLeft:D(Te,E),chevronRight:D(oe,E),chevronDown:D(fe,E),arrowLeft:D(me,E),arrowRight:D(Ue,E)},at={"✅":`check`,"❌":`error`,"🔧":`tool`,"⏭":`skip`,"🧠":`brain`,"💓":`heartPulse`,"🔒":`lock`,"🔓":`lockOpen`,"🔑":`key`,"⚙":`settings`,"⚙️":`settings`,"📄":`file`,"🗑":`trash`,"🗑️":`trash`,"⚠":`warning`,"⚠️":`warning`,"💡":`lightbulb`,"🦈":`shark`,"👤":`user`,"💭":`thinking`,"🔍":`search`,"🌐":`web`,"⚡":`exec`,"🗜":`compacting`,"🗜️":`compacting`,"📝":`plan`,"📑":`clipboard`,"🤖":`robot`,"📋":`clipboard`,"🔄":`refresh`,"🎨":`palette`,"🎤":`mic`,"🔗":`link`,"🫡":`salute`,"📎":`paperclip`,"💾":`save`,"🎮":`gamepad`,"🏠":`house`,"📡":`radio`,"📂":`folder`,"✏️":`pencil`,"📊":`chart`,"🎙️":`mic`};function ot(e){let t=at[e];return t?O[t]:e}function st(e){return e===`✅`?`done`:e===`❌`?`error`:null}function ct(e=document.body){let t=e.querySelectorAll(`[data-icon]`);for(let e of t){let t=e.dataset.icon;t&&O[t]&&(e.innerHTML=O[t],e.classList.add(`icon-hydrated`))}}function lt(e){let t=[],n=e.replace(/```[\s\S]*?```/g,e=>(t.push(e),`\x00P${t.length-1}\x00`)).replace(/`[^`]+`/g,e=>(t.push(e),`\x00P${t.length-1}\x00`));return n=n.replace(/([\p{P}])\*\*(?=[^\s\p{P}])/gu,(e,t)=>t===`*`?e:t+`**`),n=n.replace(/\x00P(\d+)\x00/g,(e,n)=>t[Number(n)]),n}var k=0;function ut(e){let t=new Map;return{text:e.replace(/^ {0,3}(`{3,}|~{3,})[^\n]*\n[\s\S]*?\n {0,3}\1[ \t]*$/gm,e=>{let n=`\x00FENCE-${k++}\x00`;return t.set(n,e),n}),fences:t}}function dt(e,t){for(let[n,r]of t)e=e.replace(n,()=>r);return e}function ft(e,t=!1){let n=[],r=``,i=0;for(;i<e.length;){let a=e.indexOf(`<svg`,i);if(a===-1){r+=e.slice(i);break}let o=e[a+4];if(o&&!/[\s\/>]/.test(o)){r+=e.slice(i,a+4),i=a+4;continue}r+=e.slice(i,a);let s=0,c=a,l=!1;for(;c<e.length;){let t=e.indexOf(`<svg`,c+1),o=e.indexOf(`</svg>`,c+(c===a?0:1));if(o===-1)break;if(t!==-1&&t<o){let n=e[t+4];n&&/[\s\/>]/.test(n)&&s++,c=t+4}else if(s===0){let t=o+6,s=e.slice(a,t),c=k++,u=`\n\n<div data-jaw-svg="${c}"></div>\n\n`;n.push({id:c,index:a,length:s.length,svg:s,kind:`complete`,placeholder:u}),r+=u,i=t,l=!0;break}else s--,c=o+6}if(!l){let o=k++;if(t){let t=e.slice(a),s=`\n\n<div data-jaw-svg="${o}" data-jaw-kind="partial"></div>\n\n`;n.push({id:o,index:a,length:t.length,svg:``,kind:`partial`,placeholder:s}),r+=s,i=e.length}else{let t=`\n\n<div data-jaw-svg="${o}" data-jaw-kind="error"></div>\n\n`,s=e.slice(a),c=s.search(/\n\s*\n/),l=c===-1?s.length:c;n.push({id:o,index:a,length:l,svg:``,kind:`error`,placeholder:t}),r+=t,i=a+l}}}return{text:r,blocks:n}}l.registerLanguage(`javascript`,s),l.registerLanguage(`js`,s),l.registerLanguage(`typescript`,o),l.registerLanguage(`ts`,o),l.registerLanguage(`python`,p),l.registerLanguage(`py`,p),l.registerLanguage(`bash`,e),l.registerLanguage(`shell`,m),l.registerLanguage(`sh`,m),l.registerLanguage(`json`,c),l.registerLanguage(`css`,n),l.registerLanguage(`xml`,r),l.registerLanguage(`html`,r),l.registerLanguage(`markdown`,d),l.registerLanguage(`md`,d),l.registerLanguage(`yaml`,h),l.registerLanguage(`yml`,h),l.registerLanguage(`sql`,t),l.registerLanguage(`rust`,u),l.registerLanguage(`rs`,u),l.registerLanguage(`go`,re),l.registerLanguage(`java`,ee),l.registerLanguage(`cpp`,g),l.registerLanguage(`c`,g),l.registerLanguage(`diff`,ne),l.registerLanguage(`plaintext`,f),l.registerLanguage(`text`,f);var A=null,j=Promise.resolve();function pt(){return document.documentElement.getAttribute(`data-theme`)===`light`?{primaryColor:`#e2e8f0`,primaryTextColor:`#1a202c`,primaryBorderColor:`#a0aec0`,lineColor:`#718096`,secondaryColor:`#ebf8ff`,tertiaryColor:`#f7fafc`,background:`transparent`,mainBkg:`#e2e8f0`,nodeBorder:`#a0aec0`,clusterBkg:`#f7fafc`,clusterBorder:`#cbd5e0`,titleColor:`#1a202c`,edgeLabelBackground:`#f7fafc`}:{primaryColor:`#2d3748`,primaryTextColor:`#e2e8f0`,primaryBorderColor:`#4a5568`,lineColor:`#718096`,secondaryColor:`#1a365d`,tertiaryColor:`#1a202c`,background:`transparent`,mainBkg:`#2d3748`,nodeBorder:`#4a5568`,clusterBkg:`#1a202c`,clusterBorder:`#2d3748`,titleColor:`#e2e8f0`,edgeLabelBackground:`#1a202c`}}async function M(){return A||(A=await v(()=>import(`./mermaid.core-CYqc8Qyq.js`),[]),A.default.setParseErrorHandler(()=>{})),A.default}function N(){A.default.initialize({startOnLoad:!1,theme:`base`,htmlLabels:!1,themeVariables:pt(),securityLevel:`strict`,suppressErrorRendering:!0})}function P(e){let t=_.sanitize(e,{USE_PROFILES:{svg:!0,svgFilters:!0},FORBID_TAGS:[`script`,`iframe`,`object`,`embed`,`form`,`input`,`foreignObject`,`animate`,`set`,`animateTransform`,`animateMotion`],FORBID_ATTR:[`onerror`,`onclick`,`onload`,`onmouseover`,`onfocus`,`onblur`,`background`]}),n=document.createElement(`div`);n.innerHTML=t;for(let e of n.querySelectorAll(`style`)){let t=e.textContent||``;t=t.replace(/@import\b[^;]*;?/gi,`/* stripped */`),t=t.replace(/@font-face\s*\{[^}]*\}/gi,`/* stripped */`),t=t.replace(/url\s*\(\s*(?!['"]?#)[^)]*\)/gi,`none`),e.textContent=t}return n.innerHTML}function F(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function I(e){return _.sanitize(e,{USE_PROFILES:{html:!0,svg:!0,svgFilters:!0},FORBID_TAGS:[`script`,`style`,`iframe`,`object`,`embed`,`form`,`input`,`foreignObject`,`animate`,`set`,`animateTransform`,`animateMotion`],FORBID_ATTR:[`onerror`,`onclick`,`onload`,`onmouseover`,`onfocus`,`onblur`,`background`],ADD_TAGS:[`use`],ADD_ATTR:[`aria-hidden`,`xmlns`,`viewBox`,`role`,`aria-label`,`data-jaw-svg`,`data-jaw-kind`]})}var mt=`http://www.w3.org/2000/svg`,ht=new Set([`a`,`area`,`link`]);_.addHook(`afterSanitizeAttributes`,e=>{let t=e.tagName.toLowerCase();if(e.namespaceURI===mt||!ht.has(t)){let t=e.getAttribute(`href`)||``;t&&!t.startsWith(`#`)&&e.removeAttribute(`href`)}let n=e.getAttributeNS(`http://www.w3.org/1999/xlink`,`href`)||e.getAttribute(`xlink:href`)||``;if(n&&!n.startsWith(`#`)&&(e.removeAttributeNS(`http://www.w3.org/1999/xlink`,`href`),e.removeAttribute(`xlink:href`)),t===`image`||t===`feimage`){let t=e.getAttribute(`src`)||``;t&&!t.startsWith(`#`)&&e.removeAttribute(`src`)}let r=[`fill`,`stroke`,`filter`,`mask`,`clip-path`,`marker-start`,`marker-mid`,`marker-end`,`cursor`];if(e.hasAttribute(`style`)){let t=e.style?.cssText||``;if(/url\s*\(/i.test(t)){let n=t.replace(/url\s*\(\s*(?!['"]?#)[^)]*\)/gi,`none`);e.style.cssText=n}}for(let t of r)if(e.hasAttribute(t)){let n=e.getAttribute(t)||``;if(/url\s*\(/i.test(n)){let r=n.replace(/url\s*\(\s*(?!['"]?#)[^)]*\)/gi,`none`);e.setAttribute(t,r)}}});var gt=/["'](?:subtasks|employee_config|agent_phases|orchestration_plan)["']\s*:/;function L(e){let t=e.replace(/```json\n([\s\S]*?)\n```/g,(e,t)=>gt.test(t)?``:e);return t=t.replace(/\{[^{}]*"subtasks"\s*:\s*\[[\s\S]*?\]\s*\}/g,``).trim(),t}function _t(e){let t=[],n=[],r=e.replace(/```[\s\S]*?```/g,e=>(n.push(e),`\x00C${n.length-1}\x00`)).replace(/`[^`]+`/g,e=>(n.push(e),`\x00C${n.length-1}\x00`));return r=r.replace(/\$\$([\s\S]+?)\$\$/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!0}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\\\[([\s\S]+?)\\\]/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!0}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/(?<!\$)\$(?!\$)([^\n$]+?)\$(?!\$)/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!1}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\\\((.+?)\\\)/g,(e,n)=>(t.push({tex:n.trim(),displayMode:!1}),`\x00MATH-${t.length-1}\x00`)),r=r.replace(/\x00C(\d+)\x00/g,(e,t)=>n[Number(t)]),{text:r,blocks:t}}function vt(e,t,n=!1){return e.replace(/\x00MATH-(\d+)\x00/g,(e,r)=>{let i=t[Number(r)];if(!i)return`<code title="math placeholder error">[math error]</code>`;if(n)return i.displayMode?`<div class="math-placeholder">${F(i.tex)}</div>`:`<code class="math-placeholder">${F(i.tex)}</code>`;try{return te.renderToString(i.tex,{displayMode:i.displayMode,throwOnError:!1})}catch{return i.displayMode?`<pre><code>${F(i.tex)}</code></pre>`:`<code>${F(i.tex)}</code>`}})}var R=0;async function yt(){let e=document.querySelectorAll(`.mermaid-rendered`);if(!e.length)return;let t=await M();for(let n of e){let e=n.dataset.mermaidCode;if(!e)continue;let r=`mermaid-${++R}`;try{N();let{svg:i}=await t.render(r,e);n.innerHTML=P(i),B(n)}catch{}}}var z=null;function bt(){z||=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target;e.classList.contains(`mermaid-pending`)&&(z.unobserve(e),Ct(e))}},{rootMargin:`200px`})}function B(e){e.querySelector(`.mermaid-copy-btn`)?.remove(),e.querySelector(`.mermaid-save-btn`)?.remove();let t=document.createElement(`button`);t.className=`mermaid-save-btn`,t.type=`button`,t.ariaLabel=`Save as image`,t.title=`Save`,t.innerHTML=O.download,e.appendChild(t);let n=document.createElement(`button`);n.className=`mermaid-copy-btn`,n.type=`button`,n.ariaLabel=`Copy source`,n.title=`Copy`,n.innerHTML=O.copy,e.appendChild(n)}function xt(e,t,n){e.classList.remove(`mermaid-rendered`),e.innerHTML=`
|
|
2
2
|
<div class="mermaid-error">
|
|
3
3
|
<div class="mermaid-error-title">${O.warning} ${F(w(`mermaid.renderFail`)||`Mermaid render failed`)}</div>
|
|
4
4
|
<div class="mermaid-error-msg">${F(n.slice(0,200))}</div>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./state-O6NVkWcL.js";import{n as t,r as n,t as r}from"./api-DygAf_G_.js";import{h as i,n as a,s as o}from"./render-
|
|
1
|
+
import{t as e}from"./state-O6NVkWcL.js";import{n as t,r as n,t as r}from"./api-DygAf_G_.js";import{h as i,n as a,s as o}from"./render-BGh36e9F.js";import{n as s,r as c}from"./locale-CxI5nTcf.js";import{a as l,i as u,r as d,t as f}from"./constants-DwGsi0Gn.js";function p(e){let t=document.getElementById(`sttEngine`),r=document.getElementById(`sttGeminiKey`),i=document.getElementById(`sttGeminiModel`),a=document.getElementById(`sttGeminiModelCustom`),o=document.getElementById(`sttWhisperModel`),s=document.getElementById(`sttOpenaiBaseUrl`),c=document.getElementById(`sttOpenaiKey`),l=document.getElementById(`sttOpenaiModel`),u=document.getElementById(`sttVertexJson`);if(t&&(t.value=e.engine||`auto`),r&&(r.placeholder=e.geminiKeySet?`✓ 입력됨 ····${e.geminiKeyLast4||``}`:`AIza...`),i){let t=e.geminiModel||`gemini-2.5-flash-lite`;Array.from(i.options).some(e=>e.value===t)?i.value=t:(i.value=`__custom__`,a&&(a.value=t,a.style.display=``))}o&&(o.value=e.whisperModel||`mlx-community/whisper-large-v3-turbo`),s&&(s.value=e.openaiBaseUrl||``),c&&(c.placeholder=e.openaiKeySet?`✓ 입력됨 ····${e.openaiKeyLast4||``}`:`sk-...`),l&&(l.value=e.openaiModel||``),u&&(u.value=e.vertexConfig||``);function d(){let e=t?.value||`auto`,n=e===`auto`||e===`gemini`,r=e===`openai`,i=e===`vertex`,a=e===`auto`||e===`whisper`;document.querySelectorAll(`.stt-gemini`).forEach(e=>e.style.display=n?``:`none`),document.querySelectorAll(`.stt-openai`).forEach(e=>e.style.display=r?``:`none`),document.querySelectorAll(`.stt-vertex`).forEach(e=>e.style.display=i?``:`none`),document.querySelectorAll(`.stt-whisper`).forEach(e=>e.style.display=a?``:`none`)}d();async function f(){let e={stt:{engine:t?.value||`auto`,geminiModel:(i?.value===`__custom__`?a?.value:i?.value)||`gemini-2.5-flash-lite`,whisperModel:o?.value||``,openaiBaseUrl:s?.value||``,openaiModel:l?.value||``,vertexConfig:u?.value||``}};r?.value&&(e.stt.geminiApiKey=r.value),c?.value&&(e.stt.openaiApiKey=c.value),console.log(`[stt] saving:`,{engine:e.stt.engine,hasGeminiKey:!!e.stt.geminiApiKey,hasOpenaiKey:!!e.stt.openaiApiKey});try{if(await n(`/api/settings`,`PUT`,e),r?.value){let e=r.value.slice(-4);r.value=``,r.placeholder=`✓ 입력됨 ····${e}`}if(c?.value){let e=c.value.slice(-4);c.value=``,c.placeholder=`✓ 입력됨 ····${e}`}}catch(e){console.error(`[stt] save failed:`,e)}}t?.addEventListener(`change`,()=>{d(),f()}),i?.addEventListener(`change`,()=>{a&&(a.style.display=i.value===`__custom__`?``:`none`),i.value!==`__custom__`&&f()}),a?.addEventListener(`blur`,f),r?.addEventListener(`blur`,()=>{r.value&&f()}),c?.addEventListener(`blur`,()=>{c.value&&f()}),s?.addEventListener(`blur`,f),l?.addEventListener(`blur`,f),o?.addEventListener(`blur`,f),u?.addEventListener(`blur`,f)}async function ee(){let e=document.getElementById(`tgToken`)?.value.trim()||``,t=document.getElementById(`tgChatIds`)?.value.trim()||``;await n(`/api/settings`,`PUT`,{telegram:{token:e,allowedChatIds:t?t.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)):[]}})}async function te(e){document.getElementById(`tgOn`)?.classList.toggle(`active`,e),document.getElementById(`tgOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{telegram:{enabled:e}})}async function m(e){document.getElementById(`tgForwardOn`)?.classList.toggle(`active`,e),document.getElementById(`tgForwardOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{telegram:{forwardAll:e}})}async function h(e){document.getElementById(`tgMentionOn`)?.classList.toggle(`active`,e),document.getElementById(`tgMentionOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{telegram:{mentionOnly:e}})}function g(e){if(!e.telegram)return;let t=e.telegram;document.getElementById(`tgOn`)?.classList.toggle(`active`,!!t.enabled),document.getElementById(`tgOff`)?.classList.toggle(`active`,!t.enabled);let n=document.getElementById(`tgToken`);t.token&&n&&(n.value=t.token);let r=document.getElementById(`tgChatIds`);t.allowedChatIds?.length&&r&&(r.value=t.allowedChatIds.join(`, `));let i=t.forwardAll!==!1;document.getElementById(`tgForwardOn`)?.classList.toggle(`active`,i),document.getElementById(`tgForwardOff`)?.classList.toggle(`active`,!i);let a=t.mentionOnly!==!1;document.getElementById(`tgMentionOn`)?.classList.toggle(`active`,a),document.getElementById(`tgMentionOff`)?.classList.toggle(`active`,!a)}async function _(){let e=document.getElementById(`dcToken`)?.value.trim()||``,t=document.getElementById(`dcGuildId`)?.value.trim()||``,r=document.getElementById(`dcChannelIds`)?.value.trim()||``;await n(`/api/settings`,`PUT`,{discord:{token:e,guildId:t,channelIds:r?r.split(`,`).map(e=>e.trim()).filter(Boolean):[]}})}async function v(e){document.getElementById(`dcOn`)?.classList.toggle(`active`,e),document.getElementById(`dcOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{enabled:e}})}async function y(e){document.getElementById(`dcForwardOn`)?.classList.toggle(`active`,e),document.getElementById(`dcForwardOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{forwardAll:e}})}async function b(e){document.getElementById(`dcAllowBotsOn`)?.classList.toggle(`active`,e),document.getElementById(`dcAllowBotsOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{allowBots:e}})}async function ne(e){document.getElementById(`dcMentionOn`)?.classList.toggle(`active`,e),document.getElementById(`dcMentionOff`)?.classList.toggle(`active`,!e),await n(`/api/settings`,`PUT`,{discord:{mentionOnly:e}})}function re(e){if(!e.discord)return;let t=e.discord;document.getElementById(`dcOn`)?.classList.toggle(`active`,!!t.enabled),document.getElementById(`dcOff`)?.classList.toggle(`active`,!t.enabled);let n=document.getElementById(`dcToken`);t.token&&n&&(n.value=t.token);let r=document.getElementById(`dcGuildId`);t.guildId&&r&&(r.value=t.guildId);let i=document.getElementById(`dcChannelIds`);t.channelIds?.length&&i&&(i.value=t.channelIds.join(`, `));let a=t.forwardAll!==!1;document.getElementById(`dcForwardOn`)?.classList.toggle(`active`,a),document.getElementById(`dcForwardOff`)?.classList.toggle(`active`,!a);let o=!!t.allowBots;document.getElementById(`dcAllowBotsOn`)?.classList.toggle(`active`,o),document.getElementById(`dcAllowBotsOff`)?.classList.toggle(`active`,!o);let s=!!t.mentionOnly;document.getElementById(`dcMentionOn`)?.classList.toggle(`active`,s),document.getElementById(`dcMentionOff`)?.classList.toggle(`active`,!s)}async function ie(e){document.getElementById(`chTelegram`)?.classList.toggle(`active`,e===`telegram`),document.getElementById(`chDiscord`)?.classList.toggle(`active`,e===`discord`),document.getElementById(`channelTelegramSettings`)?.style.setProperty(`display`,e===`telegram`?``:`none`),document.getElementById(`channelDiscordSettings`)?.style.setProperty(`display`,e===`discord`?``:`none`),await n(`/api/settings`,`PUT`,{channel:e})}function ae(e){let t=e.channel||`telegram`;document.getElementById(`chTelegram`)?.classList.toggle(`active`,t===`telegram`),document.getElementById(`chDiscord`)?.classList.toggle(`active`,t===`discord`),document.getElementById(`channelTelegramSettings`)?.style.setProperty(`display`,t===`telegram`?``:`none`),document.getElementById(`channelDiscordSettings`)?.style.setProperty(`display`,t===`discord`?``:`none`)}function x(e){let t=document.getElementById(`fallbackOrderList`);if(!t)return;let n=Object.keys(e.perCli||{}),r=e.fallbackOrder||[],o=Math.min(n.length-1,3),s=``;for(let e=0;e<o;e++){let t=r[e]||``,o=n.map(e=>`<option value="${a(e)}" ${e===t?`selected`:``}>${a(e)}</option>`).join(``);s+=`
|
|
2
2
|
<div class="settings-row sub-row">
|
|
3
3
|
<label style="min-width:60px">Fallback ${e+1}</label>
|
|
4
4
|
<select id="fallback${e}"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as e,m as t,v as n}from"./settings-BBR8HhIR.js";export{t as loadSettings,n as savePerCli,e as updateSettings};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./state-O6NVkWcL.js";import{r as t}from"./api-DygAf_G_.js";import{c as n,d as r,h as i,n as a,s as o}from"./render-
|
|
1
|
+
import{t as e}from"./state-O6NVkWcL.js";import{r as t}from"./api-DygAf_G_.js";import{c as n,d as r,h as i,n as a,s as o}from"./render-BGh36e9F.js";var s=[`productivity`,`communication`,`devtools`,`ai-media`,`utility`,`smarthome`,`automation`];async function c(){try{e.allSkills=await(await r(`/api/skills`)).json(),l()}catch{let e=document.getElementById(`skillsList`);e&&(e.innerHTML=`<div style="color:var(--text-dim);font-size:11px">${i(`skill.loadFail`)}</div>`)}}function l(){let t=document.getElementById(`skillsList`),r=document.getElementById(`skillsCount`);if(!t||!r)return;let c=e.allSkills,l=c;e.currentSkillFilter===`installed`?l=c.filter(e=>e.enabled):e.currentSkillFilter===`other`?l=c.filter(e=>!s.includes(e.category||``)):e.currentSkillFilter!==`all`&&(l=c.filter(t=>t.category===e.currentSkillFilter));let u=c.filter(e=>e.enabled).length;r.textContent=i(`skill.count`,{active:u,total:c.length}),t.innerHTML=l.map(e=>{let t=[];return e.requires?.env&&t.push(`${o.key} `+e.requires.env.map(e=>a(e)).join(`, `)),e.requires?.bins&&t.push(`${o.settings} `+e.requires.bins.map(e=>a(e)).join(`, `)),e.install&&t.push(a(e.install)),`
|
|
2
2
|
<div class="skill-card ${e.enabled?`enabled`:``}">
|
|
3
3
|
<div class="skill-card-header">
|
|
4
4
|
<span class="skill-emoji">${e.emoji?n(e.emoji):o.tool}</span>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./skills-BcpP9t6k.js";export{e as loadSkills};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./slash-commands-Utf2zCbI.js";export{e as loadCommands};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./api-DygAf_G_.js";import{h as t,n}from"./render-
|
|
1
|
+
import{t as e}from"./api-DygAf_G_.js";import{h as t,n}from"./render-BGh36e9F.js";import{t as r}from"./locale-CxI5nTcf.js";var i=[],a=[],o=-1,s=!1,c=null;function l(e){let t=String(e||``).slice(1).trim().split(/\s+/)[0]||``;return t.includes(`/`)||t.includes(`\\`)}var u=()=>document.getElementById(`cmdDropdown`),d=()=>document.getElementById(`chatInput`);function f(e){let t=String(e||``).toLowerCase();return i.filter(e=>`/${e.name}`.startsWith(t))}function p(){let e=u(),t=d();!e||!t||(c&&=(clearTimeout(c),null),e.style.display=`block`,requestAnimationFrame(()=>e.classList.add(`visible`)),s=!0,t.setAttribute(`aria-expanded`,`true`))}function m(){let e=u(),r=d();if(!e||!r)return;if(!a.length){if(!r.value.startsWith(`/`)||l(r.value)){_();return}e.innerHTML=`
|
|
2
2
|
<div class="cmd-item cmd-empty" role="option" aria-disabled="true">
|
|
3
3
|
${t(`cmd.noMatch`)}
|
|
4
4
|
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,d as t,i as n,m as r}from"./ui-th_57WwF.js";export{n as cleanupToolActivity,e as loadMessages,t as setStatus,r as updateQueueBadge};
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-Bjnw0wQ6.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./state-O6NVkWcL.js";import{i as t,t as n}from"./api-DygAf_G_.js";import{Z as r}from"./vendor-mermaid-C2RBgdM6.js";import{c as i,h as a,i as o,l as s,n as c,o as l,r as u,s as d}from"./render-BGh36e9F.js";import{a as f,i as p,r as m,t as ee}from"./idb-cache-DbK81tgv.js";function h(){let e=globalThis.crypto;if(typeof e?.randomUUID==`function`)return e.randomUUID();if(typeof e?.getRandomValues!=`function`)return`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)});let t=new Uint8Array(16);e.getRandomValues(t),t[6]=t[6]&15|64,t[8]=t[8]&63|128;let n=Array.from(t,e=>e.toString(16).padStart(2,`0`)).join(``);return`${n.slice(0,8)}-${n.slice(8,12)}-${n.slice(12,16)}-${n.slice(16,20)}-${n.slice(20)}`}var te=`agentName`,g=`CLI-JAW`,_=g;function ne(){return _}function re(e){_=(e||``).trim()||g,localStorage.setItem(te,_);let t=document.getElementById(`appNameInput`);t&&(t.value=_)}function ie(){_=localStorage.getItem(te)||g;let e=document.getElementById(`appNameInput`);e&&(e.value=_),document.getElementById(`appNameSave`)?.addEventListener(`click`,()=>{let e=document.getElementById(`appNameInput`);e&&re(e.value)}),document.getElementById(`appNameInput`)?.addEventListener(`keydown`,e=>{let t=e;t.key===`Enter`&&(t.preventDefault(),re(t.target.value),t.target.blur())})}var ae=`agentAvatar`,oe=`userAvatar`,se=d.shark,ce=d.user,le={agent:{emoji:se,imageUrl:``,updatedAt:null},user:{emoji:ce,imageUrl:``,updatedAt:null}},v=!1;function y(e){return le[e]}function ue(e){return e===`agent`?`agentAvatarPreview`:`userAvatarPreview`}function de(e){return e===`agent`?`.agent-icon`:`.user-icon`}function b(e){let t=document.getElementById(ue(e));if(t){t.innerHTML=x(e);let n=y(e).imageUrl?`image`:`emoji`;t.setAttribute(`data-avatar-kind`,n)}}function x(e){let t=y(e);return t.imageUrl?`<img class="avatar-image" src="${c(t.imageUrl)}" alt="" loading="lazy" decoding="async">`:t.emoji}function S(e){let t=x(e),n=y(e).imageUrl?`image`:`emoji`;document.querySelectorAll(de(e)).forEach(e=>{e.innerHTML=t,e.setAttribute(`data-avatar-kind`,n)})}function C(e,t){t?.kind===`image`&&t.imageUrl?(y(e).imageUrl=t.imageUrl,y(e).updatedAt=t.updatedAt??Date.now()):(y(e).imageUrl=``,y(e).updatedAt=t?.updatedAt??null),b(e),S(e)}async function fe(){let e=await n(`/api/avatar`);e&&(C(`agent`,e.agent),C(`user`,e.user))}async function pe(e,n){let r=await t(),i=new Headers(n.headers||{});return r&&i.set(`Authorization`,`Bearer ${r}`),fetch(e,{...n,headers:i})}async function me(e,t){let n=await pe(`/api/avatar/${e}/upload`,{method:`POST`,headers:{"X-Filename":encodeURIComponent(t.name)},body:t}),r=await n.json().catch(()=>null);if(!n.ok)throw Error(r?.error||`avatar upload failed (${n.status})`);C(e,r?.data||r)}async function he(e){let t=await pe(`/api/avatar/${e}/image`,{method:`DELETE`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n?.error||`avatar reset failed (${t.status})`);C(e,n?.data||n)}function ge(e){let t=e===`agent`?`agentAvatarUploadBtn`:`userAvatarUploadBtn`,n=e===`agent`?`agentAvatarResetBtn`:`userAvatarResetBtn`,r=e===`agent`?`agentAvatarFile`:`userAvatarFile`;document.getElementById(t)?.addEventListener(`click`,()=>{document.getElementById(r)?.click()}),document.getElementById(n)?.addEventListener(`click`,async()=>{try{await he(e)}catch(e){console.warn(`[avatar:reset]`,e.message)}}),document.getElementById(r)?.addEventListener(`change`,async t=>{let n=t.target,r=n.files?.[0];if(r)try{await me(e,r)}catch(e){console.warn(`[avatar:upload]`,e.message)}finally{n.value=``}})}function _e(){return x(`agent`)}function ve(){return x(`user`)}async function ye(){y(`agent`).emoji=localStorage.getItem(ae)||se,y(`user`).emoji=localStorage.getItem(oe)||ce,b(`agent`),b(`user`),v||(v=!0,ge(`agent`),ge(`user`)),await fe(),S(`agent`),S(`user`)}var be=5,xe=80,Se=class{items=[];container;spacerTop;spacerBottom;viewport;_active=!1;rafId=null;suppressScroll=!1;_remeasuring=!1;firstVisible=-1;lastVisible=-1;prefixHeights=[0];prefixDirtyFrom=0;itemSpacing=0;containerPadTop=0;containerPadBottom=0;onLazyRender=null;onPostRender=null;constructor(e){this.container=document.getElementById(e),this.spacerTop=document.createElement(`div`),this.spacerTop.className=`vs-spacer-top`,this.spacerBottom=document.createElement(`div`),this.spacerBottom.className=`vs-spacer-bottom`,this.viewport=document.createElement(`div`),this.viewport.className=`vs-viewport`}get active(){return this._active}get count(){return this.items.length}markPrefixDirty(e){this.prefixDirtyFrom=Math.min(this.prefixDirtyFrom,Math.max(0,e))}rebuildPrefixHeights(){let e=this.items.length;this.prefixHeights.length!==e+1&&(this.prefixHeights=Array(e+1).fill(0),this.prefixDirtyFrom=0);for(let t=this.prefixDirtyFrom;t<e;t++)this.prefixHeights[t+1]=this.prefixHeights[t]+this.items[t].height;this.prefixDirtyFrom=e}offsetForIndex(e){return this.rebuildPrefixHeights(),this.prefixHeights[Math.max(0,Math.min(e,this.items.length))]}effectiveOffset(e){return this.offsetForIndex(e)+e*this.itemSpacing}totalEffectiveHeight(){let e=this.items.length;return e===0?0:this.effectiveOffset(e)}bottomSpacerHeight(e){return Math.max(0,this.totalEffectiveHeight()-this.effectiveOffset(e+1))}indexForOffset(e){this.rebuildPrefixHeights();let t=this.items.length;if(t===0)return 0;let n=0,r=t-1;for(;n<r;){let t=n+r+1>>1;this.prefixHeights[t]+t*this.itemSpacing<=e?n=t:r=t-1}return n}refreshLayoutMetrics(){let e=getComputedStyle(this.container);this.containerPadTop=parseFloat(e.paddingTop)||0,this.containerPadBottom=parseFloat(e.paddingBottom)||0;let t=Array.from(this.viewport.querySelectorAll(`.msg`))[0]??null;if(t){let e=parseFloat(getComputedStyle(t).marginBottom)||0;e>0&&(this.itemSpacing=e);return}if(this._active&&this.viewport.isConnected){let e=document.createElement(`div`);e.className=`msg`,e.style.position=`absolute`,e.style.visibility=`hidden`,e.style.pointerEvents=`none`,e.textContent=` `,this.viewport.appendChild(e);let t=parseFloat(getComputedStyle(e).marginBottom)||0;e.remove(),t>0&&(this.itemSpacing=t)}}flushToDOM(){this._active&&(this.container.classList.remove(`vs-active`),this.container.removeEventListener(`scroll`,this.scrollHandler),this.rafId&&=(cancelAnimationFrame(this.rafId),null),this.container.innerHTML=this.items.map(e=>e.html).join(``),this._active=!1,this.firstVisible=-1,this.lastVisible=-1,this.items=[],this.prefixHeights=[0],this.prefixDirtyFrom=0,this.itemSpacing=0)}setItems(e,t){this.items=e,this.prefixHeights=Array(e.length+1).fill(0),this.prefixDirtyFrom=0,t?.autoActivate!==!1&&!this._active&&this.items.length>=80&&this.activate(t?.toBottom??!0)}seedMeasuredHeights(e,t){for(let n=0;n<t.length;n++){let r=e+n,i=this.items[r];if(!i)continue;let a=i.height,o=t[n];a!==o&&(i.height=o,this.markPrefixDirty(r))}}activateIfNeeded(e=!1){!this._active&&this.items.length>=80&&this.activate(e)}addItem(e,t){let n={id:e,html:t,height:xe};this.items.push(n),this.markPrefixDirty(this.items.length-1),!this._active&&this.items.length>=80&&this.activate(!0),this._active&&this.scheduleRender()}appendLiveItem(e){if(!this._active)return;let t=e.outerHTML,n={id:h(),html:t,height:xe};this.items.push(n),this.markPrefixDirty(this.items.length-1),this.scheduleRender()}updateItemHtml(e,t){this.items[e]&&(this.items[e].html=t)}scrollHandler=()=>{this.suppressScroll||this.scheduleRender()};activate(e=!1){if(this._active=!0,this.container.querySelectorAll(`.msg`).forEach((e,t)=>{this.items[t]&&(this.items[t].height=e.getBoundingClientRect().height)}),this.prefixHeights=Array(this.items.length+1).fill(0),this.prefixDirtyFrom=0,this.container.classList.add(`vs-active`),this.container.replaceChildren(this.spacerTop,this.viewport,this.spacerBottom),this.container.addEventListener(`scroll`,this.scrollHandler,{passive:!0}),this.refreshLayoutMetrics(),e){let e=this.totalEffectiveHeight();this.spacerTop.style.height=`${e}px`,this.spacerBottom.style.height=`0px`,this.container.scrollTop=this.container.scrollHeight,this.firstVisible=-1,this.lastVisible=-1}this.render()}scheduleRender(){this.rafId||=requestAnimationFrame(()=>{this.rafId=null,this.render()})}render(){this.refreshLayoutMetrics();let e=this.container.scrollTop,t=this.container.clientHeight,n=Math.max(0,e-this.containerPadTop),r=Math.max(0,t-this.containerPadTop-this.containerPadBottom),i=this.indexForOffset(n),a=Math.max(0,i-be),o=i;for(let e=i;e<this.items.length&&(o=e,!(this.effectiveOffset(e+1)>n+r));e++);let s=Math.min(this.items.length-1,o+be);if(a===this.firstVisible&&s===this.lastVisible){let e=this.effectiveOffset(a),t=this.bottomSpacerHeight(s);this.spacerTop.style.height=`${e}px`,this.spacerBottom.style.height=`${t}px`;return}this.firstVisible=a,this.lastVisible=s;let c=this.captureScrollAnchor(),l=new Map;for(let e of Array.from(this.viewport.children)){let t=Number(e.dataset.vsIdx);isNaN(t)||l.set(t,e)}for(let[e,t]of l)(e<a||e>s)&&(t.remove(),l.delete(e));let u=[];for(let e=a;e<=s;e++){let t=l.get(e);if(t)u.push(t);else{let t=this.items[e],n=document.createElement(`div`);n.innerHTML=t.html;let r=n.firstElementChild;r&&(r.dataset.vsIdx=String(e),u.push(r))}}let d=this.viewport.firstChild;for(let e of u)e===d?d=d.nextSibling:this.viewport.insertBefore(e,d);this.refreshLayoutMetrics();let f=this.effectiveOffset(a),p=this.bottomSpacerHeight(s);if(this.spacerTop.style.height=`${f}px`,this.spacerBottom.style.height=`${p}px`,this.onLazyRender){let e=this.viewport.querySelectorAll(`.lazy-pending`);e.length>0&&this.onLazyRender(Array.from(e))}this.onPostRender&&this.onPostRender(this.viewport),this.remeasureVisible(c)}captureScrollAnchor(){let e=this.container.getBoundingClientRect(),t=e.top+this.containerPadTop,n=Array.from(this.viewport.querySelectorAll(`[data-vs-idx]`)),r=n.find(e=>e.getBoundingClientRect().bottom>t)??n[0]??null;if(!r)return null;let i=Number(r.dataset.vsIdx);return Number.isFinite(i)?{index:i,top:r.getBoundingClientRect().top-e.top}:null}applyCurrentSpacers(){if(this.firstVisible<0||this.lastVisible<0||this.items.length===0){this.spacerTop.style.height=`0px`,this.spacerBottom.style.height=`0px`;return}let e=this.effectiveOffset(this.firstVisible),t=this.bottomSpacerHeight(this.lastVisible);this.spacerTop.style.height=`${e}px`,this.spacerBottom.style.height=`${t}px`}restoreScrollAnchor(e){if(!e)return;let t=this.container.getBoundingClientRect(),n=this.viewport.querySelector(`[data-vs-idx="${e.index}"]`);if(!n)return;let r=n.getBoundingClientRect().top-t.top-e.top;if(Math.abs(r)<=1)return;let i=Math.max(0,this.container.scrollHeight-this.container.clientHeight);this.suppressScroll=!0,this.container.scrollTop=Math.max(0,Math.min(this.container.scrollTop+r,i)),this.suppressScroll=!1}remeasureVisible(e){if(this._remeasuring)return;let t=this.container.scrollHeight-this.container.scrollTop-this.container.clientHeight<80,n=[];this.viewport.querySelectorAll(`[data-vs-idx]`).forEach(e=>{let t=Number(e.dataset.vsIdx);this.items[t]&&n.push({idx:t,newH:e.getBoundingClientRect().height})});let r=!1;for(let{idx:e,newH:t}of n)this.items[e].height!==t&&(this.items[e].height=t,this.markPrefixDirty(e),r=!0);if(r){this._remeasuring=!0;try{if(this.applyCurrentSpacers(),t){this.scrollToBottom();return}this.restoreScrollAnchor(e)}finally{this._remeasuring=!1}}}scrollToBottom(){this.rafId&&=(cancelAnimationFrame(this.rafId),null);let e=this.totalEffectiveHeight();this.spacerTop.style.height=`${e}px`,this.spacerBottom.style.height=`0px`,this.container.scrollTop=this.container.scrollHeight,this.firstVisible=-1,this.lastVisible=-1,this.render()}clear(){this.items=[],this.prefixHeights=[0],this.prefixDirtyFrom=0,this.itemSpacing=0,this.containerPadTop=0,this.containerPadBottom=0,this._active&&(this.container.classList.remove(`vs-active`),this.container.removeEventListener(`scroll`,this.scrollHandler),this.viewport.innerHTML=``,this.spacerTop.style.height=`0`,this.spacerBottom.style.height=`0`,this.container.innerHTML=``),this._active=!1,this.firstVisible=-1,this.lastVisible=-1,this.onLazyRender=null,this.onPostRender=null,this.rafId&&=(cancelAnimationFrame(this.rafId),null)}},w=null;function T(){return w||=new Se(`chatMessages`),w}function Ce(e,t){t.registerCallbacks(),t.setItems(e,{autoActivate:!1});let n=Math.max(0,e.length-20),r=t.measureTailWindow(e,20);r.length>0&&t.seedMeasuredHeights(n,r),t.activateIfNeeded(!0),t.scrollToBottom()}var we=2e3,Te=80;function Ee(e){return{chunks:[],fullText:``,textDirty:!1,element:e,pendingRAF:null,isFinalized:!1,lastRenderTime:0}}function E(e){return e.textDirty&&=(e.fullText=e.chunks.join(``),!1),e.fullText}function De(e,t){e.chunks.push(t),e.textDirty=!0,!e.pendingRAF&&!e.isFinalized&&(e.pendingRAF=requestAnimationFrame(()=>{if(e.pendingRAF=null,e.isFinalized)return;let t=performance.now(),n=E(e);n.length<we||t-e.lastRenderTime>Te?(e.element.innerHTML=o(n,!0)+`<span class="stream-cursor" aria-hidden="true"></span>`,e.lastRenderTime=t):e.pendingRAF=requestAnimationFrame(()=>{e.pendingRAF=null,!e.isFinalized&&(e.element.innerHTML=o(E(e),!0)+`<span class="stream-cursor" aria-hidden="true"></span>`,e.lastRenderTime=performance.now())})}))}function Oe(e,t=!1){e.isFinalized=!0,e.pendingRAF&&=(cancelAnimationFrame(e.pendingRAF),null);let n=E(e);return t||(e.element.innerHTML=o(n)),n}var ke=[`cdnjs.cloudflare.com`,`cdn.jsdelivr.net`,`unpkg.com`,`esm.sh`,`fonts.googleapis.com`,`fonts.gstatic.com`],Ae=[/\beval\s*\(/,/\bnew\s+Function\s*\(/,/\bdocument\.cookie\b/,/\bwindow\.opener\b/,/\bwindow\.top\b/,/\bparent\.postMessage\b(?!.*jaw-)/,/\blocation\.href\s*=/,/\bwindow\.location\b/,/\bsetTimeout\s*\(\s*["'`]/,/\bsetInterval\s*\(\s*["'`]/,/\.constructor\s*\.\s*constructor/,/\bdocument\.write\s*\(/,/\binsertAdjacentHTML\s*\(/,/\bimport\s*\(/],je=[];function Me(e){let t=[];if(e.length>524288)return{valid:!1,reason:`Payload too large (>512KB)`,warnings:t};let n=/(?:src|href)\s*=\s*["']https?:\/\/([^/"']+)/gi,r;for(;(r=n.exec(e))!==null;){let e=r[1];if(!ke.some(t=>e===t||e.endsWith(`.`+t)))return{valid:!1,reason:`Blocked domain: ${e}`,warnings:t}}let i=/url\s*\(\s*['"]?https?:\/\/([^)'"]+)/gi;for(;(r=i.exec(e))!==null;){let e=r[1].split(`/`)[0];ke.some(t=>e===t||e.endsWith(`.`+t))||t.push(`CSS url() references external domain: ${e}`)}for(let n of Ae)if(n.test(e))return{valid:!1,reason:`Dangerous pattern: ${n.source}`,warnings:t};for(let n of je)n.test(e)&&t.push(`DOM sink detected: ${n.source}`);return{valid:!0,warnings:t}}function Ne(){let e=document.createElement(`button`);return e.className=`diagram-copy-btn`,e.type=`button`,e.ariaLabel=`Copy source`,e.title=`Copy`,e.innerHTML=d.copy,e}function Pe(){let e=document.createElement(`button`);return e.className=`diagram-save-btn`,e.type=`button`,e.ariaLabel=`Save as image`,e.title=`Save`,e.innerHTML=d.download,e}var Fe=[`cdnjs.cloudflare.com`,`cdn.jsdelivr.net`,`unpkg.com`,`esm.sh`,`fonts.googleapis.com`,`fonts.gstatic.com`],D=new Set,O=new Map,k=null;function Ie(){if(k)return;let e=document.getElementById(`chatMessages`);e&&(k=new MutationObserver(e=>{if(D.size)for(let t of e)for(let e of t.removedNodes)e instanceof HTMLIFrameElement&&e.contentWindow&&(D.delete(e.contentWindow),O.delete(e.contentWindow)),e instanceof HTMLElement&&e.querySelectorAll(`iframe`).forEach(e=>{e.contentWindow&&(D.delete(e.contentWindow),O.delete(e.contentWindow))})}),k.observe(e,{childList:!0,subtree:!0}))}function Le(e){if(e.includes(`"importmap"`)||e.includes(`'importmap'`))return``;let t={},n=e.match(/(?:cdn\.jsdelivr\.net\/npm|unpkg\.com)\/three@([\d.]+)/);if(n){let r=n[1],i=e.includes(`unpkg.com/three@`)?`unpkg.com`:`cdn.jsdelivr.net/npm`;t.three=`https://${i}/three@${r}/${i===`unpkg.com`?`build/three.module.js`:`build/three.module.min.js`}`,t[`three/addons/`]=`https://${i}/three@${r}/examples/jsm/`}return Object.keys(t).length===0?``:`<script type="importmap">${JSON.stringify({imports:t})}<\/script>`}function Re(e){let t=`'none'`;(e.includes(`cdn.jsdelivr.net/npm/us-atlas`)||e.includes(`cdn.jsdelivr.net/npm/world-atlas`)||e.includes(`cdn.jsdelivr.net/npm/datamaps`))&&(t=`https://cdn.jsdelivr.net`);let n=/Tone\.min\.js|tone@/.test(e)?`worker-src blob:;`:``,r=Fe.map(e=>`https://${e}`),i=r.join(` `),a=[`data:`,`blob:`,...r],o=[`'unsafe-inline'`,`https://fonts.googleapis.com`];/L\.(map|tileLayer|marker|geoJSON|polyline|polygon|circle)\(|leaflet[\w.@/-]*\.(js|css)|tile\.openstreetmap\.org/.test(e)&&(a.push(`https://a.tile.openstreetmap.org`,`https://b.tile.openstreetmap.org`,`https://c.tile.openstreetmap.org`),o.push(`https://cdnjs.cloudflare.com`,`https://cdn.jsdelivr.net`));let s=a.join(` `);return`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; script-src 'unsafe-inline' ${i}; style-src ${o.join(` `)}; img-src ${s}; font-src https://fonts.gstatic.com; connect-src ${t}; ${n} base-uri 'none';">`}function ze(){let e=!document.documentElement.hasAttribute(`data-theme`)||document.documentElement.getAttribute(`data-theme`)===`dark`,t=getComputedStyle(document.documentElement);return{isDark:e,tokens:{"--bg":t.getPropertyValue(`--bg`).trim(),"--surface":t.getPropertyValue(`--surface`).trim(),"--border":t.getPropertyValue(`--border`).trim(),"--text":t.getPropertyValue(`--text`).trim(),"--text-dim":t.getPropertyValue(`--text-dim`).trim(),"--accent":t.getPropertyValue(`--accent`).trim(),"--font-ui":t.getPropertyValue(`--font-ui`).trim(),"--font-mono":t.getPropertyValue(`--font-mono`).trim(),"--radius-sm":t.getPropertyValue(`--radius-sm`).trim(),"--radius-md":t.getPropertyValue(`--radius-md`).trim()}}}function Be(e){return`
|
|
3
|
+
<script>
|
|
4
|
+
(function() {
|
|
5
|
+
var __nonce = '${e}';
|
|
6
|
+
|
|
7
|
+
window.addEventListener('message', function(e) {
|
|
8
|
+
if (e.source !== window.parent) return;
|
|
9
|
+
if (!e.data || typeof e.data !== 'object') return;
|
|
10
|
+
|
|
11
|
+
if (e.data.type === 'jaw-theme-update') {
|
|
12
|
+
window.__jawTheme = { isDark: !!e.data.isDark };
|
|
13
|
+
window.__jawTokens = e.data.tokens || {};
|
|
14
|
+
window.dispatchEvent(new CustomEvent('jaw-theme-change', { detail: window.__jawTheme }));
|
|
15
|
+
}
|
|
16
|
+
if (e.data.type === 'jaw-request-resize') {
|
|
17
|
+
postHeight();
|
|
18
|
+
}
|
|
19
|
+
if (e.data.type === 'jaw-request-screenshot') {
|
|
20
|
+
var canvas = document.querySelector('canvas');
|
|
21
|
+
if (canvas) {
|
|
22
|
+
try {
|
|
23
|
+
var dataUrl = canvas.toDataURL('image/png');
|
|
24
|
+
window.parent.postMessage({ type: 'jaw-screenshot', dataUrl: dataUrl, nonce: __nonce }, '*');
|
|
25
|
+
} catch(ex) { /* tainted canvas or other error */ }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
function postHeight() {
|
|
31
|
+
var h = Math.max(
|
|
32
|
+
document.body.scrollHeight,
|
|
33
|
+
document.body.offsetHeight,
|
|
34
|
+
document.documentElement.scrollHeight
|
|
35
|
+
);
|
|
36
|
+
window.parent.postMessage({ type: 'jaw-diagram-resize', height: h, nonce: __nonce }, '*');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (typeof ResizeObserver !== 'undefined') {
|
|
40
|
+
var ro = new ResizeObserver(function() {
|
|
41
|
+
clearTimeout(ro._t);
|
|
42
|
+
ro._t = setTimeout(postHeight, 50);
|
|
43
|
+
});
|
|
44
|
+
ro.observe(document.body);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
window.addEventListener('load', function() {
|
|
48
|
+
postHeight();
|
|
49
|
+
// Deferred re-measure for async chart renders (Chart.js animation, CDN loading)
|
|
50
|
+
setTimeout(postHeight, 200);
|
|
51
|
+
setTimeout(postHeight, 800);
|
|
52
|
+
window.parent.postMessage({ type: 'jaw-widget-ready', nonce: __nonce }, '*');
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
var lastSend = 0;
|
|
56
|
+
window.sendPrompt = function(text) {
|
|
57
|
+
var now = Date.now();
|
|
58
|
+
if (now - lastSend < 3000) return;
|
|
59
|
+
lastSend = now;
|
|
60
|
+
window.parent.postMessage({ type: 'jaw-send-prompt', text: String(text).slice(0, 500), nonce: __nonce }, '*');
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
// Ctrl+C / Cmd+C: forward selected text to host for clipboard access
|
|
64
|
+
document.addEventListener('copy', function() {
|
|
65
|
+
var sel = window.getSelection();
|
|
66
|
+
if (sel && sel.toString().trim()) {
|
|
67
|
+
window.parent.postMessage({
|
|
68
|
+
type: 'jaw-copy-text',
|
|
69
|
+
text: sel.toString().slice(0, 512),
|
|
70
|
+
nonce: __nonce
|
|
71
|
+
}, '*');
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
})();
|
|
75
|
+
<\/script>`}var Ve=[[/\/p5\.js\/1\.11\.1[1-9]\//g,`/p5.js/1.11.10/`]];function He(e){for(let[t,n]of Ve)e=e.replace(t,n);return e}function Ue(e){Ie(),We(),e=He(e);let t=Array.from(crypto.getRandomValues(new Uint8Array(16)),e=>e.toString(16).padStart(2,`0`)).join(``),n=ze(),r=Re(e),i=Le(e),a=Be(t),o=`<!DOCTYPE html>
|
|
76
|
+
<html>
|
|
77
|
+
<head>
|
|
78
|
+
<meta charset="utf-8">
|
|
79
|
+
${r}
|
|
80
|
+
${i}
|
|
81
|
+
<style>
|
|
82
|
+
:root { ${Object.entries(n.tokens).map(([e,t])=>`${e}: ${t};`).join(`
|
|
83
|
+
`)} }
|
|
84
|
+
* { margin: 0; box-sizing: border-box; }
|
|
85
|
+
body {
|
|
86
|
+
font-family: var(--font-ui), system-ui, sans-serif;
|
|
87
|
+
color: var(--text);
|
|
88
|
+
background: transparent;
|
|
89
|
+
padding: 16px;
|
|
90
|
+
overflow: hidden;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
93
|
+
</head>
|
|
94
|
+
<body>
|
|
95
|
+
<script>
|
|
96
|
+
window.__jawTheme = ${JSON.stringify({isDark:n.isDark})};
|
|
97
|
+
window.__jawTokens = ${JSON.stringify(n.tokens).replace(/<\//g,`<\\/`)};
|
|
98
|
+
<\/script>
|
|
99
|
+
${a}
|
|
100
|
+
${e}
|
|
101
|
+
</body>
|
|
102
|
+
</html>`,s=document.createElement(`iframe`);return s.sandbox.add(`allow-scripts`),s.srcdoc=o,s.style.cssText=`width: 100%; border: none; overflow: hidden; display: block;`,s.setAttribute(`aria-label`,`Interactive diagram widget`),{iframe:s,nonce:t}}function A(e){(e||document).querySelectorAll(`.diagram-widget-pending`).forEach(e=>{let t=e.dataset.diagramHtml;if(!t)return;let n;try{if(t.length>524288)throw Error(`Widget payload too large`);n=decodeURIComponent(escape(atob(t)))}catch{e.replaceWith(Object.assign(document.createElement(`div`),{className:`diagram-error`,textContent:`Failed to decode widget content`,role:`alert`}));return}let r=Me(n);if(!r.valid){e.replaceWith(Object.assign(document.createElement(`div`),{className:`diagram-error`,textContent:`Widget blocked: ${r.reason}`,role:`alert`}));return}r.warnings.length&&console.warn(`[jaw-diagram] Widget warnings:`,r.warnings);let i=document.createElement(`div`);i.className=`diagram-container diagram-widget`,i.dataset.widgetHtml=t,i.appendChild(Pe()),i.appendChild(Ne());let{iframe:a,nonce:o}=Ue(n);i.appendChild(a),e.replaceWith(i);let s=!1;a.addEventListener(`load`,()=>{s?(a.contentWindow&&(D.delete(a.contentWindow),O.delete(a.contentWindow)),console.warn(`[jaw-diagram] iframe navigated — postMessage channel revoked`)):(s=!0,a.contentWindow&&(D.add(a.contentWindow),O.set(a.contentWindow,o),a.contentWindow.postMessage({type:`jaw-request-resize`},`*`),setTimeout(()=>a.contentWindow?.postMessage({type:`jaw-request-resize`},`*`),300),setTimeout(()=>a.contentWindow?.postMessage({type:`jaw-request-resize`},`*`),1e3)))});let c=Number(i.dataset.gen||`0`);i.dataset.gen=String(c);let l=!1,u=e=>{e.source===a.contentWindow&&e.data?.type===`jaw-widget-ready`&&e.data.nonce===o&&(l=!0,window.removeEventListener(`message`,u))};window.addEventListener(`message`,u),setTimeout(()=>{if(window.removeEventListener(`message`,u),Number(i.dataset.gen||`0`)===c&&!l&&i.isConnected){let e=a.contentWindow;e&&(D.delete(e),O.delete(e)),i.innerHTML=`<div class="diagram-error" role="alert">
|
|
103
|
+
Widget failed to load within 10 seconds.
|
|
104
|
+
</div>`,console.warn(`[jaw-diagram] Widget timeout — iframe deregistered`)}},1e4)})}var j=null;function We(){if(j)return;let e=document.getElementById(`chatMessages`);e&&(j=new MutationObserver(t=>{for(let n of t)for(let t of n.addedNodes)if(t instanceof HTMLElement&&(t.classList?.contains(`diagram-widget-pending`)||t.querySelector?.(`.diagram-widget-pending`))){requestAnimationFrame(()=>A(t.parentElement||e));return}}),j.observe(e,{childList:!0}))}var M=new WeakMap;function Ge(e,t){M.has(e)||(M.set(e,window.setTimeout(()=>M.delete(e),100)),document.querySelectorAll(`iframe`).forEach(n=>{n.contentWindow===e&&(n.style.height=`${Math.min(Math.max(t,60),2e3)}px`)}))}function Ke(){document.querySelectorAll(`.diagram-widget`).forEach(e=>{let t=e.dataset.widgetHtml;if(!t)return;let n;try{n=decodeURIComponent(escape(atob(t)))}catch{return}let r=e.querySelector(`iframe`);r?.contentWindow&&(D.delete(r.contentWindow),O.delete(r.contentWindow));let i=e;i.dataset.gen=String((Number(i.dataset.gen||`0`)||0)+1);let{iframe:a,nonce:o}=Ue(n);e.innerHTML=``,e.appendChild(Pe()),e.appendChild(Ne()),e.appendChild(a);let s=!1;a.addEventListener(`load`,()=>{s?a.contentWindow&&(D.delete(a.contentWindow),O.delete(a.contentWindow)):(s=!0,a.contentWindow&&(D.add(a.contentWindow),O.set(a.contentWindow,o),a.contentWindow.postMessage({type:`jaw-request-resize`},`*`),setTimeout(()=>a.contentWindow?.postMessage({type:`jaw-request-resize`},`*`),300),setTimeout(()=>a.contentWindow?.postMessage({type:`jaw-request-resize`},`*`),1e3)))})})}var N=0;window.addEventListener(`message`,e=>{if(!e.data||typeof e.data!=`object`||!e.source||e.origin!==`null`||!D.has(e.source)||![...document.querySelectorAll(`iframe`)].find(t=>t.contentWindow===e.source)?.isConnected)return;let t=O.get(e.source);if(!(!t||e.data.nonce!==t))switch(e.data.type){case`jaw-diagram-resize`:{let t=Number(e.data.height);if(!Number.isFinite(t)||t<0)return;Ge(e.source,t);break}case`jaw-send-prompt`:{let t=Date.now();if(t-N<3e3)return;N=t;let n=String(e.data.text||``).trim().slice(0,500);if(!n)return;let r=document.getElementById(`chatInput`);r&&(r.value=n,r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus());break}case`jaw-copy-text`:{let t=String(e.data.text||``).trim().slice(0,512);if(!t)return;navigator.clipboard.writeText(t).catch(()=>{});break}case`jaw-screenshot`:{let t=String(e.data.dataUrl||``);if(!t.startsWith(`data:image/`)||t.length>5242880)return;fetch(t).then(e=>e.blob()).then(e=>{let t=URL.createObjectURL(e),n=document.createElement(`a`);n.href=t,n.download=`widget-${Date.now()}.png`,n.click(),setTimeout(()=>URL.revokeObjectURL(t),1e3)}).catch(()=>{});break}case`jaw-widget-ready`:break}});function qe(e){e.dataset.toolItemBound!==`1`&&(e.addEventListener(`click`,e=>{let t=e.target;if(!t)return;let n=t.closest(`.tool-item-toggle`);if(!n)return;let r=n.closest(`.tool-item`),i=r?.querySelector(`.tool-item-details`),a=n.querySelector(`.tool-item-chevron`);if(!r||!i)return;let o=i.classList.contains(`collapsed`);i.classList.toggle(`collapsed`,!o),r.classList.toggle(`expanded`,o),n.setAttribute(`aria-expanded`,o?`true`:`false`),a&&(a.innerHTML=o?d.chevronDown:d.chevronRight)}),e.dataset.toolItemBound=`1`)}function Je(){document.querySelectorAll(`.tool-activity-live`).forEach(e=>e.remove()),document.querySelectorAll(`.msg-system.tool-activity`).forEach(e=>e.remove())}function P(e){let t={};for(let n of e){let e=n.type===`thinking`?`${d.thinking} Thinking`:n.type===`search`?`${d.search} Search`:`${d.tool} Tool`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>t>1?`${e}×${t}`:e).join(` + `)}function Ye(e,t=120){let n=e.replace(/\s+/g,` `).trim();return n?n.length>t?`${n.slice(0,t-1)}…`:n:``}function F(e){let t=(e.detail||``).trim();return t?t!==(e.label||``).trim():!1}function I(e){let t=`process-step-dot ${e.status}`,n=`process-step-badge ${e.type}`,r=e.type.toUpperCase(),i=c(e.label||e.icon||``),a=e.detail||``,o=`process-detail-${e.id}`,s=F(e)?Ye(a,e.type===`thinking`?120:100):``,l=s?`<span class="process-step-snippet">${c(s)}</span>`:``;return F(e)?`<div class="process-step process-step-expandable" data-step-id="${e.id}" data-type="${e.type}">
|
|
105
|
+
<button class="process-step-toggle" aria-expanded="false" aria-controls="${o}">
|
|
106
|
+
<span class="${t}"></span>
|
|
107
|
+
<span class="${n}">${r}</span>
|
|
108
|
+
<span class="process-step-main">
|
|
109
|
+
<span class="process-step-label">${i}</span>
|
|
110
|
+
${l}
|
|
111
|
+
</span>
|
|
112
|
+
<span class="process-step-chevron">${d.chevronRight}</span>
|
|
113
|
+
</button>
|
|
114
|
+
<div class="process-step-details collapsed" id="${o}">
|
|
115
|
+
<pre class="process-step-full">${c(a)}</pre>
|
|
116
|
+
</div>
|
|
117
|
+
</div>`:`<div class="process-step" data-step-id="${e.id}" data-type="${e.type}">
|
|
118
|
+
<span class="${t}"></span>
|
|
119
|
+
<span class="${n}">${r}</span>
|
|
120
|
+
<span class="process-step-label">${i}</span>
|
|
121
|
+
</div>`}function L(e=``,t=!1){return`<div class="process-block${t?` collapsed`:``}">
|
|
122
|
+
<button class="process-summary" aria-expanded="${t?`false`:`true`}">
|
|
123
|
+
<span class="process-dot ${t?`done`:`running`}"></span>
|
|
124
|
+
<span class="process-summary-text">${e}</span>
|
|
125
|
+
<span class="process-duration"></span>
|
|
126
|
+
<span class="process-chevron">${t?d.chevronRight:d.chevronDown}</span>
|
|
127
|
+
</button>
|
|
128
|
+
<div class="process-details">
|
|
129
|
+
<div class="process-steps-inner"></div>
|
|
130
|
+
</div>
|
|
131
|
+
</div>`}function Xe(e){let t=e.closest(`.process-step`),n=t?.querySelector(`.process-step-details`),r=e.querySelector(`.process-step-chevron`);if(!t||!n)return;let i=n.classList.contains(`collapsed`);n.classList.toggle(`collapsed`,!i),t.classList.toggle(`expanded`,i),e.setAttribute(`aria-expanded`,i?`true`:`false`),r&&(r.innerHTML=i?d.chevronDown:d.chevronRight)}function Ze(e){e.dataset.processBlockBound!==`1`&&(e.addEventListener(`click`,e=>{let t=e.target;if(!t)return;let n=t.closest(`.process-step-toggle`);if(n){Xe(n);return}let r=t.closest(`.process-summary`);if(r){let e=r.closest(`.process-block`);if(!e)return;let t=e.classList.contains(`collapsed`);e.classList.toggle(`collapsed`,!t),r.setAttribute(`aria-expanded`,t?`true`:`false`);let n=r.querySelector(`.process-chevron`);n&&(n.innerHTML=t?d.chevronDown:d.chevronRight)}}),e.dataset.processBlockBound=`1`)}function R(e,t=!0){let n=L(P(e),t),r=document.createElement(`div`);r.innerHTML=n;let i=r.querySelector(`.process-steps-inner`);i&&(i.innerHTML=e.map(I).join(``));let a=r.querySelector(`.process-dot`);if(a){let n=e.some(e=>e.status===`running`);a.classList.toggle(`running`,n&&!t),a.classList.toggle(`done`,!n||t)}return r.innerHTML}function z(e){let t=e.element.querySelector(`.process-summary-text`);t&&(t.innerHTML=P(e.steps));let n=e.steps.some(e=>e.status===`running`),r=e.element.querySelector(`.process-dot`);r&&(r.classList.toggle(`running`,n&&!e.collapsed),r.classList.toggle(`done`,!n||e.collapsed));let i=e.steps.length>0?Math.round((Date.now()-e.steps[0].startTime)/1e3):0,a=e.element.querySelector(`.process-duration`);a&&(a.textContent=i>0?`${i}s`:``)}function B(e){let t=document.createElement(`div`);t.innerHTML=L(``,!1);let n=t.firstElementChild,r=e.querySelector(`.msg-content`);return r?r.before(n):e.appendChild(n),{element:n,steps:[],collapsed:!1}}function V(e,t){e.steps.push(t);let n=e.element.querySelector(`.process-steps-inner`);n&&n.insertAdjacentHTML(`beforeend`,I(t)),z(e)}function H(e,t,n){let r=e.steps.findIndex(e=>e.id===t);if(r===-1)return;e.steps[r]=n;let i=e.element.querySelector(`[data-step-id="${t}"]`);if(i){let e=document.createElement(`div`);e.innerHTML=I(n);let t=e.firstElementChild;t&&i.replaceWith(t)}z(e)}function Qe(e,t,n){let r=e.steps.find(e=>e.id===t);if(!r)return;r.status=n;let i=e.element.querySelector(`[data-step-id="${t}"]`);if(i){let e=i.querySelector(`.process-step-dot`);e&&(e.classList.remove(`running`,`done`,`error`),e.classList.add(n))}z(e)}function U(e){e.collapsed=!0,e.element.classList.add(`collapsed`);let t=e.element.querySelector(`.process-summary`);t&&t.setAttribute(`aria-expanded`,`false`);let n=e.element.querySelector(`.process-chevron`);n&&(n.innerHTML=d.chevronRight);for(let t of e.steps)t.status===`running`&&(t.status=`done`);e.element.querySelectorAll(`.process-step-dot.running`).forEach(e=>{e.classList.remove(`running`),e.classList.add(`done`)}),z(e)}function W(e){if(!e)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t:[]}catch{return[]}}function $e(e){return _e()}function G(e){return e.map(e=>({id:h(),icon:e.icon?i(e.icon):d.tool,label:e.label||e.name||`tool`,type:e.toolType||`tool`,detail:e.detail||``,stepRef:e.stepRef||``,status:e.status||`done`,startTime:Date.now()}))}function et(t){let n=document.getElementById(`statusBadge`),r=document.getElementById(`btnSend`);e.agentBusy=t===`running`,document.getElementById(`typingIndicator`)?.classList.toggle(`active`,e.agentBusy),t===`running`?(n&&(n.className=`status-badge status-running`,n.textContent=`running`),r&&(r.innerHTML=d.stop,r.title=a(`btn.stop`),r.classList.add(`stop-mode`)),nt()):(n&&(n.className=`status-badge status-idle`,n.textContent=`idle`),r&&(r.innerHTML=d.send,r.title=`Send`,r.classList.remove(`stop-mode`)),K(),tt(0))}function tt(e){let t=document.getElementById(`queueBadge`);if(!t){t=document.createElement(`span`),t.id=`queueBadge`,t.className=`queue-badge`;let e=document.getElementById(`btnSend`);e?.parentElement&&(e.parentElement.style.position=`relative`),e&&(e.style.position=`relative`,e.appendChild(t))}t.textContent=e>0?String(e):``,t.style.display=e>0?`flex`:`none`}function nt(){let e=document.getElementById(`chatMessages`);if(!e||e.querySelector(`.skeleton-msg`))return;q();let t=document.createElement(`div`);t.className=`skeleton-msg`,t.innerHTML=`<div class="skeleton-line"></div><div class="skeleton-line"></div><div class="skeleton-line"></div>`,e.appendChild(t),Q()}function K(){document.querySelectorAll(`.skeleton-msg`).forEach(e=>e.remove())}function q(){document.getElementById(`emptyState`)?.classList.remove(`visible`)}function J(){let e=document.getElementById(`chatMessages`);e&&e.children.length===0&&document.getElementById(`emptyState`)?.classList.add(`visible`)}function rt(e,t,n){let r=document.getElementById(`chatMessages`);if(!r)return;let i=T();q();let a=document.createElement(`div`);a.className=`msg msg-system`+(n?` msg-type-${n}`:``)+(t?` `+t:``),a.innerHTML=e,i.active?i.appendLiveItem(a):r.appendChild(a),Q()}function it(){Je(),e.currentAgentDiv=null,e.currentProcessBlock=null}function at(t){if(K(),(!e.currentAgentDiv||!e.currentAgentDiv.isConnected)&&(e.currentAgentDiv=X(`agent`,``),e.currentProcessBlock=null),!e.currentProcessBlock){let t=e.currentAgentDiv.querySelector(`.agent-body`);t&&(e.currentProcessBlock=B(t))}if(e.currentProcessBlock){let n=t.status&&t.status!==`running`?t.status:s(t.icon);if(n===`done`||n===`error`){let r=t.stepRef,a=r?[...e.currentProcessBlock.steps].reverse().find(e=>e.status===`running`&&e.stepRef===r):[...e.currentProcessBlock.steps].reverse().find(e=>e.status===`running`&&e.label===t.label);if(a){t.detail&&!a.detail?(t.icon=i(t.icon),H(e.currentProcessBlock,a.id,{...t,id:a.id})):Qe(e.currentProcessBlock,a.id,n),Q();return}let o=[...e.currentProcessBlock.steps].reverse().find(e=>e.status===`running`);if(o){t.detail&&!o.detail?(t.icon=i(t.icon),H(e.currentProcessBlock,o.id,{...t,id:o.id})):Qe(e.currentProcessBlock,o.id,n),Q();return}}if(t.detail){let n=[...e.currentProcessBlock.steps].reverse().find(e=>e.status===`running`&&e.label===t.label&&e.type===t.type&&!e.detail);if(n){H(e.currentProcessBlock,n.id,t),Q();return}}t.icon=i(t.icon),V(e.currentProcessBlock,t)}Q()}var Y=null;function ot(t){if(!t)return;K(),(!e.currentAgentDiv||!e.currentAgentDiv.isConnected)&&(e.currentAgentDiv=X(`agent`,``),Y=null);let n=e.currentAgentDiv?.querySelector(`.msg-content`);n&&(Y||=Ee(n),De(Y,t)),Q()}var st=0;function ct(t,n){let r=Date.now();if(!e.currentAgentDiv&&r-st<500)return;Je(),K();let i=!!e.currentProcessBlock;e.currentProcessBlock&&=(U(e.currentProcessBlock),null);let a=n&&n.length>0;if(t||a){(!e.currentAgentDiv||!e.currentAgentDiv.isConnected)&&(e.currentAgentDiv=X(`agent`,``));let r=e.currentAgentDiv?.querySelector(`.msg-content`),s=Y?Oe(Y,!0):``,c=t||s;Y=null;let u=a&&!i?R(G(n),!0):``;r&&(r.innerHTML=u+o(c)),r&&r.setAttribute(`data-raw`,l(c)),r&&A(r);let d=T();d.active&&e.currentAgentDiv&&e.currentAgentDiv.isConnected&&(d.appendLiveItem(e.currentAgentDiv),e.currentAgentDiv.remove()),c&&f({role:`assistant`,content:c,tool_log:n?JSON.stringify(n):null,timestamp:Date.now()}).catch(()=>{})}Y=null,e.currentAgentDiv=null,st=Date.now(),et(`idle`),ht()}function X(e,t,n){let r=document.getElementById(`chatMessages`),i=T();q(),K();let s=o(t),d=c(e===`user`?a(`msg.you`):ne()),f=document.createElement(`div`);e===`agent`?(f.className=`msg msg-agent`,f.innerHTML=`<div class="agent-icon" aria-hidden="true">${$e(n)}</div><div class="agent-body"><div class="msg-content">${s}</div><button class="msg-copy" title="Copy" aria-label="Copy message"></button></div>`):(f.className=`msg msg-${e}`,f.innerHTML=`<div class="user-body"><div class="msg-label">${d}</div><div class="msg-content">${s}</div><button class="msg-copy" title="Copy" aria-label="Copy message"></button></div><div class="user-icon" aria-hidden="true">${ve()}</div>`);let p=f.querySelector(`.msg-content`);p&&p.setAttribute(`data-raw`,l(t));let m=e===`agent`&&!t;return i.active&&!m?i.appendLiveItem(f):(r?.appendChild(f),A(f),!i.active&&!m&&r&&r.querySelectorAll(`.msg`).length>=80&&(r.querySelectorAll(`.msg`).forEach(e=>{i.addItem(h(),e.outerHTML)}),i.onPostRender=e=>{A(e),u(e)})),Q(e===`user`),f}var lt=null,Z=!0,ut=!1,dt=80;function ft(){if(ut)return;let e=document.getElementById(`chatMessages`);e&&(ut=!0,e.addEventListener(`scroll`,()=>{Z=e.scrollHeight-e.scrollTop-e.clientHeight<dt},{passive:!0}))}function Q(e=!1){if(ft(),!e&&!Z)return;e&&(Z=!0);let t=T();if(t.active){t.scrollToBottom();return}lt||=requestAnimationFrame(()=>{lt=null;let e=document.getElementById(`chatMessages`);e&&(e.scrollTop=e.scrollHeight)})}function pt(e,t){document.querySelectorAll(`.tab-btn`).forEach(e=>{e.classList.remove(`active`),e.setAttribute(`aria-selected`,`false`)}),document.querySelectorAll(`.tab-content`).forEach(e=>e.classList.remove(`active`)),document.getElementById({agents:`tabAgents`,settings:`tabSettings`,skills:`tabSkills`}[e])?.classList.add(`active`),t&&(t.classList.add(`active`),t.setAttribute(`aria-selected`,`true`)),e===`settings`&&r(()=>import(`./settings-DCPeIn7T.js`).then(e=>e.loadSettings()),__vite__mapDeps([0])),e===`agents`&&r(()=>import(`./employees-Bqy3DcSm.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0])),e===`skills`&&r(()=>import(`./skills-DSnKA-Nc.js`).then(e=>e.loadSkills()),__vite__mapDeps([0]))}function mt(){document.getElementById(`tabSettings`)?.classList.contains(`active`)?r(()=>import(`./settings-DCPeIn7T.js`).then(e=>e.savePerCli()),__vite__mapDeps([0])):r(()=>import(`./settings-DCPeIn7T.js`).then(e=>e.updateSettings()),__vite__mapDeps([0]))}function $(e){let t=document.getElementById(`statMsgs`);t&&(t.textContent=a(`stat.messages`,{count:e}))}async function ht(){let e=await n(`/api/messages`);e&&$(e.length)}function gt(e){let t=[];for(let n of e){let e=n.role===`assistant`?`agent`:n.role,r=l(n.content),i=c(e===`user`?a(`msg.you`):ne()),o=n.role===`assistant`?W(n.tool_log):[],s=o.length>0?R(G(o),!0):``,u=`<div class="skeleton-line"></div><div class="skeleton-line"></div>`,d=e===`agent`?`<div class="msg msg-agent"><div class="agent-icon" aria-hidden="true">${$e(n.cli)}</div><div class="agent-body">${s}<div class="msg-content lazy-pending" data-raw="${c(r)}">${u}</div><button class="msg-copy" title="Copy" aria-label="Copy message"></button></div></div>`:`<div class="msg msg-${e}"><div class="user-body"><div class="msg-label">${i}</div><div class="msg-content lazy-pending" data-raw="${c(r)}">${u}</div><button class="msg-copy" title="Copy" aria-label="Copy message"></button></div><div class="user-icon" aria-hidden="true">${ve()}</div></div>`;t.push({id:h(),html:d,height:80})}return t}function _t(e){e.onLazyRender=t=>{for(let n of t){if(!n.classList.contains(`lazy-pending`))continue;let t=n.getAttribute(`data-raw`)||``;n.innerHTML=t?o(t):``,n.classList.remove(`lazy-pending`),A(n);let r=n.closest(`[data-vs-idx]`);if(r){let t=Number(r.dataset.vsIdx);e.updateItemHtml(t,r.outerHTML)}}},e.onPostRender=e=>{A(e),u(e)}}function vt(e,t,n){let r=Math.max(0,t.length-n),i=t.slice(r);if(i.length===0)return[];let a=document.createDocumentFragment();for(let e of i){let t=document.createElement(`div`);t.innerHTML=e.html;let n=t.firstElementChild;n&&a.appendChild(n)}e.appendChild(a);let o=[],s=e.children;for(let e=0;e<s.length;e++)o.push(s[e].getBoundingClientRect().height);return e.innerHTML=``,o}function yt(e,t){return{registerCallbacks:()=>_t(e),measureTailWindow:(e,n)=>vt(t,e,n),setItems:(t,n)=>e.setItems(t,n),seedMeasuredHeights:(t,n)=>e.seedMeasuredHeights(t,n),activateIfNeeded:t=>e.activateIfNeeded(t),scrollToBottom:()=>e.scrollToBottom()}}async function bt(){let e=T(),t=document.getElementById(`chatMessages`);try{let e=await n(`/api/settings`);e?.workingDir&&p(e.workingDir)}catch{}let r=await n(`/api/messages`);if(r!==null){e.clear(),t&&(t.innerHTML=``),r.length>=80?Ce(gt(r),yt(e,t)):r.forEach(e=>{let t=X(e.role===`assistant`?`agent`:e.role,e.content,e.cli);if(e.role===`assistant`){let n=W(e.tool_log);if(n.length>0){let e=t.querySelector(`.agent-body`);if(e){let t=B(e);for(let e of G(n))V(t,e);U(t)}}}}),ee(r.map(e=>({role:e.role,content:e.content,cli:e.cli??null,tool_log:e.tool_log??null,timestamp:Date.now()}))).catch(()=>{}),$(r.length),J();return}if(t&&t.children.length>0){J();return}let i=await m();i.length>0&&(i.length>=80?Ce(gt(i),yt(e,t)):i.forEach(e=>{let t=X(e.role===`assistant`?`agent`:e.role,e.content,e.cli);if(e.role===`assistant`&&e.tool_log){let n=W(e.tool_log);if(n.length>0){let e=t.querySelector(`.agent-body`);if(e){let t=B(e);for(let e of G(n))V(t,e);U(t)}}}}),rt(`${d.warning} 오프라인 모드 — 캐시된 메시지 표시 중`),$(i.length)),J()}function xt(){let e=document.getElementById(`chatMessages`);e&&(Ze(e),qe(e),e.addEventListener(`click`,e=>{let t=e.target,n=t.closest(`.tool-group-summary`);if(n){let e=n.closest(`.tool-group`),t=n.nextElementSibling;if(e&&t){let r=!e.classList.contains(`expanded`);e.classList.toggle(`expanded`),t.classList.toggle(`collapsed`),n.setAttribute(`aria-expanded`,r?`true`:`false`)}return}let r=t.closest(`.msg-copy`);if(!r)return;let i=r.closest(`.msg`)?.querySelector(`.msg-content`);if(!i)return;let a=i.getAttribute(`data-raw`)||i.innerText||i.textContent||``;navigator.clipboard.writeText(a).then(()=>{r.classList.add(`copied`),r.innerHTML=d.checkSimple,setTimeout(()=>{r.classList.remove(`copied`),r.textContent=``},600)}).catch(()=>{})}))}export{ye as _,ct as a,bt as c,et as d,at as f,T as g,Ke as h,it as i,ht as l,tt as m,rt as n,mt as o,pt as p,ot as r,xt as s,X as t,Q as u,ie as v};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/vendor-render-Bjnw0wQ6.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{t as e}from"./state-O6NVkWcL.js";import{Z as t}from"./vendor-mermaid-C2RBgdM6.js";import{f as n,h as r,n as i,s as a,t as o}from"./render-
|
|
2
|
+
import{t as e}from"./state-O6NVkWcL.js";import{Z as t}from"./vendor-mermaid-C2RBgdM6.js";import{f as n,h as r,n as i,s as a,t as o}from"./render-BGh36e9F.js";import{a as s,d as c,f as l,g as u,i as d,m as f,n as p,r as m,t as h}from"./ui-th_57WwF.js";var g=[`P`,`A`,`B`,`C`],_=null;function v(e,t,n){let r=g.indexOf(n);if(r<0)return;let i=e.getBoundingClientRect(),a=t.offsetWidth||36,o=document.getElementById(`dot-${n}`);if(!o)return;let s=g[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.left=r-i.left-a/2+`px`}else{let e=o.getBoundingClientRect();t.style.left=e.left-i.left+e.width/2-a/2+`px`}}var y={},b=``,x=0;function S(e){for(let e of Object.keys(y))delete y[e];for(let t of e)t.state===`running`&&t.phase&&(y[t.agentId]={phase:t.phase,phaseLabel:t.phaseLabel||``})}function C(t,n){let r=new Set([`IDLE`,`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:``,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(()=>{_&&o.classList.contains(`running`)&&v(a,o,_)}).observe(a);let e=0;window.addEventListener(`resize`,()=>{cancelAnimationFrame(e),e=requestAnimationFrame(()=>{_&&o.classList.contains(`running`)&&v(a,o,_)})})}if(r===`IDLE`)a.classList.remove(`visible`,`shimmer-out`),o.classList.remove(`running`),_=null;else if(r===`D`){g.forEach(e=>{let t=document.getElementById(`dot-${e}`);t&&(t.className=`pabc-dot done`,t.setAttribute(`data-phase`,e))});for(let e=0;e<4;e++){let t=document.getElementById(`pabc-conn-${e}`);t&&(t.className=`pabc-connector done`)}o.classList.remove(`running`),_=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=g.indexOf(r);g.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<4;t++){let n=document.getElementById(`pabc-conn-${t}`);n&&(n.className=`pabc-connector ${t<e?`done`:``}`)}_=r,requestAnimationFrame(()=>v(a,o,r))}s&&n&&(s.textContent=n)}}function w(){let g=`ws://${location.host}`;e.ws=new WebSocket(`${g}?lang=${n()}`),e.ws.onmessage=e=>{let n;try{n=JSON.parse(e.data)}catch{console.warn(`[ws] malformed message:`,e.data);return}if(!n||typeof n!=`object`||typeof n.type!=`string`){console.warn(`[ws] invalid message shape:`,n);return}if(n.type===`agent_status`)n.running===void 0?c(n.status||`idle`):c(n.running?`running`:`idle`),n.agentId&&n.phase&&(y[n.agentId]={phase:n.phase,phaseLabel:n.phaseLabel||``},t(()=>import(`./employees-Bqy3DcSm.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0])));else if(n.type===`queue_update`)f(n.pending||0);else if(n.type===`worklog_created`)p(`${a.clipboard} Worklog: ${i(n.path||``)}`);else if(n.type===`round_start`){let e=n.agentPhases||n.subtasks||[],t=e.map(e=>i(e.agent||e.name||``)).join(`, `);p(r(`ws.roundStart`,{round:n.round||0,count:e.length,names:t}))}else if(n.type===`round_done`)n.action===`complete`?p(r(`ws.roundDone`,{round:n.round||0})):n.action===`next`?p(r(`ws.roundNext`,{round:n.round||0})):p(r(`ws.roundRetry`,{round:n.round||0}));else if(n.type===`agent_tool`){let e=n.toolType===`thinking`?`thinking`:n.toolType===`search`?`search`:`tool`;l({id:`step-${Date.now()}-${Math.random().toString(36).slice(2,6)}`,type:e,icon:n.icon||a.tool,label:n.label||``,detail:n.detail||``,stepRef:n.stepRef||``,status:n.status||`running`,startTime:Date.now()})}else if(n.type===`agent_output`)m(n.text||``);else if(n.type===`agent_retry`)p(r(`ws.retry`,{cli:i(n.cli||``),delay:n.delay||10}),`tool-activity`);else if(n.type===`agent_fallback`)p(r(`ws.fallback`,{from:i(n.from||``),to:i(n.to||``)}),`tool-activity`);else if(n.type===`agent_smoke`)p(`${a.warning} ${i(n.cli||`agent`)}: smoke response detected — auto-continuing`,`tool-activity`);else if(n.type===`agent_done`)s(n.text||``,n.toolLog);else if(n.type===`orchestrate_done`)s(n.text||``);else if(n.type===`clear`){o(),d(),u().clear();let e=document.getElementById(`chatMessages`);e&&(e.innerHTML=``),t(()=>import(`./idb-cache-C7z4qE00.js`).then(e=>e.clearCache()),[]).catch(()=>{})}else if(n.type===`session_reset`)p(`${a.refresh} Session reset — history preserved`,`tool-activity`);else if(n.type===`agent_added`||n.type===`agent_updated`||n.type===`agent_deleted`)t(()=>import(`./employees-Bqy3DcSm.js`).then(e=>e.loadEmployees()),__vite__mapDeps([0]));else if(n.type===`orc_state`){if(n.scope&&b&&n.scope!==b)return;C(typeof n.state==`string`?n.state:`IDLE`,n.title)}else n.type===`new_message`&&(n.source===`telegram`||n.source===`discord`)&&h(n.role===`assistant`?`agent`:n.role||`user`,n.content||``,n.cli)},e.ws.onopen=()=>{console.log(`[ws] connected`);let e=Date.now()-x<1e4;t(()=>import(`./ui-N0IhTP91.js`).then(async t=>{if(t.cleanupToolActivity(),!e)try{await t.loadMessages(),x=Date.now()}catch(e){console.error(`[ws] loadMessages failed`,e)}t.setStatus(`idle`)}),__vite__mapDeps([0])),fetch(`/api/orchestrate/snapshot`).then(e=>e.json()).then(e=>{b=String(e.orc.scope||``),C(e.orc.state),S(e.workers),f(e.runtime.queuePending),c(e.runtime.busy?`running`:`idle`),t(()=>import(`./employees-Bqy3DcSm.js`).then(e=>{typeof e.renderEmployees==`function`&&e.renderEmployees()}),__vite__mapDeps([0]))}).catch(()=>{})},e.ws.onclose=()=>{console.log(`[ws] disconnected, reconnecting in 2s...`),t(()=>import(`./ui-N0IhTP91.js`).then(e=>e.cleanupToolActivity()),__vite__mapDeps([0])),c(`idle`),p(`${a.exec} 연결 끊김 — 재연결 중...`,`tool-activity`),setTimeout(w,2e3)}}function T(e){return y[e]||null}export{T as n,w as t};
|
package/public/dist/index.html
CHANGED
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
href="https://fonts.googleapis.com/css2?family=Chakra+Petch:wght@400;500;600;700&family=Outfit:wght@400;500;600;700&display=swap"
|
|
26
26
|
rel="stylesheet">
|
|
27
27
|
<!-- Vite handles module bundling in dev (HMR) and production (build) -->
|
|
28
|
-
<script type="module" crossorigin src="/dist/assets/index-
|
|
28
|
+
<script type="module" crossorigin src="/dist/assets/index-Br2aZvLo.js"></script>
|
|
29
29
|
<link rel="stylesheet" crossorigin href="/dist/assets/vendor-render-Bjnw0wQ6.css">
|
|
30
|
-
<link rel="stylesheet" crossorigin href="/dist/assets/index-
|
|
30
|
+
<link rel="stylesheet" crossorigin href="/dist/assets/index-B4ZSYCSC.css">
|
|
31
31
|
</head>
|
|
32
32
|
|
|
33
33
|
<body>
|
package/public/js/ui.ts
CHANGED
|
@@ -328,13 +328,37 @@ export function addMessage(role: string, text: string, cli?: string | null): HTM
|
|
|
328
328
|
}
|
|
329
329
|
}
|
|
330
330
|
}
|
|
331
|
-
|
|
331
|
+
// Force scroll for user messages so they're always visible after sending;
|
|
332
|
+
// agent/system messages respect the user's current scroll position.
|
|
333
|
+
scrollToBottom(role === 'user');
|
|
332
334
|
return div;
|
|
333
335
|
}
|
|
334
336
|
|
|
335
337
|
let scrollRAF: number | null = null;
|
|
338
|
+
let userNearBottom = true;
|
|
339
|
+
let scrollTrackingBound = false;
|
|
340
|
+
const SCROLL_BOTTOM_THRESHOLD = 80; // px
|
|
341
|
+
|
|
342
|
+
function ensureScrollTracking(): void {
|
|
343
|
+
if (scrollTrackingBound) return;
|
|
344
|
+
const c = document.getElementById('chatMessages');
|
|
345
|
+
if (!c) return;
|
|
346
|
+
scrollTrackingBound = true;
|
|
347
|
+
c.addEventListener('scroll', () => {
|
|
348
|
+
const dist = c.scrollHeight - c.scrollTop - c.clientHeight;
|
|
349
|
+
userNearBottom = dist < SCROLL_BOTTOM_THRESHOLD;
|
|
350
|
+
}, { passive: true });
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/** Scroll chat to bottom.
|
|
354
|
+
* @param force - bypass user-scroll detection (use for explicit user actions) */
|
|
355
|
+
export function scrollToBottom(force = false): void {
|
|
356
|
+
ensureScrollTracking();
|
|
357
|
+
if (!force && !userNearBottom) return;
|
|
358
|
+
// After force scroll, mark as near-bottom so subsequent
|
|
359
|
+
// streaming chunks keep auto-scrolling until user scrolls up
|
|
360
|
+
if (force) userNearBottom = true;
|
|
336
361
|
|
|
337
|
-
export function scrollToBottom(): void {
|
|
338
362
|
const vs = getVirtualScroll();
|
|
339
363
|
if (vs.active) {
|
|
340
364
|
vs.scrollToBottom();
|
|
@@ -39,6 +39,7 @@ export class VirtualScroll {
|
|
|
39
39
|
private _active = false;
|
|
40
40
|
private rafId: number | null = null;
|
|
41
41
|
private suppressScroll = false;
|
|
42
|
+
private _remeasuring = false;
|
|
42
43
|
private firstVisible = -1;
|
|
43
44
|
private lastVisible = -1;
|
|
44
45
|
|
|
@@ -227,7 +228,9 @@ export class VirtualScroll {
|
|
|
227
228
|
const item: VirtualItem = { id, html, height: EST_HEIGHT };
|
|
228
229
|
this.items.push(item);
|
|
229
230
|
this.markPrefixDirty(this.items.length - 1);
|
|
230
|
-
|
|
231
|
+
// Don't force scroll here — let the ui.ts wrapper decide
|
|
232
|
+
// based on userNearBottom state
|
|
233
|
+
this.scheduleRender();
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
updateItemHtml(idx: number, html: string): void {
|
|
@@ -412,6 +415,8 @@ export class VirtualScroll {
|
|
|
412
415
|
}
|
|
413
416
|
|
|
414
417
|
private remeasureVisible(anchor: ScrollAnchor | null): void {
|
|
418
|
+
if (this._remeasuring) return;
|
|
419
|
+
|
|
415
420
|
const wasAtBottom = this.container.scrollHeight - this.container.scrollTop - this.container.clientHeight < 80;
|
|
416
421
|
|
|
417
422
|
const rects: { idx: number; newH: number }[] = [];
|
|
@@ -431,12 +436,18 @@ export class VirtualScroll {
|
|
|
431
436
|
}
|
|
432
437
|
}
|
|
433
438
|
if (!heightChanged) return;
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
439
|
+
|
|
440
|
+
this._remeasuring = true;
|
|
441
|
+
try {
|
|
442
|
+
this.applyCurrentSpacers();
|
|
443
|
+
if (wasAtBottom) {
|
|
444
|
+
this.scrollToBottom();
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
this.restoreScrollAnchor(anchor);
|
|
448
|
+
} finally {
|
|
449
|
+
this._remeasuring = false;
|
|
438
450
|
}
|
|
439
|
-
this.restoreScrollAnchor(anchor);
|
|
440
451
|
}
|
|
441
452
|
|
|
442
453
|
/** Synchronous scroll — cancel pending RAF, update spacers, render directly */
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{b as e,m as t,v as n}from"./settings-CxZuFlXv.js";export{t as loadSettings,n as savePerCli,e as updateSettings};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./skills-CGd2AfXY.js";export{e as loadSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./slash-commands-CG3D5Bh-.js";export{e as loadCommands};
|