@recombine-ai/bosun 0.20.3 → 0.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/build/_app/immutable/assets/{0.CdQBFG7k.css → 0.BaQKRsv_.css} +1 -1
  2. package/build/_app/immutable/assets/0.BaQKRsv_.css.br +0 -0
  3. package/build/_app/immutable/assets/{0.CdQBFG7k.css.gz → 0.BaQKRsv_.css.gz} +0 -0
  4. package/build/_app/immutable/chunks/{Bmkwccsg.js → BaUo4AYS.js} +1 -1
  5. package/build/_app/immutable/chunks/BaUo4AYS.js.br +0 -0
  6. package/build/_app/immutable/chunks/BaUo4AYS.js.gz +0 -0
  7. package/build/_app/immutable/chunks/{DdNCOsWe.js → C9p6yGAG.js} +1 -1
  8. package/build/_app/immutable/chunks/C9p6yGAG.js.br +0 -0
  9. package/build/_app/immutable/chunks/{DdNCOsWe.js.gz → C9p6yGAG.js.gz} +0 -0
  10. package/build/_app/immutable/chunks/C_lx-sL6.js +1 -0
  11. package/build/_app/immutable/chunks/C_lx-sL6.js.br +2 -0
  12. package/build/_app/immutable/chunks/C_lx-sL6.js.gz +0 -0
  13. package/build/_app/immutable/chunks/{BFUe72xu.js → CaUCcDHI.js} +1 -1
  14. package/build/_app/immutable/chunks/CaUCcDHI.js.br +1 -0
  15. package/build/_app/immutable/chunks/CaUCcDHI.js.gz +0 -0
  16. package/build/_app/immutable/entry/{app.L5djN6KO.js → app.CxRWmgCQ.js} +2 -2
  17. package/build/_app/immutable/entry/app.CxRWmgCQ.js.br +0 -0
  18. package/build/_app/immutable/entry/app.CxRWmgCQ.js.gz +0 -0
  19. package/build/_app/immutable/entry/start.By8y392C.js +1 -0
  20. package/build/_app/immutable/entry/start.By8y392C.js.br +1 -0
  21. package/build/_app/immutable/entry/start.By8y392C.js.gz +0 -0
  22. package/build/_app/immutable/nodes/{0.DxT2ZCBH.js → 0.BTXrMtNp.js} +1 -1
  23. package/build/_app/immutable/nodes/0.BTXrMtNp.js.br +0 -0
  24. package/build/_app/immutable/nodes/0.BTXrMtNp.js.gz +0 -0
  25. package/build/_app/immutable/nodes/{1.CuGmyB-B.js → 1.Jfuz02fG.js} +1 -1
  26. package/build/_app/immutable/nodes/1.Jfuz02fG.js.br +2 -0
  27. package/build/_app/immutable/nodes/1.Jfuz02fG.js.gz +0 -0
  28. package/build/_app/immutable/nodes/{16.RilBjs7p.js → 16.BfX5703e.js} +1 -1
  29. package/build/_app/immutable/nodes/16.BfX5703e.js.br +0 -0
  30. package/build/_app/immutable/nodes/16.BfX5703e.js.gz +0 -0
  31. package/build/_app/immutable/nodes/17.DOR5yQVm.js +2 -0
  32. package/build/_app/immutable/nodes/17.DOR5yQVm.js.br +0 -0
  33. package/build/_app/immutable/nodes/17.DOR5yQVm.js.gz +0 -0
  34. package/build/_app/immutable/nodes/{17.lZCHazN-.js → 18.KIU8tKM7.js} +3 -3
  35. package/build/_app/immutable/nodes/18.KIU8tKM7.js.br +0 -0
  36. package/build/_app/immutable/nodes/18.KIU8tKM7.js.gz +0 -0
  37. package/build/_app/immutable/nodes/{2.47DRuv-7.js → 2.wEp5zss5.js} +2 -2
  38. package/build/_app/immutable/nodes/2.wEp5zss5.js.br +0 -0
  39. package/build/_app/immutable/nodes/2.wEp5zss5.js.gz +0 -0
  40. package/build/_app/immutable/nodes/3.DWCLBLue.js +1 -0
  41. package/build/_app/immutable/nodes/3.DWCLBLue.js.br +0 -0
  42. package/build/_app/immutable/nodes/3.DWCLBLue.js.gz +0 -0
  43. package/build/_app/immutable/nodes/4.DRyEBVph.js +1 -0
  44. package/build/_app/immutable/nodes/4.DRyEBVph.js.br +0 -0
  45. package/build/_app/immutable/nodes/4.DRyEBVph.js.gz +0 -0
  46. package/build/_app/immutable/nodes/{6.C7VHMxJG.js → 6.DxbD8svh.js} +1 -1
  47. package/build/_app/immutable/nodes/6.DxbD8svh.js.br +0 -0
  48. package/build/_app/immutable/nodes/6.DxbD8svh.js.gz +0 -0
  49. package/build/_app/immutable/nodes/8.BESB58-w.js +2 -0
  50. package/build/_app/immutable/nodes/8.BESB58-w.js.br +0 -0
  51. package/build/_app/immutable/nodes/8.BESB58-w.js.gz +0 -0
  52. package/build/_app/immutable/nodes/{9.DGHLzn6-.js → 9.CBINh_ET.js} +1 -1
  53. package/build/_app/immutable/nodes/9.CBINh_ET.js.br +0 -0
  54. package/build/_app/immutable/nodes/9.CBINh_ET.js.gz +0 -0
  55. package/build/_app/version.json +1 -1
  56. package/build/_app/version.json.br +0 -0
  57. package/build/_app/version.json.gz +0 -0
  58. package/build/index.html +10 -10
  59. package/build/index.html.br +0 -0
  60. package/build/index.html.gz +0 -0
  61. package/dist/index.js +25 -6
  62. package/dist/index.js.map +2 -2
  63. package/dist/types/backend/roleplay/conversation-store.d.ts +3 -2
  64. package/dist/types/backend/roleplay/router.d.ts +1 -1
  65. package/dist/types/backend/roleplay/variants.d.ts +1 -1
  66. package/dist/types/backend/server.d.ts +5 -5
  67. package/dist/types/backend/tests/router.d.ts +4 -4
  68. package/dist/types/lib/conversation.d.ts +3 -1
  69. package/dist/types/lib/tests/pii-sanitized-test-draft.d.ts +1 -1
  70. package/package.json +5 -5
  71. package/build/_app/immutable/assets/0.CdQBFG7k.css.br +0 -0
  72. package/build/_app/immutable/chunks/BFUe72xu.js.br +0 -0
  73. package/build/_app/immutable/chunks/BFUe72xu.js.gz +0 -0
  74. package/build/_app/immutable/chunks/Bmkwccsg.js.br +0 -0
  75. package/build/_app/immutable/chunks/Bmkwccsg.js.gz +0 -0
  76. package/build/_app/immutable/chunks/CZcJNBdK.js +0 -1
  77. package/build/_app/immutable/chunks/CZcJNBdK.js.br +0 -2
  78. package/build/_app/immutable/chunks/CZcJNBdK.js.gz +0 -0
  79. package/build/_app/immutable/chunks/DdNCOsWe.js.br +0 -0
  80. package/build/_app/immutable/entry/app.L5djN6KO.js.br +0 -0
  81. package/build/_app/immutable/entry/app.L5djN6KO.js.gz +0 -0
  82. package/build/_app/immutable/entry/start.CGCxa4r9.js +0 -1
  83. package/build/_app/immutable/entry/start.CGCxa4r9.js.br +0 -0
  84. package/build/_app/immutable/entry/start.CGCxa4r9.js.gz +0 -0
  85. package/build/_app/immutable/nodes/0.DxT2ZCBH.js.br +0 -0
  86. package/build/_app/immutable/nodes/0.DxT2ZCBH.js.gz +0 -0
  87. package/build/_app/immutable/nodes/1.CuGmyB-B.js.br +0 -2
  88. package/build/_app/immutable/nodes/1.CuGmyB-B.js.gz +0 -0
  89. package/build/_app/immutable/nodes/16.RilBjs7p.js.br +0 -0
  90. package/build/_app/immutable/nodes/16.RilBjs7p.js.gz +0 -0
  91. package/build/_app/immutable/nodes/17.lZCHazN-.js.br +0 -0
  92. package/build/_app/immutable/nodes/17.lZCHazN-.js.gz +0 -0
  93. package/build/_app/immutable/nodes/2.47DRuv-7.js.br +0 -0
  94. package/build/_app/immutable/nodes/2.47DRuv-7.js.gz +0 -0
  95. package/build/_app/immutable/nodes/3.BTFj2TcK.js +0 -1
  96. package/build/_app/immutable/nodes/3.BTFj2TcK.js.br +0 -0
  97. package/build/_app/immutable/nodes/3.BTFj2TcK.js.gz +0 -0
  98. package/build/_app/immutable/nodes/4.D7rKFBIq.js +0 -1
  99. package/build/_app/immutable/nodes/4.D7rKFBIq.js.br +0 -0
  100. package/build/_app/immutable/nodes/4.D7rKFBIq.js.gz +0 -0
  101. package/build/_app/immutable/nodes/6.C7VHMxJG.js.br +0 -0
  102. package/build/_app/immutable/nodes/6.C7VHMxJG.js.gz +0 -0
  103. package/build/_app/immutable/nodes/8.B-2mfKlr.js +0 -2
  104. package/build/_app/immutable/nodes/8.B-2mfKlr.js.br +0 -0
  105. package/build/_app/immutable/nodes/8.B-2mfKlr.js.gz +0 -0
  106. package/build/_app/immutable/nodes/9.DGHLzn6-.js.br +0 -0
  107. package/build/_app/immutable/nodes/9.DGHLzn6-.js.gz +0 -0
  108. /package/build/_app/immutable/assets/{17.BR6pkKJY.css → 18.BR6pkKJY.css} +0 -0
  109. /package/build/_app/immutable/assets/{17.BR6pkKJY.css.br → 18.BR6pkKJY.css.br} +0 -0
  110. /package/build/_app/immutable/assets/{17.BR6pkKJY.css.gz → 18.BR6pkKJY.css.gz} +0 -0
