@recombine-ai/bosun 0.20.1 → 0.20.3
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/build/_app/immutable/assets/0.CdQBFG7k.css +1 -0
- package/build/_app/immutable/assets/0.CdQBFG7k.css.br +0 -0
- package/build/_app/immutable/assets/0.CdQBFG7k.css.gz +0 -0
- package/build/_app/immutable/chunks/{BMXNEmOt.js → BFUe72xu.js} +1 -1
- package/build/_app/immutable/chunks/BFUe72xu.js.br +0 -0
- package/build/_app/immutable/chunks/BFUe72xu.js.gz +0 -0
- package/build/_app/immutable/chunks/Bmkwccsg.js +1 -0
- package/build/_app/immutable/chunks/Bmkwccsg.js.br +0 -0
- package/build/_app/immutable/chunks/Bmkwccsg.js.gz +0 -0
- package/build/_app/immutable/chunks/CCtAgMW8.js +64 -0
- package/build/_app/immutable/chunks/CCtAgMW8.js.br +0 -0
- package/build/_app/immutable/chunks/CCtAgMW8.js.gz +0 -0
- package/build/_app/immutable/chunks/CZcJNBdK.js +1 -0
- package/build/_app/immutable/chunks/CZcJNBdK.js.br +2 -0
- package/build/_app/immutable/chunks/CZcJNBdK.js.gz +0 -0
- package/build/_app/immutable/chunks/DdNCOsWe.js +3 -0
- package/build/_app/immutable/chunks/DdNCOsWe.js.br +0 -0
- package/build/_app/immutable/chunks/DdNCOsWe.js.gz +0 -0
- package/build/_app/immutable/chunks/{Dne1wF_T.js → U2g-17s7.js} +1 -1
- package/build/_app/immutable/chunks/U2g-17s7.js.br +0 -0
- package/build/_app/immutable/chunks/U2g-17s7.js.gz +0 -0
- package/build/_app/immutable/entry/{app.CmqNz4dP.js → app.L5djN6KO.js} +2 -2
- package/build/_app/immutable/entry/app.L5djN6KO.js.br +0 -0
- package/build/_app/immutable/entry/app.L5djN6KO.js.gz +0 -0
- package/build/_app/immutable/entry/start.CGCxa4r9.js +1 -0
- package/build/_app/immutable/entry/start.CGCxa4r9.js.br +0 -0
- package/build/_app/immutable/entry/start.CGCxa4r9.js.gz +0 -0
- package/build/_app/immutable/nodes/{0.7_4gjAOP.js → 0.DxT2ZCBH.js} +1 -1
- package/build/_app/immutable/nodes/0.DxT2ZCBH.js.br +0 -0
- package/build/_app/immutable/nodes/0.DxT2ZCBH.js.gz +0 -0
- package/build/_app/immutable/nodes/{1.BDUoE6Lf.js → 1.CuGmyB-B.js} +1 -1
- package/build/_app/immutable/nodes/1.CuGmyB-B.js.br +2 -0
- package/build/_app/immutable/nodes/1.CuGmyB-B.js.gz +0 -0
- package/build/_app/immutable/nodes/16.RilBjs7p.js +3 -0
- package/build/_app/immutable/nodes/16.RilBjs7p.js.br +0 -0
- package/build/_app/immutable/nodes/16.RilBjs7p.js.gz +0 -0
- package/build/_app/immutable/nodes/17.lZCHazN-.js +11 -0
- package/build/_app/immutable/nodes/17.lZCHazN-.js.br +0 -0
- package/build/_app/immutable/nodes/17.lZCHazN-.js.gz +0 -0
- package/build/_app/immutable/nodes/{2.BBdgkEgn.js → 2.47DRuv-7.js} +1 -1
- package/build/_app/immutable/nodes/2.47DRuv-7.js.br +0 -0
- package/build/_app/immutable/nodes/2.47DRuv-7.js.gz +0 -0
- package/build/_app/immutable/nodes/3.BTFj2TcK.js +1 -0
- package/build/_app/immutable/nodes/3.BTFj2TcK.js.br +0 -0
- package/build/_app/immutable/nodes/3.BTFj2TcK.js.gz +0 -0
- package/build/_app/immutable/nodes/{4.Dc4ohbhz.js → 4.D7rKFBIq.js} +1 -1
- package/build/_app/immutable/nodes/4.D7rKFBIq.js.br +0 -0
- package/build/_app/immutable/nodes/4.D7rKFBIq.js.gz +0 -0
- package/build/_app/immutable/nodes/{6.B1NLkNvV.js → 6.C7VHMxJG.js} +1 -1
- package/build/_app/immutable/nodes/6.C7VHMxJG.js.br +0 -0
- package/build/_app/immutable/nodes/6.C7VHMxJG.js.gz +0 -0
- package/build/_app/immutable/nodes/{8.BCatMgwB.js → 8.B-2mfKlr.js} +1 -1
- package/build/_app/immutable/nodes/8.B-2mfKlr.js.br +0 -0
- package/build/_app/immutable/nodes/8.B-2mfKlr.js.gz +0 -0
- package/build/_app/immutable/nodes/{9.t9Xho5xQ.js → 9.DGHLzn6-.js} +1 -1
- package/build/_app/immutable/nodes/9.DGHLzn6-.js.br +0 -0
- package/build/_app/immutable/nodes/9.DGHLzn6-.js.gz +0 -0
- package/build/_app/version.json +1 -1
- package/build/_app/version.json.br +0 -0
- package/build/_app/version.json.gz +0 -0
- package/build/index.html +10 -10
- package/build/index.html.br +0 -0
- package/build/index.html.gz +0 -0
- package/dist/index.js +61 -17
- package/dist/index.js.map +2 -2
- package/dist/types/backend/server.d.ts +1 -1
- package/dist/types/backend/telescope/router.d.ts +1 -1
- package/dist/types/lib/api-telescope/types.d.ts +29 -0
- package/package.json +1 -1
- package/build/_app/immutable/assets/0.CDmx-FLf.css +0 -1
- package/build/_app/immutable/assets/0.CDmx-FLf.css.br +0 -0
- package/build/_app/immutable/assets/0.CDmx-FLf.css.gz +0 -0
- package/build/_app/immutable/chunks/B9BVEgll.js +0 -1
- package/build/_app/immutable/chunks/B9BVEgll.js.br +0 -2
- package/build/_app/immutable/chunks/B9BVEgll.js.gz +0 -0
- package/build/_app/immutable/chunks/BMXNEmOt.js.br +0 -0
- package/build/_app/immutable/chunks/BMXNEmOt.js.gz +0 -0
- package/build/_app/immutable/chunks/Byx1piFp.js +0 -3
- package/build/_app/immutable/chunks/Byx1piFp.js.br +0 -0
- package/build/_app/immutable/chunks/Byx1piFp.js.gz +0 -0
- package/build/_app/immutable/chunks/DnNg4NpV.js +0 -1
- package/build/_app/immutable/chunks/DnNg4NpV.js.br +0 -0
- package/build/_app/immutable/chunks/DnNg4NpV.js.gz +0 -0
- package/build/_app/immutable/chunks/Dne1wF_T.js.br +0 -0
- package/build/_app/immutable/chunks/Dne1wF_T.js.gz +0 -0
- package/build/_app/immutable/chunks/MIEISUXS.js +0 -64
- package/build/_app/immutable/chunks/MIEISUXS.js.br +0 -0
- package/build/_app/immutable/chunks/MIEISUXS.js.gz +0 -0
- package/build/_app/immutable/entry/app.CmqNz4dP.js.br +0 -0
- package/build/_app/immutable/entry/app.CmqNz4dP.js.gz +0 -0
- package/build/_app/immutable/entry/start.C_0LKZp5.js +0 -1
- package/build/_app/immutable/entry/start.C_0LKZp5.js.br +0 -0
- package/build/_app/immutable/entry/start.C_0LKZp5.js.gz +0 -0
- package/build/_app/immutable/nodes/0.7_4gjAOP.js.br +0 -0
- package/build/_app/immutable/nodes/0.7_4gjAOP.js.gz +0 -0
- package/build/_app/immutable/nodes/1.BDUoE6Lf.js.br +0 -2
- package/build/_app/immutable/nodes/1.BDUoE6Lf.js.gz +0 -0
- package/build/_app/immutable/nodes/16.mD6XiwAU.js +0 -3
- package/build/_app/immutable/nodes/16.mD6XiwAU.js.br +0 -0
- package/build/_app/immutable/nodes/16.mD6XiwAU.js.gz +0 -0
- package/build/_app/immutable/nodes/17.CCdGfMvB.js +0 -10
- package/build/_app/immutable/nodes/17.CCdGfMvB.js.br +0 -0
- package/build/_app/immutable/nodes/17.CCdGfMvB.js.gz +0 -0
- package/build/_app/immutable/nodes/2.BBdgkEgn.js.br +0 -0
- package/build/_app/immutable/nodes/2.BBdgkEgn.js.gz +0 -0
- package/build/_app/immutable/nodes/3.Bb12zNlk.js +0 -1
- package/build/_app/immutable/nodes/3.Bb12zNlk.js.br +0 -0
- package/build/_app/immutable/nodes/3.Bb12zNlk.js.gz +0 -0
- package/build/_app/immutable/nodes/4.Dc4ohbhz.js.br +0 -0
- package/build/_app/immutable/nodes/4.Dc4ohbhz.js.gz +0 -0
- package/build/_app/immutable/nodes/6.B1NLkNvV.js.br +0 -0
- package/build/_app/immutable/nodes/6.B1NLkNvV.js.gz +0 -0
- package/build/_app/immutable/nodes/8.BCatMgwB.js.br +0 -0
- package/build/_app/immutable/nodes/8.BCatMgwB.js.gz +0 -0
- package/build/_app/immutable/nodes/9.t9Xho5xQ.js.br +0 -0
- package/build/_app/immutable/nodes/9.t9Xho5xQ.js.gz +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{B as e,Dt as t,E as n,F as r,G as i,H as a,I as o,L as s,N as c,Nt as l,O as u,Ot as d,Pt as f,S as p,V as m,a as h,at as g,b as _,dt as v,et as y,gt as b,it as x,j as S,k as C,l as w,m as ee,ot as T,pt as E,r as D,st as O,tt as k,x as te,z as A}from"../chunks/CPCsWwEy.js";import"../chunks/xihTtKlq.js";import{r as j,t as M}from"../chunks/oarl--hZ.js";import{t as N}from"../chunks/6OCsQ6r7.js";import{t as P}from"../chunks/Cf3l6QEG.js";import{t as F}from"../chunks/DWoqp3ac.js";import{t as ne}from"../chunks/B9YnyJ2j.js";import{c as re,i as I,o as ie,s as L}from"../chunks/By9tvIIw.js";import{r as ae}from"../chunks/BOHUKGg_.js";import{t as oe}from"../chunks/D3fLfD-Y.js";import{a as se,i as ce,n as le,o as ue,r as de,s as R,t as fe}from"../chunks/
|
|
1
|
+
import{B as e,Dt as t,E as n,F as r,G as i,H as a,I as o,L as s,N as c,Nt as l,O as u,Ot as d,Pt as f,S as p,V as m,a as h,at as g,b as _,dt as v,et as y,gt as b,it as x,j as S,k as C,l as w,m as ee,ot as T,pt as E,r as D,st as O,tt as k,x as te,z as A}from"../chunks/CPCsWwEy.js";import"../chunks/xihTtKlq.js";import{r as j,t as M}from"../chunks/oarl--hZ.js";import{t as N}from"../chunks/6OCsQ6r7.js";import{t as P}from"../chunks/Cf3l6QEG.js";import{t as F}from"../chunks/DWoqp3ac.js";import{t as ne}from"../chunks/B9YnyJ2j.js";import{c as re,i as I,o as ie,s as L}from"../chunks/By9tvIIw.js";import{r as ae}from"../chunks/BOHUKGg_.js";import{t as oe}from"../chunks/D3fLfD-Y.js";import{a as se,i as ce,n as le,o as ue,r as de,s as R,t as fe}from"../chunks/DdNCOsWe.js";var pe=s(`<span class="min-w-0 flex-1 truncate text-left"> </span> <!>`,1),z=s(`<div class="flex items-start gap-2"><div class="min-w-0"><div class="truncate p-1 text-sm text-rc-gray-300 group-hover:text-rc-gray-200"> </div> <div> </div></div></div>`),B=s(`<div class="mt-1 max-h-96 w-max min-w-full max-w-[min(26rem,90vw)] overflow-y-auto overflow-x-hidden rounded-lg border border-rc-gray-110 bg-rc-gray-930 backdrop-blur-2xl" role="listbox"></div>`),V=s(`<div><!> <!></div>`);function H(e,n){d(n,!0);let a=h(n,`class`,3,``),o=E(!1),s=E(null),l=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function p(){v(o,!i(o))}function m(e){n.onSelect(e),v(o,!1)}function _(e){return(e.lastMessage??``).trim()||`No messages`}function S(e,t=50,n=`…`){if(!e)return``;if(e.length<=t)return e;let r=e.slice(0,t+1),i=Math.max(r.lastIndexOf(` `),r.lastIndexOf(`\xA0`),r.lastIndexOf(` `),r.lastIndexOf(`
|
|
2
2
|
`),r.lastIndexOf(`\r`));return(i>0?r.slice(0,i):e.slice(0,t)).trimEnd()+n}function w(e){e.key===`ArrowDown`&&!i(o)?(v(o,!0),e.preventDefault()):e.key===`ArrowUp`&&i(o)&&(v(o,!1),e.preventDefault())}function ee(e){let t=e.getDate(),n=l[e.getMonth()],r=e.getHours(),i=r>=12?`PM`:`AM`;r%=12,r===0&&(r=12);let a=String(e.getMinutes()).padStart(2,`0`),o=new Date,s=e.getFullYear();return`${t} ${n}${s===o.getFullYear()?``:` ${s}`}, ${r}:${a} ${i}`}function D(e){return ee(new Date(e.createdAt))}let O=b(()=>n.conversations.find(e=>e.conversationId===n.currentConversationId)??null),k=b(()=>i(O)?D(i(O)):`History`);var A=V(),j=x(A);N(j,{variant:`ghost`,get"aria-expanded"(){return i(o)},"aria-haspopup":`listbox`,"aria-controls":`history-dropdown`,onclick:p,onkeydown:w,class:`inline-flex w-40 items-center rounded-lg border border-transparent !bg-rc-gray-700 !px-3 !pb-1 !pt-[5px] text-rc-gray-200 hover:border hover:border-rc-gray-500 focus:outline-none focus:ring-0`,get el(){return i(s)},set el(e){v(s,e,!0)},children:(e,t)=>{var n=pe(),a=g(n),s=x(a,!0);f(a);var l=T(a,2);{let e=b(()=>`size-7 shrink-0 text-rc-gray-500 transition-transform duration-200 `+(i(o)?`rotate-180`:``));P(l,{name:`chevron-down`,get class(){return i(e)}})}y(()=>c(s,i(k))),r(e,n)},$$slots:{default:!0}});var M=T(j,2);R(M,{id:`history-dropdown`,get open(){return i(o)},onClose:()=>v(o,!1),get anchorEl(){return i(s)},placement:`bottom-start`,offset:[0,1],children:e=>{var t=B();u(t,21,()=>n.conversations,C,(e,t)=>{{let a=b(()=>i(t).conversationId===n.currentConversationId);N(e,{variant:`ghost`,size:`small`,role:`option`,get"aria-selected"(){return i(a)},onclick:()=>m(i(t).conversationId),class:`group w-full rounded-none border-b border-rc-gray-110 py-2 pr-3 text-left backdrop-blur-2xl last:border-b-0 hover:bg-rc-gray-700 focus:bg-rc-gray-400`,children:(e,a)=>{var o=z(),s=x(o),l=x(s),u=x(l,!0);f(l);var d=T(l,2),p=x(d,!0);f(d),f(s),f(o),y((e,r)=>{c(u,e),te(d,1,`truncate p-1 text-base font-semibold `+(i(t).conversationId===n.currentConversationId?`text-rc-green-200`:`text-rc-gray-100`)),c(p,r)},[()=>D(i(t)),()=>S(_(i(t)))]),r(e,o)},$$slots:{default:!0}})}}),f(t),r(e,t)},$$slots:{default:!0}}),f(A),y(()=>te(A,1,`relative ${a()}`)),r(e,A),t()}var U=s(`<dialog class="dialog m-auto bg-transparent p-0 text-rc-gray-100 shadow-md svelte-jby388"><!> <!></dialog>`);function me(e,i){d(i,!0);let a,o=h(i,`showCloseButton`,3,!1),s=h(i,`onClose`,3,()=>{}),c=h(i,`onOpen`,3,()=>{}),u=h(i,`isOpen`,3,!1);k(()=>{u()?(console.log(`show`),a?.showModal(),c()()):a?.open&&(console.log(`close`),a.close())});function p(){s()()}D(()=>(a.addEventListener(`close`,p),()=>{a.removeEventListener(`close`,p)}));function g(e){e.target===a&&a.close()}var _=U(),v=x(_);n(v,()=>i.children);var y=T(v,2),b=e=>{N(e,{variant:`ghost`,onclick:()=>a.close(),class:`absolute right-2 top-2`,children:(e,t)=>{l();var n=A(`✕`);r(e,n)},$$slots:{default:!0}})};S(y,e=>{o()&&e(b)}),f(_),w(_,e=>a=e,()=>a),m(`mousedown`,_,g),r(e,_),t()}e([`mousedown`]);function he(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.text,r=n.lastSeen,i=n.uses;if(typeof e!=`string`||typeof r!=`number`||!Number.isFinite(r)||typeof i!=`number`||!Number.isFinite(i))continue;let a=e.trim();a&&t.push({text:a,lastSeen:r,uses:i})}return t.sort((e,t)=>t.lastSeen-e.lastSeen),t}function ge(e,t,n=2e3){let r=t.trim();if(!r)return e;let i=(e[0]?.lastSeen??0)+1,a=e.findIndex(e=>e.text===r),o;if(a!==-1){let t=e[a];o=[{text:t.text,lastSeen:i,uses:(t.uses??0)+1},...e.slice(0,a),...e.slice(a+1)]}else o=[{text:r,lastSeen:i,uses:1},...e];return o.length>n?o.slice(0,n):o}function _e(e,t,n=2e3){if(!t.length)return e;if(!e.length)return t;let r=e[0]?.lastSeen??0,i=(t[0]?.lastSeen??0)>r?t:t.map((e,n)=>({...e,lastSeen:r+(t.length-n)})),a=new Map;for(let t of e)a.set(t.text,t);for(let e of i){let t=a.get(e.text);if(!t){a.set(e.text,e);continue}a.set(e.text,{text:e.text,lastSeen:Math.max(t.lastSeen,e.lastSeen),uses:t.uses+e.uses})}return Array.from(a.values()).sort((e,t)=>t.lastSeen-e.lastSeen).slice(0,n)}function ve(e,t,n=5){if(!t.length)return[];let r=e.trim().toLowerCase(),i=W(e,!1).text,a=/\s$/u.test(e);if(!W(e,!0).text)return[];let o=[];for(let e of t){let t=W(e.text);if(!t.text||e.text.trim().toLowerCase()===r)continue;let n=ye(t,e.text,i,a);n&&o.push({item:e,match:n})}return o.sort((e,t)=>e.match.kindRank===t.match.kindRank?e.match.span===t.match.span?e.match.start===t.match.start?e.item.lastSeen===t.item.lastSeen?e.item.uses===t.item.uses?e.item.text.length-t.item.text.length:t.item.uses-e.item.uses:t.item.lastSeen-e.item.lastSeen:e.match.start-t.match.start:e.match.span-t.match.span:e.match.kindRank-t.match.kindRank),o.slice(0,n).map(e=>({text:e.item.text,prefixEndIndex:e.match.prefixEndIndex,segments:xe(e.item.text,e.match.ranges)}))}function W(e,t=!0){let n=[],r=[];for(let t=0;t<e.length;t++){let i=G(e[t]);if(i===` `){if(!n.length)continue;let e=n.length-1;if(n[e]===` `){r[e][1]=t+1;continue}}n.push(i),r.push([t,t+1])}return t&&n[n.length-1]===` `&&(n.pop(),r.pop()),{text:n.join(``),ranges:r}}function G(e){if(/\s/u.test(e))return` `;try{return/[\p{P}\p{S}]/u.test(e)?` `:e.toLowerCase()}catch{return/[^a-z0-9\s]/i.test(e)?` `:e.toLowerCase()}}function ye(e,t,n,r){if(!e.text)return null;if(e.text.startsWith(n)){let e=be(t,n,r)??t.length,i=Math.max(0,Math.min(t.length,e));return{kindRank:0,start:0,span:n.length,ranges:[[0,i]],prefixEndIndex:i}}let i=e.text.indexOf(n);return i===-1?null:{kindRank:J(e.text,i,n.length),start:i,span:n.length,ranges:Y(e,i,i+n.length),prefixEndIndex:t.length}}function K(e,t){return t<=0||e[t-1]===` `}function q(e,t){return t>=e.length||e[t]===` `}function J(e,t,n){let r=K(e,t),i=q(e,t+n);return r&&i?1:r?2:3}function Y(e,t,n){let r=Math.max(0,Math.min(e.ranges.length,t)),i=Math.max(r,Math.min(e.ranges.length,n));return X(e.ranges.slice(r,i))}function be(e,t,n){if(!t)return null;let r=``,i=!0;for(let a=0;a<e.length;a++){let o=e[a],s;if(/\s/u.test(o))s=` `;else try{s=/[\p{P}\p{S}]/u.test(o)?` `:o.toLowerCase()}catch{s=/[^a-z0-9\s]/i.test(o)?` `:o.toLowerCase()}if(s===` `){if(i)continue;r+=` `,i=!0}else r+=s,i=!1;if(r.length===t.length){if(r!==t)return null;let i=a+1;if(n&&t.endsWith(` `)){let t=i;for(;t<e.length;){let n=e[t];if(/\s/u.test(n)){t+=1;continue}try{if(/[\p{P}\p{S}]/u.test(n)){t+=1;continue}}catch{if(/[^a-z0-9\s]/i.test(n)){t+=1;continue}}break}i=t}return i}if(r.length>t.length)return null}return null}function xe(e,t){let n=X(t);if(!n.length)return[{text:e,matched:!1}];let r=[],i=0;for(let[t,a]of n)t>i&&r.push({text:e.slice(i,t),matched:!1}),r.push({text:e.slice(t,a),matched:!0}),i=a;return i<e.length&&r.push({text:e.slice(i),matched:!1}),r.filter(e=>e.text.length>0)}function X(e){if(!e.length)return[];let t=e.map(([e,t])=>[Math.max(0,e),Math.max(0,t)]).filter(([e,t])=>t>e).sort((e,t)=>e[0]-t[0]||e[1]-t[1]);if(!t.length)return[];let n=[[t[0][0],t[0][1]]];for(let e=1;e<t.length;e++){let[r,i]=t[e],a=n[n.length-1];if(r<=a[1]){a[1]=Math.max(a[1],i);continue}n.push([r,i])}return n}var Se=s(`<form><h2 class="text-l mb-4 text-gray-300">Image URL</h2> <!> <!></form>`),Ce=s(`<div class="my-2 flex w-full justify-center"><div class="rounded-full border border-rc-gray-650 bg-rc-gray-800/40 px-3 py-1 text-xs text-rc-gray-200"> </div></div>`),we=s(`<div class="rounded-lg border border-rc-green-450 bg-transparent px-3 py-2 text-sm text-rc-gray-300">Generating 9 more variants…</div>`),Te=s(`<div class="rounded-lg border border-red-500/70 bg-red-950/20 px-3 py-2 text-sm text-red-200"> </div>`),Ee=s(`<button type="button"><div class="whitespace-pre-line break-words"> </div></button>`),De=s(`<div class="ml-7 mt-2 flex flex-col gap-2"><!> <!> <!></div>`),Oe=s(`<!> <div class="log-element"><div><!></div> <!></div>`,1),ke=s(`<div class="absolute bottom-2 left-2 right-2 z-10 flex items-center gap-3 rounded-lg border border-rc-green-450 bg-rc-gray-930/90 px-3 py-3 font-semibold text-rc-gray-100 shadow-inner-white-soft backdrop-blur-3xl"><span>Choose a variant above to continue</span> <button type="button" class="rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-300 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-100 focus:outline-none focus-visible:outline-none disabled:cursor-wait disabled:opacity-50">Regenerate</button> <button type="button" class="rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-300 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-100 focus:outline-none focus-visible:outline-none">Cancel</button></div>`),Ae=s(`<div class="absolute bottom-16 left-2 right-2 z-20 rounded-lg border border-red-500/60 bg-red-950/90 px-3 py-2 text-sm text-red-100 shadow-lg" role="alert"> </div>`),je=s(`<span> </span>`),Me=s(`<button type="button" role="option" tabindex="-1"></button>`),Ne=s(`<div class="absolute bottom-full left-0 right-0 mb-1 max-h-60 overflow-y-auto rounded-lg border border-rc-gray-110 bg-rc-gray-930 shadow-inner-white-soft backdrop-blur-2xl" role="listbox"></div>`),Pe=s(`<div class="pointer-events-none absolute inset-0 z-10 overflow-hidden rounded-lg" aria-hidden="true"><div class="whitespace-pre text-rc-gray-400/70"><span class="invisible"> </span><span> </span></div></div>`),Fe=s(`<!> <form><fieldset class="absolute bottom-2 left-2 right-2 z-10 flex gap-2 disabled:opacity-35"><div class="relative flex-1"><!> <!> <button type="button" class="absolute bottom-0 left-3 top-0 z-20 inline-flex items-center border-r border-rc-gray-500/70 bg-transparent pr-2 text-base font-semibold leading-6 text-rc-gray-300 transition-colors duration-75 hover:text-rc-gray-300 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50"> </button> <!></div> <!> <!></fieldset></form>`,1),Ie=s(`<div class="rc-scroll min-h-0 flex-1 overflow-y-auto pr-1"></div> <!>`,1),Le=s(`<!> <!>`,1);function Z(e,n){d(n,!0);let s=h(n,`promptEditProposalId`,3,null),D=h(n,`analyzeDisabled`,3,!1),M=h(n,`variantSourceTrace`,3,null),ae=h(n,`variantChoices`,19,()=>[]),se=h(n,`variantLoading`,3,!1),R=h(n,`variantApplyingId`,3,null),pe=h(n,`variantError`,3,null),z=O(new Set),B=E(``),V=E(``),H=E(``),U,W=E(!1),G=E(null),ye=E(``),K=E(!1),q=E(`user`),J=E(null),Y=E(O([])),be=E(null),xe=E(!1),X=E(!1),Z=E(null),Q=b(()=>ve(i(B),i(Y))),Re=b(()=>i(Z)==null?null:i(Q)[i(Z)]??null),ze=b(()=>i(Re)?i(Re).text.slice(i(Re).prefixEndIndex):``),Be=b(()=>!M()&&!i(H)&&i(B).trim().length===0);k(()=>{if(typeof window>`u`)return;if(!i(G)){v(ye,``);return}let e=window.getComputedStyle(i(G)),t=`calc(${e.paddingTop} + ${e.borderTopWidth})`,n=`calc(${e.paddingRight} + ${e.borderRightWidth})`,r=`calc(${e.paddingBottom} + ${e.borderBottomWidth})`,a=`calc(${e.paddingLeft} + ${e.borderLeftWidth})`;v(ye,[`padding:${t} ${n} ${r} ${a}`,`font:${e.font}`,`letter-spacing:${e.letterSpacing}`,`line-height:${e.lineHeight}`,`text-indent:${e.textIndent}`,`text-transform:${e.textTransform}`,`text-align:${e.textAlign}`,`box-sizing:${e.boxSizing}`].join(`;`),!0)}),k(()=>{i(Z)!=null&&i(Z)>=i(Q).length&&v(Z,null)});let Ve=b(()=>M()||!i(xe)||i(X)?!1:i(Q).length>0);function He(e){v(B,e.text,!0),v(Z,null),v(X,!0)}function Ue(){v(xe,!0),v(X,!1)}function We(){v(xe,!1),v(Z,null),v(X,!1)}function Ge(){v(Z,null),v(X,!1)}function Ke(e){if(e.key===`Escape`){i(Ve)&&e.preventDefault(),v(X,!0),v(Z,null);return}if(e.key===`ArrowUp`||e.key===`ArrowDown`){if(!i(Q).length)return;i(X)&&v(X,!1),e.preventDefault();let t=i(Q).length-1;if(i(Z)===null)v(Z,e.key===`ArrowUp`?t:0,!0);else{let n=e.key===`ArrowUp`?-1:1;v(Z,Math.max(0,Math.min(t,i(Z)+n)),!0)}return}if(e.key===`Enter`||e.key===`Tab`&&!e.shiftKey){if(i(Z)===null)return;let t=i(Q)[i(Z)];if(!t)return;e.preventDefault(),He(t);return}}let qe=null,Je=!1,Ye=0;function Xe(){typeof window>`u`||U&&(!Je&&z.has(U)||(qe??=requestAnimationFrame(()=>{if(qe=null,!U||!Je&&z.has(U))return;let e=U.scrollHeight-(U.scrollTop+U.clientHeight),t=Je||e>U.clientHeight?`auto`:`smooth`;U.scrollTo({top:U.scrollHeight,behavior:t}),Je=!1})))}k(()=>{let e=I.length;e===0&&Ye>0&&(Je=!0,U&&z.delete(U)),Ye=e,e>0&&Xe()});function Ze(e){e.scrollTop+e.clientHeight+200>e.scrollHeight?z.delete(e):z.add(e)}function Qe(e){i(K)||(i(B).trim().length>0||i(H))&&(v(Y,ge(i(Y),i(B)),!0),n.onmessage({sender:e,text:i(B),imageUrl:i(H)}),v(H,``),v(B,``),v(q,`user`),v(X,!1),v(Z,null))}function $e(e){e.preventDefault(),Qe(i(q))}function et(){v(q,i(q)===`system`?`user`:`system`,!0),requestAnimationFrame(()=>i(G)?.focus())}function tt(e){e.preventDefault(),v(H,i(V),!0),v(V,``),v(W,!1)}function nt(e){return e&&typeof e.renderedPrompt==`string`?e.renderedPrompt:null}function rt(e,t){for(let n=t-1;n>=0;n--){let t=e[n];if(re(t)&&ne(t.name)&&nt(t))return t}for(let n=t-1;n>=0;n--){let t=e[n];if(re(t)&&t.name===`prewarm`&&nt(t))return t}return null}function it(e){return(e.eventName===`received-message`||e.eventName===`llm-handler-stream-requested`)&&!String(e.content??``).trim()?!1:e.eventName===`received-message`||e.eventName===`llm-handler-stream-requested`||e.eventName===`finished-main-streaming-step`||e.eventName===`sent-message`||e.eventName===`transfer-requested`||e.eventName===`hangup-requested`}function at(e){return!!(n.agentId&&n.agentId.trim())&&e.eventName!==`transfer-requested`&&(e.eventName===`finished-main-streaming-step`||e.eventName===`sent-message`)}function ot(e){return e.role===`user`||e.eventName===`received-message`||e.eventName===`llm-handler-stream-requested`}function st(e){let t=String(e??``).trim();return!t||/^\[image\]\s+/.test(t)?``:t}function ct(e){let t=e?.bosunInputMessageSender;return t===`system`?`system`:t===`user`?`user`:e.role===`system`?`system`:`user`}function lt(e){if(!n.onRevertToState)return;let t=e?.bosunPrevStateId,r=typeof t==`string`&&t.trim().length>0?t:null;n.onRevertToState(r);let a=typeof e?.bosunUserMessage==`string`?e.bosunUserMessage:e.content;v(B,st(a),!0),v(q,ct(e),!0),v(X,!1),v(Z,null),requestAnimationFrame(()=>{try{i(G)?.focus(),i(G)?.select()}catch{}})}function ut(){n.agentType===`text`?v(W,!0):n.agentType===`voice`&&n.onHangup?.()}let dt=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`];function ft(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,`0`)}-${String(t.getDate()).padStart(2,`0`)}`}function pt(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:`${t.getDate()} ${dt[t.getMonth()]} ${t.getFullYear()}`}let $=b(()=>I.filter(e=>ie(e)||re(e)?!0:L(e)?it(e):!1)),mt=b(()=>I.findLast(e=>L(e))?.eventName===`hangup-requested`),ht=b(()=>{let e=i($).map((e,t)=>({entry:e,index:t})).reverse().find(({entry:e,index:t})=>!L(e)||!at(e)?!1:i($).slice(0,t).some(e=>L(e)&&ot(e)));return e&&L(e.entry)?e.entry:null}),gt=b(()=>{let e=i(ht);if(!e)return null;try{let t=_t(e);return{model:t.model,stringifiedConversation:t.stringifiedConversation,response:t.response}}catch{return null}});function _t(e){if(!(n.agentId??``).trim())throw Error(`Agent id is not available; cannot analyze`);let t=I.indexOf(e);if(t===-1)throw Error(`Could not locate trace in chat history`);let r=de(I,t,{requireRenderedPrompt:!0});if(!r)throw Error(`Could not find main step trace for this message`);let i=typeof r.renderedPrompt==`string`?r.renderedPrompt:``;if(!i.trim())throw Error(`Main step rendered prompt is missing`);let a=typeof r.stringifiedConversation==`string`&&r.stringifiedConversation.trim()?r.stringifiedConversation:ce(I,t)??``,o=String(e?.content??``);if(!o.trim())throw Error(`Message content is missing`);let s=typeof r?.model==`string`?String(r.model):void 0,c=e?.createdAt;return{trace:e,stepTrace:r,renderedPrompt:i,stringifiedConversation:a,response:o,model:s,createdAt:typeof c==`number`&&Number.isFinite(c)?c:void 0}}function vt(e){if(n.onAnalyzeTrace)try{v(J,null),n.onAnalyzeTrace(_t(e))}catch(e){console.error(e),v(J,e instanceof Error?e.message:String(e),!0)}}function yt(e){if(n.onRegenerateTrace)try{v(J,null),n.onRegenerateTrace(e)}catch(e){console.error(e),v(J,e instanceof Error?e.message:String(e),!0)}}async function bt(){if(i(K))return;let e=i(gt);if(e){v(X,!0),v(Z,null),v(K,!0);try{let t=await F.agents.generateUserResponse.mutate(e);v(B,t.text,!0),v(X,!0),v(Z,null),requestAnimationFrame(()=>{try{i(G)?.focus(),i(G)?.setSelectionRange(t.text.length,t.text.length)}catch{}})}catch(e){console.error(`Failed to generate suggested user response`,e)}finally{v(K,!1)}}}k(()=>{if(typeof window>`u`)return;let e=(n.agentId??``).trim();if(!e||e===i(be))return;v(be,e,!0),v(Y,[],!0);let t=e,r=e;F.agents.userMessageHistory.query({agentId:t}).then(e=>{if(i(be)!==r)return;let t=he(e);v(Y,_e(t,i(Y)),!0),v(Z,null)}).catch(e=>{console.error(`Failed to load user message history`,e),i(be)===r&&(v(Y,[],!0),v(Z,null))})}),k(()=>{let e=M(),t=ae().length,n=se(),r=pe(),i=R();!e&&!t&&!n&&!r&&!i||Xe()});var xt=Le(),St=g(xt);me(St,{get isOpen(){return i(W)},onClose:()=>v(W,!1),showCloseButton:!0,children:(e,t)=>{j(e,{class:`p-4`,children:(e,t)=>{var n=Se(),o=T(x(n),2);oe(o,{class:`mb-2 w-80`,get value(){return i(V)},set value(e){v(V,e,!0)}});var s=T(o,2);N(s,{variant:`secondary`,type:`submit`,class:`ml-2 p-2`,children:(e,t)=>{l();var n=A(`Attach`);r(e,n)},$$slots:{default:!0}}),f(n),a(`submit`,n,tt),r(e,n)},$$slots:{default:!0}})},$$slots:{default:!0}});var Ct=T(St,2);j(Ct,{get class(){return`relative flex min-h-0 flex-col p-2 pb-16 ${n.class??``}`},children:(e,t)=>{var l=Ie(),d=g(l);u(d,21,()=>i($),C,(e,t,a)=>{let o=b(()=>ft(i(t).createdAt)),l=b(()=>a>0?ft(i($)[a-1].createdAt):null),d=b(()=>pt(i(t).createdAt));var p=Oe(),h=g(p),_=e=>{var t=Ce(),n=x(t),a=x(n,!0);f(n),f(t),y(()=>c(a,i(d))),r(e,t)};S(h,e=>{i(o)&&i(d)&&i(o)!==i(l)&&e(_)});var v=T(h,2),C=x(v),w=x(C),ee=e=>{ue(e,{get trace(){return i(t)}})},E=b(()=>ie(i(t))),O=e=>{{let r=b(()=>de(i($),a)),o=b(()=>n.onAnalyzeTrace?vt:void 0),c=b(()=>n.onRegenerateTrace?yt:void 0),l=b(()=>n.onRevertToState?lt:void 0),u=b(()=>!!n.onSeeVariants&&!M()&&i(t)===i(ht)),d=b(()=>M()&&i(t)===M()?`source`:`none`),f=b(()=>R()===null&&M()&&i(t)===M()?n.onChooseOriginalVariant:void 0),p=b(()=>!!M()&&i(t)===M());le(e,{testCreationMode:`direct`,get trace(){return i(t)},get context(){return n.context},get agentId(){return n.agentId},get promptEditProposalId(){return s()},get testSourceStep(){return i(r)},get testEntries(){return i($)},get analyzeDisabled(){return D()},get onAnalyze(){return i(o)},get onRegenerate(){return i(c)},get onRevert(){return i(l)},get showSeeVariants(){return i(u)},get onSeeVariants(){return n.onSeeVariants},get variantSelectionState(){return i(d)},get onSelectInVariantMode(){return i(f)},get suppressActionRow(){return i(p)}})}},k=b(()=>L(i(t))),A=e=>{{let r=b(()=>ce(i($),a)),o=b(()=>ne(i(t).name)?rt(i($),a):null);fe(e,{testCreationMode:`direct`,get trace(){return i(t)},get agentId(){return n.agentId},get promptEditProposalId(){return s()},get fallbackConversation(){return i(r)},get runtimeContext(){return n.context},get compareTrace(){return i(o)}})}},j=b(()=>re(i(t)));S(w,e=>{i(E)?e(ee):i(k)?e(O,1):i(j)&&e(A,2)}),f(C);var N=T(C,2),P=e=>{var t=De(),a=x(t),o=e=>{var t=we();r(e,t)};S(a,e=>{se()&&e(o)});var s=T(a,2),l=e=>{var t=Te(),n=x(t,!0);f(t),y(()=>c(n,pe())),r(e,t)};S(s,e=>{pe()&&e(l)});var d=T(s,2);u(d,17,ae,e=>e.id,(e,t)=>{var a=Ee(),o=x(a),s=x(o,!0);f(o),f(a),y(()=>{a.disabled=R()!==null,te(a,1,`w-full max-w-[83%] cursor-pointer rounded-lg border border-rc-green-450 bg-transparent p-2 pt-1 text-left text-rc-gray-100 backdrop-blur-md transition-colors hover:bg-rc-green-700 focus:outline-none focus-visible:outline-none disabled:cursor-wait disabled:opacity-70 ${R()===i(t).id?`bg-rc-green-700`:``}`),c(s,i(t).text)}),m(`click`,a,()=>n.onChooseVariant?.(i(t).id)),r(e,a)}),f(t),r(e,t)};S(N,e=>{M()&&i(t)===M()&&e(P)}),f(v),r(e,p)}),f(d),w(d,e=>U=e,()=>U);var h=T(d,2),E=e=>{var t=ke(),i=T(x(t),2),a=T(i,2);f(t),y(()=>i.disabled=!n.onRegenerateVariants||se()||R()!==null),m(`click`,i,()=>n.onRegenerateVariants?.()),m(`click`,a,()=>n.onCancelVariants?.()),r(e,t)},O=e=>{var t=Fe(),s=g(t),l=e=>{var t=Ae(),n=x(t,!0);f(t),y(()=>c(n,i(J))),r(e,t)};S(s,e=>{i(J)&&e(l)});var d=T(s,2),h=x(d),w=x(h),E=x(w),D=e=>{var t=Ne();u(t,23,()=>i(Q),e=>e.text,(e,t,n)=>{var a=Me();u(a,21,()=>i(t).segments,C,(e,t)=>{var n=je(),a=x(n,!0);f(n),y(()=>{te(n,1,p(i(t).matched?`text-rc-green-200`:``)),c(a,i(t).text)}),r(e,n)}),f(a),y(()=>{ee(a,`aria-selected`,i(Z)===i(n)),te(a,1,`w-full select-none border-b border-rc-gray-110 px-3 py-2 text-left font-semibold text-rc-gray-100 last:border-b-0 hover:bg-rc-gray-700/70 ${i(Z)===i(n)?`bg-rc-gray-700/70`:``}`)}),m(`mousedown`,a,e=>{e.preventDefault(),He(i(t))}),r(e,a)}),f(t),r(e,t)};S(E,e=>{i(Ve)&&e(D)});var O=T(E,2);{let e=b(()=>i(q)===`system`?`!border-emerald-500 !pl-[5.5rem] hover:!border-emerald-500 focus:!border-emerald-500`:`!pl-[4.25rem]`),t=b(()=>i(K)?`Generating`:`Enter message...`);oe(O,{variant:`chat`,get class(){return`!text-base !leading-6 !duration-75 ${i(e)??``}`},get placeholder(){return i(t)},autocomplete:`off`,get readonly(){return i(K)},onfocus:Ue,onblur:We,oninput:Ge,onkeydown:Ke,get value(){return i(B)},set value(e){v(B,e,!0)},get el(){return i(G)},set el(e){v(G,e,!0)}})}var k=T(O,2),A=x(k,!0);f(k);var j=T(k,2),M=e=>{var t=Pe(),n=x(t),a=x(n),o=x(a,!0);f(a);var s=T(a),l=x(s,!0);f(s),f(n),f(t),y(()=>{_(n,i(ye)),c(o,i(B)),c(l,i(ze))}),r(e,t)};S(j,e=>{i(Z)!==null&&i(ze)&&e(M)}),f(w);var F=T(w,2);{let e=b(()=>i(K)||!n.agentType);N(F,{size:`small`,variant:`secondary`,get disabled(){return i(e)},onclick:ut,children:(e,t)=>{var i=o(),a=g(i),s=e=>{P(e,{name:`paperclip`})},c=e=>{P(e,{name:`hangup`})};S(a,e=>{n.agentType===`text`?e(s):n.agentType===`voice`&&e(c,1)}),r(e,i)},$$slots:{default:!0}})}var ne=T(F,2),re=e=>{{let t=b(()=>i(K)||!i(gt));N(e,{size:`small`,type:`button`,title:`Generate response`,"aria-label":`Generate response`,get disabled(){return i(t)},class:`inline-flex !w-[59px] items-center justify-center !px-0`,onclick:e=>{e.preventDefault(),bt()},children:(e,t)=>{P(e,{name:`sparkles`})},$$slots:{default:!0}})}},I=e=>{{let t=b(()=>i(q)===`system`?`Send as system`:`Send as user`),n=b(()=>i(q)===`system`?`Send as system`:`Send as user`);N(e,{size:`small`,type:`submit`,get title(){return i(t)},get"aria-label"(){return i(n)},get disabled(){return i(K)},class:`inline-flex !w-[59px] items-center justify-center !px-0`,children:(e,t)=>{P(e,{name:`send`})},$$slots:{default:!0}})}};S(ne,e=>{i(Be)?e(re):e(I,-1)}),f(h),f(d),y(()=>{h.disabled=i(mt),ee(k,`title`,i(q)===`system`?`Switch to user`:`Switch to system`),ee(k,`aria-label`,i(q)===`system`?`Switch to user`:`Switch to system`),k.disabled=i(K),c(A,i(q)===`system`?`System`:`User`)}),a(`submit`,d,$e),m(`click`,k,e=>{e.preventDefault(),e.stopPropagation(),et()}),r(e,t)};S(h,e=>{M()?e(E):e(O,-1)}),a(`scroll`,d,e=>Ze(e.target)),r(e,l)},$$slots:{default:!0}}),r(e,xt),t()}e([`click`,`mousedown`]);var Q=s(`<div class="mt-1 w-max overflow-hidden rounded-lg border border-rc-gray-110 bg-rc-gray-930 shadow-inner-white-soft backdrop-blur-2xl" role="listbox"><!> <!> <!></div>`),Re=s(`<div class="flex h-full items-center justify-center text-sm text-rc-gray-300">Connecting…</div>`),ze=s(`<div class="flex h-full items-center justify-center text-sm text-rc-gray-300">Select an agent to start chatting</div>`),Be=s(`<div class="h-full min-h-0 p-2"><!></div>`),Ve=s(`<div class="relative flex h-full min-h-0 flex-col"><div class="flex flex-none flex-nowrap items-center gap-2 p-2"><!> <div class="ml-auto flex flex-none flex-nowrap items-center gap-2"><!> <!> <!> <!></div></div> <div class="min-h-0 flex-1"><!></div></div>`);function He(e,n){d(n,!0);let{state:a,actions:s}=M(),c=E(!1),u=E(null),p=b(()=>{let e=a.currentStep?.name;return e?Object.values(a.promptEdits).find(t=>t.agentId===a.agentId&&t.step===e)?.id??null:null}),m=E(null),h=null,_=E(!1),y=E(null);b(()=>I.reduce((e,t)=>Math.max(e,ne(t)??0),0)),k(()=>{!I.length&&!ae.length&&i(_)&&v(_,!1)});function C(e){let t=(e||``).trim();return t?t.split(`/`).at(-1)??t:`Agent`}function w(e){if(typeof e!=`number`||!Number.isFinite(e))return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:`${String(t.getHours()).padStart(2,`0`)}:${String(t.getMinutes()).padStart(2,`0`)}:${String(t.getSeconds()).padStart(2,`0`)}`}async function ee(e){if(i(c))return;v(c,!0);let t=s.openPopover(`analyze`),n=w(e.createdAt),r=n?` • ${n}`:``,o=`Analysis — ${C(a.agentId)}${r}`;try{let n=await F.agents.analyzeTrace.mutate({agentId:a.agentId,traceId:e.trace?.traceId,eventName:e.trace.eventName,createdAt:e.createdAt,model:e.model,renderedPrompt:e.renderedPrompt,stringifiedConversation:e.stringifiedConversation,response:e.response,stepTrace:e.stepTrace});if(a.edit.popover?.requestId!==t)return;s.setHighlightQuotes(n.quotes);let r=null;try{r=JSON.stringify(n.raw,null,2)}catch{r=null}s.setPopoverReady(t,{title:o,quotes:n.quotes,rationales:n.rationales,parallelCalls:n.parallelCalls,raw:r})}catch(e){console.error(e);let n=typeof e?.message==`string`?e.message:(()=>{try{return JSON.stringify(e)}catch{return String(e)}})();s.setPopoverError(t,n||`Failed to analyze this response`,{raw:n})}finally{v(c,!1)}}function D(e){return e?I:I.map(e=>{if(!re(e))return e;let{receivedPrompt:t,renderedPrompt:n,...r}=e;return r})}function O(e){v(m,e,!0),h&&clearTimeout(h),h=window.setTimeout(()=>{v(m,null),h=null},2e3)}async function te(){try{await navigator.clipboard.writeText(JSON.stringify(ae,null,2)),O(`logs`)}catch(e){console.error(`Failed to copy logs`,e)}}async function j(e){try{await navigator.clipboard.writeText(JSON.stringify(D(e),null,2)),O(e?`with-prompts`:`without-prompts`)}catch(e){console.error(`Failed to copy traces`,e)}}function P(){L(),s.closePopover(),s.newConversation()}function ne(e){let t=e?.bosunTurn;return typeof t==`number`&&t>0?t:null}function ie(e){L();let t=ne(e);if(!t){console.warn(`Cannot regenerate: this response has no turn metadata`);return}s.regenerateFromTurn(t)}function L(){v(u,null)}function oe(e){let t=I.indexOf(e),n=t===-1?null:de(I,t);return n&&n.receivedContext!==void 0?se(n.receivedContext):{}}function ce(e){return oe(e)}async function le(e){let t=a.conversationId;if(!t)return;let n=s.getPromptOverrides();await s.flushPromptSave(),v(u,{sourceTrace:e,choices:[],loading:!0,applyingId:null,error:null},!0);try{let r=await F.agents.generateVariants.mutate({conversationId:t,context:ce(e),promptOverrides:n,count:9});if(!i(u)||i(u).sourceTrace!==e)return;v(u,{...i(u),choices:r,loading:!1,error:null},!0)}catch(t){if(console.error(`Failed to generate variants`,t),!i(u)||i(u).sourceTrace!==e)return;v(u,{...i(u),choices:[],loading:!1,error:typeof t?.message==`string`?t.message:`Failed to generate variants`},!0)}}function ue(e){le(e)}function fe(){s.hangup()}function pe(){let e=i(u)?.sourceTrace;e&&le(e)}async function z(e){let t=a.conversationId;if(!i(u)||!t)return;let n=i(u).choices.find(t=>t.id===e);if(n){v(u,{...i(u),applyingId:e,error:null},!0);try{await F.agents.commitVariant.mutate({conversationId:t,entries:n.entries}),L(),s.selectConversation(t)}catch(e){if(console.error(`Failed to apply variant`,e),!i(u))return;v(u,{...i(u),applyingId:null,error:typeof e?.message==`string`?e.message:`Failed to apply variant`},!0)}}}function B(){L()}k(()=>{let e=i(u),t=a.agentId,n=e?.sourceTrace;!e||!n||(!t||!I.includes(n))&&v(u,null)});var V=Ve(),U=x(V),me=x(U),he=e=>{H(e,{get conversations(){return a.conversations},get currentConversationId(){return a.conversationId},class:`ml-9`,onSelect:e=>s.selectConversation(e)})};S(me,e=>{a.conversations.length>0&&e(he)});var ge=T(me,2),_e=x(ge);{let e=b(()=>!a.context);N(_e,{variant:`secondary`,size:`small`,get disabled(){return i(e)},get"aria-expanded"(){return a.contextPopoverOpen},"aria-haspopup":`dialog`,get onclick(){return s.toggleContextPopover},children:(e,t)=>{l();var n=A(`Show context`);r(e,n)},$$slots:{default:!0}})}var ve=T(_e,2);{let e=b(()=>!I.length&&!ae.length);N(ve,{variant:`secondary`,size:`small`,get disabled(){return i(e)},get"aria-expanded"(){return i(_)},"aria-haspopup":`listbox`,"aria-controls":`roleplay-copy-dropdown`,onclick:e=>{e.stopPropagation(),v(_,!i(_))},get el(){return i(y)},set el(e){v(y,e,!0)},children:(e,t)=>{var n=o(),a=g(n),s=e=>{var t=A(`Copied logs`);r(e,t)},c=e=>{var t=A(`Copied traces (with prompts)`);r(e,t)},l=e=>{var t=A(`Copied traces (without prompts)`);r(e,t)},u=e=>{var t=A(`Copy...`);r(e,t)};S(a,e=>{i(m)===`logs`?e(s):i(m)===`with-prompts`?e(c,1):i(m)===`without-prompts`?e(l,2):e(u,-1)}),r(e,n)},$$slots:{default:!0}})}var W=T(ve,2);R(W,{id:`roleplay-copy-dropdown`,get open(){return i(_)},onClose:()=>v(_,!1),get anchorEl(){return i(y)},placement:`bottom-end`,offset:[0,1],children:e=>{var t=Q(),n=x(t);{let e=b(()=>!ae.length);N(n,{variant:`ghost`,size:`small`,role:`option`,get disabled(){return i(e)},onclick:e=>{e.stopPropagation(),v(_,!1),te()},class:`block rounded-none border-b border-rc-gray-110 py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400`,children:(e,t)=>{l();var n=A(`Copy logs`);r(e,n)},$$slots:{default:!0}})}var a=T(n,2);{let e=b(()=>!I.length);N(a,{variant:`ghost`,size:`small`,role:`option`,get disabled(){return i(e)},onclick:e=>{e.stopPropagation(),v(_,!1),j(!0)},class:`block rounded-none border-b border-rc-gray-110 py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400`,children:(e,t)=>{l();var n=A(`Copy traces with prompts`);r(e,n)},$$slots:{default:!0}})}var o=T(a,2);{let e=b(()=>!I.length);N(o,{variant:`ghost`,size:`small`,role:`option`,get disabled(){return i(e)},onclick:e=>{e.stopPropagation(),v(_,!1),j(!1)},class:`block rounded-none py-2 pr-3 text-left backdrop-blur-2xl hover:bg-rc-gray-700 focus:bg-rc-gray-400`,children:(e,t)=>{l();var n=A(`Copy traces without prompts`);r(e,n)},$$slots:{default:!0}})}f(t),r(e,t)},$$slots:{default:!0}});var G=T(W,2);N(G,{size:`small`,onclick:P,children:(e,t)=>{l();var n=A(`New chat`);r(e,n)},$$slots:{default:!0}}),f(ge),f(U);var ye=T(U,2),K=x(ye),q=e=>{var t=Re();r(e,t)},J=e=>{var t=ze();r(e,t)},Y=e=>{var t=Be(),n=x(t);{let e=b(()=>i(u)?.sourceTrace??null),t=b(()=>i(u)?.choices??[]),r=b(()=>i(u)?.loading??!1),o=b(()=>i(u)?.applyingId??null),l=b(()=>i(u)?.error??null);Z(n,{class:`h-full min-w-0`,context:null,get agentId(){return a.agentId},get promptEditProposalId(){return i(p)},get agentType(){return a.agentType},onmessage:e=>s.sendChatMessage(e),get analyzeDisabled(){return i(c)},onAnalyzeTrace:ee,onRegenerateTrace:ie,onSeeVariants:ue,onHangup:fe,get variantSourceTrace(){return i(e)},get variantChoices(){return i(t)},get variantLoading(){return i(r)},get variantApplyingId(){return i(o)},get variantError(){return i(l)},onCancelVariants:L,onRegenerateVariants:pe,onChooseOriginalVariant:B,onChooseVariant:z})}f(t),r(e,t)};S(K,e=>{!a.wsLoaded||!a.chatReady?e(q):a.agentId?e(Y,-1):e(J,1)}),f(ye),f(V),r(e,V),t()}export{He as component};
|
|
Binary file
|
|
Binary file
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["../chunks/CUZn05nQ.js","../chunks/hePW80VL.js","../chunks/HclGiUj8.js","../chunks/C_yvzB4Z.js","../assets/editor.chSTM-fo.css","../assets/editor.BoJhDcRF.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{A as e,B as t,D as n,Dt as r,F as i,G as a,I as o,L as s,N as c,Nt as l,O as u,Ot as d,Pt as f,R as p,S as m,V as h,_ as g,a as _,at as v,b as ee,d as y,dt as b,et as x,f as S,g as C,gt as w,it as T,j as E,k as D,l as O,m as k,mt as A,n as j,o as M,ot as N,p as te,pt as P,q as F,r as I,st as L,tt as R,u as ne,w as re,x as z,z as B}from"../chunks/CPCsWwEy.js";import{t as V}from"../chunks/HclGiUj8.js";import"../chunks/xihTtKlq.js";import{t as H}from"../chunks/BMXNEmOt.js";import{r as U,t as ie}from"../chunks/oarl--hZ.js";import{t as W}from"../chunks/6OCsQ6r7.js";import{t as ae}from"../chunks/Cf3l6QEG.js";import{n as oe,t as se}from"../chunks/BJqZY8o2.js";import{t as ce}from"../chunks/BP0Xadq7.js";import{i as le,t as ue}from"../chunks/BT98u4gR.js";import{t as G}from"../chunks/DWoqp3ac.js";import{a as de,c as fe,o as pe,r as K,s as me,t as he}from"../chunks/12bfCwgn.js";import{t as ge}from"../chunks/B9YnyJ2j.js";import{t as _e}from"../chunks/D3fLfD-Y.js";import{t as ve}from"../chunks/CL717zGu.js";var ye=/^[a-z0-9]+(-[a-z0-9]+)*$/,be=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!xe(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!xe(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!xe(e,n)?null:e}return null},xe=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1;function Se(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var Ce=Object.freeze({left:0,top:0,width:16,height:16}),we=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Te=Object.freeze({...Ce,...we}),Ee=Object.freeze({...Te,body:``,hidden:!1});function De(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Oe(e,t){let n=De(e,t);for(let r in Ee)r in we?r in e&&!(r in n)&&(n[r]=we[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function ke(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=Oe(r[e]||i[e],a)}return o(t),n.forEach(o),Oe(e,a)}function q(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=Se(e);for(let i in r){let a=r[i];a&&(t(i,ke(e,i,a)),n.push(i))}return n}var Ae={provider:``,aliases:{},not_found:{},...Ce};function je(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function Me(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!je(e,Ae))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!je(t,Ee))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!je(t,Ee))return null}return t}var Ne=Object.create(null);function Pe(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Fe(e,t){let n=Ne[e]||(Ne[e]=Object.create(null));return n[t]||(n[t]=Pe(e,t))}function J(e,t){return Me(t)?q(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function Ie(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var Le=!1;function Re(e){return typeof e==`boolean`&&(Le=e),Le}function ze(e){let t=typeof e==`string`?be(e,!0,Le):e;if(t){let e=Fe(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function Be(e,t){let n=be(e,!0,Le);if(!n)return!1;let r=Fe(n.provider,n.prefix);return t?Ie(r,n.name,t):(r.missing.add(n.name),!0)}function Ve(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),Le&&!t&&!e.prefix){let t=!1;return Me(e)&&(e.prefix=``,q(e,(e,n)=>{Be(e,n)&&(t=!0)})),t}let n=e.prefix;return xe({prefix:n,name:`a`})?!!J(Fe(t,n),e):!1}var He=Object.freeze({width:null,height:null}),Ue=Object.freeze({...He,...we}),Y=/(-?[0-9.]*[0-9]+[0-9.]*)/g,We=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function X(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(Y);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=We.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function Ge(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function Ke(e,t){return e?`<defs>`+e+`</defs>`+t:t}function qe(e,t,n){let r=Ge(e);return Ke(r.defs,t+r.content+n)}var Z=e=>e===`unset`||e===`undefined`||e===`none`;function Je(e,t){let n={...Te,...e},r={...Ue,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`)}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=qe(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=X(d,c/l)):(u=o===`auto`?c:o,d=s===null?X(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{Z(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var Ye=/\sid="(\S+)"/g,Xe=new Map;function Ze(e){e=e.replace(/[0-9]+$/,``)||`a`;let t=Xe.get(e)||0;return Xe.set(e,t+1),t?`${e}${t}`:e}function Qe(e){let t=[],n;for(;n=Ye.exec(e);)t.push(n[1]);if(!t.length)return e;let r=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(t=>{let n=Ze(t),i=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+i+`)([")]|\\.[a-z])`,`g`),`$1`+n+r+`$3`)}),e=e.replace(new RegExp(r,`g`),``),e}var $e=Object.create(null);function et(e,t){$e[e]=t}function tt(e){return $e[e]||$e[``]}function nt(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var rt=Object.create(null),it=[`https://api.simplesvg.com`,`https://api.unisvg.com`],at=[];it.length>0;)it.length===1||Math.random()>.5?at.push(it.shift()):at.push(it.pop());rt[``]=nt({resources:[`https://api.iconify.design`].concat(at)});function Q(e,t){let n=nt(t);return n!==null&&(rt[e]=n,!0)}function $(e){return rt[e]}var ot=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function st(e,t){let n=$(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function ct(e){return e===404}var lt=(e,t,n)=>{let r=[],i=st(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function ut(e){if(typeof e==`string`){let t=$(e);if(t)return t.path}return`/`}var dt={prepare:lt,send:(e,t,n)=>{if(!ot){n(`abort`,424);return}let r=ut(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;ot(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(ct(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function ft(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function pt(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||ft([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var mt=0;function ht(e,t,n){let r=mt++,i=ft.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function gt(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=Fe(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function _t(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?be(e,t,n):e;i&&r.push(i)}),r}var vt={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function yt(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function ee(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function y(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?b():v());return}if(m(),ee(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function b(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(ee(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{y(i,e,t)}};f.push(i),l++,d=setTimeout(b,e.rotate),n(r,t,i.callback)}return setTimeout(b),_}function bt(e){let t={...vt,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=yt(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function xt(){}var St=Object.create(null);function Ct(e){if(!St[e]){let t=$(e);if(!t)return;St[e]={config:t,redundancy:bt(t)}}return St[e]}function wt(e,t,n){let r,i;if(typeof e==`string`){let t=tt(e);if(!t)return n(void 0,424),xt;i=t.send;let a=Ct(e);a&&(r=a.redundancy)}else{let t=nt(e);if(t){r=bt(t);let n=tt(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),xt):r.query(t,i,n)().abort}function Tt(){}function Et(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,pt(e)}))}function Dt(e){let t=[],n=[];return e.forEach(e=>{(e.match(ye)?t:n).push(e)}),{valid:t,invalid:n}}function Ot(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!J(e,n).length){r();return}}catch(e){console.error(e)}r(),Et(e)}function kt(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function At(e,t){e.iconsToLoad=e.iconsToLoad?e.iconsToLoad.concat(t).sort():t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){kt(e.loadIcons(r,n,t),t=>{Ot(e,r,t)});return}if(i){r.forEach(r=>{kt(i(r,n,t),t=>{Ot(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Dt(r);if(o.length&&Ot(e,o,null),!a.length)return;let s=n.match(ye)?tt(t):null;if(!s){Ot(e,a,null);return}s.prepare(t,n,a).forEach(n=>{wt(t,n,t=>{Ot(e,n.icons,t)})})}))}var jt=(e,t)=>{let n=gt(_t(e,!0,Re()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Tt)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(Fe(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=Fe(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&At(e,t)}),t?ht(t,n,i):Tt};function Mt(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in He?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Nt=/[\s,]+/;function Pt(e,t){t.split(Nt).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0}})}function Ft(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function It(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Lt(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Rt(e){return`data:image/svg+xml,`+Lt(e)}function zt(e){return`url("`+Rt(e)+`")`}var Bt={...Ue,inline:!1},Vt={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Ht={display:`inline-block`},Ut={"background-color":`currentColor`},Wt={"background-color":`transparent`},Gt={image:`var(--svg)`,repeat:`no-repeat`,size:`100% 100%`},Kt={"-webkit-mask":Ut,mask:Ut,background:Wt};for(let e in Kt){let t=Kt[e];for(let n in Gt)t[e+`-`+n]=Gt[n]}function qt(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}function Jt(e,t){let n=Mt(Bt,t),r=t.mode||`svg`,i=r===`svg`?{...Vt}:{};e.body.indexOf(`xlink:`)===-1&&delete i[`xmlns:xlink`];let a=typeof t.style==`string`?t.style:``;for(let e in t){let r=t[e];if(r!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:n[e]=r===!0||r===`true`||r===1;break;case`flip`:typeof r==`string`&&Pt(n,r);break;case`color`:a=a+(a.length>0&&a.trim().slice(-1)!==`;`?`;`:``)+`color: `+r+`; `;break;case`rotate`:typeof r==`string`?n[e]=Ft(r):typeof r==`number`&&(n[e]=r);break;case`ariaHidden`:case`aria-hidden`:r!==!0&&r!==`true`&&delete i[`aria-hidden`];break;default:if(e.slice(0,3)===`on:`)break;Bt[e]===void 0&&(i[e]=r)}}let o=Je(e,n),s=o.attributes;if(n.inline&&(a=`vertical-align: -0.125em; `+a),r===`svg`)return Object.assign(i,s),a!==``&&(i.style=a),{svg:!0,attributes:i,body:Qe(o.body)};let{body:c,width:l,height:u}=e,d=r===`mask`||r!==`bg`&&c.indexOf(`currentColor`)!==-1,f={"--svg":zt(It(c,{...s,width:l+``,height:u+``}))},p=e=>{let t=s[e];t&&(f[e]=qt(t))};p(`width`),p(`height`),Object.assign(f,Ht,d?Ut:Wt);let m=``;for(let e in f)m+=e+`: `+f[e]+`;`;return i.style=m+a,{svg:!1,attributes:i}}if(Re(!0),et(``,dt),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!Ve(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;Q(e,r)||console.error(n)}catch{console.error(n)}}}}function Yt(){try{return typeof window!=`object`}catch{return!0}}function Xt(e,t,n,r){function i(){t.loading&&=(t.loading.abort(),null)}if(typeof e==`object`&&e&&typeof e.body==`string`)return t.name=``,i(),{data:{...Te,...e}};let a;if(typeof e!=`string`||(a=be(e,!1,!0))===null)return i(),null;let o=ze(a);if(!o)return!Yt()&&(!t.loading||t.loading.name!==e)&&(i(),t.name=``,t.loading={name:e,abort:jt([a],n)}),null;i(),t.name!==e&&(t.name=e,r&&!t.destroyed&&setTimeout(()=>{r(e)}));let s=[`iconify`];return a.prefix!==``&&s.push(`iconify--`+a.prefix),a.provider!==``&&s.push(`iconify--`+a.provider),{data:o,classes:s}}function Zt(e,t){return e?Jt({...Te,...e},t):null}var Qt=new Set([`$$slots`,`$$events`,`$$legacy`]),$t=p(`<svg></svg>`),en=s(`<span></span>`);function tn(e,t){d(t,!0);let s={name:``,loading:null,destroyed:!1},c=M(t,Qt),l=P(0),u=w(()=>(a(l),Xt(t.icon,s,m,t.onload))),p=w(()=>{let e=a(u)?Zt(a(u).data,c):null;return e&&a(u).classes&&c.class===void 0&&(e.attributes.class=(typeof c.class==`string`?c.class+` `:``)+a(u).classes.join(` `)),e});function m(){A(l)}j(()=>{s.destroyed=!0,s.loading&&=(s.loading.abort(),null)});var h=o(),g=v(h),_=e=>{var t=o(),r=v(t),s=e=>{var t=$t();S(t,()=>({...a(p).attributes})),n(t,()=>a(p).body,!0),f(t),i(e,t)},c=e=>{var t=en();S(t,()=>({...a(p).attributes})),i(e,t)};E(r,e=>{a(p).svg?e(s):e(c,-1)}),i(e,t)};E(g,e=>{a(p)&&e(_)}),i(e,h),r()}var nn=s(`<div class="w-full"></div>`);function rn(e,t){d(t,!0);let n=P(null),o=null,s=[],c=null,l=!1,u,f=_(t,`language`,3,`plaintext`),p=_(t,`height`,3,120),m=_(t,`readOnly`,3,!1),h=null,g=P(!1),v=P(!1);function y(e){a(v)||e.stopPropagation()}I(async()=>{if(!u)return;u.addEventListener(`wheel`,y,{capture:!0,passive:!0}),me();let e=await V(()=>import(`../chunks/CUZn05nQ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);if(l)return;c=e,pe(e);let r=f()===`json`?`json`:f()===`markdown`?`markdown`:`plaintext`;b(n,e.editor.create(u,{...de(`test-history`),value:t.value??``,language:r,readOnly:m(),domReadOnly:m()}),!0);let i=a(n);if(!i)return;o=i.getModel(),h=K(e,i),h.update(t.highlights??[]),b(g,!0),s.push(i.onDidFocusEditorText(()=>{b(v,!0)})),s.push(i.onDidChangeModelContent(()=>{try{let e=i.getValue();if(e===t.value)return;t.onChange?.(e)}catch(e){console.error(`MiniEditor change error`,e)}})),s.push(i.onDidBlurEditorText(()=>{b(v,!1);try{t.onBlur?.(i.getValue())}catch{}}));let d=i.onDidFocusEditorWidget?.(()=>{b(v,!0)});d&&s.push(d);let p=i.onDidBlurEditorWidget?.(()=>{b(v,!1);try{t.onBlur?.(i.getValue())}catch{}});p&&s.push(p)}),j(()=>{l=!0,b(g,!1);try{u.removeEventListener(`wheel`,y,{capture:!0})}catch{}for(let e of s)try{e.dispose()}catch{}s=[],h?.dispose(),h=null;let e=o;o=null;try{if(a(n)){try{a(n).setModel(null)}catch{}a(n).dispose()}}finally{b(n,null)}try{e?.dispose()}catch{}c=null}),R(()=>{if(!a(n))return;let e=f()===`json`?`json`:f()===`markdown`?`markdown`:`plaintext`,t=a(n).getModel();if(!t||t.getLanguageId()===e)return;let r=!1;return(c?Promise.resolve(c):V(()=>import(`../chunks/CUZn05nQ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).then(n=>{if(!r)try{n.editor.setModelLanguage(t,e)}catch{}}),()=>{r=!0}}),R(()=>{let e=t.value??``,r=t.highlights??[];!a(n)||!a(g)||(e!==a(n).getValue()&&a(n).setValue(e),h?.update(r))}),R(()=>{a(n)?.updateOptions({readOnly:m(),domReadOnly:m()})});var S=nn();O(S,e=>u=e,()=>u),x(()=>ee(S,`height:${p()}px`)),i(e,S),r()}var an=s(`<button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400">Fix</button>`),on=s(`<button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400">Analyze</button>`),sn=s(`<div><div class="mb-1 text-xs text-rc-gray-300"> </div> <div class="whitespace-pre-wrap break-words text-rc-gray-100"> </div></div>`),cn=s(`<div class="flex flex-col gap-3"></div>`),ln=s(`<div class="p-2 text-rc-gray-300">Loading…</div>`),un=s(`<div class="p-2 text-red-400"> </div>`),dn=s(`<div class="flex h-full flex-col gap-2"><div class="grid grid-cols-2 gap-2"><div class="flex items-center justify-start"><!></div> <div class="flex items-center justify-end"><!></div></div> <!></div>`),fn=s(`<div class="h-[55vh]"><!></div>`),pn=s(`<!> <!> <!>`,1),mn=s(`<!> <div class="mt-2 h-[55vh]"><!></div>`,1),hn=s(`<div class="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1"><!> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400"> </button> <!> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">See variants</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Prompt</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Conversation</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Context</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Debug</button></div> <!> <!> <!>`,1);function gn(e,t){d(t,!0);let n=_(t,`actionsDisabled`,3,!1),o=_(t,`actionsInert`,3,!1),s=_(t,`addTestDisabled`,3,!1),p=_(t,`showAnalyze`,3,!0),m=_(t,`analyzeDisabled`,3,!1),g=_(t,`fixDisabled`,3,!1),ee=P(!1),y=P(!1),S=P(!1),C=P(`errors`),D=P(`prompt`),O=P(null),k=P(null),A=P(null),M=P(null),te=P(null),F=P(null),I=P(null),R=P(L({prompt:!1,conversation:!1,context:!1,errors:!1,traces:!1,logs:!1})),ne=P(L({prompt:null,conversation:null,context:null,errors:null,traces:null,logs:null})),re=0,V=P(null),H=null,U=P(`idle`),ie=null;function ae(e){try{return{raw:e,formatted:JSON.stringify(JSON.parse(e),null,2)}}catch{return{raw:e,formatted:e}}}async function le(e){return ae(await G.tests.resultEntry.query({agent:e.agent,testId:e.id,resultKey:e.key,timestamp:e.timestamp,index:e.run}))}function ue(e){return e===`prompt`?a(k)!==null&&a(O)!==null:e===`conversation`?a(A)!==null:e===`context`?a(M)!==null:e===`errors`?a(te)!==null:e===`traces`?a(F)!==null:a(I)!==null}async function de(e){if(ue(e)||a(R)[e])return;let n=re;b(R,{...a(R),[e]:!0},!0),b(ne,{...a(ne),[e]:null},!0);try{if(e===`prompt`){let[e,r]=await Promise.all([le(t.links.renderedPrompt),le(t.links.receivedPrompt)]);if(n!==re)return;b(O,e,!0),b(k,r,!0)}else{let r=await le(e===`conversation`?t.links.conversation:e===`context`?t.links.context:e===`errors`?t.links.errors:e===`traces`?t.links.traces:t.links.logs);if(n!==re)return;b(e===`conversation`?A:e===`context`?M:e===`errors`?te:e===`traces`?F:I,r,!0)}}catch(t){if(n!==re)return;console.error(t),b(ne,{...a(ne),[e]:`Failed to load content`},!0)}finally{n===re&&b(R,{...a(R),[e]:!1},!0)}}function fe(){b(O,null),b(k,null),b(A,null),b(M,null),b(te,null),b(F,null),b(I,null),b(R,{prompt:!1,conversation:!1,context:!1,errors:!1,traces:!1,logs:!1},!0),b(ne,{prompt:null,conversation:null,context:null,errors:null,traces:null,logs:null},!0)}function pe(){re+=1,b(C,`errors`),fe(),b(ee,!0),de(`errors`)}function K(e){re+=1,b(D,e,!0),fe(),b(y,!0),de(e)}function me(e){return e===`prompt`?`Prompt`:e===`conversation`?`Conversation`:`Context`}function ge(e){b(C,e,!0),de(e)}async function _e(){if(a(U)!==`adding`){b(U,`adding`);try{await t.onAddTest(),b(U,`added`)}catch(e){console.error(`Failed to add test`,e),b(U,`failed`)}ie&&clearTimeout(ie),ie=window.setTimeout(()=>{b(U,`idle`),ie=null},2500)}}async function ye(e){if(!(!a(k)||!a(O)))try{let t=e===`raw`?a(k).raw:a(O).raw;await navigator.clipboard.writeText(t),b(V,e,!0),H&&clearTimeout(H),H=window.setTimeout(()=>{b(V,null),H=null},2e3)}catch(e){console.error(`Failed to copy prompt`,e)}}j(()=>{re+=1,H&&clearTimeout(H),ie&&clearTimeout(ie)});var be=hn(),xe=v(be),Se=T(xe),Ce=e=>{var r=an();x(()=>{r.inert=o(),r.disabled=n()||g()}),h(`click`,r,function(...e){t.onFix?.apply(this,e)}),i(e,r)};E(Se,e=>{t.onFix&&e(Ce)});var we=N(Se,2),Te=T(we,!0);f(we);var Ee=N(we,2),De=e=>{var n=on();x(()=>n.disabled=m()),h(`click`,n,function(...e){t.onAnalyze?.apply(this,e)}),i(e,n)};E(Ee,e=>{p()&&e(De)});var Oe=N(Ee,2),ke=N(Oe,2),q=N(ke,2),Ae=N(q,2),je=N(Ae,2);f(xe);var Me=N(xe,2),Ne=e=>{{let n=e=>{var n=cn();u(n,21,()=>t.variants,e=>e.index,(e,n)=>{var r=sn(),o=T(r),s=T(o);f(o);var l=N(o,2),u=T(l,!0);f(l),f(r),x(()=>{z(r,1,`rounded-lg border p-3 ${a(n).index===t.runIndex?`border-rc-green-450`:`border-rc-gray-650`} ${a(n).success?`bg-rc-green-700/80`:`bg-rc-gray-900/60`}`),c(s,`Run ${a(n).index??``}${a(n).index===t.runIndex?` • selected`:``}`),c(u,a(n).text||a(n).errors||`—`)}),i(e,r)}),f(n),i(e,n)},r=w(()=>`Variants — ${t.scenario||`Test`}`);ce(e,{get title(){return a(r)},class:`!w-[80vw] !max-w-4xl`,get open(){return a(S)},set open(e){b(S,e,!0)},children:n,$$slots:{default:!0}})}};E(Me,e=>{a(S)&&e(Ne)});var Pe=N(Me,2),Fe=e=>{{let n=e=>{var t=fn(),n=T(t),r=e=>{var t=ln();i(e,t)},o=e=>{var t=un(),n=T(t,!0);f(t),x(()=>c(n,a(ne)[a(D)])),i(e,t)},s=e=>{var t=dn(),n=T(t),r=T(n),o=T(r);{let e=w(()=>!a(k).raw.trim());W(o,{variant:`secondary`,size:`small`,get disabled(){return a(e)},onclick:()=>ye(`raw`),children:(e,t)=>{l();var n=B();x(()=>c(n,a(V)===`raw`?`Copied raw prompt`:`Copy raw prompt`)),i(e,n)},$$slots:{default:!0}})}f(r);var s=N(r,2),u=T(s);{let e=w(()=>!a(O).raw.trim());W(u,{variant:`secondary`,size:`small`,get disabled(){return a(e)},onclick:()=>ye(`rendered`),children:(e,t)=>{l();var n=B();x(()=>c(n,a(V)===`rendered`?`Copied rendered prompt`:`Copy rendered prompt`)),i(e,n)},$$slots:{default:!0}})}f(s),f(n);var d=N(n,2);he(d,{variant:`generic`,get original(){return a(k).formatted},get modified(){return a(O).formatted},language:`markdown`,class:`min-h-0 flex-1`}),f(t),i(e,t)},u=e=>{{let t=w(()=>a(A).formatted||`—`);ve(e,{get value(){return a(t)},language:`text`,class:`h-full`})}},d=e=>{{let t=w(()=>a(M).formatted||`—`);ve(e,{get value(){return a(t)},language:`json`,class:`h-full`})}};E(n,e=>{a(R)[a(D)]?e(r):a(ne)[a(D)]?e(o,1):a(D)===`prompt`&&a(k)&&a(O)?e(s,2):a(D)===`conversation`&&a(A)?e(u,3):a(D)===`context`&&a(M)&&e(d,4)}),f(t),i(e,t)},r=w(()=>`${me(a(D))} — ${t.scenario||`Test`} (run ${t.runIndex})`);ce(e,{get title(){return a(r)},class:`!w-[85vw] !max-w-5xl`,get open(){return a(y)},set open(e){b(y,e,!0)},children:n,$$slots:{default:!0}})}};E(Pe,e=>{a(y)&&e(Fe)});var J=N(Pe,2),Ie=e=>{{let n=e=>{var t=mn(),n=v(t);oe(n,{get value(){return a(C)},ariaLabel:`Test run debug tabs`,onChange:({value:e})=>ge(e),children:(e,t)=>{var n=pn(),r=v(n);se(r,{value:`errors`,class:`px-3`,children:(e,t)=>{l();var n=B(`Errors`);i(e,n)},$$slots:{default:!0}});var a=N(r,2);se(a,{value:`traces`,class:`px-3`,children:(e,t)=>{l();var n=B(`Traces`);i(e,n)},$$slots:{default:!0}});var o=N(a,2);se(o,{value:`logs`,class:`px-3`,children:(e,t)=>{l();var n=B(`Logs`);i(e,n)},$$slots:{default:!0}}),i(e,n)},$$slots:{default:!0}});var r=N(n,2),o=T(r),s=e=>{var t=ln();i(e,t)},u=e=>{var t=un(),n=T(t,!0);f(t),x(()=>c(n,a(ne)[a(C)])),i(e,t)},d=e=>{{let t=w(()=>a(te).formatted||`—`);ve(e,{get value(){return a(t)},language:`text`,class:`h-full`})}},p=e=>{{let t=w(()=>a(F).formatted||`—`);ve(e,{get value(){return a(t)},language:`json`,class:`h-full`})}},m=e=>{{let t=w(()=>a(I).formatted||`—`);ve(e,{get value(){return a(t)},language:`text`,class:`h-full`})}};E(o,e=>{a(R)[a(C)]?e(s):a(ne)[a(C)]?e(u,1):a(C)===`errors`&&a(te)?e(d,2):a(C)===`traces`&&a(F)?e(p,3):a(C)===`logs`&&a(I)&&e(m,4)}),f(r),i(e,t)},r=w(()=>`Debug — ${t.scenario||`Test`} (run ${t.runIndex})`);ce(e,{get title(){return a(r)},class:`!w-[85vw] !max-w-5xl`,get open(){return a(ee)},set open(e){b(ee,e,!0)},children:n,$$slots:{default:!0}})}};E(J,e=>{a(ee)&&e(Ie)}),x(()=>{we.inert=o(),we.disabled=n()||s()||a(U)===`adding`,c(Te,a(U)===`adding`?`Adding…`:a(U)===`added`?`Added`:a(U)===`failed`?`Failed`:`Add test`)}),h(`click`,we,_e),h(`click`,Oe,()=>b(S,!0)),h(`click`,ke,()=>K(`prompt`)),h(`click`,q,()=>K(`conversation`)),h(`click`,Ae,()=>K(`context`)),h(`click`,je,pe),i(e,be),r()}t([`click`]);var _n=`Update the conversation history so it reflects behaviour that is valid under the current prompt. Preserve the test's intent and expected outcome, and make only the smallest necessary changes. Possible roles: "Agent", "User", "System"`;function vn(e,t){return[e.trim()===`LLM`?``:e.trim(),t.trim()].filter(Boolean).join(` `)}function yn(e){let t=vn(e.assertionLabel,e.assertionValue);return`You will be given the context, the conversation and the desired output and assertion about it. First, find why the prompt is not producing the correct result. It's usually one concrete instruction within the relevant section, or a contradiction. Then, change the prompt minimally so this will work, but keeping the prompt clean and comprehensive is more important. Try to provide as general solution as possible. Try to change just one part of the prompt, not multiple parts. Avoid adding exceptions and overrides. Avoid duplicating information that already exists in the prompt.
|
|
2
|
+
import{A as e,B as t,D as n,Dt as r,F as i,G as a,I as o,L as s,N as c,Nt as l,O as u,Ot as d,Pt as f,R as p,S as m,V as h,_ as g,a as _,at as v,b as ee,d as y,dt as b,et as x,f as S,g as C,gt as w,it as T,j as E,k as D,l as O,m as k,mt as A,n as j,o as M,ot as N,p as te,pt as P,q as F,r as I,st as L,tt as R,u as ne,w as re,x as z,z as B}from"../chunks/CPCsWwEy.js";import{t as V}from"../chunks/HclGiUj8.js";import"../chunks/xihTtKlq.js";import{t as H}from"../chunks/BFUe72xu.js";import{r as U,t as ie}from"../chunks/oarl--hZ.js";import{t as W}from"../chunks/6OCsQ6r7.js";import{t as ae}from"../chunks/Cf3l6QEG.js";import{n as oe,t as se}from"../chunks/BJqZY8o2.js";import{t as ce}from"../chunks/BP0Xadq7.js";import{i as le,t as ue}from"../chunks/BT98u4gR.js";import{t as G}from"../chunks/DWoqp3ac.js";import{a as de,c as fe,o as pe,r as K,s as me,t as he}from"../chunks/12bfCwgn.js";import{t as ge}from"../chunks/B9YnyJ2j.js";import{t as _e}from"../chunks/D3fLfD-Y.js";import{t as ve}from"../chunks/CL717zGu.js";var ye=/^[a-z0-9]+(-[a-z0-9]+)*$/,be=(e,t,n,r=``)=>{let i=e.split(`:`);if(e.slice(0,1)===`@`){if(i.length<2||i.length>3)return null;r=i.shift().slice(1)}if(i.length>3||!i.length)return null;if(i.length>1){let e=i.pop(),n=i.pop(),a={provider:i.length>0?i[0]:r,prefix:n,name:e};return t&&!xe(a)?null:a}let a=i[0],o=a.split(`-`);if(o.length>1){let e={provider:r,prefix:o.shift(),name:o.join(`-`)};return t&&!xe(e)?null:e}if(n&&r===``){let e={provider:r,prefix:``,name:a};return t&&!xe(e,n)?null:e}return null},xe=(e,t)=>e?!!((t&&e.prefix===``||e.prefix)&&e.name):!1;function Se(e,t){let n=e.icons,r=e.aliases||Object.create(null),i=Object.create(null);function a(e){if(n[e])return i[e]=[];if(!(e in i)){i[e]=null;let t=r[e]&&r[e].parent,n=t&&a(t);n&&(i[e]=[t].concat(n))}return i[e]}return Object.keys(n).concat(Object.keys(r)).forEach(a),i}var Ce=Object.freeze({left:0,top:0,width:16,height:16}),we=Object.freeze({rotate:0,vFlip:!1,hFlip:!1}),Te=Object.freeze({...Ce,...we}),Ee=Object.freeze({...Te,body:``,hidden:!1});function De(e,t){let n={};!e.hFlip!=!t.hFlip&&(n.hFlip=!0),!e.vFlip!=!t.vFlip&&(n.vFlip=!0);let r=((e.rotate||0)+(t.rotate||0))%4;return r&&(n.rotate=r),n}function Oe(e,t){let n=De(e,t);for(let r in Ee)r in we?r in e&&!(r in n)&&(n[r]=we[r]):r in t?n[r]=t[r]:r in e&&(n[r]=e[r]);return n}function ke(e,t,n){let r=e.icons,i=e.aliases||Object.create(null),a={};function o(e){a=Oe(r[e]||i[e],a)}return o(t),n.forEach(o),Oe(e,a)}function q(e,t){let n=[];if(typeof e!=`object`||typeof e.icons!=`object`)return n;e.not_found instanceof Array&&e.not_found.forEach(e=>{t(e,null),n.push(e)});let r=Se(e);for(let i in r){let a=r[i];a&&(t(i,ke(e,i,a)),n.push(i))}return n}var Ae={provider:``,aliases:{},not_found:{},...Ce};function je(e,t){for(let n in t)if(n in e&&typeof e[n]!=typeof t[n])return!1;return!0}function Me(e){if(typeof e!=`object`||!e)return null;let t=e;if(typeof t.prefix!=`string`||!e.icons||typeof e.icons!=`object`||!je(e,Ae))return null;let n=t.icons;for(let e in n){let t=n[e];if(!e||typeof t.body!=`string`||!je(t,Ee))return null}let r=t.aliases||Object.create(null);for(let e in r){let t=r[e],i=t.parent;if(!e||typeof i!=`string`||!n[i]&&!r[i]||!je(t,Ee))return null}return t}var Ne=Object.create(null);function Pe(e,t){return{provider:e,prefix:t,icons:Object.create(null),missing:new Set}}function Fe(e,t){let n=Ne[e]||(Ne[e]=Object.create(null));return n[t]||(n[t]=Pe(e,t))}function J(e,t){return Me(t)?q(t,(t,n)=>{n?e.icons[t]=n:e.missing.add(t)}):[]}function Ie(e,t,n){try{if(typeof n.body==`string`)return e.icons[t]={...n},!0}catch{}return!1}var Le=!1;function Re(e){return typeof e==`boolean`&&(Le=e),Le}function ze(e){let t=typeof e==`string`?be(e,!0,Le):e;if(t){let e=Fe(t.provider,t.prefix),n=t.name;return e.icons[n]||(e.missing.has(n)?null:void 0)}}function Be(e,t){let n=be(e,!0,Le);if(!n)return!1;let r=Fe(n.provider,n.prefix);return t?Ie(r,n.name,t):(r.missing.add(n.name),!0)}function Ve(e,t){if(typeof e!=`object`)return!1;if(typeof t!=`string`&&(t=e.provider||``),Le&&!t&&!e.prefix){let t=!1;return Me(e)&&(e.prefix=``,q(e,(e,n)=>{Be(e,n)&&(t=!0)})),t}let n=e.prefix;return xe({prefix:n,name:`a`})?!!J(Fe(t,n),e):!1}var He=Object.freeze({width:null,height:null}),Ue=Object.freeze({...He,...we}),Y=/(-?[0-9.]*[0-9]+[0-9.]*)/g,We=/^-?[0-9.]*[0-9]+[0-9.]*$/g;function X(e,t,n){if(t===1)return e;if(n||=100,typeof e==`number`)return Math.ceil(e*t*n)/n;if(typeof e!=`string`)return e;let r=e.split(Y);if(r===null||!r.length)return e;let i=[],a=r.shift(),o=We.test(a);for(;;){if(o){let e=parseFloat(a);isNaN(e)?i.push(a):i.push(Math.ceil(e*t*n)/n)}else i.push(a);if(a=r.shift(),a===void 0)return i.join(``);o=!o}}function Ge(e,t=`defs`){let n=``,r=e.indexOf(`<`+t);for(;r>=0;){let i=e.indexOf(`>`,r),a=e.indexOf(`</`+t);if(i===-1||a===-1)break;let o=e.indexOf(`>`,a);if(o===-1)break;n+=e.slice(i+1,a).trim(),e=e.slice(0,r).trim()+e.slice(o+1)}return{defs:n,content:e}}function Ke(e,t){return e?`<defs>`+e+`</defs>`+t:t}function qe(e,t,n){let r=Ge(e);return Ke(r.defs,t+r.content+n)}var Z=e=>e===`unset`||e===`undefined`||e===`none`;function Je(e,t){let n={...Te,...e},r={...Ue,...t},i={left:n.left,top:n.top,width:n.width,height:n.height},a=n.body;[n,r].forEach(e=>{let t=[],n=e.hFlip,r=e.vFlip,o=e.rotate;n?r?o+=2:(t.push(`translate(`+(i.width+i.left).toString()+` `+(0-i.top).toString()+`)`),t.push(`scale(-1 1)`),i.top=i.left=0):r&&(t.push(`translate(`+(0-i.left).toString()+` `+(i.height+i.top).toString()+`)`),t.push(`scale(1 -1)`),i.top=i.left=0);let s;switch(o<0&&(o-=Math.floor(o/4)*4),o%=4,o){case 1:s=i.height/2+i.top,t.unshift(`rotate(90 `+s.toString()+` `+s.toString()+`)`);break;case 2:t.unshift(`rotate(180 `+(i.width/2+i.left).toString()+` `+(i.height/2+i.top).toString()+`)`);break;case 3:s=i.width/2+i.left,t.unshift(`rotate(-90 `+s.toString()+` `+s.toString()+`)`)}o%2==1&&(i.left!==i.top&&(s=i.left,i.left=i.top,i.top=s),i.width!==i.height&&(s=i.width,i.width=i.height,i.height=s)),t.length&&(a=qe(a,`<g transform="`+t.join(` `)+`">`,`</g>`))});let o=r.width,s=r.height,c=i.width,l=i.height,u,d;o===null?(d=s===null?`1em`:s===`auto`?l:s,u=X(d,c/l)):(u=o===`auto`?c:o,d=s===null?X(u,l/c):s===`auto`?l:s);let f={},p=(e,t)=>{Z(t)||(f[e]=t.toString())};p(`width`,u),p(`height`,d);let m=[i.left,i.top,c,l];return f.viewBox=m.join(` `),{attributes:f,viewBox:m,body:a}}var Ye=/\sid="(\S+)"/g,Xe=new Map;function Ze(e){e=e.replace(/[0-9]+$/,``)||`a`;let t=Xe.get(e)||0;return Xe.set(e,t+1),t?`${e}${t}`:e}function Qe(e){let t=[],n;for(;n=Ye.exec(e);)t.push(n[1]);if(!t.length)return e;let r=`suffix`+(Math.random()*16777216|Date.now()).toString(16);return t.forEach(t=>{let n=Ze(t),i=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`);e=e.replace(RegExp(`([#;"])(`+i+`)([")]|\\.[a-z])`,`g`),`$1`+n+r+`$3`)}),e=e.replace(new RegExp(r,`g`),``),e}var $e=Object.create(null);function et(e,t){$e[e]=t}function tt(e){return $e[e]||$e[``]}function nt(e){let t;if(typeof e.resources==`string`)t=[e.resources];else if(t=e.resources,!(t instanceof Array)||!t.length)return null;return{resources:t,path:e.path||`/`,maxURL:e.maxURL||500,rotate:e.rotate||750,timeout:e.timeout||5e3,random:e.random===!0,index:e.index||0,dataAfterTimeout:e.dataAfterTimeout!==!1}}for(var rt=Object.create(null),it=[`https://api.simplesvg.com`,`https://api.unisvg.com`],at=[];it.length>0;)it.length===1||Math.random()>.5?at.push(it.shift()):at.push(it.pop());rt[``]=nt({resources:[`https://api.iconify.design`].concat(at)});function Q(e,t){let n=nt(t);return n!==null&&(rt[e]=n,!0)}function $(e){return rt[e]}var ot=(()=>{let e;try{if(e=fetch,typeof e==`function`)return e}catch{}})();function st(e,t){let n=$(e);if(!n)return 0;let r;if(!n.maxURL)r=0;else{let e=0;n.resources.forEach(t=>{e=Math.max(e,t.length)});let i=t+`.json?icons=`;r=n.maxURL-e-n.path.length-i.length}return r}function ct(e){return e===404}var lt=(e,t,n)=>{let r=[],i=st(e,t),a=`icons`,o={type:a,provider:e,prefix:t,icons:[]},s=0;return n.forEach((n,c)=>{s+=n.length+1,s>=i&&c>0&&(r.push(o),o={type:a,provider:e,prefix:t,icons:[]},s=n.length),o.icons.push(n)}),r.push(o),r};function ut(e){if(typeof e==`string`){let t=$(e);if(t)return t.path}return`/`}var dt={prepare:lt,send:(e,t,n)=>{if(!ot){n(`abort`,424);return}let r=ut(t.provider);switch(t.type){case`icons`:{let e=t.prefix,n=t.icons.join(`,`),i=new URLSearchParams({icons:n});r+=e+`.json?`+i.toString();break}case`custom`:{let e=t.uri;r+=e.slice(0,1)===`/`?e.slice(1):e;break}default:n(`abort`,400);return}let i=503;ot(e+r).then(e=>{let t=e.status;if(t!==200){setTimeout(()=>{n(ct(t)?`abort`:`next`,t)});return}return i=501,e.json()}).then(e=>{if(typeof e!=`object`||!e){setTimeout(()=>{e===404?n(`abort`,e):n(`next`,i)});return}setTimeout(()=>{n(`success`,e)})}).catch(()=>{n(`next`,i)})}};function ft(e,t){e.forEach(e=>{let n=e.loaderCallbacks;n&&(e.loaderCallbacks=n.filter(e=>e.id!==t))})}function pt(e){e.pendingCallbacksFlag||(e.pendingCallbacksFlag=!0,setTimeout(()=>{e.pendingCallbacksFlag=!1;let t=e.loaderCallbacks?e.loaderCallbacks.slice(0):[];if(!t.length)return;let n=!1,r=e.provider,i=e.prefix;t.forEach(t=>{let a=t.icons,o=a.pending.length;a.pending=a.pending.filter(t=>{if(t.prefix!==i)return!0;let o=t.name;if(e.icons[o])a.loaded.push({provider:r,prefix:i,name:o});else if(e.missing.has(o))a.missing.push({provider:r,prefix:i,name:o});else return n=!0,!0;return!1}),a.pending.length!==o&&(n||ft([e],t.id),t.callback(a.loaded.slice(0),a.missing.slice(0),a.pending.slice(0),t.abort))})}))}var mt=0;function ht(e,t,n){let r=mt++,i=ft.bind(null,n,r);if(!t.pending.length)return i;let a={id:r,icons:t,callback:e,abort:i};return n.forEach(e=>{(e.loaderCallbacks||=[]).push(a)}),i}function gt(e){let t={loaded:[],missing:[],pending:[]},n=Object.create(null);e.sort((e,t)=>e.provider===t.provider?e.prefix===t.prefix?e.name.localeCompare(t.name):e.prefix.localeCompare(t.prefix):e.provider.localeCompare(t.provider));let r={provider:``,prefix:``,name:``};return e.forEach(e=>{if(r.name===e.name&&r.prefix===e.prefix&&r.provider===e.provider)return;r=e;let i=e.provider,a=e.prefix,o=e.name,s=n[i]||(n[i]=Object.create(null)),c=s[a]||(s[a]=Fe(i,a)),l;l=o in c.icons?t.loaded:a===``||c.missing.has(o)?t.missing:t.pending;let u={provider:i,prefix:a,name:o};l.push(u)}),t}function _t(e,t=!0,n=!1){let r=[];return e.forEach(e=>{let i=typeof e==`string`?be(e,t,n):e;i&&r.push(i)}),r}var vt={resources:[],index:0,timeout:2e3,rotate:750,random:!1,dataAfterTimeout:!1};function yt(e,t,n,r){let i=e.resources.length,a=e.random?Math.floor(Math.random()*i):e.index,o;if(e.random){let t=e.resources.slice(0);for(o=[];t.length>1;){let e=Math.floor(Math.random()*t.length);o.push(t[e]),t=t.slice(0,e).concat(t.slice(e+1))}o=o.concat(t)}else o=e.resources.slice(a).concat(e.resources.slice(0,a));let s=Date.now(),c=`pending`,l=0,u,d=null,f=[],p=[];typeof r==`function`&&p.push(r);function m(){d&&=(clearTimeout(d),null)}function h(){c===`pending`&&(c=`aborted`),m(),f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function g(e,t){t&&(p=[]),typeof e==`function`&&p.push(e)}function _(){return{startTime:s,payload:t,status:c,queriesSent:l,queriesPending:f.length,subscribe:g,abort:h}}function v(){c=`failed`,p.forEach(e=>{e(void 0,u)})}function ee(){f.forEach(e=>{e.status===`pending`&&(e.status=`aborted`)}),f=[]}function y(t,n,r){let i=n!==`success`;switch(f=f.filter(e=>e!==t),c){case`pending`:break;case`failed`:if(i||!e.dataAfterTimeout)return;break;default:return}if(n===`abort`){u=r,v();return}if(i){u=r,f.length||(o.length?b():v());return}if(m(),ee(),!e.random){let n=e.resources.indexOf(t.resource);n!==-1&&n!==e.index&&(e.index=n)}c=`completed`,p.forEach(e=>{e(r)})}function b(){if(c!==`pending`)return;m();let r=o.shift();if(r===void 0){if(f.length){d=setTimeout(()=>{m(),c===`pending`&&(ee(),v())},e.timeout);return}v();return}let i={status:`pending`,resource:r,callback:(e,t)=>{y(i,e,t)}};f.push(i),l++,d=setTimeout(b,e.rotate),n(r,t,i.callback)}return setTimeout(b),_}function bt(e){let t={...vt,...e},n=[];function r(){n=n.filter(e=>e().status===`pending`)}function i(e,i,a){let o=yt(t,e,i,(e,t)=>{r(),a&&a(e,t)});return n.push(o),o}function a(e){return n.find(t=>e(t))||null}return{query:i,find:a,setIndex:e=>{t.index=e},getIndex:()=>t.index,cleanup:r}}function xt(){}var St=Object.create(null);function Ct(e){if(!St[e]){let t=$(e);if(!t)return;St[e]={config:t,redundancy:bt(t)}}return St[e]}function wt(e,t,n){let r,i;if(typeof e==`string`){let t=tt(e);if(!t)return n(void 0,424),xt;i=t.send;let a=Ct(e);a&&(r=a.redundancy)}else{let t=nt(e);if(t){r=bt(t);let n=tt(e.resources?e.resources[0]:``);n&&(i=n.send)}}return!r||!i?(n(void 0,424),xt):r.query(t,i,n)().abort}function Tt(){}function Et(e){e.iconsLoaderFlag||(e.iconsLoaderFlag=!0,setTimeout(()=>{e.iconsLoaderFlag=!1,pt(e)}))}function Dt(e){let t=[],n=[];return e.forEach(e=>{(e.match(ye)?t:n).push(e)}),{valid:t,invalid:n}}function Ot(e,t,n){function r(){let n=e.pendingIcons;t.forEach(t=>{n&&n.delete(t),e.icons[t]||e.missing.add(t)})}if(n&&typeof n==`object`)try{if(!J(e,n).length){r();return}}catch(e){console.error(e)}r(),Et(e)}function kt(e,t){e instanceof Promise?e.then(e=>{t(e)}).catch(()=>{t(null)}):t(e)}function At(e,t){e.iconsToLoad=e.iconsToLoad?e.iconsToLoad.concat(t).sort():t,e.iconsQueueFlag||(e.iconsQueueFlag=!0,setTimeout(()=>{e.iconsQueueFlag=!1;let{provider:t,prefix:n}=e,r=e.iconsToLoad;if(delete e.iconsToLoad,!r||!r.length)return;let i=e.loadIcon;if(e.loadIcons&&(r.length>1||!i)){kt(e.loadIcons(r,n,t),t=>{Ot(e,r,t)});return}if(i){r.forEach(r=>{kt(i(r,n,t),t=>{Ot(e,[r],t?{prefix:n,icons:{[r]:t}}:null)})});return}let{valid:a,invalid:o}=Dt(r);if(o.length&&Ot(e,o,null),!a.length)return;let s=n.match(ye)?tt(t):null;if(!s){Ot(e,a,null);return}s.prepare(t,n,a).forEach(n=>{wt(t,n,t=>{Ot(e,n.icons,t)})})}))}var jt=(e,t)=>{let n=gt(_t(e,!0,Re()));if(!n.pending.length){let e=!0;return t&&setTimeout(()=>{e&&t(n.loaded,n.missing,n.pending,Tt)}),()=>{e=!1}}let r=Object.create(null),i=[],a,o;return n.pending.forEach(e=>{let{provider:t,prefix:n}=e;if(n===o&&t===a)return;a=t,o=n,i.push(Fe(t,n));let s=r[t]||(r[t]=Object.create(null));s[n]||(s[n]=[])}),n.pending.forEach(e=>{let{provider:t,prefix:n,name:i}=e,a=Fe(t,n),o=a.pendingIcons||=new Set;o.has(i)||(o.add(i),r[t][n].push(i))}),i.forEach(e=>{let t=r[e.provider][e.prefix];t.length&&At(e,t)}),t?ht(t,n,i):Tt};function Mt(e,t){let n={...e};for(let e in t){let r=t[e],i=typeof r;e in He?(r===null||r&&(i===`string`||i===`number`))&&(n[e]=r):i===typeof n[e]&&(n[e]=e===`rotate`?r%4:r)}return n}var Nt=/[\s,]+/;function Pt(e,t){t.split(Nt).forEach(t=>{switch(t.trim()){case`horizontal`:e.hFlip=!0;break;case`vertical`:e.vFlip=!0}})}function Ft(e,t=0){let n=e.replace(/^-?[0-9.]*/,``);function r(e){for(;e<0;)e+=4;return e%4}if(n===``){let t=parseInt(e);return isNaN(t)?0:r(t)}if(n!==e){let t=0;switch(n){case`%`:t=25;break;case`deg`:t=90}if(t){let i=parseFloat(e.slice(0,e.length-n.length));return isNaN(i)?0:(i/=t,i%1==0?r(i):0)}}return t}function It(e,t){let n=e.indexOf(`xlink:`)===-1?``:` xmlns:xlink="http://www.w3.org/1999/xlink"`;for(let e in t)n+=` `+e+`="`+t[e]+`"`;return`<svg xmlns="http://www.w3.org/2000/svg"`+n+`>`+e+`</svg>`}function Lt(e){return e.replace(/"/g,`'`).replace(/%/g,`%25`).replace(/#/g,`%23`).replace(/</g,`%3C`).replace(/>/g,`%3E`).replace(/\s+/g,` `)}function Rt(e){return`data:image/svg+xml,`+Lt(e)}function zt(e){return`url("`+Rt(e)+`")`}var Bt={...Ue,inline:!1},Vt={xmlns:`http://www.w3.org/2000/svg`,"xmlns:xlink":`http://www.w3.org/1999/xlink`,"aria-hidden":!0,role:`img`},Ht={display:`inline-block`},Ut={"background-color":`currentColor`},Wt={"background-color":`transparent`},Gt={image:`var(--svg)`,repeat:`no-repeat`,size:`100% 100%`},Kt={"-webkit-mask":Ut,mask:Ut,background:Wt};for(let e in Kt){let t=Kt[e];for(let n in Gt)t[e+`-`+n]=Gt[n]}function qt(e){return e+(e.match(/^[-0-9.]+$/)?`px`:``)}function Jt(e,t){let n=Mt(Bt,t),r=t.mode||`svg`,i=r===`svg`?{...Vt}:{};e.body.indexOf(`xlink:`)===-1&&delete i[`xmlns:xlink`];let a=typeof t.style==`string`?t.style:``;for(let e in t){let r=t[e];if(r!==void 0)switch(e){case`icon`:case`style`:case`onLoad`:case`mode`:case`ssr`:break;case`inline`:case`hFlip`:case`vFlip`:n[e]=r===!0||r===`true`||r===1;break;case`flip`:typeof r==`string`&&Pt(n,r);break;case`color`:a=a+(a.length>0&&a.trim().slice(-1)!==`;`?`;`:``)+`color: `+r+`; `;break;case`rotate`:typeof r==`string`?n[e]=Ft(r):typeof r==`number`&&(n[e]=r);break;case`ariaHidden`:case`aria-hidden`:r!==!0&&r!==`true`&&delete i[`aria-hidden`];break;default:if(e.slice(0,3)===`on:`)break;Bt[e]===void 0&&(i[e]=r)}}let o=Je(e,n),s=o.attributes;if(n.inline&&(a=`vertical-align: -0.125em; `+a),r===`svg`)return Object.assign(i,s),a!==``&&(i.style=a),{svg:!0,attributes:i,body:Qe(o.body)};let{body:c,width:l,height:u}=e,d=r===`mask`||r!==`bg`&&c.indexOf(`currentColor`)!==-1,f={"--svg":zt(It(c,{...s,width:l+``,height:u+``}))},p=e=>{let t=s[e];t&&(f[e]=qt(t))};p(`width`),p(`height`),Object.assign(f,Ht,d?Ut:Wt);let m=``;for(let e in f)m+=e+`: `+f[e]+`;`;return i.style=m+a,{svg:!1,attributes:i}}if(Re(!0),et(``,dt),typeof document<`u`&&typeof window<`u`){let e=window;if(e.IconifyPreload!==void 0){let t=e.IconifyPreload,n=`Invalid IconifyPreload syntax.`;typeof t==`object`&&t&&(t instanceof Array?t:[t]).forEach(e=>{try{(typeof e!=`object`||!e||e instanceof Array||typeof e.icons!=`object`||typeof e.prefix!=`string`||!Ve(e))&&console.error(n)}catch{console.error(n)}})}if(e.IconifyProviders!==void 0){let t=e.IconifyProviders;if(typeof t==`object`&&t)for(let e in t){let n=`IconifyProviders[`+e+`] is invalid.`;try{let r=t[e];if(typeof r!=`object`||!r||r.resources===void 0)continue;Q(e,r)||console.error(n)}catch{console.error(n)}}}}function Yt(){try{return typeof window!=`object`}catch{return!0}}function Xt(e,t,n,r){function i(){t.loading&&=(t.loading.abort(),null)}if(typeof e==`object`&&e&&typeof e.body==`string`)return t.name=``,i(),{data:{...Te,...e}};let a;if(typeof e!=`string`||(a=be(e,!1,!0))===null)return i(),null;let o=ze(a);if(!o)return!Yt()&&(!t.loading||t.loading.name!==e)&&(i(),t.name=``,t.loading={name:e,abort:jt([a],n)}),null;i(),t.name!==e&&(t.name=e,r&&!t.destroyed&&setTimeout(()=>{r(e)}));let s=[`iconify`];return a.prefix!==``&&s.push(`iconify--`+a.prefix),a.provider!==``&&s.push(`iconify--`+a.provider),{data:o,classes:s}}function Zt(e,t){return e?Jt({...Te,...e},t):null}var Qt=new Set([`$$slots`,`$$events`,`$$legacy`]),$t=p(`<svg></svg>`),en=s(`<span></span>`);function tn(e,t){d(t,!0);let s={name:``,loading:null,destroyed:!1},c=M(t,Qt),l=P(0),u=w(()=>(a(l),Xt(t.icon,s,m,t.onload))),p=w(()=>{let e=a(u)?Zt(a(u).data,c):null;return e&&a(u).classes&&c.class===void 0&&(e.attributes.class=(typeof c.class==`string`?c.class+` `:``)+a(u).classes.join(` `)),e});function m(){A(l)}j(()=>{s.destroyed=!0,s.loading&&=(s.loading.abort(),null)});var h=o(),g=v(h),_=e=>{var t=o(),r=v(t),s=e=>{var t=$t();S(t,()=>({...a(p).attributes})),n(t,()=>a(p).body,!0),f(t),i(e,t)},c=e=>{var t=en();S(t,()=>({...a(p).attributes})),i(e,t)};E(r,e=>{a(p).svg?e(s):e(c,-1)}),i(e,t)};E(g,e=>{a(p)&&e(_)}),i(e,h),r()}var nn=s(`<div class="w-full"></div>`);function rn(e,t){d(t,!0);let n=P(null),o=null,s=[],c=null,l=!1,u,f=_(t,`language`,3,`plaintext`),p=_(t,`height`,3,120),m=_(t,`readOnly`,3,!1),h=null,g=P(!1),v=P(!1);function y(e){a(v)||e.stopPropagation()}I(async()=>{if(!u)return;u.addEventListener(`wheel`,y,{capture:!0,passive:!0}),me();let e=await V(()=>import(`../chunks/CUZn05nQ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url);if(l)return;c=e,pe(e);let r=f()===`json`?`json`:f()===`markdown`?`markdown`:`plaintext`;b(n,e.editor.create(u,{...de(`test-history`),value:t.value??``,language:r,readOnly:m(),domReadOnly:m()}),!0);let i=a(n);if(!i)return;o=i.getModel(),h=K(e,i),h.update(t.highlights??[]),b(g,!0),s.push(i.onDidFocusEditorText(()=>{b(v,!0)})),s.push(i.onDidChangeModelContent(()=>{try{let e=i.getValue();if(e===t.value)return;t.onChange?.(e)}catch(e){console.error(`MiniEditor change error`,e)}})),s.push(i.onDidBlurEditorText(()=>{b(v,!1);try{t.onBlur?.(i.getValue())}catch{}}));let d=i.onDidFocusEditorWidget?.(()=>{b(v,!0)});d&&s.push(d);let p=i.onDidBlurEditorWidget?.(()=>{b(v,!1);try{t.onBlur?.(i.getValue())}catch{}});p&&s.push(p)}),j(()=>{l=!0,b(g,!1);try{u.removeEventListener(`wheel`,y,{capture:!0})}catch{}for(let e of s)try{e.dispose()}catch{}s=[],h?.dispose(),h=null;let e=o;o=null;try{if(a(n)){try{a(n).setModel(null)}catch{}a(n).dispose()}}finally{b(n,null)}try{e?.dispose()}catch{}c=null}),R(()=>{if(!a(n))return;let e=f()===`json`?`json`:f()===`markdown`?`markdown`:`plaintext`,t=a(n).getModel();if(!t||t.getLanguageId()===e)return;let r=!1;return(c?Promise.resolve(c):V(()=>import(`../chunks/CUZn05nQ.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5]),import.meta.url)).then(n=>{if(!r)try{n.editor.setModelLanguage(t,e)}catch{}}),()=>{r=!0}}),R(()=>{let e=t.value??``,r=t.highlights??[];!a(n)||!a(g)||(e!==a(n).getValue()&&a(n).setValue(e),h?.update(r))}),R(()=>{a(n)?.updateOptions({readOnly:m(),domReadOnly:m()})});var S=nn();O(S,e=>u=e,()=>u),x(()=>ee(S,`height:${p()}px`)),i(e,S),r()}var an=s(`<button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400">Fix</button>`),on=s(`<button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400">Analyze</button>`),sn=s(`<div><div class="mb-1 text-xs text-rc-gray-300"> </div> <div class="whitespace-pre-wrap break-words text-rc-gray-100"> </div></div>`),cn=s(`<div class="flex flex-col gap-3"></div>`),ln=s(`<div class="p-2 text-rc-gray-300">Loading…</div>`),un=s(`<div class="p-2 text-red-400"> </div>`),dn=s(`<div class="flex h-full flex-col gap-2"><div class="grid grid-cols-2 gap-2"><div class="flex items-center justify-start"><!></div> <div class="flex items-center justify-end"><!></div></div> <!></div>`),fn=s(`<div class="h-[55vh]"><!></div>`),pn=s(`<!> <!> <!>`,1),mn=s(`<!> <div class="mt-2 h-[55vh]"><!></div>`,1),hn=s(`<div class="mt-1 flex flex-wrap items-center gap-x-2 gap-y-1"><!> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:bg-transparent disabled:hover:text-rc-gray-400"> </button> <!> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">See variants</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Prompt</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Conversation</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Context</button> <button type="button" class="inline-flex items-center text-nowrap rounded border-0 bg-transparent px-1 py-0.5 text-rc-gray-400 transition-colors hover:bg-rc-gray-900 hover:text-rc-gray-200 focus:outline-none focus-visible:outline-none">Debug</button></div> <!> <!> <!>`,1);function gn(e,t){d(t,!0);let n=_(t,`actionsDisabled`,3,!1),o=_(t,`actionsInert`,3,!1),s=_(t,`addTestDisabled`,3,!1),p=_(t,`showAnalyze`,3,!0),m=_(t,`analyzeDisabled`,3,!1),g=_(t,`fixDisabled`,3,!1),ee=P(!1),y=P(!1),S=P(!1),C=P(`errors`),D=P(`prompt`),O=P(null),k=P(null),A=P(null),M=P(null),te=P(null),F=P(null),I=P(null),R=P(L({prompt:!1,conversation:!1,context:!1,errors:!1,traces:!1,logs:!1})),ne=P(L({prompt:null,conversation:null,context:null,errors:null,traces:null,logs:null})),re=0,V=P(null),H=null,U=P(`idle`),ie=null;function ae(e){try{return{raw:e,formatted:JSON.stringify(JSON.parse(e),null,2)}}catch{return{raw:e,formatted:e}}}async function le(e){return ae(await G.tests.resultEntry.query({agent:e.agent,testId:e.id,resultKey:e.key,timestamp:e.timestamp,index:e.run}))}function ue(e){return e===`prompt`?a(k)!==null&&a(O)!==null:e===`conversation`?a(A)!==null:e===`context`?a(M)!==null:e===`errors`?a(te)!==null:e===`traces`?a(F)!==null:a(I)!==null}async function de(e){if(ue(e)||a(R)[e])return;let n=re;b(R,{...a(R),[e]:!0},!0),b(ne,{...a(ne),[e]:null},!0);try{if(e===`prompt`){let[e,r]=await Promise.all([le(t.links.renderedPrompt),le(t.links.receivedPrompt)]);if(n!==re)return;b(O,e,!0),b(k,r,!0)}else{let r=await le(e===`conversation`?t.links.conversation:e===`context`?t.links.context:e===`errors`?t.links.errors:e===`traces`?t.links.traces:t.links.logs);if(n!==re)return;b(e===`conversation`?A:e===`context`?M:e===`errors`?te:e===`traces`?F:I,r,!0)}}catch(t){if(n!==re)return;console.error(t),b(ne,{...a(ne),[e]:`Failed to load content`},!0)}finally{n===re&&b(R,{...a(R),[e]:!1},!0)}}function fe(){b(O,null),b(k,null),b(A,null),b(M,null),b(te,null),b(F,null),b(I,null),b(R,{prompt:!1,conversation:!1,context:!1,errors:!1,traces:!1,logs:!1},!0),b(ne,{prompt:null,conversation:null,context:null,errors:null,traces:null,logs:null},!0)}function pe(){re+=1,b(C,`errors`),fe(),b(ee,!0),de(`errors`)}function K(e){re+=1,b(D,e,!0),fe(),b(y,!0),de(e)}function me(e){return e===`prompt`?`Prompt`:e===`conversation`?`Conversation`:`Context`}function ge(e){b(C,e,!0),de(e)}async function _e(){if(a(U)!==`adding`){b(U,`adding`);try{await t.onAddTest(),b(U,`added`)}catch(e){console.error(`Failed to add test`,e),b(U,`failed`)}ie&&clearTimeout(ie),ie=window.setTimeout(()=>{b(U,`idle`),ie=null},2500)}}async function ye(e){if(!(!a(k)||!a(O)))try{let t=e===`raw`?a(k).raw:a(O).raw;await navigator.clipboard.writeText(t),b(V,e,!0),H&&clearTimeout(H),H=window.setTimeout(()=>{b(V,null),H=null},2e3)}catch(e){console.error(`Failed to copy prompt`,e)}}j(()=>{re+=1,H&&clearTimeout(H),ie&&clearTimeout(ie)});var be=hn(),xe=v(be),Se=T(xe),Ce=e=>{var r=an();x(()=>{r.inert=o(),r.disabled=n()||g()}),h(`click`,r,function(...e){t.onFix?.apply(this,e)}),i(e,r)};E(Se,e=>{t.onFix&&e(Ce)});var we=N(Se,2),Te=T(we,!0);f(we);var Ee=N(we,2),De=e=>{var n=on();x(()=>n.disabled=m()),h(`click`,n,function(...e){t.onAnalyze?.apply(this,e)}),i(e,n)};E(Ee,e=>{p()&&e(De)});var Oe=N(Ee,2),ke=N(Oe,2),q=N(ke,2),Ae=N(q,2),je=N(Ae,2);f(xe);var Me=N(xe,2),Ne=e=>{{let n=e=>{var n=cn();u(n,21,()=>t.variants,e=>e.index,(e,n)=>{var r=sn(),o=T(r),s=T(o);f(o);var l=N(o,2),u=T(l,!0);f(l),f(r),x(()=>{z(r,1,`rounded-lg border p-3 ${a(n).index===t.runIndex?`border-rc-green-450`:`border-rc-gray-650`} ${a(n).success?`bg-rc-green-700/80`:`bg-rc-gray-900/60`}`),c(s,`Run ${a(n).index??``}${a(n).index===t.runIndex?` • selected`:``}`),c(u,a(n).text||a(n).errors||`—`)}),i(e,r)}),f(n),i(e,n)},r=w(()=>`Variants — ${t.scenario||`Test`}`);ce(e,{get title(){return a(r)},class:`!w-[80vw] !max-w-4xl`,get open(){return a(S)},set open(e){b(S,e,!0)},children:n,$$slots:{default:!0}})}};E(Me,e=>{a(S)&&e(Ne)});var Pe=N(Me,2),Fe=e=>{{let n=e=>{var t=fn(),n=T(t),r=e=>{var t=ln();i(e,t)},o=e=>{var t=un(),n=T(t,!0);f(t),x(()=>c(n,a(ne)[a(D)])),i(e,t)},s=e=>{var t=dn(),n=T(t),r=T(n),o=T(r);{let e=w(()=>!a(k).raw.trim());W(o,{variant:`secondary`,size:`small`,get disabled(){return a(e)},onclick:()=>ye(`raw`),children:(e,t)=>{l();var n=B();x(()=>c(n,a(V)===`raw`?`Copied raw prompt`:`Copy raw prompt`)),i(e,n)},$$slots:{default:!0}})}f(r);var s=N(r,2),u=T(s);{let e=w(()=>!a(O).raw.trim());W(u,{variant:`secondary`,size:`small`,get disabled(){return a(e)},onclick:()=>ye(`rendered`),children:(e,t)=>{l();var n=B();x(()=>c(n,a(V)===`rendered`?`Copied rendered prompt`:`Copy rendered prompt`)),i(e,n)},$$slots:{default:!0}})}f(s),f(n);var d=N(n,2);he(d,{variant:`generic`,get original(){return a(k).formatted},get modified(){return a(O).formatted},language:`markdown`,class:`min-h-0 flex-1`}),f(t),i(e,t)},u=e=>{{let t=w(()=>a(A).formatted||`—`);ve(e,{get value(){return a(t)},language:`text`,class:`h-full`})}},d=e=>{{let t=w(()=>a(M).formatted||`—`);ve(e,{get value(){return a(t)},language:`json`,class:`h-full`})}};E(n,e=>{a(R)[a(D)]?e(r):a(ne)[a(D)]?e(o,1):a(D)===`prompt`&&a(k)&&a(O)?e(s,2):a(D)===`conversation`&&a(A)?e(u,3):a(D)===`context`&&a(M)&&e(d,4)}),f(t),i(e,t)},r=w(()=>`${me(a(D))} — ${t.scenario||`Test`} (run ${t.runIndex})`);ce(e,{get title(){return a(r)},class:`!w-[85vw] !max-w-5xl`,get open(){return a(y)},set open(e){b(y,e,!0)},children:n,$$slots:{default:!0}})}};E(Pe,e=>{a(y)&&e(Fe)});var J=N(Pe,2),Ie=e=>{{let n=e=>{var t=mn(),n=v(t);oe(n,{get value(){return a(C)},ariaLabel:`Test run debug tabs`,onChange:({value:e})=>ge(e),children:(e,t)=>{var n=pn(),r=v(n);se(r,{value:`errors`,class:`px-3`,children:(e,t)=>{l();var n=B(`Errors`);i(e,n)},$$slots:{default:!0}});var a=N(r,2);se(a,{value:`traces`,class:`px-3`,children:(e,t)=>{l();var n=B(`Traces`);i(e,n)},$$slots:{default:!0}});var o=N(a,2);se(o,{value:`logs`,class:`px-3`,children:(e,t)=>{l();var n=B(`Logs`);i(e,n)},$$slots:{default:!0}}),i(e,n)},$$slots:{default:!0}});var r=N(n,2),o=T(r),s=e=>{var t=ln();i(e,t)},u=e=>{var t=un(),n=T(t,!0);f(t),x(()=>c(n,a(ne)[a(C)])),i(e,t)},d=e=>{{let t=w(()=>a(te).formatted||`—`);ve(e,{get value(){return a(t)},language:`text`,class:`h-full`})}},p=e=>{{let t=w(()=>a(F).formatted||`—`);ve(e,{get value(){return a(t)},language:`json`,class:`h-full`})}},m=e=>{{let t=w(()=>a(I).formatted||`—`);ve(e,{get value(){return a(t)},language:`text`,class:`h-full`})}};E(o,e=>{a(R)[a(C)]?e(s):a(ne)[a(C)]?e(u,1):a(C)===`errors`&&a(te)?e(d,2):a(C)===`traces`&&a(F)?e(p,3):a(C)===`logs`&&a(I)&&e(m,4)}),f(r),i(e,t)},r=w(()=>`Debug — ${t.scenario||`Test`} (run ${t.runIndex})`);ce(e,{get title(){return a(r)},class:`!w-[85vw] !max-w-5xl`,get open(){return a(ee)},set open(e){b(ee,e,!0)},children:n,$$slots:{default:!0}})}};E(J,e=>{a(ee)&&e(Ie)}),x(()=>{we.inert=o(),we.disabled=n()||s()||a(U)===`adding`,c(Te,a(U)===`adding`?`Adding…`:a(U)===`added`?`Added`:a(U)===`failed`?`Failed`:`Add test`)}),h(`click`,we,_e),h(`click`,Oe,()=>b(S,!0)),h(`click`,ke,()=>K(`prompt`)),h(`click`,q,()=>K(`conversation`)),h(`click`,Ae,()=>K(`context`)),h(`click`,je,pe),i(e,be),r()}t([`click`]);var _n=`Update the conversation history so it reflects behaviour that is valid under the current prompt. Preserve the test's intent and expected outcome, and make only the smallest necessary changes. Possible roles: "Agent", "User", "System"`;function vn(e,t){return[e.trim()===`LLM`?``:e.trim(),t.trim()].filter(Boolean).join(` `)}function yn(e){let t=vn(e.assertionLabel,e.assertionValue);return`You will be given the context, the conversation and the desired output and assertion about it. First, find why the prompt is not producing the correct result. It's usually one concrete instruction within the relevant section, or a contradiction. Then, change the prompt minimally so this will work, but keeping the prompt clean and comprehensive is more important. Try to provide as general solution as possible. Try to change just one part of the prompt, not multiple parts. Avoid adding exceptions and overrides. Avoid duplicating information that already exists in the prompt.
|
|
3
3
|
|
|
4
4
|
Context:
|
|
5
5
|
${e.context.trim()}
|
|
Binary file
|
|
Binary file
|
package/build/_app/version.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"
|
|
1
|
+
{"version":"1789652145769"}
|
|
Binary file
|
|
Binary file
|
package/build/index.html
CHANGED
|
@@ -4,35 +4,35 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<link rel="icon" href="/favicon.png" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
7
|
-
<link href="/_app/immutable/entry/start.
|
|
8
|
-
<link href="/_app/immutable/chunks/
|
|
7
|
+
<link href="/_app/immutable/entry/start.CGCxa4r9.js" rel="modulepreload">
|
|
8
|
+
<link href="/_app/immutable/chunks/Bmkwccsg.js" rel="modulepreload">
|
|
9
9
|
<link href="/_app/immutable/chunks/CPCsWwEy.js" rel="modulepreload">
|
|
10
10
|
<link href="/_app/immutable/chunks/hePW80VL.js" rel="modulepreload">
|
|
11
11
|
<link href="/_app/immutable/chunks/Dt-HX3Vu.js" rel="modulepreload">
|
|
12
12
|
<link href="/_app/immutable/chunks/AvXp07rr.js" rel="modulepreload">
|
|
13
|
-
<link href="/_app/immutable/entry/app.
|
|
13
|
+
<link href="/_app/immutable/entry/app.L5djN6KO.js" rel="modulepreload">
|
|
14
14
|
<link href="/_app/immutable/chunks/HclGiUj8.js" rel="modulepreload">
|
|
15
15
|
<link href="/_app/immutable/chunks/xihTtKlq.js" rel="modulepreload">
|
|
16
|
-
<link href="/_app/immutable/nodes/0.
|
|
16
|
+
<link href="/_app/immutable/nodes/0.DxT2ZCBH.js" rel="modulepreload">
|
|
17
17
|
<link href="/_app/immutable/chunks/DDZ8GqHh.js" rel="modulepreload">
|
|
18
|
-
<link href="/_app/immutable/chunks/
|
|
19
|
-
<link href="/_app/immutable/chunks/
|
|
18
|
+
<link href="/_app/immutable/chunks/BFUe72xu.js" rel="modulepreload">
|
|
19
|
+
<link href="/_app/immutable/chunks/CZcJNBdK.js" rel="modulepreload">
|
|
20
20
|
|
|
21
|
-
<link href="/_app/immutable/assets/0.
|
|
21
|
+
<link href="/_app/immutable/assets/0.CdQBFG7k.css" rel="stylesheet">
|
|
22
22
|
</head>
|
|
23
23
|
<body data-sveltekit-preload-data="hover">
|
|
24
24
|
<div style="display: contents">
|
|
25
25
|
<script>
|
|
26
26
|
{
|
|
27
|
-
|
|
27
|
+
__sveltekit_m0k6gr = {
|
|
28
28
|
base: ""
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
const element = document.currentScript.parentElement;
|
|
32
32
|
|
|
33
33
|
Promise.all([
|
|
34
|
-
import("/_app/immutable/entry/start.
|
|
35
|
-
import("/_app/immutable/entry/app.
|
|
34
|
+
import("/_app/immutable/entry/start.CGCxa4r9.js"),
|
|
35
|
+
import("/_app/immutable/entry/app.L5djN6KO.js")
|
|
36
36
|
]).then(([kit, app]) => {
|
|
37
37
|
kit.start(app, element);
|
|
38
38
|
});
|
package/build/index.html.br
CHANGED
|
Binary file
|
package/build/index.html.gz
CHANGED
|
Binary file
|
package/dist/index.js
CHANGED
|
@@ -4521,16 +4521,28 @@ var PaginatedConversationsResponseSchema = z10.object({
|
|
|
4521
4521
|
lastConversationId: z10.string().optional()
|
|
4522
4522
|
});
|
|
4523
4523
|
var AnalyticsScalarSchema = z10.union([z10.boolean(), z10.number(), z10.string()]);
|
|
4524
|
+
var AnalyticsFieldNameSchema = z10.string().regex(/^[A-Za-z0-9_.:-]{1,128}$/);
|
|
4525
|
+
var AnalyticsFieldValueSchema = z10.object({
|
|
4526
|
+
value: AnalyticsScalarSchema,
|
|
4527
|
+
count: z10.number().int().nonnegative()
|
|
4528
|
+
});
|
|
4529
|
+
var AnalyticsFieldMetadataSchema = z10.object({
|
|
4530
|
+
field: AnalyticsFieldNameSchema,
|
|
4531
|
+
type: z10.enum(["boolean", "number", "string"]),
|
|
4532
|
+
distinctValueCount: z10.number().int().nonnegative()
|
|
4533
|
+
});
|
|
4534
|
+
var AnalyticsFieldMetadataResponseSchema = z10.object({
|
|
4535
|
+
items: z10.array(AnalyticsFieldMetadataSchema)
|
|
4536
|
+
});
|
|
4537
|
+
var AnalyticsFieldValuesResponseSchema = z10.object({
|
|
4538
|
+
items: z10.array(AnalyticsFieldValueSchema),
|
|
4539
|
+
nextCursor: z10.string().nullable()
|
|
4540
|
+
});
|
|
4524
4541
|
var AnalyticsFieldSchema = z10.object({
|
|
4525
4542
|
key: z10.string(),
|
|
4526
4543
|
type: z10.enum(["boolean", "number", "string"]),
|
|
4527
4544
|
variantCount: z10.number(),
|
|
4528
|
-
values: z10.array(
|
|
4529
|
-
z10.object({
|
|
4530
|
-
value: AnalyticsScalarSchema,
|
|
4531
|
-
count: z10.number()
|
|
4532
|
-
})
|
|
4533
|
-
)
|
|
4545
|
+
values: z10.array(AnalyticsFieldValueSchema)
|
|
4534
4546
|
});
|
|
4535
4547
|
var AnalyticsFieldsResponseSchema = z10.object({
|
|
4536
4548
|
items: z10.array(AnalyticsFieldSchema)
|
|
@@ -4618,8 +4630,9 @@ var PaginatedLatencyTracesResponseSchema = z10.object({
|
|
|
4618
4630
|
var SourceIdSchema = z11.string().trim().max(128).optional();
|
|
4619
4631
|
var ConversationIdSchema3 = z11.string().trim().min(1).max(256);
|
|
4620
4632
|
var LimitSchema = z11.number().int().positive().max(1e3).optional();
|
|
4633
|
+
var ANALYTICS_FIELD_VALUE_LIMIT = 50;
|
|
4621
4634
|
var AnalyticsFilterSchema = z11.object({
|
|
4622
|
-
key:
|
|
4635
|
+
key: AnalyticsFieldNameSchema,
|
|
4623
4636
|
type: z11.enum(["boolean", "number", "string"]),
|
|
4624
4637
|
values: z11.array(AnalyticsScalarSchema).min(1)
|
|
4625
4638
|
});
|
|
@@ -4642,6 +4655,32 @@ function pageSearch(limit, lastTraceId) {
|
|
|
4642
4655
|
if (lastTraceId) search.set("lastTraceId", lastTraceId);
|
|
4643
4656
|
return search;
|
|
4644
4657
|
}
|
|
4658
|
+
function serializeAnalyticsFilters(filters) {
|
|
4659
|
+
return JSON.stringify(filters.map(({ key, values }) => ({ field: key, operator: "in", values })));
|
|
4660
|
+
}
|
|
4661
|
+
async function loadAnalyticsField(ctx, sourceId, agentId, field) {
|
|
4662
|
+
let variantCount = field.distinctValueCount;
|
|
4663
|
+
let values = [];
|
|
4664
|
+
if (variantCount <= ANALYTICS_FIELD_VALUE_LIMIT) {
|
|
4665
|
+
const response = await get(ctx, {
|
|
4666
|
+
sourceId,
|
|
4667
|
+
path: `analytics/fields/${encodeURIComponent(field.field)}/values`,
|
|
4668
|
+
search: new URLSearchParams({
|
|
4669
|
+
agentId,
|
|
4670
|
+
limit: String(ANALYTICS_FIELD_VALUE_LIMIT)
|
|
4671
|
+
}),
|
|
4672
|
+
schema: AnalyticsFieldValuesResponseSchema
|
|
4673
|
+
});
|
|
4674
|
+
if (response.nextCursor) variantCount = ANALYTICS_FIELD_VALUE_LIMIT + 1;
|
|
4675
|
+
else values = response.items;
|
|
4676
|
+
}
|
|
4677
|
+
return {
|
|
4678
|
+
key: field.field,
|
|
4679
|
+
type: field.type,
|
|
4680
|
+
variantCount,
|
|
4681
|
+
values
|
|
4682
|
+
};
|
|
4683
|
+
}
|
|
4645
4684
|
function createTelescopeRouter(t2) {
|
|
4646
4685
|
return t2.router({
|
|
4647
4686
|
sources: t2.procedure.query(
|
|
@@ -4655,6 +4694,9 @@ function createTelescopeRouter(t2) {
|
|
|
4655
4694
|
phoneNumber: z11.string().trim().min(1).optional(),
|
|
4656
4695
|
agentId: z11.string().trim().min(1).optional(),
|
|
4657
4696
|
analyticsFilters: z11.array(AnalyticsFilterSchema).optional()
|
|
4697
|
+
}).refine((input) => !input.analyticsFilters?.length || input.agentId, {
|
|
4698
|
+
message: "agentId is required when analytics filters are set",
|
|
4699
|
+
path: ["agentId"]
|
|
4658
4700
|
})
|
|
4659
4701
|
).query(async ({ input, ctx }) => {
|
|
4660
4702
|
const search = new URLSearchParams({ limit: String(input.limit ?? 10) });
|
|
@@ -4662,10 +4704,7 @@ function createTelescopeRouter(t2) {
|
|
|
4662
4704
|
if (input.phoneNumber) search.set("phoneNumber", input.phoneNumber);
|
|
4663
4705
|
if (input.agentId) search.set("agentId", input.agentId);
|
|
4664
4706
|
if (input.analyticsFilters?.length) {
|
|
4665
|
-
search.set(
|
|
4666
|
-
"filters",
|
|
4667
|
-
JSON.stringify(input.analyticsFilters.map((filter) => ({ ...filter, operator: "in" })))
|
|
4668
|
-
);
|
|
4707
|
+
search.set("filters", serializeAnalyticsFilters(input.analyticsFilters));
|
|
4669
4708
|
}
|
|
4670
4709
|
const page = await get(ctx, {
|
|
4671
4710
|
sourceId: input.sourceId,
|
|
@@ -4682,15 +4721,20 @@ function createTelescopeRouter(t2) {
|
|
|
4682
4721
|
}))
|
|
4683
4722
|
};
|
|
4684
4723
|
}),
|
|
4685
|
-
analyticsFields: t2.procedure.input(z11.object({ sourceId: SourceIdSchema, agentId: z11.string().trim().min(1)
|
|
4686
|
-
const
|
|
4687
|
-
if (input.agentId) search.set("agentId", input.agentId);
|
|
4688
|
-
return get(ctx, {
|
|
4724
|
+
analyticsFields: t2.procedure.input(z11.object({ sourceId: SourceIdSchema, agentId: z11.string().trim().min(1) })).query(async ({ input, ctx }) => {
|
|
4725
|
+
const response = await get(ctx, {
|
|
4689
4726
|
sourceId: input.sourceId,
|
|
4690
4727
|
path: "analytics/fields",
|
|
4691
|
-
search,
|
|
4692
|
-
schema:
|
|
4728
|
+
search: new URLSearchParams({ agentId: input.agentId }),
|
|
4729
|
+
schema: AnalyticsFieldMetadataResponseSchema
|
|
4693
4730
|
});
|
|
4731
|
+
return {
|
|
4732
|
+
items: await Promise.all(
|
|
4733
|
+
response.items.map(
|
|
4734
|
+
(field) => loadAnalyticsField(ctx, input.sourceId, input.agentId, field)
|
|
4735
|
+
)
|
|
4736
|
+
)
|
|
4737
|
+
};
|
|
4694
4738
|
}),
|
|
4695
4739
|
conversation: t2.procedure.input(z11.object({ sourceId: SourceIdSchema, conversationId: ConversationIdSchema3 })).query(
|
|
4696
4740
|
({ input, ctx }) => get(ctx, {
|