@@ -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/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.
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/CaUCcDHI.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()}
@@ -1 +1 @@
1
- {"version":"1789652145769"}
1
+ {"version":"1789817609356"}
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.CGCxa4r9.js" rel="modulepreload">
8
- <link href="/_app/immutable/chunks/Bmkwccsg.js" rel="modulepreload">
7
+ <link href="/_app/immutable/entry/start.By8y392C.js" rel="modulepreload">
8
+ <link href="/_app/immutable/chunks/BaUo4AYS.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.L5djN6KO.js" rel="modulepreload">
13
+ <link href="/_app/immutable/entry/app.CxRWmgCQ.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.DxT2ZCBH.js" rel="modulepreload">
16
+ <link href="/_app/immutable/nodes/0.BTXrMtNp.js" rel="modulepreload">
17
17
  <link href="/_app/immutable/chunks/DDZ8GqHh.js" rel="modulepreload">
18
- <link href="/_app/immutable/chunks/BFUe72xu.js" rel="modulepreload">
19
- <link href="/_app/immutable/chunks/CZcJNBdK.js" rel="modulepreload">
18
+ <link href="/_app/immutable/chunks/CaUCcDHI.js" rel="modulepreload">
19
+ <link href="/_app/immutable/chunks/C_lx-sL6.js" rel="modulepreload">
20
20
 
21
- <link href="/_app/immutable/assets/0.CdQBFG7k.css" rel="stylesheet">
21
+ <link href="/_app/immutable/assets/0.BaQKRsv_.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
- __sveltekit_m0k6gr = {
27
+ __sveltekit_r7dhmb = {
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.CGCxa4r9.js"),
35
- import("/_app/immutable/entry/app.L5djN6KO.js")
34
+ import("/_app/immutable/entry/start.By8y392C.js"),
35
+ import("/_app/immutable/entry/app.CxRWmgCQ.js")
36
36
  ]).then(([kit, app]) => {
37
37
  kit.start(app, element);
38
38
  });
Binary file
Binary file
package/dist/index.js CHANGED
@@ -146,6 +146,12 @@ function messageSummary(message) {
146
146
  function lastTurn(conversation) {
147
147
  return conversation.entries.at(-1)?.turn ?? 0;
148
148
  }
149
+ function turnStartContext(entries, turn) {
150
+ for (const entry of entries) {
151
+ if (entry.turn === turn && entry.kind === "context") return entry.payload;
152
+ }
153
+ return null;
154
+ }
149
155
  function conversationMessages(conversation) {
150
156
  return conversation.entries.filter((entry) => entry.kind === "message").map((entry) => entry.payload);
151
157
  }
@@ -222,6 +228,8 @@ async function truncateConversation(ctx, conversationId, fromTurn) {
222
228
  const conversation = await loadConversation(ctx, conversationId);
223
229
  const dropped = conversation.entries.filter((entry) => entry.turn >= fromTurn);
224
230
  conversation.entries = conversation.entries.filter((entry) => entry.turn < fromTurn);
231
+ const startContext = turnStartContext(dropped, fromTurn);
232
+ if (startContext) conversation.context = startContext;
225
233
  await saveConversation(ctx, conversation);
226
234
  const inbound = dropped.find(
227
235
  (entry) => entry.kind === "message" && (entry.payload.sender === "user" || entry.payload.sender === "system")
@@ -521,6 +529,7 @@ async function runTurn(bosun, input) {
521
529
  isTest: false
522
530
  }
523
531
  });
532
+ push("context", normalizeTracePayload(ctx.get() ?? {}));
524
533
  if (input.message) {
525
534
  push("message", input.message);
526
535
  push("conversational-trace", {
@@ -557,6 +566,9 @@ async function runTurn(bosun, input) {
557
566
  await agent.onCallEnd();
558
567
  break;
559
568
  }
569
+ if (isVoiceAgent(agent)) {
570
+ await agent.waitForIdle();
571
+ }
560
572
  conversation.context = ctx.get() ?? {};
561
573
  return conversation;
562
574
  }
@@ -1946,15 +1958,16 @@ async function generateReplyVariants(ctx, props) {
1946
1958
  );
1947
1959
  if (!inbound) throw new Error("Could not reconstruct the input message for variants");
1948
1960
  const history = conversation.entries.filter((entry) => entry.turn < turn);
1961
+ const startContext = turnStartContext(conversation.entries, turn);
1949
1962
  return Promise.all(
1950
1963
  Array.from({ length: count }, async (_, index) => {
1951
1964
  const draft = {
1952
1965
  ...conversation,
1953
- context: props.context ?? conversation.context,
1966
+ context: structuredClone(startContext ?? conversation.context),
1954
1967
  entries: structuredClone(history)
1955
1968
  };
1956
1969
  const produced = [];
1957
- await runTurn(ctx, {
1970
+ const result = await runTurn(ctx, {
1958
1971
  conversation: draft,
1959
1972
  kind: "message",
1960
1973
  message: inbound.payload,
@@ -1964,7 +1977,8 @@ async function generateReplyVariants(ctx, props) {
1964
1977
  return {
1965
1978
  id: `variant-${index + 1}`,
1966
1979
  text: agentReplyText(produced),
1967
- entries: produced
1980
+ entries: produced,
1981
+ context: result.context
1968
1982
  };
1969
1983
  })
1970
1984
  );
@@ -2730,7 +2744,6 @@ function createRolePlayRouter(t2) {
2730
2744
  generateVariants: t2.procedure.input(
2731
2745
  z4.object({
2732
2746
  conversationId: ConversationIdSchema,
2733
- context: z4.record(z4.string(), z4.unknown()).nullable().optional(),
2734
2747
  promptOverrides: z4.record(z4.string(), z4.string().max(1e6)).optional(),
2735
2748
  count: z4.number().int().min(1).max(9).default(9)
2736
2749
  })
@@ -2739,11 +2752,16 @@ function createRolePlayRouter(t2) {
2739
2752
  return generateReplyVariants(ctx, {
2740
2753
  conversation,
2741
2754
  count: input.count,
2742
- context: input.context ?? void 0,
2743
2755
  promptOverrides: input.promptOverrides ?? {}
2744
2756
  });
2745
2757
  }),
2746
- commitVariant: write.input(z4.object({ conversationId: ConversationIdSchema, entries: z4.array(z4.any()) })).mutation(async ({ input, ctx }) => {
2758
+ commitVariant: write.input(
2759
+ z4.object({
2760
+ conversationId: ConversationIdSchema,
2761
+ entries: z4.array(z4.any()),
2762
+ context: z4.record(z4.string(), z4.unknown())
2763
+ })
2764
+ ).mutation(async ({ input, ctx }) => {
2747
2765
  const conversation = await loadConversation(ctx, input.conversationId);
2748
2766
  const turn = lastTurn(conversation);
2749
2767
  if (!turn) throw new Error("This conversation has no reply to replace");
@@ -2753,6 +2771,7 @@ function createRolePlayRouter(t2) {
2753
2771
  turn
2754
2772
  );
2755
2773
  truncated.entries.push(...input.entries);
2774
+ truncated.context = input.context;
2756
2775
  await saveConversation(ctx, truncated);
2757
2776
  return { ok: true };
2758
2777
  }),